diff --git a/cmd/qcloud-exporter/qcloud_exporter.go b/cmd/qcloud-exporter/qcloud_exporter.go
new file mode 100644
index 0000000..4756278
--- /dev/null
+++ b/cmd/qcloud-exporter/qcloud_exporter.go
@@ -0,0 +1,119 @@
+package main
+
+import (
+ "fmt"
+ "github.com/go-kit/kit/log"
+ "github.com/go-kit/kit/log/level"
+ "github.com/prometheus/client_golang/prometheus"
+ "github.com/prometheus/client_golang/prometheus/promhttp"
+ "github.com/prometheus/common/promlog"
+ "github.com/prometheus/common/promlog/flag"
+ "github.com/prometheus/common/version"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/collector"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/config"
+ kingpin "gopkg.in/alecthomas/kingpin.v2"
+ "net/http"
+ "os"
+)
+
+func newHandler(c *config.TencentConfig, includeExporterMetrics bool, maxRequests int, logger log.Logger) (*http.Handler, error) {
+ exporterMetricsRegistry := prometheus.NewRegistry()
+ if includeExporterMetrics {
+ exporterMetricsRegistry.MustRegister(
+ prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{}),
+ prometheus.NewGoCollector(),
+ )
+ }
+
+ nc, err := collector.NewTcMonitorCollector(c, logger)
+ if err != nil {
+ return nil, fmt.Errorf("couldn't create collector: %s", err)
+ }
+ r := prometheus.NewRegistry()
+ r.MustRegister(version.NewCollector("qcloud_exporter"))
+ if err := r.Register(nc); err != nil {
+ return nil, fmt.Errorf("couldn't register tencent cloud monitor collector: %s", err)
+ }
+
+ handler := promhttp.HandlerFor(
+ prometheus.Gatherers{exporterMetricsRegistry, r},
+ promhttp.HandlerOpts{
+ ErrorHandling: promhttp.ContinueOnError,
+ MaxRequestsInFlight: maxRequests,
+ Registry: exporterMetricsRegistry,
+ },
+ )
+ if includeExporterMetrics {
+ handler = promhttp.InstrumentMetricHandler(
+ exporterMetricsRegistry, handler,
+ )
+ }
+ return &handler, nil
+
+}
+
+func main() {
+ var (
+ listenAddress = kingpin.Flag(
+ "web.listen-address",
+ "Address on which to expose metrics and web interface.",
+ ).Default(":9123").String()
+ metricsPath = kingpin.Flag(
+ "web.telemetry-path",
+ "Path under which to expose metrics.",
+ ).Default("/metrics").String()
+ enableExporterMetrics = kingpin.Flag(
+ "web.enable-exporter-metrics",
+ "Include metrics about the exporter itself (promhttp_*, process_*, go_*).",
+ ).Default("false").Bool()
+ maxRequests = kingpin.Flag(
+ "web.max-requests",
+ "Maximum number of parallel scrape requests. Use 0 to disable.",
+ ).Default("0").Int()
+ configFile = kingpin.Flag(
+ "config.file", "Tencent qcloud exporter configuration file.",
+ ).Default("qcloud.yml").String()
+ )
+
+ promlogConfig := &promlog.Config{}
+ flag.AddFlags(kingpin.CommandLine, promlogConfig)
+ kingpin.Version(version.Print("qcloud_exporter"))
+ kingpin.HelpFlag.Short('h')
+ kingpin.Parse()
+ logger := promlog.New(promlogConfig)
+
+ level.Info(logger).Log("msg", "Starting qcloud_exporter", "version", version.Info())
+ level.Info(logger).Log("msg", "Build context", "build_context", version.BuildContext())
+
+ tencentConfig := config.NewConfig()
+ if err := tencentConfig.LoadFile(*configFile); err != nil {
+ level.Error(logger).Log("msg", "Load config error", "err", err)
+ os.Exit(1)
+ } else {
+ level.Info(logger).Log("msg", "Load config ok")
+ }
+
+ handler, err := newHandler(tencentConfig, *enableExporterMetrics, *maxRequests, logger)
+ if err != nil {
+ level.Error(logger).Log("msg", "Create handler fail", "err", err)
+ os.Exit(1)
+ }
+
+ http.Handle(*metricsPath, *handler)
+ http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
+ w.Write([]byte(`
+
QCloud Exporter
+
+ QCloud Exporter
+ Metrics
+
+ `))
+ })
+
+ level.Info(logger).Log("msg", "Listening on", "address", *listenAddress)
+ err = http.ListenAndServe(*listenAddress, nil)
+ if err != nil {
+ level.Error(logger).Log("err", err)
+ os.Exit(1)
+ }
+}
diff --git a/collector/collector.go b/collector/collector.go
deleted file mode 100644
index 0a2869e..0000000
--- a/collector/collector.go
+++ /dev/null
@@ -1,210 +0,0 @@
-package collector
-
-import (
- "fmt"
- "sort"
- "strings"
- "sync"
-
- "github.com/tencentyun/tencentcloud-exporter/config"
- "github.com/tencentyun/tencentcloud-exporter/instances"
- "github.com/tencentyun/tencentcloud-exporter/monitor"
-
- "github.com/prometheus/client_golang/prometheus"
- "github.com/prometheus/common/log"
-)
-
-type MetricReuseDesc struct {
- metricName string
- metricLabels []string
- desc *prometheus.Desc
-}
-
-type Collector struct {
- locker sync.Mutex
- /*Looking at indicator data from an overview perspective*/
- overviewMetrics []*OverviewMetric
-
- /*Look at index data from multidimensional perspective*/
- specialDimensionMetrics []*SpecailMetric
-
- allMetricConfig []config.TencentMetric
-
- /*Reuse desc and detect duplicates*/
- allPromDesc map[string]*MetricReuseDesc
-
- sdkErrorDesc *prometheus.Desc
- sdkErrors map[string]int64
-}
-
-func NewCollector(allMetricConfig []config.TencentMetric) (ret *Collector, errRet error) {
- ret = &Collector{}
-
- ret.overviewMetrics = make([]*OverviewMetric, 0, len(allMetricConfig))
- ret.specialDimensionMetrics = make([]*SpecailMetric, 0, len(allMetricConfig))
- ret.allPromDesc = make(map[string]*MetricReuseDesc)
-
- ret.allMetricConfig = allMetricConfig
-
- if errRet = ret.checkConfig(); errRet != nil {
- return
- }
- ret.sdkErrorDesc = prometheus.NewDesc(sdkErrorReportMetricName, "Error fom sdk error", []string{"product"}, nil)
- ret.sdkErrors = make(map[string]int64)
- for _, metricConfig := range allMetricConfig {
-
- if len(metricConfig.Dimensions) == 0 {
- metric, err := NewOverviewMetric(metricConfig, ret)
- if err != nil {
- errRet = err
- return
- }
-
- ret.overviewMetrics = append(ret.overviewMetrics, metric)
- } else {
- metric, err := NewSpecailMetric(metricConfig, ret)
- if err != nil {
- errRet = err
- return
- }
-
- ret.specialDimensionMetrics = append(ret.specialDimensionMetrics, metric)
- }
-
- }
-
- return
-}
-
-func (me *Collector) getExistedDesc(promMetric string, labels []string) (desc *prometheus.Desc, errRet error) {
- temp := labels[:]
- sort.Strings(temp)
- saved := me.allPromDesc[promMetric]
- if saved == nil {
- return
- }
- if strings.Join(saved.metricLabels, "#") == strings.Join(temp, "#") {
- log.Debugf("prometheus metric desc reuse %s with labels %+v", promMetric, temp)
- desc = saved.desc
- return
- } else {
- errRet = fmt.Errorf("prometheus metric name %s with labels %+v conflict labels %+v", promMetric, saved.metricLabels, temp)
- return
- }
-}
-
-func (me *Collector) saveDesc(promMetric string, labels []string, desc *prometheus.Desc) {
- temp := labels[:]
- sort.Strings(temp)
-
- var reuseDesc MetricReuseDesc
- reuseDesc.desc = desc
- reuseDesc.metricLabels = temp
- reuseDesc.metricName = promMetric
-
- me.allPromDesc[promMetric] = &reuseDesc
- return
-}
-
-/*
- Check that the configurations in the file "yml" are legal
-*/
-func (me *Collector) checkConfig() (errRet error) {
- for _, metricConfig := range me.allMetricConfig {
- for _, statistic := range metricConfig.Statistics {
- if SupportStatistic[strings.ToLower(statistic)] == nil {
- errRet = fmt.Errorf("not support statistic [%s] yet", statistic)
- return
- }
- }
- items := strings.Split(metricConfig.Namespace, `/`)
- productName := items[len(items)-1]
- productName = strings.ToLower(productName)
-
- var (
- multiKeyFunc = monitor.GetMultiKeyFunc(productName)
- primaryKeyFunc = monitor.GetPrimaryKeyFunc(productName)
- instanceFunc = instances.GetInstanceFunc(productName)
- )
-
- if multiKeyFunc == nil && primaryKeyFunc == nil {
- errRet = fmt.Errorf("not support product [%s] yet, need monitor api code.", productName)
- return
- }
-
- if len(metricConfig.Dimensions) == 0 {
- if instanceFunc == nil || primaryKeyFunc == nil {
- errRet = fmt.Errorf("product [%s] not support [tc_labels,tc_filters] yet, you can use [tc_myself_dimensions]", productName)
- return
- }
- } else {
- if multiKeyFunc == nil {
- errRet = fmt.Errorf("product [%s] not support [tc_myself_dimensions] yet, you can use [tc_labels,tc_filters]", productName)
- return
- }
- }
- }
- return
-
-}
-
-func (me *Collector) Describe(ch chan<- *prometheus.Desc) {
- me.locker.Lock()
- defer me.locker.Unlock()
- for _, v := range me.overviewMetrics {
- for _, desc := range v.PromDeses {
- ch <- desc
- }
- }
- for _, v := range me.specialDimensionMetrics {
- for _, desc := range v.PromDeses {
- ch <- desc
- }
- }
-
- return
-}
-
-func (me *Collector) Collect(ch chan<- prometheus.Metric) {
- me.locker.Lock()
- defer me.locker.Unlock()
-
- var group sync.WaitGroup
-
- for _, v := range me.overviewMetrics {
- group.Add(1)
- vTemp := v
- go func() {
- defer group.Done()
- if err := vTemp.collect(ch); err != nil {
- log.Errorf("collect monitor data fail , reason %s ", err.Error())
- }
- }()
- }
-
- for _, v := range me.specialDimensionMetrics {
- group.Add(1)
- vTemp := v
- go func() {
- defer group.Done()
- if err := vTemp.collect(ch); err != nil {
- log.Errorf("collect monitor data fail , reason %s ", err.Error())
- }
- }()
- }
-
- group.Wait()
-
- for productName, value := range me.sdkErrors {
- ch <- prometheus.MustNewConstMetric(me.sdkErrorDesc, prometheus.GaugeValue, float64(value), productName)
- }
- me.sdkErrors = make(map[string]int64)
- return
-}
-
-/*
- Error reporting for tencent-sdk-go API
-*/
-func (me *Collector) reportSdkError(productName string) {
- me.sdkErrors[productName]++
-}
diff --git a/collector/common.go b/collector/common.go
deleted file mode 100644
index c976f91..0000000
--- a/collector/common.go
+++ /dev/null
@@ -1,137 +0,0 @@
-package collector
-
-import (
- "github.com/prometheus/client_golang/prometheus"
-)
-
-type funcStatistic func(map[int64]float64) (float64, int64, bool)
-
-/*for tencent cloud api error */
-var sdkErrorReportMetricName = "tencent_cloud_sdk_error"
-
-/*what we can monitor product*/
-var monitorProductName = "monitor"
-
-/*Data(metric) cache time*/
-const metricCacheTime = 30
-
-/*Supports the way statistic are calculated*/
-var SupportStatistic = map[string]funcStatistic{
- "min": minFromMap,
- "max": maxFromMap,
- "avg": avgFromMap,
- "sum": sumFromMap,
-}
-
-/*Number of concurrent requests*/
-var numberOfConcurrent = 10
-
-type MetricCache struct {
- insertTime int64
- metric *prometheus.Metric
-}
-
-func ToUnderlineLower(s string) string {
-
- var interval byte = 'a' - 'A'
-
- b := make([]byte, 0, len(s))
-
- for i := 0; i < len(s); i++ {
- c := s[i]
- if c >= 'A' && c <= 'Z' {
- c += interval
- if i != 0 {
- b = append(b, '_')
- }
- }
- b = append(b, c)
- }
- return string(b)
-}
-
-func minFromMap(input map[int64]float64) (min float64, lastTime int64, has bool) {
- if len(input) == 0 {
- return
- }
- has = true
- first := true
- for ts, v := range input {
- if first {
- min = v
- lastTime = ts
- first = false
- } else {
- if min > v {
- min = v
- }
- if ts > lastTime {
- lastTime = ts
- }
- }
- }
- return
-}
-
-func maxFromMap(input map[int64]float64) (max float64, lastTime int64, has bool) {
- if len(input) == 0 {
- return
- }
- has = true
- first := true
- for ts, v := range input {
- if first {
- max = v
- lastTime = ts
- first = false
- } else {
- if max < v {
- max = v
- }
- if ts > lastTime {
- lastTime = ts
- }
- }
- }
- return
-}
-
-func avgFromMap(input map[int64]float64) (avg float64, lastTime int64, has bool) {
- if len(input) == 0 {
- return
- }
- has = true
- first := true
- var sum float64 = 0
- for ts, v := range input {
- if first {
- lastTime = ts
- first = false
- }
- sum += v
- if ts > lastTime {
- lastTime = ts
- }
- }
- avg = sum / float64(len(input))
- return
-}
-
-func sumFromMap(input map[int64]float64) (sum float64, lastTime int64, has bool) {
- if len(input) == 0 {
- return
- }
- has = true
- first := true
- for ts, v := range input {
- if first {
- lastTime = ts
- first = false
- }
- sum += v
- if ts > lastTime {
- lastTime = ts
- }
- }
- return
-}
diff --git a/collector/overview_metric.go b/collector/overview_metric.go
deleted file mode 100644
index 1802621..0000000
--- a/collector/overview_metric.go
+++ /dev/null
@@ -1,213 +0,0 @@
-package collector
-
-import (
- "fmt"
- "sort"
- "strings"
- "time"
-
- "github.com/tencentyun/tencentcloud-exporter/config"
- "github.com/tencentyun/tencentcloud-exporter/instances"
- "github.com/tencentyun/tencentcloud-exporter/monitor"
-
- "github.com/prometheus/client_golang/prometheus"
- "github.com/prometheus/common/log"
-)
-
-type OverviewMetric struct {
- PromPrefix string
- ProductName string
- Labels []string
- MetricConfig config.TencentMetric
- PromDeses map[string]*prometheus.Desc /* prometheus.name-->prometheus.Desc */
- collector *Collector
- caches map[string]*MetricCache
-}
-
-func NewOverviewMetric(cm config.TencentMetric, collector *Collector) (ret *OverviewMetric, errRet error) {
- ret = &OverviewMetric{}
-
- ret.MetricConfig = cm
- ret.collector = collector
-
- /*if tc_namespace is Tencent/CVM, ProductName is cvm*/
- items := strings.Split(cm.Namespace, `/`)
- ret.ProductName = strings.ToLower(items[len(items)-1])
-
- /*add primary key to dimensions and uniq(dimensions) */
- uniqMap := make(map[string]bool)
- primaryKey := monitor.PrimaryKeys[ret.ProductName]
- if primaryKey != "" {
- cm.Labels = append([]string{primaryKey}, cm.Labels...)
- }
- for _, v := range cm.Labels {
- uniqMap[v] = true
- }
- ret.Labels = make([]string, 0, len(uniqMap))
- for _, v := range cm.Labels {
- if uniqMap[v] {
- ret.Labels = append(ret.Labels, v)
- uniqMap[v] = false
- }
- }
- sort.Strings(ret.Labels)
-
- /*tc_cvm_cpu_usage_*/
- promPrefix := fmt.Sprintf("%s_%s_%s_", items[0], items[1], ToUnderlineLower(cm.MetricReName))
-
- ret.PromPrefix = strings.ToLower(promPrefix)
-
- ret.PromDeses = make(map[string]*prometheus.Desc, len(cm.Statistics))
- ret.caches = make(map[string]*MetricCache)
-
- for _, v := range cm.Statistics {
- v = strings.ToLower(v)
- /*tc_cvm_cpu_usage_max*/
- promMetric := ret.PromPrefix + v
-
- docString := fmt.Sprintf("Metric from %s.%s %s", ret.ProductName, cm.MetricName, v)
-
- labels := make([]string, 0, len(ret.Labels))
- for _, v := range ret.Labels {
- labels = append(labels, ToUnderlineLower(v))
- }
- desc, err := collector.getExistedDesc(promMetric, labels)
- if err != nil {
- errRet = err
- return
- }
- if desc != nil {
- ret.PromDeses[v] = desc
- } else {
- ret.PromDeses[v] = prometheus.NewDesc(promMetric, docString, labels, nil)
- collector.saveDesc(promMetric, labels, ret.PromDeses[v])
- }
- }
- return
-}
-
-func (me *OverviewMetric) collect(ch chan<- prometheus.Metric) (errRet error) {
-
- funcGetInstanceInfos := instances.GetInstanceFunc(me.ProductName)
-
- if funcGetInstanceInfos == nil {
- errRet = fmt.Errorf("error,this product [%s] get instances func not support yet", me.ProductName)
- return
- }
-
- funcGetMonitorData := monitor.GetPrimaryKeyFunc(me.ProductName)
-
- if funcGetMonitorData == nil {
- errRet = fmt.Errorf("error,this product [%s] get monitor datas func not support yet", me.ProductName)
- return
- }
-
- instances, err := funcGetInstanceInfos(me.MetricConfig.Filters)
- if err != nil {
- me.collector.reportSdkError(me.ProductName)
- log.Errorln(err.Error())
- }
- instanceIds := make([]string, 0, len(instances))
- for instanceId := range instances {
- instanceIds = append(instanceIds, instanceId)
- }
- if len(instanceIds) == 0 {
- return
- }
-
- var cacheMetrics = make([]*prometheus.Metric, 0, len(me.MetricConfig.Statistics))
-
- nowts := time.Now().Unix()
-
- for _, instanceId := range instanceIds {
- for _, statistic := range me.MetricConfig.Statistics {
- statistic = strings.ToLower(statistic)
- cacheMetric := me.caches[instanceId+"#"+statistic]
- if cacheMetric != nil &&
- cacheMetric.metric != nil &&
- cacheMetric.insertTime+metricCacheTime > nowts {
- cacheMetrics = append(cacheMetrics, cacheMetric.metric)
- }
- }
- }
-
- if len(cacheMetrics) > 0 {
- for _, cacheMetric := range cacheMetrics {
- ch <- *cacheMetric
- log.Debugf("metric read from cache,%s", (*cacheMetric).Desc().String())
- }
- return
- }
-
- allDataRet, err := funcGetMonitorData(instanceIds,
- me.MetricConfig.MetricName,
- me.MetricConfig.PeriodSeconds,
- me.MetricConfig.RangeSeconds,
- me.MetricConfig.DelaySeconds,
- instances)
-
- if err != nil {
- me.collector.reportSdkError(monitorProductName)
- }
- /*
- Have to deal with allDataRet whether it's wrong or not.
- */
- nowts = time.Now().Unix()
- for instanceId, datas := range allDataRet {
- if instances[instanceId] == nil {
- log.Errorf("It was a big api bug, because monitor api return a not exist instance id [%s] ", instanceId)
- me.collector.reportSdkError(monitorProductName)
- continue
- }
- if len(datas) == 0 {
- continue
- }
- for _, statistic := range me.MetricConfig.Statistics {
-
- statistic = strings.ToLower(statistic)
-
- funcStatistic := SupportStatistic[statistic]
- if funcStatistic == nil {
- log.Errorf("can not be here, not support statistic [%s ] yet ", statistic)
- continue
- }
- var (
- statisticRet, lastTime, _ = funcStatistic(datas)
- promDesc = me.PromDeses[statistic]
- labels = me.getLabels(instances[instanceId])
- )
-
- proMetric := prometheus.MustNewConstMetric(promDesc, prometheus.GaugeValue, float64(statisticRet), labels...)
- me.caches[instanceId+"#"+statistic] = &MetricCache{
- metric: &proMetric,
- insertTime: nowts,
- }
- ch <- proMetric
- _ = lastTime
- //ch <- prometheus.NewMetricWithTimestamp(time.Unix(lastTime, 0), proMetric)
- }
- }
- return
-}
-
-/*
- Gets a list of tags that the product instance needs to be reported to the prom
-*/
-func (me *OverviewMetric) getLabels(instanceInfo map[string]interface{}) (ret []string) {
- lowerKeyinstanceInfo := make(map[string]interface{}, len(instanceInfo))
- for key, value := range instanceInfo {
- lowerKeyinstanceInfo[strings.ToLower(key)] = value
- }
- ret = make([]string, 0, len(me.Labels))
-
- for _, dimension := range me.Labels {
- dimension = strings.ToLower(dimension)
- dimensionValue := lowerKeyinstanceInfo[dimension]
- if dimensionValue == nil {
- ret = append(ret, "")
- } else {
- ret = append(ret, fmt.Sprintf("%v", dimensionValue))
- }
- }
- return
-}
diff --git a/collector/special_metric.go b/collector/special_metric.go
deleted file mode 100644
index 04c26e4..0000000
--- a/collector/special_metric.go
+++ /dev/null
@@ -1,157 +0,0 @@
-package collector
-
-import (
- "fmt"
- "sort"
- "strings"
- "time"
-
- "github.com/tencentyun/tencentcloud-exporter/config"
- "github.com/tencentyun/tencentcloud-exporter/monitor"
-
- "github.com/prometheus/client_golang/prometheus"
- "github.com/prometheus/common/log"
-)
-
-type SpecailMetric struct {
- PromPrefix string
- ProductName string
- Labels []string
- MetricConfig config.TencentMetric
- PromDeses map[string]*prometheus.Desc /* prometheus.name-->prometheus.Desc */
- collector *Collector
- caches map[string]*MetricCache
-}
-
-func NewSpecailMetric(cm config.TencentMetric, collector *Collector) (ret *SpecailMetric, errRet error) {
- ret = &SpecailMetric{}
-
- ret.MetricConfig = cm
- ret.collector = collector
-
- /*if tc_namespace is Tencent/CVM, ProductName is cvm*/
- items := strings.Split(cm.Namespace, `/`)
- ret.ProductName = strings.ToLower(items[len(items)-1])
- ret.Labels = make([]string, 0, len(cm.Dimensions))
-
- for dName, _ := range cm.Dimensions {
- ret.Labels = append(ret.Labels, dName)
- }
- sort.Strings(ret.Labels)
-
- /*tc_cvm_cpu_usage_*/
- promPrefix := fmt.Sprintf("%s_%s_%s_", items[0], items[1], ToUnderlineLower(cm.MetricReName))
-
- ret.PromPrefix = strings.ToLower(promPrefix)
-
- ret.PromDeses = make(map[string]*prometheus.Desc, len(cm.Statistics))
- ret.caches = make(map[string]*MetricCache)
-
- for _, v := range cm.Statistics {
- v = strings.ToLower(v)
- /*tc_cvm_cpu_usage_max*/
- promMetric := ret.PromPrefix + v
-
- docString := fmt.Sprintf("Metric from %s.%s %s", ret.ProductName, cm.MetricName, v)
-
- labels := make([]string, 0, len(ret.Labels))
- for _, v := range ret.Labels {
- labels = append(labels, ToUnderlineLower(v))
- }
-
- desc, err := collector.getExistedDesc(promMetric, labels)
- if err != nil {
- errRet = err
- return
- }
- if desc != nil {
- ret.PromDeses[v] = desc
- } else {
- ret.PromDeses[v] = prometheus.NewDesc(promMetric, docString, labels, nil)
- collector.saveDesc(promMetric, labels, ret.PromDeses[v])
- }
- }
- return
-}
-
-func (me *SpecailMetric) collect(ch chan<- prometheus.Metric) (errRet error) {
-
- funcGetMonitorData := monitor.GetMultiKeyFunc(me.ProductName)
-
- if funcGetMonitorData == nil {
- errRet = fmt.Errorf("error,this product [%s] get self control monitor datas func not support yet", me.ProductName)
- return
- }
-
- nowts := time.Now().Unix()
- var cacheMetrics = make([]*prometheus.Metric, 0, len(me.MetricConfig.Statistics))
- for _, statistic := range me.MetricConfig.Statistics {
- statistic = strings.ToLower(statistic)
- cacheMetric := me.caches[statistic]
-
- if cacheMetric != nil &&
- cacheMetric.metric != nil &&
- cacheMetric.insertTime+metricCacheTime > nowts {
- cacheMetrics = append(cacheMetrics, cacheMetric.metric)
- }
- }
-
- if len(cacheMetrics) > 0 {
- for _, cacheMetric := range cacheMetrics {
- ch <- *cacheMetric
- log.Debugf("metric read from cache,%s", (*cacheMetric).Desc().String())
- }
- return
- }
-
- datas, err := funcGetMonitorData(me.MetricConfig.Dimensions,
- me.MetricConfig.MetricName,
- me.MetricConfig.PeriodSeconds,
- me.MetricConfig.RangeSeconds,
- me.MetricConfig.DelaySeconds)
- if err != nil {
- me.collector.reportSdkError(monitorProductName)
- return
- }
-
- nowts = time.Now().Unix()
-
- for _, statistic := range me.MetricConfig.Statistics {
-
- statistic = strings.ToLower(statistic)
-
- funcStatistic := SupportStatistic[statistic]
- if funcStatistic == nil {
- log.Errorf("can not be here, not support statistic [%s ] yet ", statistic)
- continue
- }
- var (
- statisticRet, lastTime, _ = funcStatistic(datas)
- promDesc = me.PromDeses[statistic]
- labels = me.getLabels()
- )
-
- proMetric := prometheus.MustNewConstMetric(promDesc, prometheus.GaugeValue, float64(statisticRet), labels...)
- me.caches[statistic] = &MetricCache{
- metric: &proMetric,
- insertTime: nowts,
- }
- ch <- proMetric
- _ = lastTime
- //ch <- prometheus.NewMetricWithTimestamp(time.Unix(lastTime, 0), proMetric)
- }
- return
-}
-
-/*
- Gets a list of tags that the product instance needs to be reported to the prom
-*/
-func (me *SpecailMetric) getLabels() (ret []string) {
-
- ret = make([]string, 0, len(me.Labels))
- for _, dimension := range me.Labels {
- value := fmt.Sprintf("%v", me.MetricConfig.Dimensions[dimension])
- ret = append(ret, value)
- }
- return
-}
diff --git a/config/config.go b/config/config.go
deleted file mode 100644
index f1a7abf..0000000
--- a/config/config.go
+++ /dev/null
@@ -1,118 +0,0 @@
-package config
-
-import (
- "fmt"
- "io/ioutil"
- "os"
- "strings"
-
- "gopkg.in/yaml.v2"
-)
-
-const (
- DefaultPeriodSeconds = 60
- DefaultDelaySeconds = 300
-
- EnvAccessKey = "TENCENTCLOUD_SECRET_ID"
- EnvSecretKey = "TENCENTCLOUD_SECRET_KEY"
- EnvRegion = "TENCENTCLOUD_REGION"
-)
-
-type TencentCredential struct {
- AccessKey string `yaml:"access_key"`
- SecretKey string `yaml:"secret_key"`
- Region string `yaml:"region"`
-}
-type TencentMetric struct {
- Namespace string `yaml:"tc_namespace"`
- MetricName string `yaml:"tc_metric_name"`
- MetricReName string `yaml:"tc_metric_rename"`
- Labels []string `yaml:"tc_labels"`
- Dimensions map[string]interface{} `yaml:"tc_myself_dimensions"`
- Filters map[string]interface{} `yaml:"tc_filters"`
- Statistics []string `yaml:"tc_statistics"`
- PeriodSeconds int64 `yaml:"period_seconds"`
- RangeSeconds int64 `yaml:"range_seconds"`
- DelaySeconds int64 `yaml:"delay_seconds"`
-}
-
-type TencentConfig struct {
- Credential TencentCredential `yaml:"credential"`
- Metrics []TencentMetric `yaml:"metrics"`
- RateLimit int64 `yaml:"rate_limit"`
- filename string
-}
-
-func NewConfig() *TencentConfig {
- return &TencentConfig{}
-}
-
-func (me *TencentConfig) LoadFile(filename string) (errRet error) {
- me.filename = filename
- content, err := ioutil.ReadFile(me.filename)
- if err != nil {
- errRet = err
- return
- }
- if err = yaml.UnmarshalStrict(content, me); err != nil {
- errRet = err
- return
- }
- if errRet = me.check(); errRet != nil {
- return errRet
- }
- me.fillDefault()
- return nil
-}
-
-func (me *TencentConfig) check() (errRet error) {
-
- if me.Credential.AccessKey == "" {
- me.Credential.AccessKey = os.Getenv(EnvAccessKey)
- me.Credential.SecretKey = os.Getenv(EnvSecretKey)
- me.Credential.Region = os.Getenv(EnvRegion)
- }
-
- if me.Credential.AccessKey == "" ||
- me.Credential.SecretKey == "" ||
- me.Credential.Region == "" {
- return fmt.Errorf("error, missing credential information!")
- }
- for _, metric := range me.Metrics {
- if metric.MetricName == "" {
- return fmt.Errorf("error, missing tc_metric_name !")
- }
- if len(strings.Split(metric.Namespace, `/`)) != 2 {
- return fmt.Errorf("error, tc_namespace should be 'xxxxxx/productName' format")
- }
- if len(metric.Dimensions) != 0 && (len(metric.Filters) != 0 || len(metric.Labels) != 0) {
- return fmt.Errorf("error, [tc_myself_dimensions] conflict with [tc_labels,tc_filters]")
- }
- }
-
- return nil
-}
-
-func (me *TencentConfig) fillDefault() {
-
- if me.RateLimit <= 0 {
- me.RateLimit = 10
- }
-
- for index, metric := range me.Metrics {
- if metric.PeriodSeconds == 0 {
- me.Metrics[index].PeriodSeconds = DefaultPeriodSeconds
- }
- if metric.DelaySeconds == 0 {
- me.Metrics[index].DelaySeconds = DefaultDelaySeconds
- }
-
- if metric.RangeSeconds == 0 {
- metric.RangeSeconds = metric.PeriodSeconds
- }
-
- if metric.MetricReName == "" {
- me.Metrics[index].MetricReName = me.Metrics[index].MetricName
- }
- }
-}
diff --git a/configs/qcloud-cdb-product.yml b/configs/qcloud-cdb-product.yml
new file mode 100644
index 0000000..e85cbd5
--- /dev/null
+++ b/configs/qcloud-cdb-product.yml
@@ -0,0 +1,17 @@
+credential:
+ access_key: "access_key"
+ secret_key: "secret_key"
+ region: "region"
+
+rate_limit: 15 #云监控拉数据接口最大限制, 20/秒, 1200/分钟, https://cloud.tencent.com/document/product/248/31014
+
+products:
+ - namespace: QCE/CDB #指标详情: https://cloud.tencent.com/document/product/248/45147
+ all_metrics: true
+ all_instances: true
+ #only_include_metrics: []
+ #only_include_instances: [cdb-xxxxxxxx]
+ #extra_labels: [InstanceName]
+ #statistics_types: [last]
+ #period_seconds: 60
+ #metric_name_type: 2
diff --git a/configs/qcloud-cdn-product.yml b/configs/qcloud-cdn-product.yml
new file mode 100644
index 0000000..2e33c45
--- /dev/null
+++ b/configs/qcloud-cdn-product.yml
@@ -0,0 +1,14 @@
+credential:
+ access_key: "access_key"
+ secret_key: "secret_key"
+ region: "region"
+
+rate_limit: 15 #云监控拉数据接口最大限制, 20/秒, 1200/分钟, https://cloud.tencent.com/document/product/248/31014
+
+products:
+ - namespace: QCE/CDN #指标详情: https://cloud.tencent.com/document/product/248/45138
+ custom_query_dimensions: #CDN只支持自定义查询
+ - projectId: xxx1
+ domain: xxx1
+ - projectId: xxx2
+ domain: xxx2
\ No newline at end of file
diff --git a/configs/qcloud-clb-product.yml b/configs/qcloud-clb-product.yml
new file mode 100644
index 0000000..a61ada8
--- /dev/null
+++ b/configs/qcloud-clb-product.yml
@@ -0,0 +1,17 @@
+credential:
+ access_key: "access_key"
+ secret_key: "secret_key"
+ region: "region"
+
+rate_limit: 15 #云监控拉数据接口最大限制, 20/秒, 1200/分钟, https://cloud.tencent.com/document/product/248/31014
+
+products:
+ - namespace: QCE/LB_PUBLIC #指标详情: https://cloud.tencent.com/document/product/248/45047
+ all_metrics: true
+ all_instances: true
+ #only_include_metrics: []
+ #only_include_instances: [lb-xxxxxxxx]
+ #extra_labels: [InstanceName]
+ #statistics_types: [last]
+ #period_seconds: 60
+ #metric_name_type: 2
\ No newline at end of file
diff --git a/configs/qcloud-cmongo-product.yml b/configs/qcloud-cmongo-product.yml
new file mode 100644
index 0000000..8c46f25
--- /dev/null
+++ b/configs/qcloud-cmongo-product.yml
@@ -0,0 +1,17 @@
+credential:
+ access_key: "access_key"
+ secret_key: "secret_key"
+ region: "region"
+
+rate_limit: 15 #云监控拉数据接口最大限制, 20/秒, 1200/分钟, https://cloud.tencent.com/document/product/248/31014
+
+products:
+ - namespace: QCE/CMONGO #指标详情: https://cloud.tencent.com/document/product/248/45104
+ all_metrics: true #自动导出所有实例的集群、副本集、节点3个纬度的指标数据
+ all_instances: true
+ #only_include_metrics: []
+ #only_include_instances: [cmgo-xxxxxxxx]
+ #extra_labels: [InstanceName]
+ #statistics_types: [last]
+ #period_seconds: 60
+ #metric_name_type: 2
diff --git a/configs/qcloud-cos-product.yml b/configs/qcloud-cos-product.yml
new file mode 100644
index 0000000..623f549
--- /dev/null
+++ b/configs/qcloud-cos-product.yml
@@ -0,0 +1,12 @@
+credential:
+ access_key: "access_key"
+ secret_key: "secret_key"
+ region: "region"
+
+rate_limit: 15 #云监控拉数据接口最大限制, 20/秒, 1200/分钟, https://cloud.tencent.com/document/product/248/31014
+
+products:
+ - namespace: QCE/COS #指标详情: https://cloud.tencent.com/document/product/248/45140
+ custom_query_dimensions: #COS只支持自定义查询
+ - appid: xxxxxxxx
+ bucket: xxxxxx-xxxxxxx
diff --git a/configs/qcloud-cvm-product.yml b/configs/qcloud-cvm-product.yml
new file mode 100644
index 0000000..883e7fa
--- /dev/null
+++ b/configs/qcloud-cvm-product.yml
@@ -0,0 +1,17 @@
+credential:
+ access_key: "access_key"
+ secret_key: "secret_key"
+ region: "region"
+
+rate_limit: 15 #云监控拉数据接口最大限制, 20/秒, 1200/分钟, https://cloud.tencent.com/document/product/248/31014
+
+products:
+ - namespace: QCE/CVM #指标详情: https://cloud.tencent.com/document/product/248/6843
+ all_metrics: true
+ all_instances: true
+ #only_include_metrics: []
+ #only_include_instances: [ins-xxxxxxxx]
+ #extra_labels: [InstanceName]
+ #statistics_types: [last]
+ #period_seconds: 60
+ #metric_name_type: 2
diff --git a/configs/qcloud-dc-product.yml b/configs/qcloud-dc-product.yml
new file mode 100644
index 0000000..ee33c14
--- /dev/null
+++ b/configs/qcloud-dc-product.yml
@@ -0,0 +1,17 @@
+credential:
+ access_key: "access_key"
+ secret_key: "secret_key"
+ region: "region"
+
+rate_limit: 15 #云监控拉数据接口最大限制, 20/秒, 1200/分钟, https://cloud.tencent.com/document/product/248/31014
+
+products:
+ - namespace: QCE/DC #指标详情: https://cloud.tencent.com/document/product/248/45102
+ all_metrics: true
+ all_instances: true
+ #only_include_metrics: []
+ #only_include_instances: [dc-xxxxxxxx]
+ #extra_labels: [InstanceName]
+ #statistics_types: [last]
+ #period_seconds: 60
+ #metric_name_type: 2
diff --git a/configs/qcloud-dcx-product.yml b/configs/qcloud-dcx-product.yml
new file mode 100644
index 0000000..bcfbe8c
--- /dev/null
+++ b/configs/qcloud-dcx-product.yml
@@ -0,0 +1,17 @@
+credential:
+ access_key: "access_key"
+ secret_key: "secret_key"
+ region: "region"
+
+rate_limit: 15 #云监控拉数据接口最大限制, 20/秒, 1200/分钟, https://cloud.tencent.com/document/product/248/31014
+
+products:
+ - namespace: QCE/DCX # 指标详情: https://cloud.tencent.com/document/product/248/45101
+ all_metrics: true
+ all_instances: true
+ #only_include_metrics: []
+ #only_include_instances: [dcx-xxxxxxxx]
+ #extra_labels: [InstanceName]
+ #statistics_types: [last]
+ #period_seconds: 60
+ #metric_name_type: 2
diff --git a/configs/qcloud-nat-product.yml b/configs/qcloud-nat-product.yml
new file mode 100644
index 0000000..a725f15
--- /dev/null
+++ b/configs/qcloud-nat-product.yml
@@ -0,0 +1,17 @@
+credential:
+ access_key: "access_key"
+ secret_key: "secret_key"
+ region: "region"
+
+rate_limit: 15 #云监控拉数据接口最大限制, 20/秒, 1200/分钟, https://cloud.tencent.com/document/product/248/31014
+
+products:
+ - namespace: QCE/NAT_GATEWAY #指标详情: https://cloud.tencent.com/document/product/248/45069
+ all_metrics: true
+ all_instances: true
+ #only_include_metrics: []
+ #only_include_instances: [nat-xxxxxxxx]
+ #extra_labels: [InstanceName]
+ #statistics_types: [last]
+ #period_seconds: 60
+ #metric_name_type: 2
diff --git a/configs/qcloud-redis-cluster-product.yml b/configs/qcloud-redis-cluster-product.yml
new file mode 100644
index 0000000..00717f2
--- /dev/null
+++ b/configs/qcloud-redis-cluster-product.yml
@@ -0,0 +1,17 @@
+credential:
+ access_key: "access_key"
+ secret_key: "secret_key"
+ region: "region"
+
+rate_limit: 15 #云监控拉数据接口最大限制, 20/秒, 1200/分钟, https://cloud.tencent.com/document/product/248/31014
+
+products:
+ - namespace: QCE/CLUSTER_REDIS # 指标详情: https://cloud.tencent.com/document/product/248/45111
+ all_metrics: true
+ all_instances: true
+ #only_include_metrics: []
+ #only_include_instances: [crs-xxxxxxxx]
+ #extra_labels: [InstanceName]
+ #statistics_types: [last]
+ #period_seconds: 60
+ #metric_name_type: 2
diff --git a/configs/qcloud-redis-product.yml b/configs/qcloud-redis-product.yml
new file mode 100644
index 0000000..c793264
--- /dev/null
+++ b/configs/qcloud-redis-product.yml
@@ -0,0 +1,17 @@
+credential:
+ access_key: "access_key"
+ secret_key: "secret_key"
+ region: "region"
+
+rate_limit: 15 #云监控拉数据接口最大限制, 20/秒, 1200/分钟, https://cloud.tencent.com/document/product/248/31014
+
+products:
+ - namespace: QCE/REDIS # 指标详情: https://cloud.tencent.com/document/product/248/45111
+ all_metrics: true
+ all_instances: true
+ #only_include_metrics: []
+ #only_include_instances: [crs-xxxxxxxx]
+ #extra_labels: [InstanceName]
+ #statistics_types: [last]
+ #period_seconds: 60
+ #metric_name_type: 2
diff --git a/go.mod b/go.mod
index 7ad743c..be7c9d9 100644
--- a/go.mod
+++ b/go.mod
@@ -3,11 +3,13 @@ module github.com/tencentyun/tencentcloud-exporter
go 1.12
require (
+ github.com/deckarep/golang-set v1.7.1
+ github.com/go-kit/kit v0.9.0
github.com/prometheus/client_golang v1.5.1
github.com/prometheus/common v0.9.1
github.com/prometheus/tsdb v0.7.1 // indirect
- github.com/tencentcloud/tencentcloud-sdk-go v3.0.73-0.20190704135516-e86c9d8b05ee+incompatible
- github.com/yangwenmai/ratelimit v0.0.0-20180104140304-44221c2292e1
+ github.com/tencentcloud/tencentcloud-sdk-go v3.0.226+incompatible
+ golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e
gopkg.in/alecthomas/kingpin.v2 v2.2.6
gopkg.in/yaml.v2 v2.2.5
)
diff --git a/go.sum b/go.sum
index 7c0e82a..5b32254 100644
--- a/go.sum
+++ b/go.sum
@@ -18,10 +18,13 @@ github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/deckarep/golang-set v1.7.1/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
+github.com/go-kit/kit v0.9.0 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
+github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
@@ -51,6 +54,7 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
@@ -89,6 +93,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/tencentcloud/tencentcloud-sdk-go v3.0.73-0.20190704135516-e86c9d8b05ee+incompatible h1:bqYHIfgYCNbwEDT+06X2KWi5g7svrzAhZAZCGnK6Mks=
github.com/tencentcloud/tencentcloud-sdk-go v3.0.73-0.20190704135516-e86c9d8b05ee+incompatible/go.mod h1:0PfYow01SHPMhKY31xa+EFz2RStxIqj6JFAJS+IkCi4=
+github.com/tencentcloud/tencentcloud-sdk-go v3.0.226+incompatible h1:e6tY2NFYiRHEhBZiugeZhAjlL6fw+Gq2BtCm1tnAtmg=
+github.com/tencentcloud/tencentcloud-sdk-go v3.0.226+incompatible/go.mod h1:0PfYow01SHPMhKY31xa+EFz2RStxIqj6JFAJS+IkCi4=
github.com/yangwenmai/ratelimit v0.0.0-20180104140304-44221c2292e1 h1:q6c//IMJug6THoqsseZ+Z/zq53HQvADPh5a66E9hb+I=
github.com/yangwenmai/ratelimit v0.0.0-20180104140304-44221c2292e1/go.mod h1:Rl8MvKI/yVRGN91gMEZAIf/92QtFQBSG/QFRHWQZtmo=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I=
@@ -108,6 +114,8 @@ golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82 h1:ywK/j/KkyTHcdyYSZNXGjMwgmDSfjglYZ3vStQ/gSCU=
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e h1:EHBhcS0mlXEAVwNyO2dLfjToGsyY4j24pTs2ScHnX7s=
+golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
diff --git a/instances/common.go b/instances/common.go
deleted file mode 100644
index f8da395..0000000
--- a/instances/common.go
+++ /dev/null
@@ -1,87 +0,0 @@
-package instances
-
-import (
- "fmt"
-
- "github.com/tencentyun/tencentcloud-exporter/config"
-)
-
-type FuncGetInstanceIds func(map[string]interface{}) (map[string]map[string]interface{}, error)
-
-/*
- Each product has a function that gets instance infos.
- Format is: [productName]=>function
- eg: funcGets["mysql"]=getMysqlInstancesIds
-*/
-
-var funcGets = map[string]FuncGetInstanceIds{}
-
-var credentialConfig config.TencentCredential
-
-func GetInstanceFunc(productName string) FuncGetInstanceIds {
- return funcGets[productName]
-}
-
-func InitClient(cConfig config.TencentCredential) (errRet error) {
- credentialConfig = cConfig
- return
-}
-
-/*
- AbcdEfgh ---> abcd_efgh
-*/
-func ToUnderlineLower(s string) string {
- var interval byte = 'a' - 'A'
- b := make([]byte, 0, len(s))
- for i := 0; i < len(s); i++ {
- c := s[i]
- if c >= 'A' && c <= 'Z' {
- c += interval
- if i != 0 {
- b = append(b, '_')
- }
- }
- b = append(b, c)
- }
- return string(b)
-}
-
-/*
- Conversion of non-standard int64 api return to our data map.
- eg:api return UniqVpcId we need format to VpcId
-*/
-func setNonStandardInt64(needName string, int64Ptr *int64, toMap map[string]interface{}) {
- if int64Ptr == nil {
- return
- }
- toMap[needName] = int64(*int64Ptr)
-}
-
-/*
- Conversion of non-standard string api return to our data map.
-*/
-func setNonStandardStr(needName string, strPtr *string, toMap map[string]interface{}) {
- if strPtr == nil {
- return
- }
- toMap[needName] = *strPtr
-}
-
-/*
- check if the product instance satisfies the select rules defined by yml
-*/
-func meetConditions(dimensionSelect map[string]interface{}, productData map[string]interface{}, skipFilters map[string]bool) (ret bool) {
- for k, v := range dimensionSelect {
- if skipFilters[k] {
- continue
- }
- if productData[k] != nil {
- if fmt.Sprintf("%v", v) == fmt.Sprintf("%v", productData[k]) {
- continue
- } else {
- return false
- }
- }
- }
- return true
-}
diff --git a/instances/cvm_instances.go b/instances/cvm_instances.go
deleted file mode 100644
index 77065b3..0000000
--- a/instances/cvm_instances.go
+++ /dev/null
@@ -1,162 +0,0 @@
-package instances
-
-import (
- "encoding/json"
- "fmt"
- "github.com/tencentyun/tencentcloud-exporter/lib/ratelimit"
-
- "github.com/prometheus/common/log"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
- cvm "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312"
-)
-
-/*what we call this product in prom*/
-const CvmProductName = "cvm"
-
-var cvmTools cvmToolStruct
-
-func init() {
- funcGets[CvmProductName] = getCvmInstancesIds
-}
-
-var cvmApiFilterStrs = []string{"Zone", "VpcId", "InstanceName", "InstanceId", "PrivateIpAddress", "PublicIpAddress", "SubnetId", "InstanceChargeType"}
-var cvmApiFilterInts = []string{"ProjectId"}
-
-func getCvmInstancesIds(filters map[string]interface{}) (instanceIdsMap map[string]map[string]interface{},
- errRet error) {
-
- if credentialConfig.AccessKey == "" {
- errRet = fmt.Errorf("error,instantces client is not initialized yet")
- log.Errorf(errRet.Error())
- return
- }
-
- cacheKey := getCacheKey(CvmProductName, filters)
-
- if instanceIdsMap = getCache(cacheKey, true); instanceIdsMap != nil {
- log.Debugf("product [%s] list from new cache", CvmProductName)
- return
- }
-
- /*if product api error, we can get from cache.*/
- defer func() {
- if errRet != nil {
- if oldInstanceIdsMap := getCache(cacheKey, false); oldInstanceIdsMap != nil {
- instanceIdsMap = oldInstanceIdsMap
- log.Warnf("product [%s] from old cache, because product list api error", CvmProductName)
- }
- }
- }()
-
- credential := common.NewCredential(
- credentialConfig.AccessKey,
- credentialConfig.SecretKey,
- )
- cpf := profile.NewClientProfile()
- cpf.HttpProfile.ReqMethod = "POST"
- cpf.HttpProfile.ReqTimeout = 10
-
- client, err := cvm.NewClient(credential, credentialConfig.Region, cpf)
- if err != nil {
- log.Error(err.Error())
- errRet = err
- return
- }
- request := cvm.NewDescribeInstancesRequest()
-
- var apiCanFilters = map[string]bool{}
-
- for _, v := range cvmApiFilterStrs {
- cvmTools.fillStringFilter(cvmTools.ToMiddlelineLower(v), filters[v], request)
- apiCanFilters[v] = true
- }
- for _, v := range cvmApiFilterInts {
- cvmTools.fillIntFilter(cvmTools.ToMiddlelineLower(v), filters[v], request)
- apiCanFilters[v] = true
- }
- instanceIdsMap = make(map[string]map[string]interface{})
- hasGet := make(map[string]bool)
-
- var offset int64 = 0
- var limit int64 = 100
- var total int64 = -1
-
-getMoreInstanceId:
- request.Offset = &offset
- request.Limit = &limit
- ratelimit.Check(request.GetAction())
- response, err := client.DescribeInstances(request)
- if err != nil {
- ratelimit.Check(request.GetAction())
- response, err = client.DescribeInstances(request)
- }
-
- if err != nil {
- errRet = err
- log.Errorf("api[%s] fail, request body [%s], reason[%s]", request.GetAction(), request.ToJsonString(), errRet.Error())
- return
- }
- if total == -1 {
- total = *response.Response.TotalCount
- }
- if len(response.Response.InstanceSet) == 0 {
- goto hasGetAll
- }
- for _, v := range response.Response.InstanceSet {
- if _, ok := hasGet[*v.InstanceId]; ok {
- errRet = fmt.Errorf("api[%s] return error, has repeat instance id [%s]", request.GetAction(), *v.InstanceId)
- log.Errorf(errRet.Error())
- return
- }
- js, err := json.Marshal(v)
- if err != nil {
- errRet = fmt.Errorf("api[%s] return error, can not json encode [%s]", request.GetAction(), *v.InstanceId)
- log.Errorf(errRet.Error())
- }
- var data map[string]interface{}
-
- err = json.Unmarshal(js, &data)
- if err != nil {
- errRet = fmt.Errorf("api[%s] return error, can not json decode [%s]", request.GetAction(), *v.InstanceId)
- log.Errorf(errRet.Error())
- }
- /*
- Need to convert some heterogeneous data
- */
- if v.Placement != nil {
- setNonStandardStr("Zone", v.Placement.Zone, data)
- setNonStandardInt64("ProjectId", v.Placement.ProjectId, data)
- }
-
- var privateIpAddress string
- for _, v := range v.PrivateIpAddresses {
- privateIpAddress = privateIpAddress + "," + (*v)
- data["PrivateIpAddress"] = privateIpAddress
- }
- var publicIpAddress string
- for _, v := range v.PublicIpAddresses {
- publicIpAddress = publicIpAddress + "," + (*v)
- data["PublicIpAddress"] = publicIpAddress
- }
- if v.VirtualPrivateCloud != nil {
- setNonStandardStr("VpcId", v.VirtualPrivateCloud.VpcId, data)
- setNonStandardStr("SubnetId", v.VirtualPrivateCloud.SubnetId, data)
- }
- if meetConditions(filters, data, apiCanFilters) {
- instanceIdsMap[*v.InstanceId] = data
- }
- hasGet[*v.InstanceId] = true
- }
- offset += limit
- if total != -1 && int64(offset) >= total {
- goto hasGetAll
- }
- goto getMoreInstanceId
-
-hasGetAll:
- if len(instanceIdsMap) > 0 {
- setCache(cacheKey, instanceIdsMap)
- }
- return
-}
diff --git a/instances/cvm_tools.go b/instances/cvm_tools.go
deleted file mode 100644
index facd230..0000000
--- a/instances/cvm_tools.go
+++ /dev/null
@@ -1,65 +0,0 @@
-package instances
-
-import (
- "fmt"
-
- cvm "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312"
-)
-
-type cvmToolStruct struct{}
-
-/*
- ProjectId ---- > project-id
-*/
-func (me *cvmToolStruct) ToMiddlelineLower(s string) string {
-
- var interval byte = 'a' - 'A'
-
- b := make([]byte, 0, len(s))
-
- for i := 0; i < len(s); i++ {
- c := s[i]
- if c >= 'A' && c <= 'Z' {
- c += interval
- if i != 0 {
- b = append(b, '-')
- }
- }
- b = append(b, c)
- }
- return string(b)
-}
-
-func (me *cvmToolStruct) fillStringFilter(filterName string, valueInterface interface{}, request *cvm.DescribeInstancesRequest) (has bool) {
- if valueInterface == nil || request == nil {
- return
- }
- str, ok := valueInterface.(string)
- if !ok {
- return
- }
- has = true
- filter := &cvm.Filter{}
- filter.Name = &filterName
- filter.Values = []*string{&str}
- request.Filters = append(request.Filters, filter)
- return
-}
-
-func (me *cvmToolStruct) fillIntFilter(filterName string, valueInterface interface{}, request *cvm.DescribeInstancesRequest) (has bool) {
- if valueInterface == nil || request == nil {
- return
- }
- intv, ok := valueInterface.(int)
- if !ok {
- return
- }
-
- str := fmt.Sprintf("%d", intv)
- has = true
- filter := &cvm.Filter{}
- filter.Name = &filterName
- filter.Values = []*string{&str}
- request.Filters = append(request.Filters, filter)
- return
-}
diff --git a/instances/dc_instances.go b/instances/dc_instances.go
deleted file mode 100644
index 9a0cb5d..0000000
--- a/instances/dc_instances.go
+++ /dev/null
@@ -1,214 +0,0 @@
-package instances
-
-import (
- "encoding/json"
- "fmt"
- "github.com/tencentyun/tencentcloud-exporter/lib/ratelimit"
-
- "github.com/prometheus/common/log"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
- dc "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dc/v20180410"
-)
-
-/*what we call this product in prom*/
-const DcProductName = "dc"
-const DcxProductName = "dcx"
-
-var dcTools dcToolStruct
-
-func init() {
- funcGets[DcProductName] = getDcInstancesIds
- funcGets[DcxProductName] = getDcxInstancesIds
-}
-
-func getDcInstancesIds(filters map[string]interface{}) (instanceIdsMap map[string]map[string]interface{},
- errRet error) {
-
- credential := common.NewCredential(
- credentialConfig.AccessKey,
- credentialConfig.SecretKey,
- )
-
- cpf := profile.NewClientProfile()
- cpf.HttpProfile.ReqMethod = "POST"
- cpf.HttpProfile.ReqTimeout = 10
-
- client, err := dc.NewClient(credential, credentialConfig.Region, cpf)
- if err != nil {
- errRet = err
- return
- }
- request := dc.NewDescribeDirectConnectsRequest()
-
- var apiCanFilters = map[string]bool{}
-
- nameFilterMap := map[string]string{
- "DirectConnectName": "direct-connect-name",
- "DirectConnectId": "direct-connect-id"}
-
- for name, nameInFilter := range nameFilterMap {
- dcTools.fillStringFilter(nameInFilter, filters[name], request)
- apiCanFilters[name] = true
- }
-
- instanceIdsMap = make(map[string]map[string]interface{})
- hasGet := make(map[string]bool)
-
- var offset int64 = 0
- var limit int64 = 100
- var total int64 = -1
-
-getMoreInstanceId:
- request.Offset = &offset
- request.Limit = &limit
- ratelimit.Check(request.GetAction())
- response, err := client.DescribeDirectConnects(request)
- if err != nil {
- ratelimit.Check(request.GetAction())
- response, err = client.DescribeDirectConnects(request)
- }
- if err != nil {
- errRet = err
- log.Errorf("api[%s] fail, request body [%s], reason[%s]", request.GetAction(), request.ToJsonString(), errRet.Error())
- return
- } else {
- log.Debugf("api[%s] success, request body [%s], response[%s]", request.GetAction(), request.ToJsonString(), response.ToJsonString())
- }
- if total == -1 {
- total = *response.Response.TotalCount
- }
- if len(response.Response.DirectConnectSet) == 0 {
- goto hasGetAll
- }
-
- for _, v := range response.Response.DirectConnectSet {
- if _, ok := hasGet[*v.DirectConnectId]; ok {
- errRet = fmt.Errorf("api[%s] return error, has repeat instance id [%s]", request.GetAction(), *v.DirectConnectId)
- log.Errorf(errRet.Error())
- return
- }
- js, err := json.Marshal(v)
- if err != nil {
- errRet = fmt.Errorf("api[%s] return error, can not json encode [%s]", request.GetAction(), *v.DirectConnectId)
- log.Errorf(errRet.Error())
- }
- var data map[string]interface{}
-
- err = json.Unmarshal(js, &data)
- if err != nil {
- errRet = fmt.Errorf("api[%s] return error, can not json decode [%s]", request.GetAction(), *v.DirectConnectId)
- log.Errorf(errRet.Error())
- }
- if meetConditions(filters, data, apiCanFilters) {
- instanceIdsMap[*v.DirectConnectId] = data
- }
- hasGet[*v.DirectConnectId] = true
- }
- offset += limit
- if total != -1 && int64(offset) >= total {
- goto hasGetAll
- }
- goto getMoreInstanceId
-
-hasGetAll:
- return
-}
-
-func getDcxInstancesIds(filters map[string]interface{}) (instanceIdsMap map[string]map[string]interface{},
- errRet error) {
-
- if credentialConfig.AccessKey == "" {
- errRet = fmt.Errorf("error,instantces client is not initialized yet")
- log.Errorf(errRet.Error())
- return
- }
-
- credential := common.NewCredential(
- credentialConfig.AccessKey,
- credentialConfig.SecretKey,
- )
-
- cpf := profile.NewClientProfile()
- cpf.HttpProfile.ReqMethod = "POST"
- cpf.HttpProfile.ReqTimeout = 10
-
- client, err := dc.NewClient(credential, credentialConfig.Region, cpf)
- if err != nil {
- errRet = err
- return
- }
- request := dc.NewDescribeDirectConnectTunnelsRequest()
-
- var apiCanFilters = map[string]bool{}
-
- nameFilterMap := map[string]string{
- "DirectConnectTunnelName": "direct-connect-tunnel-name",
- "DirectConnectTunnelId": "direct-connect-tunnel-id"}
-
- for name, nameInFilter := range nameFilterMap {
- dcTools.fillStringFilter(nameInFilter, filters[name], request)
- apiCanFilters[name] = true
- }
-
- instanceIdsMap = make(map[string]map[string]interface{})
- hasGet := make(map[string]bool)
-
- var offset int64 = 0
- var limit int64 = 100
- var total int64 = -1
-
-getMoreInstanceId:
- request.Offset = &offset
- request.Limit = &limit
- response, err := client.DescribeDirectConnectTunnels(request)
- if err != nil {
- response, err = client.DescribeDirectConnectTunnels(request)
- }
-
- if err != nil {
- errRet = err
- log.Errorf("api[%s] fail, request body [%s], reason[%s]", request.GetAction(), request.ToJsonString(), errRet.Error())
- return
- } else {
- log.Debugf("api[%s] success, request body [%s], response[%s]", request.GetAction(), request.ToJsonString(), response.ToJsonString())
- }
- if total == -1 {
- total = *response.Response.TotalCount
- }
- if len(response.Response.DirectConnectTunnelSet) == 0 {
- goto hasGetAll
- }
-
- for _, v := range response.Response.DirectConnectTunnelSet {
- if _, ok := hasGet[*v.DirectConnectTunnelId]; ok {
- errRet = fmt.Errorf("api[%s] return error, has repeat instance id [%s]", request.GetAction(), *v.DirectConnectTunnelId)
- log.Errorf(errRet.Error())
- return
- }
- js, err := json.Marshal(v)
- if err != nil {
- errRet = fmt.Errorf("api[%s] return error, can not json encode [%s]", request.GetAction(), *v.DirectConnectTunnelId)
- log.Errorf(errRet.Error())
- }
- var data map[string]interface{}
-
- err = json.Unmarshal(js, &data)
- if err != nil {
- errRet = fmt.Errorf("api[%s] return error, can not json decode [%s]", request.GetAction(), *v.DirectConnectTunnelId)
- log.Errorf(errRet.Error())
- }
- if meetConditions(filters, data, apiCanFilters) {
- instanceIdsMap[*v.DirectConnectTunnelId] = data
- }
- hasGet[*v.DirectConnectTunnelId] = true
- }
- offset += limit
- if total != -1 && int64(offset) >= total {
- goto hasGetAll
- }
- goto getMoreInstanceId
-
-hasGetAll:
- return
-}
diff --git a/instances/dc_tools.go b/instances/dc_tools.go
deleted file mode 100644
index 987133f..0000000
--- a/instances/dc_tools.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package instances
-
-import (
- dc "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dc/v20180410"
-)
-
-type dcToolStruct struct{}
-
-func (me *dcToolStruct) fillStringFilter(filterName string, valueInterface interface{}, request interface{}) (has bool) {
-
- if valueInterface == nil || request == nil {
- return
- }
-
- dcxRequest, isDcx := request.(*dc.DescribeDirectConnectTunnelsRequest)
-
- dcRequest, isDc := request.(*dc.DescribeDirectConnectsRequest)
-
- str, ok := valueInterface.(string)
- if !ok {
- return
- }
- has = true
- filter := &dc.Filter{}
- filter.Name = &filterName
-
- filter.Values = []*string{&str}
- if isDcx {
- dcxRequest.Filters = append(dcxRequest.Filters, filter)
- }
- if isDc {
- dcRequest.Filters = append(dcRequest.Filters, filter)
- }
-
- return
-}
diff --git a/instances/list_cache.go b/instances/list_cache.go
deleted file mode 100644
index 8e4f4f2..0000000
--- a/instances/list_cache.go
+++ /dev/null
@@ -1,60 +0,0 @@
-package instances
-
-import (
- "bytes"
- "crypto/md5"
- "encoding/json"
- "fmt"
- "sync"
- "time"
-)
-
-type cacheItem struct {
- cacheData map[string]map[string]interface{}
- lastModifyTime int64
-}
-
-/*Cache the list of products for equal conditions, cache && locker && time*/
-var memCache = map[string]cacheItem{}
-var memCacheLocker sync.Mutex
-var maxCacheTime int64 = 40
-
-func getCache(key string, strict bool) (ret map[string]map[string]interface{}) {
-
- memCacheLocker.Lock()
- defer memCacheLocker.Unlock()
-
- saveRet, ok := memCache[key]
- if !ok {
- return
- }
-
- if !strict || (saveRet.lastModifyTime+maxCacheTime > time.Now().Unix()) {
- ret = saveRet.cacheData
- return
- }
-
- return
-}
-
-func setCache(key string, value map[string]map[string]interface{}) {
- memCacheLocker.Lock()
- memCache[key] = cacheItem{
- cacheData: value,
- lastModifyTime: time.Now().Unix(),
- }
- memCacheLocker.Unlock()
-}
-
-func getCacheKey(productName string, dimensionSelect map[string]interface{}) (key string) {
- var buf bytes.Buffer
- js, _ := json.Marshal(dimensionSelect)
- buf.Write(js)
- buf.WriteString(credentialConfig.AccessKey)
- buf.WriteString(credentialConfig.SecretKey)
- buf.WriteString(credentialConfig.Region)
- md := md5.New()
- md.Write(buf.Bytes())
- key = fmt.Sprintf("%s_%x", md.Sum(nil), productName)
- return
-}
diff --git a/instances/list_cache_test.go b/instances/list_cache_test.go
deleted file mode 100644
index 65bcb3c..0000000
--- a/instances/list_cache_test.go
+++ /dev/null
@@ -1,68 +0,0 @@
-package instances
-
-import (
- "testing"
- "time"
-)
-
-func TestCache(t *testing.T) {
-
- oldMaxCacheTime := maxCacheTime
-
- defer func() {
- maxCacheTime = oldMaxCacheTime
- }()
-
- maxCacheTime = 3
-
- productName := "testProduct"
-
- nowUnixNano := time.Now().UnixNano()
-
- dimensionSelect := map[string]interface{}{}
- dimensionSelect["name"] = "guagua"
- dimensionSelect["age"] = 20
-
- key := getCacheKey(productName, dimensionSelect)
-
- value := map[string]map[string]interface{}{}
-
- value["info"] = map[string]interface{}{}
- value["info"]["id"] = nowUnixNano
-
- setCache(key, value)
- ret := getCache(key, true)
-
- checkOk := false
-
- if ret["info"] != nil && ret["info"]["id"] != nil {
- if id, ok := ret["info"]["id"].(int64); ok && id == nowUnixNano {
- checkOk = true
- }
- }
- if !checkOk {
- t.Errorf("getCacheKey return error,the data we save is missing or incorrect")
- }
-
- time.Sleep(time.Duration(maxCacheTime+1) * time.Second)
-
- if ret = getCache(key, true); ret != nil {
- t.Errorf("getCacheKey return error, cache is not expired")
- }
-
- ret = getCache(key, false)
- checkOk = false
- if ret["info"] != nil && ret["info"]["id"] != nil {
- if id, ok := ret["info"]["id"].(int64); ok && id == nowUnixNano {
- checkOk = true
- }
- }
- if !checkOk {
- t.Errorf("getCacheKey return error,in the non-strict case, our data also fiction, but should exist")
- }
-
- if ret = getCache(key+"a", false); ret != nil {
- t.Errorf("getCacheKey return error, the wrong key returns data")
- }
-
-}
diff --git a/instances/mysql_instances.go b/instances/mysql_instances.go
deleted file mode 100644
index f66a1ba..0000000
--- a/instances/mysql_instances.go
+++ /dev/null
@@ -1,151 +0,0 @@
-package instances
-
-import (
- "encoding/json"
- "fmt"
- "github.com/tencentyun/tencentcloud-exporter/lib/ratelimit"
-
- "github.com/prometheus/common/log"
- cdb "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdb/v20170320"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
-)
-
-/*what we call this product in prom*/
-const MysqlProductName = "mysql"
-
-func init() {
- funcGets[MysqlProductName] = getMysqlInstancesIds
-}
-
-func getMysqlInstancesIds(filters map[string]interface{}) (instanceIdsMap map[string]map[string]interface{},
- errRet error) {
-
- if credentialConfig.AccessKey == "" {
- errRet = fmt.Errorf("error,instantces client is not initialized yet")
- log.Errorf(errRet.Error())
- return
- }
-
- cacheKey := getCacheKey(MysqlProductName, filters)
-
- if instanceIdsMap = getCache(cacheKey, true); instanceIdsMap != nil {
- log.Debugf("product [%s] list from new cache", MysqlProductName)
- return
- }
-
- /*if product api error, we can get from cache.*/
- defer func() {
- if errRet != nil {
- if oldInstanceIdsMap := getCache(cacheKey, false); oldInstanceIdsMap != nil {
- instanceIdsMap = oldInstanceIdsMap
- log.Warnf("product [%s] from old cache, because product list api error", MysqlProductName)
- }
- }
- }()
-
- credential := common.NewCredential(
- credentialConfig.AccessKey,
- credentialConfig.SecretKey,
- )
- cpf := profile.NewClientProfile()
- cpf.HttpProfile.ReqMethod = "POST"
- cpf.HttpProfile.ReqTimeout = 10
-
- mysqlClient, err := cdb.NewClient(credential, credentialConfig.Region, cpf)
- if err != nil {
- errRet = err
- return
- }
- request := cdb.NewDescribeDBInstancesRequest()
-
- var apiCanFilters = map[string]bool{}
-
- fiterName := "ProjectId"
- apiCanFilters[fiterName] = true
- if temp, ok := filters[fiterName].(int); ok {
- tempInt64 := int64(temp)
- request.ProjectId = &tempInt64
- }
-
- fiterName = "InstanceName"
- apiCanFilters[fiterName] = true
- if temp, ok := filters[fiterName].(string); ok {
- request.InstanceNames = []*string{&temp}
- }
-
- fiterName = "InstanceId"
- apiCanFilters[fiterName] = true
- if temp, ok := filters[fiterName].(string); ok {
- request.InstanceIds = []*string{&temp}
- }
-
- instanceIdsMap = make(map[string]map[string]interface{})
- hasGet := make(map[string]bool)
-
- var offset uint64 = 0
- var limit uint64 = 2000
- var total int64 = -1
-
-getMoreInstanceId:
- request.Offset = &offset
- request.Limit = &limit
- ratelimit.Check(request.GetAction())
- response, err := mysqlClient.DescribeDBInstances(request)
- if err != nil {
- ratelimit.Check(request.GetAction())
- response, err = mysqlClient.DescribeDBInstances(request)
- }
- if err != nil {
- errRet = err
- log.Errorf("api[%s] fail, request body [%s], reason[%s]", request.GetAction(), request.ToJsonString(), errRet.Error())
- return
- }
- if total == -1 {
- total = *response.Response.TotalCount
- }
- if len(response.Response.Items) == 0 {
- goto hasGetAll
- }
- for _, v := range response.Response.Items {
- if _, ok := hasGet[*v.InstanceId]; ok {
- errRet = fmt.Errorf("api[%s] return error, has repeat instance id [%s]", request.GetAction(), *v.InstanceId)
- log.Errorf(errRet.Error())
- return
- }
- js, err := json.Marshal(v)
- if err != nil {
- errRet = fmt.Errorf("api[%s] return error, can not json encode [%s]", request.GetAction(), *v.InstanceId)
- log.Errorf(errRet.Error())
- }
- var data map[string]interface{}
-
- err = json.Unmarshal(js, &data)
- if err != nil {
- errRet = fmt.Errorf("api[%s] return error, can not json decode [%s]", request.GetAction(), *v.InstanceId)
- log.Errorf(errRet.Error())
- }
-
- setNonStandardStr("VpcId", v.UniqVpcId, data)
- setNonStandardStr("SubnetId", v.UniqSubnetId, data)
- setNonStandardInt64("ProjectId", v.ProjectId, data)
-
- if meetConditions(filters, data, apiCanFilters) {
- instanceIdsMap[*v.InstanceId] = data
- }
- hasGet[*v.InstanceId] = true
-
- }
- offset += limit
- if total != -1 && int64(offset) >= total {
- goto hasGetAll
- }
- goto getMoreInstanceId
-
-hasGetAll:
-
- if len(instanceIdsMap) > 0 {
- setCache(cacheKey, instanceIdsMap)
- }
- return
-}
diff --git a/instances/nat_instances.go b/instances/nat_instances.go
deleted file mode 100644
index f07c09a..0000000
--- a/instances/nat_instances.go
+++ /dev/null
@@ -1,163 +0,0 @@
-package instances
-
-import (
- "encoding/json"
- "fmt"
- "github.com/prometheus/common/log"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
- vpc "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312"
- "github.com/tencentyun/tencentcloud-exporter/lib/ratelimit"
-)
-
-/*what we call this product in prom*/
-const NatProductName = "nat"
-
-func init() {
- funcGets[NatProductName] = getNatInstancesIds
-}
-
-func getNatInstancesIds(filters map[string]interface{}) (instanceIdsMap map[string]map[string]interface{},
- errRet error) {
-
- if credentialConfig.AccessKey == "" {
- errRet = fmt.Errorf("error,instantces client is not initialized yet")
- log.Errorf(errRet.Error())
- return
- }
-
- cacheKey := getCacheKey(NatProductName, filters)
-
- if instanceIdsMap = getCache(cacheKey, true); instanceIdsMap != nil {
- log.Debugf("product [%s] list from new cache", NatProductName)
- return
- }
-
- /*if product api error, we can get from cache.*/
- defer func() {
- if errRet != nil {
- if oldInstanceIdsMap := getCache(cacheKey, false); oldInstanceIdsMap != nil {
- instanceIdsMap = oldInstanceIdsMap
- log.Warnf("product [%s] from old cache, because product list api error", NatProductName)
- }
- }
- }()
-
- credential := common.NewCredential(
- credentialConfig.AccessKey,
- credentialConfig.SecretKey,
- )
- cpf := profile.NewClientProfile()
- cpf.HttpProfile.ReqMethod = "POST"
- cpf.HttpProfile.ReqTimeout = 10
-
- client, err := vpc.NewClient(credential, credentialConfig.Region, cpf)
- if err != nil {
- errRet = err
- return
- }
- request := vpc.NewDescribeNatGatewaysRequest()
- request.Filters = make([]*vpc.Filter, 0, 3)
-
- var apiCanFilters = map[string]bool{}
-
- fiterName := "VpcId"
- apiCanFilters[fiterName] = true
- if temp, ok := filters[fiterName].(string); ok {
- name := "vpc-id"
- request.Filters = append(request.Filters,
- &vpc.Filter{
- Name: &name,
- Values: []*string{&temp},
- })
- }
-
- fiterName = "InstanceId"
- apiCanFilters[fiterName] = true
- if temp, ok := filters[fiterName].(string); ok {
- name := "nat-gateway-id"
- request.Filters = append(request.Filters,
- &vpc.Filter{
- Name: &name,
- Values: []*string{&temp},
- })
- }
-
- fiterName = "InstanceName"
- apiCanFilters[fiterName] = true
- if temp, ok := filters[fiterName].(string); ok {
- name := "nat-gateway-name"
- request.Filters = append(request.Filters,
- &vpc.Filter{
- Name: &name,
- Values: []*string{&temp},
- })
- }
-
- instanceIdsMap = make(map[string]map[string]interface{})
-
- hasGet := make(map[string]bool)
-
- var offset uint64 = 0
- var limit uint64 = 20
- var total int64 = -1
-
-getMoreInstanceId:
- request.Offset = &offset
- request.Limit = &limit
- ratelimit.Check(request.GetAction())
- response, err := client.DescribeNatGateways(request)
- if err != nil {
- ratelimit.Check(request.GetAction())
- response, err = client.DescribeNatGateways(request)
- }
- if err != nil {
- errRet = err
- log.Errorf("api[%s] fail, request body [%s], reason[%s]", request.GetAction(), request.ToJsonString(), errRet.Error())
- return
- }
- if total == -1 {
- total = int64(*response.Response.TotalCount)
- }
- if len(response.Response.NatGatewaySet) == 0 {
- goto hasGetAll
- }
- for _, v := range response.Response.NatGatewaySet {
- if _, ok := hasGet[*v.NatGatewayId]; ok {
- errRet = fmt.Errorf("api[%s] return error, has repeat instance id [%s]", request.GetAction(), *v.NatGatewayId)
- log.Errorf(errRet.Error())
- return
- }
- js, err := json.Marshal(v)
- if err != nil {
- errRet = fmt.Errorf("api[%s] return error, can not json encode [%s]", request.GetAction(), *v.NatGatewayId)
- log.Errorf(errRet.Error())
- }
- var data map[string]interface{}
-
- err = json.Unmarshal(js, &data)
- if err != nil {
- errRet = fmt.Errorf("api[%s] return error, can not json decode [%s]", request.GetAction(), *v.NatGatewayId)
- log.Errorf(errRet.Error())
- }
-
- setNonStandardStr("InstanceId", v.NatGatewayId, data)
- setNonStandardStr("InstanceName", v.NatGatewayName, data)
-
- if meetConditions(filters, data, apiCanFilters) {
- instanceIdsMap[*v.NatGatewayId] = data
- }
- hasGet[*v.NatGatewayId] = true
- }
- offset += limit
- if total != -1 && int64(offset) >= total {
- goto hasGetAll
- }
- goto getMoreInstanceId
-
-hasGetAll:
- if len(instanceIdsMap) > 0 {
- setCache(cacheKey, instanceIdsMap)
- }
- return
-}
diff --git a/instances/nat_instances_test.go b/instances/nat_instances_test.go
deleted file mode 100644
index 35b997e..0000000
--- a/instances/nat_instances_test.go
+++ /dev/null
@@ -1,51 +0,0 @@
-package instances
-
-import (
- "fmt"
- "github.com/prometheus/common/log"
- "github.com/tencentyun/tencentcloud-exporter/config"
- "os"
- "strings"
- "testing"
-)
-
-func TestGetNatInstancesIds(t *testing.T) {
-
- credentialConfig.AccessKey = os.Getenv(config.EnvAccessKey)
- credentialConfig.SecretKey = os.Getenv(config.EnvSecretKey)
- credentialConfig.Region = os.Getenv(config.EnvRegion)
-
- if credentialConfig.AccessKey == "" || credentialConfig.SecretKey == "" || credentialConfig.Region == "" {
- log.Errorf("should set env TENCENTCLOUD_SECRET_ID , TENCENTCLOUD_SECRET_KEY and TENCENTCLOUD_REGION")
- return
- }
-
- fun := GetInstanceFunc(NatProductName)
- if fun == nil {
- t.Errorf("%s get InstancesIds func not exist.", NatProductName)
- return
- }
- _, err := fun(nil)
- if err != nil {
- t.Errorf("%s get InstancesIds func fail,reason %s", NatProductName, err.Error())
- return
- }
-
- filters := make(map[string]interface{})
-
- filters["InstanceName"] = "t"
-
- instances, err := fun(filters)
- if err != nil {
- t.Errorf("%s get InstancesIds func fail,reason %s", NatProductName, err.Error())
- return
- }
- for instanceId, instance := range instances {
- if !strings.Contains(fmt.Sprintf("%+v", instance["InstanceName"]),
- fmt.Sprintf("%+v", filters["InstanceName"])) {
-
- t.Errorf("%s get InstancesIds return[%s] not match filters", NatProductName, instanceId)
- return
- }
- }
-}
diff --git a/instances/pub_clb_instances.go b/instances/pub_clb_instances.go
deleted file mode 100644
index 4452174..0000000
--- a/instances/pub_clb_instances.go
+++ /dev/null
@@ -1,173 +0,0 @@
-package instances
-
-import (
- "encoding/json"
- "fmt"
- "github.com/tencentyun/tencentcloud-exporter/lib/ratelimit"
- "strings"
-
- "github.com/prometheus/common/log"
- clb "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb/v20180317"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
-)
-
-/*what we call this product in prom*/
-const ClbProductName = "public_clb"
-
-const LoadBalancerTypeInternet = "OPEN"
-const LoadBalancerTypeInternal = "INTERNAL"
-
-func init() {
- funcGets[ClbProductName] = getClbLoadBalancerVips
-}
-
-func getClbLoadBalancerVips(filters map[string]interface{}) (instanceIdsMap map[string]map[string]interface{},
- errRet error) {
-
- if credentialConfig.AccessKey == "" {
- errRet = fmt.Errorf("error,instantces client is not initialized yet")
- log.Errorf(errRet.Error())
- return
- }
-
- cacheKey := getCacheKey(ClbProductName, filters)
-
- if instanceIdsMap = getCache(cacheKey, true); instanceIdsMap != nil {
- log.Debugf("product [%s] list from new cache", ClbProductName)
- return
- }
-
- /*if product api error, we can get from cache.*/
- defer func() {
- if errRet != nil {
- if oldInstanceIdsMap := getCache(cacheKey, false); oldInstanceIdsMap != nil {
- instanceIdsMap = oldInstanceIdsMap
- log.Warnf("product [%s] from old cache, because product list api error", ClbProductName)
- }
- }
- }()
-
- credential := common.NewCredential(
- credentialConfig.AccessKey,
- credentialConfig.SecretKey,
- )
- cpf := profile.NewClientProfile()
- cpf.HttpProfile.ReqMethod = "POST"
- cpf.HttpProfile.ReqTimeout = 10
-
- client, err := clb.NewClient(credential, credentialConfig.Region, cpf)
- if err != nil {
- errRet = err
- return
- }
- request := clb.NewDescribeLoadBalancersRequest()
-
- var apiCanFilters = map[string]bool{}
-
- fiterName := "ProjectId"
- apiCanFilters[fiterName] = true
- if temp, ok := filters[fiterName].(int); ok {
- tempInt64 := int64(temp)
- request.ProjectId = &tempInt64
- }
- fiterName = "VpcId"
- apiCanFilters[fiterName] = true
- if temp, ok := filters[fiterName].(string); ok {
- request.VpcId = &temp
- }
-
- fiterName = "LoadBalancerName"
- apiCanFilters[fiterName] = true
- if temp, ok := filters[fiterName].(string); ok {
- request.LoadBalancerName = &temp
- }
-
- fiterName = "LoadBalancerVip"
- apiCanFilters[fiterName] = true
- if temp, ok := filters[fiterName].(string); ok {
- request.LoadBalancerVips = []*string{&temp}
- }
-
- instanceIdsMap = make(map[string]map[string]interface{})
- hasGet := make(map[string]bool)
-
- var offset int64 = 0
- var limit int64 = 20
- var total int64 = -1
-
-getMoreInstanceId:
- request.Offset = &offset
- request.Limit = &limit
- ratelimit.Check(request.GetAction())
- response, err := client.DescribeLoadBalancers(request)
- if err != nil {
- ratelimit.Check(request.GetAction())
- response, err = client.DescribeLoadBalancers(request)
- }
- if err != nil {
- errRet = err
- log.Errorf("api[%s] fail, request body [%s], reason[%s]", request.GetAction(), request.ToJsonString(), errRet.Error())
- return
- }
- if total == -1 {
- total = int64(*response.Response.TotalCount)
- }
- if len(response.Response.LoadBalancerSet) == 0 {
- goto hasGetAll
- }
- for _, v := range response.Response.LoadBalancerSet {
- if _, ok := hasGet[*v.LoadBalancerId]; ok {
- errRet = fmt.Errorf("api[%s] return error, has repeat instance id [%s]", request.GetAction(), *v.LoadBalancerId)
- log.Errorf(errRet.Error())
- return
- }
- js, err := json.Marshal(v)
- if err != nil {
- errRet = fmt.Errorf("api[%s] return error, can not json encode [%s]", request.GetAction(), *v.LoadBalancerId)
- log.Errorf(errRet.Error())
- }
- var data map[string]interface{}
-
- err = json.Unmarshal(js, &data)
- if err != nil {
- errRet = fmt.Errorf("api[%s] return error, can not json decode [%s]", request.GetAction(), *v.LoadBalancerId)
- log.Errorf(errRet.Error())
- }
-
- if len(v.LoadBalancerVips) == 0 {
- log.Warnf("This clb [%s] has none LoadBalancerVip", *v.LoadBalancerId)
- continue
- }
-
- if len(v.LoadBalancerVips) != 1 {
- log.Errorf("This clb [%s] has %d LoadBalancerVips,we can not solute now.", *v.LoadBalancerId, len(v.LoadBalancerVips))
- continue
- }
- loadBalancerVip := *(v.LoadBalancerVips[0])
-
- if strings.ToUpper(*v.LoadBalancerType) != LoadBalancerTypeInternet {
- continue
- }
- if v.ProjectId != nil {
- data["ProjectId"] = int64(*v.ProjectId)
- }
- if meetConditions(filters, data, apiCanFilters) {
- data["LoadBalancerVip"] = loadBalancerVip
- instanceIdsMap[loadBalancerVip] = data
- }
- hasGet[*v.LoadBalancerId] = true
- }
- offset += limit
- if total != -1 && int64(offset) >= total {
- goto hasGetAll
- }
-
- goto getMoreInstanceId
-
-hasGetAll:
- if len(instanceIdsMap) > 0 {
- setCache(cacheKey, instanceIdsMap)
- }
- return
-}
diff --git a/instances/redis_instances.go b/instances/redis_instances.go
deleted file mode 100644
index c0dcbcf..0000000
--- a/instances/redis_instances.go
+++ /dev/null
@@ -1,165 +0,0 @@
-package instances
-
-import (
- "encoding/json"
- "fmt"
- "github.com/tencentyun/tencentcloud-exporter/lib/ratelimit"
-
- "github.com/prometheus/common/log"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
- redis "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis/v20180412"
-)
-
-/*what we call this product in prom*/
-const RedisProductName = "redis"
-const ClusterRedisProductName = "cluster_redis"
-
-func init() {
- funcGets[RedisProductName] = getRedisInstancesIds
- funcGets[ClusterRedisProductName] = getRedisInstancesIds
-}
-func getRedisInstancesIds(filters map[string]interface{}) (instanceIdsMap map[string]map[string]interface{},
- errRet error) {
-
- if credentialConfig.AccessKey == "" {
- errRet = fmt.Errorf("error,instantces client is not initialized yet")
- log.Errorf(errRet.Error())
- return
- }
-
- cacheKey := getCacheKey(RedisProductName, filters)
-
- if instanceIdsMap = getCache(cacheKey, true); instanceIdsMap != nil {
- log.Debugf("product [%s] list from new cache", RedisProductName)
- return
- }
-
- /*if product api error, we can get from cache.*/
- defer func() {
- if errRet != nil {
- if oldInstanceIdsMap := getCache(cacheKey, false); oldInstanceIdsMap != nil {
- instanceIdsMap = oldInstanceIdsMap
- log.Warnf("product [%s] from old cache, because product list api error", RedisProductName)
- }
- }
- }()
- credential := common.NewCredential(
- credentialConfig.AccessKey,
- credentialConfig.SecretKey,
- )
- cpf := profile.NewClientProfile()
- cpf.HttpProfile.ReqMethod = "POST"
- cpf.HttpProfile.ReqTimeout = 10
-
- client, err := redis.NewClient(credential, credentialConfig.Region, cpf)
- if err != nil {
- errRet = err
- return
- }
- request := redis.NewDescribeInstancesRequest()
-
- var apiCanFilters = map[string]bool{}
-
- fiterName := "ProjectId"
- apiCanFilters[fiterName] = true
- if temp, ok := filters[fiterName].(int); ok {
- tempInt64 := int64(temp)
- request.ProjectIds = []*int64{&tempInt64}
- }
-
- fiterName = "InstanceName"
- apiCanFilters[fiterName] = true
- if temp, ok := filters[fiterName].(string); ok {
- request.InstanceName = &temp
- }
-
- fiterName = "InstanceId"
- apiCanFilters[fiterName] = true
- if temp, ok := filters[fiterName].(string); ok {
- request.InstanceId = &temp
- }
-
- fiterName = "VpcId"
- apiCanFilters[fiterName] = true
- if temp, ok := filters[fiterName].(string); ok {
- request.UniqVpcIds = []*string{&temp}
- }
-
- fiterName = "SubnetId"
- apiCanFilters[fiterName] = true
- if temp, ok := filters[fiterName].(string); ok {
- request.UniqSubnetIds = []*string{&temp}
- }
-
- instanceIdsMap = make(map[string]map[string]interface{})
- hasGet := make(map[string]bool)
-
- var offset uint64 = 0
- var limit uint64 = 20
- var total int64 = -1
-
-getMoreInstanceId:
- request.Offset = &offset
- request.Limit = &limit
- ratelimit.Check(request.GetAction())
- response, err := client.DescribeInstances(request)
- if err != nil {
- ratelimit.Check(request.GetAction())
- response, err = client.DescribeInstances(request)
- }
-
- if err != nil {
- errRet = err
- log.Errorf("api[%s] fail, request body [%s], reason[%s]", request.GetAction(), request.ToJsonString(), errRet.Error())
- return
- }
- if total == -1 {
- total = *response.Response.TotalCount
- }
- if len(response.Response.InstanceSet) == 0 {
- goto hasGetAll
- }
- for _, v := range response.Response.InstanceSet {
- if _, ok := hasGet[*v.InstanceId]; ok {
- errRet = fmt.Errorf("api[%s] return error, has repeat instance id [%s]", request.GetAction(), *v.InstanceId)
- log.Errorf(errRet.Error())
- return
- }
- js, err := json.Marshal(v)
- if err != nil {
- errRet = fmt.Errorf("api[%s] return error, can not json encode [%s]", request.GetAction(), *v.InstanceId)
- log.Errorf(errRet.Error())
- }
- var data map[string]interface{}
-
- err = json.Unmarshal(js, &data)
- if err != nil {
- errRet = fmt.Errorf("api[%s] return error, can not json decode [%s]", request.GetAction(), *v.InstanceId)
- log.Errorf(errRet.Error())
- }
-
- setNonStandardStr("VpcId", v.UniqVpcId, data)
- setNonStandardStr("SubnetId", v.UniqSubnetId, data)
- setNonStandardInt64("ProjectId", v.ProjectId, data)
- setNonStandardInt64("Port", v.Port, data)
- setNonStandardInt64("ZoneId", v.ZoneId, data)
-
- if meetConditions(filters, data, apiCanFilters) {
- instanceIdsMap[*v.InstanceId] = data
- }
- hasGet[*v.InstanceId] = true
-
- }
- offset += limit
- if total != -1 && int64(offset) >= total {
- goto hasGetAll
- }
- goto getMoreInstanceId
-
-hasGetAll:
- if len(instanceIdsMap) > 0 {
- setCache(cacheKey, instanceIdsMap)
- }
- return
-}
diff --git a/lib/ratelimit/config.go b/lib/ratelimit/config.go
deleted file mode 100644
index 2ffe510..0000000
--- a/lib/ratelimit/config.go
+++ /dev/null
@@ -1,10 +0,0 @@
-package ratelimit
-
-//default cgi limit
-
-const (
- DefaultLimit int64 = 5
-)
-
-func init() {
-}
diff --git a/lib/ratelimit/limit.go b/lib/ratelimit/limit.go
deleted file mode 100644
index 0bd838b..0000000
--- a/lib/ratelimit/limit.go
+++ /dev/null
@@ -1,64 +0,0 @@
-package ratelimit
-
-import (
- "fmt"
- "log"
- "math/rand"
- "sync"
- "time"
-
- "github.com/yangwenmai/ratelimit/simpleratelimit"
-)
-
-var (
- limitConfig = make(map[string]int64)
-
- limitContainer = make(map[string]*simpleratelimit.RateLimiter)
-
- locker sync.Mutex
-)
-
-func ProCheck(namespace, action string) {
-
- key := fmt.Sprintf("%s.%s", namespace, action)
-
- var limit *simpleratelimit.RateLimiter
-
- locker.Lock()
-
- limitNumber := limitConfig[key]
- if limitNumber == 0 {
- limitNumber = DefaultLimit
-
- if limitConfig[namespace] != 0 {
- limitNumber = limitConfig[namespace]
- }
- limitConfig[key] = limitNumber
- }
-
- if limitContainer[key] == nil {
- limitContainer[key] = simpleratelimit.New(int(limitNumber), time.Second)
- }
-
- limit = limitContainer[key]
- locker.Unlock()
-
- old := time.Now()
-
- for limit.Limit() {
- //Prevent wake at same time
- sleepMs := 10 + rand.Intn(30)
- time.Sleep(time.Duration(sleepMs) * time.Microsecond)
-
- if time.Since(old) > 5*time.Minute {
- log.Printf("[WARN] %s wait too long, we try to release it", key)
- break
- }
- }
-
-}
-
-func Check(action string) {
-
- ProCheck("", action)
-}
diff --git a/monitor/cdn_monitor.go b/monitor/cdn_monitor.go
deleted file mode 100644
index 67d0b27..0000000
--- a/monitor/cdn_monitor.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package monitor
-
-/*what we call this product in prom*/
-const CdnProductName = "cdn"
-
-/*what they can this product in cloud monitor*/
-const cdnNamespaceInMonitor = "QCE/CDN"
-
-func init() {
- funcGetMultiKeys[CdnProductName] = cdnMultiGetMonitorData
-}
-
-func cdnMultiGetMonitorData(dimensions map[string]interface{},
- metricName string,
- periodSeconds int64,
- rangeSeconds int64,
- delaySeconds int64) (allDataRet map[int64]float64, errRet error) {
-
- return getMonitorDataByMultipleKeys(cdnNamespaceInMonitor,
- dimensions,
- metricName,
- periodSeconds,
- rangeSeconds,
- delaySeconds)
-}
diff --git a/monitor/common.go b/monitor/common.go
deleted file mode 100644
index 6e7534a..0000000
--- a/monitor/common.go
+++ /dev/null
@@ -1,314 +0,0 @@
-package monitor
-
-import (
- "fmt"
- "math"
- "time"
-
- "github.com/tencentyun/tencentcloud-exporter/config"
-
- "github.com/prometheus/common/log"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
- remoteMonitor "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/monitor/v20180724"
- "github.com/yangwenmai/ratelimit/simpleratelimit"
-)
-
-type funcGetMonitorDatasByPrimaryKeys func([]string,
- string,
- int64,
- int64,
- int64,
- map[string]map[string]interface{}) (map[string]map[int64]float64, error)
-
-type funcGetMonitorDatasByMultiKeys func(map[string]interface{},
- string,
- int64,
- int64,
- int64) (map[int64]float64, error)
-
-/*
- How many instances of information can be read per request
- Remote server limit, max is 10
-*/
-const monitorMaxRequestSize = 10
-
-const timeNormalLayout = "2006-01-02 15:04:05"
-
-const errorLogTemplate = "api[%s] fail, request body [%s], reason[%s]"
-
-const debugLogTemplate = "api[%s] success, request body [%s], response body[%s]"
-
-var rateLimit *simpleratelimit.RateLimiter
-
-/*
- Each product has a function that gets metrics
- Format is: [productName]=>function
- eg: funcGets["mysql"]=mysqlGetMonitorData
-*/
-var funcGetPrimaryKeys = map[string]funcGetMonitorDatasByPrimaryKeys{}
-
-var funcGetMultiKeys = map[string]funcGetMonitorDatasByMultiKeys{}
-
-var PrimaryKeys = map[string]string{}
-
-/*
- api client for tentcent qcloud monitor.
-*/
-var remoteClient *remoteMonitor.Client
-
-func splitSlice(slice []string, size int) [][]string {
- if size < 1 {
- size = 10
- }
- length := len(slice)
- chunks := int(math.Ceil(float64(length) / float64(size)))
- var buckets [][]string
- for i, end := 0, 0; chunks > 0; chunks-- {
- end = (i + 1) * size
- if end > length {
- end = length
- }
- buckets = append(buckets, slice[i*size:end])
- i++
- }
- return buckets
-}
-
-/*
- get FuncMonitorData for the product, can get many instances info
-*/
-func GetPrimaryKeyFunc(productName string) funcGetMonitorDatasByPrimaryKeys {
- return funcGetPrimaryKeys[productName]
-}
-
-/*
- get FuncMonitorData for the product, only can get one specail dimensions info
-*/
-func GetMultiKeyFunc(productName string) funcGetMonitorDatasByMultiKeys {
- return funcGetMultiKeys[productName]
-}
-
-func InitClient(credentialConfig config.TencentCredential, rateLimitNumber int64) (errRet error) {
- credential := common.NewCredential(
- credentialConfig.AccessKey,
- credentialConfig.SecretKey,
- )
-
- cpf := profile.NewClientProfile()
- cpf.HttpProfile.ReqMethod = "POST"
- cpf.HttpProfile.ReqTimeout = 10
-
- client, err := remoteMonitor.NewClient(credential, credentialConfig.Region, cpf)
- if err != nil {
- errRet = err
- return
- }
- rateLimit = simpleratelimit.New(int(rateLimitNumber), time.Second)
- remoteClient = client
- return
-}
-
-func rateLimitCheck() {
- var sleepCount = 0
- for rateLimit.Limit() {
- sleepCount++
- if sleepCount > 10000 {
- log.Warnf("rate_limit sleep too much.")
- break
- }
- time.Sleep(time.Microsecond)
- }
- if sleepCount > 0 {
- log.Warnf("Hit rate_limit logic, a total of time delay is %f seconds", float64(sleepCount)/1000)
- }
-}
-
-/*
- get monitor data from qcloud, all dimensions used to determine the key
- if func return 'errRet!=nil', allDataRet is empty, diff from getMonitorDataByPrimarykey
-*/
-func getMonitorDataByMultipleKeys(namespaceInMonitor string,
- dimensions map[string]interface{},
- metricName string,
- periodSeconds int64,
- rangeSeconds int64,
- delaySeconds int64) (allDataRet map[int64]float64, errRet error) {
-
- if remoteClient == nil {
- errRet = fmt.Errorf("error,remote monitor client is not initialized yet")
- log.Errorf(errRet.Error())
- return
- }
-
- rangeCount := rangeSeconds/periodSeconds - 1
- if rangeCount < 0 {
- rangeCount = 0
- }
-
- var (
- endTime = ((time.Now().Unix() - delaySeconds) / periodSeconds) * periodSeconds
- startTime = endTime - rangeCount*periodSeconds
- periodSecondsUint64 = uint64(periodSeconds)
- )
-
- startTimeStr := time.Unix(startTime, 0).Format(timeNormalLayout)
- endTimeStr := time.Unix(endTime, 0).Format(timeNormalLayout)
-
- request := remoteMonitor.NewGetMonitorDataRequest()
- request.Namespace = &namespaceInMonitor
- request.MetricName = &metricName
- request.Period = &periodSecondsUint64
- request.StartTime = &startTimeStr
- request.EndTime = &endTimeStr
-
- var requestDimensions = make([]*remoteMonitor.Dimension, 0, len(dimensions))
- var instance remoteMonitor.Instance
-
- for dName, dValue := range dimensions {
- if len(dName) == 0 {
- continue
- }
- var (
- strName = dName
- strValue = fmt.Sprintf("%v", dValue)
- dimension remoteMonitor.Dimension
- )
- dimension.Name = &strName
- dimension.Value = &strValue
- requestDimensions = append(requestDimensions, &dimension)
- }
- instance.Dimensions = requestDimensions
- request.Instances = []*remoteMonitor.Instance{&instance}
-
- rateLimitCheck()
-
- response, err := remoteClient.GetMonitorData(request)
- if err != nil {
- errRet = err
- log.Errorf(errorLogTemplate, request.GetAction(), request.ToJsonString(), errRet.Error())
- return
- } else {
- log.Debugf(debugLogTemplate, request.GetAction(), request.ToJsonString(), response.ToJsonString())
- }
-
- if len(response.Response.DataPoints) == 0 {
- log.Warnf("[Response.DataPoints].The product dimensions has not monitor data at this time yet[instance is not use or not exist or not report to monitor now], monitor return: %s", response.ToJsonString())
- return
- }
-
- dataPoint := response.Response.DataPoints[0]
-
- if len(dataPoint.Values) == 0 {
- log.Warnf("[Response.DataPoints.Values].The product dimensions has not monitor data at this time yet[instance is not use or not exist or not report to monitor now], monitor return: %s", response.ToJsonString())
- return
- }
-
- if len(dataPoint.Timestamps) != len(dataPoint.Values) {
- errRet = fmt.Errorf("api return error, len(Response.DataPoints.Dimensions.Timestamps) != len(Response.DataPoints.Dimensions.Values) ")
- log.Errorf(errorLogTemplate, request.GetAction(), request.ToJsonString(), errRet.Error())
- return
- }
- allDataRet = make(map[int64]float64, len(dataPoint.Timestamps))
- for index, value := range dataPoint.Timestamps {
- allDataRet[int64(*value)] = *(dataPoint.Values[index])
- }
- return
-}
-
-/*
-get monitor data from qcloud, the primary key (eg:InstanceId) is the information used to determine the instance
-
-if func return 'errRet!=nil', we also have to deal with it 'allDataRet'
-*/
-func getMonitorDataByPrimarykey(namespaceInMonitor string,
- primaryKeys []string,
- primaryKeyName string,
- metricName string,
- periodSeconds int64,
- rangeSeconds int64,
- delaySeconds int64) (allDataRet map[string]map[int64]float64, errRet error) {
-
- if remoteClient == nil {
- errRet = fmt.Errorf("error,remote monitor client is not initialized yet")
- log.Errorf(errRet.Error())
- return
- }
-
- rangeCount := rangeSeconds/periodSeconds - 1
- if rangeCount < 0 {
- rangeCount = 0
- }
-
- allDataRet = make(map[string]map[int64]float64)
-
- var (
- endTime = ((time.Now().Unix() - delaySeconds) / periodSeconds) * periodSeconds
- startTime = endTime - rangeCount*periodSeconds
- periodSecondsUint64 = uint64(periodSeconds)
- )
-
- startTimeStr := time.Unix(startTime, 0).Format(timeNormalLayout)
- endTimeStr := time.Unix(endTime, 0).Format(timeNormalLayout)
-
- request := remoteMonitor.NewGetMonitorDataRequest()
- request.Namespace = &namespaceInMonitor
- request.MetricName = &metricName
- request.Period = &periodSecondsUint64
- request.StartTime = &startTimeStr
- request.EndTime = &endTimeStr
-
- buckets := splitSlice(primaryKeys, monitorMaxRequestSize)
-
- for _, bucket := range buckets {
- request.Instances = make([]*remoteMonitor.Instance, 0, len(bucket))
- for index := range bucket {
- var dimension remoteMonitor.Dimension
- var instance remoteMonitor.Instance
- dimension.Name = &primaryKeyName
- dimension.Value = &bucket[index]
- instance.Dimensions = []*remoteMonitor.Dimension{&dimension}
- request.Instances = append(request.Instances, &instance)
- }
- rateLimitCheck()
- response, err := remoteClient.GetMonitorData(request)
-
- if err != nil {
- errRet = err
- log.Errorf(errorLogTemplate, request.GetAction(), request.ToJsonString(), errRet.Error())
- continue
- } else {
- log.Debugf(debugLogTemplate, request.GetAction(), request.ToJsonString(), response.ToJsonString())
- }
-
- for _, dataPoint := range response.Response.DataPoints {
- if len(dataPoint.Dimensions) != 1 {
- errRet = fmt.Errorf("api return error, Response.DataPoints.Dimensions too long")
- log.Errorf(errorLogTemplate, request.GetAction(), request.ToJsonString(), errRet.Error())
- continue
- }
- if *(dataPoint.Dimensions[0].Name) != primaryKeyName {
- errRet = fmt.Errorf("api return error, Response.DataPoints.Dimensions not return %s", primaryKeyName)
- log.Errorf(errorLogTemplate, request.GetAction(), request.ToJsonString(), errRet.Error())
- continue
- }
-
- if len(dataPoint.Values) == 0 {
- log.Warnf("some product instances has not monitor data at this time yet[instance is not use or not exist or not report to monitor now], instance is: %s", *dataPoint.Dimensions[0].Value)
- }
-
- returnPrimaryKey := *(dataPoint.Dimensions[0].Value)
- if len(dataPoint.Timestamps) != len(dataPoint.Values) {
- errRet = fmt.Errorf("api return error, len(Response.DataPoints.Dimensions.Timestamps) != len(Response.DataPoints.Dimensions.Values) ")
- log.Errorf(errorLogTemplate, request.GetAction(), request.ToJsonString(), errRet.Error())
- continue
- }
- oneInstanceResult := make(map[int64]float64, len(dataPoint.Timestamps))
- for index, value := range dataPoint.Timestamps {
- oneInstanceResult[int64(*value)] = *(dataPoint.Values[index])
- }
- allDataRet[returnPrimaryKey] = oneInstanceResult
- }
- }
- return
-}
diff --git a/monitor/cos_monitor.go b/monitor/cos_monitor.go
deleted file mode 100644
index e32950c..0000000
--- a/monitor/cos_monitor.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package monitor
-
-/*what we call this product in prom*/
-const CosProductName = "cos"
-
-/*what they can this product in cloud monitor*/
-const cosNamespaceInMonitor = "QCE/COS"
-
-func init() {
- funcGetMultiKeys[CosProductName] = cosMultiGetMonitorData
-}
-
-func cosMultiGetMonitorData(dimensions map[string]interface{},
- metricName string,
- periodSeconds int64,
- rangeSeconds int64,
- delaySeconds int64) (allDataRet map[int64]float64, errRet error) {
-
- return getMonitorDataByMultipleKeys(cosNamespaceInMonitor,
- dimensions,
- metricName,
- periodSeconds,
- rangeSeconds,
- delaySeconds)
-}
diff --git a/monitor/cvm_monitor.go b/monitor/cvm_monitor.go
deleted file mode 100644
index 1025496..0000000
--- a/monitor/cvm_monitor.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package monitor
-
-/*what we call this product in prom*/
-const CvmProductName = "cvm"
-
-/*what they can this product in cloud monitor*/
-const cvmNamespaceInMonitor = "QCE/CVM"
-
-func init() {
- funcGetPrimaryKeys[CvmProductName] = cvmGetMonitorData
- PrimaryKeys[CvmProductName] = "InstanceId"
-}
-
-func cvmGetMonitorData(instanceIds []string,
- metricName string,
- periodSeconds int64,
- rangeSeconds int64,
- delaySeconds int64,
- instances map[string]map[string]interface{}) (allDataRet map[string]map[int64]float64, errRet error) {
-
- _ = instances
-
- return getMonitorDataByPrimarykey(cvmNamespaceInMonitor,
- instanceIds,
- PrimaryKeys[CvmProductName],
- metricName,
- periodSeconds,
- rangeSeconds,
- delaySeconds)
-}
diff --git a/monitor/dc_monitor.go b/monitor/dc_monitor.go
deleted file mode 100644
index 60d933c..0000000
--- a/monitor/dc_monitor.go
+++ /dev/null
@@ -1,54 +0,0 @@
-package monitor
-
-/*what we call this product in prom*/
-const DcProductName = "dc"
-const DcxProductName = "dcx"
-
-/*what they can this product in cloud monitor*/
-const dcNamespaceInMonitor = "QCE/DC"
-const dcxNamespaceInMonitor = "QCE/DCX"
-
-func init() {
- funcGetPrimaryKeys[DcProductName] = dcGetMonitorData
- PrimaryKeys[DcProductName] = "DirectConnectId"
-
- funcGetPrimaryKeys[DcxProductName] = dcxGetMonitorData
- PrimaryKeys[DcxProductName] = "DirectConnectTunnelId"
-
-}
-
-func dcGetMonitorData(instanceIds []string,
- metricName string,
- periodSeconds int64,
- rangeSeconds int64,
- delaySeconds int64,
- instances map[string]map[string]interface{}) (allDataRet map[string]map[int64]float64, errRet error) {
-
- _ = instances
-
- return getMonitorDataByPrimarykey(dcNamespaceInMonitor,
- instanceIds,
- "directConnectId",
- metricName,
- periodSeconds,
- rangeSeconds,
- delaySeconds)
-}
-
-func dcxGetMonitorData(instanceIds []string,
- metricName string,
- periodSeconds int64,
- rangeSeconds int64,
- delaySeconds int64,
- instances map[string]map[string]interface{}) (allDataRet map[string]map[int64]float64, errRet error) {
-
- _ = instances
-
- return getMonitorDataByPrimarykey(dcxNamespaceInMonitor,
- instanceIds,
- "directConnectConnId",
- metricName,
- periodSeconds,
- rangeSeconds,
- delaySeconds)
-}
diff --git a/monitor/mysql_monitor.go b/monitor/mysql_monitor.go
deleted file mode 100644
index b349284..0000000
--- a/monitor/mysql_monitor.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package monitor
-
-/*what we call this product in prom*/
-const MysqlProductName = "mysql"
-
-/*what they can this product in cloud monitor*/
-const mysqlNamespaceInMonitor = "QCE/CDB"
-
-func init() {
- funcGetPrimaryKeys[MysqlProductName] = mysqlGetMonitorData
- PrimaryKeys[MysqlProductName] = "InstanceId"
-}
-
-func mysqlGetMonitorData(instanceIds []string,
- metricName string,
- periodSeconds int64,
- rangeSeconds int64,
- delaySeconds int64,
- instances map[string]map[string]interface{}) (allDataRet map[string]map[int64]float64, errRet error) {
-
- _ = instances
-
- return getMonitorDataByPrimarykey(mysqlNamespaceInMonitor,
- instanceIds,
- PrimaryKeys[MysqlProductName],
- metricName,
- periodSeconds,
- rangeSeconds,
- delaySeconds)
-}
diff --git a/monitor/nat_monitor.go b/monitor/nat_monitor.go
deleted file mode 100644
index aa4cdb6..0000000
--- a/monitor/nat_monitor.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package monitor
-
-/*what we call this product in prom*/
-const NatProductName = "nat"
-
-/*what they can this product in cloud monitor*/
-const natNamespaceInMonitor = "QCE/NAT_GATEWAY"
-
-func init() {
- funcGetPrimaryKeys[NatProductName] = natGetMonitorData
- PrimaryKeys[NatProductName] = "InstanceId"
-}
-
-func natGetMonitorData(instanceIds []string,
- metricName string,
- periodSeconds int64,
- rangeSeconds int64,
- delaySeconds int64,
- instances map[string]map[string]interface{}) (allDataRet map[string]map[int64]float64, errRet error) {
-
- _ = instances
-
- return getMonitorDataByPrimarykey(natNamespaceInMonitor,
- instanceIds,
- "natId", //in redis they call nat instance id "natId" in monitor.
- metricName,
- periodSeconds,
- rangeSeconds,
- delaySeconds)
-}
diff --git a/monitor/pub_clb_monitor.go b/monitor/pub_clb_monitor.go
deleted file mode 100644
index ee521fa..0000000
--- a/monitor/pub_clb_monitor.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package monitor
-
-/*what we call this product in prom*/
-const ClbProductName = "public_clb"
-
-/*what they can this product in cloud monitor*/
-const clbNamespaceInMonitor = "QCE/LB_PUBLIC"
-
-func init() {
- funcGetPrimaryKeys[ClbProductName] = clbGetMonitorData
- PrimaryKeys[ClbProductName] = "LoadBalancerVip"
-}
-
-func clbGetMonitorData(instanceIds []string,
- metricName string,
- periodSeconds int64,
- rangeSeconds int64,
- delaySeconds int64,
- instances map[string]map[string]interface{}) (allDataRet map[string]map[int64]float64, errRet error) {
-
- _ = instances
-
- return getMonitorDataByPrimarykey(clbNamespaceInMonitor,
- instanceIds,
- "vip", //in redis they call LoadBalancerVip "vip" in monitor.
- metricName,
- periodSeconds,
- rangeSeconds,
- delaySeconds)
-}
diff --git a/monitor/redis_monitor.go b/monitor/redis_monitor.go
deleted file mode 100644
index 07c3de7..0000000
--- a/monitor/redis_monitor.go
+++ /dev/null
@@ -1,96 +0,0 @@
-package monitor
-
-import (
- "fmt"
-)
-
-/*what we call this product in prom*/
-const RedisProductName = "redis"
-const ClusterRedisProductName = "cluster_redis"
-
-/*what they can this product in cloud monitor*/
-const redisNamespaceInMonitor = "QCE/REDIS"
-
-/*https://cloud.tencent.com/document/product/239/20018*/
-const (
- REDIS_VERSION_OLD_CLUSTER_REDIS = "1"
- REDIS_VERSION_MASTER_SLAVE_REDIS = "2"
- REDIS_VERSION_MASTER_SLAVE_CKV = "3"
- REDIS_VERSION_CLUSTER_CKV = "4"
- REDIS_VERSION_STANDALONE_REDIS = "5"
- REDIS_VERSION_CLUSTER_REDIS_V4 = "6"
- REDIS_VERSION_CLUSTER_REDIS = "7"
-)
-
-var noneClusterVersions = map[string]bool{
-
- REDIS_VERSION_OLD_CLUSTER_REDIS: true,
- REDIS_VERSION_MASTER_SLAVE_CKV: true,
- REDIS_VERSION_CLUSTER_CKV: true,
-}
-
-func init() {
- funcGetPrimaryKeys[RedisProductName] = nonClusterRedisGetMonitorData
- funcGetPrimaryKeys[ClusterRedisProductName] = clusterRedisGetMonitorData
-
- PrimaryKeys[RedisProductName] = "InstanceId"
- PrimaryKeys[ClusterRedisProductName] = "InstanceId"
-}
-
-func nonClusterRedisGetMonitorData(instanceIds []string,
- metricName string,
- periodSeconds int64,
- rangeSeconds int64,
- delaySeconds int64,
- instances map[string]map[string]interface{}) (allDataRet map[string]map[int64]float64,
- errRet error) {
-
- _ = instances
-
- noneClusterIds := make([]string, 0, len(instanceIds))
- for id, data := range instances {
- redisVersion := fmt.Sprintf("%v", data["Type"])
- if noneClusterVersions[redisVersion] {
- noneClusterIds = append(noneClusterIds, id)
- }
- }
- if len(noneClusterIds) == 0 {
- return
- }
- return getMonitorDataByPrimarykey(redisNamespaceInMonitor,
- noneClusterIds,
- "redis_uuid",
- metricName,
- periodSeconds,
- rangeSeconds,
- delaySeconds)
-}
-
-func clusterRedisGetMonitorData(instanceIds []string,
- metricName string,
- periodSeconds int64,
- rangeSeconds int64,
- delaySeconds int64,
- instances map[string]map[string]interface{}) (allDataRet map[string]map[int64]float64,
- errRet error) {
-
- _ = instances
-
- clusterIds := make([]string, 0, len(instanceIds))
- for id, data := range instances {
- redisVersion := fmt.Sprintf("%v", data["Type"])
- if !noneClusterVersions[redisVersion] {
- clusterIds = append(clusterIds, id)
- }
- }
- if len(clusterIds) == 0 {
- return
- }
- return getMonitorDataByPrimarykey(redisNamespaceInMonitor,
- clusterIds,
- "instanceid",
- metricName,
- periodSeconds,
- rangeSeconds,
- delaySeconds)
-}
diff --git a/pkg/client/client.go b/pkg/client/client.go
new file mode 100644
index 0000000..23c131b
--- /dev/null
+++ b/pkg/client/client.go
@@ -0,0 +1,101 @@
+package client
+
+import (
+ cdb "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdb/v20170320"
+ clb "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb/v20180317"
+ "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
+ "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
+ cvm "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312"
+ dc "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dc/v20180410"
+ mongodb "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mongodb/v20190725"
+ monitor "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/monitor/v20180724"
+ redis "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis/v20180412"
+ vpc "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/config"
+)
+
+func NewMonitorClient(conf *config.TencentConfig) (*monitor.Client, error) {
+ credential := common.NewCredential(
+ conf.Credential.AccessKey,
+ conf.Credential.SecretKey,
+ )
+ cpf := profile.NewClientProfile()
+ cpf.HttpProfile.Endpoint = "monitor.tencentcloudapi.com"
+ return monitor.NewClient(credential, conf.Credential.Region, cpf)
+}
+
+func NewMongodbClient(conf *config.TencentConfig) (*mongodb.Client, error) {
+ credential := common.NewCredential(
+ conf.Credential.AccessKey,
+ conf.Credential.SecretKey,
+ )
+ cpf := profile.NewClientProfile()
+ cpf.HttpProfile.Endpoint = "mongodb.tencentcloudapi.com"
+ return mongodb.NewClient(credential, conf.Credential.Region, cpf)
+
+}
+
+func NewCdbClient(conf *config.TencentConfig) (*cdb.Client, error) {
+ credential := common.NewCredential(
+ conf.Credential.AccessKey,
+ conf.Credential.SecretKey,
+ )
+ cpf := profile.NewClientProfile()
+ cpf.HttpProfile.Endpoint = "cdb.tencentcloudapi.com"
+ return cdb.NewClient(credential, conf.Credential.Region, cpf)
+
+}
+
+func NewCvmClient(conf *config.TencentConfig) (*cvm.Client, error) {
+ credential := common.NewCredential(
+ conf.Credential.AccessKey,
+ conf.Credential.SecretKey,
+ )
+ cpf := profile.NewClientProfile()
+ cpf.HttpProfile.Endpoint = "cvm.tencentcloudapi.com"
+ return cvm.NewClient(credential, conf.Credential.Region, cpf)
+
+}
+
+func NewRedisClient(conf *config.TencentConfig) (*redis.Client, error) {
+ credential := common.NewCredential(
+ conf.Credential.AccessKey,
+ conf.Credential.SecretKey,
+ )
+ cpf := profile.NewClientProfile()
+ cpf.HttpProfile.Endpoint = "redis.tencentcloudapi.com"
+ return redis.NewClient(credential, conf.Credential.Region, cpf)
+}
+
+func NewDcClient(conf *config.TencentConfig) (*dc.Client, error) {
+ credential := common.NewCredential(
+ conf.Credential.AccessKey,
+ conf.Credential.SecretKey,
+ )
+ cpf := profile.NewClientProfile()
+ cpf.HttpProfile.Endpoint = "dc.tencentcloudapi.com"
+ return dc.NewClient(credential, conf.Credential.Region, cpf)
+
+}
+
+func NewClbClient(conf *config.TencentConfig) (*clb.Client, error) {
+ credential := common.NewCredential(
+ conf.Credential.AccessKey,
+ conf.Credential.SecretKey,
+ )
+ cpf := profile.NewClientProfile()
+ cpf.HttpProfile.Endpoint = "clb.tencentcloudapi.com"
+ return clb.NewClient(credential, conf.Credential.Region, cpf)
+
+}
+
+func NewVpvClient(conf *config.TencentConfig) (*vpc.Client, error) {
+ credential := common.NewCredential(
+ conf.Credential.AccessKey,
+ conf.Credential.SecretKey,
+ )
+ cpf := profile.NewClientProfile()
+ cpf.HttpProfile.Endpoint = "vpc.tencentcloudapi.com"
+ return vpc.NewClient(credential, conf.Credential.Region, cpf)
+
+}
diff --git a/pkg/collector/collector.go b/pkg/collector/collector.go
new file mode 100644
index 0000000..21586c7
--- /dev/null
+++ b/pkg/collector/collector.go
@@ -0,0 +1,116 @@
+package collector
+
+import (
+ "fmt"
+ "github.com/go-kit/kit/log"
+ "github.com/go-kit/kit/log/level"
+ "github.com/prometheus/client_golang/prometheus"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/config"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/metric"
+ "sync"
+ "time"
+)
+
+const exporterNamespace = "tcm"
+
+var (
+ scrapeDurationDesc = prometheus.NewDesc(
+ prometheus.BuildFQName(exporterNamespace, "scrape", "collector_duration_seconds"),
+ "qcloud_exporter: Duration of a collector scrape.",
+ []string{"collector"},
+ nil,
+ )
+ scrapeSuccessDesc = prometheus.NewDesc(
+ prometheus.BuildFQName(exporterNamespace, "scrape", "collector_success"),
+ "qcloud_exporter: Whether a collector succeeded.",
+ []string{"collector"},
+ nil,
+ )
+)
+
+const (
+ defaultHandlerEnabled = true
+)
+
+var (
+ collectorState = make(map[string]int)
+)
+
+type TcMonitorCollector struct {
+ Collectors map[string]*TcProductCollector
+ config *config.TencentConfig
+ logger log.Logger
+ lock sync.Mutex
+}
+
+func (n *TcMonitorCollector) Describe(ch chan<- *prometheus.Desc) {
+ ch <- scrapeDurationDesc
+ ch <- scrapeSuccessDesc
+}
+
+func (n *TcMonitorCollector) Collect(ch chan<- prometheus.Metric) {
+ n.lock.Lock()
+ defer n.lock.Unlock()
+
+ wg := sync.WaitGroup{}
+ wg.Add(len(n.Collectors))
+ for name, c := range n.Collectors {
+ go func(name string, c *TcProductCollector) {
+ defer wg.Done()
+ collect(name, c, ch, n.logger)
+ }(name, c)
+ }
+ wg.Wait()
+}
+
+func collect(name string, c *TcProductCollector, ch chan<- prometheus.Metric, logger log.Logger) {
+ begin := time.Now()
+ level.Info(logger).Log("msg", "Start collect......", "name", name)
+
+ err := c.Collect(ch)
+ duration := time.Since(begin)
+ var success float64
+
+ if err != nil {
+ level.Error(logger).Log("msg", "Collector failed", "name", name, "duration_seconds", duration.Seconds(), "err", err)
+ success = 0
+ } else {
+ level.Info(logger).Log("msg", "Collect done", "name", name, "duration_seconds", duration.Seconds())
+ success = 1
+ }
+ ch <- prometheus.MustNewConstMetric(scrapeDurationDesc, prometheus.GaugeValue, duration.Seconds(), name)
+ ch <- prometheus.MustNewConstMetric(scrapeSuccessDesc, prometheus.GaugeValue, success, name)
+}
+
+func NewTcMonitorCollector(conf *config.TencentConfig, logger log.Logger) (*TcMonitorCollector, error) {
+ collectors := make(map[string]*TcProductCollector)
+
+ metricRepo, err := metric.NewTcmMetricRepository(conf, logger)
+ if err != nil {
+ return nil, err
+ }
+ // 使用meta缓存
+ metricRepoCache := metric.NewTcmMetricCache(metricRepo, logger)
+
+ for _, namespace := range conf.GetNamespaces() {
+ state, exists := collectorState[namespace]
+ if exists && state == 1 {
+ continue
+ }
+
+ collector, err := NewTcProductCollector(namespace, metricRepoCache, conf, logger)
+ if err != nil {
+ panic(fmt.Sprintf("Create product collecter fail, err=%s, Namespace=%s", err, namespace))
+ }
+ collectors[namespace] = collector
+ collectorState[namespace] = 1
+ level.Info(logger).Log("msg", "Create product collecter ok", "Namespace", namespace)
+ }
+
+ level.Info(logger).Log("msg", "Create all product collecter ok", "num", len(collectors))
+ return &TcMonitorCollector{
+ Collectors: collectors,
+ config: conf,
+ logger: logger,
+ }, nil
+}
diff --git a/pkg/collector/handler.go b/pkg/collector/handler.go
new file mode 100644
index 0000000..852f645
--- /dev/null
+++ b/pkg/collector/handler.go
@@ -0,0 +1,87 @@
+package collector
+
+import (
+ "fmt"
+ "github.com/go-kit/kit/log"
+ "github.com/go-kit/kit/log/level"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/metric"
+)
+
+var (
+ handlerFactoryMap = make(map[string]func(*TcProductCollector, log.Logger) (productHandler, error))
+)
+
+type productHandler interface {
+ GetNamespace() string
+ IsIncludeMetric(m *metric.TcmMetric) bool
+ GetSeries(tcmMetric *metric.TcmMetric) (series []*metric.TcmSeries, err error)
+}
+
+func registerHandler(namespace string, isDefaultEnabled bool, factory func(*TcProductCollector, log.Logger) (productHandler, error)) {
+ handlerFactoryMap[namespace] = factory
+}
+
+type baseProductHandler struct {
+ monitorQueryKey string
+ collector *TcProductCollector
+ logger log.Logger
+}
+
+func (h *baseProductHandler) GetSeries(m *metric.TcmMetric) (slist []*metric.TcmSeries, err error) {
+ if len(m.Conf.OnlyIncludeInstances) != 0 {
+ for _, insId := range m.Conf.OnlyIncludeInstances {
+ ins, err := h.collector.InstanceRepo.Get(insId)
+ if err != nil {
+ level.Error(h.logger).Log("msg", "Instance not found", "id", insId)
+ continue
+ }
+ ql := map[string]string{
+ h.monitorQueryKey: ins.GetInstanceId(),
+ }
+ s, err := metric.NewTcmSeries(m, ql, ins)
+ if err != nil {
+ level.Error(h.logger).Log("msg", "Create metric series fail", "metric", m.Meta.MetricName, "instacne", insId)
+ continue
+ }
+ slist = append(slist, s)
+ }
+ } else if m.Conf.AllInstances {
+ insList, err := h.collector.InstanceRepo.ListByFilters(m.Conf.InstanceFilters)
+ if err != nil {
+ return nil, err
+ }
+ for _, ins := range insList {
+ ql := map[string]string{
+ h.monitorQueryKey: ins.GetInstanceId(),
+ }
+ s, err := metric.NewTcmSeries(m, ql, ins)
+ if err != nil {
+ level.Error(h.logger).Log("msg", "Create metric series fail", "metric", m.Meta.MetricName, "instacne", ins.GetInstanceId())
+ continue
+ }
+ slist = append(slist, s)
+ }
+ } else {
+ for _, ql := range m.Conf.CustomQueryDimensions {
+ v, ok := ql[h.monitorQueryKey]
+ if !ok {
+ level.Error(h.logger).Log("msg", fmt.Sprintf("not found %s in queryDimensions", h.monitorQueryKey),
+ "ql", fmt.Sprintf("%v", ql))
+ continue
+ }
+ ins, err := h.collector.InstanceRepo.Get(v)
+ if err != nil {
+ level.Error(h.logger).Log("msg", "Instance not found", "id", v)
+ continue
+ }
+
+ s, err := metric.NewTcmSeries(m, ql, ins)
+ if err != nil {
+ level.Error(h.logger).Log("msg", "Create metric series fail", "metric", m.Meta.MetricName, "instacne", ins.GetInstanceId())
+ continue
+ }
+ slist = append(slist, s)
+ }
+ }
+ return
+}
diff --git a/pkg/collector/handler_cdb.go b/pkg/collector/handler_cdb.go
new file mode 100644
index 0000000..7711280
--- /dev/null
+++ b/pkg/collector/handler_cdb.go
@@ -0,0 +1,39 @@
+package collector
+
+import (
+ "github.com/go-kit/kit/log"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/metric"
+)
+
+const (
+ CdbNamespace = "QCE/CDB"
+ CdbInstanceidKey = "InstanceId"
+)
+
+func init() {
+ registerHandler(CdbNamespace, defaultHandlerEnabled, NewCdbHandler)
+}
+
+type cdbHandler struct {
+ baseProductHandler
+}
+
+func (h *cdbHandler) GetNamespace() string {
+ return CdbNamespace
+}
+
+func (h *cdbHandler) IsIncludeMetric(m *metric.TcmMetric) bool {
+ return true
+}
+
+func NewCdbHandler(c *TcProductCollector, logger log.Logger) (handler productHandler, err error) {
+ handler = &cdbHandler{
+ baseProductHandler{
+ monitorQueryKey: CdbInstanceidKey,
+ collector: c,
+ logger: logger,
+ },
+ }
+ return
+
+}
diff --git a/pkg/collector/handler_cdn.go b/pkg/collector/handler_cdn.go
new file mode 100644
index 0000000..390aff2
--- /dev/null
+++ b/pkg/collector/handler_cdn.go
@@ -0,0 +1,67 @@
+package collector
+
+import (
+ "fmt"
+ "github.com/go-kit/kit/log"
+ "github.com/go-kit/kit/log/level"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/metric"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/util"
+)
+
+const (
+ CdnNamespace = "QCE/CDN"
+)
+
+func init() {
+ registerHandler(CdnNamespace, defaultHandlerEnabled, NewCdnHandler)
+}
+
+type cdnHandler struct {
+ baseProductHandler
+}
+
+func (h *cdnHandler) GetNamespace() string {
+ return CdnNamespace
+}
+
+func (h *cdnHandler) IsIncludeMetric(m *metric.TcmMetric) bool {
+ return true
+}
+
+func (h *cdnHandler) GetSeries(m *metric.TcmMetric) (slist []*metric.TcmSeries, err error) {
+ for _, ql := range m.Conf.CustomQueryDimensions {
+ if !h.checkMonitorQueryKeys(m, ql) {
+ continue
+ }
+
+ s, err := metric.NewTcmSeries(m, ql, nil)
+ if err != nil {
+ level.Error(h.logger).Log("msg", "Create metric series fail", "metric", m.Meta.MetricName,
+ "ql", fmt.Sprintf("%v", ql))
+ continue
+ }
+ slist = append(slist, s)
+ }
+ return
+}
+
+func (h *cdnHandler) checkMonitorQueryKeys(m *metric.TcmMetric, ql map[string]string) bool {
+ for k := range ql {
+ if !util.IsStrInList(m.Meta.SupportDimensions, k) {
+ level.Error(h.logger).Log("msg", fmt.Sprintf("not found %s in supportQueryDimensions", k),
+ "ql", fmt.Sprintf("%v", ql))
+ return false
+ }
+ }
+ return true
+}
+
+func NewCdnHandler(c *TcProductCollector, logger log.Logger) (handler productHandler, err error) {
+ handler = &cdnHandler{
+ baseProductHandler{
+ collector: c,
+ logger: logger,
+ },
+ }
+ return
+}
diff --git a/pkg/collector/handler_clb.go b/pkg/collector/handler_clb.go
new file mode 100644
index 0000000..22d3678
--- /dev/null
+++ b/pkg/collector/handler_clb.go
@@ -0,0 +1,39 @@
+package collector
+
+import (
+ "github.com/go-kit/kit/log"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/metric"
+)
+
+const (
+ ClbNamespace = "QCE/LB_PUBLIC"
+ ClbInstanceidKey = "vip"
+)
+
+func init() {
+ registerHandler(ClbNamespace, defaultHandlerEnabled, NewClbHandler)
+}
+
+type clbHandler struct {
+ baseProductHandler
+}
+
+func (h *clbHandler) GetNamespace() string {
+ return ClbNamespace
+}
+
+func (h *clbHandler) IsIncludeMetric(m *metric.TcmMetric) bool {
+ return true
+}
+
+func NewClbHandler(c *TcProductCollector, logger log.Logger) (handler productHandler, err error) {
+ handler = &clbHandler{
+ baseProductHandler{
+ monitorQueryKey: ClbInstanceidKey,
+ collector: c,
+ logger: logger,
+ },
+ }
+ return
+
+}
diff --git a/pkg/collector/handler_cos.go b/pkg/collector/handler_cos.go
new file mode 100644
index 0000000..5b2114e
--- /dev/null
+++ b/pkg/collector/handler_cos.go
@@ -0,0 +1,77 @@
+package collector
+
+import (
+ "fmt"
+ "github.com/go-kit/kit/log"
+ "github.com/go-kit/kit/log/level"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/metric"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/util"
+)
+
+const (
+ CosNamespace = "QCE/COS"
+)
+
+func init() {
+ registerHandler(CosNamespace, defaultHandlerEnabled, NewCosHandler)
+}
+
+var (
+ CosSupportDimensions = []string{"appid", "bucket"}
+)
+
+type cosHandler struct {
+ baseProductHandler
+}
+
+func (h *cosHandler) GetNamespace() string {
+ return CosNamespace
+}
+
+func (h *cosHandler) IsIncludeMetric(m *metric.TcmMetric) bool {
+ // cos大部分指标不支持300以下的统计纬度
+ if m.Conf.StatPeriodSeconds < 300 {
+ m.Conf.StatPeriodSeconds = 300
+ }
+ return true
+}
+
+func (h *cosHandler) GetSeries(m *metric.TcmMetric) (slist []*metric.TcmSeries, err error) {
+ for _, ql := range m.Conf.CustomQueryDimensions {
+ if !h.checkMonitorQueryKeys(m, ql) {
+ continue
+ }
+
+ s, err := metric.NewTcmSeries(m, ql, nil)
+ if err != nil {
+ level.Error(h.logger).Log("msg", "Create metric series fail", "metric", m.Meta.MetricName,
+ "ql", fmt.Sprintf("%v", ql))
+ continue
+ }
+ slist = append(slist, s)
+ }
+ return
+}
+
+func (h *cosHandler) checkMonitorQueryKeys(m *metric.TcmMetric, ql map[string]string) bool {
+ for k := range ql {
+ if !util.IsStrInList(CosSupportDimensions, k) {
+ level.Error(h.logger).Log("msg", fmt.Sprintf("not found %s in supportQueryDimensions", k),
+ "ql", fmt.Sprintf("%v", ql),
+ "sd", fmt.Sprintf("%v", m.Meta.SupportDimensions),
+ )
+ return false
+ }
+ }
+ return true
+}
+
+func NewCosHandler(c *TcProductCollector, logger log.Logger) (handler productHandler, err error) {
+ handler = &cosHandler{
+ baseProductHandler{
+ collector: c,
+ logger: logger,
+ },
+ }
+ return
+}
diff --git a/pkg/collector/handler_cvm.go b/pkg/collector/handler_cvm.go
new file mode 100644
index 0000000..8877a5b
--- /dev/null
+++ b/pkg/collector/handler_cvm.go
@@ -0,0 +1,55 @@
+package collector
+
+import (
+ "github.com/go-kit/kit/log"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/metric"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/util"
+ "strings"
+)
+
+const (
+ CvmNamespace = "QCE/CVM"
+ CvmInstanceidKey = "InstanceId"
+)
+
+var (
+ CvmInvalidMetricNames = []string{"dccpuusage", "dcmemusage"}
+)
+
+func init() {
+ registerHandler(CvmNamespace, defaultHandlerEnabled, NewCvmHandler)
+}
+
+type cvmHandler struct {
+ baseProductHandler
+}
+
+func (h *cvmHandler) GetNamespace() string {
+ return CvmNamespace
+}
+
+func (h *cvmHandler) IsIncludeMetric(m *metric.TcmMetric) bool {
+ if util.IsStrInList(CvmInvalidMetricNames, strings.ToLower(m.Meta.MetricName)) {
+ return false
+ }
+ return true
+}
+
+func (h *cvmHandler) GetSeries(m *metric.TcmMetric) (slist []*metric.TcmSeries, err error) {
+ if m.Conf.StatPeriodSeconds < 60 {
+ m.Conf.StatPeriodSeconds = 60
+ }
+ return h.baseProductHandler.GetSeries(m)
+}
+
+func NewCvmHandler(c *TcProductCollector, logger log.Logger) (handler productHandler, err error) {
+ handler = &cvmHandler{
+ baseProductHandler{
+ monitorQueryKey: CvmInstanceidKey,
+ collector: c,
+ logger: logger,
+ },
+ }
+ return
+
+}
diff --git a/pkg/collector/handler_dc.go b/pkg/collector/handler_dc.go
new file mode 100644
index 0000000..af5dc23
--- /dev/null
+++ b/pkg/collector/handler_dc.go
@@ -0,0 +1,39 @@
+package collector
+
+import (
+ "github.com/go-kit/kit/log"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/metric"
+)
+
+const (
+ DcNamespace = "QCE/DC"
+ DcInstanceidKey = "directConnectId"
+)
+
+func init() {
+ registerHandler(DcNamespace, defaultHandlerEnabled, NewDcHandler)
+}
+
+type dcHandler struct {
+ baseProductHandler
+}
+
+func (h *dcHandler) GetNamespace() string {
+ return DcNamespace
+}
+
+func (h *dcHandler) IsIncludeMetric(m *metric.TcmMetric) bool {
+ return true
+}
+
+func NewDcHandler(c *TcProductCollector, logger log.Logger) (handler productHandler, err error) {
+ handler = &dcHandler{
+ baseProductHandler{
+ monitorQueryKey: DcInstanceidKey,
+ collector: c,
+ logger: logger,
+ },
+ }
+ return
+
+}
diff --git a/pkg/collector/handler_dcx.go b/pkg/collector/handler_dcx.go
new file mode 100644
index 0000000..ca1d2a6
--- /dev/null
+++ b/pkg/collector/handler_dcx.go
@@ -0,0 +1,39 @@
+package collector
+
+import (
+ "github.com/go-kit/kit/log"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/metric"
+)
+
+const (
+ DcxNamespace = "QCE/DCX"
+ DcxInstanceidKey = "directConnectConnId"
+)
+
+func init() {
+ registerHandler(DcxNamespace, defaultHandlerEnabled, NewDcxHandler)
+}
+
+type dcxHandler struct {
+ baseProductHandler
+}
+
+func (h *dcxHandler) GetNamespace() string {
+ return DcxNamespace
+}
+
+func (h *dcxHandler) IsIncludeMetric(m *metric.TcmMetric) bool {
+ return true
+}
+
+func NewDcxHandler(c *TcProductCollector, logger log.Logger) (handler productHandler, err error) {
+ handler = &dcxHandler{
+ baseProductHandler{
+ monitorQueryKey: DcxInstanceidKey,
+ collector: c,
+ logger: logger,
+ },
+ }
+ return
+
+}
diff --git a/pkg/collector/handler_mongo.go b/pkg/collector/handler_mongo.go
new file mode 100644
index 0000000..14f172b
--- /dev/null
+++ b/pkg/collector/handler_mongo.go
@@ -0,0 +1,186 @@
+package collector
+
+import (
+ "fmt"
+ "github.com/go-kit/kit/log"
+ "github.com/go-kit/kit/log/level"
+ mongodb "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mongodb/v20190725"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/instance"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/metric"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/util"
+ "strings"
+)
+
+const (
+ MongoNamespace = "QCE/CMONGO"
+ MongoInstanceidKey = "target"
+)
+
+var (
+ // TODO: Disk未找到
+ MongoClusterMetrics = []string{
+ "inserts", "reads", "updates", "deletes", "counts", "aggregates", "clusterconn", "commands", "connper", "clusterdiskusage",
+ "qps", "success", "delay10", "delay50", "delay100", "timeouts",
+ }
+ MongoReplicaMetrics = []string{
+ "replicadiskusage", "slavedelay", "oplogreservedtime",
+ }
+ MongoNodeMetrics = []string{
+ "conn", "cpuusage", "memusage", "qr", "qw", "netin", "netout",
+ }
+)
+
+func init() {
+ registerHandler(MongoNamespace, defaultHandlerEnabled, NewMongoHandler)
+}
+
+type mongoHandler struct {
+ collector *TcProductCollector
+ logger log.Logger
+}
+
+func (h *mongoHandler) GetNamespace() string {
+ return MongoNamespace
+}
+
+func (h *mongoHandler) IsIncludeMetric(m *metric.TcmMetric) bool {
+ return true
+}
+
+func (h *mongoHandler) GetSeries(m *metric.TcmMetric) (slist []*metric.TcmSeries, err error) {
+ if m.Meta.MetricName == "Commands" {
+ if m.Conf.StatPeriodSeconds == 60 {
+ // 该指标不支持60统计
+ m.Conf.StatPeriodSeconds = 300
+ }
+ }
+
+ if len(m.Conf.OnlyIncludeInstances) != 0 {
+ for _, insId := range m.Conf.OnlyIncludeInstances {
+ ins, err := h.collector.InstanceRepo.Get(insId)
+ if err != nil {
+ level.Error(h.logger).Log("msg", "Instance not found", "id", insId)
+ continue
+ }
+ sl, err := h.getSeriesByMetricType(m, ins)
+ if err != nil {
+ level.Error(h.logger).Log("msg", "Create metric series fail", "metric", m.Meta.MetricName, "instacne", insId)
+ continue
+ }
+ slist = append(slist, sl...)
+ }
+
+ } else if m.Conf.AllInstances {
+ insList, err := h.collector.InstanceRepo.ListByFilters(m.Conf.InstanceFilters)
+ if err != nil {
+ return nil, err
+ }
+ for _, ins := range insList {
+ if len(m.Conf.ExcludeInstances) != 0 && util.IsStrInList(m.Conf.ExcludeInstances, ins.GetInstanceId()) {
+ continue
+ }
+ sl, err := h.getSeriesByMetricType(m, ins)
+ if err != nil {
+ level.Error(h.logger).Log("msg", "Create metric series fail", "metric", m.Meta.MetricName, "instacne", ins.GetInstanceId())
+ continue
+ }
+ slist = append(slist, sl...)
+ }
+ } else {
+ for _, ql := range m.Conf.CustomQueryDimensions {
+ v, ok := ql[MongoInstanceidKey]
+ if !ok {
+ return nil, fmt.Errorf("not found %s in queryDimensions", MongoInstanceidKey)
+ }
+ ins, err := h.collector.InstanceRepo.Get(v)
+ if err != nil {
+ return nil, err
+ }
+ s, err := metric.NewTcmSeries(m, ql, ins)
+ if err != nil {
+ return nil, err
+ }
+ slist = append(slist, s)
+ }
+ }
+
+ return
+}
+
+func (h *mongoHandler) getSeriesByMetricType(m *metric.TcmMetric, ins instance.TcInstance) (slist []*metric.TcmSeries, err error) {
+ if util.IsStrInList(MongoClusterMetrics, strings.ToLower(m.Meta.MetricName)) {
+ // 集群纬度
+ // cmgo-6ielucen
+ ql := map[string]string{
+ MongoInstanceidKey: ins.GetInstanceId(),
+ }
+ s, err := metric.NewTcmSeries(m, ql, ins)
+ if err != nil {
+ return nil, fmt.Errorf("create metric series fail, metric=%s, instacne=%s", m.Meta.MetricName, ins.GetInstanceId())
+ }
+ slist = append(slist, s)
+ } else if util.IsStrInList(MongoReplicaMetrics, strings.ToLower(m.Meta.MetricName)) {
+ // 副本集纬度
+ meta, ok := ins.GetMeta().(*mongodb.InstanceDetail)
+ if !ok {
+ return nil, fmt.Errorf("get instacne raw meta fail, metric=%s, instacne=%s", m.Meta.MetricName, ins.GetInstanceId())
+ }
+ for _, rep := range meta.ReplicaSets {
+ // cmgo-6ielucen_0
+ ql := map[string]string{
+ MongoInstanceidKey: *rep.ReplicaSetId,
+ }
+ s, err := metric.NewTcmSeries(m, ql, ins)
+ if err != nil {
+ level.Error(h.logger).Log("msg", "Create metric series fail", "metric", m.Meta.MetricName, "instacne", *rep.ReplicaSetId)
+ } else {
+ slist = append(slist, s)
+ }
+ }
+ } else if util.IsStrInList(MongoNodeMetrics, strings.ToLower(m.Meta.MetricName)) {
+ // 节点纬度
+ meta, ok := ins.GetMeta().(*mongodb.InstanceDetail)
+ if !ok {
+ return nil, fmt.Errorf("get instacne raw meta fail, metric=%s, instacne=%s", m.Meta.MetricName, ins.GetInstanceId())
+ }
+ for _, rep := range meta.ReplicaSets {
+ // cmgo-6ielucen_0-node-primary
+ nprimary := fmt.Sprintf("%s-node-%s", *rep.ReplicaSetId, "primary")
+ ql := map[string]string{
+ MongoInstanceidKey: nprimary,
+ }
+ s, err := metric.NewTcmSeries(m, ql, ins)
+ if err != nil {
+ level.Error(h.logger).Log("msg", "Create metric series fail", "metric", m.Meta.MetricName, "instacne", nprimary)
+ } else {
+ slist = append(slist, s)
+ }
+
+ for i := 0; i < int(*rep.SecondaryNum); i++ {
+ // cmgo-6ielucen_1-node-slave0
+ nslave := fmt.Sprintf("%s-node-slave%d", *rep.ReplicaSetId, i)
+ ql := map[string]string{
+ MongoInstanceidKey: nslave,
+ }
+ s, err := metric.NewTcmSeries(m, ql, ins)
+ if err != nil {
+ level.Error(h.logger).Log("msg", "Create metric series fail", "metric", m.Meta.MetricName, "instacne", nslave)
+ } else {
+ slist = append(slist, s)
+ }
+ }
+ }
+ } else {
+ level.Warn(h.logger).Log("msg", "not found metric type", "metric", m.Meta.MetricName)
+ }
+ return
+}
+
+func NewMongoHandler(c *TcProductCollector, logger log.Logger) (handler productHandler, err error) {
+ handler = &mongoHandler{
+ collector: c,
+ logger: logger,
+ }
+ return
+
+}
diff --git a/pkg/collector/handler_nat.go b/pkg/collector/handler_nat.go
new file mode 100644
index 0000000..481c6f5
--- /dev/null
+++ b/pkg/collector/handler_nat.go
@@ -0,0 +1,38 @@
+package collector
+
+import (
+ "github.com/go-kit/kit/log"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/metric"
+)
+
+const (
+ NatNamespace = "QCE/NAT_GATEWAY"
+ NatMonitorQueryKey = "natId"
+)
+
+func init() {
+ registerHandler(NatNamespace, defaultHandlerEnabled, NewNatHandler)
+}
+
+type natHandler struct {
+ baseProductHandler
+}
+
+func (h *natHandler) GetNamespace() string {
+ return NatNamespace
+}
+
+func (h *natHandler) IsIncludeMetric(m *metric.TcmMetric) bool {
+ return true
+}
+
+func NewNatHandler(c *TcProductCollector, logger log.Logger) (handler productHandler, err error) {
+ handler = &natHandler{
+ baseProductHandler{
+ monitorQueryKey: NatMonitorQueryKey,
+ collector: c,
+ logger: logger,
+ },
+ }
+ return
+}
diff --git a/pkg/collector/handler_redis.go b/pkg/collector/handler_redis.go
new file mode 100644
index 0000000..efb5814
--- /dev/null
+++ b/pkg/collector/handler_redis.go
@@ -0,0 +1,66 @@
+package collector
+
+import (
+ "github.com/go-kit/kit/log"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/metric"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/util"
+ "strings"
+)
+
+const (
+ RedisNamespace = "QCE/REDIS"
+ RedisInstanceidKey = "instanceid"
+)
+
+func init() {
+ registerHandler(RedisNamespace, defaultHandlerEnabled, NewRedisHandler)
+}
+
+var (
+ RedisMetricNames = []string{
+ "cpuusmin", "storagemin", "storageusmin", "keysmin", "expiredkeysmin", "evictedkeysmin", "connectionsmin", "connectionsusmin",
+ "inflowmin", "inflowusmin", "outflowmin", "outflowusmin", "latencymin", "latencygetmin", "latencysetmin", "latencyothermin",
+ "qpsmin", "statgetmin", "statsetmin", "statothermin", "bigvaluemin", "slowquerymin", "statsuccessmin", "statmissedmin",
+ "cmderrmin", "cachehitratiomin",
+ }
+ RedisClusterMetricNames = []string{
+ "cpuusmin", "cpumaxusmin", "storagemin", "storageusmin", "storagemaxusmin", "keysmin", "expiredkeysmin", "evictedkeysmin",
+ "connectionsmin", "connectionsusmin", "inflowmin", "inflowusmin", "outflowmin", "outflowusmin", "latencymin", "latencygetmin",
+ "latencysetmin", "latencyothermin", "qpsmin", "statgetmin", "statsetmin", "statothermin", "bigvaluemin", "slowquerymin",
+ "statsuccessmin", "statmissedmin", "cmderrmin", "cachehitratiomin",
+ }
+)
+
+type redisHandler struct {
+ baseProductHandler
+}
+
+func (h *redisHandler) GetNamespace() string {
+ return RedisNamespace
+}
+
+func (h *redisHandler) IsIncludeMetric(m *metric.TcmMetric) bool {
+ if strings.ToLower(m.Conf.CustomProductName) == "cluster_redis" {
+ if util.IsStrInList(RedisClusterMetricNames, strings.ToLower(m.Meta.MetricName)) {
+ return true
+ }
+ }
+ if strings.ToLower(m.Conf.CustomProductName) == "redis" {
+ if util.IsStrInList(RedisMetricNames, strings.ToLower(m.Meta.MetricName)) {
+ return true
+ }
+ }
+ return false
+}
+
+func NewRedisHandler(c *TcProductCollector, logger log.Logger) (handler productHandler, err error) {
+ handler = &redisHandler{
+ baseProductHandler{
+ monitorQueryKey: RedisInstanceidKey,
+ collector: c,
+ logger: logger,
+ },
+ }
+ return
+
+}
diff --git a/pkg/collector/product.go b/pkg/collector/product.go
new file mode 100644
index 0000000..b00311c
--- /dev/null
+++ b/pkg/collector/product.go
@@ -0,0 +1,250 @@
+package collector
+
+import (
+ "fmt"
+ "github.com/go-kit/kit/log"
+ "github.com/go-kit/kit/log/level"
+ "github.com/prometheus/client_golang/prometheus"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/config"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/instance"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/metric"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/util"
+ "strings"
+ "sync"
+)
+
+type TcProductCollector struct {
+ Namespace string
+ MetricRepo metric.TcmMetricRepository
+ InstanceRepo instance.TcInstanceRepository
+ MetricMap map[string]*metric.TcmMetric
+ InstanceMap map[string]instance.TcInstance
+ Querys metric.TcmQuerySet
+ Conf *config.TencentConfig
+ handler productHandler
+ logger log.Logger
+ lock sync.Mutex
+}
+
+// 指标纬度配置
+func (c *TcProductCollector) loadMetricsByMetricConf() (err error) {
+ if len(c.MetricMap) == 0 {
+ c.MetricMap = make(map[string]*metric.TcmMetric)
+ }
+
+ for _, mconf := range c.Conf.GetMetricConfigs(c.Namespace) {
+ meta, err := c.MetricRepo.GetMeta(c.Namespace, mconf.MetricName)
+ if err != nil {
+ level.Error(c.logger).Log("msg", "not found metric meta", "err", err, "Namespace", c.Namespace, "name", mconf.MetricName)
+ continue
+ }
+
+ m, ok := c.MetricMap[meta.MetricName]
+ if !ok {
+ conf, err := metric.NewTcmMetricConfigWithMetricYaml(mconf, meta)
+ if err != nil {
+ level.Error(c.logger).Log("msg", "parse metric config err", "err", err, "Namespace", c.Namespace, "name", mconf.MetricName)
+ continue
+ }
+ nm, err := metric.NewTcmMetric(meta, conf)
+ if err != nil {
+ level.Error(c.logger).Log("msg", "create metric err", "err", err, "Namespace", c.Namespace, "name", mconf.MetricName)
+ continue
+ }
+ // 指标过滤
+ if !c.handler.IsIncludeMetric(nm) {
+ level.Error(c.logger).Log("msg", " Metric not support, skip", "Namespace", c.Namespace, "name", nm.Meta.MetricName)
+ continue
+ }
+ c.MetricMap[meta.MetricName] = nm
+ m = nm
+ }
+
+ series, err := c.handler.GetSeries(m)
+ if err != nil {
+ level.Error(c.logger).Log("msg", "create metric series err", "err", err, "Namespace", c.Namespace, "name", mconf.MetricName)
+ continue
+ }
+
+ err = m.LoadSeries(series)
+ if err != nil {
+ level.Error(c.logger).Log("msg", "load metric series err", "err", err, "Namespace", c.Namespace, "name", mconf.MetricName)
+ continue
+ }
+ }
+ return nil
+}
+
+// 产品纬度配置
+func (c *TcProductCollector) loadMetricsByProductConf() (err error) {
+ if len(c.MetricMap) == 0 {
+ c.MetricMap = make(map[string]*metric.TcmMetric)
+ }
+
+ for _, pconf := range c.Conf.GetProductConfigs(c.Namespace) {
+ var metricNames []string
+
+ if len(pconf.OnlyIncludeMetrics) != 0 {
+ // 导出指定指标列表
+ for _, mname := range pconf.OnlyIncludeMetrics {
+ meta, err := c.MetricRepo.GetMeta(c.Namespace, mname)
+ if err != nil {
+ level.Warn(c.logger).Log("msg", "not found metric meta", "Namespace", c.Namespace, "name", mname)
+ } else {
+ metricNames = append(metricNames, meta.MetricName)
+ }
+ }
+ } else {
+ // 导出该namespace下的所有指标
+ var excludeMetrics []string
+ if len(pconf.ExcludeMetrics) != 0 {
+ for _, em := range pconf.ExcludeMetrics {
+ excludeMetrics = append(excludeMetrics, strings.ToLower(em))
+ }
+ }
+ allMetas, err := c.MetricRepo.ListMetaByNamespace(c.Namespace)
+ if err != nil {
+ return err
+ }
+
+ for _, meta := range allMetas {
+ if len(excludeMetrics) != 0 && util.IsStrInList(excludeMetrics, strings.ToLower(meta.MetricName)) {
+ continue
+ }
+ metricNames = append(metricNames, meta.MetricName)
+ }
+ }
+
+ for _, mname := range metricNames {
+ meta, err := c.MetricRepo.GetMeta(c.Namespace, mname)
+ if err != nil {
+ level.Error(c.logger).Log("msg", "not found metric meta", "Namespace", c.Namespace, "name", mname)
+ continue
+ }
+
+ m, ok := c.MetricMap[mname]
+ if !ok {
+ // 创建TcmMetric模型
+ conf, err := metric.NewTcmMetricConfigWithProductYaml(pconf, meta)
+ if err != nil {
+ level.Error(c.logger).Log("msg", "parse metric config err", "err", err, "Namespace", c.Namespace, "name", mname)
+ continue
+ }
+ nm, err := metric.NewTcmMetric(meta, conf)
+ if err != nil {
+ level.Error(c.logger).Log("msg", "create metric err", "err", err, "Namespace", c.Namespace, "name", mname)
+ continue
+ }
+ // 指标过滤
+ if !c.handler.IsIncludeMetric(nm) {
+ level.Error(c.logger).Log("msg", " Metric not support, skip", "Namespace", c.Namespace, "name", nm.Meta.MetricName)
+ continue
+ }
+ c.MetricMap[meta.MetricName] = nm
+ m = nm
+ }
+
+ // 获取该指标下的所有实例纬度查询或自定义纬度查询
+ series, err := c.handler.GetSeries(m)
+ if err != nil {
+ level.Error(c.logger).Log("msg", "create metric series err", "err", err, "Namespace", c.Namespace, "name", mname)
+ continue
+ }
+
+ err = m.LoadSeries(series)
+ if err != nil {
+ level.Error(c.logger).Log("msg", "load metric series err", "err", err, "Namespace", c.Namespace, "name", mname)
+ continue
+ }
+ }
+
+ }
+ return nil
+}
+
+// 一个query管理一个metric的采集
+func (c *TcProductCollector) initQuerys() (err error) {
+ var numSeries int
+ for _, m := range c.MetricMap {
+ q, e := metric.NewTcmQuery(m, c.MetricRepo)
+ if e != nil {
+ return e
+ }
+ c.Querys = append(c.Querys, q)
+ numSeries += len(q.Metric.Series)
+ }
+ level.Info(c.logger).Log("msg", "Init all query ok", "Namespace", c.Namespace, "numMetric", len(c.Querys), "numSeries", numSeries)
+ return
+}
+
+func (c *TcProductCollector) Collect(ch chan<- prometheus.Metric) (err error) {
+ wg := sync.WaitGroup{}
+ wg.Add(len(c.Querys))
+ for _, query := range c.Querys {
+ go func(q *metric.TcmQuery) {
+ defer wg.Done()
+ pms, err := q.GetPromMetrics()
+ if err != nil {
+ level.Error(c.logger).Log(
+ "msg", "Get samples fail",
+ "err", err,
+ "metric", q.Metric.Id,
+ )
+ } else {
+ for _, pm := range pms {
+ ch <- pm
+ }
+ }
+
+ }(query)
+ }
+ wg.Wait()
+
+ return
+}
+
+func NewTcProductCollector(namespace string, metricRepo metric.TcmMetricRepository, conf *config.TencentConfig, logger log.Logger) (*TcProductCollector, error) {
+ factory, exists := handlerFactoryMap[namespace]
+ if !exists {
+ return nil, fmt.Errorf("Product handler not found, Namespace=%s ", namespace)
+ }
+
+ var instanceRepoCache instance.TcInstanceRepository
+ if !util.IsStrInList(instance.NotSupportInstances, namespace) {
+ instanceRepo, err := instance.NewTcInstanceRepository(namespace, conf, logger)
+ if err != nil {
+ return nil, err
+ }
+ // 使用instance缓存
+ instanceRepoCache = instance.NewTcInstanceCache(instanceRepo, logger)
+ }
+
+ c := &TcProductCollector{
+ Namespace: namespace,
+ MetricRepo: metricRepo,
+ InstanceRepo: instanceRepoCache,
+ Conf: conf,
+ logger: logger,
+ }
+
+ handler, err := factory(c, logger)
+ if err != nil {
+ return nil, err
+ }
+ c.handler = handler
+
+ err = c.loadMetricsByMetricConf()
+ if err != nil {
+ return nil, err
+ }
+ err = c.loadMetricsByProductConf()
+ if err != nil {
+ return nil, err
+ }
+ err = c.initQuerys()
+ if err != nil {
+ return nil, err
+ }
+ return c, nil
+
+}
diff --git a/pkg/config/config.go b/pkg/config/config.go
new file mode 100644
index 0000000..9d666db
--- /dev/null
+++ b/pkg/config/config.go
@@ -0,0 +1,242 @@
+package config
+
+import (
+ "fmt"
+ "gopkg.in/yaml.v2"
+ "io/ioutil"
+ "os"
+ "strings"
+)
+
+const (
+ DefaultPeriodSeconds = 60
+ DefaultDelaySeconds = 300
+
+ EnvAccessKey = "TENCENTCLOUD_SECRET_ID"
+ EnvSecretKey = "TENCENTCLOUD_SECRET_KEY"
+ EnvRegion = "TENCENTCLOUD_REGION"
+)
+
+var (
+ Product2Namespace = map[string]string{
+ "cmongo": "QCE/CMONGO",
+ "mongo": "QCE/CMONGO",
+ "cdb": "QCE/CDB",
+ "mysql": "QCE/CDB",
+ "cvm": "QCE/CVM",
+ "redis": "QCE/REDIS",
+ "cluster_redis": "QCE/REDIS",
+ "dc": "QCE/DC",
+ "dcx": "QCE/DCX",
+ "lb_public": "QCE/LB_PUBLIC",
+ "public_clb": "QCE/LB_PUBLIC",
+ "nat_gateway": "QCE/NAT_GATEWAY",
+ "nat": "QCE/NAT_GATEWAY",
+ "cos": "QCE/COS",
+ "cdn": "QCE/CDN",
+ }
+
+ SupportStatisticsTypes = map[string]bool{
+ "max": true,
+ "min": true,
+ "avg": true,
+ "last": true,
+ }
+)
+
+type TencentCredential struct {
+ AccessKey string `yaml:"access_key"`
+ SecretKey string `yaml:"secret_key"`
+ Region string `yaml:"region"`
+}
+
+type TencentMetric struct {
+ Namespace string `yaml:"tc_namespace"`
+ MetricName string `yaml:"tc_metric_name"`
+ MetricReName string `yaml:"tc_metric_rename"`
+ MetricNameType int32 `yaml:"tc_metric_name_type"` // 1=大写转下划线, 2=全小写
+ Labels []string `yaml:"tc_labels"`
+ Dimensions map[string]string `yaml:"tc_myself_dimensions"`
+ Filters map[string]string `yaml:"tc_filters"`
+ Statistics []string `yaml:"tc_statistics"`
+ PeriodSeconds int64 `yaml:"period_seconds"`
+ RangeSeconds int64 `yaml:"range_seconds"`
+ DelaySeconds int64 `yaml:"delay_seconds"`
+}
+
+type TencentProduct struct {
+ Namespace string `yaml:"namespace"`
+ AllMetrics bool `yaml:"all_metrics"`
+ AllInstances bool `yaml:"all_instances"`
+ ExtraLabels []string `yaml:"extra_labels"`
+ OnlyIncludeMetrics []string `yaml:"only_include_metrics"`
+ ExcludeMetrics []string `yaml:"exclude_metrics"`
+ InstanceFilters map[string]string `yaml:"instance_filters"`
+ OnlyIncludeInstances []string `yaml:"only_include_instances"`
+ ExcludeInstances []string `yaml:"exclude_instances"`
+ CustomQueryDimensions []map[string]string `yaml:"custom_query_dimensions"`
+ Statistics []string `yaml:"statistics_types"`
+ PeriodSeconds int64 `yaml:"period_seconds"`
+ RangeSeconds int64 `yaml:"range_seconds"`
+ DelaySeconds int64 `yaml:"delay_seconds"`
+ MetricNameType int32 `yaml:"metric_name_type"` // 1=大写转下划线, 2=全小写
+}
+
+type TencentConfig struct {
+ Credential TencentCredential `yaml:"credential"`
+ Metrics []TencentMetric `yaml:"metrics"`
+ Products []TencentProduct `yaml:"products"`
+ RateLimit float64 `yaml:"rate_limit"`
+ Filename string `yaml:"filename"`
+}
+
+func NewConfig() *TencentConfig {
+ return &TencentConfig{}
+}
+
+func (c *TencentConfig) LoadFile(filename string) error {
+ c.Filename = filename
+ content, err := ioutil.ReadFile(c.Filename)
+ if err != nil {
+ return err
+ }
+ if err = yaml.UnmarshalStrict(content, c); err != nil {
+ return err
+
+ }
+ if err = c.check(); err != nil {
+ return err
+ }
+ c.fillDefault()
+ return nil
+}
+
+func (c *TencentConfig) check() (err error) {
+ if c.Credential.AccessKey == "" {
+ c.Credential.AccessKey = os.Getenv(EnvAccessKey)
+ if c.Credential.AccessKey == "" {
+ return fmt.Errorf("credential.access_key is empty, must be set")
+ }
+ }
+ if c.Credential.SecretKey == "" {
+ c.Credential.SecretKey = os.Getenv(EnvSecretKey)
+ if c.Credential.SecretKey == "" {
+ return fmt.Errorf("credential.secret_key is empty, must be set")
+ }
+ }
+ if c.Credential.Region == "" {
+ c.Credential.Region = os.Getenv(EnvRegion)
+ if c.Credential.Region == "" {
+ return fmt.Errorf("credential.region is empty, must be set")
+ }
+ }
+
+ for _, mconf := range c.Metrics {
+ if mconf.MetricName == "" {
+ return fmt.Errorf("tc_metric_name is empty, must be set")
+ }
+ nsitems := strings.Split(mconf.Namespace, `/`)
+ if len(nsitems) != 2 {
+ return fmt.Errorf("tc_namespace should be 'xxxxxx/productName' format")
+ }
+ pname := nsitems[1]
+ if _, exists := Product2Namespace[strings.ToLower(pname)]; !exists {
+ return fmt.Errorf("tc_namespace productName not support")
+ }
+ for _, statistic := range mconf.Statistics {
+ _, exists := SupportStatisticsTypes[strings.ToLower(statistic)]
+ if !exists {
+ return fmt.Errorf("statistic type not support, type=%s", statistic)
+ }
+ }
+ }
+
+ for _, pconf := range c.Products {
+ nsitems := strings.Split(pconf.Namespace, `/`)
+ if len(nsitems) != 2 {
+ return fmt.Errorf("namespace should be 'xxxxxx/productName' format")
+ }
+ pname := nsitems[1]
+ if _, exists := Product2Namespace[strings.ToLower(pname)]; !exists {
+ return fmt.Errorf("namespace productName not support, %s", pname)
+ }
+ }
+
+ return nil
+}
+
+func (c *TencentConfig) fillDefault() {
+
+ if c.RateLimit <= 0 {
+ c.RateLimit = 15
+ }
+
+ for index, metric := range c.Metrics {
+ if metric.PeriodSeconds == 0 {
+ c.Metrics[index].PeriodSeconds = DefaultPeriodSeconds
+ }
+ if metric.DelaySeconds == 0 {
+ c.Metrics[index].DelaySeconds = c.Metrics[index].PeriodSeconds
+ }
+
+ if metric.RangeSeconds == 0 {
+ metric.RangeSeconds = metric.PeriodSeconds
+ }
+
+ if metric.MetricReName == "" {
+ c.Metrics[index].MetricReName = c.Metrics[index].MetricName
+ }
+ }
+}
+
+func (c *TencentConfig) GetNamespaces() (nps []string) {
+ nsSet := map[string]struct{}{}
+ for _, pconf := range c.Products {
+ ns := GetStandardNamespaceFromCustomNamespace(pconf.Namespace)
+ nsSet[ns] = struct{}{}
+ }
+ for _, mconf := range c.Metrics {
+ ns := GetStandardNamespaceFromCustomNamespace(mconf.Namespace)
+ nsSet[ns] = struct{}{}
+ }
+
+ for np := range nsSet {
+ nps = append(nps, np)
+ }
+ return
+}
+
+func (c *TencentConfig) GetMetricConfigs(namespace string) (mconfigs []TencentMetric) {
+ for _, mconf := range c.Metrics {
+ ns := GetStandardNamespaceFromCustomNamespace(mconf.Namespace)
+ if ns == namespace {
+ mconfigs = append(mconfigs, mconf)
+ }
+ }
+ return
+}
+
+func (c *TencentConfig) GetProductConfigs(namespace string) (pconfigs []TencentProduct) {
+ for _, pconf := range c.Products {
+ ns := GetStandardNamespaceFromCustomNamespace(pconf.Namespace)
+ if ns == namespace {
+ pconfigs = append(pconfigs, pconf)
+ }
+ }
+ return
+}
+
+func GetStandardNamespaceFromCustomNamespace(cns string) string {
+ items := strings.Split(cns, "/")
+ if len(items) != 2 {
+ panic(fmt.Sprintf("Namespace should be 'customPrefix/productName' format"))
+ }
+ pname := items[1]
+ sns, exists := Product2Namespace[strings.ToLower(pname)]
+ if exists {
+ return sns
+ } else {
+ panic(fmt.Sprintf("Product not support, namespace=%s, product=%s", cns, pname))
+ }
+
+}
diff --git a/pkg/instance/cache.go b/pkg/instance/cache.go
new file mode 100644
index 0000000..ea668ad
--- /dev/null
+++ b/pkg/instance/cache.go
@@ -0,0 +1,104 @@
+package instance
+
+import (
+ "github.com/go-kit/kit/log"
+ "github.com/go-kit/kit/log/level"
+ "sync"
+ "time"
+)
+
+type TcInstanceCache struct {
+ Raw TcInstanceRepository
+ cache map[string]TcInstance
+ lastReloadTime int64
+ logger log.Logger
+ mu sync.Mutex
+}
+
+func (c *TcInstanceCache) GetInstanceKey() string {
+ return c.Raw.GetInstanceKey()
+}
+
+func (c *TcInstanceCache) Get(id string) (TcInstance, error) {
+ ins, ok := c.cache[id]
+ if ok {
+ return ins, nil
+ }
+
+ ins, err := c.Raw.Get(id)
+ if err != nil {
+ return nil, err
+ }
+ c.cache[ins.GetInstanceId()] = ins
+ return ins, nil
+}
+
+func (c *TcInstanceCache) ListByIds(ids []string) (insList []TcInstance, err error) {
+ err = c.checkNeedreload()
+ if err != nil {
+ return nil, err
+ }
+
+ var notexists []string
+ for _, id := range ids {
+ ins, ok := c.cache[id]
+ if ok {
+ insList = append(insList, ins)
+ } else {
+ notexists = append(notexists, id)
+ }
+ }
+ return
+}
+
+func (c *TcInstanceCache) ListByFilters(filters map[string]string) (insList []TcInstance, err error) {
+ err = c.checkNeedreload()
+ if err != nil {
+ return
+ }
+
+ for _, ins := range c.cache {
+ for k, v := range filters {
+ tv, e := ins.GetFieldValueByName(k)
+ if e != nil {
+ break
+ }
+ if v != tv {
+ break
+ }
+ }
+ insList = append(insList, ins)
+ }
+
+ return
+}
+
+func (c *TcInstanceCache) checkNeedreload() (err error) {
+ c.mu.Lock()
+ defer c.mu.Unlock()
+
+ if c.lastReloadTime != 0 {
+ return nil
+ }
+
+ inss, err := c.Raw.ListByFilters(map[string]string{})
+ if err != nil {
+ return err
+ }
+ for _, instance := range inss {
+ c.cache[instance.GetInstanceId()] = instance
+ }
+ c.lastReloadTime = time.Now().Unix()
+ level.Info(c.logger).Log("msg", "Reload instance cache", "num", len(c.cache))
+ return
+}
+
+func NewTcInstanceCache(repo TcInstanceRepository, logger log.Logger) TcInstanceRepository {
+ cache := &TcInstanceCache{
+ Raw: repo,
+ cache: map[string]TcInstance{},
+ logger: logger,
+ }
+ return cache
+
+}
diff --git a/pkg/instance/instance.go b/pkg/instance/instance.go
new file mode 100644
index 0000000..2a90c8b
--- /dev/null
+++ b/pkg/instance/instance.go
@@ -0,0 +1,52 @@
+package instance
+
+import (
+ "fmt"
+ "reflect"
+ "strconv"
+)
+
+// 不支持实例纬度自动查询的namespace
+var NotSupportInstances = []string{
+ "QCE/COS",
+ "QCE/CDN",
+}
+
+type TcInstance interface {
+ GetInstanceId() string
+
+ GetMonitorQueryKey() string
+
+ // 根据字段名称获取该字段的值, 由各个产品接口具体实现
+ GetFieldValueByName(string) (string, error)
+
+ GetMeta() interface{}
+}
+
+type baseTcInstance struct {
+ instanceId string
+ value reflect.Value
+}
+
+func (ins *baseTcInstance) GetInstanceId() string {
+ return ins.instanceId
+}
+
+func (ins *baseTcInstance) GetMonitorQueryKey() string {
+ return ins.instanceId
+}
+
+func (ins *baseTcInstance) GetFieldValueByName(name string) (string, error) {
+ v := ins.value.FieldByName(name)
+ if v.Kind() == reflect.Ptr {
+ v = reflect.Indirect(v)
+ }
+ switch k := v.Kind(); k {
+ case reflect.Uint64:
+ return strconv.FormatUint(v.Uint(), 10), nil
+ case reflect.String:
+ return v.String(), nil
+ default:
+ return "", fmt.Errorf("value type not support, type=%s", k)
+ }
+}
diff --git a/pkg/instance/instance_cdb.go b/pkg/instance/instance_cdb.go
new file mode 100644
index 0000000..12da1b9
--- /dev/null
+++ b/pkg/instance/instance_cdb.go
@@ -0,0 +1,33 @@
+package instance
+
+import (
+ "fmt"
+ sdk "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdb/v20170320"
+ "reflect"
+)
+
+type CdbTcInstance struct {
+ baseTcInstance
+ meta *sdk.InstanceInfo
+}
+
+func (ins *CdbTcInstance) GetMeta() interface{} {
+ return ins.meta
+}
+
+func NewCdbTcInstance(instanceId string, meta *sdk.InstanceInfo) (ins *CdbTcInstance, err error) {
+ if instanceId == "" {
+ return nil, fmt.Errorf("instanceId is empty ")
+ }
+ if meta == nil {
+ return nil, fmt.Errorf("meta is empty ")
+ }
+ ins = &CdbTcInstance{
+ baseTcInstance: baseTcInstance{
+ instanceId: instanceId,
+ value: reflect.ValueOf(*meta),
+ },
+ meta: meta,
+ }
+ return
+}
diff --git a/pkg/instance/instance_clb.go b/pkg/instance/instance_clb.go
new file mode 100644
index 0000000..704574b
--- /dev/null
+++ b/pkg/instance/instance_clb.go
@@ -0,0 +1,41 @@
+package instance
+
+import (
+ "fmt"
+ sdk "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb/v20180317"
+ "reflect"
+)
+
+type ClbInstance struct {
+ baseTcInstance
+ meta *sdk.LoadBalancer
+}
+
+func (ins *ClbInstance) GetMonitorQueryKey() string {
+ if len(ins.meta.LoadBalancerVips) == 1 {
+ return *ins.meta.LoadBalancerVips[0]
+ } else {
+ return ""
+ }
+}
+
+func (ins *ClbInstance) GetMeta() interface{} {
+ return ins.meta
+}
+
+func NewClbTcInstance(instanceId string, meta *sdk.LoadBalancer) (ins *ClbInstance, err error) {
+ if instanceId == "" {
+ return nil, fmt.Errorf("instanceId is empty ")
+ }
+ if meta == nil {
+ return nil, fmt.Errorf("meta is empty ")
+ }
+ ins = &ClbInstance{
+ baseTcInstance: baseTcInstance{
+ instanceId: instanceId,
+ value: reflect.ValueOf(*meta),
+ },
+ meta: meta,
+ }
+ return
+}
diff --git a/pkg/instance/instance_cvm.go b/pkg/instance/instance_cvm.go
new file mode 100644
index 0000000..4c012fc
--- /dev/null
+++ b/pkg/instance/instance_cvm.go
@@ -0,0 +1,33 @@
+package instance
+
+import (
+ "fmt"
+ sdk "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312"
+ "reflect"
+)
+
+type CvmTcInstance struct {
+ baseTcInstance
+ meta *sdk.Instance
+}
+
+func (ins *CvmTcInstance) GetMeta() interface{} {
+ return ins.meta
+}
+
+func NewCvmTcInstance(instanceId string, meta *sdk.Instance) (ins *CvmTcInstance, err error) {
+ if instanceId == "" {
+ return nil, fmt.Errorf("instanceId is empty ")
+ }
+ if meta == nil {
+ return nil, fmt.Errorf("meta is empty ")
+ }
+ ins = &CvmTcInstance{
+ baseTcInstance: baseTcInstance{
+ instanceId: instanceId,
+ value: reflect.ValueOf(*meta),
+ },
+ meta: meta,
+ }
+ return
+}
diff --git a/pkg/instance/instance_dc.go b/pkg/instance/instance_dc.go
new file mode 100644
index 0000000..1151b61
--- /dev/null
+++ b/pkg/instance/instance_dc.go
@@ -0,0 +1,33 @@
+package instance
+
+import (
+ "fmt"
+ sdk "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dc/v20180410"
+ "reflect"
+)
+
+type DcTcInstance struct {
+ baseTcInstance
+ meta *sdk.DirectConnect
+}
+
+func (ins *DcTcInstance) GetMeta() interface{} {
+ return ins.meta
+}
+
+func NewDcTcInstance(instanceId string, meta *sdk.DirectConnect) (ins *DcTcInstance, err error) {
+ if instanceId == "" {
+ return nil, fmt.Errorf("instanceId is empty ")
+ }
+ if meta == nil {
+ return nil, fmt.Errorf("meta is empty ")
+ }
+ ins = &DcTcInstance{
+ baseTcInstance: baseTcInstance{
+ instanceId: instanceId,
+ value: reflect.ValueOf(*meta),
+ },
+ meta: meta,
+ }
+ return
+}
diff --git a/pkg/instance/instance_dcx.go b/pkg/instance/instance_dcx.go
new file mode 100644
index 0000000..bdb90ea
--- /dev/null
+++ b/pkg/instance/instance_dcx.go
@@ -0,0 +1,33 @@
+package instance
+
+import (
+ "fmt"
+ sdk "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dc/v20180410"
+ "reflect"
+)
+
+type DcxTcInstance struct {
+ baseTcInstance
+ meta *sdk.DirectConnectTunnel
+}
+
+func (ins *DcxTcInstance) GetMeta() interface{} {
+ return ins.meta
+}
+
+func NewDcxTcInstance(instanceId string, meta *sdk.DirectConnectTunnel) (ins *DcxTcInstance, err error) {
+ if instanceId == "" {
+ return nil, fmt.Errorf("instanceId is empty ")
+ }
+ if meta == nil {
+ return nil, fmt.Errorf("meta is empty ")
+ }
+ ins = &DcxTcInstance{
+ baseTcInstance: baseTcInstance{
+ instanceId: instanceId,
+ value: reflect.ValueOf(*meta),
+ },
+ meta: meta,
+ }
+ return
+}
diff --git a/pkg/instance/instance_mongo.go b/pkg/instance/instance_mongo.go
new file mode 100644
index 0000000..0ee290b
--- /dev/null
+++ b/pkg/instance/instance_mongo.go
@@ -0,0 +1,33 @@
+package instance
+
+import (
+ "fmt"
+ sdk "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mongodb/v20190725"
+ "reflect"
+)
+
+type MongoTcInstance struct {
+ baseTcInstance
+ meta *sdk.InstanceDetail
+}
+
+func (ins *MongoTcInstance) GetMeta() interface{} {
+ return ins.meta
+}
+
+func NewMongoTcInstance(instanceId string, meta *sdk.InstanceDetail) (ins *MongoTcInstance, err error) {
+ if instanceId == "" {
+ return nil, fmt.Errorf("instanceId is empty ")
+ }
+ if meta == nil {
+ return nil, fmt.Errorf("meta is empty ")
+ }
+ ins = &MongoTcInstance{
+ baseTcInstance: baseTcInstance{
+ instanceId: instanceId,
+ value: reflect.ValueOf(*meta),
+ },
+ meta: meta,
+ }
+ return
+}
diff --git a/pkg/instance/instance_nat.go b/pkg/instance/instance_nat.go
new file mode 100644
index 0000000..f593557
--- /dev/null
+++ b/pkg/instance/instance_nat.go
@@ -0,0 +1,33 @@
+package instance
+
+import (
+ "fmt"
+ sdk "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312"
+ "reflect"
+)
+
+type NatTcInstance struct {
+ baseTcInstance
+ meta *sdk.NatGateway
+}
+
+func (ins *NatTcInstance) GetMeta() interface{} {
+ return ins.meta
+}
+
+func NewNatTcInstance(instanceId string, meta *sdk.NatGateway) (ins *NatTcInstance, err error) {
+ if instanceId == "" {
+ return nil, fmt.Errorf("instanceId is empty ")
+ }
+ if meta == nil {
+ return nil, fmt.Errorf("meta is empty ")
+ }
+ ins = &NatTcInstance{
+ baseTcInstance: baseTcInstance{
+ instanceId: instanceId,
+ value: reflect.ValueOf(*meta),
+ },
+ meta: meta,
+ }
+ return
+}
diff --git a/pkg/instance/instance_redis.go b/pkg/instance/instance_redis.go
new file mode 100644
index 0000000..3660af2
--- /dev/null
+++ b/pkg/instance/instance_redis.go
@@ -0,0 +1,33 @@
+package instance
+
+import (
+ "fmt"
+ sdk "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis/v20180412"
+ "reflect"
+)
+
+type RedisTcInstance struct {
+ baseTcInstance
+ meta *sdk.InstanceSet
+}
+
+func (ins *RedisTcInstance) GetMeta() interface{} {
+ return ins.meta
+}
+
+func NewRedisTcInstance(instanceId string, meta *sdk.InstanceSet) (ins *RedisTcInstance, err error) {
+ if instanceId == "" {
+ return nil, fmt.Errorf("instanceId is empty ")
+ }
+ if meta == nil {
+ return nil, fmt.Errorf("meta is empty ")
+ }
+ ins = &RedisTcInstance{
+ baseTcInstance: baseTcInstance{
+ instanceId: instanceId,
+ value: reflect.ValueOf(*meta),
+ },
+ meta: meta,
+ }
+ return
+}
diff --git a/pkg/instance/repository.go b/pkg/instance/repository.go
new file mode 100644
index 0000000..d035a33
--- /dev/null
+++ b/pkg/instance/repository.go
@@ -0,0 +1,30 @@
+package instance
+
+import (
+ "fmt"
+ "github.com/go-kit/kit/log"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/config"
+)
+
+var (
+ factoryMap = make(map[string]func(*config.TencentConfig, log.Logger) (TcInstanceRepository, error))
+)
+
+type TcInstanceRepository interface {
+ GetInstanceKey() string
+ Get(id string) (TcInstance, error)
+ ListByIds(ids []string) ([]TcInstance, error)
+ ListByFilters(filters map[string]string) ([]TcInstance, error)
+}
+
+func NewTcInstanceRepository(namespace string, conf *config.TencentConfig, logger log.Logger) (TcInstanceRepository, error) {
+ f, exists := factoryMap[namespace]
+ if !exists {
+ return nil, fmt.Errorf("Namespace not support, namespace=%s ", namespace)
+ }
+ return f(conf, logger)
+}
+
+func registerRepository(namespace string, factory func(*config.TencentConfig, log.Logger) (TcInstanceRepository, error)) {
+ factoryMap[namespace] = factory
+}
diff --git a/pkg/instance/repository_cdb.go b/pkg/instance/repository_cdb.go
new file mode 100644
index 0000000..4efaff7
--- /dev/null
+++ b/pkg/instance/repository_cdb.go
@@ -0,0 +1,89 @@
+package instance
+
+import (
+ "fmt"
+ "github.com/go-kit/kit/log"
+ "github.com/go-kit/kit/log/level"
+ sdk "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdb/v20170320"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/client"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/config"
+)
+
+func init() {
+ registerRepository("QCE/CDB", NewCdbTcInstanceRepository)
+}
+
+type CdbTcInstanceRepository struct {
+ client *sdk.Client
+ logger log.Logger
+}
+
+func (repo *CdbTcInstanceRepository) GetInstanceKey() string {
+ return "InstanceId"
+}
+
+func (repo *CdbTcInstanceRepository) Get(id string) (instance TcInstance, err error) {
+ req := sdk.NewDescribeDBInstancesRequest()
+ req.InstanceIds = []*string{&id}
+ resp, err := repo.client.DescribeDBInstances(req)
+ if err != nil {
+ return
+ }
+ if len(resp.Response.Items) != 1 {
+ return nil, fmt.Errorf("Response instanceDetails size != 1, id=%s ", id)
+ }
+ meta := resp.Response.Items[0]
+ instance, err = NewCdbTcInstance(id, meta)
+ if err != nil {
+ return
+ }
+ return
+}
+
+func (repo *CdbTcInstanceRepository) ListByIds(id []string) (instances []TcInstance, err error) {
+ return
+}
+
+func (repo *CdbTcInstanceRepository) ListByFilters(filters map[string]string) (instances []TcInstance, err error) {
+ req := sdk.NewDescribeDBInstancesRequest()
+ var offset uint64 = 0
+ var limit uint64 = 2000
+ var total int64 = -1
+
+ req.Limit = &limit
+
+getMoreInstances:
+ resp, err := repo.client.DescribeDBInstances(req)
+ if err != nil {
+ return
+ }
+ if total == -1 {
+ total = *resp.Response.TotalCount
+ }
+ for _, meta := range resp.Response.Items {
+ ins, e := NewCdbTcInstance(*meta.InstanceId, meta)
+ if e != nil {
+ level.Error(repo.logger).Log("msg", "Create cdb instance fail", "id", *meta.InstanceId)
+ continue
+ }
+ instances = append(instances, ins)
+ }
+ offset += limit
+ if offset < uint64(total) {
+ goto getMoreInstances
+ }
+
+ return
+}
+
+func NewCdbTcInstanceRepository(c *config.TencentConfig, logger log.Logger) (repo TcInstanceRepository, err error) {
+ cli, err := client.NewCdbClient(c)
+ if err != nil {
+ return
+ }
+ repo = &CdbTcInstanceRepository{
+ client: cli,
+ logger: logger,
+ }
+ return
+}
diff --git a/pkg/instance/repository_clb.go b/pkg/instance/repository_clb.go
new file mode 100644
index 0000000..9993609
--- /dev/null
+++ b/pkg/instance/repository_clb.go
@@ -0,0 +1,88 @@
+package instance
+
+import (
+ "fmt"
+ "github.com/go-kit/kit/log"
+ "github.com/go-kit/kit/log/level"
+ sdk "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb/v20180317"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/client"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/config"
+)
+
+func init() {
+ registerRepository("QCE/LB_PUBLIC", NewClbTcInstanceRepository)
+}
+
+type ClbTcInstanceRepository struct {
+ client *sdk.Client
+ logger log.Logger
+}
+
+func (repo *ClbTcInstanceRepository) GetInstanceKey() string {
+ return "LoadBalancerVip"
+}
+
+func (repo *ClbTcInstanceRepository) Get(id string) (instance TcInstance, err error) {
+ req := sdk.NewDescribeLoadBalancersRequest()
+ req.LoadBalancerIds = []*string{&id}
+ resp, err := repo.client.DescribeLoadBalancers(req)
+ if err != nil {
+ return
+ }
+ if len(resp.Response.LoadBalancerSet) != 1 {
+ return nil, fmt.Errorf("Response instanceDetails size != 1, id=%s ", id)
+ }
+ meta := resp.Response.LoadBalancerSet[0]
+ instance, err = NewClbTcInstance(id, meta)
+ if err != nil {
+ return
+ }
+ return
+}
+
+func (repo *ClbTcInstanceRepository) ListByIds(id []string) (instances []TcInstance, err error) {
+ return
+}
+
+func (repo *ClbTcInstanceRepository) ListByFilters(filters map[string]string) (instances []TcInstance, err error) {
+ req := sdk.NewDescribeLoadBalancersRequest()
+ var offset int64 = 0
+ var limit int64 = 100
+ var total int64 = -1
+ req.Limit = &limit
+
+getMoreInstances:
+ resp, err := repo.client.DescribeLoadBalancers(req)
+ if err != nil {
+ return
+ }
+ if total == -1 {
+ total = int64(*resp.Response.TotalCount)
+ }
+ for _, meta := range resp.Response.LoadBalancerSet {
+ ins, e := NewClbTcInstance(*meta.LoadBalancerId, meta)
+ if e != nil {
+ level.Error(repo.logger).Log("msg", "Create clb instance fail", "id", *meta.LoadBalancerId)
+ continue
+ }
+ instances = append(instances, ins)
+ }
+ offset += limit
+ if offset < total {
+ goto getMoreInstances
+ }
+
+ return
+}
+
+func NewClbTcInstanceRepository(c *config.TencentConfig, logger log.Logger) (repo TcInstanceRepository, err error) {
+ cli, err := client.NewClbClient(c)
+ if err != nil {
+ return
+ }
+ repo = &ClbTcInstanceRepository{
+ client: cli,
+ logger: logger,
+ }
+ return
+}
diff --git a/pkg/instance/repository_cvm.go b/pkg/instance/repository_cvm.go
new file mode 100644
index 0000000..5348fa5
--- /dev/null
+++ b/pkg/instance/repository_cvm.go
@@ -0,0 +1,88 @@
+package instance
+
+import (
+ "fmt"
+ "github.com/go-kit/kit/log"
+ "github.com/go-kit/kit/log/level"
+ sdk "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/client"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/config"
+)
+
+func init() {
+ registerRepository("QCE/CVM", NewCvmTcInstanceRepository)
+}
+
+type CvmTcInstanceRepository struct {
+ client *sdk.Client
+ logger log.Logger
+}
+
+func (repo *CvmTcInstanceRepository) GetInstanceKey() string {
+ return "InstanceId"
+}
+
+func (repo *CvmTcInstanceRepository) Get(id string) (instance TcInstance, err error) {
+ req := sdk.NewDescribeInstancesRequest()
+ req.InstanceIds = []*string{&id}
+ resp, err := repo.client.DescribeInstances(req)
+ if err != nil {
+ return
+ }
+ if len(resp.Response.InstanceSet) != 1 {
+ return nil, fmt.Errorf("Response instanceDetails size != 1, id=%s ", id)
+ }
+ meta := resp.Response.InstanceSet[0]
+ instance, err = NewCvmTcInstance(id, meta)
+ if err != nil {
+ return
+ }
+ return
+}
+
+func (repo *CvmTcInstanceRepository) ListByIds(id []string) (instances []TcInstance, err error) {
+ return
+}
+
+func (repo *CvmTcInstanceRepository) ListByFilters(filters map[string]string) (instances []TcInstance, err error) {
+ req := sdk.NewDescribeInstancesRequest()
+ var offset int64 = 0
+ var limit int64 = 100
+ var total int64 = -1
+
+ req.Limit = &limit
+
+getMoreInstances:
+ resp, err := repo.client.DescribeInstances(req)
+ if err != nil {
+ return
+ }
+ if total == -1 {
+ total = *resp.Response.TotalCount
+ }
+ for _, meta := range resp.Response.InstanceSet {
+ ins, e := NewCvmTcInstance(*meta.InstanceId, meta)
+ if e != nil {
+ level.Error(repo.logger).Log("msg", "Create cvm instance fail", "id", *meta.InstanceId)
+ continue
+ }
+ instances = append(instances, ins)
+ }
+ offset += limit
+ if offset < total {
+ goto getMoreInstances
+ }
+ return
+}
+
+func NewCvmTcInstanceRepository(c *config.TencentConfig, logger log.Logger) (repo TcInstanceRepository, err error) {
+ cli, err := client.NewCvmClient(c)
+ if err != nil {
+ return
+ }
+ repo = &CvmTcInstanceRepository{
+ client: cli,
+ logger: logger,
+ }
+ return
+}
diff --git a/pkg/instance/repository_dc.go b/pkg/instance/repository_dc.go
new file mode 100644
index 0000000..106a387
--- /dev/null
+++ b/pkg/instance/repository_dc.go
@@ -0,0 +1,89 @@
+package instance
+
+import (
+ "fmt"
+ "github.com/go-kit/kit/log"
+ "github.com/go-kit/kit/log/level"
+ sdk "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dc/v20180410"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/client"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/config"
+)
+
+func init() {
+ registerRepository("QCE/DC", NewDcTcInstanceRepository)
+}
+
+type DcTcInstanceRepository struct {
+ client *sdk.Client
+ logger log.Logger
+}
+
+func (repo *DcTcInstanceRepository) GetInstanceKey() string {
+ return "directConnectId"
+}
+
+func (repo *DcTcInstanceRepository) Get(id string) (instance TcInstance, err error) {
+ req := sdk.NewDescribeDirectConnectsRequest()
+ req.DirectConnectIds = []*string{&id}
+ resp, err := repo.client.DescribeDirectConnects(req)
+ if err != nil {
+ return
+ }
+ if len(resp.Response.DirectConnectSet) != 1 {
+ return nil, fmt.Errorf("Response instanceDetails size != 1, id=%s ", id)
+ }
+ meta := resp.Response.DirectConnectSet[0]
+ instance, err = NewDcTcInstance(id, meta)
+ if err != nil {
+ return
+ }
+ return
+}
+
+func (repo *DcTcInstanceRepository) ListByIds(id []string) (instances []TcInstance, err error) {
+ return
+}
+
+func (repo *DcTcInstanceRepository) ListByFilters(filters map[string]string) (instances []TcInstance, err error) {
+ req := sdk.NewDescribeDirectConnectsRequest()
+ var offset int64 = 0
+ var limit int64 = 100
+ var total int64 = -1
+
+ req.Limit = &limit
+
+getMoreInstances:
+ resp, err := repo.client.DescribeDirectConnects(req)
+ if err != nil {
+ return
+ }
+ if total == -1 {
+ total = *resp.Response.TotalCount
+ }
+ for _, meta := range resp.Response.DirectConnectSet {
+ ins, e := NewDcTcInstance(*meta.DirectConnectId, meta)
+ if e != nil {
+ level.Error(repo.logger).Log("msg", "Create dc instance fail", "id", *meta.DirectConnectId)
+ continue
+ }
+ instances = append(instances, ins)
+ }
+ offset += limit
+ if offset < total {
+ goto getMoreInstances
+ }
+
+ return
+}
+
+func NewDcTcInstanceRepository(c *config.TencentConfig, logger log.Logger) (repo TcInstanceRepository, err error) {
+ cli, err := client.NewDcClient(c)
+ if err != nil {
+ return
+ }
+ repo = &DcTcInstanceRepository{
+ client: cli,
+ logger: logger,
+ }
+ return
+}
diff --git a/pkg/instance/repository_dcx.go b/pkg/instance/repository_dcx.go
new file mode 100644
index 0000000..83428b8
--- /dev/null
+++ b/pkg/instance/repository_dcx.go
@@ -0,0 +1,88 @@
+package instance
+
+import (
+ "fmt"
+ "github.com/go-kit/kit/log"
+ "github.com/go-kit/kit/log/level"
+ sdk "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dc/v20180410"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/client"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/config"
+)
+
+func init() {
+ registerRepository("QCE/DCX", NewDcxTcInstanceRepository)
+}
+
+type DcxTcInstanceRepository struct {
+ client *sdk.Client
+ logger log.Logger
+}
+
+func (repo *DcxTcInstanceRepository) GetInstanceKey() string {
+ return "directConnectConnId"
+}
+
+func (repo *DcxTcInstanceRepository) Get(id string) (instance TcInstance, err error) {
+ req := sdk.NewDescribeDirectConnectTunnelsRequest()
+ req.DirectConnectTunnelIds = []*string{&id}
+ resp, err := repo.client.DescribeDirectConnectTunnels(req)
+ if err != nil {
+ return
+ }
+ if len(resp.Response.DirectConnectTunnelSet) != 1 {
+ return nil, fmt.Errorf("Response instanceDetails size != 1, id=%s ", id)
+ }
+ meta := resp.Response.DirectConnectTunnelSet[0]
+ instance, err = NewDcxTcInstance(id, meta)
+ if err != nil {
+ return
+ }
+ return
+}
+
+func (repo *DcxTcInstanceRepository) ListByIds(id []string) (instances []TcInstance, err error) {
+ return
+}
+
+func (repo *DcxTcInstanceRepository) ListByFilters(filters map[string]string) (instances []TcInstance, err error) {
+ req := sdk.NewDescribeDirectConnectTunnelsRequest()
+ var offset int64 = 0
+ var limit int64 = 100
+ var total int64 = -1
+ req.Limit = &limit
+
+getMoreInstances:
+ resp, err := repo.client.DescribeDirectConnectTunnels(req)
+ if err != nil {
+ return
+ }
+ if total == -1 {
+ total = *resp.Response.TotalCount
+ }
+ for _, meta := range resp.Response.DirectConnectTunnelSet {
+ ins, e := NewDcxTcInstance(*meta.DirectConnectTunnelId, meta)
+ if e != nil {
+ level.Error(repo.logger).Log("msg", "Create dcx instance fail", "id", *meta.DirectConnectId)
+ continue
+ }
+ instances = append(instances, ins)
+ }
+ offset += limit
+ if offset < total {
+ goto getMoreInstances
+ }
+
+ return
+}
+
+func NewDcxTcInstanceRepository(c *config.TencentConfig, logger log.Logger) (repo TcInstanceRepository, err error) {
+ cli, err := client.NewDcClient(c)
+ if err != nil {
+ return
+ }
+ repo = &DcxTcInstanceRepository{
+ client: cli,
+ logger: logger,
+ }
+ return
+}
diff --git a/pkg/instance/repository_mongo.go b/pkg/instance/repository_mongo.go
new file mode 100644
index 0000000..7b54f6d
--- /dev/null
+++ b/pkg/instance/repository_mongo.go
@@ -0,0 +1,101 @@
+package instance
+
+import (
+ "fmt"
+ "github.com/go-kit/kit/log"
+ "github.com/go-kit/kit/log/level"
+ sdk "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mongodb/v20190725"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/client"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/config"
+ "strconv"
+)
+
+func init() {
+ registerRepository("QCE/CMONGO", NewMongoTcInstanceRepository)
+}
+
+type MongoTcInstanceRepository struct {
+ client *sdk.Client
+ logger log.Logger
+}
+
+func (repo *MongoTcInstanceRepository) GetInstanceKey() string {
+ return "target"
+}
+
+func (repo *MongoTcInstanceRepository) Get(id string) (instance TcInstance, err error) {
+ req := sdk.NewDescribeDBInstancesRequest()
+ req.InstanceIds = []*string{&id}
+ resp, err := repo.client.DescribeDBInstances(req)
+ if err != nil {
+ return
+ }
+ if len(resp.Response.InstanceDetails) != 1 {
+ return nil, fmt.Errorf("Response instanceDetails size != 1, id=%s ", id)
+ }
+ meta := resp.Response.InstanceDetails[0]
+ instance, err = NewMongoTcInstance(id, meta)
+ if err != nil {
+ return
+ }
+ return
+}
+
+func (repo *MongoTcInstanceRepository) ListByIds(id []string) (instances []TcInstance, err error) {
+ return
+}
+
+func (repo *MongoTcInstanceRepository) ListByFilters(filters map[string]string) (instances []TcInstance, err error) {
+ req := sdk.NewDescribeDBInstancesRequest()
+ var offset uint64 = 0
+ var limit uint64 = 100
+ var total int64 = -1
+
+ req.Limit = &limit
+
+ if v, ok := filters["ProjectId"]; ok {
+ tv, e := strconv.ParseInt(v, 10, 64)
+ utv := uint64(tv)
+ if e == nil {
+ req.ProjectIds = []*uint64{&utv}
+ }
+ }
+ if v, ok := filters["InstanceId"]; ok {
+ req.InstanceIds = []*string{&v}
+ }
+
+getMoreInstances:
+ resp, err := repo.client.DescribeDBInstances(req)
+ if err != nil {
+ return
+ }
+ if total == -1 {
+ total = int64(*resp.Response.TotalCount)
+ }
+ for _, meta := range resp.Response.InstanceDetails {
+ ins, e := NewMongoTcInstance(*meta.InstanceId, meta)
+ if e != nil {
+ level.Error(repo.logger).Log("msg", "Create mongo instance fail", "id", *meta.InstanceId)
+ continue
+ }
+ instances = append(instances, ins)
+ }
+ offset += limit
+ if offset < uint64(total) {
+ goto getMoreInstances
+ }
+
+ return
+}
+
+func NewMongoTcInstanceRepository(c *config.TencentConfig, logger log.Logger) (repo TcInstanceRepository, err error) {
+ cli, err := client.NewMongodbClient(c)
+ if err != nil {
+ return
+ }
+ repo = &MongoTcInstanceRepository{
+ client: cli,
+ logger: logger,
+ }
+ return
+}
diff --git a/pkg/instance/repository_nat.go b/pkg/instance/repository_nat.go
new file mode 100644
index 0000000..c950cfa
--- /dev/null
+++ b/pkg/instance/repository_nat.go
@@ -0,0 +1,87 @@
+package instance
+
+import (
+ "fmt"
+ "github.com/go-kit/kit/log"
+ "github.com/go-kit/kit/log/level"
+ sdk "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/client"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/config"
+)
+
+func init() {
+ registerRepository("QCE/NAT_GATEWAY", NewNatTcInstanceRepository)
+}
+
+type NatTcInstanceRepository struct {
+ client *sdk.Client
+ logger log.Logger
+}
+
+func (repo *NatTcInstanceRepository) GetInstanceKey() string {
+ return "instanceid"
+}
+
+func (repo *NatTcInstanceRepository) Get(id string) (instance TcInstance, err error) {
+ req := sdk.NewDescribeNatGatewaysRequest()
+ req.NatGatewayIds = []*string{&id}
+ resp, err := repo.client.DescribeNatGateways(req)
+ if err != nil {
+ return
+ }
+ if len(resp.Response.NatGatewaySet) != 1 {
+ return nil, fmt.Errorf("Response instanceDetails size != 1, id=%s ", id)
+ }
+ meta := resp.Response.NatGatewaySet[0]
+ instance, err = NewNatTcInstance(id, meta)
+ if err != nil {
+ return
+ }
+ return
+}
+
+func (repo *NatTcInstanceRepository) ListByIds(id []string) (instances []TcInstance, err error) {
+ return
+}
+
+func (repo *NatTcInstanceRepository) ListByFilters(filters map[string]string) (instances []TcInstance, err error) {
+ req := sdk.NewDescribeNatGatewaysRequest()
+ var offset uint64 = 0
+ var limit uint64 = 100
+ var total int64 = -1
+ req.Limit = &limit
+
+getMoreInstances:
+ resp, err := repo.client.DescribeNatGateways(req)
+ if err != nil {
+ return
+ }
+ if total == -1 {
+ total = int64(*resp.Response.TotalCount)
+ }
+ for _, meta := range resp.Response.NatGatewaySet {
+ ins, e := NewNatTcInstance(*meta.NatGatewayId, meta)
+ if e != nil {
+ level.Error(repo.logger).Log("msg", "Create redis instance fail", "id", *meta.NatGatewayId)
+ continue
+ }
+ instances = append(instances, ins)
+ }
+ offset += limit
+ if offset < uint64(total) {
+ goto getMoreInstances
+ }
+ return
+}
+
+func NewNatTcInstanceRepository(c *config.TencentConfig, logger log.Logger) (repo TcInstanceRepository, err error) {
+ cli, err := client.NewVpvClient(c)
+ if err != nil {
+ return
+ }
+ repo = &NatTcInstanceRepository{
+ client: cli,
+ logger: logger,
+ }
+ return
+}
diff --git a/pkg/instance/repository_redis.go b/pkg/instance/repository_redis.go
new file mode 100644
index 0000000..92a0f2b
--- /dev/null
+++ b/pkg/instance/repository_redis.go
@@ -0,0 +1,89 @@
+package instance
+
+import (
+ "fmt"
+ "github.com/go-kit/kit/log"
+ "github.com/go-kit/kit/log/level"
+ sdk "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis/v20180412"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/client"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/config"
+)
+
+func init() {
+ registerRepository("QCE/REDIS", NewRedisTcInstanceRepository)
+}
+
+type RedisTcInstanceRepository struct {
+ client *sdk.Client
+ logger log.Logger
+}
+
+func (repo *RedisTcInstanceRepository) GetInstanceKey() string {
+ return "instanceid"
+}
+
+func (repo *RedisTcInstanceRepository) Get(id string) (instance TcInstance, err error) {
+ req := sdk.NewDescribeInstancesRequest()
+ req.InstanceId = &id
+ resp, err := repo.client.DescribeInstances(req)
+ if err != nil {
+ return
+ }
+ if len(resp.Response.InstanceSet) != 1 {
+ return nil, fmt.Errorf("Response instanceDetails size != 1, id=%s ", id)
+ }
+ meta := resp.Response.InstanceSet[0]
+ instance, err = NewRedisTcInstance(id, meta)
+ if err != nil {
+ return
+ }
+ return
+}
+
+func (repo *RedisTcInstanceRepository) ListByIds(id []string) (instances []TcInstance, err error) {
+ return
+}
+
+func (repo *RedisTcInstanceRepository) ListByFilters(filters map[string]string) (instances []TcInstance, err error) {
+ req := sdk.NewDescribeInstancesRequest()
+ var offset uint64 = 0
+ var limit uint64 = 100
+ var total int64 = -1
+
+ req.Limit = &limit
+
+getMoreInstances:
+ resp, err := repo.client.DescribeInstances(req)
+ if err != nil {
+ return
+ }
+ if total == -1 {
+ total = *resp.Response.TotalCount
+ }
+ for _, meta := range resp.Response.InstanceSet {
+ ins, e := NewRedisTcInstance(*meta.InstanceId, meta)
+ if e != nil {
+ level.Error(repo.logger).Log("msg", "Create redis instance fail", "id", *meta.InstanceId)
+ continue
+ }
+ instances = append(instances, ins)
+ }
+ offset += limit
+ if offset < uint64(total) {
+ goto getMoreInstances
+ }
+
+ return
+}
+
+func NewRedisTcInstanceRepository(c *config.TencentConfig, logger log.Logger) (repo TcInstanceRepository, err error) {
+ cli, err := client.NewRedisClient(c)
+ if err != nil {
+ return
+ }
+ repo = &RedisTcInstanceRepository{
+ client: cli,
+ logger: logger,
+ }
+ return
+}
diff --git a/pkg/metric/cache.go b/pkg/metric/cache.go
new file mode 100644
index 0000000..9b3a68b
--- /dev/null
+++ b/pkg/metric/cache.go
@@ -0,0 +1,78 @@
+package metric
+
+import (
+ "github.com/go-kit/kit/log"
+ "github.com/go-kit/kit/log/level"
+ "strings"
+ "time"
+)
+
+type TcmMetricCache struct {
+ Raw TcmMetricRepository
+ metaCache map[string]map[string]*TcmMeta //k1=namespace, k2=metricname(小写)
+ metaLastReloadTime map[string]int64
+ logger log.Logger
+}
+
+func (c *TcmMetricCache) GetMeta(namespace string, name string) (*TcmMeta, error) {
+ err := c.checkMetaNeedreload(namespace)
+ if err != nil {
+ return nil, err
+ }
+ return c.metaCache[namespace][strings.ToLower(name)], nil
+}
+
+func (c *TcmMetricCache) ListMetaByNamespace(namespace string) ([]*TcmMeta, error) {
+ err := c.checkMetaNeedreload(namespace)
+ if err != nil {
+ return nil, err
+ }
+ var metas []*TcmMeta
+ for _, meta := range c.metaCache[namespace] {
+ metas = append(metas, meta)
+ }
+ return metas, nil
+}
+
+func (c *TcmMetricCache) GetSamples(series *TcmSeries, startTime int64, endTime int64) (samples *TcmSamples, err error) {
+ return c.Raw.GetSamples(series, startTime, endTime)
+}
+
+func (c *TcmMetricCache) ListSamples(metric *TcmMetric, startTime int64, endTime int64) (samplesList []*TcmSamples, err error) {
+ return c.Raw.ListSamples(metric, startTime, endTime)
+}
+
+func (c *TcmMetricCache) checkMetaNeedreload(namespace string) (err error) {
+ v, ok := c.metaLastReloadTime[namespace]
+ if ok && v != 0 {
+ return nil
+ }
+ metas, err := c.Raw.ListMetaByNamespace(namespace)
+ if err != nil {
+ return err
+ }
+ np, ok := c.metaCache[namespace]
+ if !ok {
+ np = map[string]*TcmMeta{}
+ c.metaCache[namespace] = np
+
+ }
+ for _, meta := range metas {
+ np[strings.ToLower(meta.MetricName)] = meta
+ }
+ c.metaLastReloadTime[namespace] = time.Now().Unix()
+
+ level.Info(c.logger).Log("msg", "Reload metric meta cache", "namespace", namespace, "num", len(np))
+ return
+}
+
+func NewTcmMetricCache(repo TcmMetricRepository, logger log.Logger) TcmMetricRepository {
+ cache := &TcmMetricCache{
+ Raw: repo,
+ metaCache: map[string]map[string]*TcmMeta{},
+ metaLastReloadTime: map[string]int64{},
+ logger: logger,
+ }
+ return cache
+
+}
diff --git a/pkg/metric/conf.go b/pkg/metric/conf.go
new file mode 100644
index 0000000..9d25f05
--- /dev/null
+++ b/pkg/metric/conf.go
@@ -0,0 +1,112 @@
+package metric
+
+import (
+ "github.com/tencentyun/tencentcloud-exporter/pkg/config"
+ "strings"
+)
+
+type TcmMetricConfig struct {
+ CustomNamespacePrefix string
+ CustomProductName string
+ CustomMetricName string
+ MetricNameType int32
+ CustomQueryDimensions []map[string]string
+ InstanceLabelNames []string
+ ConstLabels map[string]string
+ StatTypes []string
+ StatPeriodSeconds int64
+ StatNumSamples int64
+ StatDelaySeconds int64
+ AllInstances bool
+ InstanceFilters map[string]string
+ OnlyIncludeInstances []string
+ ExcludeInstances []string
+}
+
+func NewTcmMetricConfigWithMetricYaml(c config.TencentMetric, meta *TcmMeta) (*TcmMetricConfig, error) {
+ conf := &TcmMetricConfig{}
+
+ npitems := strings.Split(c.Namespace, "/")
+ conf.CustomNamespacePrefix = npitems[0]
+
+ conf.CustomProductName = npitems[1]
+ conf.CustomMetricName = c.MetricReName
+ if c.MetricNameType != 0 {
+ conf.MetricNameType = c.MetricNameType
+ } else {
+ conf.MetricNameType = 2
+ }
+
+ conf.CustomQueryDimensions = []map[string]string{c.Dimensions}
+ conf.InstanceLabelNames = c.Labels
+ if len(c.Statistics) != 0 {
+ for _, st := range c.Statistics {
+ conf.StatTypes = append(conf.StatTypes, strings.ToLower(st))
+ }
+ } else {
+ conf.StatTypes = []string{"last"}
+ }
+ // 自动获取支持的统计周期
+ period, err := meta.GetPeriod(c.PeriodSeconds)
+ if err != nil {
+ return nil, err
+ }
+ conf.StatPeriodSeconds = period
+ conf.StatNumSamples = (c.RangeSeconds / period) + 1
+ // 至少采集4个点的数据
+ if conf.StatNumSamples < 4 {
+ conf.StatNumSamples = 4
+ }
+ conf.StatDelaySeconds = c.DelaySeconds
+
+ if len(c.Dimensions) == 0 {
+ conf.AllInstances = true
+ }
+
+ conf.InstanceFilters = c.Filters
+ return conf, nil
+
+}
+
+func NewTcmMetricConfigWithProductYaml(c config.TencentProduct, meta *TcmMeta) (*TcmMetricConfig, error) {
+ conf := &TcmMetricConfig{}
+
+ npitems := strings.Split(c.Namespace, "/")
+ conf.CustomNamespacePrefix = npitems[0]
+
+ conf.CustomProductName = npitems[1]
+ conf.CustomMetricName = ""
+ if c.MetricNameType != 0 {
+ conf.MetricNameType = c.MetricNameType
+ } else {
+ conf.MetricNameType = 2
+ }
+
+ conf.CustomQueryDimensions = c.CustomQueryDimensions
+ conf.InstanceLabelNames = c.ExtraLabels
+ if len(c.Statistics) != 0 {
+ for _, st := range c.Statistics {
+ conf.StatTypes = append(conf.StatTypes, strings.ToLower(st))
+ }
+ } else {
+ conf.StatTypes = []string{"last"}
+ }
+
+ period, err := meta.GetPeriod(c.PeriodSeconds)
+ if err != nil {
+ return nil, err
+ }
+ conf.StatPeriodSeconds = period
+ conf.StatNumSamples = (c.RangeSeconds / period) + 1
+ if conf.StatNumSamples < 4 {
+ conf.StatNumSamples = 4
+ }
+ conf.StatDelaySeconds = c.DelaySeconds
+ conf.AllInstances = c.AllInstances
+ conf.InstanceFilters = c.InstanceFilters
+ conf.OnlyIncludeInstances = c.OnlyIncludeInstances
+ conf.ExcludeInstances = c.ExcludeInstances
+
+ return conf, nil
+
+}
diff --git a/pkg/metric/label.go b/pkg/metric/label.go
new file mode 100644
index 0000000..d2aae6c
--- /dev/null
+++ b/pkg/metric/label.go
@@ -0,0 +1,80 @@
+package metric
+
+import (
+ "crypto/md5"
+ "encoding/json"
+ "fmt"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/instance"
+ "sort"
+)
+
+type Labels map[string]string
+
+func (l *Labels) Md5() (string, error) {
+ h := md5.New()
+ jb, err := json.Marshal(l)
+ if err != nil {
+ return "", err
+ }
+ return fmt.Sprintf("%x", h.Sum(jb)), nil
+}
+
+type TcmLabels struct {
+ queryLableNames []string
+ instanceLabelNames []string
+ constLabels Labels
+ Names []string
+}
+
+func (l *TcmLabels) GetValues(filters map[string]string, ins instance.TcInstance) (values []string, err error) {
+ nameValues := map[string]string{}
+ for _, name := range l.queryLableNames {
+ v, ok := filters[name]
+ if ok {
+ nameValues[name] = v
+ } else {
+ nameValues[name] = ""
+ }
+ }
+ for _, name := range l.instanceLabelNames {
+ v, e := ins.GetFieldValueByName(name)
+ if e != nil {
+ nameValues[name] = ""
+ } else {
+ nameValues[name] = v
+ }
+ }
+ for name, value := range l.constLabels {
+ nameValues[name] = value
+ }
+ for _, name := range l.Names {
+ values = append(values, nameValues[name])
+ }
+ return
+}
+
+func NewTcmLabels(qln []string, iln []string, cl Labels) (*TcmLabels, error) {
+ var labelNames []string
+ labelNames = append(labelNames, qln...)
+ labelNames = append(labelNames, iln...)
+ for lname := range cl {
+ labelNames = append(labelNames, lname)
+ }
+ var uniq = map[string]bool{}
+ for _, name := range labelNames {
+ uniq[name] = true
+ }
+ var uniqLabelNames []string
+ for n := range uniq {
+ uniqLabelNames = append(uniqLabelNames, n)
+ }
+ sort.Strings(uniqLabelNames)
+
+ l := &TcmLabels{
+ queryLableNames: qln,
+ instanceLabelNames: iln,
+ constLabels: cl,
+ Names: uniqLabelNames,
+ }
+ return l, nil
+}
diff --git a/pkg/metric/meta.go b/pkg/metric/meta.go
new file mode 100644
index 0000000..d82f5fe
--- /dev/null
+++ b/pkg/metric/meta.go
@@ -0,0 +1,99 @@
+package metric
+
+import (
+ "errors"
+ "fmt"
+ monitor "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/monitor/v20180724"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/config"
+ "sort"
+ "strconv"
+ "strings"
+)
+
+type TcmMeta struct {
+ Id string
+ Namespace string
+ ProductName string
+ MetricName string
+ SupportDimensions []string
+ m *monitor.MetricSet
+}
+
+func (meta *TcmMeta) GetPeriod(confPeriod int64) (int64, error) {
+ if len(meta.m.Period) == 0 {
+ return 0, errors.New("period is empty")
+ }
+
+ var allowPeriods []int
+ for _, p := range meta.m.Period {
+ allowPeriods = append(allowPeriods, int(*p))
+ }
+ sort.Ints(allowPeriods)
+
+ var period int64
+ if confPeriod != 0 {
+ period = confPeriod
+ } else {
+ period = config.DefaultPeriodSeconds
+ }
+
+ idx := sort.SearchInts(allowPeriods, int(period))
+ if idx < len(allowPeriods) {
+ return period, nil
+ } else {
+ return int64(allowPeriods[0]), nil
+ }
+
+}
+
+func (meta *TcmMeta) GetStatType(period int64) (string, error) {
+ var statType string
+ var defaultStatType string
+ for _, p := range meta.m.Periods {
+ i, err := strconv.ParseInt(*p.Period, 10, 64)
+ if err != nil {
+ return "", err
+ }
+ if i == period {
+ statType = *p.StatType[0]
+ }
+ if i == 300 {
+ defaultStatType = *p.StatType[0]
+ }
+ }
+ if statType != "" {
+ return statType, nil
+ }
+ if defaultStatType != "" {
+ return defaultStatType, nil
+ }
+
+ return "", fmt.Errorf("not found statType, period=%d", period)
+
+}
+
+func NewTcmMeta(m *monitor.MetricSet) (*TcmMeta, error) {
+ id := fmt.Sprintf("%s-%s", *m.Namespace, *m.MetricName)
+
+ var productName string
+ nsItems := strings.Split(*m.Namespace, "/")
+ productName = nsItems[len(nsItems)-1]
+
+ var supportDimensions []string
+ for _, dimension := range m.Dimensions {
+ for _, d := range dimension.Dimensions {
+ supportDimensions = append(supportDimensions, *d)
+ }
+ }
+
+ meta := &TcmMeta{
+ Id: id,
+ Namespace: *m.Namespace,
+ ProductName: productName,
+ MetricName: *m.MetricName,
+ SupportDimensions: supportDimensions,
+ m: m,
+ }
+ return meta, nil
+
+}
diff --git a/pkg/metric/metric.go b/pkg/metric/metric.go
new file mode 100644
index 0000000..d6a8524
--- /dev/null
+++ b/pkg/metric/metric.go
@@ -0,0 +1,169 @@
+package metric
+
+import (
+ "fmt"
+ "github.com/prometheus/client_golang/prometheus"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/util"
+ "strings"
+ "time"
+)
+
+type TcmMetric struct {
+ Id string
+ Meta *TcmMeta
+ Labels *TcmLabels
+ Series map[string]*TcmSeries
+ StatPromDesc map[string]*prometheus.Desc
+ Conf *TcmMetricConfig
+}
+
+func (m *TcmMetric) LoadSeries(series []*TcmSeries) error {
+ for _, s := range series {
+ m.Series[s.Id] = s
+ }
+ return nil
+}
+
+func (m *TcmMetric) GetLatestPromMetrics(repo TcmMetricRepository) (pms []prometheus.Metric, err error) {
+ st := time.Now().Unix() - m.Conf.StatNumSamples*m.Conf.StatPeriodSeconds
+
+ samplesList, err := repo.ListSamples(m, st, 0)
+ if err != nil {
+ return nil, err
+ }
+ for _, samples := range samplesList {
+ for st, desc := range m.StatPromDesc {
+ var point *TcmSample
+ switch st {
+ case "last":
+ point, err = samples.GetLatestPoint()
+ if err != nil {
+ return nil, err
+ }
+ case "max":
+ point, err = samples.GetMaxPoint()
+ if err != nil {
+ return nil, err
+ }
+ case "min":
+ point, err = samples.GetMinPoint()
+ if err != nil {
+ return nil, err
+ }
+ case "avg":
+ point, err = samples.GetAvgPoint()
+ if err != nil {
+ return nil, err
+ }
+ }
+ values, err := m.Labels.GetValues(samples.Series.QueryLabels, samples.Series.Instance)
+ if err != nil {
+ return nil, err
+ }
+ pm := prometheus.MustNewConstMetric(
+ desc,
+ prometheus.GaugeValue,
+ point.Value,
+ values...,
+ )
+ pms = append(pms, pm)
+ }
+ }
+
+ return
+}
+
+func (m TcmMetric) GetSeriesSplitByBatch(batch int) (steps [][]*TcmSeries) {
+ var series []*TcmSeries
+ for _, s := range m.Series {
+ series = append(series, s)
+ }
+
+ total := len(series)
+ for i := 0; i < total/batch+1; i++ {
+ s := i * batch
+ if s >= total {
+ continue
+ }
+ e := i*batch + batch
+ if e >= total {
+ e = total
+ }
+ steps = append(steps, series[s:e])
+ }
+ return
+}
+
+func NewTcmMetric(meta *TcmMeta, conf *TcmMetricConfig) (*TcmMetric, error) {
+ id := fmt.Sprintf("%s-%s", meta.Namespace, meta.MetricName)
+
+ labels, err := NewTcmLabels(meta.SupportDimensions, conf.InstanceLabelNames, conf.ConstLabels)
+ if err != nil {
+ return nil, err
+ }
+
+ statDescs := make(map[string]*prometheus.Desc)
+ statType, err := meta.GetStatType(conf.StatPeriodSeconds)
+ if err != nil {
+ return nil, err
+ }
+ help := fmt.Sprintf("Metric from %s.%s unit=%s stat=%s Desc=%s",
+ meta.Namespace,
+ meta.MetricName,
+ *meta.m.Unit,
+ statType,
+ *meta.m.Meaning.Zh,
+ )
+ var lnames []string
+ for _, name := range labels.Names {
+ lnames = append(lnames, util.ToUnderlineLower(name))
+ }
+ for _, s := range conf.StatTypes {
+ var st string
+ if s == "last" {
+ st = strings.ToLower(statType)
+ } else {
+ st = strings.ToLower(s)
+ }
+
+ // 显示的指标名称
+ var mn string
+ if conf.CustomMetricName != "" {
+ mn = conf.CustomMetricName
+ } else {
+ mn = meta.MetricName
+ }
+
+ // 显示的指标名称格式化
+ var vmn string
+ if conf.MetricNameType == 1 {
+ vmn = util.ToUnderlineLower(mn)
+ } else {
+ vmn = strings.ToLower(mn)
+ }
+ fqName := fmt.Sprintf("%s_%s_%s_%s",
+ conf.CustomNamespacePrefix,
+ conf.CustomProductName,
+ vmn,
+ st,
+ )
+ fqName = strings.ToLower(fqName)
+ desc := prometheus.NewDesc(
+ fqName,
+ help,
+ lnames,
+ nil,
+ )
+ statDescs[strings.ToLower(s)] = desc
+ }
+
+ m := &TcmMetric{
+ Id: id,
+ Meta: meta,
+ Labels: labels,
+ Series: map[string]*TcmSeries{},
+ StatPromDesc: statDescs,
+ Conf: conf,
+ }
+ return m, nil
+}
diff --git a/pkg/metric/query.go b/pkg/metric/query.go
new file mode 100644
index 0000000..56ffdbf
--- /dev/null
+++ b/pkg/metric/query.go
@@ -0,0 +1,49 @@
+package metric
+
+import (
+ "github.com/prometheus/client_golang/prometheus"
+)
+
+type TcmQuery struct {
+ Metric *TcmMetric
+ LatestQueryStatus int
+ repo TcmMetricRepository
+}
+
+type TcmQuerySet []*TcmQuery
+
+func (q *TcmQuery) GetPromMetrics() (pms []prometheus.Metric, err error) {
+ q.LatestQueryStatus = 2
+
+ pms, err = q.Metric.GetLatestPromMetrics(q.repo)
+ if err != nil {
+ return
+ }
+
+ q.LatestQueryStatus = 1
+ return
+}
+
+func (qs TcmQuerySet) SplitByBatch(batch int) (steps [][]*TcmQuery) {
+ total := len(qs)
+ for i := 0; i < total/batch+1; i++ {
+ s := i * batch
+ if s >= total {
+ continue
+ }
+ e := i*batch + batch
+ if e >= total {
+ e = total
+ }
+ steps = append(steps, qs[s:e])
+ }
+ return
+}
+
+func NewTcmQuery(m *TcmMetric, repo TcmMetricRepository) (query *TcmQuery, err error) {
+ query = &TcmQuery{
+ Metric: m,
+ repo: repo,
+ }
+ return
+}
diff --git a/pkg/metric/repository.go b/pkg/metric/repository.go
new file mode 100644
index 0000000..cfd96b3
--- /dev/null
+++ b/pkg/metric/repository.go
@@ -0,0 +1,229 @@
+package metric
+
+import (
+ "context"
+ "fmt"
+ "github.com/go-kit/kit/log"
+ "github.com/go-kit/kit/log/level"
+ monitor "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/monitor/v20180724"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/client"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/config"
+ "golang.org/x/time/rate"
+ "time"
+)
+
+var (
+ timeStampFormat = "2006-01-02 15:04:05"
+)
+
+type TcmMetricRepository interface {
+ GetMeta(namespace string, name string) (*TcmMeta, error)
+
+ ListMetaByNamespace(namespace string) ([]*TcmMeta, error)
+
+ GetSamples(series *TcmSeries, startTime int64, endTime int64) (samples *TcmSamples, err error)
+
+ ListSamples(metric *TcmMetric, startTime int64, endTime int64) (samplesList []*TcmSamples, err error)
+}
+
+type TcmMetricRepositoryImpl struct {
+ monitorClient *monitor.Client
+ limiter *rate.Limiter // 限速
+ ctx context.Context
+ logger log.Logger
+}
+
+func (repo *TcmMetricRepositoryImpl) GetMeta(namespace string, name string) (meta *TcmMeta, err error) {
+ // 限速
+ ctx, cancel := context.WithCancel(repo.ctx)
+ defer cancel()
+ err = repo.limiter.Wait(ctx)
+ if err != nil {
+ return
+ }
+
+ request := monitor.NewDescribeBaseMetricsRequest()
+ request.Namespace = &namespace
+ request.MetricName = &name
+ response, err := repo.monitorClient.DescribeBaseMetrics(request)
+ if err != nil {
+ return
+ }
+ if len(response.Response.MetricSet) != 1 {
+ return nil, fmt.Errorf("response metricSet size != 1")
+ }
+ meta, err = NewTcmMeta(response.Response.MetricSet[0])
+ if err != nil {
+ return
+ }
+ return
+}
+
+func (repo *TcmMetricRepositoryImpl) ListMetaByNamespace(namespace string) (metas []*TcmMeta, err error) {
+ // 限速
+ ctx, cancel := context.WithCancel(repo.ctx)
+ defer cancel()
+ err = repo.limiter.Wait(ctx)
+ if err != nil {
+ return
+ }
+
+ request := monitor.NewDescribeBaseMetricsRequest()
+ request.Namespace = &namespace
+ response, err := repo.monitorClient.DescribeBaseMetrics(request)
+ if err != nil {
+ return
+ }
+ for _, metricSet := range response.Response.MetricSet {
+ m, e := NewTcmMeta(metricSet)
+ if e != nil {
+ return nil, err
+ }
+ metas = append(metas, m)
+ }
+ return
+}
+
+func (repo *TcmMetricRepositoryImpl) GetSamples(s *TcmSeries, st int64, et int64) (samples *TcmSamples, err error) {
+ // 限速
+ ctx, cancel := context.WithCancel(repo.ctx)
+ defer cancel()
+ err = repo.limiter.Wait(ctx)
+ if err != nil {
+ return
+ }
+
+ request := monitor.NewGetMonitorDataRequest()
+ request.Namespace = &s.Metric.Meta.Namespace
+ request.MetricName = &s.Metric.Meta.MetricName
+
+ period := uint64(s.Metric.Conf.StatPeriodSeconds)
+ request.Period = &period
+
+ instanceFilters := &monitor.Instance{
+ Dimensions: []*monitor.Dimension{},
+ }
+ for k, v := range s.QueryLabels {
+ tk := k
+ tv := v
+ instanceFilters.Dimensions = append(instanceFilters.Dimensions, &monitor.Dimension{Name: &tk, Value: &tv})
+ }
+ request.Instances = []*monitor.Instance{instanceFilters}
+
+ stStr := time.Unix(st, 0).Format(timeStampFormat)
+ request.StartTime = &stStr
+ if et != 0 {
+ etStr := time.Unix(et, 0).Format(timeStampFormat)
+ request.StartTime = &etStr
+ }
+
+ response, err := repo.monitorClient.GetMonitorData(request)
+ if err != nil {
+ return
+ }
+
+ if len(response.Response.DataPoints) != 1 {
+ return nil, fmt.Errorf("response dataPoints size!=1")
+ }
+
+ samples, err = NewTcmSamples(s, response.Response.DataPoints[0])
+ if err != nil {
+ return
+ }
+ return
+}
+
+func (repo *TcmMetricRepositoryImpl) ListSamples(m *TcmMetric, st int64, et int64) (samplesList []*TcmSamples, err error) {
+ for _, seriesList := range m.GetSeriesSplitByBatch(10) {
+ ctx, cancel := context.WithCancel(repo.ctx)
+ err = repo.limiter.Wait(ctx)
+ if err != nil {
+ return
+ }
+
+ request := monitor.NewGetMonitorDataRequest()
+ request.Namespace = &m.Meta.Namespace
+ request.MetricName = &m.Meta.MetricName
+
+ period := uint64(m.Conf.StatPeriodSeconds)
+ request.Period = &period
+
+ for _, series := range seriesList {
+ ifilters := &monitor.Instance{
+ Dimensions: []*monitor.Dimension{},
+ }
+ for k, v := range series.QueryLabels {
+ tk := k
+ tv := v
+ ifilters.Dimensions = append(ifilters.Dimensions, &monitor.Dimension{Name: &tk, Value: &tv})
+ }
+ request.Instances = append(request.Instances, ifilters)
+ }
+
+ stStr := time.Unix(st, 0).Format(timeStampFormat)
+ request.StartTime = &stStr
+ if et != 0 {
+ etStr := time.Unix(et, 0).Format(timeStampFormat)
+ request.StartTime = &etStr
+ }
+
+ response, err := repo.monitorClient.GetMonitorData(request)
+ if err != nil {
+ return nil, err
+ }
+
+ for _, points := range response.Response.DataPoints {
+ ql := map[string]string{}
+ for _, dimension := range points.Dimensions {
+ if *dimension.Value != "" {
+ ql[*dimension.Name] = *dimension.Value
+ }
+ }
+ sid, e := GetTcmSeriesId(m, ql)
+ if e != nil {
+ level.Warn(repo.logger).Log(
+ "msg", "Get series id fail",
+ "metric", m.Meta.MetricName,
+ "dimension", fmt.Sprintf("%v", ql))
+ continue
+ }
+ s, ok := m.Series[sid]
+ if !ok {
+ level.Warn(repo.logger).Log(
+ "msg", "Response data point not match series",
+ "metric", m.Meta.MetricName,
+ "dimension", fmt.Sprintf("%v", ql))
+ continue
+ }
+ samples, e := NewTcmSamples(s, points)
+ if e != nil {
+ level.Warn(repo.logger).Log(
+ "msg", "Instance has not monitor data",
+ "metric", m.Meta.MetricName,
+ "dimension", fmt.Sprintf("%v", ql))
+ } else {
+ samplesList = append(samplesList, samples)
+ }
+
+ }
+
+ cancel()
+ }
+ return
+}
+
+func NewTcmMetricRepository(conf *config.TencentConfig, logger log.Logger) (repo TcmMetricRepository, err error) {
+ monitorClient, err := client.NewMonitorClient(conf)
+ if err != nil {
+ return
+ }
+
+ repo = &TcmMetricRepositoryImpl{
+ monitorClient: monitorClient,
+ limiter: rate.NewLimiter(rate.Limit(conf.RateLimit), 1),
+ ctx: context.Background(),
+ logger: logger,
+ }
+
+ return
+}
diff --git a/pkg/metric/sample.go b/pkg/metric/sample.go
new file mode 100644
index 0000000..d6c43ec
--- /dev/null
+++ b/pkg/metric/sample.go
@@ -0,0 +1,81 @@
+package metric
+
+import (
+ "fmt"
+ monitor "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/monitor/v20180724"
+)
+
+type TcmSample struct {
+ Timestamp float64
+ Value float64
+}
+
+type TcmSamples struct {
+ Series *TcmSeries
+ Samples []*TcmSample
+}
+
+func (s *TcmSamples) GetLatestPoint() (point *TcmSample, err error) {
+ if len(s.Samples) == 1 {
+ return s.Samples[0], nil
+ } else {
+ return s.Samples[len(s.Samples)-2], nil
+ }
+}
+
+func (s *TcmSamples) GetMaxPoint() (point *TcmSample, err error) {
+ maxValue := s.Samples[0].Value
+ var maxIdx int
+ for idx, sample := range s.Samples {
+ if sample.Value > maxValue {
+ maxValue = sample.Value
+ maxIdx = idx
+ }
+ }
+ return s.Samples[maxIdx], nil
+}
+
+func (s *TcmSamples) GetMinPoint() (point *TcmSample, err error) {
+ minValue := s.Samples[0].Value
+ var minIdx int
+ for idx, sample := range s.Samples {
+ if sample.Value < minValue {
+ minValue = sample.Value
+ minIdx = idx
+ }
+ }
+ return s.Samples[minIdx], nil
+}
+
+func (s *TcmSamples) GetAvgPoint() (point *TcmSample, err error) {
+ var sum float64
+ for _, sample := range s.Samples {
+ sum = sum + sample.Value
+ }
+ avg := sum / float64(len(s.Samples))
+ sample := &TcmSample{
+ Timestamp: s.Samples[len(s.Samples)-1].Timestamp,
+ Value: avg,
+ }
+ return sample, nil
+}
+
+func NewTcmSamples(series *TcmSeries, p *monitor.DataPoint) (s *TcmSamples, err error) {
+ s = &TcmSamples{
+ Series: series,
+ Samples: []*TcmSample{},
+ }
+
+ if len(p.Timestamps) == 0 {
+ return nil, fmt.Errorf("Samples is empty ")
+ }
+
+ if len(p.Timestamps) != len(p.Values) {
+ return nil, fmt.Errorf("Samples error, timestamps != values ")
+ }
+
+ for i := 0; i < len(p.Timestamps); i++ {
+ s.Samples = append(s.Samples, &TcmSample{*p.Timestamps[i], *p.Values[i]})
+ }
+ return
+}
diff --git a/pkg/metric/series.go b/pkg/metric/series.go
new file mode 100644
index 0000000..baec866
--- /dev/null
+++ b/pkg/metric/series.go
@@ -0,0 +1,37 @@
+package metric
+
+import (
+ "fmt"
+ "github.com/tencentyun/tencentcloud-exporter/pkg/instance"
+)
+
+type TcmSeries struct {
+ Id string
+ Metric *TcmMetric
+ QueryLabels Labels
+ Instance instance.TcInstance
+}
+
+func GetTcmSeriesId(m *TcmMetric, ql Labels) (string, error) {
+ m5, e := ql.Md5()
+ if e != nil {
+ return "", e
+ }
+ return fmt.Sprintf("%s-%s", m.Id, m5), nil
+}
+
+func NewTcmSeries(m *TcmMetric, ql Labels, ins instance.TcInstance) (*TcmSeries, error) {
+ id, err := GetTcmSeriesId(m, ql)
+ if err != nil {
+ return nil, err
+ }
+
+ s := &TcmSeries{
+ Id: id,
+ Metric: m,
+ QueryLabels: ql,
+ Instance: ins,
+ }
+ return s, nil
+
+}
diff --git a/pkg/util/list.go b/pkg/util/list.go
new file mode 100644
index 0000000..1fcf8a4
--- /dev/null
+++ b/pkg/util/list.go
@@ -0,0 +1,21 @@
+package util
+
+func IsStrInList(l []string, i string) bool {
+ for _, item := range l {
+ if item == i {
+ return true
+ }
+ }
+ return false
+
+}
+
+func IsInt64InList(l []*int64, i int64) bool {
+ for _, item := range l {
+ if *item == i {
+ return true
+ }
+ }
+ return false
+
+}
diff --git a/pkg/util/map.go b/pkg/util/map.go
new file mode 100644
index 0000000..c7d8682
--- /dev/null
+++ b/pkg/util/map.go
@@ -0,0 +1 @@
+package util
diff --git a/pkg/util/set.go b/pkg/util/set.go
new file mode 100644
index 0000000..c7d8682
--- /dev/null
+++ b/pkg/util/set.go
@@ -0,0 +1 @@
+package util
diff --git a/pkg/util/str.go b/pkg/util/str.go
new file mode 100644
index 0000000..c9e2318
--- /dev/null
+++ b/pkg/util/str.go
@@ -0,0 +1,17 @@
+package util
+
+func ToUnderlineLower(s string) string {
+ var interval byte = 'a' - 'A'
+ b := make([]byte, 0, len(s))
+ for i := 0; i < len(s); i++ {
+ c := s[i]
+ if c >= 'A' && c <= 'Z' {
+ c += interval
+ if i != 0 {
+ b = append(b, '_')
+ }
+ }
+ b = append(b, c)
+ }
+ return string(b)
+}
diff --git a/qcloud.yml b/qcloud.yml
deleted file mode 100644
index 460796f..0000000
--- a/qcloud.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-credential:
- access_key: "AKIDPTH3NY1BXXXXXXXXXXXXXXXXXXXXXXXXXX"
- secret_key: "XoqmT7WlkYYYYYYYYYYYYYYYYYYYYYY"
- region: "ap-guangzhou"
-metrics:
- - tc_namespace: test/cvm
- tc_metric_name: CPUUsage
- tc_metric_rename: cpu_use
- tc_labels: [InstanceName,Zone]
- tc_statistics: [max]
- period_seconds: 60
- delay_seconds: 300
- range_seconds: 120
\ No newline at end of file
diff --git a/qcloud_exporter.go b/qcloud_exporter.go
deleted file mode 100644
index 2a5c976..0000000
--- a/qcloud_exporter.go
+++ /dev/null
@@ -1,75 +0,0 @@
-package main
-
-import (
- "net/http"
-
- "github.com/tencentyun/tencentcloud-exporter/collector"
- "github.com/tencentyun/tencentcloud-exporter/config"
- "github.com/tencentyun/tencentcloud-exporter/instances"
- "github.com/tencentyun/tencentcloud-exporter/monitor"
-
- "github.com/prometheus/client_golang/prometheus"
- "github.com/prometheus/client_golang/prometheus/promhttp"
- "github.com/prometheus/common/log"
- "github.com/prometheus/common/version"
- kingpin "gopkg.in/alecthomas/kingpin.v2"
-)
-
-func main() {
-
- var (
- listenAddress = kingpin.Flag("web.listen-address", "Address on which to expose metrics and web interface.").
- Default("localhost:8001").String()
-
- metricsPath = kingpin.Flag("web.telemetry-path", "Path under which to expose metrics.").
- Default("/metrics").String()
-
- configFile = kingpin.Flag("config.file", "Tencent qcloud exporter configuration file.").
- Default("qcloud.yml").String()
- )
- log.AddFlags(kingpin.CommandLine)
- kingpin.Version(version.Print("tencent_qcloud_exporter"))
- kingpin.HelpFlag.Short('h')
- kingpin.Parse()
-
- log.Infoln("Starting tencent_qcloud_exporter", version.Info())
- log.Infoln("Build context", version.BuildContext())
-
- tencentConfig := config.NewConfig()
- if err := tencentConfig.LoadFile(*configFile); err != nil {
- log.Fatal(err.Error())
- }
-
- credentialConfig := (*tencentConfig).Credential
- metricsConfig := (*tencentConfig).Metrics
-
- if err := monitor.InitClient(credentialConfig, (*tencentConfig).RateLimit); err != nil {
- log.Fatal(err.Error())
- }
-
- if err := instances.InitClient(credentialConfig); err != nil {
- log.Fatal(err.Error())
- }
-
- tencentCollector, err := collector.NewCollector(metricsConfig)
- if err != nil {
- log.Fatal(err.Error())
- }
-
- registry := prometheus.NewRegistry()
- registry.MustRegister(tencentCollector)
-
- http.Handle(*metricsPath, promhttp.HandlerFor(registry, promhttp.HandlerOpts{}))
-
- http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
- w.Write([]byte(`
- TencentCloud Exporter
-
- TencentCloud Exporter
- Metrics
-
- `))
- })
-
- log.Fatal(http.ListenAndServe(*listenAddress, nil))
-}
diff --git a/readme.md b/readme.md
index a59ffcb..a1c5824 100644
--- a/readme.md
+++ b/readme.md
@@ -1,311 +1,142 @@
-# 腾讯云监控 Exporter
-
-## 安装
-
-### 环境
-`go1.9.x` (and later)
-### 编译
+# 腾讯云监控 Exporter v2
+
+通过qcloud exporter将云监控支持的产品监控指标自动批量导出
+(`兼容v1版本`)
+
+## 一、支持的产品列表
+
+产品 | 命名空间 |支持的指标
+--------|---------|----------
+MongoDB |QCE/CMONGO|[指标详情](https://cloud.tencent.com/document/product/248/45104)
+CDB|QCE/CDB|[指标详情](https://cloud.tencent.com/document/product/248/45147)
+Redis标准版|QCE/REDIS|[指标详情](https://cloud.tencent.com/document/product/248/45111)
+Redis集群版|QCE/REDIS|[指标详情](https://cloud.tencent.com/document/product/248/45111)
+CVM|QCE/CVM|[指标详情](https://cloud.tencent.com/document/product/248/6843)
+COS|QCE/COS|[指标详情](https://cloud.tencent.com/document/product/248/45140)
+CDN|QCE/CDN|[指标详情](https://cloud.tencent.com/document/product/248/45138)
+CLB|QCE/LB_PUBLIC|[指标详情](https://cloud.tencent.com/document/product/248/45047)
+NAT|QCE/NAT_GATEWAY|[指标详情](https://cloud.tencent.com/document/product/248/45069)
+物理专线|QCE/DC|[指标详情](https://cloud.tencent.com/document/product/248/45102)
+专用通道|QCE/DCX|[指标详情](https://cloud.tencent.com/document/product/248/45101)
+
+`后续会有更多的产品支持`
+
+## 二、快速开始
+### 1.构建
```shell
-cd $GOPATH/src
-go get github.com/tencentyun/tencentcloud-exporter
-go build
+git clone http://git.code.oa.com/rig/tencentcloud-exporter.git
+go build cmd/qcloud-exporter/qcloud_exporter.go
```
+或从release列表获取预编译的二进制, 目前只提供linux-amd64
+### 2. 定义产品实例配置
+- 配置云API的`credential`认证信息
+- 配置产品`products`指标、实例导出信息
-## 快速开始
-
-需要配置腾讯云提供的access_key,secret_key和地区id,例子(qcloud.yml)如下:
+如导出MongoDB所有指标所有实例
```yaml
credential:
- access_key: "your_fancy_accesskey"
- secret_key: "your_fancy_accesskey"
- region: "ap-shanghai"
-metrics:
- - tc_namespace: test/cvm
- tc_metric_name: CPUUsage
- tc_metric_rename: cpu_use
- tc_labels: [InstanceName,Zone]
- tc_statistics: [max]
- period_seconds: 60
- delay_seconds: 300
- range_seconds: 120
+ access_key: "access_key" // 云API的SecretId
+ secret_key: "secret_key" // 云API的SecretKey
+ region: "ap-guangzhou" // 实例所在区域信息
+
+products:
+ - namespace: QCE/CMONGO // 产品命名空间
+ all_metrics: true // 导出支持的所有指标
+ all_instances: true // 导出region下的所有实例
+ extra_labels: [InstanceName,Zone] // 将实例的字段作为指标的lables导出
```
-启动 Exporter
+### 3. 启动 Exporter
```bash
-> tencentcloud-exporter --web.listen-address "0.0.0.0:9123" --config.file "qcloud.yml" --web.telemetry-path "/metrics" --log.level "debug"
+> qcloud_exporter --config.file "qcloud.yml"
```
-访问 [http://127.0.0.1:9123/metrics](http://127.0.0.1:9123/metrics) 查看指标抓取是否成功
+访问 [http://127.0.0.1:9123/metrics](http://127.0.0.1:9123/metrics) 查看所有导出的指标
-`--log.level` 是打印的日志级别,方便定时使用,平时可以去除
-## 高级配置
-```
+## 三、qcloud.yml配置详情
+在git的`configs`里有支持产品的配置模版样例可参考
+```yaml
credential:
- access_key:
- access_secret:
- region:
-
-rate_limit: 10 #限制此实例接口调用频率, 一秒钟可以有几次监控接口调用
-
+ access_key: // 必须, 云API的SecretId
+ access_secret: // 必须, 云API的SecretKey
+ region: // 必须, 实例所在区域信息
+
+rate_limit: 15 // 腾讯云监控拉取指标数据限制, 官方默认限制最大20qps
+
+
+// 整个产品纬度配置, 每个产品一个item
+products:
+ - namespace: QCE/CMONGO // 必须, 产品命名空间; QCE前缀可自定义,CMONGO产品名不区分大小写, 可用别名
+ all_metrics: true // 常用, 推荐开启, 导出支持的所有指标
+ all_instances: true // 常用, 推荐开启, 导出该region下的所有实例
+ extra_labels: [InstanceName,Zone] // 可选, 将实例的字段作为指标的lables导出
+ only_include_metrics: [Inserts] // 可选, 只导出这些指标, 配置时all_metrics失效
+ exclude_metrics: [Reads] // 可选, 不导出这些指标
+ instance_filters: // 可选, 在all_instances开启情况下, 根据每个实例的字段进行过滤
+ - ProjectId: 1
+ Status: 1
+ only_include_instances: [cmgo-xxxxxxxx] // 可选, 只导出这些实例id, 配置时all_instances失效
+ exclude_instances: [cmgo-xxxxxxxx] // 可选, 不导出这些实例id
+ custom_query_dimensions: // 可选, 不常用, 自定义指标查询条件, 配置时all_instances,only_include_instances,exclude_instances失效, 用于不支持按实例纬度查询的指标
+ - target: cmgo-xxxxxxxx
+ statistics_types: [avg] // 可选, 拉取N个数据点, 再进行max、min、avg、last计算, 默认last取最新值
+ period_seconds: 60 // 可选, 指标统计周期, 默认自动获取指标支持的最小统计周期
+ range_seconds: 300 // 可选, 选取时间范围, 开始时间=now-range_seconds, 结束时间=now
+ delay_seconds: 60 // 可选, 时间偏移量, 结束时间=now-delay_seconds
+ metric_name_type: 1 // 可选,导出指标的名字格式化类型, 1=大写转小写加下划线, 2=转小写; 默认2
+
+
+// 单个指标纬度配置, 每个指标一个item
metrics:
- - tc_namespace: xxx/CVM #命名空间(xxx是a-z随意定的名字, 而后面的cvm是固定的,是每个产品的名字)
- tc_metric_name: CPUUsage #腾讯云上指标名字
- tc_metric_rename: cpu_usage #上报的指标名字(默认是tc_metric_name)
- tc_myself_dimensions:#使用者自己指定上报维度,一般用不到设置
- appid: 123456789
- bucket :"test"
- tc_labels: [Zone,InstanceName,ProjectId,Vip,UniqVpcId] #tag, labels会按照tc_labels元素字节序进行排序
- tc_filters: #过滤实例
- InstanceName: test #InstanceName必须存在test和my才会上报
- VpcId: vpc-dk8zmwuf #VpcId必须为vpc-dk8zmwuf才会上报
- tc_statistics: [Max]#计算方法 支持Max Min 和Avg (字母大小写无关)
- period_seconds: 60 #数据统计周期
- range_seconds: 300 #取多少数据进行统计(如例子是取300/60+1==6个进行max,min,avg或sum,越多数据越平稳)
- delay_seconds: 600 #数据延时时长
-```
-
-credential中项目可以在环境变量中配置(如果设置了下面的环境变量, 删除credential这个block就可以了)
-```
+ - tc_namespace: QCE/CMONGO // 产品命名空间, 同namespace
+ tc_metric_name: Inserts // 云监控定义的指标名
+ tc_metric_rename: Inserts // 导出指标的显示名
+ tc_metric_name_type: 1 // 可选,导出指标的名字格式化类型, 1=大写转小写加下划线, 2=转小写; 默认1
+ tc_labels: [InstanceName] // 可选, 将实例的字段作为指标的lables导出
+ tc_filters: // 可选, 根据每个实例的字段进行过滤, 否则默认导出region下所有实例
+ - ProjectId: 1
+ Status: 1
+ tc_myself_dimensions: // 可选, 同custom_query_dimensions
+ tc_statistics: [Avg] // 可选, 同statistics_types
+ period_seconds: 60 // 可选, 同period_seconds
+ range_seconds: 300 // 可选, 同range_seconds
+ delay_seconds: 60 // 可选, 同delay_seconds
+
+```
+特殊说明:
+1. **custom_query_dimensions**
+每个实例的纬度字段信息, 可从对应的云监控产品指标文档查询, 如mongo支持的纬度字段信息可由[云监控指标详情](https://cloud.tencent.com/document/product/248/45104#%E5%90%84%E7%BB%B4%E5%BA%A6%E5%AF%B9%E5%BA%94%E5%8F%82%E6%95%B0%E6%80%BB%E8%A7%88) 查询
+2. **extra_labels**
+每个导出metric的labels还额外上报实例对应的字段信息, 实例可选的字段列表可从对应产品文档查询, 如mongo实例支持的字段可从[实例查询api文档](https://cloud.tencent.com/document/product/240/38568) 获取, 目前只支持str、int类型的字段
+3. **period_seconds**
+每个指标支持的时间纬度统计, 一般支持60、300秒等, 具体可由对应产品的云监控产品指标文档查询, 如mongo可由[指标元数据查询](https://cloud.tencent.com/document/product/248/30351) , 假如不配置, 使用默认值(60), 假如该指标不支持60, 则自动使用该指标支持的最小值
+4. **credential**
+SecretId、SecretKey、Region可由环境变量获取
+```bash
export TENCENTCLOUD_SECRET_ID="YOUR_ACCESS_KEY"
export TENCENTCLOUD_SECRET_KEY="YOUR_ACCESS_SECRET"
export TENCENTCLOUD_REGION="REGION"
```
-上边说明上报例子:
-
-```
-xxx_cvm_cpu_usage_max{instance_name="my_a_test",zone="ap-guangzhou-3",project_id:"0",vpc_id="vpc-dk8zmwuf"} 42.0
-xxx_cvm_cpu_usage_max{instance_name="my_b_test",zone="ap-guangzhou-1",project_id:"0",vpc_id="vpc-dk8zmwuf"} 7.0
-```
-
-
-
-## 使用注意
-### 1. tc_myself_dimensions风格 vs tc_labels风格
-配置存在两种风格,两种风格在字段上不兼容, tc_myself_dimensions风格里边有严格字段要求(大小写也有要求), tc_myself_dimensions和 [tc_filters、tc_labels]是冲突的.各个产品会按照业务模型、api不同选择tc_myself_dimensions风格或者tc_labels风格, 可以参考各产品文档了解产品使用那种风格
-
-- tc_myself_dimensions风格在生成prometheus tags时会按照key的字节序排序
-
-
-- tc_labels风格在生成prometheus tags时会按照数组元素的字节序排序
-
-如:CDN业务,只能支持tc_myself_dimensions, 里边必须设置"projectId"和"domain"两个属性,多设置属性、少设置或者设置"ProjectId"等请求皆无法拉取到监控数据
-
-### 2.不同产品的同属性存细微差异
-同一个属性(label)产品api的支持情形不同, 如cvm的InstanceName不支持模糊匹配, 而mysql\redis等产品支持模糊匹配 ,这个可以参考各个产品拉取实例列表的接口
-
-### 3.各个指标period_seconds是不同的
-
-如COS的InternetTraffic指标支持60和300,而StdStorage指标是小时级别的,这部分差异比较多需要参考监控的官方文档
-
-
-## 各个产品风格及说明
-
-### **数据库:mysql** (tc_labels风格)
-
-
-
-支持属性:
-```
-{"Zone","VpcId","SubnetId","InstanceName","InstanceId","ProjectId","Qps",
-"EngineVersion",,"RenewFlag","SubnetId","CPU","Memory","Volume","Vip","Vport","CreateTime"}
-```
-
-
-eg:
-```
- - tc_namespace: guauga/Mysql
- tc_metric_name: BytesSent
- tc_metric_rename: MyNewName
- tc_labels: [ProjectId,Zone]
- tc_statistics: [Max,Min,Avg]
- period_seconds: 60
- delay_seconds: 300
- range_seconds: 120
-```
-### **虚拟主机:cvm** (tc_labels风格)
-
-支持属性:
-```
-{"Zone", "VpcId", "SubnetId","InstanceName", "InstanceId", "PrivateIpAddress","PublicIpAddress",
- "InstanceChargeType","InstanceType","CreatedTime","ImageId","RenewFlag","SubnetId","CPU","Memory"}
-```
-eg:
-
-```
- - tc_namespace: guauga/cvm
- tc_metric_name: CPUUsage
- tc_metric_rename: cpu_use
- tc_labels: [Zone,InstanceId,InstanceName]
- tc_filters:
- InstanceName: "dev"
- Zone: "ap-guangzhou-4"
- tc_statistics: [Max,Min,Avg]
- period_seconds: 60
- delay_seconds: 300
- range_seconds: 120
-```
-### **键值存储(Redis老集群版\CKV主从版\CKV集群版):redis** (tc_labels风格)
-
-支持属性:
-```
-{"InstanceId", "InstanceName","ProjectId","VpcId","SubnetId"}
-```
+## 四、qcloud_exporter支持的命令行参数说明
-eg:
+命令行参数|说明|默认值
+-------|----|-----
+--web.listen-address|http服务的端口|9123
+--web.telemetry-path|http访问的路径|/metrics
+--web.enable-exporter-metrics|是否开启服务自身的指标导出, promhttp_\*, process_\*, go_*|false
+--web.max-requests|最大同时抓取/metrics并发数, 0=disable|0
+--config.file|产品实例指标配置文件位置|qcloud.yml
+--log.level|日志级别|info
-```
- - tc_namespace: guauga/redis
- tc_metric_name: CmdstatGet
- tc_metric_rename: cmd_get
- tc_labels: [InstanceId, InstanceName,ProjectId,VpcId,SubnetId]
- tc_filters:
- InstanceName: "cdn"
- tc_statistics: [Max,Min,Avg]
- period_seconds: 60
- delay_seconds: 300
- range_seconds: 120
-```
-### **键值存储集群(Redis 2.8主从版\Redis 2.8单机版\Redis 4.0集群版等):cluster_redis** (tc_labels风格)
-
-支持属性:
-```
-{"InstanceId", "InstanceName","ProjectId","VpcId","SubnetId"}
-```
-eg:
-
-```
- - tc_namespace: guauga/cluster_redis
- tc_metric_name: KeysMin
- tc_metric_rename: keys
- tc_labels: [InstanceId, InstanceName,ProjectId,VpcId,SubnetId]
- tc_filters:
- InstanceName: "cdn"
- tc_statistics: [Avg]
- period_seconds: 60
- delay_seconds: 300
- range_seconds: 120
-```
-
-
-### **负载均衡(公网):public_clb** (tc_labels风格)
-
-支持属性:
-```
-{"LoadBalancerName","LoadBalancerVip","ProjectId"}
-```
-eg:
-
-```
- - tc_namespace: Tencent/public_clb
- tc_metric_name: Outtraffic
- tc_labels: [LoadBalancerVip,ProjectId]
- tc_filters:
- LoadBalancerName: "SK1"
- tc_statistics: [Max]
- period_seconds: 60
- delay_seconds: 120
- range_seconds: 120
-```
-
-### **内容分发网络:cdn** (tc_myself_dimensions风格)
-
-可用维度
-
-
-- [projectId,domain]
-
-
-eg:
-
-```
- - tc_namespace: guauga/cdn
- tc_metric_name: Requests
- tc_myself_dimensions:
- projectId: 0
- domain: "s5.hy.qcloudcdn.com"
- tc_statistics: [Max]
- period_seconds: 60
- delay_seconds: 600
- range_seconds: 60
-```
-
-### **对象存储:cos** (tc_myself_dimensions风格)
-
-
-可用维度
-
-- [appid,bucket]
-
-eg:
-```
- - tc_namespace: guauga/cos
- tc_metric_name: StdWriteRequests
- tc_myself_dimensions:
- appid: 1251337138
- bucket: "test-1251337138"
- tc_statistics: [Max]
- period_seconds: 60
- delay_seconds: 300
- range_seconds: 60
-```
-### **专线(逻辑层-专线通道):dcx** (tc_labels风格)
-
-
-
-支持属性:
-```
-{"DirectConnectTunnelId","DirectConnectTunnelName","VpcId","TencentAddress","CustomerAddress"}
-```
-eg:
-```
- - tc_namespace: Tencent/dcx
- tc_metric_name: Delay
- tc_labels: [DirectConnectTunnelName]
- tc_statistics: [Max]
- period_seconds: 300
- delay_seconds: 600
- range_seconds: 600
-```
-### **专线(物理层-物理通道):dc** (tc_labels风格)
-支持属性:
-```
-{"DirectConnectId","DirectConnectName"}
-```
-eg:
-```
- - tc_namespace: Tencent/dc
- tc_metric_name: Outbandwidth
- tc_labels: [DirectConnectName]
- tc_statistics: [Max]
- period_seconds: 300
- delay_seconds: 600
- range_seconds: 600
-```
-
-
-### **NAT 网关:nat** (tc_labels风格)
-支持属性:
-```
-{"InstanceId","InstanceName", "Zone"}
-```
-eg:
-```
-- tc_namespace: test/nat
- tc_metric_name: Outbandwidth
- tc_metric_rename: out
- tc_labels: [InstanceName,Zone]
- tc_statistics: [max]
- period_seconds: 60
- delay_seconds: 300
- range_seconds: 120
-```
+## 五、qcloud.yml样例
+在git的configs里有支持产品的配置模版样例
diff --git a/sonar-project.properties b/sonar-project.properties
deleted file mode 100644
index 9a9844d..0000000
--- a/sonar-project.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-sonar.projectKey=my:tencent_qcloud_exporter
-sonar.projectName=tencent_qcloud_exporter
-sonar.projectVersion=1.0
-sonar.sourceEncoding=UTF-8
-sonar.sources=.
-sonar.cpp.file.suffixes=-
-sonar.c.file.suffixes=-
-sonar.objc.file.suffixes=-
-
-#disable Cognitive Complexity of functions
-sonar.issue.ignore.multicriteria=S3776
-sonar.issue.ignore.multicriteria.S3776.ruleKey=go:S3776
-sonar.issue.ignore.multicriteria.S3776.resourceKey=**/*
-
diff --git a/vendor/github.com/alecthomas/template/LICENSE b/vendor/github.com/alecthomas/template/LICENSE
deleted file mode 100644
index 7448756..0000000
--- a/vendor/github.com/alecthomas/template/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2012 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/alecthomas/template/README.md b/vendor/github.com/alecthomas/template/README.md
deleted file mode 100644
index ef6a8ee..0000000
--- a/vendor/github.com/alecthomas/template/README.md
+++ /dev/null
@@ -1,25 +0,0 @@
-# Go's `text/template` package with newline elision
-
-This is a fork of Go 1.4's [text/template](http://golang.org/pkg/text/template/) package with one addition: a backslash immediately after a closing delimiter will delete all subsequent newlines until a non-newline.
-
-eg.
-
-```
-{{if true}}\
-hello
-{{end}}\
-```
-
-Will result in:
-
-```
-hello\n
-```
-
-Rather than:
-
-```
-\n
-hello\n
-\n
-```
diff --git a/vendor/github.com/alecthomas/template/doc.go b/vendor/github.com/alecthomas/template/doc.go
deleted file mode 100644
index 223c595..0000000
--- a/vendor/github.com/alecthomas/template/doc.go
+++ /dev/null
@@ -1,406 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
-Package template implements data-driven templates for generating textual output.
-
-To generate HTML output, see package html/template, which has the same interface
-as this package but automatically secures HTML output against certain attacks.
-
-Templates are executed by applying them to a data structure. Annotations in the
-template refer to elements of the data structure (typically a field of a struct
-or a key in a map) to control execution and derive values to be displayed.
-Execution of the template walks the structure and sets the cursor, represented
-by a period '.' and called "dot", to the value at the current location in the
-structure as execution proceeds.
-
-The input text for a template is UTF-8-encoded text in any format.
-"Actions"--data evaluations or control structures--are delimited by
-"{{" and "}}"; all text outside actions is copied to the output unchanged.
-Actions may not span newlines, although comments can.
-
-Once parsed, a template may be executed safely in parallel.
-
-Here is a trivial example that prints "17 items are made of wool".
-
- type Inventory struct {
- Material string
- Count uint
- }
- sweaters := Inventory{"wool", 17}
- tmpl, err := template.New("test").Parse("{{.Count}} items are made of {{.Material}}")
- if err != nil { panic(err) }
- err = tmpl.Execute(os.Stdout, sweaters)
- if err != nil { panic(err) }
-
-More intricate examples appear below.
-
-Actions
-
-Here is the list of actions. "Arguments" and "pipelines" are evaluations of
-data, defined in detail below.
-
-*/
-// {{/* a comment */}}
-// A comment; discarded. May contain newlines.
-// Comments do not nest and must start and end at the
-// delimiters, as shown here.
-/*
-
- {{pipeline}}
- The default textual representation of the value of the pipeline
- is copied to the output.
-
- {{if pipeline}} T1 {{end}}
- If the value of the pipeline is empty, no output is generated;
- otherwise, T1 is executed. The empty values are false, 0, any
- nil pointer or interface value, and any array, slice, map, or
- string of length zero.
- Dot is unaffected.
-
- {{if pipeline}} T1 {{else}} T0 {{end}}
- If the value of the pipeline is empty, T0 is executed;
- otherwise, T1 is executed. Dot is unaffected.
-
- {{if pipeline}} T1 {{else if pipeline}} T0 {{end}}
- To simplify the appearance of if-else chains, the else action
- of an if may include another if directly; the effect is exactly
- the same as writing
- {{if pipeline}} T1 {{else}}{{if pipeline}} T0 {{end}}{{end}}
-
- {{range pipeline}} T1 {{end}}
- The value of the pipeline must be an array, slice, map, or channel.
- If the value of the pipeline has length zero, nothing is output;
- otherwise, dot is set to the successive elements of the array,
- slice, or map and T1 is executed. If the value is a map and the
- keys are of basic type with a defined order ("comparable"), the
- elements will be visited in sorted key order.
-
- {{range pipeline}} T1 {{else}} T0 {{end}}
- The value of the pipeline must be an array, slice, map, or channel.
- If the value of the pipeline has length zero, dot is unaffected and
- T0 is executed; otherwise, dot is set to the successive elements
- of the array, slice, or map and T1 is executed.
-
- {{template "name"}}
- The template with the specified name is executed with nil data.
-
- {{template "name" pipeline}}
- The template with the specified name is executed with dot set
- to the value of the pipeline.
-
- {{with pipeline}} T1 {{end}}
- If the value of the pipeline is empty, no output is generated;
- otherwise, dot is set to the value of the pipeline and T1 is
- executed.
-
- {{with pipeline}} T1 {{else}} T0 {{end}}
- If the value of the pipeline is empty, dot is unaffected and T0
- is executed; otherwise, dot is set to the value of the pipeline
- and T1 is executed.
-
-Arguments
-
-An argument is a simple value, denoted by one of the following.
-
- - A boolean, string, character, integer, floating-point, imaginary
- or complex constant in Go syntax. These behave like Go's untyped
- constants, although raw strings may not span newlines.
- - The keyword nil, representing an untyped Go nil.
- - The character '.' (period):
- .
- The result is the value of dot.
- - A variable name, which is a (possibly empty) alphanumeric string
- preceded by a dollar sign, such as
- $piOver2
- or
- $
- The result is the value of the variable.
- Variables are described below.
- - The name of a field of the data, which must be a struct, preceded
- by a period, such as
- .Field
- The result is the value of the field. Field invocations may be
- chained:
- .Field1.Field2
- Fields can also be evaluated on variables, including chaining:
- $x.Field1.Field2
- - The name of a key of the data, which must be a map, preceded
- by a period, such as
- .Key
- The result is the map element value indexed by the key.
- Key invocations may be chained and combined with fields to any
- depth:
- .Field1.Key1.Field2.Key2
- Although the key must be an alphanumeric identifier, unlike with
- field names they do not need to start with an upper case letter.
- Keys can also be evaluated on variables, including chaining:
- $x.key1.key2
- - The name of a niladic method of the data, preceded by a period,
- such as
- .Method
- The result is the value of invoking the method with dot as the
- receiver, dot.Method(). Such a method must have one return value (of
- any type) or two return values, the second of which is an error.
- If it has two and the returned error is non-nil, execution terminates
- and an error is returned to the caller as the value of Execute.
- Method invocations may be chained and combined with fields and keys
- to any depth:
- .Field1.Key1.Method1.Field2.Key2.Method2
- Methods can also be evaluated on variables, including chaining:
- $x.Method1.Field
- - The name of a niladic function, such as
- fun
- The result is the value of invoking the function, fun(). The return
- types and values behave as in methods. Functions and function
- names are described below.
- - A parenthesized instance of one the above, for grouping. The result
- may be accessed by a field or map key invocation.
- print (.F1 arg1) (.F2 arg2)
- (.StructValuedMethod "arg").Field
-
-Arguments may evaluate to any type; if they are pointers the implementation
-automatically indirects to the base type when required.
-If an evaluation yields a function value, such as a function-valued
-field of a struct, the function is not invoked automatically, but it
-can be used as a truth value for an if action and the like. To invoke
-it, use the call function, defined below.
-
-A pipeline is a possibly chained sequence of "commands". A command is a simple
-value (argument) or a function or method call, possibly with multiple arguments:
-
- Argument
- The result is the value of evaluating the argument.
- .Method [Argument...]
- The method can be alone or the last element of a chain but,
- unlike methods in the middle of a chain, it can take arguments.
- The result is the value of calling the method with the
- arguments:
- dot.Method(Argument1, etc.)
- functionName [Argument...]
- The result is the value of calling the function associated
- with the name:
- function(Argument1, etc.)
- Functions and function names are described below.
-
-Pipelines
-
-A pipeline may be "chained" by separating a sequence of commands with pipeline
-characters '|'. In a chained pipeline, the result of the each command is
-passed as the last argument of the following command. The output of the final
-command in the pipeline is the value of the pipeline.
-
-The output of a command will be either one value or two values, the second of
-which has type error. If that second value is present and evaluates to
-non-nil, execution terminates and the error is returned to the caller of
-Execute.
-
-Variables
-
-A pipeline inside an action may initialize a variable to capture the result.
-The initialization has syntax
-
- $variable := pipeline
-
-where $variable is the name of the variable. An action that declares a
-variable produces no output.
-
-If a "range" action initializes a variable, the variable is set to the
-successive elements of the iteration. Also, a "range" may declare two
-variables, separated by a comma:
-
- range $index, $element := pipeline
-
-in which case $index and $element are set to the successive values of the
-array/slice index or map key and element, respectively. Note that if there is
-only one variable, it is assigned the element; this is opposite to the
-convention in Go range clauses.
-
-A variable's scope extends to the "end" action of the control structure ("if",
-"with", or "range") in which it is declared, or to the end of the template if
-there is no such control structure. A template invocation does not inherit
-variables from the point of its invocation.
-
-When execution begins, $ is set to the data argument passed to Execute, that is,
-to the starting value of dot.
-
-Examples
-
-Here are some example one-line templates demonstrating pipelines and variables.
-All produce the quoted word "output":
-
- {{"\"output\""}}
- A string constant.
- {{`"output"`}}
- A raw string constant.
- {{printf "%q" "output"}}
- A function call.
- {{"output" | printf "%q"}}
- A function call whose final argument comes from the previous
- command.
- {{printf "%q" (print "out" "put")}}
- A parenthesized argument.
- {{"put" | printf "%s%s" "out" | printf "%q"}}
- A more elaborate call.
- {{"output" | printf "%s" | printf "%q"}}
- A longer chain.
- {{with "output"}}{{printf "%q" .}}{{end}}
- A with action using dot.
- {{with $x := "output" | printf "%q"}}{{$x}}{{end}}
- A with action that creates and uses a variable.
- {{with $x := "output"}}{{printf "%q" $x}}{{end}}
- A with action that uses the variable in another action.
- {{with $x := "output"}}{{$x | printf "%q"}}{{end}}
- The same, but pipelined.
-
-Functions
-
-During execution functions are found in two function maps: first in the
-template, then in the global function map. By default, no functions are defined
-in the template but the Funcs method can be used to add them.
-
-Predefined global functions are named as follows.
-
- and
- Returns the boolean AND of its arguments by returning the
- first empty argument or the last argument, that is,
- "and x y" behaves as "if x then y else x". All the
- arguments are evaluated.
- call
- Returns the result of calling the first argument, which
- must be a function, with the remaining arguments as parameters.
- Thus "call .X.Y 1 2" is, in Go notation, dot.X.Y(1, 2) where
- Y is a func-valued field, map entry, or the like.
- The first argument must be the result of an evaluation
- that yields a value of function type (as distinct from
- a predefined function such as print). The function must
- return either one or two result values, the second of which
- is of type error. If the arguments don't match the function
- or the returned error value is non-nil, execution stops.
- html
- Returns the escaped HTML equivalent of the textual
- representation of its arguments.
- index
- Returns the result of indexing its first argument by the
- following arguments. Thus "index x 1 2 3" is, in Go syntax,
- x[1][2][3]. Each indexed item must be a map, slice, or array.
- js
- Returns the escaped JavaScript equivalent of the textual
- representation of its arguments.
- len
- Returns the integer length of its argument.
- not
- Returns the boolean negation of its single argument.
- or
- Returns the boolean OR of its arguments by returning the
- first non-empty argument or the last argument, that is,
- "or x y" behaves as "if x then x else y". All the
- arguments are evaluated.
- print
- An alias for fmt.Sprint
- printf
- An alias for fmt.Sprintf
- println
- An alias for fmt.Sprintln
- urlquery
- Returns the escaped value of the textual representation of
- its arguments in a form suitable for embedding in a URL query.
-
-The boolean functions take any zero value to be false and a non-zero
-value to be true.
-
-There is also a set of binary comparison operators defined as
-functions:
-
- eq
- Returns the boolean truth of arg1 == arg2
- ne
- Returns the boolean truth of arg1 != arg2
- lt
- Returns the boolean truth of arg1 < arg2
- le
- Returns the boolean truth of arg1 <= arg2
- gt
- Returns the boolean truth of arg1 > arg2
- ge
- Returns the boolean truth of arg1 >= arg2
-
-For simpler multi-way equality tests, eq (only) accepts two or more
-arguments and compares the second and subsequent to the first,
-returning in effect
-
- arg1==arg2 || arg1==arg3 || arg1==arg4 ...
-
-(Unlike with || in Go, however, eq is a function call and all the
-arguments will be evaluated.)
-
-The comparison functions work on basic types only (or named basic
-types, such as "type Celsius float32"). They implement the Go rules
-for comparison of values, except that size and exact type are
-ignored, so any integer value, signed or unsigned, may be compared
-with any other integer value. (The arithmetic value is compared,
-not the bit pattern, so all negative integers are less than all
-unsigned integers.) However, as usual, one may not compare an int
-with a float32 and so on.
-
-Associated templates
-
-Each template is named by a string specified when it is created. Also, each
-template is associated with zero or more other templates that it may invoke by
-name; such associations are transitive and form a name space of templates.
-
-A template may use a template invocation to instantiate another associated
-template; see the explanation of the "template" action above. The name must be
-that of a template associated with the template that contains the invocation.
-
-Nested template definitions
-
-When parsing a template, another template may be defined and associated with the
-template being parsed. Template definitions must appear at the top level of the
-template, much like global variables in a Go program.
-
-The syntax of such definitions is to surround each template declaration with a
-"define" and "end" action.
-
-The define action names the template being created by providing a string
-constant. Here is a simple example:
-
- `{{define "T1"}}ONE{{end}}
- {{define "T2"}}TWO{{end}}
- {{define "T3"}}{{template "T1"}} {{template "T2"}}{{end}}
- {{template "T3"}}`
-
-This defines two templates, T1 and T2, and a third T3 that invokes the other two
-when it is executed. Finally it invokes T3. If executed this template will
-produce the text
-
- ONE TWO
-
-By construction, a template may reside in only one association. If it's
-necessary to have a template addressable from multiple associations, the
-template definition must be parsed multiple times to create distinct *Template
-values, or must be copied with the Clone or AddParseTree method.
-
-Parse may be called multiple times to assemble the various associated templates;
-see the ParseFiles and ParseGlob functions and methods for simple ways to parse
-related templates stored in files.
-
-A template may be executed directly or through ExecuteTemplate, which executes
-an associated template identified by name. To invoke our example above, we
-might write,
-
- err := tmpl.Execute(os.Stdout, "no data needed")
- if err != nil {
- log.Fatalf("execution failed: %s", err)
- }
-
-or to invoke a particular template explicitly by name,
-
- err := tmpl.ExecuteTemplate(os.Stdout, "T2", "no data needed")
- if err != nil {
- log.Fatalf("execution failed: %s", err)
- }
-
-*/
-package template
diff --git a/vendor/github.com/alecthomas/template/exec.go b/vendor/github.com/alecthomas/template/exec.go
deleted file mode 100644
index c3078e5..0000000
--- a/vendor/github.com/alecthomas/template/exec.go
+++ /dev/null
@@ -1,845 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package template
-
-import (
- "bytes"
- "fmt"
- "io"
- "reflect"
- "runtime"
- "sort"
- "strings"
-
- "github.com/alecthomas/template/parse"
-)
-
-// state represents the state of an execution. It's not part of the
-// template so that multiple executions of the same template
-// can execute in parallel.
-type state struct {
- tmpl *Template
- wr io.Writer
- node parse.Node // current node, for errors
- vars []variable // push-down stack of variable values.
-}
-
-// variable holds the dynamic value of a variable such as $, $x etc.
-type variable struct {
- name string
- value reflect.Value
-}
-
-// push pushes a new variable on the stack.
-func (s *state) push(name string, value reflect.Value) {
- s.vars = append(s.vars, variable{name, value})
-}
-
-// mark returns the length of the variable stack.
-func (s *state) mark() int {
- return len(s.vars)
-}
-
-// pop pops the variable stack up to the mark.
-func (s *state) pop(mark int) {
- s.vars = s.vars[0:mark]
-}
-
-// setVar overwrites the top-nth variable on the stack. Used by range iterations.
-func (s *state) setVar(n int, value reflect.Value) {
- s.vars[len(s.vars)-n].value = value
-}
-
-// varValue returns the value of the named variable.
-func (s *state) varValue(name string) reflect.Value {
- for i := s.mark() - 1; i >= 0; i-- {
- if s.vars[i].name == name {
- return s.vars[i].value
- }
- }
- s.errorf("undefined variable: %s", name)
- return zero
-}
-
-var zero reflect.Value
-
-// at marks the state to be on node n, for error reporting.
-func (s *state) at(node parse.Node) {
- s.node = node
-}
-
-// doublePercent returns the string with %'s replaced by %%, if necessary,
-// so it can be used safely inside a Printf format string.
-func doublePercent(str string) string {
- if strings.Contains(str, "%") {
- str = strings.Replace(str, "%", "%%", -1)
- }
- return str
-}
-
-// errorf formats the error and terminates processing.
-func (s *state) errorf(format string, args ...interface{}) {
- name := doublePercent(s.tmpl.Name())
- if s.node == nil {
- format = fmt.Sprintf("template: %s: %s", name, format)
- } else {
- location, context := s.tmpl.ErrorContext(s.node)
- format = fmt.Sprintf("template: %s: executing %q at <%s>: %s", location, name, doublePercent(context), format)
- }
- panic(fmt.Errorf(format, args...))
-}
-
-// errRecover is the handler that turns panics into returns from the top
-// level of Parse.
-func errRecover(errp *error) {
- e := recover()
- if e != nil {
- switch err := e.(type) {
- case runtime.Error:
- panic(e)
- case error:
- *errp = err
- default:
- panic(e)
- }
- }
-}
-
-// ExecuteTemplate applies the template associated with t that has the given name
-// to the specified data object and writes the output to wr.
-// If an error occurs executing the template or writing its output,
-// execution stops, but partial results may already have been written to
-// the output writer.
-// A template may be executed safely in parallel.
-func (t *Template) ExecuteTemplate(wr io.Writer, name string, data interface{}) error {
- tmpl := t.tmpl[name]
- if tmpl == nil {
- return fmt.Errorf("template: no template %q associated with template %q", name, t.name)
- }
- return tmpl.Execute(wr, data)
-}
-
-// Execute applies a parsed template to the specified data object,
-// and writes the output to wr.
-// If an error occurs executing the template or writing its output,
-// execution stops, but partial results may already have been written to
-// the output writer.
-// A template may be executed safely in parallel.
-func (t *Template) Execute(wr io.Writer, data interface{}) (err error) {
- defer errRecover(&err)
- value := reflect.ValueOf(data)
- state := &state{
- tmpl: t,
- wr: wr,
- vars: []variable{{"$", value}},
- }
- t.init()
- if t.Tree == nil || t.Root == nil {
- var b bytes.Buffer
- for name, tmpl := range t.tmpl {
- if tmpl.Tree == nil || tmpl.Root == nil {
- continue
- }
- if b.Len() > 0 {
- b.WriteString(", ")
- }
- fmt.Fprintf(&b, "%q", name)
- }
- var s string
- if b.Len() > 0 {
- s = "; defined templates are: " + b.String()
- }
- state.errorf("%q is an incomplete or empty template%s", t.Name(), s)
- }
- state.walk(value, t.Root)
- return
-}
-
-// Walk functions step through the major pieces of the template structure,
-// generating output as they go.
-func (s *state) walk(dot reflect.Value, node parse.Node) {
- s.at(node)
- switch node := node.(type) {
- case *parse.ActionNode:
- // Do not pop variables so they persist until next end.
- // Also, if the action declares variables, don't print the result.
- val := s.evalPipeline(dot, node.Pipe)
- if len(node.Pipe.Decl) == 0 {
- s.printValue(node, val)
- }
- case *parse.IfNode:
- s.walkIfOrWith(parse.NodeIf, dot, node.Pipe, node.List, node.ElseList)
- case *parse.ListNode:
- for _, node := range node.Nodes {
- s.walk(dot, node)
- }
- case *parse.RangeNode:
- s.walkRange(dot, node)
- case *parse.TemplateNode:
- s.walkTemplate(dot, node)
- case *parse.TextNode:
- if _, err := s.wr.Write(node.Text); err != nil {
- s.errorf("%s", err)
- }
- case *parse.WithNode:
- s.walkIfOrWith(parse.NodeWith, dot, node.Pipe, node.List, node.ElseList)
- default:
- s.errorf("unknown node: %s", node)
- }
-}
-
-// walkIfOrWith walks an 'if' or 'with' node. The two control structures
-// are identical in behavior except that 'with' sets dot.
-func (s *state) walkIfOrWith(typ parse.NodeType, dot reflect.Value, pipe *parse.PipeNode, list, elseList *parse.ListNode) {
- defer s.pop(s.mark())
- val := s.evalPipeline(dot, pipe)
- truth, ok := isTrue(val)
- if !ok {
- s.errorf("if/with can't use %v", val)
- }
- if truth {
- if typ == parse.NodeWith {
- s.walk(val, list)
- } else {
- s.walk(dot, list)
- }
- } else if elseList != nil {
- s.walk(dot, elseList)
- }
-}
-
-// isTrue reports whether the value is 'true', in the sense of not the zero of its type,
-// and whether the value has a meaningful truth value.
-func isTrue(val reflect.Value) (truth, ok bool) {
- if !val.IsValid() {
- // Something like var x interface{}, never set. It's a form of nil.
- return false, true
- }
- switch val.Kind() {
- case reflect.Array, reflect.Map, reflect.Slice, reflect.String:
- truth = val.Len() > 0
- case reflect.Bool:
- truth = val.Bool()
- case reflect.Complex64, reflect.Complex128:
- truth = val.Complex() != 0
- case reflect.Chan, reflect.Func, reflect.Ptr, reflect.Interface:
- truth = !val.IsNil()
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- truth = val.Int() != 0
- case reflect.Float32, reflect.Float64:
- truth = val.Float() != 0
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- truth = val.Uint() != 0
- case reflect.Struct:
- truth = true // Struct values are always true.
- default:
- return
- }
- return truth, true
-}
-
-func (s *state) walkRange(dot reflect.Value, r *parse.RangeNode) {
- s.at(r)
- defer s.pop(s.mark())
- val, _ := indirect(s.evalPipeline(dot, r.Pipe))
- // mark top of stack before any variables in the body are pushed.
- mark := s.mark()
- oneIteration := func(index, elem reflect.Value) {
- // Set top var (lexically the second if there are two) to the element.
- if len(r.Pipe.Decl) > 0 {
- s.setVar(1, elem)
- }
- // Set next var (lexically the first if there are two) to the index.
- if len(r.Pipe.Decl) > 1 {
- s.setVar(2, index)
- }
- s.walk(elem, r.List)
- s.pop(mark)
- }
- switch val.Kind() {
- case reflect.Array, reflect.Slice:
- if val.Len() == 0 {
- break
- }
- for i := 0; i < val.Len(); i++ {
- oneIteration(reflect.ValueOf(i), val.Index(i))
- }
- return
- case reflect.Map:
- if val.Len() == 0 {
- break
- }
- for _, key := range sortKeys(val.MapKeys()) {
- oneIteration(key, val.MapIndex(key))
- }
- return
- case reflect.Chan:
- if val.IsNil() {
- break
- }
- i := 0
- for ; ; i++ {
- elem, ok := val.Recv()
- if !ok {
- break
- }
- oneIteration(reflect.ValueOf(i), elem)
- }
- if i == 0 {
- break
- }
- return
- case reflect.Invalid:
- break // An invalid value is likely a nil map, etc. and acts like an empty map.
- default:
- s.errorf("range can't iterate over %v", val)
- }
- if r.ElseList != nil {
- s.walk(dot, r.ElseList)
- }
-}
-
-func (s *state) walkTemplate(dot reflect.Value, t *parse.TemplateNode) {
- s.at(t)
- tmpl := s.tmpl.tmpl[t.Name]
- if tmpl == nil {
- s.errorf("template %q not defined", t.Name)
- }
- // Variables declared by the pipeline persist.
- dot = s.evalPipeline(dot, t.Pipe)
- newState := *s
- newState.tmpl = tmpl
- // No dynamic scoping: template invocations inherit no variables.
- newState.vars = []variable{{"$", dot}}
- newState.walk(dot, tmpl.Root)
-}
-
-// Eval functions evaluate pipelines, commands, and their elements and extract
-// values from the data structure by examining fields, calling methods, and so on.
-// The printing of those values happens only through walk functions.
-
-// evalPipeline returns the value acquired by evaluating a pipeline. If the
-// pipeline has a variable declaration, the variable will be pushed on the
-// stack. Callers should therefore pop the stack after they are finished
-// executing commands depending on the pipeline value.
-func (s *state) evalPipeline(dot reflect.Value, pipe *parse.PipeNode) (value reflect.Value) {
- if pipe == nil {
- return
- }
- s.at(pipe)
- for _, cmd := range pipe.Cmds {
- value = s.evalCommand(dot, cmd, value) // previous value is this one's final arg.
- // If the object has type interface{}, dig down one level to the thing inside.
- if value.Kind() == reflect.Interface && value.Type().NumMethod() == 0 {
- value = reflect.ValueOf(value.Interface()) // lovely!
- }
- }
- for _, variable := range pipe.Decl {
- s.push(variable.Ident[0], value)
- }
- return value
-}
-
-func (s *state) notAFunction(args []parse.Node, final reflect.Value) {
- if len(args) > 1 || final.IsValid() {
- s.errorf("can't give argument to non-function %s", args[0])
- }
-}
-
-func (s *state) evalCommand(dot reflect.Value, cmd *parse.CommandNode, final reflect.Value) reflect.Value {
- firstWord := cmd.Args[0]
- switch n := firstWord.(type) {
- case *parse.FieldNode:
- return s.evalFieldNode(dot, n, cmd.Args, final)
- case *parse.ChainNode:
- return s.evalChainNode(dot, n, cmd.Args, final)
- case *parse.IdentifierNode:
- // Must be a function.
- return s.evalFunction(dot, n, cmd, cmd.Args, final)
- case *parse.PipeNode:
- // Parenthesized pipeline. The arguments are all inside the pipeline; final is ignored.
- return s.evalPipeline(dot, n)
- case *parse.VariableNode:
- return s.evalVariableNode(dot, n, cmd.Args, final)
- }
- s.at(firstWord)
- s.notAFunction(cmd.Args, final)
- switch word := firstWord.(type) {
- case *parse.BoolNode:
- return reflect.ValueOf(word.True)
- case *parse.DotNode:
- return dot
- case *parse.NilNode:
- s.errorf("nil is not a command")
- case *parse.NumberNode:
- return s.idealConstant(word)
- case *parse.StringNode:
- return reflect.ValueOf(word.Text)
- }
- s.errorf("can't evaluate command %q", firstWord)
- panic("not reached")
-}
-
-// idealConstant is called to return the value of a number in a context where
-// we don't know the type. In that case, the syntax of the number tells us
-// its type, and we use Go rules to resolve. Note there is no such thing as
-// a uint ideal constant in this situation - the value must be of int type.
-func (s *state) idealConstant(constant *parse.NumberNode) reflect.Value {
- // These are ideal constants but we don't know the type
- // and we have no context. (If it was a method argument,
- // we'd know what we need.) The syntax guides us to some extent.
- s.at(constant)
- switch {
- case constant.IsComplex:
- return reflect.ValueOf(constant.Complex128) // incontrovertible.
- case constant.IsFloat && !isHexConstant(constant.Text) && strings.IndexAny(constant.Text, ".eE") >= 0:
- return reflect.ValueOf(constant.Float64)
- case constant.IsInt:
- n := int(constant.Int64)
- if int64(n) != constant.Int64 {
- s.errorf("%s overflows int", constant.Text)
- }
- return reflect.ValueOf(n)
- case constant.IsUint:
- s.errorf("%s overflows int", constant.Text)
- }
- return zero
-}
-
-func isHexConstant(s string) bool {
- return len(s) > 2 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X')
-}
-
-func (s *state) evalFieldNode(dot reflect.Value, field *parse.FieldNode, args []parse.Node, final reflect.Value) reflect.Value {
- s.at(field)
- return s.evalFieldChain(dot, dot, field, field.Ident, args, final)
-}
-
-func (s *state) evalChainNode(dot reflect.Value, chain *parse.ChainNode, args []parse.Node, final reflect.Value) reflect.Value {
- s.at(chain)
- // (pipe).Field1.Field2 has pipe as .Node, fields as .Field. Eval the pipeline, then the fields.
- pipe := s.evalArg(dot, nil, chain.Node)
- if len(chain.Field) == 0 {
- s.errorf("internal error: no fields in evalChainNode")
- }
- return s.evalFieldChain(dot, pipe, chain, chain.Field, args, final)
-}
-
-func (s *state) evalVariableNode(dot reflect.Value, variable *parse.VariableNode, args []parse.Node, final reflect.Value) reflect.Value {
- // $x.Field has $x as the first ident, Field as the second. Eval the var, then the fields.
- s.at(variable)
- value := s.varValue(variable.Ident[0])
- if len(variable.Ident) == 1 {
- s.notAFunction(args, final)
- return value
- }
- return s.evalFieldChain(dot, value, variable, variable.Ident[1:], args, final)
-}
-
-// evalFieldChain evaluates .X.Y.Z possibly followed by arguments.
-// dot is the environment in which to evaluate arguments, while
-// receiver is the value being walked along the chain.
-func (s *state) evalFieldChain(dot, receiver reflect.Value, node parse.Node, ident []string, args []parse.Node, final reflect.Value) reflect.Value {
- n := len(ident)
- for i := 0; i < n-1; i++ {
- receiver = s.evalField(dot, ident[i], node, nil, zero, receiver)
- }
- // Now if it's a method, it gets the arguments.
- return s.evalField(dot, ident[n-1], node, args, final, receiver)
-}
-
-func (s *state) evalFunction(dot reflect.Value, node *parse.IdentifierNode, cmd parse.Node, args []parse.Node, final reflect.Value) reflect.Value {
- s.at(node)
- name := node.Ident
- function, ok := findFunction(name, s.tmpl)
- if !ok {
- s.errorf("%q is not a defined function", name)
- }
- return s.evalCall(dot, function, cmd, name, args, final)
-}
-
-// evalField evaluates an expression like (.Field) or (.Field arg1 arg2).
-// The 'final' argument represents the return value from the preceding
-// value of the pipeline, if any.
-func (s *state) evalField(dot reflect.Value, fieldName string, node parse.Node, args []parse.Node, final, receiver reflect.Value) reflect.Value {
- if !receiver.IsValid() {
- return zero
- }
- typ := receiver.Type()
- receiver, _ = indirect(receiver)
- // Unless it's an interface, need to get to a value of type *T to guarantee
- // we see all methods of T and *T.
- ptr := receiver
- if ptr.Kind() != reflect.Interface && ptr.CanAddr() {
- ptr = ptr.Addr()
- }
- if method := ptr.MethodByName(fieldName); method.IsValid() {
- return s.evalCall(dot, method, node, fieldName, args, final)
- }
- hasArgs := len(args) > 1 || final.IsValid()
- // It's not a method; must be a field of a struct or an element of a map. The receiver must not be nil.
- receiver, isNil := indirect(receiver)
- if isNil {
- s.errorf("nil pointer evaluating %s.%s", typ, fieldName)
- }
- switch receiver.Kind() {
- case reflect.Struct:
- tField, ok := receiver.Type().FieldByName(fieldName)
- if ok {
- field := receiver.FieldByIndex(tField.Index)
- if tField.PkgPath != "" { // field is unexported
- s.errorf("%s is an unexported field of struct type %s", fieldName, typ)
- }
- // If it's a function, we must call it.
- if hasArgs {
- s.errorf("%s has arguments but cannot be invoked as function", fieldName)
- }
- return field
- }
- s.errorf("%s is not a field of struct type %s", fieldName, typ)
- case reflect.Map:
- // If it's a map, attempt to use the field name as a key.
- nameVal := reflect.ValueOf(fieldName)
- if nameVal.Type().AssignableTo(receiver.Type().Key()) {
- if hasArgs {
- s.errorf("%s is not a method but has arguments", fieldName)
- }
- return receiver.MapIndex(nameVal)
- }
- }
- s.errorf("can't evaluate field %s in type %s", fieldName, typ)
- panic("not reached")
-}
-
-var (
- errorType = reflect.TypeOf((*error)(nil)).Elem()
- fmtStringerType = reflect.TypeOf((*fmt.Stringer)(nil)).Elem()
-)
-
-// evalCall executes a function or method call. If it's a method, fun already has the receiver bound, so
-// it looks just like a function call. The arg list, if non-nil, includes (in the manner of the shell), arg[0]
-// as the function itself.
-func (s *state) evalCall(dot, fun reflect.Value, node parse.Node, name string, args []parse.Node, final reflect.Value) reflect.Value {
- if args != nil {
- args = args[1:] // Zeroth arg is function name/node; not passed to function.
- }
- typ := fun.Type()
- numIn := len(args)
- if final.IsValid() {
- numIn++
- }
- numFixed := len(args)
- if typ.IsVariadic() {
- numFixed = typ.NumIn() - 1 // last arg is the variadic one.
- if numIn < numFixed {
- s.errorf("wrong number of args for %s: want at least %d got %d", name, typ.NumIn()-1, len(args))
- }
- } else if numIn < typ.NumIn()-1 || !typ.IsVariadic() && numIn != typ.NumIn() {
- s.errorf("wrong number of args for %s: want %d got %d", name, typ.NumIn(), len(args))
- }
- if !goodFunc(typ) {
- // TODO: This could still be a confusing error; maybe goodFunc should provide info.
- s.errorf("can't call method/function %q with %d results", name, typ.NumOut())
- }
- // Build the arg list.
- argv := make([]reflect.Value, numIn)
- // Args must be evaluated. Fixed args first.
- i := 0
- for ; i < numFixed && i < len(args); i++ {
- argv[i] = s.evalArg(dot, typ.In(i), args[i])
- }
- // Now the ... args.
- if typ.IsVariadic() {
- argType := typ.In(typ.NumIn() - 1).Elem() // Argument is a slice.
- for ; i < len(args); i++ {
- argv[i] = s.evalArg(dot, argType, args[i])
- }
- }
- // Add final value if necessary.
- if final.IsValid() {
- t := typ.In(typ.NumIn() - 1)
- if typ.IsVariadic() {
- t = t.Elem()
- }
- argv[i] = s.validateType(final, t)
- }
- result := fun.Call(argv)
- // If we have an error that is not nil, stop execution and return that error to the caller.
- if len(result) == 2 && !result[1].IsNil() {
- s.at(node)
- s.errorf("error calling %s: %s", name, result[1].Interface().(error))
- }
- return result[0]
-}
-
-// canBeNil reports whether an untyped nil can be assigned to the type. See reflect.Zero.
-func canBeNil(typ reflect.Type) bool {
- switch typ.Kind() {
- case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:
- return true
- }
- return false
-}
-
-// validateType guarantees that the value is valid and assignable to the type.
-func (s *state) validateType(value reflect.Value, typ reflect.Type) reflect.Value {
- if !value.IsValid() {
- if typ == nil || canBeNil(typ) {
- // An untyped nil interface{}. Accept as a proper nil value.
- return reflect.Zero(typ)
- }
- s.errorf("invalid value; expected %s", typ)
- }
- if typ != nil && !value.Type().AssignableTo(typ) {
- if value.Kind() == reflect.Interface && !value.IsNil() {
- value = value.Elem()
- if value.Type().AssignableTo(typ) {
- return value
- }
- // fallthrough
- }
- // Does one dereference or indirection work? We could do more, as we
- // do with method receivers, but that gets messy and method receivers
- // are much more constrained, so it makes more sense there than here.
- // Besides, one is almost always all you need.
- switch {
- case value.Kind() == reflect.Ptr && value.Type().Elem().AssignableTo(typ):
- value = value.Elem()
- if !value.IsValid() {
- s.errorf("dereference of nil pointer of type %s", typ)
- }
- case reflect.PtrTo(value.Type()).AssignableTo(typ) && value.CanAddr():
- value = value.Addr()
- default:
- s.errorf("wrong type for value; expected %s; got %s", typ, value.Type())
- }
- }
- return value
-}
-
-func (s *state) evalArg(dot reflect.Value, typ reflect.Type, n parse.Node) reflect.Value {
- s.at(n)
- switch arg := n.(type) {
- case *parse.DotNode:
- return s.validateType(dot, typ)
- case *parse.NilNode:
- if canBeNil(typ) {
- return reflect.Zero(typ)
- }
- s.errorf("cannot assign nil to %s", typ)
- case *parse.FieldNode:
- return s.validateType(s.evalFieldNode(dot, arg, []parse.Node{n}, zero), typ)
- case *parse.VariableNode:
- return s.validateType(s.evalVariableNode(dot, arg, nil, zero), typ)
- case *parse.PipeNode:
- return s.validateType(s.evalPipeline(dot, arg), typ)
- case *parse.IdentifierNode:
- return s.evalFunction(dot, arg, arg, nil, zero)
- case *parse.ChainNode:
- return s.validateType(s.evalChainNode(dot, arg, nil, zero), typ)
- }
- switch typ.Kind() {
- case reflect.Bool:
- return s.evalBool(typ, n)
- case reflect.Complex64, reflect.Complex128:
- return s.evalComplex(typ, n)
- case reflect.Float32, reflect.Float64:
- return s.evalFloat(typ, n)
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return s.evalInteger(typ, n)
- case reflect.Interface:
- if typ.NumMethod() == 0 {
- return s.evalEmptyInterface(dot, n)
- }
- case reflect.String:
- return s.evalString(typ, n)
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return s.evalUnsignedInteger(typ, n)
- }
- s.errorf("can't handle %s for arg of type %s", n, typ)
- panic("not reached")
-}
-
-func (s *state) evalBool(typ reflect.Type, n parse.Node) reflect.Value {
- s.at(n)
- if n, ok := n.(*parse.BoolNode); ok {
- value := reflect.New(typ).Elem()
- value.SetBool(n.True)
- return value
- }
- s.errorf("expected bool; found %s", n)
- panic("not reached")
-}
-
-func (s *state) evalString(typ reflect.Type, n parse.Node) reflect.Value {
- s.at(n)
- if n, ok := n.(*parse.StringNode); ok {
- value := reflect.New(typ).Elem()
- value.SetString(n.Text)
- return value
- }
- s.errorf("expected string; found %s", n)
- panic("not reached")
-}
-
-func (s *state) evalInteger(typ reflect.Type, n parse.Node) reflect.Value {
- s.at(n)
- if n, ok := n.(*parse.NumberNode); ok && n.IsInt {
- value := reflect.New(typ).Elem()
- value.SetInt(n.Int64)
- return value
- }
- s.errorf("expected integer; found %s", n)
- panic("not reached")
-}
-
-func (s *state) evalUnsignedInteger(typ reflect.Type, n parse.Node) reflect.Value {
- s.at(n)
- if n, ok := n.(*parse.NumberNode); ok && n.IsUint {
- value := reflect.New(typ).Elem()
- value.SetUint(n.Uint64)
- return value
- }
- s.errorf("expected unsigned integer; found %s", n)
- panic("not reached")
-}
-
-func (s *state) evalFloat(typ reflect.Type, n parse.Node) reflect.Value {
- s.at(n)
- if n, ok := n.(*parse.NumberNode); ok && n.IsFloat {
- value := reflect.New(typ).Elem()
- value.SetFloat(n.Float64)
- return value
- }
- s.errorf("expected float; found %s", n)
- panic("not reached")
-}
-
-func (s *state) evalComplex(typ reflect.Type, n parse.Node) reflect.Value {
- if n, ok := n.(*parse.NumberNode); ok && n.IsComplex {
- value := reflect.New(typ).Elem()
- value.SetComplex(n.Complex128)
- return value
- }
- s.errorf("expected complex; found %s", n)
- panic("not reached")
-}
-
-func (s *state) evalEmptyInterface(dot reflect.Value, n parse.Node) reflect.Value {
- s.at(n)
- switch n := n.(type) {
- case *parse.BoolNode:
- return reflect.ValueOf(n.True)
- case *parse.DotNode:
- return dot
- case *parse.FieldNode:
- return s.evalFieldNode(dot, n, nil, zero)
- case *parse.IdentifierNode:
- return s.evalFunction(dot, n, n, nil, zero)
- case *parse.NilNode:
- // NilNode is handled in evalArg, the only place that calls here.
- s.errorf("evalEmptyInterface: nil (can't happen)")
- case *parse.NumberNode:
- return s.idealConstant(n)
- case *parse.StringNode:
- return reflect.ValueOf(n.Text)
- case *parse.VariableNode:
- return s.evalVariableNode(dot, n, nil, zero)
- case *parse.PipeNode:
- return s.evalPipeline(dot, n)
- }
- s.errorf("can't handle assignment of %s to empty interface argument", n)
- panic("not reached")
-}
-
-// indirect returns the item at the end of indirection, and a bool to indicate if it's nil.
-// We indirect through pointers and empty interfaces (only) because
-// non-empty interfaces have methods we might need.
-func indirect(v reflect.Value) (rv reflect.Value, isNil bool) {
- for ; v.Kind() == reflect.Ptr || v.Kind() == reflect.Interface; v = v.Elem() {
- if v.IsNil() {
- return v, true
- }
- if v.Kind() == reflect.Interface && v.NumMethod() > 0 {
- break
- }
- }
- return v, false
-}
-
-// printValue writes the textual representation of the value to the output of
-// the template.
-func (s *state) printValue(n parse.Node, v reflect.Value) {
- s.at(n)
- iface, ok := printableValue(v)
- if !ok {
- s.errorf("can't print %s of type %s", n, v.Type())
- }
- fmt.Fprint(s.wr, iface)
-}
-
-// printableValue returns the, possibly indirected, interface value inside v that
-// is best for a call to formatted printer.
-func printableValue(v reflect.Value) (interface{}, bool) {
- if v.Kind() == reflect.Ptr {
- v, _ = indirect(v) // fmt.Fprint handles nil.
- }
- if !v.IsValid() {
- return "", true
- }
-
- if !v.Type().Implements(errorType) && !v.Type().Implements(fmtStringerType) {
- if v.CanAddr() && (reflect.PtrTo(v.Type()).Implements(errorType) || reflect.PtrTo(v.Type()).Implements(fmtStringerType)) {
- v = v.Addr()
- } else {
- switch v.Kind() {
- case reflect.Chan, reflect.Func:
- return nil, false
- }
- }
- }
- return v.Interface(), true
-}
-
-// Types to help sort the keys in a map for reproducible output.
-
-type rvs []reflect.Value
-
-func (x rvs) Len() int { return len(x) }
-func (x rvs) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
-
-type rvInts struct{ rvs }
-
-func (x rvInts) Less(i, j int) bool { return x.rvs[i].Int() < x.rvs[j].Int() }
-
-type rvUints struct{ rvs }
-
-func (x rvUints) Less(i, j int) bool { return x.rvs[i].Uint() < x.rvs[j].Uint() }
-
-type rvFloats struct{ rvs }
-
-func (x rvFloats) Less(i, j int) bool { return x.rvs[i].Float() < x.rvs[j].Float() }
-
-type rvStrings struct{ rvs }
-
-func (x rvStrings) Less(i, j int) bool { return x.rvs[i].String() < x.rvs[j].String() }
-
-// sortKeys sorts (if it can) the slice of reflect.Values, which is a slice of map keys.
-func sortKeys(v []reflect.Value) []reflect.Value {
- if len(v) <= 1 {
- return v
- }
- switch v[0].Kind() {
- case reflect.Float32, reflect.Float64:
- sort.Sort(rvFloats{v})
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- sort.Sort(rvInts{v})
- case reflect.String:
- sort.Sort(rvStrings{v})
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- sort.Sort(rvUints{v})
- }
- return v
-}
diff --git a/vendor/github.com/alecthomas/template/funcs.go b/vendor/github.com/alecthomas/template/funcs.go
deleted file mode 100644
index 39ee5ed..0000000
--- a/vendor/github.com/alecthomas/template/funcs.go
+++ /dev/null
@@ -1,598 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package template
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io"
- "net/url"
- "reflect"
- "strings"
- "unicode"
- "unicode/utf8"
-)
-
-// FuncMap is the type of the map defining the mapping from names to functions.
-// Each function must have either a single return value, or two return values of
-// which the second has type error. In that case, if the second (error)
-// return value evaluates to non-nil during execution, execution terminates and
-// Execute returns that error.
-type FuncMap map[string]interface{}
-
-var builtins = FuncMap{
- "and": and,
- "call": call,
- "html": HTMLEscaper,
- "index": index,
- "js": JSEscaper,
- "len": length,
- "not": not,
- "or": or,
- "print": fmt.Sprint,
- "printf": fmt.Sprintf,
- "println": fmt.Sprintln,
- "urlquery": URLQueryEscaper,
-
- // Comparisons
- "eq": eq, // ==
- "ge": ge, // >=
- "gt": gt, // >
- "le": le, // <=
- "lt": lt, // <
- "ne": ne, // !=
-}
-
-var builtinFuncs = createValueFuncs(builtins)
-
-// createValueFuncs turns a FuncMap into a map[string]reflect.Value
-func createValueFuncs(funcMap FuncMap) map[string]reflect.Value {
- m := make(map[string]reflect.Value)
- addValueFuncs(m, funcMap)
- return m
-}
-
-// addValueFuncs adds to values the functions in funcs, converting them to reflect.Values.
-func addValueFuncs(out map[string]reflect.Value, in FuncMap) {
- for name, fn := range in {
- v := reflect.ValueOf(fn)
- if v.Kind() != reflect.Func {
- panic("value for " + name + " not a function")
- }
- if !goodFunc(v.Type()) {
- panic(fmt.Errorf("can't install method/function %q with %d results", name, v.Type().NumOut()))
- }
- out[name] = v
- }
-}
-
-// addFuncs adds to values the functions in funcs. It does no checking of the input -
-// call addValueFuncs first.
-func addFuncs(out, in FuncMap) {
- for name, fn := range in {
- out[name] = fn
- }
-}
-
-// goodFunc checks that the function or method has the right result signature.
-func goodFunc(typ reflect.Type) bool {
- // We allow functions with 1 result or 2 results where the second is an error.
- switch {
- case typ.NumOut() == 1:
- return true
- case typ.NumOut() == 2 && typ.Out(1) == errorType:
- return true
- }
- return false
-}
-
-// findFunction looks for a function in the template, and global map.
-func findFunction(name string, tmpl *Template) (reflect.Value, bool) {
- if tmpl != nil && tmpl.common != nil {
- if fn := tmpl.execFuncs[name]; fn.IsValid() {
- return fn, true
- }
- }
- if fn := builtinFuncs[name]; fn.IsValid() {
- return fn, true
- }
- return reflect.Value{}, false
-}
-
-// Indexing.
-
-// index returns the result of indexing its first argument by the following
-// arguments. Thus "index x 1 2 3" is, in Go syntax, x[1][2][3]. Each
-// indexed item must be a map, slice, or array.
-func index(item interface{}, indices ...interface{}) (interface{}, error) {
- v := reflect.ValueOf(item)
- for _, i := range indices {
- index := reflect.ValueOf(i)
- var isNil bool
- if v, isNil = indirect(v); isNil {
- return nil, fmt.Errorf("index of nil pointer")
- }
- switch v.Kind() {
- case reflect.Array, reflect.Slice, reflect.String:
- var x int64
- switch index.Kind() {
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- x = index.Int()
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- x = int64(index.Uint())
- default:
- return nil, fmt.Errorf("cannot index slice/array with type %s", index.Type())
- }
- if x < 0 || x >= int64(v.Len()) {
- return nil, fmt.Errorf("index out of range: %d", x)
- }
- v = v.Index(int(x))
- case reflect.Map:
- if !index.IsValid() {
- index = reflect.Zero(v.Type().Key())
- }
- if !index.Type().AssignableTo(v.Type().Key()) {
- return nil, fmt.Errorf("%s is not index type for %s", index.Type(), v.Type())
- }
- if x := v.MapIndex(index); x.IsValid() {
- v = x
- } else {
- v = reflect.Zero(v.Type().Elem())
- }
- default:
- return nil, fmt.Errorf("can't index item of type %s", v.Type())
- }
- }
- return v.Interface(), nil
-}
-
-// Length
-
-// length returns the length of the item, with an error if it has no defined length.
-func length(item interface{}) (int, error) {
- v, isNil := indirect(reflect.ValueOf(item))
- if isNil {
- return 0, fmt.Errorf("len of nil pointer")
- }
- switch v.Kind() {
- case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice, reflect.String:
- return v.Len(), nil
- }
- return 0, fmt.Errorf("len of type %s", v.Type())
-}
-
-// Function invocation
-
-// call returns the result of evaluating the first argument as a function.
-// The function must return 1 result, or 2 results, the second of which is an error.
-func call(fn interface{}, args ...interface{}) (interface{}, error) {
- v := reflect.ValueOf(fn)
- typ := v.Type()
- if typ.Kind() != reflect.Func {
- return nil, fmt.Errorf("non-function of type %s", typ)
- }
- if !goodFunc(typ) {
- return nil, fmt.Errorf("function called with %d args; should be 1 or 2", typ.NumOut())
- }
- numIn := typ.NumIn()
- var dddType reflect.Type
- if typ.IsVariadic() {
- if len(args) < numIn-1 {
- return nil, fmt.Errorf("wrong number of args: got %d want at least %d", len(args), numIn-1)
- }
- dddType = typ.In(numIn - 1).Elem()
- } else {
- if len(args) != numIn {
- return nil, fmt.Errorf("wrong number of args: got %d want %d", len(args), numIn)
- }
- }
- argv := make([]reflect.Value, len(args))
- for i, arg := range args {
- value := reflect.ValueOf(arg)
- // Compute the expected type. Clumsy because of variadics.
- var argType reflect.Type
- if !typ.IsVariadic() || i < numIn-1 {
- argType = typ.In(i)
- } else {
- argType = dddType
- }
- if !value.IsValid() && canBeNil(argType) {
- value = reflect.Zero(argType)
- }
- if !value.Type().AssignableTo(argType) {
- return nil, fmt.Errorf("arg %d has type %s; should be %s", i, value.Type(), argType)
- }
- argv[i] = value
- }
- result := v.Call(argv)
- if len(result) == 2 && !result[1].IsNil() {
- return result[0].Interface(), result[1].Interface().(error)
- }
- return result[0].Interface(), nil
-}
-
-// Boolean logic.
-
-func truth(a interface{}) bool {
- t, _ := isTrue(reflect.ValueOf(a))
- return t
-}
-
-// and computes the Boolean AND of its arguments, returning
-// the first false argument it encounters, or the last argument.
-func and(arg0 interface{}, args ...interface{}) interface{} {
- if !truth(arg0) {
- return arg0
- }
- for i := range args {
- arg0 = args[i]
- if !truth(arg0) {
- break
- }
- }
- return arg0
-}
-
-// or computes the Boolean OR of its arguments, returning
-// the first true argument it encounters, or the last argument.
-func or(arg0 interface{}, args ...interface{}) interface{} {
- if truth(arg0) {
- return arg0
- }
- for i := range args {
- arg0 = args[i]
- if truth(arg0) {
- break
- }
- }
- return arg0
-}
-
-// not returns the Boolean negation of its argument.
-func not(arg interface{}) (truth bool) {
- truth, _ = isTrue(reflect.ValueOf(arg))
- return !truth
-}
-
-// Comparison.
-
-// TODO: Perhaps allow comparison between signed and unsigned integers.
-
-var (
- errBadComparisonType = errors.New("invalid type for comparison")
- errBadComparison = errors.New("incompatible types for comparison")
- errNoComparison = errors.New("missing argument for comparison")
-)
-
-type kind int
-
-const (
- invalidKind kind = iota
- boolKind
- complexKind
- intKind
- floatKind
- integerKind
- stringKind
- uintKind
-)
-
-func basicKind(v reflect.Value) (kind, error) {
- switch v.Kind() {
- case reflect.Bool:
- return boolKind, nil
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return intKind, nil
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return uintKind, nil
- case reflect.Float32, reflect.Float64:
- return floatKind, nil
- case reflect.Complex64, reflect.Complex128:
- return complexKind, nil
- case reflect.String:
- return stringKind, nil
- }
- return invalidKind, errBadComparisonType
-}
-
-// eq evaluates the comparison a == b || a == c || ...
-func eq(arg1 interface{}, arg2 ...interface{}) (bool, error) {
- v1 := reflect.ValueOf(arg1)
- k1, err := basicKind(v1)
- if err != nil {
- return false, err
- }
- if len(arg2) == 0 {
- return false, errNoComparison
- }
- for _, arg := range arg2 {
- v2 := reflect.ValueOf(arg)
- k2, err := basicKind(v2)
- if err != nil {
- return false, err
- }
- truth := false
- if k1 != k2 {
- // Special case: Can compare integer values regardless of type's sign.
- switch {
- case k1 == intKind && k2 == uintKind:
- truth = v1.Int() >= 0 && uint64(v1.Int()) == v2.Uint()
- case k1 == uintKind && k2 == intKind:
- truth = v2.Int() >= 0 && v1.Uint() == uint64(v2.Int())
- default:
- return false, errBadComparison
- }
- } else {
- switch k1 {
- case boolKind:
- truth = v1.Bool() == v2.Bool()
- case complexKind:
- truth = v1.Complex() == v2.Complex()
- case floatKind:
- truth = v1.Float() == v2.Float()
- case intKind:
- truth = v1.Int() == v2.Int()
- case stringKind:
- truth = v1.String() == v2.String()
- case uintKind:
- truth = v1.Uint() == v2.Uint()
- default:
- panic("invalid kind")
- }
- }
- if truth {
- return true, nil
- }
- }
- return false, nil
-}
-
-// ne evaluates the comparison a != b.
-func ne(arg1, arg2 interface{}) (bool, error) {
- // != is the inverse of ==.
- equal, err := eq(arg1, arg2)
- return !equal, err
-}
-
-// lt evaluates the comparison a < b.
-func lt(arg1, arg2 interface{}) (bool, error) {
- v1 := reflect.ValueOf(arg1)
- k1, err := basicKind(v1)
- if err != nil {
- return false, err
- }
- v2 := reflect.ValueOf(arg2)
- k2, err := basicKind(v2)
- if err != nil {
- return false, err
- }
- truth := false
- if k1 != k2 {
- // Special case: Can compare integer values regardless of type's sign.
- switch {
- case k1 == intKind && k2 == uintKind:
- truth = v1.Int() < 0 || uint64(v1.Int()) < v2.Uint()
- case k1 == uintKind && k2 == intKind:
- truth = v2.Int() >= 0 && v1.Uint() < uint64(v2.Int())
- default:
- return false, errBadComparison
- }
- } else {
- switch k1 {
- case boolKind, complexKind:
- return false, errBadComparisonType
- case floatKind:
- truth = v1.Float() < v2.Float()
- case intKind:
- truth = v1.Int() < v2.Int()
- case stringKind:
- truth = v1.String() < v2.String()
- case uintKind:
- truth = v1.Uint() < v2.Uint()
- default:
- panic("invalid kind")
- }
- }
- return truth, nil
-}
-
-// le evaluates the comparison <= b.
-func le(arg1, arg2 interface{}) (bool, error) {
- // <= is < or ==.
- lessThan, err := lt(arg1, arg2)
- if lessThan || err != nil {
- return lessThan, err
- }
- return eq(arg1, arg2)
-}
-
-// gt evaluates the comparison a > b.
-func gt(arg1, arg2 interface{}) (bool, error) {
- // > is the inverse of <=.
- lessOrEqual, err := le(arg1, arg2)
- if err != nil {
- return false, err
- }
- return !lessOrEqual, nil
-}
-
-// ge evaluates the comparison a >= b.
-func ge(arg1, arg2 interface{}) (bool, error) {
- // >= is the inverse of <.
- lessThan, err := lt(arg1, arg2)
- if err != nil {
- return false, err
- }
- return !lessThan, nil
-}
-
-// HTML escaping.
-
-var (
- htmlQuot = []byte(""") // shorter than """
- htmlApos = []byte("'") // shorter than "'" and apos was not in HTML until HTML5
- htmlAmp = []byte("&")
- htmlLt = []byte("<")
- htmlGt = []byte(">")
-)
-
-// HTMLEscape writes to w the escaped HTML equivalent of the plain text data b.
-func HTMLEscape(w io.Writer, b []byte) {
- last := 0
- for i, c := range b {
- var html []byte
- switch c {
- case '"':
- html = htmlQuot
- case '\'':
- html = htmlApos
- case '&':
- html = htmlAmp
- case '<':
- html = htmlLt
- case '>':
- html = htmlGt
- default:
- continue
- }
- w.Write(b[last:i])
- w.Write(html)
- last = i + 1
- }
- w.Write(b[last:])
-}
-
-// HTMLEscapeString returns the escaped HTML equivalent of the plain text data s.
-func HTMLEscapeString(s string) string {
- // Avoid allocation if we can.
- if strings.IndexAny(s, `'"&<>`) < 0 {
- return s
- }
- var b bytes.Buffer
- HTMLEscape(&b, []byte(s))
- return b.String()
-}
-
-// HTMLEscaper returns the escaped HTML equivalent of the textual
-// representation of its arguments.
-func HTMLEscaper(args ...interface{}) string {
- return HTMLEscapeString(evalArgs(args))
-}
-
-// JavaScript escaping.
-
-var (
- jsLowUni = []byte(`\u00`)
- hex = []byte("0123456789ABCDEF")
-
- jsBackslash = []byte(`\\`)
- jsApos = []byte(`\'`)
- jsQuot = []byte(`\"`)
- jsLt = []byte(`\x3C`)
- jsGt = []byte(`\x3E`)
-)
-
-// JSEscape writes to w the escaped JavaScript equivalent of the plain text data b.
-func JSEscape(w io.Writer, b []byte) {
- last := 0
- for i := 0; i < len(b); i++ {
- c := b[i]
-
- if !jsIsSpecial(rune(c)) {
- // fast path: nothing to do
- continue
- }
- w.Write(b[last:i])
-
- if c < utf8.RuneSelf {
- // Quotes, slashes and angle brackets get quoted.
- // Control characters get written as \u00XX.
- switch c {
- case '\\':
- w.Write(jsBackslash)
- case '\'':
- w.Write(jsApos)
- case '"':
- w.Write(jsQuot)
- case '<':
- w.Write(jsLt)
- case '>':
- w.Write(jsGt)
- default:
- w.Write(jsLowUni)
- t, b := c>>4, c&0x0f
- w.Write(hex[t : t+1])
- w.Write(hex[b : b+1])
- }
- } else {
- // Unicode rune.
- r, size := utf8.DecodeRune(b[i:])
- if unicode.IsPrint(r) {
- w.Write(b[i : i+size])
- } else {
- fmt.Fprintf(w, "\\u%04X", r)
- }
- i += size - 1
- }
- last = i + 1
- }
- w.Write(b[last:])
-}
-
-// JSEscapeString returns the escaped JavaScript equivalent of the plain text data s.
-func JSEscapeString(s string) string {
- // Avoid allocation if we can.
- if strings.IndexFunc(s, jsIsSpecial) < 0 {
- return s
- }
- var b bytes.Buffer
- JSEscape(&b, []byte(s))
- return b.String()
-}
-
-func jsIsSpecial(r rune) bool {
- switch r {
- case '\\', '\'', '"', '<', '>':
- return true
- }
- return r < ' ' || utf8.RuneSelf <= r
-}
-
-// JSEscaper returns the escaped JavaScript equivalent of the textual
-// representation of its arguments.
-func JSEscaper(args ...interface{}) string {
- return JSEscapeString(evalArgs(args))
-}
-
-// URLQueryEscaper returns the escaped value of the textual representation of
-// its arguments in a form suitable for embedding in a URL query.
-func URLQueryEscaper(args ...interface{}) string {
- return url.QueryEscape(evalArgs(args))
-}
-
-// evalArgs formats the list of arguments into a string. It is therefore equivalent to
-// fmt.Sprint(args...)
-// except that each argument is indirected (if a pointer), as required,
-// using the same rules as the default string evaluation during template
-// execution.
-func evalArgs(args []interface{}) string {
- ok := false
- var s string
- // Fast path for simple common case.
- if len(args) == 1 {
- s, ok = args[0].(string)
- }
- if !ok {
- for i, arg := range args {
- a, ok := printableValue(reflect.ValueOf(arg))
- if ok {
- args[i] = a
- } // else left fmt do its thing
- }
- s = fmt.Sprint(args...)
- }
- return s
-}
diff --git a/vendor/github.com/alecthomas/template/go.mod b/vendor/github.com/alecthomas/template/go.mod
deleted file mode 100644
index a70670a..0000000
--- a/vendor/github.com/alecthomas/template/go.mod
+++ /dev/null
@@ -1 +0,0 @@
-module github.com/alecthomas/template
diff --git a/vendor/github.com/alecthomas/template/helper.go b/vendor/github.com/alecthomas/template/helper.go
deleted file mode 100644
index 3636fb5..0000000
--- a/vendor/github.com/alecthomas/template/helper.go
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Helper functions to make constructing templates easier.
-
-package template
-
-import (
- "fmt"
- "io/ioutil"
- "path/filepath"
-)
-
-// Functions and methods to parse templates.
-
-// Must is a helper that wraps a call to a function returning (*Template, error)
-// and panics if the error is non-nil. It is intended for use in variable
-// initializations such as
-// var t = template.Must(template.New("name").Parse("text"))
-func Must(t *Template, err error) *Template {
- if err != nil {
- panic(err)
- }
- return t
-}
-
-// ParseFiles creates a new Template and parses the template definitions from
-// the named files. The returned template's name will have the (base) name and
-// (parsed) contents of the first file. There must be at least one file.
-// If an error occurs, parsing stops and the returned *Template is nil.
-func ParseFiles(filenames ...string) (*Template, error) {
- return parseFiles(nil, filenames...)
-}
-
-// ParseFiles parses the named files and associates the resulting templates with
-// t. If an error occurs, parsing stops and the returned template is nil;
-// otherwise it is t. There must be at least one file.
-func (t *Template) ParseFiles(filenames ...string) (*Template, error) {
- return parseFiles(t, filenames...)
-}
-
-// parseFiles is the helper for the method and function. If the argument
-// template is nil, it is created from the first file.
-func parseFiles(t *Template, filenames ...string) (*Template, error) {
- if len(filenames) == 0 {
- // Not really a problem, but be consistent.
- return nil, fmt.Errorf("template: no files named in call to ParseFiles")
- }
- for _, filename := range filenames {
- b, err := ioutil.ReadFile(filename)
- if err != nil {
- return nil, err
- }
- s := string(b)
- name := filepath.Base(filename)
- // First template becomes return value if not already defined,
- // and we use that one for subsequent New calls to associate
- // all the templates together. Also, if this file has the same name
- // as t, this file becomes the contents of t, so
- // t, err := New(name).Funcs(xxx).ParseFiles(name)
- // works. Otherwise we create a new template associated with t.
- var tmpl *Template
- if t == nil {
- t = New(name)
- }
- if name == t.Name() {
- tmpl = t
- } else {
- tmpl = t.New(name)
- }
- _, err = tmpl.Parse(s)
- if err != nil {
- return nil, err
- }
- }
- return t, nil
-}
-
-// ParseGlob creates a new Template and parses the template definitions from the
-// files identified by the pattern, which must match at least one file. The
-// returned template will have the (base) name and (parsed) contents of the
-// first file matched by the pattern. ParseGlob is equivalent to calling
-// ParseFiles with the list of files matched by the pattern.
-func ParseGlob(pattern string) (*Template, error) {
- return parseGlob(nil, pattern)
-}
-
-// ParseGlob parses the template definitions in the files identified by the
-// pattern and associates the resulting templates with t. The pattern is
-// processed by filepath.Glob and must match at least one file. ParseGlob is
-// equivalent to calling t.ParseFiles with the list of files matched by the
-// pattern.
-func (t *Template) ParseGlob(pattern string) (*Template, error) {
- return parseGlob(t, pattern)
-}
-
-// parseGlob is the implementation of the function and method ParseGlob.
-func parseGlob(t *Template, pattern string) (*Template, error) {
- filenames, err := filepath.Glob(pattern)
- if err != nil {
- return nil, err
- }
- if len(filenames) == 0 {
- return nil, fmt.Errorf("template: pattern matches no files: %#q", pattern)
- }
- return parseFiles(t, filenames...)
-}
diff --git a/vendor/github.com/alecthomas/template/parse/lex.go b/vendor/github.com/alecthomas/template/parse/lex.go
deleted file mode 100644
index 55f1c05..0000000
--- a/vendor/github.com/alecthomas/template/parse/lex.go
+++ /dev/null
@@ -1,556 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package parse
-
-import (
- "fmt"
- "strings"
- "unicode"
- "unicode/utf8"
-)
-
-// item represents a token or text string returned from the scanner.
-type item struct {
- typ itemType // The type of this item.
- pos Pos // The starting position, in bytes, of this item in the input string.
- val string // The value of this item.
-}
-
-func (i item) String() string {
- switch {
- case i.typ == itemEOF:
- return "EOF"
- case i.typ == itemError:
- return i.val
- case i.typ > itemKeyword:
- return fmt.Sprintf("<%s>", i.val)
- case len(i.val) > 10:
- return fmt.Sprintf("%.10q...", i.val)
- }
- return fmt.Sprintf("%q", i.val)
-}
-
-// itemType identifies the type of lex items.
-type itemType int
-
-const (
- itemError itemType = iota // error occurred; value is text of error
- itemBool // boolean constant
- itemChar // printable ASCII character; grab bag for comma etc.
- itemCharConstant // character constant
- itemComplex // complex constant (1+2i); imaginary is just a number
- itemColonEquals // colon-equals (':=') introducing a declaration
- itemEOF
- itemField // alphanumeric identifier starting with '.'
- itemIdentifier // alphanumeric identifier not starting with '.'
- itemLeftDelim // left action delimiter
- itemLeftParen // '(' inside action
- itemNumber // simple number, including imaginary
- itemPipe // pipe symbol
- itemRawString // raw quoted string (includes quotes)
- itemRightDelim // right action delimiter
- itemElideNewline // elide newline after right delim
- itemRightParen // ')' inside action
- itemSpace // run of spaces separating arguments
- itemString // quoted string (includes quotes)
- itemText // plain text
- itemVariable // variable starting with '$', such as '$' or '$1' or '$hello'
- // Keywords appear after all the rest.
- itemKeyword // used only to delimit the keywords
- itemDot // the cursor, spelled '.'
- itemDefine // define keyword
- itemElse // else keyword
- itemEnd // end keyword
- itemIf // if keyword
- itemNil // the untyped nil constant, easiest to treat as a keyword
- itemRange // range keyword
- itemTemplate // template keyword
- itemWith // with keyword
-)
-
-var key = map[string]itemType{
- ".": itemDot,
- "define": itemDefine,
- "else": itemElse,
- "end": itemEnd,
- "if": itemIf,
- "range": itemRange,
- "nil": itemNil,
- "template": itemTemplate,
- "with": itemWith,
-}
-
-const eof = -1
-
-// stateFn represents the state of the scanner as a function that returns the next state.
-type stateFn func(*lexer) stateFn
-
-// lexer holds the state of the scanner.
-type lexer struct {
- name string // the name of the input; used only for error reports
- input string // the string being scanned
- leftDelim string // start of action
- rightDelim string // end of action
- state stateFn // the next lexing function to enter
- pos Pos // current position in the input
- start Pos // start position of this item
- width Pos // width of last rune read from input
- lastPos Pos // position of most recent item returned by nextItem
- items chan item // channel of scanned items
- parenDepth int // nesting depth of ( ) exprs
-}
-
-// next returns the next rune in the input.
-func (l *lexer) next() rune {
- if int(l.pos) >= len(l.input) {
- l.width = 0
- return eof
- }
- r, w := utf8.DecodeRuneInString(l.input[l.pos:])
- l.width = Pos(w)
- l.pos += l.width
- return r
-}
-
-// peek returns but does not consume the next rune in the input.
-func (l *lexer) peek() rune {
- r := l.next()
- l.backup()
- return r
-}
-
-// backup steps back one rune. Can only be called once per call of next.
-func (l *lexer) backup() {
- l.pos -= l.width
-}
-
-// emit passes an item back to the client.
-func (l *lexer) emit(t itemType) {
- l.items <- item{t, l.start, l.input[l.start:l.pos]}
- l.start = l.pos
-}
-
-// ignore skips over the pending input before this point.
-func (l *lexer) ignore() {
- l.start = l.pos
-}
-
-// accept consumes the next rune if it's from the valid set.
-func (l *lexer) accept(valid string) bool {
- if strings.IndexRune(valid, l.next()) >= 0 {
- return true
- }
- l.backup()
- return false
-}
-
-// acceptRun consumes a run of runes from the valid set.
-func (l *lexer) acceptRun(valid string) {
- for strings.IndexRune(valid, l.next()) >= 0 {
- }
- l.backup()
-}
-
-// lineNumber reports which line we're on, based on the position of
-// the previous item returned by nextItem. Doing it this way
-// means we don't have to worry about peek double counting.
-func (l *lexer) lineNumber() int {
- return 1 + strings.Count(l.input[:l.lastPos], "\n")
-}
-
-// errorf returns an error token and terminates the scan by passing
-// back a nil pointer that will be the next state, terminating l.nextItem.
-func (l *lexer) errorf(format string, args ...interface{}) stateFn {
- l.items <- item{itemError, l.start, fmt.Sprintf(format, args...)}
- return nil
-}
-
-// nextItem returns the next item from the input.
-func (l *lexer) nextItem() item {
- item := <-l.items
- l.lastPos = item.pos
- return item
-}
-
-// lex creates a new scanner for the input string.
-func lex(name, input, left, right string) *lexer {
- if left == "" {
- left = leftDelim
- }
- if right == "" {
- right = rightDelim
- }
- l := &lexer{
- name: name,
- input: input,
- leftDelim: left,
- rightDelim: right,
- items: make(chan item),
- }
- go l.run()
- return l
-}
-
-// run runs the state machine for the lexer.
-func (l *lexer) run() {
- for l.state = lexText; l.state != nil; {
- l.state = l.state(l)
- }
-}
-
-// state functions
-
-const (
- leftDelim = "{{"
- rightDelim = "}}"
- leftComment = "/*"
- rightComment = "*/"
-)
-
-// lexText scans until an opening action delimiter, "{{".
-func lexText(l *lexer) stateFn {
- for {
- if strings.HasPrefix(l.input[l.pos:], l.leftDelim) {
- if l.pos > l.start {
- l.emit(itemText)
- }
- return lexLeftDelim
- }
- if l.next() == eof {
- break
- }
- }
- // Correctly reached EOF.
- if l.pos > l.start {
- l.emit(itemText)
- }
- l.emit(itemEOF)
- return nil
-}
-
-// lexLeftDelim scans the left delimiter, which is known to be present.
-func lexLeftDelim(l *lexer) stateFn {
- l.pos += Pos(len(l.leftDelim))
- if strings.HasPrefix(l.input[l.pos:], leftComment) {
- return lexComment
- }
- l.emit(itemLeftDelim)
- l.parenDepth = 0
- return lexInsideAction
-}
-
-// lexComment scans a comment. The left comment marker is known to be present.
-func lexComment(l *lexer) stateFn {
- l.pos += Pos(len(leftComment))
- i := strings.Index(l.input[l.pos:], rightComment)
- if i < 0 {
- return l.errorf("unclosed comment")
- }
- l.pos += Pos(i + len(rightComment))
- if !strings.HasPrefix(l.input[l.pos:], l.rightDelim) {
- return l.errorf("comment ends before closing delimiter")
-
- }
- l.pos += Pos(len(l.rightDelim))
- l.ignore()
- return lexText
-}
-
-// lexRightDelim scans the right delimiter, which is known to be present.
-func lexRightDelim(l *lexer) stateFn {
- l.pos += Pos(len(l.rightDelim))
- l.emit(itemRightDelim)
- if l.peek() == '\\' {
- l.pos++
- l.emit(itemElideNewline)
- }
- return lexText
-}
-
-// lexInsideAction scans the elements inside action delimiters.
-func lexInsideAction(l *lexer) stateFn {
- // Either number, quoted string, or identifier.
- // Spaces separate arguments; runs of spaces turn into itemSpace.
- // Pipe symbols separate and are emitted.
- if strings.HasPrefix(l.input[l.pos:], l.rightDelim+"\\") || strings.HasPrefix(l.input[l.pos:], l.rightDelim) {
- if l.parenDepth == 0 {
- return lexRightDelim
- }
- return l.errorf("unclosed left paren")
- }
- switch r := l.next(); {
- case r == eof || isEndOfLine(r):
- return l.errorf("unclosed action")
- case isSpace(r):
- return lexSpace
- case r == ':':
- if l.next() != '=' {
- return l.errorf("expected :=")
- }
- l.emit(itemColonEquals)
- case r == '|':
- l.emit(itemPipe)
- case r == '"':
- return lexQuote
- case r == '`':
- return lexRawQuote
- case r == '$':
- return lexVariable
- case r == '\'':
- return lexChar
- case r == '.':
- // special look-ahead for ".field" so we don't break l.backup().
- if l.pos < Pos(len(l.input)) {
- r := l.input[l.pos]
- if r < '0' || '9' < r {
- return lexField
- }
- }
- fallthrough // '.' can start a number.
- case r == '+' || r == '-' || ('0' <= r && r <= '9'):
- l.backup()
- return lexNumber
- case isAlphaNumeric(r):
- l.backup()
- return lexIdentifier
- case r == '(':
- l.emit(itemLeftParen)
- l.parenDepth++
- return lexInsideAction
- case r == ')':
- l.emit(itemRightParen)
- l.parenDepth--
- if l.parenDepth < 0 {
- return l.errorf("unexpected right paren %#U", r)
- }
- return lexInsideAction
- case r <= unicode.MaxASCII && unicode.IsPrint(r):
- l.emit(itemChar)
- return lexInsideAction
- default:
- return l.errorf("unrecognized character in action: %#U", r)
- }
- return lexInsideAction
-}
-
-// lexSpace scans a run of space characters.
-// One space has already been seen.
-func lexSpace(l *lexer) stateFn {
- for isSpace(l.peek()) {
- l.next()
- }
- l.emit(itemSpace)
- return lexInsideAction
-}
-
-// lexIdentifier scans an alphanumeric.
-func lexIdentifier(l *lexer) stateFn {
-Loop:
- for {
- switch r := l.next(); {
- case isAlphaNumeric(r):
- // absorb.
- default:
- l.backup()
- word := l.input[l.start:l.pos]
- if !l.atTerminator() {
- return l.errorf("bad character %#U", r)
- }
- switch {
- case key[word] > itemKeyword:
- l.emit(key[word])
- case word[0] == '.':
- l.emit(itemField)
- case word == "true", word == "false":
- l.emit(itemBool)
- default:
- l.emit(itemIdentifier)
- }
- break Loop
- }
- }
- return lexInsideAction
-}
-
-// lexField scans a field: .Alphanumeric.
-// The . has been scanned.
-func lexField(l *lexer) stateFn {
- return lexFieldOrVariable(l, itemField)
-}
-
-// lexVariable scans a Variable: $Alphanumeric.
-// The $ has been scanned.
-func lexVariable(l *lexer) stateFn {
- if l.atTerminator() { // Nothing interesting follows -> "$".
- l.emit(itemVariable)
- return lexInsideAction
- }
- return lexFieldOrVariable(l, itemVariable)
-}
-
-// lexVariable scans a field or variable: [.$]Alphanumeric.
-// The . or $ has been scanned.
-func lexFieldOrVariable(l *lexer, typ itemType) stateFn {
- if l.atTerminator() { // Nothing interesting follows -> "." or "$".
- if typ == itemVariable {
- l.emit(itemVariable)
- } else {
- l.emit(itemDot)
- }
- return lexInsideAction
- }
- var r rune
- for {
- r = l.next()
- if !isAlphaNumeric(r) {
- l.backup()
- break
- }
- }
- if !l.atTerminator() {
- return l.errorf("bad character %#U", r)
- }
- l.emit(typ)
- return lexInsideAction
-}
-
-// atTerminator reports whether the input is at valid termination character to
-// appear after an identifier. Breaks .X.Y into two pieces. Also catches cases
-// like "$x+2" not being acceptable without a space, in case we decide one
-// day to implement arithmetic.
-func (l *lexer) atTerminator() bool {
- r := l.peek()
- if isSpace(r) || isEndOfLine(r) {
- return true
- }
- switch r {
- case eof, '.', ',', '|', ':', ')', '(':
- return true
- }
- // Does r start the delimiter? This can be ambiguous (with delim=="//", $x/2 will
- // succeed but should fail) but only in extremely rare cases caused by willfully
- // bad choice of delimiter.
- if rd, _ := utf8.DecodeRuneInString(l.rightDelim); rd == r {
- return true
- }
- return false
-}
-
-// lexChar scans a character constant. The initial quote is already
-// scanned. Syntax checking is done by the parser.
-func lexChar(l *lexer) stateFn {
-Loop:
- for {
- switch l.next() {
- case '\\':
- if r := l.next(); r != eof && r != '\n' {
- break
- }
- fallthrough
- case eof, '\n':
- return l.errorf("unterminated character constant")
- case '\'':
- break Loop
- }
- }
- l.emit(itemCharConstant)
- return lexInsideAction
-}
-
-// lexNumber scans a number: decimal, octal, hex, float, or imaginary. This
-// isn't a perfect number scanner - for instance it accepts "." and "0x0.2"
-// and "089" - but when it's wrong the input is invalid and the parser (via
-// strconv) will notice.
-func lexNumber(l *lexer) stateFn {
- if !l.scanNumber() {
- return l.errorf("bad number syntax: %q", l.input[l.start:l.pos])
- }
- if sign := l.peek(); sign == '+' || sign == '-' {
- // Complex: 1+2i. No spaces, must end in 'i'.
- if !l.scanNumber() || l.input[l.pos-1] != 'i' {
- return l.errorf("bad number syntax: %q", l.input[l.start:l.pos])
- }
- l.emit(itemComplex)
- } else {
- l.emit(itemNumber)
- }
- return lexInsideAction
-}
-
-func (l *lexer) scanNumber() bool {
- // Optional leading sign.
- l.accept("+-")
- // Is it hex?
- digits := "0123456789"
- if l.accept("0") && l.accept("xX") {
- digits = "0123456789abcdefABCDEF"
- }
- l.acceptRun(digits)
- if l.accept(".") {
- l.acceptRun(digits)
- }
- if l.accept("eE") {
- l.accept("+-")
- l.acceptRun("0123456789")
- }
- // Is it imaginary?
- l.accept("i")
- // Next thing mustn't be alphanumeric.
- if isAlphaNumeric(l.peek()) {
- l.next()
- return false
- }
- return true
-}
-
-// lexQuote scans a quoted string.
-func lexQuote(l *lexer) stateFn {
-Loop:
- for {
- switch l.next() {
- case '\\':
- if r := l.next(); r != eof && r != '\n' {
- break
- }
- fallthrough
- case eof, '\n':
- return l.errorf("unterminated quoted string")
- case '"':
- break Loop
- }
- }
- l.emit(itemString)
- return lexInsideAction
-}
-
-// lexRawQuote scans a raw quoted string.
-func lexRawQuote(l *lexer) stateFn {
-Loop:
- for {
- switch l.next() {
- case eof, '\n':
- return l.errorf("unterminated raw quoted string")
- case '`':
- break Loop
- }
- }
- l.emit(itemRawString)
- return lexInsideAction
-}
-
-// isSpace reports whether r is a space character.
-func isSpace(r rune) bool {
- return r == ' ' || r == '\t'
-}
-
-// isEndOfLine reports whether r is an end-of-line character.
-func isEndOfLine(r rune) bool {
- return r == '\r' || r == '\n'
-}
-
-// isAlphaNumeric reports whether r is an alphabetic, digit, or underscore.
-func isAlphaNumeric(r rune) bool {
- return r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r)
-}
diff --git a/vendor/github.com/alecthomas/template/parse/node.go b/vendor/github.com/alecthomas/template/parse/node.go
deleted file mode 100644
index 55c37f6..0000000
--- a/vendor/github.com/alecthomas/template/parse/node.go
+++ /dev/null
@@ -1,834 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Parse nodes.
-
-package parse
-
-import (
- "bytes"
- "fmt"
- "strconv"
- "strings"
-)
-
-var textFormat = "%s" // Changed to "%q" in tests for better error messages.
-
-// A Node is an element in the parse tree. The interface is trivial.
-// The interface contains an unexported method so that only
-// types local to this package can satisfy it.
-type Node interface {
- Type() NodeType
- String() string
- // Copy does a deep copy of the Node and all its components.
- // To avoid type assertions, some XxxNodes also have specialized
- // CopyXxx methods that return *XxxNode.
- Copy() Node
- Position() Pos // byte position of start of node in full original input string
- // tree returns the containing *Tree.
- // It is unexported so all implementations of Node are in this package.
- tree() *Tree
-}
-
-// NodeType identifies the type of a parse tree node.
-type NodeType int
-
-// Pos represents a byte position in the original input text from which
-// this template was parsed.
-type Pos int
-
-func (p Pos) Position() Pos {
- return p
-}
-
-// Type returns itself and provides an easy default implementation
-// for embedding in a Node. Embedded in all non-trivial Nodes.
-func (t NodeType) Type() NodeType {
- return t
-}
-
-const (
- NodeText NodeType = iota // Plain text.
- NodeAction // A non-control action such as a field evaluation.
- NodeBool // A boolean constant.
- NodeChain // A sequence of field accesses.
- NodeCommand // An element of a pipeline.
- NodeDot // The cursor, dot.
- nodeElse // An else action. Not added to tree.
- nodeEnd // An end action. Not added to tree.
- NodeField // A field or method name.
- NodeIdentifier // An identifier; always a function name.
- NodeIf // An if action.
- NodeList // A list of Nodes.
- NodeNil // An untyped nil constant.
- NodeNumber // A numerical constant.
- NodePipe // A pipeline of commands.
- NodeRange // A range action.
- NodeString // A string constant.
- NodeTemplate // A template invocation action.
- NodeVariable // A $ variable.
- NodeWith // A with action.
-)
-
-// Nodes.
-
-// ListNode holds a sequence of nodes.
-type ListNode struct {
- NodeType
- Pos
- tr *Tree
- Nodes []Node // The element nodes in lexical order.
-}
-
-func (t *Tree) newList(pos Pos) *ListNode {
- return &ListNode{tr: t, NodeType: NodeList, Pos: pos}
-}
-
-func (l *ListNode) append(n Node) {
- l.Nodes = append(l.Nodes, n)
-}
-
-func (l *ListNode) tree() *Tree {
- return l.tr
-}
-
-func (l *ListNode) String() string {
- b := new(bytes.Buffer)
- for _, n := range l.Nodes {
- fmt.Fprint(b, n)
- }
- return b.String()
-}
-
-func (l *ListNode) CopyList() *ListNode {
- if l == nil {
- return l
- }
- n := l.tr.newList(l.Pos)
- for _, elem := range l.Nodes {
- n.append(elem.Copy())
- }
- return n
-}
-
-func (l *ListNode) Copy() Node {
- return l.CopyList()
-}
-
-// TextNode holds plain text.
-type TextNode struct {
- NodeType
- Pos
- tr *Tree
- Text []byte // The text; may span newlines.
-}
-
-func (t *Tree) newText(pos Pos, text string) *TextNode {
- return &TextNode{tr: t, NodeType: NodeText, Pos: pos, Text: []byte(text)}
-}
-
-func (t *TextNode) String() string {
- return fmt.Sprintf(textFormat, t.Text)
-}
-
-func (t *TextNode) tree() *Tree {
- return t.tr
-}
-
-func (t *TextNode) Copy() Node {
- return &TextNode{tr: t.tr, NodeType: NodeText, Pos: t.Pos, Text: append([]byte{}, t.Text...)}
-}
-
-// PipeNode holds a pipeline with optional declaration
-type PipeNode struct {
- NodeType
- Pos
- tr *Tree
- Line int // The line number in the input (deprecated; kept for compatibility)
- Decl []*VariableNode // Variable declarations in lexical order.
- Cmds []*CommandNode // The commands in lexical order.
-}
-
-func (t *Tree) newPipeline(pos Pos, line int, decl []*VariableNode) *PipeNode {
- return &PipeNode{tr: t, NodeType: NodePipe, Pos: pos, Line: line, Decl: decl}
-}
-
-func (p *PipeNode) append(command *CommandNode) {
- p.Cmds = append(p.Cmds, command)
-}
-
-func (p *PipeNode) String() string {
- s := ""
- if len(p.Decl) > 0 {
- for i, v := range p.Decl {
- if i > 0 {
- s += ", "
- }
- s += v.String()
- }
- s += " := "
- }
- for i, c := range p.Cmds {
- if i > 0 {
- s += " | "
- }
- s += c.String()
- }
- return s
-}
-
-func (p *PipeNode) tree() *Tree {
- return p.tr
-}
-
-func (p *PipeNode) CopyPipe() *PipeNode {
- if p == nil {
- return p
- }
- var decl []*VariableNode
- for _, d := range p.Decl {
- decl = append(decl, d.Copy().(*VariableNode))
- }
- n := p.tr.newPipeline(p.Pos, p.Line, decl)
- for _, c := range p.Cmds {
- n.append(c.Copy().(*CommandNode))
- }
- return n
-}
-
-func (p *PipeNode) Copy() Node {
- return p.CopyPipe()
-}
-
-// ActionNode holds an action (something bounded by delimiters).
-// Control actions have their own nodes; ActionNode represents simple
-// ones such as field evaluations and parenthesized pipelines.
-type ActionNode struct {
- NodeType
- Pos
- tr *Tree
- Line int // The line number in the input (deprecated; kept for compatibility)
- Pipe *PipeNode // The pipeline in the action.
-}
-
-func (t *Tree) newAction(pos Pos, line int, pipe *PipeNode) *ActionNode {
- return &ActionNode{tr: t, NodeType: NodeAction, Pos: pos, Line: line, Pipe: pipe}
-}
-
-func (a *ActionNode) String() string {
- return fmt.Sprintf("{{%s}}", a.Pipe)
-
-}
-
-func (a *ActionNode) tree() *Tree {
- return a.tr
-}
-
-func (a *ActionNode) Copy() Node {
- return a.tr.newAction(a.Pos, a.Line, a.Pipe.CopyPipe())
-
-}
-
-// CommandNode holds a command (a pipeline inside an evaluating action).
-type CommandNode struct {
- NodeType
- Pos
- tr *Tree
- Args []Node // Arguments in lexical order: Identifier, field, or constant.
-}
-
-func (t *Tree) newCommand(pos Pos) *CommandNode {
- return &CommandNode{tr: t, NodeType: NodeCommand, Pos: pos}
-}
-
-func (c *CommandNode) append(arg Node) {
- c.Args = append(c.Args, arg)
-}
-
-func (c *CommandNode) String() string {
- s := ""
- for i, arg := range c.Args {
- if i > 0 {
- s += " "
- }
- if arg, ok := arg.(*PipeNode); ok {
- s += "(" + arg.String() + ")"
- continue
- }
- s += arg.String()
- }
- return s
-}
-
-func (c *CommandNode) tree() *Tree {
- return c.tr
-}
-
-func (c *CommandNode) Copy() Node {
- if c == nil {
- return c
- }
- n := c.tr.newCommand(c.Pos)
- for _, c := range c.Args {
- n.append(c.Copy())
- }
- return n
-}
-
-// IdentifierNode holds an identifier.
-type IdentifierNode struct {
- NodeType
- Pos
- tr *Tree
- Ident string // The identifier's name.
-}
-
-// NewIdentifier returns a new IdentifierNode with the given identifier name.
-func NewIdentifier(ident string) *IdentifierNode {
- return &IdentifierNode{NodeType: NodeIdentifier, Ident: ident}
-}
-
-// SetPos sets the position. NewIdentifier is a public method so we can't modify its signature.
-// Chained for convenience.
-// TODO: fix one day?
-func (i *IdentifierNode) SetPos(pos Pos) *IdentifierNode {
- i.Pos = pos
- return i
-}
-
-// SetTree sets the parent tree for the node. NewIdentifier is a public method so we can't modify its signature.
-// Chained for convenience.
-// TODO: fix one day?
-func (i *IdentifierNode) SetTree(t *Tree) *IdentifierNode {
- i.tr = t
- return i
-}
-
-func (i *IdentifierNode) String() string {
- return i.Ident
-}
-
-func (i *IdentifierNode) tree() *Tree {
- return i.tr
-}
-
-func (i *IdentifierNode) Copy() Node {
- return NewIdentifier(i.Ident).SetTree(i.tr).SetPos(i.Pos)
-}
-
-// VariableNode holds a list of variable names, possibly with chained field
-// accesses. The dollar sign is part of the (first) name.
-type VariableNode struct {
- NodeType
- Pos
- tr *Tree
- Ident []string // Variable name and fields in lexical order.
-}
-
-func (t *Tree) newVariable(pos Pos, ident string) *VariableNode {
- return &VariableNode{tr: t, NodeType: NodeVariable, Pos: pos, Ident: strings.Split(ident, ".")}
-}
-
-func (v *VariableNode) String() string {
- s := ""
- for i, id := range v.Ident {
- if i > 0 {
- s += "."
- }
- s += id
- }
- return s
-}
-
-func (v *VariableNode) tree() *Tree {
- return v.tr
-}
-
-func (v *VariableNode) Copy() Node {
- return &VariableNode{tr: v.tr, NodeType: NodeVariable, Pos: v.Pos, Ident: append([]string{}, v.Ident...)}
-}
-
-// DotNode holds the special identifier '.'.
-type DotNode struct {
- NodeType
- Pos
- tr *Tree
-}
-
-func (t *Tree) newDot(pos Pos) *DotNode {
- return &DotNode{tr: t, NodeType: NodeDot, Pos: pos}
-}
-
-func (d *DotNode) Type() NodeType {
- // Override method on embedded NodeType for API compatibility.
- // TODO: Not really a problem; could change API without effect but
- // api tool complains.
- return NodeDot
-}
-
-func (d *DotNode) String() string {
- return "."
-}
-
-func (d *DotNode) tree() *Tree {
- return d.tr
-}
-
-func (d *DotNode) Copy() Node {
- return d.tr.newDot(d.Pos)
-}
-
-// NilNode holds the special identifier 'nil' representing an untyped nil constant.
-type NilNode struct {
- NodeType
- Pos
- tr *Tree
-}
-
-func (t *Tree) newNil(pos Pos) *NilNode {
- return &NilNode{tr: t, NodeType: NodeNil, Pos: pos}
-}
-
-func (n *NilNode) Type() NodeType {
- // Override method on embedded NodeType for API compatibility.
- // TODO: Not really a problem; could change API without effect but
- // api tool complains.
- return NodeNil
-}
-
-func (n *NilNode) String() string {
- return "nil"
-}
-
-func (n *NilNode) tree() *Tree {
- return n.tr
-}
-
-func (n *NilNode) Copy() Node {
- return n.tr.newNil(n.Pos)
-}
-
-// FieldNode holds a field (identifier starting with '.').
-// The names may be chained ('.x.y').
-// The period is dropped from each ident.
-type FieldNode struct {
- NodeType
- Pos
- tr *Tree
- Ident []string // The identifiers in lexical order.
-}
-
-func (t *Tree) newField(pos Pos, ident string) *FieldNode {
- return &FieldNode{tr: t, NodeType: NodeField, Pos: pos, Ident: strings.Split(ident[1:], ".")} // [1:] to drop leading period
-}
-
-func (f *FieldNode) String() string {
- s := ""
- for _, id := range f.Ident {
- s += "." + id
- }
- return s
-}
-
-func (f *FieldNode) tree() *Tree {
- return f.tr
-}
-
-func (f *FieldNode) Copy() Node {
- return &FieldNode{tr: f.tr, NodeType: NodeField, Pos: f.Pos, Ident: append([]string{}, f.Ident...)}
-}
-
-// ChainNode holds a term followed by a chain of field accesses (identifier starting with '.').
-// The names may be chained ('.x.y').
-// The periods are dropped from each ident.
-type ChainNode struct {
- NodeType
- Pos
- tr *Tree
- Node Node
- Field []string // The identifiers in lexical order.
-}
-
-func (t *Tree) newChain(pos Pos, node Node) *ChainNode {
- return &ChainNode{tr: t, NodeType: NodeChain, Pos: pos, Node: node}
-}
-
-// Add adds the named field (which should start with a period) to the end of the chain.
-func (c *ChainNode) Add(field string) {
- if len(field) == 0 || field[0] != '.' {
- panic("no dot in field")
- }
- field = field[1:] // Remove leading dot.
- if field == "" {
- panic("empty field")
- }
- c.Field = append(c.Field, field)
-}
-
-func (c *ChainNode) String() string {
- s := c.Node.String()
- if _, ok := c.Node.(*PipeNode); ok {
- s = "(" + s + ")"
- }
- for _, field := range c.Field {
- s += "." + field
- }
- return s
-}
-
-func (c *ChainNode) tree() *Tree {
- return c.tr
-}
-
-func (c *ChainNode) Copy() Node {
- return &ChainNode{tr: c.tr, NodeType: NodeChain, Pos: c.Pos, Node: c.Node, Field: append([]string{}, c.Field...)}
-}
-
-// BoolNode holds a boolean constant.
-type BoolNode struct {
- NodeType
- Pos
- tr *Tree
- True bool // The value of the boolean constant.
-}
-
-func (t *Tree) newBool(pos Pos, true bool) *BoolNode {
- return &BoolNode{tr: t, NodeType: NodeBool, Pos: pos, True: true}
-}
-
-func (b *BoolNode) String() string {
- if b.True {
- return "true"
- }
- return "false"
-}
-
-func (b *BoolNode) tree() *Tree {
- return b.tr
-}
-
-func (b *BoolNode) Copy() Node {
- return b.tr.newBool(b.Pos, b.True)
-}
-
-// NumberNode holds a number: signed or unsigned integer, float, or complex.
-// The value is parsed and stored under all the types that can represent the value.
-// This simulates in a small amount of code the behavior of Go's ideal constants.
-type NumberNode struct {
- NodeType
- Pos
- tr *Tree
- IsInt bool // Number has an integral value.
- IsUint bool // Number has an unsigned integral value.
- IsFloat bool // Number has a floating-point value.
- IsComplex bool // Number is complex.
- Int64 int64 // The signed integer value.
- Uint64 uint64 // The unsigned integer value.
- Float64 float64 // The floating-point value.
- Complex128 complex128 // The complex value.
- Text string // The original textual representation from the input.
-}
-
-func (t *Tree) newNumber(pos Pos, text string, typ itemType) (*NumberNode, error) {
- n := &NumberNode{tr: t, NodeType: NodeNumber, Pos: pos, Text: text}
- switch typ {
- case itemCharConstant:
- rune, _, tail, err := strconv.UnquoteChar(text[1:], text[0])
- if err != nil {
- return nil, err
- }
- if tail != "'" {
- return nil, fmt.Errorf("malformed character constant: %s", text)
- }
- n.Int64 = int64(rune)
- n.IsInt = true
- n.Uint64 = uint64(rune)
- n.IsUint = true
- n.Float64 = float64(rune) // odd but those are the rules.
- n.IsFloat = true
- return n, nil
- case itemComplex:
- // fmt.Sscan can parse the pair, so let it do the work.
- if _, err := fmt.Sscan(text, &n.Complex128); err != nil {
- return nil, err
- }
- n.IsComplex = true
- n.simplifyComplex()
- return n, nil
- }
- // Imaginary constants can only be complex unless they are zero.
- if len(text) > 0 && text[len(text)-1] == 'i' {
- f, err := strconv.ParseFloat(text[:len(text)-1], 64)
- if err == nil {
- n.IsComplex = true
- n.Complex128 = complex(0, f)
- n.simplifyComplex()
- return n, nil
- }
- }
- // Do integer test first so we get 0x123 etc.
- u, err := strconv.ParseUint(text, 0, 64) // will fail for -0; fixed below.
- if err == nil {
- n.IsUint = true
- n.Uint64 = u
- }
- i, err := strconv.ParseInt(text, 0, 64)
- if err == nil {
- n.IsInt = true
- n.Int64 = i
- if i == 0 {
- n.IsUint = true // in case of -0.
- n.Uint64 = u
- }
- }
- // If an integer extraction succeeded, promote the float.
- if n.IsInt {
- n.IsFloat = true
- n.Float64 = float64(n.Int64)
- } else if n.IsUint {
- n.IsFloat = true
- n.Float64 = float64(n.Uint64)
- } else {
- f, err := strconv.ParseFloat(text, 64)
- if err == nil {
- n.IsFloat = true
- n.Float64 = f
- // If a floating-point extraction succeeded, extract the int if needed.
- if !n.IsInt && float64(int64(f)) == f {
- n.IsInt = true
- n.Int64 = int64(f)
- }
- if !n.IsUint && float64(uint64(f)) == f {
- n.IsUint = true
- n.Uint64 = uint64(f)
- }
- }
- }
- if !n.IsInt && !n.IsUint && !n.IsFloat {
- return nil, fmt.Errorf("illegal number syntax: %q", text)
- }
- return n, nil
-}
-
-// simplifyComplex pulls out any other types that are represented by the complex number.
-// These all require that the imaginary part be zero.
-func (n *NumberNode) simplifyComplex() {
- n.IsFloat = imag(n.Complex128) == 0
- if n.IsFloat {
- n.Float64 = real(n.Complex128)
- n.IsInt = float64(int64(n.Float64)) == n.Float64
- if n.IsInt {
- n.Int64 = int64(n.Float64)
- }
- n.IsUint = float64(uint64(n.Float64)) == n.Float64
- if n.IsUint {
- n.Uint64 = uint64(n.Float64)
- }
- }
-}
-
-func (n *NumberNode) String() string {
- return n.Text
-}
-
-func (n *NumberNode) tree() *Tree {
- return n.tr
-}
-
-func (n *NumberNode) Copy() Node {
- nn := new(NumberNode)
- *nn = *n // Easy, fast, correct.
- return nn
-}
-
-// StringNode holds a string constant. The value has been "unquoted".
-type StringNode struct {
- NodeType
- Pos
- tr *Tree
- Quoted string // The original text of the string, with quotes.
- Text string // The string, after quote processing.
-}
-
-func (t *Tree) newString(pos Pos, orig, text string) *StringNode {
- return &StringNode{tr: t, NodeType: NodeString, Pos: pos, Quoted: orig, Text: text}
-}
-
-func (s *StringNode) String() string {
- return s.Quoted
-}
-
-func (s *StringNode) tree() *Tree {
- return s.tr
-}
-
-func (s *StringNode) Copy() Node {
- return s.tr.newString(s.Pos, s.Quoted, s.Text)
-}
-
-// endNode represents an {{end}} action.
-// It does not appear in the final parse tree.
-type endNode struct {
- NodeType
- Pos
- tr *Tree
-}
-
-func (t *Tree) newEnd(pos Pos) *endNode {
- return &endNode{tr: t, NodeType: nodeEnd, Pos: pos}
-}
-
-func (e *endNode) String() string {
- return "{{end}}"
-}
-
-func (e *endNode) tree() *Tree {
- return e.tr
-}
-
-func (e *endNode) Copy() Node {
- return e.tr.newEnd(e.Pos)
-}
-
-// elseNode represents an {{else}} action. Does not appear in the final tree.
-type elseNode struct {
- NodeType
- Pos
- tr *Tree
- Line int // The line number in the input (deprecated; kept for compatibility)
-}
-
-func (t *Tree) newElse(pos Pos, line int) *elseNode {
- return &elseNode{tr: t, NodeType: nodeElse, Pos: pos, Line: line}
-}
-
-func (e *elseNode) Type() NodeType {
- return nodeElse
-}
-
-func (e *elseNode) String() string {
- return "{{else}}"
-}
-
-func (e *elseNode) tree() *Tree {
- return e.tr
-}
-
-func (e *elseNode) Copy() Node {
- return e.tr.newElse(e.Pos, e.Line)
-}
-
-// BranchNode is the common representation of if, range, and with.
-type BranchNode struct {
- NodeType
- Pos
- tr *Tree
- Line int // The line number in the input (deprecated; kept for compatibility)
- Pipe *PipeNode // The pipeline to be evaluated.
- List *ListNode // What to execute if the value is non-empty.
- ElseList *ListNode // What to execute if the value is empty (nil if absent).
-}
-
-func (b *BranchNode) String() string {
- name := ""
- switch b.NodeType {
- case NodeIf:
- name = "if"
- case NodeRange:
- name = "range"
- case NodeWith:
- name = "with"
- default:
- panic("unknown branch type")
- }
- if b.ElseList != nil {
- return fmt.Sprintf("{{%s %s}}%s{{else}}%s{{end}}", name, b.Pipe, b.List, b.ElseList)
- }
- return fmt.Sprintf("{{%s %s}}%s{{end}}", name, b.Pipe, b.List)
-}
-
-func (b *BranchNode) tree() *Tree {
- return b.tr
-}
-
-func (b *BranchNode) Copy() Node {
- switch b.NodeType {
- case NodeIf:
- return b.tr.newIf(b.Pos, b.Line, b.Pipe, b.List, b.ElseList)
- case NodeRange:
- return b.tr.newRange(b.Pos, b.Line, b.Pipe, b.List, b.ElseList)
- case NodeWith:
- return b.tr.newWith(b.Pos, b.Line, b.Pipe, b.List, b.ElseList)
- default:
- panic("unknown branch type")
- }
-}
-
-// IfNode represents an {{if}} action and its commands.
-type IfNode struct {
- BranchNode
-}
-
-func (t *Tree) newIf(pos Pos, line int, pipe *PipeNode, list, elseList *ListNode) *IfNode {
- return &IfNode{BranchNode{tr: t, NodeType: NodeIf, Pos: pos, Line: line, Pipe: pipe, List: list, ElseList: elseList}}
-}
-
-func (i *IfNode) Copy() Node {
- return i.tr.newIf(i.Pos, i.Line, i.Pipe.CopyPipe(), i.List.CopyList(), i.ElseList.CopyList())
-}
-
-// RangeNode represents a {{range}} action and its commands.
-type RangeNode struct {
- BranchNode
-}
-
-func (t *Tree) newRange(pos Pos, line int, pipe *PipeNode, list, elseList *ListNode) *RangeNode {
- return &RangeNode{BranchNode{tr: t, NodeType: NodeRange, Pos: pos, Line: line, Pipe: pipe, List: list, ElseList: elseList}}
-}
-
-func (r *RangeNode) Copy() Node {
- return r.tr.newRange(r.Pos, r.Line, r.Pipe.CopyPipe(), r.List.CopyList(), r.ElseList.CopyList())
-}
-
-// WithNode represents a {{with}} action and its commands.
-type WithNode struct {
- BranchNode
-}
-
-func (t *Tree) newWith(pos Pos, line int, pipe *PipeNode, list, elseList *ListNode) *WithNode {
- return &WithNode{BranchNode{tr: t, NodeType: NodeWith, Pos: pos, Line: line, Pipe: pipe, List: list, ElseList: elseList}}
-}
-
-func (w *WithNode) Copy() Node {
- return w.tr.newWith(w.Pos, w.Line, w.Pipe.CopyPipe(), w.List.CopyList(), w.ElseList.CopyList())
-}
-
-// TemplateNode represents a {{template}} action.
-type TemplateNode struct {
- NodeType
- Pos
- tr *Tree
- Line int // The line number in the input (deprecated; kept for compatibility)
- Name string // The name of the template (unquoted).
- Pipe *PipeNode // The command to evaluate as dot for the template.
-}
-
-func (t *Tree) newTemplate(pos Pos, line int, name string, pipe *PipeNode) *TemplateNode {
- return &TemplateNode{tr: t, NodeType: NodeTemplate, Pos: pos, Line: line, Name: name, Pipe: pipe}
-}
-
-func (t *TemplateNode) String() string {
- if t.Pipe == nil {
- return fmt.Sprintf("{{template %q}}", t.Name)
- }
- return fmt.Sprintf("{{template %q %s}}", t.Name, t.Pipe)
-}
-
-func (t *TemplateNode) tree() *Tree {
- return t.tr
-}
-
-func (t *TemplateNode) Copy() Node {
- return t.tr.newTemplate(t.Pos, t.Line, t.Name, t.Pipe.CopyPipe())
-}
diff --git a/vendor/github.com/alecthomas/template/parse/parse.go b/vendor/github.com/alecthomas/template/parse/parse.go
deleted file mode 100644
index 0d77ade..0000000
--- a/vendor/github.com/alecthomas/template/parse/parse.go
+++ /dev/null
@@ -1,700 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package parse builds parse trees for templates as defined by text/template
-// and html/template. Clients should use those packages to construct templates
-// rather than this one, which provides shared internal data structures not
-// intended for general use.
-package parse
-
-import (
- "bytes"
- "fmt"
- "runtime"
- "strconv"
- "strings"
-)
-
-// Tree is the representation of a single parsed template.
-type Tree struct {
- Name string // name of the template represented by the tree.
- ParseName string // name of the top-level template during parsing, for error messages.
- Root *ListNode // top-level root of the tree.
- text string // text parsed to create the template (or its parent)
- // Parsing only; cleared after parse.
- funcs []map[string]interface{}
- lex *lexer
- token [3]item // three-token lookahead for parser.
- peekCount int
- vars []string // variables defined at the moment.
-}
-
-// Copy returns a copy of the Tree. Any parsing state is discarded.
-func (t *Tree) Copy() *Tree {
- if t == nil {
- return nil
- }
- return &Tree{
- Name: t.Name,
- ParseName: t.ParseName,
- Root: t.Root.CopyList(),
- text: t.text,
- }
-}
-
-// Parse returns a map from template name to parse.Tree, created by parsing the
-// templates described in the argument string. The top-level template will be
-// given the specified name. If an error is encountered, parsing stops and an
-// empty map is returned with the error.
-func Parse(name, text, leftDelim, rightDelim string, funcs ...map[string]interface{}) (treeSet map[string]*Tree, err error) {
- treeSet = make(map[string]*Tree)
- t := New(name)
- t.text = text
- _, err = t.Parse(text, leftDelim, rightDelim, treeSet, funcs...)
- return
-}
-
-// next returns the next token.
-func (t *Tree) next() item {
- if t.peekCount > 0 {
- t.peekCount--
- } else {
- t.token[0] = t.lex.nextItem()
- }
- return t.token[t.peekCount]
-}
-
-// backup backs the input stream up one token.
-func (t *Tree) backup() {
- t.peekCount++
-}
-
-// backup2 backs the input stream up two tokens.
-// The zeroth token is already there.
-func (t *Tree) backup2(t1 item) {
- t.token[1] = t1
- t.peekCount = 2
-}
-
-// backup3 backs the input stream up three tokens
-// The zeroth token is already there.
-func (t *Tree) backup3(t2, t1 item) { // Reverse order: we're pushing back.
- t.token[1] = t1
- t.token[2] = t2
- t.peekCount = 3
-}
-
-// peek returns but does not consume the next token.
-func (t *Tree) peek() item {
- if t.peekCount > 0 {
- return t.token[t.peekCount-1]
- }
- t.peekCount = 1
- t.token[0] = t.lex.nextItem()
- return t.token[0]
-}
-
-// nextNonSpace returns the next non-space token.
-func (t *Tree) nextNonSpace() (token item) {
- for {
- token = t.next()
- if token.typ != itemSpace {
- break
- }
- }
- return token
-}
-
-// peekNonSpace returns but does not consume the next non-space token.
-func (t *Tree) peekNonSpace() (token item) {
- for {
- token = t.next()
- if token.typ != itemSpace {
- break
- }
- }
- t.backup()
- return token
-}
-
-// Parsing.
-
-// New allocates a new parse tree with the given name.
-func New(name string, funcs ...map[string]interface{}) *Tree {
- return &Tree{
- Name: name,
- funcs: funcs,
- }
-}
-
-// ErrorContext returns a textual representation of the location of the node in the input text.
-// The receiver is only used when the node does not have a pointer to the tree inside,
-// which can occur in old code.
-func (t *Tree) ErrorContext(n Node) (location, context string) {
- pos := int(n.Position())
- tree := n.tree()
- if tree == nil {
- tree = t
- }
- text := tree.text[:pos]
- byteNum := strings.LastIndex(text, "\n")
- if byteNum == -1 {
- byteNum = pos // On first line.
- } else {
- byteNum++ // After the newline.
- byteNum = pos - byteNum
- }
- lineNum := 1 + strings.Count(text, "\n")
- context = n.String()
- if len(context) > 20 {
- context = fmt.Sprintf("%.20s...", context)
- }
- return fmt.Sprintf("%s:%d:%d", tree.ParseName, lineNum, byteNum), context
-}
-
-// errorf formats the error and terminates processing.
-func (t *Tree) errorf(format string, args ...interface{}) {
- t.Root = nil
- format = fmt.Sprintf("template: %s:%d: %s", t.ParseName, t.lex.lineNumber(), format)
- panic(fmt.Errorf(format, args...))
-}
-
-// error terminates processing.
-func (t *Tree) error(err error) {
- t.errorf("%s", err)
-}
-
-// expect consumes the next token and guarantees it has the required type.
-func (t *Tree) expect(expected itemType, context string) item {
- token := t.nextNonSpace()
- if token.typ != expected {
- t.unexpected(token, context)
- }
- return token
-}
-
-// expectOneOf consumes the next token and guarantees it has one of the required types.
-func (t *Tree) expectOneOf(expected1, expected2 itemType, context string) item {
- token := t.nextNonSpace()
- if token.typ != expected1 && token.typ != expected2 {
- t.unexpected(token, context)
- }
- return token
-}
-
-// unexpected complains about the token and terminates processing.
-func (t *Tree) unexpected(token item, context string) {
- t.errorf("unexpected %s in %s", token, context)
-}
-
-// recover is the handler that turns panics into returns from the top level of Parse.
-func (t *Tree) recover(errp *error) {
- e := recover()
- if e != nil {
- if _, ok := e.(runtime.Error); ok {
- panic(e)
- }
- if t != nil {
- t.stopParse()
- }
- *errp = e.(error)
- }
- return
-}
-
-// startParse initializes the parser, using the lexer.
-func (t *Tree) startParse(funcs []map[string]interface{}, lex *lexer) {
- t.Root = nil
- t.lex = lex
- t.vars = []string{"$"}
- t.funcs = funcs
-}
-
-// stopParse terminates parsing.
-func (t *Tree) stopParse() {
- t.lex = nil
- t.vars = nil
- t.funcs = nil
-}
-
-// Parse parses the template definition string to construct a representation of
-// the template for execution. If either action delimiter string is empty, the
-// default ("{{" or "}}") is used. Embedded template definitions are added to
-// the treeSet map.
-func (t *Tree) Parse(text, leftDelim, rightDelim string, treeSet map[string]*Tree, funcs ...map[string]interface{}) (tree *Tree, err error) {
- defer t.recover(&err)
- t.ParseName = t.Name
- t.startParse(funcs, lex(t.Name, text, leftDelim, rightDelim))
- t.text = text
- t.parse(treeSet)
- t.add(treeSet)
- t.stopParse()
- return t, nil
-}
-
-// add adds tree to the treeSet.
-func (t *Tree) add(treeSet map[string]*Tree) {
- tree := treeSet[t.Name]
- if tree == nil || IsEmptyTree(tree.Root) {
- treeSet[t.Name] = t
- return
- }
- if !IsEmptyTree(t.Root) {
- t.errorf("template: multiple definition of template %q", t.Name)
- }
-}
-
-// IsEmptyTree reports whether this tree (node) is empty of everything but space.
-func IsEmptyTree(n Node) bool {
- switch n := n.(type) {
- case nil:
- return true
- case *ActionNode:
- case *IfNode:
- case *ListNode:
- for _, node := range n.Nodes {
- if !IsEmptyTree(node) {
- return false
- }
- }
- return true
- case *RangeNode:
- case *TemplateNode:
- case *TextNode:
- return len(bytes.TrimSpace(n.Text)) == 0
- case *WithNode:
- default:
- panic("unknown node: " + n.String())
- }
- return false
-}
-
-// parse is the top-level parser for a template, essentially the same
-// as itemList except it also parses {{define}} actions.
-// It runs to EOF.
-func (t *Tree) parse(treeSet map[string]*Tree) (next Node) {
- t.Root = t.newList(t.peek().pos)
- for t.peek().typ != itemEOF {
- if t.peek().typ == itemLeftDelim {
- delim := t.next()
- if t.nextNonSpace().typ == itemDefine {
- newT := New("definition") // name will be updated once we know it.
- newT.text = t.text
- newT.ParseName = t.ParseName
- newT.startParse(t.funcs, t.lex)
- newT.parseDefinition(treeSet)
- continue
- }
- t.backup2(delim)
- }
- n := t.textOrAction()
- if n.Type() == nodeEnd {
- t.errorf("unexpected %s", n)
- }
- t.Root.append(n)
- }
- return nil
-}
-
-// parseDefinition parses a {{define}} ... {{end}} template definition and
-// installs the definition in the treeSet map. The "define" keyword has already
-// been scanned.
-func (t *Tree) parseDefinition(treeSet map[string]*Tree) {
- const context = "define clause"
- name := t.expectOneOf(itemString, itemRawString, context)
- var err error
- t.Name, err = strconv.Unquote(name.val)
- if err != nil {
- t.error(err)
- }
- t.expect(itemRightDelim, context)
- var end Node
- t.Root, end = t.itemList()
- if end.Type() != nodeEnd {
- t.errorf("unexpected %s in %s", end, context)
- }
- t.add(treeSet)
- t.stopParse()
-}
-
-// itemList:
-// textOrAction*
-// Terminates at {{end}} or {{else}}, returned separately.
-func (t *Tree) itemList() (list *ListNode, next Node) {
- list = t.newList(t.peekNonSpace().pos)
- for t.peekNonSpace().typ != itemEOF {
- n := t.textOrAction()
- switch n.Type() {
- case nodeEnd, nodeElse:
- return list, n
- }
- list.append(n)
- }
- t.errorf("unexpected EOF")
- return
-}
-
-// textOrAction:
-// text | action
-func (t *Tree) textOrAction() Node {
- switch token := t.nextNonSpace(); token.typ {
- case itemElideNewline:
- return t.elideNewline()
- case itemText:
- return t.newText(token.pos, token.val)
- case itemLeftDelim:
- return t.action()
- default:
- t.unexpected(token, "input")
- }
- return nil
-}
-
-// elideNewline:
-// Remove newlines trailing rightDelim if \\ is present.
-func (t *Tree) elideNewline() Node {
- token := t.peek()
- if token.typ != itemText {
- t.unexpected(token, "input")
- return nil
- }
-
- t.next()
- stripped := strings.TrimLeft(token.val, "\n\r")
- diff := len(token.val) - len(stripped)
- if diff > 0 {
- // This is a bit nasty. We mutate the token in-place to remove
- // preceding newlines.
- token.pos += Pos(diff)
- token.val = stripped
- }
- return t.newText(token.pos, token.val)
-}
-
-// Action:
-// control
-// command ("|" command)*
-// Left delim is past. Now get actions.
-// First word could be a keyword such as range.
-func (t *Tree) action() (n Node) {
- switch token := t.nextNonSpace(); token.typ {
- case itemElse:
- return t.elseControl()
- case itemEnd:
- return t.endControl()
- case itemIf:
- return t.ifControl()
- case itemRange:
- return t.rangeControl()
- case itemTemplate:
- return t.templateControl()
- case itemWith:
- return t.withControl()
- }
- t.backup()
- // Do not pop variables; they persist until "end".
- return t.newAction(t.peek().pos, t.lex.lineNumber(), t.pipeline("command"))
-}
-
-// Pipeline:
-// declarations? command ('|' command)*
-func (t *Tree) pipeline(context string) (pipe *PipeNode) {
- var decl []*VariableNode
- pos := t.peekNonSpace().pos
- // Are there declarations?
- for {
- if v := t.peekNonSpace(); v.typ == itemVariable {
- t.next()
- // Since space is a token, we need 3-token look-ahead here in the worst case:
- // in "$x foo" we need to read "foo" (as opposed to ":=") to know that $x is an
- // argument variable rather than a declaration. So remember the token
- // adjacent to the variable so we can push it back if necessary.
- tokenAfterVariable := t.peek()
- if next := t.peekNonSpace(); next.typ == itemColonEquals || (next.typ == itemChar && next.val == ",") {
- t.nextNonSpace()
- variable := t.newVariable(v.pos, v.val)
- decl = append(decl, variable)
- t.vars = append(t.vars, v.val)
- if next.typ == itemChar && next.val == "," {
- if context == "range" && len(decl) < 2 {
- continue
- }
- t.errorf("too many declarations in %s", context)
- }
- } else if tokenAfterVariable.typ == itemSpace {
- t.backup3(v, tokenAfterVariable)
- } else {
- t.backup2(v)
- }
- }
- break
- }
- pipe = t.newPipeline(pos, t.lex.lineNumber(), decl)
- for {
- switch token := t.nextNonSpace(); token.typ {
- case itemRightDelim, itemRightParen:
- if len(pipe.Cmds) == 0 {
- t.errorf("missing value for %s", context)
- }
- if token.typ == itemRightParen {
- t.backup()
- }
- return
- case itemBool, itemCharConstant, itemComplex, itemDot, itemField, itemIdentifier,
- itemNumber, itemNil, itemRawString, itemString, itemVariable, itemLeftParen:
- t.backup()
- pipe.append(t.command())
- default:
- t.unexpected(token, context)
- }
- }
-}
-
-func (t *Tree) parseControl(allowElseIf bool, context string) (pos Pos, line int, pipe *PipeNode, list, elseList *ListNode) {
- defer t.popVars(len(t.vars))
- line = t.lex.lineNumber()
- pipe = t.pipeline(context)
- var next Node
- list, next = t.itemList()
- switch next.Type() {
- case nodeEnd: //done
- case nodeElse:
- if allowElseIf {
- // Special case for "else if". If the "else" is followed immediately by an "if",
- // the elseControl will have left the "if" token pending. Treat
- // {{if a}}_{{else if b}}_{{end}}
- // as
- // {{if a}}_{{else}}{{if b}}_{{end}}{{end}}.
- // To do this, parse the if as usual and stop at it {{end}}; the subsequent{{end}}
- // is assumed. This technique works even for long if-else-if chains.
- // TODO: Should we allow else-if in with and range?
- if t.peek().typ == itemIf {
- t.next() // Consume the "if" token.
- elseList = t.newList(next.Position())
- elseList.append(t.ifControl())
- // Do not consume the next item - only one {{end}} required.
- break
- }
- }
- elseList, next = t.itemList()
- if next.Type() != nodeEnd {
- t.errorf("expected end; found %s", next)
- }
- }
- return pipe.Position(), line, pipe, list, elseList
-}
-
-// If:
-// {{if pipeline}} itemList {{end}}
-// {{if pipeline}} itemList {{else}} itemList {{end}}
-// If keyword is past.
-func (t *Tree) ifControl() Node {
- return t.newIf(t.parseControl(true, "if"))
-}
-
-// Range:
-// {{range pipeline}} itemList {{end}}
-// {{range pipeline}} itemList {{else}} itemList {{end}}
-// Range keyword is past.
-func (t *Tree) rangeControl() Node {
- return t.newRange(t.parseControl(false, "range"))
-}
-
-// With:
-// {{with pipeline}} itemList {{end}}
-// {{with pipeline}} itemList {{else}} itemList {{end}}
-// If keyword is past.
-func (t *Tree) withControl() Node {
- return t.newWith(t.parseControl(false, "with"))
-}
-
-// End:
-// {{end}}
-// End keyword is past.
-func (t *Tree) endControl() Node {
- return t.newEnd(t.expect(itemRightDelim, "end").pos)
-}
-
-// Else:
-// {{else}}
-// Else keyword is past.
-func (t *Tree) elseControl() Node {
- // Special case for "else if".
- peek := t.peekNonSpace()
- if peek.typ == itemIf {
- // We see "{{else if ... " but in effect rewrite it to {{else}}{{if ... ".
- return t.newElse(peek.pos, t.lex.lineNumber())
- }
- return t.newElse(t.expect(itemRightDelim, "else").pos, t.lex.lineNumber())
-}
-
-// Template:
-// {{template stringValue pipeline}}
-// Template keyword is past. The name must be something that can evaluate
-// to a string.
-func (t *Tree) templateControl() Node {
- var name string
- token := t.nextNonSpace()
- switch token.typ {
- case itemString, itemRawString:
- s, err := strconv.Unquote(token.val)
- if err != nil {
- t.error(err)
- }
- name = s
- default:
- t.unexpected(token, "template invocation")
- }
- var pipe *PipeNode
- if t.nextNonSpace().typ != itemRightDelim {
- t.backup()
- // Do not pop variables; they persist until "end".
- pipe = t.pipeline("template")
- }
- return t.newTemplate(token.pos, t.lex.lineNumber(), name, pipe)
-}
-
-// command:
-// operand (space operand)*
-// space-separated arguments up to a pipeline character or right delimiter.
-// we consume the pipe character but leave the right delim to terminate the action.
-func (t *Tree) command() *CommandNode {
- cmd := t.newCommand(t.peekNonSpace().pos)
- for {
- t.peekNonSpace() // skip leading spaces.
- operand := t.operand()
- if operand != nil {
- cmd.append(operand)
- }
- switch token := t.next(); token.typ {
- case itemSpace:
- continue
- case itemError:
- t.errorf("%s", token.val)
- case itemRightDelim, itemRightParen:
- t.backup()
- case itemPipe:
- default:
- t.errorf("unexpected %s in operand; missing space?", token)
- }
- break
- }
- if len(cmd.Args) == 0 {
- t.errorf("empty command")
- }
- return cmd
-}
-
-// operand:
-// term .Field*
-// An operand is a space-separated component of a command,
-// a term possibly followed by field accesses.
-// A nil return means the next item is not an operand.
-func (t *Tree) operand() Node {
- node := t.term()
- if node == nil {
- return nil
- }
- if t.peek().typ == itemField {
- chain := t.newChain(t.peek().pos, node)
- for t.peek().typ == itemField {
- chain.Add(t.next().val)
- }
- // Compatibility with original API: If the term is of type NodeField
- // or NodeVariable, just put more fields on the original.
- // Otherwise, keep the Chain node.
- // TODO: Switch to Chains always when we can.
- switch node.Type() {
- case NodeField:
- node = t.newField(chain.Position(), chain.String())
- case NodeVariable:
- node = t.newVariable(chain.Position(), chain.String())
- default:
- node = chain
- }
- }
- return node
-}
-
-// term:
-// literal (number, string, nil, boolean)
-// function (identifier)
-// .
-// .Field
-// $
-// '(' pipeline ')'
-// A term is a simple "expression".
-// A nil return means the next item is not a term.
-func (t *Tree) term() Node {
- switch token := t.nextNonSpace(); token.typ {
- case itemError:
- t.errorf("%s", token.val)
- case itemIdentifier:
- if !t.hasFunction(token.val) {
- t.errorf("function %q not defined", token.val)
- }
- return NewIdentifier(token.val).SetTree(t).SetPos(token.pos)
- case itemDot:
- return t.newDot(token.pos)
- case itemNil:
- return t.newNil(token.pos)
- case itemVariable:
- return t.useVar(token.pos, token.val)
- case itemField:
- return t.newField(token.pos, token.val)
- case itemBool:
- return t.newBool(token.pos, token.val == "true")
- case itemCharConstant, itemComplex, itemNumber:
- number, err := t.newNumber(token.pos, token.val, token.typ)
- if err != nil {
- t.error(err)
- }
- return number
- case itemLeftParen:
- pipe := t.pipeline("parenthesized pipeline")
- if token := t.next(); token.typ != itemRightParen {
- t.errorf("unclosed right paren: unexpected %s", token)
- }
- return pipe
- case itemString, itemRawString:
- s, err := strconv.Unquote(token.val)
- if err != nil {
- t.error(err)
- }
- return t.newString(token.pos, token.val, s)
- }
- t.backup()
- return nil
-}
-
-// hasFunction reports if a function name exists in the Tree's maps.
-func (t *Tree) hasFunction(name string) bool {
- for _, funcMap := range t.funcs {
- if funcMap == nil {
- continue
- }
- if funcMap[name] != nil {
- return true
- }
- }
- return false
-}
-
-// popVars trims the variable list to the specified length
-func (t *Tree) popVars(n int) {
- t.vars = t.vars[:n]
-}
-
-// useVar returns a node for a variable reference. It errors if the
-// variable is not defined.
-func (t *Tree) useVar(pos Pos, name string) Node {
- v := t.newVariable(pos, name)
- for _, varName := range t.vars {
- if varName == v.Ident[0] {
- return v
- }
- }
- t.errorf("undefined variable %q", v.Ident[0])
- return nil
-}
diff --git a/vendor/github.com/alecthomas/template/template.go b/vendor/github.com/alecthomas/template/template.go
deleted file mode 100644
index 447ed2a..0000000
--- a/vendor/github.com/alecthomas/template/template.go
+++ /dev/null
@@ -1,218 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package template
-
-import (
- "fmt"
- "reflect"
-
- "github.com/alecthomas/template/parse"
-)
-
-// common holds the information shared by related templates.
-type common struct {
- tmpl map[string]*Template
- // We use two maps, one for parsing and one for execution.
- // This separation makes the API cleaner since it doesn't
- // expose reflection to the client.
- parseFuncs FuncMap
- execFuncs map[string]reflect.Value
-}
-
-// Template is the representation of a parsed template. The *parse.Tree
-// field is exported only for use by html/template and should be treated
-// as unexported by all other clients.
-type Template struct {
- name string
- *parse.Tree
- *common
- leftDelim string
- rightDelim string
-}
-
-// New allocates a new template with the given name.
-func New(name string) *Template {
- return &Template{
- name: name,
- }
-}
-
-// Name returns the name of the template.
-func (t *Template) Name() string {
- return t.name
-}
-
-// New allocates a new template associated with the given one and with the same
-// delimiters. The association, which is transitive, allows one template to
-// invoke another with a {{template}} action.
-func (t *Template) New(name string) *Template {
- t.init()
- return &Template{
- name: name,
- common: t.common,
- leftDelim: t.leftDelim,
- rightDelim: t.rightDelim,
- }
-}
-
-func (t *Template) init() {
- if t.common == nil {
- t.common = new(common)
- t.tmpl = make(map[string]*Template)
- t.parseFuncs = make(FuncMap)
- t.execFuncs = make(map[string]reflect.Value)
- }
-}
-
-// Clone returns a duplicate of the template, including all associated
-// templates. The actual representation is not copied, but the name space of
-// associated templates is, so further calls to Parse in the copy will add
-// templates to the copy but not to the original. Clone can be used to prepare
-// common templates and use them with variant definitions for other templates
-// by adding the variants after the clone is made.
-func (t *Template) Clone() (*Template, error) {
- nt := t.copy(nil)
- nt.init()
- nt.tmpl[t.name] = nt
- for k, v := range t.tmpl {
- if k == t.name { // Already installed.
- continue
- }
- // The associated templates share nt's common structure.
- tmpl := v.copy(nt.common)
- nt.tmpl[k] = tmpl
- }
- for k, v := range t.parseFuncs {
- nt.parseFuncs[k] = v
- }
- for k, v := range t.execFuncs {
- nt.execFuncs[k] = v
- }
- return nt, nil
-}
-
-// copy returns a shallow copy of t, with common set to the argument.
-func (t *Template) copy(c *common) *Template {
- nt := New(t.name)
- nt.Tree = t.Tree
- nt.common = c
- nt.leftDelim = t.leftDelim
- nt.rightDelim = t.rightDelim
- return nt
-}
-
-// AddParseTree creates a new template with the name and parse tree
-// and associates it with t.
-func (t *Template) AddParseTree(name string, tree *parse.Tree) (*Template, error) {
- if t.common != nil && t.tmpl[name] != nil {
- return nil, fmt.Errorf("template: redefinition of template %q", name)
- }
- nt := t.New(name)
- nt.Tree = tree
- t.tmpl[name] = nt
- return nt, nil
-}
-
-// Templates returns a slice of the templates associated with t, including t
-// itself.
-func (t *Template) Templates() []*Template {
- if t.common == nil {
- return nil
- }
- // Return a slice so we don't expose the map.
- m := make([]*Template, 0, len(t.tmpl))
- for _, v := range t.tmpl {
- m = append(m, v)
- }
- return m
-}
-
-// Delims sets the action delimiters to the specified strings, to be used in
-// subsequent calls to Parse, ParseFiles, or ParseGlob. Nested template
-// definitions will inherit the settings. An empty delimiter stands for the
-// corresponding default: {{ or }}.
-// The return value is the template, so calls can be chained.
-func (t *Template) Delims(left, right string) *Template {
- t.leftDelim = left
- t.rightDelim = right
- return t
-}
-
-// Funcs adds the elements of the argument map to the template's function map.
-// It panics if a value in the map is not a function with appropriate return
-// type. However, it is legal to overwrite elements of the map. The return
-// value is the template, so calls can be chained.
-func (t *Template) Funcs(funcMap FuncMap) *Template {
- t.init()
- addValueFuncs(t.execFuncs, funcMap)
- addFuncs(t.parseFuncs, funcMap)
- return t
-}
-
-// Lookup returns the template with the given name that is associated with t,
-// or nil if there is no such template.
-func (t *Template) Lookup(name string) *Template {
- if t.common == nil {
- return nil
- }
- return t.tmpl[name]
-}
-
-// Parse parses a string into a template. Nested template definitions will be
-// associated with the top-level template t. Parse may be called multiple times
-// to parse definitions of templates to associate with t. It is an error if a
-// resulting template is non-empty (contains content other than template
-// definitions) and would replace a non-empty template with the same name.
-// (In multiple calls to Parse with the same receiver template, only one call
-// can contain text other than space, comments, and template definitions.)
-func (t *Template) Parse(text string) (*Template, error) {
- t.init()
- trees, err := parse.Parse(t.name, text, t.leftDelim, t.rightDelim, t.parseFuncs, builtins)
- if err != nil {
- return nil, err
- }
- // Add the newly parsed trees, including the one for t, into our common structure.
- for name, tree := range trees {
- // If the name we parsed is the name of this template, overwrite this template.
- // The associate method checks it's not a redefinition.
- tmpl := t
- if name != t.name {
- tmpl = t.New(name)
- }
- // Even if t == tmpl, we need to install it in the common.tmpl map.
- if replace, err := t.associate(tmpl, tree); err != nil {
- return nil, err
- } else if replace {
- tmpl.Tree = tree
- }
- tmpl.leftDelim = t.leftDelim
- tmpl.rightDelim = t.rightDelim
- }
- return t, nil
-}
-
-// associate installs the new template into the group of templates associated
-// with t. It is an error to reuse a name except to overwrite an empty
-// template. The two are already known to share the common structure.
-// The boolean return value reports wither to store this tree as t.Tree.
-func (t *Template) associate(new *Template, tree *parse.Tree) (bool, error) {
- if new.common != t.common {
- panic("internal error: associate not common")
- }
- name := new.name
- if old := t.tmpl[name]; old != nil {
- oldIsEmpty := parse.IsEmptyTree(old.Root)
- newIsEmpty := parse.IsEmptyTree(tree.Root)
- if newIsEmpty {
- // Whether old is empty or not, new is empty; no reason to replace old.
- return false, nil
- }
- if !oldIsEmpty {
- return false, fmt.Errorf("template: redefinition of template %q", name)
- }
- }
- t.tmpl[name] = new
- return true, nil
-}
diff --git a/vendor/github.com/alecthomas/units/COPYING b/vendor/github.com/alecthomas/units/COPYING
deleted file mode 100644
index 2993ec0..0000000
--- a/vendor/github.com/alecthomas/units/COPYING
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (C) 2014 Alec Thomas
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/github.com/alecthomas/units/README.md b/vendor/github.com/alecthomas/units/README.md
deleted file mode 100644
index bee884e..0000000
--- a/vendor/github.com/alecthomas/units/README.md
+++ /dev/null
@@ -1,11 +0,0 @@
-# Units - Helpful unit multipliers and functions for Go
-
-The goal of this package is to have functionality similar to the [time](http://golang.org/pkg/time/) package.
-
-It allows for code like this:
-
-```go
-n, err := ParseBase2Bytes("1KB")
-// n == 1024
-n = units.Mebibyte * 512
-```
diff --git a/vendor/github.com/alecthomas/units/bytes.go b/vendor/github.com/alecthomas/units/bytes.go
deleted file mode 100644
index eaadeb8..0000000
--- a/vendor/github.com/alecthomas/units/bytes.go
+++ /dev/null
@@ -1,83 +0,0 @@
-package units
-
-// Base2Bytes is the old non-SI power-of-2 byte scale (1024 bytes in a kilobyte,
-// etc.).
-type Base2Bytes int64
-
-// Base-2 byte units.
-const (
- Kibibyte Base2Bytes = 1024
- KiB = Kibibyte
- Mebibyte = Kibibyte * 1024
- MiB = Mebibyte
- Gibibyte = Mebibyte * 1024
- GiB = Gibibyte
- Tebibyte = Gibibyte * 1024
- TiB = Tebibyte
- Pebibyte = Tebibyte * 1024
- PiB = Pebibyte
- Exbibyte = Pebibyte * 1024
- EiB = Exbibyte
-)
-
-var (
- bytesUnitMap = MakeUnitMap("iB", "B", 1024)
- oldBytesUnitMap = MakeUnitMap("B", "B", 1024)
-)
-
-// ParseBase2Bytes supports both iB and B in base-2 multipliers. That is, KB
-// and KiB are both 1024.
-func ParseBase2Bytes(s string) (Base2Bytes, error) {
- n, err := ParseUnit(s, bytesUnitMap)
- if err != nil {
- n, err = ParseUnit(s, oldBytesUnitMap)
- }
- return Base2Bytes(n), err
-}
-
-func (b Base2Bytes) String() string {
- return ToString(int64(b), 1024, "iB", "B")
-}
-
-var (
- metricBytesUnitMap = MakeUnitMap("B", "B", 1000)
-)
-
-// MetricBytes are SI byte units (1000 bytes in a kilobyte).
-type MetricBytes SI
-
-// SI base-10 byte units.
-const (
- Kilobyte MetricBytes = 1000
- KB = Kilobyte
- Megabyte = Kilobyte * 1000
- MB = Megabyte
- Gigabyte = Megabyte * 1000
- GB = Gigabyte
- Terabyte = Gigabyte * 1000
- TB = Terabyte
- Petabyte = Terabyte * 1000
- PB = Petabyte
- Exabyte = Petabyte * 1000
- EB = Exabyte
-)
-
-// ParseMetricBytes parses base-10 metric byte units. That is, KB is 1000 bytes.
-func ParseMetricBytes(s string) (MetricBytes, error) {
- n, err := ParseUnit(s, metricBytesUnitMap)
- return MetricBytes(n), err
-}
-
-func (m MetricBytes) String() string {
- return ToString(int64(m), 1000, "B", "B")
-}
-
-// ParseStrictBytes supports both iB and B suffixes for base 2 and metric,
-// respectively. That is, KiB represents 1024 and KB represents 1000.
-func ParseStrictBytes(s string) (int64, error) {
- n, err := ParseUnit(s, bytesUnitMap)
- if err != nil {
- n, err = ParseUnit(s, metricBytesUnitMap)
- }
- return int64(n), err
-}
diff --git a/vendor/github.com/alecthomas/units/doc.go b/vendor/github.com/alecthomas/units/doc.go
deleted file mode 100644
index 156ae38..0000000
--- a/vendor/github.com/alecthomas/units/doc.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// Package units provides helpful unit multipliers and functions for Go.
-//
-// The goal of this package is to have functionality similar to the time [1] package.
-//
-//
-// [1] http://golang.org/pkg/time/
-//
-// It allows for code like this:
-//
-// n, err := ParseBase2Bytes("1KB")
-// // n == 1024
-// n = units.Mebibyte * 512
-package units
diff --git a/vendor/github.com/alecthomas/units/go.mod b/vendor/github.com/alecthomas/units/go.mod
deleted file mode 100644
index f572173..0000000
--- a/vendor/github.com/alecthomas/units/go.mod
+++ /dev/null
@@ -1 +0,0 @@
-module github.com/alecthomas/units
diff --git a/vendor/github.com/alecthomas/units/si.go b/vendor/github.com/alecthomas/units/si.go
deleted file mode 100644
index 8234a9d..0000000
--- a/vendor/github.com/alecthomas/units/si.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package units
-
-// SI units.
-type SI int64
-
-// SI unit multiples.
-const (
- Kilo SI = 1000
- Mega = Kilo * 1000
- Giga = Mega * 1000
- Tera = Giga * 1000
- Peta = Tera * 1000
- Exa = Peta * 1000
-)
-
-func MakeUnitMap(suffix, shortSuffix string, scale int64) map[string]float64 {
- return map[string]float64{
- shortSuffix: 1,
- "K" + suffix: float64(scale),
- "M" + suffix: float64(scale * scale),
- "G" + suffix: float64(scale * scale * scale),
- "T" + suffix: float64(scale * scale * scale * scale),
- "P" + suffix: float64(scale * scale * scale * scale * scale),
- "E" + suffix: float64(scale * scale * scale * scale * scale * scale),
- }
-}
diff --git a/vendor/github.com/alecthomas/units/util.go b/vendor/github.com/alecthomas/units/util.go
deleted file mode 100644
index 6527e92..0000000
--- a/vendor/github.com/alecthomas/units/util.go
+++ /dev/null
@@ -1,138 +0,0 @@
-package units
-
-import (
- "errors"
- "fmt"
- "strings"
-)
-
-var (
- siUnits = []string{"", "K", "M", "G", "T", "P", "E"}
-)
-
-func ToString(n int64, scale int64, suffix, baseSuffix string) string {
- mn := len(siUnits)
- out := make([]string, mn)
- for i, m := range siUnits {
- if n%scale != 0 || i == 0 && n == 0 {
- s := suffix
- if i == 0 {
- s = baseSuffix
- }
- out[mn-1-i] = fmt.Sprintf("%d%s%s", n%scale, m, s)
- }
- n /= scale
- if n == 0 {
- break
- }
- }
- return strings.Join(out, "")
-}
-
-// Below code ripped straight from http://golang.org/src/pkg/time/format.go?s=33392:33438#L1123
-var errLeadingInt = errors.New("units: bad [0-9]*") // never printed
-
-// leadingInt consumes the leading [0-9]* from s.
-func leadingInt(s string) (x int64, rem string, err error) {
- i := 0
- for ; i < len(s); i++ {
- c := s[i]
- if c < '0' || c > '9' {
- break
- }
- if x >= (1<<63-10)/10 {
- // overflow
- return 0, "", errLeadingInt
- }
- x = x*10 + int64(c) - '0'
- }
- return x, s[i:], nil
-}
-
-func ParseUnit(s string, unitMap map[string]float64) (int64, error) {
- // [-+]?([0-9]*(\.[0-9]*)?[a-z]+)+
- orig := s
- f := float64(0)
- neg := false
-
- // Consume [-+]?
- if s != "" {
- c := s[0]
- if c == '-' || c == '+' {
- neg = c == '-'
- s = s[1:]
- }
- }
- // Special case: if all that is left is "0", this is zero.
- if s == "0" {
- return 0, nil
- }
- if s == "" {
- return 0, errors.New("units: invalid " + orig)
- }
- for s != "" {
- g := float64(0) // this element of the sequence
-
- var x int64
- var err error
-
- // The next character must be [0-9.]
- if !(s[0] == '.' || ('0' <= s[0] && s[0] <= '9')) {
- return 0, errors.New("units: invalid " + orig)
- }
- // Consume [0-9]*
- pl := len(s)
- x, s, err = leadingInt(s)
- if err != nil {
- return 0, errors.New("units: invalid " + orig)
- }
- g = float64(x)
- pre := pl != len(s) // whether we consumed anything before a period
-
- // Consume (\.[0-9]*)?
- post := false
- if s != "" && s[0] == '.' {
- s = s[1:]
- pl := len(s)
- x, s, err = leadingInt(s)
- if err != nil {
- return 0, errors.New("units: invalid " + orig)
- }
- scale := 1.0
- for n := pl - len(s); n > 0; n-- {
- scale *= 10
- }
- g += float64(x) / scale
- post = pl != len(s)
- }
- if !pre && !post {
- // no digits (e.g. ".s" or "-.s")
- return 0, errors.New("units: invalid " + orig)
- }
-
- // Consume unit.
- i := 0
- for ; i < len(s); i++ {
- c := s[i]
- if c == '.' || ('0' <= c && c <= '9') {
- break
- }
- }
- u := s[:i]
- s = s[i:]
- unit, ok := unitMap[u]
- if !ok {
- return 0, errors.New("units: unknown unit " + u + " in " + orig)
- }
-
- f += g * unit
- }
-
- if neg {
- f = -f
- }
- if f < float64(-1<<63) || f > float64(1<<63-1) {
- return 0, errors.New("units: overflow parsing unit")
- }
- return int64(f), nil
-}
diff --git a/vendor/github.com/beorn7/perks/LICENSE b/vendor/github.com/beorn7/perks/LICENSE
deleted file mode 100644
index 339177b..0000000
--- a/vendor/github.com/beorn7/perks/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (C) 2013 Blake Mizerany
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/github.com/beorn7/perks/quantile/exampledata.txt b/vendor/github.com/beorn7/perks/quantile/exampledata.txt
deleted file mode 100644
index 1602287..0000000
--- a/vendor/github.com/beorn7/perks/quantile/exampledata.txt
+++ /dev/null
@@ -1,2388 +0,0 @@
-8
-5
-26
-12
-5
-235
-13
-6
-28
-30
-3
-3
-3
-3
-5
-2
-33
-7
-2
-4
-7
-12
-14
-5
-8
-3
-10
-4
-5
-3
-6
-6
-209
-20
-3
-10
-14
-3
-4
-6
-8
-5
-11
-7
-3
-2
-3
-3
-212
-5
-222
-4
-10
-10
-5
-6
-3
-8
-3
-10
-254
-220
-2
-3
-5
-24
-5
-4
-222
-7
-3
-3
-223
-8
-15
-12
-14
-14
-3
-2
-2
-3
-13
-3
-11
-4
-4
-6
-5
-7
-13
-5
-3
-5
-2
-5
-3
-5
-2
-7
-15
-17
-14
-3
-6
-6
-3
-17
-5
-4
-7
-6
-4
-4
-8
-6
-8
-3
-9
-3
-6
-3
-4
-5
-3
-3
-660
-4
-6
-10
-3
-6
-3
-2
-5
-13
-2
-4
-4
-10
-4
-8
-4
-3
-7
-9
-9
-3
-10
-37
-3
-13
-4
-12
-3
-6
-10
-8
-5
-21
-2
-3
-8
-3
-2
-3
-3
-4
-12
-2
-4
-8
-8
-4
-3
-2
-20
-1
-6
-32
-2
-11
-6
-18
-3
-8
-11
-3
-212
-3
-4
-2
-6
-7
-12
-11
-3
-2
-16
-10
-6
-4
-6
-3
-2
-7
-3
-2
-2
-2
-2
-5
-6
-4
-3
-10
-3
-4
-6
-5
-3
-4
-4
-5
-6
-4
-3
-4
-4
-5
-7
-5
-5
-3
-2
-7
-2
-4
-12
-4
-5
-6
-2
-4
-4
-8
-4
-15
-13
-7
-16
-5
-3
-23
-5
-5
-7
-3
-2
-9
-8
-7
-5
-8
-11
-4
-10
-76
-4
-47
-4
-3
-2
-7
-4
-2
-3
-37
-10
-4
-2
-20
-5
-4
-4
-10
-10
-4
-3
-7
-23
-240
-7
-13
-5
-5
-3
-3
-2
-5
-4
-2
-8
-7
-19
-2
-23
-8
-7
-2
-5
-3
-8
-3
-8
-13
-5
-5
-5
-2
-3
-23
-4
-9
-8
-4
-3
-3
-5
-220
-2
-3
-4
-6
-14
-3
-53
-6
-2
-5
-18
-6
-3
-219
-6
-5
-2
-5
-3
-6
-5
-15
-4
-3
-17
-3
-2
-4
-7
-2
-3
-3
-4
-4
-3
-2
-664
-6
-3
-23
-5
-5
-16
-5
-8
-2
-4
-2
-24
-12
-3
-2
-3
-5
-8
-3
-5
-4
-3
-14
-3
-5
-8
-2
-3
-7
-9
-4
-2
-3
-6
-8
-4
-3
-4
-6
-5
-3
-3
-6
-3
-19
-4
-4
-6
-3
-6
-3
-5
-22
-5
-4
-4
-3
-8
-11
-4
-9
-7
-6
-13
-4
-4
-4
-6
-17
-9
-3
-3
-3
-4
-3
-221
-5
-11
-3
-4
-2
-12
-6
-3
-5
-7
-5
-7
-4
-9
-7
-14
-37
-19
-217
-16
-3
-5
-2
-2
-7
-19
-7
-6
-7
-4
-24
-5
-11
-4
-7
-7
-9
-13
-3
-4
-3
-6
-28
-4
-4
-5
-5
-2
-5
-6
-4
-4
-6
-10
-5
-4
-3
-2
-3
-3
-6
-5
-5
-4
-3
-2
-3
-7
-4
-6
-18
-16
-8
-16
-4
-5
-8
-6
-9
-13
-1545
-6
-215
-6
-5
-6
-3
-45
-31
-5
-2
-2
-4
-3
-3
-2
-5
-4
-3
-5
-7
-7
-4
-5
-8
-5
-4
-749
-2
-31
-9
-11
-2
-11
-5
-4
-4
-7
-9
-11
-4
-5
-4
-7
-3
-4
-6
-2
-15
-3
-4
-3
-4
-3
-5
-2
-13
-5
-5
-3
-3
-23
-4
-4
-5
-7
-4
-13
-2
-4
-3
-4
-2
-6
-2
-7
-3
-5
-5
-3
-29
-5
-4
-4
-3
-10
-2
-3
-79
-16
-6
-6
-7
-7
-3
-5
-5
-7
-4
-3
-7
-9
-5
-6
-5
-9
-6
-3
-6
-4
-17
-2
-10
-9
-3
-6
-2
-3
-21
-22
-5
-11
-4
-2
-17
-2
-224
-2
-14
-3
-4
-4
-2
-4
-4
-4
-4
-5
-3
-4
-4
-10
-2
-6
-3
-3
-5
-7
-2
-7
-5
-6
-3
-218
-2
-2
-5
-2
-6
-3
-5
-222
-14
-6
-33
-3
-2
-5
-3
-3
-3
-9
-5
-3
-3
-2
-7
-4
-3
-4
-3
-5
-6
-5
-26
-4
-13
-9
-7
-3
-221
-3
-3
-4
-4
-4
-4
-2
-18
-5
-3
-7
-9
-6
-8
-3
-10
-3
-11
-9
-5
-4
-17
-5
-5
-6
-6
-3
-2
-4
-12
-17
-6
-7
-218
-4
-2
-4
-10
-3
-5
-15
-3
-9
-4
-3
-3
-6
-29
-3
-3
-4
-5
-5
-3
-8
-5
-6
-6
-7
-5
-3
-5
-3
-29
-2
-31
-5
-15
-24
-16
-5
-207
-4
-3
-3
-2
-15
-4
-4
-13
-5
-5
-4
-6
-10
-2
-7
-8
-4
-6
-20
-5
-3
-4
-3
-12
-12
-5
-17
-7
-3
-3
-3
-6
-10
-3
-5
-25
-80
-4
-9
-3
-2
-11
-3
-3
-2
-3
-8
-7
-5
-5
-19
-5
-3
-3
-12
-11
-2
-6
-5
-5
-5
-3
-3
-3
-4
-209
-14
-3
-2
-5
-19
-4
-4
-3
-4
-14
-5
-6
-4
-13
-9
-7
-4
-7
-10
-2
-9
-5
-7
-2
-8
-4
-6
-5
-5
-222
-8
-7
-12
-5
-216
-3
-4
-4
-6
-3
-14
-8
-7
-13
-4
-3
-3
-3
-3
-17
-5
-4
-3
-33
-6
-6
-33
-7
-5
-3
-8
-7
-5
-2
-9
-4
-2
-233
-24
-7
-4
-8
-10
-3
-4
-15
-2
-16
-3
-3
-13
-12
-7
-5
-4
-207
-4
-2
-4
-27
-15
-2
-5
-2
-25
-6
-5
-5
-6
-13
-6
-18
-6
-4
-12
-225
-10
-7
-5
-2
-2
-11
-4
-14
-21
-8
-10
-3
-5
-4
-232
-2
-5
-5
-3
-7
-17
-11
-6
-6
-23
-4
-6
-3
-5
-4
-2
-17
-3
-6
-5
-8
-3
-2
-2
-14
-9
-4
-4
-2
-5
-5
-3
-7
-6
-12
-6
-10
-3
-6
-2
-2
-19
-5
-4
-4
-9
-2
-4
-13
-3
-5
-6
-3
-6
-5
-4
-9
-6
-3
-5
-7
-3
-6
-6
-4
-3
-10
-6
-3
-221
-3
-5
-3
-6
-4
-8
-5
-3
-6
-4
-4
-2
-54
-5
-6
-11
-3
-3
-4
-4
-4
-3
-7
-3
-11
-11
-7
-10
-6
-13
-223
-213
-15
-231
-7
-3
-7
-228
-2
-3
-4
-4
-5
-6
-7
-4
-13
-3
-4
-5
-3
-6
-4
-6
-7
-2
-4
-3
-4
-3
-3
-6
-3
-7
-3
-5
-18
-5
-6
-8
-10
-3
-3
-3
-2
-4
-2
-4
-4
-5
-6
-6
-4
-10
-13
-3
-12
-5
-12
-16
-8
-4
-19
-11
-2
-4
-5
-6
-8
-5
-6
-4
-18
-10
-4
-2
-216
-6
-6
-6
-2
-4
-12
-8
-3
-11
-5
-6
-14
-5
-3
-13
-4
-5
-4
-5
-3
-28
-6
-3
-7
-219
-3
-9
-7
-3
-10
-6
-3
-4
-19
-5
-7
-11
-6
-15
-19
-4
-13
-11
-3
-7
-5
-10
-2
-8
-11
-2
-6
-4
-6
-24
-6
-3
-3
-3
-3
-6
-18
-4
-11
-4
-2
-5
-10
-8
-3
-9
-5
-3
-4
-5
-6
-2
-5
-7
-4
-4
-14
-6
-4
-4
-5
-5
-7
-2
-4
-3
-7
-3
-3
-6
-4
-5
-4
-4
-4
-3
-3
-3
-3
-8
-14
-2
-3
-5
-3
-2
-4
-5
-3
-7
-3
-3
-18
-3
-4
-4
-5
-7
-3
-3
-3
-13
-5
-4
-8
-211
-5
-5
-3
-5
-2
-5
-4
-2
-655
-6
-3
-5
-11
-2
-5
-3
-12
-9
-15
-11
-5
-12
-217
-2
-6
-17
-3
-3
-207
-5
-5
-4
-5
-9
-3
-2
-8
-5
-4
-3
-2
-5
-12
-4
-14
-5
-4
-2
-13
-5
-8
-4
-225
-4
-3
-4
-5
-4
-3
-3
-6
-23
-9
-2
-6
-7
-233
-4
-4
-6
-18
-3
-4
-6
-3
-4
-4
-2
-3
-7
-4
-13
-227
-4
-3
-5
-4
-2
-12
-9
-17
-3
-7
-14
-6
-4
-5
-21
-4
-8
-9
-2
-9
-25
-16
-3
-6
-4
-7
-8
-5
-2
-3
-5
-4
-3
-3
-5
-3
-3
-3
-2
-3
-19
-2
-4
-3
-4
-2
-3
-4
-4
-2
-4
-3
-3
-3
-2
-6
-3
-17
-5
-6
-4
-3
-13
-5
-3
-3
-3
-4
-9
-4
-2
-14
-12
-4
-5
-24
-4
-3
-37
-12
-11
-21
-3
-4
-3
-13
-4
-2
-3
-15
-4
-11
-4
-4
-3
-8
-3
-4
-4
-12
-8
-5
-3
-3
-4
-2
-220
-3
-5
-223
-3
-3
-3
-10
-3
-15
-4
-241
-9
-7
-3
-6
-6
-23
-4
-13
-7
-3
-4
-7
-4
-9
-3
-3
-4
-10
-5
-5
-1
-5
-24
-2
-4
-5
-5
-6
-14
-3
-8
-2
-3
-5
-13
-13
-3
-5
-2
-3
-15
-3
-4
-2
-10
-4
-4
-4
-5
-5
-3
-5
-3
-4
-7
-4
-27
-3
-6
-4
-15
-3
-5
-6
-6
-5
-4
-8
-3
-9
-2
-6
-3
-4
-3
-7
-4
-18
-3
-11
-3
-3
-8
-9
-7
-24
-3
-219
-7
-10
-4
-5
-9
-12
-2
-5
-4
-4
-4
-3
-3
-19
-5
-8
-16
-8
-6
-22
-3
-23
-3
-242
-9
-4
-3
-3
-5
-7
-3
-3
-5
-8
-3
-7
-5
-14
-8
-10
-3
-4
-3
-7
-4
-6
-7
-4
-10
-4
-3
-11
-3
-7
-10
-3
-13
-6
-8
-12
-10
-5
-7
-9
-3
-4
-7
-7
-10
-8
-30
-9
-19
-4
-3
-19
-15
-4
-13
-3
-215
-223
-4
-7
-4
-8
-17
-16
-3
-7
-6
-5
-5
-4
-12
-3
-7
-4
-4
-13
-4
-5
-2
-5
-6
-5
-6
-6
-7
-10
-18
-23
-9
-3
-3
-6
-5
-2
-4
-2
-7
-3
-3
-2
-5
-5
-14
-10
-224
-6
-3
-4
-3
-7
-5
-9
-3
-6
-4
-2
-5
-11
-4
-3
-3
-2
-8
-4
-7
-4
-10
-7
-3
-3
-18
-18
-17
-3
-3
-3
-4
-5
-3
-3
-4
-12
-7
-3
-11
-13
-5
-4
-7
-13
-5
-4
-11
-3
-12
-3
-6
-4
-4
-21
-4
-6
-9
-5
-3
-10
-8
-4
-6
-4
-4
-6
-5
-4
-8
-6
-4
-6
-4
-4
-5
-9
-6
-3
-4
-2
-9
-3
-18
-2
-4
-3
-13
-3
-6
-6
-8
-7
-9
-3
-2
-16
-3
-4
-6
-3
-2
-33
-22
-14
-4
-9
-12
-4
-5
-6
-3
-23
-9
-4
-3
-5
-5
-3
-4
-5
-3
-5
-3
-10
-4
-5
-5
-8
-4
-4
-6
-8
-5
-4
-3
-4
-6
-3
-3
-3
-5
-9
-12
-6
-5
-9
-3
-5
-3
-2
-2
-2
-18
-3
-2
-21
-2
-5
-4
-6
-4
-5
-10
-3
-9
-3
-2
-10
-7
-3
-6
-6
-4
-4
-8
-12
-7
-3
-7
-3
-3
-9
-3
-4
-5
-4
-4
-5
-5
-10
-15
-4
-4
-14
-6
-227
-3
-14
-5
-216
-22
-5
-4
-2
-2
-6
-3
-4
-2
-9
-9
-4
-3
-28
-13
-11
-4
-5
-3
-3
-2
-3
-3
-5
-3
-4
-3
-5
-23
-26
-3
-4
-5
-6
-4
-6
-3
-5
-5
-3
-4
-3
-2
-2
-2
-7
-14
-3
-6
-7
-17
-2
-2
-15
-14
-16
-4
-6
-7
-13
-6
-4
-5
-6
-16
-3
-3
-28
-3
-6
-15
-3
-9
-2
-4
-6
-3
-3
-22
-4
-12
-6
-7
-2
-5
-4
-10
-3
-16
-6
-9
-2
-5
-12
-7
-5
-5
-5
-5
-2
-11
-9
-17
-4
-3
-11
-7
-3
-5
-15
-4
-3
-4
-211
-8
-7
-5
-4
-7
-6
-7
-6
-3
-6
-5
-6
-5
-3
-4
-4
-26
-4
-6
-10
-4
-4
-3
-2
-3
-3
-4
-5
-9
-3
-9
-4
-4
-5
-5
-8
-2
-4
-2
-3
-8
-4
-11
-19
-5
-8
-6
-3
-5
-6
-12
-3
-2
-4
-16
-12
-3
-4
-4
-8
-6
-5
-6
-6
-219
-8
-222
-6
-16
-3
-13
-19
-5
-4
-3
-11
-6
-10
-4
-7
-7
-12
-5
-3
-3
-5
-6
-10
-3
-8
-2
-5
-4
-7
-2
-4
-4
-2
-12
-9
-6
-4
-2
-40
-2
-4
-10
-4
-223
-4
-2
-20
-6
-7
-24
-5
-4
-5
-2
-20
-16
-6
-5
-13
-2
-3
-3
-19
-3
-2
-4
-5
-6
-7
-11
-12
-5
-6
-7
-7
-3
-5
-3
-5
-3
-14
-3
-4
-4
-2
-11
-1
-7
-3
-9
-6
-11
-12
-5
-8
-6
-221
-4
-2
-12
-4
-3
-15
-4
-5
-226
-7
-218
-7
-5
-4
-5
-18
-4
-5
-9
-4
-4
-2
-9
-18
-18
-9
-5
-6
-6
-3
-3
-7
-3
-5
-4
-4
-4
-12
-3
-6
-31
-5
-4
-7
-3
-6
-5
-6
-5
-11
-2
-2
-11
-11
-6
-7
-5
-8
-7
-10
-5
-23
-7
-4
-3
-5
-34
-2
-5
-23
-7
-3
-6
-8
-4
-4
-4
-2
-5
-3
-8
-5
-4
-8
-25
-2
-3
-17
-8
-3
-4
-8
-7
-3
-15
-6
-5
-7
-21
-9
-5
-6
-6
-5
-3
-2
-3
-10
-3
-6
-3
-14
-7
-4
-4
-8
-7
-8
-2
-6
-12
-4
-213
-6
-5
-21
-8
-2
-5
-23
-3
-11
-2
-3
-6
-25
-2
-3
-6
-7
-6
-6
-4
-4
-6
-3
-17
-9
-7
-6
-4
-3
-10
-7
-2
-3
-3
-3
-11
-8
-3
-7
-6
-4
-14
-36
-3
-4
-3
-3
-22
-13
-21
-4
-2
-7
-4
-4
-17
-15
-3
-7
-11
-2
-4
-7
-6
-209
-6
-3
-2
-2
-24
-4
-9
-4
-3
-3
-3
-29
-2
-2
-4
-3
-3
-5
-4
-6
-3
-3
-2
-4
diff --git a/vendor/github.com/beorn7/perks/quantile/stream.go b/vendor/github.com/beorn7/perks/quantile/stream.go
deleted file mode 100644
index d7d14f8..0000000
--- a/vendor/github.com/beorn7/perks/quantile/stream.go
+++ /dev/null
@@ -1,316 +0,0 @@
-// Package quantile computes approximate quantiles over an unbounded data
-// stream within low memory and CPU bounds.
-//
-// A small amount of accuracy is traded to achieve the above properties.
-//
-// Multiple streams can be merged before calling Query to generate a single set
-// of results. This is meaningful when the streams represent the same type of
-// data. See Merge and Samples.
-//
-// For more detailed information about the algorithm used, see:
-//
-// Effective Computation of Biased Quantiles over Data Streams
-//
-// http://www.cs.rutgers.edu/~muthu/bquant.pdf
-package quantile
-
-import (
- "math"
- "sort"
-)
-
-// Sample holds an observed value and meta information for compression. JSON
-// tags have been added for convenience.
-type Sample struct {
- Value float64 `json:",string"`
- Width float64 `json:",string"`
- Delta float64 `json:",string"`
-}
-
-// Samples represents a slice of samples. It implements sort.Interface.
-type Samples []Sample
-
-func (a Samples) Len() int { return len(a) }
-func (a Samples) Less(i, j int) bool { return a[i].Value < a[j].Value }
-func (a Samples) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
-
-type invariant func(s *stream, r float64) float64
-
-// NewLowBiased returns an initialized Stream for low-biased quantiles
-// (e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but
-// error guarantees can still be given even for the lower ranks of the data
-// distribution.
-//
-// The provided epsilon is a relative error, i.e. the true quantile of a value
-// returned by a query is guaranteed to be within (1±Epsilon)*Quantile.
-//
-// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error
-// properties.
-func NewLowBiased(epsilon float64) *Stream {
- ƒ := func(s *stream, r float64) float64 {
- return 2 * epsilon * r
- }
- return newStream(ƒ)
-}
-
-// NewHighBiased returns an initialized Stream for high-biased quantiles
-// (e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but
-// error guarantees can still be given even for the higher ranks of the data
-// distribution.
-//
-// The provided epsilon is a relative error, i.e. the true quantile of a value
-// returned by a query is guaranteed to be within 1-(1±Epsilon)*(1-Quantile).
-//
-// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error
-// properties.
-func NewHighBiased(epsilon float64) *Stream {
- ƒ := func(s *stream, r float64) float64 {
- return 2 * epsilon * (s.n - r)
- }
- return newStream(ƒ)
-}
-
-// NewTargeted returns an initialized Stream concerned with a particular set of
-// quantile values that are supplied a priori. Knowing these a priori reduces
-// space and computation time. The targets map maps the desired quantiles to
-// their absolute errors, i.e. the true quantile of a value returned by a query
-// is guaranteed to be within (Quantile±Epsilon).
-//
-// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error properties.
-func NewTargeted(targetMap map[float64]float64) *Stream {
- // Convert map to slice to avoid slow iterations on a map.
- // ƒ is called on the hot path, so converting the map to a slice
- // beforehand results in significant CPU savings.
- targets := targetMapToSlice(targetMap)
-
- ƒ := func(s *stream, r float64) float64 {
- var m = math.MaxFloat64
- var f float64
- for _, t := range targets {
- if t.quantile*s.n <= r {
- f = (2 * t.epsilon * r) / t.quantile
- } else {
- f = (2 * t.epsilon * (s.n - r)) / (1 - t.quantile)
- }
- if f < m {
- m = f
- }
- }
- return m
- }
- return newStream(ƒ)
-}
-
-type target struct {
- quantile float64
- epsilon float64
-}
-
-func targetMapToSlice(targetMap map[float64]float64) []target {
- targets := make([]target, 0, len(targetMap))
-
- for quantile, epsilon := range targetMap {
- t := target{
- quantile: quantile,
- epsilon: epsilon,
- }
- targets = append(targets, t)
- }
-
- return targets
-}
-
-// Stream computes quantiles for a stream of float64s. It is not thread-safe by
-// design. Take care when using across multiple goroutines.
-type Stream struct {
- *stream
- b Samples
- sorted bool
-}
-
-func newStream(ƒ invariant) *Stream {
- x := &stream{ƒ: ƒ}
- return &Stream{x, make(Samples, 0, 500), true}
-}
-
-// Insert inserts v into the stream.
-func (s *Stream) Insert(v float64) {
- s.insert(Sample{Value: v, Width: 1})
-}
-
-func (s *Stream) insert(sample Sample) {
- s.b = append(s.b, sample)
- s.sorted = false
- if len(s.b) == cap(s.b) {
- s.flush()
- }
-}
-
-// Query returns the computed qth percentiles value. If s was created with
-// NewTargeted, and q is not in the set of quantiles provided a priori, Query
-// will return an unspecified result.
-func (s *Stream) Query(q float64) float64 {
- if !s.flushed() {
- // Fast path when there hasn't been enough data for a flush;
- // this also yields better accuracy for small sets of data.
- l := len(s.b)
- if l == 0 {
- return 0
- }
- i := int(math.Ceil(float64(l) * q))
- if i > 0 {
- i -= 1
- }
- s.maybeSort()
- return s.b[i].Value
- }
- s.flush()
- return s.stream.query(q)
-}
-
-// Merge merges samples into the underlying streams samples. This is handy when
-// merging multiple streams from separate threads, database shards, etc.
-//
-// ATTENTION: This method is broken and does not yield correct results. The
-// underlying algorithm is not capable of merging streams correctly.
-func (s *Stream) Merge(samples Samples) {
- sort.Sort(samples)
- s.stream.merge(samples)
-}
-
-// Reset reinitializes and clears the list reusing the samples buffer memory.
-func (s *Stream) Reset() {
- s.stream.reset()
- s.b = s.b[:0]
-}
-
-// Samples returns stream samples held by s.
-func (s *Stream) Samples() Samples {
- if !s.flushed() {
- return s.b
- }
- s.flush()
- return s.stream.samples()
-}
-
-// Count returns the total number of samples observed in the stream
-// since initialization.
-func (s *Stream) Count() int {
- return len(s.b) + s.stream.count()
-}
-
-func (s *Stream) flush() {
- s.maybeSort()
- s.stream.merge(s.b)
- s.b = s.b[:0]
-}
-
-func (s *Stream) maybeSort() {
- if !s.sorted {
- s.sorted = true
- sort.Sort(s.b)
- }
-}
-
-func (s *Stream) flushed() bool {
- return len(s.stream.l) > 0
-}
-
-type stream struct {
- n float64
- l []Sample
- ƒ invariant
-}
-
-func (s *stream) reset() {
- s.l = s.l[:0]
- s.n = 0
-}
-
-func (s *stream) insert(v float64) {
- s.merge(Samples{{v, 1, 0}})
-}
-
-func (s *stream) merge(samples Samples) {
- // TODO(beorn7): This tries to merge not only individual samples, but
- // whole summaries. The paper doesn't mention merging summaries at
- // all. Unittests show that the merging is inaccurate. Find out how to
- // do merges properly.
- var r float64
- i := 0
- for _, sample := range samples {
- for ; i < len(s.l); i++ {
- c := s.l[i]
- if c.Value > sample.Value {
- // Insert at position i.
- s.l = append(s.l, Sample{})
- copy(s.l[i+1:], s.l[i:])
- s.l[i] = Sample{
- sample.Value,
- sample.Width,
- math.Max(sample.Delta, math.Floor(s.ƒ(s, r))-1),
- // TODO(beorn7): How to calculate delta correctly?
- }
- i++
- goto inserted
- }
- r += c.Width
- }
- s.l = append(s.l, Sample{sample.Value, sample.Width, 0})
- i++
- inserted:
- s.n += sample.Width
- r += sample.Width
- }
- s.compress()
-}
-
-func (s *stream) count() int {
- return int(s.n)
-}
-
-func (s *stream) query(q float64) float64 {
- t := math.Ceil(q * s.n)
- t += math.Ceil(s.ƒ(s, t) / 2)
- p := s.l[0]
- var r float64
- for _, c := range s.l[1:] {
- r += p.Width
- if r+c.Width+c.Delta > t {
- return p.Value
- }
- p = c
- }
- return p.Value
-}
-
-func (s *stream) compress() {
- if len(s.l) < 2 {
- return
- }
- x := s.l[len(s.l)-1]
- xi := len(s.l) - 1
- r := s.n - 1 - x.Width
-
- for i := len(s.l) - 2; i >= 0; i-- {
- c := s.l[i]
- if c.Width+x.Width+x.Delta <= s.ƒ(s, r) {
- x.Width += c.Width
- s.l[xi] = x
- // Remove element at i.
- copy(s.l[i:], s.l[i+1:])
- s.l = s.l[:len(s.l)-1]
- xi -= 1
- } else {
- x = c
- xi = i
- }
- r -= c.Width
- }
-}
-
-func (s *stream) samples() Samples {
- samples := make(Samples, len(s.l))
- copy(samples, s.l)
- return samples
-}
diff --git a/vendor/github.com/cespare/xxhash/v2/.travis.yml b/vendor/github.com/cespare/xxhash/v2/.travis.yml
deleted file mode 100644
index c516ea8..0000000
--- a/vendor/github.com/cespare/xxhash/v2/.travis.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-language: go
-go:
- - "1.x"
- - master
-env:
- - TAGS=""
- - TAGS="-tags purego"
-script: go test $TAGS -v ./...
diff --git a/vendor/github.com/cespare/xxhash/v2/LICENSE.txt b/vendor/github.com/cespare/xxhash/v2/LICENSE.txt
deleted file mode 100644
index 24b5306..0000000
--- a/vendor/github.com/cespare/xxhash/v2/LICENSE.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2016 Caleb Spare
-
-MIT License
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/github.com/cespare/xxhash/v2/README.md b/vendor/github.com/cespare/xxhash/v2/README.md
deleted file mode 100644
index 2fd8693..0000000
--- a/vendor/github.com/cespare/xxhash/v2/README.md
+++ /dev/null
@@ -1,67 +0,0 @@
-# xxhash
-
-[![GoDoc](https://godoc.org/github.com/cespare/xxhash?status.svg)](https://godoc.org/github.com/cespare/xxhash)
-[![Build Status](https://travis-ci.org/cespare/xxhash.svg?branch=master)](https://travis-ci.org/cespare/xxhash)
-
-xxhash is a Go implementation of the 64-bit
-[xxHash](http://cyan4973.github.io/xxHash/) algorithm, XXH64. This is a
-high-quality hashing algorithm that is much faster than anything in the Go
-standard library.
-
-This package provides a straightforward API:
-
-```
-func Sum64(b []byte) uint64
-func Sum64String(s string) uint64
-type Digest struct{ ... }
- func New() *Digest
-```
-
-The `Digest` type implements hash.Hash64. Its key methods are:
-
-```
-func (*Digest) Write([]byte) (int, error)
-func (*Digest) WriteString(string) (int, error)
-func (*Digest) Sum64() uint64
-```
-
-This implementation provides a fast pure-Go implementation and an even faster
-assembly implementation for amd64.
-
-## Compatibility
-
-This package is in a module and the latest code is in version 2 of the module.
-You need a version of Go with at least "minimal module compatibility" to use
-github.com/cespare/xxhash/v2:
-
-* 1.9.7+ for Go 1.9
-* 1.10.3+ for Go 1.10
-* Go 1.11 or later
-
-I recommend using the latest release of Go.
-
-## Benchmarks
-
-Here are some quick benchmarks comparing the pure-Go and assembly
-implementations of Sum64.
-
-| input size | purego | asm |
-| --- | --- | --- |
-| 5 B | 979.66 MB/s | 1291.17 MB/s |
-| 100 B | 7475.26 MB/s | 7973.40 MB/s |
-| 4 KB | 17573.46 MB/s | 17602.65 MB/s |
-| 10 MB | 17131.46 MB/s | 17142.16 MB/s |
-
-These numbers were generated on Ubuntu 18.04 with an Intel i7-8700K CPU using
-the following commands under Go 1.11.2:
-
-```
-$ go test -tags purego -benchtime 10s -bench '/xxhash,direct,bytes'
-$ go test -benchtime 10s -bench '/xxhash,direct,bytes'
-```
-
-## Projects using this package
-
-- [InfluxDB](https://github.com/influxdata/influxdb)
-- [Prometheus](https://github.com/prometheus/prometheus)
-- [FreeCache](https://github.com/coocood/freecache)
diff --git a/vendor/github.com/cespare/xxhash/v2/go.mod b/vendor/github.com/cespare/xxhash/v2/go.mod
deleted file mode 100644
index 49f6760..0000000
--- a/vendor/github.com/cespare/xxhash/v2/go.mod
+++ /dev/null
@@ -1,3 +0,0 @@
-module github.com/cespare/xxhash/v2
-
-go 1.11
diff --git a/vendor/github.com/cespare/xxhash/v2/go.sum b/vendor/github.com/cespare/xxhash/v2/go.sum
deleted file mode 100644
index e69de29..0000000
diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash.go b/vendor/github.com/cespare/xxhash/v2/xxhash.go
deleted file mode 100644
index db0b35f..0000000
--- a/vendor/github.com/cespare/xxhash/v2/xxhash.go
+++ /dev/null
@@ -1,236 +0,0 @@
-// Package xxhash implements the 64-bit variant of xxHash (XXH64) as described
-// at http://cyan4973.github.io/xxHash/.
-package xxhash
-
-import (
- "encoding/binary"
- "errors"
- "math/bits"
-)
-
-const (
- prime1 uint64 = 11400714785074694791
- prime2 uint64 = 14029467366897019727
- prime3 uint64 = 1609587929392839161
- prime4 uint64 = 9650029242287828579
- prime5 uint64 = 2870177450012600261
-)
-
-// NOTE(caleb): I'm using both consts and vars of the primes. Using consts where
-// possible in the Go code is worth a small (but measurable) performance boost
-// by avoiding some MOVQs. Vars are needed for the asm and also are useful for
-// convenience in the Go code in a few places where we need to intentionally
-// avoid constant arithmetic (e.g., v1 := prime1 + prime2 fails because the
-// result overflows a uint64).
-var (
- prime1v = prime1
- prime2v = prime2
- prime3v = prime3
- prime4v = prime4
- prime5v = prime5
-)
-
-// Digest implements hash.Hash64.
-type Digest struct {
- v1 uint64
- v2 uint64
- v3 uint64
- v4 uint64
- total uint64
- mem [32]byte
- n int // how much of mem is used
-}
-
-// New creates a new Digest that computes the 64-bit xxHash algorithm.
-func New() *Digest {
- var d Digest
- d.Reset()
- return &d
-}
-
-// Reset clears the Digest's state so that it can be reused.
-func (d *Digest) Reset() {
- d.v1 = prime1v + prime2
- d.v2 = prime2
- d.v3 = 0
- d.v4 = -prime1v
- d.total = 0
- d.n = 0
-}
-
-// Size always returns 8 bytes.
-func (d *Digest) Size() int { return 8 }
-
-// BlockSize always returns 32 bytes.
-func (d *Digest) BlockSize() int { return 32 }
-
-// Write adds more data to d. It always returns len(b), nil.
-func (d *Digest) Write(b []byte) (n int, err error) {
- n = len(b)
- d.total += uint64(n)
-
- if d.n+n < 32 {
- // This new data doesn't even fill the current block.
- copy(d.mem[d.n:], b)
- d.n += n
- return
- }
-
- if d.n > 0 {
- // Finish off the partial block.
- copy(d.mem[d.n:], b)
- d.v1 = round(d.v1, u64(d.mem[0:8]))
- d.v2 = round(d.v2, u64(d.mem[8:16]))
- d.v3 = round(d.v3, u64(d.mem[16:24]))
- d.v4 = round(d.v4, u64(d.mem[24:32]))
- b = b[32-d.n:]
- d.n = 0
- }
-
- if len(b) >= 32 {
- // One or more full blocks left.
- nw := writeBlocks(d, b)
- b = b[nw:]
- }
-
- // Store any remaining partial block.
- copy(d.mem[:], b)
- d.n = len(b)
-
- return
-}
-
-// Sum appends the current hash to b and returns the resulting slice.
-func (d *Digest) Sum(b []byte) []byte {
- s := d.Sum64()
- return append(
- b,
- byte(s>>56),
- byte(s>>48),
- byte(s>>40),
- byte(s>>32),
- byte(s>>24),
- byte(s>>16),
- byte(s>>8),
- byte(s),
- )
-}
-
-// Sum64 returns the current hash.
-func (d *Digest) Sum64() uint64 {
- var h uint64
-
- if d.total >= 32 {
- v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4
- h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4)
- h = mergeRound(h, v1)
- h = mergeRound(h, v2)
- h = mergeRound(h, v3)
- h = mergeRound(h, v4)
- } else {
- h = d.v3 + prime5
- }
-
- h += d.total
-
- i, end := 0, d.n
- for ; i+8 <= end; i += 8 {
- k1 := round(0, u64(d.mem[i:i+8]))
- h ^= k1
- h = rol27(h)*prime1 + prime4
- }
- if i+4 <= end {
- h ^= uint64(u32(d.mem[i:i+4])) * prime1
- h = rol23(h)*prime2 + prime3
- i += 4
- }
- for i < end {
- h ^= uint64(d.mem[i]) * prime5
- h = rol11(h) * prime1
- i++
- }
-
- h ^= h >> 33
- h *= prime2
- h ^= h >> 29
- h *= prime3
- h ^= h >> 32
-
- return h
-}
-
-const (
- magic = "xxh\x06"
- marshaledSize = len(magic) + 8*5 + 32
-)
-
-// MarshalBinary implements the encoding.BinaryMarshaler interface.
-func (d *Digest) MarshalBinary() ([]byte, error) {
- b := make([]byte, 0, marshaledSize)
- b = append(b, magic...)
- b = appendUint64(b, d.v1)
- b = appendUint64(b, d.v2)
- b = appendUint64(b, d.v3)
- b = appendUint64(b, d.v4)
- b = appendUint64(b, d.total)
- b = append(b, d.mem[:d.n]...)
- b = b[:len(b)+len(d.mem)-d.n]
- return b, nil
-}
-
-// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
-func (d *Digest) UnmarshalBinary(b []byte) error {
- if len(b) < len(magic) || string(b[:len(magic)]) != magic {
- return errors.New("xxhash: invalid hash state identifier")
- }
- if len(b) != marshaledSize {
- return errors.New("xxhash: invalid hash state size")
- }
- b = b[len(magic):]
- b, d.v1 = consumeUint64(b)
- b, d.v2 = consumeUint64(b)
- b, d.v3 = consumeUint64(b)
- b, d.v4 = consumeUint64(b)
- b, d.total = consumeUint64(b)
- copy(d.mem[:], b)
- b = b[len(d.mem):]
- d.n = int(d.total % uint64(len(d.mem)))
- return nil
-}
-
-func appendUint64(b []byte, x uint64) []byte {
- var a [8]byte
- binary.LittleEndian.PutUint64(a[:], x)
- return append(b, a[:]...)
-}
-
-func consumeUint64(b []byte) ([]byte, uint64) {
- x := u64(b)
- return b[8:], x
-}
-
-func u64(b []byte) uint64 { return binary.LittleEndian.Uint64(b) }
-func u32(b []byte) uint32 { return binary.LittleEndian.Uint32(b) }
-
-func round(acc, input uint64) uint64 {
- acc += input * prime2
- acc = rol31(acc)
- acc *= prime1
- return acc
-}
-
-func mergeRound(acc, val uint64) uint64 {
- val = round(0, val)
- acc ^= val
- acc = acc*prime1 + prime4
- return acc
-}
-
-func rol1(x uint64) uint64 { return bits.RotateLeft64(x, 1) }
-func rol7(x uint64) uint64 { return bits.RotateLeft64(x, 7) }
-func rol11(x uint64) uint64 { return bits.RotateLeft64(x, 11) }
-func rol12(x uint64) uint64 { return bits.RotateLeft64(x, 12) }
-func rol18(x uint64) uint64 { return bits.RotateLeft64(x, 18) }
-func rol23(x uint64) uint64 { return bits.RotateLeft64(x, 23) }
-func rol27(x uint64) uint64 { return bits.RotateLeft64(x, 27) }
-func rol31(x uint64) uint64 { return bits.RotateLeft64(x, 31) }
diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.go b/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.go
deleted file mode 100644
index ad14b80..0000000
--- a/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build !appengine
-// +build gc
-// +build !purego
-
-package xxhash
-
-// Sum64 computes the 64-bit xxHash digest of b.
-//
-//go:noescape
-func Sum64(b []byte) uint64
-
-//go:noescape
-func writeBlocks(d *Digest, b []byte) int
diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s b/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s
deleted file mode 100644
index d580e32..0000000
--- a/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s
+++ /dev/null
@@ -1,215 +0,0 @@
-// +build !appengine
-// +build gc
-// +build !purego
-
-#include "textflag.h"
-
-// Register allocation:
-// AX h
-// CX pointer to advance through b
-// DX n
-// BX loop end
-// R8 v1, k1
-// R9 v2
-// R10 v3
-// R11 v4
-// R12 tmp
-// R13 prime1v
-// R14 prime2v
-// R15 prime4v
-
-// round reads from and advances the buffer pointer in CX.
-// It assumes that R13 has prime1v and R14 has prime2v.
-#define round(r) \
- MOVQ (CX), R12 \
- ADDQ $8, CX \
- IMULQ R14, R12 \
- ADDQ R12, r \
- ROLQ $31, r \
- IMULQ R13, r
-
-// mergeRound applies a merge round on the two registers acc and val.
-// It assumes that R13 has prime1v, R14 has prime2v, and R15 has prime4v.
-#define mergeRound(acc, val) \
- IMULQ R14, val \
- ROLQ $31, val \
- IMULQ R13, val \
- XORQ val, acc \
- IMULQ R13, acc \
- ADDQ R15, acc
-
-// func Sum64(b []byte) uint64
-TEXT ·Sum64(SB), NOSPLIT, $0-32
- // Load fixed primes.
- MOVQ ·prime1v(SB), R13
- MOVQ ·prime2v(SB), R14
- MOVQ ·prime4v(SB), R15
-
- // Load slice.
- MOVQ b_base+0(FP), CX
- MOVQ b_len+8(FP), DX
- LEAQ (CX)(DX*1), BX
-
- // The first loop limit will be len(b)-32.
- SUBQ $32, BX
-
- // Check whether we have at least one block.
- CMPQ DX, $32
- JLT noBlocks
-
- // Set up initial state (v1, v2, v3, v4).
- MOVQ R13, R8
- ADDQ R14, R8
- MOVQ R14, R9
- XORQ R10, R10
- XORQ R11, R11
- SUBQ R13, R11
-
- // Loop until CX > BX.
-blockLoop:
- round(R8)
- round(R9)
- round(R10)
- round(R11)
-
- CMPQ CX, BX
- JLE blockLoop
-
- MOVQ R8, AX
- ROLQ $1, AX
- MOVQ R9, R12
- ROLQ $7, R12
- ADDQ R12, AX
- MOVQ R10, R12
- ROLQ $12, R12
- ADDQ R12, AX
- MOVQ R11, R12
- ROLQ $18, R12
- ADDQ R12, AX
-
- mergeRound(AX, R8)
- mergeRound(AX, R9)
- mergeRound(AX, R10)
- mergeRound(AX, R11)
-
- JMP afterBlocks
-
-noBlocks:
- MOVQ ·prime5v(SB), AX
-
-afterBlocks:
- ADDQ DX, AX
-
- // Right now BX has len(b)-32, and we want to loop until CX > len(b)-8.
- ADDQ $24, BX
-
- CMPQ CX, BX
- JG fourByte
-
-wordLoop:
- // Calculate k1.
- MOVQ (CX), R8
- ADDQ $8, CX
- IMULQ R14, R8
- ROLQ $31, R8
- IMULQ R13, R8
-
- XORQ R8, AX
- ROLQ $27, AX
- IMULQ R13, AX
- ADDQ R15, AX
-
- CMPQ CX, BX
- JLE wordLoop
-
-fourByte:
- ADDQ $4, BX
- CMPQ CX, BX
- JG singles
-
- MOVL (CX), R8
- ADDQ $4, CX
- IMULQ R13, R8
- XORQ R8, AX
-
- ROLQ $23, AX
- IMULQ R14, AX
- ADDQ ·prime3v(SB), AX
-
-singles:
- ADDQ $4, BX
- CMPQ CX, BX
- JGE finalize
-
-singlesLoop:
- MOVBQZX (CX), R12
- ADDQ $1, CX
- IMULQ ·prime5v(SB), R12
- XORQ R12, AX
-
- ROLQ $11, AX
- IMULQ R13, AX
-
- CMPQ CX, BX
- JL singlesLoop
-
-finalize:
- MOVQ AX, R12
- SHRQ $33, R12
- XORQ R12, AX
- IMULQ R14, AX
- MOVQ AX, R12
- SHRQ $29, R12
- XORQ R12, AX
- IMULQ ·prime3v(SB), AX
- MOVQ AX, R12
- SHRQ $32, R12
- XORQ R12, AX
-
- MOVQ AX, ret+24(FP)
- RET
-
-// writeBlocks uses the same registers as above except that it uses AX to store
-// the d pointer.
-
-// func writeBlocks(d *Digest, b []byte) int
-TEXT ·writeBlocks(SB), NOSPLIT, $0-40
- // Load fixed primes needed for round.
- MOVQ ·prime1v(SB), R13
- MOVQ ·prime2v(SB), R14
-
- // Load slice.
- MOVQ b_base+8(FP), CX
- MOVQ b_len+16(FP), DX
- LEAQ (CX)(DX*1), BX
- SUBQ $32, BX
-
- // Load vN from d.
- MOVQ d+0(FP), AX
- MOVQ 0(AX), R8 // v1
- MOVQ 8(AX), R9 // v2
- MOVQ 16(AX), R10 // v3
- MOVQ 24(AX), R11 // v4
-
- // We don't need to check the loop condition here; this function is
- // always called with at least one block of data to process.
-blockLoop:
- round(R8)
- round(R9)
- round(R10)
- round(R11)
-
- CMPQ CX, BX
- JLE blockLoop
-
- // Copy vN back to d.
- MOVQ R8, 0(AX)
- MOVQ R9, 8(AX)
- MOVQ R10, 16(AX)
- MOVQ R11, 24(AX)
-
- // The number of bytes written is CX minus the old base pointer.
- SUBQ b_base+8(FP), CX
- MOVQ CX, ret+32(FP)
-
- RET
diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_other.go b/vendor/github.com/cespare/xxhash/v2/xxhash_other.go
deleted file mode 100644
index 4a5a821..0000000
--- a/vendor/github.com/cespare/xxhash/v2/xxhash_other.go
+++ /dev/null
@@ -1,76 +0,0 @@
-// +build !amd64 appengine !gc purego
-
-package xxhash
-
-// Sum64 computes the 64-bit xxHash digest of b.
-func Sum64(b []byte) uint64 {
- // A simpler version would be
- // d := New()
- // d.Write(b)
- // return d.Sum64()
- // but this is faster, particularly for small inputs.
-
- n := len(b)
- var h uint64
-
- if n >= 32 {
- v1 := prime1v + prime2
- v2 := prime2
- v3 := uint64(0)
- v4 := -prime1v
- for len(b) >= 32 {
- v1 = round(v1, u64(b[0:8:len(b)]))
- v2 = round(v2, u64(b[8:16:len(b)]))
- v3 = round(v3, u64(b[16:24:len(b)]))
- v4 = round(v4, u64(b[24:32:len(b)]))
- b = b[32:len(b):len(b)]
- }
- h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4)
- h = mergeRound(h, v1)
- h = mergeRound(h, v2)
- h = mergeRound(h, v3)
- h = mergeRound(h, v4)
- } else {
- h = prime5
- }
-
- h += uint64(n)
-
- i, end := 0, len(b)
- for ; i+8 <= end; i += 8 {
- k1 := round(0, u64(b[i:i+8:len(b)]))
- h ^= k1
- h = rol27(h)*prime1 + prime4
- }
- if i+4 <= end {
- h ^= uint64(u32(b[i:i+4:len(b)])) * prime1
- h = rol23(h)*prime2 + prime3
- i += 4
- }
- for ; i < end; i++ {
- h ^= uint64(b[i]) * prime5
- h = rol11(h) * prime1
- }
-
- h ^= h >> 33
- h *= prime2
- h ^= h >> 29
- h *= prime3
- h ^= h >> 32
-
- return h
-}
-
-func writeBlocks(d *Digest, b []byte) int {
- v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4
- n := len(b)
- for len(b) >= 32 {
- v1 = round(v1, u64(b[0:8:len(b)]))
- v2 = round(v2, u64(b[8:16:len(b)]))
- v3 = round(v3, u64(b[16:24:len(b)]))
- v4 = round(v4, u64(b[24:32:len(b)]))
- b = b[32:len(b):len(b)]
- }
- d.v1, d.v2, d.v3, d.v4 = v1, v2, v3, v4
- return n - len(b)
-}
diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go b/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go
deleted file mode 100644
index fc9bea7..0000000
--- a/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build appengine
-
-// This file contains the safe implementations of otherwise unsafe-using code.
-
-package xxhash
-
-// Sum64String computes the 64-bit xxHash digest of s.
-func Sum64String(s string) uint64 {
- return Sum64([]byte(s))
-}
-
-// WriteString adds more data to d. It always returns len(s), nil.
-func (d *Digest) WriteString(s string) (n int, err error) {
- return d.Write([]byte(s))
-}
diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go b/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go
deleted file mode 100644
index 53bf76e..0000000
--- a/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// +build !appengine
-
-// This file encapsulates usage of unsafe.
-// xxhash_safe.go contains the safe implementations.
-
-package xxhash
-
-import (
- "reflect"
- "unsafe"
-)
-
-// Notes:
-//
-// See https://groups.google.com/d/msg/golang-nuts/dcjzJy-bSpw/tcZYBzQqAQAJ
-// for some discussion about these unsafe conversions.
-//
-// In the future it's possible that compiler optimizations will make these
-// unsafe operations unnecessary: https://golang.org/issue/2205.
-//
-// Both of these wrapper functions still incur function call overhead since they
-// will not be inlined. We could write Go/asm copies of Sum64 and Digest.Write
-// for strings to squeeze out a bit more speed. Mid-stack inlining should
-// eventually fix this.
-
-// Sum64String computes the 64-bit xxHash digest of s.
-// It may be faster than Sum64([]byte(s)) by avoiding a copy.
-func Sum64String(s string) uint64 {
- var b []byte
- bh := (*reflect.SliceHeader)(unsafe.Pointer(&b))
- bh.Data = (*reflect.StringHeader)(unsafe.Pointer(&s)).Data
- bh.Len = len(s)
- bh.Cap = len(s)
- return Sum64(b)
-}
-
-// WriteString adds more data to d. It always returns len(s), nil.
-// It may be faster than Write([]byte(s)) by avoiding a copy.
-func (d *Digest) WriteString(s string) (n int, err error) {
- var b []byte
- bh := (*reflect.SliceHeader)(unsafe.Pointer(&b))
- bh.Data = (*reflect.StringHeader)(unsafe.Pointer(&s)).Data
- bh.Len = len(s)
- bh.Cap = len(s)
- return d.Write(b)
-}
diff --git a/vendor/github.com/golang/protobuf/AUTHORS b/vendor/github.com/golang/protobuf/AUTHORS
deleted file mode 100644
index 15167cd..0000000
--- a/vendor/github.com/golang/protobuf/AUTHORS
+++ /dev/null
@@ -1,3 +0,0 @@
-# This source code refers to The Go Authors for copyright purposes.
-# The master list of authors is in the main Go distribution,
-# visible at http://tip.golang.org/AUTHORS.
diff --git a/vendor/github.com/golang/protobuf/CONTRIBUTORS b/vendor/github.com/golang/protobuf/CONTRIBUTORS
deleted file mode 100644
index 1c4577e..0000000
--- a/vendor/github.com/golang/protobuf/CONTRIBUTORS
+++ /dev/null
@@ -1,3 +0,0 @@
-# This source code was written by the Go contributors.
-# The master list of contributors is in the main Go distribution,
-# visible at http://tip.golang.org/CONTRIBUTORS.
diff --git a/vendor/github.com/golang/protobuf/LICENSE b/vendor/github.com/golang/protobuf/LICENSE
deleted file mode 100644
index 0f64693..0000000
--- a/vendor/github.com/golang/protobuf/LICENSE
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright 2010 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
diff --git a/vendor/github.com/golang/protobuf/proto/clone.go b/vendor/github.com/golang/protobuf/proto/clone.go
deleted file mode 100644
index 3cd3249..0000000
--- a/vendor/github.com/golang/protobuf/proto/clone.go
+++ /dev/null
@@ -1,253 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2011 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Protocol buffer deep copy and merge.
-// TODO: RawMessage.
-
-package proto
-
-import (
- "fmt"
- "log"
- "reflect"
- "strings"
-)
-
-// Clone returns a deep copy of a protocol buffer.
-func Clone(src Message) Message {
- in := reflect.ValueOf(src)
- if in.IsNil() {
- return src
- }
- out := reflect.New(in.Type().Elem())
- dst := out.Interface().(Message)
- Merge(dst, src)
- return dst
-}
-
-// Merger is the interface representing objects that can merge messages of the same type.
-type Merger interface {
- // Merge merges src into this message.
- // Required and optional fields that are set in src will be set to that value in dst.
- // Elements of repeated fields will be appended.
- //
- // Merge may panic if called with a different argument type than the receiver.
- Merge(src Message)
-}
-
-// generatedMerger is the custom merge method that generated protos will have.
-// We must add this method since a generate Merge method will conflict with
-// many existing protos that have a Merge data field already defined.
-type generatedMerger interface {
- XXX_Merge(src Message)
-}
-
-// Merge merges src into dst.
-// Required and optional fields that are set in src will be set to that value in dst.
-// Elements of repeated fields will be appended.
-// Merge panics if src and dst are not the same type, or if dst is nil.
-func Merge(dst, src Message) {
- if m, ok := dst.(Merger); ok {
- m.Merge(src)
- return
- }
-
- in := reflect.ValueOf(src)
- out := reflect.ValueOf(dst)
- if out.IsNil() {
- panic("proto: nil destination")
- }
- if in.Type() != out.Type() {
- panic(fmt.Sprintf("proto.Merge(%T, %T) type mismatch", dst, src))
- }
- if in.IsNil() {
- return // Merge from nil src is a noop
- }
- if m, ok := dst.(generatedMerger); ok {
- m.XXX_Merge(src)
- return
- }
- mergeStruct(out.Elem(), in.Elem())
-}
-
-func mergeStruct(out, in reflect.Value) {
- sprop := GetProperties(in.Type())
- for i := 0; i < in.NumField(); i++ {
- f := in.Type().Field(i)
- if strings.HasPrefix(f.Name, "XXX_") {
- continue
- }
- mergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i])
- }
-
- if emIn, err := extendable(in.Addr().Interface()); err == nil {
- emOut, _ := extendable(out.Addr().Interface())
- mIn, muIn := emIn.extensionsRead()
- if mIn != nil {
- mOut := emOut.extensionsWrite()
- muIn.Lock()
- mergeExtension(mOut, mIn)
- muIn.Unlock()
- }
- }
-
- uf := in.FieldByName("XXX_unrecognized")
- if !uf.IsValid() {
- return
- }
- uin := uf.Bytes()
- if len(uin) > 0 {
- out.FieldByName("XXX_unrecognized").SetBytes(append([]byte(nil), uin...))
- }
-}
-
-// mergeAny performs a merge between two values of the same type.
-// viaPtr indicates whether the values were indirected through a pointer (implying proto2).
-// prop is set if this is a struct field (it may be nil).
-func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) {
- if in.Type() == protoMessageType {
- if !in.IsNil() {
- if out.IsNil() {
- out.Set(reflect.ValueOf(Clone(in.Interface().(Message))))
- } else {
- Merge(out.Interface().(Message), in.Interface().(Message))
- }
- }
- return
- }
- switch in.Kind() {
- case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64,
- reflect.String, reflect.Uint32, reflect.Uint64:
- if !viaPtr && isProto3Zero(in) {
- return
- }
- out.Set(in)
- case reflect.Interface:
- // Probably a oneof field; copy non-nil values.
- if in.IsNil() {
- return
- }
- // Allocate destination if it is not set, or set to a different type.
- // Otherwise we will merge as normal.
- if out.IsNil() || out.Elem().Type() != in.Elem().Type() {
- out.Set(reflect.New(in.Elem().Elem().Type())) // interface -> *T -> T -> new(T)
- }
- mergeAny(out.Elem(), in.Elem(), false, nil)
- case reflect.Map:
- if in.Len() == 0 {
- return
- }
- if out.IsNil() {
- out.Set(reflect.MakeMap(in.Type()))
- }
- // For maps with value types of *T or []byte we need to deep copy each value.
- elemKind := in.Type().Elem().Kind()
- for _, key := range in.MapKeys() {
- var val reflect.Value
- switch elemKind {
- case reflect.Ptr:
- val = reflect.New(in.Type().Elem().Elem())
- mergeAny(val, in.MapIndex(key), false, nil)
- case reflect.Slice:
- val = in.MapIndex(key)
- val = reflect.ValueOf(append([]byte{}, val.Bytes()...))
- default:
- val = in.MapIndex(key)
- }
- out.SetMapIndex(key, val)
- }
- case reflect.Ptr:
- if in.IsNil() {
- return
- }
- if out.IsNil() {
- out.Set(reflect.New(in.Elem().Type()))
- }
- mergeAny(out.Elem(), in.Elem(), true, nil)
- case reflect.Slice:
- if in.IsNil() {
- return
- }
- if in.Type().Elem().Kind() == reflect.Uint8 {
- // []byte is a scalar bytes field, not a repeated field.
-
- // Edge case: if this is in a proto3 message, a zero length
- // bytes field is considered the zero value, and should not
- // be merged.
- if prop != nil && prop.proto3 && in.Len() == 0 {
- return
- }
-
- // Make a deep copy.
- // Append to []byte{} instead of []byte(nil) so that we never end up
- // with a nil result.
- out.SetBytes(append([]byte{}, in.Bytes()...))
- return
- }
- n := in.Len()
- if out.IsNil() {
- out.Set(reflect.MakeSlice(in.Type(), 0, n))
- }
- switch in.Type().Elem().Kind() {
- case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64,
- reflect.String, reflect.Uint32, reflect.Uint64:
- out.Set(reflect.AppendSlice(out, in))
- default:
- for i := 0; i < n; i++ {
- x := reflect.Indirect(reflect.New(in.Type().Elem()))
- mergeAny(x, in.Index(i), false, nil)
- out.Set(reflect.Append(out, x))
- }
- }
- case reflect.Struct:
- mergeStruct(out, in)
- default:
- // unknown type, so not a protocol buffer
- log.Printf("proto: don't know how to copy %v", in)
- }
-}
-
-func mergeExtension(out, in map[int32]Extension) {
- for extNum, eIn := range in {
- eOut := Extension{desc: eIn.desc}
- if eIn.value != nil {
- v := reflect.New(reflect.TypeOf(eIn.value)).Elem()
- mergeAny(v, reflect.ValueOf(eIn.value), false, nil)
- eOut.value = v.Interface()
- }
- if eIn.enc != nil {
- eOut.enc = make([]byte, len(eIn.enc))
- copy(eOut.enc, eIn.enc)
- }
-
- out[extNum] = eOut
- }
-}
diff --git a/vendor/github.com/golang/protobuf/proto/decode.go b/vendor/github.com/golang/protobuf/proto/decode.go
deleted file mode 100644
index 63b0f08..0000000
--- a/vendor/github.com/golang/protobuf/proto/decode.go
+++ /dev/null
@@ -1,427 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-/*
- * Routines for decoding protocol buffer data to construct in-memory representations.
- */
-
-import (
- "errors"
- "fmt"
- "io"
-)
-
-// errOverflow is returned when an integer is too large to be represented.
-var errOverflow = errors.New("proto: integer overflow")
-
-// ErrInternalBadWireType is returned by generated code when an incorrect
-// wire type is encountered. It does not get returned to user code.
-var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof")
-
-// DecodeVarint reads a varint-encoded integer from the slice.
-// It returns the integer and the number of bytes consumed, or
-// zero if there is not enough.
-// This is the format for the
-// int32, int64, uint32, uint64, bool, and enum
-// protocol buffer types.
-func DecodeVarint(buf []byte) (x uint64, n int) {
- for shift := uint(0); shift < 64; shift += 7 {
- if n >= len(buf) {
- return 0, 0
- }
- b := uint64(buf[n])
- n++
- x |= (b & 0x7F) << shift
- if (b & 0x80) == 0 {
- return x, n
- }
- }
-
- // The number is too large to represent in a 64-bit value.
- return 0, 0
-}
-
-func (p *Buffer) decodeVarintSlow() (x uint64, err error) {
- i := p.index
- l := len(p.buf)
-
- for shift := uint(0); shift < 64; shift += 7 {
- if i >= l {
- err = io.ErrUnexpectedEOF
- return
- }
- b := p.buf[i]
- i++
- x |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- p.index = i
- return
- }
- }
-
- // The number is too large to represent in a 64-bit value.
- err = errOverflow
- return
-}
-
-// DecodeVarint reads a varint-encoded integer from the Buffer.
-// This is the format for the
-// int32, int64, uint32, uint64, bool, and enum
-// protocol buffer types.
-func (p *Buffer) DecodeVarint() (x uint64, err error) {
- i := p.index
- buf := p.buf
-
- if i >= len(buf) {
- return 0, io.ErrUnexpectedEOF
- } else if buf[i] < 0x80 {
- p.index++
- return uint64(buf[i]), nil
- } else if len(buf)-i < 10 {
- return p.decodeVarintSlow()
- }
-
- var b uint64
- // we already checked the first byte
- x = uint64(buf[i]) - 0x80
- i++
-
- b = uint64(buf[i])
- i++
- x += b << 7
- if b&0x80 == 0 {
- goto done
- }
- x -= 0x80 << 7
-
- b = uint64(buf[i])
- i++
- x += b << 14
- if b&0x80 == 0 {
- goto done
- }
- x -= 0x80 << 14
-
- b = uint64(buf[i])
- i++
- x += b << 21
- if b&0x80 == 0 {
- goto done
- }
- x -= 0x80 << 21
-
- b = uint64(buf[i])
- i++
- x += b << 28
- if b&0x80 == 0 {
- goto done
- }
- x -= 0x80 << 28
-
- b = uint64(buf[i])
- i++
- x += b << 35
- if b&0x80 == 0 {
- goto done
- }
- x -= 0x80 << 35
-
- b = uint64(buf[i])
- i++
- x += b << 42
- if b&0x80 == 0 {
- goto done
- }
- x -= 0x80 << 42
-
- b = uint64(buf[i])
- i++
- x += b << 49
- if b&0x80 == 0 {
- goto done
- }
- x -= 0x80 << 49
-
- b = uint64(buf[i])
- i++
- x += b << 56
- if b&0x80 == 0 {
- goto done
- }
- x -= 0x80 << 56
-
- b = uint64(buf[i])
- i++
- x += b << 63
- if b&0x80 == 0 {
- goto done
- }
-
- return 0, errOverflow
-
-done:
- p.index = i
- return x, nil
-}
-
-// DecodeFixed64 reads a 64-bit integer from the Buffer.
-// This is the format for the
-// fixed64, sfixed64, and double protocol buffer types.
-func (p *Buffer) DecodeFixed64() (x uint64, err error) {
- // x, err already 0
- i := p.index + 8
- if i < 0 || i > len(p.buf) {
- err = io.ErrUnexpectedEOF
- return
- }
- p.index = i
-
- x = uint64(p.buf[i-8])
- x |= uint64(p.buf[i-7]) << 8
- x |= uint64(p.buf[i-6]) << 16
- x |= uint64(p.buf[i-5]) << 24
- x |= uint64(p.buf[i-4]) << 32
- x |= uint64(p.buf[i-3]) << 40
- x |= uint64(p.buf[i-2]) << 48
- x |= uint64(p.buf[i-1]) << 56
- return
-}
-
-// DecodeFixed32 reads a 32-bit integer from the Buffer.
-// This is the format for the
-// fixed32, sfixed32, and float protocol buffer types.
-func (p *Buffer) DecodeFixed32() (x uint64, err error) {
- // x, err already 0
- i := p.index + 4
- if i < 0 || i > len(p.buf) {
- err = io.ErrUnexpectedEOF
- return
- }
- p.index = i
-
- x = uint64(p.buf[i-4])
- x |= uint64(p.buf[i-3]) << 8
- x |= uint64(p.buf[i-2]) << 16
- x |= uint64(p.buf[i-1]) << 24
- return
-}
-
-// DecodeZigzag64 reads a zigzag-encoded 64-bit integer
-// from the Buffer.
-// This is the format used for the sint64 protocol buffer type.
-func (p *Buffer) DecodeZigzag64() (x uint64, err error) {
- x, err = p.DecodeVarint()
- if err != nil {
- return
- }
- x = (x >> 1) ^ uint64((int64(x&1)<<63)>>63)
- return
-}
-
-// DecodeZigzag32 reads a zigzag-encoded 32-bit integer
-// from the Buffer.
-// This is the format used for the sint32 protocol buffer type.
-func (p *Buffer) DecodeZigzag32() (x uint64, err error) {
- x, err = p.DecodeVarint()
- if err != nil {
- return
- }
- x = uint64((uint32(x) >> 1) ^ uint32((int32(x&1)<<31)>>31))
- return
-}
-
-// DecodeRawBytes reads a count-delimited byte buffer from the Buffer.
-// This is the format used for the bytes protocol buffer
-// type and for embedded messages.
-func (p *Buffer) DecodeRawBytes(alloc bool) (buf []byte, err error) {
- n, err := p.DecodeVarint()
- if err != nil {
- return nil, err
- }
-
- nb := int(n)
- if nb < 0 {
- return nil, fmt.Errorf("proto: bad byte length %d", nb)
- }
- end := p.index + nb
- if end < p.index || end > len(p.buf) {
- return nil, io.ErrUnexpectedEOF
- }
-
- if !alloc {
- // todo: check if can get more uses of alloc=false
- buf = p.buf[p.index:end]
- p.index += nb
- return
- }
-
- buf = make([]byte, nb)
- copy(buf, p.buf[p.index:])
- p.index += nb
- return
-}
-
-// DecodeStringBytes reads an encoded string from the Buffer.
-// This is the format used for the proto2 string type.
-func (p *Buffer) DecodeStringBytes() (s string, err error) {
- buf, err := p.DecodeRawBytes(false)
- if err != nil {
- return
- }
- return string(buf), nil
-}
-
-// Unmarshaler is the interface representing objects that can
-// unmarshal themselves. The argument points to data that may be
-// overwritten, so implementations should not keep references to the
-// buffer.
-// Unmarshal implementations should not clear the receiver.
-// Any unmarshaled data should be merged into the receiver.
-// Callers of Unmarshal that do not want to retain existing data
-// should Reset the receiver before calling Unmarshal.
-type Unmarshaler interface {
- Unmarshal([]byte) error
-}
-
-// newUnmarshaler is the interface representing objects that can
-// unmarshal themselves. The semantics are identical to Unmarshaler.
-//
-// This exists to support protoc-gen-go generated messages.
-// The proto package will stop type-asserting to this interface in the future.
-//
-// DO NOT DEPEND ON THIS.
-type newUnmarshaler interface {
- XXX_Unmarshal([]byte) error
-}
-
-// Unmarshal parses the protocol buffer representation in buf and places the
-// decoded result in pb. If the struct underlying pb does not match
-// the data in buf, the results can be unpredictable.
-//
-// Unmarshal resets pb before starting to unmarshal, so any
-// existing data in pb is always removed. Use UnmarshalMerge
-// to preserve and append to existing data.
-func Unmarshal(buf []byte, pb Message) error {
- pb.Reset()
- if u, ok := pb.(newUnmarshaler); ok {
- return u.XXX_Unmarshal(buf)
- }
- if u, ok := pb.(Unmarshaler); ok {
- return u.Unmarshal(buf)
- }
- return NewBuffer(buf).Unmarshal(pb)
-}
-
-// UnmarshalMerge parses the protocol buffer representation in buf and
-// writes the decoded result to pb. If the struct underlying pb does not match
-// the data in buf, the results can be unpredictable.
-//
-// UnmarshalMerge merges into existing data in pb.
-// Most code should use Unmarshal instead.
-func UnmarshalMerge(buf []byte, pb Message) error {
- if u, ok := pb.(newUnmarshaler); ok {
- return u.XXX_Unmarshal(buf)
- }
- if u, ok := pb.(Unmarshaler); ok {
- // NOTE: The history of proto have unfortunately been inconsistent
- // whether Unmarshaler should or should not implicitly clear itself.
- // Some implementations do, most do not.
- // Thus, calling this here may or may not do what people want.
- //
- // See https://github.com/golang/protobuf/issues/424
- return u.Unmarshal(buf)
- }
- return NewBuffer(buf).Unmarshal(pb)
-}
-
-// DecodeMessage reads a count-delimited message from the Buffer.
-func (p *Buffer) DecodeMessage(pb Message) error {
- enc, err := p.DecodeRawBytes(false)
- if err != nil {
- return err
- }
- return NewBuffer(enc).Unmarshal(pb)
-}
-
-// DecodeGroup reads a tag-delimited group from the Buffer.
-// StartGroup tag is already consumed. This function consumes
-// EndGroup tag.
-func (p *Buffer) DecodeGroup(pb Message) error {
- b := p.buf[p.index:]
- x, y := findEndGroup(b)
- if x < 0 {
- return io.ErrUnexpectedEOF
- }
- err := Unmarshal(b[:x], pb)
- p.index += y
- return err
-}
-
-// Unmarshal parses the protocol buffer representation in the
-// Buffer and places the decoded result in pb. If the struct
-// underlying pb does not match the data in the buffer, the results can be
-// unpredictable.
-//
-// Unlike proto.Unmarshal, this does not reset pb before starting to unmarshal.
-func (p *Buffer) Unmarshal(pb Message) error {
- // If the object can unmarshal itself, let it.
- if u, ok := pb.(newUnmarshaler); ok {
- err := u.XXX_Unmarshal(p.buf[p.index:])
- p.index = len(p.buf)
- return err
- }
- if u, ok := pb.(Unmarshaler); ok {
- // NOTE: The history of proto have unfortunately been inconsistent
- // whether Unmarshaler should or should not implicitly clear itself.
- // Some implementations do, most do not.
- // Thus, calling this here may or may not do what people want.
- //
- // See https://github.com/golang/protobuf/issues/424
- err := u.Unmarshal(p.buf[p.index:])
- p.index = len(p.buf)
- return err
- }
-
- // Slow workaround for messages that aren't Unmarshalers.
- // This includes some hand-coded .pb.go files and
- // bootstrap protos.
- // TODO: fix all of those and then add Unmarshal to
- // the Message interface. Then:
- // The cast above and code below can be deleted.
- // The old unmarshaler can be deleted.
- // Clients can call Unmarshal directly (can already do that, actually).
- var info InternalMessageInfo
- err := info.Unmarshal(pb, p.buf[p.index:])
- p.index = len(p.buf)
- return err
-}
diff --git a/vendor/github.com/golang/protobuf/proto/deprecated.go b/vendor/github.com/golang/protobuf/proto/deprecated.go
deleted file mode 100644
index 35b882c..0000000
--- a/vendor/github.com/golang/protobuf/proto/deprecated.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2018 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-import "errors"
-
-// Deprecated: do not use.
-type Stats struct{ Emalloc, Dmalloc, Encode, Decode, Chit, Cmiss, Size uint64 }
-
-// Deprecated: do not use.
-func GetStats() Stats { return Stats{} }
-
-// Deprecated: do not use.
-func MarshalMessageSet(interface{}) ([]byte, error) {
- return nil, errors.New("proto: not implemented")
-}
-
-// Deprecated: do not use.
-func UnmarshalMessageSet([]byte, interface{}) error {
- return errors.New("proto: not implemented")
-}
-
-// Deprecated: do not use.
-func MarshalMessageSetJSON(interface{}) ([]byte, error) {
- return nil, errors.New("proto: not implemented")
-}
-
-// Deprecated: do not use.
-func UnmarshalMessageSetJSON([]byte, interface{}) error {
- return errors.New("proto: not implemented")
-}
-
-// Deprecated: do not use.
-func RegisterMessageSetType(Message, int32, string) {}
diff --git a/vendor/github.com/golang/protobuf/proto/discard.go b/vendor/github.com/golang/protobuf/proto/discard.go
deleted file mode 100644
index dea2617..0000000
--- a/vendor/github.com/golang/protobuf/proto/discard.go
+++ /dev/null
@@ -1,350 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2017 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-import (
- "fmt"
- "reflect"
- "strings"
- "sync"
- "sync/atomic"
-)
-
-type generatedDiscarder interface {
- XXX_DiscardUnknown()
-}
-
-// DiscardUnknown recursively discards all unknown fields from this message
-// and all embedded messages.
-//
-// When unmarshaling a message with unrecognized fields, the tags and values
-// of such fields are preserved in the Message. This allows a later call to
-// marshal to be able to produce a message that continues to have those
-// unrecognized fields. To avoid this, DiscardUnknown is used to
-// explicitly clear the unknown fields after unmarshaling.
-//
-// For proto2 messages, the unknown fields of message extensions are only
-// discarded from messages that have been accessed via GetExtension.
-func DiscardUnknown(m Message) {
- if m, ok := m.(generatedDiscarder); ok {
- m.XXX_DiscardUnknown()
- return
- }
- // TODO: Dynamically populate a InternalMessageInfo for legacy messages,
- // but the master branch has no implementation for InternalMessageInfo,
- // so it would be more work to replicate that approach.
- discardLegacy(m)
-}
-
-// DiscardUnknown recursively discards all unknown fields.
-func (a *InternalMessageInfo) DiscardUnknown(m Message) {
- di := atomicLoadDiscardInfo(&a.discard)
- if di == nil {
- di = getDiscardInfo(reflect.TypeOf(m).Elem())
- atomicStoreDiscardInfo(&a.discard, di)
- }
- di.discard(toPointer(&m))
-}
-
-type discardInfo struct {
- typ reflect.Type
-
- initialized int32 // 0: only typ is valid, 1: everything is valid
- lock sync.Mutex
-
- fields []discardFieldInfo
- unrecognized field
-}
-
-type discardFieldInfo struct {
- field field // Offset of field, guaranteed to be valid
- discard func(src pointer)
-}
-
-var (
- discardInfoMap = map[reflect.Type]*discardInfo{}
- discardInfoLock sync.Mutex
-)
-
-func getDiscardInfo(t reflect.Type) *discardInfo {
- discardInfoLock.Lock()
- defer discardInfoLock.Unlock()
- di := discardInfoMap[t]
- if di == nil {
- di = &discardInfo{typ: t}
- discardInfoMap[t] = di
- }
- return di
-}
-
-func (di *discardInfo) discard(src pointer) {
- if src.isNil() {
- return // Nothing to do.
- }
-
- if atomic.LoadInt32(&di.initialized) == 0 {
- di.computeDiscardInfo()
- }
-
- for _, fi := range di.fields {
- sfp := src.offset(fi.field)
- fi.discard(sfp)
- }
-
- // For proto2 messages, only discard unknown fields in message extensions
- // that have been accessed via GetExtension.
- if em, err := extendable(src.asPointerTo(di.typ).Interface()); err == nil {
- // Ignore lock since DiscardUnknown is not concurrency safe.
- emm, _ := em.extensionsRead()
- for _, mx := range emm {
- if m, ok := mx.value.(Message); ok {
- DiscardUnknown(m)
- }
- }
- }
-
- if di.unrecognized.IsValid() {
- *src.offset(di.unrecognized).toBytes() = nil
- }
-}
-
-func (di *discardInfo) computeDiscardInfo() {
- di.lock.Lock()
- defer di.lock.Unlock()
- if di.initialized != 0 {
- return
- }
- t := di.typ
- n := t.NumField()
-
- for i := 0; i < n; i++ {
- f := t.Field(i)
- if strings.HasPrefix(f.Name, "XXX_") {
- continue
- }
-
- dfi := discardFieldInfo{field: toField(&f)}
- tf := f.Type
-
- // Unwrap tf to get its most basic type.
- var isPointer, isSlice bool
- if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 {
- isSlice = true
- tf = tf.Elem()
- }
- if tf.Kind() == reflect.Ptr {
- isPointer = true
- tf = tf.Elem()
- }
- if isPointer && isSlice && tf.Kind() != reflect.Struct {
- panic(fmt.Sprintf("%v.%s cannot be a slice of pointers to primitive types", t, f.Name))
- }
-
- switch tf.Kind() {
- case reflect.Struct:
- switch {
- case !isPointer:
- panic(fmt.Sprintf("%v.%s cannot be a direct struct value", t, f.Name))
- case isSlice: // E.g., []*pb.T
- di := getDiscardInfo(tf)
- dfi.discard = func(src pointer) {
- sps := src.getPointerSlice()
- for _, sp := range sps {
- if !sp.isNil() {
- di.discard(sp)
- }
- }
- }
- default: // E.g., *pb.T
- di := getDiscardInfo(tf)
- dfi.discard = func(src pointer) {
- sp := src.getPointer()
- if !sp.isNil() {
- di.discard(sp)
- }
- }
- }
- case reflect.Map:
- switch {
- case isPointer || isSlice:
- panic(fmt.Sprintf("%v.%s cannot be a pointer to a map or a slice of map values", t, f.Name))
- default: // E.g., map[K]V
- if tf.Elem().Kind() == reflect.Ptr { // Proto struct (e.g., *T)
- dfi.discard = func(src pointer) {
- sm := src.asPointerTo(tf).Elem()
- if sm.Len() == 0 {
- return
- }
- for _, key := range sm.MapKeys() {
- val := sm.MapIndex(key)
- DiscardUnknown(val.Interface().(Message))
- }
- }
- } else {
- dfi.discard = func(pointer) {} // Noop
- }
- }
- case reflect.Interface:
- // Must be oneof field.
- switch {
- case isPointer || isSlice:
- panic(fmt.Sprintf("%v.%s cannot be a pointer to a interface or a slice of interface values", t, f.Name))
- default: // E.g., interface{}
- // TODO: Make this faster?
- dfi.discard = func(src pointer) {
- su := src.asPointerTo(tf).Elem()
- if !su.IsNil() {
- sv := su.Elem().Elem().Field(0)
- if sv.Kind() == reflect.Ptr && sv.IsNil() {
- return
- }
- switch sv.Type().Kind() {
- case reflect.Ptr: // Proto struct (e.g., *T)
- DiscardUnknown(sv.Interface().(Message))
- }
- }
- }
- }
- default:
- continue
- }
- di.fields = append(di.fields, dfi)
- }
-
- di.unrecognized = invalidField
- if f, ok := t.FieldByName("XXX_unrecognized"); ok {
- if f.Type != reflect.TypeOf([]byte{}) {
- panic("expected XXX_unrecognized to be of type []byte")
- }
- di.unrecognized = toField(&f)
- }
-
- atomic.StoreInt32(&di.initialized, 1)
-}
-
-func discardLegacy(m Message) {
- v := reflect.ValueOf(m)
- if v.Kind() != reflect.Ptr || v.IsNil() {
- return
- }
- v = v.Elem()
- if v.Kind() != reflect.Struct {
- return
- }
- t := v.Type()
-
- for i := 0; i < v.NumField(); i++ {
- f := t.Field(i)
- if strings.HasPrefix(f.Name, "XXX_") {
- continue
- }
- vf := v.Field(i)
- tf := f.Type
-
- // Unwrap tf to get its most basic type.
- var isPointer, isSlice bool
- if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 {
- isSlice = true
- tf = tf.Elem()
- }
- if tf.Kind() == reflect.Ptr {
- isPointer = true
- tf = tf.Elem()
- }
- if isPointer && isSlice && tf.Kind() != reflect.Struct {
- panic(fmt.Sprintf("%T.%s cannot be a slice of pointers to primitive types", m, f.Name))
- }
-
- switch tf.Kind() {
- case reflect.Struct:
- switch {
- case !isPointer:
- panic(fmt.Sprintf("%T.%s cannot be a direct struct value", m, f.Name))
- case isSlice: // E.g., []*pb.T
- for j := 0; j < vf.Len(); j++ {
- discardLegacy(vf.Index(j).Interface().(Message))
- }
- default: // E.g., *pb.T
- discardLegacy(vf.Interface().(Message))
- }
- case reflect.Map:
- switch {
- case isPointer || isSlice:
- panic(fmt.Sprintf("%T.%s cannot be a pointer to a map or a slice of map values", m, f.Name))
- default: // E.g., map[K]V
- tv := vf.Type().Elem()
- if tv.Kind() == reflect.Ptr && tv.Implements(protoMessageType) { // Proto struct (e.g., *T)
- for _, key := range vf.MapKeys() {
- val := vf.MapIndex(key)
- discardLegacy(val.Interface().(Message))
- }
- }
- }
- case reflect.Interface:
- // Must be oneof field.
- switch {
- case isPointer || isSlice:
- panic(fmt.Sprintf("%T.%s cannot be a pointer to a interface or a slice of interface values", m, f.Name))
- default: // E.g., test_proto.isCommunique_Union interface
- if !vf.IsNil() && f.Tag.Get("protobuf_oneof") != "" {
- vf = vf.Elem() // E.g., *test_proto.Communique_Msg
- if !vf.IsNil() {
- vf = vf.Elem() // E.g., test_proto.Communique_Msg
- vf = vf.Field(0) // E.g., Proto struct (e.g., *T) or primitive value
- if vf.Kind() == reflect.Ptr {
- discardLegacy(vf.Interface().(Message))
- }
- }
- }
- }
- }
- }
-
- if vf := v.FieldByName("XXX_unrecognized"); vf.IsValid() {
- if vf.Type() != reflect.TypeOf([]byte{}) {
- panic("expected XXX_unrecognized to be of type []byte")
- }
- vf.Set(reflect.ValueOf([]byte(nil)))
- }
-
- // For proto2 messages, only discard unknown fields in message extensions
- // that have been accessed via GetExtension.
- if em, err := extendable(m); err == nil {
- // Ignore lock since discardLegacy is not concurrency safe.
- emm, _ := em.extensionsRead()
- for _, mx := range emm {
- if m, ok := mx.value.(Message); ok {
- discardLegacy(m)
- }
- }
- }
-}
diff --git a/vendor/github.com/golang/protobuf/proto/encode.go b/vendor/github.com/golang/protobuf/proto/encode.go
deleted file mode 100644
index 3abfed2..0000000
--- a/vendor/github.com/golang/protobuf/proto/encode.go
+++ /dev/null
@@ -1,203 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-/*
- * Routines for encoding data into the wire format for protocol buffers.
- */
-
-import (
- "errors"
- "reflect"
-)
-
-var (
- // errRepeatedHasNil is the error returned if Marshal is called with
- // a struct with a repeated field containing a nil element.
- errRepeatedHasNil = errors.New("proto: repeated field has nil element")
-
- // errOneofHasNil is the error returned if Marshal is called with
- // a struct with a oneof field containing a nil element.
- errOneofHasNil = errors.New("proto: oneof field has nil value")
-
- // ErrNil is the error returned if Marshal is called with nil.
- ErrNil = errors.New("proto: Marshal called with nil")
-
- // ErrTooLarge is the error returned if Marshal is called with a
- // message that encodes to >2GB.
- ErrTooLarge = errors.New("proto: message encodes to over 2 GB")
-)
-
-// The fundamental encoders that put bytes on the wire.
-// Those that take integer types all accept uint64 and are
-// therefore of type valueEncoder.
-
-const maxVarintBytes = 10 // maximum length of a varint
-
-// EncodeVarint returns the varint encoding of x.
-// This is the format for the
-// int32, int64, uint32, uint64, bool, and enum
-// protocol buffer types.
-// Not used by the package itself, but helpful to clients
-// wishing to use the same encoding.
-func EncodeVarint(x uint64) []byte {
- var buf [maxVarintBytes]byte
- var n int
- for n = 0; x > 127; n++ {
- buf[n] = 0x80 | uint8(x&0x7F)
- x >>= 7
- }
- buf[n] = uint8(x)
- n++
- return buf[0:n]
-}
-
-// EncodeVarint writes a varint-encoded integer to the Buffer.
-// This is the format for the
-// int32, int64, uint32, uint64, bool, and enum
-// protocol buffer types.
-func (p *Buffer) EncodeVarint(x uint64) error {
- for x >= 1<<7 {
- p.buf = append(p.buf, uint8(x&0x7f|0x80))
- x >>= 7
- }
- p.buf = append(p.buf, uint8(x))
- return nil
-}
-
-// SizeVarint returns the varint encoding size of an integer.
-func SizeVarint(x uint64) int {
- switch {
- case x < 1<<7:
- return 1
- case x < 1<<14:
- return 2
- case x < 1<<21:
- return 3
- case x < 1<<28:
- return 4
- case x < 1<<35:
- return 5
- case x < 1<<42:
- return 6
- case x < 1<<49:
- return 7
- case x < 1<<56:
- return 8
- case x < 1<<63:
- return 9
- }
- return 10
-}
-
-// EncodeFixed64 writes a 64-bit integer to the Buffer.
-// This is the format for the
-// fixed64, sfixed64, and double protocol buffer types.
-func (p *Buffer) EncodeFixed64(x uint64) error {
- p.buf = append(p.buf,
- uint8(x),
- uint8(x>>8),
- uint8(x>>16),
- uint8(x>>24),
- uint8(x>>32),
- uint8(x>>40),
- uint8(x>>48),
- uint8(x>>56))
- return nil
-}
-
-// EncodeFixed32 writes a 32-bit integer to the Buffer.
-// This is the format for the
-// fixed32, sfixed32, and float protocol buffer types.
-func (p *Buffer) EncodeFixed32(x uint64) error {
- p.buf = append(p.buf,
- uint8(x),
- uint8(x>>8),
- uint8(x>>16),
- uint8(x>>24))
- return nil
-}
-
-// EncodeZigzag64 writes a zigzag-encoded 64-bit integer
-// to the Buffer.
-// This is the format used for the sint64 protocol buffer type.
-func (p *Buffer) EncodeZigzag64(x uint64) error {
- // use signed number to get arithmetic right shift.
- return p.EncodeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63))))
-}
-
-// EncodeZigzag32 writes a zigzag-encoded 32-bit integer
-// to the Buffer.
-// This is the format used for the sint32 protocol buffer type.
-func (p *Buffer) EncodeZigzag32(x uint64) error {
- // use signed number to get arithmetic right shift.
- return p.EncodeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31))))
-}
-
-// EncodeRawBytes writes a count-delimited byte buffer to the Buffer.
-// This is the format used for the bytes protocol buffer
-// type and for embedded messages.
-func (p *Buffer) EncodeRawBytes(b []byte) error {
- p.EncodeVarint(uint64(len(b)))
- p.buf = append(p.buf, b...)
- return nil
-}
-
-// EncodeStringBytes writes an encoded string to the Buffer.
-// This is the format used for the proto2 string type.
-func (p *Buffer) EncodeStringBytes(s string) error {
- p.EncodeVarint(uint64(len(s)))
- p.buf = append(p.buf, s...)
- return nil
-}
-
-// Marshaler is the interface representing objects that can marshal themselves.
-type Marshaler interface {
- Marshal() ([]byte, error)
-}
-
-// EncodeMessage writes the protocol buffer to the Buffer,
-// prefixed by a varint-encoded length.
-func (p *Buffer) EncodeMessage(pb Message) error {
- siz := Size(pb)
- p.EncodeVarint(uint64(siz))
- return p.Marshal(pb)
-}
-
-// All protocol buffer fields are nillable, but be careful.
-func isNil(v reflect.Value) bool {
- switch v.Kind() {
- case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:
- return v.IsNil()
- }
- return false
-}
diff --git a/vendor/github.com/golang/protobuf/proto/equal.go b/vendor/github.com/golang/protobuf/proto/equal.go
deleted file mode 100644
index f9b6e41..0000000
--- a/vendor/github.com/golang/protobuf/proto/equal.go
+++ /dev/null
@@ -1,301 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2011 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Protocol buffer comparison.
-
-package proto
-
-import (
- "bytes"
- "log"
- "reflect"
- "strings"
-)
-
-/*
-Equal returns true iff protocol buffers a and b are equal.
-The arguments must both be pointers to protocol buffer structs.
-
-Equality is defined in this way:
- - Two messages are equal iff they are the same type,
- corresponding fields are equal, unknown field sets
- are equal, and extensions sets are equal.
- - Two set scalar fields are equal iff their values are equal.
- If the fields are of a floating-point type, remember that
- NaN != x for all x, including NaN. If the message is defined
- in a proto3 .proto file, fields are not "set"; specifically,
- zero length proto3 "bytes" fields are equal (nil == {}).
- - Two repeated fields are equal iff their lengths are the same,
- and their corresponding elements are equal. Note a "bytes" field,
- although represented by []byte, is not a repeated field and the
- rule for the scalar fields described above applies.
- - Two unset fields are equal.
- - Two unknown field sets are equal if their current
- encoded state is equal.
- - Two extension sets are equal iff they have corresponding
- elements that are pairwise equal.
- - Two map fields are equal iff their lengths are the same,
- and they contain the same set of elements. Zero-length map
- fields are equal.
- - Every other combination of things are not equal.
-
-The return value is undefined if a and b are not protocol buffers.
-*/
-func Equal(a, b Message) bool {
- if a == nil || b == nil {
- return a == b
- }
- v1, v2 := reflect.ValueOf(a), reflect.ValueOf(b)
- if v1.Type() != v2.Type() {
- return false
- }
- if v1.Kind() == reflect.Ptr {
- if v1.IsNil() {
- return v2.IsNil()
- }
- if v2.IsNil() {
- return false
- }
- v1, v2 = v1.Elem(), v2.Elem()
- }
- if v1.Kind() != reflect.Struct {
- return false
- }
- return equalStruct(v1, v2)
-}
-
-// v1 and v2 are known to have the same type.
-func equalStruct(v1, v2 reflect.Value) bool {
- sprop := GetProperties(v1.Type())
- for i := 0; i < v1.NumField(); i++ {
- f := v1.Type().Field(i)
- if strings.HasPrefix(f.Name, "XXX_") {
- continue
- }
- f1, f2 := v1.Field(i), v2.Field(i)
- if f.Type.Kind() == reflect.Ptr {
- if n1, n2 := f1.IsNil(), f2.IsNil(); n1 && n2 {
- // both unset
- continue
- } else if n1 != n2 {
- // set/unset mismatch
- return false
- }
- f1, f2 = f1.Elem(), f2.Elem()
- }
- if !equalAny(f1, f2, sprop.Prop[i]) {
- return false
- }
- }
-
- if em1 := v1.FieldByName("XXX_InternalExtensions"); em1.IsValid() {
- em2 := v2.FieldByName("XXX_InternalExtensions")
- if !equalExtensions(v1.Type(), em1.Interface().(XXX_InternalExtensions), em2.Interface().(XXX_InternalExtensions)) {
- return false
- }
- }
-
- if em1 := v1.FieldByName("XXX_extensions"); em1.IsValid() {
- em2 := v2.FieldByName("XXX_extensions")
- if !equalExtMap(v1.Type(), em1.Interface().(map[int32]Extension), em2.Interface().(map[int32]Extension)) {
- return false
- }
- }
-
- uf := v1.FieldByName("XXX_unrecognized")
- if !uf.IsValid() {
- return true
- }
-
- u1 := uf.Bytes()
- u2 := v2.FieldByName("XXX_unrecognized").Bytes()
- return bytes.Equal(u1, u2)
-}
-
-// v1 and v2 are known to have the same type.
-// prop may be nil.
-func equalAny(v1, v2 reflect.Value, prop *Properties) bool {
- if v1.Type() == protoMessageType {
- m1, _ := v1.Interface().(Message)
- m2, _ := v2.Interface().(Message)
- return Equal(m1, m2)
- }
- switch v1.Kind() {
- case reflect.Bool:
- return v1.Bool() == v2.Bool()
- case reflect.Float32, reflect.Float64:
- return v1.Float() == v2.Float()
- case reflect.Int32, reflect.Int64:
- return v1.Int() == v2.Int()
- case reflect.Interface:
- // Probably a oneof field; compare the inner values.
- n1, n2 := v1.IsNil(), v2.IsNil()
- if n1 || n2 {
- return n1 == n2
- }
- e1, e2 := v1.Elem(), v2.Elem()
- if e1.Type() != e2.Type() {
- return false
- }
- return equalAny(e1, e2, nil)
- case reflect.Map:
- if v1.Len() != v2.Len() {
- return false
- }
- for _, key := range v1.MapKeys() {
- val2 := v2.MapIndex(key)
- if !val2.IsValid() {
- // This key was not found in the second map.
- return false
- }
- if !equalAny(v1.MapIndex(key), val2, nil) {
- return false
- }
- }
- return true
- case reflect.Ptr:
- // Maps may have nil values in them, so check for nil.
- if v1.IsNil() && v2.IsNil() {
- return true
- }
- if v1.IsNil() != v2.IsNil() {
- return false
- }
- return equalAny(v1.Elem(), v2.Elem(), prop)
- case reflect.Slice:
- if v1.Type().Elem().Kind() == reflect.Uint8 {
- // short circuit: []byte
-
- // Edge case: if this is in a proto3 message, a zero length
- // bytes field is considered the zero value.
- if prop != nil && prop.proto3 && v1.Len() == 0 && v2.Len() == 0 {
- return true
- }
- if v1.IsNil() != v2.IsNil() {
- return false
- }
- return bytes.Equal(v1.Interface().([]byte), v2.Interface().([]byte))
- }
-
- if v1.Len() != v2.Len() {
- return false
- }
- for i := 0; i < v1.Len(); i++ {
- if !equalAny(v1.Index(i), v2.Index(i), prop) {
- return false
- }
- }
- return true
- case reflect.String:
- return v1.Interface().(string) == v2.Interface().(string)
- case reflect.Struct:
- return equalStruct(v1, v2)
- case reflect.Uint32, reflect.Uint64:
- return v1.Uint() == v2.Uint()
- }
-
- // unknown type, so not a protocol buffer
- log.Printf("proto: don't know how to compare %v", v1)
- return false
-}
-
-// base is the struct type that the extensions are based on.
-// x1 and x2 are InternalExtensions.
-func equalExtensions(base reflect.Type, x1, x2 XXX_InternalExtensions) bool {
- em1, _ := x1.extensionsRead()
- em2, _ := x2.extensionsRead()
- return equalExtMap(base, em1, em2)
-}
-
-func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool {
- if len(em1) != len(em2) {
- return false
- }
-
- for extNum, e1 := range em1 {
- e2, ok := em2[extNum]
- if !ok {
- return false
- }
-
- m1 := extensionAsLegacyType(e1.value)
- m2 := extensionAsLegacyType(e2.value)
-
- if m1 == nil && m2 == nil {
- // Both have only encoded form.
- if bytes.Equal(e1.enc, e2.enc) {
- continue
- }
- // The bytes are different, but the extensions might still be
- // equal. We need to decode them to compare.
- }
-
- if m1 != nil && m2 != nil {
- // Both are unencoded.
- if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) {
- return false
- }
- continue
- }
-
- // At least one is encoded. To do a semantically correct comparison
- // we need to unmarshal them first.
- var desc *ExtensionDesc
- if m := extensionMaps[base]; m != nil {
- desc = m[extNum]
- }
- if desc == nil {
- // If both have only encoded form and the bytes are the same,
- // it is handled above. We get here when the bytes are different.
- // We don't know how to decode it, so just compare them as byte
- // slices.
- log.Printf("proto: don't know how to compare extension %d of %v", extNum, base)
- return false
- }
- var err error
- if m1 == nil {
- m1, err = decodeExtension(e1.enc, desc)
- }
- if m2 == nil && err == nil {
- m2, err = decodeExtension(e2.enc, desc)
- }
- if err != nil {
- // The encoded form is invalid.
- log.Printf("proto: badly encoded extension %d of %v: %v", extNum, base, err)
- return false
- }
- if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) {
- return false
- }
- }
-
- return true
-}
diff --git a/vendor/github.com/golang/protobuf/proto/extensions.go b/vendor/github.com/golang/protobuf/proto/extensions.go
deleted file mode 100644
index fa88add..0000000
--- a/vendor/github.com/golang/protobuf/proto/extensions.go
+++ /dev/null
@@ -1,607 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-/*
- * Types and routines for supporting protocol buffer extensions.
- */
-
-import (
- "errors"
- "fmt"
- "io"
- "reflect"
- "strconv"
- "sync"
-)
-
-// ErrMissingExtension is the error returned by GetExtension if the named extension is not in the message.
-var ErrMissingExtension = errors.New("proto: missing extension")
-
-// ExtensionRange represents a range of message extensions for a protocol buffer.
-// Used in code generated by the protocol compiler.
-type ExtensionRange struct {
- Start, End int32 // both inclusive
-}
-
-// extendableProto is an interface implemented by any protocol buffer generated by the current
-// proto compiler that may be extended.
-type extendableProto interface {
- Message
- ExtensionRangeArray() []ExtensionRange
- extensionsWrite() map[int32]Extension
- extensionsRead() (map[int32]Extension, sync.Locker)
-}
-
-// extendableProtoV1 is an interface implemented by a protocol buffer generated by the previous
-// version of the proto compiler that may be extended.
-type extendableProtoV1 interface {
- Message
- ExtensionRangeArray() []ExtensionRange
- ExtensionMap() map[int32]Extension
-}
-
-// extensionAdapter is a wrapper around extendableProtoV1 that implements extendableProto.
-type extensionAdapter struct {
- extendableProtoV1
-}
-
-func (e extensionAdapter) extensionsWrite() map[int32]Extension {
- return e.ExtensionMap()
-}
-
-func (e extensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) {
- return e.ExtensionMap(), notLocker{}
-}
-
-// notLocker is a sync.Locker whose Lock and Unlock methods are nops.
-type notLocker struct{}
-
-func (n notLocker) Lock() {}
-func (n notLocker) Unlock() {}
-
-// extendable returns the extendableProto interface for the given generated proto message.
-// If the proto message has the old extension format, it returns a wrapper that implements
-// the extendableProto interface.
-func extendable(p interface{}) (extendableProto, error) {
- switch p := p.(type) {
- case extendableProto:
- if isNilPtr(p) {
- return nil, fmt.Errorf("proto: nil %T is not extendable", p)
- }
- return p, nil
- case extendableProtoV1:
- if isNilPtr(p) {
- return nil, fmt.Errorf("proto: nil %T is not extendable", p)
- }
- return extensionAdapter{p}, nil
- }
- // Don't allocate a specific error containing %T:
- // this is the hot path for Clone and MarshalText.
- return nil, errNotExtendable
-}
-
-var errNotExtendable = errors.New("proto: not an extendable proto.Message")
-
-func isNilPtr(x interface{}) bool {
- v := reflect.ValueOf(x)
- return v.Kind() == reflect.Ptr && v.IsNil()
-}
-
-// XXX_InternalExtensions is an internal representation of proto extensions.
-//
-// Each generated message struct type embeds an anonymous XXX_InternalExtensions field,
-// thus gaining the unexported 'extensions' method, which can be called only from the proto package.
-//
-// The methods of XXX_InternalExtensions are not concurrency safe in general,
-// but calls to logically read-only methods such as has and get may be executed concurrently.
-type XXX_InternalExtensions struct {
- // The struct must be indirect so that if a user inadvertently copies a
- // generated message and its embedded XXX_InternalExtensions, they
- // avoid the mayhem of a copied mutex.
- //
- // The mutex serializes all logically read-only operations to p.extensionMap.
- // It is up to the client to ensure that write operations to p.extensionMap are
- // mutually exclusive with other accesses.
- p *struct {
- mu sync.Mutex
- extensionMap map[int32]Extension
- }
-}
-
-// extensionsWrite returns the extension map, creating it on first use.
-func (e *XXX_InternalExtensions) extensionsWrite() map[int32]Extension {
- if e.p == nil {
- e.p = new(struct {
- mu sync.Mutex
- extensionMap map[int32]Extension
- })
- e.p.extensionMap = make(map[int32]Extension)
- }
- return e.p.extensionMap
-}
-
-// extensionsRead returns the extensions map for read-only use. It may be nil.
-// The caller must hold the returned mutex's lock when accessing Elements within the map.
-func (e *XXX_InternalExtensions) extensionsRead() (map[int32]Extension, sync.Locker) {
- if e.p == nil {
- return nil, nil
- }
- return e.p.extensionMap, &e.p.mu
-}
-
-// ExtensionDesc represents an extension specification.
-// Used in generated code from the protocol compiler.
-type ExtensionDesc struct {
- ExtendedType Message // nil pointer to the type that is being extended
- ExtensionType interface{} // nil pointer to the extension type
- Field int32 // field number
- Name string // fully-qualified name of extension, for text formatting
- Tag string // protobuf tag style
- Filename string // name of the file in which the extension is defined
-}
-
-func (ed *ExtensionDesc) repeated() bool {
- t := reflect.TypeOf(ed.ExtensionType)
- return t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8
-}
-
-// Extension represents an extension in a message.
-type Extension struct {
- // When an extension is stored in a message using SetExtension
- // only desc and value are set. When the message is marshaled
- // enc will be set to the encoded form of the message.
- //
- // When a message is unmarshaled and contains extensions, each
- // extension will have only enc set. When such an extension is
- // accessed using GetExtension (or GetExtensions) desc and value
- // will be set.
- desc *ExtensionDesc
-
- // value is a concrete value for the extension field. Let the type of
- // desc.ExtensionType be the "API type" and the type of Extension.value
- // be the "storage type". The API type and storage type are the same except:
- // * For scalars (except []byte), the API type uses *T,
- // while the storage type uses T.
- // * For repeated fields, the API type uses []T, while the storage type
- // uses *[]T.
- //
- // The reason for the divergence is so that the storage type more naturally
- // matches what is expected of when retrieving the values through the
- // protobuf reflection APIs.
- //
- // The value may only be populated if desc is also populated.
- value interface{}
-
- // enc is the raw bytes for the extension field.
- enc []byte
-}
-
-// SetRawExtension is for testing only.
-func SetRawExtension(base Message, id int32, b []byte) {
- epb, err := extendable(base)
- if err != nil {
- return
- }
- extmap := epb.extensionsWrite()
- extmap[id] = Extension{enc: b}
-}
-
-// isExtensionField returns true iff the given field number is in an extension range.
-func isExtensionField(pb extendableProto, field int32) bool {
- for _, er := range pb.ExtensionRangeArray() {
- if er.Start <= field && field <= er.End {
- return true
- }
- }
- return false
-}
-
-// checkExtensionTypes checks that the given extension is valid for pb.
-func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error {
- var pbi interface{} = pb
- // Check the extended type.
- if ea, ok := pbi.(extensionAdapter); ok {
- pbi = ea.extendableProtoV1
- }
- if a, b := reflect.TypeOf(pbi), reflect.TypeOf(extension.ExtendedType); a != b {
- return fmt.Errorf("proto: bad extended type; %v does not extend %v", b, a)
- }
- // Check the range.
- if !isExtensionField(pb, extension.Field) {
- return errors.New("proto: bad extension number; not in declared ranges")
- }
- return nil
-}
-
-// extPropKey is sufficient to uniquely identify an extension.
-type extPropKey struct {
- base reflect.Type
- field int32
-}
-
-var extProp = struct {
- sync.RWMutex
- m map[extPropKey]*Properties
-}{
- m: make(map[extPropKey]*Properties),
-}
-
-func extensionProperties(ed *ExtensionDesc) *Properties {
- key := extPropKey{base: reflect.TypeOf(ed.ExtendedType), field: ed.Field}
-
- extProp.RLock()
- if prop, ok := extProp.m[key]; ok {
- extProp.RUnlock()
- return prop
- }
- extProp.RUnlock()
-
- extProp.Lock()
- defer extProp.Unlock()
- // Check again.
- if prop, ok := extProp.m[key]; ok {
- return prop
- }
-
- prop := new(Properties)
- prop.Init(reflect.TypeOf(ed.ExtensionType), "unknown_name", ed.Tag, nil)
- extProp.m[key] = prop
- return prop
-}
-
-// HasExtension returns whether the given extension is present in pb.
-func HasExtension(pb Message, extension *ExtensionDesc) bool {
- // TODO: Check types, field numbers, etc.?
- epb, err := extendable(pb)
- if err != nil {
- return false
- }
- extmap, mu := epb.extensionsRead()
- if extmap == nil {
- return false
- }
- mu.Lock()
- _, ok := extmap[extension.Field]
- mu.Unlock()
- return ok
-}
-
-// ClearExtension removes the given extension from pb.
-func ClearExtension(pb Message, extension *ExtensionDesc) {
- epb, err := extendable(pb)
- if err != nil {
- return
- }
- // TODO: Check types, field numbers, etc.?
- extmap := epb.extensionsWrite()
- delete(extmap, extension.Field)
-}
-
-// GetExtension retrieves a proto2 extended field from pb.
-//
-// If the descriptor is type complete (i.e., ExtensionDesc.ExtensionType is non-nil),
-// then GetExtension parses the encoded field and returns a Go value of the specified type.
-// If the field is not present, then the default value is returned (if one is specified),
-// otherwise ErrMissingExtension is reported.
-//
-// If the descriptor is not type complete (i.e., ExtensionDesc.ExtensionType is nil),
-// then GetExtension returns the raw encoded bytes of the field extension.
-func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) {
- epb, err := extendable(pb)
- if err != nil {
- return nil, err
- }
-
- if extension.ExtendedType != nil {
- // can only check type if this is a complete descriptor
- if err := checkExtensionTypes(epb, extension); err != nil {
- return nil, err
- }
- }
-
- emap, mu := epb.extensionsRead()
- if emap == nil {
- return defaultExtensionValue(extension)
- }
- mu.Lock()
- defer mu.Unlock()
- e, ok := emap[extension.Field]
- if !ok {
- // defaultExtensionValue returns the default value or
- // ErrMissingExtension if there is no default.
- return defaultExtensionValue(extension)
- }
-
- if e.value != nil {
- // Already decoded. Check the descriptor, though.
- if e.desc != extension {
- // This shouldn't happen. If it does, it means that
- // GetExtension was called twice with two different
- // descriptors with the same field number.
- return nil, errors.New("proto: descriptor conflict")
- }
- return extensionAsLegacyType(e.value), nil
- }
-
- if extension.ExtensionType == nil {
- // incomplete descriptor
- return e.enc, nil
- }
-
- v, err := decodeExtension(e.enc, extension)
- if err != nil {
- return nil, err
- }
-
- // Remember the decoded version and drop the encoded version.
- // That way it is safe to mutate what we return.
- e.value = extensionAsStorageType(v)
- e.desc = extension
- e.enc = nil
- emap[extension.Field] = e
- return extensionAsLegacyType(e.value), nil
-}
-
-// defaultExtensionValue returns the default value for extension.
-// If no default for an extension is defined ErrMissingExtension is returned.
-func defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) {
- if extension.ExtensionType == nil {
- // incomplete descriptor, so no default
- return nil, ErrMissingExtension
- }
-
- t := reflect.TypeOf(extension.ExtensionType)
- props := extensionProperties(extension)
-
- sf, _, err := fieldDefault(t, props)
- if err != nil {
- return nil, err
- }
-
- if sf == nil || sf.value == nil {
- // There is no default value.
- return nil, ErrMissingExtension
- }
-
- if t.Kind() != reflect.Ptr {
- // We do not need to return a Ptr, we can directly return sf.value.
- return sf.value, nil
- }
-
- // We need to return an interface{} that is a pointer to sf.value.
- value := reflect.New(t).Elem()
- value.Set(reflect.New(value.Type().Elem()))
- if sf.kind == reflect.Int32 {
- // We may have an int32 or an enum, but the underlying data is int32.
- // Since we can't set an int32 into a non int32 reflect.value directly
- // set it as a int32.
- value.Elem().SetInt(int64(sf.value.(int32)))
- } else {
- value.Elem().Set(reflect.ValueOf(sf.value))
- }
- return value.Interface(), nil
-}
-
-// decodeExtension decodes an extension encoded in b.
-func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) {
- t := reflect.TypeOf(extension.ExtensionType)
- unmarshal := typeUnmarshaler(t, extension.Tag)
-
- // t is a pointer to a struct, pointer to basic type or a slice.
- // Allocate space to store the pointer/slice.
- value := reflect.New(t).Elem()
-
- var err error
- for {
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- wire := int(x) & 7
-
- b, err = unmarshal(b, valToPointer(value.Addr()), wire)
- if err != nil {
- return nil, err
- }
-
- if len(b) == 0 {
- break
- }
- }
- return value.Interface(), nil
-}
-
-// GetExtensions returns a slice of the extensions present in pb that are also listed in es.
-// The returned slice has the same length as es; missing extensions will appear as nil elements.
-func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) {
- epb, err := extendable(pb)
- if err != nil {
- return nil, err
- }
- extensions = make([]interface{}, len(es))
- for i, e := range es {
- extensions[i], err = GetExtension(epb, e)
- if err == ErrMissingExtension {
- err = nil
- }
- if err != nil {
- return
- }
- }
- return
-}
-
-// ExtensionDescs returns a new slice containing pb's extension descriptors, in undefined order.
-// For non-registered extensions, ExtensionDescs returns an incomplete descriptor containing
-// just the Field field, which defines the extension's field number.
-func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) {
- epb, err := extendable(pb)
- if err != nil {
- return nil, err
- }
- registeredExtensions := RegisteredExtensions(pb)
-
- emap, mu := epb.extensionsRead()
- if emap == nil {
- return nil, nil
- }
- mu.Lock()
- defer mu.Unlock()
- extensions := make([]*ExtensionDesc, 0, len(emap))
- for extid, e := range emap {
- desc := e.desc
- if desc == nil {
- desc = registeredExtensions[extid]
- if desc == nil {
- desc = &ExtensionDesc{Field: extid}
- }
- }
-
- extensions = append(extensions, desc)
- }
- return extensions, nil
-}
-
-// SetExtension sets the specified extension of pb to the specified value.
-func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error {
- epb, err := extendable(pb)
- if err != nil {
- return err
- }
- if err := checkExtensionTypes(epb, extension); err != nil {
- return err
- }
- typ := reflect.TypeOf(extension.ExtensionType)
- if typ != reflect.TypeOf(value) {
- return fmt.Errorf("proto: bad extension value type. got: %T, want: %T", value, extension.ExtensionType)
- }
- // nil extension values need to be caught early, because the
- // encoder can't distinguish an ErrNil due to a nil extension
- // from an ErrNil due to a missing field. Extensions are
- // always optional, so the encoder would just swallow the error
- // and drop all the extensions from the encoded message.
- if reflect.ValueOf(value).IsNil() {
- return fmt.Errorf("proto: SetExtension called with nil value of type %T", value)
- }
-
- extmap := epb.extensionsWrite()
- extmap[extension.Field] = Extension{desc: extension, value: extensionAsStorageType(value)}
- return nil
-}
-
-// ClearAllExtensions clears all extensions from pb.
-func ClearAllExtensions(pb Message) {
- epb, err := extendable(pb)
- if err != nil {
- return
- }
- m := epb.extensionsWrite()
- for k := range m {
- delete(m, k)
- }
-}
-
-// A global registry of extensions.
-// The generated code will register the generated descriptors by calling RegisterExtension.
-
-var extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc)
-
-// RegisterExtension is called from the generated code.
-func RegisterExtension(desc *ExtensionDesc) {
- st := reflect.TypeOf(desc.ExtendedType).Elem()
- m := extensionMaps[st]
- if m == nil {
- m = make(map[int32]*ExtensionDesc)
- extensionMaps[st] = m
- }
- if _, ok := m[desc.Field]; ok {
- panic("proto: duplicate extension registered: " + st.String() + " " + strconv.Itoa(int(desc.Field)))
- }
- m[desc.Field] = desc
-}
-
-// RegisteredExtensions returns a map of the registered extensions of a
-// protocol buffer struct, indexed by the extension number.
-// The argument pb should be a nil pointer to the struct type.
-func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc {
- return extensionMaps[reflect.TypeOf(pb).Elem()]
-}
-
-// extensionAsLegacyType converts an value in the storage type as the API type.
-// See Extension.value.
-func extensionAsLegacyType(v interface{}) interface{} {
- switch rv := reflect.ValueOf(v); rv.Kind() {
- case reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String:
- // Represent primitive types as a pointer to the value.
- rv2 := reflect.New(rv.Type())
- rv2.Elem().Set(rv)
- v = rv2.Interface()
- case reflect.Ptr:
- // Represent slice types as the value itself.
- switch rv.Type().Elem().Kind() {
- case reflect.Slice:
- if rv.IsNil() {
- v = reflect.Zero(rv.Type().Elem()).Interface()
- } else {
- v = rv.Elem().Interface()
- }
- }
- }
- return v
-}
-
-// extensionAsStorageType converts an value in the API type as the storage type.
-// See Extension.value.
-func extensionAsStorageType(v interface{}) interface{} {
- switch rv := reflect.ValueOf(v); rv.Kind() {
- case reflect.Ptr:
- // Represent slice types as the value itself.
- switch rv.Type().Elem().Kind() {
- case reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String:
- if rv.IsNil() {
- v = reflect.Zero(rv.Type().Elem()).Interface()
- } else {
- v = rv.Elem().Interface()
- }
- }
- case reflect.Slice:
- // Represent slice types as a pointer to the value.
- if rv.Type().Elem().Kind() != reflect.Uint8 {
- rv2 := reflect.New(rv.Type())
- rv2.Elem().Set(rv)
- v = rv2.Interface()
- }
- }
- return v
-}
diff --git a/vendor/github.com/golang/protobuf/proto/lib.go b/vendor/github.com/golang/protobuf/proto/lib.go
deleted file mode 100644
index fdd328b..0000000
--- a/vendor/github.com/golang/protobuf/proto/lib.go
+++ /dev/null
@@ -1,965 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-/*
-Package proto converts data structures to and from the wire format of
-protocol buffers. It works in concert with the Go source code generated
-for .proto files by the protocol compiler.
-
-A summary of the properties of the protocol buffer interface
-for a protocol buffer variable v:
-
- - Names are turned from camel_case to CamelCase for export.
- - There are no methods on v to set fields; just treat
- them as structure fields.
- - There are getters that return a field's value if set,
- and return the field's default value if unset.
- The getters work even if the receiver is a nil message.
- - The zero value for a struct is its correct initialization state.
- All desired fields must be set before marshaling.
- - A Reset() method will restore a protobuf struct to its zero state.
- - Non-repeated fields are pointers to the values; nil means unset.
- That is, optional or required field int32 f becomes F *int32.
- - Repeated fields are slices.
- - Helper functions are available to aid the setting of fields.
- msg.Foo = proto.String("hello") // set field
- - Constants are defined to hold the default values of all fields that
- have them. They have the form Default_StructName_FieldName.
- Because the getter methods handle defaulted values,
- direct use of these constants should be rare.
- - Enums are given type names and maps from names to values.
- Enum values are prefixed by the enclosing message's name, or by the
- enum's type name if it is a top-level enum. Enum types have a String
- method, and a Enum method to assist in message construction.
- - Nested messages, groups and enums have type names prefixed with the name of
- the surrounding message type.
- - Extensions are given descriptor names that start with E_,
- followed by an underscore-delimited list of the nested messages
- that contain it (if any) followed by the CamelCased name of the
- extension field itself. HasExtension, ClearExtension, GetExtension
- and SetExtension are functions for manipulating extensions.
- - Oneof field sets are given a single field in their message,
- with distinguished wrapper types for each possible field value.
- - Marshal and Unmarshal are functions to encode and decode the wire format.
-
-When the .proto file specifies `syntax="proto3"`, there are some differences:
-
- - Non-repeated fields of non-message type are values instead of pointers.
- - Enum types do not get an Enum method.
-
-The simplest way to describe this is to see an example.
-Given file test.proto, containing
-
- package example;
-
- enum FOO { X = 17; }
-
- message Test {
- required string label = 1;
- optional int32 type = 2 [default=77];
- repeated int64 reps = 3;
- optional group OptionalGroup = 4 {
- required string RequiredField = 5;
- }
- oneof union {
- int32 number = 6;
- string name = 7;
- }
- }
-
-The resulting file, test.pb.go, is:
-
- package example
-
- import proto "github.com/golang/protobuf/proto"
- import math "math"
-
- type FOO int32
- const (
- FOO_X FOO = 17
- )
- var FOO_name = map[int32]string{
- 17: "X",
- }
- var FOO_value = map[string]int32{
- "X": 17,
- }
-
- func (x FOO) Enum() *FOO {
- p := new(FOO)
- *p = x
- return p
- }
- func (x FOO) String() string {
- return proto.EnumName(FOO_name, int32(x))
- }
- func (x *FOO) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(FOO_value, data)
- if err != nil {
- return err
- }
- *x = FOO(value)
- return nil
- }
-
- type Test struct {
- Label *string `protobuf:"bytes,1,req,name=label" json:"label,omitempty"`
- Type *int32 `protobuf:"varint,2,opt,name=type,def=77" json:"type,omitempty"`
- Reps []int64 `protobuf:"varint,3,rep,name=reps" json:"reps,omitempty"`
- Optionalgroup *Test_OptionalGroup `protobuf:"group,4,opt,name=OptionalGroup" json:"optionalgroup,omitempty"`
- // Types that are valid to be assigned to Union:
- // *Test_Number
- // *Test_Name
- Union isTest_Union `protobuf_oneof:"union"`
- XXX_unrecognized []byte `json:"-"`
- }
- func (m *Test) Reset() { *m = Test{} }
- func (m *Test) String() string { return proto.CompactTextString(m) }
- func (*Test) ProtoMessage() {}
-
- type isTest_Union interface {
- isTest_Union()
- }
-
- type Test_Number struct {
- Number int32 `protobuf:"varint,6,opt,name=number"`
- }
- type Test_Name struct {
- Name string `protobuf:"bytes,7,opt,name=name"`
- }
-
- func (*Test_Number) isTest_Union() {}
- func (*Test_Name) isTest_Union() {}
-
- func (m *Test) GetUnion() isTest_Union {
- if m != nil {
- return m.Union
- }
- return nil
- }
- const Default_Test_Type int32 = 77
-
- func (m *Test) GetLabel() string {
- if m != nil && m.Label != nil {
- return *m.Label
- }
- return ""
- }
-
- func (m *Test) GetType() int32 {
- if m != nil && m.Type != nil {
- return *m.Type
- }
- return Default_Test_Type
- }
-
- func (m *Test) GetOptionalgroup() *Test_OptionalGroup {
- if m != nil {
- return m.Optionalgroup
- }
- return nil
- }
-
- type Test_OptionalGroup struct {
- RequiredField *string `protobuf:"bytes,5,req" json:"RequiredField,omitempty"`
- }
- func (m *Test_OptionalGroup) Reset() { *m = Test_OptionalGroup{} }
- func (m *Test_OptionalGroup) String() string { return proto.CompactTextString(m) }
-
- func (m *Test_OptionalGroup) GetRequiredField() string {
- if m != nil && m.RequiredField != nil {
- return *m.RequiredField
- }
- return ""
- }
-
- func (m *Test) GetNumber() int32 {
- if x, ok := m.GetUnion().(*Test_Number); ok {
- return x.Number
- }
- return 0
- }
-
- func (m *Test) GetName() string {
- if x, ok := m.GetUnion().(*Test_Name); ok {
- return x.Name
- }
- return ""
- }
-
- func init() {
- proto.RegisterEnum("example.FOO", FOO_name, FOO_value)
- }
-
-To create and play with a Test object:
-
- package main
-
- import (
- "log"
-
- "github.com/golang/protobuf/proto"
- pb "./example.pb"
- )
-
- func main() {
- test := &pb.Test{
- Label: proto.String("hello"),
- Type: proto.Int32(17),
- Reps: []int64{1, 2, 3},
- Optionalgroup: &pb.Test_OptionalGroup{
- RequiredField: proto.String("good bye"),
- },
- Union: &pb.Test_Name{"fred"},
- }
- data, err := proto.Marshal(test)
- if err != nil {
- log.Fatal("marshaling error: ", err)
- }
- newTest := &pb.Test{}
- err = proto.Unmarshal(data, newTest)
- if err != nil {
- log.Fatal("unmarshaling error: ", err)
- }
- // Now test and newTest contain the same data.
- if test.GetLabel() != newTest.GetLabel() {
- log.Fatalf("data mismatch %q != %q", test.GetLabel(), newTest.GetLabel())
- }
- // Use a type switch to determine which oneof was set.
- switch u := test.Union.(type) {
- case *pb.Test_Number: // u.Number contains the number.
- case *pb.Test_Name: // u.Name contains the string.
- }
- // etc.
- }
-*/
-package proto
-
-import (
- "encoding/json"
- "fmt"
- "log"
- "reflect"
- "sort"
- "strconv"
- "sync"
-)
-
-// RequiredNotSetError is an error type returned by either Marshal or Unmarshal.
-// Marshal reports this when a required field is not initialized.
-// Unmarshal reports this when a required field is missing from the wire data.
-type RequiredNotSetError struct{ field string }
-
-func (e *RequiredNotSetError) Error() string {
- if e.field == "" {
- return fmt.Sprintf("proto: required field not set")
- }
- return fmt.Sprintf("proto: required field %q not set", e.field)
-}
-func (e *RequiredNotSetError) RequiredNotSet() bool {
- return true
-}
-
-type invalidUTF8Error struct{ field string }
-
-func (e *invalidUTF8Error) Error() string {
- if e.field == "" {
- return "proto: invalid UTF-8 detected"
- }
- return fmt.Sprintf("proto: field %q contains invalid UTF-8", e.field)
-}
-func (e *invalidUTF8Error) InvalidUTF8() bool {
- return true
-}
-
-// errInvalidUTF8 is a sentinel error to identify fields with invalid UTF-8.
-// This error should not be exposed to the external API as such errors should
-// be recreated with the field information.
-var errInvalidUTF8 = &invalidUTF8Error{}
-
-// isNonFatal reports whether the error is either a RequiredNotSet error
-// or a InvalidUTF8 error.
-func isNonFatal(err error) bool {
- if re, ok := err.(interface{ RequiredNotSet() bool }); ok && re.RequiredNotSet() {
- return true
- }
- if re, ok := err.(interface{ InvalidUTF8() bool }); ok && re.InvalidUTF8() {
- return true
- }
- return false
-}
-
-type nonFatal struct{ E error }
-
-// Merge merges err into nf and reports whether it was successful.
-// Otherwise it returns false for any fatal non-nil errors.
-func (nf *nonFatal) Merge(err error) (ok bool) {
- if err == nil {
- return true // not an error
- }
- if !isNonFatal(err) {
- return false // fatal error
- }
- if nf.E == nil {
- nf.E = err // store first instance of non-fatal error
- }
- return true
-}
-
-// Message is implemented by generated protocol buffer messages.
-type Message interface {
- Reset()
- String() string
- ProtoMessage()
-}
-
-// A Buffer is a buffer manager for marshaling and unmarshaling
-// protocol buffers. It may be reused between invocations to
-// reduce memory usage. It is not necessary to use a Buffer;
-// the global functions Marshal and Unmarshal create a
-// temporary Buffer and are fine for most applications.
-type Buffer struct {
- buf []byte // encode/decode byte stream
- index int // read point
-
- deterministic bool
-}
-
-// NewBuffer allocates a new Buffer and initializes its internal data to
-// the contents of the argument slice.
-func NewBuffer(e []byte) *Buffer {
- return &Buffer{buf: e}
-}
-
-// Reset resets the Buffer, ready for marshaling a new protocol buffer.
-func (p *Buffer) Reset() {
- p.buf = p.buf[0:0] // for reading/writing
- p.index = 0 // for reading
-}
-
-// SetBuf replaces the internal buffer with the slice,
-// ready for unmarshaling the contents of the slice.
-func (p *Buffer) SetBuf(s []byte) {
- p.buf = s
- p.index = 0
-}
-
-// Bytes returns the contents of the Buffer.
-func (p *Buffer) Bytes() []byte { return p.buf }
-
-// SetDeterministic sets whether to use deterministic serialization.
-//
-// Deterministic serialization guarantees that for a given binary, equal
-// messages will always be serialized to the same bytes. This implies:
-//
-// - Repeated serialization of a message will return the same bytes.
-// - Different processes of the same binary (which may be executing on
-// different machines) will serialize equal messages to the same bytes.
-//
-// Note that the deterministic serialization is NOT canonical across
-// languages. It is not guaranteed to remain stable over time. It is unstable
-// across different builds with schema changes due to unknown fields.
-// Users who need canonical serialization (e.g., persistent storage in a
-// canonical form, fingerprinting, etc.) should define their own
-// canonicalization specification and implement their own serializer rather
-// than relying on this API.
-//
-// If deterministic serialization is requested, map entries will be sorted
-// by keys in lexographical order. This is an implementation detail and
-// subject to change.
-func (p *Buffer) SetDeterministic(deterministic bool) {
- p.deterministic = deterministic
-}
-
-/*
- * Helper routines for simplifying the creation of optional fields of basic type.
- */
-
-// Bool is a helper routine that allocates a new bool value
-// to store v and returns a pointer to it.
-func Bool(v bool) *bool {
- return &v
-}
-
-// Int32 is a helper routine that allocates a new int32 value
-// to store v and returns a pointer to it.
-func Int32(v int32) *int32 {
- return &v
-}
-
-// Int is a helper routine that allocates a new int32 value
-// to store v and returns a pointer to it, but unlike Int32
-// its argument value is an int.
-func Int(v int) *int32 {
- p := new(int32)
- *p = int32(v)
- return p
-}
-
-// Int64 is a helper routine that allocates a new int64 value
-// to store v and returns a pointer to it.
-func Int64(v int64) *int64 {
- return &v
-}
-
-// Float32 is a helper routine that allocates a new float32 value
-// to store v and returns a pointer to it.
-func Float32(v float32) *float32 {
- return &v
-}
-
-// Float64 is a helper routine that allocates a new float64 value
-// to store v and returns a pointer to it.
-func Float64(v float64) *float64 {
- return &v
-}
-
-// Uint32 is a helper routine that allocates a new uint32 value
-// to store v and returns a pointer to it.
-func Uint32(v uint32) *uint32 {
- return &v
-}
-
-// Uint64 is a helper routine that allocates a new uint64 value
-// to store v and returns a pointer to it.
-func Uint64(v uint64) *uint64 {
- return &v
-}
-
-// String is a helper routine that allocates a new string value
-// to store v and returns a pointer to it.
-func String(v string) *string {
- return &v
-}
-
-// EnumName is a helper function to simplify printing protocol buffer enums
-// by name. Given an enum map and a value, it returns a useful string.
-func EnumName(m map[int32]string, v int32) string {
- s, ok := m[v]
- if ok {
- return s
- }
- return strconv.Itoa(int(v))
-}
-
-// UnmarshalJSONEnum is a helper function to simplify recovering enum int values
-// from their JSON-encoded representation. Given a map from the enum's symbolic
-// names to its int values, and a byte buffer containing the JSON-encoded
-// value, it returns an int32 that can be cast to the enum type by the caller.
-//
-// The function can deal with both JSON representations, numeric and symbolic.
-func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) {
- if data[0] == '"' {
- // New style: enums are strings.
- var repr string
- if err := json.Unmarshal(data, &repr); err != nil {
- return -1, err
- }
- val, ok := m[repr]
- if !ok {
- return 0, fmt.Errorf("unrecognized enum %s value %q", enumName, repr)
- }
- return val, nil
- }
- // Old style: enums are ints.
- var val int32
- if err := json.Unmarshal(data, &val); err != nil {
- return 0, fmt.Errorf("cannot unmarshal %#q into enum %s", data, enumName)
- }
- return val, nil
-}
-
-// DebugPrint dumps the encoded data in b in a debugging format with a header
-// including the string s. Used in testing but made available for general debugging.
-func (p *Buffer) DebugPrint(s string, b []byte) {
- var u uint64
-
- obuf := p.buf
- index := p.index
- p.buf = b
- p.index = 0
- depth := 0
-
- fmt.Printf("\n--- %s ---\n", s)
-
-out:
- for {
- for i := 0; i < depth; i++ {
- fmt.Print(" ")
- }
-
- index := p.index
- if index == len(p.buf) {
- break
- }
-
- op, err := p.DecodeVarint()
- if err != nil {
- fmt.Printf("%3d: fetching op err %v\n", index, err)
- break out
- }
- tag := op >> 3
- wire := op & 7
-
- switch wire {
- default:
- fmt.Printf("%3d: t=%3d unknown wire=%d\n",
- index, tag, wire)
- break out
-
- case WireBytes:
- var r []byte
-
- r, err = p.DecodeRawBytes(false)
- if err != nil {
- break out
- }
- fmt.Printf("%3d: t=%3d bytes [%d]", index, tag, len(r))
- if len(r) <= 6 {
- for i := 0; i < len(r); i++ {
- fmt.Printf(" %.2x", r[i])
- }
- } else {
- for i := 0; i < 3; i++ {
- fmt.Printf(" %.2x", r[i])
- }
- fmt.Printf(" ..")
- for i := len(r) - 3; i < len(r); i++ {
- fmt.Printf(" %.2x", r[i])
- }
- }
- fmt.Printf("\n")
-
- case WireFixed32:
- u, err = p.DecodeFixed32()
- if err != nil {
- fmt.Printf("%3d: t=%3d fix32 err %v\n", index, tag, err)
- break out
- }
- fmt.Printf("%3d: t=%3d fix32 %d\n", index, tag, u)
-
- case WireFixed64:
- u, err = p.DecodeFixed64()
- if err != nil {
- fmt.Printf("%3d: t=%3d fix64 err %v\n", index, tag, err)
- break out
- }
- fmt.Printf("%3d: t=%3d fix64 %d\n", index, tag, u)
-
- case WireVarint:
- u, err = p.DecodeVarint()
- if err != nil {
- fmt.Printf("%3d: t=%3d varint err %v\n", index, tag, err)
- break out
- }
- fmt.Printf("%3d: t=%3d varint %d\n", index, tag, u)
-
- case WireStartGroup:
- fmt.Printf("%3d: t=%3d start\n", index, tag)
- depth++
-
- case WireEndGroup:
- depth--
- fmt.Printf("%3d: t=%3d end\n", index, tag)
- }
- }
-
- if depth != 0 {
- fmt.Printf("%3d: start-end not balanced %d\n", p.index, depth)
- }
- fmt.Printf("\n")
-
- p.buf = obuf
- p.index = index
-}
-
-// SetDefaults sets unset protocol buffer fields to their default values.
-// It only modifies fields that are both unset and have defined defaults.
-// It recursively sets default values in any non-nil sub-messages.
-func SetDefaults(pb Message) {
- setDefaults(reflect.ValueOf(pb), true, false)
-}
-
-// v is a pointer to a struct.
-func setDefaults(v reflect.Value, recur, zeros bool) {
- v = v.Elem()
-
- defaultMu.RLock()
- dm, ok := defaults[v.Type()]
- defaultMu.RUnlock()
- if !ok {
- dm = buildDefaultMessage(v.Type())
- defaultMu.Lock()
- defaults[v.Type()] = dm
- defaultMu.Unlock()
- }
-
- for _, sf := range dm.scalars {
- f := v.Field(sf.index)
- if !f.IsNil() {
- // field already set
- continue
- }
- dv := sf.value
- if dv == nil && !zeros {
- // no explicit default, and don't want to set zeros
- continue
- }
- fptr := f.Addr().Interface() // **T
- // TODO: Consider batching the allocations we do here.
- switch sf.kind {
- case reflect.Bool:
- b := new(bool)
- if dv != nil {
- *b = dv.(bool)
- }
- *(fptr.(**bool)) = b
- case reflect.Float32:
- f := new(float32)
- if dv != nil {
- *f = dv.(float32)
- }
- *(fptr.(**float32)) = f
- case reflect.Float64:
- f := new(float64)
- if dv != nil {
- *f = dv.(float64)
- }
- *(fptr.(**float64)) = f
- case reflect.Int32:
- // might be an enum
- if ft := f.Type(); ft != int32PtrType {
- // enum
- f.Set(reflect.New(ft.Elem()))
- if dv != nil {
- f.Elem().SetInt(int64(dv.(int32)))
- }
- } else {
- // int32 field
- i := new(int32)
- if dv != nil {
- *i = dv.(int32)
- }
- *(fptr.(**int32)) = i
- }
- case reflect.Int64:
- i := new(int64)
- if dv != nil {
- *i = dv.(int64)
- }
- *(fptr.(**int64)) = i
- case reflect.String:
- s := new(string)
- if dv != nil {
- *s = dv.(string)
- }
- *(fptr.(**string)) = s
- case reflect.Uint8:
- // exceptional case: []byte
- var b []byte
- if dv != nil {
- db := dv.([]byte)
- b = make([]byte, len(db))
- copy(b, db)
- } else {
- b = []byte{}
- }
- *(fptr.(*[]byte)) = b
- case reflect.Uint32:
- u := new(uint32)
- if dv != nil {
- *u = dv.(uint32)
- }
- *(fptr.(**uint32)) = u
- case reflect.Uint64:
- u := new(uint64)
- if dv != nil {
- *u = dv.(uint64)
- }
- *(fptr.(**uint64)) = u
- default:
- log.Printf("proto: can't set default for field %v (sf.kind=%v)", f, sf.kind)
- }
- }
-
- for _, ni := range dm.nested {
- f := v.Field(ni)
- // f is *T or []*T or map[T]*T
- switch f.Kind() {
- case reflect.Ptr:
- if f.IsNil() {
- continue
- }
- setDefaults(f, recur, zeros)
-
- case reflect.Slice:
- for i := 0; i < f.Len(); i++ {
- e := f.Index(i)
- if e.IsNil() {
- continue
- }
- setDefaults(e, recur, zeros)
- }
-
- case reflect.Map:
- for _, k := range f.MapKeys() {
- e := f.MapIndex(k)
- if e.IsNil() {
- continue
- }
- setDefaults(e, recur, zeros)
- }
- }
- }
-}
-
-var (
- // defaults maps a protocol buffer struct type to a slice of the fields,
- // with its scalar fields set to their proto-declared non-zero default values.
- defaultMu sync.RWMutex
- defaults = make(map[reflect.Type]defaultMessage)
-
- int32PtrType = reflect.TypeOf((*int32)(nil))
-)
-
-// defaultMessage represents information about the default values of a message.
-type defaultMessage struct {
- scalars []scalarField
- nested []int // struct field index of nested messages
-}
-
-type scalarField struct {
- index int // struct field index
- kind reflect.Kind // element type (the T in *T or []T)
- value interface{} // the proto-declared default value, or nil
-}
-
-// t is a struct type.
-func buildDefaultMessage(t reflect.Type) (dm defaultMessage) {
- sprop := GetProperties(t)
- for _, prop := range sprop.Prop {
- fi, ok := sprop.decoderTags.get(prop.Tag)
- if !ok {
- // XXX_unrecognized
- continue
- }
- ft := t.Field(fi).Type
-
- sf, nested, err := fieldDefault(ft, prop)
- switch {
- case err != nil:
- log.Print(err)
- case nested:
- dm.nested = append(dm.nested, fi)
- case sf != nil:
- sf.index = fi
- dm.scalars = append(dm.scalars, *sf)
- }
- }
-
- return dm
-}
-
-// fieldDefault returns the scalarField for field type ft.
-// sf will be nil if the field can not have a default.
-// nestedMessage will be true if this is a nested message.
-// Note that sf.index is not set on return.
-func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMessage bool, err error) {
- var canHaveDefault bool
- switch ft.Kind() {
- case reflect.Ptr:
- if ft.Elem().Kind() == reflect.Struct {
- nestedMessage = true
- } else {
- canHaveDefault = true // proto2 scalar field
- }
-
- case reflect.Slice:
- switch ft.Elem().Kind() {
- case reflect.Ptr:
- nestedMessage = true // repeated message
- case reflect.Uint8:
- canHaveDefault = true // bytes field
- }
-
- case reflect.Map:
- if ft.Elem().Kind() == reflect.Ptr {
- nestedMessage = true // map with message values
- }
- }
-
- if !canHaveDefault {
- if nestedMessage {
- return nil, true, nil
- }
- return nil, false, nil
- }
-
- // We now know that ft is a pointer or slice.
- sf = &scalarField{kind: ft.Elem().Kind()}
-
- // scalar fields without defaults
- if !prop.HasDefault {
- return sf, false, nil
- }
-
- // a scalar field: either *T or []byte
- switch ft.Elem().Kind() {
- case reflect.Bool:
- x, err := strconv.ParseBool(prop.Default)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default bool %q: %v", prop.Default, err)
- }
- sf.value = x
- case reflect.Float32:
- x, err := strconv.ParseFloat(prop.Default, 32)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default float32 %q: %v", prop.Default, err)
- }
- sf.value = float32(x)
- case reflect.Float64:
- x, err := strconv.ParseFloat(prop.Default, 64)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default float64 %q: %v", prop.Default, err)
- }
- sf.value = x
- case reflect.Int32:
- x, err := strconv.ParseInt(prop.Default, 10, 32)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default int32 %q: %v", prop.Default, err)
- }
- sf.value = int32(x)
- case reflect.Int64:
- x, err := strconv.ParseInt(prop.Default, 10, 64)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default int64 %q: %v", prop.Default, err)
- }
- sf.value = x
- case reflect.String:
- sf.value = prop.Default
- case reflect.Uint8:
- // []byte (not *uint8)
- sf.value = []byte(prop.Default)
- case reflect.Uint32:
- x, err := strconv.ParseUint(prop.Default, 10, 32)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default uint32 %q: %v", prop.Default, err)
- }
- sf.value = uint32(x)
- case reflect.Uint64:
- x, err := strconv.ParseUint(prop.Default, 10, 64)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default uint64 %q: %v", prop.Default, err)
- }
- sf.value = x
- default:
- return nil, false, fmt.Errorf("proto: unhandled def kind %v", ft.Elem().Kind())
- }
-
- return sf, false, nil
-}
-
-// mapKeys returns a sort.Interface to be used for sorting the map keys.
-// Map fields may have key types of non-float scalars, strings and enums.
-func mapKeys(vs []reflect.Value) sort.Interface {
- s := mapKeySorter{vs: vs}
-
- // Type specialization per https://developers.google.com/protocol-buffers/docs/proto#maps.
- if len(vs) == 0 {
- return s
- }
- switch vs[0].Kind() {
- case reflect.Int32, reflect.Int64:
- s.less = func(a, b reflect.Value) bool { return a.Int() < b.Int() }
- case reflect.Uint32, reflect.Uint64:
- s.less = func(a, b reflect.Value) bool { return a.Uint() < b.Uint() }
- case reflect.Bool:
- s.less = func(a, b reflect.Value) bool { return !a.Bool() && b.Bool() } // false < true
- case reflect.String:
- s.less = func(a, b reflect.Value) bool { return a.String() < b.String() }
- default:
- panic(fmt.Sprintf("unsupported map key type: %v", vs[0].Kind()))
- }
-
- return s
-}
-
-type mapKeySorter struct {
- vs []reflect.Value
- less func(a, b reflect.Value) bool
-}
-
-func (s mapKeySorter) Len() int { return len(s.vs) }
-func (s mapKeySorter) Swap(i, j int) { s.vs[i], s.vs[j] = s.vs[j], s.vs[i] }
-func (s mapKeySorter) Less(i, j int) bool {
- return s.less(s.vs[i], s.vs[j])
-}
-
-// isProto3Zero reports whether v is a zero proto3 value.
-func isProto3Zero(v reflect.Value) bool {
- switch v.Kind() {
- case reflect.Bool:
- return !v.Bool()
- case reflect.Int32, reflect.Int64:
- return v.Int() == 0
- case reflect.Uint32, reflect.Uint64:
- return v.Uint() == 0
- case reflect.Float32, reflect.Float64:
- return v.Float() == 0
- case reflect.String:
- return v.String() == ""
- }
- return false
-}
-
-const (
- // ProtoPackageIsVersion3 is referenced from generated protocol buffer files
- // to assert that that code is compatible with this version of the proto package.
- ProtoPackageIsVersion3 = true
-
- // ProtoPackageIsVersion2 is referenced from generated protocol buffer files
- // to assert that that code is compatible with this version of the proto package.
- ProtoPackageIsVersion2 = true
-
- // ProtoPackageIsVersion1 is referenced from generated protocol buffer files
- // to assert that that code is compatible with this version of the proto package.
- ProtoPackageIsVersion1 = true
-)
-
-// InternalMessageInfo is a type used internally by generated .pb.go files.
-// This type is not intended to be used by non-generated code.
-// This type is not subject to any compatibility guarantee.
-type InternalMessageInfo struct {
- marshal *marshalInfo
- unmarshal *unmarshalInfo
- merge *mergeInfo
- discard *discardInfo
-}
diff --git a/vendor/github.com/golang/protobuf/proto/message_set.go b/vendor/github.com/golang/protobuf/proto/message_set.go
deleted file mode 100644
index f48a756..0000000
--- a/vendor/github.com/golang/protobuf/proto/message_set.go
+++ /dev/null
@@ -1,181 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-/*
- * Support for message sets.
- */
-
-import (
- "errors"
-)
-
-// errNoMessageTypeID occurs when a protocol buffer does not have a message type ID.
-// A message type ID is required for storing a protocol buffer in a message set.
-var errNoMessageTypeID = errors.New("proto does not have a message type ID")
-
-// The first two types (_MessageSet_Item and messageSet)
-// model what the protocol compiler produces for the following protocol message:
-// message MessageSet {
-// repeated group Item = 1 {
-// required int32 type_id = 2;
-// required string message = 3;
-// };
-// }
-// That is the MessageSet wire format. We can't use a proto to generate these
-// because that would introduce a circular dependency between it and this package.
-
-type _MessageSet_Item struct {
- TypeId *int32 `protobuf:"varint,2,req,name=type_id"`
- Message []byte `protobuf:"bytes,3,req,name=message"`
-}
-
-type messageSet struct {
- Item []*_MessageSet_Item `protobuf:"group,1,rep"`
- XXX_unrecognized []byte
- // TODO: caching?
-}
-
-// Make sure messageSet is a Message.
-var _ Message = (*messageSet)(nil)
-
-// messageTypeIder is an interface satisfied by a protocol buffer type
-// that may be stored in a MessageSet.
-type messageTypeIder interface {
- MessageTypeId() int32
-}
-
-func (ms *messageSet) find(pb Message) *_MessageSet_Item {
- mti, ok := pb.(messageTypeIder)
- if !ok {
- return nil
- }
- id := mti.MessageTypeId()
- for _, item := range ms.Item {
- if *item.TypeId == id {
- return item
- }
- }
- return nil
-}
-
-func (ms *messageSet) Has(pb Message) bool {
- return ms.find(pb) != nil
-}
-
-func (ms *messageSet) Unmarshal(pb Message) error {
- if item := ms.find(pb); item != nil {
- return Unmarshal(item.Message, pb)
- }
- if _, ok := pb.(messageTypeIder); !ok {
- return errNoMessageTypeID
- }
- return nil // TODO: return error instead?
-}
-
-func (ms *messageSet) Marshal(pb Message) error {
- msg, err := Marshal(pb)
- if err != nil {
- return err
- }
- if item := ms.find(pb); item != nil {
- // reuse existing item
- item.Message = msg
- return nil
- }
-
- mti, ok := pb.(messageTypeIder)
- if !ok {
- return errNoMessageTypeID
- }
-
- mtid := mti.MessageTypeId()
- ms.Item = append(ms.Item, &_MessageSet_Item{
- TypeId: &mtid,
- Message: msg,
- })
- return nil
-}
-
-func (ms *messageSet) Reset() { *ms = messageSet{} }
-func (ms *messageSet) String() string { return CompactTextString(ms) }
-func (*messageSet) ProtoMessage() {}
-
-// Support for the message_set_wire_format message option.
-
-func skipVarint(buf []byte) []byte {
- i := 0
- for ; buf[i]&0x80 != 0; i++ {
- }
- return buf[i+1:]
-}
-
-// unmarshalMessageSet decodes the extension map encoded in buf in the message set wire format.
-// It is called by Unmarshal methods on protocol buffer messages with the message_set_wire_format option.
-func unmarshalMessageSet(buf []byte, exts interface{}) error {
- var m map[int32]Extension
- switch exts := exts.(type) {
- case *XXX_InternalExtensions:
- m = exts.extensionsWrite()
- case map[int32]Extension:
- m = exts
- default:
- return errors.New("proto: not an extension map")
- }
-
- ms := new(messageSet)
- if err := Unmarshal(buf, ms); err != nil {
- return err
- }
- for _, item := range ms.Item {
- id := *item.TypeId
- msg := item.Message
-
- // Restore wire type and field number varint, plus length varint.
- // Be careful to preserve duplicate items.
- b := EncodeVarint(uint64(id)<<3 | WireBytes)
- if ext, ok := m[id]; ok {
- // Existing data; rip off the tag and length varint
- // so we join the new data correctly.
- // We can assume that ext.enc is set because we are unmarshaling.
- o := ext.enc[len(b):] // skip wire type and field number
- _, n := DecodeVarint(o) // calculate length of length varint
- o = o[n:] // skip length varint
- msg = append(o, msg...) // join old data and new data
- }
- b = append(b, EncodeVarint(uint64(len(msg)))...)
- b = append(b, msg...)
-
- m[id] = Extension{enc: b}
- }
- return nil
-}
diff --git a/vendor/github.com/golang/protobuf/proto/pointer_reflect.go b/vendor/github.com/golang/protobuf/proto/pointer_reflect.go
deleted file mode 100644
index 94fa919..0000000
--- a/vendor/github.com/golang/protobuf/proto/pointer_reflect.go
+++ /dev/null
@@ -1,360 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2012 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// +build purego appengine js
-
-// This file contains an implementation of proto field accesses using package reflect.
-// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can
-// be used on App Engine.
-
-package proto
-
-import (
- "reflect"
- "sync"
-)
-
-const unsafeAllowed = false
-
-// A field identifies a field in a struct, accessible from a pointer.
-// In this implementation, a field is identified by the sequence of field indices
-// passed to reflect's FieldByIndex.
-type field []int
-
-// toField returns a field equivalent to the given reflect field.
-func toField(f *reflect.StructField) field {
- return f.Index
-}
-
-// invalidField is an invalid field identifier.
-var invalidField = field(nil)
-
-// zeroField is a noop when calling pointer.offset.
-var zeroField = field([]int{})
-
-// IsValid reports whether the field identifier is valid.
-func (f field) IsValid() bool { return f != nil }
-
-// The pointer type is for the table-driven decoder.
-// The implementation here uses a reflect.Value of pointer type to
-// create a generic pointer. In pointer_unsafe.go we use unsafe
-// instead of reflect to implement the same (but faster) interface.
-type pointer struct {
- v reflect.Value
-}
-
-// toPointer converts an interface of pointer type to a pointer
-// that points to the same target.
-func toPointer(i *Message) pointer {
- return pointer{v: reflect.ValueOf(*i)}
-}
-
-// toAddrPointer converts an interface to a pointer that points to
-// the interface data.
-func toAddrPointer(i *interface{}, isptr, deref bool) pointer {
- v := reflect.ValueOf(*i)
- u := reflect.New(v.Type())
- u.Elem().Set(v)
- if deref {
- u = u.Elem()
- }
- return pointer{v: u}
-}
-
-// valToPointer converts v to a pointer. v must be of pointer type.
-func valToPointer(v reflect.Value) pointer {
- return pointer{v: v}
-}
-
-// offset converts from a pointer to a structure to a pointer to
-// one of its fields.
-func (p pointer) offset(f field) pointer {
- return pointer{v: p.v.Elem().FieldByIndex(f).Addr()}
-}
-
-func (p pointer) isNil() bool {
- return p.v.IsNil()
-}
-
-// grow updates the slice s in place to make it one element longer.
-// s must be addressable.
-// Returns the (addressable) new element.
-func grow(s reflect.Value) reflect.Value {
- n, m := s.Len(), s.Cap()
- if n < m {
- s.SetLen(n + 1)
- } else {
- s.Set(reflect.Append(s, reflect.Zero(s.Type().Elem())))
- }
- return s.Index(n)
-}
-
-func (p pointer) toInt64() *int64 {
- return p.v.Interface().(*int64)
-}
-func (p pointer) toInt64Ptr() **int64 {
- return p.v.Interface().(**int64)
-}
-func (p pointer) toInt64Slice() *[]int64 {
- return p.v.Interface().(*[]int64)
-}
-
-var int32ptr = reflect.TypeOf((*int32)(nil))
-
-func (p pointer) toInt32() *int32 {
- return p.v.Convert(int32ptr).Interface().(*int32)
-}
-
-// The toInt32Ptr/Slice methods don't work because of enums.
-// Instead, we must use set/get methods for the int32ptr/slice case.
-/*
- func (p pointer) toInt32Ptr() **int32 {
- return p.v.Interface().(**int32)
-}
- func (p pointer) toInt32Slice() *[]int32 {
- return p.v.Interface().(*[]int32)
-}
-*/
-func (p pointer) getInt32Ptr() *int32 {
- if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) {
- // raw int32 type
- return p.v.Elem().Interface().(*int32)
- }
- // an enum
- return p.v.Elem().Convert(int32PtrType).Interface().(*int32)
-}
-func (p pointer) setInt32Ptr(v int32) {
- // Allocate value in a *int32. Possibly convert that to a *enum.
- // Then assign it to a **int32 or **enum.
- // Note: we can convert *int32 to *enum, but we can't convert
- // **int32 to **enum!
- p.v.Elem().Set(reflect.ValueOf(&v).Convert(p.v.Type().Elem()))
-}
-
-// getInt32Slice copies []int32 from p as a new slice.
-// This behavior differs from the implementation in pointer_unsafe.go.
-func (p pointer) getInt32Slice() []int32 {
- if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) {
- // raw int32 type
- return p.v.Elem().Interface().([]int32)
- }
- // an enum
- // Allocate a []int32, then assign []enum's values into it.
- // Note: we can't convert []enum to []int32.
- slice := p.v.Elem()
- s := make([]int32, slice.Len())
- for i := 0; i < slice.Len(); i++ {
- s[i] = int32(slice.Index(i).Int())
- }
- return s
-}
-
-// setInt32Slice copies []int32 into p as a new slice.
-// This behavior differs from the implementation in pointer_unsafe.go.
-func (p pointer) setInt32Slice(v []int32) {
- if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) {
- // raw int32 type
- p.v.Elem().Set(reflect.ValueOf(v))
- return
- }
- // an enum
- // Allocate a []enum, then assign []int32's values into it.
- // Note: we can't convert []enum to []int32.
- slice := reflect.MakeSlice(p.v.Type().Elem(), len(v), cap(v))
- for i, x := range v {
- slice.Index(i).SetInt(int64(x))
- }
- p.v.Elem().Set(slice)
-}
-func (p pointer) appendInt32Slice(v int32) {
- grow(p.v.Elem()).SetInt(int64(v))
-}
-
-func (p pointer) toUint64() *uint64 {
- return p.v.Interface().(*uint64)
-}
-func (p pointer) toUint64Ptr() **uint64 {
- return p.v.Interface().(**uint64)
-}
-func (p pointer) toUint64Slice() *[]uint64 {
- return p.v.Interface().(*[]uint64)
-}
-func (p pointer) toUint32() *uint32 {
- return p.v.Interface().(*uint32)
-}
-func (p pointer) toUint32Ptr() **uint32 {
- return p.v.Interface().(**uint32)
-}
-func (p pointer) toUint32Slice() *[]uint32 {
- return p.v.Interface().(*[]uint32)
-}
-func (p pointer) toBool() *bool {
- return p.v.Interface().(*bool)
-}
-func (p pointer) toBoolPtr() **bool {
- return p.v.Interface().(**bool)
-}
-func (p pointer) toBoolSlice() *[]bool {
- return p.v.Interface().(*[]bool)
-}
-func (p pointer) toFloat64() *float64 {
- return p.v.Interface().(*float64)
-}
-func (p pointer) toFloat64Ptr() **float64 {
- return p.v.Interface().(**float64)
-}
-func (p pointer) toFloat64Slice() *[]float64 {
- return p.v.Interface().(*[]float64)
-}
-func (p pointer) toFloat32() *float32 {
- return p.v.Interface().(*float32)
-}
-func (p pointer) toFloat32Ptr() **float32 {
- return p.v.Interface().(**float32)
-}
-func (p pointer) toFloat32Slice() *[]float32 {
- return p.v.Interface().(*[]float32)
-}
-func (p pointer) toString() *string {
- return p.v.Interface().(*string)
-}
-func (p pointer) toStringPtr() **string {
- return p.v.Interface().(**string)
-}
-func (p pointer) toStringSlice() *[]string {
- return p.v.Interface().(*[]string)
-}
-func (p pointer) toBytes() *[]byte {
- return p.v.Interface().(*[]byte)
-}
-func (p pointer) toBytesSlice() *[][]byte {
- return p.v.Interface().(*[][]byte)
-}
-func (p pointer) toExtensions() *XXX_InternalExtensions {
- return p.v.Interface().(*XXX_InternalExtensions)
-}
-func (p pointer) toOldExtensions() *map[int32]Extension {
- return p.v.Interface().(*map[int32]Extension)
-}
-func (p pointer) getPointer() pointer {
- return pointer{v: p.v.Elem()}
-}
-func (p pointer) setPointer(q pointer) {
- p.v.Elem().Set(q.v)
-}
-func (p pointer) appendPointer(q pointer) {
- grow(p.v.Elem()).Set(q.v)
-}
-
-// getPointerSlice copies []*T from p as a new []pointer.
-// This behavior differs from the implementation in pointer_unsafe.go.
-func (p pointer) getPointerSlice() []pointer {
- if p.v.IsNil() {
- return nil
- }
- n := p.v.Elem().Len()
- s := make([]pointer, n)
- for i := 0; i < n; i++ {
- s[i] = pointer{v: p.v.Elem().Index(i)}
- }
- return s
-}
-
-// setPointerSlice copies []pointer into p as a new []*T.
-// This behavior differs from the implementation in pointer_unsafe.go.
-func (p pointer) setPointerSlice(v []pointer) {
- if v == nil {
- p.v.Elem().Set(reflect.New(p.v.Elem().Type()).Elem())
- return
- }
- s := reflect.MakeSlice(p.v.Elem().Type(), 0, len(v))
- for _, p := range v {
- s = reflect.Append(s, p.v)
- }
- p.v.Elem().Set(s)
-}
-
-// getInterfacePointer returns a pointer that points to the
-// interface data of the interface pointed by p.
-func (p pointer) getInterfacePointer() pointer {
- if p.v.Elem().IsNil() {
- return pointer{v: p.v.Elem()}
- }
- return pointer{v: p.v.Elem().Elem().Elem().Field(0).Addr()} // *interface -> interface -> *struct -> struct
-}
-
-func (p pointer) asPointerTo(t reflect.Type) reflect.Value {
- // TODO: check that p.v.Type().Elem() == t?
- return p.v
-}
-
-func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo {
- atomicLock.Lock()
- defer atomicLock.Unlock()
- return *p
-}
-func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) {
- atomicLock.Lock()
- defer atomicLock.Unlock()
- *p = v
-}
-func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo {
- atomicLock.Lock()
- defer atomicLock.Unlock()
- return *p
-}
-func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) {
- atomicLock.Lock()
- defer atomicLock.Unlock()
- *p = v
-}
-func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo {
- atomicLock.Lock()
- defer atomicLock.Unlock()
- return *p
-}
-func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) {
- atomicLock.Lock()
- defer atomicLock.Unlock()
- *p = v
-}
-func atomicLoadDiscardInfo(p **discardInfo) *discardInfo {
- atomicLock.Lock()
- defer atomicLock.Unlock()
- return *p
-}
-func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) {
- atomicLock.Lock()
- defer atomicLock.Unlock()
- *p = v
-}
-
-var atomicLock sync.Mutex
diff --git a/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go b/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go
deleted file mode 100644
index dbfffe0..0000000
--- a/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go
+++ /dev/null
@@ -1,313 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2012 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// +build !purego,!appengine,!js
-
-// This file contains the implementation of the proto field accesses using package unsafe.
-
-package proto
-
-import (
- "reflect"
- "sync/atomic"
- "unsafe"
-)
-
-const unsafeAllowed = true
-
-// A field identifies a field in a struct, accessible from a pointer.
-// In this implementation, a field is identified by its byte offset from the start of the struct.
-type field uintptr
-
-// toField returns a field equivalent to the given reflect field.
-func toField(f *reflect.StructField) field {
- return field(f.Offset)
-}
-
-// invalidField is an invalid field identifier.
-const invalidField = ^field(0)
-
-// zeroField is a noop when calling pointer.offset.
-const zeroField = field(0)
-
-// IsValid reports whether the field identifier is valid.
-func (f field) IsValid() bool {
- return f != invalidField
-}
-
-// The pointer type below is for the new table-driven encoder/decoder.
-// The implementation here uses unsafe.Pointer to create a generic pointer.
-// In pointer_reflect.go we use reflect instead of unsafe to implement
-// the same (but slower) interface.
-type pointer struct {
- p unsafe.Pointer
-}
-
-// size of pointer
-var ptrSize = unsafe.Sizeof(uintptr(0))
-
-// toPointer converts an interface of pointer type to a pointer
-// that points to the same target.
-func toPointer(i *Message) pointer {
- // Super-tricky - read pointer out of data word of interface value.
- // Saves ~25ns over the equivalent:
- // return valToPointer(reflect.ValueOf(*i))
- return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]}
-}
-
-// toAddrPointer converts an interface to a pointer that points to
-// the interface data.
-func toAddrPointer(i *interface{}, isptr, deref bool) (p pointer) {
- // Super-tricky - read or get the address of data word of interface value.
- if isptr {
- // The interface is of pointer type, thus it is a direct interface.
- // The data word is the pointer data itself. We take its address.
- p = pointer{p: unsafe.Pointer(uintptr(unsafe.Pointer(i)) + ptrSize)}
- } else {
- // The interface is not of pointer type. The data word is the pointer
- // to the data.
- p = pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]}
- }
- if deref {
- p.p = *(*unsafe.Pointer)(p.p)
- }
- return p
-}
-
-// valToPointer converts v to a pointer. v must be of pointer type.
-func valToPointer(v reflect.Value) pointer {
- return pointer{p: unsafe.Pointer(v.Pointer())}
-}
-
-// offset converts from a pointer to a structure to a pointer to
-// one of its fields.
-func (p pointer) offset(f field) pointer {
- // For safety, we should panic if !f.IsValid, however calling panic causes
- // this to no longer be inlineable, which is a serious performance cost.
- /*
- if !f.IsValid() {
- panic("invalid field")
- }
- */
- return pointer{p: unsafe.Pointer(uintptr(p.p) + uintptr(f))}
-}
-
-func (p pointer) isNil() bool {
- return p.p == nil
-}
-
-func (p pointer) toInt64() *int64 {
- return (*int64)(p.p)
-}
-func (p pointer) toInt64Ptr() **int64 {
- return (**int64)(p.p)
-}
-func (p pointer) toInt64Slice() *[]int64 {
- return (*[]int64)(p.p)
-}
-func (p pointer) toInt32() *int32 {
- return (*int32)(p.p)
-}
-
-// See pointer_reflect.go for why toInt32Ptr/Slice doesn't exist.
-/*
- func (p pointer) toInt32Ptr() **int32 {
- return (**int32)(p.p)
- }
- func (p pointer) toInt32Slice() *[]int32 {
- return (*[]int32)(p.p)
- }
-*/
-func (p pointer) getInt32Ptr() *int32 {
- return *(**int32)(p.p)
-}
-func (p pointer) setInt32Ptr(v int32) {
- *(**int32)(p.p) = &v
-}
-
-// getInt32Slice loads a []int32 from p.
-// The value returned is aliased with the original slice.
-// This behavior differs from the implementation in pointer_reflect.go.
-func (p pointer) getInt32Slice() []int32 {
- return *(*[]int32)(p.p)
-}
-
-// setInt32Slice stores a []int32 to p.
-// The value set is aliased with the input slice.
-// This behavior differs from the implementation in pointer_reflect.go.
-func (p pointer) setInt32Slice(v []int32) {
- *(*[]int32)(p.p) = v
-}
-
-// TODO: Can we get rid of appendInt32Slice and use setInt32Slice instead?
-func (p pointer) appendInt32Slice(v int32) {
- s := (*[]int32)(p.p)
- *s = append(*s, v)
-}
-
-func (p pointer) toUint64() *uint64 {
- return (*uint64)(p.p)
-}
-func (p pointer) toUint64Ptr() **uint64 {
- return (**uint64)(p.p)
-}
-func (p pointer) toUint64Slice() *[]uint64 {
- return (*[]uint64)(p.p)
-}
-func (p pointer) toUint32() *uint32 {
- return (*uint32)(p.p)
-}
-func (p pointer) toUint32Ptr() **uint32 {
- return (**uint32)(p.p)
-}
-func (p pointer) toUint32Slice() *[]uint32 {
- return (*[]uint32)(p.p)
-}
-func (p pointer) toBool() *bool {
- return (*bool)(p.p)
-}
-func (p pointer) toBoolPtr() **bool {
- return (**bool)(p.p)
-}
-func (p pointer) toBoolSlice() *[]bool {
- return (*[]bool)(p.p)
-}
-func (p pointer) toFloat64() *float64 {
- return (*float64)(p.p)
-}
-func (p pointer) toFloat64Ptr() **float64 {
- return (**float64)(p.p)
-}
-func (p pointer) toFloat64Slice() *[]float64 {
- return (*[]float64)(p.p)
-}
-func (p pointer) toFloat32() *float32 {
- return (*float32)(p.p)
-}
-func (p pointer) toFloat32Ptr() **float32 {
- return (**float32)(p.p)
-}
-func (p pointer) toFloat32Slice() *[]float32 {
- return (*[]float32)(p.p)
-}
-func (p pointer) toString() *string {
- return (*string)(p.p)
-}
-func (p pointer) toStringPtr() **string {
- return (**string)(p.p)
-}
-func (p pointer) toStringSlice() *[]string {
- return (*[]string)(p.p)
-}
-func (p pointer) toBytes() *[]byte {
- return (*[]byte)(p.p)
-}
-func (p pointer) toBytesSlice() *[][]byte {
- return (*[][]byte)(p.p)
-}
-func (p pointer) toExtensions() *XXX_InternalExtensions {
- return (*XXX_InternalExtensions)(p.p)
-}
-func (p pointer) toOldExtensions() *map[int32]Extension {
- return (*map[int32]Extension)(p.p)
-}
-
-// getPointerSlice loads []*T from p as a []pointer.
-// The value returned is aliased with the original slice.
-// This behavior differs from the implementation in pointer_reflect.go.
-func (p pointer) getPointerSlice() []pointer {
- // Super-tricky - p should point to a []*T where T is a
- // message type. We load it as []pointer.
- return *(*[]pointer)(p.p)
-}
-
-// setPointerSlice stores []pointer into p as a []*T.
-// The value set is aliased with the input slice.
-// This behavior differs from the implementation in pointer_reflect.go.
-func (p pointer) setPointerSlice(v []pointer) {
- // Super-tricky - p should point to a []*T where T is a
- // message type. We store it as []pointer.
- *(*[]pointer)(p.p) = v
-}
-
-// getPointer loads the pointer at p and returns it.
-func (p pointer) getPointer() pointer {
- return pointer{p: *(*unsafe.Pointer)(p.p)}
-}
-
-// setPointer stores the pointer q at p.
-func (p pointer) setPointer(q pointer) {
- *(*unsafe.Pointer)(p.p) = q.p
-}
-
-// append q to the slice pointed to by p.
-func (p pointer) appendPointer(q pointer) {
- s := (*[]unsafe.Pointer)(p.p)
- *s = append(*s, q.p)
-}
-
-// getInterfacePointer returns a pointer that points to the
-// interface data of the interface pointed by p.
-func (p pointer) getInterfacePointer() pointer {
- // Super-tricky - read pointer out of data word of interface value.
- return pointer{p: (*(*[2]unsafe.Pointer)(p.p))[1]}
-}
-
-// asPointerTo returns a reflect.Value that is a pointer to an
-// object of type t stored at p.
-func (p pointer) asPointerTo(t reflect.Type) reflect.Value {
- return reflect.NewAt(t, p.p)
-}
-
-func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo {
- return (*unmarshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p))))
-}
-func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) {
- atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v))
-}
-func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo {
- return (*marshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p))))
-}
-func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) {
- atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v))
-}
-func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo {
- return (*mergeInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p))))
-}
-func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) {
- atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v))
-}
-func atomicLoadDiscardInfo(p **discardInfo) *discardInfo {
- return (*discardInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p))))
-}
-func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) {
- atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v))
-}
diff --git a/vendor/github.com/golang/protobuf/proto/properties.go b/vendor/github.com/golang/protobuf/proto/properties.go
deleted file mode 100644
index a4b8c0c..0000000
--- a/vendor/github.com/golang/protobuf/proto/properties.go
+++ /dev/null
@@ -1,544 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-/*
- * Routines for encoding data into the wire format for protocol buffers.
- */
-
-import (
- "fmt"
- "log"
- "reflect"
- "sort"
- "strconv"
- "strings"
- "sync"
-)
-
-const debug bool = false
-
-// Constants that identify the encoding of a value on the wire.
-const (
- WireVarint = 0
- WireFixed64 = 1
- WireBytes = 2
- WireStartGroup = 3
- WireEndGroup = 4
- WireFixed32 = 5
-)
-
-// tagMap is an optimization over map[int]int for typical protocol buffer
-// use-cases. Encoded protocol buffers are often in tag order with small tag
-// numbers.
-type tagMap struct {
- fastTags []int
- slowTags map[int]int
-}
-
-// tagMapFastLimit is the upper bound on the tag number that will be stored in
-// the tagMap slice rather than its map.
-const tagMapFastLimit = 1024
-
-func (p *tagMap) get(t int) (int, bool) {
- if t > 0 && t < tagMapFastLimit {
- if t >= len(p.fastTags) {
- return 0, false
- }
- fi := p.fastTags[t]
- return fi, fi >= 0
- }
- fi, ok := p.slowTags[t]
- return fi, ok
-}
-
-func (p *tagMap) put(t int, fi int) {
- if t > 0 && t < tagMapFastLimit {
- for len(p.fastTags) < t+1 {
- p.fastTags = append(p.fastTags, -1)
- }
- p.fastTags[t] = fi
- return
- }
- if p.slowTags == nil {
- p.slowTags = make(map[int]int)
- }
- p.slowTags[t] = fi
-}
-
-// StructProperties represents properties for all the fields of a struct.
-// decoderTags and decoderOrigNames should only be used by the decoder.
-type StructProperties struct {
- Prop []*Properties // properties for each field
- reqCount int // required count
- decoderTags tagMap // map from proto tag to struct field number
- decoderOrigNames map[string]int // map from original name to struct field number
- order []int // list of struct field numbers in tag order
-
- // OneofTypes contains information about the oneof fields in this message.
- // It is keyed by the original name of a field.
- OneofTypes map[string]*OneofProperties
-}
-
-// OneofProperties represents information about a specific field in a oneof.
-type OneofProperties struct {
- Type reflect.Type // pointer to generated struct type for this oneof field
- Field int // struct field number of the containing oneof in the message
- Prop *Properties
-}
-
-// Implement the sorting interface so we can sort the fields in tag order, as recommended by the spec.
-// See encode.go, (*Buffer).enc_struct.
-
-func (sp *StructProperties) Len() int { return len(sp.order) }
-func (sp *StructProperties) Less(i, j int) bool {
- return sp.Prop[sp.order[i]].Tag < sp.Prop[sp.order[j]].Tag
-}
-func (sp *StructProperties) Swap(i, j int) { sp.order[i], sp.order[j] = sp.order[j], sp.order[i] }
-
-// Properties represents the protocol-specific behavior of a single struct field.
-type Properties struct {
- Name string // name of the field, for error messages
- OrigName string // original name before protocol compiler (always set)
- JSONName string // name to use for JSON; determined by protoc
- Wire string
- WireType int
- Tag int
- Required bool
- Optional bool
- Repeated bool
- Packed bool // relevant for repeated primitives only
- Enum string // set for enum types only
- proto3 bool // whether this is known to be a proto3 field
- oneof bool // whether this is a oneof field
-
- Default string // default value
- HasDefault bool // whether an explicit default was provided
-
- stype reflect.Type // set for struct types only
- sprop *StructProperties // set for struct types only
-
- mtype reflect.Type // set for map types only
- MapKeyProp *Properties // set for map types only
- MapValProp *Properties // set for map types only
-}
-
-// String formats the properties in the protobuf struct field tag style.
-func (p *Properties) String() string {
- s := p.Wire
- s += ","
- s += strconv.Itoa(p.Tag)
- if p.Required {
- s += ",req"
- }
- if p.Optional {
- s += ",opt"
- }
- if p.Repeated {
- s += ",rep"
- }
- if p.Packed {
- s += ",packed"
- }
- s += ",name=" + p.OrigName
- if p.JSONName != p.OrigName {
- s += ",json=" + p.JSONName
- }
- if p.proto3 {
- s += ",proto3"
- }
- if p.oneof {
- s += ",oneof"
- }
- if len(p.Enum) > 0 {
- s += ",enum=" + p.Enum
- }
- if p.HasDefault {
- s += ",def=" + p.Default
- }
- return s
-}
-
-// Parse populates p by parsing a string in the protobuf struct field tag style.
-func (p *Properties) Parse(s string) {
- // "bytes,49,opt,name=foo,def=hello!"
- fields := strings.Split(s, ",") // breaks def=, but handled below.
- if len(fields) < 2 {
- log.Printf("proto: tag has too few fields: %q", s)
- return
- }
-
- p.Wire = fields[0]
- switch p.Wire {
- case "varint":
- p.WireType = WireVarint
- case "fixed32":
- p.WireType = WireFixed32
- case "fixed64":
- p.WireType = WireFixed64
- case "zigzag32":
- p.WireType = WireVarint
- case "zigzag64":
- p.WireType = WireVarint
- case "bytes", "group":
- p.WireType = WireBytes
- // no numeric converter for non-numeric types
- default:
- log.Printf("proto: tag has unknown wire type: %q", s)
- return
- }
-
- var err error
- p.Tag, err = strconv.Atoi(fields[1])
- if err != nil {
- return
- }
-
-outer:
- for i := 2; i < len(fields); i++ {
- f := fields[i]
- switch {
- case f == "req":
- p.Required = true
- case f == "opt":
- p.Optional = true
- case f == "rep":
- p.Repeated = true
- case f == "packed":
- p.Packed = true
- case strings.HasPrefix(f, "name="):
- p.OrigName = f[5:]
- case strings.HasPrefix(f, "json="):
- p.JSONName = f[5:]
- case strings.HasPrefix(f, "enum="):
- p.Enum = f[5:]
- case f == "proto3":
- p.proto3 = true
- case f == "oneof":
- p.oneof = true
- case strings.HasPrefix(f, "def="):
- p.HasDefault = true
- p.Default = f[4:] // rest of string
- if i+1 < len(fields) {
- // Commas aren't escaped, and def is always last.
- p.Default += "," + strings.Join(fields[i+1:], ",")
- break outer
- }
- }
- }
-}
-
-var protoMessageType = reflect.TypeOf((*Message)(nil)).Elem()
-
-// setFieldProps initializes the field properties for submessages and maps.
-func (p *Properties) setFieldProps(typ reflect.Type, f *reflect.StructField, lockGetProp bool) {
- switch t1 := typ; t1.Kind() {
- case reflect.Ptr:
- if t1.Elem().Kind() == reflect.Struct {
- p.stype = t1.Elem()
- }
-
- case reflect.Slice:
- if t2 := t1.Elem(); t2.Kind() == reflect.Ptr && t2.Elem().Kind() == reflect.Struct {
- p.stype = t2.Elem()
- }
-
- case reflect.Map:
- p.mtype = t1
- p.MapKeyProp = &Properties{}
- p.MapKeyProp.init(reflect.PtrTo(p.mtype.Key()), "Key", f.Tag.Get("protobuf_key"), nil, lockGetProp)
- p.MapValProp = &Properties{}
- vtype := p.mtype.Elem()
- if vtype.Kind() != reflect.Ptr && vtype.Kind() != reflect.Slice {
- // The value type is not a message (*T) or bytes ([]byte),
- // so we need encoders for the pointer to this type.
- vtype = reflect.PtrTo(vtype)
- }
- p.MapValProp.init(vtype, "Value", f.Tag.Get("protobuf_val"), nil, lockGetProp)
- }
-
- if p.stype != nil {
- if lockGetProp {
- p.sprop = GetProperties(p.stype)
- } else {
- p.sprop = getPropertiesLocked(p.stype)
- }
- }
-}
-
-var (
- marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem()
-)
-
-// Init populates the properties from a protocol buffer struct tag.
-func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) {
- p.init(typ, name, tag, f, true)
-}
-
-func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructField, lockGetProp bool) {
- // "bytes,49,opt,def=hello!"
- p.Name = name
- p.OrigName = name
- if tag == "" {
- return
- }
- p.Parse(tag)
- p.setFieldProps(typ, f, lockGetProp)
-}
-
-var (
- propertiesMu sync.RWMutex
- propertiesMap = make(map[reflect.Type]*StructProperties)
-)
-
-// GetProperties returns the list of properties for the type represented by t.
-// t must represent a generated struct type of a protocol message.
-func GetProperties(t reflect.Type) *StructProperties {
- if t.Kind() != reflect.Struct {
- panic("proto: type must have kind struct")
- }
-
- // Most calls to GetProperties in a long-running program will be
- // retrieving details for types we have seen before.
- propertiesMu.RLock()
- sprop, ok := propertiesMap[t]
- propertiesMu.RUnlock()
- if ok {
- return sprop
- }
-
- propertiesMu.Lock()
- sprop = getPropertiesLocked(t)
- propertiesMu.Unlock()
- return sprop
-}
-
-type (
- oneofFuncsIface interface {
- XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{})
- }
- oneofWrappersIface interface {
- XXX_OneofWrappers() []interface{}
- }
-)
-
-// getPropertiesLocked requires that propertiesMu is held.
-func getPropertiesLocked(t reflect.Type) *StructProperties {
- if prop, ok := propertiesMap[t]; ok {
- return prop
- }
-
- prop := new(StructProperties)
- // in case of recursive protos, fill this in now.
- propertiesMap[t] = prop
-
- // build properties
- prop.Prop = make([]*Properties, t.NumField())
- prop.order = make([]int, t.NumField())
-
- for i := 0; i < t.NumField(); i++ {
- f := t.Field(i)
- p := new(Properties)
- name := f.Name
- p.init(f.Type, name, f.Tag.Get("protobuf"), &f, false)
-
- oneof := f.Tag.Get("protobuf_oneof") // special case
- if oneof != "" {
- // Oneof fields don't use the traditional protobuf tag.
- p.OrigName = oneof
- }
- prop.Prop[i] = p
- prop.order[i] = i
- if debug {
- print(i, " ", f.Name, " ", t.String(), " ")
- if p.Tag > 0 {
- print(p.String())
- }
- print("\n")
- }
- }
-
- // Re-order prop.order.
- sort.Sort(prop)
-
- var oots []interface{}
- switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) {
- case oneofFuncsIface:
- _, _, _, oots = m.XXX_OneofFuncs()
- case oneofWrappersIface:
- oots = m.XXX_OneofWrappers()
- }
- if len(oots) > 0 {
- // Interpret oneof metadata.
- prop.OneofTypes = make(map[string]*OneofProperties)
- for _, oot := range oots {
- oop := &OneofProperties{
- Type: reflect.ValueOf(oot).Type(), // *T
- Prop: new(Properties),
- }
- sft := oop.Type.Elem().Field(0)
- oop.Prop.Name = sft.Name
- oop.Prop.Parse(sft.Tag.Get("protobuf"))
- // There will be exactly one interface field that
- // this new value is assignable to.
- for i := 0; i < t.NumField(); i++ {
- f := t.Field(i)
- if f.Type.Kind() != reflect.Interface {
- continue
- }
- if !oop.Type.AssignableTo(f.Type) {
- continue
- }
- oop.Field = i
- break
- }
- prop.OneofTypes[oop.Prop.OrigName] = oop
- }
- }
-
- // build required counts
- // build tags
- reqCount := 0
- prop.decoderOrigNames = make(map[string]int)
- for i, p := range prop.Prop {
- if strings.HasPrefix(p.Name, "XXX_") {
- // Internal fields should not appear in tags/origNames maps.
- // They are handled specially when encoding and decoding.
- continue
- }
- if p.Required {
- reqCount++
- }
- prop.decoderTags.put(p.Tag, i)
- prop.decoderOrigNames[p.OrigName] = i
- }
- prop.reqCount = reqCount
-
- return prop
-}
-
-// A global registry of enum types.
-// The generated code will register the generated maps by calling RegisterEnum.
-
-var enumValueMaps = make(map[string]map[string]int32)
-
-// RegisterEnum is called from the generated code to install the enum descriptor
-// maps into the global table to aid parsing text format protocol buffers.
-func RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) {
- if _, ok := enumValueMaps[typeName]; ok {
- panic("proto: duplicate enum registered: " + typeName)
- }
- enumValueMaps[typeName] = valueMap
-}
-
-// EnumValueMap returns the mapping from names to integers of the
-// enum type enumType, or a nil if not found.
-func EnumValueMap(enumType string) map[string]int32 {
- return enumValueMaps[enumType]
-}
-
-// A registry of all linked message types.
-// The string is a fully-qualified proto name ("pkg.Message").
-var (
- protoTypedNils = make(map[string]Message) // a map from proto names to typed nil pointers
- protoMapTypes = make(map[string]reflect.Type) // a map from proto names to map types
- revProtoTypes = make(map[reflect.Type]string)
-)
-
-// RegisterType is called from generated code and maps from the fully qualified
-// proto name to the type (pointer to struct) of the protocol buffer.
-func RegisterType(x Message, name string) {
- if _, ok := protoTypedNils[name]; ok {
- // TODO: Some day, make this a panic.
- log.Printf("proto: duplicate proto type registered: %s", name)
- return
- }
- t := reflect.TypeOf(x)
- if v := reflect.ValueOf(x); v.Kind() == reflect.Ptr && v.Pointer() == 0 {
- // Generated code always calls RegisterType with nil x.
- // This check is just for extra safety.
- protoTypedNils[name] = x
- } else {
- protoTypedNils[name] = reflect.Zero(t).Interface().(Message)
- }
- revProtoTypes[t] = name
-}
-
-// RegisterMapType is called from generated code and maps from the fully qualified
-// proto name to the native map type of the proto map definition.
-func RegisterMapType(x interface{}, name string) {
- if reflect.TypeOf(x).Kind() != reflect.Map {
- panic(fmt.Sprintf("RegisterMapType(%T, %q); want map", x, name))
- }
- if _, ok := protoMapTypes[name]; ok {
- log.Printf("proto: duplicate proto type registered: %s", name)
- return
- }
- t := reflect.TypeOf(x)
- protoMapTypes[name] = t
- revProtoTypes[t] = name
-}
-
-// MessageName returns the fully-qualified proto name for the given message type.
-func MessageName(x Message) string {
- type xname interface {
- XXX_MessageName() string
- }
- if m, ok := x.(xname); ok {
- return m.XXX_MessageName()
- }
- return revProtoTypes[reflect.TypeOf(x)]
-}
-
-// MessageType returns the message type (pointer to struct) for a named message.
-// The type is not guaranteed to implement proto.Message if the name refers to a
-// map entry.
-func MessageType(name string) reflect.Type {
- if t, ok := protoTypedNils[name]; ok {
- return reflect.TypeOf(t)
- }
- return protoMapTypes[name]
-}
-
-// A registry of all linked proto files.
-var (
- protoFiles = make(map[string][]byte) // file name => fileDescriptor
-)
-
-// RegisterFile is called from generated code and maps from the
-// full file name of a .proto file to its compressed FileDescriptorProto.
-func RegisterFile(filename string, fileDescriptor []byte) {
- protoFiles[filename] = fileDescriptor
-}
-
-// FileDescriptor returns the compressed FileDescriptorProto for a .proto file.
-func FileDescriptor(filename string) []byte { return protoFiles[filename] }
diff --git a/vendor/github.com/golang/protobuf/proto/table_marshal.go b/vendor/github.com/golang/protobuf/proto/table_marshal.go
deleted file mode 100644
index 5cb11fa..0000000
--- a/vendor/github.com/golang/protobuf/proto/table_marshal.go
+++ /dev/null
@@ -1,2776 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2016 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-import (
- "errors"
- "fmt"
- "math"
- "reflect"
- "sort"
- "strconv"
- "strings"
- "sync"
- "sync/atomic"
- "unicode/utf8"
-)
-
-// a sizer takes a pointer to a field and the size of its tag, computes the size of
-// the encoded data.
-type sizer func(pointer, int) int
-
-// a marshaler takes a byte slice, a pointer to a field, and its tag (in wire format),
-// marshals the field to the end of the slice, returns the slice and error (if any).
-type marshaler func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error)
-
-// marshalInfo is the information used for marshaling a message.
-type marshalInfo struct {
- typ reflect.Type
- fields []*marshalFieldInfo
- unrecognized field // offset of XXX_unrecognized
- extensions field // offset of XXX_InternalExtensions
- v1extensions field // offset of XXX_extensions
- sizecache field // offset of XXX_sizecache
- initialized int32 // 0 -- only typ is set, 1 -- fully initialized
- messageset bool // uses message set wire format
- hasmarshaler bool // has custom marshaler
- sync.RWMutex // protect extElems map, also for initialization
- extElems map[int32]*marshalElemInfo // info of extension elements
-}
-
-// marshalFieldInfo is the information used for marshaling a field of a message.
-type marshalFieldInfo struct {
- field field
- wiretag uint64 // tag in wire format
- tagsize int // size of tag in wire format
- sizer sizer
- marshaler marshaler
- isPointer bool
- required bool // field is required
- name string // name of the field, for error reporting
- oneofElems map[reflect.Type]*marshalElemInfo // info of oneof elements
-}
-
-// marshalElemInfo is the information used for marshaling an extension or oneof element.
-type marshalElemInfo struct {
- wiretag uint64 // tag in wire format
- tagsize int // size of tag in wire format
- sizer sizer
- marshaler marshaler
- isptr bool // elem is pointer typed, thus interface of this type is a direct interface (extension only)
- deref bool // dereference the pointer before operating on it; implies isptr
-}
-
-var (
- marshalInfoMap = map[reflect.Type]*marshalInfo{}
- marshalInfoLock sync.Mutex
-)
-
-// getMarshalInfo returns the information to marshal a given type of message.
-// The info it returns may not necessarily initialized.
-// t is the type of the message (NOT the pointer to it).
-func getMarshalInfo(t reflect.Type) *marshalInfo {
- marshalInfoLock.Lock()
- u, ok := marshalInfoMap[t]
- if !ok {
- u = &marshalInfo{typ: t}
- marshalInfoMap[t] = u
- }
- marshalInfoLock.Unlock()
- return u
-}
-
-// Size is the entry point from generated code,
-// and should be ONLY called by generated code.
-// It computes the size of encoded data of msg.
-// a is a pointer to a place to store cached marshal info.
-func (a *InternalMessageInfo) Size(msg Message) int {
- u := getMessageMarshalInfo(msg, a)
- ptr := toPointer(&msg)
- if ptr.isNil() {
- // We get here if msg is a typed nil ((*SomeMessage)(nil)),
- // so it satisfies the interface, and msg == nil wouldn't
- // catch it. We don't want crash in this case.
- return 0
- }
- return u.size(ptr)
-}
-
-// Marshal is the entry point from generated code,
-// and should be ONLY called by generated code.
-// It marshals msg to the end of b.
-// a is a pointer to a place to store cached marshal info.
-func (a *InternalMessageInfo) Marshal(b []byte, msg Message, deterministic bool) ([]byte, error) {
- u := getMessageMarshalInfo(msg, a)
- ptr := toPointer(&msg)
- if ptr.isNil() {
- // We get here if msg is a typed nil ((*SomeMessage)(nil)),
- // so it satisfies the interface, and msg == nil wouldn't
- // catch it. We don't want crash in this case.
- return b, ErrNil
- }
- return u.marshal(b, ptr, deterministic)
-}
-
-func getMessageMarshalInfo(msg interface{}, a *InternalMessageInfo) *marshalInfo {
- // u := a.marshal, but atomically.
- // We use an atomic here to ensure memory consistency.
- u := atomicLoadMarshalInfo(&a.marshal)
- if u == nil {
- // Get marshal information from type of message.
- t := reflect.ValueOf(msg).Type()
- if t.Kind() != reflect.Ptr {
- panic(fmt.Sprintf("cannot handle non-pointer message type %v", t))
- }
- u = getMarshalInfo(t.Elem())
- // Store it in the cache for later users.
- // a.marshal = u, but atomically.
- atomicStoreMarshalInfo(&a.marshal, u)
- }
- return u
-}
-
-// size is the main function to compute the size of the encoded data of a message.
-// ptr is the pointer to the message.
-func (u *marshalInfo) size(ptr pointer) int {
- if atomic.LoadInt32(&u.initialized) == 0 {
- u.computeMarshalInfo()
- }
-
- // If the message can marshal itself, let it do it, for compatibility.
- // NOTE: This is not efficient.
- if u.hasmarshaler {
- m := ptr.asPointerTo(u.typ).Interface().(Marshaler)
- b, _ := m.Marshal()
- return len(b)
- }
-
- n := 0
- for _, f := range u.fields {
- if f.isPointer && ptr.offset(f.field).getPointer().isNil() {
- // nil pointer always marshals to nothing
- continue
- }
- n += f.sizer(ptr.offset(f.field), f.tagsize)
- }
- if u.extensions.IsValid() {
- e := ptr.offset(u.extensions).toExtensions()
- if u.messageset {
- n += u.sizeMessageSet(e)
- } else {
- n += u.sizeExtensions(e)
- }
- }
- if u.v1extensions.IsValid() {
- m := *ptr.offset(u.v1extensions).toOldExtensions()
- n += u.sizeV1Extensions(m)
- }
- if u.unrecognized.IsValid() {
- s := *ptr.offset(u.unrecognized).toBytes()
- n += len(s)
- }
- // cache the result for use in marshal
- if u.sizecache.IsValid() {
- atomic.StoreInt32(ptr.offset(u.sizecache).toInt32(), int32(n))
- }
- return n
-}
-
-// cachedsize gets the size from cache. If there is no cache (i.e. message is not generated),
-// fall back to compute the size.
-func (u *marshalInfo) cachedsize(ptr pointer) int {
- if u.sizecache.IsValid() {
- return int(atomic.LoadInt32(ptr.offset(u.sizecache).toInt32()))
- }
- return u.size(ptr)
-}
-
-// marshal is the main function to marshal a message. It takes a byte slice and appends
-// the encoded data to the end of the slice, returns the slice and error (if any).
-// ptr is the pointer to the message.
-// If deterministic is true, map is marshaled in deterministic order.
-func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte, error) {
- if atomic.LoadInt32(&u.initialized) == 0 {
- u.computeMarshalInfo()
- }
-
- // If the message can marshal itself, let it do it, for compatibility.
- // NOTE: This is not efficient.
- if u.hasmarshaler {
- m := ptr.asPointerTo(u.typ).Interface().(Marshaler)
- b1, err := m.Marshal()
- b = append(b, b1...)
- return b, err
- }
-
- var err, errLater error
- // The old marshaler encodes extensions at beginning.
- if u.extensions.IsValid() {
- e := ptr.offset(u.extensions).toExtensions()
- if u.messageset {
- b, err = u.appendMessageSet(b, e, deterministic)
- } else {
- b, err = u.appendExtensions(b, e, deterministic)
- }
- if err != nil {
- return b, err
- }
- }
- if u.v1extensions.IsValid() {
- m := *ptr.offset(u.v1extensions).toOldExtensions()
- b, err = u.appendV1Extensions(b, m, deterministic)
- if err != nil {
- return b, err
- }
- }
- for _, f := range u.fields {
- if f.required {
- if ptr.offset(f.field).getPointer().isNil() {
- // Required field is not set.
- // We record the error but keep going, to give a complete marshaling.
- if errLater == nil {
- errLater = &RequiredNotSetError{f.name}
- }
- continue
- }
- }
- if f.isPointer && ptr.offset(f.field).getPointer().isNil() {
- // nil pointer always marshals to nothing
- continue
- }
- b, err = f.marshaler(b, ptr.offset(f.field), f.wiretag, deterministic)
- if err != nil {
- if err1, ok := err.(*RequiredNotSetError); ok {
- // Required field in submessage is not set.
- // We record the error but keep going, to give a complete marshaling.
- if errLater == nil {
- errLater = &RequiredNotSetError{f.name + "." + err1.field}
- }
- continue
- }
- if err == errRepeatedHasNil {
- err = errors.New("proto: repeated field " + f.name + " has nil element")
- }
- if err == errInvalidUTF8 {
- if errLater == nil {
- fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name
- errLater = &invalidUTF8Error{fullName}
- }
- continue
- }
- return b, err
- }
- }
- if u.unrecognized.IsValid() {
- s := *ptr.offset(u.unrecognized).toBytes()
- b = append(b, s...)
- }
- return b, errLater
-}
-
-// computeMarshalInfo initializes the marshal info.
-func (u *marshalInfo) computeMarshalInfo() {
- u.Lock()
- defer u.Unlock()
- if u.initialized != 0 { // non-atomic read is ok as it is protected by the lock
- return
- }
-
- t := u.typ
- u.unrecognized = invalidField
- u.extensions = invalidField
- u.v1extensions = invalidField
- u.sizecache = invalidField
-
- // If the message can marshal itself, let it do it, for compatibility.
- // NOTE: This is not efficient.
- if reflect.PtrTo(t).Implements(marshalerType) {
- u.hasmarshaler = true
- atomic.StoreInt32(&u.initialized, 1)
- return
- }
-
- // get oneof implementers
- var oneofImplementers []interface{}
- switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) {
- case oneofFuncsIface:
- _, _, _, oneofImplementers = m.XXX_OneofFuncs()
- case oneofWrappersIface:
- oneofImplementers = m.XXX_OneofWrappers()
- }
-
- n := t.NumField()
-
- // deal with XXX fields first
- for i := 0; i < t.NumField(); i++ {
- f := t.Field(i)
- if !strings.HasPrefix(f.Name, "XXX_") {
- continue
- }
- switch f.Name {
- case "XXX_sizecache":
- u.sizecache = toField(&f)
- case "XXX_unrecognized":
- u.unrecognized = toField(&f)
- case "XXX_InternalExtensions":
- u.extensions = toField(&f)
- u.messageset = f.Tag.Get("protobuf_messageset") == "1"
- case "XXX_extensions":
- u.v1extensions = toField(&f)
- case "XXX_NoUnkeyedLiteral":
- // nothing to do
- default:
- panic("unknown XXX field: " + f.Name)
- }
- n--
- }
-
- // normal fields
- fields := make([]marshalFieldInfo, n) // batch allocation
- u.fields = make([]*marshalFieldInfo, 0, n)
- for i, j := 0, 0; i < t.NumField(); i++ {
- f := t.Field(i)
-
- if strings.HasPrefix(f.Name, "XXX_") {
- continue
- }
- field := &fields[j]
- j++
- field.name = f.Name
- u.fields = append(u.fields, field)
- if f.Tag.Get("protobuf_oneof") != "" {
- field.computeOneofFieldInfo(&f, oneofImplementers)
- continue
- }
- if f.Tag.Get("protobuf") == "" {
- // field has no tag (not in generated message), ignore it
- u.fields = u.fields[:len(u.fields)-1]
- j--
- continue
- }
- field.computeMarshalFieldInfo(&f)
- }
-
- // fields are marshaled in tag order on the wire.
- sort.Sort(byTag(u.fields))
-
- atomic.StoreInt32(&u.initialized, 1)
-}
-
-// helper for sorting fields by tag
-type byTag []*marshalFieldInfo
-
-func (a byTag) Len() int { return len(a) }
-func (a byTag) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
-func (a byTag) Less(i, j int) bool { return a[i].wiretag < a[j].wiretag }
-
-// getExtElemInfo returns the information to marshal an extension element.
-// The info it returns is initialized.
-func (u *marshalInfo) getExtElemInfo(desc *ExtensionDesc) *marshalElemInfo {
- // get from cache first
- u.RLock()
- e, ok := u.extElems[desc.Field]
- u.RUnlock()
- if ok {
- return e
- }
-
- t := reflect.TypeOf(desc.ExtensionType) // pointer or slice to basic type or struct
- tags := strings.Split(desc.Tag, ",")
- tag, err := strconv.Atoi(tags[1])
- if err != nil {
- panic("tag is not an integer")
- }
- wt := wiretype(tags[0])
- if t.Kind() == reflect.Ptr && t.Elem().Kind() != reflect.Struct {
- t = t.Elem()
- }
- sizer, marshaler := typeMarshaler(t, tags, false, false)
- var deref bool
- if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 {
- t = reflect.PtrTo(t)
- deref = true
- }
- e = &marshalElemInfo{
- wiretag: uint64(tag)<<3 | wt,
- tagsize: SizeVarint(uint64(tag) << 3),
- sizer: sizer,
- marshaler: marshaler,
- isptr: t.Kind() == reflect.Ptr,
- deref: deref,
- }
-
- // update cache
- u.Lock()
- if u.extElems == nil {
- u.extElems = make(map[int32]*marshalElemInfo)
- }
- u.extElems[desc.Field] = e
- u.Unlock()
- return e
-}
-
-// computeMarshalFieldInfo fills up the information to marshal a field.
-func (fi *marshalFieldInfo) computeMarshalFieldInfo(f *reflect.StructField) {
- // parse protobuf tag of the field.
- // tag has format of "bytes,49,opt,name=foo,def=hello!"
- tags := strings.Split(f.Tag.Get("protobuf"), ",")
- if tags[0] == "" {
- return
- }
- tag, err := strconv.Atoi(tags[1])
- if err != nil {
- panic("tag is not an integer")
- }
- wt := wiretype(tags[0])
- if tags[2] == "req" {
- fi.required = true
- }
- fi.setTag(f, tag, wt)
- fi.setMarshaler(f, tags)
-}
-
-func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofImplementers []interface{}) {
- fi.field = toField(f)
- fi.wiretag = math.MaxInt32 // Use a large tag number, make oneofs sorted at the end. This tag will not appear on the wire.
- fi.isPointer = true
- fi.sizer, fi.marshaler = makeOneOfMarshaler(fi, f)
- fi.oneofElems = make(map[reflect.Type]*marshalElemInfo)
-
- ityp := f.Type // interface type
- for _, o := range oneofImplementers {
- t := reflect.TypeOf(o)
- if !t.Implements(ityp) {
- continue
- }
- sf := t.Elem().Field(0) // oneof implementer is a struct with a single field
- tags := strings.Split(sf.Tag.Get("protobuf"), ",")
- tag, err := strconv.Atoi(tags[1])
- if err != nil {
- panic("tag is not an integer")
- }
- wt := wiretype(tags[0])
- sizer, marshaler := typeMarshaler(sf.Type, tags, false, true) // oneof should not omit any zero value
- fi.oneofElems[t.Elem()] = &marshalElemInfo{
- wiretag: uint64(tag)<<3 | wt,
- tagsize: SizeVarint(uint64(tag) << 3),
- sizer: sizer,
- marshaler: marshaler,
- }
- }
-}
-
-// wiretype returns the wire encoding of the type.
-func wiretype(encoding string) uint64 {
- switch encoding {
- case "fixed32":
- return WireFixed32
- case "fixed64":
- return WireFixed64
- case "varint", "zigzag32", "zigzag64":
- return WireVarint
- case "bytes":
- return WireBytes
- case "group":
- return WireStartGroup
- }
- panic("unknown wire type " + encoding)
-}
-
-// setTag fills up the tag (in wire format) and its size in the info of a field.
-func (fi *marshalFieldInfo) setTag(f *reflect.StructField, tag int, wt uint64) {
- fi.field = toField(f)
- fi.wiretag = uint64(tag)<<3 | wt
- fi.tagsize = SizeVarint(uint64(tag) << 3)
-}
-
-// setMarshaler fills up the sizer and marshaler in the info of a field.
-func (fi *marshalFieldInfo) setMarshaler(f *reflect.StructField, tags []string) {
- switch f.Type.Kind() {
- case reflect.Map:
- // map field
- fi.isPointer = true
- fi.sizer, fi.marshaler = makeMapMarshaler(f)
- return
- case reflect.Ptr, reflect.Slice:
- fi.isPointer = true
- }
- fi.sizer, fi.marshaler = typeMarshaler(f.Type, tags, true, false)
-}
-
-// typeMarshaler returns the sizer and marshaler of a given field.
-// t is the type of the field.
-// tags is the generated "protobuf" tag of the field.
-// If nozero is true, zero value is not marshaled to the wire.
-// If oneof is true, it is a oneof field.
-func typeMarshaler(t reflect.Type, tags []string, nozero, oneof bool) (sizer, marshaler) {
- encoding := tags[0]
-
- pointer := false
- slice := false
- if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 {
- slice = true
- t = t.Elem()
- }
- if t.Kind() == reflect.Ptr {
- pointer = true
- t = t.Elem()
- }
-
- packed := false
- proto3 := false
- validateUTF8 := true
- for i := 2; i < len(tags); i++ {
- if tags[i] == "packed" {
- packed = true
- }
- if tags[i] == "proto3" {
- proto3 = true
- }
- }
- validateUTF8 = validateUTF8 && proto3
-
- switch t.Kind() {
- case reflect.Bool:
- if pointer {
- return sizeBoolPtr, appendBoolPtr
- }
- if slice {
- if packed {
- return sizeBoolPackedSlice, appendBoolPackedSlice
- }
- return sizeBoolSlice, appendBoolSlice
- }
- if nozero {
- return sizeBoolValueNoZero, appendBoolValueNoZero
- }
- return sizeBoolValue, appendBoolValue
- case reflect.Uint32:
- switch encoding {
- case "fixed32":
- if pointer {
- return sizeFixed32Ptr, appendFixed32Ptr
- }
- if slice {
- if packed {
- return sizeFixed32PackedSlice, appendFixed32PackedSlice
- }
- return sizeFixed32Slice, appendFixed32Slice
- }
- if nozero {
- return sizeFixed32ValueNoZero, appendFixed32ValueNoZero
- }
- return sizeFixed32Value, appendFixed32Value
- case "varint":
- if pointer {
- return sizeVarint32Ptr, appendVarint32Ptr
- }
- if slice {
- if packed {
- return sizeVarint32PackedSlice, appendVarint32PackedSlice
- }
- return sizeVarint32Slice, appendVarint32Slice
- }
- if nozero {
- return sizeVarint32ValueNoZero, appendVarint32ValueNoZero
- }
- return sizeVarint32Value, appendVarint32Value
- }
- case reflect.Int32:
- switch encoding {
- case "fixed32":
- if pointer {
- return sizeFixedS32Ptr, appendFixedS32Ptr
- }
- if slice {
- if packed {
- return sizeFixedS32PackedSlice, appendFixedS32PackedSlice
- }
- return sizeFixedS32Slice, appendFixedS32Slice
- }
- if nozero {
- return sizeFixedS32ValueNoZero, appendFixedS32ValueNoZero
- }
- return sizeFixedS32Value, appendFixedS32Value
- case "varint":
- if pointer {
- return sizeVarintS32Ptr, appendVarintS32Ptr
- }
- if slice {
- if packed {
- return sizeVarintS32PackedSlice, appendVarintS32PackedSlice
- }
- return sizeVarintS32Slice, appendVarintS32Slice
- }
- if nozero {
- return sizeVarintS32ValueNoZero, appendVarintS32ValueNoZero
- }
- return sizeVarintS32Value, appendVarintS32Value
- case "zigzag32":
- if pointer {
- return sizeZigzag32Ptr, appendZigzag32Ptr
- }
- if slice {
- if packed {
- return sizeZigzag32PackedSlice, appendZigzag32PackedSlice
- }
- return sizeZigzag32Slice, appendZigzag32Slice
- }
- if nozero {
- return sizeZigzag32ValueNoZero, appendZigzag32ValueNoZero
- }
- return sizeZigzag32Value, appendZigzag32Value
- }
- case reflect.Uint64:
- switch encoding {
- case "fixed64":
- if pointer {
- return sizeFixed64Ptr, appendFixed64Ptr
- }
- if slice {
- if packed {
- return sizeFixed64PackedSlice, appendFixed64PackedSlice
- }
- return sizeFixed64Slice, appendFixed64Slice
- }
- if nozero {
- return sizeFixed64ValueNoZero, appendFixed64ValueNoZero
- }
- return sizeFixed64Value, appendFixed64Value
- case "varint":
- if pointer {
- return sizeVarint64Ptr, appendVarint64Ptr
- }
- if slice {
- if packed {
- return sizeVarint64PackedSlice, appendVarint64PackedSlice
- }
- return sizeVarint64Slice, appendVarint64Slice
- }
- if nozero {
- return sizeVarint64ValueNoZero, appendVarint64ValueNoZero
- }
- return sizeVarint64Value, appendVarint64Value
- }
- case reflect.Int64:
- switch encoding {
- case "fixed64":
- if pointer {
- return sizeFixedS64Ptr, appendFixedS64Ptr
- }
- if slice {
- if packed {
- return sizeFixedS64PackedSlice, appendFixedS64PackedSlice
- }
- return sizeFixedS64Slice, appendFixedS64Slice
- }
- if nozero {
- return sizeFixedS64ValueNoZero, appendFixedS64ValueNoZero
- }
- return sizeFixedS64Value, appendFixedS64Value
- case "varint":
- if pointer {
- return sizeVarintS64Ptr, appendVarintS64Ptr
- }
- if slice {
- if packed {
- return sizeVarintS64PackedSlice, appendVarintS64PackedSlice
- }
- return sizeVarintS64Slice, appendVarintS64Slice
- }
- if nozero {
- return sizeVarintS64ValueNoZero, appendVarintS64ValueNoZero
- }
- return sizeVarintS64Value, appendVarintS64Value
- case "zigzag64":
- if pointer {
- return sizeZigzag64Ptr, appendZigzag64Ptr
- }
- if slice {
- if packed {
- return sizeZigzag64PackedSlice, appendZigzag64PackedSlice
- }
- return sizeZigzag64Slice, appendZigzag64Slice
- }
- if nozero {
- return sizeZigzag64ValueNoZero, appendZigzag64ValueNoZero
- }
- return sizeZigzag64Value, appendZigzag64Value
- }
- case reflect.Float32:
- if pointer {
- return sizeFloat32Ptr, appendFloat32Ptr
- }
- if slice {
- if packed {
- return sizeFloat32PackedSlice, appendFloat32PackedSlice
- }
- return sizeFloat32Slice, appendFloat32Slice
- }
- if nozero {
- return sizeFloat32ValueNoZero, appendFloat32ValueNoZero
- }
- return sizeFloat32Value, appendFloat32Value
- case reflect.Float64:
- if pointer {
- return sizeFloat64Ptr, appendFloat64Ptr
- }
- if slice {
- if packed {
- return sizeFloat64PackedSlice, appendFloat64PackedSlice
- }
- return sizeFloat64Slice, appendFloat64Slice
- }
- if nozero {
- return sizeFloat64ValueNoZero, appendFloat64ValueNoZero
- }
- return sizeFloat64Value, appendFloat64Value
- case reflect.String:
- if validateUTF8 {
- if pointer {
- return sizeStringPtr, appendUTF8StringPtr
- }
- if slice {
- return sizeStringSlice, appendUTF8StringSlice
- }
- if nozero {
- return sizeStringValueNoZero, appendUTF8StringValueNoZero
- }
- return sizeStringValue, appendUTF8StringValue
- }
- if pointer {
- return sizeStringPtr, appendStringPtr
- }
- if slice {
- return sizeStringSlice, appendStringSlice
- }
- if nozero {
- return sizeStringValueNoZero, appendStringValueNoZero
- }
- return sizeStringValue, appendStringValue
- case reflect.Slice:
- if slice {
- return sizeBytesSlice, appendBytesSlice
- }
- if oneof {
- // Oneof bytes field may also have "proto3" tag.
- // We want to marshal it as a oneof field. Do this
- // check before the proto3 check.
- return sizeBytesOneof, appendBytesOneof
- }
- if proto3 {
- return sizeBytes3, appendBytes3
- }
- return sizeBytes, appendBytes
- case reflect.Struct:
- switch encoding {
- case "group":
- if slice {
- return makeGroupSliceMarshaler(getMarshalInfo(t))
- }
- return makeGroupMarshaler(getMarshalInfo(t))
- case "bytes":
- if slice {
- return makeMessageSliceMarshaler(getMarshalInfo(t))
- }
- return makeMessageMarshaler(getMarshalInfo(t))
- }
- }
- panic(fmt.Sprintf("unknown or mismatched type: type: %v, wire type: %v", t, encoding))
-}
-
-// Below are functions to size/marshal a specific type of a field.
-// They are stored in the field's info, and called by function pointers.
-// They have type sizer or marshaler.
-
-func sizeFixed32Value(_ pointer, tagsize int) int {
- return 4 + tagsize
-}
-func sizeFixed32ValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toUint32()
- if v == 0 {
- return 0
- }
- return 4 + tagsize
-}
-func sizeFixed32Ptr(ptr pointer, tagsize int) int {
- p := *ptr.toUint32Ptr()
- if p == nil {
- return 0
- }
- return 4 + tagsize
-}
-func sizeFixed32Slice(ptr pointer, tagsize int) int {
- s := *ptr.toUint32Slice()
- return (4 + tagsize) * len(s)
-}
-func sizeFixed32PackedSlice(ptr pointer, tagsize int) int {
- s := *ptr.toUint32Slice()
- if len(s) == 0 {
- return 0
- }
- return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize
-}
-func sizeFixedS32Value(_ pointer, tagsize int) int {
- return 4 + tagsize
-}
-func sizeFixedS32ValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toInt32()
- if v == 0 {
- return 0
- }
- return 4 + tagsize
-}
-func sizeFixedS32Ptr(ptr pointer, tagsize int) int {
- p := ptr.getInt32Ptr()
- if p == nil {
- return 0
- }
- return 4 + tagsize
-}
-func sizeFixedS32Slice(ptr pointer, tagsize int) int {
- s := ptr.getInt32Slice()
- return (4 + tagsize) * len(s)
-}
-func sizeFixedS32PackedSlice(ptr pointer, tagsize int) int {
- s := ptr.getInt32Slice()
- if len(s) == 0 {
- return 0
- }
- return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize
-}
-func sizeFloat32Value(_ pointer, tagsize int) int {
- return 4 + tagsize
-}
-func sizeFloat32ValueNoZero(ptr pointer, tagsize int) int {
- v := math.Float32bits(*ptr.toFloat32())
- if v == 0 {
- return 0
- }
- return 4 + tagsize
-}
-func sizeFloat32Ptr(ptr pointer, tagsize int) int {
- p := *ptr.toFloat32Ptr()
- if p == nil {
- return 0
- }
- return 4 + tagsize
-}
-func sizeFloat32Slice(ptr pointer, tagsize int) int {
- s := *ptr.toFloat32Slice()
- return (4 + tagsize) * len(s)
-}
-func sizeFloat32PackedSlice(ptr pointer, tagsize int) int {
- s := *ptr.toFloat32Slice()
- if len(s) == 0 {
- return 0
- }
- return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize
-}
-func sizeFixed64Value(_ pointer, tagsize int) int {
- return 8 + tagsize
-}
-func sizeFixed64ValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toUint64()
- if v == 0 {
- return 0
- }
- return 8 + tagsize
-}
-func sizeFixed64Ptr(ptr pointer, tagsize int) int {
- p := *ptr.toUint64Ptr()
- if p == nil {
- return 0
- }
- return 8 + tagsize
-}
-func sizeFixed64Slice(ptr pointer, tagsize int) int {
- s := *ptr.toUint64Slice()
- return (8 + tagsize) * len(s)
-}
-func sizeFixed64PackedSlice(ptr pointer, tagsize int) int {
- s := *ptr.toUint64Slice()
- if len(s) == 0 {
- return 0
- }
- return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize
-}
-func sizeFixedS64Value(_ pointer, tagsize int) int {
- return 8 + tagsize
-}
-func sizeFixedS64ValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toInt64()
- if v == 0 {
- return 0
- }
- return 8 + tagsize
-}
-func sizeFixedS64Ptr(ptr pointer, tagsize int) int {
- p := *ptr.toInt64Ptr()
- if p == nil {
- return 0
- }
- return 8 + tagsize
-}
-func sizeFixedS64Slice(ptr pointer, tagsize int) int {
- s := *ptr.toInt64Slice()
- return (8 + tagsize) * len(s)
-}
-func sizeFixedS64PackedSlice(ptr pointer, tagsize int) int {
- s := *ptr.toInt64Slice()
- if len(s) == 0 {
- return 0
- }
- return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize
-}
-func sizeFloat64Value(_ pointer, tagsize int) int {
- return 8 + tagsize
-}
-func sizeFloat64ValueNoZero(ptr pointer, tagsize int) int {
- v := math.Float64bits(*ptr.toFloat64())
- if v == 0 {
- return 0
- }
- return 8 + tagsize
-}
-func sizeFloat64Ptr(ptr pointer, tagsize int) int {
- p := *ptr.toFloat64Ptr()
- if p == nil {
- return 0
- }
- return 8 + tagsize
-}
-func sizeFloat64Slice(ptr pointer, tagsize int) int {
- s := *ptr.toFloat64Slice()
- return (8 + tagsize) * len(s)
-}
-func sizeFloat64PackedSlice(ptr pointer, tagsize int) int {
- s := *ptr.toFloat64Slice()
- if len(s) == 0 {
- return 0
- }
- return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize
-}
-func sizeVarint32Value(ptr pointer, tagsize int) int {
- v := *ptr.toUint32()
- return SizeVarint(uint64(v)) + tagsize
-}
-func sizeVarint32ValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toUint32()
- if v == 0 {
- return 0
- }
- return SizeVarint(uint64(v)) + tagsize
-}
-func sizeVarint32Ptr(ptr pointer, tagsize int) int {
- p := *ptr.toUint32Ptr()
- if p == nil {
- return 0
- }
- return SizeVarint(uint64(*p)) + tagsize
-}
-func sizeVarint32Slice(ptr pointer, tagsize int) int {
- s := *ptr.toUint32Slice()
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v)) + tagsize
- }
- return n
-}
-func sizeVarint32PackedSlice(ptr pointer, tagsize int) int {
- s := *ptr.toUint32Slice()
- if len(s) == 0 {
- return 0
- }
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v))
- }
- return n + SizeVarint(uint64(n)) + tagsize
-}
-func sizeVarintS32Value(ptr pointer, tagsize int) int {
- v := *ptr.toInt32()
- return SizeVarint(uint64(v)) + tagsize
-}
-func sizeVarintS32ValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toInt32()
- if v == 0 {
- return 0
- }
- return SizeVarint(uint64(v)) + tagsize
-}
-func sizeVarintS32Ptr(ptr pointer, tagsize int) int {
- p := ptr.getInt32Ptr()
- if p == nil {
- return 0
- }
- return SizeVarint(uint64(*p)) + tagsize
-}
-func sizeVarintS32Slice(ptr pointer, tagsize int) int {
- s := ptr.getInt32Slice()
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v)) + tagsize
- }
- return n
-}
-func sizeVarintS32PackedSlice(ptr pointer, tagsize int) int {
- s := ptr.getInt32Slice()
- if len(s) == 0 {
- return 0
- }
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v))
- }
- return n + SizeVarint(uint64(n)) + tagsize
-}
-func sizeVarint64Value(ptr pointer, tagsize int) int {
- v := *ptr.toUint64()
- return SizeVarint(v) + tagsize
-}
-func sizeVarint64ValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toUint64()
- if v == 0 {
- return 0
- }
- return SizeVarint(v) + tagsize
-}
-func sizeVarint64Ptr(ptr pointer, tagsize int) int {
- p := *ptr.toUint64Ptr()
- if p == nil {
- return 0
- }
- return SizeVarint(*p) + tagsize
-}
-func sizeVarint64Slice(ptr pointer, tagsize int) int {
- s := *ptr.toUint64Slice()
- n := 0
- for _, v := range s {
- n += SizeVarint(v) + tagsize
- }
- return n
-}
-func sizeVarint64PackedSlice(ptr pointer, tagsize int) int {
- s := *ptr.toUint64Slice()
- if len(s) == 0 {
- return 0
- }
- n := 0
- for _, v := range s {
- n += SizeVarint(v)
- }
- return n + SizeVarint(uint64(n)) + tagsize
-}
-func sizeVarintS64Value(ptr pointer, tagsize int) int {
- v := *ptr.toInt64()
- return SizeVarint(uint64(v)) + tagsize
-}
-func sizeVarintS64ValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toInt64()
- if v == 0 {
- return 0
- }
- return SizeVarint(uint64(v)) + tagsize
-}
-func sizeVarintS64Ptr(ptr pointer, tagsize int) int {
- p := *ptr.toInt64Ptr()
- if p == nil {
- return 0
- }
- return SizeVarint(uint64(*p)) + tagsize
-}
-func sizeVarintS64Slice(ptr pointer, tagsize int) int {
- s := *ptr.toInt64Slice()
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v)) + tagsize
- }
- return n
-}
-func sizeVarintS64PackedSlice(ptr pointer, tagsize int) int {
- s := *ptr.toInt64Slice()
- if len(s) == 0 {
- return 0
- }
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v))
- }
- return n + SizeVarint(uint64(n)) + tagsize
-}
-func sizeZigzag32Value(ptr pointer, tagsize int) int {
- v := *ptr.toInt32()
- return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize
-}
-func sizeZigzag32ValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toInt32()
- if v == 0 {
- return 0
- }
- return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize
-}
-func sizeZigzag32Ptr(ptr pointer, tagsize int) int {
- p := ptr.getInt32Ptr()
- if p == nil {
- return 0
- }
- v := *p
- return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize
-}
-func sizeZigzag32Slice(ptr pointer, tagsize int) int {
- s := ptr.getInt32Slice()
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize
- }
- return n
-}
-func sizeZigzag32PackedSlice(ptr pointer, tagsize int) int {
- s := ptr.getInt32Slice()
- if len(s) == 0 {
- return 0
- }
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31))))
- }
- return n + SizeVarint(uint64(n)) + tagsize
-}
-func sizeZigzag64Value(ptr pointer, tagsize int) int {
- v := *ptr.toInt64()
- return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize
-}
-func sizeZigzag64ValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toInt64()
- if v == 0 {
- return 0
- }
- return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize
-}
-func sizeZigzag64Ptr(ptr pointer, tagsize int) int {
- p := *ptr.toInt64Ptr()
- if p == nil {
- return 0
- }
- v := *p
- return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize
-}
-func sizeZigzag64Slice(ptr pointer, tagsize int) int {
- s := *ptr.toInt64Slice()
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize
- }
- return n
-}
-func sizeZigzag64PackedSlice(ptr pointer, tagsize int) int {
- s := *ptr.toInt64Slice()
- if len(s) == 0 {
- return 0
- }
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63)))
- }
- return n + SizeVarint(uint64(n)) + tagsize
-}
-func sizeBoolValue(_ pointer, tagsize int) int {
- return 1 + tagsize
-}
-func sizeBoolValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toBool()
- if !v {
- return 0
- }
- return 1 + tagsize
-}
-func sizeBoolPtr(ptr pointer, tagsize int) int {
- p := *ptr.toBoolPtr()
- if p == nil {
- return 0
- }
- return 1 + tagsize
-}
-func sizeBoolSlice(ptr pointer, tagsize int) int {
- s := *ptr.toBoolSlice()
- return (1 + tagsize) * len(s)
-}
-func sizeBoolPackedSlice(ptr pointer, tagsize int) int {
- s := *ptr.toBoolSlice()
- if len(s) == 0 {
- return 0
- }
- return len(s) + SizeVarint(uint64(len(s))) + tagsize
-}
-func sizeStringValue(ptr pointer, tagsize int) int {
- v := *ptr.toString()
- return len(v) + SizeVarint(uint64(len(v))) + tagsize
-}
-func sizeStringValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toString()
- if v == "" {
- return 0
- }
- return len(v) + SizeVarint(uint64(len(v))) + tagsize
-}
-func sizeStringPtr(ptr pointer, tagsize int) int {
- p := *ptr.toStringPtr()
- if p == nil {
- return 0
- }
- v := *p
- return len(v) + SizeVarint(uint64(len(v))) + tagsize
-}
-func sizeStringSlice(ptr pointer, tagsize int) int {
- s := *ptr.toStringSlice()
- n := 0
- for _, v := range s {
- n += len(v) + SizeVarint(uint64(len(v))) + tagsize
- }
- return n
-}
-func sizeBytes(ptr pointer, tagsize int) int {
- v := *ptr.toBytes()
- if v == nil {
- return 0
- }
- return len(v) + SizeVarint(uint64(len(v))) + tagsize
-}
-func sizeBytes3(ptr pointer, tagsize int) int {
- v := *ptr.toBytes()
- if len(v) == 0 {
- return 0
- }
- return len(v) + SizeVarint(uint64(len(v))) + tagsize
-}
-func sizeBytesOneof(ptr pointer, tagsize int) int {
- v := *ptr.toBytes()
- return len(v) + SizeVarint(uint64(len(v))) + tagsize
-}
-func sizeBytesSlice(ptr pointer, tagsize int) int {
- s := *ptr.toBytesSlice()
- n := 0
- for _, v := range s {
- n += len(v) + SizeVarint(uint64(len(v))) + tagsize
- }
- return n
-}
-
-// appendFixed32 appends an encoded fixed32 to b.
-func appendFixed32(b []byte, v uint32) []byte {
- b = append(b,
- byte(v),
- byte(v>>8),
- byte(v>>16),
- byte(v>>24))
- return b
-}
-
-// appendFixed64 appends an encoded fixed64 to b.
-func appendFixed64(b []byte, v uint64) []byte {
- b = append(b,
- byte(v),
- byte(v>>8),
- byte(v>>16),
- byte(v>>24),
- byte(v>>32),
- byte(v>>40),
- byte(v>>48),
- byte(v>>56))
- return b
-}
-
-// appendVarint appends an encoded varint to b.
-func appendVarint(b []byte, v uint64) []byte {
- // TODO: make 1-byte (maybe 2-byte) case inline-able, once we
- // have non-leaf inliner.
- switch {
- case v < 1<<7:
- b = append(b, byte(v))
- case v < 1<<14:
- b = append(b,
- byte(v&0x7f|0x80),
- byte(v>>7))
- case v < 1<<21:
- b = append(b,
- byte(v&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte(v>>14))
- case v < 1<<28:
- b = append(b,
- byte(v&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte((v>>14)&0x7f|0x80),
- byte(v>>21))
- case v < 1<<35:
- b = append(b,
- byte(v&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte((v>>14)&0x7f|0x80),
- byte((v>>21)&0x7f|0x80),
- byte(v>>28))
- case v < 1<<42:
- b = append(b,
- byte(v&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte((v>>14)&0x7f|0x80),
- byte((v>>21)&0x7f|0x80),
- byte((v>>28)&0x7f|0x80),
- byte(v>>35))
- case v < 1<<49:
- b = append(b,
- byte(v&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte((v>>14)&0x7f|0x80),
- byte((v>>21)&0x7f|0x80),
- byte((v>>28)&0x7f|0x80),
- byte((v>>35)&0x7f|0x80),
- byte(v>>42))
- case v < 1<<56:
- b = append(b,
- byte(v&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte((v>>14)&0x7f|0x80),
- byte((v>>21)&0x7f|0x80),
- byte((v>>28)&0x7f|0x80),
- byte((v>>35)&0x7f|0x80),
- byte((v>>42)&0x7f|0x80),
- byte(v>>49))
- case v < 1<<63:
- b = append(b,
- byte(v&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte((v>>14)&0x7f|0x80),
- byte((v>>21)&0x7f|0x80),
- byte((v>>28)&0x7f|0x80),
- byte((v>>35)&0x7f|0x80),
- byte((v>>42)&0x7f|0x80),
- byte((v>>49)&0x7f|0x80),
- byte(v>>56))
- default:
- b = append(b,
- byte(v&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte((v>>14)&0x7f|0x80),
- byte((v>>21)&0x7f|0x80),
- byte((v>>28)&0x7f|0x80),
- byte((v>>35)&0x7f|0x80),
- byte((v>>42)&0x7f|0x80),
- byte((v>>49)&0x7f|0x80),
- byte((v>>56)&0x7f|0x80),
- 1)
- }
- return b
-}
-
-func appendFixed32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toUint32()
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, v)
- return b, nil
-}
-func appendFixed32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toUint32()
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, v)
- return b, nil
-}
-func appendFixed32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := *ptr.toUint32Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, *p)
- return b, nil
-}
-func appendFixed32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toUint32Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, v)
- }
- return b, nil
-}
-func appendFixed32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toUint32Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- b = appendVarint(b, uint64(4*len(s)))
- for _, v := range s {
- b = appendFixed32(b, v)
- }
- return b, nil
-}
-func appendFixedS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt32()
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, uint32(v))
- return b, nil
-}
-func appendFixedS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt32()
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, uint32(v))
- return b, nil
-}
-func appendFixedS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := ptr.getInt32Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, uint32(*p))
- return b, nil
-}
-func appendFixedS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := ptr.getInt32Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, uint32(v))
- }
- return b, nil
-}
-func appendFixedS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := ptr.getInt32Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- b = appendVarint(b, uint64(4*len(s)))
- for _, v := range s {
- b = appendFixed32(b, uint32(v))
- }
- return b, nil
-}
-func appendFloat32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := math.Float32bits(*ptr.toFloat32())
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, v)
- return b, nil
-}
-func appendFloat32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := math.Float32bits(*ptr.toFloat32())
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, v)
- return b, nil
-}
-func appendFloat32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := *ptr.toFloat32Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, math.Float32bits(*p))
- return b, nil
-}
-func appendFloat32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toFloat32Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, math.Float32bits(v))
- }
- return b, nil
-}
-func appendFloat32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toFloat32Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- b = appendVarint(b, uint64(4*len(s)))
- for _, v := range s {
- b = appendFixed32(b, math.Float32bits(v))
- }
- return b, nil
-}
-func appendFixed64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toUint64()
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, v)
- return b, nil
-}
-func appendFixed64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toUint64()
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, v)
- return b, nil
-}
-func appendFixed64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := *ptr.toUint64Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, *p)
- return b, nil
-}
-func appendFixed64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toUint64Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, v)
- }
- return b, nil
-}
-func appendFixed64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toUint64Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- b = appendVarint(b, uint64(8*len(s)))
- for _, v := range s {
- b = appendFixed64(b, v)
- }
- return b, nil
-}
-func appendFixedS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt64()
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, uint64(v))
- return b, nil
-}
-func appendFixedS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt64()
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, uint64(v))
- return b, nil
-}
-func appendFixedS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := *ptr.toInt64Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, uint64(*p))
- return b, nil
-}
-func appendFixedS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toInt64Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, uint64(v))
- }
- return b, nil
-}
-func appendFixedS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toInt64Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- b = appendVarint(b, uint64(8*len(s)))
- for _, v := range s {
- b = appendFixed64(b, uint64(v))
- }
- return b, nil
-}
-func appendFloat64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := math.Float64bits(*ptr.toFloat64())
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, v)
- return b, nil
-}
-func appendFloat64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := math.Float64bits(*ptr.toFloat64())
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, v)
- return b, nil
-}
-func appendFloat64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := *ptr.toFloat64Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, math.Float64bits(*p))
- return b, nil
-}
-func appendFloat64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toFloat64Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, math.Float64bits(v))
- }
- return b, nil
-}
-func appendFloat64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toFloat64Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- b = appendVarint(b, uint64(8*len(s)))
- for _, v := range s {
- b = appendFixed64(b, math.Float64bits(v))
- }
- return b, nil
-}
-func appendVarint32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toUint32()
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v))
- return b, nil
-}
-func appendVarint32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toUint32()
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v))
- return b, nil
-}
-func appendVarint32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := *ptr.toUint32Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(*p))
- return b, nil
-}
-func appendVarint32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toUint32Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v))
- }
- return b, nil
-}
-func appendVarint32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toUint32Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- // compute size
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v))
- }
- b = appendVarint(b, uint64(n))
- for _, v := range s {
- b = appendVarint(b, uint64(v))
- }
- return b, nil
-}
-func appendVarintS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt32()
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v))
- return b, nil
-}
-func appendVarintS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt32()
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v))
- return b, nil
-}
-func appendVarintS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := ptr.getInt32Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(*p))
- return b, nil
-}
-func appendVarintS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := ptr.getInt32Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v))
- }
- return b, nil
-}
-func appendVarintS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := ptr.getInt32Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- // compute size
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v))
- }
- b = appendVarint(b, uint64(n))
- for _, v := range s {
- b = appendVarint(b, uint64(v))
- }
- return b, nil
-}
-func appendVarint64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toUint64()
- b = appendVarint(b, wiretag)
- b = appendVarint(b, v)
- return b, nil
-}
-func appendVarint64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toUint64()
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, v)
- return b, nil
-}
-func appendVarint64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := *ptr.toUint64Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, *p)
- return b, nil
-}
-func appendVarint64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toUint64Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendVarint(b, v)
- }
- return b, nil
-}
-func appendVarint64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toUint64Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- // compute size
- n := 0
- for _, v := range s {
- n += SizeVarint(v)
- }
- b = appendVarint(b, uint64(n))
- for _, v := range s {
- b = appendVarint(b, v)
- }
- return b, nil
-}
-func appendVarintS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt64()
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v))
- return b, nil
-}
-func appendVarintS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt64()
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v))
- return b, nil
-}
-func appendVarintS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := *ptr.toInt64Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(*p))
- return b, nil
-}
-func appendVarintS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toInt64Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v))
- }
- return b, nil
-}
-func appendVarintS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toInt64Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- // compute size
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v))
- }
- b = appendVarint(b, uint64(n))
- for _, v := range s {
- b = appendVarint(b, uint64(v))
- }
- return b, nil
-}
-func appendZigzag32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt32()
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31))))
- return b, nil
-}
-func appendZigzag32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt32()
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31))))
- return b, nil
-}
-func appendZigzag32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := ptr.getInt32Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- v := *p
- b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31))))
- return b, nil
-}
-func appendZigzag32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := ptr.getInt32Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31))))
- }
- return b, nil
-}
-func appendZigzag32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := ptr.getInt32Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- // compute size
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31))))
- }
- b = appendVarint(b, uint64(n))
- for _, v := range s {
- b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31))))
- }
- return b, nil
-}
-func appendZigzag64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt64()
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63)))
- return b, nil
-}
-func appendZigzag64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt64()
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63)))
- return b, nil
-}
-func appendZigzag64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := *ptr.toInt64Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- v := *p
- b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63)))
- return b, nil
-}
-func appendZigzag64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toInt64Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63)))
- }
- return b, nil
-}
-func appendZigzag64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toInt64Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- // compute size
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63)))
- }
- b = appendVarint(b, uint64(n))
- for _, v := range s {
- b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63)))
- }
- return b, nil
-}
-func appendBoolValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toBool()
- b = appendVarint(b, wiretag)
- if v {
- b = append(b, 1)
- } else {
- b = append(b, 0)
- }
- return b, nil
-}
-func appendBoolValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toBool()
- if !v {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = append(b, 1)
- return b, nil
-}
-
-func appendBoolPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := *ptr.toBoolPtr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- if *p {
- b = append(b, 1)
- } else {
- b = append(b, 0)
- }
- return b, nil
-}
-func appendBoolSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toBoolSlice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- if v {
- b = append(b, 1)
- } else {
- b = append(b, 0)
- }
- }
- return b, nil
-}
-func appendBoolPackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toBoolSlice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- b = appendVarint(b, uint64(len(s)))
- for _, v := range s {
- if v {
- b = append(b, 1)
- } else {
- b = append(b, 0)
- }
- }
- return b, nil
-}
-func appendStringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toString()
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- return b, nil
-}
-func appendStringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toString()
- if v == "" {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- return b, nil
-}
-func appendStringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := *ptr.toStringPtr()
- if p == nil {
- return b, nil
- }
- v := *p
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- return b, nil
-}
-func appendStringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toStringSlice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- }
- return b, nil
-}
-func appendUTF8StringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- var invalidUTF8 bool
- v := *ptr.toString()
- if !utf8.ValidString(v) {
- invalidUTF8 = true
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- if invalidUTF8 {
- return b, errInvalidUTF8
- }
- return b, nil
-}
-func appendUTF8StringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- var invalidUTF8 bool
- v := *ptr.toString()
- if v == "" {
- return b, nil
- }
- if !utf8.ValidString(v) {
- invalidUTF8 = true
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- if invalidUTF8 {
- return b, errInvalidUTF8
- }
- return b, nil
-}
-func appendUTF8StringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- var invalidUTF8 bool
- p := *ptr.toStringPtr()
- if p == nil {
- return b, nil
- }
- v := *p
- if !utf8.ValidString(v) {
- invalidUTF8 = true
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- if invalidUTF8 {
- return b, errInvalidUTF8
- }
- return b, nil
-}
-func appendUTF8StringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- var invalidUTF8 bool
- s := *ptr.toStringSlice()
- for _, v := range s {
- if !utf8.ValidString(v) {
- invalidUTF8 = true
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- }
- if invalidUTF8 {
- return b, errInvalidUTF8
- }
- return b, nil
-}
-func appendBytes(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toBytes()
- if v == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- return b, nil
-}
-func appendBytes3(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toBytes()
- if len(v) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- return b, nil
-}
-func appendBytesOneof(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toBytes()
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- return b, nil
-}
-func appendBytesSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toBytesSlice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- }
- return b, nil
-}
-
-// makeGroupMarshaler returns the sizer and marshaler for a group.
-// u is the marshal info of the underlying message.
-func makeGroupMarshaler(u *marshalInfo) (sizer, marshaler) {
- return func(ptr pointer, tagsize int) int {
- p := ptr.getPointer()
- if p.isNil() {
- return 0
- }
- return u.size(p) + 2*tagsize
- },
- func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) {
- p := ptr.getPointer()
- if p.isNil() {
- return b, nil
- }
- var err error
- b = appendVarint(b, wiretag) // start group
- b, err = u.marshal(b, p, deterministic)
- b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group
- return b, err
- }
-}
-
-// makeGroupSliceMarshaler returns the sizer and marshaler for a group slice.
-// u is the marshal info of the underlying message.
-func makeGroupSliceMarshaler(u *marshalInfo) (sizer, marshaler) {
- return func(ptr pointer, tagsize int) int {
- s := ptr.getPointerSlice()
- n := 0
- for _, v := range s {
- if v.isNil() {
- continue
- }
- n += u.size(v) + 2*tagsize
- }
- return n
- },
- func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) {
- s := ptr.getPointerSlice()
- var err error
- var nerr nonFatal
- for _, v := range s {
- if v.isNil() {
- return b, errRepeatedHasNil
- }
- b = appendVarint(b, wiretag) // start group
- b, err = u.marshal(b, v, deterministic)
- b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group
- if !nerr.Merge(err) {
- if err == ErrNil {
- err = errRepeatedHasNil
- }
- return b, err
- }
- }
- return b, nerr.E
- }
-}
-
-// makeMessageMarshaler returns the sizer and marshaler for a message field.
-// u is the marshal info of the message.
-func makeMessageMarshaler(u *marshalInfo) (sizer, marshaler) {
- return func(ptr pointer, tagsize int) int {
- p := ptr.getPointer()
- if p.isNil() {
- return 0
- }
- siz := u.size(p)
- return siz + SizeVarint(uint64(siz)) + tagsize
- },
- func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) {
- p := ptr.getPointer()
- if p.isNil() {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- siz := u.cachedsize(p)
- b = appendVarint(b, uint64(siz))
- return u.marshal(b, p, deterministic)
- }
-}
-
-// makeMessageSliceMarshaler returns the sizer and marshaler for a message slice.
-// u is the marshal info of the message.
-func makeMessageSliceMarshaler(u *marshalInfo) (sizer, marshaler) {
- return func(ptr pointer, tagsize int) int {
- s := ptr.getPointerSlice()
- n := 0
- for _, v := range s {
- if v.isNil() {
- continue
- }
- siz := u.size(v)
- n += siz + SizeVarint(uint64(siz)) + tagsize
- }
- return n
- },
- func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) {
- s := ptr.getPointerSlice()
- var err error
- var nerr nonFatal
- for _, v := range s {
- if v.isNil() {
- return b, errRepeatedHasNil
- }
- b = appendVarint(b, wiretag)
- siz := u.cachedsize(v)
- b = appendVarint(b, uint64(siz))
- b, err = u.marshal(b, v, deterministic)
-
- if !nerr.Merge(err) {
- if err == ErrNil {
- err = errRepeatedHasNil
- }
- return b, err
- }
- }
- return b, nerr.E
- }
-}
-
-// makeMapMarshaler returns the sizer and marshaler for a map field.
-// f is the pointer to the reflect data structure of the field.
-func makeMapMarshaler(f *reflect.StructField) (sizer, marshaler) {
- // figure out key and value type
- t := f.Type
- keyType := t.Key()
- valType := t.Elem()
- keyTags := strings.Split(f.Tag.Get("protobuf_key"), ",")
- valTags := strings.Split(f.Tag.Get("protobuf_val"), ",")
- keySizer, keyMarshaler := typeMarshaler(keyType, keyTags, false, false) // don't omit zero value in map
- valSizer, valMarshaler := typeMarshaler(valType, valTags, false, false) // don't omit zero value in map
- keyWireTag := 1<<3 | wiretype(keyTags[0])
- valWireTag := 2<<3 | wiretype(valTags[0])
-
- // We create an interface to get the addresses of the map key and value.
- // If value is pointer-typed, the interface is a direct interface, the
- // idata itself is the value. Otherwise, the idata is the pointer to the
- // value.
- // Key cannot be pointer-typed.
- valIsPtr := valType.Kind() == reflect.Ptr
-
- // If value is a message with nested maps, calling
- // valSizer in marshal may be quadratic. We should use
- // cached version in marshal (but not in size).
- // If value is not message type, we don't have size cache,
- // but it cannot be nested either. Just use valSizer.
- valCachedSizer := valSizer
- if valIsPtr && valType.Elem().Kind() == reflect.Struct {
- u := getMarshalInfo(valType.Elem())
- valCachedSizer = func(ptr pointer, tagsize int) int {
- // Same as message sizer, but use cache.
- p := ptr.getPointer()
- if p.isNil() {
- return 0
- }
- siz := u.cachedsize(p)
- return siz + SizeVarint(uint64(siz)) + tagsize
- }
- }
- return func(ptr pointer, tagsize int) int {
- m := ptr.asPointerTo(t).Elem() // the map
- n := 0
- for _, k := range m.MapKeys() {
- ki := k.Interface()
- vi := m.MapIndex(k).Interface()
- kaddr := toAddrPointer(&ki, false, false) // pointer to key
- vaddr := toAddrPointer(&vi, valIsPtr, false) // pointer to value
- siz := keySizer(kaddr, 1) + valSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1)
- n += siz + SizeVarint(uint64(siz)) + tagsize
- }
- return n
- },
- func(b []byte, ptr pointer, tag uint64, deterministic bool) ([]byte, error) {
- m := ptr.asPointerTo(t).Elem() // the map
- var err error
- keys := m.MapKeys()
- if len(keys) > 1 && deterministic {
- sort.Sort(mapKeys(keys))
- }
-
- var nerr nonFatal
- for _, k := range keys {
- ki := k.Interface()
- vi := m.MapIndex(k).Interface()
- kaddr := toAddrPointer(&ki, false, false) // pointer to key
- vaddr := toAddrPointer(&vi, valIsPtr, false) // pointer to value
- b = appendVarint(b, tag)
- siz := keySizer(kaddr, 1) + valCachedSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1)
- b = appendVarint(b, uint64(siz))
- b, err = keyMarshaler(b, kaddr, keyWireTag, deterministic)
- if !nerr.Merge(err) {
- return b, err
- }
- b, err = valMarshaler(b, vaddr, valWireTag, deterministic)
- if err != ErrNil && !nerr.Merge(err) { // allow nil value in map
- return b, err
- }
- }
- return b, nerr.E
- }
-}
-
-// makeOneOfMarshaler returns the sizer and marshaler for a oneof field.
-// fi is the marshal info of the field.
-// f is the pointer to the reflect data structure of the field.
-func makeOneOfMarshaler(fi *marshalFieldInfo, f *reflect.StructField) (sizer, marshaler) {
- // Oneof field is an interface. We need to get the actual data type on the fly.
- t := f.Type
- return func(ptr pointer, _ int) int {
- p := ptr.getInterfacePointer()
- if p.isNil() {
- return 0
- }
- v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct
- telem := v.Type()
- e := fi.oneofElems[telem]
- return e.sizer(p, e.tagsize)
- },
- func(b []byte, ptr pointer, _ uint64, deterministic bool) ([]byte, error) {
- p := ptr.getInterfacePointer()
- if p.isNil() {
- return b, nil
- }
- v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct
- telem := v.Type()
- if telem.Field(0).Type.Kind() == reflect.Ptr && p.getPointer().isNil() {
- return b, errOneofHasNil
- }
- e := fi.oneofElems[telem]
- return e.marshaler(b, p, e.wiretag, deterministic)
- }
-}
-
-// sizeExtensions computes the size of encoded data for a XXX_InternalExtensions field.
-func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int {
- m, mu := ext.extensionsRead()
- if m == nil {
- return 0
- }
- mu.Lock()
-
- n := 0
- for _, e := range m {
- if e.value == nil || e.desc == nil {
- // Extension is only in its encoded form.
- n += len(e.enc)
- continue
- }
-
- // We don't skip extensions that have an encoded form set,
- // because the extension value may have been mutated after
- // the last time this function was called.
- ei := u.getExtElemInfo(e.desc)
- v := e.value
- p := toAddrPointer(&v, ei.isptr, ei.deref)
- n += ei.sizer(p, ei.tagsize)
- }
- mu.Unlock()
- return n
-}
-
-// appendExtensions marshals a XXX_InternalExtensions field to the end of byte slice b.
-func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) {
- m, mu := ext.extensionsRead()
- if m == nil {
- return b, nil
- }
- mu.Lock()
- defer mu.Unlock()
-
- var err error
- var nerr nonFatal
-
- // Fast-path for common cases: zero or one extensions.
- // Don't bother sorting the keys.
- if len(m) <= 1 {
- for _, e := range m {
- if e.value == nil || e.desc == nil {
- // Extension is only in its encoded form.
- b = append(b, e.enc...)
- continue
- }
-
- // We don't skip extensions that have an encoded form set,
- // because the extension value may have been mutated after
- // the last time this function was called.
-
- ei := u.getExtElemInfo(e.desc)
- v := e.value
- p := toAddrPointer(&v, ei.isptr, ei.deref)
- b, err = ei.marshaler(b, p, ei.wiretag, deterministic)
- if !nerr.Merge(err) {
- return b, err
- }
- }
- return b, nerr.E
- }
-
- // Sort the keys to provide a deterministic encoding.
- // Not sure this is required, but the old code does it.
- keys := make([]int, 0, len(m))
- for k := range m {
- keys = append(keys, int(k))
- }
- sort.Ints(keys)
-
- for _, k := range keys {
- e := m[int32(k)]
- if e.value == nil || e.desc == nil {
- // Extension is only in its encoded form.
- b = append(b, e.enc...)
- continue
- }
-
- // We don't skip extensions that have an encoded form set,
- // because the extension value may have been mutated after
- // the last time this function was called.
-
- ei := u.getExtElemInfo(e.desc)
- v := e.value
- p := toAddrPointer(&v, ei.isptr, ei.deref)
- b, err = ei.marshaler(b, p, ei.wiretag, deterministic)
- if !nerr.Merge(err) {
- return b, err
- }
- }
- return b, nerr.E
-}
-
-// message set format is:
-// message MessageSet {
-// repeated group Item = 1 {
-// required int32 type_id = 2;
-// required string message = 3;
-// };
-// }
-
-// sizeMessageSet computes the size of encoded data for a XXX_InternalExtensions field
-// in message set format (above).
-func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions) int {
- m, mu := ext.extensionsRead()
- if m == nil {
- return 0
- }
- mu.Lock()
-
- n := 0
- for id, e := range m {
- n += 2 // start group, end group. tag = 1 (size=1)
- n += SizeVarint(uint64(id)) + 1 // type_id, tag = 2 (size=1)
-
- if e.value == nil || e.desc == nil {
- // Extension is only in its encoded form.
- msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint
- siz := len(msgWithLen)
- n += siz + 1 // message, tag = 3 (size=1)
- continue
- }
-
- // We don't skip extensions that have an encoded form set,
- // because the extension value may have been mutated after
- // the last time this function was called.
-
- ei := u.getExtElemInfo(e.desc)
- v := e.value
- p := toAddrPointer(&v, ei.isptr, ei.deref)
- n += ei.sizer(p, 1) // message, tag = 3 (size=1)
- }
- mu.Unlock()
- return n
-}
-
-// appendMessageSet marshals a XXX_InternalExtensions field in message set format (above)
-// to the end of byte slice b.
-func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) {
- m, mu := ext.extensionsRead()
- if m == nil {
- return b, nil
- }
- mu.Lock()
- defer mu.Unlock()
-
- var err error
- var nerr nonFatal
-
- // Fast-path for common cases: zero or one extensions.
- // Don't bother sorting the keys.
- if len(m) <= 1 {
- for id, e := range m {
- b = append(b, 1<<3|WireStartGroup)
- b = append(b, 2<<3|WireVarint)
- b = appendVarint(b, uint64(id))
-
- if e.value == nil || e.desc == nil {
- // Extension is only in its encoded form.
- msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint
- b = append(b, 3<<3|WireBytes)
- b = append(b, msgWithLen...)
- b = append(b, 1<<3|WireEndGroup)
- continue
- }
-
- // We don't skip extensions that have an encoded form set,
- // because the extension value may have been mutated after
- // the last time this function was called.
-
- ei := u.getExtElemInfo(e.desc)
- v := e.value
- p := toAddrPointer(&v, ei.isptr, ei.deref)
- b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic)
- if !nerr.Merge(err) {
- return b, err
- }
- b = append(b, 1<<3|WireEndGroup)
- }
- return b, nerr.E
- }
-
- // Sort the keys to provide a deterministic encoding.
- keys := make([]int, 0, len(m))
- for k := range m {
- keys = append(keys, int(k))
- }
- sort.Ints(keys)
-
- for _, id := range keys {
- e := m[int32(id)]
- b = append(b, 1<<3|WireStartGroup)
- b = append(b, 2<<3|WireVarint)
- b = appendVarint(b, uint64(id))
-
- if e.value == nil || e.desc == nil {
- // Extension is only in its encoded form.
- msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint
- b = append(b, 3<<3|WireBytes)
- b = append(b, msgWithLen...)
- b = append(b, 1<<3|WireEndGroup)
- continue
- }
-
- // We don't skip extensions that have an encoded form set,
- // because the extension value may have been mutated after
- // the last time this function was called.
-
- ei := u.getExtElemInfo(e.desc)
- v := e.value
- p := toAddrPointer(&v, ei.isptr, ei.deref)
- b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic)
- b = append(b, 1<<3|WireEndGroup)
- if !nerr.Merge(err) {
- return b, err
- }
- }
- return b, nerr.E
-}
-
-// sizeV1Extensions computes the size of encoded data for a V1-API extension field.
-func (u *marshalInfo) sizeV1Extensions(m map[int32]Extension) int {
- if m == nil {
- return 0
- }
-
- n := 0
- for _, e := range m {
- if e.value == nil || e.desc == nil {
- // Extension is only in its encoded form.
- n += len(e.enc)
- continue
- }
-
- // We don't skip extensions that have an encoded form set,
- // because the extension value may have been mutated after
- // the last time this function was called.
-
- ei := u.getExtElemInfo(e.desc)
- v := e.value
- p := toAddrPointer(&v, ei.isptr, ei.deref)
- n += ei.sizer(p, ei.tagsize)
- }
- return n
-}
-
-// appendV1Extensions marshals a V1-API extension field to the end of byte slice b.
-func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, deterministic bool) ([]byte, error) {
- if m == nil {
- return b, nil
- }
-
- // Sort the keys to provide a deterministic encoding.
- keys := make([]int, 0, len(m))
- for k := range m {
- keys = append(keys, int(k))
- }
- sort.Ints(keys)
-
- var err error
- var nerr nonFatal
- for _, k := range keys {
- e := m[int32(k)]
- if e.value == nil || e.desc == nil {
- // Extension is only in its encoded form.
- b = append(b, e.enc...)
- continue
- }
-
- // We don't skip extensions that have an encoded form set,
- // because the extension value may have been mutated after
- // the last time this function was called.
-
- ei := u.getExtElemInfo(e.desc)
- v := e.value
- p := toAddrPointer(&v, ei.isptr, ei.deref)
- b, err = ei.marshaler(b, p, ei.wiretag, deterministic)
- if !nerr.Merge(err) {
- return b, err
- }
- }
- return b, nerr.E
-}
-
-// newMarshaler is the interface representing objects that can marshal themselves.
-//
-// This exists to support protoc-gen-go generated messages.
-// The proto package will stop type-asserting to this interface in the future.
-//
-// DO NOT DEPEND ON THIS.
-type newMarshaler interface {
- XXX_Size() int
- XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
-}
-
-// Size returns the encoded size of a protocol buffer message.
-// This is the main entry point.
-func Size(pb Message) int {
- if m, ok := pb.(newMarshaler); ok {
- return m.XXX_Size()
- }
- if m, ok := pb.(Marshaler); ok {
- // If the message can marshal itself, let it do it, for compatibility.
- // NOTE: This is not efficient.
- b, _ := m.Marshal()
- return len(b)
- }
- // in case somehow we didn't generate the wrapper
- if pb == nil {
- return 0
- }
- var info InternalMessageInfo
- return info.Size(pb)
-}
-
-// Marshal takes a protocol buffer message
-// and encodes it into the wire format, returning the data.
-// This is the main entry point.
-func Marshal(pb Message) ([]byte, error) {
- if m, ok := pb.(newMarshaler); ok {
- siz := m.XXX_Size()
- b := make([]byte, 0, siz)
- return m.XXX_Marshal(b, false)
- }
- if m, ok := pb.(Marshaler); ok {
- // If the message can marshal itself, let it do it, for compatibility.
- // NOTE: This is not efficient.
- return m.Marshal()
- }
- // in case somehow we didn't generate the wrapper
- if pb == nil {
- return nil, ErrNil
- }
- var info InternalMessageInfo
- siz := info.Size(pb)
- b := make([]byte, 0, siz)
- return info.Marshal(b, pb, false)
-}
-
-// Marshal takes a protocol buffer message
-// and encodes it into the wire format, writing the result to the
-// Buffer.
-// This is an alternative entry point. It is not necessary to use
-// a Buffer for most applications.
-func (p *Buffer) Marshal(pb Message) error {
- var err error
- if m, ok := pb.(newMarshaler); ok {
- siz := m.XXX_Size()
- p.grow(siz) // make sure buf has enough capacity
- p.buf, err = m.XXX_Marshal(p.buf, p.deterministic)
- return err
- }
- if m, ok := pb.(Marshaler); ok {
- // If the message can marshal itself, let it do it, for compatibility.
- // NOTE: This is not efficient.
- b, err := m.Marshal()
- p.buf = append(p.buf, b...)
- return err
- }
- // in case somehow we didn't generate the wrapper
- if pb == nil {
- return ErrNil
- }
- var info InternalMessageInfo
- siz := info.Size(pb)
- p.grow(siz) // make sure buf has enough capacity
- p.buf, err = info.Marshal(p.buf, pb, p.deterministic)
- return err
-}
-
-// grow grows the buffer's capacity, if necessary, to guarantee space for
-// another n bytes. After grow(n), at least n bytes can be written to the
-// buffer without another allocation.
-func (p *Buffer) grow(n int) {
- need := len(p.buf) + n
- if need <= cap(p.buf) {
- return
- }
- newCap := len(p.buf) * 2
- if newCap < need {
- newCap = need
- }
- p.buf = append(make([]byte, 0, newCap), p.buf...)
-}
diff --git a/vendor/github.com/golang/protobuf/proto/table_merge.go b/vendor/github.com/golang/protobuf/proto/table_merge.go
deleted file mode 100644
index 5525def..0000000
--- a/vendor/github.com/golang/protobuf/proto/table_merge.go
+++ /dev/null
@@ -1,654 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2016 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-import (
- "fmt"
- "reflect"
- "strings"
- "sync"
- "sync/atomic"
-)
-
-// Merge merges the src message into dst.
-// This assumes that dst and src of the same type and are non-nil.
-func (a *InternalMessageInfo) Merge(dst, src Message) {
- mi := atomicLoadMergeInfo(&a.merge)
- if mi == nil {
- mi = getMergeInfo(reflect.TypeOf(dst).Elem())
- atomicStoreMergeInfo(&a.merge, mi)
- }
- mi.merge(toPointer(&dst), toPointer(&src))
-}
-
-type mergeInfo struct {
- typ reflect.Type
-
- initialized int32 // 0: only typ is valid, 1: everything is valid
- lock sync.Mutex
-
- fields []mergeFieldInfo
- unrecognized field // Offset of XXX_unrecognized
-}
-
-type mergeFieldInfo struct {
- field field // Offset of field, guaranteed to be valid
-
- // isPointer reports whether the value in the field is a pointer.
- // This is true for the following situations:
- // * Pointer to struct
- // * Pointer to basic type (proto2 only)
- // * Slice (first value in slice header is a pointer)
- // * String (first value in string header is a pointer)
- isPointer bool
-
- // basicWidth reports the width of the field assuming that it is directly
- // embedded in the struct (as is the case for basic types in proto3).
- // The possible values are:
- // 0: invalid
- // 1: bool
- // 4: int32, uint32, float32
- // 8: int64, uint64, float64
- basicWidth int
-
- // Where dst and src are pointers to the types being merged.
- merge func(dst, src pointer)
-}
-
-var (
- mergeInfoMap = map[reflect.Type]*mergeInfo{}
- mergeInfoLock sync.Mutex
-)
-
-func getMergeInfo(t reflect.Type) *mergeInfo {
- mergeInfoLock.Lock()
- defer mergeInfoLock.Unlock()
- mi := mergeInfoMap[t]
- if mi == nil {
- mi = &mergeInfo{typ: t}
- mergeInfoMap[t] = mi
- }
- return mi
-}
-
-// merge merges src into dst assuming they are both of type *mi.typ.
-func (mi *mergeInfo) merge(dst, src pointer) {
- if dst.isNil() {
- panic("proto: nil destination")
- }
- if src.isNil() {
- return // Nothing to do.
- }
-
- if atomic.LoadInt32(&mi.initialized) == 0 {
- mi.computeMergeInfo()
- }
-
- for _, fi := range mi.fields {
- sfp := src.offset(fi.field)
-
- // As an optimization, we can avoid the merge function call cost
- // if we know for sure that the source will have no effect
- // by checking if it is the zero value.
- if unsafeAllowed {
- if fi.isPointer && sfp.getPointer().isNil() { // Could be slice or string
- continue
- }
- if fi.basicWidth > 0 {
- switch {
- case fi.basicWidth == 1 && !*sfp.toBool():
- continue
- case fi.basicWidth == 4 && *sfp.toUint32() == 0:
- continue
- case fi.basicWidth == 8 && *sfp.toUint64() == 0:
- continue
- }
- }
- }
-
- dfp := dst.offset(fi.field)
- fi.merge(dfp, sfp)
- }
-
- // TODO: Make this faster?
- out := dst.asPointerTo(mi.typ).Elem()
- in := src.asPointerTo(mi.typ).Elem()
- if emIn, err := extendable(in.Addr().Interface()); err == nil {
- emOut, _ := extendable(out.Addr().Interface())
- mIn, muIn := emIn.extensionsRead()
- if mIn != nil {
- mOut := emOut.extensionsWrite()
- muIn.Lock()
- mergeExtension(mOut, mIn)
- muIn.Unlock()
- }
- }
-
- if mi.unrecognized.IsValid() {
- if b := *src.offset(mi.unrecognized).toBytes(); len(b) > 0 {
- *dst.offset(mi.unrecognized).toBytes() = append([]byte(nil), b...)
- }
- }
-}
-
-func (mi *mergeInfo) computeMergeInfo() {
- mi.lock.Lock()
- defer mi.lock.Unlock()
- if mi.initialized != 0 {
- return
- }
- t := mi.typ
- n := t.NumField()
-
- props := GetProperties(t)
- for i := 0; i < n; i++ {
- f := t.Field(i)
- if strings.HasPrefix(f.Name, "XXX_") {
- continue
- }
-
- mfi := mergeFieldInfo{field: toField(&f)}
- tf := f.Type
-
- // As an optimization, we can avoid the merge function call cost
- // if we know for sure that the source will have no effect
- // by checking if it is the zero value.
- if unsafeAllowed {
- switch tf.Kind() {
- case reflect.Ptr, reflect.Slice, reflect.String:
- // As a special case, we assume slices and strings are pointers
- // since we know that the first field in the SliceSlice or
- // StringHeader is a data pointer.
- mfi.isPointer = true
- case reflect.Bool:
- mfi.basicWidth = 1
- case reflect.Int32, reflect.Uint32, reflect.Float32:
- mfi.basicWidth = 4
- case reflect.Int64, reflect.Uint64, reflect.Float64:
- mfi.basicWidth = 8
- }
- }
-
- // Unwrap tf to get at its most basic type.
- var isPointer, isSlice bool
- if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 {
- isSlice = true
- tf = tf.Elem()
- }
- if tf.Kind() == reflect.Ptr {
- isPointer = true
- tf = tf.Elem()
- }
- if isPointer && isSlice && tf.Kind() != reflect.Struct {
- panic("both pointer and slice for basic type in " + tf.Name())
- }
-
- switch tf.Kind() {
- case reflect.Int32:
- switch {
- case isSlice: // E.g., []int32
- mfi.merge = func(dst, src pointer) {
- // NOTE: toInt32Slice is not defined (see pointer_reflect.go).
- /*
- sfsp := src.toInt32Slice()
- if *sfsp != nil {
- dfsp := dst.toInt32Slice()
- *dfsp = append(*dfsp, *sfsp...)
- if *dfsp == nil {
- *dfsp = []int64{}
- }
- }
- */
- sfs := src.getInt32Slice()
- if sfs != nil {
- dfs := dst.getInt32Slice()
- dfs = append(dfs, sfs...)
- if dfs == nil {
- dfs = []int32{}
- }
- dst.setInt32Slice(dfs)
- }
- }
- case isPointer: // E.g., *int32
- mfi.merge = func(dst, src pointer) {
- // NOTE: toInt32Ptr is not defined (see pointer_reflect.go).
- /*
- sfpp := src.toInt32Ptr()
- if *sfpp != nil {
- dfpp := dst.toInt32Ptr()
- if *dfpp == nil {
- *dfpp = Int32(**sfpp)
- } else {
- **dfpp = **sfpp
- }
- }
- */
- sfp := src.getInt32Ptr()
- if sfp != nil {
- dfp := dst.getInt32Ptr()
- if dfp == nil {
- dst.setInt32Ptr(*sfp)
- } else {
- *dfp = *sfp
- }
- }
- }
- default: // E.g., int32
- mfi.merge = func(dst, src pointer) {
- if v := *src.toInt32(); v != 0 {
- *dst.toInt32() = v
- }
- }
- }
- case reflect.Int64:
- switch {
- case isSlice: // E.g., []int64
- mfi.merge = func(dst, src pointer) {
- sfsp := src.toInt64Slice()
- if *sfsp != nil {
- dfsp := dst.toInt64Slice()
- *dfsp = append(*dfsp, *sfsp...)
- if *dfsp == nil {
- *dfsp = []int64{}
- }
- }
- }
- case isPointer: // E.g., *int64
- mfi.merge = func(dst, src pointer) {
- sfpp := src.toInt64Ptr()
- if *sfpp != nil {
- dfpp := dst.toInt64Ptr()
- if *dfpp == nil {
- *dfpp = Int64(**sfpp)
- } else {
- **dfpp = **sfpp
- }
- }
- }
- default: // E.g., int64
- mfi.merge = func(dst, src pointer) {
- if v := *src.toInt64(); v != 0 {
- *dst.toInt64() = v
- }
- }
- }
- case reflect.Uint32:
- switch {
- case isSlice: // E.g., []uint32
- mfi.merge = func(dst, src pointer) {
- sfsp := src.toUint32Slice()
- if *sfsp != nil {
- dfsp := dst.toUint32Slice()
- *dfsp = append(*dfsp, *sfsp...)
- if *dfsp == nil {
- *dfsp = []uint32{}
- }
- }
- }
- case isPointer: // E.g., *uint32
- mfi.merge = func(dst, src pointer) {
- sfpp := src.toUint32Ptr()
- if *sfpp != nil {
- dfpp := dst.toUint32Ptr()
- if *dfpp == nil {
- *dfpp = Uint32(**sfpp)
- } else {
- **dfpp = **sfpp
- }
- }
- }
- default: // E.g., uint32
- mfi.merge = func(dst, src pointer) {
- if v := *src.toUint32(); v != 0 {
- *dst.toUint32() = v
- }
- }
- }
- case reflect.Uint64:
- switch {
- case isSlice: // E.g., []uint64
- mfi.merge = func(dst, src pointer) {
- sfsp := src.toUint64Slice()
- if *sfsp != nil {
- dfsp := dst.toUint64Slice()
- *dfsp = append(*dfsp, *sfsp...)
- if *dfsp == nil {
- *dfsp = []uint64{}
- }
- }
- }
- case isPointer: // E.g., *uint64
- mfi.merge = func(dst, src pointer) {
- sfpp := src.toUint64Ptr()
- if *sfpp != nil {
- dfpp := dst.toUint64Ptr()
- if *dfpp == nil {
- *dfpp = Uint64(**sfpp)
- } else {
- **dfpp = **sfpp
- }
- }
- }
- default: // E.g., uint64
- mfi.merge = func(dst, src pointer) {
- if v := *src.toUint64(); v != 0 {
- *dst.toUint64() = v
- }
- }
- }
- case reflect.Float32:
- switch {
- case isSlice: // E.g., []float32
- mfi.merge = func(dst, src pointer) {
- sfsp := src.toFloat32Slice()
- if *sfsp != nil {
- dfsp := dst.toFloat32Slice()
- *dfsp = append(*dfsp, *sfsp...)
- if *dfsp == nil {
- *dfsp = []float32{}
- }
- }
- }
- case isPointer: // E.g., *float32
- mfi.merge = func(dst, src pointer) {
- sfpp := src.toFloat32Ptr()
- if *sfpp != nil {
- dfpp := dst.toFloat32Ptr()
- if *dfpp == nil {
- *dfpp = Float32(**sfpp)
- } else {
- **dfpp = **sfpp
- }
- }
- }
- default: // E.g., float32
- mfi.merge = func(dst, src pointer) {
- if v := *src.toFloat32(); v != 0 {
- *dst.toFloat32() = v
- }
- }
- }
- case reflect.Float64:
- switch {
- case isSlice: // E.g., []float64
- mfi.merge = func(dst, src pointer) {
- sfsp := src.toFloat64Slice()
- if *sfsp != nil {
- dfsp := dst.toFloat64Slice()
- *dfsp = append(*dfsp, *sfsp...)
- if *dfsp == nil {
- *dfsp = []float64{}
- }
- }
- }
- case isPointer: // E.g., *float64
- mfi.merge = func(dst, src pointer) {
- sfpp := src.toFloat64Ptr()
- if *sfpp != nil {
- dfpp := dst.toFloat64Ptr()
- if *dfpp == nil {
- *dfpp = Float64(**sfpp)
- } else {
- **dfpp = **sfpp
- }
- }
- }
- default: // E.g., float64
- mfi.merge = func(dst, src pointer) {
- if v := *src.toFloat64(); v != 0 {
- *dst.toFloat64() = v
- }
- }
- }
- case reflect.Bool:
- switch {
- case isSlice: // E.g., []bool
- mfi.merge = func(dst, src pointer) {
- sfsp := src.toBoolSlice()
- if *sfsp != nil {
- dfsp := dst.toBoolSlice()
- *dfsp = append(*dfsp, *sfsp...)
- if *dfsp == nil {
- *dfsp = []bool{}
- }
- }
- }
- case isPointer: // E.g., *bool
- mfi.merge = func(dst, src pointer) {
- sfpp := src.toBoolPtr()
- if *sfpp != nil {
- dfpp := dst.toBoolPtr()
- if *dfpp == nil {
- *dfpp = Bool(**sfpp)
- } else {
- **dfpp = **sfpp
- }
- }
- }
- default: // E.g., bool
- mfi.merge = func(dst, src pointer) {
- if v := *src.toBool(); v {
- *dst.toBool() = v
- }
- }
- }
- case reflect.String:
- switch {
- case isSlice: // E.g., []string
- mfi.merge = func(dst, src pointer) {
- sfsp := src.toStringSlice()
- if *sfsp != nil {
- dfsp := dst.toStringSlice()
- *dfsp = append(*dfsp, *sfsp...)
- if *dfsp == nil {
- *dfsp = []string{}
- }
- }
- }
- case isPointer: // E.g., *string
- mfi.merge = func(dst, src pointer) {
- sfpp := src.toStringPtr()
- if *sfpp != nil {
- dfpp := dst.toStringPtr()
- if *dfpp == nil {
- *dfpp = String(**sfpp)
- } else {
- **dfpp = **sfpp
- }
- }
- }
- default: // E.g., string
- mfi.merge = func(dst, src pointer) {
- if v := *src.toString(); v != "" {
- *dst.toString() = v
- }
- }
- }
- case reflect.Slice:
- isProto3 := props.Prop[i].proto3
- switch {
- case isPointer:
- panic("bad pointer in byte slice case in " + tf.Name())
- case tf.Elem().Kind() != reflect.Uint8:
- panic("bad element kind in byte slice case in " + tf.Name())
- case isSlice: // E.g., [][]byte
- mfi.merge = func(dst, src pointer) {
- sbsp := src.toBytesSlice()
- if *sbsp != nil {
- dbsp := dst.toBytesSlice()
- for _, sb := range *sbsp {
- if sb == nil {
- *dbsp = append(*dbsp, nil)
- } else {
- *dbsp = append(*dbsp, append([]byte{}, sb...))
- }
- }
- if *dbsp == nil {
- *dbsp = [][]byte{}
- }
- }
- }
- default: // E.g., []byte
- mfi.merge = func(dst, src pointer) {
- sbp := src.toBytes()
- if *sbp != nil {
- dbp := dst.toBytes()
- if !isProto3 || len(*sbp) > 0 {
- *dbp = append([]byte{}, *sbp...)
- }
- }
- }
- }
- case reflect.Struct:
- switch {
- case !isPointer:
- panic(fmt.Sprintf("message field %s without pointer", tf))
- case isSlice: // E.g., []*pb.T
- mi := getMergeInfo(tf)
- mfi.merge = func(dst, src pointer) {
- sps := src.getPointerSlice()
- if sps != nil {
- dps := dst.getPointerSlice()
- for _, sp := range sps {
- var dp pointer
- if !sp.isNil() {
- dp = valToPointer(reflect.New(tf))
- mi.merge(dp, sp)
- }
- dps = append(dps, dp)
- }
- if dps == nil {
- dps = []pointer{}
- }
- dst.setPointerSlice(dps)
- }
- }
- default: // E.g., *pb.T
- mi := getMergeInfo(tf)
- mfi.merge = func(dst, src pointer) {
- sp := src.getPointer()
- if !sp.isNil() {
- dp := dst.getPointer()
- if dp.isNil() {
- dp = valToPointer(reflect.New(tf))
- dst.setPointer(dp)
- }
- mi.merge(dp, sp)
- }
- }
- }
- case reflect.Map:
- switch {
- case isPointer || isSlice:
- panic("bad pointer or slice in map case in " + tf.Name())
- default: // E.g., map[K]V
- mfi.merge = func(dst, src pointer) {
- sm := src.asPointerTo(tf).Elem()
- if sm.Len() == 0 {
- return
- }
- dm := dst.asPointerTo(tf).Elem()
- if dm.IsNil() {
- dm.Set(reflect.MakeMap(tf))
- }
-
- switch tf.Elem().Kind() {
- case reflect.Ptr: // Proto struct (e.g., *T)
- for _, key := range sm.MapKeys() {
- val := sm.MapIndex(key)
- val = reflect.ValueOf(Clone(val.Interface().(Message)))
- dm.SetMapIndex(key, val)
- }
- case reflect.Slice: // E.g. Bytes type (e.g., []byte)
- for _, key := range sm.MapKeys() {
- val := sm.MapIndex(key)
- val = reflect.ValueOf(append([]byte{}, val.Bytes()...))
- dm.SetMapIndex(key, val)
- }
- default: // Basic type (e.g., string)
- for _, key := range sm.MapKeys() {
- val := sm.MapIndex(key)
- dm.SetMapIndex(key, val)
- }
- }
- }
- }
- case reflect.Interface:
- // Must be oneof field.
- switch {
- case isPointer || isSlice:
- panic("bad pointer or slice in interface case in " + tf.Name())
- default: // E.g., interface{}
- // TODO: Make this faster?
- mfi.merge = func(dst, src pointer) {
- su := src.asPointerTo(tf).Elem()
- if !su.IsNil() {
- du := dst.asPointerTo(tf).Elem()
- typ := su.Elem().Type()
- if du.IsNil() || du.Elem().Type() != typ {
- du.Set(reflect.New(typ.Elem())) // Initialize interface if empty
- }
- sv := su.Elem().Elem().Field(0)
- if sv.Kind() == reflect.Ptr && sv.IsNil() {
- return
- }
- dv := du.Elem().Elem().Field(0)
- if dv.Kind() == reflect.Ptr && dv.IsNil() {
- dv.Set(reflect.New(sv.Type().Elem())) // Initialize proto message if empty
- }
- switch sv.Type().Kind() {
- case reflect.Ptr: // Proto struct (e.g., *T)
- Merge(dv.Interface().(Message), sv.Interface().(Message))
- case reflect.Slice: // E.g. Bytes type (e.g., []byte)
- dv.Set(reflect.ValueOf(append([]byte{}, sv.Bytes()...)))
- default: // Basic type (e.g., string)
- dv.Set(sv)
- }
- }
- }
- }
- default:
- panic(fmt.Sprintf("merger not found for type:%s", tf))
- }
- mi.fields = append(mi.fields, mfi)
- }
-
- mi.unrecognized = invalidField
- if f, ok := t.FieldByName("XXX_unrecognized"); ok {
- if f.Type != reflect.TypeOf([]byte{}) {
- panic("expected XXX_unrecognized to be of type []byte")
- }
- mi.unrecognized = toField(&f)
- }
-
- atomic.StoreInt32(&mi.initialized, 1)
-}
diff --git a/vendor/github.com/golang/protobuf/proto/table_unmarshal.go b/vendor/github.com/golang/protobuf/proto/table_unmarshal.go
deleted file mode 100644
index acee2fc..0000000
--- a/vendor/github.com/golang/protobuf/proto/table_unmarshal.go
+++ /dev/null
@@ -1,2053 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2016 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-import (
- "errors"
- "fmt"
- "io"
- "math"
- "reflect"
- "strconv"
- "strings"
- "sync"
- "sync/atomic"
- "unicode/utf8"
-)
-
-// Unmarshal is the entry point from the generated .pb.go files.
-// This function is not intended to be used by non-generated code.
-// This function is not subject to any compatibility guarantee.
-// msg contains a pointer to a protocol buffer struct.
-// b is the data to be unmarshaled into the protocol buffer.
-// a is a pointer to a place to store cached unmarshal information.
-func (a *InternalMessageInfo) Unmarshal(msg Message, b []byte) error {
- // Load the unmarshal information for this message type.
- // The atomic load ensures memory consistency.
- u := atomicLoadUnmarshalInfo(&a.unmarshal)
- if u == nil {
- // Slow path: find unmarshal info for msg, update a with it.
- u = getUnmarshalInfo(reflect.TypeOf(msg).Elem())
- atomicStoreUnmarshalInfo(&a.unmarshal, u)
- }
- // Then do the unmarshaling.
- err := u.unmarshal(toPointer(&msg), b)
- return err
-}
-
-type unmarshalInfo struct {
- typ reflect.Type // type of the protobuf struct
-
- // 0 = only typ field is initialized
- // 1 = completely initialized
- initialized int32
- lock sync.Mutex // prevents double initialization
- dense []unmarshalFieldInfo // fields indexed by tag #
- sparse map[uint64]unmarshalFieldInfo // fields indexed by tag #
- reqFields []string // names of required fields
- reqMask uint64 // 1< 0 {
- // Read tag and wire type.
- // Special case 1 and 2 byte varints.
- var x uint64
- if b[0] < 128 {
- x = uint64(b[0])
- b = b[1:]
- } else if len(b) >= 2 && b[1] < 128 {
- x = uint64(b[0]&0x7f) + uint64(b[1])<<7
- b = b[2:]
- } else {
- var n int
- x, n = decodeVarint(b)
- if n == 0 {
- return io.ErrUnexpectedEOF
- }
- b = b[n:]
- }
- tag := x >> 3
- wire := int(x) & 7
-
- // Dispatch on the tag to one of the unmarshal* functions below.
- var f unmarshalFieldInfo
- if tag < uint64(len(u.dense)) {
- f = u.dense[tag]
- } else {
- f = u.sparse[tag]
- }
- if fn := f.unmarshal; fn != nil {
- var err error
- b, err = fn(b, m.offset(f.field), wire)
- if err == nil {
- reqMask |= f.reqMask
- continue
- }
- if r, ok := err.(*RequiredNotSetError); ok {
- // Remember this error, but keep parsing. We need to produce
- // a full parse even if a required field is missing.
- if errLater == nil {
- errLater = r
- }
- reqMask |= f.reqMask
- continue
- }
- if err != errInternalBadWireType {
- if err == errInvalidUTF8 {
- if errLater == nil {
- fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name
- errLater = &invalidUTF8Error{fullName}
- }
- continue
- }
- return err
- }
- // Fragments with bad wire type are treated as unknown fields.
- }
-
- // Unknown tag.
- if !u.unrecognized.IsValid() {
- // Don't keep unrecognized data; just skip it.
- var err error
- b, err = skipField(b, wire)
- if err != nil {
- return err
- }
- continue
- }
- // Keep unrecognized data around.
- // maybe in extensions, maybe in the unrecognized field.
- z := m.offset(u.unrecognized).toBytes()
- var emap map[int32]Extension
- var e Extension
- for _, r := range u.extensionRanges {
- if uint64(r.Start) <= tag && tag <= uint64(r.End) {
- if u.extensions.IsValid() {
- mp := m.offset(u.extensions).toExtensions()
- emap = mp.extensionsWrite()
- e = emap[int32(tag)]
- z = &e.enc
- break
- }
- if u.oldExtensions.IsValid() {
- p := m.offset(u.oldExtensions).toOldExtensions()
- emap = *p
- if emap == nil {
- emap = map[int32]Extension{}
- *p = emap
- }
- e = emap[int32(tag)]
- z = &e.enc
- break
- }
- panic("no extensions field available")
- }
- }
-
- // Use wire type to skip data.
- var err error
- b0 := b
- b, err = skipField(b, wire)
- if err != nil {
- return err
- }
- *z = encodeVarint(*z, tag<<3|uint64(wire))
- *z = append(*z, b0[:len(b0)-len(b)]...)
-
- if emap != nil {
- emap[int32(tag)] = e
- }
- }
- if reqMask != u.reqMask && errLater == nil {
- // A required field of this message is missing.
- for _, n := range u.reqFields {
- if reqMask&1 == 0 {
- errLater = &RequiredNotSetError{n}
- }
- reqMask >>= 1
- }
- }
- return errLater
-}
-
-// computeUnmarshalInfo fills in u with information for use
-// in unmarshaling protocol buffers of type u.typ.
-func (u *unmarshalInfo) computeUnmarshalInfo() {
- u.lock.Lock()
- defer u.lock.Unlock()
- if u.initialized != 0 {
- return
- }
- t := u.typ
- n := t.NumField()
-
- // Set up the "not found" value for the unrecognized byte buffer.
- // This is the default for proto3.
- u.unrecognized = invalidField
- u.extensions = invalidField
- u.oldExtensions = invalidField
-
- // List of the generated type and offset for each oneof field.
- type oneofField struct {
- ityp reflect.Type // interface type of oneof field
- field field // offset in containing message
- }
- var oneofFields []oneofField
-
- for i := 0; i < n; i++ {
- f := t.Field(i)
- if f.Name == "XXX_unrecognized" {
- // The byte slice used to hold unrecognized input is special.
- if f.Type != reflect.TypeOf(([]byte)(nil)) {
- panic("bad type for XXX_unrecognized field: " + f.Type.Name())
- }
- u.unrecognized = toField(&f)
- continue
- }
- if f.Name == "XXX_InternalExtensions" {
- // Ditto here.
- if f.Type != reflect.TypeOf(XXX_InternalExtensions{}) {
- panic("bad type for XXX_InternalExtensions field: " + f.Type.Name())
- }
- u.extensions = toField(&f)
- if f.Tag.Get("protobuf_messageset") == "1" {
- u.isMessageSet = true
- }
- continue
- }
- if f.Name == "XXX_extensions" {
- // An older form of the extensions field.
- if f.Type != reflect.TypeOf((map[int32]Extension)(nil)) {
- panic("bad type for XXX_extensions field: " + f.Type.Name())
- }
- u.oldExtensions = toField(&f)
- continue
- }
- if f.Name == "XXX_NoUnkeyedLiteral" || f.Name == "XXX_sizecache" {
- continue
- }
-
- oneof := f.Tag.Get("protobuf_oneof")
- if oneof != "" {
- oneofFields = append(oneofFields, oneofField{f.Type, toField(&f)})
- // The rest of oneof processing happens below.
- continue
- }
-
- tags := f.Tag.Get("protobuf")
- tagArray := strings.Split(tags, ",")
- if len(tagArray) < 2 {
- panic("protobuf tag not enough fields in " + t.Name() + "." + f.Name + ": " + tags)
- }
- tag, err := strconv.Atoi(tagArray[1])
- if err != nil {
- panic("protobuf tag field not an integer: " + tagArray[1])
- }
-
- name := ""
- for _, tag := range tagArray[3:] {
- if strings.HasPrefix(tag, "name=") {
- name = tag[5:]
- }
- }
-
- // Extract unmarshaling function from the field (its type and tags).
- unmarshal := fieldUnmarshaler(&f)
-
- // Required field?
- var reqMask uint64
- if tagArray[2] == "req" {
- bit := len(u.reqFields)
- u.reqFields = append(u.reqFields, name)
- reqMask = uint64(1) << uint(bit)
- // TODO: if we have more than 64 required fields, we end up
- // not verifying that all required fields are present.
- // Fix this, perhaps using a count of required fields?
- }
-
- // Store the info in the correct slot in the message.
- u.setTag(tag, toField(&f), unmarshal, reqMask, name)
- }
-
- // Find any types associated with oneof fields.
- var oneofImplementers []interface{}
- switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) {
- case oneofFuncsIface:
- _, _, _, oneofImplementers = m.XXX_OneofFuncs()
- case oneofWrappersIface:
- oneofImplementers = m.XXX_OneofWrappers()
- }
- for _, v := range oneofImplementers {
- tptr := reflect.TypeOf(v) // *Msg_X
- typ := tptr.Elem() // Msg_X
-
- f := typ.Field(0) // oneof implementers have one field
- baseUnmarshal := fieldUnmarshaler(&f)
- tags := strings.Split(f.Tag.Get("protobuf"), ",")
- fieldNum, err := strconv.Atoi(tags[1])
- if err != nil {
- panic("protobuf tag field not an integer: " + tags[1])
- }
- var name string
- for _, tag := range tags {
- if strings.HasPrefix(tag, "name=") {
- name = strings.TrimPrefix(tag, "name=")
- break
- }
- }
-
- // Find the oneof field that this struct implements.
- // Might take O(n^2) to process all of the oneofs, but who cares.
- for _, of := range oneofFields {
- if tptr.Implements(of.ityp) {
- // We have found the corresponding interface for this struct.
- // That lets us know where this struct should be stored
- // when we encounter it during unmarshaling.
- unmarshal := makeUnmarshalOneof(typ, of.ityp, baseUnmarshal)
- u.setTag(fieldNum, of.field, unmarshal, 0, name)
- }
- }
-
- }
-
- // Get extension ranges, if any.
- fn := reflect.Zero(reflect.PtrTo(t)).MethodByName("ExtensionRangeArray")
- if fn.IsValid() {
- if !u.extensions.IsValid() && !u.oldExtensions.IsValid() {
- panic("a message with extensions, but no extensions field in " + t.Name())
- }
- u.extensionRanges = fn.Call(nil)[0].Interface().([]ExtensionRange)
- }
-
- // Explicitly disallow tag 0. This will ensure we flag an error
- // when decoding a buffer of all zeros. Without this code, we
- // would decode and skip an all-zero buffer of even length.
- // [0 0] is [tag=0/wiretype=varint varint-encoded-0].
- u.setTag(0, zeroField, func(b []byte, f pointer, w int) ([]byte, error) {
- return nil, fmt.Errorf("proto: %s: illegal tag 0 (wire type %d)", t, w)
- }, 0, "")
-
- // Set mask for required field check.
- u.reqMask = uint64(1)<= 0 && (tag < 16 || tag < 2*n) { // TODO: what are the right numbers here?
- for len(u.dense) <= tag {
- u.dense = append(u.dense, unmarshalFieldInfo{})
- }
- u.dense[tag] = i
- return
- }
- if u.sparse == nil {
- u.sparse = map[uint64]unmarshalFieldInfo{}
- }
- u.sparse[uint64(tag)] = i
-}
-
-// fieldUnmarshaler returns an unmarshaler for the given field.
-func fieldUnmarshaler(f *reflect.StructField) unmarshaler {
- if f.Type.Kind() == reflect.Map {
- return makeUnmarshalMap(f)
- }
- return typeUnmarshaler(f.Type, f.Tag.Get("protobuf"))
-}
-
-// typeUnmarshaler returns an unmarshaler for the given field type / field tag pair.
-func typeUnmarshaler(t reflect.Type, tags string) unmarshaler {
- tagArray := strings.Split(tags, ",")
- encoding := tagArray[0]
- name := "unknown"
- proto3 := false
- validateUTF8 := true
- for _, tag := range tagArray[3:] {
- if strings.HasPrefix(tag, "name=") {
- name = tag[5:]
- }
- if tag == "proto3" {
- proto3 = true
- }
- }
- validateUTF8 = validateUTF8 && proto3
-
- // Figure out packaging (pointer, slice, or both)
- slice := false
- pointer := false
- if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 {
- slice = true
- t = t.Elem()
- }
- if t.Kind() == reflect.Ptr {
- pointer = true
- t = t.Elem()
- }
-
- // We'll never have both pointer and slice for basic types.
- if pointer && slice && t.Kind() != reflect.Struct {
- panic("both pointer and slice for basic type in " + t.Name())
- }
-
- switch t.Kind() {
- case reflect.Bool:
- if pointer {
- return unmarshalBoolPtr
- }
- if slice {
- return unmarshalBoolSlice
- }
- return unmarshalBoolValue
- case reflect.Int32:
- switch encoding {
- case "fixed32":
- if pointer {
- return unmarshalFixedS32Ptr
- }
- if slice {
- return unmarshalFixedS32Slice
- }
- return unmarshalFixedS32Value
- case "varint":
- // this could be int32 or enum
- if pointer {
- return unmarshalInt32Ptr
- }
- if slice {
- return unmarshalInt32Slice
- }
- return unmarshalInt32Value
- case "zigzag32":
- if pointer {
- return unmarshalSint32Ptr
- }
- if slice {
- return unmarshalSint32Slice
- }
- return unmarshalSint32Value
- }
- case reflect.Int64:
- switch encoding {
- case "fixed64":
- if pointer {
- return unmarshalFixedS64Ptr
- }
- if slice {
- return unmarshalFixedS64Slice
- }
- return unmarshalFixedS64Value
- case "varint":
- if pointer {
- return unmarshalInt64Ptr
- }
- if slice {
- return unmarshalInt64Slice
- }
- return unmarshalInt64Value
- case "zigzag64":
- if pointer {
- return unmarshalSint64Ptr
- }
- if slice {
- return unmarshalSint64Slice
- }
- return unmarshalSint64Value
- }
- case reflect.Uint32:
- switch encoding {
- case "fixed32":
- if pointer {
- return unmarshalFixed32Ptr
- }
- if slice {
- return unmarshalFixed32Slice
- }
- return unmarshalFixed32Value
- case "varint":
- if pointer {
- return unmarshalUint32Ptr
- }
- if slice {
- return unmarshalUint32Slice
- }
- return unmarshalUint32Value
- }
- case reflect.Uint64:
- switch encoding {
- case "fixed64":
- if pointer {
- return unmarshalFixed64Ptr
- }
- if slice {
- return unmarshalFixed64Slice
- }
- return unmarshalFixed64Value
- case "varint":
- if pointer {
- return unmarshalUint64Ptr
- }
- if slice {
- return unmarshalUint64Slice
- }
- return unmarshalUint64Value
- }
- case reflect.Float32:
- if pointer {
- return unmarshalFloat32Ptr
- }
- if slice {
- return unmarshalFloat32Slice
- }
- return unmarshalFloat32Value
- case reflect.Float64:
- if pointer {
- return unmarshalFloat64Ptr
- }
- if slice {
- return unmarshalFloat64Slice
- }
- return unmarshalFloat64Value
- case reflect.Map:
- panic("map type in typeUnmarshaler in " + t.Name())
- case reflect.Slice:
- if pointer {
- panic("bad pointer in slice case in " + t.Name())
- }
- if slice {
- return unmarshalBytesSlice
- }
- return unmarshalBytesValue
- case reflect.String:
- if validateUTF8 {
- if pointer {
- return unmarshalUTF8StringPtr
- }
- if slice {
- return unmarshalUTF8StringSlice
- }
- return unmarshalUTF8StringValue
- }
- if pointer {
- return unmarshalStringPtr
- }
- if slice {
- return unmarshalStringSlice
- }
- return unmarshalStringValue
- case reflect.Struct:
- // message or group field
- if !pointer {
- panic(fmt.Sprintf("message/group field %s:%s without pointer", t, encoding))
- }
- switch encoding {
- case "bytes":
- if slice {
- return makeUnmarshalMessageSlicePtr(getUnmarshalInfo(t), name)
- }
- return makeUnmarshalMessagePtr(getUnmarshalInfo(t), name)
- case "group":
- if slice {
- return makeUnmarshalGroupSlicePtr(getUnmarshalInfo(t), name)
- }
- return makeUnmarshalGroupPtr(getUnmarshalInfo(t), name)
- }
- }
- panic(fmt.Sprintf("unmarshaler not found type:%s encoding:%s", t, encoding))
-}
-
-// Below are all the unmarshalers for individual fields of various types.
-
-func unmarshalInt64Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int64(x)
- *f.toInt64() = v
- return b, nil
-}
-
-func unmarshalInt64Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int64(x)
- *f.toInt64Ptr() = &v
- return b, nil
-}
-
-func unmarshalInt64Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- x, n = decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int64(x)
- s := f.toInt64Slice()
- *s = append(*s, v)
- }
- return res, nil
- }
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int64(x)
- s := f.toInt64Slice()
- *s = append(*s, v)
- return b, nil
-}
-
-func unmarshalSint64Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int64(x>>1) ^ int64(x)<<63>>63
- *f.toInt64() = v
- return b, nil
-}
-
-func unmarshalSint64Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int64(x>>1) ^ int64(x)<<63>>63
- *f.toInt64Ptr() = &v
- return b, nil
-}
-
-func unmarshalSint64Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- x, n = decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int64(x>>1) ^ int64(x)<<63>>63
- s := f.toInt64Slice()
- *s = append(*s, v)
- }
- return res, nil
- }
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int64(x>>1) ^ int64(x)<<63>>63
- s := f.toInt64Slice()
- *s = append(*s, v)
- return b, nil
-}
-
-func unmarshalUint64Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := uint64(x)
- *f.toUint64() = v
- return b, nil
-}
-
-func unmarshalUint64Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := uint64(x)
- *f.toUint64Ptr() = &v
- return b, nil
-}
-
-func unmarshalUint64Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- x, n = decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := uint64(x)
- s := f.toUint64Slice()
- *s = append(*s, v)
- }
- return res, nil
- }
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := uint64(x)
- s := f.toUint64Slice()
- *s = append(*s, v)
- return b, nil
-}
-
-func unmarshalInt32Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int32(x)
- *f.toInt32() = v
- return b, nil
-}
-
-func unmarshalInt32Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int32(x)
- f.setInt32Ptr(v)
- return b, nil
-}
-
-func unmarshalInt32Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- x, n = decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int32(x)
- f.appendInt32Slice(v)
- }
- return res, nil
- }
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int32(x)
- f.appendInt32Slice(v)
- return b, nil
-}
-
-func unmarshalSint32Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int32(x>>1) ^ int32(x)<<31>>31
- *f.toInt32() = v
- return b, nil
-}
-
-func unmarshalSint32Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int32(x>>1) ^ int32(x)<<31>>31
- f.setInt32Ptr(v)
- return b, nil
-}
-
-func unmarshalSint32Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- x, n = decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int32(x>>1) ^ int32(x)<<31>>31
- f.appendInt32Slice(v)
- }
- return res, nil
- }
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int32(x>>1) ^ int32(x)<<31>>31
- f.appendInt32Slice(v)
- return b, nil
-}
-
-func unmarshalUint32Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := uint32(x)
- *f.toUint32() = v
- return b, nil
-}
-
-func unmarshalUint32Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := uint32(x)
- *f.toUint32Ptr() = &v
- return b, nil
-}
-
-func unmarshalUint32Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- x, n = decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := uint32(x)
- s := f.toUint32Slice()
- *s = append(*s, v)
- }
- return res, nil
- }
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := uint32(x)
- s := f.toUint32Slice()
- *s = append(*s, v)
- return b, nil
-}
-
-func unmarshalFixed64Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed64 {
- return b, errInternalBadWireType
- }
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
- *f.toUint64() = v
- return b[8:], nil
-}
-
-func unmarshalFixed64Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed64 {
- return b, errInternalBadWireType
- }
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
- *f.toUint64Ptr() = &v
- return b[8:], nil
-}
-
-func unmarshalFixed64Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
- s := f.toUint64Slice()
- *s = append(*s, v)
- b = b[8:]
- }
- return res, nil
- }
- if w != WireFixed64 {
- return b, errInternalBadWireType
- }
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
- s := f.toUint64Slice()
- *s = append(*s, v)
- return b[8:], nil
-}
-
-func unmarshalFixedS64Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed64 {
- return b, errInternalBadWireType
- }
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56
- *f.toInt64() = v
- return b[8:], nil
-}
-
-func unmarshalFixedS64Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed64 {
- return b, errInternalBadWireType
- }
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56
- *f.toInt64Ptr() = &v
- return b[8:], nil
-}
-
-func unmarshalFixedS64Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56
- s := f.toInt64Slice()
- *s = append(*s, v)
- b = b[8:]
- }
- return res, nil
- }
- if w != WireFixed64 {
- return b, errInternalBadWireType
- }
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56
- s := f.toInt64Slice()
- *s = append(*s, v)
- return b[8:], nil
-}
-
-func unmarshalFixed32Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed32 {
- return b, errInternalBadWireType
- }
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
- *f.toUint32() = v
- return b[4:], nil
-}
-
-func unmarshalFixed32Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed32 {
- return b, errInternalBadWireType
- }
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
- *f.toUint32Ptr() = &v
- return b[4:], nil
-}
-
-func unmarshalFixed32Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
- s := f.toUint32Slice()
- *s = append(*s, v)
- b = b[4:]
- }
- return res, nil
- }
- if w != WireFixed32 {
- return b, errInternalBadWireType
- }
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
- s := f.toUint32Slice()
- *s = append(*s, v)
- return b[4:], nil
-}
-
-func unmarshalFixedS32Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed32 {
- return b, errInternalBadWireType
- }
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24
- *f.toInt32() = v
- return b[4:], nil
-}
-
-func unmarshalFixedS32Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed32 {
- return b, errInternalBadWireType
- }
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24
- f.setInt32Ptr(v)
- return b[4:], nil
-}
-
-func unmarshalFixedS32Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24
- f.appendInt32Slice(v)
- b = b[4:]
- }
- return res, nil
- }
- if w != WireFixed32 {
- return b, errInternalBadWireType
- }
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24
- f.appendInt32Slice(v)
- return b[4:], nil
-}
-
-func unmarshalBoolValue(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- // Note: any length varint is allowed, even though any sane
- // encoder will use one byte.
- // See https://github.com/golang/protobuf/issues/76
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- // TODO: check if x>1? Tests seem to indicate no.
- v := x != 0
- *f.toBool() = v
- return b[n:], nil
-}
-
-func unmarshalBoolPtr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- v := x != 0
- *f.toBoolPtr() = &v
- return b[n:], nil
-}
-
-func unmarshalBoolSlice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- x, n = decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- v := x != 0
- s := f.toBoolSlice()
- *s = append(*s, v)
- b = b[n:]
- }
- return res, nil
- }
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- v := x != 0
- s := f.toBoolSlice()
- *s = append(*s, v)
- return b[n:], nil
-}
-
-func unmarshalFloat64Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed64 {
- return b, errInternalBadWireType
- }
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56)
- *f.toFloat64() = v
- return b[8:], nil
-}
-
-func unmarshalFloat64Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed64 {
- return b, errInternalBadWireType
- }
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56)
- *f.toFloat64Ptr() = &v
- return b[8:], nil
-}
-
-func unmarshalFloat64Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56)
- s := f.toFloat64Slice()
- *s = append(*s, v)
- b = b[8:]
- }
- return res, nil
- }
- if w != WireFixed64 {
- return b, errInternalBadWireType
- }
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56)
- s := f.toFloat64Slice()
- *s = append(*s, v)
- return b[8:], nil
-}
-
-func unmarshalFloat32Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed32 {
- return b, errInternalBadWireType
- }
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24)
- *f.toFloat32() = v
- return b[4:], nil
-}
-
-func unmarshalFloat32Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed32 {
- return b, errInternalBadWireType
- }
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24)
- *f.toFloat32Ptr() = &v
- return b[4:], nil
-}
-
-func unmarshalFloat32Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24)
- s := f.toFloat32Slice()
- *s = append(*s, v)
- b = b[4:]
- }
- return res, nil
- }
- if w != WireFixed32 {
- return b, errInternalBadWireType
- }
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24)
- s := f.toFloat32Slice()
- *s = append(*s, v)
- return b[4:], nil
-}
-
-func unmarshalStringValue(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireBytes {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- v := string(b[:x])
- *f.toString() = v
- return b[x:], nil
-}
-
-func unmarshalStringPtr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireBytes {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- v := string(b[:x])
- *f.toStringPtr() = &v
- return b[x:], nil
-}
-
-func unmarshalStringSlice(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireBytes {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- v := string(b[:x])
- s := f.toStringSlice()
- *s = append(*s, v)
- return b[x:], nil
-}
-
-func unmarshalUTF8StringValue(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireBytes {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- v := string(b[:x])
- *f.toString() = v
- if !utf8.ValidString(v) {
- return b[x:], errInvalidUTF8
- }
- return b[x:], nil
-}
-
-func unmarshalUTF8StringPtr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireBytes {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- v := string(b[:x])
- *f.toStringPtr() = &v
- if !utf8.ValidString(v) {
- return b[x:], errInvalidUTF8
- }
- return b[x:], nil
-}
-
-func unmarshalUTF8StringSlice(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireBytes {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- v := string(b[:x])
- s := f.toStringSlice()
- *s = append(*s, v)
- if !utf8.ValidString(v) {
- return b[x:], errInvalidUTF8
- }
- return b[x:], nil
-}
-
-var emptyBuf [0]byte
-
-func unmarshalBytesValue(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireBytes {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- // The use of append here is a trick which avoids the zeroing
- // that would be required if we used a make/copy pair.
- // We append to emptyBuf instead of nil because we want
- // a non-nil result even when the length is 0.
- v := append(emptyBuf[:], b[:x]...)
- *f.toBytes() = v
- return b[x:], nil
-}
-
-func unmarshalBytesSlice(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireBytes {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- v := append(emptyBuf[:], b[:x]...)
- s := f.toBytesSlice()
- *s = append(*s, v)
- return b[x:], nil
-}
-
-func makeUnmarshalMessagePtr(sub *unmarshalInfo, name string) unmarshaler {
- return func(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireBytes {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- // First read the message field to see if something is there.
- // The semantics of multiple submessages are weird. Instead of
- // the last one winning (as it is for all other fields), multiple
- // submessages are merged.
- v := f.getPointer()
- if v.isNil() {
- v = valToPointer(reflect.New(sub.typ))
- f.setPointer(v)
- }
- err := sub.unmarshal(v, b[:x])
- if err != nil {
- if r, ok := err.(*RequiredNotSetError); ok {
- r.field = name + "." + r.field
- } else {
- return nil, err
- }
- }
- return b[x:], err
- }
-}
-
-func makeUnmarshalMessageSlicePtr(sub *unmarshalInfo, name string) unmarshaler {
- return func(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireBytes {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- v := valToPointer(reflect.New(sub.typ))
- err := sub.unmarshal(v, b[:x])
- if err != nil {
- if r, ok := err.(*RequiredNotSetError); ok {
- r.field = name + "." + r.field
- } else {
- return nil, err
- }
- }
- f.appendPointer(v)
- return b[x:], err
- }
-}
-
-func makeUnmarshalGroupPtr(sub *unmarshalInfo, name string) unmarshaler {
- return func(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireStartGroup {
- return b, errInternalBadWireType
- }
- x, y := findEndGroup(b)
- if x < 0 {
- return nil, io.ErrUnexpectedEOF
- }
- v := f.getPointer()
- if v.isNil() {
- v = valToPointer(reflect.New(sub.typ))
- f.setPointer(v)
- }
- err := sub.unmarshal(v, b[:x])
- if err != nil {
- if r, ok := err.(*RequiredNotSetError); ok {
- r.field = name + "." + r.field
- } else {
- return nil, err
- }
- }
- return b[y:], err
- }
-}
-
-func makeUnmarshalGroupSlicePtr(sub *unmarshalInfo, name string) unmarshaler {
- return func(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireStartGroup {
- return b, errInternalBadWireType
- }
- x, y := findEndGroup(b)
- if x < 0 {
- return nil, io.ErrUnexpectedEOF
- }
- v := valToPointer(reflect.New(sub.typ))
- err := sub.unmarshal(v, b[:x])
- if err != nil {
- if r, ok := err.(*RequiredNotSetError); ok {
- r.field = name + "." + r.field
- } else {
- return nil, err
- }
- }
- f.appendPointer(v)
- return b[y:], err
- }
-}
-
-func makeUnmarshalMap(f *reflect.StructField) unmarshaler {
- t := f.Type
- kt := t.Key()
- vt := t.Elem()
- unmarshalKey := typeUnmarshaler(kt, f.Tag.Get("protobuf_key"))
- unmarshalVal := typeUnmarshaler(vt, f.Tag.Get("protobuf_val"))
- return func(b []byte, f pointer, w int) ([]byte, error) {
- // The map entry is a submessage. Figure out how big it is.
- if w != WireBytes {
- return nil, fmt.Errorf("proto: bad wiretype for map field: got %d want %d", w, WireBytes)
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- r := b[x:] // unused data to return
- b = b[:x] // data for map entry
-
- // Note: we could use #keys * #values ~= 200 functions
- // to do map decoding without reflection. Probably not worth it.
- // Maps will be somewhat slow. Oh well.
-
- // Read key and value from data.
- var nerr nonFatal
- k := reflect.New(kt)
- v := reflect.New(vt)
- for len(b) > 0 {
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- wire := int(x) & 7
- b = b[n:]
-
- var err error
- switch x >> 3 {
- case 1:
- b, err = unmarshalKey(b, valToPointer(k), wire)
- case 2:
- b, err = unmarshalVal(b, valToPointer(v), wire)
- default:
- err = errInternalBadWireType // skip unknown tag
- }
-
- if nerr.Merge(err) {
- continue
- }
- if err != errInternalBadWireType {
- return nil, err
- }
-
- // Skip past unknown fields.
- b, err = skipField(b, wire)
- if err != nil {
- return nil, err
- }
- }
-
- // Get map, allocate if needed.
- m := f.asPointerTo(t).Elem() // an addressable map[K]T
- if m.IsNil() {
- m.Set(reflect.MakeMap(t))
- }
-
- // Insert into map.
- m.SetMapIndex(k.Elem(), v.Elem())
-
- return r, nerr.E
- }
-}
-
-// makeUnmarshalOneof makes an unmarshaler for oneof fields.
-// for:
-// message Msg {
-// oneof F {
-// int64 X = 1;
-// float64 Y = 2;
-// }
-// }
-// typ is the type of the concrete entry for a oneof case (e.g. Msg_X).
-// ityp is the interface type of the oneof field (e.g. isMsg_F).
-// unmarshal is the unmarshaler for the base type of the oneof case (e.g. int64).
-// Note that this function will be called once for each case in the oneof.
-func makeUnmarshalOneof(typ, ityp reflect.Type, unmarshal unmarshaler) unmarshaler {
- sf := typ.Field(0)
- field0 := toField(&sf)
- return func(b []byte, f pointer, w int) ([]byte, error) {
- // Allocate holder for value.
- v := reflect.New(typ)
-
- // Unmarshal data into holder.
- // We unmarshal into the first field of the holder object.
- var err error
- var nerr nonFatal
- b, err = unmarshal(b, valToPointer(v).offset(field0), w)
- if !nerr.Merge(err) {
- return nil, err
- }
-
- // Write pointer to holder into target field.
- f.asPointerTo(ityp).Elem().Set(v)
-
- return b, nerr.E
- }
-}
-
-// Error used by decode internally.
-var errInternalBadWireType = errors.New("proto: internal error: bad wiretype")
-
-// skipField skips past a field of type wire and returns the remaining bytes.
-func skipField(b []byte, wire int) ([]byte, error) {
- switch wire {
- case WireVarint:
- _, k := decodeVarint(b)
- if k == 0 {
- return b, io.ErrUnexpectedEOF
- }
- b = b[k:]
- case WireFixed32:
- if len(b) < 4 {
- return b, io.ErrUnexpectedEOF
- }
- b = b[4:]
- case WireFixed64:
- if len(b) < 8 {
- return b, io.ErrUnexpectedEOF
- }
- b = b[8:]
- case WireBytes:
- m, k := decodeVarint(b)
- if k == 0 || uint64(len(b)-k) < m {
- return b, io.ErrUnexpectedEOF
- }
- b = b[uint64(k)+m:]
- case WireStartGroup:
- _, i := findEndGroup(b)
- if i == -1 {
- return b, io.ErrUnexpectedEOF
- }
- b = b[i:]
- default:
- return b, fmt.Errorf("proto: can't skip unknown wire type %d", wire)
- }
- return b, nil
-}
-
-// findEndGroup finds the index of the next EndGroup tag.
-// Groups may be nested, so the "next" EndGroup tag is the first
-// unpaired EndGroup.
-// findEndGroup returns the indexes of the start and end of the EndGroup tag.
-// Returns (-1,-1) if it can't find one.
-func findEndGroup(b []byte) (int, int) {
- depth := 1
- i := 0
- for {
- x, n := decodeVarint(b[i:])
- if n == 0 {
- return -1, -1
- }
- j := i
- i += n
- switch x & 7 {
- case WireVarint:
- _, k := decodeVarint(b[i:])
- if k == 0 {
- return -1, -1
- }
- i += k
- case WireFixed32:
- if len(b)-4 < i {
- return -1, -1
- }
- i += 4
- case WireFixed64:
- if len(b)-8 < i {
- return -1, -1
- }
- i += 8
- case WireBytes:
- m, k := decodeVarint(b[i:])
- if k == 0 {
- return -1, -1
- }
- i += k
- if uint64(len(b)-i) < m {
- return -1, -1
- }
- i += int(m)
- case WireStartGroup:
- depth++
- case WireEndGroup:
- depth--
- if depth == 0 {
- return j, i
- }
- default:
- return -1, -1
- }
- }
-}
-
-// encodeVarint appends a varint-encoded integer to b and returns the result.
-func encodeVarint(b []byte, x uint64) []byte {
- for x >= 1<<7 {
- b = append(b, byte(x&0x7f|0x80))
- x >>= 7
- }
- return append(b, byte(x))
-}
-
-// decodeVarint reads a varint-encoded integer from b.
-// Returns the decoded integer and the number of bytes read.
-// If there is an error, it returns 0,0.
-func decodeVarint(b []byte) (uint64, int) {
- var x, y uint64
- if len(b) == 0 {
- goto bad
- }
- x = uint64(b[0])
- if x < 0x80 {
- return x, 1
- }
- x -= 0x80
-
- if len(b) <= 1 {
- goto bad
- }
- y = uint64(b[1])
- x += y << 7
- if y < 0x80 {
- return x, 2
- }
- x -= 0x80 << 7
-
- if len(b) <= 2 {
- goto bad
- }
- y = uint64(b[2])
- x += y << 14
- if y < 0x80 {
- return x, 3
- }
- x -= 0x80 << 14
-
- if len(b) <= 3 {
- goto bad
- }
- y = uint64(b[3])
- x += y << 21
- if y < 0x80 {
- return x, 4
- }
- x -= 0x80 << 21
-
- if len(b) <= 4 {
- goto bad
- }
- y = uint64(b[4])
- x += y << 28
- if y < 0x80 {
- return x, 5
- }
- x -= 0x80 << 28
-
- if len(b) <= 5 {
- goto bad
- }
- y = uint64(b[5])
- x += y << 35
- if y < 0x80 {
- return x, 6
- }
- x -= 0x80 << 35
-
- if len(b) <= 6 {
- goto bad
- }
- y = uint64(b[6])
- x += y << 42
- if y < 0x80 {
- return x, 7
- }
- x -= 0x80 << 42
-
- if len(b) <= 7 {
- goto bad
- }
- y = uint64(b[7])
- x += y << 49
- if y < 0x80 {
- return x, 8
- }
- x -= 0x80 << 49
-
- if len(b) <= 8 {
- goto bad
- }
- y = uint64(b[8])
- x += y << 56
- if y < 0x80 {
- return x, 9
- }
- x -= 0x80 << 56
-
- if len(b) <= 9 {
- goto bad
- }
- y = uint64(b[9])
- x += y << 63
- if y < 2 {
- return x, 10
- }
-
-bad:
- return 0, 0
-}
diff --git a/vendor/github.com/golang/protobuf/proto/text.go b/vendor/github.com/golang/protobuf/proto/text.go
deleted file mode 100644
index 1aaee72..0000000
--- a/vendor/github.com/golang/protobuf/proto/text.go
+++ /dev/null
@@ -1,843 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-// Functions for writing the text protocol buffer format.
-
-import (
- "bufio"
- "bytes"
- "encoding"
- "errors"
- "fmt"
- "io"
- "log"
- "math"
- "reflect"
- "sort"
- "strings"
-)
-
-var (
- newline = []byte("\n")
- spaces = []byte(" ")
- endBraceNewline = []byte("}\n")
- backslashN = []byte{'\\', 'n'}
- backslashR = []byte{'\\', 'r'}
- backslashT = []byte{'\\', 't'}
- backslashDQ = []byte{'\\', '"'}
- backslashBS = []byte{'\\', '\\'}
- posInf = []byte("inf")
- negInf = []byte("-inf")
- nan = []byte("nan")
-)
-
-type writer interface {
- io.Writer
- WriteByte(byte) error
-}
-
-// textWriter is an io.Writer that tracks its indentation level.
-type textWriter struct {
- ind int
- complete bool // if the current position is a complete line
- compact bool // whether to write out as a one-liner
- w writer
-}
-
-func (w *textWriter) WriteString(s string) (n int, err error) {
- if !strings.Contains(s, "\n") {
- if !w.compact && w.complete {
- w.writeIndent()
- }
- w.complete = false
- return io.WriteString(w.w, s)
- }
- // WriteString is typically called without newlines, so this
- // codepath and its copy are rare. We copy to avoid
- // duplicating all of Write's logic here.
- return w.Write([]byte(s))
-}
-
-func (w *textWriter) Write(p []byte) (n int, err error) {
- newlines := bytes.Count(p, newline)
- if newlines == 0 {
- if !w.compact && w.complete {
- w.writeIndent()
- }
- n, err = w.w.Write(p)
- w.complete = false
- return n, err
- }
-
- frags := bytes.SplitN(p, newline, newlines+1)
- if w.compact {
- for i, frag := range frags {
- if i > 0 {
- if err := w.w.WriteByte(' '); err != nil {
- return n, err
- }
- n++
- }
- nn, err := w.w.Write(frag)
- n += nn
- if err != nil {
- return n, err
- }
- }
- return n, nil
- }
-
- for i, frag := range frags {
- if w.complete {
- w.writeIndent()
- }
- nn, err := w.w.Write(frag)
- n += nn
- if err != nil {
- return n, err
- }
- if i+1 < len(frags) {
- if err := w.w.WriteByte('\n'); err != nil {
- return n, err
- }
- n++
- }
- }
- w.complete = len(frags[len(frags)-1]) == 0
- return n, nil
-}
-
-func (w *textWriter) WriteByte(c byte) error {
- if w.compact && c == '\n' {
- c = ' '
- }
- if !w.compact && w.complete {
- w.writeIndent()
- }
- err := w.w.WriteByte(c)
- w.complete = c == '\n'
- return err
-}
-
-func (w *textWriter) indent() { w.ind++ }
-
-func (w *textWriter) unindent() {
- if w.ind == 0 {
- log.Print("proto: textWriter unindented too far")
- return
- }
- w.ind--
-}
-
-func writeName(w *textWriter, props *Properties) error {
- if _, err := w.WriteString(props.OrigName); err != nil {
- return err
- }
- if props.Wire != "group" {
- return w.WriteByte(':')
- }
- return nil
-}
-
-func requiresQuotes(u string) bool {
- // When type URL contains any characters except [0-9A-Za-z./\-]*, it must be quoted.
- for _, ch := range u {
- switch {
- case ch == '.' || ch == '/' || ch == '_':
- continue
- case '0' <= ch && ch <= '9':
- continue
- case 'A' <= ch && ch <= 'Z':
- continue
- case 'a' <= ch && ch <= 'z':
- continue
- default:
- return true
- }
- }
- return false
-}
-
-// isAny reports whether sv is a google.protobuf.Any message
-func isAny(sv reflect.Value) bool {
- type wkt interface {
- XXX_WellKnownType() string
- }
- t, ok := sv.Addr().Interface().(wkt)
- return ok && t.XXX_WellKnownType() == "Any"
-}
-
-// writeProto3Any writes an expanded google.protobuf.Any message.
-//
-// It returns (false, nil) if sv value can't be unmarshaled (e.g. because
-// required messages are not linked in).
-//
-// It returns (true, error) when sv was written in expanded format or an error
-// was encountered.
-func (tm *TextMarshaler) writeProto3Any(w *textWriter, sv reflect.Value) (bool, error) {
- turl := sv.FieldByName("TypeUrl")
- val := sv.FieldByName("Value")
- if !turl.IsValid() || !val.IsValid() {
- return true, errors.New("proto: invalid google.protobuf.Any message")
- }
-
- b, ok := val.Interface().([]byte)
- if !ok {
- return true, errors.New("proto: invalid google.protobuf.Any message")
- }
-
- parts := strings.Split(turl.String(), "/")
- mt := MessageType(parts[len(parts)-1])
- if mt == nil {
- return false, nil
- }
- m := reflect.New(mt.Elem())
- if err := Unmarshal(b, m.Interface().(Message)); err != nil {
- return false, nil
- }
- w.Write([]byte("["))
- u := turl.String()
- if requiresQuotes(u) {
- writeString(w, u)
- } else {
- w.Write([]byte(u))
- }
- if w.compact {
- w.Write([]byte("]:<"))
- } else {
- w.Write([]byte("]: <\n"))
- w.ind++
- }
- if err := tm.writeStruct(w, m.Elem()); err != nil {
- return true, err
- }
- if w.compact {
- w.Write([]byte("> "))
- } else {
- w.ind--
- w.Write([]byte(">\n"))
- }
- return true, nil
-}
-
-func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error {
- if tm.ExpandAny && isAny(sv) {
- if canExpand, err := tm.writeProto3Any(w, sv); canExpand {
- return err
- }
- }
- st := sv.Type()
- sprops := GetProperties(st)
- for i := 0; i < sv.NumField(); i++ {
- fv := sv.Field(i)
- props := sprops.Prop[i]
- name := st.Field(i).Name
-
- if name == "XXX_NoUnkeyedLiteral" {
- continue
- }
-
- if strings.HasPrefix(name, "XXX_") {
- // There are two XXX_ fields:
- // XXX_unrecognized []byte
- // XXX_extensions map[int32]proto.Extension
- // The first is handled here;
- // the second is handled at the bottom of this function.
- if name == "XXX_unrecognized" && !fv.IsNil() {
- if err := writeUnknownStruct(w, fv.Interface().([]byte)); err != nil {
- return err
- }
- }
- continue
- }
- if fv.Kind() == reflect.Ptr && fv.IsNil() {
- // Field not filled in. This could be an optional field or
- // a required field that wasn't filled in. Either way, there
- // isn't anything we can show for it.
- continue
- }
- if fv.Kind() == reflect.Slice && fv.IsNil() {
- // Repeated field that is empty, or a bytes field that is unused.
- continue
- }
-
- if props.Repeated && fv.Kind() == reflect.Slice {
- // Repeated field.
- for j := 0; j < fv.Len(); j++ {
- if err := writeName(w, props); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- v := fv.Index(j)
- if v.Kind() == reflect.Ptr && v.IsNil() {
- // A nil message in a repeated field is not valid,
- // but we can handle that more gracefully than panicking.
- if _, err := w.Write([]byte("\n")); err != nil {
- return err
- }
- continue
- }
- if err := tm.writeAny(w, v, props); err != nil {
- return err
- }
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
- continue
- }
- if fv.Kind() == reflect.Map {
- // Map fields are rendered as a repeated struct with key/value fields.
- keys := fv.MapKeys()
- sort.Sort(mapKeys(keys))
- for _, key := range keys {
- val := fv.MapIndex(key)
- if err := writeName(w, props); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- // open struct
- if err := w.WriteByte('<'); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
- w.indent()
- // key
- if _, err := w.WriteString("key:"); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- if err := tm.writeAny(w, key, props.MapKeyProp); err != nil {
- return err
- }
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- // nil values aren't legal, but we can avoid panicking because of them.
- if val.Kind() != reflect.Ptr || !val.IsNil() {
- // value
- if _, err := w.WriteString("value:"); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- if err := tm.writeAny(w, val, props.MapValProp); err != nil {
- return err
- }
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
- // close struct
- w.unindent()
- if err := w.WriteByte('>'); err != nil {
- return err
- }
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
- continue
- }
- if props.proto3 && fv.Kind() == reflect.Slice && fv.Len() == 0 {
- // empty bytes field
- continue
- }
- if fv.Kind() != reflect.Ptr && fv.Kind() != reflect.Slice {
- // proto3 non-repeated scalar field; skip if zero value
- if isProto3Zero(fv) {
- continue
- }
- }
-
- if fv.Kind() == reflect.Interface {
- // Check if it is a oneof.
- if st.Field(i).Tag.Get("protobuf_oneof") != "" {
- // fv is nil, or holds a pointer to generated struct.
- // That generated struct has exactly one field,
- // which has a protobuf struct tag.
- if fv.IsNil() {
- continue
- }
- inner := fv.Elem().Elem() // interface -> *T -> T
- tag := inner.Type().Field(0).Tag.Get("protobuf")
- props = new(Properties) // Overwrite the outer props var, but not its pointee.
- props.Parse(tag)
- // Write the value in the oneof, not the oneof itself.
- fv = inner.Field(0)
-
- // Special case to cope with malformed messages gracefully:
- // If the value in the oneof is a nil pointer, don't panic
- // in writeAny.
- if fv.Kind() == reflect.Ptr && fv.IsNil() {
- // Use errors.New so writeAny won't render quotes.
- msg := errors.New("/* nil */")
- fv = reflect.ValueOf(&msg).Elem()
- }
- }
- }
-
- if err := writeName(w, props); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
-
- // Enums have a String method, so writeAny will work fine.
- if err := tm.writeAny(w, fv, props); err != nil {
- return err
- }
-
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
-
- // Extensions (the XXX_extensions field).
- pv := sv.Addr()
- if _, err := extendable(pv.Interface()); err == nil {
- if err := tm.writeExtensions(w, pv); err != nil {
- return err
- }
- }
-
- return nil
-}
-
-// writeAny writes an arbitrary field.
-func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error {
- v = reflect.Indirect(v)
-
- // Floats have special cases.
- if v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 {
- x := v.Float()
- var b []byte
- switch {
- case math.IsInf(x, 1):
- b = posInf
- case math.IsInf(x, -1):
- b = negInf
- case math.IsNaN(x):
- b = nan
- }
- if b != nil {
- _, err := w.Write(b)
- return err
- }
- // Other values are handled below.
- }
-
- // We don't attempt to serialise every possible value type; only those
- // that can occur in protocol buffers.
- switch v.Kind() {
- case reflect.Slice:
- // Should only be a []byte; repeated fields are handled in writeStruct.
- if err := writeString(w, string(v.Bytes())); err != nil {
- return err
- }
- case reflect.String:
- if err := writeString(w, v.String()); err != nil {
- return err
- }
- case reflect.Struct:
- // Required/optional group/message.
- var bra, ket byte = '<', '>'
- if props != nil && props.Wire == "group" {
- bra, ket = '{', '}'
- }
- if err := w.WriteByte(bra); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
- w.indent()
- if v.CanAddr() {
- // Calling v.Interface on a struct causes the reflect package to
- // copy the entire struct. This is racy with the new Marshaler
- // since we atomically update the XXX_sizecache.
- //
- // Thus, we retrieve a pointer to the struct if possible to avoid
- // a race since v.Interface on the pointer doesn't copy the struct.
- //
- // If v is not addressable, then we are not worried about a race
- // since it implies that the binary Marshaler cannot possibly be
- // mutating this value.
- v = v.Addr()
- }
- if etm, ok := v.Interface().(encoding.TextMarshaler); ok {
- text, err := etm.MarshalText()
- if err != nil {
- return err
- }
- if _, err = w.Write(text); err != nil {
- return err
- }
- } else {
- if v.Kind() == reflect.Ptr {
- v = v.Elem()
- }
- if err := tm.writeStruct(w, v); err != nil {
- return err
- }
- }
- w.unindent()
- if err := w.WriteByte(ket); err != nil {
- return err
- }
- default:
- _, err := fmt.Fprint(w, v.Interface())
- return err
- }
- return nil
-}
-
-// equivalent to C's isprint.
-func isprint(c byte) bool {
- return c >= 0x20 && c < 0x7f
-}
-
-// writeString writes a string in the protocol buffer text format.
-// It is similar to strconv.Quote except we don't use Go escape sequences,
-// we treat the string as a byte sequence, and we use octal escapes.
-// These differences are to maintain interoperability with the other
-// languages' implementations of the text format.
-func writeString(w *textWriter, s string) error {
- // use WriteByte here to get any needed indent
- if err := w.WriteByte('"'); err != nil {
- return err
- }
- // Loop over the bytes, not the runes.
- for i := 0; i < len(s); i++ {
- var err error
- // Divergence from C++: we don't escape apostrophes.
- // There's no need to escape them, and the C++ parser
- // copes with a naked apostrophe.
- switch c := s[i]; c {
- case '\n':
- _, err = w.w.Write(backslashN)
- case '\r':
- _, err = w.w.Write(backslashR)
- case '\t':
- _, err = w.w.Write(backslashT)
- case '"':
- _, err = w.w.Write(backslashDQ)
- case '\\':
- _, err = w.w.Write(backslashBS)
- default:
- if isprint(c) {
- err = w.w.WriteByte(c)
- } else {
- _, err = fmt.Fprintf(w.w, "\\%03o", c)
- }
- }
- if err != nil {
- return err
- }
- }
- return w.WriteByte('"')
-}
-
-func writeUnknownStruct(w *textWriter, data []byte) (err error) {
- if !w.compact {
- if _, err := fmt.Fprintf(w, "/* %d unknown bytes */\n", len(data)); err != nil {
- return err
- }
- }
- b := NewBuffer(data)
- for b.index < len(b.buf) {
- x, err := b.DecodeVarint()
- if err != nil {
- _, err := fmt.Fprintf(w, "/* %v */\n", err)
- return err
- }
- wire, tag := x&7, x>>3
- if wire == WireEndGroup {
- w.unindent()
- if _, err := w.Write(endBraceNewline); err != nil {
- return err
- }
- continue
- }
- if _, err := fmt.Fprint(w, tag); err != nil {
- return err
- }
- if wire != WireStartGroup {
- if err := w.WriteByte(':'); err != nil {
- return err
- }
- }
- if !w.compact || wire == WireStartGroup {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- switch wire {
- case WireBytes:
- buf, e := b.DecodeRawBytes(false)
- if e == nil {
- _, err = fmt.Fprintf(w, "%q", buf)
- } else {
- _, err = fmt.Fprintf(w, "/* %v */", e)
- }
- case WireFixed32:
- x, err = b.DecodeFixed32()
- err = writeUnknownInt(w, x, err)
- case WireFixed64:
- x, err = b.DecodeFixed64()
- err = writeUnknownInt(w, x, err)
- case WireStartGroup:
- err = w.WriteByte('{')
- w.indent()
- case WireVarint:
- x, err = b.DecodeVarint()
- err = writeUnknownInt(w, x, err)
- default:
- _, err = fmt.Fprintf(w, "/* unknown wire type %d */", wire)
- }
- if err != nil {
- return err
- }
- if err = w.WriteByte('\n'); err != nil {
- return err
- }
- }
- return nil
-}
-
-func writeUnknownInt(w *textWriter, x uint64, err error) error {
- if err == nil {
- _, err = fmt.Fprint(w, x)
- } else {
- _, err = fmt.Fprintf(w, "/* %v */", err)
- }
- return err
-}
-
-type int32Slice []int32
-
-func (s int32Slice) Len() int { return len(s) }
-func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] }
-func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-
-// writeExtensions writes all the extensions in pv.
-// pv is assumed to be a pointer to a protocol message struct that is extendable.
-func (tm *TextMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error {
- emap := extensionMaps[pv.Type().Elem()]
- ep, _ := extendable(pv.Interface())
-
- // Order the extensions by ID.
- // This isn't strictly necessary, but it will give us
- // canonical output, which will also make testing easier.
- m, mu := ep.extensionsRead()
- if m == nil {
- return nil
- }
- mu.Lock()
- ids := make([]int32, 0, len(m))
- for id := range m {
- ids = append(ids, id)
- }
- sort.Sort(int32Slice(ids))
- mu.Unlock()
-
- for _, extNum := range ids {
- ext := m[extNum]
- var desc *ExtensionDesc
- if emap != nil {
- desc = emap[extNum]
- }
- if desc == nil {
- // Unknown extension.
- if err := writeUnknownStruct(w, ext.enc); err != nil {
- return err
- }
- continue
- }
-
- pb, err := GetExtension(ep, desc)
- if err != nil {
- return fmt.Errorf("failed getting extension: %v", err)
- }
-
- // Repeated extensions will appear as a slice.
- if !desc.repeated() {
- if err := tm.writeExtension(w, desc.Name, pb); err != nil {
- return err
- }
- } else {
- v := reflect.ValueOf(pb)
- for i := 0; i < v.Len(); i++ {
- if err := tm.writeExtension(w, desc.Name, v.Index(i).Interface()); err != nil {
- return err
- }
- }
- }
- }
- return nil
-}
-
-func (tm *TextMarshaler) writeExtension(w *textWriter, name string, pb interface{}) error {
- if _, err := fmt.Fprintf(w, "[%s]:", name); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- if err := tm.writeAny(w, reflect.ValueOf(pb), nil); err != nil {
- return err
- }
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- return nil
-}
-
-func (w *textWriter) writeIndent() {
- if !w.complete {
- return
- }
- remain := w.ind * 2
- for remain > 0 {
- n := remain
- if n > len(spaces) {
- n = len(spaces)
- }
- w.w.Write(spaces[:n])
- remain -= n
- }
- w.complete = false
-}
-
-// TextMarshaler is a configurable text format marshaler.
-type TextMarshaler struct {
- Compact bool // use compact text format (one line).
- ExpandAny bool // expand google.protobuf.Any messages of known types
-}
-
-// Marshal writes a given protocol buffer in text format.
-// The only errors returned are from w.
-func (tm *TextMarshaler) Marshal(w io.Writer, pb Message) error {
- val := reflect.ValueOf(pb)
- if pb == nil || val.IsNil() {
- w.Write([]byte(""))
- return nil
- }
- var bw *bufio.Writer
- ww, ok := w.(writer)
- if !ok {
- bw = bufio.NewWriter(w)
- ww = bw
- }
- aw := &textWriter{
- w: ww,
- complete: true,
- compact: tm.Compact,
- }
-
- if etm, ok := pb.(encoding.TextMarshaler); ok {
- text, err := etm.MarshalText()
- if err != nil {
- return err
- }
- if _, err = aw.Write(text); err != nil {
- return err
- }
- if bw != nil {
- return bw.Flush()
- }
- return nil
- }
- // Dereference the received pointer so we don't have outer < and >.
- v := reflect.Indirect(val)
- if err := tm.writeStruct(aw, v); err != nil {
- return err
- }
- if bw != nil {
- return bw.Flush()
- }
- return nil
-}
-
-// Text is the same as Marshal, but returns the string directly.
-func (tm *TextMarshaler) Text(pb Message) string {
- var buf bytes.Buffer
- tm.Marshal(&buf, pb)
- return buf.String()
-}
-
-var (
- defaultTextMarshaler = TextMarshaler{}
- compactTextMarshaler = TextMarshaler{Compact: true}
-)
-
-// TODO: consider removing some of the Marshal functions below.
-
-// MarshalText writes a given protocol buffer in text format.
-// The only errors returned are from w.
-func MarshalText(w io.Writer, pb Message) error { return defaultTextMarshaler.Marshal(w, pb) }
-
-// MarshalTextString is the same as MarshalText, but returns the string directly.
-func MarshalTextString(pb Message) string { return defaultTextMarshaler.Text(pb) }
-
-// CompactText writes a given protocol buffer in compact text format (one line).
-func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Marshal(w, pb) }
-
-// CompactTextString is the same as CompactText, but returns the string directly.
-func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) }
diff --git a/vendor/github.com/golang/protobuf/proto/text_parser.go b/vendor/github.com/golang/protobuf/proto/text_parser.go
deleted file mode 100644
index bb55a3a..0000000
--- a/vendor/github.com/golang/protobuf/proto/text_parser.go
+++ /dev/null
@@ -1,880 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-// Functions for parsing the Text protocol buffer format.
-// TODO: message sets.
-
-import (
- "encoding"
- "errors"
- "fmt"
- "reflect"
- "strconv"
- "strings"
- "unicode/utf8"
-)
-
-// Error string emitted when deserializing Any and fields are already set
-const anyRepeatedlyUnpacked = "Any message unpacked multiple times, or %q already set"
-
-type ParseError struct {
- Message string
- Line int // 1-based line number
- Offset int // 0-based byte offset from start of input
-}
-
-func (p *ParseError) Error() string {
- if p.Line == 1 {
- // show offset only for first line
- return fmt.Sprintf("line 1.%d: %v", p.Offset, p.Message)
- }
- return fmt.Sprintf("line %d: %v", p.Line, p.Message)
-}
-
-type token struct {
- value string
- err *ParseError
- line int // line number
- offset int // byte number from start of input, not start of line
- unquoted string // the unquoted version of value, if it was a quoted string
-}
-
-func (t *token) String() string {
- if t.err == nil {
- return fmt.Sprintf("%q (line=%d, offset=%d)", t.value, t.line, t.offset)
- }
- return fmt.Sprintf("parse error: %v", t.err)
-}
-
-type textParser struct {
- s string // remaining input
- done bool // whether the parsing is finished (success or error)
- backed bool // whether back() was called
- offset, line int
- cur token
-}
-
-func newTextParser(s string) *textParser {
- p := new(textParser)
- p.s = s
- p.line = 1
- p.cur.line = 1
- return p
-}
-
-func (p *textParser) errorf(format string, a ...interface{}) *ParseError {
- pe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset}
- p.cur.err = pe
- p.done = true
- return pe
-}
-
-// Numbers and identifiers are matched by [-+._A-Za-z0-9]
-func isIdentOrNumberChar(c byte) bool {
- switch {
- case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z':
- return true
- case '0' <= c && c <= '9':
- return true
- }
- switch c {
- case '-', '+', '.', '_':
- return true
- }
- return false
-}
-
-func isWhitespace(c byte) bool {
- switch c {
- case ' ', '\t', '\n', '\r':
- return true
- }
- return false
-}
-
-func isQuote(c byte) bool {
- switch c {
- case '"', '\'':
- return true
- }
- return false
-}
-
-func (p *textParser) skipWhitespace() {
- i := 0
- for i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') {
- if p.s[i] == '#' {
- // comment; skip to end of line or input
- for i < len(p.s) && p.s[i] != '\n' {
- i++
- }
- if i == len(p.s) {
- break
- }
- }
- if p.s[i] == '\n' {
- p.line++
- }
- i++
- }
- p.offset += i
- p.s = p.s[i:len(p.s)]
- if len(p.s) == 0 {
- p.done = true
- }
-}
-
-func (p *textParser) advance() {
- // Skip whitespace
- p.skipWhitespace()
- if p.done {
- return
- }
-
- // Start of non-whitespace
- p.cur.err = nil
- p.cur.offset, p.cur.line = p.offset, p.line
- p.cur.unquoted = ""
- switch p.s[0] {
- case '<', '>', '{', '}', ':', '[', ']', ';', ',', '/':
- // Single symbol
- p.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)]
- case '"', '\'':
- // Quoted string
- i := 1
- for i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\n' {
- if p.s[i] == '\\' && i+1 < len(p.s) {
- // skip escaped char
- i++
- }
- i++
- }
- if i >= len(p.s) || p.s[i] != p.s[0] {
- p.errorf("unmatched quote")
- return
- }
- unq, err := unquoteC(p.s[1:i], rune(p.s[0]))
- if err != nil {
- p.errorf("invalid quoted string %s: %v", p.s[0:i+1], err)
- return
- }
- p.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)]
- p.cur.unquoted = unq
- default:
- i := 0
- for i < len(p.s) && isIdentOrNumberChar(p.s[i]) {
- i++
- }
- if i == 0 {
- p.errorf("unexpected byte %#x", p.s[0])
- return
- }
- p.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)]
- }
- p.offset += len(p.cur.value)
-}
-
-var (
- errBadUTF8 = errors.New("proto: bad UTF-8")
-)
-
-func unquoteC(s string, quote rune) (string, error) {
- // This is based on C++'s tokenizer.cc.
- // Despite its name, this is *not* parsing C syntax.
- // For instance, "\0" is an invalid quoted string.
-
- // Avoid allocation in trivial cases.
- simple := true
- for _, r := range s {
- if r == '\\' || r == quote {
- simple = false
- break
- }
- }
- if simple {
- return s, nil
- }
-
- buf := make([]byte, 0, 3*len(s)/2)
- for len(s) > 0 {
- r, n := utf8.DecodeRuneInString(s)
- if r == utf8.RuneError && n == 1 {
- return "", errBadUTF8
- }
- s = s[n:]
- if r != '\\' {
- if r < utf8.RuneSelf {
- buf = append(buf, byte(r))
- } else {
- buf = append(buf, string(r)...)
- }
- continue
- }
-
- ch, tail, err := unescape(s)
- if err != nil {
- return "", err
- }
- buf = append(buf, ch...)
- s = tail
- }
- return string(buf), nil
-}
-
-func unescape(s string) (ch string, tail string, err error) {
- r, n := utf8.DecodeRuneInString(s)
- if r == utf8.RuneError && n == 1 {
- return "", "", errBadUTF8
- }
- s = s[n:]
- switch r {
- case 'a':
- return "\a", s, nil
- case 'b':
- return "\b", s, nil
- case 'f':
- return "\f", s, nil
- case 'n':
- return "\n", s, nil
- case 'r':
- return "\r", s, nil
- case 't':
- return "\t", s, nil
- case 'v':
- return "\v", s, nil
- case '?':
- return "?", s, nil // trigraph workaround
- case '\'', '"', '\\':
- return string(r), s, nil
- case '0', '1', '2', '3', '4', '5', '6', '7':
- if len(s) < 2 {
- return "", "", fmt.Errorf(`\%c requires 2 following digits`, r)
- }
- ss := string(r) + s[:2]
- s = s[2:]
- i, err := strconv.ParseUint(ss, 8, 8)
- if err != nil {
- return "", "", fmt.Errorf(`\%s contains non-octal digits`, ss)
- }
- return string([]byte{byte(i)}), s, nil
- case 'x', 'X', 'u', 'U':
- var n int
- switch r {
- case 'x', 'X':
- n = 2
- case 'u':
- n = 4
- case 'U':
- n = 8
- }
- if len(s) < n {
- return "", "", fmt.Errorf(`\%c requires %d following digits`, r, n)
- }
- ss := s[:n]
- s = s[n:]
- i, err := strconv.ParseUint(ss, 16, 64)
- if err != nil {
- return "", "", fmt.Errorf(`\%c%s contains non-hexadecimal digits`, r, ss)
- }
- if r == 'x' || r == 'X' {
- return string([]byte{byte(i)}), s, nil
- }
- if i > utf8.MaxRune {
- return "", "", fmt.Errorf(`\%c%s is not a valid Unicode code point`, r, ss)
- }
- return string(i), s, nil
- }
- return "", "", fmt.Errorf(`unknown escape \%c`, r)
-}
-
-// Back off the parser by one token. Can only be done between calls to next().
-// It makes the next advance() a no-op.
-func (p *textParser) back() { p.backed = true }
-
-// Advances the parser and returns the new current token.
-func (p *textParser) next() *token {
- if p.backed || p.done {
- p.backed = false
- return &p.cur
- }
- p.advance()
- if p.done {
- p.cur.value = ""
- } else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) {
- // Look for multiple quoted strings separated by whitespace,
- // and concatenate them.
- cat := p.cur
- for {
- p.skipWhitespace()
- if p.done || !isQuote(p.s[0]) {
- break
- }
- p.advance()
- if p.cur.err != nil {
- return &p.cur
- }
- cat.value += " " + p.cur.value
- cat.unquoted += p.cur.unquoted
- }
- p.done = false // parser may have seen EOF, but we want to return cat
- p.cur = cat
- }
- return &p.cur
-}
-
-func (p *textParser) consumeToken(s string) error {
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value != s {
- p.back()
- return p.errorf("expected %q, found %q", s, tok.value)
- }
- return nil
-}
-
-// Return a RequiredNotSetError indicating which required field was not set.
-func (p *textParser) missingRequiredFieldError(sv reflect.Value) *RequiredNotSetError {
- st := sv.Type()
- sprops := GetProperties(st)
- for i := 0; i < st.NumField(); i++ {
- if !isNil(sv.Field(i)) {
- continue
- }
-
- props := sprops.Prop[i]
- if props.Required {
- return &RequiredNotSetError{fmt.Sprintf("%v.%v", st, props.OrigName)}
- }
- }
- return &RequiredNotSetError{fmt.Sprintf("%v.", st)} // should not happen
-}
-
-// Returns the index in the struct for the named field, as well as the parsed tag properties.
-func structFieldByName(sprops *StructProperties, name string) (int, *Properties, bool) {
- i, ok := sprops.decoderOrigNames[name]
- if ok {
- return i, sprops.Prop[i], true
- }
- return -1, nil, false
-}
-
-// Consume a ':' from the input stream (if the next token is a colon),
-// returning an error if a colon is needed but not present.
-func (p *textParser) checkForColon(props *Properties, typ reflect.Type) *ParseError {
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value != ":" {
- // Colon is optional when the field is a group or message.
- needColon := true
- switch props.Wire {
- case "group":
- needColon = false
- case "bytes":
- // A "bytes" field is either a message, a string, or a repeated field;
- // those three become *T, *string and []T respectively, so we can check for
- // this field being a pointer to a non-string.
- if typ.Kind() == reflect.Ptr {
- // *T or *string
- if typ.Elem().Kind() == reflect.String {
- break
- }
- } else if typ.Kind() == reflect.Slice {
- // []T or []*T
- if typ.Elem().Kind() != reflect.Ptr {
- break
- }
- } else if typ.Kind() == reflect.String {
- // The proto3 exception is for a string field,
- // which requires a colon.
- break
- }
- needColon = false
- }
- if needColon {
- return p.errorf("expected ':', found %q", tok.value)
- }
- p.back()
- }
- return nil
-}
-
-func (p *textParser) readStruct(sv reflect.Value, terminator string) error {
- st := sv.Type()
- sprops := GetProperties(st)
- reqCount := sprops.reqCount
- var reqFieldErr error
- fieldSet := make(map[string]bool)
- // A struct is a sequence of "name: value", terminated by one of
- // '>' or '}', or the end of the input. A name may also be
- // "[extension]" or "[type/url]".
- //
- // The whole struct can also be an expanded Any message, like:
- // [type/url] < ... struct contents ... >
- for {
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value == terminator {
- break
- }
- if tok.value == "[" {
- // Looks like an extension or an Any.
- //
- // TODO: Check whether we need to handle
- // namespace rooted names (e.g. ".something.Foo").
- extName, err := p.consumeExtName()
- if err != nil {
- return err
- }
-
- if s := strings.LastIndex(extName, "/"); s >= 0 {
- // If it contains a slash, it's an Any type URL.
- messageName := extName[s+1:]
- mt := MessageType(messageName)
- if mt == nil {
- return p.errorf("unrecognized message %q in google.protobuf.Any", messageName)
- }
- tok = p.next()
- if tok.err != nil {
- return tok.err
- }
- // consume an optional colon
- if tok.value == ":" {
- tok = p.next()
- if tok.err != nil {
- return tok.err
- }
- }
- var terminator string
- switch tok.value {
- case "<":
- terminator = ">"
- case "{":
- terminator = "}"
- default:
- return p.errorf("expected '{' or '<', found %q", tok.value)
- }
- v := reflect.New(mt.Elem())
- if pe := p.readStruct(v.Elem(), terminator); pe != nil {
- return pe
- }
- b, err := Marshal(v.Interface().(Message))
- if err != nil {
- return p.errorf("failed to marshal message of type %q: %v", messageName, err)
- }
- if fieldSet["type_url"] {
- return p.errorf(anyRepeatedlyUnpacked, "type_url")
- }
- if fieldSet["value"] {
- return p.errorf(anyRepeatedlyUnpacked, "value")
- }
- sv.FieldByName("TypeUrl").SetString(extName)
- sv.FieldByName("Value").SetBytes(b)
- fieldSet["type_url"] = true
- fieldSet["value"] = true
- continue
- }
-
- var desc *ExtensionDesc
- // This could be faster, but it's functional.
- // TODO: Do something smarter than a linear scan.
- for _, d := range RegisteredExtensions(reflect.New(st).Interface().(Message)) {
- if d.Name == extName {
- desc = d
- break
- }
- }
- if desc == nil {
- return p.errorf("unrecognized extension %q", extName)
- }
-
- props := &Properties{}
- props.Parse(desc.Tag)
-
- typ := reflect.TypeOf(desc.ExtensionType)
- if err := p.checkForColon(props, typ); err != nil {
- return err
- }
-
- rep := desc.repeated()
-
- // Read the extension structure, and set it in
- // the value we're constructing.
- var ext reflect.Value
- if !rep {
- ext = reflect.New(typ).Elem()
- } else {
- ext = reflect.New(typ.Elem()).Elem()
- }
- if err := p.readAny(ext, props); err != nil {
- if _, ok := err.(*RequiredNotSetError); !ok {
- return err
- }
- reqFieldErr = err
- }
- ep := sv.Addr().Interface().(Message)
- if !rep {
- SetExtension(ep, desc, ext.Interface())
- } else {
- old, err := GetExtension(ep, desc)
- var sl reflect.Value
- if err == nil {
- sl = reflect.ValueOf(old) // existing slice
- } else {
- sl = reflect.MakeSlice(typ, 0, 1)
- }
- sl = reflect.Append(sl, ext)
- SetExtension(ep, desc, sl.Interface())
- }
- if err := p.consumeOptionalSeparator(); err != nil {
- return err
- }
- continue
- }
-
- // This is a normal, non-extension field.
- name := tok.value
- var dst reflect.Value
- fi, props, ok := structFieldByName(sprops, name)
- if ok {
- dst = sv.Field(fi)
- } else if oop, ok := sprops.OneofTypes[name]; ok {
- // It is a oneof.
- props = oop.Prop
- nv := reflect.New(oop.Type.Elem())
- dst = nv.Elem().Field(0)
- field := sv.Field(oop.Field)
- if !field.IsNil() {
- return p.errorf("field '%s' would overwrite already parsed oneof '%s'", name, sv.Type().Field(oop.Field).Name)
- }
- field.Set(nv)
- }
- if !dst.IsValid() {
- return p.errorf("unknown field name %q in %v", name, st)
- }
-
- if dst.Kind() == reflect.Map {
- // Consume any colon.
- if err := p.checkForColon(props, dst.Type()); err != nil {
- return err
- }
-
- // Construct the map if it doesn't already exist.
- if dst.IsNil() {
- dst.Set(reflect.MakeMap(dst.Type()))
- }
- key := reflect.New(dst.Type().Key()).Elem()
- val := reflect.New(dst.Type().Elem()).Elem()
-
- // The map entry should be this sequence of tokens:
- // < key : KEY value : VALUE >
- // However, implementations may omit key or value, and technically
- // we should support them in any order. See b/28924776 for a time
- // this went wrong.
-
- tok := p.next()
- var terminator string
- switch tok.value {
- case "<":
- terminator = ">"
- case "{":
- terminator = "}"
- default:
- return p.errorf("expected '{' or '<', found %q", tok.value)
- }
- for {
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value == terminator {
- break
- }
- switch tok.value {
- case "key":
- if err := p.consumeToken(":"); err != nil {
- return err
- }
- if err := p.readAny(key, props.MapKeyProp); err != nil {
- return err
- }
- if err := p.consumeOptionalSeparator(); err != nil {
- return err
- }
- case "value":
- if err := p.checkForColon(props.MapValProp, dst.Type().Elem()); err != nil {
- return err
- }
- if err := p.readAny(val, props.MapValProp); err != nil {
- return err
- }
- if err := p.consumeOptionalSeparator(); err != nil {
- return err
- }
- default:
- p.back()
- return p.errorf(`expected "key", "value", or %q, found %q`, terminator, tok.value)
- }
- }
-
- dst.SetMapIndex(key, val)
- continue
- }
-
- // Check that it's not already set if it's not a repeated field.
- if !props.Repeated && fieldSet[name] {
- return p.errorf("non-repeated field %q was repeated", name)
- }
-
- if err := p.checkForColon(props, dst.Type()); err != nil {
- return err
- }
-
- // Parse into the field.
- fieldSet[name] = true
- if err := p.readAny(dst, props); err != nil {
- if _, ok := err.(*RequiredNotSetError); !ok {
- return err
- }
- reqFieldErr = err
- }
- if props.Required {
- reqCount--
- }
-
- if err := p.consumeOptionalSeparator(); err != nil {
- return err
- }
-
- }
-
- if reqCount > 0 {
- return p.missingRequiredFieldError(sv)
- }
- return reqFieldErr
-}
-
-// consumeExtName consumes extension name or expanded Any type URL and the
-// following ']'. It returns the name or URL consumed.
-func (p *textParser) consumeExtName() (string, error) {
- tok := p.next()
- if tok.err != nil {
- return "", tok.err
- }
-
- // If extension name or type url is quoted, it's a single token.
- if len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] {
- name, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0]))
- if err != nil {
- return "", err
- }
- return name, p.consumeToken("]")
- }
-
- // Consume everything up to "]"
- var parts []string
- for tok.value != "]" {
- parts = append(parts, tok.value)
- tok = p.next()
- if tok.err != nil {
- return "", p.errorf("unrecognized type_url or extension name: %s", tok.err)
- }
- if p.done && tok.value != "]" {
- return "", p.errorf("unclosed type_url or extension name")
- }
- }
- return strings.Join(parts, ""), nil
-}
-
-// consumeOptionalSeparator consumes an optional semicolon or comma.
-// It is used in readStruct to provide backward compatibility.
-func (p *textParser) consumeOptionalSeparator() error {
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value != ";" && tok.value != "," {
- p.back()
- }
- return nil
-}
-
-func (p *textParser) readAny(v reflect.Value, props *Properties) error {
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value == "" {
- return p.errorf("unexpected EOF")
- }
-
- switch fv := v; fv.Kind() {
- case reflect.Slice:
- at := v.Type()
- if at.Elem().Kind() == reflect.Uint8 {
- // Special case for []byte
- if tok.value[0] != '"' && tok.value[0] != '\'' {
- // Deliberately written out here, as the error after
- // this switch statement would write "invalid []byte: ...",
- // which is not as user-friendly.
- return p.errorf("invalid string: %v", tok.value)
- }
- bytes := []byte(tok.unquoted)
- fv.Set(reflect.ValueOf(bytes))
- return nil
- }
- // Repeated field.
- if tok.value == "[" {
- // Repeated field with list notation, like [1,2,3].
- for {
- fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem()))
- err := p.readAny(fv.Index(fv.Len()-1), props)
- if err != nil {
- return err
- }
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value == "]" {
- break
- }
- if tok.value != "," {
- return p.errorf("Expected ']' or ',' found %q", tok.value)
- }
- }
- return nil
- }
- // One value of the repeated field.
- p.back()
- fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem()))
- return p.readAny(fv.Index(fv.Len()-1), props)
- case reflect.Bool:
- // true/1/t/True or false/f/0/False.
- switch tok.value {
- case "true", "1", "t", "True":
- fv.SetBool(true)
- return nil
- case "false", "0", "f", "False":
- fv.SetBool(false)
- return nil
- }
- case reflect.Float32, reflect.Float64:
- v := tok.value
- // Ignore 'f' for compatibility with output generated by C++, but don't
- // remove 'f' when the value is "-inf" or "inf".
- if strings.HasSuffix(v, "f") && tok.value != "-inf" && tok.value != "inf" {
- v = v[:len(v)-1]
- }
- if f, err := strconv.ParseFloat(v, fv.Type().Bits()); err == nil {
- fv.SetFloat(f)
- return nil
- }
- case reflect.Int32:
- if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil {
- fv.SetInt(x)
- return nil
- }
-
- if len(props.Enum) == 0 {
- break
- }
- m, ok := enumValueMaps[props.Enum]
- if !ok {
- break
- }
- x, ok := m[tok.value]
- if !ok {
- break
- }
- fv.SetInt(int64(x))
- return nil
- case reflect.Int64:
- if x, err := strconv.ParseInt(tok.value, 0, 64); err == nil {
- fv.SetInt(x)
- return nil
- }
-
- case reflect.Ptr:
- // A basic field (indirected through pointer), or a repeated message/group
- p.back()
- fv.Set(reflect.New(fv.Type().Elem()))
- return p.readAny(fv.Elem(), props)
- case reflect.String:
- if tok.value[0] == '"' || tok.value[0] == '\'' {
- fv.SetString(tok.unquoted)
- return nil
- }
- case reflect.Struct:
- var terminator string
- switch tok.value {
- case "{":
- terminator = "}"
- case "<":
- terminator = ">"
- default:
- return p.errorf("expected '{' or '<', found %q", tok.value)
- }
- // TODO: Handle nested messages which implement encoding.TextUnmarshaler.
- return p.readStruct(fv, terminator)
- case reflect.Uint32:
- if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil {
- fv.SetUint(uint64(x))
- return nil
- }
- case reflect.Uint64:
- if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil {
- fv.SetUint(x)
- return nil
- }
- }
- return p.errorf("invalid %v: %v", v.Type(), tok.value)
-}
-
-// UnmarshalText reads a protocol buffer in Text format. UnmarshalText resets pb
-// before starting to unmarshal, so any existing data in pb is always removed.
-// If a required field is not set and no other error occurs,
-// UnmarshalText returns *RequiredNotSetError.
-func UnmarshalText(s string, pb Message) error {
- if um, ok := pb.(encoding.TextUnmarshaler); ok {
- return um.UnmarshalText([]byte(s))
- }
- pb.Reset()
- v := reflect.ValueOf(pb)
- return newTextParser(s).readStruct(v.Elem(), "")
-}
diff --git a/vendor/github.com/golang/protobuf/ptypes/any.go b/vendor/github.com/golang/protobuf/ptypes/any.go
deleted file mode 100644
index 70276e8..0000000
--- a/vendor/github.com/golang/protobuf/ptypes/any.go
+++ /dev/null
@@ -1,141 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2016 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package ptypes
-
-// This file implements functions to marshal proto.Message to/from
-// google.protobuf.Any message.
-
-import (
- "fmt"
- "reflect"
- "strings"
-
- "github.com/golang/protobuf/proto"
- "github.com/golang/protobuf/ptypes/any"
-)
-
-const googleApis = "type.googleapis.com/"
-
-// AnyMessageName returns the name of the message contained in a google.protobuf.Any message.
-//
-// Note that regular type assertions should be done using the Is
-// function. AnyMessageName is provided for less common use cases like filtering a
-// sequence of Any messages based on a set of allowed message type names.
-func AnyMessageName(any *any.Any) (string, error) {
- if any == nil {
- return "", fmt.Errorf("message is nil")
- }
- slash := strings.LastIndex(any.TypeUrl, "/")
- if slash < 0 {
- return "", fmt.Errorf("message type url %q is invalid", any.TypeUrl)
- }
- return any.TypeUrl[slash+1:], nil
-}
-
-// MarshalAny takes the protocol buffer and encodes it into google.protobuf.Any.
-func MarshalAny(pb proto.Message) (*any.Any, error) {
- value, err := proto.Marshal(pb)
- if err != nil {
- return nil, err
- }
- return &any.Any{TypeUrl: googleApis + proto.MessageName(pb), Value: value}, nil
-}
-
-// DynamicAny is a value that can be passed to UnmarshalAny to automatically
-// allocate a proto.Message for the type specified in a google.protobuf.Any
-// message. The allocated message is stored in the embedded proto.Message.
-//
-// Example:
-//
-// var x ptypes.DynamicAny
-// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... }
-// fmt.Printf("unmarshaled message: %v", x.Message)
-type DynamicAny struct {
- proto.Message
-}
-
-// Empty returns a new proto.Message of the type specified in a
-// google.protobuf.Any message. It returns an error if corresponding message
-// type isn't linked in.
-func Empty(any *any.Any) (proto.Message, error) {
- aname, err := AnyMessageName(any)
- if err != nil {
- return nil, err
- }
-
- t := proto.MessageType(aname)
- if t == nil {
- return nil, fmt.Errorf("any: message type %q isn't linked in", aname)
- }
- return reflect.New(t.Elem()).Interface().(proto.Message), nil
-}
-
-// UnmarshalAny parses the protocol buffer representation in a google.protobuf.Any
-// message and places the decoded result in pb. It returns an error if type of
-// contents of Any message does not match type of pb message.
-//
-// pb can be a proto.Message, or a *DynamicAny.
-func UnmarshalAny(any *any.Any, pb proto.Message) error {
- if d, ok := pb.(*DynamicAny); ok {
- if d.Message == nil {
- var err error
- d.Message, err = Empty(any)
- if err != nil {
- return err
- }
- }
- return UnmarshalAny(any, d.Message)
- }
-
- aname, err := AnyMessageName(any)
- if err != nil {
- return err
- }
-
- mname := proto.MessageName(pb)
- if aname != mname {
- return fmt.Errorf("mismatched message type: got %q want %q", aname, mname)
- }
- return proto.Unmarshal(any.Value, pb)
-}
-
-// Is returns true if any value contains a given message type.
-func Is(any *any.Any, pb proto.Message) bool {
- // The following is equivalent to AnyMessageName(any) == proto.MessageName(pb),
- // but it avoids scanning TypeUrl for the slash.
- if any == nil {
- return false
- }
- name := proto.MessageName(pb)
- prefix := len(any.TypeUrl) - len(name)
- return prefix >= 1 && any.TypeUrl[prefix-1] == '/' && any.TypeUrl[prefix:] == name
-}
diff --git a/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go b/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go
deleted file mode 100644
index 78ee523..0000000
--- a/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go
+++ /dev/null
@@ -1,200 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// source: google/protobuf/any.proto
-
-package any
-
-import (
- fmt "fmt"
- proto "github.com/golang/protobuf/proto"
- math "math"
-)
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
-// `Any` contains an arbitrary serialized protocol buffer message along with a
-// URL that describes the type of the serialized message.
-//
-// Protobuf library provides support to pack/unpack Any values in the form
-// of utility functions or additional generated methods of the Any type.
-//
-// Example 1: Pack and unpack a message in C++.
-//
-// Foo foo = ...;
-// Any any;
-// any.PackFrom(foo);
-// ...
-// if (any.UnpackTo(&foo)) {
-// ...
-// }
-//
-// Example 2: Pack and unpack a message in Java.
-//
-// Foo foo = ...;
-// Any any = Any.pack(foo);
-// ...
-// if (any.is(Foo.class)) {
-// foo = any.unpack(Foo.class);
-// }
-//
-// Example 3: Pack and unpack a message in Python.
-//
-// foo = Foo(...)
-// any = Any()
-// any.Pack(foo)
-// ...
-// if any.Is(Foo.DESCRIPTOR):
-// any.Unpack(foo)
-// ...
-//
-// Example 4: Pack and unpack a message in Go
-//
-// foo := &pb.Foo{...}
-// any, err := ptypes.MarshalAny(foo)
-// ...
-// foo := &pb.Foo{}
-// if err := ptypes.UnmarshalAny(any, foo); err != nil {
-// ...
-// }
-//
-// The pack methods provided by protobuf library will by default use
-// 'type.googleapis.com/full.type.name' as the type URL and the unpack
-// methods only use the fully qualified type name after the last '/'
-// in the type URL, for example "foo.bar.com/x/y.z" will yield type
-// name "y.z".
-//
-//
-// JSON
-// ====
-// The JSON representation of an `Any` value uses the regular
-// representation of the deserialized, embedded message, with an
-// additional field `@type` which contains the type URL. Example:
-//
-// package google.profile;
-// message Person {
-// string first_name = 1;
-// string last_name = 2;
-// }
-//
-// {
-// "@type": "type.googleapis.com/google.profile.Person",
-// "firstName": ,
-// "lastName":
-// }
-//
-// If the embedded message type is well-known and has a custom JSON
-// representation, that representation will be embedded adding a field
-// `value` which holds the custom JSON in addition to the `@type`
-// field. Example (for message [google.protobuf.Duration][]):
-//
-// {
-// "@type": "type.googleapis.com/google.protobuf.Duration",
-// "value": "1.212s"
-// }
-//
-type Any struct {
- // A URL/resource name that uniquely identifies the type of the serialized
- // protocol buffer message. The last segment of the URL's path must represent
- // the fully qualified name of the type (as in
- // `path/google.protobuf.Duration`). The name should be in a canonical form
- // (e.g., leading "." is not accepted).
- //
- // In practice, teams usually precompile into the binary all types that they
- // expect it to use in the context of Any. However, for URLs which use the
- // scheme `http`, `https`, or no scheme, one can optionally set up a type
- // server that maps type URLs to message definitions as follows:
- //
- // * If no scheme is provided, `https` is assumed.
- // * An HTTP GET on the URL must yield a [google.protobuf.Type][]
- // value in binary format, or produce an error.
- // * Applications are allowed to cache lookup results based on the
- // URL, or have them precompiled into a binary to avoid any
- // lookup. Therefore, binary compatibility needs to be preserved
- // on changes to types. (Use versioned type names to manage
- // breaking changes.)
- //
- // Note: this functionality is not currently available in the official
- // protobuf release, and it is not used for type URLs beginning with
- // type.googleapis.com.
- //
- // Schemes other than `http`, `https` (or the empty scheme) might be
- // used with implementation specific semantics.
- //
- TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"`
- // Must be a valid serialized protocol buffer of the above specified type.
- Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *Any) Reset() { *m = Any{} }
-func (m *Any) String() string { return proto.CompactTextString(m) }
-func (*Any) ProtoMessage() {}
-func (*Any) Descriptor() ([]byte, []int) {
- return fileDescriptor_b53526c13ae22eb4, []int{0}
-}
-
-func (*Any) XXX_WellKnownType() string { return "Any" }
-
-func (m *Any) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_Any.Unmarshal(m, b)
-}
-func (m *Any) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_Any.Marshal(b, m, deterministic)
-}
-func (m *Any) XXX_Merge(src proto.Message) {
- xxx_messageInfo_Any.Merge(m, src)
-}
-func (m *Any) XXX_Size() int {
- return xxx_messageInfo_Any.Size(m)
-}
-func (m *Any) XXX_DiscardUnknown() {
- xxx_messageInfo_Any.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Any proto.InternalMessageInfo
-
-func (m *Any) GetTypeUrl() string {
- if m != nil {
- return m.TypeUrl
- }
- return ""
-}
-
-func (m *Any) GetValue() []byte {
- if m != nil {
- return m.Value
- }
- return nil
-}
-
-func init() {
- proto.RegisterType((*Any)(nil), "google.protobuf.Any")
-}
-
-func init() { proto.RegisterFile("google/protobuf/any.proto", fileDescriptor_b53526c13ae22eb4) }
-
-var fileDescriptor_b53526c13ae22eb4 = []byte{
- // 185 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xcf, 0xcf, 0x4f,
- 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcc, 0xab, 0xd4,
- 0x03, 0x73, 0x84, 0xf8, 0x21, 0x52, 0x7a, 0x30, 0x29, 0x25, 0x33, 0x2e, 0x66, 0xc7, 0xbc, 0x4a,
- 0x21, 0x49, 0x2e, 0x8e, 0x92, 0xca, 0x82, 0xd4, 0xf8, 0xd2, 0xa2, 0x1c, 0x09, 0x46, 0x05, 0x46,
- 0x0d, 0xce, 0x20, 0x76, 0x10, 0x3f, 0xb4, 0x28, 0x47, 0x48, 0x84, 0x8b, 0xb5, 0x2c, 0x31, 0xa7,
- 0x34, 0x55, 0x82, 0x49, 0x81, 0x51, 0x83, 0x27, 0x08, 0xc2, 0x71, 0xca, 0xe7, 0x12, 0x4e, 0xce,
- 0xcf, 0xd5, 0x43, 0x33, 0xce, 0x89, 0xc3, 0x31, 0xaf, 0x32, 0x00, 0xc4, 0x09, 0x60, 0x8c, 0x52,
- 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0xcf, 0x49, 0xcc,
- 0x4b, 0x47, 0xb8, 0xa8, 0x00, 0x64, 0x7a, 0x31, 0xc8, 0x61, 0x8b, 0x98, 0x98, 0xdd, 0x03, 0x9c,
- 0x56, 0x31, 0xc9, 0xb9, 0x43, 0x8c, 0x0a, 0x80, 0x2a, 0xd1, 0x0b, 0x4f, 0xcd, 0xc9, 0xf1, 0xce,
- 0xcb, 0x2f, 0xcf, 0x0b, 0x01, 0x29, 0x4d, 0x62, 0x03, 0xeb, 0x35, 0x06, 0x04, 0x00, 0x00, 0xff,
- 0xff, 0x13, 0xf8, 0xe8, 0x42, 0xdd, 0x00, 0x00, 0x00,
-}
diff --git a/vendor/github.com/golang/protobuf/ptypes/any/any.proto b/vendor/github.com/golang/protobuf/ptypes/any/any.proto
deleted file mode 100644
index 4932942..0000000
--- a/vendor/github.com/golang/protobuf/ptypes/any/any.proto
+++ /dev/null
@@ -1,154 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-syntax = "proto3";
-
-package google.protobuf;
-
-option csharp_namespace = "Google.Protobuf.WellKnownTypes";
-option go_package = "github.com/golang/protobuf/ptypes/any";
-option java_package = "com.google.protobuf";
-option java_outer_classname = "AnyProto";
-option java_multiple_files = true;
-option objc_class_prefix = "GPB";
-
-// `Any` contains an arbitrary serialized protocol buffer message along with a
-// URL that describes the type of the serialized message.
-//
-// Protobuf library provides support to pack/unpack Any values in the form
-// of utility functions or additional generated methods of the Any type.
-//
-// Example 1: Pack and unpack a message in C++.
-//
-// Foo foo = ...;
-// Any any;
-// any.PackFrom(foo);
-// ...
-// if (any.UnpackTo(&foo)) {
-// ...
-// }
-//
-// Example 2: Pack and unpack a message in Java.
-//
-// Foo foo = ...;
-// Any any = Any.pack(foo);
-// ...
-// if (any.is(Foo.class)) {
-// foo = any.unpack(Foo.class);
-// }
-//
-// Example 3: Pack and unpack a message in Python.
-//
-// foo = Foo(...)
-// any = Any()
-// any.Pack(foo)
-// ...
-// if any.Is(Foo.DESCRIPTOR):
-// any.Unpack(foo)
-// ...
-//
-// Example 4: Pack and unpack a message in Go
-//
-// foo := &pb.Foo{...}
-// any, err := ptypes.MarshalAny(foo)
-// ...
-// foo := &pb.Foo{}
-// if err := ptypes.UnmarshalAny(any, foo); err != nil {
-// ...
-// }
-//
-// The pack methods provided by protobuf library will by default use
-// 'type.googleapis.com/full.type.name' as the type URL and the unpack
-// methods only use the fully qualified type name after the last '/'
-// in the type URL, for example "foo.bar.com/x/y.z" will yield type
-// name "y.z".
-//
-//
-// JSON
-// ====
-// The JSON representation of an `Any` value uses the regular
-// representation of the deserialized, embedded message, with an
-// additional field `@type` which contains the type URL. Example:
-//
-// package google.profile;
-// message Person {
-// string first_name = 1;
-// string last_name = 2;
-// }
-//
-// {
-// "@type": "type.googleapis.com/google.profile.Person",
-// "firstName": ,
-// "lastName":
-// }
-//
-// If the embedded message type is well-known and has a custom JSON
-// representation, that representation will be embedded adding a field
-// `value` which holds the custom JSON in addition to the `@type`
-// field. Example (for message [google.protobuf.Duration][]):
-//
-// {
-// "@type": "type.googleapis.com/google.protobuf.Duration",
-// "value": "1.212s"
-// }
-//
-message Any {
- // A URL/resource name that uniquely identifies the type of the serialized
- // protocol buffer message. The last segment of the URL's path must represent
- // the fully qualified name of the type (as in
- // `path/google.protobuf.Duration`). The name should be in a canonical form
- // (e.g., leading "." is not accepted).
- //
- // In practice, teams usually precompile into the binary all types that they
- // expect it to use in the context of Any. However, for URLs which use the
- // scheme `http`, `https`, or no scheme, one can optionally set up a type
- // server that maps type URLs to message definitions as follows:
- //
- // * If no scheme is provided, `https` is assumed.
- // * An HTTP GET on the URL must yield a [google.protobuf.Type][]
- // value in binary format, or produce an error.
- // * Applications are allowed to cache lookup results based on the
- // URL, or have them precompiled into a binary to avoid any
- // lookup. Therefore, binary compatibility needs to be preserved
- // on changes to types. (Use versioned type names to manage
- // breaking changes.)
- //
- // Note: this functionality is not currently available in the official
- // protobuf release, and it is not used for type URLs beginning with
- // type.googleapis.com.
- //
- // Schemes other than `http`, `https` (or the empty scheme) might be
- // used with implementation specific semantics.
- //
- string type_url = 1;
-
- // Must be a valid serialized protocol buffer of the above specified type.
- bytes value = 2;
-}
diff --git a/vendor/github.com/golang/protobuf/ptypes/doc.go b/vendor/github.com/golang/protobuf/ptypes/doc.go
deleted file mode 100644
index c0d595d..0000000
--- a/vendor/github.com/golang/protobuf/ptypes/doc.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2016 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-/*
-Package ptypes contains code for interacting with well-known types.
-*/
-package ptypes
diff --git a/vendor/github.com/golang/protobuf/ptypes/duration.go b/vendor/github.com/golang/protobuf/ptypes/duration.go
deleted file mode 100644
index 26d1ca2..0000000
--- a/vendor/github.com/golang/protobuf/ptypes/duration.go
+++ /dev/null
@@ -1,102 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2016 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package ptypes
-
-// This file implements conversions between google.protobuf.Duration
-// and time.Duration.
-
-import (
- "errors"
- "fmt"
- "time"
-
- durpb "github.com/golang/protobuf/ptypes/duration"
-)
-
-const (
- // Range of a durpb.Duration in seconds, as specified in
- // google/protobuf/duration.proto. This is about 10,000 years in seconds.
- maxSeconds = int64(10000 * 365.25 * 24 * 60 * 60)
- minSeconds = -maxSeconds
-)
-
-// validateDuration determines whether the durpb.Duration is valid according to the
-// definition in google/protobuf/duration.proto. A valid durpb.Duration
-// may still be too large to fit into a time.Duration (the range of durpb.Duration
-// is about 10,000 years, and the range of time.Duration is about 290).
-func validateDuration(d *durpb.Duration) error {
- if d == nil {
- return errors.New("duration: nil Duration")
- }
- if d.Seconds < minSeconds || d.Seconds > maxSeconds {
- return fmt.Errorf("duration: %v: seconds out of range", d)
- }
- if d.Nanos <= -1e9 || d.Nanos >= 1e9 {
- return fmt.Errorf("duration: %v: nanos out of range", d)
- }
- // Seconds and Nanos must have the same sign, unless d.Nanos is zero.
- if (d.Seconds < 0 && d.Nanos > 0) || (d.Seconds > 0 && d.Nanos < 0) {
- return fmt.Errorf("duration: %v: seconds and nanos have different signs", d)
- }
- return nil
-}
-
-// Duration converts a durpb.Duration to a time.Duration. Duration
-// returns an error if the durpb.Duration is invalid or is too large to be
-// represented in a time.Duration.
-func Duration(p *durpb.Duration) (time.Duration, error) {
- if err := validateDuration(p); err != nil {
- return 0, err
- }
- d := time.Duration(p.Seconds) * time.Second
- if int64(d/time.Second) != p.Seconds {
- return 0, fmt.Errorf("duration: %v is out of range for time.Duration", p)
- }
- if p.Nanos != 0 {
- d += time.Duration(p.Nanos) * time.Nanosecond
- if (d < 0) != (p.Nanos < 0) {
- return 0, fmt.Errorf("duration: %v is out of range for time.Duration", p)
- }
- }
- return d, nil
-}
-
-// DurationProto converts a time.Duration to a durpb.Duration.
-func DurationProto(d time.Duration) *durpb.Duration {
- nanos := d.Nanoseconds()
- secs := nanos / 1e9
- nanos -= secs * 1e9
- return &durpb.Duration{
- Seconds: secs,
- Nanos: int32(nanos),
- }
-}
diff --git a/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go b/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go
deleted file mode 100644
index 0d681ee..0000000
--- a/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go
+++ /dev/null
@@ -1,161 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// source: google/protobuf/duration.proto
-
-package duration
-
-import (
- fmt "fmt"
- proto "github.com/golang/protobuf/proto"
- math "math"
-)
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
-// A Duration represents a signed, fixed-length span of time represented
-// as a count of seconds and fractions of seconds at nanosecond
-// resolution. It is independent of any calendar and concepts like "day"
-// or "month". It is related to Timestamp in that the difference between
-// two Timestamp values is a Duration and it can be added or subtracted
-// from a Timestamp. Range is approximately +-10,000 years.
-//
-// # Examples
-//
-// Example 1: Compute Duration from two Timestamps in pseudo code.
-//
-// Timestamp start = ...;
-// Timestamp end = ...;
-// Duration duration = ...;
-//
-// duration.seconds = end.seconds - start.seconds;
-// duration.nanos = end.nanos - start.nanos;
-//
-// if (duration.seconds < 0 && duration.nanos > 0) {
-// duration.seconds += 1;
-// duration.nanos -= 1000000000;
-// } else if (durations.seconds > 0 && duration.nanos < 0) {
-// duration.seconds -= 1;
-// duration.nanos += 1000000000;
-// }
-//
-// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
-//
-// Timestamp start = ...;
-// Duration duration = ...;
-// Timestamp end = ...;
-//
-// end.seconds = start.seconds + duration.seconds;
-// end.nanos = start.nanos + duration.nanos;
-//
-// if (end.nanos < 0) {
-// end.seconds -= 1;
-// end.nanos += 1000000000;
-// } else if (end.nanos >= 1000000000) {
-// end.seconds += 1;
-// end.nanos -= 1000000000;
-// }
-//
-// Example 3: Compute Duration from datetime.timedelta in Python.
-//
-// td = datetime.timedelta(days=3, minutes=10)
-// duration = Duration()
-// duration.FromTimedelta(td)
-//
-// # JSON Mapping
-//
-// In JSON format, the Duration type is encoded as a string rather than an
-// object, where the string ends in the suffix "s" (indicating seconds) and
-// is preceded by the number of seconds, with nanoseconds expressed as
-// fractional seconds. For example, 3 seconds with 0 nanoseconds should be
-// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
-// be expressed in JSON format as "3.000000001s", and 3 seconds and 1
-// microsecond should be expressed in JSON format as "3.000001s".
-//
-//
-type Duration struct {
- // Signed seconds of the span of time. Must be from -315,576,000,000
- // to +315,576,000,000 inclusive. Note: these bounds are computed from:
- // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
- Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"`
- // Signed fractions of a second at nanosecond resolution of the span
- // of time. Durations less than one second are represented with a 0
- // `seconds` field and a positive or negative `nanos` field. For durations
- // of one second or more, a non-zero value for the `nanos` field must be
- // of the same sign as the `seconds` field. Must be from -999,999,999
- // to +999,999,999 inclusive.
- Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *Duration) Reset() { *m = Duration{} }
-func (m *Duration) String() string { return proto.CompactTextString(m) }
-func (*Duration) ProtoMessage() {}
-func (*Duration) Descriptor() ([]byte, []int) {
- return fileDescriptor_23597b2ebd7ac6c5, []int{0}
-}
-
-func (*Duration) XXX_WellKnownType() string { return "Duration" }
-
-func (m *Duration) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_Duration.Unmarshal(m, b)
-}
-func (m *Duration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_Duration.Marshal(b, m, deterministic)
-}
-func (m *Duration) XXX_Merge(src proto.Message) {
- xxx_messageInfo_Duration.Merge(m, src)
-}
-func (m *Duration) XXX_Size() int {
- return xxx_messageInfo_Duration.Size(m)
-}
-func (m *Duration) XXX_DiscardUnknown() {
- xxx_messageInfo_Duration.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Duration proto.InternalMessageInfo
-
-func (m *Duration) GetSeconds() int64 {
- if m != nil {
- return m.Seconds
- }
- return 0
-}
-
-func (m *Duration) GetNanos() int32 {
- if m != nil {
- return m.Nanos
- }
- return 0
-}
-
-func init() {
- proto.RegisterType((*Duration)(nil), "google.protobuf.Duration")
-}
-
-func init() { proto.RegisterFile("google/protobuf/duration.proto", fileDescriptor_23597b2ebd7ac6c5) }
-
-var fileDescriptor_23597b2ebd7ac6c5 = []byte{
- // 190 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xcf, 0xcf, 0x4f,
- 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0x29, 0x2d, 0x4a,
- 0x2c, 0xc9, 0xcc, 0xcf, 0xd3, 0x03, 0x8b, 0x08, 0xf1, 0x43, 0xe4, 0xf5, 0x60, 0xf2, 0x4a, 0x56,
- 0x5c, 0x1c, 0x2e, 0x50, 0x25, 0x42, 0x12, 0x5c, 0xec, 0xc5, 0xa9, 0xc9, 0xf9, 0x79, 0x29, 0xc5,
- 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xcc, 0x41, 0x30, 0xae, 0x90, 0x08, 0x17, 0x6b, 0x5e, 0x62, 0x5e,
- 0x7e, 0xb1, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x6b, 0x10, 0x84, 0xe3, 0x54, 0xc3, 0x25, 0x9c, 0x9c,
- 0x9f, 0xab, 0x87, 0x66, 0xa4, 0x13, 0x2f, 0xcc, 0xc0, 0x00, 0x90, 0x48, 0x00, 0x63, 0x94, 0x56,
- 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x7a, 0x7e, 0x4e, 0x62, 0x5e,
- 0x3a, 0xc2, 0x7d, 0x05, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x70, 0x67, 0xfe, 0x60, 0x64, 0x5c, 0xc4,
- 0xc4, 0xec, 0x1e, 0xe0, 0xb4, 0x8a, 0x49, 0xce, 0x1d, 0x62, 0x6e, 0x00, 0x54, 0xa9, 0x5e, 0x78,
- 0x6a, 0x4e, 0x8e, 0x77, 0x5e, 0x7e, 0x79, 0x5e, 0x08, 0x48, 0x4b, 0x12, 0x1b, 0xd8, 0x0c, 0x63,
- 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x84, 0x30, 0xff, 0xf3, 0x00, 0x00, 0x00,
-}
diff --git a/vendor/github.com/golang/protobuf/ptypes/duration/duration.proto b/vendor/github.com/golang/protobuf/ptypes/duration/duration.proto
deleted file mode 100644
index 975fce4..0000000
--- a/vendor/github.com/golang/protobuf/ptypes/duration/duration.proto
+++ /dev/null
@@ -1,117 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-syntax = "proto3";
-
-package google.protobuf;
-
-option csharp_namespace = "Google.Protobuf.WellKnownTypes";
-option cc_enable_arenas = true;
-option go_package = "github.com/golang/protobuf/ptypes/duration";
-option java_package = "com.google.protobuf";
-option java_outer_classname = "DurationProto";
-option java_multiple_files = true;
-option objc_class_prefix = "GPB";
-
-// A Duration represents a signed, fixed-length span of time represented
-// as a count of seconds and fractions of seconds at nanosecond
-// resolution. It is independent of any calendar and concepts like "day"
-// or "month". It is related to Timestamp in that the difference between
-// two Timestamp values is a Duration and it can be added or subtracted
-// from a Timestamp. Range is approximately +-10,000 years.
-//
-// # Examples
-//
-// Example 1: Compute Duration from two Timestamps in pseudo code.
-//
-// Timestamp start = ...;
-// Timestamp end = ...;
-// Duration duration = ...;
-//
-// duration.seconds = end.seconds - start.seconds;
-// duration.nanos = end.nanos - start.nanos;
-//
-// if (duration.seconds < 0 && duration.nanos > 0) {
-// duration.seconds += 1;
-// duration.nanos -= 1000000000;
-// } else if (durations.seconds > 0 && duration.nanos < 0) {
-// duration.seconds -= 1;
-// duration.nanos += 1000000000;
-// }
-//
-// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
-//
-// Timestamp start = ...;
-// Duration duration = ...;
-// Timestamp end = ...;
-//
-// end.seconds = start.seconds + duration.seconds;
-// end.nanos = start.nanos + duration.nanos;
-//
-// if (end.nanos < 0) {
-// end.seconds -= 1;
-// end.nanos += 1000000000;
-// } else if (end.nanos >= 1000000000) {
-// end.seconds += 1;
-// end.nanos -= 1000000000;
-// }
-//
-// Example 3: Compute Duration from datetime.timedelta in Python.
-//
-// td = datetime.timedelta(days=3, minutes=10)
-// duration = Duration()
-// duration.FromTimedelta(td)
-//
-// # JSON Mapping
-//
-// In JSON format, the Duration type is encoded as a string rather than an
-// object, where the string ends in the suffix "s" (indicating seconds) and
-// is preceded by the number of seconds, with nanoseconds expressed as
-// fractional seconds. For example, 3 seconds with 0 nanoseconds should be
-// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
-// be expressed in JSON format as "3.000000001s", and 3 seconds and 1
-// microsecond should be expressed in JSON format as "3.000001s".
-//
-//
-message Duration {
-
- // Signed seconds of the span of time. Must be from -315,576,000,000
- // to +315,576,000,000 inclusive. Note: these bounds are computed from:
- // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
- int64 seconds = 1;
-
- // Signed fractions of a second at nanosecond resolution of the span
- // of time. Durations less than one second are represented with a 0
- // `seconds` field and a positive or negative `nanos` field. For durations
- // of one second or more, a non-zero value for the `nanos` field must be
- // of the same sign as the `seconds` field. Must be from -999,999,999
- // to +999,999,999 inclusive.
- int32 nanos = 2;
-}
diff --git a/vendor/github.com/golang/protobuf/ptypes/timestamp.go b/vendor/github.com/golang/protobuf/ptypes/timestamp.go
deleted file mode 100644
index 8da0df0..0000000
--- a/vendor/github.com/golang/protobuf/ptypes/timestamp.go
+++ /dev/null
@@ -1,132 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2016 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package ptypes
-
-// This file implements operations on google.protobuf.Timestamp.
-
-import (
- "errors"
- "fmt"
- "time"
-
- tspb "github.com/golang/protobuf/ptypes/timestamp"
-)
-
-const (
- // Seconds field of the earliest valid Timestamp.
- // This is time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC).Unix().
- minValidSeconds = -62135596800
- // Seconds field just after the latest valid Timestamp.
- // This is time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC).Unix().
- maxValidSeconds = 253402300800
-)
-
-// validateTimestamp determines whether a Timestamp is valid.
-// A valid timestamp represents a time in the range
-// [0001-01-01, 10000-01-01) and has a Nanos field
-// in the range [0, 1e9).
-//
-// If the Timestamp is valid, validateTimestamp returns nil.
-// Otherwise, it returns an error that describes
-// the problem.
-//
-// Every valid Timestamp can be represented by a time.Time, but the converse is not true.
-func validateTimestamp(ts *tspb.Timestamp) error {
- if ts == nil {
- return errors.New("timestamp: nil Timestamp")
- }
- if ts.Seconds < minValidSeconds {
- return fmt.Errorf("timestamp: %v before 0001-01-01", ts)
- }
- if ts.Seconds >= maxValidSeconds {
- return fmt.Errorf("timestamp: %v after 10000-01-01", ts)
- }
- if ts.Nanos < 0 || ts.Nanos >= 1e9 {
- return fmt.Errorf("timestamp: %v: nanos not in range [0, 1e9)", ts)
- }
- return nil
-}
-
-// Timestamp converts a google.protobuf.Timestamp proto to a time.Time.
-// It returns an error if the argument is invalid.
-//
-// Unlike most Go functions, if Timestamp returns an error, the first return value
-// is not the zero time.Time. Instead, it is the value obtained from the
-// time.Unix function when passed the contents of the Timestamp, in the UTC
-// locale. This may or may not be a meaningful time; many invalid Timestamps
-// do map to valid time.Times.
-//
-// A nil Timestamp returns an error. The first return value in that case is
-// undefined.
-func Timestamp(ts *tspb.Timestamp) (time.Time, error) {
- // Don't return the zero value on error, because corresponds to a valid
- // timestamp. Instead return whatever time.Unix gives us.
- var t time.Time
- if ts == nil {
- t = time.Unix(0, 0).UTC() // treat nil like the empty Timestamp
- } else {
- t = time.Unix(ts.Seconds, int64(ts.Nanos)).UTC()
- }
- return t, validateTimestamp(ts)
-}
-
-// TimestampNow returns a google.protobuf.Timestamp for the current time.
-func TimestampNow() *tspb.Timestamp {
- ts, err := TimestampProto(time.Now())
- if err != nil {
- panic("ptypes: time.Now() out of Timestamp range")
- }
- return ts
-}
-
-// TimestampProto converts the time.Time to a google.protobuf.Timestamp proto.
-// It returns an error if the resulting Timestamp is invalid.
-func TimestampProto(t time.Time) (*tspb.Timestamp, error) {
- ts := &tspb.Timestamp{
- Seconds: t.Unix(),
- Nanos: int32(t.Nanosecond()),
- }
- if err := validateTimestamp(ts); err != nil {
- return nil, err
- }
- return ts, nil
-}
-
-// TimestampString returns the RFC 3339 string for valid Timestamps. For invalid
-// Timestamps, it returns an error message in parentheses.
-func TimestampString(ts *tspb.Timestamp) string {
- t, err := Timestamp(ts)
- if err != nil {
- return fmt.Sprintf("(%v)", err)
- }
- return t.Format(time.RFC3339Nano)
-}
diff --git a/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go b/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go
deleted file mode 100644
index 31cd846..0000000
--- a/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go
+++ /dev/null
@@ -1,179 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// source: google/protobuf/timestamp.proto
-
-package timestamp
-
-import (
- fmt "fmt"
- proto "github.com/golang/protobuf/proto"
- math "math"
-)
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
-// A Timestamp represents a point in time independent of any time zone
-// or calendar, represented as seconds and fractions of seconds at
-// nanosecond resolution in UTC Epoch time. It is encoded using the
-// Proleptic Gregorian Calendar which extends the Gregorian calendar
-// backwards to year one. It is encoded assuming all minutes are 60
-// seconds long, i.e. leap seconds are "smeared" so that no leap second
-// table is needed for interpretation. Range is from
-// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
-// By restricting to that range, we ensure that we can convert to
-// and from RFC 3339 date strings.
-// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
-//
-// # Examples
-//
-// Example 1: Compute Timestamp from POSIX `time()`.
-//
-// Timestamp timestamp;
-// timestamp.set_seconds(time(NULL));
-// timestamp.set_nanos(0);
-//
-// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
-//
-// struct timeval tv;
-// gettimeofday(&tv, NULL);
-//
-// Timestamp timestamp;
-// timestamp.set_seconds(tv.tv_sec);
-// timestamp.set_nanos(tv.tv_usec * 1000);
-//
-// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
-//
-// FILETIME ft;
-// GetSystemTimeAsFileTime(&ft);
-// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
-//
-// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
-// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
-// Timestamp timestamp;
-// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
-// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
-//
-// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
-//
-// long millis = System.currentTimeMillis();
-//
-// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
-// .setNanos((int) ((millis % 1000) * 1000000)).build();
-//
-//
-// Example 5: Compute Timestamp from current time in Python.
-//
-// timestamp = Timestamp()
-// timestamp.GetCurrentTime()
-//
-// # JSON Mapping
-//
-// In JSON format, the Timestamp type is encoded as a string in the
-// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
-// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
-// where {year} is always expressed using four digits while {month}, {day},
-// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
-// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
-// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
-// is required. A proto3 JSON serializer should always use UTC (as indicated by
-// "Z") when printing the Timestamp type and a proto3 JSON parser should be
-// able to accept both UTC and other timezones (as indicated by an offset).
-//
-// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
-// 01:30 UTC on January 15, 2017.
-//
-// In JavaScript, one can convert a Date object to this format using the
-// standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
-// method. In Python, a standard `datetime.datetime` object can be converted
-// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
-// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
-// can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
-// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
-// ) to obtain a formatter capable of generating timestamps in this format.
-//
-//
-type Timestamp struct {
- // Represents seconds of UTC time since Unix epoch
- // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
- // 9999-12-31T23:59:59Z inclusive.
- Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"`
- // Non-negative fractions of a second at nanosecond resolution. Negative
- // second values with fractions must still have non-negative nanos values
- // that count forward in time. Must be from 0 to 999,999,999
- // inclusive.
- Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *Timestamp) Reset() { *m = Timestamp{} }
-func (m *Timestamp) String() string { return proto.CompactTextString(m) }
-func (*Timestamp) ProtoMessage() {}
-func (*Timestamp) Descriptor() ([]byte, []int) {
- return fileDescriptor_292007bbfe81227e, []int{0}
-}
-
-func (*Timestamp) XXX_WellKnownType() string { return "Timestamp" }
-
-func (m *Timestamp) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_Timestamp.Unmarshal(m, b)
-}
-func (m *Timestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_Timestamp.Marshal(b, m, deterministic)
-}
-func (m *Timestamp) XXX_Merge(src proto.Message) {
- xxx_messageInfo_Timestamp.Merge(m, src)
-}
-func (m *Timestamp) XXX_Size() int {
- return xxx_messageInfo_Timestamp.Size(m)
-}
-func (m *Timestamp) XXX_DiscardUnknown() {
- xxx_messageInfo_Timestamp.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Timestamp proto.InternalMessageInfo
-
-func (m *Timestamp) GetSeconds() int64 {
- if m != nil {
- return m.Seconds
- }
- return 0
-}
-
-func (m *Timestamp) GetNanos() int32 {
- if m != nil {
- return m.Nanos
- }
- return 0
-}
-
-func init() {
- proto.RegisterType((*Timestamp)(nil), "google.protobuf.Timestamp")
-}
-
-func init() { proto.RegisterFile("google/protobuf/timestamp.proto", fileDescriptor_292007bbfe81227e) }
-
-var fileDescriptor_292007bbfe81227e = []byte{
- // 191 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xcf, 0xcf, 0x4f,
- 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0xc9, 0xcc, 0x4d,
- 0x2d, 0x2e, 0x49, 0xcc, 0x2d, 0xd0, 0x03, 0x0b, 0x09, 0xf1, 0x43, 0x14, 0xe8, 0xc1, 0x14, 0x28,
- 0x59, 0x73, 0x71, 0x86, 0xc0, 0xd4, 0x08, 0x49, 0x70, 0xb1, 0x17, 0xa7, 0x26, 0xe7, 0xe7, 0xa5,
- 0x14, 0x4b, 0x30, 0x2a, 0x30, 0x6a, 0x30, 0x07, 0xc1, 0xb8, 0x42, 0x22, 0x5c, 0xac, 0x79, 0x89,
- 0x79, 0xf9, 0xc5, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xac, 0x41, 0x10, 0x8e, 0x53, 0x1d, 0x97, 0x70,
- 0x72, 0x7e, 0xae, 0x1e, 0x9a, 0x99, 0x4e, 0x7c, 0x70, 0x13, 0x03, 0x40, 0x42, 0x01, 0x8c, 0x51,
- 0xda, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xe9, 0xf9, 0x39, 0x89,
- 0x79, 0xe9, 0x08, 0x27, 0x16, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x23, 0x5c, 0xfa, 0x83, 0x91, 0x71,
- 0x11, 0x13, 0xb3, 0x7b, 0x80, 0xd3, 0x2a, 0x26, 0x39, 0x77, 0x88, 0xc9, 0x01, 0x50, 0xb5, 0x7a,
- 0xe1, 0xa9, 0x39, 0x39, 0xde, 0x79, 0xf9, 0xe5, 0x79, 0x21, 0x20, 0x3d, 0x49, 0x6c, 0x60, 0x43,
- 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbc, 0x77, 0x4a, 0x07, 0xf7, 0x00, 0x00, 0x00,
-}
diff --git a/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.proto b/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.proto
deleted file mode 100644
index eafb3fa..0000000
--- a/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.proto
+++ /dev/null
@@ -1,135 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-syntax = "proto3";
-
-package google.protobuf;
-
-option csharp_namespace = "Google.Protobuf.WellKnownTypes";
-option cc_enable_arenas = true;
-option go_package = "github.com/golang/protobuf/ptypes/timestamp";
-option java_package = "com.google.protobuf";
-option java_outer_classname = "TimestampProto";
-option java_multiple_files = true;
-option objc_class_prefix = "GPB";
-
-// A Timestamp represents a point in time independent of any time zone
-// or calendar, represented as seconds and fractions of seconds at
-// nanosecond resolution in UTC Epoch time. It is encoded using the
-// Proleptic Gregorian Calendar which extends the Gregorian calendar
-// backwards to year one. It is encoded assuming all minutes are 60
-// seconds long, i.e. leap seconds are "smeared" so that no leap second
-// table is needed for interpretation. Range is from
-// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
-// By restricting to that range, we ensure that we can convert to
-// and from RFC 3339 date strings.
-// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
-//
-// # Examples
-//
-// Example 1: Compute Timestamp from POSIX `time()`.
-//
-// Timestamp timestamp;
-// timestamp.set_seconds(time(NULL));
-// timestamp.set_nanos(0);
-//
-// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
-//
-// struct timeval tv;
-// gettimeofday(&tv, NULL);
-//
-// Timestamp timestamp;
-// timestamp.set_seconds(tv.tv_sec);
-// timestamp.set_nanos(tv.tv_usec * 1000);
-//
-// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
-//
-// FILETIME ft;
-// GetSystemTimeAsFileTime(&ft);
-// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
-//
-// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
-// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
-// Timestamp timestamp;
-// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
-// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
-//
-// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
-//
-// long millis = System.currentTimeMillis();
-//
-// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
-// .setNanos((int) ((millis % 1000) * 1000000)).build();
-//
-//
-// Example 5: Compute Timestamp from current time in Python.
-//
-// timestamp = Timestamp()
-// timestamp.GetCurrentTime()
-//
-// # JSON Mapping
-//
-// In JSON format, the Timestamp type is encoded as a string in the
-// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
-// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
-// where {year} is always expressed using four digits while {month}, {day},
-// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
-// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
-// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
-// is required. A proto3 JSON serializer should always use UTC (as indicated by
-// "Z") when printing the Timestamp type and a proto3 JSON parser should be
-// able to accept both UTC and other timezones (as indicated by an offset).
-//
-// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
-// 01:30 UTC on January 15, 2017.
-//
-// In JavaScript, one can convert a Date object to this format using the
-// standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
-// method. In Python, a standard `datetime.datetime` object can be converted
-// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
-// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
-// can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
-// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
-// ) to obtain a formatter capable of generating timestamps in this format.
-//
-//
-message Timestamp {
-
- // Represents seconds of UTC time since Unix epoch
- // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
- // 9999-12-31T23:59:59Z inclusive.
- int64 seconds = 1;
-
- // Non-negative fractions of a second at nanosecond resolution. Negative
- // second values with fractions must still have non-negative nanos values
- // that count forward in time. Must be from 0 to 999,999,999
- // inclusive.
- int32 nanos = 2;
-}
diff --git a/vendor/github.com/konsorten/go-windows-terminal-sequences/LICENSE b/vendor/github.com/konsorten/go-windows-terminal-sequences/LICENSE
deleted file mode 100644
index 14127cd..0000000
--- a/vendor/github.com/konsorten/go-windows-terminal-sequences/LICENSE
+++ /dev/null
@@ -1,9 +0,0 @@
-(The MIT License)
-
-Copyright (c) 2017 marvin + konsorten GmbH (open-source@konsorten.de)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/github.com/konsorten/go-windows-terminal-sequences/README.md b/vendor/github.com/konsorten/go-windows-terminal-sequences/README.md
deleted file mode 100644
index 949b77e..0000000
--- a/vendor/github.com/konsorten/go-windows-terminal-sequences/README.md
+++ /dev/null
@@ -1,40 +0,0 @@
-# Windows Terminal Sequences
-
-This library allow for enabling Windows terminal color support for Go.
-
-See [Console Virtual Terminal Sequences](https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences) for details.
-
-## Usage
-
-```go
-import (
- "syscall"
-
- sequences "github.com/konsorten/go-windows-terminal-sequences"
-)
-
-func main() {
- sequences.EnableVirtualTerminalProcessing(syscall.Stdout, true)
-}
-
-```
-
-## Authors
-
-The tool is sponsored by the [marvin + konsorten GmbH](http://www.konsorten.de).
-
-We thank all the authors who provided code to this library:
-
-* Felix Kollmann
-
-## License
-
-(The MIT License)
-
-Copyright (c) 2018 marvin + konsorten GmbH (open-source@konsorten.de)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/github.com/konsorten/go-windows-terminal-sequences/go.mod b/vendor/github.com/konsorten/go-windows-terminal-sequences/go.mod
deleted file mode 100644
index 716c613..0000000
--- a/vendor/github.com/konsorten/go-windows-terminal-sequences/go.mod
+++ /dev/null
@@ -1 +0,0 @@
-module github.com/konsorten/go-windows-terminal-sequences
diff --git a/vendor/github.com/konsorten/go-windows-terminal-sequences/sequences.go b/vendor/github.com/konsorten/go-windows-terminal-sequences/sequences.go
deleted file mode 100644
index ef18d8f..0000000
--- a/vendor/github.com/konsorten/go-windows-terminal-sequences/sequences.go
+++ /dev/null
@@ -1,36 +0,0 @@
-// +build windows
-
-package sequences
-
-import (
- "syscall"
- "unsafe"
-)
-
-var (
- kernel32Dll *syscall.LazyDLL = syscall.NewLazyDLL("Kernel32.dll")
- setConsoleMode *syscall.LazyProc = kernel32Dll.NewProc("SetConsoleMode")
-)
-
-func EnableVirtualTerminalProcessing(stream syscall.Handle, enable bool) error {
- const ENABLE_VIRTUAL_TERMINAL_PROCESSING uint32 = 0x4
-
- var mode uint32
- err := syscall.GetConsoleMode(syscall.Stdout, &mode)
- if err != nil {
- return err
- }
-
- if enable {
- mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING
- } else {
- mode &^= ENABLE_VIRTUAL_TERMINAL_PROCESSING
- }
-
- ret, _, err := setConsoleMode.Call(uintptr(unsafe.Pointer(stream)), uintptr(mode))
- if ret == 0 {
- return err
- }
-
- return nil
-}
diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/LICENSE b/vendor/github.com/matttproud/golang_protobuf_extensions/LICENSE
deleted file mode 100644
index 8dada3e..0000000
--- a/vendor/github.com/matttproud/golang_protobuf_extensions/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright {yyyy} {name of copyright owner}
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/NOTICE b/vendor/github.com/matttproud/golang_protobuf_extensions/NOTICE
deleted file mode 100644
index 5d8cb5b..0000000
--- a/vendor/github.com/matttproud/golang_protobuf_extensions/NOTICE
+++ /dev/null
@@ -1 +0,0 @@
-Copyright 2012 Matt T. Proud (matt.proud@gmail.com)
diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/.gitignore b/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/.gitignore
deleted file mode 100644
index e16fb94..0000000
--- a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-cover.dat
diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/Makefile b/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/Makefile
deleted file mode 100644
index 81be214..0000000
--- a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-all:
-
-cover:
- go test -cover -v -coverprofile=cover.dat ./...
- go tool cover -func cover.dat
-
-.PHONY: cover
diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode.go b/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode.go
deleted file mode 100644
index 258c063..0000000
--- a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode.go
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright 2013 Matt T. Proud
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package pbutil
-
-import (
- "encoding/binary"
- "errors"
- "io"
-
- "github.com/golang/protobuf/proto"
-)
-
-var errInvalidVarint = errors.New("invalid varint32 encountered")
-
-// ReadDelimited decodes a message from the provided length-delimited stream,
-// where the length is encoded as 32-bit varint prefix to the message body.
-// It returns the total number of bytes read and any applicable error. This is
-// roughly equivalent to the companion Java API's
-// MessageLite#parseDelimitedFrom. As per the reader contract, this function
-// calls r.Read repeatedly as required until exactly one message including its
-// prefix is read and decoded (or an error has occurred). The function never
-// reads more bytes from the stream than required. The function never returns
-// an error if a message has been read and decoded correctly, even if the end
-// of the stream has been reached in doing so. In that case, any subsequent
-// calls return (0, io.EOF).
-func ReadDelimited(r io.Reader, m proto.Message) (n int, err error) {
- // Per AbstractParser#parsePartialDelimitedFrom with
- // CodedInputStream#readRawVarint32.
- var headerBuf [binary.MaxVarintLen32]byte
- var bytesRead, varIntBytes int
- var messageLength uint64
- for varIntBytes == 0 { // i.e. no varint has been decoded yet.
- if bytesRead >= len(headerBuf) {
- return bytesRead, errInvalidVarint
- }
- // We have to read byte by byte here to avoid reading more bytes
- // than required. Each read byte is appended to what we have
- // read before.
- newBytesRead, err := r.Read(headerBuf[bytesRead : bytesRead+1])
- if newBytesRead == 0 {
- if err != nil {
- return bytesRead, err
- }
- // A Reader should not return (0, nil), but if it does,
- // it should be treated as no-op (according to the
- // Reader contract). So let's go on...
- continue
- }
- bytesRead += newBytesRead
- // Now present everything read so far to the varint decoder and
- // see if a varint can be decoded already.
- messageLength, varIntBytes = proto.DecodeVarint(headerBuf[:bytesRead])
- }
-
- messageBuf := make([]byte, messageLength)
- newBytesRead, err := io.ReadFull(r, messageBuf)
- bytesRead += newBytesRead
- if err != nil {
- return bytesRead, err
- }
-
- return bytesRead, proto.Unmarshal(messageBuf, m)
-}
diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/doc.go b/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/doc.go
deleted file mode 100644
index c318385..0000000
--- a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/doc.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2013 Matt T. Proud
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package pbutil provides record length-delimited Protocol Buffer streaming.
-package pbutil
diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode.go b/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode.go
deleted file mode 100644
index 8fb59ad..0000000
--- a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2013 Matt T. Proud
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package pbutil
-
-import (
- "encoding/binary"
- "io"
-
- "github.com/golang/protobuf/proto"
-)
-
-// WriteDelimited encodes and dumps a message to the provided writer prefixed
-// with a 32-bit varint indicating the length of the encoded message, producing
-// a length-delimited record stream, which can be used to chain together
-// encoded messages of the same type together in a file. It returns the total
-// number of bytes written and any applicable error. This is roughly
-// equivalent to the companion Java API's MessageLite#writeDelimitedTo.
-func WriteDelimited(w io.Writer, m proto.Message) (n int, err error) {
- buffer, err := proto.Marshal(m)
- if err != nil {
- return 0, err
- }
-
- var buf [binary.MaxVarintLen32]byte
- encodedLength := binary.PutUvarint(buf[:], uint64(len(buffer)))
-
- sync, err := w.Write(buf[:encodedLength])
- if err != nil {
- return sync, err
- }
-
- n, err = w.Write(buffer)
- return n + sync, err
-}
diff --git a/vendor/github.com/prometheus/client_golang/LICENSE b/vendor/github.com/prometheus/client_golang/LICENSE
deleted file mode 100644
index 261eeb9..0000000
--- a/vendor/github.com/prometheus/client_golang/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/vendor/github.com/prometheus/client_golang/NOTICE b/vendor/github.com/prometheus/client_golang/NOTICE
deleted file mode 100644
index dd878a3..0000000
--- a/vendor/github.com/prometheus/client_golang/NOTICE
+++ /dev/null
@@ -1,23 +0,0 @@
-Prometheus instrumentation library for Go applications
-Copyright 2012-2015 The Prometheus Authors
-
-This product includes software developed at
-SoundCloud Ltd. (http://soundcloud.com/).
-
-
-The following components are included in this product:
-
-perks - a fork of https://github.com/bmizerany/perks
-https://github.com/beorn7/perks
-Copyright 2013-2015 Blake Mizerany, Björn Rabenstein
-See https://github.com/beorn7/perks/blob/master/README.md for license details.
-
-Go support for Protocol Buffers - Google's data interchange format
-http://github.com/golang/protobuf/
-Copyright 2010 The Go Authors
-See source code for license details.
-
-Support for streaming Protocol Buffer messages for the Go language (golang).
-https://github.com/matttproud/golang_protobuf_extensions
-Copyright 2013 Matt T. Proud
-Licensed under the Apache License, Version 2.0
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/.gitignore b/vendor/github.com/prometheus/client_golang/prometheus/.gitignore
deleted file mode 100644
index 3460f03..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-command-line-arguments.test
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/README.md b/vendor/github.com/prometheus/client_golang/prometheus/README.md
deleted file mode 100644
index 44986bf..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/README.md
+++ /dev/null
@@ -1 +0,0 @@
-See [![go-doc](https://godoc.org/github.com/prometheus/client_golang/prometheus?status.svg)](https://godoc.org/github.com/prometheus/client_golang/prometheus).
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/build_info.go b/vendor/github.com/prometheus/client_golang/prometheus/build_info.go
deleted file mode 100644
index 288f0e8..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/build_info.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build go1.12
-
-package prometheus
-
-import "runtime/debug"
-
-// readBuildInfo is a wrapper around debug.ReadBuildInfo for Go 1.12+.
-func readBuildInfo() (path, version, sum string) {
- path, version, sum = "unknown", "unknown", "unknown"
- if bi, ok := debug.ReadBuildInfo(); ok {
- path = bi.Main.Path
- version = bi.Main.Version
- sum = bi.Main.Sum
- }
- return
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/build_info_pre_1.12.go b/vendor/github.com/prometheus/client_golang/prometheus/build_info_pre_1.12.go
deleted file mode 100644
index 6609e28..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/build_info_pre_1.12.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build !go1.12
-
-package prometheus
-
-// readBuildInfo is a wrapper around debug.ReadBuildInfo for Go versions before
-// 1.12. Remove this whole file once the minimum supported Go version is 1.12.
-func readBuildInfo() (path, version, sum string) {
- return "unknown", "unknown", "unknown"
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/collector.go b/vendor/github.com/prometheus/client_golang/prometheus/collector.go
deleted file mode 100644
index 1e83965..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/collector.go
+++ /dev/null
@@ -1,120 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-// Collector is the interface implemented by anything that can be used by
-// Prometheus to collect metrics. A Collector has to be registered for
-// collection. See Registerer.Register.
-//
-// The stock metrics provided by this package (Gauge, Counter, Summary,
-// Histogram, Untyped) are also Collectors (which only ever collect one metric,
-// namely itself). An implementer of Collector may, however, collect multiple
-// metrics in a coordinated fashion and/or create metrics on the fly. Examples
-// for collectors already implemented in this library are the metric vectors
-// (i.e. collection of multiple instances of the same Metric but with different
-// label values) like GaugeVec or SummaryVec, and the ExpvarCollector.
-type Collector interface {
- // Describe sends the super-set of all possible descriptors of metrics
- // collected by this Collector to the provided channel and returns once
- // the last descriptor has been sent. The sent descriptors fulfill the
- // consistency and uniqueness requirements described in the Desc
- // documentation.
- //
- // It is valid if one and the same Collector sends duplicate
- // descriptors. Those duplicates are simply ignored. However, two
- // different Collectors must not send duplicate descriptors.
- //
- // Sending no descriptor at all marks the Collector as “unchecked”,
- // i.e. no checks will be performed at registration time, and the
- // Collector may yield any Metric it sees fit in its Collect method.
- //
- // This method idempotently sends the same descriptors throughout the
- // lifetime of the Collector. It may be called concurrently and
- // therefore must be implemented in a concurrency safe way.
- //
- // If a Collector encounters an error while executing this method, it
- // must send an invalid descriptor (created with NewInvalidDesc) to
- // signal the error to the registry.
- Describe(chan<- *Desc)
- // Collect is called by the Prometheus registry when collecting
- // metrics. The implementation sends each collected metric via the
- // provided channel and returns once the last metric has been sent. The
- // descriptor of each sent metric is one of those returned by Describe
- // (unless the Collector is unchecked, see above). Returned metrics that
- // share the same descriptor must differ in their variable label
- // values.
- //
- // This method may be called concurrently and must therefore be
- // implemented in a concurrency safe way. Blocking occurs at the expense
- // of total performance of rendering all registered metrics. Ideally,
- // Collector implementations support concurrent readers.
- Collect(chan<- Metric)
-}
-
-// DescribeByCollect is a helper to implement the Describe method of a custom
-// Collector. It collects the metrics from the provided Collector and sends
-// their descriptors to the provided channel.
-//
-// If a Collector collects the same metrics throughout its lifetime, its
-// Describe method can simply be implemented as:
-//
-// func (c customCollector) Describe(ch chan<- *Desc) {
-// DescribeByCollect(c, ch)
-// }
-//
-// However, this will not work if the metrics collected change dynamically over
-// the lifetime of the Collector in a way that their combined set of descriptors
-// changes as well. The shortcut implementation will then violate the contract
-// of the Describe method. If a Collector sometimes collects no metrics at all
-// (for example vectors like CounterVec, GaugeVec, etc., which only collect
-// metrics after a metric with a fully specified label set has been accessed),
-// it might even get registered as an unchecked Collector (cf. the Register
-// method of the Registerer interface). Hence, only use this shortcut
-// implementation of Describe if you are certain to fulfill the contract.
-//
-// The Collector example demonstrates a use of DescribeByCollect.
-func DescribeByCollect(c Collector, descs chan<- *Desc) {
- metrics := make(chan Metric)
- go func() {
- c.Collect(metrics)
- close(metrics)
- }()
- for m := range metrics {
- descs <- m.Desc()
- }
-}
-
-// selfCollector implements Collector for a single Metric so that the Metric
-// collects itself. Add it as an anonymous field to a struct that implements
-// Metric, and call init with the Metric itself as an argument.
-type selfCollector struct {
- self Metric
-}
-
-// init provides the selfCollector with a reference to the metric it is supposed
-// to collect. It is usually called within the factory function to create a
-// metric. See example.
-func (c *selfCollector) init(self Metric) {
- c.self = self
-}
-
-// Describe implements Collector.
-func (c *selfCollector) Describe(ch chan<- *Desc) {
- ch <- c.self.Desc()
-}
-
-// Collect implements Collector.
-func (c *selfCollector) Collect(ch chan<- Metric) {
- ch <- c.self
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/counter.go b/vendor/github.com/prometheus/client_golang/prometheus/counter.go
deleted file mode 100644
index df72fcf..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/counter.go
+++ /dev/null
@@ -1,319 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "errors"
- "math"
- "sync/atomic"
- "time"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-// Counter is a Metric that represents a single numerical value that only ever
-// goes up. That implies that it cannot be used to count items whose number can
-// also go down, e.g. the number of currently running goroutines. Those
-// "counters" are represented by Gauges.
-//
-// A Counter is typically used to count requests served, tasks completed, errors
-// occurred, etc.
-//
-// To create Counter instances, use NewCounter.
-type Counter interface {
- Metric
- Collector
-
- // Inc increments the counter by 1. Use Add to increment it by arbitrary
- // non-negative values.
- Inc()
- // Add adds the given value to the counter. It panics if the value is <
- // 0.
- Add(float64)
-}
-
-// ExemplarAdder is implemented by Counters that offer the option of adding a
-// value to the Counter together with an exemplar. Its AddWithExemplar method
-// works like the Add method of the Counter interface but also replaces the
-// currently saved exemplar (if any) with a new one, created from the provided
-// value, the current time as timestamp, and the provided labels. Empty Labels
-// will lead to a valid (label-less) exemplar. But if Labels is nil, the current
-// exemplar is left in place. AddWithExemplar panics if the value is < 0, if any
-// of the provided labels are invalid, or if the provided labels contain more
-// than 64 runes in total.
-type ExemplarAdder interface {
- AddWithExemplar(value float64, exemplar Labels)
-}
-
-// CounterOpts is an alias for Opts. See there for doc comments.
-type CounterOpts Opts
-
-// NewCounter creates a new Counter based on the provided CounterOpts.
-//
-// The returned implementation also implements ExemplarAdder. It is safe to
-// perform the corresponding type assertion.
-//
-// The returned implementation tracks the counter value in two separate
-// variables, a float64 and a uint64. The latter is used to track calls of the
-// Inc method and calls of the Add method with a value that can be represented
-// as a uint64. This allows atomic increments of the counter with optimal
-// performance. (It is common to have an Inc call in very hot execution paths.)
-// Both internal tracking values are added up in the Write method. This has to
-// be taken into account when it comes to precision and overflow behavior.
-func NewCounter(opts CounterOpts) Counter {
- desc := NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- nil,
- opts.ConstLabels,
- )
- result := &counter{desc: desc, labelPairs: desc.constLabelPairs, now: time.Now}
- result.init(result) // Init self-collection.
- return result
-}
-
-type counter struct {
- // valBits contains the bits of the represented float64 value, while
- // valInt stores values that are exact integers. Both have to go first
- // in the struct to guarantee alignment for atomic operations.
- // http://golang.org/pkg/sync/atomic/#pkg-note-BUG
- valBits uint64
- valInt uint64
-
- selfCollector
- desc *Desc
-
- labelPairs []*dto.LabelPair
- exemplar atomic.Value // Containing nil or a *dto.Exemplar.
-
- now func() time.Time // To mock out time.Now() for testing.
-}
-
-func (c *counter) Desc() *Desc {
- return c.desc
-}
-
-func (c *counter) Add(v float64) {
- if v < 0 {
- panic(errors.New("counter cannot decrease in value"))
- }
-
- ival := uint64(v)
- if float64(ival) == v {
- atomic.AddUint64(&c.valInt, ival)
- return
- }
-
- for {
- oldBits := atomic.LoadUint64(&c.valBits)
- newBits := math.Float64bits(math.Float64frombits(oldBits) + v)
- if atomic.CompareAndSwapUint64(&c.valBits, oldBits, newBits) {
- return
- }
- }
-}
-
-func (c *counter) AddWithExemplar(v float64, e Labels) {
- c.Add(v)
- c.updateExemplar(v, e)
-}
-
-func (c *counter) Inc() {
- atomic.AddUint64(&c.valInt, 1)
-}
-
-func (c *counter) Write(out *dto.Metric) error {
- fval := math.Float64frombits(atomic.LoadUint64(&c.valBits))
- ival := atomic.LoadUint64(&c.valInt)
- val := fval + float64(ival)
-
- var exemplar *dto.Exemplar
- if e := c.exemplar.Load(); e != nil {
- exemplar = e.(*dto.Exemplar)
- }
-
- return populateMetric(CounterValue, val, c.labelPairs, exemplar, out)
-}
-
-func (c *counter) updateExemplar(v float64, l Labels) {
- if l == nil {
- return
- }
- e, err := newExemplar(v, c.now(), l)
- if err != nil {
- panic(err)
- }
- c.exemplar.Store(e)
-}
-
-// CounterVec is a Collector that bundles a set of Counters that all share the
-// same Desc, but have different values for their variable labels. This is used
-// if you want to count the same thing partitioned by various dimensions
-// (e.g. number of HTTP requests, partitioned by response code and
-// method). Create instances with NewCounterVec.
-type CounterVec struct {
- *metricVec
-}
-
-// NewCounterVec creates a new CounterVec based on the provided CounterOpts and
-// partitioned by the given label names.
-func NewCounterVec(opts CounterOpts, labelNames []string) *CounterVec {
- desc := NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- labelNames,
- opts.ConstLabels,
- )
- return &CounterVec{
- metricVec: newMetricVec(desc, func(lvs ...string) Metric {
- if len(lvs) != len(desc.variableLabels) {
- panic(makeInconsistentCardinalityError(desc.fqName, desc.variableLabels, lvs))
- }
- result := &counter{desc: desc, labelPairs: makeLabelPairs(desc, lvs), now: time.Now}
- result.init(result) // Init self-collection.
- return result
- }),
- }
-}
-
-// GetMetricWithLabelValues returns the Counter for the given slice of label
-// values (same order as the VariableLabels in Desc). If that combination of
-// label values is accessed for the first time, a new Counter is created.
-//
-// It is possible to call this method without using the returned Counter to only
-// create the new Counter but leave it at its starting value 0. See also the
-// SummaryVec example.
-//
-// Keeping the Counter for later use is possible (and should be considered if
-// performance is critical), but keep in mind that Reset, DeleteLabelValues and
-// Delete can be used to delete the Counter from the CounterVec. In that case,
-// the Counter will still exist, but it will not be exported anymore, even if a
-// Counter with the same label values is created later.
-//
-// An error is returned if the number of label values is not the same as the
-// number of VariableLabels in Desc (minus any curried labels).
-//
-// Note that for more than one label value, this method is prone to mistakes
-// caused by an incorrect order of arguments. Consider GetMetricWith(Labels) as
-// an alternative to avoid that type of mistake. For higher label numbers, the
-// latter has a much more readable (albeit more verbose) syntax, but it comes
-// with a performance overhead (for creating and processing the Labels map).
-// See also the GaugeVec example.
-func (v *CounterVec) GetMetricWithLabelValues(lvs ...string) (Counter, error) {
- metric, err := v.metricVec.getMetricWithLabelValues(lvs...)
- if metric != nil {
- return metric.(Counter), err
- }
- return nil, err
-}
-
-// GetMetricWith returns the Counter for the given Labels map (the label names
-// must match those of the VariableLabels in Desc). If that label map is
-// accessed for the first time, a new Counter is created. Implications of
-// creating a Counter without using it and keeping the Counter for later use are
-// the same as for GetMetricWithLabelValues.
-//
-// An error is returned if the number and names of the Labels are inconsistent
-// with those of the VariableLabels in Desc (minus any curried labels).
-//
-// This method is used for the same purpose as
-// GetMetricWithLabelValues(...string). See there for pros and cons of the two
-// methods.
-func (v *CounterVec) GetMetricWith(labels Labels) (Counter, error) {
- metric, err := v.metricVec.getMetricWith(labels)
- if metric != nil {
- return metric.(Counter), err
- }
- return nil, err
-}
-
-// WithLabelValues works as GetMetricWithLabelValues, but panics where
-// GetMetricWithLabelValues would have returned an error. Not returning an
-// error allows shortcuts like
-// myVec.WithLabelValues("404", "GET").Add(42)
-func (v *CounterVec) WithLabelValues(lvs ...string) Counter {
- c, err := v.GetMetricWithLabelValues(lvs...)
- if err != nil {
- panic(err)
- }
- return c
-}
-
-// With works as GetMetricWith, but panics where GetMetricWithLabels would have
-// returned an error. Not returning an error allows shortcuts like
-// myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Add(42)
-func (v *CounterVec) With(labels Labels) Counter {
- c, err := v.GetMetricWith(labels)
- if err != nil {
- panic(err)
- }
- return c
-}
-
-// CurryWith returns a vector curried with the provided labels, i.e. the
-// returned vector has those labels pre-set for all labeled operations performed
-// on it. The cardinality of the curried vector is reduced accordingly. The
-// order of the remaining labels stays the same (just with the curried labels
-// taken out of the sequence – which is relevant for the
-// (GetMetric)WithLabelValues methods). It is possible to curry a curried
-// vector, but only with labels not yet used for currying before.
-//
-// The metrics contained in the CounterVec are shared between the curried and
-// uncurried vectors. They are just accessed differently. Curried and uncurried
-// vectors behave identically in terms of collection. Only one must be
-// registered with a given registry (usually the uncurried version). The Reset
-// method deletes all metrics, even if called on a curried vector.
-func (v *CounterVec) CurryWith(labels Labels) (*CounterVec, error) {
- vec, err := v.curryWith(labels)
- if vec != nil {
- return &CounterVec{vec}, err
- }
- return nil, err
-}
-
-// MustCurryWith works as CurryWith but panics where CurryWith would have
-// returned an error.
-func (v *CounterVec) MustCurryWith(labels Labels) *CounterVec {
- vec, err := v.CurryWith(labels)
- if err != nil {
- panic(err)
- }
- return vec
-}
-
-// CounterFunc is a Counter whose value is determined at collect time by calling a
-// provided function.
-//
-// To create CounterFunc instances, use NewCounterFunc.
-type CounterFunc interface {
- Metric
- Collector
-}
-
-// NewCounterFunc creates a new CounterFunc based on the provided
-// CounterOpts. The value reported is determined by calling the given function
-// from within the Write method. Take into account that metric collection may
-// happen concurrently. If that results in concurrent calls to Write, like in
-// the case where a CounterFunc is directly registered with Prometheus, the
-// provided function must be concurrency-safe. The function should also honor
-// the contract for a Counter (values only go up, not down), but compliance will
-// not be checked.
-func NewCounterFunc(opts CounterOpts, function func() float64) CounterFunc {
- return newValueFunc(NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- nil,
- opts.ConstLabels,
- ), CounterValue, function)
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/desc.go b/vendor/github.com/prometheus/client_golang/prometheus/desc.go
deleted file mode 100644
index e3232d7..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/desc.go
+++ /dev/null
@@ -1,185 +0,0 @@
-// Copyright 2016 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "errors"
- "fmt"
- "sort"
- "strings"
-
- "github.com/cespare/xxhash/v2"
- "github.com/golang/protobuf/proto"
- "github.com/prometheus/common/model"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-// Desc is the descriptor used by every Prometheus Metric. It is essentially
-// the immutable meta-data of a Metric. The normal Metric implementations
-// included in this package manage their Desc under the hood. Users only have to
-// deal with Desc if they use advanced features like the ExpvarCollector or
-// custom Collectors and Metrics.
-//
-// Descriptors registered with the same registry have to fulfill certain
-// consistency and uniqueness criteria if they share the same fully-qualified
-// name: They must have the same help string and the same label names (aka label
-// dimensions) in each, constLabels and variableLabels, but they must differ in
-// the values of the constLabels.
-//
-// Descriptors that share the same fully-qualified names and the same label
-// values of their constLabels are considered equal.
-//
-// Use NewDesc to create new Desc instances.
-type Desc struct {
- // fqName has been built from Namespace, Subsystem, and Name.
- fqName string
- // help provides some helpful information about this metric.
- help string
- // constLabelPairs contains precalculated DTO label pairs based on
- // the constant labels.
- constLabelPairs []*dto.LabelPair
- // VariableLabels contains names of labels for which the metric
- // maintains variable values.
- variableLabels []string
- // id is a hash of the values of the ConstLabels and fqName. This
- // must be unique among all registered descriptors and can therefore be
- // used as an identifier of the descriptor.
- id uint64
- // dimHash is a hash of the label names (preset and variable) and the
- // Help string. Each Desc with the same fqName must have the same
- // dimHash.
- dimHash uint64
- // err is an error that occurred during construction. It is reported on
- // registration time.
- err error
-}
-
-// NewDesc allocates and initializes a new Desc. Errors are recorded in the Desc
-// and will be reported on registration time. variableLabels and constLabels can
-// be nil if no such labels should be set. fqName must not be empty.
-//
-// variableLabels only contain the label names. Their label values are variable
-// and therefore not part of the Desc. (They are managed within the Metric.)
-//
-// For constLabels, the label values are constant. Therefore, they are fully
-// specified in the Desc. See the Collector example for a usage pattern.
-func NewDesc(fqName, help string, variableLabels []string, constLabels Labels) *Desc {
- d := &Desc{
- fqName: fqName,
- help: help,
- variableLabels: variableLabels,
- }
- if !model.IsValidMetricName(model.LabelValue(fqName)) {
- d.err = fmt.Errorf("%q is not a valid metric name", fqName)
- return d
- }
- // labelValues contains the label values of const labels (in order of
- // their sorted label names) plus the fqName (at position 0).
- labelValues := make([]string, 1, len(constLabels)+1)
- labelValues[0] = fqName
- labelNames := make([]string, 0, len(constLabels)+len(variableLabels))
- labelNameSet := map[string]struct{}{}
- // First add only the const label names and sort them...
- for labelName := range constLabels {
- if !checkLabelName(labelName) {
- d.err = fmt.Errorf("%q is not a valid label name for metric %q", labelName, fqName)
- return d
- }
- labelNames = append(labelNames, labelName)
- labelNameSet[labelName] = struct{}{}
- }
- sort.Strings(labelNames)
- // ... so that we can now add const label values in the order of their names.
- for _, labelName := range labelNames {
- labelValues = append(labelValues, constLabels[labelName])
- }
- // Validate the const label values. They can't have a wrong cardinality, so
- // use in len(labelValues) as expectedNumberOfValues.
- if err := validateLabelValues(labelValues, len(labelValues)); err != nil {
- d.err = err
- return d
- }
- // Now add the variable label names, but prefix them with something that
- // cannot be in a regular label name. That prevents matching the label
- // dimension with a different mix between preset and variable labels.
- for _, labelName := range variableLabels {
- if !checkLabelName(labelName) {
- d.err = fmt.Errorf("%q is not a valid label name for metric %q", labelName, fqName)
- return d
- }
- labelNames = append(labelNames, "$"+labelName)
- labelNameSet[labelName] = struct{}{}
- }
- if len(labelNames) != len(labelNameSet) {
- d.err = errors.New("duplicate label names")
- return d
- }
-
- xxh := xxhash.New()
- for _, val := range labelValues {
- xxh.WriteString(val)
- xxh.Write(separatorByteSlice)
- }
- d.id = xxh.Sum64()
- // Sort labelNames so that order doesn't matter for the hash.
- sort.Strings(labelNames)
- // Now hash together (in this order) the help string and the sorted
- // label names.
- xxh.Reset()
- xxh.WriteString(help)
- xxh.Write(separatorByteSlice)
- for _, labelName := range labelNames {
- xxh.WriteString(labelName)
- xxh.Write(separatorByteSlice)
- }
- d.dimHash = xxh.Sum64()
-
- d.constLabelPairs = make([]*dto.LabelPair, 0, len(constLabels))
- for n, v := range constLabels {
- d.constLabelPairs = append(d.constLabelPairs, &dto.LabelPair{
- Name: proto.String(n),
- Value: proto.String(v),
- })
- }
- sort.Sort(labelPairSorter(d.constLabelPairs))
- return d
-}
-
-// NewInvalidDesc returns an invalid descriptor, i.e. a descriptor with the
-// provided error set. If a collector returning such a descriptor is registered,
-// registration will fail with the provided error. NewInvalidDesc can be used by
-// a Collector to signal inability to describe itself.
-func NewInvalidDesc(err error) *Desc {
- return &Desc{
- err: err,
- }
-}
-
-func (d *Desc) String() string {
- lpStrings := make([]string, 0, len(d.constLabelPairs))
- for _, lp := range d.constLabelPairs {
- lpStrings = append(
- lpStrings,
- fmt.Sprintf("%s=%q", lp.GetName(), lp.GetValue()),
- )
- }
- return fmt.Sprintf(
- "Desc{fqName: %q, help: %q, constLabels: {%s}, variableLabels: %v}",
- d.fqName,
- d.help,
- strings.Join(lpStrings, ","),
- d.variableLabels,
- )
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/doc.go b/vendor/github.com/prometheus/client_golang/prometheus/doc.go
deleted file mode 100644
index 9845012..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/doc.go
+++ /dev/null
@@ -1,199 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package prometheus is the core instrumentation package. It provides metrics
-// primitives to instrument code for monitoring. It also offers a registry for
-// metrics. Sub-packages allow to expose the registered metrics via HTTP
-// (package promhttp) or push them to a Pushgateway (package push). There is
-// also a sub-package promauto, which provides metrics constructors with
-// automatic registration.
-//
-// All exported functions and methods are safe to be used concurrently unless
-// specified otherwise.
-//
-// A Basic Example
-//
-// As a starting point, a very basic usage example:
-//
-// package main
-//
-// import (
-// "log"
-// "net/http"
-//
-// "github.com/prometheus/client_golang/prometheus"
-// "github.com/prometheus/client_golang/prometheus/promhttp"
-// )
-//
-// var (
-// cpuTemp = prometheus.NewGauge(prometheus.GaugeOpts{
-// Name: "cpu_temperature_celsius",
-// Help: "Current temperature of the CPU.",
-// })
-// hdFailures = prometheus.NewCounterVec(
-// prometheus.CounterOpts{
-// Name: "hd_errors_total",
-// Help: "Number of hard-disk errors.",
-// },
-// []string{"device"},
-// )
-// )
-//
-// func init() {
-// // Metrics have to be registered to be exposed:
-// prometheus.MustRegister(cpuTemp)
-// prometheus.MustRegister(hdFailures)
-// }
-//
-// func main() {
-// cpuTemp.Set(65.3)
-// hdFailures.With(prometheus.Labels{"device":"/dev/sda"}).Inc()
-//
-// // The Handler function provides a default handler to expose metrics
-// // via an HTTP server. "/metrics" is the usual endpoint for that.
-// http.Handle("/metrics", promhttp.Handler())
-// log.Fatal(http.ListenAndServe(":8080", nil))
-// }
-//
-//
-// This is a complete program that exports two metrics, a Gauge and a Counter,
-// the latter with a label attached to turn it into a (one-dimensional) vector.
-//
-// Metrics
-//
-// The number of exported identifiers in this package might appear a bit
-// overwhelming. However, in addition to the basic plumbing shown in the example
-// above, you only need to understand the different metric types and their
-// vector versions for basic usage. Furthermore, if you are not concerned with
-// fine-grained control of when and how to register metrics with the registry,
-// have a look at the promauto package, which will effectively allow you to
-// ignore registration altogether in simple cases.
-//
-// Above, you have already touched the Counter and the Gauge. There are two more
-// advanced metric types: the Summary and Histogram. A more thorough description
-// of those four metric types can be found in the Prometheus docs:
-// https://prometheus.io/docs/concepts/metric_types/
-//
-// In addition to the fundamental metric types Gauge, Counter, Summary, and
-// Histogram, a very important part of the Prometheus data model is the
-// partitioning of samples along dimensions called labels, which results in
-// metric vectors. The fundamental types are GaugeVec, CounterVec, SummaryVec,
-// and HistogramVec.
-//
-// While only the fundamental metric types implement the Metric interface, both
-// the metrics and their vector versions implement the Collector interface. A
-// Collector manages the collection of a number of Metrics, but for convenience,
-// a Metric can also “collect itself”. Note that Gauge, Counter, Summary, and
-// Histogram are interfaces themselves while GaugeVec, CounterVec, SummaryVec,
-// and HistogramVec are not.
-//
-// To create instances of Metrics and their vector versions, you need a suitable
-// …Opts struct, i.e. GaugeOpts, CounterOpts, SummaryOpts, or HistogramOpts.
-//
-// Custom Collectors and constant Metrics
-//
-// While you could create your own implementations of Metric, most likely you
-// will only ever implement the Collector interface on your own. At a first
-// glance, a custom Collector seems handy to bundle Metrics for common
-// registration (with the prime example of the different metric vectors above,
-// which bundle all the metrics of the same name but with different labels).
-//
-// There is a more involved use case, too: If you already have metrics
-// available, created outside of the Prometheus context, you don't need the
-// interface of the various Metric types. You essentially want to mirror the
-// existing numbers into Prometheus Metrics during collection. An own
-// implementation of the Collector interface is perfect for that. You can create
-// Metric instances “on the fly” using NewConstMetric, NewConstHistogram, and
-// NewConstSummary (and their respective Must… versions). NewConstMetric is used
-// for all metric types with just a float64 as their value: Counter, Gauge, and
-// a special “type” called Untyped. Use the latter if you are not sure if the
-// mirrored metric is a Counter or a Gauge. Creation of the Metric instance
-// happens in the Collect method. The Describe method has to return separate
-// Desc instances, representative of the “throw-away” metrics to be created
-// later. NewDesc comes in handy to create those Desc instances. Alternatively,
-// you could return no Desc at all, which will mark the Collector “unchecked”.
-// No checks are performed at registration time, but metric consistency will
-// still be ensured at scrape time, i.e. any inconsistencies will lead to scrape
-// errors. Thus, with unchecked Collectors, the responsibility to not collect
-// metrics that lead to inconsistencies in the total scrape result lies with the
-// implementer of the Collector. While this is not a desirable state, it is
-// sometimes necessary. The typical use case is a situation where the exact
-// metrics to be returned by a Collector cannot be predicted at registration
-// time, but the implementer has sufficient knowledge of the whole system to
-// guarantee metric consistency.
-//
-// The Collector example illustrates the use case. You can also look at the
-// source code of the processCollector (mirroring process metrics), the
-// goCollector (mirroring Go metrics), or the expvarCollector (mirroring expvar
-// metrics) as examples that are used in this package itself.
-//
-// If you just need to call a function to get a single float value to collect as
-// a metric, GaugeFunc, CounterFunc, or UntypedFunc might be interesting
-// shortcuts.
-//
-// Advanced Uses of the Registry
-//
-// While MustRegister is the by far most common way of registering a Collector,
-// sometimes you might want to handle the errors the registration might cause.
-// As suggested by the name, MustRegister panics if an error occurs. With the
-// Register function, the error is returned and can be handled.
-//
-// An error is returned if the registered Collector is incompatible or
-// inconsistent with already registered metrics. The registry aims for
-// consistency of the collected metrics according to the Prometheus data model.
-// Inconsistencies are ideally detected at registration time, not at collect
-// time. The former will usually be detected at start-up time of a program,
-// while the latter will only happen at scrape time, possibly not even on the
-// first scrape if the inconsistency only becomes relevant later. That is the
-// main reason why a Collector and a Metric have to describe themselves to the
-// registry.
-//
-// So far, everything we did operated on the so-called default registry, as it
-// can be found in the global DefaultRegisterer variable. With NewRegistry, you
-// can create a custom registry, or you can even implement the Registerer or
-// Gatherer interfaces yourself. The methods Register and Unregister work in the
-// same way on a custom registry as the global functions Register and Unregister
-// on the default registry.
-//
-// There are a number of uses for custom registries: You can use registries with
-// special properties, see NewPedanticRegistry. You can avoid global state, as
-// it is imposed by the DefaultRegisterer. You can use multiple registries at
-// the same time to expose different metrics in different ways. You can use
-// separate registries for testing purposes.
-//
-// Also note that the DefaultRegisterer comes registered with a Collector for Go
-// runtime metrics (via NewGoCollector) and a Collector for process metrics (via
-// NewProcessCollector). With a custom registry, you are in control and decide
-// yourself about the Collectors to register.
-//
-// HTTP Exposition
-//
-// The Registry implements the Gatherer interface. The caller of the Gather
-// method can then expose the gathered metrics in some way. Usually, the metrics
-// are served via HTTP on the /metrics endpoint. That's happening in the example
-// above. The tools to expose metrics via HTTP are in the promhttp sub-package.
-//
-// Pushing to the Pushgateway
-//
-// Function for pushing to the Pushgateway can be found in the push sub-package.
-//
-// Graphite Bridge
-//
-// Functions and examples to push metrics from a Gatherer to Graphite can be
-// found in the graphite sub-package.
-//
-// Other Means of Exposition
-//
-// More ways of exposing metrics can easily be added by following the approaches
-// of the existing implementations.
-package prometheus
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go b/vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go
deleted file mode 100644
index 18a99d5..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "encoding/json"
- "expvar"
-)
-
-type expvarCollector struct {
- exports map[string]*Desc
-}
-
-// NewExpvarCollector returns a newly allocated expvar Collector that still has
-// to be registered with a Prometheus registry.
-//
-// An expvar Collector collects metrics from the expvar interface. It provides a
-// quick way to expose numeric values that are already exported via expvar as
-// Prometheus metrics. Note that the data models of expvar and Prometheus are
-// fundamentally different, and that the expvar Collector is inherently slower
-// than native Prometheus metrics. Thus, the expvar Collector is probably great
-// for experiments and prototying, but you should seriously consider a more
-// direct implementation of Prometheus metrics for monitoring production
-// systems.
-//
-// The exports map has the following meaning:
-//
-// The keys in the map correspond to expvar keys, i.e. for every expvar key you
-// want to export as Prometheus metric, you need an entry in the exports
-// map. The descriptor mapped to each key describes how to export the expvar
-// value. It defines the name and the help string of the Prometheus metric
-// proxying the expvar value. The type will always be Untyped.
-//
-// For descriptors without variable labels, the expvar value must be a number or
-// a bool. The number is then directly exported as the Prometheus sample
-// value. (For a bool, 'false' translates to 0 and 'true' to 1). Expvar values
-// that are not numbers or bools are silently ignored.
-//
-// If the descriptor has one variable label, the expvar value must be an expvar
-// map. The keys in the expvar map become the various values of the one
-// Prometheus label. The values in the expvar map must be numbers or bools again
-// as above.
-//
-// For descriptors with more than one variable label, the expvar must be a
-// nested expvar map, i.e. where the values of the topmost map are maps again
-// etc. until a depth is reached that corresponds to the number of labels. The
-// leaves of that structure must be numbers or bools as above to serve as the
-// sample values.
-//
-// Anything that does not fit into the scheme above is silently ignored.
-func NewExpvarCollector(exports map[string]*Desc) Collector {
- return &expvarCollector{
- exports: exports,
- }
-}
-
-// Describe implements Collector.
-func (e *expvarCollector) Describe(ch chan<- *Desc) {
- for _, desc := range e.exports {
- ch <- desc
- }
-}
-
-// Collect implements Collector.
-func (e *expvarCollector) Collect(ch chan<- Metric) {
- for name, desc := range e.exports {
- var m Metric
- expVar := expvar.Get(name)
- if expVar == nil {
- continue
- }
- var v interface{}
- labels := make([]string, len(desc.variableLabels))
- if err := json.Unmarshal([]byte(expVar.String()), &v); err != nil {
- ch <- NewInvalidMetric(desc, err)
- continue
- }
- var processValue func(v interface{}, i int)
- processValue = func(v interface{}, i int) {
- if i >= len(labels) {
- copiedLabels := append(make([]string, 0, len(labels)), labels...)
- switch v := v.(type) {
- case float64:
- m = MustNewConstMetric(desc, UntypedValue, v, copiedLabels...)
- case bool:
- if v {
- m = MustNewConstMetric(desc, UntypedValue, 1, copiedLabels...)
- } else {
- m = MustNewConstMetric(desc, UntypedValue, 0, copiedLabels...)
- }
- default:
- return
- }
- ch <- m
- return
- }
- vm, ok := v.(map[string]interface{})
- if !ok {
- return
- }
- for lv, val := range vm {
- labels[i] = lv
- processValue(val, i+1)
- }
- }
- processValue(v, 0)
- }
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/fnv.go b/vendor/github.com/prometheus/client_golang/prometheus/fnv.go
deleted file mode 100644
index 3d383a7..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/fnv.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-// Inline and byte-free variant of hash/fnv's fnv64a.
-
-const (
- offset64 = 14695981039346656037
- prime64 = 1099511628211
-)
-
-// hashNew initializies a new fnv64a hash value.
-func hashNew() uint64 {
- return offset64
-}
-
-// hashAdd adds a string to a fnv64a hash value, returning the updated hash.
-func hashAdd(h uint64, s string) uint64 {
- for i := 0; i < len(s); i++ {
- h ^= uint64(s[i])
- h *= prime64
- }
- return h
-}
-
-// hashAddByte adds a byte to a fnv64a hash value, returning the updated hash.
-func hashAddByte(h uint64, b byte) uint64 {
- h ^= uint64(b)
- h *= prime64
- return h
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/gauge.go b/vendor/github.com/prometheus/client_golang/prometheus/gauge.go
deleted file mode 100644
index d67573f..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/gauge.go
+++ /dev/null
@@ -1,289 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "math"
- "sync/atomic"
- "time"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-// Gauge is a Metric that represents a single numerical value that can
-// arbitrarily go up and down.
-//
-// A Gauge is typically used for measured values like temperatures or current
-// memory usage, but also "counts" that can go up and down, like the number of
-// running goroutines.
-//
-// To create Gauge instances, use NewGauge.
-type Gauge interface {
- Metric
- Collector
-
- // Set sets the Gauge to an arbitrary value.
- Set(float64)
- // Inc increments the Gauge by 1. Use Add to increment it by arbitrary
- // values.
- Inc()
- // Dec decrements the Gauge by 1. Use Sub to decrement it by arbitrary
- // values.
- Dec()
- // Add adds the given value to the Gauge. (The value can be negative,
- // resulting in a decrease of the Gauge.)
- Add(float64)
- // Sub subtracts the given value from the Gauge. (The value can be
- // negative, resulting in an increase of the Gauge.)
- Sub(float64)
-
- // SetToCurrentTime sets the Gauge to the current Unix time in seconds.
- SetToCurrentTime()
-}
-
-// GaugeOpts is an alias for Opts. See there for doc comments.
-type GaugeOpts Opts
-
-// NewGauge creates a new Gauge based on the provided GaugeOpts.
-//
-// The returned implementation is optimized for a fast Set method. If you have a
-// choice for managing the value of a Gauge via Set vs. Inc/Dec/Add/Sub, pick
-// the former. For example, the Inc method of the returned Gauge is slower than
-// the Inc method of a Counter returned by NewCounter. This matches the typical
-// scenarios for Gauges and Counters, where the former tends to be Set-heavy and
-// the latter Inc-heavy.
-func NewGauge(opts GaugeOpts) Gauge {
- desc := NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- nil,
- opts.ConstLabels,
- )
- result := &gauge{desc: desc, labelPairs: desc.constLabelPairs}
- result.init(result) // Init self-collection.
- return result
-}
-
-type gauge struct {
- // valBits contains the bits of the represented float64 value. It has
- // to go first in the struct to guarantee alignment for atomic
- // operations. http://golang.org/pkg/sync/atomic/#pkg-note-BUG
- valBits uint64
-
- selfCollector
-
- desc *Desc
- labelPairs []*dto.LabelPair
-}
-
-func (g *gauge) Desc() *Desc {
- return g.desc
-}
-
-func (g *gauge) Set(val float64) {
- atomic.StoreUint64(&g.valBits, math.Float64bits(val))
-}
-
-func (g *gauge) SetToCurrentTime() {
- g.Set(float64(time.Now().UnixNano()) / 1e9)
-}
-
-func (g *gauge) Inc() {
- g.Add(1)
-}
-
-func (g *gauge) Dec() {
- g.Add(-1)
-}
-
-func (g *gauge) Add(val float64) {
- for {
- oldBits := atomic.LoadUint64(&g.valBits)
- newBits := math.Float64bits(math.Float64frombits(oldBits) + val)
- if atomic.CompareAndSwapUint64(&g.valBits, oldBits, newBits) {
- return
- }
- }
-}
-
-func (g *gauge) Sub(val float64) {
- g.Add(val * -1)
-}
-
-func (g *gauge) Write(out *dto.Metric) error {
- val := math.Float64frombits(atomic.LoadUint64(&g.valBits))
- return populateMetric(GaugeValue, val, g.labelPairs, nil, out)
-}
-
-// GaugeVec is a Collector that bundles a set of Gauges that all share the same
-// Desc, but have different values for their variable labels. This is used if
-// you want to count the same thing partitioned by various dimensions
-// (e.g. number of operations queued, partitioned by user and operation
-// type). Create instances with NewGaugeVec.
-type GaugeVec struct {
- *metricVec
-}
-
-// NewGaugeVec creates a new GaugeVec based on the provided GaugeOpts and
-// partitioned by the given label names.
-func NewGaugeVec(opts GaugeOpts, labelNames []string) *GaugeVec {
- desc := NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- labelNames,
- opts.ConstLabels,
- )
- return &GaugeVec{
- metricVec: newMetricVec(desc, func(lvs ...string) Metric {
- if len(lvs) != len(desc.variableLabels) {
- panic(makeInconsistentCardinalityError(desc.fqName, desc.variableLabels, lvs))
- }
- result := &gauge{desc: desc, labelPairs: makeLabelPairs(desc, lvs)}
- result.init(result) // Init self-collection.
- return result
- }),
- }
-}
-
-// GetMetricWithLabelValues returns the Gauge for the given slice of label
-// values (same order as the VariableLabels in Desc). If that combination of
-// label values is accessed for the first time, a new Gauge is created.
-//
-// It is possible to call this method without using the returned Gauge to only
-// create the new Gauge but leave it at its starting value 0. See also the
-// SummaryVec example.
-//
-// Keeping the Gauge for later use is possible (and should be considered if
-// performance is critical), but keep in mind that Reset, DeleteLabelValues and
-// Delete can be used to delete the Gauge from the GaugeVec. In that case, the
-// Gauge will still exist, but it will not be exported anymore, even if a
-// Gauge with the same label values is created later. See also the CounterVec
-// example.
-//
-// An error is returned if the number of label values is not the same as the
-// number of VariableLabels in Desc (minus any curried labels).
-//
-// Note that for more than one label value, this method is prone to mistakes
-// caused by an incorrect order of arguments. Consider GetMetricWith(Labels) as
-// an alternative to avoid that type of mistake. For higher label numbers, the
-// latter has a much more readable (albeit more verbose) syntax, but it comes
-// with a performance overhead (for creating and processing the Labels map).
-func (v *GaugeVec) GetMetricWithLabelValues(lvs ...string) (Gauge, error) {
- metric, err := v.metricVec.getMetricWithLabelValues(lvs...)
- if metric != nil {
- return metric.(Gauge), err
- }
- return nil, err
-}
-
-// GetMetricWith returns the Gauge for the given Labels map (the label names
-// must match those of the VariableLabels in Desc). If that label map is
-// accessed for the first time, a new Gauge is created. Implications of
-// creating a Gauge without using it and keeping the Gauge for later use are
-// the same as for GetMetricWithLabelValues.
-//
-// An error is returned if the number and names of the Labels are inconsistent
-// with those of the VariableLabels in Desc (minus any curried labels).
-//
-// This method is used for the same purpose as
-// GetMetricWithLabelValues(...string). See there for pros and cons of the two
-// methods.
-func (v *GaugeVec) GetMetricWith(labels Labels) (Gauge, error) {
- metric, err := v.metricVec.getMetricWith(labels)
- if metric != nil {
- return metric.(Gauge), err
- }
- return nil, err
-}
-
-// WithLabelValues works as GetMetricWithLabelValues, but panics where
-// GetMetricWithLabelValues would have returned an error. Not returning an
-// error allows shortcuts like
-// myVec.WithLabelValues("404", "GET").Add(42)
-func (v *GaugeVec) WithLabelValues(lvs ...string) Gauge {
- g, err := v.GetMetricWithLabelValues(lvs...)
- if err != nil {
- panic(err)
- }
- return g
-}
-
-// With works as GetMetricWith, but panics where GetMetricWithLabels would have
-// returned an error. Not returning an error allows shortcuts like
-// myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Add(42)
-func (v *GaugeVec) With(labels Labels) Gauge {
- g, err := v.GetMetricWith(labels)
- if err != nil {
- panic(err)
- }
- return g
-}
-
-// CurryWith returns a vector curried with the provided labels, i.e. the
-// returned vector has those labels pre-set for all labeled operations performed
-// on it. The cardinality of the curried vector is reduced accordingly. The
-// order of the remaining labels stays the same (just with the curried labels
-// taken out of the sequence – which is relevant for the
-// (GetMetric)WithLabelValues methods). It is possible to curry a curried
-// vector, but only with labels not yet used for currying before.
-//
-// The metrics contained in the GaugeVec are shared between the curried and
-// uncurried vectors. They are just accessed differently. Curried and uncurried
-// vectors behave identically in terms of collection. Only one must be
-// registered with a given registry (usually the uncurried version). The Reset
-// method deletes all metrics, even if called on a curried vector.
-func (v *GaugeVec) CurryWith(labels Labels) (*GaugeVec, error) {
- vec, err := v.curryWith(labels)
- if vec != nil {
- return &GaugeVec{vec}, err
- }
- return nil, err
-}
-
-// MustCurryWith works as CurryWith but panics where CurryWith would have
-// returned an error.
-func (v *GaugeVec) MustCurryWith(labels Labels) *GaugeVec {
- vec, err := v.CurryWith(labels)
- if err != nil {
- panic(err)
- }
- return vec
-}
-
-// GaugeFunc is a Gauge whose value is determined at collect time by calling a
-// provided function.
-//
-// To create GaugeFunc instances, use NewGaugeFunc.
-type GaugeFunc interface {
- Metric
- Collector
-}
-
-// NewGaugeFunc creates a new GaugeFunc based on the provided GaugeOpts. The
-// value reported is determined by calling the given function from within the
-// Write method. Take into account that metric collection may happen
-// concurrently. Therefore, it must be safe to call the provided function
-// concurrently.
-//
-// NewGaugeFunc is a good way to create an “info” style metric with a constant
-// value of 1. Example:
-// https://github.com/prometheus/common/blob/8558a5b7db3c84fa38b4766966059a7bd5bfa2ee/version/info.go#L36-L56
-func NewGaugeFunc(opts GaugeOpts, function func() float64) GaugeFunc {
- return newValueFunc(NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- nil,
- opts.ConstLabels,
- ), GaugeValue, function)
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go b/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go
deleted file mode 100644
index ea05cf4..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go
+++ /dev/null
@@ -1,396 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "runtime"
- "runtime/debug"
- "sync"
- "time"
-)
-
-type goCollector struct {
- goroutinesDesc *Desc
- threadsDesc *Desc
- gcDesc *Desc
- goInfoDesc *Desc
-
- // ms... are memstats related.
- msLast *runtime.MemStats // Previously collected memstats.
- msLastTimestamp time.Time
- msMtx sync.Mutex // Protects msLast and msLastTimestamp.
- msMetrics memStatsMetrics
- msRead func(*runtime.MemStats) // For mocking in tests.
- msMaxWait time.Duration // Wait time for fresh memstats.
- msMaxAge time.Duration // Maximum allowed age of old memstats.
-}
-
-// NewGoCollector returns a collector that exports metrics about the current Go
-// process. This includes memory stats. To collect those, runtime.ReadMemStats
-// is called. This requires to “stop the world”, which usually only happens for
-// garbage collection (GC). Take the following implications into account when
-// deciding whether to use the Go collector:
-//
-// 1. The performance impact of stopping the world is the more relevant the more
-// frequently metrics are collected. However, with Go1.9 or later the
-// stop-the-world time per metrics collection is very short (~25µs) so that the
-// performance impact will only matter in rare cases. However, with older Go
-// versions, the stop-the-world duration depends on the heap size and can be
-// quite significant (~1.7 ms/GiB as per
-// https://go-review.googlesource.com/c/go/+/34937).
-//
-// 2. During an ongoing GC, nothing else can stop the world. Therefore, if the
-// metrics collection happens to coincide with GC, it will only complete after
-// GC has finished. Usually, GC is fast enough to not cause problems. However,
-// with a very large heap, GC might take multiple seconds, which is enough to
-// cause scrape timeouts in common setups. To avoid this problem, the Go
-// collector will use the memstats from a previous collection if
-// runtime.ReadMemStats takes more than 1s. However, if there are no previously
-// collected memstats, or their collection is more than 5m ago, the collection
-// will block until runtime.ReadMemStats succeeds. (The problem might be solved
-// in Go1.13, see https://github.com/golang/go/issues/19812 for the related Go
-// issue.)
-func NewGoCollector() Collector {
- return &goCollector{
- goroutinesDesc: NewDesc(
- "go_goroutines",
- "Number of goroutines that currently exist.",
- nil, nil),
- threadsDesc: NewDesc(
- "go_threads",
- "Number of OS threads created.",
- nil, nil),
- gcDesc: NewDesc(
- "go_gc_duration_seconds",
- "A summary of the pause duration of garbage collection cycles.",
- nil, nil),
- goInfoDesc: NewDesc(
- "go_info",
- "Information about the Go environment.",
- nil, Labels{"version": runtime.Version()}),
- msLast: &runtime.MemStats{},
- msRead: runtime.ReadMemStats,
- msMaxWait: time.Second,
- msMaxAge: 5 * time.Minute,
- msMetrics: memStatsMetrics{
- {
- desc: NewDesc(
- memstatNamespace("alloc_bytes"),
- "Number of bytes allocated and still in use.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.Alloc) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("alloc_bytes_total"),
- "Total number of bytes allocated, even if freed.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.TotalAlloc) },
- valType: CounterValue,
- }, {
- desc: NewDesc(
- memstatNamespace("sys_bytes"),
- "Number of bytes obtained from system.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.Sys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("lookups_total"),
- "Total number of pointer lookups.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.Lookups) },
- valType: CounterValue,
- }, {
- desc: NewDesc(
- memstatNamespace("mallocs_total"),
- "Total number of mallocs.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.Mallocs) },
- valType: CounterValue,
- }, {
- desc: NewDesc(
- memstatNamespace("frees_total"),
- "Total number of frees.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.Frees) },
- valType: CounterValue,
- }, {
- desc: NewDesc(
- memstatNamespace("heap_alloc_bytes"),
- "Number of heap bytes allocated and still in use.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapAlloc) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("heap_sys_bytes"),
- "Number of heap bytes obtained from system.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapSys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("heap_idle_bytes"),
- "Number of heap bytes waiting to be used.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapIdle) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("heap_inuse_bytes"),
- "Number of heap bytes that are in use.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapInuse) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("heap_released_bytes"),
- "Number of heap bytes released to OS.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapReleased) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("heap_objects"),
- "Number of allocated objects.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapObjects) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("stack_inuse_bytes"),
- "Number of bytes in use by the stack allocator.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.StackInuse) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("stack_sys_bytes"),
- "Number of bytes obtained from system for stack allocator.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.StackSys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("mspan_inuse_bytes"),
- "Number of bytes in use by mspan structures.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.MSpanInuse) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("mspan_sys_bytes"),
- "Number of bytes used for mspan structures obtained from system.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.MSpanSys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("mcache_inuse_bytes"),
- "Number of bytes in use by mcache structures.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.MCacheInuse) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("mcache_sys_bytes"),
- "Number of bytes used for mcache structures obtained from system.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.MCacheSys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("buck_hash_sys_bytes"),
- "Number of bytes used by the profiling bucket hash table.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.BuckHashSys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("gc_sys_bytes"),
- "Number of bytes used for garbage collection system metadata.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.GCSys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("other_sys_bytes"),
- "Number of bytes used for other system allocations.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.OtherSys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("next_gc_bytes"),
- "Number of heap bytes when next garbage collection will take place.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.NextGC) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("last_gc_time_seconds"),
- "Number of seconds since 1970 of last garbage collection.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.LastGC) / 1e9 },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("gc_cpu_fraction"),
- "The fraction of this program's available CPU time used by the GC since the program started.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return ms.GCCPUFraction },
- valType: GaugeValue,
- },
- },
- }
-}
-
-func memstatNamespace(s string) string {
- return "go_memstats_" + s
-}
-
-// Describe returns all descriptions of the collector.
-func (c *goCollector) Describe(ch chan<- *Desc) {
- ch <- c.goroutinesDesc
- ch <- c.threadsDesc
- ch <- c.gcDesc
- ch <- c.goInfoDesc
- for _, i := range c.msMetrics {
- ch <- i.desc
- }
-}
-
-// Collect returns the current state of all metrics of the collector.
-func (c *goCollector) Collect(ch chan<- Metric) {
- var (
- ms = &runtime.MemStats{}
- done = make(chan struct{})
- )
- // Start reading memstats first as it might take a while.
- go func() {
- c.msRead(ms)
- c.msMtx.Lock()
- c.msLast = ms
- c.msLastTimestamp = time.Now()
- c.msMtx.Unlock()
- close(done)
- }()
-
- ch <- MustNewConstMetric(c.goroutinesDesc, GaugeValue, float64(runtime.NumGoroutine()))
- n, _ := runtime.ThreadCreateProfile(nil)
- ch <- MustNewConstMetric(c.threadsDesc, GaugeValue, float64(n))
-
- var stats debug.GCStats
- stats.PauseQuantiles = make([]time.Duration, 5)
- debug.ReadGCStats(&stats)
-
- quantiles := make(map[float64]float64)
- for idx, pq := range stats.PauseQuantiles[1:] {
- quantiles[float64(idx+1)/float64(len(stats.PauseQuantiles)-1)] = pq.Seconds()
- }
- quantiles[0.0] = stats.PauseQuantiles[0].Seconds()
- ch <- MustNewConstSummary(c.gcDesc, uint64(stats.NumGC), stats.PauseTotal.Seconds(), quantiles)
-
- ch <- MustNewConstMetric(c.goInfoDesc, GaugeValue, 1)
-
- timer := time.NewTimer(c.msMaxWait)
- select {
- case <-done: // Our own ReadMemStats succeeded in time. Use it.
- timer.Stop() // Important for high collection frequencies to not pile up timers.
- c.msCollect(ch, ms)
- return
- case <-timer.C: // Time out, use last memstats if possible. Continue below.
- }
- c.msMtx.Lock()
- if time.Since(c.msLastTimestamp) < c.msMaxAge {
- // Last memstats are recent enough. Collect from them under the lock.
- c.msCollect(ch, c.msLast)
- c.msMtx.Unlock()
- return
- }
- // If we are here, the last memstats are too old or don't exist. We have
- // to wait until our own ReadMemStats finally completes. For that to
- // happen, we have to release the lock.
- c.msMtx.Unlock()
- <-done
- c.msCollect(ch, ms)
-}
-
-func (c *goCollector) msCollect(ch chan<- Metric, ms *runtime.MemStats) {
- for _, i := range c.msMetrics {
- ch <- MustNewConstMetric(i.desc, i.valType, i.eval(ms))
- }
-}
-
-// memStatsMetrics provide description, value, and value type for memstat metrics.
-type memStatsMetrics []struct {
- desc *Desc
- eval func(*runtime.MemStats) float64
- valType ValueType
-}
-
-// NewBuildInfoCollector returns a collector collecting a single metric
-// "go_build_info" with the constant value 1 and three labels "path", "version",
-// and "checksum". Their label values contain the main module path, version, and
-// checksum, respectively. The labels will only have meaningful values if the
-// binary is built with Go module support and from source code retrieved from
-// the source repository (rather than the local file system). This is usually
-// accomplished by building from outside of GOPATH, specifying the full address
-// of the main package, e.g. "GO111MODULE=on go run
-// github.com/prometheus/client_golang/examples/random". If built without Go
-// module support, all label values will be "unknown". If built with Go module
-// support but using the source code from the local file system, the "path" will
-// be set appropriately, but "checksum" will be empty and "version" will be
-// "(devel)".
-//
-// This collector uses only the build information for the main module. See
-// https://github.com/povilasv/prommod for an example of a collector for the
-// module dependencies.
-func NewBuildInfoCollector() Collector {
- path, version, sum := readBuildInfo()
- c := &selfCollector{MustNewConstMetric(
- NewDesc(
- "go_build_info",
- "Build information about the main Go module.",
- nil, Labels{"path": path, "version": version, "checksum": sum},
- ),
- GaugeValue, 1)}
- c.init(c.self)
- return c
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/histogram.go b/vendor/github.com/prometheus/client_golang/prometheus/histogram.go
deleted file mode 100644
index 4271f43..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/histogram.go
+++ /dev/null
@@ -1,636 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "fmt"
- "math"
- "runtime"
- "sort"
- "sync"
- "sync/atomic"
- "time"
-
- "github.com/golang/protobuf/proto"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-// A Histogram counts individual observations from an event or sample stream in
-// configurable buckets. Similar to a summary, it also provides a sum of
-// observations and an observation count.
-//
-// On the Prometheus server, quantiles can be calculated from a Histogram using
-// the histogram_quantile function in the query language.
-//
-// Note that Histograms, in contrast to Summaries, can be aggregated with the
-// Prometheus query language (see the documentation for detailed
-// procedures). However, Histograms require the user to pre-define suitable
-// buckets, and they are in general less accurate. The Observe method of a
-// Histogram has a very low performance overhead in comparison with the Observe
-// method of a Summary.
-//
-// To create Histogram instances, use NewHistogram.
-type Histogram interface {
- Metric
- Collector
-
- // Observe adds a single observation to the histogram.
- Observe(float64)
-}
-
-// bucketLabel is used for the label that defines the upper bound of a
-// bucket of a histogram ("le" -> "less or equal").
-const bucketLabel = "le"
-
-// DefBuckets are the default Histogram buckets. The default buckets are
-// tailored to broadly measure the response time (in seconds) of a network
-// service. Most likely, however, you will be required to define buckets
-// customized to your use case.
-var (
- DefBuckets = []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10}
-
- errBucketLabelNotAllowed = fmt.Errorf(
- "%q is not allowed as label name in histograms", bucketLabel,
- )
-)
-
-// LinearBuckets creates 'count' buckets, each 'width' wide, where the lowest
-// bucket has an upper bound of 'start'. The final +Inf bucket is not counted
-// and not included in the returned slice. The returned slice is meant to be
-// used for the Buckets field of HistogramOpts.
-//
-// The function panics if 'count' is zero or negative.
-func LinearBuckets(start, width float64, count int) []float64 {
- if count < 1 {
- panic("LinearBuckets needs a positive count")
- }
- buckets := make([]float64, count)
- for i := range buckets {
- buckets[i] = start
- start += width
- }
- return buckets
-}
-
-// ExponentialBuckets creates 'count' buckets, where the lowest bucket has an
-// upper bound of 'start' and each following bucket's upper bound is 'factor'
-// times the previous bucket's upper bound. The final +Inf bucket is not counted
-// and not included in the returned slice. The returned slice is meant to be
-// used for the Buckets field of HistogramOpts.
-//
-// The function panics if 'count' is 0 or negative, if 'start' is 0 or negative,
-// or if 'factor' is less than or equal 1.
-func ExponentialBuckets(start, factor float64, count int) []float64 {
- if count < 1 {
- panic("ExponentialBuckets needs a positive count")
- }
- if start <= 0 {
- panic("ExponentialBuckets needs a positive start value")
- }
- if factor <= 1 {
- panic("ExponentialBuckets needs a factor greater than 1")
- }
- buckets := make([]float64, count)
- for i := range buckets {
- buckets[i] = start
- start *= factor
- }
- return buckets
-}
-
-// HistogramOpts bundles the options for creating a Histogram metric. It is
-// mandatory to set Name to a non-empty string. All other fields are optional
-// and can safely be left at their zero value, although it is strongly
-// encouraged to set a Help string.
-type HistogramOpts struct {
- // Namespace, Subsystem, and Name are components of the fully-qualified
- // name of the Histogram (created by joining these components with
- // "_"). Only Name is mandatory, the others merely help structuring the
- // name. Note that the fully-qualified name of the Histogram must be a
- // valid Prometheus metric name.
- Namespace string
- Subsystem string
- Name string
-
- // Help provides information about this Histogram.
- //
- // Metrics with the same fully-qualified name must have the same Help
- // string.
- Help string
-
- // ConstLabels are used to attach fixed labels to this metric. Metrics
- // with the same fully-qualified name must have the same label names in
- // their ConstLabels.
- //
- // ConstLabels are only used rarely. In particular, do not use them to
- // attach the same labels to all your metrics. Those use cases are
- // better covered by target labels set by the scraping Prometheus
- // server, or by one specific metric (e.g. a build_info or a
- // machine_role metric). See also
- // https://prometheus.io/docs/instrumenting/writing_exporters/#target-labels-not-static-scraped-labels
- ConstLabels Labels
-
- // Buckets defines the buckets into which observations are counted. Each
- // element in the slice is the upper inclusive bound of a bucket. The
- // values must be sorted in strictly increasing order. There is no need
- // to add a highest bucket with +Inf bound, it will be added
- // implicitly. The default value is DefBuckets.
- Buckets []float64
-}
-
-// NewHistogram creates a new Histogram based on the provided HistogramOpts. It
-// panics if the buckets in HistogramOpts are not in strictly increasing order.
-//
-// The returned implementation also implements ExemplarObserver. It is safe to
-// perform the corresponding type assertion. Exemplars are tracked separately
-// for each bucket.
-func NewHistogram(opts HistogramOpts) Histogram {
- return newHistogram(
- NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- nil,
- opts.ConstLabels,
- ),
- opts,
- )
-}
-
-func newHistogram(desc *Desc, opts HistogramOpts, labelValues ...string) Histogram {
- if len(desc.variableLabels) != len(labelValues) {
- panic(makeInconsistentCardinalityError(desc.fqName, desc.variableLabels, labelValues))
- }
-
- for _, n := range desc.variableLabels {
- if n == bucketLabel {
- panic(errBucketLabelNotAllowed)
- }
- }
- for _, lp := range desc.constLabelPairs {
- if lp.GetName() == bucketLabel {
- panic(errBucketLabelNotAllowed)
- }
- }
-
- if len(opts.Buckets) == 0 {
- opts.Buckets = DefBuckets
- }
-
- h := &histogram{
- desc: desc,
- upperBounds: opts.Buckets,
- labelPairs: makeLabelPairs(desc, labelValues),
- counts: [2]*histogramCounts{{}, {}},
- now: time.Now,
- }
- for i, upperBound := range h.upperBounds {
- if i < len(h.upperBounds)-1 {
- if upperBound >= h.upperBounds[i+1] {
- panic(fmt.Errorf(
- "histogram buckets must be in increasing order: %f >= %f",
- upperBound, h.upperBounds[i+1],
- ))
- }
- } else {
- if math.IsInf(upperBound, +1) {
- // The +Inf bucket is implicit. Remove it here.
- h.upperBounds = h.upperBounds[:i]
- }
- }
- }
- // Finally we know the final length of h.upperBounds and can make buckets
- // for both counts as well as exemplars:
- h.counts[0].buckets = make([]uint64, len(h.upperBounds))
- h.counts[1].buckets = make([]uint64, len(h.upperBounds))
- h.exemplars = make([]atomic.Value, len(h.upperBounds)+1)
-
- h.init(h) // Init self-collection.
- return h
-}
-
-type histogramCounts struct {
- // sumBits contains the bits of the float64 representing the sum of all
- // observations. sumBits and count have to go first in the struct to
- // guarantee alignment for atomic operations.
- // http://golang.org/pkg/sync/atomic/#pkg-note-BUG
- sumBits uint64
- count uint64
- buckets []uint64
-}
-
-type histogram struct {
- // countAndHotIdx enables lock-free writes with use of atomic updates.
- // The most significant bit is the hot index [0 or 1] of the count field
- // below. Observe calls update the hot one. All remaining bits count the
- // number of Observe calls. Observe starts by incrementing this counter,
- // and finish by incrementing the count field in the respective
- // histogramCounts, as a marker for completion.
- //
- // Calls of the Write method (which are non-mutating reads from the
- // perspective of the histogram) swap the hot–cold under the writeMtx
- // lock. A cooldown is awaited (while locked) by comparing the number of
- // observations with the initiation count. Once they match, then the
- // last observation on the now cool one has completed. All cool fields must
- // be merged into the new hot before releasing writeMtx.
- //
- // Fields with atomic access first! See alignment constraint:
- // http://golang.org/pkg/sync/atomic/#pkg-note-BUG
- countAndHotIdx uint64
-
- selfCollector
- desc *Desc
- writeMtx sync.Mutex // Only used in the Write method.
-
- // Two counts, one is "hot" for lock-free observations, the other is
- // "cold" for writing out a dto.Metric. It has to be an array of
- // pointers to guarantee 64bit alignment of the histogramCounts, see
- // http://golang.org/pkg/sync/atomic/#pkg-note-BUG.
- counts [2]*histogramCounts
-
- upperBounds []float64
- labelPairs []*dto.LabelPair
- exemplars []atomic.Value // One more than buckets (to include +Inf), each a *dto.Exemplar.
-
- now func() time.Time // To mock out time.Now() for testing.
-}
-
-func (h *histogram) Desc() *Desc {
- return h.desc
-}
-
-func (h *histogram) Observe(v float64) {
- h.observe(v, h.findBucket(v))
-}
-
-func (h *histogram) ObserveWithExemplar(v float64, e Labels) {
- i := h.findBucket(v)
- h.observe(v, i)
- h.updateExemplar(v, i, e)
-}
-
-func (h *histogram) Write(out *dto.Metric) error {
- // For simplicity, we protect this whole method by a mutex. It is not in
- // the hot path, i.e. Observe is called much more often than Write. The
- // complication of making Write lock-free isn't worth it, if possible at
- // all.
- h.writeMtx.Lock()
- defer h.writeMtx.Unlock()
-
- // Adding 1<<63 switches the hot index (from 0 to 1 or from 1 to 0)
- // without touching the count bits. See the struct comments for a full
- // description of the algorithm.
- n := atomic.AddUint64(&h.countAndHotIdx, 1<<63)
- // count is contained unchanged in the lower 63 bits.
- count := n & ((1 << 63) - 1)
- // The most significant bit tells us which counts is hot. The complement
- // is thus the cold one.
- hotCounts := h.counts[n>>63]
- coldCounts := h.counts[(^n)>>63]
-
- // Await cooldown.
- for count != atomic.LoadUint64(&coldCounts.count) {
- runtime.Gosched() // Let observations get work done.
- }
-
- his := &dto.Histogram{
- Bucket: make([]*dto.Bucket, len(h.upperBounds)),
- SampleCount: proto.Uint64(count),
- SampleSum: proto.Float64(math.Float64frombits(atomic.LoadUint64(&coldCounts.sumBits))),
- }
- var cumCount uint64
- for i, upperBound := range h.upperBounds {
- cumCount += atomic.LoadUint64(&coldCounts.buckets[i])
- his.Bucket[i] = &dto.Bucket{
- CumulativeCount: proto.Uint64(cumCount),
- UpperBound: proto.Float64(upperBound),
- }
- if e := h.exemplars[i].Load(); e != nil {
- his.Bucket[i].Exemplar = e.(*dto.Exemplar)
- }
- }
- // If there is an exemplar for the +Inf bucket, we have to add that bucket explicitly.
- if e := h.exemplars[len(h.upperBounds)].Load(); e != nil {
- b := &dto.Bucket{
- CumulativeCount: proto.Uint64(count),
- UpperBound: proto.Float64(math.Inf(1)),
- Exemplar: e.(*dto.Exemplar),
- }
- his.Bucket = append(his.Bucket, b)
- }
-
- out.Histogram = his
- out.Label = h.labelPairs
-
- // Finally add all the cold counts to the new hot counts and reset the cold counts.
- atomic.AddUint64(&hotCounts.count, count)
- atomic.StoreUint64(&coldCounts.count, 0)
- for {
- oldBits := atomic.LoadUint64(&hotCounts.sumBits)
- newBits := math.Float64bits(math.Float64frombits(oldBits) + his.GetSampleSum())
- if atomic.CompareAndSwapUint64(&hotCounts.sumBits, oldBits, newBits) {
- atomic.StoreUint64(&coldCounts.sumBits, 0)
- break
- }
- }
- for i := range h.upperBounds {
- atomic.AddUint64(&hotCounts.buckets[i], atomic.LoadUint64(&coldCounts.buckets[i]))
- atomic.StoreUint64(&coldCounts.buckets[i], 0)
- }
- return nil
-}
-
-// findBucket returns the index of the bucket for the provided value, or
-// len(h.upperBounds) for the +Inf bucket.
-func (h *histogram) findBucket(v float64) int {
- // TODO(beorn7): For small numbers of buckets (<30), a linear search is
- // slightly faster than the binary search. If we really care, we could
- // switch from one search strategy to the other depending on the number
- // of buckets.
- //
- // Microbenchmarks (BenchmarkHistogramNoLabels):
- // 11 buckets: 38.3 ns/op linear - binary 48.7 ns/op
- // 100 buckets: 78.1 ns/op linear - binary 54.9 ns/op
- // 300 buckets: 154 ns/op linear - binary 61.6 ns/op
- return sort.SearchFloat64s(h.upperBounds, v)
-}
-
-// observe is the implementation for Observe without the findBucket part.
-func (h *histogram) observe(v float64, bucket int) {
- // We increment h.countAndHotIdx so that the counter in the lower
- // 63 bits gets incremented. At the same time, we get the new value
- // back, which we can use to find the currently-hot counts.
- n := atomic.AddUint64(&h.countAndHotIdx, 1)
- hotCounts := h.counts[n>>63]
-
- if bucket < len(h.upperBounds) {
- atomic.AddUint64(&hotCounts.buckets[bucket], 1)
- }
- for {
- oldBits := atomic.LoadUint64(&hotCounts.sumBits)
- newBits := math.Float64bits(math.Float64frombits(oldBits) + v)
- if atomic.CompareAndSwapUint64(&hotCounts.sumBits, oldBits, newBits) {
- break
- }
- }
- // Increment count last as we take it as a signal that the observation
- // is complete.
- atomic.AddUint64(&hotCounts.count, 1)
-}
-
-// updateExemplar replaces the exemplar for the provided bucket. With empty
-// labels, it's a no-op. It panics if any of the labels is invalid.
-func (h *histogram) updateExemplar(v float64, bucket int, l Labels) {
- if l == nil {
- return
- }
- e, err := newExemplar(v, h.now(), l)
- if err != nil {
- panic(err)
- }
- h.exemplars[bucket].Store(e)
-}
-
-// HistogramVec is a Collector that bundles a set of Histograms that all share the
-// same Desc, but have different values for their variable labels. This is used
-// if you want to count the same thing partitioned by various dimensions
-// (e.g. HTTP request latencies, partitioned by status code and method). Create
-// instances with NewHistogramVec.
-type HistogramVec struct {
- *metricVec
-}
-
-// NewHistogramVec creates a new HistogramVec based on the provided HistogramOpts and
-// partitioned by the given label names.
-func NewHistogramVec(opts HistogramOpts, labelNames []string) *HistogramVec {
- desc := NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- labelNames,
- opts.ConstLabels,
- )
- return &HistogramVec{
- metricVec: newMetricVec(desc, func(lvs ...string) Metric {
- return newHistogram(desc, opts, lvs...)
- }),
- }
-}
-
-// GetMetricWithLabelValues returns the Histogram for the given slice of label
-// values (same order as the VariableLabels in Desc). If that combination of
-// label values is accessed for the first time, a new Histogram is created.
-//
-// It is possible to call this method without using the returned Histogram to only
-// create the new Histogram but leave it at its starting value, a Histogram without
-// any observations.
-//
-// Keeping the Histogram for later use is possible (and should be considered if
-// performance is critical), but keep in mind that Reset, DeleteLabelValues and
-// Delete can be used to delete the Histogram from the HistogramVec. In that case, the
-// Histogram will still exist, but it will not be exported anymore, even if a
-// Histogram with the same label values is created later. See also the CounterVec
-// example.
-//
-// An error is returned if the number of label values is not the same as the
-// number of VariableLabels in Desc (minus any curried labels).
-//
-// Note that for more than one label value, this method is prone to mistakes
-// caused by an incorrect order of arguments. Consider GetMetricWith(Labels) as
-// an alternative to avoid that type of mistake. For higher label numbers, the
-// latter has a much more readable (albeit more verbose) syntax, but it comes
-// with a performance overhead (for creating and processing the Labels map).
-// See also the GaugeVec example.
-func (v *HistogramVec) GetMetricWithLabelValues(lvs ...string) (Observer, error) {
- metric, err := v.metricVec.getMetricWithLabelValues(lvs...)
- if metric != nil {
- return metric.(Observer), err
- }
- return nil, err
-}
-
-// GetMetricWith returns the Histogram for the given Labels map (the label names
-// must match those of the VariableLabels in Desc). If that label map is
-// accessed for the first time, a new Histogram is created. Implications of
-// creating a Histogram without using it and keeping the Histogram for later use
-// are the same as for GetMetricWithLabelValues.
-//
-// An error is returned if the number and names of the Labels are inconsistent
-// with those of the VariableLabels in Desc (minus any curried labels).
-//
-// This method is used for the same purpose as
-// GetMetricWithLabelValues(...string). See there for pros and cons of the two
-// methods.
-func (v *HistogramVec) GetMetricWith(labels Labels) (Observer, error) {
- metric, err := v.metricVec.getMetricWith(labels)
- if metric != nil {
- return metric.(Observer), err
- }
- return nil, err
-}
-
-// WithLabelValues works as GetMetricWithLabelValues, but panics where
-// GetMetricWithLabelValues would have returned an error. Not returning an
-// error allows shortcuts like
-// myVec.WithLabelValues("404", "GET").Observe(42.21)
-func (v *HistogramVec) WithLabelValues(lvs ...string) Observer {
- h, err := v.GetMetricWithLabelValues(lvs...)
- if err != nil {
- panic(err)
- }
- return h
-}
-
-// With works as GetMetricWith but panics where GetMetricWithLabels would have
-// returned an error. Not returning an error allows shortcuts like
-// myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Observe(42.21)
-func (v *HistogramVec) With(labels Labels) Observer {
- h, err := v.GetMetricWith(labels)
- if err != nil {
- panic(err)
- }
- return h
-}
-
-// CurryWith returns a vector curried with the provided labels, i.e. the
-// returned vector has those labels pre-set for all labeled operations performed
-// on it. The cardinality of the curried vector is reduced accordingly. The
-// order of the remaining labels stays the same (just with the curried labels
-// taken out of the sequence – which is relevant for the
-// (GetMetric)WithLabelValues methods). It is possible to curry a curried
-// vector, but only with labels not yet used for currying before.
-//
-// The metrics contained in the HistogramVec are shared between the curried and
-// uncurried vectors. They are just accessed differently. Curried and uncurried
-// vectors behave identically in terms of collection. Only one must be
-// registered with a given registry (usually the uncurried version). The Reset
-// method deletes all metrics, even if called on a curried vector.
-func (v *HistogramVec) CurryWith(labels Labels) (ObserverVec, error) {
- vec, err := v.curryWith(labels)
- if vec != nil {
- return &HistogramVec{vec}, err
- }
- return nil, err
-}
-
-// MustCurryWith works as CurryWith but panics where CurryWith would have
-// returned an error.
-func (v *HistogramVec) MustCurryWith(labels Labels) ObserverVec {
- vec, err := v.CurryWith(labels)
- if err != nil {
- panic(err)
- }
- return vec
-}
-
-type constHistogram struct {
- desc *Desc
- count uint64
- sum float64
- buckets map[float64]uint64
- labelPairs []*dto.LabelPair
-}
-
-func (h *constHistogram) Desc() *Desc {
- return h.desc
-}
-
-func (h *constHistogram) Write(out *dto.Metric) error {
- his := &dto.Histogram{}
- buckets := make([]*dto.Bucket, 0, len(h.buckets))
-
- his.SampleCount = proto.Uint64(h.count)
- his.SampleSum = proto.Float64(h.sum)
-
- for upperBound, count := range h.buckets {
- buckets = append(buckets, &dto.Bucket{
- CumulativeCount: proto.Uint64(count),
- UpperBound: proto.Float64(upperBound),
- })
- }
-
- if len(buckets) > 0 {
- sort.Sort(buckSort(buckets))
- }
- his.Bucket = buckets
-
- out.Histogram = his
- out.Label = h.labelPairs
-
- return nil
-}
-
-// NewConstHistogram returns a metric representing a Prometheus histogram with
-// fixed values for the count, sum, and bucket counts. As those parameters
-// cannot be changed, the returned value does not implement the Histogram
-// interface (but only the Metric interface). Users of this package will not
-// have much use for it in regular operations. However, when implementing custom
-// Collectors, it is useful as a throw-away metric that is generated on the fly
-// to send it to Prometheus in the Collect method.
-//
-// buckets is a map of upper bounds to cumulative counts, excluding the +Inf
-// bucket.
-//
-// NewConstHistogram returns an error if the length of labelValues is not
-// consistent with the variable labels in Desc or if Desc is invalid.
-func NewConstHistogram(
- desc *Desc,
- count uint64,
- sum float64,
- buckets map[float64]uint64,
- labelValues ...string,
-) (Metric, error) {
- if desc.err != nil {
- return nil, desc.err
- }
- if err := validateLabelValues(labelValues, len(desc.variableLabels)); err != nil {
- return nil, err
- }
- return &constHistogram{
- desc: desc,
- count: count,
- sum: sum,
- buckets: buckets,
- labelPairs: makeLabelPairs(desc, labelValues),
- }, nil
-}
-
-// MustNewConstHistogram is a version of NewConstHistogram that panics where
-// NewConstMetric would have returned an error.
-func MustNewConstHistogram(
- desc *Desc,
- count uint64,
- sum float64,
- buckets map[float64]uint64,
- labelValues ...string,
-) Metric {
- m, err := NewConstHistogram(desc, count, sum, buckets, labelValues...)
- if err != nil {
- panic(err)
- }
- return m
-}
-
-type buckSort []*dto.Bucket
-
-func (s buckSort) Len() int {
- return len(s)
-}
-
-func (s buckSort) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
-}
-
-func (s buckSort) Less(i, j int) bool {
- return s[i].GetUpperBound() < s[j].GetUpperBound()
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/internal/metric.go b/vendor/github.com/prometheus/client_golang/prometheus/internal/metric.go
deleted file mode 100644
index 351c26e..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/internal/metric.go
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package internal
-
-import (
- "sort"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-// metricSorter is a sortable slice of *dto.Metric.
-type metricSorter []*dto.Metric
-
-func (s metricSorter) Len() int {
- return len(s)
-}
-
-func (s metricSorter) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
-}
-
-func (s metricSorter) Less(i, j int) bool {
- if len(s[i].Label) != len(s[j].Label) {
- // This should not happen. The metrics are
- // inconsistent. However, we have to deal with the fact, as
- // people might use custom collectors or metric family injection
- // to create inconsistent metrics. So let's simply compare the
- // number of labels in this case. That will still yield
- // reproducible sorting.
- return len(s[i].Label) < len(s[j].Label)
- }
- for n, lp := range s[i].Label {
- vi := lp.GetValue()
- vj := s[j].Label[n].GetValue()
- if vi != vj {
- return vi < vj
- }
- }
-
- // We should never arrive here. Multiple metrics with the same
- // label set in the same scrape will lead to undefined ingestion
- // behavior. However, as above, we have to provide stable sorting
- // here, even for inconsistent metrics. So sort equal metrics
- // by their timestamp, with missing timestamps (implying "now")
- // coming last.
- if s[i].TimestampMs == nil {
- return false
- }
- if s[j].TimestampMs == nil {
- return true
- }
- return s[i].GetTimestampMs() < s[j].GetTimestampMs()
-}
-
-// NormalizeMetricFamilies returns a MetricFamily slice with empty
-// MetricFamilies pruned and the remaining MetricFamilies sorted by name within
-// the slice, with the contained Metrics sorted within each MetricFamily.
-func NormalizeMetricFamilies(metricFamiliesByName map[string]*dto.MetricFamily) []*dto.MetricFamily {
- for _, mf := range metricFamiliesByName {
- sort.Sort(metricSorter(mf.Metric))
- }
- names := make([]string, 0, len(metricFamiliesByName))
- for name, mf := range metricFamiliesByName {
- if len(mf.Metric) > 0 {
- names = append(names, name)
- }
- }
- sort.Strings(names)
- result := make([]*dto.MetricFamily, 0, len(names))
- for _, name := range names {
- result = append(result, metricFamiliesByName[name])
- }
- return result
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/labels.go b/vendor/github.com/prometheus/client_golang/prometheus/labels.go
deleted file mode 100644
index 2744443..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/labels.go
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "errors"
- "fmt"
- "strings"
- "unicode/utf8"
-
- "github.com/prometheus/common/model"
-)
-
-// Labels represents a collection of label name -> value mappings. This type is
-// commonly used with the With(Labels) and GetMetricWith(Labels) methods of
-// metric vector Collectors, e.g.:
-// myVec.With(Labels{"code": "404", "method": "GET"}).Add(42)
-//
-// The other use-case is the specification of constant label pairs in Opts or to
-// create a Desc.
-type Labels map[string]string
-
-// reservedLabelPrefix is a prefix which is not legal in user-supplied
-// label names.
-const reservedLabelPrefix = "__"
-
-var errInconsistentCardinality = errors.New("inconsistent label cardinality")
-
-func makeInconsistentCardinalityError(fqName string, labels, labelValues []string) error {
- return fmt.Errorf(
- "%s: %q has %d variable labels named %q but %d values %q were provided",
- errInconsistentCardinality, fqName,
- len(labels), labels,
- len(labelValues), labelValues,
- )
-}
-
-func validateValuesInLabels(labels Labels, expectedNumberOfValues int) error {
- if len(labels) != expectedNumberOfValues {
- return fmt.Errorf(
- "%s: expected %d label values but got %d in %#v",
- errInconsistentCardinality, expectedNumberOfValues,
- len(labels), labels,
- )
- }
-
- for name, val := range labels {
- if !utf8.ValidString(val) {
- return fmt.Errorf("label %s: value %q is not valid UTF-8", name, val)
- }
- }
-
- return nil
-}
-
-func validateLabelValues(vals []string, expectedNumberOfValues int) error {
- if len(vals) != expectedNumberOfValues {
- return fmt.Errorf(
- "%s: expected %d label values but got %d in %#v",
- errInconsistentCardinality, expectedNumberOfValues,
- len(vals), vals,
- )
- }
-
- for _, val := range vals {
- if !utf8.ValidString(val) {
- return fmt.Errorf("label value %q is not valid UTF-8", val)
- }
- }
-
- return nil
-}
-
-func checkLabelName(l string) bool {
- return model.LabelName(l).IsValid() && !strings.HasPrefix(l, reservedLabelPrefix)
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/metric.go b/vendor/github.com/prometheus/client_golang/prometheus/metric.go
deleted file mode 100644
index 0df1eff..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/metric.go
+++ /dev/null
@@ -1,175 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "strings"
- "time"
-
- "github.com/golang/protobuf/proto"
- "github.com/prometheus/common/model"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-var separatorByteSlice = []byte{model.SeparatorByte} // For convenient use with xxhash.
-
-// A Metric models a single sample value with its meta data being exported to
-// Prometheus. Implementations of Metric in this package are Gauge, Counter,
-// Histogram, Summary, and Untyped.
-type Metric interface {
- // Desc returns the descriptor for the Metric. This method idempotently
- // returns the same descriptor throughout the lifetime of the
- // Metric. The returned descriptor is immutable by contract. A Metric
- // unable to describe itself must return an invalid descriptor (created
- // with NewInvalidDesc).
- Desc() *Desc
- // Write encodes the Metric into a "Metric" Protocol Buffer data
- // transmission object.
- //
- // Metric implementations must observe concurrency safety as reads of
- // this metric may occur at any time, and any blocking occurs at the
- // expense of total performance of rendering all registered
- // metrics. Ideally, Metric implementations should support concurrent
- // readers.
- //
- // While populating dto.Metric, it is the responsibility of the
- // implementation to ensure validity of the Metric protobuf (like valid
- // UTF-8 strings or syntactically valid metric and label names). It is
- // recommended to sort labels lexicographically. Callers of Write should
- // still make sure of sorting if they depend on it.
- Write(*dto.Metric) error
- // TODO(beorn7): The original rationale of passing in a pre-allocated
- // dto.Metric protobuf to save allocations has disappeared. The
- // signature of this method should be changed to "Write() (*dto.Metric,
- // error)".
-}
-
-// Opts bundles the options for creating most Metric types. Each metric
-// implementation XXX has its own XXXOpts type, but in most cases, it is just be
-// an alias of this type (which might change when the requirement arises.)
-//
-// It is mandatory to set Name to a non-empty string. All other fields are
-// optional and can safely be left at their zero value, although it is strongly
-// encouraged to set a Help string.
-type Opts struct {
- // Namespace, Subsystem, and Name are components of the fully-qualified
- // name of the Metric (created by joining these components with
- // "_"). Only Name is mandatory, the others merely help structuring the
- // name. Note that the fully-qualified name of the metric must be a
- // valid Prometheus metric name.
- Namespace string
- Subsystem string
- Name string
-
- // Help provides information about this metric.
- //
- // Metrics with the same fully-qualified name must have the same Help
- // string.
- Help string
-
- // ConstLabels are used to attach fixed labels to this metric. Metrics
- // with the same fully-qualified name must have the same label names in
- // their ConstLabels.
- //
- // ConstLabels are only used rarely. In particular, do not use them to
- // attach the same labels to all your metrics. Those use cases are
- // better covered by target labels set by the scraping Prometheus
- // server, or by one specific metric (e.g. a build_info or a
- // machine_role metric). See also
- // https://prometheus.io/docs/instrumenting/writing_exporters/#target-labels,-not-static-scraped-labels
- ConstLabels Labels
-}
-
-// BuildFQName joins the given three name components by "_". Empty name
-// components are ignored. If the name parameter itself is empty, an empty
-// string is returned, no matter what. Metric implementations included in this
-// library use this function internally to generate the fully-qualified metric
-// name from the name component in their Opts. Users of the library will only
-// need this function if they implement their own Metric or instantiate a Desc
-// (with NewDesc) directly.
-func BuildFQName(namespace, subsystem, name string) string {
- if name == "" {
- return ""
- }
- switch {
- case namespace != "" && subsystem != "":
- return strings.Join([]string{namespace, subsystem, name}, "_")
- case namespace != "":
- return strings.Join([]string{namespace, name}, "_")
- case subsystem != "":
- return strings.Join([]string{subsystem, name}, "_")
- }
- return name
-}
-
-// labelPairSorter implements sort.Interface. It is used to sort a slice of
-// dto.LabelPair pointers.
-type labelPairSorter []*dto.LabelPair
-
-func (s labelPairSorter) Len() int {
- return len(s)
-}
-
-func (s labelPairSorter) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
-}
-
-func (s labelPairSorter) Less(i, j int) bool {
- return s[i].GetName() < s[j].GetName()
-}
-
-type invalidMetric struct {
- desc *Desc
- err error
-}
-
-// NewInvalidMetric returns a metric whose Write method always returns the
-// provided error. It is useful if a Collector finds itself unable to collect
-// a metric and wishes to report an error to the registry.
-func NewInvalidMetric(desc *Desc, err error) Metric {
- return &invalidMetric{desc, err}
-}
-
-func (m *invalidMetric) Desc() *Desc { return m.desc }
-
-func (m *invalidMetric) Write(*dto.Metric) error { return m.err }
-
-type timestampedMetric struct {
- Metric
- t time.Time
-}
-
-func (m timestampedMetric) Write(pb *dto.Metric) error {
- e := m.Metric.Write(pb)
- pb.TimestampMs = proto.Int64(m.t.Unix()*1000 + int64(m.t.Nanosecond()/1000000))
- return e
-}
-
-// NewMetricWithTimestamp returns a new Metric wrapping the provided Metric in a
-// way that it has an explicit timestamp set to the provided Time. This is only
-// useful in rare cases as the timestamp of a Prometheus metric should usually
-// be set by the Prometheus server during scraping. Exceptions include mirroring
-// metrics with given timestamps from other metric
-// sources.
-//
-// NewMetricWithTimestamp works best with MustNewConstMetric,
-// MustNewConstHistogram, and MustNewConstSummary, see example.
-//
-// Currently, the exposition formats used by Prometheus are limited to
-// millisecond resolution. Thus, the provided time will be rounded down to the
-// next full millisecond value.
-func NewMetricWithTimestamp(t time.Time, m Metric) Metric {
- return timestampedMetric{Metric: m, t: t}
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/observer.go b/vendor/github.com/prometheus/client_golang/prometheus/observer.go
deleted file mode 100644
index 4412801..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/observer.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2017 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-// Observer is the interface that wraps the Observe method, which is used by
-// Histogram and Summary to add observations.
-type Observer interface {
- Observe(float64)
-}
-
-// The ObserverFunc type is an adapter to allow the use of ordinary
-// functions as Observers. If f is a function with the appropriate
-// signature, ObserverFunc(f) is an Observer that calls f.
-//
-// This adapter is usually used in connection with the Timer type, and there are
-// two general use cases:
-//
-// The most common one is to use a Gauge as the Observer for a Timer.
-// See the "Gauge" Timer example.
-//
-// The more advanced use case is to create a function that dynamically decides
-// which Observer to use for observing the duration. See the "Complex" Timer
-// example.
-type ObserverFunc func(float64)
-
-// Observe calls f(value). It implements Observer.
-func (f ObserverFunc) Observe(value float64) {
- f(value)
-}
-
-// ObserverVec is an interface implemented by `HistogramVec` and `SummaryVec`.
-type ObserverVec interface {
- GetMetricWith(Labels) (Observer, error)
- GetMetricWithLabelValues(lvs ...string) (Observer, error)
- With(Labels) Observer
- WithLabelValues(...string) Observer
- CurryWith(Labels) (ObserverVec, error)
- MustCurryWith(Labels) ObserverVec
-
- Collector
-}
-
-// ExemplarObserver is implemented by Observers that offer the option of
-// observing a value together with an exemplar. Its ObserveWithExemplar method
-// works like the Observe method of an Observer but also replaces the currently
-// saved exemplar (if any) with a new one, created from the provided value, the
-// current time as timestamp, and the provided Labels. Empty Labels will lead to
-// a valid (label-less) exemplar. But if Labels is nil, the current exemplar is
-// left in place. ObserveWithExemplar panics if any of the provided labels are
-// invalid or if the provided labels contain more than 64 runes in total.
-type ExemplarObserver interface {
- ObserveWithExemplar(value float64, exemplar Labels)
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go b/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go
deleted file mode 100644
index 9b80979..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "errors"
- "os"
-)
-
-type processCollector struct {
- collectFn func(chan<- Metric)
- pidFn func() (int, error)
- reportErrors bool
- cpuTotal *Desc
- openFDs, maxFDs *Desc
- vsize, maxVsize *Desc
- rss *Desc
- startTime *Desc
-}
-
-// ProcessCollectorOpts defines the behavior of a process metrics collector
-// created with NewProcessCollector.
-type ProcessCollectorOpts struct {
- // PidFn returns the PID of the process the collector collects metrics
- // for. It is called upon each collection. By default, the PID of the
- // current process is used, as determined on construction time by
- // calling os.Getpid().
- PidFn func() (int, error)
- // If non-empty, each of the collected metrics is prefixed by the
- // provided string and an underscore ("_").
- Namespace string
- // If true, any error encountered during collection is reported as an
- // invalid metric (see NewInvalidMetric). Otherwise, errors are ignored
- // and the collected metrics will be incomplete. (Possibly, no metrics
- // will be collected at all.) While that's usually not desired, it is
- // appropriate for the common "mix-in" of process metrics, where process
- // metrics are nice to have, but failing to collect them should not
- // disrupt the collection of the remaining metrics.
- ReportErrors bool
-}
-
-// NewProcessCollector returns a collector which exports the current state of
-// process metrics including CPU, memory and file descriptor usage as well as
-// the process start time. The detailed behavior is defined by the provided
-// ProcessCollectorOpts. The zero value of ProcessCollectorOpts creates a
-// collector for the current process with an empty namespace string and no error
-// reporting.
-//
-// The collector only works on operating systems with a Linux-style proc
-// filesystem and on Microsoft Windows. On other operating systems, it will not
-// collect any metrics.
-func NewProcessCollector(opts ProcessCollectorOpts) Collector {
- ns := ""
- if len(opts.Namespace) > 0 {
- ns = opts.Namespace + "_"
- }
-
- c := &processCollector{
- reportErrors: opts.ReportErrors,
- cpuTotal: NewDesc(
- ns+"process_cpu_seconds_total",
- "Total user and system CPU time spent in seconds.",
- nil, nil,
- ),
- openFDs: NewDesc(
- ns+"process_open_fds",
- "Number of open file descriptors.",
- nil, nil,
- ),
- maxFDs: NewDesc(
- ns+"process_max_fds",
- "Maximum number of open file descriptors.",
- nil, nil,
- ),
- vsize: NewDesc(
- ns+"process_virtual_memory_bytes",
- "Virtual memory size in bytes.",
- nil, nil,
- ),
- maxVsize: NewDesc(
- ns+"process_virtual_memory_max_bytes",
- "Maximum amount of virtual memory available in bytes.",
- nil, nil,
- ),
- rss: NewDesc(
- ns+"process_resident_memory_bytes",
- "Resident memory size in bytes.",
- nil, nil,
- ),
- startTime: NewDesc(
- ns+"process_start_time_seconds",
- "Start time of the process since unix epoch in seconds.",
- nil, nil,
- ),
- }
-
- if opts.PidFn == nil {
- pid := os.Getpid()
- c.pidFn = func() (int, error) { return pid, nil }
- } else {
- c.pidFn = opts.PidFn
- }
-
- // Set up process metric collection if supported by the runtime.
- if canCollectProcess() {
- c.collectFn = c.processCollect
- } else {
- c.collectFn = func(ch chan<- Metric) {
- c.reportError(ch, nil, errors.New("process metrics not supported on this platform"))
- }
- }
-
- return c
-}
-
-// Describe returns all descriptions of the collector.
-func (c *processCollector) Describe(ch chan<- *Desc) {
- ch <- c.cpuTotal
- ch <- c.openFDs
- ch <- c.maxFDs
- ch <- c.vsize
- ch <- c.maxVsize
- ch <- c.rss
- ch <- c.startTime
-}
-
-// Collect returns the current state of all metrics of the collector.
-func (c *processCollector) Collect(ch chan<- Metric) {
- c.collectFn(ch)
-}
-
-func (c *processCollector) reportError(ch chan<- Metric, desc *Desc, err error) {
- if !c.reportErrors {
- return
- }
- if desc == nil {
- desc = NewInvalidDesc(err)
- }
- ch <- NewInvalidMetric(desc, err)
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_other.go b/vendor/github.com/prometheus/client_golang/prometheus/process_collector_other.go
deleted file mode 100644
index 3117461..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_other.go
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build !windows
-
-package prometheus
-
-import (
- "github.com/prometheus/procfs"
-)
-
-func canCollectProcess() bool {
- _, err := procfs.NewDefaultFS()
- return err == nil
-}
-
-func (c *processCollector) processCollect(ch chan<- Metric) {
- pid, err := c.pidFn()
- if err != nil {
- c.reportError(ch, nil, err)
- return
- }
-
- p, err := procfs.NewProc(pid)
- if err != nil {
- c.reportError(ch, nil, err)
- return
- }
-
- if stat, err := p.Stat(); err == nil {
- ch <- MustNewConstMetric(c.cpuTotal, CounterValue, stat.CPUTime())
- ch <- MustNewConstMetric(c.vsize, GaugeValue, float64(stat.VirtualMemory()))
- ch <- MustNewConstMetric(c.rss, GaugeValue, float64(stat.ResidentMemory()))
- if startTime, err := stat.StartTime(); err == nil {
- ch <- MustNewConstMetric(c.startTime, GaugeValue, startTime)
- } else {
- c.reportError(ch, c.startTime, err)
- }
- } else {
- c.reportError(ch, nil, err)
- }
-
- if fds, err := p.FileDescriptorsLen(); err == nil {
- ch <- MustNewConstMetric(c.openFDs, GaugeValue, float64(fds))
- } else {
- c.reportError(ch, c.openFDs, err)
- }
-
- if limits, err := p.Limits(); err == nil {
- ch <- MustNewConstMetric(c.maxFDs, GaugeValue, float64(limits.OpenFiles))
- ch <- MustNewConstMetric(c.maxVsize, GaugeValue, float64(limits.AddressSpace))
- } else {
- c.reportError(ch, nil, err)
- }
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_windows.go b/vendor/github.com/prometheus/client_golang/prometheus/process_collector_windows.go
deleted file mode 100644
index e0b935d..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_windows.go
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "syscall"
- "unsafe"
-
- "golang.org/x/sys/windows"
-)
-
-func canCollectProcess() bool {
- return true
-}
-
-var (
- modpsapi = syscall.NewLazyDLL("psapi.dll")
- modkernel32 = syscall.NewLazyDLL("kernel32.dll")
-
- procGetProcessMemoryInfo = modpsapi.NewProc("GetProcessMemoryInfo")
- procGetProcessHandleCount = modkernel32.NewProc("GetProcessHandleCount")
-)
-
-type processMemoryCounters struct {
- // https://docs.microsoft.com/en-us/windows/desktop/api/psapi/ns-psapi-_process_memory_counters_ex
- _ uint32
- PageFaultCount uint32
- PeakWorkingSetSize uint64
- WorkingSetSize uint64
- QuotaPeakPagedPoolUsage uint64
- QuotaPagedPoolUsage uint64
- QuotaPeakNonPagedPoolUsage uint64
- QuotaNonPagedPoolUsage uint64
- PagefileUsage uint64
- PeakPagefileUsage uint64
- PrivateUsage uint64
-}
-
-func getProcessMemoryInfo(handle windows.Handle) (processMemoryCounters, error) {
- mem := processMemoryCounters{}
- r1, _, err := procGetProcessMemoryInfo.Call(
- uintptr(handle),
- uintptr(unsafe.Pointer(&mem)),
- uintptr(unsafe.Sizeof(mem)),
- )
- if r1 != 1 {
- return mem, err
- } else {
- return mem, nil
- }
-}
-
-func getProcessHandleCount(handle windows.Handle) (uint32, error) {
- var count uint32
- r1, _, err := procGetProcessHandleCount.Call(
- uintptr(handle),
- uintptr(unsafe.Pointer(&count)),
- )
- if r1 != 1 {
- return 0, err
- } else {
- return count, nil
- }
-}
-
-func (c *processCollector) processCollect(ch chan<- Metric) {
- h, err := windows.GetCurrentProcess()
- if err != nil {
- c.reportError(ch, nil, err)
- return
- }
-
- var startTime, exitTime, kernelTime, userTime windows.Filetime
- err = windows.GetProcessTimes(h, &startTime, &exitTime, &kernelTime, &userTime)
- if err != nil {
- c.reportError(ch, nil, err)
- return
- }
- ch <- MustNewConstMetric(c.startTime, GaugeValue, float64(startTime.Nanoseconds()/1e9))
- ch <- MustNewConstMetric(c.cpuTotal, CounterValue, fileTimeToSeconds(kernelTime)+fileTimeToSeconds(userTime))
-
- mem, err := getProcessMemoryInfo(h)
- if err != nil {
- c.reportError(ch, nil, err)
- return
- }
- ch <- MustNewConstMetric(c.vsize, GaugeValue, float64(mem.PrivateUsage))
- ch <- MustNewConstMetric(c.rss, GaugeValue, float64(mem.WorkingSetSize))
-
- handles, err := getProcessHandleCount(h)
- if err != nil {
- c.reportError(ch, nil, err)
- return
- }
- ch <- MustNewConstMetric(c.openFDs, GaugeValue, float64(handles))
- ch <- MustNewConstMetric(c.maxFDs, GaugeValue, float64(16*1024*1024)) // Windows has a hard-coded max limit, not per-process.
-}
-
-func fileTimeToSeconds(ft windows.Filetime) float64 {
- return float64(uint64(ft.HighDateTime)<<32+uint64(ft.LowDateTime)) / 1e7
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go
deleted file mode 100644
index 5070e72..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go
+++ /dev/null
@@ -1,370 +0,0 @@
-// Copyright 2017 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package promhttp
-
-import (
- "bufio"
- "io"
- "net"
- "net/http"
-)
-
-const (
- closeNotifier = 1 << iota
- flusher
- hijacker
- readerFrom
- pusher
-)
-
-type delegator interface {
- http.ResponseWriter
-
- Status() int
- Written() int64
-}
-
-type responseWriterDelegator struct {
- http.ResponseWriter
-
- status int
- written int64
- wroteHeader bool
- observeWriteHeader func(int)
-}
-
-func (r *responseWriterDelegator) Status() int {
- return r.status
-}
-
-func (r *responseWriterDelegator) Written() int64 {
- return r.written
-}
-
-func (r *responseWriterDelegator) WriteHeader(code int) {
- if r.observeWriteHeader != nil && !r.wroteHeader {
- // Only call observeWriteHeader for the 1st time. It's a bug if
- // WriteHeader is called more than once, but we want to protect
- // against it here. Note that we still delegate the WriteHeader
- // to the original ResponseWriter to not mask the bug from it.
- r.observeWriteHeader(code)
- }
- r.status = code
- r.wroteHeader = true
- r.ResponseWriter.WriteHeader(code)
-}
-
-func (r *responseWriterDelegator) Write(b []byte) (int, error) {
- // If applicable, call WriteHeader here so that observeWriteHeader is
- // handled appropriately.
- if !r.wroteHeader {
- r.WriteHeader(http.StatusOK)
- }
- n, err := r.ResponseWriter.Write(b)
- r.written += int64(n)
- return n, err
-}
-
-type closeNotifierDelegator struct{ *responseWriterDelegator }
-type flusherDelegator struct{ *responseWriterDelegator }
-type hijackerDelegator struct{ *responseWriterDelegator }
-type readerFromDelegator struct{ *responseWriterDelegator }
-type pusherDelegator struct{ *responseWriterDelegator }
-
-func (d closeNotifierDelegator) CloseNotify() <-chan bool {
- //lint:ignore SA1019 http.CloseNotifier is deprecated but we don't want to
- //remove support from client_golang yet.
- return d.ResponseWriter.(http.CloseNotifier).CloseNotify()
-}
-func (d flusherDelegator) Flush() {
- // If applicable, call WriteHeader here so that observeWriteHeader is
- // handled appropriately.
- if !d.wroteHeader {
- d.WriteHeader(http.StatusOK)
- }
- d.ResponseWriter.(http.Flusher).Flush()
-}
-func (d hijackerDelegator) Hijack() (net.Conn, *bufio.ReadWriter, error) {
- return d.ResponseWriter.(http.Hijacker).Hijack()
-}
-func (d readerFromDelegator) ReadFrom(re io.Reader) (int64, error) {
- // If applicable, call WriteHeader here so that observeWriteHeader is
- // handled appropriately.
- if !d.wroteHeader {
- d.WriteHeader(http.StatusOK)
- }
- n, err := d.ResponseWriter.(io.ReaderFrom).ReadFrom(re)
- d.written += n
- return n, err
-}
-func (d pusherDelegator) Push(target string, opts *http.PushOptions) error {
- return d.ResponseWriter.(http.Pusher).Push(target, opts)
-}
-
-var pickDelegator = make([]func(*responseWriterDelegator) delegator, 32)
-
-func init() {
- // TODO(beorn7): Code generation would help here.
- pickDelegator[0] = func(d *responseWriterDelegator) delegator { // 0
- return d
- }
- pickDelegator[closeNotifier] = func(d *responseWriterDelegator) delegator { // 1
- return closeNotifierDelegator{d}
- }
- pickDelegator[flusher] = func(d *responseWriterDelegator) delegator { // 2
- return flusherDelegator{d}
- }
- pickDelegator[flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 3
- return struct {
- *responseWriterDelegator
- http.Flusher
- http.CloseNotifier
- }{d, flusherDelegator{d}, closeNotifierDelegator{d}}
- }
- pickDelegator[hijacker] = func(d *responseWriterDelegator) delegator { // 4
- return hijackerDelegator{d}
- }
- pickDelegator[hijacker+closeNotifier] = func(d *responseWriterDelegator) delegator { // 5
- return struct {
- *responseWriterDelegator
- http.Hijacker
- http.CloseNotifier
- }{d, hijackerDelegator{d}, closeNotifierDelegator{d}}
- }
- pickDelegator[hijacker+flusher] = func(d *responseWriterDelegator) delegator { // 6
- return struct {
- *responseWriterDelegator
- http.Hijacker
- http.Flusher
- }{d, hijackerDelegator{d}, flusherDelegator{d}}
- }
- pickDelegator[hijacker+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 7
- return struct {
- *responseWriterDelegator
- http.Hijacker
- http.Flusher
- http.CloseNotifier
- }{d, hijackerDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}}
- }
- pickDelegator[readerFrom] = func(d *responseWriterDelegator) delegator { // 8
- return readerFromDelegator{d}
- }
- pickDelegator[readerFrom+closeNotifier] = func(d *responseWriterDelegator) delegator { // 9
- return struct {
- *responseWriterDelegator
- io.ReaderFrom
- http.CloseNotifier
- }{d, readerFromDelegator{d}, closeNotifierDelegator{d}}
- }
- pickDelegator[readerFrom+flusher] = func(d *responseWriterDelegator) delegator { // 10
- return struct {
- *responseWriterDelegator
- io.ReaderFrom
- http.Flusher
- }{d, readerFromDelegator{d}, flusherDelegator{d}}
- }
- pickDelegator[readerFrom+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 11
- return struct {
- *responseWriterDelegator
- io.ReaderFrom
- http.Flusher
- http.CloseNotifier
- }{d, readerFromDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}}
- }
- pickDelegator[readerFrom+hijacker] = func(d *responseWriterDelegator) delegator { // 12
- return struct {
- *responseWriterDelegator
- io.ReaderFrom
- http.Hijacker
- }{d, readerFromDelegator{d}, hijackerDelegator{d}}
- }
- pickDelegator[readerFrom+hijacker+closeNotifier] = func(d *responseWriterDelegator) delegator { // 13
- return struct {
- *responseWriterDelegator
- io.ReaderFrom
- http.Hijacker
- http.CloseNotifier
- }{d, readerFromDelegator{d}, hijackerDelegator{d}, closeNotifierDelegator{d}}
- }
- pickDelegator[readerFrom+hijacker+flusher] = func(d *responseWriterDelegator) delegator { // 14
- return struct {
- *responseWriterDelegator
- io.ReaderFrom
- http.Hijacker
- http.Flusher
- }{d, readerFromDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}}
- }
- pickDelegator[readerFrom+hijacker+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 15
- return struct {
- *responseWriterDelegator
- io.ReaderFrom
- http.Hijacker
- http.Flusher
- http.CloseNotifier
- }{d, readerFromDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}}
- }
- pickDelegator[pusher] = func(d *responseWriterDelegator) delegator { // 16
- return pusherDelegator{d}
- }
- pickDelegator[pusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 17
- return struct {
- *responseWriterDelegator
- http.Pusher
- http.CloseNotifier
- }{d, pusherDelegator{d}, closeNotifierDelegator{d}}
- }
- pickDelegator[pusher+flusher] = func(d *responseWriterDelegator) delegator { // 18
- return struct {
- *responseWriterDelegator
- http.Pusher
- http.Flusher
- }{d, pusherDelegator{d}, flusherDelegator{d}}
- }
- pickDelegator[pusher+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 19
- return struct {
- *responseWriterDelegator
- http.Pusher
- http.Flusher
- http.CloseNotifier
- }{d, pusherDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}}
- }
- pickDelegator[pusher+hijacker] = func(d *responseWriterDelegator) delegator { // 20
- return struct {
- *responseWriterDelegator
- http.Pusher
- http.Hijacker
- }{d, pusherDelegator{d}, hijackerDelegator{d}}
- }
- pickDelegator[pusher+hijacker+closeNotifier] = func(d *responseWriterDelegator) delegator { // 21
- return struct {
- *responseWriterDelegator
- http.Pusher
- http.Hijacker
- http.CloseNotifier
- }{d, pusherDelegator{d}, hijackerDelegator{d}, closeNotifierDelegator{d}}
- }
- pickDelegator[pusher+hijacker+flusher] = func(d *responseWriterDelegator) delegator { // 22
- return struct {
- *responseWriterDelegator
- http.Pusher
- http.Hijacker
- http.Flusher
- }{d, pusherDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}}
- }
- pickDelegator[pusher+hijacker+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { //23
- return struct {
- *responseWriterDelegator
- http.Pusher
- http.Hijacker
- http.Flusher
- http.CloseNotifier
- }{d, pusherDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}}
- }
- pickDelegator[pusher+readerFrom] = func(d *responseWriterDelegator) delegator { // 24
- return struct {
- *responseWriterDelegator
- http.Pusher
- io.ReaderFrom
- }{d, pusherDelegator{d}, readerFromDelegator{d}}
- }
- pickDelegator[pusher+readerFrom+closeNotifier] = func(d *responseWriterDelegator) delegator { // 25
- return struct {
- *responseWriterDelegator
- http.Pusher
- io.ReaderFrom
- http.CloseNotifier
- }{d, pusherDelegator{d}, readerFromDelegator{d}, closeNotifierDelegator{d}}
- }
- pickDelegator[pusher+readerFrom+flusher] = func(d *responseWriterDelegator) delegator { // 26
- return struct {
- *responseWriterDelegator
- http.Pusher
- io.ReaderFrom
- http.Flusher
- }{d, pusherDelegator{d}, readerFromDelegator{d}, flusherDelegator{d}}
- }
- pickDelegator[pusher+readerFrom+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 27
- return struct {
- *responseWriterDelegator
- http.Pusher
- io.ReaderFrom
- http.Flusher
- http.CloseNotifier
- }{d, pusherDelegator{d}, readerFromDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}}
- }
- pickDelegator[pusher+readerFrom+hijacker] = func(d *responseWriterDelegator) delegator { // 28
- return struct {
- *responseWriterDelegator
- http.Pusher
- io.ReaderFrom
- http.Hijacker
- }{d, pusherDelegator{d}, readerFromDelegator{d}, hijackerDelegator{d}}
- }
- pickDelegator[pusher+readerFrom+hijacker+closeNotifier] = func(d *responseWriterDelegator) delegator { // 29
- return struct {
- *responseWriterDelegator
- http.Pusher
- io.ReaderFrom
- http.Hijacker
- http.CloseNotifier
- }{d, pusherDelegator{d}, readerFromDelegator{d}, hijackerDelegator{d}, closeNotifierDelegator{d}}
- }
- pickDelegator[pusher+readerFrom+hijacker+flusher] = func(d *responseWriterDelegator) delegator { // 30
- return struct {
- *responseWriterDelegator
- http.Pusher
- io.ReaderFrom
- http.Hijacker
- http.Flusher
- }{d, pusherDelegator{d}, readerFromDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}}
- }
- pickDelegator[pusher+readerFrom+hijacker+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 31
- return struct {
- *responseWriterDelegator
- http.Pusher
- io.ReaderFrom
- http.Hijacker
- http.Flusher
- http.CloseNotifier
- }{d, pusherDelegator{d}, readerFromDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}}
- }
-}
-
-func newDelegator(w http.ResponseWriter, observeWriteHeaderFunc func(int)) delegator {
- d := &responseWriterDelegator{
- ResponseWriter: w,
- observeWriteHeader: observeWriteHeaderFunc,
- }
-
- id := 0
- //lint:ignore SA1019 http.CloseNotifier is deprecated but we don't want to
- //remove support from client_golang yet.
- if _, ok := w.(http.CloseNotifier); ok {
- id += closeNotifier
- }
- if _, ok := w.(http.Flusher); ok {
- id += flusher
- }
- if _, ok := w.(http.Hijacker); ok {
- id += hijacker
- }
- if _, ok := w.(io.ReaderFrom); ok {
- id += readerFrom
- }
- if _, ok := w.(http.Pusher); ok {
- id += pusher
- }
-
- return pickDelegator[id](d)
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go
deleted file mode 100644
index 5e1c454..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go
+++ /dev/null
@@ -1,379 +0,0 @@
-// Copyright 2016 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package promhttp provides tooling around HTTP servers and clients.
-//
-// First, the package allows the creation of http.Handler instances to expose
-// Prometheus metrics via HTTP. promhttp.Handler acts on the
-// prometheus.DefaultGatherer. With HandlerFor, you can create a handler for a
-// custom registry or anything that implements the Gatherer interface. It also
-// allows the creation of handlers that act differently on errors or allow to
-// log errors.
-//
-// Second, the package provides tooling to instrument instances of http.Handler
-// via middleware. Middleware wrappers follow the naming scheme
-// InstrumentHandlerX, where X describes the intended use of the middleware.
-// See each function's doc comment for specific details.
-//
-// Finally, the package allows for an http.RoundTripper to be instrumented via
-// middleware. Middleware wrappers follow the naming scheme
-// InstrumentRoundTripperX, where X describes the intended use of the
-// middleware. See each function's doc comment for specific details.
-package promhttp
-
-import (
- "compress/gzip"
- "fmt"
- "io"
- "net/http"
- "strings"
- "sync"
- "time"
-
- "github.com/prometheus/common/expfmt"
-
- "github.com/prometheus/client_golang/prometheus"
-)
-
-const (
- contentTypeHeader = "Content-Type"
- contentEncodingHeader = "Content-Encoding"
- acceptEncodingHeader = "Accept-Encoding"
-)
-
-var gzipPool = sync.Pool{
- New: func() interface{} {
- return gzip.NewWriter(nil)
- },
-}
-
-// Handler returns an http.Handler for the prometheus.DefaultGatherer, using
-// default HandlerOpts, i.e. it reports the first error as an HTTP error, it has
-// no error logging, and it applies compression if requested by the client.
-//
-// The returned http.Handler is already instrumented using the
-// InstrumentMetricHandler function and the prometheus.DefaultRegisterer. If you
-// create multiple http.Handlers by separate calls of the Handler function, the
-// metrics used for instrumentation will be shared between them, providing
-// global scrape counts.
-//
-// This function is meant to cover the bulk of basic use cases. If you are doing
-// anything that requires more customization (including using a non-default
-// Gatherer, different instrumentation, and non-default HandlerOpts), use the
-// HandlerFor function. See there for details.
-func Handler() http.Handler {
- return InstrumentMetricHandler(
- prometheus.DefaultRegisterer, HandlerFor(prometheus.DefaultGatherer, HandlerOpts{}),
- )
-}
-
-// HandlerFor returns an uninstrumented http.Handler for the provided
-// Gatherer. The behavior of the Handler is defined by the provided
-// HandlerOpts. Thus, HandlerFor is useful to create http.Handlers for custom
-// Gatherers, with non-default HandlerOpts, and/or with custom (or no)
-// instrumentation. Use the InstrumentMetricHandler function to apply the same
-// kind of instrumentation as it is used by the Handler function.
-func HandlerFor(reg prometheus.Gatherer, opts HandlerOpts) http.Handler {
- var (
- inFlightSem chan struct{}
- errCnt = prometheus.NewCounterVec(
- prometheus.CounterOpts{
- Name: "promhttp_metric_handler_errors_total",
- Help: "Total number of internal errors encountered by the promhttp metric handler.",
- },
- []string{"cause"},
- )
- )
-
- if opts.MaxRequestsInFlight > 0 {
- inFlightSem = make(chan struct{}, opts.MaxRequestsInFlight)
- }
- if opts.Registry != nil {
- // Initialize all possibilites that can occur below.
- errCnt.WithLabelValues("gathering")
- errCnt.WithLabelValues("encoding")
- if err := opts.Registry.Register(errCnt); err != nil {
- if are, ok := err.(prometheus.AlreadyRegisteredError); ok {
- errCnt = are.ExistingCollector.(*prometheus.CounterVec)
- } else {
- panic(err)
- }
- }
- }
-
- h := http.HandlerFunc(func(rsp http.ResponseWriter, req *http.Request) {
- if inFlightSem != nil {
- select {
- case inFlightSem <- struct{}{}: // All good, carry on.
- defer func() { <-inFlightSem }()
- default:
- http.Error(rsp, fmt.Sprintf(
- "Limit of concurrent requests reached (%d), try again later.", opts.MaxRequestsInFlight,
- ), http.StatusServiceUnavailable)
- return
- }
- }
- mfs, err := reg.Gather()
- if err != nil {
- if opts.ErrorLog != nil {
- opts.ErrorLog.Println("error gathering metrics:", err)
- }
- errCnt.WithLabelValues("gathering").Inc()
- switch opts.ErrorHandling {
- case PanicOnError:
- panic(err)
- case ContinueOnError:
- if len(mfs) == 0 {
- // Still report the error if no metrics have been gathered.
- httpError(rsp, err)
- return
- }
- case HTTPErrorOnError:
- httpError(rsp, err)
- return
- }
- }
-
- var contentType expfmt.Format
- if opts.EnableOpenMetrics {
- contentType = expfmt.NegotiateIncludingOpenMetrics(req.Header)
- } else {
- contentType = expfmt.Negotiate(req.Header)
- }
- header := rsp.Header()
- header.Set(contentTypeHeader, string(contentType))
-
- w := io.Writer(rsp)
- if !opts.DisableCompression && gzipAccepted(req.Header) {
- header.Set(contentEncodingHeader, "gzip")
- gz := gzipPool.Get().(*gzip.Writer)
- defer gzipPool.Put(gz)
-
- gz.Reset(w)
- defer gz.Close()
-
- w = gz
- }
-
- enc := expfmt.NewEncoder(w, contentType)
-
- // handleError handles the error according to opts.ErrorHandling
- // and returns true if we have to abort after the handling.
- handleError := func(err error) bool {
- if err == nil {
- return false
- }
- if opts.ErrorLog != nil {
- opts.ErrorLog.Println("error encoding and sending metric family:", err)
- }
- errCnt.WithLabelValues("encoding").Inc()
- switch opts.ErrorHandling {
- case PanicOnError:
- panic(err)
- case HTTPErrorOnError:
- // We cannot really send an HTTP error at this
- // point because we most likely have written
- // something to rsp already. But at least we can
- // stop sending.
- return true
- }
- // Do nothing in all other cases, including ContinueOnError.
- return false
- }
-
- for _, mf := range mfs {
- if handleError(enc.Encode(mf)) {
- return
- }
- }
- if closer, ok := enc.(expfmt.Closer); ok {
- // This in particular takes care of the final "# EOF\n" line for OpenMetrics.
- if handleError(closer.Close()) {
- return
- }
- }
- })
-
- if opts.Timeout <= 0 {
- return h
- }
- return http.TimeoutHandler(h, opts.Timeout, fmt.Sprintf(
- "Exceeded configured timeout of %v.\n",
- opts.Timeout,
- ))
-}
-
-// InstrumentMetricHandler is usually used with an http.Handler returned by the
-// HandlerFor function. It instruments the provided http.Handler with two
-// metrics: A counter vector "promhttp_metric_handler_requests_total" to count
-// scrapes partitioned by HTTP status code, and a gauge
-// "promhttp_metric_handler_requests_in_flight" to track the number of
-// simultaneous scrapes. This function idempotently registers collectors for
-// both metrics with the provided Registerer. It panics if the registration
-// fails. The provided metrics are useful to see how many scrapes hit the
-// monitored target (which could be from different Prometheus servers or other
-// scrapers), and how often they overlap (which would result in more than one
-// scrape in flight at the same time). Note that the scrapes-in-flight gauge
-// will contain the scrape by which it is exposed, while the scrape counter will
-// only get incremented after the scrape is complete (as only then the status
-// code is known). For tracking scrape durations, use the
-// "scrape_duration_seconds" gauge created by the Prometheus server upon each
-// scrape.
-func InstrumentMetricHandler(reg prometheus.Registerer, handler http.Handler) http.Handler {
- cnt := prometheus.NewCounterVec(
- prometheus.CounterOpts{
- Name: "promhttp_metric_handler_requests_total",
- Help: "Total number of scrapes by HTTP status code.",
- },
- []string{"code"},
- )
- // Initialize the most likely HTTP status codes.
- cnt.WithLabelValues("200")
- cnt.WithLabelValues("500")
- cnt.WithLabelValues("503")
- if err := reg.Register(cnt); err != nil {
- if are, ok := err.(prometheus.AlreadyRegisteredError); ok {
- cnt = are.ExistingCollector.(*prometheus.CounterVec)
- } else {
- panic(err)
- }
- }
-
- gge := prometheus.NewGauge(prometheus.GaugeOpts{
- Name: "promhttp_metric_handler_requests_in_flight",
- Help: "Current number of scrapes being served.",
- })
- if err := reg.Register(gge); err != nil {
- if are, ok := err.(prometheus.AlreadyRegisteredError); ok {
- gge = are.ExistingCollector.(prometheus.Gauge)
- } else {
- panic(err)
- }
- }
-
- return InstrumentHandlerCounter(cnt, InstrumentHandlerInFlight(gge, handler))
-}
-
-// HandlerErrorHandling defines how a Handler serving metrics will handle
-// errors.
-type HandlerErrorHandling int
-
-// These constants cause handlers serving metrics to behave as described if
-// errors are encountered.
-const (
- // Serve an HTTP status code 500 upon the first error
- // encountered. Report the error message in the body. Note that HTTP
- // errors cannot be served anymore once the beginning of a regular
- // payload has been sent. Thus, in the (unlikely) case that encoding the
- // payload into the negotiated wire format fails, serving the response
- // will simply be aborted. Set an ErrorLog in HandlerOpts to detect
- // those errors.
- HTTPErrorOnError HandlerErrorHandling = iota
- // Ignore errors and try to serve as many metrics as possible. However,
- // if no metrics can be served, serve an HTTP status code 500 and the
- // last error message in the body. Only use this in deliberate "best
- // effort" metrics collection scenarios. In this case, it is highly
- // recommended to provide other means of detecting errors: By setting an
- // ErrorLog in HandlerOpts, the errors are logged. By providing a
- // Registry in HandlerOpts, the exposed metrics include an error counter
- // "promhttp_metric_handler_errors_total", which can be used for
- // alerts.
- ContinueOnError
- // Panic upon the first error encountered (useful for "crash only" apps).
- PanicOnError
-)
-
-// Logger is the minimal interface HandlerOpts needs for logging. Note that
-// log.Logger from the standard library implements this interface, and it is
-// easy to implement by custom loggers, if they don't do so already anyway.
-type Logger interface {
- Println(v ...interface{})
-}
-
-// HandlerOpts specifies options how to serve metrics via an http.Handler. The
-// zero value of HandlerOpts is a reasonable default.
-type HandlerOpts struct {
- // ErrorLog specifies an optional logger for errors collecting and
- // serving metrics. If nil, errors are not logged at all.
- ErrorLog Logger
- // ErrorHandling defines how errors are handled. Note that errors are
- // logged regardless of the configured ErrorHandling provided ErrorLog
- // is not nil.
- ErrorHandling HandlerErrorHandling
- // If Registry is not nil, it is used to register a metric
- // "promhttp_metric_handler_errors_total", partitioned by "cause". A
- // failed registration causes a panic. Note that this error counter is
- // different from the instrumentation you get from the various
- // InstrumentHandler... helpers. It counts errors that don't necessarily
- // result in a non-2xx HTTP status code. There are two typical cases:
- // (1) Encoding errors that only happen after streaming of the HTTP body
- // has already started (and the status code 200 has been sent). This
- // should only happen with custom collectors. (2) Collection errors with
- // no effect on the HTTP status code because ErrorHandling is set to
- // ContinueOnError.
- Registry prometheus.Registerer
- // If DisableCompression is true, the handler will never compress the
- // response, even if requested by the client.
- DisableCompression bool
- // The number of concurrent HTTP requests is limited to
- // MaxRequestsInFlight. Additional requests are responded to with 503
- // Service Unavailable and a suitable message in the body. If
- // MaxRequestsInFlight is 0 or negative, no limit is applied.
- MaxRequestsInFlight int
- // If handling a request takes longer than Timeout, it is responded to
- // with 503 ServiceUnavailable and a suitable Message. No timeout is
- // applied if Timeout is 0 or negative. Note that with the current
- // implementation, reaching the timeout simply ends the HTTP requests as
- // described above (and even that only if sending of the body hasn't
- // started yet), while the bulk work of gathering all the metrics keeps
- // running in the background (with the eventual result to be thrown
- // away). Until the implementation is improved, it is recommended to
- // implement a separate timeout in potentially slow Collectors.
- Timeout time.Duration
- // If true, the experimental OpenMetrics encoding is added to the
- // possible options during content negotiation. Note that Prometheus
- // 2.5.0+ will negotiate OpenMetrics as first priority. OpenMetrics is
- // the only way to transmit exemplars. However, the move to OpenMetrics
- // is not completely transparent. Most notably, the values of "quantile"
- // labels of Summaries and "le" labels of Histograms are formatted with
- // a trailing ".0" if they would otherwise look like integer numbers
- // (which changes the identity of the resulting series on the Prometheus
- // server).
- EnableOpenMetrics bool
-}
-
-// gzipAccepted returns whether the client will accept gzip-encoded content.
-func gzipAccepted(header http.Header) bool {
- a := header.Get(acceptEncodingHeader)
- parts := strings.Split(a, ",")
- for _, part := range parts {
- part = strings.TrimSpace(part)
- if part == "gzip" || strings.HasPrefix(part, "gzip;") {
- return true
- }
- }
- return false
-}
-
-// httpError removes any content-encoding header and then calls http.Error with
-// the provided error and http.StatusInternalServerError. Error contents is
-// supposed to be uncompressed plain text. Same as with a plain http.Error, this
-// must not be called if the header or any payload has already been sent.
-func httpError(rsp http.ResponseWriter, err error) {
- rsp.Header().Del(contentEncodingHeader)
- http.Error(
- rsp,
- "An error has occurred while serving metrics:\n\n"+err.Error(),
- http.StatusInternalServerError,
- )
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client.go
deleted file mode 100644
index 83c49b6..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client.go
+++ /dev/null
@@ -1,219 +0,0 @@
-// Copyright 2017 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package promhttp
-
-import (
- "crypto/tls"
- "net/http"
- "net/http/httptrace"
- "time"
-
- "github.com/prometheus/client_golang/prometheus"
-)
-
-// The RoundTripperFunc type is an adapter to allow the use of ordinary
-// functions as RoundTrippers. If f is a function with the appropriate
-// signature, RountTripperFunc(f) is a RoundTripper that calls f.
-type RoundTripperFunc func(req *http.Request) (*http.Response, error)
-
-// RoundTrip implements the RoundTripper interface.
-func (rt RoundTripperFunc) RoundTrip(r *http.Request) (*http.Response, error) {
- return rt(r)
-}
-
-// InstrumentRoundTripperInFlight is a middleware that wraps the provided
-// http.RoundTripper. It sets the provided prometheus.Gauge to the number of
-// requests currently handled by the wrapped http.RoundTripper.
-//
-// See the example for ExampleInstrumentRoundTripperDuration for example usage.
-func InstrumentRoundTripperInFlight(gauge prometheus.Gauge, next http.RoundTripper) RoundTripperFunc {
- return RoundTripperFunc(func(r *http.Request) (*http.Response, error) {
- gauge.Inc()
- defer gauge.Dec()
- return next.RoundTrip(r)
- })
-}
-
-// InstrumentRoundTripperCounter is a middleware that wraps the provided
-// http.RoundTripper to observe the request result with the provided CounterVec.
-// The CounterVec must have zero, one, or two non-const non-curried labels. For
-// those, the only allowed label names are "code" and "method". The function
-// panics otherwise. Partitioning of the CounterVec happens by HTTP status code
-// and/or HTTP method if the respective instance label names are present in the
-// CounterVec. For unpartitioned counting, use a CounterVec with zero labels.
-//
-// If the wrapped RoundTripper panics or returns a non-nil error, the Counter
-// is not incremented.
-//
-// See the example for ExampleInstrumentRoundTripperDuration for example usage.
-func InstrumentRoundTripperCounter(counter *prometheus.CounterVec, next http.RoundTripper) RoundTripperFunc {
- code, method := checkLabels(counter)
-
- return RoundTripperFunc(func(r *http.Request) (*http.Response, error) {
- resp, err := next.RoundTrip(r)
- if err == nil {
- counter.With(labels(code, method, r.Method, resp.StatusCode)).Inc()
- }
- return resp, err
- })
-}
-
-// InstrumentRoundTripperDuration is a middleware that wraps the provided
-// http.RoundTripper to observe the request duration with the provided
-// ObserverVec. The ObserverVec must have zero, one, or two non-const
-// non-curried labels. For those, the only allowed label names are "code" and
-// "method". The function panics otherwise. The Observe method of the Observer
-// in the ObserverVec is called with the request duration in
-// seconds. Partitioning happens by HTTP status code and/or HTTP method if the
-// respective instance label names are present in the ObserverVec. For
-// unpartitioned observations, use an ObserverVec with zero labels. Note that
-// partitioning of Histograms is expensive and should be used judiciously.
-//
-// If the wrapped RoundTripper panics or returns a non-nil error, no values are
-// reported.
-//
-// Note that this method is only guaranteed to never observe negative durations
-// if used with Go1.9+.
-func InstrumentRoundTripperDuration(obs prometheus.ObserverVec, next http.RoundTripper) RoundTripperFunc {
- code, method := checkLabels(obs)
-
- return RoundTripperFunc(func(r *http.Request) (*http.Response, error) {
- start := time.Now()
- resp, err := next.RoundTrip(r)
- if err == nil {
- obs.With(labels(code, method, r.Method, resp.StatusCode)).Observe(time.Since(start).Seconds())
- }
- return resp, err
- })
-}
-
-// InstrumentTrace is used to offer flexibility in instrumenting the available
-// httptrace.ClientTrace hook functions. Each function is passed a float64
-// representing the time in seconds since the start of the http request. A user
-// may choose to use separately buckets Histograms, or implement custom
-// instance labels on a per function basis.
-type InstrumentTrace struct {
- GotConn func(float64)
- PutIdleConn func(float64)
- GotFirstResponseByte func(float64)
- Got100Continue func(float64)
- DNSStart func(float64)
- DNSDone func(float64)
- ConnectStart func(float64)
- ConnectDone func(float64)
- TLSHandshakeStart func(float64)
- TLSHandshakeDone func(float64)
- WroteHeaders func(float64)
- Wait100Continue func(float64)
- WroteRequest func(float64)
-}
-
-// InstrumentRoundTripperTrace is a middleware that wraps the provided
-// RoundTripper and reports times to hook functions provided in the
-// InstrumentTrace struct. Hook functions that are not present in the provided
-// InstrumentTrace struct are ignored. Times reported to the hook functions are
-// time since the start of the request. Only with Go1.9+, those times are
-// guaranteed to never be negative. (Earlier Go versions are not using a
-// monotonic clock.) Note that partitioning of Histograms is expensive and
-// should be used judiciously.
-//
-// For hook functions that receive an error as an argument, no observations are
-// made in the event of a non-nil error value.
-//
-// See the example for ExampleInstrumentRoundTripperDuration for example usage.
-func InstrumentRoundTripperTrace(it *InstrumentTrace, next http.RoundTripper) RoundTripperFunc {
- return RoundTripperFunc(func(r *http.Request) (*http.Response, error) {
- start := time.Now()
-
- trace := &httptrace.ClientTrace{
- GotConn: func(_ httptrace.GotConnInfo) {
- if it.GotConn != nil {
- it.GotConn(time.Since(start).Seconds())
- }
- },
- PutIdleConn: func(err error) {
- if err != nil {
- return
- }
- if it.PutIdleConn != nil {
- it.PutIdleConn(time.Since(start).Seconds())
- }
- },
- DNSStart: func(_ httptrace.DNSStartInfo) {
- if it.DNSStart != nil {
- it.DNSStart(time.Since(start).Seconds())
- }
- },
- DNSDone: func(_ httptrace.DNSDoneInfo) {
- if it.DNSDone != nil {
- it.DNSDone(time.Since(start).Seconds())
- }
- },
- ConnectStart: func(_, _ string) {
- if it.ConnectStart != nil {
- it.ConnectStart(time.Since(start).Seconds())
- }
- },
- ConnectDone: func(_, _ string, err error) {
- if err != nil {
- return
- }
- if it.ConnectDone != nil {
- it.ConnectDone(time.Since(start).Seconds())
- }
- },
- GotFirstResponseByte: func() {
- if it.GotFirstResponseByte != nil {
- it.GotFirstResponseByte(time.Since(start).Seconds())
- }
- },
- Got100Continue: func() {
- if it.Got100Continue != nil {
- it.Got100Continue(time.Since(start).Seconds())
- }
- },
- TLSHandshakeStart: func() {
- if it.TLSHandshakeStart != nil {
- it.TLSHandshakeStart(time.Since(start).Seconds())
- }
- },
- TLSHandshakeDone: func(_ tls.ConnectionState, err error) {
- if err != nil {
- return
- }
- if it.TLSHandshakeDone != nil {
- it.TLSHandshakeDone(time.Since(start).Seconds())
- }
- },
- WroteHeaders: func() {
- if it.WroteHeaders != nil {
- it.WroteHeaders(time.Since(start).Seconds())
- }
- },
- Wait100Continue: func() {
- if it.Wait100Continue != nil {
- it.Wait100Continue(time.Since(start).Seconds())
- }
- },
- WroteRequest: func(_ httptrace.WroteRequestInfo) {
- if it.WroteRequest != nil {
- it.WroteRequest(time.Since(start).Seconds())
- }
- },
- }
- r = r.WithContext(httptrace.WithClientTrace(r.Context(), trace))
-
- return next.RoundTrip(r)
- })
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server.go
deleted file mode 100644
index 9db2438..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server.go
+++ /dev/null
@@ -1,447 +0,0 @@
-// Copyright 2017 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package promhttp
-
-import (
- "errors"
- "net/http"
- "strconv"
- "strings"
- "time"
-
- dto "github.com/prometheus/client_model/go"
-
- "github.com/prometheus/client_golang/prometheus"
-)
-
-// magicString is used for the hacky label test in checkLabels. Remove once fixed.
-const magicString = "zZgWfBxLqvG8kc8IMv3POi2Bb0tZI3vAnBx+gBaFi9FyPzB/CzKUer1yufDa"
-
-// InstrumentHandlerInFlight is a middleware that wraps the provided
-// http.Handler. It sets the provided prometheus.Gauge to the number of
-// requests currently handled by the wrapped http.Handler.
-//
-// See the example for InstrumentHandlerDuration for example usage.
-func InstrumentHandlerInFlight(g prometheus.Gauge, next http.Handler) http.Handler {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- g.Inc()
- defer g.Dec()
- next.ServeHTTP(w, r)
- })
-}
-
-// InstrumentHandlerDuration is a middleware that wraps the provided
-// http.Handler to observe the request duration with the provided ObserverVec.
-// The ObserverVec must have zero, one, or two non-const non-curried labels. For
-// those, the only allowed label names are "code" and "method". The function
-// panics otherwise. The Observe method of the Observer in the ObserverVec is
-// called with the request duration in seconds. Partitioning happens by HTTP
-// status code and/or HTTP method if the respective instance label names are
-// present in the ObserverVec. For unpartitioned observations, use an
-// ObserverVec with zero labels. Note that partitioning of Histograms is
-// expensive and should be used judiciously.
-//
-// If the wrapped Handler does not set a status code, a status code of 200 is assumed.
-//
-// If the wrapped Handler panics, no values are reported.
-//
-// Note that this method is only guaranteed to never observe negative durations
-// if used with Go1.9+.
-func InstrumentHandlerDuration(obs prometheus.ObserverVec, next http.Handler) http.HandlerFunc {
- code, method := checkLabels(obs)
-
- if code {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- now := time.Now()
- d := newDelegator(w, nil)
- next.ServeHTTP(d, r)
-
- obs.With(labels(code, method, r.Method, d.Status())).Observe(time.Since(now).Seconds())
- })
- }
-
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- now := time.Now()
- next.ServeHTTP(w, r)
- obs.With(labels(code, method, r.Method, 0)).Observe(time.Since(now).Seconds())
- })
-}
-
-// InstrumentHandlerCounter is a middleware that wraps the provided http.Handler
-// to observe the request result with the provided CounterVec. The CounterVec
-// must have zero, one, or two non-const non-curried labels. For those, the only
-// allowed label names are "code" and "method". The function panics
-// otherwise. Partitioning of the CounterVec happens by HTTP status code and/or
-// HTTP method if the respective instance label names are present in the
-// CounterVec. For unpartitioned counting, use a CounterVec with zero labels.
-//
-// If the wrapped Handler does not set a status code, a status code of 200 is assumed.
-//
-// If the wrapped Handler panics, the Counter is not incremented.
-//
-// See the example for InstrumentHandlerDuration for example usage.
-func InstrumentHandlerCounter(counter *prometheus.CounterVec, next http.Handler) http.HandlerFunc {
- code, method := checkLabels(counter)
-
- if code {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- d := newDelegator(w, nil)
- next.ServeHTTP(d, r)
- counter.With(labels(code, method, r.Method, d.Status())).Inc()
- })
- }
-
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- next.ServeHTTP(w, r)
- counter.With(labels(code, method, r.Method, 0)).Inc()
- })
-}
-
-// InstrumentHandlerTimeToWriteHeader is a middleware that wraps the provided
-// http.Handler to observe with the provided ObserverVec the request duration
-// until the response headers are written. The ObserverVec must have zero, one,
-// or two non-const non-curried labels. For those, the only allowed label names
-// are "code" and "method". The function panics otherwise. The Observe method of
-// the Observer in the ObserverVec is called with the request duration in
-// seconds. Partitioning happens by HTTP status code and/or HTTP method if the
-// respective instance label names are present in the ObserverVec. For
-// unpartitioned observations, use an ObserverVec with zero labels. Note that
-// partitioning of Histograms is expensive and should be used judiciously.
-//
-// If the wrapped Handler panics before calling WriteHeader, no value is
-// reported.
-//
-// Note that this method is only guaranteed to never observe negative durations
-// if used with Go1.9+.
-//
-// See the example for InstrumentHandlerDuration for example usage.
-func InstrumentHandlerTimeToWriteHeader(obs prometheus.ObserverVec, next http.Handler) http.HandlerFunc {
- code, method := checkLabels(obs)
-
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- now := time.Now()
- d := newDelegator(w, func(status int) {
- obs.With(labels(code, method, r.Method, status)).Observe(time.Since(now).Seconds())
- })
- next.ServeHTTP(d, r)
- })
-}
-
-// InstrumentHandlerRequestSize is a middleware that wraps the provided
-// http.Handler to observe the request size with the provided ObserverVec. The
-// ObserverVec must have zero, one, or two non-const non-curried labels. For
-// those, the only allowed label names are "code" and "method". The function
-// panics otherwise. The Observe method of the Observer in the ObserverVec is
-// called with the request size in bytes. Partitioning happens by HTTP status
-// code and/or HTTP method if the respective instance label names are present in
-// the ObserverVec. For unpartitioned observations, use an ObserverVec with zero
-// labels. Note that partitioning of Histograms is expensive and should be used
-// judiciously.
-//
-// If the wrapped Handler does not set a status code, a status code of 200 is assumed.
-//
-// If the wrapped Handler panics, no values are reported.
-//
-// See the example for InstrumentHandlerDuration for example usage.
-func InstrumentHandlerRequestSize(obs prometheus.ObserverVec, next http.Handler) http.HandlerFunc {
- code, method := checkLabels(obs)
-
- if code {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- d := newDelegator(w, nil)
- next.ServeHTTP(d, r)
- size := computeApproximateRequestSize(r)
- obs.With(labels(code, method, r.Method, d.Status())).Observe(float64(size))
- })
- }
-
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- next.ServeHTTP(w, r)
- size := computeApproximateRequestSize(r)
- obs.With(labels(code, method, r.Method, 0)).Observe(float64(size))
- })
-}
-
-// InstrumentHandlerResponseSize is a middleware that wraps the provided
-// http.Handler to observe the response size with the provided ObserverVec. The
-// ObserverVec must have zero, one, or two non-const non-curried labels. For
-// those, the only allowed label names are "code" and "method". The function
-// panics otherwise. The Observe method of the Observer in the ObserverVec is
-// called with the response size in bytes. Partitioning happens by HTTP status
-// code and/or HTTP method if the respective instance label names are present in
-// the ObserverVec. For unpartitioned observations, use an ObserverVec with zero
-// labels. Note that partitioning of Histograms is expensive and should be used
-// judiciously.
-//
-// If the wrapped Handler does not set a status code, a status code of 200 is assumed.
-//
-// If the wrapped Handler panics, no values are reported.
-//
-// See the example for InstrumentHandlerDuration for example usage.
-func InstrumentHandlerResponseSize(obs prometheus.ObserverVec, next http.Handler) http.Handler {
- code, method := checkLabels(obs)
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- d := newDelegator(w, nil)
- next.ServeHTTP(d, r)
- obs.With(labels(code, method, r.Method, d.Status())).Observe(float64(d.Written()))
- })
-}
-
-func checkLabels(c prometheus.Collector) (code bool, method bool) {
- // TODO(beorn7): Remove this hacky way to check for instance labels
- // once Descriptors can have their dimensionality queried.
- var (
- desc *prometheus.Desc
- m prometheus.Metric
- pm dto.Metric
- lvs []string
- )
-
- // Get the Desc from the Collector.
- descc := make(chan *prometheus.Desc, 1)
- c.Describe(descc)
-
- select {
- case desc = <-descc:
- default:
- panic("no description provided by collector")
- }
- select {
- case <-descc:
- panic("more than one description provided by collector")
- default:
- }
-
- close(descc)
-
- // Create a ConstMetric with the Desc. Since we don't know how many
- // variable labels there are, try for as long as it needs.
- for err := errors.New("dummy"); err != nil; lvs = append(lvs, magicString) {
- m, err = prometheus.NewConstMetric(desc, prometheus.UntypedValue, 0, lvs...)
- }
-
- // Write out the metric into a proto message and look at the labels.
- // If the value is not the magicString, it is a constLabel, which doesn't interest us.
- // If the label is curried, it doesn't interest us.
- // In all other cases, only "code" or "method" is allowed.
- if err := m.Write(&pm); err != nil {
- panic("error checking metric for labels")
- }
- for _, label := range pm.Label {
- name, value := label.GetName(), label.GetValue()
- if value != magicString || isLabelCurried(c, name) {
- continue
- }
- switch name {
- case "code":
- code = true
- case "method":
- method = true
- default:
- panic("metric partitioned with non-supported labels")
- }
- }
- return
-}
-
-func isLabelCurried(c prometheus.Collector, label string) bool {
- // This is even hackier than the label test above.
- // We essentially try to curry again and see if it works.
- // But for that, we need to type-convert to the two
- // types we use here, ObserverVec or *CounterVec.
- switch v := c.(type) {
- case *prometheus.CounterVec:
- if _, err := v.CurryWith(prometheus.Labels{label: "dummy"}); err == nil {
- return false
- }
- case prometheus.ObserverVec:
- if _, err := v.CurryWith(prometheus.Labels{label: "dummy"}); err == nil {
- return false
- }
- default:
- panic("unsupported metric vec type")
- }
- return true
-}
-
-// emptyLabels is a one-time allocation for non-partitioned metrics to avoid
-// unnecessary allocations on each request.
-var emptyLabels = prometheus.Labels{}
-
-func labels(code, method bool, reqMethod string, status int) prometheus.Labels {
- if !(code || method) {
- return emptyLabels
- }
- labels := prometheus.Labels{}
-
- if code {
- labels["code"] = sanitizeCode(status)
- }
- if method {
- labels["method"] = sanitizeMethod(reqMethod)
- }
-
- return labels
-}
-
-func computeApproximateRequestSize(r *http.Request) int {
- s := 0
- if r.URL != nil {
- s += len(r.URL.String())
- }
-
- s += len(r.Method)
- s += len(r.Proto)
- for name, values := range r.Header {
- s += len(name)
- for _, value := range values {
- s += len(value)
- }
- }
- s += len(r.Host)
-
- // N.B. r.Form and r.MultipartForm are assumed to be included in r.URL.
-
- if r.ContentLength != -1 {
- s += int(r.ContentLength)
- }
- return s
-}
-
-func sanitizeMethod(m string) string {
- switch m {
- case "GET", "get":
- return "get"
- case "PUT", "put":
- return "put"
- case "HEAD", "head":
- return "head"
- case "POST", "post":
- return "post"
- case "DELETE", "delete":
- return "delete"
- case "CONNECT", "connect":
- return "connect"
- case "OPTIONS", "options":
- return "options"
- case "NOTIFY", "notify":
- return "notify"
- default:
- return strings.ToLower(m)
- }
-}
-
-// If the wrapped http.Handler has not set a status code, i.e. the value is
-// currently 0, santizeCode will return 200, for consistency with behavior in
-// the stdlib.
-func sanitizeCode(s int) string {
- switch s {
- case 100:
- return "100"
- case 101:
- return "101"
-
- case 200, 0:
- return "200"
- case 201:
- return "201"
- case 202:
- return "202"
- case 203:
- return "203"
- case 204:
- return "204"
- case 205:
- return "205"
- case 206:
- return "206"
-
- case 300:
- return "300"
- case 301:
- return "301"
- case 302:
- return "302"
- case 304:
- return "304"
- case 305:
- return "305"
- case 307:
- return "307"
-
- case 400:
- return "400"
- case 401:
- return "401"
- case 402:
- return "402"
- case 403:
- return "403"
- case 404:
- return "404"
- case 405:
- return "405"
- case 406:
- return "406"
- case 407:
- return "407"
- case 408:
- return "408"
- case 409:
- return "409"
- case 410:
- return "410"
- case 411:
- return "411"
- case 412:
- return "412"
- case 413:
- return "413"
- case 414:
- return "414"
- case 415:
- return "415"
- case 416:
- return "416"
- case 417:
- return "417"
- case 418:
- return "418"
-
- case 500:
- return "500"
- case 501:
- return "501"
- case 502:
- return "502"
- case 503:
- return "503"
- case 504:
- return "504"
- case 505:
- return "505"
-
- case 428:
- return "428"
- case 429:
- return "429"
- case 431:
- return "431"
- case 511:
- return "511"
-
- default:
- return strconv.Itoa(s)
- }
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/registry.go b/vendor/github.com/prometheus/client_golang/prometheus/registry.go
deleted file mode 100644
index c05d6ee..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/registry.go
+++ /dev/null
@@ -1,947 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "bytes"
- "fmt"
- "io/ioutil"
- "os"
- "path/filepath"
- "runtime"
- "sort"
- "strings"
- "sync"
- "unicode/utf8"
-
- "github.com/cespare/xxhash/v2"
- "github.com/golang/protobuf/proto"
- "github.com/prometheus/common/expfmt"
-
- dto "github.com/prometheus/client_model/go"
-
- "github.com/prometheus/client_golang/prometheus/internal"
-)
-
-const (
- // Capacity for the channel to collect metrics and descriptors.
- capMetricChan = 1000
- capDescChan = 10
-)
-
-// DefaultRegisterer and DefaultGatherer are the implementations of the
-// Registerer and Gatherer interface a number of convenience functions in this
-// package act on. Initially, both variables point to the same Registry, which
-// has a process collector (currently on Linux only, see NewProcessCollector)
-// and a Go collector (see NewGoCollector, in particular the note about
-// stop-the-world implication with Go versions older than 1.9) already
-// registered. This approach to keep default instances as global state mirrors
-// the approach of other packages in the Go standard library. Note that there
-// are caveats. Change the variables with caution and only if you understand the
-// consequences. Users who want to avoid global state altogether should not use
-// the convenience functions and act on custom instances instead.
-var (
- defaultRegistry = NewRegistry()
- DefaultRegisterer Registerer = defaultRegistry
- DefaultGatherer Gatherer = defaultRegistry
-)
-
-func init() {
- MustRegister(NewProcessCollector(ProcessCollectorOpts{}))
- MustRegister(NewGoCollector())
-}
-
-// NewRegistry creates a new vanilla Registry without any Collectors
-// pre-registered.
-func NewRegistry() *Registry {
- return &Registry{
- collectorsByID: map[uint64]Collector{},
- descIDs: map[uint64]struct{}{},
- dimHashesByName: map[string]uint64{},
- }
-}
-
-// NewPedanticRegistry returns a registry that checks during collection if each
-// collected Metric is consistent with its reported Desc, and if the Desc has
-// actually been registered with the registry. Unchecked Collectors (those whose
-// Describe method does not yield any descriptors) are excluded from the check.
-//
-// Usually, a Registry will be happy as long as the union of all collected
-// Metrics is consistent and valid even if some metrics are not consistent with
-// their own Desc or a Desc provided by their registered Collector. Well-behaved
-// Collectors and Metrics will only provide consistent Descs. This Registry is
-// useful to test the implementation of Collectors and Metrics.
-func NewPedanticRegistry() *Registry {
- r := NewRegistry()
- r.pedanticChecksEnabled = true
- return r
-}
-
-// Registerer is the interface for the part of a registry in charge of
-// registering and unregistering. Users of custom registries should use
-// Registerer as type for registration purposes (rather than the Registry type
-// directly). In that way, they are free to use custom Registerer implementation
-// (e.g. for testing purposes).
-type Registerer interface {
- // Register registers a new Collector to be included in metrics
- // collection. It returns an error if the descriptors provided by the
- // Collector are invalid or if they — in combination with descriptors of
- // already registered Collectors — do not fulfill the consistency and
- // uniqueness criteria described in the documentation of metric.Desc.
- //
- // If the provided Collector is equal to a Collector already registered
- // (which includes the case of re-registering the same Collector), the
- // returned error is an instance of AlreadyRegisteredError, which
- // contains the previously registered Collector.
- //
- // A Collector whose Describe method does not yield any Desc is treated
- // as unchecked. Registration will always succeed. No check for
- // re-registering (see previous paragraph) is performed. Thus, the
- // caller is responsible for not double-registering the same unchecked
- // Collector, and for providing a Collector that will not cause
- // inconsistent metrics on collection. (This would lead to scrape
- // errors.)
- Register(Collector) error
- // MustRegister works like Register but registers any number of
- // Collectors and panics upon the first registration that causes an
- // error.
- MustRegister(...Collector)
- // Unregister unregisters the Collector that equals the Collector passed
- // in as an argument. (Two Collectors are considered equal if their
- // Describe method yields the same set of descriptors.) The function
- // returns whether a Collector was unregistered. Note that an unchecked
- // Collector cannot be unregistered (as its Describe method does not
- // yield any descriptor).
- //
- // Note that even after unregistering, it will not be possible to
- // register a new Collector that is inconsistent with the unregistered
- // Collector, e.g. a Collector collecting metrics with the same name but
- // a different help string. The rationale here is that the same registry
- // instance must only collect consistent metrics throughout its
- // lifetime.
- Unregister(Collector) bool
-}
-
-// Gatherer is the interface for the part of a registry in charge of gathering
-// the collected metrics into a number of MetricFamilies. The Gatherer interface
-// comes with the same general implication as described for the Registerer
-// interface.
-type Gatherer interface {
- // Gather calls the Collect method of the registered Collectors and then
- // gathers the collected metrics into a lexicographically sorted slice
- // of uniquely named MetricFamily protobufs. Gather ensures that the
- // returned slice is valid and self-consistent so that it can be used
- // for valid exposition. As an exception to the strict consistency
- // requirements described for metric.Desc, Gather will tolerate
- // different sets of label names for metrics of the same metric family.
- //
- // Even if an error occurs, Gather attempts to gather as many metrics as
- // possible. Hence, if a non-nil error is returned, the returned
- // MetricFamily slice could be nil (in case of a fatal error that
- // prevented any meaningful metric collection) or contain a number of
- // MetricFamily protobufs, some of which might be incomplete, and some
- // might be missing altogether. The returned error (which might be a
- // MultiError) explains the details. Note that this is mostly useful for
- // debugging purposes. If the gathered protobufs are to be used for
- // exposition in actual monitoring, it is almost always better to not
- // expose an incomplete result and instead disregard the returned
- // MetricFamily protobufs in case the returned error is non-nil.
- Gather() ([]*dto.MetricFamily, error)
-}
-
-// Register registers the provided Collector with the DefaultRegisterer.
-//
-// Register is a shortcut for DefaultRegisterer.Register(c). See there for more
-// details.
-func Register(c Collector) error {
- return DefaultRegisterer.Register(c)
-}
-
-// MustRegister registers the provided Collectors with the DefaultRegisterer and
-// panics if any error occurs.
-//
-// MustRegister is a shortcut for DefaultRegisterer.MustRegister(cs...). See
-// there for more details.
-func MustRegister(cs ...Collector) {
- DefaultRegisterer.MustRegister(cs...)
-}
-
-// Unregister removes the registration of the provided Collector from the
-// DefaultRegisterer.
-//
-// Unregister is a shortcut for DefaultRegisterer.Unregister(c). See there for
-// more details.
-func Unregister(c Collector) bool {
- return DefaultRegisterer.Unregister(c)
-}
-
-// GathererFunc turns a function into a Gatherer.
-type GathererFunc func() ([]*dto.MetricFamily, error)
-
-// Gather implements Gatherer.
-func (gf GathererFunc) Gather() ([]*dto.MetricFamily, error) {
- return gf()
-}
-
-// AlreadyRegisteredError is returned by the Register method if the Collector to
-// be registered has already been registered before, or a different Collector
-// that collects the same metrics has been registered before. Registration fails
-// in that case, but you can detect from the kind of error what has
-// happened. The error contains fields for the existing Collector and the
-// (rejected) new Collector that equals the existing one. This can be used to
-// find out if an equal Collector has been registered before and switch over to
-// using the old one, as demonstrated in the example.
-type AlreadyRegisteredError struct {
- ExistingCollector, NewCollector Collector
-}
-
-func (err AlreadyRegisteredError) Error() string {
- return "duplicate metrics collector registration attempted"
-}
-
-// MultiError is a slice of errors implementing the error interface. It is used
-// by a Gatherer to report multiple errors during MetricFamily gathering.
-type MultiError []error
-
-func (errs MultiError) Error() string {
- if len(errs) == 0 {
- return ""
- }
- buf := &bytes.Buffer{}
- fmt.Fprintf(buf, "%d error(s) occurred:", len(errs))
- for _, err := range errs {
- fmt.Fprintf(buf, "\n* %s", err)
- }
- return buf.String()
-}
-
-// Append appends the provided error if it is not nil.
-func (errs *MultiError) Append(err error) {
- if err != nil {
- *errs = append(*errs, err)
- }
-}
-
-// MaybeUnwrap returns nil if len(errs) is 0. It returns the first and only
-// contained error as error if len(errs is 1). In all other cases, it returns
-// the MultiError directly. This is helpful for returning a MultiError in a way
-// that only uses the MultiError if needed.
-func (errs MultiError) MaybeUnwrap() error {
- switch len(errs) {
- case 0:
- return nil
- case 1:
- return errs[0]
- default:
- return errs
- }
-}
-
-// Registry registers Prometheus collectors, collects their metrics, and gathers
-// them into MetricFamilies for exposition. It implements both Registerer and
-// Gatherer. The zero value is not usable. Create instances with NewRegistry or
-// NewPedanticRegistry.
-type Registry struct {
- mtx sync.RWMutex
- collectorsByID map[uint64]Collector // ID is a hash of the descIDs.
- descIDs map[uint64]struct{}
- dimHashesByName map[string]uint64
- uncheckedCollectors []Collector
- pedanticChecksEnabled bool
-}
-
-// Register implements Registerer.
-func (r *Registry) Register(c Collector) error {
- var (
- descChan = make(chan *Desc, capDescChan)
- newDescIDs = map[uint64]struct{}{}
- newDimHashesByName = map[string]uint64{}
- collectorID uint64 // All desc IDs XOR'd together.
- duplicateDescErr error
- )
- go func() {
- c.Describe(descChan)
- close(descChan)
- }()
- r.mtx.Lock()
- defer func() {
- // Drain channel in case of premature return to not leak a goroutine.
- for range descChan {
- }
- r.mtx.Unlock()
- }()
- // Conduct various tests...
- for desc := range descChan {
-
- // Is the descriptor valid at all?
- if desc.err != nil {
- return fmt.Errorf("descriptor %s is invalid: %s", desc, desc.err)
- }
-
- // Is the descID unique?
- // (In other words: Is the fqName + constLabel combination unique?)
- if _, exists := r.descIDs[desc.id]; exists {
- duplicateDescErr = fmt.Errorf("descriptor %s already exists with the same fully-qualified name and const label values", desc)
- }
- // If it is not a duplicate desc in this collector, XOR it to
- // the collectorID. (We allow duplicate descs within the same
- // collector, but their existence must be a no-op.)
- if _, exists := newDescIDs[desc.id]; !exists {
- newDescIDs[desc.id] = struct{}{}
- collectorID ^= desc.id
- }
-
- // Are all the label names and the help string consistent with
- // previous descriptors of the same name?
- // First check existing descriptors...
- if dimHash, exists := r.dimHashesByName[desc.fqName]; exists {
- if dimHash != desc.dimHash {
- return fmt.Errorf("a previously registered descriptor with the same fully-qualified name as %s has different label names or a different help string", desc)
- }
- } else {
- // ...then check the new descriptors already seen.
- if dimHash, exists := newDimHashesByName[desc.fqName]; exists {
- if dimHash != desc.dimHash {
- return fmt.Errorf("descriptors reported by collector have inconsistent label names or help strings for the same fully-qualified name, offender is %s", desc)
- }
- } else {
- newDimHashesByName[desc.fqName] = desc.dimHash
- }
- }
- }
- // A Collector yielding no Desc at all is considered unchecked.
- if len(newDescIDs) == 0 {
- r.uncheckedCollectors = append(r.uncheckedCollectors, c)
- return nil
- }
- if existing, exists := r.collectorsByID[collectorID]; exists {
- switch e := existing.(type) {
- case *wrappingCollector:
- return AlreadyRegisteredError{
- ExistingCollector: e.unwrapRecursively(),
- NewCollector: c,
- }
- default:
- return AlreadyRegisteredError{
- ExistingCollector: e,
- NewCollector: c,
- }
- }
- }
- // If the collectorID is new, but at least one of the descs existed
- // before, we are in trouble.
- if duplicateDescErr != nil {
- return duplicateDescErr
- }
-
- // Only after all tests have passed, actually register.
- r.collectorsByID[collectorID] = c
- for hash := range newDescIDs {
- r.descIDs[hash] = struct{}{}
- }
- for name, dimHash := range newDimHashesByName {
- r.dimHashesByName[name] = dimHash
- }
- return nil
-}
-
-// Unregister implements Registerer.
-func (r *Registry) Unregister(c Collector) bool {
- var (
- descChan = make(chan *Desc, capDescChan)
- descIDs = map[uint64]struct{}{}
- collectorID uint64 // All desc IDs XOR'd together.
- )
- go func() {
- c.Describe(descChan)
- close(descChan)
- }()
- for desc := range descChan {
- if _, exists := descIDs[desc.id]; !exists {
- collectorID ^= desc.id
- descIDs[desc.id] = struct{}{}
- }
- }
-
- r.mtx.RLock()
- if _, exists := r.collectorsByID[collectorID]; !exists {
- r.mtx.RUnlock()
- return false
- }
- r.mtx.RUnlock()
-
- r.mtx.Lock()
- defer r.mtx.Unlock()
-
- delete(r.collectorsByID, collectorID)
- for id := range descIDs {
- delete(r.descIDs, id)
- }
- // dimHashesByName is left untouched as those must be consistent
- // throughout the lifetime of a program.
- return true
-}
-
-// MustRegister implements Registerer.
-func (r *Registry) MustRegister(cs ...Collector) {
- for _, c := range cs {
- if err := r.Register(c); err != nil {
- panic(err)
- }
- }
-}
-
-// Gather implements Gatherer.
-func (r *Registry) Gather() ([]*dto.MetricFamily, error) {
- var (
- checkedMetricChan = make(chan Metric, capMetricChan)
- uncheckedMetricChan = make(chan Metric, capMetricChan)
- metricHashes = map[uint64]struct{}{}
- wg sync.WaitGroup
- errs MultiError // The collected errors to return in the end.
- registeredDescIDs map[uint64]struct{} // Only used for pedantic checks
- )
-
- r.mtx.RLock()
- goroutineBudget := len(r.collectorsByID) + len(r.uncheckedCollectors)
- metricFamiliesByName := make(map[string]*dto.MetricFamily, len(r.dimHashesByName))
- checkedCollectors := make(chan Collector, len(r.collectorsByID))
- uncheckedCollectors := make(chan Collector, len(r.uncheckedCollectors))
- for _, collector := range r.collectorsByID {
- checkedCollectors <- collector
- }
- for _, collector := range r.uncheckedCollectors {
- uncheckedCollectors <- collector
- }
- // In case pedantic checks are enabled, we have to copy the map before
- // giving up the RLock.
- if r.pedanticChecksEnabled {
- registeredDescIDs = make(map[uint64]struct{}, len(r.descIDs))
- for id := range r.descIDs {
- registeredDescIDs[id] = struct{}{}
- }
- }
- r.mtx.RUnlock()
-
- wg.Add(goroutineBudget)
-
- collectWorker := func() {
- for {
- select {
- case collector := <-checkedCollectors:
- collector.Collect(checkedMetricChan)
- case collector := <-uncheckedCollectors:
- collector.Collect(uncheckedMetricChan)
- default:
- return
- }
- wg.Done()
- }
- }
-
- // Start the first worker now to make sure at least one is running.
- go collectWorker()
- goroutineBudget--
-
- // Close checkedMetricChan and uncheckedMetricChan once all collectors
- // are collected.
- go func() {
- wg.Wait()
- close(checkedMetricChan)
- close(uncheckedMetricChan)
- }()
-
- // Drain checkedMetricChan and uncheckedMetricChan in case of premature return.
- defer func() {
- if checkedMetricChan != nil {
- for range checkedMetricChan {
- }
- }
- if uncheckedMetricChan != nil {
- for range uncheckedMetricChan {
- }
- }
- }()
-
- // Copy the channel references so we can nil them out later to remove
- // them from the select statements below.
- cmc := checkedMetricChan
- umc := uncheckedMetricChan
-
- for {
- select {
- case metric, ok := <-cmc:
- if !ok {
- cmc = nil
- break
- }
- errs.Append(processMetric(
- metric, metricFamiliesByName,
- metricHashes,
- registeredDescIDs,
- ))
- case metric, ok := <-umc:
- if !ok {
- umc = nil
- break
- }
- errs.Append(processMetric(
- metric, metricFamiliesByName,
- metricHashes,
- nil,
- ))
- default:
- if goroutineBudget <= 0 || len(checkedCollectors)+len(uncheckedCollectors) == 0 {
- // All collectors are already being worked on or
- // we have already as many goroutines started as
- // there are collectors. Do the same as above,
- // just without the default.
- select {
- case metric, ok := <-cmc:
- if !ok {
- cmc = nil
- break
- }
- errs.Append(processMetric(
- metric, metricFamiliesByName,
- metricHashes,
- registeredDescIDs,
- ))
- case metric, ok := <-umc:
- if !ok {
- umc = nil
- break
- }
- errs.Append(processMetric(
- metric, metricFamiliesByName,
- metricHashes,
- nil,
- ))
- }
- break
- }
- // Start more workers.
- go collectWorker()
- goroutineBudget--
- runtime.Gosched()
- }
- // Once both checkedMetricChan and uncheckdMetricChan are closed
- // and drained, the contraption above will nil out cmc and umc,
- // and then we can leave the collect loop here.
- if cmc == nil && umc == nil {
- break
- }
- }
- return internal.NormalizeMetricFamilies(metricFamiliesByName), errs.MaybeUnwrap()
-}
-
-// WriteToTextfile calls Gather on the provided Gatherer, encodes the result in the
-// Prometheus text format, and writes it to a temporary file. Upon success, the
-// temporary file is renamed to the provided filename.
-//
-// This is intended for use with the textfile collector of the node exporter.
-// Note that the node exporter expects the filename to be suffixed with ".prom".
-func WriteToTextfile(filename string, g Gatherer) error {
- tmp, err := ioutil.TempFile(filepath.Dir(filename), filepath.Base(filename))
- if err != nil {
- return err
- }
- defer os.Remove(tmp.Name())
-
- mfs, err := g.Gather()
- if err != nil {
- return err
- }
- for _, mf := range mfs {
- if _, err := expfmt.MetricFamilyToText(tmp, mf); err != nil {
- return err
- }
- }
- if err := tmp.Close(); err != nil {
- return err
- }
-
- if err := os.Chmod(tmp.Name(), 0644); err != nil {
- return err
- }
- return os.Rename(tmp.Name(), filename)
-}
-
-// processMetric is an internal helper method only used by the Gather method.
-func processMetric(
- metric Metric,
- metricFamiliesByName map[string]*dto.MetricFamily,
- metricHashes map[uint64]struct{},
- registeredDescIDs map[uint64]struct{},
-) error {
- desc := metric.Desc()
- // Wrapped metrics collected by an unchecked Collector can have an
- // invalid Desc.
- if desc.err != nil {
- return desc.err
- }
- dtoMetric := &dto.Metric{}
- if err := metric.Write(dtoMetric); err != nil {
- return fmt.Errorf("error collecting metric %v: %s", desc, err)
- }
- metricFamily, ok := metricFamiliesByName[desc.fqName]
- if ok { // Existing name.
- if metricFamily.GetHelp() != desc.help {
- return fmt.Errorf(
- "collected metric %s %s has help %q but should have %q",
- desc.fqName, dtoMetric, desc.help, metricFamily.GetHelp(),
- )
- }
- // TODO(beorn7): Simplify switch once Desc has type.
- switch metricFamily.GetType() {
- case dto.MetricType_COUNTER:
- if dtoMetric.Counter == nil {
- return fmt.Errorf(
- "collected metric %s %s should be a Counter",
- desc.fqName, dtoMetric,
- )
- }
- case dto.MetricType_GAUGE:
- if dtoMetric.Gauge == nil {
- return fmt.Errorf(
- "collected metric %s %s should be a Gauge",
- desc.fqName, dtoMetric,
- )
- }
- case dto.MetricType_SUMMARY:
- if dtoMetric.Summary == nil {
- return fmt.Errorf(
- "collected metric %s %s should be a Summary",
- desc.fqName, dtoMetric,
- )
- }
- case dto.MetricType_UNTYPED:
- if dtoMetric.Untyped == nil {
- return fmt.Errorf(
- "collected metric %s %s should be Untyped",
- desc.fqName, dtoMetric,
- )
- }
- case dto.MetricType_HISTOGRAM:
- if dtoMetric.Histogram == nil {
- return fmt.Errorf(
- "collected metric %s %s should be a Histogram",
- desc.fqName, dtoMetric,
- )
- }
- default:
- panic("encountered MetricFamily with invalid type")
- }
- } else { // New name.
- metricFamily = &dto.MetricFamily{}
- metricFamily.Name = proto.String(desc.fqName)
- metricFamily.Help = proto.String(desc.help)
- // TODO(beorn7): Simplify switch once Desc has type.
- switch {
- case dtoMetric.Gauge != nil:
- metricFamily.Type = dto.MetricType_GAUGE.Enum()
- case dtoMetric.Counter != nil:
- metricFamily.Type = dto.MetricType_COUNTER.Enum()
- case dtoMetric.Summary != nil:
- metricFamily.Type = dto.MetricType_SUMMARY.Enum()
- case dtoMetric.Untyped != nil:
- metricFamily.Type = dto.MetricType_UNTYPED.Enum()
- case dtoMetric.Histogram != nil:
- metricFamily.Type = dto.MetricType_HISTOGRAM.Enum()
- default:
- return fmt.Errorf("empty metric collected: %s", dtoMetric)
- }
- if err := checkSuffixCollisions(metricFamily, metricFamiliesByName); err != nil {
- return err
- }
- metricFamiliesByName[desc.fqName] = metricFamily
- }
- if err := checkMetricConsistency(metricFamily, dtoMetric, metricHashes); err != nil {
- return err
- }
- if registeredDescIDs != nil {
- // Is the desc registered at all?
- if _, exist := registeredDescIDs[desc.id]; !exist {
- return fmt.Errorf(
- "collected metric %s %s with unregistered descriptor %s",
- metricFamily.GetName(), dtoMetric, desc,
- )
- }
- if err := checkDescConsistency(metricFamily, dtoMetric, desc); err != nil {
- return err
- }
- }
- metricFamily.Metric = append(metricFamily.Metric, dtoMetric)
- return nil
-}
-
-// Gatherers is a slice of Gatherer instances that implements the Gatherer
-// interface itself. Its Gather method calls Gather on all Gatherers in the
-// slice in order and returns the merged results. Errors returned from the
-// Gather calls are all returned in a flattened MultiError. Duplicate and
-// inconsistent Metrics are skipped (first occurrence in slice order wins) and
-// reported in the returned error.
-//
-// Gatherers can be used to merge the Gather results from multiple
-// Registries. It also provides a way to directly inject existing MetricFamily
-// protobufs into the gathering by creating a custom Gatherer with a Gather
-// method that simply returns the existing MetricFamily protobufs. Note that no
-// registration is involved (in contrast to Collector registration), so
-// obviously registration-time checks cannot happen. Any inconsistencies between
-// the gathered MetricFamilies are reported as errors by the Gather method, and
-// inconsistent Metrics are dropped. Invalid parts of the MetricFamilies
-// (e.g. syntactically invalid metric or label names) will go undetected.
-type Gatherers []Gatherer
-
-// Gather implements Gatherer.
-func (gs Gatherers) Gather() ([]*dto.MetricFamily, error) {
- var (
- metricFamiliesByName = map[string]*dto.MetricFamily{}
- metricHashes = map[uint64]struct{}{}
- errs MultiError // The collected errors to return in the end.
- )
-
- for i, g := range gs {
- mfs, err := g.Gather()
- if err != nil {
- if multiErr, ok := err.(MultiError); ok {
- for _, err := range multiErr {
- errs = append(errs, fmt.Errorf("[from Gatherer #%d] %s", i+1, err))
- }
- } else {
- errs = append(errs, fmt.Errorf("[from Gatherer #%d] %s", i+1, err))
- }
- }
- for _, mf := range mfs {
- existingMF, exists := metricFamiliesByName[mf.GetName()]
- if exists {
- if existingMF.GetHelp() != mf.GetHelp() {
- errs = append(errs, fmt.Errorf(
- "gathered metric family %s has help %q but should have %q",
- mf.GetName(), mf.GetHelp(), existingMF.GetHelp(),
- ))
- continue
- }
- if existingMF.GetType() != mf.GetType() {
- errs = append(errs, fmt.Errorf(
- "gathered metric family %s has type %s but should have %s",
- mf.GetName(), mf.GetType(), existingMF.GetType(),
- ))
- continue
- }
- } else {
- existingMF = &dto.MetricFamily{}
- existingMF.Name = mf.Name
- existingMF.Help = mf.Help
- existingMF.Type = mf.Type
- if err := checkSuffixCollisions(existingMF, metricFamiliesByName); err != nil {
- errs = append(errs, err)
- continue
- }
- metricFamiliesByName[mf.GetName()] = existingMF
- }
- for _, m := range mf.Metric {
- if err := checkMetricConsistency(existingMF, m, metricHashes); err != nil {
- errs = append(errs, err)
- continue
- }
- existingMF.Metric = append(existingMF.Metric, m)
- }
- }
- }
- return internal.NormalizeMetricFamilies(metricFamiliesByName), errs.MaybeUnwrap()
-}
-
-// checkSuffixCollisions checks for collisions with the “magic” suffixes the
-// Prometheus text format and the internal metric representation of the
-// Prometheus server add while flattening Summaries and Histograms.
-func checkSuffixCollisions(mf *dto.MetricFamily, mfs map[string]*dto.MetricFamily) error {
- var (
- newName = mf.GetName()
- newType = mf.GetType()
- newNameWithoutSuffix = ""
- )
- switch {
- case strings.HasSuffix(newName, "_count"):
- newNameWithoutSuffix = newName[:len(newName)-6]
- case strings.HasSuffix(newName, "_sum"):
- newNameWithoutSuffix = newName[:len(newName)-4]
- case strings.HasSuffix(newName, "_bucket"):
- newNameWithoutSuffix = newName[:len(newName)-7]
- }
- if newNameWithoutSuffix != "" {
- if existingMF, ok := mfs[newNameWithoutSuffix]; ok {
- switch existingMF.GetType() {
- case dto.MetricType_SUMMARY:
- if !strings.HasSuffix(newName, "_bucket") {
- return fmt.Errorf(
- "collected metric named %q collides with previously collected summary named %q",
- newName, newNameWithoutSuffix,
- )
- }
- case dto.MetricType_HISTOGRAM:
- return fmt.Errorf(
- "collected metric named %q collides with previously collected histogram named %q",
- newName, newNameWithoutSuffix,
- )
- }
- }
- }
- if newType == dto.MetricType_SUMMARY || newType == dto.MetricType_HISTOGRAM {
- if _, ok := mfs[newName+"_count"]; ok {
- return fmt.Errorf(
- "collected histogram or summary named %q collides with previously collected metric named %q",
- newName, newName+"_count",
- )
- }
- if _, ok := mfs[newName+"_sum"]; ok {
- return fmt.Errorf(
- "collected histogram or summary named %q collides with previously collected metric named %q",
- newName, newName+"_sum",
- )
- }
- }
- if newType == dto.MetricType_HISTOGRAM {
- if _, ok := mfs[newName+"_bucket"]; ok {
- return fmt.Errorf(
- "collected histogram named %q collides with previously collected metric named %q",
- newName, newName+"_bucket",
- )
- }
- }
- return nil
-}
-
-// checkMetricConsistency checks if the provided Metric is consistent with the
-// provided MetricFamily. It also hashes the Metric labels and the MetricFamily
-// name. If the resulting hash is already in the provided metricHashes, an error
-// is returned. If not, it is added to metricHashes.
-func checkMetricConsistency(
- metricFamily *dto.MetricFamily,
- dtoMetric *dto.Metric,
- metricHashes map[uint64]struct{},
-) error {
- name := metricFamily.GetName()
-
- // Type consistency with metric family.
- if metricFamily.GetType() == dto.MetricType_GAUGE && dtoMetric.Gauge == nil ||
- metricFamily.GetType() == dto.MetricType_COUNTER && dtoMetric.Counter == nil ||
- metricFamily.GetType() == dto.MetricType_SUMMARY && dtoMetric.Summary == nil ||
- metricFamily.GetType() == dto.MetricType_HISTOGRAM && dtoMetric.Histogram == nil ||
- metricFamily.GetType() == dto.MetricType_UNTYPED && dtoMetric.Untyped == nil {
- return fmt.Errorf(
- "collected metric %q { %s} is not a %s",
- name, dtoMetric, metricFamily.GetType(),
- )
- }
-
- previousLabelName := ""
- for _, labelPair := range dtoMetric.GetLabel() {
- labelName := labelPair.GetName()
- if labelName == previousLabelName {
- return fmt.Errorf(
- "collected metric %q { %s} has two or more labels with the same name: %s",
- name, dtoMetric, labelName,
- )
- }
- if !checkLabelName(labelName) {
- return fmt.Errorf(
- "collected metric %q { %s} has a label with an invalid name: %s",
- name, dtoMetric, labelName,
- )
- }
- if dtoMetric.Summary != nil && labelName == quantileLabel {
- return fmt.Errorf(
- "collected metric %q { %s} must not have an explicit %q label",
- name, dtoMetric, quantileLabel,
- )
- }
- if !utf8.ValidString(labelPair.GetValue()) {
- return fmt.Errorf(
- "collected metric %q { %s} has a label named %q whose value is not utf8: %#v",
- name, dtoMetric, labelName, labelPair.GetValue())
- }
- previousLabelName = labelName
- }
-
- // Is the metric unique (i.e. no other metric with the same name and the same labels)?
- h := xxhash.New()
- h.WriteString(name)
- h.Write(separatorByteSlice)
- // Make sure label pairs are sorted. We depend on it for the consistency
- // check.
- if !sort.IsSorted(labelPairSorter(dtoMetric.Label)) {
- // We cannot sort dtoMetric.Label in place as it is immutable by contract.
- copiedLabels := make([]*dto.LabelPair, len(dtoMetric.Label))
- copy(copiedLabels, dtoMetric.Label)
- sort.Sort(labelPairSorter(copiedLabels))
- dtoMetric.Label = copiedLabels
- }
- for _, lp := range dtoMetric.Label {
- h.WriteString(lp.GetName())
- h.Write(separatorByteSlice)
- h.WriteString(lp.GetValue())
- h.Write(separatorByteSlice)
- }
- hSum := h.Sum64()
- if _, exists := metricHashes[hSum]; exists {
- return fmt.Errorf(
- "collected metric %q { %s} was collected before with the same name and label values",
- name, dtoMetric,
- )
- }
- metricHashes[hSum] = struct{}{}
- return nil
-}
-
-func checkDescConsistency(
- metricFamily *dto.MetricFamily,
- dtoMetric *dto.Metric,
- desc *Desc,
-) error {
- // Desc help consistency with metric family help.
- if metricFamily.GetHelp() != desc.help {
- return fmt.Errorf(
- "collected metric %s %s has help %q but should have %q",
- metricFamily.GetName(), dtoMetric, metricFamily.GetHelp(), desc.help,
- )
- }
-
- // Is the desc consistent with the content of the metric?
- lpsFromDesc := make([]*dto.LabelPair, len(desc.constLabelPairs), len(dtoMetric.Label))
- copy(lpsFromDesc, desc.constLabelPairs)
- for _, l := range desc.variableLabels {
- lpsFromDesc = append(lpsFromDesc, &dto.LabelPair{
- Name: proto.String(l),
- })
- }
- if len(lpsFromDesc) != len(dtoMetric.Label) {
- return fmt.Errorf(
- "labels in collected metric %s %s are inconsistent with descriptor %s",
- metricFamily.GetName(), dtoMetric, desc,
- )
- }
- sort.Sort(labelPairSorter(lpsFromDesc))
- for i, lpFromDesc := range lpsFromDesc {
- lpFromMetric := dtoMetric.Label[i]
- if lpFromDesc.GetName() != lpFromMetric.GetName() ||
- lpFromDesc.Value != nil && lpFromDesc.GetValue() != lpFromMetric.GetValue() {
- return fmt.Errorf(
- "labels in collected metric %s %s are inconsistent with descriptor %s",
- metricFamily.GetName(), dtoMetric, desc,
- )
- }
- }
- return nil
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/summary.go b/vendor/github.com/prometheus/client_golang/prometheus/summary.go
deleted file mode 100644
index ae42e76..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/summary.go
+++ /dev/null
@@ -1,736 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "fmt"
- "math"
- "runtime"
- "sort"
- "sync"
- "sync/atomic"
- "time"
-
- "github.com/beorn7/perks/quantile"
- "github.com/golang/protobuf/proto"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-// quantileLabel is used for the label that defines the quantile in a
-// summary.
-const quantileLabel = "quantile"
-
-// A Summary captures individual observations from an event or sample stream and
-// summarizes them in a manner similar to traditional summary statistics: 1. sum
-// of observations, 2. observation count, 3. rank estimations.
-//
-// A typical use-case is the observation of request latencies. By default, a
-// Summary provides the median, the 90th and the 99th percentile of the latency
-// as rank estimations. However, the default behavior will change in the
-// upcoming v1.0.0 of the library. There will be no rank estimations at all by
-// default. For a sane transition, it is recommended to set the desired rank
-// estimations explicitly.
-//
-// Note that the rank estimations cannot be aggregated in a meaningful way with
-// the Prometheus query language (i.e. you cannot average or add them). If you
-// need aggregatable quantiles (e.g. you want the 99th percentile latency of all
-// queries served across all instances of a service), consider the Histogram
-// metric type. See the Prometheus documentation for more details.
-//
-// To create Summary instances, use NewSummary.
-type Summary interface {
- Metric
- Collector
-
- // Observe adds a single observation to the summary.
- Observe(float64)
-}
-
-var errQuantileLabelNotAllowed = fmt.Errorf(
- "%q is not allowed as label name in summaries", quantileLabel,
-)
-
-// Default values for SummaryOpts.
-const (
- // DefMaxAge is the default duration for which observations stay
- // relevant.
- DefMaxAge time.Duration = 10 * time.Minute
- // DefAgeBuckets is the default number of buckets used to calculate the
- // age of observations.
- DefAgeBuckets = 5
- // DefBufCap is the standard buffer size for collecting Summary observations.
- DefBufCap = 500
-)
-
-// SummaryOpts bundles the options for creating a Summary metric. It is
-// mandatory to set Name to a non-empty string. While all other fields are
-// optional and can safely be left at their zero value, it is recommended to set
-// a help string and to explicitly set the Objectives field to the desired value
-// as the default value will change in the upcoming v1.0.0 of the library.
-type SummaryOpts struct {
- // Namespace, Subsystem, and Name are components of the fully-qualified
- // name of the Summary (created by joining these components with
- // "_"). Only Name is mandatory, the others merely help structuring the
- // name. Note that the fully-qualified name of the Summary must be a
- // valid Prometheus metric name.
- Namespace string
- Subsystem string
- Name string
-
- // Help provides information about this Summary.
- //
- // Metrics with the same fully-qualified name must have the same Help
- // string.
- Help string
-
- // ConstLabels are used to attach fixed labels to this metric. Metrics
- // with the same fully-qualified name must have the same label names in
- // their ConstLabels.
- //
- // Due to the way a Summary is represented in the Prometheus text format
- // and how it is handled by the Prometheus server internally, “quantile”
- // is an illegal label name. Construction of a Summary or SummaryVec
- // will panic if this label name is used in ConstLabels.
- //
- // ConstLabels are only used rarely. In particular, do not use them to
- // attach the same labels to all your metrics. Those use cases are
- // better covered by target labels set by the scraping Prometheus
- // server, or by one specific metric (e.g. a build_info or a
- // machine_role metric). See also
- // https://prometheus.io/docs/instrumenting/writing_exporters/#target-labels,-not-static-scraped-labels
- ConstLabels Labels
-
- // Objectives defines the quantile rank estimates with their respective
- // absolute error. If Objectives[q] = e, then the value reported for q
- // will be the φ-quantile value for some φ between q-e and q+e. The
- // default value is an empty map, resulting in a summary without
- // quantiles.
- Objectives map[float64]float64
-
- // MaxAge defines the duration for which an observation stays relevant
- // for the summary. Must be positive. The default value is DefMaxAge.
- MaxAge time.Duration
-
- // AgeBuckets is the number of buckets used to exclude observations that
- // are older than MaxAge from the summary. A higher number has a
- // resource penalty, so only increase it if the higher resolution is
- // really required. For very high observation rates, you might want to
- // reduce the number of age buckets. With only one age bucket, you will
- // effectively see a complete reset of the summary each time MaxAge has
- // passed. The default value is DefAgeBuckets.
- AgeBuckets uint32
-
- // BufCap defines the default sample stream buffer size. The default
- // value of DefBufCap should suffice for most uses. If there is a need
- // to increase the value, a multiple of 500 is recommended (because that
- // is the internal buffer size of the underlying package
- // "github.com/bmizerany/perks/quantile").
- BufCap uint32
-}
-
-// Problem with the sliding-window decay algorithm... The Merge method of
-// perk/quantile is actually not working as advertised - and it might be
-// unfixable, as the underlying algorithm is apparently not capable of merging
-// summaries in the first place. To avoid using Merge, we are currently adding
-// observations to _each_ age bucket, i.e. the effort to add a sample is
-// essentially multiplied by the number of age buckets. When rotating age
-// buckets, we empty the previous head stream. On scrape time, we simply take
-// the quantiles from the head stream (no merging required). Result: More effort
-// on observation time, less effort on scrape time, which is exactly the
-// opposite of what we try to accomplish, but at least the results are correct.
-//
-// The quite elegant previous contraption to merge the age buckets efficiently
-// on scrape time (see code up commit 6b9530d72ea715f0ba612c0120e6e09fbf1d49d0)
-// can't be used anymore.
-
-// NewSummary creates a new Summary based on the provided SummaryOpts.
-func NewSummary(opts SummaryOpts) Summary {
- return newSummary(
- NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- nil,
- opts.ConstLabels,
- ),
- opts,
- )
-}
-
-func newSummary(desc *Desc, opts SummaryOpts, labelValues ...string) Summary {
- if len(desc.variableLabels) != len(labelValues) {
- panic(makeInconsistentCardinalityError(desc.fqName, desc.variableLabels, labelValues))
- }
-
- for _, n := range desc.variableLabels {
- if n == quantileLabel {
- panic(errQuantileLabelNotAllowed)
- }
- }
- for _, lp := range desc.constLabelPairs {
- if lp.GetName() == quantileLabel {
- panic(errQuantileLabelNotAllowed)
- }
- }
-
- if opts.Objectives == nil {
- opts.Objectives = map[float64]float64{}
- }
-
- if opts.MaxAge < 0 {
- panic(fmt.Errorf("illegal max age MaxAge=%v", opts.MaxAge))
- }
- if opts.MaxAge == 0 {
- opts.MaxAge = DefMaxAge
- }
-
- if opts.AgeBuckets == 0 {
- opts.AgeBuckets = DefAgeBuckets
- }
-
- if opts.BufCap == 0 {
- opts.BufCap = DefBufCap
- }
-
- if len(opts.Objectives) == 0 {
- // Use the lock-free implementation of a Summary without objectives.
- s := &noObjectivesSummary{
- desc: desc,
- labelPairs: makeLabelPairs(desc, labelValues),
- counts: [2]*summaryCounts{{}, {}},
- }
- s.init(s) // Init self-collection.
- return s
- }
-
- s := &summary{
- desc: desc,
-
- objectives: opts.Objectives,
- sortedObjectives: make([]float64, 0, len(opts.Objectives)),
-
- labelPairs: makeLabelPairs(desc, labelValues),
-
- hotBuf: make([]float64, 0, opts.BufCap),
- coldBuf: make([]float64, 0, opts.BufCap),
- streamDuration: opts.MaxAge / time.Duration(opts.AgeBuckets),
- }
- s.headStreamExpTime = time.Now().Add(s.streamDuration)
- s.hotBufExpTime = s.headStreamExpTime
-
- for i := uint32(0); i < opts.AgeBuckets; i++ {
- s.streams = append(s.streams, s.newStream())
- }
- s.headStream = s.streams[0]
-
- for qu := range s.objectives {
- s.sortedObjectives = append(s.sortedObjectives, qu)
- }
- sort.Float64s(s.sortedObjectives)
-
- s.init(s) // Init self-collection.
- return s
-}
-
-type summary struct {
- selfCollector
-
- bufMtx sync.Mutex // Protects hotBuf and hotBufExpTime.
- mtx sync.Mutex // Protects every other moving part.
- // Lock bufMtx before mtx if both are needed.
-
- desc *Desc
-
- objectives map[float64]float64
- sortedObjectives []float64
-
- labelPairs []*dto.LabelPair
-
- sum float64
- cnt uint64
-
- hotBuf, coldBuf []float64
-
- streams []*quantile.Stream
- streamDuration time.Duration
- headStream *quantile.Stream
- headStreamIdx int
- headStreamExpTime, hotBufExpTime time.Time
-}
-
-func (s *summary) Desc() *Desc {
- return s.desc
-}
-
-func (s *summary) Observe(v float64) {
- s.bufMtx.Lock()
- defer s.bufMtx.Unlock()
-
- now := time.Now()
- if now.After(s.hotBufExpTime) {
- s.asyncFlush(now)
- }
- s.hotBuf = append(s.hotBuf, v)
- if len(s.hotBuf) == cap(s.hotBuf) {
- s.asyncFlush(now)
- }
-}
-
-func (s *summary) Write(out *dto.Metric) error {
- sum := &dto.Summary{}
- qs := make([]*dto.Quantile, 0, len(s.objectives))
-
- s.bufMtx.Lock()
- s.mtx.Lock()
- // Swap bufs even if hotBuf is empty to set new hotBufExpTime.
- s.swapBufs(time.Now())
- s.bufMtx.Unlock()
-
- s.flushColdBuf()
- sum.SampleCount = proto.Uint64(s.cnt)
- sum.SampleSum = proto.Float64(s.sum)
-
- for _, rank := range s.sortedObjectives {
- var q float64
- if s.headStream.Count() == 0 {
- q = math.NaN()
- } else {
- q = s.headStream.Query(rank)
- }
- qs = append(qs, &dto.Quantile{
- Quantile: proto.Float64(rank),
- Value: proto.Float64(q),
- })
- }
-
- s.mtx.Unlock()
-
- if len(qs) > 0 {
- sort.Sort(quantSort(qs))
- }
- sum.Quantile = qs
-
- out.Summary = sum
- out.Label = s.labelPairs
- return nil
-}
-
-func (s *summary) newStream() *quantile.Stream {
- return quantile.NewTargeted(s.objectives)
-}
-
-// asyncFlush needs bufMtx locked.
-func (s *summary) asyncFlush(now time.Time) {
- s.mtx.Lock()
- s.swapBufs(now)
-
- // Unblock the original goroutine that was responsible for the mutation
- // that triggered the compaction. But hold onto the global non-buffer
- // state mutex until the operation finishes.
- go func() {
- s.flushColdBuf()
- s.mtx.Unlock()
- }()
-}
-
-// rotateStreams needs mtx AND bufMtx locked.
-func (s *summary) maybeRotateStreams() {
- for !s.hotBufExpTime.Equal(s.headStreamExpTime) {
- s.headStream.Reset()
- s.headStreamIdx++
- if s.headStreamIdx >= len(s.streams) {
- s.headStreamIdx = 0
- }
- s.headStream = s.streams[s.headStreamIdx]
- s.headStreamExpTime = s.headStreamExpTime.Add(s.streamDuration)
- }
-}
-
-// flushColdBuf needs mtx locked.
-func (s *summary) flushColdBuf() {
- for _, v := range s.coldBuf {
- for _, stream := range s.streams {
- stream.Insert(v)
- }
- s.cnt++
- s.sum += v
- }
- s.coldBuf = s.coldBuf[0:0]
- s.maybeRotateStreams()
-}
-
-// swapBufs needs mtx AND bufMtx locked, coldBuf must be empty.
-func (s *summary) swapBufs(now time.Time) {
- if len(s.coldBuf) != 0 {
- panic("coldBuf is not empty")
- }
- s.hotBuf, s.coldBuf = s.coldBuf, s.hotBuf
- // hotBuf is now empty and gets new expiration set.
- for now.After(s.hotBufExpTime) {
- s.hotBufExpTime = s.hotBufExpTime.Add(s.streamDuration)
- }
-}
-
-type summaryCounts struct {
- // sumBits contains the bits of the float64 representing the sum of all
- // observations. sumBits and count have to go first in the struct to
- // guarantee alignment for atomic operations.
- // http://golang.org/pkg/sync/atomic/#pkg-note-BUG
- sumBits uint64
- count uint64
-}
-
-type noObjectivesSummary struct {
- // countAndHotIdx enables lock-free writes with use of atomic updates.
- // The most significant bit is the hot index [0 or 1] of the count field
- // below. Observe calls update the hot one. All remaining bits count the
- // number of Observe calls. Observe starts by incrementing this counter,
- // and finish by incrementing the count field in the respective
- // summaryCounts, as a marker for completion.
- //
- // Calls of the Write method (which are non-mutating reads from the
- // perspective of the summary) swap the hot–cold under the writeMtx
- // lock. A cooldown is awaited (while locked) by comparing the number of
- // observations with the initiation count. Once they match, then the
- // last observation on the now cool one has completed. All cool fields must
- // be merged into the new hot before releasing writeMtx.
-
- // Fields with atomic access first! See alignment constraint:
- // http://golang.org/pkg/sync/atomic/#pkg-note-BUG
- countAndHotIdx uint64
-
- selfCollector
- desc *Desc
- writeMtx sync.Mutex // Only used in the Write method.
-
- // Two counts, one is "hot" for lock-free observations, the other is
- // "cold" for writing out a dto.Metric. It has to be an array of
- // pointers to guarantee 64bit alignment of the histogramCounts, see
- // http://golang.org/pkg/sync/atomic/#pkg-note-BUG.
- counts [2]*summaryCounts
-
- labelPairs []*dto.LabelPair
-}
-
-func (s *noObjectivesSummary) Desc() *Desc {
- return s.desc
-}
-
-func (s *noObjectivesSummary) Observe(v float64) {
- // We increment h.countAndHotIdx so that the counter in the lower
- // 63 bits gets incremented. At the same time, we get the new value
- // back, which we can use to find the currently-hot counts.
- n := atomic.AddUint64(&s.countAndHotIdx, 1)
- hotCounts := s.counts[n>>63]
-
- for {
- oldBits := atomic.LoadUint64(&hotCounts.sumBits)
- newBits := math.Float64bits(math.Float64frombits(oldBits) + v)
- if atomic.CompareAndSwapUint64(&hotCounts.sumBits, oldBits, newBits) {
- break
- }
- }
- // Increment count last as we take it as a signal that the observation
- // is complete.
- atomic.AddUint64(&hotCounts.count, 1)
-}
-
-func (s *noObjectivesSummary) Write(out *dto.Metric) error {
- // For simplicity, we protect this whole method by a mutex. It is not in
- // the hot path, i.e. Observe is called much more often than Write. The
- // complication of making Write lock-free isn't worth it, if possible at
- // all.
- s.writeMtx.Lock()
- defer s.writeMtx.Unlock()
-
- // Adding 1<<63 switches the hot index (from 0 to 1 or from 1 to 0)
- // without touching the count bits. See the struct comments for a full
- // description of the algorithm.
- n := atomic.AddUint64(&s.countAndHotIdx, 1<<63)
- // count is contained unchanged in the lower 63 bits.
- count := n & ((1 << 63) - 1)
- // The most significant bit tells us which counts is hot. The complement
- // is thus the cold one.
- hotCounts := s.counts[n>>63]
- coldCounts := s.counts[(^n)>>63]
-
- // Await cooldown.
- for count != atomic.LoadUint64(&coldCounts.count) {
- runtime.Gosched() // Let observations get work done.
- }
-
- sum := &dto.Summary{
- SampleCount: proto.Uint64(count),
- SampleSum: proto.Float64(math.Float64frombits(atomic.LoadUint64(&coldCounts.sumBits))),
- }
-
- out.Summary = sum
- out.Label = s.labelPairs
-
- // Finally add all the cold counts to the new hot counts and reset the cold counts.
- atomic.AddUint64(&hotCounts.count, count)
- atomic.StoreUint64(&coldCounts.count, 0)
- for {
- oldBits := atomic.LoadUint64(&hotCounts.sumBits)
- newBits := math.Float64bits(math.Float64frombits(oldBits) + sum.GetSampleSum())
- if atomic.CompareAndSwapUint64(&hotCounts.sumBits, oldBits, newBits) {
- atomic.StoreUint64(&coldCounts.sumBits, 0)
- break
- }
- }
- return nil
-}
-
-type quantSort []*dto.Quantile
-
-func (s quantSort) Len() int {
- return len(s)
-}
-
-func (s quantSort) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
-}
-
-func (s quantSort) Less(i, j int) bool {
- return s[i].GetQuantile() < s[j].GetQuantile()
-}
-
-// SummaryVec is a Collector that bundles a set of Summaries that all share the
-// same Desc, but have different values for their variable labels. This is used
-// if you want to count the same thing partitioned by various dimensions
-// (e.g. HTTP request latencies, partitioned by status code and method). Create
-// instances with NewSummaryVec.
-type SummaryVec struct {
- *metricVec
-}
-
-// NewSummaryVec creates a new SummaryVec based on the provided SummaryOpts and
-// partitioned by the given label names.
-//
-// Due to the way a Summary is represented in the Prometheus text format and how
-// it is handled by the Prometheus server internally, “quantile” is an illegal
-// label name. NewSummaryVec will panic if this label name is used.
-func NewSummaryVec(opts SummaryOpts, labelNames []string) *SummaryVec {
- for _, ln := range labelNames {
- if ln == quantileLabel {
- panic(errQuantileLabelNotAllowed)
- }
- }
- desc := NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- labelNames,
- opts.ConstLabels,
- )
- return &SummaryVec{
- metricVec: newMetricVec(desc, func(lvs ...string) Metric {
- return newSummary(desc, opts, lvs...)
- }),
- }
-}
-
-// GetMetricWithLabelValues returns the Summary for the given slice of label
-// values (same order as the VariableLabels in Desc). If that combination of
-// label values is accessed for the first time, a new Summary is created.
-//
-// It is possible to call this method without using the returned Summary to only
-// create the new Summary but leave it at its starting value, a Summary without
-// any observations.
-//
-// Keeping the Summary for later use is possible (and should be considered if
-// performance is critical), but keep in mind that Reset, DeleteLabelValues and
-// Delete can be used to delete the Summary from the SummaryVec. In that case,
-// the Summary will still exist, but it will not be exported anymore, even if a
-// Summary with the same label values is created later. See also the CounterVec
-// example.
-//
-// An error is returned if the number of label values is not the same as the
-// number of VariableLabels in Desc (minus any curried labels).
-//
-// Note that for more than one label value, this method is prone to mistakes
-// caused by an incorrect order of arguments. Consider GetMetricWith(Labels) as
-// an alternative to avoid that type of mistake. For higher label numbers, the
-// latter has a much more readable (albeit more verbose) syntax, but it comes
-// with a performance overhead (for creating and processing the Labels map).
-// See also the GaugeVec example.
-func (v *SummaryVec) GetMetricWithLabelValues(lvs ...string) (Observer, error) {
- metric, err := v.metricVec.getMetricWithLabelValues(lvs...)
- if metric != nil {
- return metric.(Observer), err
- }
- return nil, err
-}
-
-// GetMetricWith returns the Summary for the given Labels map (the label names
-// must match those of the VariableLabels in Desc). If that label map is
-// accessed for the first time, a new Summary is created. Implications of
-// creating a Summary without using it and keeping the Summary for later use are
-// the same as for GetMetricWithLabelValues.
-//
-// An error is returned if the number and names of the Labels are inconsistent
-// with those of the VariableLabels in Desc (minus any curried labels).
-//
-// This method is used for the same purpose as
-// GetMetricWithLabelValues(...string). See there for pros and cons of the two
-// methods.
-func (v *SummaryVec) GetMetricWith(labels Labels) (Observer, error) {
- metric, err := v.metricVec.getMetricWith(labels)
- if metric != nil {
- return metric.(Observer), err
- }
- return nil, err
-}
-
-// WithLabelValues works as GetMetricWithLabelValues, but panics where
-// GetMetricWithLabelValues would have returned an error. Not returning an
-// error allows shortcuts like
-// myVec.WithLabelValues("404", "GET").Observe(42.21)
-func (v *SummaryVec) WithLabelValues(lvs ...string) Observer {
- s, err := v.GetMetricWithLabelValues(lvs...)
- if err != nil {
- panic(err)
- }
- return s
-}
-
-// With works as GetMetricWith, but panics where GetMetricWithLabels would have
-// returned an error. Not returning an error allows shortcuts like
-// myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Observe(42.21)
-func (v *SummaryVec) With(labels Labels) Observer {
- s, err := v.GetMetricWith(labels)
- if err != nil {
- panic(err)
- }
- return s
-}
-
-// CurryWith returns a vector curried with the provided labels, i.e. the
-// returned vector has those labels pre-set for all labeled operations performed
-// on it. The cardinality of the curried vector is reduced accordingly. The
-// order of the remaining labels stays the same (just with the curried labels
-// taken out of the sequence – which is relevant for the
-// (GetMetric)WithLabelValues methods). It is possible to curry a curried
-// vector, but only with labels not yet used for currying before.
-//
-// The metrics contained in the SummaryVec are shared between the curried and
-// uncurried vectors. They are just accessed differently. Curried and uncurried
-// vectors behave identically in terms of collection. Only one must be
-// registered with a given registry (usually the uncurried version). The Reset
-// method deletes all metrics, even if called on a curried vector.
-func (v *SummaryVec) CurryWith(labels Labels) (ObserverVec, error) {
- vec, err := v.curryWith(labels)
- if vec != nil {
- return &SummaryVec{vec}, err
- }
- return nil, err
-}
-
-// MustCurryWith works as CurryWith but panics where CurryWith would have
-// returned an error.
-func (v *SummaryVec) MustCurryWith(labels Labels) ObserverVec {
- vec, err := v.CurryWith(labels)
- if err != nil {
- panic(err)
- }
- return vec
-}
-
-type constSummary struct {
- desc *Desc
- count uint64
- sum float64
- quantiles map[float64]float64
- labelPairs []*dto.LabelPair
-}
-
-func (s *constSummary) Desc() *Desc {
- return s.desc
-}
-
-func (s *constSummary) Write(out *dto.Metric) error {
- sum := &dto.Summary{}
- qs := make([]*dto.Quantile, 0, len(s.quantiles))
-
- sum.SampleCount = proto.Uint64(s.count)
- sum.SampleSum = proto.Float64(s.sum)
-
- for rank, q := range s.quantiles {
- qs = append(qs, &dto.Quantile{
- Quantile: proto.Float64(rank),
- Value: proto.Float64(q),
- })
- }
-
- if len(qs) > 0 {
- sort.Sort(quantSort(qs))
- }
- sum.Quantile = qs
-
- out.Summary = sum
- out.Label = s.labelPairs
-
- return nil
-}
-
-// NewConstSummary returns a metric representing a Prometheus summary with fixed
-// values for the count, sum, and quantiles. As those parameters cannot be
-// changed, the returned value does not implement the Summary interface (but
-// only the Metric interface). Users of this package will not have much use for
-// it in regular operations. However, when implementing custom Collectors, it is
-// useful as a throw-away metric that is generated on the fly to send it to
-// Prometheus in the Collect method.
-//
-// quantiles maps ranks to quantile values. For example, a median latency of
-// 0.23s and a 99th percentile latency of 0.56s would be expressed as:
-// map[float64]float64{0.5: 0.23, 0.99: 0.56}
-//
-// NewConstSummary returns an error if the length of labelValues is not
-// consistent with the variable labels in Desc or if Desc is invalid.
-func NewConstSummary(
- desc *Desc,
- count uint64,
- sum float64,
- quantiles map[float64]float64,
- labelValues ...string,
-) (Metric, error) {
- if desc.err != nil {
- return nil, desc.err
- }
- if err := validateLabelValues(labelValues, len(desc.variableLabels)); err != nil {
- return nil, err
- }
- return &constSummary{
- desc: desc,
- count: count,
- sum: sum,
- quantiles: quantiles,
- labelPairs: makeLabelPairs(desc, labelValues),
- }, nil
-}
-
-// MustNewConstSummary is a version of NewConstSummary that panics where
-// NewConstMetric would have returned an error.
-func MustNewConstSummary(
- desc *Desc,
- count uint64,
- sum float64,
- quantiles map[float64]float64,
- labelValues ...string,
-) Metric {
- m, err := NewConstSummary(desc, count, sum, quantiles, labelValues...)
- if err != nil {
- panic(err)
- }
- return m
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/timer.go b/vendor/github.com/prometheus/client_golang/prometheus/timer.go
deleted file mode 100644
index 8d5f105..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/timer.go
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2016 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import "time"
-
-// Timer is a helper type to time functions. Use NewTimer to create new
-// instances.
-type Timer struct {
- begin time.Time
- observer Observer
-}
-
-// NewTimer creates a new Timer. The provided Observer is used to observe a
-// duration in seconds. Timer is usually used to time a function call in the
-// following way:
-// func TimeMe() {
-// timer := NewTimer(myHistogram)
-// defer timer.ObserveDuration()
-// // Do actual work.
-// }
-func NewTimer(o Observer) *Timer {
- return &Timer{
- begin: time.Now(),
- observer: o,
- }
-}
-
-// ObserveDuration records the duration passed since the Timer was created with
-// NewTimer. It calls the Observe method of the Observer provided during
-// construction with the duration in seconds as an argument. The observed
-// duration is also returned. ObserveDuration is usually called with a defer
-// statement.
-//
-// Note that this method is only guaranteed to never observe negative durations
-// if used with Go1.9+.
-func (t *Timer) ObserveDuration() time.Duration {
- d := time.Since(t.begin)
- if t.observer != nil {
- t.observer.Observe(d.Seconds())
- }
- return d
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/untyped.go b/vendor/github.com/prometheus/client_golang/prometheus/untyped.go
deleted file mode 100644
index 0f9ce63..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/untyped.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-// UntypedOpts is an alias for Opts. See there for doc comments.
-type UntypedOpts Opts
-
-// UntypedFunc works like GaugeFunc but the collected metric is of type
-// "Untyped". UntypedFunc is useful to mirror an external metric of unknown
-// type.
-//
-// To create UntypedFunc instances, use NewUntypedFunc.
-type UntypedFunc interface {
- Metric
- Collector
-}
-
-// NewUntypedFunc creates a new UntypedFunc based on the provided
-// UntypedOpts. The value reported is determined by calling the given function
-// from within the Write method. Take into account that metric collection may
-// happen concurrently. If that results in concurrent calls to Write, like in
-// the case where an UntypedFunc is directly registered with Prometheus, the
-// provided function must be concurrency-safe.
-func NewUntypedFunc(opts UntypedOpts, function func() float64) UntypedFunc {
- return newValueFunc(NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- nil,
- opts.ConstLabels,
- ), UntypedValue, function)
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/value.go b/vendor/github.com/prometheus/client_golang/prometheus/value.go
deleted file mode 100644
index 2be470c..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/value.go
+++ /dev/null
@@ -1,204 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "fmt"
- "sort"
- "time"
- "unicode/utf8"
-
- "github.com/golang/protobuf/proto"
- "github.com/golang/protobuf/ptypes"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-// ValueType is an enumeration of metric types that represent a simple value.
-type ValueType int
-
-// Possible values for the ValueType enum. Use UntypedValue to mark a metric
-// with an unknown type.
-const (
- _ ValueType = iota
- CounterValue
- GaugeValue
- UntypedValue
-)
-
-// valueFunc is a generic metric for simple values retrieved on collect time
-// from a function. It implements Metric and Collector. Its effective type is
-// determined by ValueType. This is a low-level building block used by the
-// library to back the implementations of CounterFunc, GaugeFunc, and
-// UntypedFunc.
-type valueFunc struct {
- selfCollector
-
- desc *Desc
- valType ValueType
- function func() float64
- labelPairs []*dto.LabelPair
-}
-
-// newValueFunc returns a newly allocated valueFunc with the given Desc and
-// ValueType. The value reported is determined by calling the given function
-// from within the Write method. Take into account that metric collection may
-// happen concurrently. If that results in concurrent calls to Write, like in
-// the case where a valueFunc is directly registered with Prometheus, the
-// provided function must be concurrency-safe.
-func newValueFunc(desc *Desc, valueType ValueType, function func() float64) *valueFunc {
- result := &valueFunc{
- desc: desc,
- valType: valueType,
- function: function,
- labelPairs: makeLabelPairs(desc, nil),
- }
- result.init(result)
- return result
-}
-
-func (v *valueFunc) Desc() *Desc {
- return v.desc
-}
-
-func (v *valueFunc) Write(out *dto.Metric) error {
- return populateMetric(v.valType, v.function(), v.labelPairs, nil, out)
-}
-
-// NewConstMetric returns a metric with one fixed value that cannot be
-// changed. Users of this package will not have much use for it in regular
-// operations. However, when implementing custom Collectors, it is useful as a
-// throw-away metric that is generated on the fly to send it to Prometheus in
-// the Collect method. NewConstMetric returns an error if the length of
-// labelValues is not consistent with the variable labels in Desc or if Desc is
-// invalid.
-func NewConstMetric(desc *Desc, valueType ValueType, value float64, labelValues ...string) (Metric, error) {
- if desc.err != nil {
- return nil, desc.err
- }
- if err := validateLabelValues(labelValues, len(desc.variableLabels)); err != nil {
- return nil, err
- }
- return &constMetric{
- desc: desc,
- valType: valueType,
- val: value,
- labelPairs: makeLabelPairs(desc, labelValues),
- }, nil
-}
-
-// MustNewConstMetric is a version of NewConstMetric that panics where
-// NewConstMetric would have returned an error.
-func MustNewConstMetric(desc *Desc, valueType ValueType, value float64, labelValues ...string) Metric {
- m, err := NewConstMetric(desc, valueType, value, labelValues...)
- if err != nil {
- panic(err)
- }
- return m
-}
-
-type constMetric struct {
- desc *Desc
- valType ValueType
- val float64
- labelPairs []*dto.LabelPair
-}
-
-func (m *constMetric) Desc() *Desc {
- return m.desc
-}
-
-func (m *constMetric) Write(out *dto.Metric) error {
- return populateMetric(m.valType, m.val, m.labelPairs, nil, out)
-}
-
-func populateMetric(
- t ValueType,
- v float64,
- labelPairs []*dto.LabelPair,
- e *dto.Exemplar,
- m *dto.Metric,
-) error {
- m.Label = labelPairs
- switch t {
- case CounterValue:
- m.Counter = &dto.Counter{Value: proto.Float64(v), Exemplar: e}
- case GaugeValue:
- m.Gauge = &dto.Gauge{Value: proto.Float64(v)}
- case UntypedValue:
- m.Untyped = &dto.Untyped{Value: proto.Float64(v)}
- default:
- return fmt.Errorf("encountered unknown type %v", t)
- }
- return nil
-}
-
-func makeLabelPairs(desc *Desc, labelValues []string) []*dto.LabelPair {
- totalLen := len(desc.variableLabels) + len(desc.constLabelPairs)
- if totalLen == 0 {
- // Super fast path.
- return nil
- }
- if len(desc.variableLabels) == 0 {
- // Moderately fast path.
- return desc.constLabelPairs
- }
- labelPairs := make([]*dto.LabelPair, 0, totalLen)
- for i, n := range desc.variableLabels {
- labelPairs = append(labelPairs, &dto.LabelPair{
- Name: proto.String(n),
- Value: proto.String(labelValues[i]),
- })
- }
- labelPairs = append(labelPairs, desc.constLabelPairs...)
- sort.Sort(labelPairSorter(labelPairs))
- return labelPairs
-}
-
-// ExemplarMaxRunes is the max total number of runes allowed in exemplar labels.
-const ExemplarMaxRunes = 64
-
-// newExemplar creates a new dto.Exemplar from the provided values. An error is
-// returned if any of the label names or values are invalid or if the total
-// number of runes in the label names and values exceeds ExemplarMaxRunes.
-func newExemplar(value float64, ts time.Time, l Labels) (*dto.Exemplar, error) {
- e := &dto.Exemplar{}
- e.Value = proto.Float64(value)
- tsProto, err := ptypes.TimestampProto(ts)
- if err != nil {
- return nil, err
- }
- e.Timestamp = tsProto
- labelPairs := make([]*dto.LabelPair, 0, len(l))
- var runes int
- for name, value := range l {
- if !checkLabelName(name) {
- return nil, fmt.Errorf("exemplar label name %q is invalid", name)
- }
- runes += utf8.RuneCountInString(name)
- if !utf8.ValidString(value) {
- return nil, fmt.Errorf("exemplar label value %q is not valid UTF-8", value)
- }
- runes += utf8.RuneCountInString(value)
- labelPairs = append(labelPairs, &dto.LabelPair{
- Name: proto.String(name),
- Value: proto.String(value),
- })
- }
- if runes > ExemplarMaxRunes {
- return nil, fmt.Errorf("exemplar labels have %d runes, exceeding the limit of %d", runes, ExemplarMaxRunes)
- }
- e.Label = labelPairs
- return e, nil
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/vec.go b/vendor/github.com/prometheus/client_golang/prometheus/vec.go
deleted file mode 100644
index d53848d..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/vec.go
+++ /dev/null
@@ -1,484 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "fmt"
- "sync"
-
- "github.com/prometheus/common/model"
-)
-
-// metricVec is a Collector to bundle metrics of the same name that differ in
-// their label values. metricVec is not used directly (and therefore
-// unexported). It is used as a building block for implementations of vectors of
-// a given metric type, like GaugeVec, CounterVec, SummaryVec, and HistogramVec.
-// It also handles label currying.
-type metricVec struct {
- *metricMap
-
- curry []curriedLabelValue
-
- // hashAdd and hashAddByte can be replaced for testing collision handling.
- hashAdd func(h uint64, s string) uint64
- hashAddByte func(h uint64, b byte) uint64
-}
-
-// newMetricVec returns an initialized metricVec.
-func newMetricVec(desc *Desc, newMetric func(lvs ...string) Metric) *metricVec {
- return &metricVec{
- metricMap: &metricMap{
- metrics: map[uint64][]metricWithLabelValues{},
- desc: desc,
- newMetric: newMetric,
- },
- hashAdd: hashAdd,
- hashAddByte: hashAddByte,
- }
-}
-
-// DeleteLabelValues removes the metric where the variable labels are the same
-// as those passed in as labels (same order as the VariableLabels in Desc). It
-// returns true if a metric was deleted.
-//
-// It is not an error if the number of label values is not the same as the
-// number of VariableLabels in Desc. However, such inconsistent label count can
-// never match an actual metric, so the method will always return false in that
-// case.
-//
-// Note that for more than one label value, this method is prone to mistakes
-// caused by an incorrect order of arguments. Consider Delete(Labels) as an
-// alternative to avoid that type of mistake. For higher label numbers, the
-// latter has a much more readable (albeit more verbose) syntax, but it comes
-// with a performance overhead (for creating and processing the Labels map).
-// See also the CounterVec example.
-func (m *metricVec) DeleteLabelValues(lvs ...string) bool {
- h, err := m.hashLabelValues(lvs)
- if err != nil {
- return false
- }
-
- return m.metricMap.deleteByHashWithLabelValues(h, lvs, m.curry)
-}
-
-// Delete deletes the metric where the variable labels are the same as those
-// passed in as labels. It returns true if a metric was deleted.
-//
-// It is not an error if the number and names of the Labels are inconsistent
-// with those of the VariableLabels in Desc. However, such inconsistent Labels
-// can never match an actual metric, so the method will always return false in
-// that case.
-//
-// This method is used for the same purpose as DeleteLabelValues(...string). See
-// there for pros and cons of the two methods.
-func (m *metricVec) Delete(labels Labels) bool {
- h, err := m.hashLabels(labels)
- if err != nil {
- return false
- }
-
- return m.metricMap.deleteByHashWithLabels(h, labels, m.curry)
-}
-
-// Without explicit forwarding of Describe, Collect, Reset, those methods won't
-// show up in GoDoc.
-
-// Describe implements Collector.
-func (m *metricVec) Describe(ch chan<- *Desc) { m.metricMap.Describe(ch) }
-
-// Collect implements Collector.
-func (m *metricVec) Collect(ch chan<- Metric) { m.metricMap.Collect(ch) }
-
-// Reset deletes all metrics in this vector.
-func (m *metricVec) Reset() { m.metricMap.Reset() }
-
-func (m *metricVec) curryWith(labels Labels) (*metricVec, error) {
- var (
- newCurry []curriedLabelValue
- oldCurry = m.curry
- iCurry int
- )
- for i, label := range m.desc.variableLabels {
- val, ok := labels[label]
- if iCurry < len(oldCurry) && oldCurry[iCurry].index == i {
- if ok {
- return nil, fmt.Errorf("label name %q is already curried", label)
- }
- newCurry = append(newCurry, oldCurry[iCurry])
- iCurry++
- } else {
- if !ok {
- continue // Label stays uncurried.
- }
- newCurry = append(newCurry, curriedLabelValue{i, val})
- }
- }
- if l := len(oldCurry) + len(labels) - len(newCurry); l > 0 {
- return nil, fmt.Errorf("%d unknown label(s) found during currying", l)
- }
-
- return &metricVec{
- metricMap: m.metricMap,
- curry: newCurry,
- hashAdd: m.hashAdd,
- hashAddByte: m.hashAddByte,
- }, nil
-}
-
-func (m *metricVec) getMetricWithLabelValues(lvs ...string) (Metric, error) {
- h, err := m.hashLabelValues(lvs)
- if err != nil {
- return nil, err
- }
-
- return m.metricMap.getOrCreateMetricWithLabelValues(h, lvs, m.curry), nil
-}
-
-func (m *metricVec) getMetricWith(labels Labels) (Metric, error) {
- h, err := m.hashLabels(labels)
- if err != nil {
- return nil, err
- }
-
- return m.metricMap.getOrCreateMetricWithLabels(h, labels, m.curry), nil
-}
-
-func (m *metricVec) hashLabelValues(vals []string) (uint64, error) {
- if err := validateLabelValues(vals, len(m.desc.variableLabels)-len(m.curry)); err != nil {
- return 0, err
- }
-
- var (
- h = hashNew()
- curry = m.curry
- iVals, iCurry int
- )
- for i := 0; i < len(m.desc.variableLabels); i++ {
- if iCurry < len(curry) && curry[iCurry].index == i {
- h = m.hashAdd(h, curry[iCurry].value)
- iCurry++
- } else {
- h = m.hashAdd(h, vals[iVals])
- iVals++
- }
- h = m.hashAddByte(h, model.SeparatorByte)
- }
- return h, nil
-}
-
-func (m *metricVec) hashLabels(labels Labels) (uint64, error) {
- if err := validateValuesInLabels(labels, len(m.desc.variableLabels)-len(m.curry)); err != nil {
- return 0, err
- }
-
- var (
- h = hashNew()
- curry = m.curry
- iCurry int
- )
- for i, label := range m.desc.variableLabels {
- val, ok := labels[label]
- if iCurry < len(curry) && curry[iCurry].index == i {
- if ok {
- return 0, fmt.Errorf("label name %q is already curried", label)
- }
- h = m.hashAdd(h, curry[iCurry].value)
- iCurry++
- } else {
- if !ok {
- return 0, fmt.Errorf("label name %q missing in label map", label)
- }
- h = m.hashAdd(h, val)
- }
- h = m.hashAddByte(h, model.SeparatorByte)
- }
- return h, nil
-}
-
-// metricWithLabelValues provides the metric and its label values for
-// disambiguation on hash collision.
-type metricWithLabelValues struct {
- values []string
- metric Metric
-}
-
-// curriedLabelValue sets the curried value for a label at the given index.
-type curriedLabelValue struct {
- index int
- value string
-}
-
-// metricMap is a helper for metricVec and shared between differently curried
-// metricVecs.
-type metricMap struct {
- mtx sync.RWMutex // Protects metrics.
- metrics map[uint64][]metricWithLabelValues
- desc *Desc
- newMetric func(labelValues ...string) Metric
-}
-
-// Describe implements Collector. It will send exactly one Desc to the provided
-// channel.
-func (m *metricMap) Describe(ch chan<- *Desc) {
- ch <- m.desc
-}
-
-// Collect implements Collector.
-func (m *metricMap) Collect(ch chan<- Metric) {
- m.mtx.RLock()
- defer m.mtx.RUnlock()
-
- for _, metrics := range m.metrics {
- for _, metric := range metrics {
- ch <- metric.metric
- }
- }
-}
-
-// Reset deletes all metrics in this vector.
-func (m *metricMap) Reset() {
- m.mtx.Lock()
- defer m.mtx.Unlock()
-
- for h := range m.metrics {
- delete(m.metrics, h)
- }
-}
-
-// deleteByHashWithLabelValues removes the metric from the hash bucket h. If
-// there are multiple matches in the bucket, use lvs to select a metric and
-// remove only that metric.
-func (m *metricMap) deleteByHashWithLabelValues(
- h uint64, lvs []string, curry []curriedLabelValue,
-) bool {
- m.mtx.Lock()
- defer m.mtx.Unlock()
-
- metrics, ok := m.metrics[h]
- if !ok {
- return false
- }
-
- i := findMetricWithLabelValues(metrics, lvs, curry)
- if i >= len(metrics) {
- return false
- }
-
- if len(metrics) > 1 {
- m.metrics[h] = append(metrics[:i], metrics[i+1:]...)
- } else {
- delete(m.metrics, h)
- }
- return true
-}
-
-// deleteByHashWithLabels removes the metric from the hash bucket h. If there
-// are multiple matches in the bucket, use lvs to select a metric and remove
-// only that metric.
-func (m *metricMap) deleteByHashWithLabels(
- h uint64, labels Labels, curry []curriedLabelValue,
-) bool {
- m.mtx.Lock()
- defer m.mtx.Unlock()
-
- metrics, ok := m.metrics[h]
- if !ok {
- return false
- }
- i := findMetricWithLabels(m.desc, metrics, labels, curry)
- if i >= len(metrics) {
- return false
- }
-
- if len(metrics) > 1 {
- m.metrics[h] = append(metrics[:i], metrics[i+1:]...)
- } else {
- delete(m.metrics, h)
- }
- return true
-}
-
-// getOrCreateMetricWithLabelValues retrieves the metric by hash and label value
-// or creates it and returns the new one.
-//
-// This function holds the mutex.
-func (m *metricMap) getOrCreateMetricWithLabelValues(
- hash uint64, lvs []string, curry []curriedLabelValue,
-) Metric {
- m.mtx.RLock()
- metric, ok := m.getMetricWithHashAndLabelValues(hash, lvs, curry)
- m.mtx.RUnlock()
- if ok {
- return metric
- }
-
- m.mtx.Lock()
- defer m.mtx.Unlock()
- metric, ok = m.getMetricWithHashAndLabelValues(hash, lvs, curry)
- if !ok {
- inlinedLVs := inlineLabelValues(lvs, curry)
- metric = m.newMetric(inlinedLVs...)
- m.metrics[hash] = append(m.metrics[hash], metricWithLabelValues{values: inlinedLVs, metric: metric})
- }
- return metric
-}
-
-// getOrCreateMetricWithLabelValues retrieves the metric by hash and label value
-// or creates it and returns the new one.
-//
-// This function holds the mutex.
-func (m *metricMap) getOrCreateMetricWithLabels(
- hash uint64, labels Labels, curry []curriedLabelValue,
-) Metric {
- m.mtx.RLock()
- metric, ok := m.getMetricWithHashAndLabels(hash, labels, curry)
- m.mtx.RUnlock()
- if ok {
- return metric
- }
-
- m.mtx.Lock()
- defer m.mtx.Unlock()
- metric, ok = m.getMetricWithHashAndLabels(hash, labels, curry)
- if !ok {
- lvs := extractLabelValues(m.desc, labels, curry)
- metric = m.newMetric(lvs...)
- m.metrics[hash] = append(m.metrics[hash], metricWithLabelValues{values: lvs, metric: metric})
- }
- return metric
-}
-
-// getMetricWithHashAndLabelValues gets a metric while handling possible
-// collisions in the hash space. Must be called while holding the read mutex.
-func (m *metricMap) getMetricWithHashAndLabelValues(
- h uint64, lvs []string, curry []curriedLabelValue,
-) (Metric, bool) {
- metrics, ok := m.metrics[h]
- if ok {
- if i := findMetricWithLabelValues(metrics, lvs, curry); i < len(metrics) {
- return metrics[i].metric, true
- }
- }
- return nil, false
-}
-
-// getMetricWithHashAndLabels gets a metric while handling possible collisions in
-// the hash space. Must be called while holding read mutex.
-func (m *metricMap) getMetricWithHashAndLabels(
- h uint64, labels Labels, curry []curriedLabelValue,
-) (Metric, bool) {
- metrics, ok := m.metrics[h]
- if ok {
- if i := findMetricWithLabels(m.desc, metrics, labels, curry); i < len(metrics) {
- return metrics[i].metric, true
- }
- }
- return nil, false
-}
-
-// findMetricWithLabelValues returns the index of the matching metric or
-// len(metrics) if not found.
-func findMetricWithLabelValues(
- metrics []metricWithLabelValues, lvs []string, curry []curriedLabelValue,
-) int {
- for i, metric := range metrics {
- if matchLabelValues(metric.values, lvs, curry) {
- return i
- }
- }
- return len(metrics)
-}
-
-// findMetricWithLabels returns the index of the matching metric or len(metrics)
-// if not found.
-func findMetricWithLabels(
- desc *Desc, metrics []metricWithLabelValues, labels Labels, curry []curriedLabelValue,
-) int {
- for i, metric := range metrics {
- if matchLabels(desc, metric.values, labels, curry) {
- return i
- }
- }
- return len(metrics)
-}
-
-func matchLabelValues(values []string, lvs []string, curry []curriedLabelValue) bool {
- if len(values) != len(lvs)+len(curry) {
- return false
- }
- var iLVs, iCurry int
- for i, v := range values {
- if iCurry < len(curry) && curry[iCurry].index == i {
- if v != curry[iCurry].value {
- return false
- }
- iCurry++
- continue
- }
- if v != lvs[iLVs] {
- return false
- }
- iLVs++
- }
- return true
-}
-
-func matchLabels(desc *Desc, values []string, labels Labels, curry []curriedLabelValue) bool {
- if len(values) != len(labels)+len(curry) {
- return false
- }
- iCurry := 0
- for i, k := range desc.variableLabels {
- if iCurry < len(curry) && curry[iCurry].index == i {
- if values[i] != curry[iCurry].value {
- return false
- }
- iCurry++
- continue
- }
- if values[i] != labels[k] {
- return false
- }
- }
- return true
-}
-
-func extractLabelValues(desc *Desc, labels Labels, curry []curriedLabelValue) []string {
- labelValues := make([]string, len(labels)+len(curry))
- iCurry := 0
- for i, k := range desc.variableLabels {
- if iCurry < len(curry) && curry[iCurry].index == i {
- labelValues[i] = curry[iCurry].value
- iCurry++
- continue
- }
- labelValues[i] = labels[k]
- }
- return labelValues
-}
-
-func inlineLabelValues(lvs []string, curry []curriedLabelValue) []string {
- labelValues := make([]string, len(lvs)+len(curry))
- var iCurry, iLVs int
- for i := range labelValues {
- if iCurry < len(curry) && curry[iCurry].index == i {
- labelValues[i] = curry[iCurry].value
- iCurry++
- continue
- }
- labelValues[i] = lvs[iLVs]
- iLVs++
- }
- return labelValues
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/wrap.go b/vendor/github.com/prometheus/client_golang/prometheus/wrap.go
deleted file mode 100644
index e303eef..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/wrap.go
+++ /dev/null
@@ -1,200 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "fmt"
- "sort"
-
- "github.com/golang/protobuf/proto"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-// WrapRegistererWith returns a Registerer wrapping the provided
-// Registerer. Collectors registered with the returned Registerer will be
-// registered with the wrapped Registerer in a modified way. The modified
-// Collector adds the provided Labels to all Metrics it collects (as
-// ConstLabels). The Metrics collected by the unmodified Collector must not
-// duplicate any of those labels.
-//
-// WrapRegistererWith provides a way to add fixed labels to a subset of
-// Collectors. It should not be used to add fixed labels to all metrics exposed.
-//
-// Conflicts between Collectors registered through the original Registerer with
-// Collectors registered through the wrapping Registerer will still be
-// detected. Any AlreadyRegisteredError returned by the Register method of
-// either Registerer will contain the ExistingCollector in the form it was
-// provided to the respective registry.
-//
-// The Collector example demonstrates a use of WrapRegistererWith.
-func WrapRegistererWith(labels Labels, reg Registerer) Registerer {
- return &wrappingRegisterer{
- wrappedRegisterer: reg,
- labels: labels,
- }
-}
-
-// WrapRegistererWithPrefix returns a Registerer wrapping the provided
-// Registerer. Collectors registered with the returned Registerer will be
-// registered with the wrapped Registerer in a modified way. The modified
-// Collector adds the provided prefix to the name of all Metrics it collects.
-//
-// WrapRegistererWithPrefix is useful to have one place to prefix all metrics of
-// a sub-system. To make this work, register metrics of the sub-system with the
-// wrapping Registerer returned by WrapRegistererWithPrefix. It is rarely useful
-// to use the same prefix for all metrics exposed. In particular, do not prefix
-// metric names that are standardized across applications, as that would break
-// horizontal monitoring, for example the metrics provided by the Go collector
-// (see NewGoCollector) and the process collector (see NewProcessCollector). (In
-// fact, those metrics are already prefixed with “go_” or “process_”,
-// respectively.)
-//
-// Conflicts between Collectors registered through the original Registerer with
-// Collectors registered through the wrapping Registerer will still be
-// detected. Any AlreadyRegisteredError returned by the Register method of
-// either Registerer will contain the ExistingCollector in the form it was
-// provided to the respective registry.
-func WrapRegistererWithPrefix(prefix string, reg Registerer) Registerer {
- return &wrappingRegisterer{
- wrappedRegisterer: reg,
- prefix: prefix,
- }
-}
-
-type wrappingRegisterer struct {
- wrappedRegisterer Registerer
- prefix string
- labels Labels
-}
-
-func (r *wrappingRegisterer) Register(c Collector) error {
- return r.wrappedRegisterer.Register(&wrappingCollector{
- wrappedCollector: c,
- prefix: r.prefix,
- labels: r.labels,
- })
-}
-
-func (r *wrappingRegisterer) MustRegister(cs ...Collector) {
- for _, c := range cs {
- if err := r.Register(c); err != nil {
- panic(err)
- }
- }
-}
-
-func (r *wrappingRegisterer) Unregister(c Collector) bool {
- return r.wrappedRegisterer.Unregister(&wrappingCollector{
- wrappedCollector: c,
- prefix: r.prefix,
- labels: r.labels,
- })
-}
-
-type wrappingCollector struct {
- wrappedCollector Collector
- prefix string
- labels Labels
-}
-
-func (c *wrappingCollector) Collect(ch chan<- Metric) {
- wrappedCh := make(chan Metric)
- go func() {
- c.wrappedCollector.Collect(wrappedCh)
- close(wrappedCh)
- }()
- for m := range wrappedCh {
- ch <- &wrappingMetric{
- wrappedMetric: m,
- prefix: c.prefix,
- labels: c.labels,
- }
- }
-}
-
-func (c *wrappingCollector) Describe(ch chan<- *Desc) {
- wrappedCh := make(chan *Desc)
- go func() {
- c.wrappedCollector.Describe(wrappedCh)
- close(wrappedCh)
- }()
- for desc := range wrappedCh {
- ch <- wrapDesc(desc, c.prefix, c.labels)
- }
-}
-
-func (c *wrappingCollector) unwrapRecursively() Collector {
- switch wc := c.wrappedCollector.(type) {
- case *wrappingCollector:
- return wc.unwrapRecursively()
- default:
- return wc
- }
-}
-
-type wrappingMetric struct {
- wrappedMetric Metric
- prefix string
- labels Labels
-}
-
-func (m *wrappingMetric) Desc() *Desc {
- return wrapDesc(m.wrappedMetric.Desc(), m.prefix, m.labels)
-}
-
-func (m *wrappingMetric) Write(out *dto.Metric) error {
- if err := m.wrappedMetric.Write(out); err != nil {
- return err
- }
- if len(m.labels) == 0 {
- // No wrapping labels.
- return nil
- }
- for ln, lv := range m.labels {
- out.Label = append(out.Label, &dto.LabelPair{
- Name: proto.String(ln),
- Value: proto.String(lv),
- })
- }
- sort.Sort(labelPairSorter(out.Label))
- return nil
-}
-
-func wrapDesc(desc *Desc, prefix string, labels Labels) *Desc {
- constLabels := Labels{}
- for _, lp := range desc.constLabelPairs {
- constLabels[*lp.Name] = *lp.Value
- }
- for ln, lv := range labels {
- if _, alreadyUsed := constLabels[ln]; alreadyUsed {
- return &Desc{
- fqName: desc.fqName,
- help: desc.help,
- variableLabels: desc.variableLabels,
- constLabelPairs: desc.constLabelPairs,
- err: fmt.Errorf("attempted wrapping with already existing label name %q", ln),
- }
- }
- constLabels[ln] = lv
- }
- // NewDesc will do remaining validations.
- newDesc := NewDesc(prefix+desc.fqName, desc.help, desc.variableLabels, constLabels)
- // Propagate errors if there was any. This will override any errer
- // created by NewDesc above, i.e. earlier errors get precedence.
- if desc.err != nil {
- newDesc.err = desc.err
- }
- return newDesc
-}
diff --git a/vendor/github.com/prometheus/client_model/LICENSE b/vendor/github.com/prometheus/client_model/LICENSE
deleted file mode 100644
index 261eeb9..0000000
--- a/vendor/github.com/prometheus/client_model/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/vendor/github.com/prometheus/client_model/NOTICE b/vendor/github.com/prometheus/client_model/NOTICE
deleted file mode 100644
index 20110e4..0000000
--- a/vendor/github.com/prometheus/client_model/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-Data model artifacts for Prometheus.
-Copyright 2012-2015 The Prometheus Authors
-
-This product includes software developed at
-SoundCloud Ltd. (http://soundcloud.com/).
diff --git a/vendor/github.com/prometheus/client_model/go/metrics.pb.go b/vendor/github.com/prometheus/client_model/go/metrics.pb.go
deleted file mode 100644
index 2f4930d..0000000
--- a/vendor/github.com/prometheus/client_model/go/metrics.pb.go
+++ /dev/null
@@ -1,723 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// source: metrics.proto
-
-package io_prometheus_client
-
-import (
- fmt "fmt"
- proto "github.com/golang/protobuf/proto"
- timestamp "github.com/golang/protobuf/ptypes/timestamp"
- math "math"
-)
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
-
-type MetricType int32
-
-const (
- MetricType_COUNTER MetricType = 0
- MetricType_GAUGE MetricType = 1
- MetricType_SUMMARY MetricType = 2
- MetricType_UNTYPED MetricType = 3
- MetricType_HISTOGRAM MetricType = 4
-)
-
-var MetricType_name = map[int32]string{
- 0: "COUNTER",
- 1: "GAUGE",
- 2: "SUMMARY",
- 3: "UNTYPED",
- 4: "HISTOGRAM",
-}
-
-var MetricType_value = map[string]int32{
- "COUNTER": 0,
- "GAUGE": 1,
- "SUMMARY": 2,
- "UNTYPED": 3,
- "HISTOGRAM": 4,
-}
-
-func (x MetricType) Enum() *MetricType {
- p := new(MetricType)
- *p = x
- return p
-}
-
-func (x MetricType) String() string {
- return proto.EnumName(MetricType_name, int32(x))
-}
-
-func (x *MetricType) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(MetricType_value, data, "MetricType")
- if err != nil {
- return err
- }
- *x = MetricType(value)
- return nil
-}
-
-func (MetricType) EnumDescriptor() ([]byte, []int) {
- return fileDescriptor_6039342a2ba47b72, []int{0}
-}
-
-type LabelPair struct {
- Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
- Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *LabelPair) Reset() { *m = LabelPair{} }
-func (m *LabelPair) String() string { return proto.CompactTextString(m) }
-func (*LabelPair) ProtoMessage() {}
-func (*LabelPair) Descriptor() ([]byte, []int) {
- return fileDescriptor_6039342a2ba47b72, []int{0}
-}
-
-func (m *LabelPair) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_LabelPair.Unmarshal(m, b)
-}
-func (m *LabelPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_LabelPair.Marshal(b, m, deterministic)
-}
-func (m *LabelPair) XXX_Merge(src proto.Message) {
- xxx_messageInfo_LabelPair.Merge(m, src)
-}
-func (m *LabelPair) XXX_Size() int {
- return xxx_messageInfo_LabelPair.Size(m)
-}
-func (m *LabelPair) XXX_DiscardUnknown() {
- xxx_messageInfo_LabelPair.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_LabelPair proto.InternalMessageInfo
-
-func (m *LabelPair) GetName() string {
- if m != nil && m.Name != nil {
- return *m.Name
- }
- return ""
-}
-
-func (m *LabelPair) GetValue() string {
- if m != nil && m.Value != nil {
- return *m.Value
- }
- return ""
-}
-
-type Gauge struct {
- Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *Gauge) Reset() { *m = Gauge{} }
-func (m *Gauge) String() string { return proto.CompactTextString(m) }
-func (*Gauge) ProtoMessage() {}
-func (*Gauge) Descriptor() ([]byte, []int) {
- return fileDescriptor_6039342a2ba47b72, []int{1}
-}
-
-func (m *Gauge) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_Gauge.Unmarshal(m, b)
-}
-func (m *Gauge) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_Gauge.Marshal(b, m, deterministic)
-}
-func (m *Gauge) XXX_Merge(src proto.Message) {
- xxx_messageInfo_Gauge.Merge(m, src)
-}
-func (m *Gauge) XXX_Size() int {
- return xxx_messageInfo_Gauge.Size(m)
-}
-func (m *Gauge) XXX_DiscardUnknown() {
- xxx_messageInfo_Gauge.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Gauge proto.InternalMessageInfo
-
-func (m *Gauge) GetValue() float64 {
- if m != nil && m.Value != nil {
- return *m.Value
- }
- return 0
-}
-
-type Counter struct {
- Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"`
- Exemplar *Exemplar `protobuf:"bytes,2,opt,name=exemplar" json:"exemplar,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *Counter) Reset() { *m = Counter{} }
-func (m *Counter) String() string { return proto.CompactTextString(m) }
-func (*Counter) ProtoMessage() {}
-func (*Counter) Descriptor() ([]byte, []int) {
- return fileDescriptor_6039342a2ba47b72, []int{2}
-}
-
-func (m *Counter) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_Counter.Unmarshal(m, b)
-}
-func (m *Counter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_Counter.Marshal(b, m, deterministic)
-}
-func (m *Counter) XXX_Merge(src proto.Message) {
- xxx_messageInfo_Counter.Merge(m, src)
-}
-func (m *Counter) XXX_Size() int {
- return xxx_messageInfo_Counter.Size(m)
-}
-func (m *Counter) XXX_DiscardUnknown() {
- xxx_messageInfo_Counter.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Counter proto.InternalMessageInfo
-
-func (m *Counter) GetValue() float64 {
- if m != nil && m.Value != nil {
- return *m.Value
- }
- return 0
-}
-
-func (m *Counter) GetExemplar() *Exemplar {
- if m != nil {
- return m.Exemplar
- }
- return nil
-}
-
-type Quantile struct {
- Quantile *float64 `protobuf:"fixed64,1,opt,name=quantile" json:"quantile,omitempty"`
- Value *float64 `protobuf:"fixed64,2,opt,name=value" json:"value,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *Quantile) Reset() { *m = Quantile{} }
-func (m *Quantile) String() string { return proto.CompactTextString(m) }
-func (*Quantile) ProtoMessage() {}
-func (*Quantile) Descriptor() ([]byte, []int) {
- return fileDescriptor_6039342a2ba47b72, []int{3}
-}
-
-func (m *Quantile) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_Quantile.Unmarshal(m, b)
-}
-func (m *Quantile) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_Quantile.Marshal(b, m, deterministic)
-}
-func (m *Quantile) XXX_Merge(src proto.Message) {
- xxx_messageInfo_Quantile.Merge(m, src)
-}
-func (m *Quantile) XXX_Size() int {
- return xxx_messageInfo_Quantile.Size(m)
-}
-func (m *Quantile) XXX_DiscardUnknown() {
- xxx_messageInfo_Quantile.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Quantile proto.InternalMessageInfo
-
-func (m *Quantile) GetQuantile() float64 {
- if m != nil && m.Quantile != nil {
- return *m.Quantile
- }
- return 0
-}
-
-func (m *Quantile) GetValue() float64 {
- if m != nil && m.Value != nil {
- return *m.Value
- }
- return 0
-}
-
-type Summary struct {
- SampleCount *uint64 `protobuf:"varint,1,opt,name=sample_count,json=sampleCount" json:"sample_count,omitempty"`
- SampleSum *float64 `protobuf:"fixed64,2,opt,name=sample_sum,json=sampleSum" json:"sample_sum,omitempty"`
- Quantile []*Quantile `protobuf:"bytes,3,rep,name=quantile" json:"quantile,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *Summary) Reset() { *m = Summary{} }
-func (m *Summary) String() string { return proto.CompactTextString(m) }
-func (*Summary) ProtoMessage() {}
-func (*Summary) Descriptor() ([]byte, []int) {
- return fileDescriptor_6039342a2ba47b72, []int{4}
-}
-
-func (m *Summary) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_Summary.Unmarshal(m, b)
-}
-func (m *Summary) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_Summary.Marshal(b, m, deterministic)
-}
-func (m *Summary) XXX_Merge(src proto.Message) {
- xxx_messageInfo_Summary.Merge(m, src)
-}
-func (m *Summary) XXX_Size() int {
- return xxx_messageInfo_Summary.Size(m)
-}
-func (m *Summary) XXX_DiscardUnknown() {
- xxx_messageInfo_Summary.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Summary proto.InternalMessageInfo
-
-func (m *Summary) GetSampleCount() uint64 {
- if m != nil && m.SampleCount != nil {
- return *m.SampleCount
- }
- return 0
-}
-
-func (m *Summary) GetSampleSum() float64 {
- if m != nil && m.SampleSum != nil {
- return *m.SampleSum
- }
- return 0
-}
-
-func (m *Summary) GetQuantile() []*Quantile {
- if m != nil {
- return m.Quantile
- }
- return nil
-}
-
-type Untyped struct {
- Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *Untyped) Reset() { *m = Untyped{} }
-func (m *Untyped) String() string { return proto.CompactTextString(m) }
-func (*Untyped) ProtoMessage() {}
-func (*Untyped) Descriptor() ([]byte, []int) {
- return fileDescriptor_6039342a2ba47b72, []int{5}
-}
-
-func (m *Untyped) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_Untyped.Unmarshal(m, b)
-}
-func (m *Untyped) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_Untyped.Marshal(b, m, deterministic)
-}
-func (m *Untyped) XXX_Merge(src proto.Message) {
- xxx_messageInfo_Untyped.Merge(m, src)
-}
-func (m *Untyped) XXX_Size() int {
- return xxx_messageInfo_Untyped.Size(m)
-}
-func (m *Untyped) XXX_DiscardUnknown() {
- xxx_messageInfo_Untyped.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Untyped proto.InternalMessageInfo
-
-func (m *Untyped) GetValue() float64 {
- if m != nil && m.Value != nil {
- return *m.Value
- }
- return 0
-}
-
-type Histogram struct {
- SampleCount *uint64 `protobuf:"varint,1,opt,name=sample_count,json=sampleCount" json:"sample_count,omitempty"`
- SampleSum *float64 `protobuf:"fixed64,2,opt,name=sample_sum,json=sampleSum" json:"sample_sum,omitempty"`
- Bucket []*Bucket `protobuf:"bytes,3,rep,name=bucket" json:"bucket,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *Histogram) Reset() { *m = Histogram{} }
-func (m *Histogram) String() string { return proto.CompactTextString(m) }
-func (*Histogram) ProtoMessage() {}
-func (*Histogram) Descriptor() ([]byte, []int) {
- return fileDescriptor_6039342a2ba47b72, []int{6}
-}
-
-func (m *Histogram) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_Histogram.Unmarshal(m, b)
-}
-func (m *Histogram) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_Histogram.Marshal(b, m, deterministic)
-}
-func (m *Histogram) XXX_Merge(src proto.Message) {
- xxx_messageInfo_Histogram.Merge(m, src)
-}
-func (m *Histogram) XXX_Size() int {
- return xxx_messageInfo_Histogram.Size(m)
-}
-func (m *Histogram) XXX_DiscardUnknown() {
- xxx_messageInfo_Histogram.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Histogram proto.InternalMessageInfo
-
-func (m *Histogram) GetSampleCount() uint64 {
- if m != nil && m.SampleCount != nil {
- return *m.SampleCount
- }
- return 0
-}
-
-func (m *Histogram) GetSampleSum() float64 {
- if m != nil && m.SampleSum != nil {
- return *m.SampleSum
- }
- return 0
-}
-
-func (m *Histogram) GetBucket() []*Bucket {
- if m != nil {
- return m.Bucket
- }
- return nil
-}
-
-type Bucket struct {
- CumulativeCount *uint64 `protobuf:"varint,1,opt,name=cumulative_count,json=cumulativeCount" json:"cumulative_count,omitempty"`
- UpperBound *float64 `protobuf:"fixed64,2,opt,name=upper_bound,json=upperBound" json:"upper_bound,omitempty"`
- Exemplar *Exemplar `protobuf:"bytes,3,opt,name=exemplar" json:"exemplar,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *Bucket) Reset() { *m = Bucket{} }
-func (m *Bucket) String() string { return proto.CompactTextString(m) }
-func (*Bucket) ProtoMessage() {}
-func (*Bucket) Descriptor() ([]byte, []int) {
- return fileDescriptor_6039342a2ba47b72, []int{7}
-}
-
-func (m *Bucket) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_Bucket.Unmarshal(m, b)
-}
-func (m *Bucket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_Bucket.Marshal(b, m, deterministic)
-}
-func (m *Bucket) XXX_Merge(src proto.Message) {
- xxx_messageInfo_Bucket.Merge(m, src)
-}
-func (m *Bucket) XXX_Size() int {
- return xxx_messageInfo_Bucket.Size(m)
-}
-func (m *Bucket) XXX_DiscardUnknown() {
- xxx_messageInfo_Bucket.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Bucket proto.InternalMessageInfo
-
-func (m *Bucket) GetCumulativeCount() uint64 {
- if m != nil && m.CumulativeCount != nil {
- return *m.CumulativeCount
- }
- return 0
-}
-
-func (m *Bucket) GetUpperBound() float64 {
- if m != nil && m.UpperBound != nil {
- return *m.UpperBound
- }
- return 0
-}
-
-func (m *Bucket) GetExemplar() *Exemplar {
- if m != nil {
- return m.Exemplar
- }
- return nil
-}
-
-type Exemplar struct {
- Label []*LabelPair `protobuf:"bytes,1,rep,name=label" json:"label,omitempty"`
- Value *float64 `protobuf:"fixed64,2,opt,name=value" json:"value,omitempty"`
- Timestamp *timestamp.Timestamp `protobuf:"bytes,3,opt,name=timestamp" json:"timestamp,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *Exemplar) Reset() { *m = Exemplar{} }
-func (m *Exemplar) String() string { return proto.CompactTextString(m) }
-func (*Exemplar) ProtoMessage() {}
-func (*Exemplar) Descriptor() ([]byte, []int) {
- return fileDescriptor_6039342a2ba47b72, []int{8}
-}
-
-func (m *Exemplar) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_Exemplar.Unmarshal(m, b)
-}
-func (m *Exemplar) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_Exemplar.Marshal(b, m, deterministic)
-}
-func (m *Exemplar) XXX_Merge(src proto.Message) {
- xxx_messageInfo_Exemplar.Merge(m, src)
-}
-func (m *Exemplar) XXX_Size() int {
- return xxx_messageInfo_Exemplar.Size(m)
-}
-func (m *Exemplar) XXX_DiscardUnknown() {
- xxx_messageInfo_Exemplar.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Exemplar proto.InternalMessageInfo
-
-func (m *Exemplar) GetLabel() []*LabelPair {
- if m != nil {
- return m.Label
- }
- return nil
-}
-
-func (m *Exemplar) GetValue() float64 {
- if m != nil && m.Value != nil {
- return *m.Value
- }
- return 0
-}
-
-func (m *Exemplar) GetTimestamp() *timestamp.Timestamp {
- if m != nil {
- return m.Timestamp
- }
- return nil
-}
-
-type Metric struct {
- Label []*LabelPair `protobuf:"bytes,1,rep,name=label" json:"label,omitempty"`
- Gauge *Gauge `protobuf:"bytes,2,opt,name=gauge" json:"gauge,omitempty"`
- Counter *Counter `protobuf:"bytes,3,opt,name=counter" json:"counter,omitempty"`
- Summary *Summary `protobuf:"bytes,4,opt,name=summary" json:"summary,omitempty"`
- Untyped *Untyped `protobuf:"bytes,5,opt,name=untyped" json:"untyped,omitempty"`
- Histogram *Histogram `protobuf:"bytes,7,opt,name=histogram" json:"histogram,omitempty"`
- TimestampMs *int64 `protobuf:"varint,6,opt,name=timestamp_ms,json=timestampMs" json:"timestamp_ms,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *Metric) Reset() { *m = Metric{} }
-func (m *Metric) String() string { return proto.CompactTextString(m) }
-func (*Metric) ProtoMessage() {}
-func (*Metric) Descriptor() ([]byte, []int) {
- return fileDescriptor_6039342a2ba47b72, []int{9}
-}
-
-func (m *Metric) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_Metric.Unmarshal(m, b)
-}
-func (m *Metric) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_Metric.Marshal(b, m, deterministic)
-}
-func (m *Metric) XXX_Merge(src proto.Message) {
- xxx_messageInfo_Metric.Merge(m, src)
-}
-func (m *Metric) XXX_Size() int {
- return xxx_messageInfo_Metric.Size(m)
-}
-func (m *Metric) XXX_DiscardUnknown() {
- xxx_messageInfo_Metric.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_Metric proto.InternalMessageInfo
-
-func (m *Metric) GetLabel() []*LabelPair {
- if m != nil {
- return m.Label
- }
- return nil
-}
-
-func (m *Metric) GetGauge() *Gauge {
- if m != nil {
- return m.Gauge
- }
- return nil
-}
-
-func (m *Metric) GetCounter() *Counter {
- if m != nil {
- return m.Counter
- }
- return nil
-}
-
-func (m *Metric) GetSummary() *Summary {
- if m != nil {
- return m.Summary
- }
- return nil
-}
-
-func (m *Metric) GetUntyped() *Untyped {
- if m != nil {
- return m.Untyped
- }
- return nil
-}
-
-func (m *Metric) GetHistogram() *Histogram {
- if m != nil {
- return m.Histogram
- }
- return nil
-}
-
-func (m *Metric) GetTimestampMs() int64 {
- if m != nil && m.TimestampMs != nil {
- return *m.TimestampMs
- }
- return 0
-}
-
-type MetricFamily struct {
- Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
- Help *string `protobuf:"bytes,2,opt,name=help" json:"help,omitempty"`
- Type *MetricType `protobuf:"varint,3,opt,name=type,enum=io.prometheus.client.MetricType" json:"type,omitempty"`
- Metric []*Metric `protobuf:"bytes,4,rep,name=metric" json:"metric,omitempty"`
- XXX_NoUnkeyedLiteral struct{} `json:"-"`
- XXX_unrecognized []byte `json:"-"`
- XXX_sizecache int32 `json:"-"`
-}
-
-func (m *MetricFamily) Reset() { *m = MetricFamily{} }
-func (m *MetricFamily) String() string { return proto.CompactTextString(m) }
-func (*MetricFamily) ProtoMessage() {}
-func (*MetricFamily) Descriptor() ([]byte, []int) {
- return fileDescriptor_6039342a2ba47b72, []int{10}
-}
-
-func (m *MetricFamily) XXX_Unmarshal(b []byte) error {
- return xxx_messageInfo_MetricFamily.Unmarshal(m, b)
-}
-func (m *MetricFamily) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
- return xxx_messageInfo_MetricFamily.Marshal(b, m, deterministic)
-}
-func (m *MetricFamily) XXX_Merge(src proto.Message) {
- xxx_messageInfo_MetricFamily.Merge(m, src)
-}
-func (m *MetricFamily) XXX_Size() int {
- return xxx_messageInfo_MetricFamily.Size(m)
-}
-func (m *MetricFamily) XXX_DiscardUnknown() {
- xxx_messageInfo_MetricFamily.DiscardUnknown(m)
-}
-
-var xxx_messageInfo_MetricFamily proto.InternalMessageInfo
-
-func (m *MetricFamily) GetName() string {
- if m != nil && m.Name != nil {
- return *m.Name
- }
- return ""
-}
-
-func (m *MetricFamily) GetHelp() string {
- if m != nil && m.Help != nil {
- return *m.Help
- }
- return ""
-}
-
-func (m *MetricFamily) GetType() MetricType {
- if m != nil && m.Type != nil {
- return *m.Type
- }
- return MetricType_COUNTER
-}
-
-func (m *MetricFamily) GetMetric() []*Metric {
- if m != nil {
- return m.Metric
- }
- return nil
-}
-
-func init() {
- proto.RegisterEnum("io.prometheus.client.MetricType", MetricType_name, MetricType_value)
- proto.RegisterType((*LabelPair)(nil), "io.prometheus.client.LabelPair")
- proto.RegisterType((*Gauge)(nil), "io.prometheus.client.Gauge")
- proto.RegisterType((*Counter)(nil), "io.prometheus.client.Counter")
- proto.RegisterType((*Quantile)(nil), "io.prometheus.client.Quantile")
- proto.RegisterType((*Summary)(nil), "io.prometheus.client.Summary")
- proto.RegisterType((*Untyped)(nil), "io.prometheus.client.Untyped")
- proto.RegisterType((*Histogram)(nil), "io.prometheus.client.Histogram")
- proto.RegisterType((*Bucket)(nil), "io.prometheus.client.Bucket")
- proto.RegisterType((*Exemplar)(nil), "io.prometheus.client.Exemplar")
- proto.RegisterType((*Metric)(nil), "io.prometheus.client.Metric")
- proto.RegisterType((*MetricFamily)(nil), "io.prometheus.client.MetricFamily")
-}
-
-func init() { proto.RegisterFile("metrics.proto", fileDescriptor_6039342a2ba47b72) }
-
-var fileDescriptor_6039342a2ba47b72 = []byte{
- // 665 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x6e, 0xd3, 0x4c,
- 0x14, 0xfd, 0xdc, 0x38, 0x3f, 0xbe, 0x69, 0x3f, 0xa2, 0x51, 0x17, 0x56, 0xa1, 0x24, 0x78, 0x55,
- 0x58, 0x38, 0xa2, 0x6a, 0x05, 0x2a, 0xb0, 0x68, 0x4b, 0x48, 0x91, 0x48, 0x5b, 0x26, 0xc9, 0xa2,
- 0xb0, 0x88, 0x1c, 0x77, 0x70, 0x2c, 0x3c, 0xb1, 0xb1, 0x67, 0x2a, 0xb2, 0x66, 0xc1, 0x16, 0x5e,
- 0x81, 0x17, 0x05, 0xcd, 0x8f, 0x6d, 0x2a, 0xb9, 0x95, 0x40, 0xec, 0x66, 0xee, 0x3d, 0xe7, 0xfa,
- 0xcc, 0xf8, 0x9c, 0x81, 0x0d, 0x4a, 0x58, 0x1a, 0xfa, 0x99, 0x9b, 0xa4, 0x31, 0x8b, 0xd1, 0x66,
- 0x18, 0x8b, 0x15, 0x25, 0x6c, 0x41, 0x78, 0xe6, 0xfa, 0x51, 0x48, 0x96, 0x6c, 0xab, 0x1b, 0xc4,
- 0x71, 0x10, 0x91, 0xbe, 0xc4, 0xcc, 0xf9, 0x87, 0x3e, 0x0b, 0x29, 0xc9, 0x98, 0x47, 0x13, 0x45,
- 0x73, 0xf6, 0xc1, 0x7a, 0xe3, 0xcd, 0x49, 0x74, 0xee, 0x85, 0x29, 0x42, 0x60, 0x2e, 0x3d, 0x4a,
- 0x6c, 0xa3, 0x67, 0xec, 0x58, 0x58, 0xae, 0xd1, 0x26, 0xd4, 0xaf, 0xbc, 0x88, 0x13, 0x7b, 0x4d,
- 0x16, 0xd5, 0xc6, 0xd9, 0x86, 0xfa, 0xd0, 0xe3, 0xc1, 0x6f, 0x6d, 0xc1, 0x31, 0xf2, 0xf6, 0x7b,
- 0x68, 0x1e, 0xc7, 0x7c, 0xc9, 0x48, 0x5a, 0x0d, 0x40, 0x07, 0xd0, 0x22, 0x9f, 0x09, 0x4d, 0x22,
- 0x2f, 0x95, 0x83, 0xdb, 0xbb, 0xf7, 0xdd, 0xaa, 0x03, 0xb8, 0x03, 0x8d, 0xc2, 0x05, 0xde, 0x79,
- 0x0e, 0xad, 0xb7, 0xdc, 0x5b, 0xb2, 0x30, 0x22, 0x68, 0x0b, 0x5a, 0x9f, 0xf4, 0x5a, 0x7f, 0xa0,
- 0xd8, 0x5f, 0x57, 0x5e, 0x48, 0xfb, 0x6a, 0x40, 0x73, 0xcc, 0x29, 0xf5, 0xd2, 0x15, 0x7a, 0x00,
- 0xeb, 0x99, 0x47, 0x93, 0x88, 0xcc, 0x7c, 0xa1, 0x56, 0x4e, 0x30, 0x71, 0x5b, 0xd5, 0xe4, 0x01,
- 0xd0, 0x36, 0x80, 0x86, 0x64, 0x9c, 0xea, 0x49, 0x96, 0xaa, 0x8c, 0x39, 0x15, 0xe7, 0x28, 0xbe,
- 0x5f, 0xeb, 0xd5, 0x6e, 0x3e, 0x47, 0xae, 0xb8, 0xd4, 0xe7, 0x74, 0xa1, 0x39, 0x5d, 0xb2, 0x55,
- 0x42, 0x2e, 0x6f, 0xb8, 0xc5, 0x2f, 0x06, 0x58, 0x27, 0x61, 0xc6, 0xe2, 0x20, 0xf5, 0xe8, 0x3f,
- 0x10, 0xbb, 0x07, 0x8d, 0x39, 0xf7, 0x3f, 0x12, 0xa6, 0xa5, 0xde, 0xab, 0x96, 0x7a, 0x24, 0x31,
- 0x58, 0x63, 0x9d, 0x6f, 0x06, 0x34, 0x54, 0x09, 0x3d, 0x84, 0x8e, 0xcf, 0x29, 0x8f, 0x3c, 0x16,
- 0x5e, 0x5d, 0x97, 0x71, 0xa7, 0xac, 0x2b, 0x29, 0x5d, 0x68, 0xf3, 0x24, 0x21, 0xe9, 0x6c, 0x1e,
- 0xf3, 0xe5, 0xa5, 0xd6, 0x02, 0xb2, 0x74, 0x24, 0x2a, 0xd7, 0x1c, 0x50, 0xfb, 0x43, 0x07, 0x7c,
- 0x37, 0xa0, 0x95, 0x97, 0xd1, 0x3e, 0xd4, 0x23, 0xe1, 0x60, 0xdb, 0x90, 0x87, 0xea, 0x56, 0x4f,
- 0x29, 0x4c, 0x8e, 0x15, 0xba, 0xda, 0x1d, 0xe8, 0x29, 0x58, 0x45, 0x42, 0xb4, 0xac, 0x2d, 0x57,
- 0x65, 0xc8, 0xcd, 0x33, 0xe4, 0x4e, 0x72, 0x04, 0x2e, 0xc1, 0xce, 0xcf, 0x35, 0x68, 0x8c, 0x64,
- 0x22, 0xff, 0x56, 0xd1, 0x63, 0xa8, 0x07, 0x22, 0x53, 0x3a, 0x10, 0x77, 0xab, 0x69, 0x32, 0x76,
- 0x58, 0x21, 0xd1, 0x13, 0x68, 0xfa, 0x2a, 0x67, 0x5a, 0xec, 0x76, 0x35, 0x49, 0x87, 0x11, 0xe7,
- 0x68, 0x41, 0xcc, 0x54, 0x08, 0x6c, 0xf3, 0x36, 0xa2, 0x4e, 0x0a, 0xce, 0xd1, 0x82, 0xc8, 0x95,
- 0x69, 0xed, 0xfa, 0x6d, 0x44, 0xed, 0x6c, 0x9c, 0xa3, 0xd1, 0x0b, 0xb0, 0x16, 0xb9, 0x97, 0xed,
- 0xa6, 0xa4, 0xde, 0x70, 0x31, 0x85, 0xe5, 0x71, 0xc9, 0x10, 0xee, 0x2f, 0xee, 0x7a, 0x46, 0x33,
- 0xbb, 0xd1, 0x33, 0x76, 0x6a, 0xb8, 0x5d, 0xd4, 0x46, 0x99, 0xf3, 0xc3, 0x80, 0x75, 0xf5, 0x07,
- 0x5e, 0x79, 0x34, 0x8c, 0x56, 0x95, 0xcf, 0x19, 0x02, 0x73, 0x41, 0xa2, 0x44, 0xbf, 0x66, 0x72,
- 0x8d, 0xf6, 0xc0, 0x14, 0x1a, 0xe5, 0x15, 0xfe, 0xbf, 0xdb, 0xab, 0x56, 0xa5, 0x26, 0x4f, 0x56,
- 0x09, 0xc1, 0x12, 0x2d, 0xd2, 0xa4, 0x5e, 0x60, 0xdb, 0xbc, 0x2d, 0x4d, 0x8a, 0x87, 0x35, 0xf6,
- 0xd1, 0x08, 0xa0, 0x9c, 0x84, 0xda, 0xd0, 0x3c, 0x3e, 0x9b, 0x9e, 0x4e, 0x06, 0xb8, 0xf3, 0x1f,
- 0xb2, 0xa0, 0x3e, 0x3c, 0x9c, 0x0e, 0x07, 0x1d, 0x43, 0xd4, 0xc7, 0xd3, 0xd1, 0xe8, 0x10, 0x5f,
- 0x74, 0xd6, 0xc4, 0x66, 0x7a, 0x3a, 0xb9, 0x38, 0x1f, 0xbc, 0xec, 0xd4, 0xd0, 0x06, 0x58, 0x27,
- 0xaf, 0xc7, 0x93, 0xb3, 0x21, 0x3e, 0x1c, 0x75, 0xcc, 0x23, 0x0c, 0x95, 0xef, 0xfe, 0xbb, 0x83,
- 0x20, 0x64, 0x0b, 0x3e, 0x77, 0xfd, 0x98, 0xf6, 0xcb, 0x6e, 0x5f, 0x75, 0x67, 0x34, 0xbe, 0x24,
- 0x51, 0x3f, 0x88, 0x9f, 0x85, 0xf1, 0xac, 0xec, 0xce, 0x54, 0xf7, 0x57, 0x00, 0x00, 0x00, 0xff,
- 0xff, 0xd0, 0x84, 0x91, 0x73, 0x59, 0x06, 0x00, 0x00,
-}
diff --git a/vendor/github.com/prometheus/common/LICENSE b/vendor/github.com/prometheus/common/LICENSE
deleted file mode 100644
index 261eeb9..0000000
--- a/vendor/github.com/prometheus/common/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/vendor/github.com/prometheus/common/NOTICE b/vendor/github.com/prometheus/common/NOTICE
deleted file mode 100644
index 636a2c1..0000000
--- a/vendor/github.com/prometheus/common/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-Common libraries shared by Prometheus Go components.
-Copyright 2015 The Prometheus Authors
-
-This product includes software developed at
-SoundCloud Ltd. (http://soundcloud.com/).
diff --git a/vendor/github.com/prometheus/common/expfmt/decode.go b/vendor/github.com/prometheus/common/expfmt/decode.go
deleted file mode 100644
index c092723..0000000
--- a/vendor/github.com/prometheus/common/expfmt/decode.go
+++ /dev/null
@@ -1,429 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package expfmt
-
-import (
- "fmt"
- "io"
- "math"
- "mime"
- "net/http"
-
- dto "github.com/prometheus/client_model/go"
-
- "github.com/matttproud/golang_protobuf_extensions/pbutil"
- "github.com/prometheus/common/model"
-)
-
-// Decoder types decode an input stream into metric families.
-type Decoder interface {
- Decode(*dto.MetricFamily) error
-}
-
-// DecodeOptions contains options used by the Decoder and in sample extraction.
-type DecodeOptions struct {
- // Timestamp is added to each value from the stream that has no explicit timestamp set.
- Timestamp model.Time
-}
-
-// ResponseFormat extracts the correct format from a HTTP response header.
-// If no matching format can be found FormatUnknown is returned.
-func ResponseFormat(h http.Header) Format {
- ct := h.Get(hdrContentType)
-
- mediatype, params, err := mime.ParseMediaType(ct)
- if err != nil {
- return FmtUnknown
- }
-
- const textType = "text/plain"
-
- switch mediatype {
- case ProtoType:
- if p, ok := params["proto"]; ok && p != ProtoProtocol {
- return FmtUnknown
- }
- if e, ok := params["encoding"]; ok && e != "delimited" {
- return FmtUnknown
- }
- return FmtProtoDelim
-
- case textType:
- if v, ok := params["version"]; ok && v != TextVersion {
- return FmtUnknown
- }
- return FmtText
- }
-
- return FmtUnknown
-}
-
-// NewDecoder returns a new decoder based on the given input format.
-// If the input format does not imply otherwise, a text format decoder is returned.
-func NewDecoder(r io.Reader, format Format) Decoder {
- switch format {
- case FmtProtoDelim:
- return &protoDecoder{r: r}
- }
- return &textDecoder{r: r}
-}
-
-// protoDecoder implements the Decoder interface for protocol buffers.
-type protoDecoder struct {
- r io.Reader
-}
-
-// Decode implements the Decoder interface.
-func (d *protoDecoder) Decode(v *dto.MetricFamily) error {
- _, err := pbutil.ReadDelimited(d.r, v)
- if err != nil {
- return err
- }
- if !model.IsValidMetricName(model.LabelValue(v.GetName())) {
- return fmt.Errorf("invalid metric name %q", v.GetName())
- }
- for _, m := range v.GetMetric() {
- if m == nil {
- continue
- }
- for _, l := range m.GetLabel() {
- if l == nil {
- continue
- }
- if !model.LabelValue(l.GetValue()).IsValid() {
- return fmt.Errorf("invalid label value %q", l.GetValue())
- }
- if !model.LabelName(l.GetName()).IsValid() {
- return fmt.Errorf("invalid label name %q", l.GetName())
- }
- }
- }
- return nil
-}
-
-// textDecoder implements the Decoder interface for the text protocol.
-type textDecoder struct {
- r io.Reader
- p TextParser
- fams []*dto.MetricFamily
-}
-
-// Decode implements the Decoder interface.
-func (d *textDecoder) Decode(v *dto.MetricFamily) error {
- // TODO(fabxc): Wrap this as a line reader to make streaming safer.
- if len(d.fams) == 0 {
- // No cached metric families, read everything and parse metrics.
- fams, err := d.p.TextToMetricFamilies(d.r)
- if err != nil {
- return err
- }
- if len(fams) == 0 {
- return io.EOF
- }
- d.fams = make([]*dto.MetricFamily, 0, len(fams))
- for _, f := range fams {
- d.fams = append(d.fams, f)
- }
- }
-
- *v = *d.fams[0]
- d.fams = d.fams[1:]
-
- return nil
-}
-
-// SampleDecoder wraps a Decoder to extract samples from the metric families
-// decoded by the wrapped Decoder.
-type SampleDecoder struct {
- Dec Decoder
- Opts *DecodeOptions
-
- f dto.MetricFamily
-}
-
-// Decode calls the Decode method of the wrapped Decoder and then extracts the
-// samples from the decoded MetricFamily into the provided model.Vector.
-func (sd *SampleDecoder) Decode(s *model.Vector) error {
- err := sd.Dec.Decode(&sd.f)
- if err != nil {
- return err
- }
- *s, err = extractSamples(&sd.f, sd.Opts)
- return err
-}
-
-// ExtractSamples builds a slice of samples from the provided metric
-// families. If an error occurrs during sample extraction, it continues to
-// extract from the remaining metric families. The returned error is the last
-// error that has occurred.
-func ExtractSamples(o *DecodeOptions, fams ...*dto.MetricFamily) (model.Vector, error) {
- var (
- all model.Vector
- lastErr error
- )
- for _, f := range fams {
- some, err := extractSamples(f, o)
- if err != nil {
- lastErr = err
- continue
- }
- all = append(all, some...)
- }
- return all, lastErr
-}
-
-func extractSamples(f *dto.MetricFamily, o *DecodeOptions) (model.Vector, error) {
- switch f.GetType() {
- case dto.MetricType_COUNTER:
- return extractCounter(o, f), nil
- case dto.MetricType_GAUGE:
- return extractGauge(o, f), nil
- case dto.MetricType_SUMMARY:
- return extractSummary(o, f), nil
- case dto.MetricType_UNTYPED:
- return extractUntyped(o, f), nil
- case dto.MetricType_HISTOGRAM:
- return extractHistogram(o, f), nil
- }
- return nil, fmt.Errorf("expfmt.extractSamples: unknown metric family type %v", f.GetType())
-}
-
-func extractCounter(o *DecodeOptions, f *dto.MetricFamily) model.Vector {
- samples := make(model.Vector, 0, len(f.Metric))
-
- for _, m := range f.Metric {
- if m.Counter == nil {
- continue
- }
-
- lset := make(model.LabelSet, len(m.Label)+1)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName())
-
- smpl := &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(m.Counter.GetValue()),
- }
-
- if m.TimestampMs != nil {
- smpl.Timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000)
- } else {
- smpl.Timestamp = o.Timestamp
- }
-
- samples = append(samples, smpl)
- }
-
- return samples
-}
-
-func extractGauge(o *DecodeOptions, f *dto.MetricFamily) model.Vector {
- samples := make(model.Vector, 0, len(f.Metric))
-
- for _, m := range f.Metric {
- if m.Gauge == nil {
- continue
- }
-
- lset := make(model.LabelSet, len(m.Label)+1)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName())
-
- smpl := &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(m.Gauge.GetValue()),
- }
-
- if m.TimestampMs != nil {
- smpl.Timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000)
- } else {
- smpl.Timestamp = o.Timestamp
- }
-
- samples = append(samples, smpl)
- }
-
- return samples
-}
-
-func extractUntyped(o *DecodeOptions, f *dto.MetricFamily) model.Vector {
- samples := make(model.Vector, 0, len(f.Metric))
-
- for _, m := range f.Metric {
- if m.Untyped == nil {
- continue
- }
-
- lset := make(model.LabelSet, len(m.Label)+1)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName())
-
- smpl := &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(m.Untyped.GetValue()),
- }
-
- if m.TimestampMs != nil {
- smpl.Timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000)
- } else {
- smpl.Timestamp = o.Timestamp
- }
-
- samples = append(samples, smpl)
- }
-
- return samples
-}
-
-func extractSummary(o *DecodeOptions, f *dto.MetricFamily) model.Vector {
- samples := make(model.Vector, 0, len(f.Metric))
-
- for _, m := range f.Metric {
- if m.Summary == nil {
- continue
- }
-
- timestamp := o.Timestamp
- if m.TimestampMs != nil {
- timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000)
- }
-
- for _, q := range m.Summary.Quantile {
- lset := make(model.LabelSet, len(m.Label)+2)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- // BUG(matt): Update other names to "quantile".
- lset[model.LabelName(model.QuantileLabel)] = model.LabelValue(fmt.Sprint(q.GetQuantile()))
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName())
-
- samples = append(samples, &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(q.GetValue()),
- Timestamp: timestamp,
- })
- }
-
- lset := make(model.LabelSet, len(m.Label)+1)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_sum")
-
- samples = append(samples, &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(m.Summary.GetSampleSum()),
- Timestamp: timestamp,
- })
-
- lset = make(model.LabelSet, len(m.Label)+1)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_count")
-
- samples = append(samples, &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(m.Summary.GetSampleCount()),
- Timestamp: timestamp,
- })
- }
-
- return samples
-}
-
-func extractHistogram(o *DecodeOptions, f *dto.MetricFamily) model.Vector {
- samples := make(model.Vector, 0, len(f.Metric))
-
- for _, m := range f.Metric {
- if m.Histogram == nil {
- continue
- }
-
- timestamp := o.Timestamp
- if m.TimestampMs != nil {
- timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000)
- }
-
- infSeen := false
-
- for _, q := range m.Histogram.Bucket {
- lset := make(model.LabelSet, len(m.Label)+2)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.LabelName(model.BucketLabel)] = model.LabelValue(fmt.Sprint(q.GetUpperBound()))
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_bucket")
-
- if math.IsInf(q.GetUpperBound(), +1) {
- infSeen = true
- }
-
- samples = append(samples, &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(q.GetCumulativeCount()),
- Timestamp: timestamp,
- })
- }
-
- lset := make(model.LabelSet, len(m.Label)+1)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_sum")
-
- samples = append(samples, &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(m.Histogram.GetSampleSum()),
- Timestamp: timestamp,
- })
-
- lset = make(model.LabelSet, len(m.Label)+1)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_count")
-
- count := &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(m.Histogram.GetSampleCount()),
- Timestamp: timestamp,
- }
- samples = append(samples, count)
-
- if !infSeen {
- // Append an infinity bucket sample.
- lset := make(model.LabelSet, len(m.Label)+2)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.LabelName(model.BucketLabel)] = model.LabelValue("+Inf")
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_bucket")
-
- samples = append(samples, &model.Sample{
- Metric: model.Metric(lset),
- Value: count.Value,
- Timestamp: timestamp,
- })
- }
- }
-
- return samples
-}
diff --git a/vendor/github.com/prometheus/common/expfmt/encode.go b/vendor/github.com/prometheus/common/expfmt/encode.go
deleted file mode 100644
index bd4e347..0000000
--- a/vendor/github.com/prometheus/common/expfmt/encode.go
+++ /dev/null
@@ -1,162 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package expfmt
-
-import (
- "fmt"
- "io"
- "net/http"
-
- "github.com/golang/protobuf/proto"
- "github.com/matttproud/golang_protobuf_extensions/pbutil"
- "github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-// Encoder types encode metric families into an underlying wire protocol.
-type Encoder interface {
- Encode(*dto.MetricFamily) error
-}
-
-// Closer is implemented by Encoders that need to be closed to finalize
-// encoding. (For example, OpenMetrics needs a final `# EOF` line.)
-//
-// Note that all Encoder implementations returned from this package implement
-// Closer, too, even if the Close call is a no-op. This happens in preparation
-// for adding a Close method to the Encoder interface directly in a (mildly
-// breaking) release in the future.
-type Closer interface {
- Close() error
-}
-
-type encoderCloser struct {
- encode func(*dto.MetricFamily) error
- close func() error
-}
-
-func (ec encoderCloser) Encode(v *dto.MetricFamily) error {
- return ec.encode(v)
-}
-
-func (ec encoderCloser) Close() error {
- return ec.close()
-}
-
-// Negotiate returns the Content-Type based on the given Accept header. If no
-// appropriate accepted type is found, FmtText is returned (which is the
-// Prometheus text format). This function will never negotiate FmtOpenMetrics,
-// as the support is still experimental. To include the option to negotiate
-// FmtOpenMetrics, use NegotiateOpenMetrics.
-func Negotiate(h http.Header) Format {
- for _, ac := range goautoneg.ParseAccept(h.Get(hdrAccept)) {
- ver := ac.Params["version"]
- if ac.Type+"/"+ac.SubType == ProtoType && ac.Params["proto"] == ProtoProtocol {
- switch ac.Params["encoding"] {
- case "delimited":
- return FmtProtoDelim
- case "text":
- return FmtProtoText
- case "compact-text":
- return FmtProtoCompact
- }
- }
- if ac.Type == "text" && ac.SubType == "plain" && (ver == TextVersion || ver == "") {
- return FmtText
- }
- }
- return FmtText
-}
-
-// NegotiateIncludingOpenMetrics works like Negotiate but includes
-// FmtOpenMetrics as an option for the result. Note that this function is
-// temporary and will disappear once FmtOpenMetrics is fully supported and as
-// such may be negotiated by the normal Negotiate function.
-func NegotiateIncludingOpenMetrics(h http.Header) Format {
- for _, ac := range goautoneg.ParseAccept(h.Get(hdrAccept)) {
- ver := ac.Params["version"]
- if ac.Type+"/"+ac.SubType == ProtoType && ac.Params["proto"] == ProtoProtocol {
- switch ac.Params["encoding"] {
- case "delimited":
- return FmtProtoDelim
- case "text":
- return FmtProtoText
- case "compact-text":
- return FmtProtoCompact
- }
- }
- if ac.Type == "text" && ac.SubType == "plain" && (ver == TextVersion || ver == "") {
- return FmtText
- }
- if ac.Type+"/"+ac.SubType == OpenMetricsType && (ver == OpenMetricsVersion || ver == "") {
- return FmtOpenMetrics
- }
- }
- return FmtText
-}
-
-// NewEncoder returns a new encoder based on content type negotiation. All
-// Encoder implementations returned by NewEncoder also implement Closer, and
-// callers should always call the Close method. It is currently only required
-// for FmtOpenMetrics, but a future (breaking) release will add the Close method
-// to the Encoder interface directly. The current version of the Encoder
-// interface is kept for backwards compatibility.
-func NewEncoder(w io.Writer, format Format) Encoder {
- switch format {
- case FmtProtoDelim:
- return encoderCloser{
- encode: func(v *dto.MetricFamily) error {
- _, err := pbutil.WriteDelimited(w, v)
- return err
- },
- close: func() error { return nil },
- }
- case FmtProtoCompact:
- return encoderCloser{
- encode: func(v *dto.MetricFamily) error {
- _, err := fmt.Fprintln(w, v.String())
- return err
- },
- close: func() error { return nil },
- }
- case FmtProtoText:
- return encoderCloser{
- encode: func(v *dto.MetricFamily) error {
- _, err := fmt.Fprintln(w, proto.MarshalTextString(v))
- return err
- },
- close: func() error { return nil },
- }
- case FmtText:
- return encoderCloser{
- encode: func(v *dto.MetricFamily) error {
- _, err := MetricFamilyToText(w, v)
- return err
- },
- close: func() error { return nil },
- }
- case FmtOpenMetrics:
- return encoderCloser{
- encode: func(v *dto.MetricFamily) error {
- _, err := MetricFamilyToOpenMetrics(w, v)
- return err
- },
- close: func() error {
- _, err := FinalizeOpenMetrics(w)
- return err
- },
- }
- }
- panic(fmt.Errorf("expfmt.NewEncoder: unknown format %q", format))
-}
diff --git a/vendor/github.com/prometheus/common/expfmt/expfmt.go b/vendor/github.com/prometheus/common/expfmt/expfmt.go
deleted file mode 100644
index 0f176fa..0000000
--- a/vendor/github.com/prometheus/common/expfmt/expfmt.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package expfmt contains tools for reading and writing Prometheus metrics.
-package expfmt
-
-// Format specifies the HTTP content type of the different wire protocols.
-type Format string
-
-// Constants to assemble the Content-Type values for the different wire protocols.
-const (
- TextVersion = "0.0.4"
- ProtoType = `application/vnd.google.protobuf`
- ProtoProtocol = `io.prometheus.client.MetricFamily`
- ProtoFmt = ProtoType + "; proto=" + ProtoProtocol + ";"
- OpenMetricsType = `application/openmetrics-text`
- OpenMetricsVersion = "0.0.1"
-
- // The Content-Type values for the different wire protocols.
- FmtUnknown Format = ``
- FmtText Format = `text/plain; version=` + TextVersion + `; charset=utf-8`
- FmtProtoDelim Format = ProtoFmt + ` encoding=delimited`
- FmtProtoText Format = ProtoFmt + ` encoding=text`
- FmtProtoCompact Format = ProtoFmt + ` encoding=compact-text`
- FmtOpenMetrics Format = OpenMetricsType + `; version=` + OpenMetricsVersion + `; charset=utf-8`
-)
-
-const (
- hdrContentType = "Content-Type"
- hdrAccept = "Accept"
-)
diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz.go b/vendor/github.com/prometheus/common/expfmt/fuzz.go
deleted file mode 100644
index dc2eede..0000000
--- a/vendor/github.com/prometheus/common/expfmt/fuzz.go
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Build only when actually fuzzing
-// +build gofuzz
-
-package expfmt
-
-import "bytes"
-
-// Fuzz text metric parser with with github.com/dvyukov/go-fuzz:
-//
-// go-fuzz-build github.com/prometheus/common/expfmt
-// go-fuzz -bin expfmt-fuzz.zip -workdir fuzz
-//
-// Further input samples should go in the folder fuzz/corpus.
-func Fuzz(in []byte) int {
- parser := TextParser{}
- _, err := parser.TextToMetricFamilies(bytes.NewReader(in))
-
- if err != nil {
- return 0
- }
-
- return 1
-}
diff --git a/vendor/github.com/prometheus/common/expfmt/openmetrics_create.go b/vendor/github.com/prometheus/common/expfmt/openmetrics_create.go
deleted file mode 100644
index 8a9313a..0000000
--- a/vendor/github.com/prometheus/common/expfmt/openmetrics_create.go
+++ /dev/null
@@ -1,527 +0,0 @@
-// Copyright 2020 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package expfmt
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "math"
- "strconv"
- "strings"
-
- "github.com/golang/protobuf/ptypes"
- "github.com/prometheus/common/model"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-// MetricFamilyToOpenMetrics converts a MetricFamily proto message into the
-// OpenMetrics text format and writes the resulting lines to 'out'. It returns
-// the number of bytes written and any error encountered. The output will have
-// the same order as the input, no further sorting is performed. Furthermore,
-// this function assumes the input is already sanitized and does not perform any
-// sanity checks. If the input contains duplicate metrics or invalid metric or
-// label names, the conversion will result in invalid text format output.
-//
-// This function fulfills the type 'expfmt.encoder'.
-//
-// Note that OpenMetrics requires a final `# EOF` line. Since this function acts
-// on individual metric families, it is the responsibility of the caller to
-// append this line to 'out' once all metric families have been written.
-// Conveniently, this can be done by calling FinalizeOpenMetrics.
-//
-// The output should be fully OpenMetrics compliant. However, there are a few
-// missing features and peculiarities to avoid complications when switching from
-// Prometheus to OpenMetrics or vice versa:
-//
-// - Counters are expected to have the `_total` suffix in their metric name. In
-// the output, the suffix will be truncated from the `# TYPE` and `# HELP`
-// line. A counter with a missing `_total` suffix is not an error. However,
-// its type will be set to `unknown` in that case to avoid invalid OpenMetrics
-// output.
-//
-// - No support for the following (optional) features: `# UNIT` line, `_created`
-// line, info type, stateset type, gaugehistogram type.
-//
-// - The size of exemplar labels is not checked (i.e. it's possible to create
-// exemplars that are larger than allowed by the OpenMetrics specification).
-//
-// - The value of Counters is not checked. (OpenMetrics doesn't allow counters
-// with a `NaN` value.)
-func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily) (written int, err error) {
- name := in.GetName()
- if name == "" {
- return 0, fmt.Errorf("MetricFamily has no name: %s", in)
- }
-
- // Try the interface upgrade. If it doesn't work, we'll use a
- // bufio.Writer from the sync.Pool.
- w, ok := out.(enhancedWriter)
- if !ok {
- b := bufPool.Get().(*bufio.Writer)
- b.Reset(out)
- w = b
- defer func() {
- bErr := b.Flush()
- if err == nil {
- err = bErr
- }
- bufPool.Put(b)
- }()
- }
-
- var (
- n int
- metricType = in.GetType()
- shortName = name
- )
- if metricType == dto.MetricType_COUNTER && strings.HasSuffix(shortName, "_total") {
- shortName = name[:len(name)-6]
- }
-
- // Comments, first HELP, then TYPE.
- if in.Help != nil {
- n, err = w.WriteString("# HELP ")
- written += n
- if err != nil {
- return
- }
- n, err = w.WriteString(shortName)
- written += n
- if err != nil {
- return
- }
- err = w.WriteByte(' ')
- written++
- if err != nil {
- return
- }
- n, err = writeEscapedString(w, *in.Help, true)
- written += n
- if err != nil {
- return
- }
- err = w.WriteByte('\n')
- written++
- if err != nil {
- return
- }
- }
- n, err = w.WriteString("# TYPE ")
- written += n
- if err != nil {
- return
- }
- n, err = w.WriteString(shortName)
- written += n
- if err != nil {
- return
- }
- switch metricType {
- case dto.MetricType_COUNTER:
- if strings.HasSuffix(name, "_total") {
- n, err = w.WriteString(" counter\n")
- } else {
- n, err = w.WriteString(" unknown\n")
- }
- case dto.MetricType_GAUGE:
- n, err = w.WriteString(" gauge\n")
- case dto.MetricType_SUMMARY:
- n, err = w.WriteString(" summary\n")
- case dto.MetricType_UNTYPED:
- n, err = w.WriteString(" unknown\n")
- case dto.MetricType_HISTOGRAM:
- n, err = w.WriteString(" histogram\n")
- default:
- return written, fmt.Errorf("unknown metric type %s", metricType.String())
- }
- written += n
- if err != nil {
- return
- }
-
- // Finally the samples, one line for each.
- for _, metric := range in.Metric {
- switch metricType {
- case dto.MetricType_COUNTER:
- if metric.Counter == nil {
- return written, fmt.Errorf(
- "expected counter in metric %s %s", name, metric,
- )
- }
- // Note that we have ensured above that either the name
- // ends on `_total` or that the rendered type is
- // `unknown`. Therefore, no `_total` must be added here.
- n, err = writeOpenMetricsSample(
- w, name, "", metric, "", 0,
- metric.Counter.GetValue(), 0, false,
- metric.Counter.Exemplar,
- )
- case dto.MetricType_GAUGE:
- if metric.Gauge == nil {
- return written, fmt.Errorf(
- "expected gauge in metric %s %s", name, metric,
- )
- }
- n, err = writeOpenMetricsSample(
- w, name, "", metric, "", 0,
- metric.Gauge.GetValue(), 0, false,
- nil,
- )
- case dto.MetricType_UNTYPED:
- if metric.Untyped == nil {
- return written, fmt.Errorf(
- "expected untyped in metric %s %s", name, metric,
- )
- }
- n, err = writeOpenMetricsSample(
- w, name, "", metric, "", 0,
- metric.Untyped.GetValue(), 0, false,
- nil,
- )
- case dto.MetricType_SUMMARY:
- if metric.Summary == nil {
- return written, fmt.Errorf(
- "expected summary in metric %s %s", name, metric,
- )
- }
- for _, q := range metric.Summary.Quantile {
- n, err = writeOpenMetricsSample(
- w, name, "", metric,
- model.QuantileLabel, q.GetQuantile(),
- q.GetValue(), 0, false,
- nil,
- )
- written += n
- if err != nil {
- return
- }
- }
- n, err = writeOpenMetricsSample(
- w, name, "_sum", metric, "", 0,
- metric.Summary.GetSampleSum(), 0, false,
- nil,
- )
- written += n
- if err != nil {
- return
- }
- n, err = writeOpenMetricsSample(
- w, name, "_count", metric, "", 0,
- 0, metric.Summary.GetSampleCount(), true,
- nil,
- )
- case dto.MetricType_HISTOGRAM:
- if metric.Histogram == nil {
- return written, fmt.Errorf(
- "expected histogram in metric %s %s", name, metric,
- )
- }
- infSeen := false
- for _, b := range metric.Histogram.Bucket {
- n, err = writeOpenMetricsSample(
- w, name, "_bucket", metric,
- model.BucketLabel, b.GetUpperBound(),
- 0, b.GetCumulativeCount(), true,
- b.Exemplar,
- )
- written += n
- if err != nil {
- return
- }
- if math.IsInf(b.GetUpperBound(), +1) {
- infSeen = true
- }
- }
- if !infSeen {
- n, err = writeOpenMetricsSample(
- w, name, "_bucket", metric,
- model.BucketLabel, math.Inf(+1),
- 0, metric.Histogram.GetSampleCount(), true,
- nil,
- )
- written += n
- if err != nil {
- return
- }
- }
- n, err = writeOpenMetricsSample(
- w, name, "_sum", metric, "", 0,
- metric.Histogram.GetSampleSum(), 0, false,
- nil,
- )
- written += n
- if err != nil {
- return
- }
- n, err = writeOpenMetricsSample(
- w, name, "_count", metric, "", 0,
- 0, metric.Histogram.GetSampleCount(), true,
- nil,
- )
- default:
- return written, fmt.Errorf(
- "unexpected type in metric %s %s", name, metric,
- )
- }
- written += n
- if err != nil {
- return
- }
- }
- return
-}
-
-// FinalizeOpenMetrics writes the final `# EOF\n` line required by OpenMetrics.
-func FinalizeOpenMetrics(w io.Writer) (written int, err error) {
- return w.Write([]byte("# EOF\n"))
-}
-
-// writeOpenMetricsSample writes a single sample in OpenMetrics text format to
-// w, given the metric name, the metric proto message itself, optionally an
-// additional label name with a float64 value (use empty string as label name if
-// not required), the value (optionally as float64 or uint64, determined by
-// useIntValue), and optionally an exemplar (use nil if not required). The
-// function returns the number of bytes written and any error encountered.
-func writeOpenMetricsSample(
- w enhancedWriter,
- name, suffix string,
- metric *dto.Metric,
- additionalLabelName string, additionalLabelValue float64,
- floatValue float64, intValue uint64, useIntValue bool,
- exemplar *dto.Exemplar,
-) (int, error) {
- var written int
- n, err := w.WriteString(name)
- written += n
- if err != nil {
- return written, err
- }
- if suffix != "" {
- n, err = w.WriteString(suffix)
- written += n
- if err != nil {
- return written, err
- }
- }
- n, err = writeOpenMetricsLabelPairs(
- w, metric.Label, additionalLabelName, additionalLabelValue,
- )
- written += n
- if err != nil {
- return written, err
- }
- err = w.WriteByte(' ')
- written++
- if err != nil {
- return written, err
- }
- if useIntValue {
- n, err = writeUint(w, intValue)
- } else {
- n, err = writeOpenMetricsFloat(w, floatValue)
- }
- written += n
- if err != nil {
- return written, err
- }
- if metric.TimestampMs != nil {
- err = w.WriteByte(' ')
- written++
- if err != nil {
- return written, err
- }
- // TODO(beorn7): Format this directly without converting to a float first.
- n, err = writeOpenMetricsFloat(w, float64(*metric.TimestampMs)/1000)
- written += n
- if err != nil {
- return written, err
- }
- }
- if exemplar != nil {
- n, err = writeExemplar(w, exemplar)
- written += n
- if err != nil {
- return written, err
- }
- }
- err = w.WriteByte('\n')
- written++
- if err != nil {
- return written, err
- }
- return written, nil
-}
-
-// writeOpenMetricsLabelPairs works like writeOpenMetrics but formats the float
-// in OpenMetrics style.
-func writeOpenMetricsLabelPairs(
- w enhancedWriter,
- in []*dto.LabelPair,
- additionalLabelName string, additionalLabelValue float64,
-) (int, error) {
- if len(in) == 0 && additionalLabelName == "" {
- return 0, nil
- }
- var (
- written int
- separator byte = '{'
- )
- for _, lp := range in {
- err := w.WriteByte(separator)
- written++
- if err != nil {
- return written, err
- }
- n, err := w.WriteString(lp.GetName())
- written += n
- if err != nil {
- return written, err
- }
- n, err = w.WriteString(`="`)
- written += n
- if err != nil {
- return written, err
- }
- n, err = writeEscapedString(w, lp.GetValue(), true)
- written += n
- if err != nil {
- return written, err
- }
- err = w.WriteByte('"')
- written++
- if err != nil {
- return written, err
- }
- separator = ','
- }
- if additionalLabelName != "" {
- err := w.WriteByte(separator)
- written++
- if err != nil {
- return written, err
- }
- n, err := w.WriteString(additionalLabelName)
- written += n
- if err != nil {
- return written, err
- }
- n, err = w.WriteString(`="`)
- written += n
- if err != nil {
- return written, err
- }
- n, err = writeOpenMetricsFloat(w, additionalLabelValue)
- written += n
- if err != nil {
- return written, err
- }
- err = w.WriteByte('"')
- written++
- if err != nil {
- return written, err
- }
- }
- err := w.WriteByte('}')
- written++
- if err != nil {
- return written, err
- }
- return written, nil
-}
-
-// writeExemplar writes the provided exemplar in OpenMetrics format to w. The
-// function returns the number of bytes written and any error encountered.
-func writeExemplar(w enhancedWriter, e *dto.Exemplar) (int, error) {
- written := 0
- n, err := w.WriteString(" # ")
- written += n
- if err != nil {
- return written, err
- }
- n, err = writeOpenMetricsLabelPairs(w, e.Label, "", 0)
- written += n
- if err != nil {
- return written, err
- }
- err = w.WriteByte(' ')
- written++
- if err != nil {
- return written, err
- }
- n, err = writeOpenMetricsFloat(w, e.GetValue())
- written += n
- if err != nil {
- return written, err
- }
- if e.Timestamp != nil {
- err = w.WriteByte(' ')
- written++
- if err != nil {
- return written, err
- }
- ts, err := ptypes.Timestamp((*e).Timestamp)
- if err != nil {
- return written, err
- }
- // TODO(beorn7): Format this directly from components of ts to
- // avoid overflow/underflow and precision issues of the float
- // conversion.
- n, err = writeOpenMetricsFloat(w, float64(ts.UnixNano())/1e9)
- written += n
- if err != nil {
- return written, err
- }
- }
- return written, nil
-}
-
-// writeOpenMetricsFloat works like writeFloat but appends ".0" if the resulting
-// number would otherwise contain neither a "." nor an "e".
-func writeOpenMetricsFloat(w enhancedWriter, f float64) (int, error) {
- switch {
- case f == 1:
- return w.WriteString("1.0")
- case f == 0:
- return w.WriteString("0.0")
- case f == -1:
- return w.WriteString("-1.0")
- case math.IsNaN(f):
- return w.WriteString("NaN")
- case math.IsInf(f, +1):
- return w.WriteString("+Inf")
- case math.IsInf(f, -1):
- return w.WriteString("-Inf")
- default:
- bp := numBufPool.Get().(*[]byte)
- *bp = strconv.AppendFloat((*bp)[:0], f, 'g', -1, 64)
- if !bytes.ContainsAny(*bp, "e.") {
- *bp = append(*bp, '.', '0')
- }
- written, err := w.Write(*bp)
- numBufPool.Put(bp)
- return written, err
- }
-}
-
-// writeUint is like writeInt just for uint64.
-func writeUint(w enhancedWriter, u uint64) (int, error) {
- bp := numBufPool.Get().(*[]byte)
- *bp = strconv.AppendUint((*bp)[:0], u, 10)
- written, err := w.Write(*bp)
- numBufPool.Put(bp)
- return written, err
-}
diff --git a/vendor/github.com/prometheus/common/expfmt/text_create.go b/vendor/github.com/prometheus/common/expfmt/text_create.go
deleted file mode 100644
index 5ba503b..0000000
--- a/vendor/github.com/prometheus/common/expfmt/text_create.go
+++ /dev/null
@@ -1,465 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package expfmt
-
-import (
- "bufio"
- "fmt"
- "io"
- "io/ioutil"
- "math"
- "strconv"
- "strings"
- "sync"
-
- "github.com/prometheus/common/model"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-// enhancedWriter has all the enhanced write functions needed here. bufio.Writer
-// implements it.
-type enhancedWriter interface {
- io.Writer
- WriteRune(r rune) (n int, err error)
- WriteString(s string) (n int, err error)
- WriteByte(c byte) error
-}
-
-const (
- initialNumBufSize = 24
-)
-
-var (
- bufPool = sync.Pool{
- New: func() interface{} {
- return bufio.NewWriter(ioutil.Discard)
- },
- }
- numBufPool = sync.Pool{
- New: func() interface{} {
- b := make([]byte, 0, initialNumBufSize)
- return &b
- },
- }
-)
-
-// MetricFamilyToText converts a MetricFamily proto message into text format and
-// writes the resulting lines to 'out'. It returns the number of bytes written
-// and any error encountered. The output will have the same order as the input,
-// no further sorting is performed. Furthermore, this function assumes the input
-// is already sanitized and does not perform any sanity checks. If the input
-// contains duplicate metrics or invalid metric or label names, the conversion
-// will result in invalid text format output.
-//
-// This method fulfills the type 'prometheus.encoder'.
-func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (written int, err error) {
- // Fail-fast checks.
- if len(in.Metric) == 0 {
- return 0, fmt.Errorf("MetricFamily has no metrics: %s", in)
- }
- name := in.GetName()
- if name == "" {
- return 0, fmt.Errorf("MetricFamily has no name: %s", in)
- }
-
- // Try the interface upgrade. If it doesn't work, we'll use a
- // bufio.Writer from the sync.Pool.
- w, ok := out.(enhancedWriter)
- if !ok {
- b := bufPool.Get().(*bufio.Writer)
- b.Reset(out)
- w = b
- defer func() {
- bErr := b.Flush()
- if err == nil {
- err = bErr
- }
- bufPool.Put(b)
- }()
- }
-
- var n int
-
- // Comments, first HELP, then TYPE.
- if in.Help != nil {
- n, err = w.WriteString("# HELP ")
- written += n
- if err != nil {
- return
- }
- n, err = w.WriteString(name)
- written += n
- if err != nil {
- return
- }
- err = w.WriteByte(' ')
- written++
- if err != nil {
- return
- }
- n, err = writeEscapedString(w, *in.Help, false)
- written += n
- if err != nil {
- return
- }
- err = w.WriteByte('\n')
- written++
- if err != nil {
- return
- }
- }
- n, err = w.WriteString("# TYPE ")
- written += n
- if err != nil {
- return
- }
- n, err = w.WriteString(name)
- written += n
- if err != nil {
- return
- }
- metricType := in.GetType()
- switch metricType {
- case dto.MetricType_COUNTER:
- n, err = w.WriteString(" counter\n")
- case dto.MetricType_GAUGE:
- n, err = w.WriteString(" gauge\n")
- case dto.MetricType_SUMMARY:
- n, err = w.WriteString(" summary\n")
- case dto.MetricType_UNTYPED:
- n, err = w.WriteString(" untyped\n")
- case dto.MetricType_HISTOGRAM:
- n, err = w.WriteString(" histogram\n")
- default:
- return written, fmt.Errorf("unknown metric type %s", metricType.String())
- }
- written += n
- if err != nil {
- return
- }
-
- // Finally the samples, one line for each.
- for _, metric := range in.Metric {
- switch metricType {
- case dto.MetricType_COUNTER:
- if metric.Counter == nil {
- return written, fmt.Errorf(
- "expected counter in metric %s %s", name, metric,
- )
- }
- n, err = writeSample(
- w, name, "", metric, "", 0,
- metric.Counter.GetValue(),
- )
- case dto.MetricType_GAUGE:
- if metric.Gauge == nil {
- return written, fmt.Errorf(
- "expected gauge in metric %s %s", name, metric,
- )
- }
- n, err = writeSample(
- w, name, "", metric, "", 0,
- metric.Gauge.GetValue(),
- )
- case dto.MetricType_UNTYPED:
- if metric.Untyped == nil {
- return written, fmt.Errorf(
- "expected untyped in metric %s %s", name, metric,
- )
- }
- n, err = writeSample(
- w, name, "", metric, "", 0,
- metric.Untyped.GetValue(),
- )
- case dto.MetricType_SUMMARY:
- if metric.Summary == nil {
- return written, fmt.Errorf(
- "expected summary in metric %s %s", name, metric,
- )
- }
- for _, q := range metric.Summary.Quantile {
- n, err = writeSample(
- w, name, "", metric,
- model.QuantileLabel, q.GetQuantile(),
- q.GetValue(),
- )
- written += n
- if err != nil {
- return
- }
- }
- n, err = writeSample(
- w, name, "_sum", metric, "", 0,
- metric.Summary.GetSampleSum(),
- )
- written += n
- if err != nil {
- return
- }
- n, err = writeSample(
- w, name, "_count", metric, "", 0,
- float64(metric.Summary.GetSampleCount()),
- )
- case dto.MetricType_HISTOGRAM:
- if metric.Histogram == nil {
- return written, fmt.Errorf(
- "expected histogram in metric %s %s", name, metric,
- )
- }
- infSeen := false
- for _, b := range metric.Histogram.Bucket {
- n, err = writeSample(
- w, name, "_bucket", metric,
- model.BucketLabel, b.GetUpperBound(),
- float64(b.GetCumulativeCount()),
- )
- written += n
- if err != nil {
- return
- }
- if math.IsInf(b.GetUpperBound(), +1) {
- infSeen = true
- }
- }
- if !infSeen {
- n, err = writeSample(
- w, name, "_bucket", metric,
- model.BucketLabel, math.Inf(+1),
- float64(metric.Histogram.GetSampleCount()),
- )
- written += n
- if err != nil {
- return
- }
- }
- n, err = writeSample(
- w, name, "_sum", metric, "", 0,
- metric.Histogram.GetSampleSum(),
- )
- written += n
- if err != nil {
- return
- }
- n, err = writeSample(
- w, name, "_count", metric, "", 0,
- float64(metric.Histogram.GetSampleCount()),
- )
- default:
- return written, fmt.Errorf(
- "unexpected type in metric %s %s", name, metric,
- )
- }
- written += n
- if err != nil {
- return
- }
- }
- return
-}
-
-// writeSample writes a single sample in text format to w, given the metric
-// name, the metric proto message itself, optionally an additional label name
-// with a float64 value (use empty string as label name if not required), and
-// the value. The function returns the number of bytes written and any error
-// encountered.
-func writeSample(
- w enhancedWriter,
- name, suffix string,
- metric *dto.Metric,
- additionalLabelName string, additionalLabelValue float64,
- value float64,
-) (int, error) {
- var written int
- n, err := w.WriteString(name)
- written += n
- if err != nil {
- return written, err
- }
- if suffix != "" {
- n, err = w.WriteString(suffix)
- written += n
- if err != nil {
- return written, err
- }
- }
- n, err = writeLabelPairs(
- w, metric.Label, additionalLabelName, additionalLabelValue,
- )
- written += n
- if err != nil {
- return written, err
- }
- err = w.WriteByte(' ')
- written++
- if err != nil {
- return written, err
- }
- n, err = writeFloat(w, value)
- written += n
- if err != nil {
- return written, err
- }
- if metric.TimestampMs != nil {
- err = w.WriteByte(' ')
- written++
- if err != nil {
- return written, err
- }
- n, err = writeInt(w, *metric.TimestampMs)
- written += n
- if err != nil {
- return written, err
- }
- }
- err = w.WriteByte('\n')
- written++
- if err != nil {
- return written, err
- }
- return written, nil
-}
-
-// writeLabelPairs converts a slice of LabelPair proto messages plus the
-// explicitly given additional label pair into text formatted as required by the
-// text format and writes it to 'w'. An empty slice in combination with an empty
-// string 'additionalLabelName' results in nothing being written. Otherwise, the
-// label pairs are written, escaped as required by the text format, and enclosed
-// in '{...}'. The function returns the number of bytes written and any error
-// encountered.
-func writeLabelPairs(
- w enhancedWriter,
- in []*dto.LabelPair,
- additionalLabelName string, additionalLabelValue float64,
-) (int, error) {
- if len(in) == 0 && additionalLabelName == "" {
- return 0, nil
- }
- var (
- written int
- separator byte = '{'
- )
- for _, lp := range in {
- err := w.WriteByte(separator)
- written++
- if err != nil {
- return written, err
- }
- n, err := w.WriteString(lp.GetName())
- written += n
- if err != nil {
- return written, err
- }
- n, err = w.WriteString(`="`)
- written += n
- if err != nil {
- return written, err
- }
- n, err = writeEscapedString(w, lp.GetValue(), true)
- written += n
- if err != nil {
- return written, err
- }
- err = w.WriteByte('"')
- written++
- if err != nil {
- return written, err
- }
- separator = ','
- }
- if additionalLabelName != "" {
- err := w.WriteByte(separator)
- written++
- if err != nil {
- return written, err
- }
- n, err := w.WriteString(additionalLabelName)
- written += n
- if err != nil {
- return written, err
- }
- n, err = w.WriteString(`="`)
- written += n
- if err != nil {
- return written, err
- }
- n, err = writeFloat(w, additionalLabelValue)
- written += n
- if err != nil {
- return written, err
- }
- err = w.WriteByte('"')
- written++
- if err != nil {
- return written, err
- }
- }
- err := w.WriteByte('}')
- written++
- if err != nil {
- return written, err
- }
- return written, nil
-}
-
-// writeEscapedString replaces '\' by '\\', new line character by '\n', and - if
-// includeDoubleQuote is true - '"' by '\"'.
-var (
- escaper = strings.NewReplacer("\\", `\\`, "\n", `\n`)
- quotedEscaper = strings.NewReplacer("\\", `\\`, "\n", `\n`, "\"", `\"`)
-)
-
-func writeEscapedString(w enhancedWriter, v string, includeDoubleQuote bool) (int, error) {
- if includeDoubleQuote {
- return quotedEscaper.WriteString(w, v)
- }
- return escaper.WriteString(w, v)
-}
-
-// writeFloat is equivalent to fmt.Fprint with a float64 argument but hardcodes
-// a few common cases for increased efficiency. For non-hardcoded cases, it uses
-// strconv.AppendFloat to avoid allocations, similar to writeInt.
-func writeFloat(w enhancedWriter, f float64) (int, error) {
- switch {
- case f == 1:
- return 1, w.WriteByte('1')
- case f == 0:
- return 1, w.WriteByte('0')
- case f == -1:
- return w.WriteString("-1")
- case math.IsNaN(f):
- return w.WriteString("NaN")
- case math.IsInf(f, +1):
- return w.WriteString("+Inf")
- case math.IsInf(f, -1):
- return w.WriteString("-Inf")
- default:
- bp := numBufPool.Get().(*[]byte)
- *bp = strconv.AppendFloat((*bp)[:0], f, 'g', -1, 64)
- written, err := w.Write(*bp)
- numBufPool.Put(bp)
- return written, err
- }
-}
-
-// writeInt is equivalent to fmt.Fprint with an int64 argument but uses
-// strconv.AppendInt with a byte slice taken from a sync.Pool to avoid
-// allocations.
-func writeInt(w enhancedWriter, i int64) (int, error) {
- bp := numBufPool.Get().(*[]byte)
- *bp = strconv.AppendInt((*bp)[:0], i, 10)
- written, err := w.Write(*bp)
- numBufPool.Put(bp)
- return written, err
-}
diff --git a/vendor/github.com/prometheus/common/expfmt/text_parse.go b/vendor/github.com/prometheus/common/expfmt/text_parse.go
deleted file mode 100644
index 342e594..0000000
--- a/vendor/github.com/prometheus/common/expfmt/text_parse.go
+++ /dev/null
@@ -1,764 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package expfmt
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "math"
- "strconv"
- "strings"
-
- dto "github.com/prometheus/client_model/go"
-
- "github.com/golang/protobuf/proto"
- "github.com/prometheus/common/model"
-)
-
-// A stateFn is a function that represents a state in a state machine. By
-// executing it, the state is progressed to the next state. The stateFn returns
-// another stateFn, which represents the new state. The end state is represented
-// by nil.
-type stateFn func() stateFn
-
-// ParseError signals errors while parsing the simple and flat text-based
-// exchange format.
-type ParseError struct {
- Line int
- Msg string
-}
-
-// Error implements the error interface.
-func (e ParseError) Error() string {
- return fmt.Sprintf("text format parsing error in line %d: %s", e.Line, e.Msg)
-}
-
-// TextParser is used to parse the simple and flat text-based exchange format. Its
-// zero value is ready to use.
-type TextParser struct {
- metricFamiliesByName map[string]*dto.MetricFamily
- buf *bufio.Reader // Where the parsed input is read through.
- err error // Most recent error.
- lineCount int // Tracks the line count for error messages.
- currentByte byte // The most recent byte read.
- currentToken bytes.Buffer // Re-used each time a token has to be gathered from multiple bytes.
- currentMF *dto.MetricFamily
- currentMetric *dto.Metric
- currentLabelPair *dto.LabelPair
-
- // The remaining member variables are only used for summaries/histograms.
- currentLabels map[string]string // All labels including '__name__' but excluding 'quantile'/'le'
- // Summary specific.
- summaries map[uint64]*dto.Metric // Key is created with LabelsToSignature.
- currentQuantile float64
- // Histogram specific.
- histograms map[uint64]*dto.Metric // Key is created with LabelsToSignature.
- currentBucket float64
- // These tell us if the currently processed line ends on '_count' or
- // '_sum' respectively and belong to a summary/histogram, representing the sample
- // count and sum of that summary/histogram.
- currentIsSummaryCount, currentIsSummarySum bool
- currentIsHistogramCount, currentIsHistogramSum bool
-}
-
-// TextToMetricFamilies reads 'in' as the simple and flat text-based exchange
-// format and creates MetricFamily proto messages. It returns the MetricFamily
-// proto messages in a map where the metric names are the keys, along with any
-// error encountered.
-//
-// If the input contains duplicate metrics (i.e. lines with the same metric name
-// and exactly the same label set), the resulting MetricFamily will contain
-// duplicate Metric proto messages. Similar is true for duplicate label
-// names. Checks for duplicates have to be performed separately, if required.
-// Also note that neither the metrics within each MetricFamily are sorted nor
-// the label pairs within each Metric. Sorting is not required for the most
-// frequent use of this method, which is sample ingestion in the Prometheus
-// server. However, for presentation purposes, you might want to sort the
-// metrics, and in some cases, you must sort the labels, e.g. for consumption by
-// the metric family injection hook of the Prometheus registry.
-//
-// Summaries and histograms are rather special beasts. You would probably not
-// use them in the simple text format anyway. This method can deal with
-// summaries and histograms if they are presented in exactly the way the
-// text.Create function creates them.
-//
-// This method must not be called concurrently. If you want to parse different
-// input concurrently, instantiate a separate Parser for each goroutine.
-func (p *TextParser) TextToMetricFamilies(in io.Reader) (map[string]*dto.MetricFamily, error) {
- p.reset(in)
- for nextState := p.startOfLine; nextState != nil; nextState = nextState() {
- // Magic happens here...
- }
- // Get rid of empty metric families.
- for k, mf := range p.metricFamiliesByName {
- if len(mf.GetMetric()) == 0 {
- delete(p.metricFamiliesByName, k)
- }
- }
- // If p.err is io.EOF now, we have run into a premature end of the input
- // stream. Turn this error into something nicer and more
- // meaningful. (io.EOF is often used as a signal for the legitimate end
- // of an input stream.)
- if p.err == io.EOF {
- p.parseError("unexpected end of input stream")
- }
- return p.metricFamiliesByName, p.err
-}
-
-func (p *TextParser) reset(in io.Reader) {
- p.metricFamiliesByName = map[string]*dto.MetricFamily{}
- if p.buf == nil {
- p.buf = bufio.NewReader(in)
- } else {
- p.buf.Reset(in)
- }
- p.err = nil
- p.lineCount = 0
- if p.summaries == nil || len(p.summaries) > 0 {
- p.summaries = map[uint64]*dto.Metric{}
- }
- if p.histograms == nil || len(p.histograms) > 0 {
- p.histograms = map[uint64]*dto.Metric{}
- }
- p.currentQuantile = math.NaN()
- p.currentBucket = math.NaN()
-}
-
-// startOfLine represents the state where the next byte read from p.buf is the
-// start of a line (or whitespace leading up to it).
-func (p *TextParser) startOfLine() stateFn {
- p.lineCount++
- if p.skipBlankTab(); p.err != nil {
- // End of input reached. This is the only case where
- // that is not an error but a signal that we are done.
- p.err = nil
- return nil
- }
- switch p.currentByte {
- case '#':
- return p.startComment
- case '\n':
- return p.startOfLine // Empty line, start the next one.
- }
- return p.readingMetricName
-}
-
-// startComment represents the state where the next byte read from p.buf is the
-// start of a comment (or whitespace leading up to it).
-func (p *TextParser) startComment() stateFn {
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentByte == '\n' {
- return p.startOfLine
- }
- if p.readTokenUntilWhitespace(); p.err != nil {
- return nil // Unexpected end of input.
- }
- // If we have hit the end of line already, there is nothing left
- // to do. This is not considered a syntax error.
- if p.currentByte == '\n' {
- return p.startOfLine
- }
- keyword := p.currentToken.String()
- if keyword != "HELP" && keyword != "TYPE" {
- // Generic comment, ignore by fast forwarding to end of line.
- for p.currentByte != '\n' {
- if p.currentByte, p.err = p.buf.ReadByte(); p.err != nil {
- return nil // Unexpected end of input.
- }
- }
- return p.startOfLine
- }
- // There is something. Next has to be a metric name.
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.readTokenAsMetricName(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentByte == '\n' {
- // At the end of the line already.
- // Again, this is not considered a syntax error.
- return p.startOfLine
- }
- if !isBlankOrTab(p.currentByte) {
- p.parseError("invalid metric name in comment")
- return nil
- }
- p.setOrCreateCurrentMF()
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentByte == '\n' {
- // At the end of the line already.
- // Again, this is not considered a syntax error.
- return p.startOfLine
- }
- switch keyword {
- case "HELP":
- return p.readingHelp
- case "TYPE":
- return p.readingType
- }
- panic(fmt.Sprintf("code error: unexpected keyword %q", keyword))
-}
-
-// readingMetricName represents the state where the last byte read (now in
-// p.currentByte) is the first byte of a metric name.
-func (p *TextParser) readingMetricName() stateFn {
- if p.readTokenAsMetricName(); p.err != nil {
- return nil
- }
- if p.currentToken.Len() == 0 {
- p.parseError("invalid metric name")
- return nil
- }
- p.setOrCreateCurrentMF()
- // Now is the time to fix the type if it hasn't happened yet.
- if p.currentMF.Type == nil {
- p.currentMF.Type = dto.MetricType_UNTYPED.Enum()
- }
- p.currentMetric = &dto.Metric{}
- // Do not append the newly created currentMetric to
- // currentMF.Metric right now. First wait if this is a summary,
- // and the metric exists already, which we can only know after
- // having read all the labels.
- if p.skipBlankTabIfCurrentBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- return p.readingLabels
-}
-
-// readingLabels represents the state where the last byte read (now in
-// p.currentByte) is either the first byte of the label set (i.e. a '{'), or the
-// first byte of the value (otherwise).
-func (p *TextParser) readingLabels() stateFn {
- // Summaries/histograms are special. We have to reset the
- // currentLabels map, currentQuantile and currentBucket before starting to
- // read labels.
- if p.currentMF.GetType() == dto.MetricType_SUMMARY || p.currentMF.GetType() == dto.MetricType_HISTOGRAM {
- p.currentLabels = map[string]string{}
- p.currentLabels[string(model.MetricNameLabel)] = p.currentMF.GetName()
- p.currentQuantile = math.NaN()
- p.currentBucket = math.NaN()
- }
- if p.currentByte != '{' {
- return p.readingValue
- }
- return p.startLabelName
-}
-
-// startLabelName represents the state where the next byte read from p.buf is
-// the start of a label name (or whitespace leading up to it).
-func (p *TextParser) startLabelName() stateFn {
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentByte == '}' {
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- return p.readingValue
- }
- if p.readTokenAsLabelName(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentToken.Len() == 0 {
- p.parseError(fmt.Sprintf("invalid label name for metric %q", p.currentMF.GetName()))
- return nil
- }
- p.currentLabelPair = &dto.LabelPair{Name: proto.String(p.currentToken.String())}
- if p.currentLabelPair.GetName() == string(model.MetricNameLabel) {
- p.parseError(fmt.Sprintf("label name %q is reserved", model.MetricNameLabel))
- return nil
- }
- // Special summary/histogram treatment. Don't add 'quantile' and 'le'
- // labels to 'real' labels.
- if !(p.currentMF.GetType() == dto.MetricType_SUMMARY && p.currentLabelPair.GetName() == model.QuantileLabel) &&
- !(p.currentMF.GetType() == dto.MetricType_HISTOGRAM && p.currentLabelPair.GetName() == model.BucketLabel) {
- p.currentMetric.Label = append(p.currentMetric.Label, p.currentLabelPair)
- }
- if p.skipBlankTabIfCurrentBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentByte != '=' {
- p.parseError(fmt.Sprintf("expected '=' after label name, found %q", p.currentByte))
- return nil
- }
- return p.startLabelValue
-}
-
-// startLabelValue represents the state where the next byte read from p.buf is
-// the start of a (quoted) label value (or whitespace leading up to it).
-func (p *TextParser) startLabelValue() stateFn {
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentByte != '"' {
- p.parseError(fmt.Sprintf("expected '\"' at start of label value, found %q", p.currentByte))
- return nil
- }
- if p.readTokenAsLabelValue(); p.err != nil {
- return nil
- }
- if !model.LabelValue(p.currentToken.String()).IsValid() {
- p.parseError(fmt.Sprintf("invalid label value %q", p.currentToken.String()))
- return nil
- }
- p.currentLabelPair.Value = proto.String(p.currentToken.String())
- // Special treatment of summaries:
- // - Quantile labels are special, will result in dto.Quantile later.
- // - Other labels have to be added to currentLabels for signature calculation.
- if p.currentMF.GetType() == dto.MetricType_SUMMARY {
- if p.currentLabelPair.GetName() == model.QuantileLabel {
- if p.currentQuantile, p.err = parseFloat(p.currentLabelPair.GetValue()); p.err != nil {
- // Create a more helpful error message.
- p.parseError(fmt.Sprintf("expected float as value for 'quantile' label, got %q", p.currentLabelPair.GetValue()))
- return nil
- }
- } else {
- p.currentLabels[p.currentLabelPair.GetName()] = p.currentLabelPair.GetValue()
- }
- }
- // Similar special treatment of histograms.
- if p.currentMF.GetType() == dto.MetricType_HISTOGRAM {
- if p.currentLabelPair.GetName() == model.BucketLabel {
- if p.currentBucket, p.err = parseFloat(p.currentLabelPair.GetValue()); p.err != nil {
- // Create a more helpful error message.
- p.parseError(fmt.Sprintf("expected float as value for 'le' label, got %q", p.currentLabelPair.GetValue()))
- return nil
- }
- } else {
- p.currentLabels[p.currentLabelPair.GetName()] = p.currentLabelPair.GetValue()
- }
- }
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- switch p.currentByte {
- case ',':
- return p.startLabelName
-
- case '}':
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- return p.readingValue
- default:
- p.parseError(fmt.Sprintf("unexpected end of label value %q", p.currentLabelPair.GetValue()))
- return nil
- }
-}
-
-// readingValue represents the state where the last byte read (now in
-// p.currentByte) is the first byte of the sample value (i.e. a float).
-func (p *TextParser) readingValue() stateFn {
- // When we are here, we have read all the labels, so for the
- // special case of a summary/histogram, we can finally find out
- // if the metric already exists.
- if p.currentMF.GetType() == dto.MetricType_SUMMARY {
- signature := model.LabelsToSignature(p.currentLabels)
- if summary := p.summaries[signature]; summary != nil {
- p.currentMetric = summary
- } else {
- p.summaries[signature] = p.currentMetric
- p.currentMF.Metric = append(p.currentMF.Metric, p.currentMetric)
- }
- } else if p.currentMF.GetType() == dto.MetricType_HISTOGRAM {
- signature := model.LabelsToSignature(p.currentLabels)
- if histogram := p.histograms[signature]; histogram != nil {
- p.currentMetric = histogram
- } else {
- p.histograms[signature] = p.currentMetric
- p.currentMF.Metric = append(p.currentMF.Metric, p.currentMetric)
- }
- } else {
- p.currentMF.Metric = append(p.currentMF.Metric, p.currentMetric)
- }
- if p.readTokenUntilWhitespace(); p.err != nil {
- return nil // Unexpected end of input.
- }
- value, err := parseFloat(p.currentToken.String())
- if err != nil {
- // Create a more helpful error message.
- p.parseError(fmt.Sprintf("expected float as value, got %q", p.currentToken.String()))
- return nil
- }
- switch p.currentMF.GetType() {
- case dto.MetricType_COUNTER:
- p.currentMetric.Counter = &dto.Counter{Value: proto.Float64(value)}
- case dto.MetricType_GAUGE:
- p.currentMetric.Gauge = &dto.Gauge{Value: proto.Float64(value)}
- case dto.MetricType_UNTYPED:
- p.currentMetric.Untyped = &dto.Untyped{Value: proto.Float64(value)}
- case dto.MetricType_SUMMARY:
- // *sigh*
- if p.currentMetric.Summary == nil {
- p.currentMetric.Summary = &dto.Summary{}
- }
- switch {
- case p.currentIsSummaryCount:
- p.currentMetric.Summary.SampleCount = proto.Uint64(uint64(value))
- case p.currentIsSummarySum:
- p.currentMetric.Summary.SampleSum = proto.Float64(value)
- case !math.IsNaN(p.currentQuantile):
- p.currentMetric.Summary.Quantile = append(
- p.currentMetric.Summary.Quantile,
- &dto.Quantile{
- Quantile: proto.Float64(p.currentQuantile),
- Value: proto.Float64(value),
- },
- )
- }
- case dto.MetricType_HISTOGRAM:
- // *sigh*
- if p.currentMetric.Histogram == nil {
- p.currentMetric.Histogram = &dto.Histogram{}
- }
- switch {
- case p.currentIsHistogramCount:
- p.currentMetric.Histogram.SampleCount = proto.Uint64(uint64(value))
- case p.currentIsHistogramSum:
- p.currentMetric.Histogram.SampleSum = proto.Float64(value)
- case !math.IsNaN(p.currentBucket):
- p.currentMetric.Histogram.Bucket = append(
- p.currentMetric.Histogram.Bucket,
- &dto.Bucket{
- UpperBound: proto.Float64(p.currentBucket),
- CumulativeCount: proto.Uint64(uint64(value)),
- },
- )
- }
- default:
- p.err = fmt.Errorf("unexpected type for metric name %q", p.currentMF.GetName())
- }
- if p.currentByte == '\n' {
- return p.startOfLine
- }
- return p.startTimestamp
-}
-
-// startTimestamp represents the state where the next byte read from p.buf is
-// the start of the timestamp (or whitespace leading up to it).
-func (p *TextParser) startTimestamp() stateFn {
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.readTokenUntilWhitespace(); p.err != nil {
- return nil // Unexpected end of input.
- }
- timestamp, err := strconv.ParseInt(p.currentToken.String(), 10, 64)
- if err != nil {
- // Create a more helpful error message.
- p.parseError(fmt.Sprintf("expected integer as timestamp, got %q", p.currentToken.String()))
- return nil
- }
- p.currentMetric.TimestampMs = proto.Int64(timestamp)
- if p.readTokenUntilNewline(false); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentToken.Len() > 0 {
- p.parseError(fmt.Sprintf("spurious string after timestamp: %q", p.currentToken.String()))
- return nil
- }
- return p.startOfLine
-}
-
-// readingHelp represents the state where the last byte read (now in
-// p.currentByte) is the first byte of the docstring after 'HELP'.
-func (p *TextParser) readingHelp() stateFn {
- if p.currentMF.Help != nil {
- p.parseError(fmt.Sprintf("second HELP line for metric name %q", p.currentMF.GetName()))
- return nil
- }
- // Rest of line is the docstring.
- if p.readTokenUntilNewline(true); p.err != nil {
- return nil // Unexpected end of input.
- }
- p.currentMF.Help = proto.String(p.currentToken.String())
- return p.startOfLine
-}
-
-// readingType represents the state where the last byte read (now in
-// p.currentByte) is the first byte of the type hint after 'HELP'.
-func (p *TextParser) readingType() stateFn {
- if p.currentMF.Type != nil {
- p.parseError(fmt.Sprintf("second TYPE line for metric name %q, or TYPE reported after samples", p.currentMF.GetName()))
- return nil
- }
- // Rest of line is the type.
- if p.readTokenUntilNewline(false); p.err != nil {
- return nil // Unexpected end of input.
- }
- metricType, ok := dto.MetricType_value[strings.ToUpper(p.currentToken.String())]
- if !ok {
- p.parseError(fmt.Sprintf("unknown metric type %q", p.currentToken.String()))
- return nil
- }
- p.currentMF.Type = dto.MetricType(metricType).Enum()
- return p.startOfLine
-}
-
-// parseError sets p.err to a ParseError at the current line with the given
-// message.
-func (p *TextParser) parseError(msg string) {
- p.err = ParseError{
- Line: p.lineCount,
- Msg: msg,
- }
-}
-
-// skipBlankTab reads (and discards) bytes from p.buf until it encounters a byte
-// that is neither ' ' nor '\t'. That byte is left in p.currentByte.
-func (p *TextParser) skipBlankTab() {
- for {
- if p.currentByte, p.err = p.buf.ReadByte(); p.err != nil || !isBlankOrTab(p.currentByte) {
- return
- }
- }
-}
-
-// skipBlankTabIfCurrentBlankTab works exactly as skipBlankTab but doesn't do
-// anything if p.currentByte is neither ' ' nor '\t'.
-func (p *TextParser) skipBlankTabIfCurrentBlankTab() {
- if isBlankOrTab(p.currentByte) {
- p.skipBlankTab()
- }
-}
-
-// readTokenUntilWhitespace copies bytes from p.buf into p.currentToken. The
-// first byte considered is the byte already read (now in p.currentByte). The
-// first whitespace byte encountered is still copied into p.currentByte, but not
-// into p.currentToken.
-func (p *TextParser) readTokenUntilWhitespace() {
- p.currentToken.Reset()
- for p.err == nil && !isBlankOrTab(p.currentByte) && p.currentByte != '\n' {
- p.currentToken.WriteByte(p.currentByte)
- p.currentByte, p.err = p.buf.ReadByte()
- }
-}
-
-// readTokenUntilNewline copies bytes from p.buf into p.currentToken. The first
-// byte considered is the byte already read (now in p.currentByte). The first
-// newline byte encountered is still copied into p.currentByte, but not into
-// p.currentToken. If recognizeEscapeSequence is true, two escape sequences are
-// recognized: '\\' translates into '\', and '\n' into a line-feed character.
-// All other escape sequences are invalid and cause an error.
-func (p *TextParser) readTokenUntilNewline(recognizeEscapeSequence bool) {
- p.currentToken.Reset()
- escaped := false
- for p.err == nil {
- if recognizeEscapeSequence && escaped {
- switch p.currentByte {
- case '\\':
- p.currentToken.WriteByte(p.currentByte)
- case 'n':
- p.currentToken.WriteByte('\n')
- default:
- p.parseError(fmt.Sprintf("invalid escape sequence '\\%c'", p.currentByte))
- return
- }
- escaped = false
- } else {
- switch p.currentByte {
- case '\n':
- return
- case '\\':
- escaped = true
- default:
- p.currentToken.WriteByte(p.currentByte)
- }
- }
- p.currentByte, p.err = p.buf.ReadByte()
- }
-}
-
-// readTokenAsMetricName copies a metric name from p.buf into p.currentToken.
-// The first byte considered is the byte already read (now in p.currentByte).
-// The first byte not part of a metric name is still copied into p.currentByte,
-// but not into p.currentToken.
-func (p *TextParser) readTokenAsMetricName() {
- p.currentToken.Reset()
- if !isValidMetricNameStart(p.currentByte) {
- return
- }
- for {
- p.currentToken.WriteByte(p.currentByte)
- p.currentByte, p.err = p.buf.ReadByte()
- if p.err != nil || !isValidMetricNameContinuation(p.currentByte) {
- return
- }
- }
-}
-
-// readTokenAsLabelName copies a label name from p.buf into p.currentToken.
-// The first byte considered is the byte already read (now in p.currentByte).
-// The first byte not part of a label name is still copied into p.currentByte,
-// but not into p.currentToken.
-func (p *TextParser) readTokenAsLabelName() {
- p.currentToken.Reset()
- if !isValidLabelNameStart(p.currentByte) {
- return
- }
- for {
- p.currentToken.WriteByte(p.currentByte)
- p.currentByte, p.err = p.buf.ReadByte()
- if p.err != nil || !isValidLabelNameContinuation(p.currentByte) {
- return
- }
- }
-}
-
-// readTokenAsLabelValue copies a label value from p.buf into p.currentToken.
-// In contrast to the other 'readTokenAs...' functions, which start with the
-// last read byte in p.currentByte, this method ignores p.currentByte and starts
-// with reading a new byte from p.buf. The first byte not part of a label value
-// is still copied into p.currentByte, but not into p.currentToken.
-func (p *TextParser) readTokenAsLabelValue() {
- p.currentToken.Reset()
- escaped := false
- for {
- if p.currentByte, p.err = p.buf.ReadByte(); p.err != nil {
- return
- }
- if escaped {
- switch p.currentByte {
- case '"', '\\':
- p.currentToken.WriteByte(p.currentByte)
- case 'n':
- p.currentToken.WriteByte('\n')
- default:
- p.parseError(fmt.Sprintf("invalid escape sequence '\\%c'", p.currentByte))
- return
- }
- escaped = false
- continue
- }
- switch p.currentByte {
- case '"':
- return
- case '\n':
- p.parseError(fmt.Sprintf("label value %q contains unescaped new-line", p.currentToken.String()))
- return
- case '\\':
- escaped = true
- default:
- p.currentToken.WriteByte(p.currentByte)
- }
- }
-}
-
-func (p *TextParser) setOrCreateCurrentMF() {
- p.currentIsSummaryCount = false
- p.currentIsSummarySum = false
- p.currentIsHistogramCount = false
- p.currentIsHistogramSum = false
- name := p.currentToken.String()
- if p.currentMF = p.metricFamiliesByName[name]; p.currentMF != nil {
- return
- }
- // Try out if this is a _sum or _count for a summary/histogram.
- summaryName := summaryMetricName(name)
- if p.currentMF = p.metricFamiliesByName[summaryName]; p.currentMF != nil {
- if p.currentMF.GetType() == dto.MetricType_SUMMARY {
- if isCount(name) {
- p.currentIsSummaryCount = true
- }
- if isSum(name) {
- p.currentIsSummarySum = true
- }
- return
- }
- }
- histogramName := histogramMetricName(name)
- if p.currentMF = p.metricFamiliesByName[histogramName]; p.currentMF != nil {
- if p.currentMF.GetType() == dto.MetricType_HISTOGRAM {
- if isCount(name) {
- p.currentIsHistogramCount = true
- }
- if isSum(name) {
- p.currentIsHistogramSum = true
- }
- return
- }
- }
- p.currentMF = &dto.MetricFamily{Name: proto.String(name)}
- p.metricFamiliesByName[name] = p.currentMF
-}
-
-func isValidLabelNameStart(b byte) bool {
- return (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_'
-}
-
-func isValidLabelNameContinuation(b byte) bool {
- return isValidLabelNameStart(b) || (b >= '0' && b <= '9')
-}
-
-func isValidMetricNameStart(b byte) bool {
- return isValidLabelNameStart(b) || b == ':'
-}
-
-func isValidMetricNameContinuation(b byte) bool {
- return isValidLabelNameContinuation(b) || b == ':'
-}
-
-func isBlankOrTab(b byte) bool {
- return b == ' ' || b == '\t'
-}
-
-func isCount(name string) bool {
- return len(name) > 6 && name[len(name)-6:] == "_count"
-}
-
-func isSum(name string) bool {
- return len(name) > 4 && name[len(name)-4:] == "_sum"
-}
-
-func isBucket(name string) bool {
- return len(name) > 7 && name[len(name)-7:] == "_bucket"
-}
-
-func summaryMetricName(name string) string {
- switch {
- case isCount(name):
- return name[:len(name)-6]
- case isSum(name):
- return name[:len(name)-4]
- default:
- return name
- }
-}
-
-func histogramMetricName(name string) string {
- switch {
- case isCount(name):
- return name[:len(name)-6]
- case isSum(name):
- return name[:len(name)-4]
- case isBucket(name):
- return name[:len(name)-7]
- default:
- return name
- }
-}
-
-func parseFloat(s string) (float64, error) {
- if strings.ContainsAny(s, "pP_") {
- return 0, fmt.Errorf("unsupported character in float")
- }
- return strconv.ParseFloat(s, 64)
-}
diff --git a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt b/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt
deleted file mode 100644
index 7723656..0000000
--- a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt
+++ /dev/null
@@ -1,67 +0,0 @@
-PACKAGE
-
-package goautoneg
-import "bitbucket.org/ww/goautoneg"
-
-HTTP Content-Type Autonegotiation.
-
-The functions in this package implement the behaviour specified in
-http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
-
-Copyright (c) 2011, Open Knowledge Foundation Ltd.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Open Knowledge Foundation Ltd. nor the
- names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-FUNCTIONS
-
-func Negotiate(header string, alternatives []string) (content_type string)
-Negotiate the most appropriate content_type given the accept header
-and a list of alternatives.
-
-func ParseAccept(header string) (accept []Accept)
-Parse an Accept Header string returning a sorted list
-of clauses
-
-
-TYPES
-
-type Accept struct {
- Type, SubType string
- Q float32
- Params map[string]string
-}
-Structure to represent a clause in an HTTP Accept Header
-
-
-SUBDIRECTORIES
-
- .hg
diff --git a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go b/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go
deleted file mode 100644
index 26e9228..0000000
--- a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
-Copyright (c) 2011, Open Knowledge Foundation Ltd.
-All rights reserved.
-
-HTTP Content-Type Autonegotiation.
-
-The functions in this package implement the behaviour specified in
-http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Open Knowledge Foundation Ltd. nor the
- names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-*/
-package goautoneg
-
-import (
- "sort"
- "strconv"
- "strings"
-)
-
-// Structure to represent a clause in an HTTP Accept Header
-type Accept struct {
- Type, SubType string
- Q float64
- Params map[string]string
-}
-
-// For internal use, so that we can use the sort interface
-type accept_slice []Accept
-
-func (accept accept_slice) Len() int {
- slice := []Accept(accept)
- return len(slice)
-}
-
-func (accept accept_slice) Less(i, j int) bool {
- slice := []Accept(accept)
- ai, aj := slice[i], slice[j]
- if ai.Q > aj.Q {
- return true
- }
- if ai.Type != "*" && aj.Type == "*" {
- return true
- }
- if ai.SubType != "*" && aj.SubType == "*" {
- return true
- }
- return false
-}
-
-func (accept accept_slice) Swap(i, j int) {
- slice := []Accept(accept)
- slice[i], slice[j] = slice[j], slice[i]
-}
-
-// Parse an Accept Header string returning a sorted list
-// of clauses
-func ParseAccept(header string) (accept []Accept) {
- parts := strings.Split(header, ",")
- accept = make([]Accept, 0, len(parts))
- for _, part := range parts {
- part := strings.Trim(part, " ")
-
- a := Accept{}
- a.Params = make(map[string]string)
- a.Q = 1.0
-
- mrp := strings.Split(part, ";")
-
- media_range := mrp[0]
- sp := strings.Split(media_range, "/")
- a.Type = strings.Trim(sp[0], " ")
-
- switch {
- case len(sp) == 1 && a.Type == "*":
- a.SubType = "*"
- case len(sp) == 2:
- a.SubType = strings.Trim(sp[1], " ")
- default:
- continue
- }
-
- if len(mrp) == 1 {
- accept = append(accept, a)
- continue
- }
-
- for _, param := range mrp[1:] {
- sp := strings.SplitN(param, "=", 2)
- if len(sp) != 2 {
- continue
- }
- token := strings.Trim(sp[0], " ")
- if token == "q" {
- a.Q, _ = strconv.ParseFloat(sp[1], 32)
- } else {
- a.Params[token] = strings.Trim(sp[1], " ")
- }
- }
-
- accept = append(accept, a)
- }
-
- slice := accept_slice(accept)
- sort.Sort(slice)
-
- return
-}
-
-// Negotiate the most appropriate content_type given the accept header
-// and a list of alternatives.
-func Negotiate(header string, alternatives []string) (content_type string) {
- asp := make([][]string, 0, len(alternatives))
- for _, ctype := range alternatives {
- asp = append(asp, strings.SplitN(ctype, "/", 2))
- }
- for _, clause := range ParseAccept(header) {
- for i, ctsp := range asp {
- if clause.Type == ctsp[0] && clause.SubType == ctsp[1] {
- content_type = alternatives[i]
- return
- }
- if clause.Type == ctsp[0] && clause.SubType == "*" {
- content_type = alternatives[i]
- return
- }
- if clause.Type == "*" && clause.SubType == "*" {
- content_type = alternatives[i]
- return
- }
- }
- }
- return
-}
diff --git a/vendor/github.com/prometheus/common/log/eventlog_formatter.go b/vendor/github.com/prometheus/common/log/eventlog_formatter.go
deleted file mode 100644
index bcf68e6..0000000
--- a/vendor/github.com/prometheus/common/log/eventlog_formatter.go
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build windows
-
-package log
-
-import (
- "fmt"
- "os"
-
- "golang.org/x/sys/windows/svc/eventlog"
-
- "github.com/sirupsen/logrus"
-)
-
-func init() {
- setEventlogFormatter = func(l logger, name string, debugAsInfo bool) error {
- if name == "" {
- return fmt.Errorf("missing name parameter")
- }
-
- fmter, err := newEventlogger(name, debugAsInfo, l.entry.Logger.Formatter)
- if err != nil {
- fmt.Fprintf(os.Stderr, "error creating eventlog formatter: %v\n", err)
- l.Errorf("can't connect logger to eventlog: %v", err)
- return err
- }
- l.entry.Logger.Formatter = fmter
- return nil
- }
-}
-
-type eventlogger struct {
- log *eventlog.Log
- debugAsInfo bool
- wrap logrus.Formatter
-}
-
-func newEventlogger(name string, debugAsInfo bool, fmter logrus.Formatter) (*eventlogger, error) {
- logHandle, err := eventlog.Open(name)
- if err != nil {
- return nil, err
- }
- return &eventlogger{log: logHandle, debugAsInfo: debugAsInfo, wrap: fmter}, nil
-}
-
-func (s *eventlogger) Format(e *logrus.Entry) ([]byte, error) {
- data, err := s.wrap.Format(e)
- if err != nil {
- fmt.Fprintf(os.Stderr, "eventlogger: can't format entry: %v\n", err)
- return data, err
- }
-
- switch e.Level {
- case logrus.PanicLevel:
- fallthrough
- case logrus.FatalLevel:
- fallthrough
- case logrus.ErrorLevel:
- err = s.log.Error(102, e.Message)
- case logrus.WarnLevel:
- err = s.log.Warning(101, e.Message)
- case logrus.InfoLevel:
- err = s.log.Info(100, e.Message)
- case logrus.DebugLevel:
- if s.debugAsInfo {
- err = s.log.Info(100, e.Message)
- }
- default:
- err = s.log.Info(100, e.Message)
- }
-
- if err != nil {
- fmt.Fprintf(os.Stderr, "eventlogger: can't send log to eventlog: %v\n", err)
- }
-
- return data, err
-}
diff --git a/vendor/github.com/prometheus/common/log/log.go b/vendor/github.com/prometheus/common/log/log.go
deleted file mode 100644
index b6adbce..0000000
--- a/vendor/github.com/prometheus/common/log/log.go
+++ /dev/null
@@ -1,368 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package log implements logging via logrus.
-//
-// Deprecated: This package has been replaced with github.com/prometheus/common/promlog.
-
-package log
-
-import (
- "fmt"
- "io"
- "io/ioutil"
- "log"
- "net/url"
- "os"
- "runtime"
- "strconv"
- "strings"
-
- "github.com/sirupsen/logrus"
- "gopkg.in/alecthomas/kingpin.v2"
-)
-
-// setSyslogFormatter is nil if the target architecture does not support syslog.
-var setSyslogFormatter func(logger, string, string) error
-
-// setEventlogFormatter is nil if the target OS does not support Eventlog (i.e., is not Windows).
-var setEventlogFormatter func(logger, string, bool) error
-
-func setJSONFormatter() {
- origLogger.Formatter = &logrus.JSONFormatter{}
-}
-
-type loggerSettings struct {
- level string
- format string
-}
-
-func (s *loggerSettings) apply(ctx *kingpin.ParseContext) error {
- err := baseLogger.SetLevel(s.level)
- if err != nil {
- return err
- }
- err = baseLogger.SetFormat(s.format)
- return err
-}
-
-// AddFlags adds the flags used by this package to the Kingpin application.
-// To use the default Kingpin application, call AddFlags(kingpin.CommandLine)
-func AddFlags(a *kingpin.Application) {
- s := loggerSettings{}
- a.Flag("log.level", "Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal]").
- Default(origLogger.Level.String()).
- StringVar(&s.level)
- defaultFormat := url.URL{Scheme: "logger", Opaque: "stderr"}
- a.Flag("log.format", `Set the log target and format. Example: "logger:syslog?appname=bob&local=7" or "logger:stdout?json=true"`).
- Default(defaultFormat.String()).
- StringVar(&s.format)
- a.Action(s.apply)
-}
-
-// Logger is the interface for loggers used in the Prometheus components.
-type Logger interface {
- Debug(...interface{})
- Debugln(...interface{})
- Debugf(string, ...interface{})
-
- Info(...interface{})
- Infoln(...interface{})
- Infof(string, ...interface{})
-
- Warn(...interface{})
- Warnln(...interface{})
- Warnf(string, ...interface{})
-
- Error(...interface{})
- Errorln(...interface{})
- Errorf(string, ...interface{})
-
- Fatal(...interface{})
- Fatalln(...interface{})
- Fatalf(string, ...interface{})
-
- With(key string, value interface{}) Logger
-
- SetFormat(string) error
- SetLevel(string) error
-}
-
-type logger struct {
- entry *logrus.Entry
-}
-
-func (l logger) With(key string, value interface{}) Logger {
- return logger{l.entry.WithField(key, value)}
-}
-
-// Debug logs a message at level Debug on the standard logger.
-func (l logger) Debug(args ...interface{}) {
- l.sourced().Debug(args...)
-}
-
-// Debug logs a message at level Debug on the standard logger.
-func (l logger) Debugln(args ...interface{}) {
- l.sourced().Debugln(args...)
-}
-
-// Debugf logs a message at level Debug on the standard logger.
-func (l logger) Debugf(format string, args ...interface{}) {
- l.sourced().Debugf(format, args...)
-}
-
-// Info logs a message at level Info on the standard logger.
-func (l logger) Info(args ...interface{}) {
- l.sourced().Info(args...)
-}
-
-// Info logs a message at level Info on the standard logger.
-func (l logger) Infoln(args ...interface{}) {
- l.sourced().Infoln(args...)
-}
-
-// Infof logs a message at level Info on the standard logger.
-func (l logger) Infof(format string, args ...interface{}) {
- l.sourced().Infof(format, args...)
-}
-
-// Warn logs a message at level Warn on the standard logger.
-func (l logger) Warn(args ...interface{}) {
- l.sourced().Warn(args...)
-}
-
-// Warn logs a message at level Warn on the standard logger.
-func (l logger) Warnln(args ...interface{}) {
- l.sourced().Warnln(args...)
-}
-
-// Warnf logs a message at level Warn on the standard logger.
-func (l logger) Warnf(format string, args ...interface{}) {
- l.sourced().Warnf(format, args...)
-}
-
-// Error logs a message at level Error on the standard logger.
-func (l logger) Error(args ...interface{}) {
- l.sourced().Error(args...)
-}
-
-// Error logs a message at level Error on the standard logger.
-func (l logger) Errorln(args ...interface{}) {
- l.sourced().Errorln(args...)
-}
-
-// Errorf logs a message at level Error on the standard logger.
-func (l logger) Errorf(format string, args ...interface{}) {
- l.sourced().Errorf(format, args...)
-}
-
-// Fatal logs a message at level Fatal on the standard logger.
-func (l logger) Fatal(args ...interface{}) {
- l.sourced().Fatal(args...)
-}
-
-// Fatal logs a message at level Fatal on the standard logger.
-func (l logger) Fatalln(args ...interface{}) {
- l.sourced().Fatalln(args...)
-}
-
-// Fatalf logs a message at level Fatal on the standard logger.
-func (l logger) Fatalf(format string, args ...interface{}) {
- l.sourced().Fatalf(format, args...)
-}
-
-func (l logger) SetLevel(level string) error {
- lvl, err := logrus.ParseLevel(level)
- if err != nil {
- return err
- }
-
- l.entry.Logger.Level = lvl
- return nil
-}
-
-func (l logger) SetFormat(format string) error {
- u, err := url.Parse(format)
- if err != nil {
- return err
- }
- if u.Scheme != "logger" {
- return fmt.Errorf("invalid scheme %s", u.Scheme)
- }
- jsonq := u.Query().Get("json")
- if jsonq == "true" {
- setJSONFormatter()
- }
-
- switch u.Opaque {
- case "syslog":
- if setSyslogFormatter == nil {
- return fmt.Errorf("system does not support syslog")
- }
- appname := u.Query().Get("appname")
- facility := u.Query().Get("local")
- return setSyslogFormatter(l, appname, facility)
- case "eventlog":
- if setEventlogFormatter == nil {
- return fmt.Errorf("system does not support eventlog")
- }
- name := u.Query().Get("name")
- debugAsInfo := false
- debugAsInfoRaw := u.Query().Get("debugAsInfo")
- if parsedDebugAsInfo, err := strconv.ParseBool(debugAsInfoRaw); err == nil {
- debugAsInfo = parsedDebugAsInfo
- }
- return setEventlogFormatter(l, name, debugAsInfo)
- case "stdout":
- l.entry.Logger.Out = os.Stdout
- case "stderr":
- l.entry.Logger.Out = os.Stderr
- default:
- return fmt.Errorf("unsupported logger %q", u.Opaque)
- }
- return nil
-}
-
-// sourced adds a source field to the logger that contains
-// the file name and line where the logging happened.
-func (l logger) sourced() *logrus.Entry {
- _, file, line, ok := runtime.Caller(2)
- if !ok {
- file = "??>"
- line = 1
- } else {
- slash := strings.LastIndex(file, "/")
- file = file[slash+1:]
- }
- return l.entry.WithField("source", fmt.Sprintf("%s:%d", file, line))
-}
-
-var origLogger = logrus.New()
-var baseLogger = logger{entry: logrus.NewEntry(origLogger)}
-
-// Base returns the default Logger logging to
-func Base() Logger {
- return baseLogger
-}
-
-// NewLogger returns a new Logger logging to out.
-func NewLogger(w io.Writer) Logger {
- l := logrus.New()
- l.Out = w
- return logger{entry: logrus.NewEntry(l)}
-}
-
-// NewNopLogger returns a logger that discards all log messages.
-func NewNopLogger() Logger {
- l := logrus.New()
- l.Out = ioutil.Discard
- return logger{entry: logrus.NewEntry(l)}
-}
-
-// With adds a field to the logger.
-func With(key string, value interface{}) Logger {
- return baseLogger.With(key, value)
-}
-
-// Debug logs a message at level Debug on the standard logger.
-func Debug(args ...interface{}) {
- baseLogger.sourced().Debug(args...)
-}
-
-// Debugln logs a message at level Debug on the standard logger.
-func Debugln(args ...interface{}) {
- baseLogger.sourced().Debugln(args...)
-}
-
-// Debugf logs a message at level Debug on the standard logger.
-func Debugf(format string, args ...interface{}) {
- baseLogger.sourced().Debugf(format, args...)
-}
-
-// Info logs a message at level Info on the standard logger.
-func Info(args ...interface{}) {
- baseLogger.sourced().Info(args...)
-}
-
-// Infoln logs a message at level Info on the standard logger.
-func Infoln(args ...interface{}) {
- baseLogger.sourced().Infoln(args...)
-}
-
-// Infof logs a message at level Info on the standard logger.
-func Infof(format string, args ...interface{}) {
- baseLogger.sourced().Infof(format, args...)
-}
-
-// Warn logs a message at level Warn on the standard logger.
-func Warn(args ...interface{}) {
- baseLogger.sourced().Warn(args...)
-}
-
-// Warnln logs a message at level Warn on the standard logger.
-func Warnln(args ...interface{}) {
- baseLogger.sourced().Warnln(args...)
-}
-
-// Warnf logs a message at level Warn on the standard logger.
-func Warnf(format string, args ...interface{}) {
- baseLogger.sourced().Warnf(format, args...)
-}
-
-// Error logs a message at level Error on the standard logger.
-func Error(args ...interface{}) {
- baseLogger.sourced().Error(args...)
-}
-
-// Errorln logs a message at level Error on the standard logger.
-func Errorln(args ...interface{}) {
- baseLogger.sourced().Errorln(args...)
-}
-
-// Errorf logs a message at level Error on the standard logger.
-func Errorf(format string, args ...interface{}) {
- baseLogger.sourced().Errorf(format, args...)
-}
-
-// Fatal logs a message at level Fatal on the standard logger.
-func Fatal(args ...interface{}) {
- baseLogger.sourced().Fatal(args...)
-}
-
-// Fatalln logs a message at level Fatal on the standard logger.
-func Fatalln(args ...interface{}) {
- baseLogger.sourced().Fatalln(args...)
-}
-
-// Fatalf logs a message at level Fatal on the standard logger.
-func Fatalf(format string, args ...interface{}) {
- baseLogger.sourced().Fatalf(format, args...)
-}
-
-// AddHook adds hook to Prometheus' original logger.
-func AddHook(hook logrus.Hook) {
- origLogger.Hooks.Add(hook)
-}
-
-type errorLogWriter struct{}
-
-func (errorLogWriter) Write(b []byte) (int, error) {
- baseLogger.sourced().Error(string(b))
- return len(b), nil
-}
-
-// NewErrorLogger returns a log.Logger that is meant to be used
-// in the ErrorLog field of an http.Server to log HTTP server errors.
-func NewErrorLogger() *log.Logger {
- return log.New(&errorLogWriter{}, "", 0)
-}
diff --git a/vendor/github.com/prometheus/common/log/syslog_formatter.go b/vendor/github.com/prometheus/common/log/syslog_formatter.go
deleted file mode 100644
index f882f2f..0000000
--- a/vendor/github.com/prometheus/common/log/syslog_formatter.go
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build !windows,!nacl,!plan9
-
-package log
-
-import (
- "fmt"
- "log/syslog"
- "os"
-
- "github.com/sirupsen/logrus"
-)
-
-var _ logrus.Formatter = (*syslogger)(nil)
-
-func init() {
- setSyslogFormatter = func(l logger, appname, local string) error {
- if appname == "" {
- return fmt.Errorf("missing appname parameter")
- }
- if local == "" {
- return fmt.Errorf("missing local parameter")
- }
-
- fmter, err := newSyslogger(appname, local, l.entry.Logger.Formatter)
- if err != nil {
- fmt.Fprintf(os.Stderr, "error creating syslog formatter: %v\n", err)
- l.entry.Errorf("can't connect logger to syslog: %v", err)
- return err
- }
- l.entry.Logger.Formatter = fmter
- return nil
- }
-}
-
-var prefixTag []byte
-
-type syslogger struct {
- wrap logrus.Formatter
- out *syslog.Writer
-}
-
-func newSyslogger(appname string, facility string, fmter logrus.Formatter) (*syslogger, error) {
- priority, err := getFacility(facility)
- if err != nil {
- return nil, err
- }
- out, err := syslog.New(priority, appname)
- _, isJSON := fmter.(*logrus.JSONFormatter)
- if isJSON {
- // add cee tag to json formatted syslogs
- prefixTag = []byte("@cee:")
- }
- return &syslogger{
- out: out,
- wrap: fmter,
- }, err
-}
-
-func getFacility(facility string) (syslog.Priority, error) {
- switch facility {
- case "0":
- return syslog.LOG_LOCAL0, nil
- case "1":
- return syslog.LOG_LOCAL1, nil
- case "2":
- return syslog.LOG_LOCAL2, nil
- case "3":
- return syslog.LOG_LOCAL3, nil
- case "4":
- return syslog.LOG_LOCAL4, nil
- case "5":
- return syslog.LOG_LOCAL5, nil
- case "6":
- return syslog.LOG_LOCAL6, nil
- case "7":
- return syslog.LOG_LOCAL7, nil
- }
- return syslog.LOG_LOCAL0, fmt.Errorf("invalid local(%s) for syslog", facility)
-}
-
-func (s *syslogger) Format(e *logrus.Entry) ([]byte, error) {
- data, err := s.wrap.Format(e)
- if err != nil {
- fmt.Fprintf(os.Stderr, "syslogger: can't format entry: %v\n", err)
- return data, err
- }
- // only append tag to data sent to syslog (line), not to what
- // is returned
- line := string(append(prefixTag, data...))
-
- switch e.Level {
- case logrus.PanicLevel:
- err = s.out.Crit(line)
- case logrus.FatalLevel:
- err = s.out.Crit(line)
- case logrus.ErrorLevel:
- err = s.out.Err(line)
- case logrus.WarnLevel:
- err = s.out.Warning(line)
- case logrus.InfoLevel:
- err = s.out.Info(line)
- case logrus.DebugLevel:
- err = s.out.Debug(line)
- default:
- err = s.out.Notice(line)
- }
-
- if err != nil {
- fmt.Fprintf(os.Stderr, "syslogger: can't send log to syslog: %v\n", err)
- }
-
- return data, err
-}
diff --git a/vendor/github.com/prometheus/common/model/alert.go b/vendor/github.com/prometheus/common/model/alert.go
deleted file mode 100644
index 35e739c..0000000
--- a/vendor/github.com/prometheus/common/model/alert.go
+++ /dev/null
@@ -1,136 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "fmt"
- "time"
-)
-
-type AlertStatus string
-
-const (
- AlertFiring AlertStatus = "firing"
- AlertResolved AlertStatus = "resolved"
-)
-
-// Alert is a generic representation of an alert in the Prometheus eco-system.
-type Alert struct {
- // Label value pairs for purpose of aggregation, matching, and disposition
- // dispatching. This must minimally include an "alertname" label.
- Labels LabelSet `json:"labels"`
-
- // Extra key/value information which does not define alert identity.
- Annotations LabelSet `json:"annotations"`
-
- // The known time range for this alert. Both ends are optional.
- StartsAt time.Time `json:"startsAt,omitempty"`
- EndsAt time.Time `json:"endsAt,omitempty"`
- GeneratorURL string `json:"generatorURL"`
-}
-
-// Name returns the name of the alert. It is equivalent to the "alertname" label.
-func (a *Alert) Name() string {
- return string(a.Labels[AlertNameLabel])
-}
-
-// Fingerprint returns a unique hash for the alert. It is equivalent to
-// the fingerprint of the alert's label set.
-func (a *Alert) Fingerprint() Fingerprint {
- return a.Labels.Fingerprint()
-}
-
-func (a *Alert) String() string {
- s := fmt.Sprintf("%s[%s]", a.Name(), a.Fingerprint().String()[:7])
- if a.Resolved() {
- return s + "[resolved]"
- }
- return s + "[active]"
-}
-
-// Resolved returns true iff the activity interval ended in the past.
-func (a *Alert) Resolved() bool {
- return a.ResolvedAt(time.Now())
-}
-
-// ResolvedAt returns true off the activity interval ended before
-// the given timestamp.
-func (a *Alert) ResolvedAt(ts time.Time) bool {
- if a.EndsAt.IsZero() {
- return false
- }
- return !a.EndsAt.After(ts)
-}
-
-// Status returns the status of the alert.
-func (a *Alert) Status() AlertStatus {
- if a.Resolved() {
- return AlertResolved
- }
- return AlertFiring
-}
-
-// Validate checks whether the alert data is inconsistent.
-func (a *Alert) Validate() error {
- if a.StartsAt.IsZero() {
- return fmt.Errorf("start time missing")
- }
- if !a.EndsAt.IsZero() && a.EndsAt.Before(a.StartsAt) {
- return fmt.Errorf("start time must be before end time")
- }
- if err := a.Labels.Validate(); err != nil {
- return fmt.Errorf("invalid label set: %s", err)
- }
- if len(a.Labels) == 0 {
- return fmt.Errorf("at least one label pair required")
- }
- if err := a.Annotations.Validate(); err != nil {
- return fmt.Errorf("invalid annotations: %s", err)
- }
- return nil
-}
-
-// Alert is a list of alerts that can be sorted in chronological order.
-type Alerts []*Alert
-
-func (as Alerts) Len() int { return len(as) }
-func (as Alerts) Swap(i, j int) { as[i], as[j] = as[j], as[i] }
-
-func (as Alerts) Less(i, j int) bool {
- if as[i].StartsAt.Before(as[j].StartsAt) {
- return true
- }
- if as[i].EndsAt.Before(as[j].EndsAt) {
- return true
- }
- return as[i].Fingerprint() < as[j].Fingerprint()
-}
-
-// HasFiring returns true iff one of the alerts is not resolved.
-func (as Alerts) HasFiring() bool {
- for _, a := range as {
- if !a.Resolved() {
- return true
- }
- }
- return false
-}
-
-// Status returns StatusFiring iff at least one of the alerts is firing.
-func (as Alerts) Status() AlertStatus {
- if as.HasFiring() {
- return AlertFiring
- }
- return AlertResolved
-}
diff --git a/vendor/github.com/prometheus/common/model/fingerprinting.go b/vendor/github.com/prometheus/common/model/fingerprinting.go
deleted file mode 100644
index fc4de41..0000000
--- a/vendor/github.com/prometheus/common/model/fingerprinting.go
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "fmt"
- "strconv"
-)
-
-// Fingerprint provides a hash-capable representation of a Metric.
-// For our purposes, FNV-1A 64-bit is used.
-type Fingerprint uint64
-
-// FingerprintFromString transforms a string representation into a Fingerprint.
-func FingerprintFromString(s string) (Fingerprint, error) {
- num, err := strconv.ParseUint(s, 16, 64)
- return Fingerprint(num), err
-}
-
-// ParseFingerprint parses the input string into a fingerprint.
-func ParseFingerprint(s string) (Fingerprint, error) {
- num, err := strconv.ParseUint(s, 16, 64)
- if err != nil {
- return 0, err
- }
- return Fingerprint(num), nil
-}
-
-func (f Fingerprint) String() string {
- return fmt.Sprintf("%016x", uint64(f))
-}
-
-// Fingerprints represents a collection of Fingerprint subject to a given
-// natural sorting scheme. It implements sort.Interface.
-type Fingerprints []Fingerprint
-
-// Len implements sort.Interface.
-func (f Fingerprints) Len() int {
- return len(f)
-}
-
-// Less implements sort.Interface.
-func (f Fingerprints) Less(i, j int) bool {
- return f[i] < f[j]
-}
-
-// Swap implements sort.Interface.
-func (f Fingerprints) Swap(i, j int) {
- f[i], f[j] = f[j], f[i]
-}
-
-// FingerprintSet is a set of Fingerprints.
-type FingerprintSet map[Fingerprint]struct{}
-
-// Equal returns true if both sets contain the same elements (and not more).
-func (s FingerprintSet) Equal(o FingerprintSet) bool {
- if len(s) != len(o) {
- return false
- }
-
- for k := range s {
- if _, ok := o[k]; !ok {
- return false
- }
- }
-
- return true
-}
-
-// Intersection returns the elements contained in both sets.
-func (s FingerprintSet) Intersection(o FingerprintSet) FingerprintSet {
- myLength, otherLength := len(s), len(o)
- if myLength == 0 || otherLength == 0 {
- return FingerprintSet{}
- }
-
- subSet := s
- superSet := o
-
- if otherLength < myLength {
- subSet = o
- superSet = s
- }
-
- out := FingerprintSet{}
-
- for k := range subSet {
- if _, ok := superSet[k]; ok {
- out[k] = struct{}{}
- }
- }
-
- return out
-}
diff --git a/vendor/github.com/prometheus/common/model/fnv.go b/vendor/github.com/prometheus/common/model/fnv.go
deleted file mode 100644
index 038fc1c..0000000
--- a/vendor/github.com/prometheus/common/model/fnv.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-// Inline and byte-free variant of hash/fnv's fnv64a.
-
-const (
- offset64 = 14695981039346656037
- prime64 = 1099511628211
-)
-
-// hashNew initializies a new fnv64a hash value.
-func hashNew() uint64 {
- return offset64
-}
-
-// hashAdd adds a string to a fnv64a hash value, returning the updated hash.
-func hashAdd(h uint64, s string) uint64 {
- for i := 0; i < len(s); i++ {
- h ^= uint64(s[i])
- h *= prime64
- }
- return h
-}
-
-// hashAddByte adds a byte to a fnv64a hash value, returning the updated hash.
-func hashAddByte(h uint64, b byte) uint64 {
- h ^= uint64(b)
- h *= prime64
- return h
-}
diff --git a/vendor/github.com/prometheus/common/model/labels.go b/vendor/github.com/prometheus/common/model/labels.go
deleted file mode 100644
index 41051a0..0000000
--- a/vendor/github.com/prometheus/common/model/labels.go
+++ /dev/null
@@ -1,210 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "encoding/json"
- "fmt"
- "regexp"
- "strings"
- "unicode/utf8"
-)
-
-const (
- // AlertNameLabel is the name of the label containing the an alert's name.
- AlertNameLabel = "alertname"
-
- // ExportedLabelPrefix is the prefix to prepend to the label names present in
- // exported metrics if a label of the same name is added by the server.
- ExportedLabelPrefix = "exported_"
-
- // MetricNameLabel is the label name indicating the metric name of a
- // timeseries.
- MetricNameLabel = "__name__"
-
- // SchemeLabel is the name of the label that holds the scheme on which to
- // scrape a target.
- SchemeLabel = "__scheme__"
-
- // AddressLabel is the name of the label that holds the address of
- // a scrape target.
- AddressLabel = "__address__"
-
- // MetricsPathLabel is the name of the label that holds the path on which to
- // scrape a target.
- MetricsPathLabel = "__metrics_path__"
-
- // ReservedLabelPrefix is a prefix which is not legal in user-supplied
- // label names.
- ReservedLabelPrefix = "__"
-
- // MetaLabelPrefix is a prefix for labels that provide meta information.
- // Labels with this prefix are used for intermediate label processing and
- // will not be attached to time series.
- MetaLabelPrefix = "__meta_"
-
- // TmpLabelPrefix is a prefix for temporary labels as part of relabelling.
- // Labels with this prefix are used for intermediate label processing and
- // will not be attached to time series. This is reserved for use in
- // Prometheus configuration files by users.
- TmpLabelPrefix = "__tmp_"
-
- // ParamLabelPrefix is a prefix for labels that provide URL parameters
- // used to scrape a target.
- ParamLabelPrefix = "__param_"
-
- // JobLabel is the label name indicating the job from which a timeseries
- // was scraped.
- JobLabel = "job"
-
- // InstanceLabel is the label name used for the instance label.
- InstanceLabel = "instance"
-
- // BucketLabel is used for the label that defines the upper bound of a
- // bucket of a histogram ("le" -> "less or equal").
- BucketLabel = "le"
-
- // QuantileLabel is used for the label that defines the quantile in a
- // summary.
- QuantileLabel = "quantile"
-)
-
-// LabelNameRE is a regular expression matching valid label names. Note that the
-// IsValid method of LabelName performs the same check but faster than a match
-// with this regular expression.
-var LabelNameRE = regexp.MustCompile("^[a-zA-Z_][a-zA-Z0-9_]*$")
-
-// A LabelName is a key for a LabelSet or Metric. It has a value associated
-// therewith.
-type LabelName string
-
-// IsValid is true iff the label name matches the pattern of LabelNameRE. This
-// method, however, does not use LabelNameRE for the check but a much faster
-// hardcoded implementation.
-func (ln LabelName) IsValid() bool {
- if len(ln) == 0 {
- return false
- }
- for i, b := range ln {
- if !((b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_' || (b >= '0' && b <= '9' && i > 0)) {
- return false
- }
- }
- return true
-}
-
-// UnmarshalYAML implements the yaml.Unmarshaler interface.
-func (ln *LabelName) UnmarshalYAML(unmarshal func(interface{}) error) error {
- var s string
- if err := unmarshal(&s); err != nil {
- return err
- }
- if !LabelName(s).IsValid() {
- return fmt.Errorf("%q is not a valid label name", s)
- }
- *ln = LabelName(s)
- return nil
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface.
-func (ln *LabelName) UnmarshalJSON(b []byte) error {
- var s string
- if err := json.Unmarshal(b, &s); err != nil {
- return err
- }
- if !LabelName(s).IsValid() {
- return fmt.Errorf("%q is not a valid label name", s)
- }
- *ln = LabelName(s)
- return nil
-}
-
-// LabelNames is a sortable LabelName slice. In implements sort.Interface.
-type LabelNames []LabelName
-
-func (l LabelNames) Len() int {
- return len(l)
-}
-
-func (l LabelNames) Less(i, j int) bool {
- return l[i] < l[j]
-}
-
-func (l LabelNames) Swap(i, j int) {
- l[i], l[j] = l[j], l[i]
-}
-
-func (l LabelNames) String() string {
- labelStrings := make([]string, 0, len(l))
- for _, label := range l {
- labelStrings = append(labelStrings, string(label))
- }
- return strings.Join(labelStrings, ", ")
-}
-
-// A LabelValue is an associated value for a LabelName.
-type LabelValue string
-
-// IsValid returns true iff the string is a valid UTF8.
-func (lv LabelValue) IsValid() bool {
- return utf8.ValidString(string(lv))
-}
-
-// LabelValues is a sortable LabelValue slice. It implements sort.Interface.
-type LabelValues []LabelValue
-
-func (l LabelValues) Len() int {
- return len(l)
-}
-
-func (l LabelValues) Less(i, j int) bool {
- return string(l[i]) < string(l[j])
-}
-
-func (l LabelValues) Swap(i, j int) {
- l[i], l[j] = l[j], l[i]
-}
-
-// LabelPair pairs a name with a value.
-type LabelPair struct {
- Name LabelName
- Value LabelValue
-}
-
-// LabelPairs is a sortable slice of LabelPair pointers. It implements
-// sort.Interface.
-type LabelPairs []*LabelPair
-
-func (l LabelPairs) Len() int {
- return len(l)
-}
-
-func (l LabelPairs) Less(i, j int) bool {
- switch {
- case l[i].Name > l[j].Name:
- return false
- case l[i].Name < l[j].Name:
- return true
- case l[i].Value > l[j].Value:
- return false
- case l[i].Value < l[j].Value:
- return true
- default:
- return false
- }
-}
-
-func (l LabelPairs) Swap(i, j int) {
- l[i], l[j] = l[j], l[i]
-}
diff --git a/vendor/github.com/prometheus/common/model/labelset.go b/vendor/github.com/prometheus/common/model/labelset.go
deleted file mode 100644
index 6eda08a..0000000
--- a/vendor/github.com/prometheus/common/model/labelset.go
+++ /dev/null
@@ -1,169 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "encoding/json"
- "fmt"
- "sort"
- "strings"
-)
-
-// A LabelSet is a collection of LabelName and LabelValue pairs. The LabelSet
-// may be fully-qualified down to the point where it may resolve to a single
-// Metric in the data store or not. All operations that occur within the realm
-// of a LabelSet can emit a vector of Metric entities to which the LabelSet may
-// match.
-type LabelSet map[LabelName]LabelValue
-
-// Validate checks whether all names and values in the label set
-// are valid.
-func (ls LabelSet) Validate() error {
- for ln, lv := range ls {
- if !ln.IsValid() {
- return fmt.Errorf("invalid name %q", ln)
- }
- if !lv.IsValid() {
- return fmt.Errorf("invalid value %q", lv)
- }
- }
- return nil
-}
-
-// Equal returns true iff both label sets have exactly the same key/value pairs.
-func (ls LabelSet) Equal(o LabelSet) bool {
- if len(ls) != len(o) {
- return false
- }
- for ln, lv := range ls {
- olv, ok := o[ln]
- if !ok {
- return false
- }
- if olv != lv {
- return false
- }
- }
- return true
-}
-
-// Before compares the metrics, using the following criteria:
-//
-// If m has fewer labels than o, it is before o. If it has more, it is not.
-//
-// If the number of labels is the same, the superset of all label names is
-// sorted alphanumerically. The first differing label pair found in that order
-// determines the outcome: If the label does not exist at all in m, then m is
-// before o, and vice versa. Otherwise the label value is compared
-// alphanumerically.
-//
-// If m and o are equal, the method returns false.
-func (ls LabelSet) Before(o LabelSet) bool {
- if len(ls) < len(o) {
- return true
- }
- if len(ls) > len(o) {
- return false
- }
-
- lns := make(LabelNames, 0, len(ls)+len(o))
- for ln := range ls {
- lns = append(lns, ln)
- }
- for ln := range o {
- lns = append(lns, ln)
- }
- // It's probably not worth it to de-dup lns.
- sort.Sort(lns)
- for _, ln := range lns {
- mlv, ok := ls[ln]
- if !ok {
- return true
- }
- olv, ok := o[ln]
- if !ok {
- return false
- }
- if mlv < olv {
- return true
- }
- if mlv > olv {
- return false
- }
- }
- return false
-}
-
-// Clone returns a copy of the label set.
-func (ls LabelSet) Clone() LabelSet {
- lsn := make(LabelSet, len(ls))
- for ln, lv := range ls {
- lsn[ln] = lv
- }
- return lsn
-}
-
-// Merge is a helper function to non-destructively merge two label sets.
-func (l LabelSet) Merge(other LabelSet) LabelSet {
- result := make(LabelSet, len(l))
-
- for k, v := range l {
- result[k] = v
- }
-
- for k, v := range other {
- result[k] = v
- }
-
- return result
-}
-
-func (l LabelSet) String() string {
- lstrs := make([]string, 0, len(l))
- for l, v := range l {
- lstrs = append(lstrs, fmt.Sprintf("%s=%q", l, v))
- }
-
- sort.Strings(lstrs)
- return fmt.Sprintf("{%s}", strings.Join(lstrs, ", "))
-}
-
-// Fingerprint returns the LabelSet's fingerprint.
-func (ls LabelSet) Fingerprint() Fingerprint {
- return labelSetToFingerprint(ls)
-}
-
-// FastFingerprint returns the LabelSet's Fingerprint calculated by a faster hashing
-// algorithm, which is, however, more susceptible to hash collisions.
-func (ls LabelSet) FastFingerprint() Fingerprint {
- return labelSetToFastFingerprint(ls)
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface.
-func (l *LabelSet) UnmarshalJSON(b []byte) error {
- var m map[LabelName]LabelValue
- if err := json.Unmarshal(b, &m); err != nil {
- return err
- }
- // encoding/json only unmarshals maps of the form map[string]T. It treats
- // LabelName as a string and does not call its UnmarshalJSON method.
- // Thus, we have to replicate the behavior here.
- for ln := range m {
- if !ln.IsValid() {
- return fmt.Errorf("%q is not a valid label name", ln)
- }
- }
- *l = LabelSet(m)
- return nil
-}
diff --git a/vendor/github.com/prometheus/common/model/metric.go b/vendor/github.com/prometheus/common/model/metric.go
deleted file mode 100644
index 00804b7..0000000
--- a/vendor/github.com/prometheus/common/model/metric.go
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "fmt"
- "regexp"
- "sort"
- "strings"
-)
-
-var (
- // MetricNameRE is a regular expression matching valid metric
- // names. Note that the IsValidMetricName function performs the same
- // check but faster than a match with this regular expression.
- MetricNameRE = regexp.MustCompile(`^[a-zA-Z_:][a-zA-Z0-9_:]*$`)
-)
-
-// A Metric is similar to a LabelSet, but the key difference is that a Metric is
-// a singleton and refers to one and only one stream of samples.
-type Metric LabelSet
-
-// Equal compares the metrics.
-func (m Metric) Equal(o Metric) bool {
- return LabelSet(m).Equal(LabelSet(o))
-}
-
-// Before compares the metrics' underlying label sets.
-func (m Metric) Before(o Metric) bool {
- return LabelSet(m).Before(LabelSet(o))
-}
-
-// Clone returns a copy of the Metric.
-func (m Metric) Clone() Metric {
- clone := make(Metric, len(m))
- for k, v := range m {
- clone[k] = v
- }
- return clone
-}
-
-func (m Metric) String() string {
- metricName, hasName := m[MetricNameLabel]
- numLabels := len(m) - 1
- if !hasName {
- numLabels = len(m)
- }
- labelStrings := make([]string, 0, numLabels)
- for label, value := range m {
- if label != MetricNameLabel {
- labelStrings = append(labelStrings, fmt.Sprintf("%s=%q", label, value))
- }
- }
-
- switch numLabels {
- case 0:
- if hasName {
- return string(metricName)
- }
- return "{}"
- default:
- sort.Strings(labelStrings)
- return fmt.Sprintf("%s{%s}", metricName, strings.Join(labelStrings, ", "))
- }
-}
-
-// Fingerprint returns a Metric's Fingerprint.
-func (m Metric) Fingerprint() Fingerprint {
- return LabelSet(m).Fingerprint()
-}
-
-// FastFingerprint returns a Metric's Fingerprint calculated by a faster hashing
-// algorithm, which is, however, more susceptible to hash collisions.
-func (m Metric) FastFingerprint() Fingerprint {
- return LabelSet(m).FastFingerprint()
-}
-
-// IsValidMetricName returns true iff name matches the pattern of MetricNameRE.
-// This function, however, does not use MetricNameRE for the check but a much
-// faster hardcoded implementation.
-func IsValidMetricName(n LabelValue) bool {
- if len(n) == 0 {
- return false
- }
- for i, b := range n {
- if !((b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_' || b == ':' || (b >= '0' && b <= '9' && i > 0)) {
- return false
- }
- }
- return true
-}
diff --git a/vendor/github.com/prometheus/common/model/model.go b/vendor/github.com/prometheus/common/model/model.go
deleted file mode 100644
index a7b9691..0000000
--- a/vendor/github.com/prometheus/common/model/model.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package model contains common data structures that are shared across
-// Prometheus components and libraries.
-package model
diff --git a/vendor/github.com/prometheus/common/model/signature.go b/vendor/github.com/prometheus/common/model/signature.go
deleted file mode 100644
index 8762b13..0000000
--- a/vendor/github.com/prometheus/common/model/signature.go
+++ /dev/null
@@ -1,144 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "sort"
-)
-
-// SeparatorByte is a byte that cannot occur in valid UTF-8 sequences and is
-// used to separate label names, label values, and other strings from each other
-// when calculating their combined hash value (aka signature aka fingerprint).
-const SeparatorByte byte = 255
-
-var (
- // cache the signature of an empty label set.
- emptyLabelSignature = hashNew()
-)
-
-// LabelsToSignature returns a quasi-unique signature (i.e., fingerprint) for a
-// given label set. (Collisions are possible but unlikely if the number of label
-// sets the function is applied to is small.)
-func LabelsToSignature(labels map[string]string) uint64 {
- if len(labels) == 0 {
- return emptyLabelSignature
- }
-
- labelNames := make([]string, 0, len(labels))
- for labelName := range labels {
- labelNames = append(labelNames, labelName)
- }
- sort.Strings(labelNames)
-
- sum := hashNew()
- for _, labelName := range labelNames {
- sum = hashAdd(sum, labelName)
- sum = hashAddByte(sum, SeparatorByte)
- sum = hashAdd(sum, labels[labelName])
- sum = hashAddByte(sum, SeparatorByte)
- }
- return sum
-}
-
-// labelSetToFingerprint works exactly as LabelsToSignature but takes a LabelSet as
-// parameter (rather than a label map) and returns a Fingerprint.
-func labelSetToFingerprint(ls LabelSet) Fingerprint {
- if len(ls) == 0 {
- return Fingerprint(emptyLabelSignature)
- }
-
- labelNames := make(LabelNames, 0, len(ls))
- for labelName := range ls {
- labelNames = append(labelNames, labelName)
- }
- sort.Sort(labelNames)
-
- sum := hashNew()
- for _, labelName := range labelNames {
- sum = hashAdd(sum, string(labelName))
- sum = hashAddByte(sum, SeparatorByte)
- sum = hashAdd(sum, string(ls[labelName]))
- sum = hashAddByte(sum, SeparatorByte)
- }
- return Fingerprint(sum)
-}
-
-// labelSetToFastFingerprint works similar to labelSetToFingerprint but uses a
-// faster and less allocation-heavy hash function, which is more susceptible to
-// create hash collisions. Therefore, collision detection should be applied.
-func labelSetToFastFingerprint(ls LabelSet) Fingerprint {
- if len(ls) == 0 {
- return Fingerprint(emptyLabelSignature)
- }
-
- var result uint64
- for labelName, labelValue := range ls {
- sum := hashNew()
- sum = hashAdd(sum, string(labelName))
- sum = hashAddByte(sum, SeparatorByte)
- sum = hashAdd(sum, string(labelValue))
- result ^= sum
- }
- return Fingerprint(result)
-}
-
-// SignatureForLabels works like LabelsToSignature but takes a Metric as
-// parameter (rather than a label map) and only includes the labels with the
-// specified LabelNames into the signature calculation. The labels passed in
-// will be sorted by this function.
-func SignatureForLabels(m Metric, labels ...LabelName) uint64 {
- if len(labels) == 0 {
- return emptyLabelSignature
- }
-
- sort.Sort(LabelNames(labels))
-
- sum := hashNew()
- for _, label := range labels {
- sum = hashAdd(sum, string(label))
- sum = hashAddByte(sum, SeparatorByte)
- sum = hashAdd(sum, string(m[label]))
- sum = hashAddByte(sum, SeparatorByte)
- }
- return sum
-}
-
-// SignatureWithoutLabels works like LabelsToSignature but takes a Metric as
-// parameter (rather than a label map) and excludes the labels with any of the
-// specified LabelNames from the signature calculation.
-func SignatureWithoutLabels(m Metric, labels map[LabelName]struct{}) uint64 {
- if len(m) == 0 {
- return emptyLabelSignature
- }
-
- labelNames := make(LabelNames, 0, len(m))
- for labelName := range m {
- if _, exclude := labels[labelName]; !exclude {
- labelNames = append(labelNames, labelName)
- }
- }
- if len(labelNames) == 0 {
- return emptyLabelSignature
- }
- sort.Sort(labelNames)
-
- sum := hashNew()
- for _, labelName := range labelNames {
- sum = hashAdd(sum, string(labelName))
- sum = hashAddByte(sum, SeparatorByte)
- sum = hashAdd(sum, string(m[labelName]))
- sum = hashAddByte(sum, SeparatorByte)
- }
- return sum
-}
diff --git a/vendor/github.com/prometheus/common/model/silence.go b/vendor/github.com/prometheus/common/model/silence.go
deleted file mode 100644
index bb99889..0000000
--- a/vendor/github.com/prometheus/common/model/silence.go
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "encoding/json"
- "fmt"
- "regexp"
- "time"
-)
-
-// Matcher describes a matches the value of a given label.
-type Matcher struct {
- Name LabelName `json:"name"`
- Value string `json:"value"`
- IsRegex bool `json:"isRegex"`
-}
-
-func (m *Matcher) UnmarshalJSON(b []byte) error {
- type plain Matcher
- if err := json.Unmarshal(b, (*plain)(m)); err != nil {
- return err
- }
-
- if len(m.Name) == 0 {
- return fmt.Errorf("label name in matcher must not be empty")
- }
- if m.IsRegex {
- if _, err := regexp.Compile(m.Value); err != nil {
- return err
- }
- }
- return nil
-}
-
-// Validate returns true iff all fields of the matcher have valid values.
-func (m *Matcher) Validate() error {
- if !m.Name.IsValid() {
- return fmt.Errorf("invalid name %q", m.Name)
- }
- if m.IsRegex {
- if _, err := regexp.Compile(m.Value); err != nil {
- return fmt.Errorf("invalid regular expression %q", m.Value)
- }
- } else if !LabelValue(m.Value).IsValid() || len(m.Value) == 0 {
- return fmt.Errorf("invalid value %q", m.Value)
- }
- return nil
-}
-
-// Silence defines the representation of a silence definition in the Prometheus
-// eco-system.
-type Silence struct {
- ID uint64 `json:"id,omitempty"`
-
- Matchers []*Matcher `json:"matchers"`
-
- StartsAt time.Time `json:"startsAt"`
- EndsAt time.Time `json:"endsAt"`
-
- CreatedAt time.Time `json:"createdAt,omitempty"`
- CreatedBy string `json:"createdBy"`
- Comment string `json:"comment,omitempty"`
-}
-
-// Validate returns true iff all fields of the silence have valid values.
-func (s *Silence) Validate() error {
- if len(s.Matchers) == 0 {
- return fmt.Errorf("at least one matcher required")
- }
- for _, m := range s.Matchers {
- if err := m.Validate(); err != nil {
- return fmt.Errorf("invalid matcher: %s", err)
- }
- }
- if s.StartsAt.IsZero() {
- return fmt.Errorf("start time missing")
- }
- if s.EndsAt.IsZero() {
- return fmt.Errorf("end time missing")
- }
- if s.EndsAt.Before(s.StartsAt) {
- return fmt.Errorf("start time must be before end time")
- }
- if s.CreatedBy == "" {
- return fmt.Errorf("creator information missing")
- }
- if s.Comment == "" {
- return fmt.Errorf("comment missing")
- }
- if s.CreatedAt.IsZero() {
- return fmt.Errorf("creation timestamp missing")
- }
- return nil
-}
diff --git a/vendor/github.com/prometheus/common/model/time.go b/vendor/github.com/prometheus/common/model/time.go
deleted file mode 100644
index 7b0064f..0000000
--- a/vendor/github.com/prometheus/common/model/time.go
+++ /dev/null
@@ -1,270 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "fmt"
- "math"
- "regexp"
- "strconv"
- "strings"
- "time"
-)
-
-const (
- // MinimumTick is the minimum supported time resolution. This has to be
- // at least time.Second in order for the code below to work.
- minimumTick = time.Millisecond
- // second is the Time duration equivalent to one second.
- second = int64(time.Second / minimumTick)
- // The number of nanoseconds per minimum tick.
- nanosPerTick = int64(minimumTick / time.Nanosecond)
-
- // Earliest is the earliest Time representable. Handy for
- // initializing a high watermark.
- Earliest = Time(math.MinInt64)
- // Latest is the latest Time representable. Handy for initializing
- // a low watermark.
- Latest = Time(math.MaxInt64)
-)
-
-// Time is the number of milliseconds since the epoch
-// (1970-01-01 00:00 UTC) excluding leap seconds.
-type Time int64
-
-// Interval describes an interval between two timestamps.
-type Interval struct {
- Start, End Time
-}
-
-// Now returns the current time as a Time.
-func Now() Time {
- return TimeFromUnixNano(time.Now().UnixNano())
-}
-
-// TimeFromUnix returns the Time equivalent to the Unix Time t
-// provided in seconds.
-func TimeFromUnix(t int64) Time {
- return Time(t * second)
-}
-
-// TimeFromUnixNano returns the Time equivalent to the Unix Time
-// t provided in nanoseconds.
-func TimeFromUnixNano(t int64) Time {
- return Time(t / nanosPerTick)
-}
-
-// Equal reports whether two Times represent the same instant.
-func (t Time) Equal(o Time) bool {
- return t == o
-}
-
-// Before reports whether the Time t is before o.
-func (t Time) Before(o Time) bool {
- return t < o
-}
-
-// After reports whether the Time t is after o.
-func (t Time) After(o Time) bool {
- return t > o
-}
-
-// Add returns the Time t + d.
-func (t Time) Add(d time.Duration) Time {
- return t + Time(d/minimumTick)
-}
-
-// Sub returns the Duration t - o.
-func (t Time) Sub(o Time) time.Duration {
- return time.Duration(t-o) * minimumTick
-}
-
-// Time returns the time.Time representation of t.
-func (t Time) Time() time.Time {
- return time.Unix(int64(t)/second, (int64(t)%second)*nanosPerTick)
-}
-
-// Unix returns t as a Unix time, the number of seconds elapsed
-// since January 1, 1970 UTC.
-func (t Time) Unix() int64 {
- return int64(t) / second
-}
-
-// UnixNano returns t as a Unix time, the number of nanoseconds elapsed
-// since January 1, 1970 UTC.
-func (t Time) UnixNano() int64 {
- return int64(t) * nanosPerTick
-}
-
-// The number of digits after the dot.
-var dotPrecision = int(math.Log10(float64(second)))
-
-// String returns a string representation of the Time.
-func (t Time) String() string {
- return strconv.FormatFloat(float64(t)/float64(second), 'f', -1, 64)
-}
-
-// MarshalJSON implements the json.Marshaler interface.
-func (t Time) MarshalJSON() ([]byte, error) {
- return []byte(t.String()), nil
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface.
-func (t *Time) UnmarshalJSON(b []byte) error {
- p := strings.Split(string(b), ".")
- switch len(p) {
- case 1:
- v, err := strconv.ParseInt(string(p[0]), 10, 64)
- if err != nil {
- return err
- }
- *t = Time(v * second)
-
- case 2:
- v, err := strconv.ParseInt(string(p[0]), 10, 64)
- if err != nil {
- return err
- }
- v *= second
-
- prec := dotPrecision - len(p[1])
- if prec < 0 {
- p[1] = p[1][:dotPrecision]
- } else if prec > 0 {
- p[1] = p[1] + strings.Repeat("0", prec)
- }
-
- va, err := strconv.ParseInt(p[1], 10, 32)
- if err != nil {
- return err
- }
-
- // If the value was something like -0.1 the negative is lost in the
- // parsing because of the leading zero, this ensures that we capture it.
- if len(p[0]) > 0 && p[0][0] == '-' && v+va > 0 {
- *t = Time(v+va) * -1
- } else {
- *t = Time(v + va)
- }
-
- default:
- return fmt.Errorf("invalid time %q", string(b))
- }
- return nil
-}
-
-// Duration wraps time.Duration. It is used to parse the custom duration format
-// from YAML.
-// This type should not propagate beyond the scope of input/output processing.
-type Duration time.Duration
-
-// Set implements pflag/flag.Value
-func (d *Duration) Set(s string) error {
- var err error
- *d, err = ParseDuration(s)
- return err
-}
-
-// Type implements pflag.Value
-func (d *Duration) Type() string {
- return "duration"
-}
-
-var durationRE = regexp.MustCompile("^([0-9]+)(y|w|d|h|m|s|ms)$")
-
-// ParseDuration parses a string into a time.Duration, assuming that a year
-// always has 365d, a week always has 7d, and a day always has 24h.
-func ParseDuration(durationStr string) (Duration, error) {
- matches := durationRE.FindStringSubmatch(durationStr)
- if len(matches) != 3 {
- return 0, fmt.Errorf("not a valid duration string: %q", durationStr)
- }
- var (
- n, _ = strconv.Atoi(matches[1])
- dur = time.Duration(n) * time.Millisecond
- )
- switch unit := matches[2]; unit {
- case "y":
- dur *= 1000 * 60 * 60 * 24 * 365
- case "w":
- dur *= 1000 * 60 * 60 * 24 * 7
- case "d":
- dur *= 1000 * 60 * 60 * 24
- case "h":
- dur *= 1000 * 60 * 60
- case "m":
- dur *= 1000 * 60
- case "s":
- dur *= 1000
- case "ms":
- // Value already correct
- default:
- return 0, fmt.Errorf("invalid time unit in duration string: %q", unit)
- }
- return Duration(dur), nil
-}
-
-func (d Duration) String() string {
- var (
- ms = int64(time.Duration(d) / time.Millisecond)
- unit = "ms"
- )
- if ms == 0 {
- return "0s"
- }
- factors := map[string]int64{
- "y": 1000 * 60 * 60 * 24 * 365,
- "w": 1000 * 60 * 60 * 24 * 7,
- "d": 1000 * 60 * 60 * 24,
- "h": 1000 * 60 * 60,
- "m": 1000 * 60,
- "s": 1000,
- "ms": 1,
- }
-
- switch int64(0) {
- case ms % factors["y"]:
- unit = "y"
- case ms % factors["w"]:
- unit = "w"
- case ms % factors["d"]:
- unit = "d"
- case ms % factors["h"]:
- unit = "h"
- case ms % factors["m"]:
- unit = "m"
- case ms % factors["s"]:
- unit = "s"
- }
- return fmt.Sprintf("%v%v", ms/factors[unit], unit)
-}
-
-// MarshalYAML implements the yaml.Marshaler interface.
-func (d Duration) MarshalYAML() (interface{}, error) {
- return d.String(), nil
-}
-
-// UnmarshalYAML implements the yaml.Unmarshaler interface.
-func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error {
- var s string
- if err := unmarshal(&s); err != nil {
- return err
- }
- dur, err := ParseDuration(s)
- if err != nil {
- return err
- }
- *d = dur
- return nil
-}
diff --git a/vendor/github.com/prometheus/common/model/value.go b/vendor/github.com/prometheus/common/model/value.go
deleted file mode 100644
index c9d8fb1..0000000
--- a/vendor/github.com/prometheus/common/model/value.go
+++ /dev/null
@@ -1,416 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "encoding/json"
- "fmt"
- "math"
- "sort"
- "strconv"
- "strings"
-)
-
-var (
- // ZeroSamplePair is the pseudo zero-value of SamplePair used to signal a
- // non-existing sample pair. It is a SamplePair with timestamp Earliest and
- // value 0.0. Note that the natural zero value of SamplePair has a timestamp
- // of 0, which is possible to appear in a real SamplePair and thus not
- // suitable to signal a non-existing SamplePair.
- ZeroSamplePair = SamplePair{Timestamp: Earliest}
-
- // ZeroSample is the pseudo zero-value of Sample used to signal a
- // non-existing sample. It is a Sample with timestamp Earliest, value 0.0,
- // and metric nil. Note that the natural zero value of Sample has a timestamp
- // of 0, which is possible to appear in a real Sample and thus not suitable
- // to signal a non-existing Sample.
- ZeroSample = Sample{Timestamp: Earliest}
-)
-
-// A SampleValue is a representation of a value for a given sample at a given
-// time.
-type SampleValue float64
-
-// MarshalJSON implements json.Marshaler.
-func (v SampleValue) MarshalJSON() ([]byte, error) {
- return json.Marshal(v.String())
-}
-
-// UnmarshalJSON implements json.Unmarshaler.
-func (v *SampleValue) UnmarshalJSON(b []byte) error {
- if len(b) < 2 || b[0] != '"' || b[len(b)-1] != '"' {
- return fmt.Errorf("sample value must be a quoted string")
- }
- f, err := strconv.ParseFloat(string(b[1:len(b)-1]), 64)
- if err != nil {
- return err
- }
- *v = SampleValue(f)
- return nil
-}
-
-// Equal returns true if the value of v and o is equal or if both are NaN. Note
-// that v==o is false if both are NaN. If you want the conventional float
-// behavior, use == to compare two SampleValues.
-func (v SampleValue) Equal(o SampleValue) bool {
- if v == o {
- return true
- }
- return math.IsNaN(float64(v)) && math.IsNaN(float64(o))
-}
-
-func (v SampleValue) String() string {
- return strconv.FormatFloat(float64(v), 'f', -1, 64)
-}
-
-// SamplePair pairs a SampleValue with a Timestamp.
-type SamplePair struct {
- Timestamp Time
- Value SampleValue
-}
-
-// MarshalJSON implements json.Marshaler.
-func (s SamplePair) MarshalJSON() ([]byte, error) {
- t, err := json.Marshal(s.Timestamp)
- if err != nil {
- return nil, err
- }
- v, err := json.Marshal(s.Value)
- if err != nil {
- return nil, err
- }
- return []byte(fmt.Sprintf("[%s,%s]", t, v)), nil
-}
-
-// UnmarshalJSON implements json.Unmarshaler.
-func (s *SamplePair) UnmarshalJSON(b []byte) error {
- v := [...]json.Unmarshaler{&s.Timestamp, &s.Value}
- return json.Unmarshal(b, &v)
-}
-
-// Equal returns true if this SamplePair and o have equal Values and equal
-// Timestamps. The semantics of Value equality is defined by SampleValue.Equal.
-func (s *SamplePair) Equal(o *SamplePair) bool {
- return s == o || (s.Value.Equal(o.Value) && s.Timestamp.Equal(o.Timestamp))
-}
-
-func (s SamplePair) String() string {
- return fmt.Sprintf("%s @[%s]", s.Value, s.Timestamp)
-}
-
-// Sample is a sample pair associated with a metric.
-type Sample struct {
- Metric Metric `json:"metric"`
- Value SampleValue `json:"value"`
- Timestamp Time `json:"timestamp"`
-}
-
-// Equal compares first the metrics, then the timestamp, then the value. The
-// semantics of value equality is defined by SampleValue.Equal.
-func (s *Sample) Equal(o *Sample) bool {
- if s == o {
- return true
- }
-
- if !s.Metric.Equal(o.Metric) {
- return false
- }
- if !s.Timestamp.Equal(o.Timestamp) {
- return false
- }
-
- return s.Value.Equal(o.Value)
-}
-
-func (s Sample) String() string {
- return fmt.Sprintf("%s => %s", s.Metric, SamplePair{
- Timestamp: s.Timestamp,
- Value: s.Value,
- })
-}
-
-// MarshalJSON implements json.Marshaler.
-func (s Sample) MarshalJSON() ([]byte, error) {
- v := struct {
- Metric Metric `json:"metric"`
- Value SamplePair `json:"value"`
- }{
- Metric: s.Metric,
- Value: SamplePair{
- Timestamp: s.Timestamp,
- Value: s.Value,
- },
- }
-
- return json.Marshal(&v)
-}
-
-// UnmarshalJSON implements json.Unmarshaler.
-func (s *Sample) UnmarshalJSON(b []byte) error {
- v := struct {
- Metric Metric `json:"metric"`
- Value SamplePair `json:"value"`
- }{
- Metric: s.Metric,
- Value: SamplePair{
- Timestamp: s.Timestamp,
- Value: s.Value,
- },
- }
-
- if err := json.Unmarshal(b, &v); err != nil {
- return err
- }
-
- s.Metric = v.Metric
- s.Timestamp = v.Value.Timestamp
- s.Value = v.Value.Value
-
- return nil
-}
-
-// Samples is a sortable Sample slice. It implements sort.Interface.
-type Samples []*Sample
-
-func (s Samples) Len() int {
- return len(s)
-}
-
-// Less compares first the metrics, then the timestamp.
-func (s Samples) Less(i, j int) bool {
- switch {
- case s[i].Metric.Before(s[j].Metric):
- return true
- case s[j].Metric.Before(s[i].Metric):
- return false
- case s[i].Timestamp.Before(s[j].Timestamp):
- return true
- default:
- return false
- }
-}
-
-func (s Samples) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
-}
-
-// Equal compares two sets of samples and returns true if they are equal.
-func (s Samples) Equal(o Samples) bool {
- if len(s) != len(o) {
- return false
- }
-
- for i, sample := range s {
- if !sample.Equal(o[i]) {
- return false
- }
- }
- return true
-}
-
-// SampleStream is a stream of Values belonging to an attached COWMetric.
-type SampleStream struct {
- Metric Metric `json:"metric"`
- Values []SamplePair `json:"values"`
-}
-
-func (ss SampleStream) String() string {
- vals := make([]string, len(ss.Values))
- for i, v := range ss.Values {
- vals[i] = v.String()
- }
- return fmt.Sprintf("%s =>\n%s", ss.Metric, strings.Join(vals, "\n"))
-}
-
-// Value is a generic interface for values resulting from a query evaluation.
-type Value interface {
- Type() ValueType
- String() string
-}
-
-func (Matrix) Type() ValueType { return ValMatrix }
-func (Vector) Type() ValueType { return ValVector }
-func (*Scalar) Type() ValueType { return ValScalar }
-func (*String) Type() ValueType { return ValString }
-
-type ValueType int
-
-const (
- ValNone ValueType = iota
- ValScalar
- ValVector
- ValMatrix
- ValString
-)
-
-// MarshalJSON implements json.Marshaler.
-func (et ValueType) MarshalJSON() ([]byte, error) {
- return json.Marshal(et.String())
-}
-
-func (et *ValueType) UnmarshalJSON(b []byte) error {
- var s string
- if err := json.Unmarshal(b, &s); err != nil {
- return err
- }
- switch s {
- case "":
- *et = ValNone
- case "scalar":
- *et = ValScalar
- case "vector":
- *et = ValVector
- case "matrix":
- *et = ValMatrix
- case "string":
- *et = ValString
- default:
- return fmt.Errorf("unknown value type %q", s)
- }
- return nil
-}
-
-func (e ValueType) String() string {
- switch e {
- case ValNone:
- return ""
- case ValScalar:
- return "scalar"
- case ValVector:
- return "vector"
- case ValMatrix:
- return "matrix"
- case ValString:
- return "string"
- }
- panic("ValueType.String: unhandled value type")
-}
-
-// Scalar is a scalar value evaluated at the set timestamp.
-type Scalar struct {
- Value SampleValue `json:"value"`
- Timestamp Time `json:"timestamp"`
-}
-
-func (s Scalar) String() string {
- return fmt.Sprintf("scalar: %v @[%v]", s.Value, s.Timestamp)
-}
-
-// MarshalJSON implements json.Marshaler.
-func (s Scalar) MarshalJSON() ([]byte, error) {
- v := strconv.FormatFloat(float64(s.Value), 'f', -1, 64)
- return json.Marshal([...]interface{}{s.Timestamp, string(v)})
-}
-
-// UnmarshalJSON implements json.Unmarshaler.
-func (s *Scalar) UnmarshalJSON(b []byte) error {
- var f string
- v := [...]interface{}{&s.Timestamp, &f}
-
- if err := json.Unmarshal(b, &v); err != nil {
- return err
- }
-
- value, err := strconv.ParseFloat(f, 64)
- if err != nil {
- return fmt.Errorf("error parsing sample value: %s", err)
- }
- s.Value = SampleValue(value)
- return nil
-}
-
-// String is a string value evaluated at the set timestamp.
-type String struct {
- Value string `json:"value"`
- Timestamp Time `json:"timestamp"`
-}
-
-func (s *String) String() string {
- return s.Value
-}
-
-// MarshalJSON implements json.Marshaler.
-func (s String) MarshalJSON() ([]byte, error) {
- return json.Marshal([]interface{}{s.Timestamp, s.Value})
-}
-
-// UnmarshalJSON implements json.Unmarshaler.
-func (s *String) UnmarshalJSON(b []byte) error {
- v := [...]interface{}{&s.Timestamp, &s.Value}
- return json.Unmarshal(b, &v)
-}
-
-// Vector is basically only an alias for Samples, but the
-// contract is that in a Vector, all Samples have the same timestamp.
-type Vector []*Sample
-
-func (vec Vector) String() string {
- entries := make([]string, len(vec))
- for i, s := range vec {
- entries[i] = s.String()
- }
- return strings.Join(entries, "\n")
-}
-
-func (vec Vector) Len() int { return len(vec) }
-func (vec Vector) Swap(i, j int) { vec[i], vec[j] = vec[j], vec[i] }
-
-// Less compares first the metrics, then the timestamp.
-func (vec Vector) Less(i, j int) bool {
- switch {
- case vec[i].Metric.Before(vec[j].Metric):
- return true
- case vec[j].Metric.Before(vec[i].Metric):
- return false
- case vec[i].Timestamp.Before(vec[j].Timestamp):
- return true
- default:
- return false
- }
-}
-
-// Equal compares two sets of samples and returns true if they are equal.
-func (vec Vector) Equal(o Vector) bool {
- if len(vec) != len(o) {
- return false
- }
-
- for i, sample := range vec {
- if !sample.Equal(o[i]) {
- return false
- }
- }
- return true
-}
-
-// Matrix is a list of time series.
-type Matrix []*SampleStream
-
-func (m Matrix) Len() int { return len(m) }
-func (m Matrix) Less(i, j int) bool { return m[i].Metric.Before(m[j].Metric) }
-func (m Matrix) Swap(i, j int) { m[i], m[j] = m[j], m[i] }
-
-func (mat Matrix) String() string {
- matCp := make(Matrix, len(mat))
- copy(matCp, mat)
- sort.Sort(matCp)
-
- strs := make([]string, len(matCp))
-
- for i, ss := range matCp {
- strs[i] = ss.String()
- }
-
- return strings.Join(strs, "\n")
-}
diff --git a/vendor/github.com/prometheus/common/version/info.go b/vendor/github.com/prometheus/common/version/info.go
deleted file mode 100644
index ac9af1f..0000000
--- a/vendor/github.com/prometheus/common/version/info.go
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2016 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package version
-
-import (
- "bytes"
- "fmt"
- "runtime"
- "strings"
- "text/template"
-
- "github.com/prometheus/client_golang/prometheus"
-)
-
-// Build information. Populated at build-time.
-var (
- Version string
- Revision string
- Branch string
- BuildUser string
- BuildDate string
- GoVersion = runtime.Version()
-)
-
-// NewCollector returns a collector that exports metrics about current version
-// information.
-func NewCollector(program string) prometheus.Collector {
- return prometheus.NewGaugeFunc(
- prometheus.GaugeOpts{
- Namespace: program,
- Name: "build_info",
- Help: fmt.Sprintf(
- "A metric with a constant '1' value labeled by version, revision, branch, and goversion from which %s was built.",
- program,
- ),
- ConstLabels: prometheus.Labels{
- "version": Version,
- "revision": Revision,
- "branch": Branch,
- "goversion": GoVersion,
- },
- },
- func() float64 { return 1 },
- )
-}
-
-// versionInfoTmpl contains the template used by Info.
-var versionInfoTmpl = `
-{{.program}}, version {{.version}} (branch: {{.branch}}, revision: {{.revision}})
- build user: {{.buildUser}}
- build date: {{.buildDate}}
- go version: {{.goVersion}}
-`
-
-// Print returns version information.
-func Print(program string) string {
- m := map[string]string{
- "program": program,
- "version": Version,
- "revision": Revision,
- "branch": Branch,
- "buildUser": BuildUser,
- "buildDate": BuildDate,
- "goVersion": GoVersion,
- }
- t := template.Must(template.New("version").Parse(versionInfoTmpl))
-
- var buf bytes.Buffer
- if err := t.ExecuteTemplate(&buf, "version", m); err != nil {
- panic(err)
- }
- return strings.TrimSpace(buf.String())
-}
-
-// Info returns version, branch and revision information.
-func Info() string {
- return fmt.Sprintf("(version=%s, branch=%s, revision=%s)", Version, Branch, Revision)
-}
-
-// BuildContext returns goVersion, buildUser and buildDate information.
-func BuildContext() string {
- return fmt.Sprintf("(go=%s, user=%s, date=%s)", GoVersion, BuildUser, BuildDate)
-}
diff --git a/vendor/github.com/prometheus/procfs/.gitignore b/vendor/github.com/prometheus/procfs/.gitignore
deleted file mode 100644
index 25e3659..0000000
--- a/vendor/github.com/prometheus/procfs/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/fixtures/
diff --git a/vendor/github.com/prometheus/procfs/.golangci.yml b/vendor/github.com/prometheus/procfs/.golangci.yml
deleted file mode 100644
index 7c4ce1f..0000000
--- a/vendor/github.com/prometheus/procfs/.golangci.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-linters:
- enable:
- - staticcheck
- - govet
diff --git a/vendor/github.com/prometheus/procfs/CONTRIBUTING.md b/vendor/github.com/prometheus/procfs/CONTRIBUTING.md
deleted file mode 100644
index 943de76..0000000
--- a/vendor/github.com/prometheus/procfs/CONTRIBUTING.md
+++ /dev/null
@@ -1,121 +0,0 @@
-# Contributing
-
-Prometheus uses GitHub to manage reviews of pull requests.
-
-* If you are a new contributor see: [Steps to Contribute](#steps-to-contribute)
-
-* If you have a trivial fix or improvement, go ahead and create a pull request,
- addressing (with `@...`) a suitable maintainer of this repository (see
- [MAINTAINERS.md](MAINTAINERS.md)) in the description of the pull request.
-
-* If you plan to do something more involved, first discuss your ideas
- on our [mailing list](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers).
- This will avoid unnecessary work and surely give you and us a good deal
- of inspiration. Also please see our [non-goals issue](https://github.com/prometheus/docs/issues/149) on areas that the Prometheus community doesn't plan to work on.
-
-* Relevant coding style guidelines are the [Go Code Review
- Comments](https://code.google.com/p/go-wiki/wiki/CodeReviewComments)
- and the _Formatting and style_ section of Peter Bourgon's [Go: Best
- Practices for Production
- Environments](https://peter.bourgon.org/go-in-production/#formatting-and-style).
-
-* Be sure to sign off on the [DCO](https://github.com/probot/dco#how-it-works)
-
-## Steps to Contribute
-
-Should you wish to work on an issue, please claim it first by commenting on the GitHub issue that you want to work on it. This is to prevent duplicated efforts from contributors on the same issue.
-
-Please check the [`help-wanted`](https://github.com/prometheus/procfs/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) label to find issues that are good for getting started. If you have questions about one of the issues, with or without the tag, please comment on them and one of the maintainers will clarify it. For a quicker response, contact us over [IRC](https://prometheus.io/community).
-
-For quickly compiling and testing your changes do:
-```
-make test # Make sure all the tests pass before you commit and push :)
-```
-
-We use [`golangci-lint`](https://github.com/golangci/golangci-lint) for linting the code. If it reports an issue and you think that the warning needs to be disregarded or is a false-positive, you can add a special comment `//nolint:linter1[,linter2,...]` before the offending line. Use this sparingly though, fixing the code to comply with the linter's recommendation is in general the preferred course of action.
-
-## Pull Request Checklist
-
-* Branch from the master branch and, if needed, rebase to the current master branch before submitting your pull request. If it doesn't merge cleanly with master you may be asked to rebase your changes.
-
-* Commits should be as small as possible, while ensuring that each commit is correct independently (i.e., each commit should compile and pass tests).
-
-* If your patch is not getting reviewed or you need a specific person to review it, you can @-reply a reviewer asking for a review in the pull request or a comment, or you can ask for a review on IRC channel [#prometheus](https://webchat.freenode.net/?channels=#prometheus) on irc.freenode.net (for the easiest start, [join via Riot](https://riot.im/app/#/room/#prometheus:matrix.org)).
-
-* Add tests relevant to the fixed bug or new feature.
-
-## Dependency management
-
-The Prometheus project uses [Go modules](https://golang.org/cmd/go/#hdr-Modules__module_versions__and_more) to manage dependencies on external packages. This requires a working Go environment with version 1.12 or greater installed.
-
-All dependencies are vendored in the `vendor/` directory.
-
-To add or update a new dependency, use the `go get` command:
-
-```bash
-# Pick the latest tagged release.
-go get example.com/some/module/pkg
-
-# Pick a specific version.
-go get example.com/some/module/pkg@vX.Y.Z
-```
-
-Tidy up the `go.mod` and `go.sum` files and copy the new/updated dependency to the `vendor/` directory:
-
-
-```bash
-# The GO111MODULE variable can be omitted when the code isn't located in GOPATH.
-GO111MODULE=on go mod tidy
-
-GO111MODULE=on go mod vendor
-```
-
-You have to commit the changes to `go.mod`, `go.sum` and the `vendor/` directory before submitting the pull request.
-
-
-## API Implementation Guidelines
-
-### Naming and Documentation
-
-Public functions and structs should normally be named according to the file(s) being read and parsed. For example,
-the `fs.BuddyInfo()` function reads the file `/proc/buddyinfo`. In addition, the godoc for each public function
-should contain the path to the file(s) being read and a URL of the linux kernel documentation describing the file(s).
-
-### Reading vs. Parsing
-
-Most functionality in this library consists of reading files and then parsing the text into structured data. In most
-cases reading and parsing should be separated into different functions/methods with a public `fs.Thing()` method and
-a private `parseThing(r Reader)` function. This provides a logical separation and allows parsing to be tested
-directly without the need to read from the filesystem. Using a `Reader` argument is preferred over other data types
-such as `string` or `*File` because it provides the most flexibility regarding the data source. When a set of files
-in a directory needs to be parsed, then a `path` string parameter to the parse function can be used instead.
-
-### /proc and /sys filesystem I/O
-
-The `proc` and `sys` filesystems are pseudo file systems and work a bit differently from standard disk I/O.
-Many of the files are changing continuously and the data being read can in some cases change between subsequent
-reads in the same file. Also, most of the files are relatively small (less than a few KBs), and system calls
-to the `stat` function will often return the wrong size. Therefore, for most files it's recommended to read the
-full file in a single operation using an internal utility function called `util.ReadFileNoStat`.
-This function is similar to `ioutil.ReadFile`, but it avoids the system call to `stat` to get the current size of
-the file.
-
-Note that parsing the file's contents can still be performed one line at a time. This is done by first reading
-the full file, and then using a scanner on the `[]byte` or `string` containing the data.
-
-```
- data, err := util.ReadFileNoStat("/proc/cpuinfo")
- if err != nil {
- return err
- }
- reader := bytes.NewReader(data)
- scanner := bufio.NewScanner(reader)
-```
-
-The `/sys` filesystem contains many very small files which contain only a single numeric or text value. These files
-can be read using an internal function called `util.SysReadFile` which is similar to `ioutil.ReadFile` but does
-not bother to check the size of the file before reading.
-```
- data, err := util.SysReadFile("/sys/class/power_supply/BAT0/capacity")
-```
-
diff --git a/vendor/github.com/prometheus/procfs/LICENSE b/vendor/github.com/prometheus/procfs/LICENSE
deleted file mode 100644
index 261eeb9..0000000
--- a/vendor/github.com/prometheus/procfs/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/vendor/github.com/prometheus/procfs/MAINTAINERS.md b/vendor/github.com/prometheus/procfs/MAINTAINERS.md
deleted file mode 100644
index 56ba67d..0000000
--- a/vendor/github.com/prometheus/procfs/MAINTAINERS.md
+++ /dev/null
@@ -1,2 +0,0 @@
-* Johannes 'fish' Ziemke @discordianfish
-* Paul Gier @pgier
diff --git a/vendor/github.com/prometheus/procfs/Makefile b/vendor/github.com/prometheus/procfs/Makefile
deleted file mode 100644
index 616a0d2..0000000
--- a/vendor/github.com/prometheus/procfs/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2018 The Prometheus Authors
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-include Makefile.common
-
-%/.unpacked: %.ttar
- @echo ">> extracting fixtures"
- ./ttar -C $(dir $*) -x -f $*.ttar
- touch $@
-
-update_fixtures:
- rm -vf fixtures/.unpacked
- ./ttar -c -f fixtures.ttar fixtures/
-
-.PHONY: build
-build:
-
-.PHONY: test
-test: fixtures/.unpacked common-test
diff --git a/vendor/github.com/prometheus/procfs/Makefile.common b/vendor/github.com/prometheus/procfs/Makefile.common
deleted file mode 100644
index d7aea1b..0000000
--- a/vendor/github.com/prometheus/procfs/Makefile.common
+++ /dev/null
@@ -1,275 +0,0 @@
-# Copyright 2018 The Prometheus Authors
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-# A common Makefile that includes rules to be reused in different prometheus projects.
-# !!! Open PRs only against the prometheus/prometheus/Makefile.common repository!
-
-# Example usage :
-# Create the main Makefile in the root project directory.
-# include Makefile.common
-# customTarget:
-# @echo ">> Running customTarget"
-#
-
-# Ensure GOBIN is not set during build so that promu is installed to the correct path
-unexport GOBIN
-
-GO ?= go
-GOFMT ?= $(GO)fmt
-FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH)))
-GOOPTS ?=
-GOHOSTOS ?= $(shell $(GO) env GOHOSTOS)
-GOHOSTARCH ?= $(shell $(GO) env GOHOSTARCH)
-
-GO_VERSION ?= $(shell $(GO) version)
-GO_VERSION_NUMBER ?= $(word 3, $(GO_VERSION))
-PRE_GO_111 ?= $(shell echo $(GO_VERSION_NUMBER) | grep -E 'go1\.(10|[0-9])\.')
-
-GOVENDOR :=
-GO111MODULE :=
-ifeq (, $(PRE_GO_111))
- ifneq (,$(wildcard go.mod))
- # Enforce Go modules support just in case the directory is inside GOPATH (and for Travis CI).
- GO111MODULE := on
-
- ifneq (,$(wildcard vendor))
- # Always use the local vendor/ directory to satisfy the dependencies.
- GOOPTS := $(GOOPTS) -mod=vendor
- endif
- endif
-else
- ifneq (,$(wildcard go.mod))
- ifneq (,$(wildcard vendor))
-$(warning This repository requires Go >= 1.11 because of Go modules)
-$(warning Some recipes may not work as expected as the current Go runtime is '$(GO_VERSION_NUMBER)')
- endif
- else
- # This repository isn't using Go modules (yet).
- GOVENDOR := $(FIRST_GOPATH)/bin/govendor
- endif
-endif
-PROMU := $(FIRST_GOPATH)/bin/promu
-pkgs = ./...
-
-ifeq (arm, $(GOHOSTARCH))
- GOHOSTARM ?= $(shell GOARM= $(GO) env GOARM)
- GO_BUILD_PLATFORM ?= $(GOHOSTOS)-$(GOHOSTARCH)v$(GOHOSTARM)
-else
- GO_BUILD_PLATFORM ?= $(GOHOSTOS)-$(GOHOSTARCH)
-endif
-
-PROMU_VERSION ?= 0.4.0
-PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz
-
-GOLANGCI_LINT :=
-GOLANGCI_LINT_OPTS ?=
-GOLANGCI_LINT_VERSION ?= v1.16.0
-# golangci-lint only supports linux, darwin and windows platforms on i386/amd64.
-# windows isn't included here because of the path separator being different.
-ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
- ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386))
- GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint
- endif
-endif
-
-PREFIX ?= $(shell pwd)
-BIN_DIR ?= $(shell pwd)
-DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD))
-DOCKERFILE_PATH ?= ./
-DOCKER_REPO ?= prom
-
-DOCKER_ARCHS ?= amd64
-
-BUILD_DOCKER_ARCHS = $(addprefix common-docker-,$(DOCKER_ARCHS))
-PUBLISH_DOCKER_ARCHS = $(addprefix common-docker-publish-,$(DOCKER_ARCHS))
-TAG_DOCKER_ARCHS = $(addprefix common-docker-tag-latest-,$(DOCKER_ARCHS))
-
-ifeq ($(GOHOSTARCH),amd64)
- ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux freebsd darwin windows))
- # Only supported on amd64
- test-flags := -race
- endif
-endif
-
-# This rule is used to forward a target like "build" to "common-build". This
-# allows a new "build" target to be defined in a Makefile which includes this
-# one and override "common-build" without override warnings.
-%: common-% ;
-
-.PHONY: common-all
-common-all: precheck style check_license lint unused build test
-
-.PHONY: common-style
-common-style:
- @echo ">> checking code style"
- @fmtRes=$$($(GOFMT) -d $$(find . -path ./vendor -prune -o -name '*.go' -print)); \
- if [ -n "$${fmtRes}" ]; then \
- echo "gofmt checking failed!"; echo "$${fmtRes}"; echo; \
- echo "Please ensure you are using $$($(GO) version) for formatting code."; \
- exit 1; \
- fi
-
-.PHONY: common-check_license
-common-check_license:
- @echo ">> checking license header"
- @licRes=$$(for file in $$(find . -type f -iname '*.go' ! -path './vendor/*') ; do \
- awk 'NR<=3' $$file | grep -Eq "(Copyright|generated|GENERATED)" || echo $$file; \
- done); \
- if [ -n "$${licRes}" ]; then \
- echo "license header checking failed:"; echo "$${licRes}"; \
- exit 1; \
- fi
-
-.PHONY: common-deps
-common-deps:
- @echo ">> getting dependencies"
-ifdef GO111MODULE
- GO111MODULE=$(GO111MODULE) $(GO) mod download
-else
- $(GO) get $(GOOPTS) -t ./...
-endif
-
-.PHONY: common-test-short
-common-test-short:
- @echo ">> running short tests"
- GO111MODULE=$(GO111MODULE) $(GO) test -short $(GOOPTS) $(pkgs)
-
-.PHONY: common-test
-common-test:
- @echo ">> running all tests"
- GO111MODULE=$(GO111MODULE) $(GO) test $(test-flags) $(GOOPTS) $(pkgs)
-
-.PHONY: common-format
-common-format:
- @echo ">> formatting code"
- GO111MODULE=$(GO111MODULE) $(GO) fmt $(pkgs)
-
-.PHONY: common-vet
-common-vet:
- @echo ">> vetting code"
- GO111MODULE=$(GO111MODULE) $(GO) vet $(GOOPTS) $(pkgs)
-
-.PHONY: common-lint
-common-lint: $(GOLANGCI_LINT)
-ifdef GOLANGCI_LINT
- @echo ">> running golangci-lint"
-ifdef GO111MODULE
-# 'go list' needs to be executed before staticcheck to prepopulate the modules cache.
-# Otherwise staticcheck might fail randomly for some reason not yet explained.
- GO111MODULE=$(GO111MODULE) $(GO) list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null
- GO111MODULE=$(GO111MODULE) $(GOLANGCI_LINT) run $(GOLANGCI_LINT_OPTS) $(pkgs)
-else
- $(GOLANGCI_LINT) run $(pkgs)
-endif
-endif
-
-# For backward-compatibility.
-.PHONY: common-staticcheck
-common-staticcheck: lint
-
-.PHONY: common-unused
-common-unused: $(GOVENDOR)
-ifdef GOVENDOR
- @echo ">> running check for unused packages"
- @$(GOVENDOR) list +unused | grep . && exit 1 || echo 'No unused packages'
-else
-ifdef GO111MODULE
- @echo ">> running check for unused/missing packages in go.mod"
- GO111MODULE=$(GO111MODULE) $(GO) mod tidy
-ifeq (,$(wildcard vendor))
- @git diff --exit-code -- go.sum go.mod
-else
- @echo ">> running check for unused packages in vendor/"
- GO111MODULE=$(GO111MODULE) $(GO) mod vendor
- @git diff --exit-code -- go.sum go.mod vendor/
-endif
-endif
-endif
-
-.PHONY: common-build
-common-build: promu
- @echo ">> building binaries"
- GO111MODULE=$(GO111MODULE) $(PROMU) build --prefix $(PREFIX)
-
-.PHONY: common-tarball
-common-tarball: promu
- @echo ">> building release tarball"
- $(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)
-
-.PHONY: common-docker $(BUILD_DOCKER_ARCHS)
-common-docker: $(BUILD_DOCKER_ARCHS)
-$(BUILD_DOCKER_ARCHS): common-docker-%:
- docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" \
- --build-arg ARCH="$*" \
- --build-arg OS="linux" \
- $(DOCKERFILE_PATH)
-
-.PHONY: common-docker-publish $(PUBLISH_DOCKER_ARCHS)
-common-docker-publish: $(PUBLISH_DOCKER_ARCHS)
-$(PUBLISH_DOCKER_ARCHS): common-docker-publish-%:
- docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)"
-
-.PHONY: common-docker-tag-latest $(TAG_DOCKER_ARCHS)
-common-docker-tag-latest: $(TAG_DOCKER_ARCHS)
-$(TAG_DOCKER_ARCHS): common-docker-tag-latest-%:
- docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:latest"
-
-.PHONY: common-docker-manifest
-common-docker-manifest:
- DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create -a "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" $(foreach ARCH,$(DOCKER_ARCHS),$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$(ARCH):$(DOCKER_IMAGE_TAG))
- DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)"
-
-.PHONY: promu
-promu: $(PROMU)
-
-$(PROMU):
- $(eval PROMU_TMP := $(shell mktemp -d))
- curl -s -L $(PROMU_URL) | tar -xvzf - -C $(PROMU_TMP)
- mkdir -p $(FIRST_GOPATH)/bin
- cp $(PROMU_TMP)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM)/promu $(FIRST_GOPATH)/bin/promu
- rm -r $(PROMU_TMP)
-
-.PHONY: proto
-proto:
- @echo ">> generating code from proto files"
- @./scripts/genproto.sh
-
-ifdef GOLANGCI_LINT
-$(GOLANGCI_LINT):
- mkdir -p $(FIRST_GOPATH)/bin
- curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/$(GOLANGCI_LINT_VERSION)/install.sh \
- | sed -e '/install -d/d' \
- | sh -s -- -b $(FIRST_GOPATH)/bin $(GOLANGCI_LINT_VERSION)
-endif
-
-ifdef GOVENDOR
-.PHONY: $(GOVENDOR)
-$(GOVENDOR):
- GOOS= GOARCH= $(GO) get -u github.com/kardianos/govendor
-endif
-
-.PHONY: precheck
-precheck::
-
-define PRECHECK_COMMAND_template =
-precheck:: $(1)_precheck
-
-PRECHECK_COMMAND_$(1) ?= $(1) $$(strip $$(PRECHECK_OPTIONS_$(1)))
-.PHONY: $(1)_precheck
-$(1)_precheck:
- @if ! $$(PRECHECK_COMMAND_$(1)) 1>/dev/null 2>&1; then \
- echo "Execution of '$$(PRECHECK_COMMAND_$(1))' command failed. Is $(1) installed?"; \
- exit 1; \
- fi
-endef
diff --git a/vendor/github.com/prometheus/procfs/NOTICE b/vendor/github.com/prometheus/procfs/NOTICE
deleted file mode 100644
index 53c5e9a..0000000
--- a/vendor/github.com/prometheus/procfs/NOTICE
+++ /dev/null
@@ -1,7 +0,0 @@
-procfs provides functions to retrieve system, kernel and process
-metrics from the pseudo-filesystem proc.
-
-Copyright 2014-2015 The Prometheus Authors
-
-This product includes software developed at
-SoundCloud Ltd. (http://soundcloud.com/).
diff --git a/vendor/github.com/prometheus/procfs/README.md b/vendor/github.com/prometheus/procfs/README.md
deleted file mode 100644
index 55d1e32..0000000
--- a/vendor/github.com/prometheus/procfs/README.md
+++ /dev/null
@@ -1,61 +0,0 @@
-# procfs
-
-This package provides functions to retrieve system, kernel, and process
-metrics from the pseudo-filesystems /proc and /sys.
-
-*WARNING*: This package is a work in progress. Its API may still break in
-backwards-incompatible ways without warnings. Use it at your own risk.
-
-[![GoDoc](https://godoc.org/github.com/prometheus/procfs?status.png)](https://godoc.org/github.com/prometheus/procfs)
-[![Build Status](https://travis-ci.org/prometheus/procfs.svg?branch=master)](https://travis-ci.org/prometheus/procfs)
-[![Go Report Card](https://goreportcard.com/badge/github.com/prometheus/procfs)](https://goreportcard.com/report/github.com/prometheus/procfs)
-
-## Usage
-
-The procfs library is organized by packages based on whether the gathered data is coming from
-/proc, /sys, or both. Each package contains an `FS` type which represents the path to either /proc,
-/sys, or both. For example, cpu statistics are gathered from
-`/proc/stat` and are available via the root procfs package. First, the proc filesystem mount
-point is initialized, and then the stat information is read.
-
-```go
-fs, err := procfs.NewFS("/proc")
-stats, err := fs.Stat()
-```
-
-Some sub-packages such as `blockdevice`, require access to both the proc and sys filesystems.
-
-```go
- fs, err := blockdevice.NewFS("/proc", "/sys")
- stats, err := fs.ProcDiskstats()
-```
-
-## Package Organization
-
-The packages in this project are organized according to (1) whether the data comes from the `/proc` or
-`/sys` filesystem and (2) the type of information being retrieved. For example, most process information
-can be gathered from the functions in the root `procfs` package. Information about block devices such as disk drives
-is available in the `blockdevices` sub-package.
-
-## Building and Testing
-
-The procfs library is intended to be built as part of another application, so there are no distributable binaries.
-However, most of the API includes unit tests which can be run with `make test`.
-
-### Updating Test Fixtures
-
-The procfs library includes a set of test fixtures which include many example files from
-the `/proc` and `/sys` filesystems. These fixtures are included as a [ttar](https://github.com/ideaship/ttar) file
-which is extracted automatically during testing. To add/update the test fixtures, first
-ensure the `fixtures` directory is up to date by removing the existing directory and then
-extracting the ttar file using `make fixtures/.unpacked` or just `make test`.
-
-```bash
-rm -rf fixtures
-make test
-```
-
-Next, make the required changes to the extracted files in the `fixtures` directory. When
-the changes are complete, run `make update_fixtures` to create a new `fixtures.ttar` file
-based on the updated `fixtures` directory. And finally, verify the changes using
-`git diff fixtures.ttar`.
diff --git a/vendor/github.com/prometheus/procfs/arp.go b/vendor/github.com/prometheus/procfs/arp.go
deleted file mode 100644
index 916c918..0000000
--- a/vendor/github.com/prometheus/procfs/arp.go
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "fmt"
- "io/ioutil"
- "net"
- "strings"
-)
-
-// ARPEntry contains a single row of the columnar data represented in
-// /proc/net/arp.
-type ARPEntry struct {
- // IP address
- IPAddr net.IP
- // MAC address
- HWAddr net.HardwareAddr
- // Name of the device
- Device string
-}
-
-// GatherARPEntries retrieves all the ARP entries, parse the relevant columns,
-// and then return a slice of ARPEntry's.
-func (fs FS) GatherARPEntries() ([]ARPEntry, error) {
- data, err := ioutil.ReadFile(fs.proc.Path("net/arp"))
- if err != nil {
- return nil, fmt.Errorf("error reading arp %s: %s", fs.proc.Path("net/arp"), err)
- }
-
- return parseARPEntries(data)
-}
-
-func parseARPEntries(data []byte) ([]ARPEntry, error) {
- lines := strings.Split(string(data), "\n")
- entries := make([]ARPEntry, 0)
- var err error
- const (
- expectedDataWidth = 6
- expectedHeaderWidth = 9
- )
- for _, line := range lines {
- columns := strings.Fields(line)
- width := len(columns)
-
- if width == expectedHeaderWidth || width == 0 {
- continue
- } else if width == expectedDataWidth {
- entry, err := parseARPEntry(columns)
- if err != nil {
- return []ARPEntry{}, fmt.Errorf("failed to parse ARP entry: %s", err)
- }
- entries = append(entries, entry)
- } else {
- return []ARPEntry{}, fmt.Errorf("%d columns were detected, but %d were expected", width, expectedDataWidth)
- }
-
- }
-
- return entries, err
-}
-
-func parseARPEntry(columns []string) (ARPEntry, error) {
- ip := net.ParseIP(columns[0])
- mac := net.HardwareAddr(columns[3])
-
- entry := ARPEntry{
- IPAddr: ip,
- HWAddr: mac,
- Device: columns[5],
- }
-
- return entry, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/buddyinfo.go b/vendor/github.com/prometheus/procfs/buddyinfo.go
deleted file mode 100644
index 10bd067..0000000
--- a/vendor/github.com/prometheus/procfs/buddyinfo.go
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2017 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "fmt"
- "io"
- "os"
- "strconv"
- "strings"
-)
-
-// A BuddyInfo is the details parsed from /proc/buddyinfo.
-// The data is comprised of an array of free fragments of each size.
-// The sizes are 2^n*PAGE_SIZE, where n is the array index.
-type BuddyInfo struct {
- Node string
- Zone string
- Sizes []float64
-}
-
-// BuddyInfo reads the buddyinfo statistics from the specified `proc` filesystem.
-func (fs FS) BuddyInfo() ([]BuddyInfo, error) {
- file, err := os.Open(fs.proc.Path("buddyinfo"))
- if err != nil {
- return nil, err
- }
- defer file.Close()
-
- return parseBuddyInfo(file)
-}
-
-func parseBuddyInfo(r io.Reader) ([]BuddyInfo, error) {
- var (
- buddyInfo = []BuddyInfo{}
- scanner = bufio.NewScanner(r)
- bucketCount = -1
- )
-
- for scanner.Scan() {
- var err error
- line := scanner.Text()
- parts := strings.Fields(line)
-
- if len(parts) < 4 {
- return nil, fmt.Errorf("invalid number of fields when parsing buddyinfo")
- }
-
- node := strings.TrimRight(parts[1], ",")
- zone := strings.TrimRight(parts[3], ",")
- arraySize := len(parts[4:])
-
- if bucketCount == -1 {
- bucketCount = arraySize
- } else {
- if bucketCount != arraySize {
- return nil, fmt.Errorf("mismatch in number of buddyinfo buckets, previous count %d, new count %d", bucketCount, arraySize)
- }
- }
-
- sizes := make([]float64, arraySize)
- for i := 0; i < arraySize; i++ {
- sizes[i], err = strconv.ParseFloat(parts[i+4], 64)
- if err != nil {
- return nil, fmt.Errorf("invalid value in buddyinfo: %s", err)
- }
- }
-
- buddyInfo = append(buddyInfo, BuddyInfo{node, zone, sizes})
- }
-
- return buddyInfo, scanner.Err()
-}
diff --git a/vendor/github.com/prometheus/procfs/cpuinfo.go b/vendor/github.com/prometheus/procfs/cpuinfo.go
deleted file mode 100644
index 2e02215..0000000
--- a/vendor/github.com/prometheus/procfs/cpuinfo.go
+++ /dev/null
@@ -1,167 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// CPUInfo contains general information about a system CPU found in /proc/cpuinfo
-type CPUInfo struct {
- Processor uint
- VendorID string
- CPUFamily string
- Model string
- ModelName string
- Stepping string
- Microcode string
- CPUMHz float64
- CacheSize string
- PhysicalID string
- Siblings uint
- CoreID string
- CPUCores uint
- APICID string
- InitialAPICID string
- FPU string
- FPUException string
- CPUIDLevel uint
- WP string
- Flags []string
- Bugs []string
- BogoMips float64
- CLFlushSize uint
- CacheAlignment uint
- AddressSizes string
- PowerManagement string
-}
-
-// CPUInfo returns information about current system CPUs.
-// See https://www.kernel.org/doc/Documentation/filesystems/proc.txt
-func (fs FS) CPUInfo() ([]CPUInfo, error) {
- data, err := util.ReadFileNoStat(fs.proc.Path("cpuinfo"))
- if err != nil {
- return nil, err
- }
- return parseCPUInfo(data)
-}
-
-// parseCPUInfo parses data from /proc/cpuinfo
-func parseCPUInfo(info []byte) ([]CPUInfo, error) {
- cpuinfo := []CPUInfo{}
- i := -1
- scanner := bufio.NewScanner(bytes.NewReader(info))
- for scanner.Scan() {
- line := scanner.Text()
- if strings.TrimSpace(line) == "" {
- continue
- }
- field := strings.SplitN(line, ": ", 2)
- switch strings.TrimSpace(field[0]) {
- case "processor":
- cpuinfo = append(cpuinfo, CPUInfo{}) // start of the next processor
- i++
- v, err := strconv.ParseUint(field[1], 0, 32)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].Processor = uint(v)
- case "vendor_id":
- cpuinfo[i].VendorID = field[1]
- case "cpu family":
- cpuinfo[i].CPUFamily = field[1]
- case "model":
- cpuinfo[i].Model = field[1]
- case "model name":
- cpuinfo[i].ModelName = field[1]
- case "stepping":
- cpuinfo[i].Stepping = field[1]
- case "microcode":
- cpuinfo[i].Microcode = field[1]
- case "cpu MHz":
- v, err := strconv.ParseFloat(field[1], 64)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].CPUMHz = v
- case "cache size":
- cpuinfo[i].CacheSize = field[1]
- case "physical id":
- cpuinfo[i].PhysicalID = field[1]
- case "siblings":
- v, err := strconv.ParseUint(field[1], 0, 32)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].Siblings = uint(v)
- case "core id":
- cpuinfo[i].CoreID = field[1]
- case "cpu cores":
- v, err := strconv.ParseUint(field[1], 0, 32)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].CPUCores = uint(v)
- case "apicid":
- cpuinfo[i].APICID = field[1]
- case "initial apicid":
- cpuinfo[i].InitialAPICID = field[1]
- case "fpu":
- cpuinfo[i].FPU = field[1]
- case "fpu_exception":
- cpuinfo[i].FPUException = field[1]
- case "cpuid level":
- v, err := strconv.ParseUint(field[1], 0, 32)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].CPUIDLevel = uint(v)
- case "wp":
- cpuinfo[i].WP = field[1]
- case "flags":
- cpuinfo[i].Flags = strings.Fields(field[1])
- case "bugs":
- cpuinfo[i].Bugs = strings.Fields(field[1])
- case "bogomips":
- v, err := strconv.ParseFloat(field[1], 64)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].BogoMips = v
- case "clflush size":
- v, err := strconv.ParseUint(field[1], 0, 32)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].CLFlushSize = uint(v)
- case "cache_alignment":
- v, err := strconv.ParseUint(field[1], 0, 32)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].CacheAlignment = uint(v)
- case "address sizes":
- cpuinfo[i].AddressSizes = field[1]
- case "power management":
- cpuinfo[i].PowerManagement = field[1]
- }
- }
- return cpuinfo, nil
-
-}
diff --git a/vendor/github.com/prometheus/procfs/crypto.go b/vendor/github.com/prometheus/procfs/crypto.go
deleted file mode 100644
index 19d4041..0000000
--- a/vendor/github.com/prometheus/procfs/crypto.go
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bytes"
- "fmt"
- "io/ioutil"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// Crypto holds info parsed from /proc/crypto.
-type Crypto struct {
- Alignmask *uint64
- Async bool
- Blocksize *uint64
- Chunksize *uint64
- Ctxsize *uint64
- Digestsize *uint64
- Driver string
- Geniv string
- Internal string
- Ivsize *uint64
- Maxauthsize *uint64
- MaxKeysize *uint64
- MinKeysize *uint64
- Module string
- Name string
- Priority *int64
- Refcnt *int64
- Seedsize *uint64
- Selftest string
- Type string
- Walksize *uint64
-}
-
-// Crypto parses an crypto-file (/proc/crypto) and returns a slice of
-// structs containing the relevant info. More information available here:
-// https://kernel.readthedocs.io/en/sphinx-samples/crypto-API.html
-func (fs FS) Crypto() ([]Crypto, error) {
- data, err := ioutil.ReadFile(fs.proc.Path("crypto"))
- if err != nil {
- return nil, fmt.Errorf("error parsing crypto %s: %s", fs.proc.Path("crypto"), err)
- }
- crypto, err := parseCrypto(data)
- if err != nil {
- return nil, fmt.Errorf("error parsing crypto %s: %s", fs.proc.Path("crypto"), err)
- }
- return crypto, nil
-}
-
-func parseCrypto(cryptoData []byte) ([]Crypto, error) {
- crypto := []Crypto{}
-
- cryptoBlocks := bytes.Split(cryptoData, []byte("\n\n"))
-
- for _, block := range cryptoBlocks {
- var newCryptoElem Crypto
-
- lines := strings.Split(string(block), "\n")
- for _, line := range lines {
- if strings.TrimSpace(line) == "" || line[0] == ' ' {
- continue
- }
- fields := strings.Split(line, ":")
- key := strings.TrimSpace(fields[0])
- value := strings.TrimSpace(fields[1])
- vp := util.NewValueParser(value)
-
- switch strings.TrimSpace(key) {
- case "async":
- b, err := strconv.ParseBool(value)
- if err == nil {
- newCryptoElem.Async = b
- }
- case "blocksize":
- newCryptoElem.Blocksize = vp.PUInt64()
- case "chunksize":
- newCryptoElem.Chunksize = vp.PUInt64()
- case "digestsize":
- newCryptoElem.Digestsize = vp.PUInt64()
- case "driver":
- newCryptoElem.Driver = value
- case "geniv":
- newCryptoElem.Geniv = value
- case "internal":
- newCryptoElem.Internal = value
- case "ivsize":
- newCryptoElem.Ivsize = vp.PUInt64()
- case "maxauthsize":
- newCryptoElem.Maxauthsize = vp.PUInt64()
- case "max keysize":
- newCryptoElem.MaxKeysize = vp.PUInt64()
- case "min keysize":
- newCryptoElem.MinKeysize = vp.PUInt64()
- case "module":
- newCryptoElem.Module = value
- case "name":
- newCryptoElem.Name = value
- case "priority":
- newCryptoElem.Priority = vp.PInt64()
- case "refcnt":
- newCryptoElem.Refcnt = vp.PInt64()
- case "seedsize":
- newCryptoElem.Seedsize = vp.PUInt64()
- case "selftest":
- newCryptoElem.Selftest = value
- case "type":
- newCryptoElem.Type = value
- case "walksize":
- newCryptoElem.Walksize = vp.PUInt64()
- }
- }
- crypto = append(crypto, newCryptoElem)
- }
- return crypto, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/doc.go b/vendor/github.com/prometheus/procfs/doc.go
deleted file mode 100644
index e2acd6d..0000000
--- a/vendor/github.com/prometheus/procfs/doc.go
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2014 Prometheus Team
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package procfs provides functions to retrieve system, kernel and process
-// metrics from the pseudo-filesystem proc.
-//
-// Example:
-//
-// package main
-//
-// import (
-// "fmt"
-// "log"
-//
-// "github.com/prometheus/procfs"
-// )
-//
-// func main() {
-// p, err := procfs.Self()
-// if err != nil {
-// log.Fatalf("could not get process: %s", err)
-// }
-//
-// stat, err := p.NewStat()
-// if err != nil {
-// log.Fatalf("could not get process stat: %s", err)
-// }
-//
-// fmt.Printf("command: %s\n", stat.Comm)
-// fmt.Printf("cpu time: %fs\n", stat.CPUTime())
-// fmt.Printf("vsize: %dB\n", stat.VirtualMemory())
-// fmt.Printf("rss: %dB\n", stat.ResidentMemory())
-// }
-//
-package procfs
diff --git a/vendor/github.com/prometheus/procfs/fixtures.ttar b/vendor/github.com/prometheus/procfs/fixtures.ttar
deleted file mode 100644
index c50a18a..0000000
--- a/vendor/github.com/prometheus/procfs/fixtures.ttar
+++ /dev/null
@@ -1,5318 +0,0 @@
-# Archive created by ttar -c -f fixtures.ttar fixtures/
-Directory: fixtures
-Mode: 775
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/proc
-Mode: 775
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/proc/26231
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/cmdline
-Lines: 1
-vimNULLBYTEtest.goNULLBYTE+10NULLBYTEEOF
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/comm
-Lines: 1
-vim
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/cwd
-SymlinkTo: /usr/bin
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/environ
-Lines: 1
-PATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binNULLBYTEHOSTNAME=cd24e11f73a5NULLBYTETERM=xtermNULLBYTEGOLANG_VERSION=1.12.5NULLBYTEGOPATH=/goNULLBYTEHOME=/rootNULLBYTEEOF
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/exe
-SymlinkTo: /usr/bin/vim
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/proc/26231/fd
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/fd/0
-SymlinkTo: ../../symlinktargets/abc
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/fd/1
-SymlinkTo: ../../symlinktargets/def
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/fd/10
-SymlinkTo: ../../symlinktargets/xyz
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/fd/2
-SymlinkTo: ../../symlinktargets/ghi
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/fd/3
-SymlinkTo: ../../symlinktargets/uvw
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/proc/26231/fdinfo
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/fdinfo/0
-Lines: 6
-pos: 0
-flags: 02004000
-mnt_id: 13
-inotify wd:3 ino:1 sdev:34 mask:fce ignored_mask:0 fhandle-bytes:c fhandle-type:81 f_handle:000000000100000000000000
-inotify wd:2 ino:1300016 sdev:fd00002 mask:fce ignored_mask:0 fhandle-bytes:8 fhandle-type:1 f_handle:16003001ed3f022a
-inotify wd:1 ino:2e0001 sdev:fd00000 mask:fce ignored_mask:0 fhandle-bytes:8 fhandle-type:1 f_handle:01002e00138e7c65
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/fdinfo/1
-Lines: 4
-pos: 0
-flags: 02004002
-mnt_id: 13
-eventfd-count: 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/fdinfo/10
-Lines: 3
-pos: 0
-flags: 02004002
-mnt_id: 9
-Mode: 400
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/fdinfo/2
-Lines: 3
-pos: 0
-flags: 02004002
-mnt_id: 9
-Mode: 400
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/fdinfo/3
-Lines: 3
-pos: 0
-flags: 02004002
-mnt_id: 9
-Mode: 400
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/io
-Lines: 7
-rchar: 750339
-wchar: 818609
-syscr: 7405
-syscw: 5245
-read_bytes: 1024
-write_bytes: 2048
-cancelled_write_bytes: -1024
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/limits
-Lines: 17
-Limit Soft Limit Hard Limit Units
-Max cpu time unlimited unlimited seconds
-Max file size unlimited unlimited bytes
-Max data size unlimited unlimited bytes
-Max stack size 8388608 unlimited bytes
-Max core file size 0 unlimited bytes
-Max resident set unlimited unlimited bytes
-Max processes 62898 62898 processes
-Max open files 2048 4096 files
-Max locked memory 65536 65536 bytes
-Max address space 8589934592 unlimited bytes
-Max file locks unlimited unlimited locks
-Max pending signals 62898 62898 signals
-Max msgqueue size 819200 819200 bytes
-Max nice priority 0 0
-Max realtime priority 0 0
-Max realtime timeout unlimited unlimited us
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/mountstats
-Lines: 20
-device rootfs mounted on / with fstype rootfs
-device sysfs mounted on /sys with fstype sysfs
-device proc mounted on /proc with fstype proc
-device /dev/sda1 mounted on / with fstype ext4
-device 192.168.1.1:/srv/test mounted on /mnt/nfs/test with fstype nfs4 statvers=1.1
- opts: rw,vers=4.0,rsize=1048576,wsize=1048576,namlen=255,acregmin=3,acregmax=60,acdirmin=30,acdirmax=60,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.1,clientaddr=192.168.1.5,local_lock=none
- age: 13968
- caps: caps=0xfff7,wtmult=512,dtsize=32768,bsize=0,namlen=255
- nfsv4: bm0=0xfdffafff,bm1=0xf9be3e,bm2=0x0,acl=0x0,pnfs=not configured
- sec: flavor=1,pseudoflavor=1
- events: 52 226 0 0 1 13 398 0 0 331 0 47 0 0 77 0 0 77 0 0 0 0 0 0 0 0 0
- bytes: 1207640230 0 0 0 1210214218 0 295483 0
- RPC iostats version: 1.0 p/v: 100003/4 (nfs)
- xprt: tcp 832 0 1 0 11 6428 6428 0 12154 0 24 26 5726
- per-op statistics
- NULL: 0 0 0 0 0 0 0 0
- READ: 1298 1298 0 207680 1210292152 6 79386 79407
- WRITE: 0 0 0 0 0 0 0 0
- ACCESS: 2927395007 2927394995 0 526931094212 362996810236 18446743919241604546 1667369447 1953587717
-
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/proc/26231/net
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/net/dev
-Lines: 4
-Inter-| Receive | Transmit
- face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
- lo: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- eth0: 438 5 0 0 0 0 0 0 648 8 0 0 0 0 0 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/proc/26231/ns
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/ns/mnt
-SymlinkTo: mnt:[4026531840]
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/ns/net
-SymlinkTo: net:[4026531993]
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/root
-SymlinkTo: /
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/schedstat
-Lines: 1
-411605849 93680043 79
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/stat
-Lines: 1
-26231 (vim) R 5392 7446 5392 34835 7446 4218880 32533 309516 26 82 1677 44 158 99 20 0 1 0 82375 56274944 1981 18446744073709551615 4194304 6294284 140736914091744 140736914087944 139965136429984 0 0 12288 1870679807 0 0 0 17 0 0 0 31 0 0 8391624 8481048 16420864 140736914093252 140736914093279 140736914093279 140736914096107 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26231/status
-Lines: 53
-
-Name: prometheus
-Umask: 0022
-State: S (sleeping)
-Tgid: 26231
-Ngid: 0
-Pid: 26231
-PPid: 1
-TracerPid: 0
-Uid: 0 0 0 0
-Gid: 0 0 0 0
-FDSize: 128
-Groups:
-NStgid: 1
-NSpid: 1
-NSpgid: 1
-NSsid: 1
-VmPeak: 58472 kB
-VmSize: 58440 kB
-VmLck: 0 kB
-VmPin: 0 kB
-VmHWM: 8028 kB
-VmRSS: 6716 kB
-RssAnon: 2092 kB
-RssFile: 4624 kB
-RssShmem: 0 kB
-VmData: 2580 kB
-VmStk: 136 kB
-VmExe: 948 kB
-VmLib: 6816 kB
-VmPTE: 128 kB
-VmPMD: 12 kB
-VmSwap: 660 kB
-HugetlbPages: 0 kB
-Threads: 1
-SigQ: 8/63965
-SigPnd: 0000000000000000
-ShdPnd: 0000000000000000
-SigBlk: 7be3c0fe28014a03
-SigIgn: 0000000000001000
-SigCgt: 00000001800004ec
-CapInh: 0000000000000000
-CapPrm: 0000003fffffffff
-CapEff: 0000003fffffffff
-CapBnd: 0000003fffffffff
-CapAmb: 0000000000000000
-Seccomp: 0
-Cpus_allowed: ff
-Cpus_allowed_list: 0-7
-Mems_allowed: 00000000,00000001
-Mems_allowed_list: 0
-voluntary_ctxt_switches: 4742839
-nonvoluntary_ctxt_switches: 1727500
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/proc/26232
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26232/cmdline
-Lines: 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26232/comm
-Lines: 1
-ata_sff
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26232/cwd
-SymlinkTo: /does/not/exist
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/proc/26232/fd
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26232/fd/0
-SymlinkTo: ../../symlinktargets/abc
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26232/fd/1
-SymlinkTo: ../../symlinktargets/def
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26232/fd/2
-SymlinkTo: ../../symlinktargets/ghi
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26232/fd/3
-SymlinkTo: ../../symlinktargets/uvw
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26232/fd/4
-SymlinkTo: ../../symlinktargets/xyz
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26232/limits
-Lines: 17
-Limit Soft Limit Hard Limit Units
-Max cpu time unlimited unlimited seconds
-Max file size unlimited unlimited bytes
-Max data size unlimited unlimited bytes
-Max stack size 8388608 unlimited bytes
-Max core file size 0 unlimited bytes
-Max resident set unlimited unlimited bytes
-Max processes 29436 29436 processes
-Max open files 1024 4096 files
-Max locked memory 65536 65536 bytes
-Max address space unlimited unlimited bytes
-Max file locks unlimited unlimited locks
-Max pending signals 29436 29436 signals
-Max msgqueue size 819200 819200 bytes
-Max nice priority 0 0
-Max realtime priority 0 0
-Max realtime timeout unlimited unlimited us
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26232/root
-SymlinkTo: /does/not/exist
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26232/stat
-Lines: 1
-33 (ata_sff) S 2 0 0 0 -1 69238880 0 0 0 0 0 0 0 0 0 -20 1 0 5 0 0 18446744073709551615 0 0 0 0 0 0 0 2147483647 0 18446744073709551615 0 0 17 1 0 0 0 0 0 0 0 0 0 0 0 0 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/proc/26233
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26233/cmdline
-Lines: 1
-com.github.uiautomatorNULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTEEOF
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/26233/schedstat
-Lines: 8
- ____________________________________
-< this is a malformed schedstat file >
- ------------------------------------
- \ ^__^
- \ (oo)\_______
- (__)\ )\/\
- ||----w |
- || ||
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/proc/584
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/584/stat
-Lines: 2
-1020 ((a b ) ( c d) ) R 28378 1020 28378 34842 1020 4218880 286 0 0 0 0 0 0 0 20 0 1 0 10839175 10395648 155 18446744073709551615 4194304 4238788 140736466511168 140736466511168 140609271124624 0 0 0 0 0 0 0 17 5 0 0 0 0 0 6336016 6337300 25579520 140736466515030 140736466515061 140736466515061 140736466518002 0
-#!/bin/cat /proc/self/stat
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/buddyinfo
-Lines: 3
-Node 0, zone DMA 1 0 1 0 2 1 1 0 1 1 3
-Node 0, zone DMA32 759 572 791 475 194 45 12 0 0 0 0
-Node 0, zone Normal 4381 1093 185 1530 567 102 4 0 0 0 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/cpuinfo
-Lines: 216
-processor : 0
-vendor_id : GenuineIntel
-cpu family : 6
-model : 142
-model name : Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
-stepping : 10
-microcode : 0xb4
-cpu MHz : 799.998
-cache size : 8192 KB
-physical id : 0
-siblings : 8
-core id : 0
-cpu cores : 4
-apicid : 0
-initial apicid : 0
-fpu : yes
-fpu_exception : yes
-cpuid level : 22
-wp : yes
-flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d
-bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs
-bogomips : 4224.00
-clflush size : 64
-cache_alignment : 64
-address sizes : 39 bits physical, 48 bits virtual
-power management:
-
-processor : 1
-vendor_id : GenuineIntel
-cpu family : 6
-model : 142
-model name : Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
-stepping : 10
-microcode : 0xb4
-cpu MHz : 800.037
-cache size : 8192 KB
-physical id : 0
-siblings : 8
-core id : 1
-cpu cores : 4
-apicid : 2
-initial apicid : 2
-fpu : yes
-fpu_exception : yes
-cpuid level : 22
-wp : yes
-flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d
-bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs
-bogomips : 4224.00
-clflush size : 64
-cache_alignment : 64
-address sizes : 39 bits physical, 48 bits virtual
-power management:
-
-processor : 2
-vendor_id : GenuineIntel
-cpu family : 6
-model : 142
-model name : Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
-stepping : 10
-microcode : 0xb4
-cpu MHz : 800.010
-cache size : 8192 KB
-physical id : 0
-siblings : 8
-core id : 2
-cpu cores : 4
-apicid : 4
-initial apicid : 4
-fpu : yes
-fpu_exception : yes
-cpuid level : 22
-wp : yes
-flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d
-bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs
-bogomips : 4224.00
-clflush size : 64
-cache_alignment : 64
-address sizes : 39 bits physical, 48 bits virtual
-power management:
-
-processor : 3
-vendor_id : GenuineIntel
-cpu family : 6
-model : 142
-model name : Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
-stepping : 10
-microcode : 0xb4
-cpu MHz : 800.028
-cache size : 8192 KB
-physical id : 0
-siblings : 8
-core id : 3
-cpu cores : 4
-apicid : 6
-initial apicid : 6
-fpu : yes
-fpu_exception : yes
-cpuid level : 22
-wp : yes
-flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d
-bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs
-bogomips : 4224.00
-clflush size : 64
-cache_alignment : 64
-address sizes : 39 bits physical, 48 bits virtual
-power management:
-
-processor : 4
-vendor_id : GenuineIntel
-cpu family : 6
-model : 142
-model name : Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
-stepping : 10
-microcode : 0xb4
-cpu MHz : 799.989
-cache size : 8192 KB
-physical id : 0
-siblings : 8
-core id : 0
-cpu cores : 4
-apicid : 1
-initial apicid : 1
-fpu : yes
-fpu_exception : yes
-cpuid level : 22
-wp : yes
-flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d
-bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs
-bogomips : 4224.00
-clflush size : 64
-cache_alignment : 64
-address sizes : 39 bits physical, 48 bits virtual
-power management:
-
-processor : 5
-vendor_id : GenuineIntel
-cpu family : 6
-model : 142
-model name : Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
-stepping : 10
-microcode : 0xb4
-cpu MHz : 800.083
-cache size : 8192 KB
-physical id : 0
-siblings : 8
-core id : 1
-cpu cores : 4
-apicid : 3
-initial apicid : 3
-fpu : yes
-fpu_exception : yes
-cpuid level : 22
-wp : yes
-flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d
-bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs
-bogomips : 4224.00
-clflush size : 64
-cache_alignment : 64
-address sizes : 39 bits physical, 48 bits virtual
-power management:
-
-processor : 6
-vendor_id : GenuineIntel
-cpu family : 6
-model : 142
-model name : Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
-stepping : 10
-microcode : 0xb4
-cpu MHz : 800.017
-cache size : 8192 KB
-physical id : 0
-siblings : 8
-core id : 2
-cpu cores : 4
-apicid : 5
-initial apicid : 5
-fpu : yes
-fpu_exception : yes
-cpuid level : 22
-wp : yes
-flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d
-bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs
-bogomips : 4224.00
-clflush size : 64
-cache_alignment : 64
-address sizes : 39 bits physical, 48 bits virtual
-power management:
-
-processor : 7
-vendor_id : GenuineIntel
-cpu family : 6
-model : 142
-model name : Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
-stepping : 10
-microcode : 0xb4
-cpu MHz : 800.030
-cache size : 8192 KB
-physical id : 0
-siblings : 8
-core id : 3
-cpu cores : 4
-apicid : 7
-initial apicid : 7
-fpu : yes
-fpu_exception : yes
-cpuid level : 22
-wp : yes
-flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d
-bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs
-bogomips : 4224.00
-clflush size : 64
-cache_alignment : 64
-address sizes : 39 bits physical, 48 bits virtual
-power management:
-
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/crypto
-Lines: 971
-name : ccm(aes)
-driver : ccm_base(ctr(aes-aesni),cbcmac(aes-aesni))
-module : ccm
-priority : 300
-refcnt : 4
-selftest : passed
-internal : no
-type : aead
-async : no
-blocksize : 1
-ivsize : 16
-maxauthsize : 16
-geniv :
-
-name : cbcmac(aes)
-driver : cbcmac(aes-aesni)
-module : ccm
-priority : 300
-refcnt : 7
-selftest : passed
-internal : no
-type : shash
-blocksize : 1
-digestsize : 16
-
-name : ecdh
-driver : ecdh-generic
-module : ecdh_generic
-priority : 100
-refcnt : 1
-selftest : passed
-internal : no
-type : kpp
-
-name : ecb(arc4)
-driver : ecb(arc4)-generic
-module : arc4
-priority : 100
-refcnt : 1
-selftest : passed
-internal : no
-type : skcipher
-async : no
-blocksize : 1
-min keysize : 1
-max keysize : 256
-ivsize : 0
-chunksize : 1
-walksize : 1
-
-name : arc4
-driver : arc4-generic
-module : arc4
-priority : 0
-refcnt : 3
-selftest : passed
-internal : no
-type : cipher
-blocksize : 1
-min keysize : 1
-max keysize : 256
-
-name : crct10dif
-driver : crct10dif-pclmul
-module : crct10dif_pclmul
-priority : 200
-refcnt : 2
-selftest : passed
-internal : no
-type : shash
-blocksize : 1
-digestsize : 2
-
-name : crc32
-driver : crc32-pclmul
-module : crc32_pclmul
-priority : 200
-refcnt : 1
-selftest : passed
-internal : no
-type : shash
-blocksize : 1
-digestsize : 4
-
-name : __ghash
-driver : cryptd(__ghash-pclmulqdqni)
-module : kernel
-priority : 50
-refcnt : 1
-selftest : passed
-internal : yes
-type : ahash
-async : yes
-blocksize : 16
-digestsize : 16
-
-name : ghash
-driver : ghash-clmulni
-module : ghash_clmulni_intel
-priority : 400
-refcnt : 1
-selftest : passed
-internal : no
-type : ahash
-async : yes
-blocksize : 16
-digestsize : 16
-
-name : __ghash
-driver : __ghash-pclmulqdqni
-module : ghash_clmulni_intel
-priority : 0
-refcnt : 1
-selftest : passed
-internal : yes
-type : shash
-blocksize : 16
-digestsize : 16
-
-name : crc32c
-driver : crc32c-intel
-module : crc32c_intel
-priority : 200
-refcnt : 5
-selftest : passed
-internal : no
-type : shash
-blocksize : 1
-digestsize : 4
-
-name : cbc(aes)
-driver : cbc(aes-aesni)
-module : kernel
-priority : 300
-refcnt : 1
-selftest : passed
-internal : no
-type : skcipher
-async : no
-blocksize : 16
-min keysize : 16
-max keysize : 32
-ivsize : 16
-chunksize : 16
-walksize : 16
-
-name : ctr(aes)
-driver : ctr(aes-aesni)
-module : kernel
-priority : 300
-refcnt : 5
-selftest : passed
-internal : no
-type : skcipher
-async : no
-blocksize : 1
-min keysize : 16
-max keysize : 32
-ivsize : 16
-chunksize : 16
-walksize : 16
-
-name : pkcs1pad(rsa,sha256)
-driver : pkcs1pad(rsa-generic,sha256)
-module : kernel
-priority : 100
-refcnt : 1
-selftest : passed
-internal : no
-type : akcipher
-
-name : __xts(aes)
-driver : cryptd(__xts-aes-aesni)
-module : kernel
-priority : 451
-refcnt : 1
-selftest : passed
-internal : yes
-type : skcipher
-async : yes
-blocksize : 16
-min keysize : 32
-max keysize : 64
-ivsize : 16
-chunksize : 16
-walksize : 16
-
-name : xts(aes)
-driver : xts-aes-aesni
-module : kernel
-priority : 401
-refcnt : 1
-selftest : passed
-internal : no
-type : skcipher
-async : yes
-blocksize : 16
-min keysize : 32
-max keysize : 64
-ivsize : 16
-chunksize : 16
-walksize : 16
-
-name : __ctr(aes)
-driver : cryptd(__ctr-aes-aesni)
-module : kernel
-priority : 450
-refcnt : 1
-selftest : passed
-internal : yes
-type : skcipher
-async : yes
-blocksize : 1
-min keysize : 16
-max keysize : 32
-ivsize : 16
-chunksize : 16
-walksize : 16
-
-name : ctr(aes)
-driver : ctr-aes-aesni
-module : kernel
-priority : 400
-refcnt : 1
-selftest : passed
-internal : no
-type : skcipher
-async : yes
-blocksize : 1
-min keysize : 16
-max keysize : 32
-ivsize : 16
-chunksize : 16
-walksize : 16
-
-name : __cbc(aes)
-driver : cryptd(__cbc-aes-aesni)
-module : kernel
-priority : 450
-refcnt : 1
-selftest : passed
-internal : yes
-type : skcipher
-async : yes
-blocksize : 16
-min keysize : 16
-max keysize : 32
-ivsize : 16
-chunksize : 16
-walksize : 16
-
-name : cbc(aes)
-driver : cbc-aes-aesni
-module : kernel
-priority : 400
-refcnt : 1
-selftest : passed
-internal : no
-type : skcipher
-async : yes
-blocksize : 16
-min keysize : 16
-max keysize : 32
-ivsize : 16
-chunksize : 16
-walksize : 16
-
-name : __ecb(aes)
-driver : cryptd(__ecb-aes-aesni)
-module : kernel
-priority : 450
-refcnt : 1
-selftest : passed
-internal : yes
-type : skcipher
-async : yes
-blocksize : 16
-min keysize : 16
-max keysize : 32
-ivsize : 0
-chunksize : 16
-walksize : 16
-
-name : ecb(aes)
-driver : ecb-aes-aesni
-module : kernel
-priority : 400
-refcnt : 1
-selftest : passed
-internal : no
-type : skcipher
-async : yes
-blocksize : 16
-min keysize : 16
-max keysize : 32
-ivsize : 0
-chunksize : 16
-walksize : 16
-
-name : __generic-gcm-aes-aesni
-driver : cryptd(__driver-generic-gcm-aes-aesni)
-module : kernel
-priority : 50
-refcnt : 1
-selftest : passed
-internal : yes
-type : aead
-async : yes
-blocksize : 1
-ivsize : 12
-maxauthsize : 16
-geniv :
-
-name : gcm(aes)
-driver : generic-gcm-aesni
-module : kernel
-priority : 400
-refcnt : 1
-selftest : passed
-internal : no
-type : aead
-async : yes
-blocksize : 1
-ivsize : 12
-maxauthsize : 16
-geniv :
-
-name : __generic-gcm-aes-aesni
-driver : __driver-generic-gcm-aes-aesni
-module : kernel
-priority : 0
-refcnt : 1
-selftest : passed
-internal : yes
-type : aead
-async : no
-blocksize : 1
-ivsize : 12
-maxauthsize : 16
-geniv :
-
-name : __gcm-aes-aesni
-driver : cryptd(__driver-gcm-aes-aesni)
-module : kernel
-priority : 50
-refcnt : 1
-selftest : passed
-internal : yes
-type : aead
-async : yes
-blocksize : 1
-ivsize : 8
-maxauthsize : 16
-geniv :
-
-name : rfc4106(gcm(aes))
-driver : rfc4106-gcm-aesni
-module : kernel
-priority : 400
-refcnt : 1
-selftest : passed
-internal : no
-type : aead
-async : yes
-blocksize : 1
-ivsize : 8
-maxauthsize : 16
-geniv :
-
-name : __gcm-aes-aesni
-driver : __driver-gcm-aes-aesni
-module : kernel
-priority : 0
-refcnt : 1
-selftest : passed
-internal : yes
-type : aead
-async : no
-blocksize : 1
-ivsize : 8
-maxauthsize : 16
-geniv :
-
-name : __xts(aes)
-driver : __xts-aes-aesni
-module : kernel
-priority : 401
-refcnt : 1
-selftest : passed
-internal : yes
-type : skcipher
-async : no
-blocksize : 16
-min keysize : 32
-max keysize : 64
-ivsize : 16
-chunksize : 16
-walksize : 16
-
-name : __ctr(aes)
-driver : __ctr-aes-aesni
-module : kernel
-priority : 400
-refcnt : 1
-selftest : passed
-internal : yes
-type : skcipher
-async : no
-blocksize : 1
-min keysize : 16
-max keysize : 32
-ivsize : 16
-chunksize : 16
-walksize : 16
-
-name : __cbc(aes)
-driver : __cbc-aes-aesni
-module : kernel
-priority : 400
-refcnt : 1
-selftest : passed
-internal : yes
-type : skcipher
-async : no
-blocksize : 16
-min keysize : 16
-max keysize : 32
-ivsize : 16
-chunksize : 16
-walksize : 16
-
-name : __ecb(aes)
-driver : __ecb-aes-aesni
-module : kernel
-priority : 400
-refcnt : 1
-selftest : passed
-internal : yes
-type : skcipher
-async : no
-blocksize : 16
-min keysize : 16
-max keysize : 32
-ivsize : 0
-chunksize : 16
-walksize : 16
-
-name : __aes
-driver : __aes-aesni
-module : kernel
-priority : 300
-refcnt : 1
-selftest : passed
-internal : yes
-type : cipher
-blocksize : 16
-min keysize : 16
-max keysize : 32
-
-name : aes
-driver : aes-aesni
-module : kernel
-priority : 300
-refcnt : 8
-selftest : passed
-internal : no
-type : cipher
-blocksize : 16
-min keysize : 16
-max keysize : 32
-
-name : hmac(sha1)
-driver : hmac(sha1-generic)
-module : kernel
-priority : 100
-refcnt : 9
-selftest : passed
-internal : no
-type : shash
-blocksize : 64
-digestsize : 20
-
-name : ghash
-driver : ghash-generic
-module : kernel
-priority : 100
-refcnt : 3
-selftest : passed
-internal : no
-type : shash
-blocksize : 16
-digestsize : 16
-
-name : jitterentropy_rng
-driver : jitterentropy_rng
-module : kernel
-priority : 100
-refcnt : 1
-selftest : passed
-internal : no
-type : rng
-seedsize : 0
-
-name : stdrng
-driver : drbg_nopr_hmac_sha256
-module : kernel
-priority : 221
-refcnt : 2
-selftest : passed
-internal : no
-type : rng
-seedsize : 0
-
-name : stdrng
-driver : drbg_nopr_hmac_sha512
-module : kernel
-priority : 220
-refcnt : 1
-selftest : passed
-internal : no
-type : rng
-seedsize : 0
-
-name : stdrng
-driver : drbg_nopr_hmac_sha384
-module : kernel
-priority : 219
-refcnt : 1
-selftest : passed
-internal : no
-type : rng
-seedsize : 0
-
-name : stdrng
-driver : drbg_nopr_hmac_sha1
-module : kernel
-priority : 218
-refcnt : 1
-selftest : passed
-internal : no
-type : rng
-seedsize : 0
-
-name : stdrng
-driver : drbg_nopr_sha256
-module : kernel
-priority : 217
-refcnt : 1
-selftest : passed
-internal : no
-type : rng
-seedsize : 0
-
-name : stdrng
-driver : drbg_nopr_sha512
-module : kernel
-priority : 216
-refcnt : 1
-selftest : passed
-internal : no
-type : rng
-seedsize : 0
-
-name : stdrng
-driver : drbg_nopr_sha384
-module : kernel
-priority : 215
-refcnt : 1
-selftest : passed
-internal : no
-type : rng
-seedsize : 0
-
-name : stdrng
-driver : drbg_nopr_sha1
-module : kernel
-priority : 214
-refcnt : 1
-selftest : passed
-internal : no
-type : rng
-seedsize : 0
-
-name : stdrng
-driver : drbg_nopr_ctr_aes256
-module : kernel
-priority : 213
-refcnt : 1
-selftest : passed
-internal : no
-type : rng
-seedsize : 0
-
-name : stdrng
-driver : drbg_nopr_ctr_aes192
-module : kernel
-priority : 212
-refcnt : 1
-selftest : passed
-internal : no
-type : rng
-seedsize : 0
-
-name : stdrng
-driver : drbg_nopr_ctr_aes128
-module : kernel
-priority : 211
-refcnt : 1
-selftest : passed
-internal : no
-type : rng
-seedsize : 0
-
-name : hmac(sha256)
-driver : hmac(sha256-generic)
-module : kernel
-priority : 100
-refcnt : 10
-selftest : passed
-internal : no
-type : shash
-blocksize : 64
-digestsize : 32
-
-name : stdrng
-driver : drbg_pr_hmac_sha256
-module : kernel
-priority : 210
-refcnt : 1
-selftest : passed
-internal : no
-type : rng
-seedsize : 0
-
-name : stdrng
-driver : drbg_pr_hmac_sha512
-module : kernel
-priority : 209
-refcnt : 1
-selftest : passed
-internal : no
-type : rng
-seedsize : 0
-
-name : stdrng
-driver : drbg_pr_hmac_sha384
-module : kernel
-priority : 208
-refcnt : 1
-selftest : passed
-internal : no
-type : rng
-seedsize : 0
-
-name : stdrng
-driver : drbg_pr_hmac_sha1
-module : kernel
-priority : 207
-refcnt : 1
-selftest : passed
-internal : no
-type : rng
-seedsize : 0
-
-name : stdrng
-driver : drbg_pr_sha256
-module : kernel
-priority : 206
-refcnt : 1
-selftest : passed
-internal : no
-type : rng
-seedsize : 0
-
-name : stdrng
-driver : drbg_pr_sha512
-module : kernel
-priority : 205
-refcnt : 1
-selftest : passed
-internal : no
-type : rng
-seedsize : 0
-
-name : stdrng
-driver : drbg_pr_sha384
-module : kernel
-priority : 204
-refcnt : 1
-selftest : passed
-internal : no
-type : rng
-seedsize : 0
-
-name : stdrng
-driver : drbg_pr_sha1
-module : kernel
-priority : 203
-refcnt : 1
-selftest : passed
-internal : no
-type : rng
-seedsize : 0
-
-name : stdrng
-driver : drbg_pr_ctr_aes256
-module : kernel
-priority : 202
-refcnt : 1
-selftest : passed
-internal : no
-type : rng
-seedsize : 0
-
-name : stdrng
-driver : drbg_pr_ctr_aes192
-module : kernel
-priority : 201
-refcnt : 1
-selftest : passed
-internal : no
-type : rng
-seedsize : 0
-
-name : stdrng
-driver : drbg_pr_ctr_aes128
-module : kernel
-priority : 200
-refcnt : 1
-selftest : passed
-internal : no
-type : rng
-seedsize : 0
-
-name : 842
-driver : 842-scomp
-module : kernel
-priority : 100
-refcnt : 1
-selftest : passed
-internal : no
-type : scomp
-
-name : 842
-driver : 842-generic
-module : kernel
-priority : 100
-refcnt : 1
-selftest : passed
-internal : no
-type : compression
-
-name : lzo-rle
-driver : lzo-rle-scomp
-module : kernel
-priority : 0
-refcnt : 1
-selftest : passed
-internal : no
-type : scomp
-
-name : lzo-rle
-driver : lzo-rle-generic
-module : kernel
-priority : 0
-refcnt : 1
-selftest : passed
-internal : no
-type : compression
-
-name : lzo
-driver : lzo-scomp
-module : kernel
-priority : 0
-refcnt : 1
-selftest : passed
-internal : no
-type : scomp
-
-name : lzo
-driver : lzo-generic
-module : kernel
-priority : 0
-refcnt : 9
-selftest : passed
-internal : no
-type : compression
-
-name : crct10dif
-driver : crct10dif-generic
-module : kernel
-priority : 100
-refcnt : 1
-selftest : passed
-internal : no
-type : shash
-blocksize : 1
-digestsize : 2
-
-name : crc32c
-driver : crc32c-generic
-module : kernel
-priority : 100
-refcnt : 1
-selftest : passed
-internal : no
-type : shash
-blocksize : 1
-digestsize : 4
-
-name : zlib-deflate
-driver : zlib-deflate-scomp
-module : kernel
-priority : 0
-refcnt : 1
-selftest : passed
-internal : no
-type : scomp
-
-name : deflate
-driver : deflate-scomp
-module : kernel
-priority : 0
-refcnt : 1
-selftest : passed
-internal : no
-type : scomp
-
-name : deflate
-driver : deflate-generic
-module : kernel
-priority : 0
-refcnt : 1
-selftest : passed
-internal : no
-type : compression
-
-name : aes
-driver : aes-generic
-module : kernel
-priority : 100
-refcnt : 1
-selftest : passed
-internal : no
-type : cipher
-blocksize : 16
-min keysize : 16
-max keysize : 32
-
-name : sha224
-driver : sha224-generic
-module : kernel
-priority : 100
-refcnt : 1
-selftest : passed
-internal : no
-type : shash
-blocksize : 64
-digestsize : 28
-
-name : sha256
-driver : sha256-generic
-module : kernel
-priority : 100
-refcnt : 11
-selftest : passed
-internal : no
-type : shash
-blocksize : 64
-digestsize : 32
-
-name : sha1
-driver : sha1-generic
-module : kernel
-priority : 100
-refcnt : 11
-selftest : passed
-internal : no
-type : shash
-blocksize : 64
-digestsize : 20
-
-name : md5
-driver : md5-generic
-module : kernel
-priority : 0
-refcnt : 1
-selftest : passed
-internal : no
-type : shash
-blocksize : 64
-digestsize : 16
-
-name : ecb(cipher_null)
-driver : ecb-cipher_null
-module : kernel
-priority : 100
-refcnt : 1
-selftest : passed
-internal : no
-type : skcipher
-async : no
-blocksize : 1
-min keysize : 0
-max keysize : 0
-ivsize : 0
-chunksize : 1
-walksize : 1
-
-name : digest_null
-driver : digest_null-generic
-module : kernel
-priority : 0
-refcnt : 1
-selftest : passed
-internal : no
-type : shash
-blocksize : 1
-digestsize : 0
-
-name : compress_null
-driver : compress_null-generic
-module : kernel
-priority : 0
-refcnt : 1
-selftest : passed
-internal : no
-type : compression
-
-name : cipher_null
-driver : cipher_null-generic
-module : kernel
-priority : 0
-refcnt : 1
-selftest : passed
-internal : no
-type : cipher
-blocksize : 1
-min keysize : 0
-max keysize : 0
-
-name : rsa
-driver : rsa-generic
-module : kernel
-priority : 100
-refcnt : 1
-selftest : passed
-internal : no
-type : akcipher
-
-name : dh
-driver : dh-generic
-module : kernel
-priority : 100
-refcnt : 1
-selftest : passed
-internal : no
-type : kpp
-
-name : aes
-driver : aes-asm
-module : kernel
-priority : 200
-refcnt : 1
-selftest : passed
-internal : no
-type : cipher
-blocksize : 16
-min keysize : 16
-max keysize : 32
-
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/diskstats
-Lines: 49
- 1 0 ram0 0 0 0 0 0 0 0 0 0 0 0
- 1 1 ram1 0 0 0 0 0 0 0 0 0 0 0
- 1 2 ram2 0 0 0 0 0 0 0 0 0 0 0
- 1 3 ram3 0 0 0 0 0 0 0 0 0 0 0
- 1 4 ram4 0 0 0 0 0 0 0 0 0 0 0
- 1 5 ram5 0 0 0 0 0 0 0 0 0 0 0
- 1 6 ram6 0 0 0 0 0 0 0 0 0 0 0
- 1 7 ram7 0 0 0 0 0 0 0 0 0 0 0
- 1 8 ram8 0 0 0 0 0 0 0 0 0 0 0
- 1 9 ram9 0 0 0 0 0 0 0 0 0 0 0
- 1 10 ram10 0 0 0 0 0 0 0 0 0 0 0
- 1 11 ram11 0 0 0 0 0 0 0 0 0 0 0
- 1 12 ram12 0 0 0 0 0 0 0 0 0 0 0
- 1 13 ram13 0 0 0 0 0 0 0 0 0 0 0
- 1 14 ram14 0 0 0 0 0 0 0 0 0 0 0
- 1 15 ram15 0 0 0 0 0 0 0 0 0 0 0
- 7 0 loop0 0 0 0 0 0 0 0 0 0 0 0
- 7 1 loop1 0 0 0 0 0 0 0 0 0 0 0
- 7 2 loop2 0 0 0 0 0 0 0 0 0 0 0
- 7 3 loop3 0 0 0 0 0 0 0 0 0 0 0
- 7 4 loop4 0 0 0 0 0 0 0 0 0 0 0
- 7 5 loop5 0 0 0 0 0 0 0 0 0 0 0
- 7 6 loop6 0 0 0 0 0 0 0 0 0 0 0
- 7 7 loop7 0 0 0 0 0 0 0 0 0 0 0
- 8 0 sda 25354637 34367663 1003346126 18492372 28444756 11134226 505697032 63877960 0 9653880 82621804
- 8 1 sda1 250 0 2000 36 0 0 0 0 0 36 36
- 8 2 sda2 246 0 1968 32 0 0 0 0 0 32 32
- 8 3 sda3 340 13 2818 52 11 8 152 8 0 56 60
- 8 4 sda4 25353629 34367650 1003337964 18492232 27448755 11134218 505696880 61593380 0 7576432 80332428
- 252 0 dm-0 59910002 0 1003337218 46229572 39231014 0 505696880 1158557800 0 11325968 1206301256
- 252 1 dm-1 388 0 3104 84 74 0 592 0 0 76 84
- 252 2 dm-2 11571 0 308350 6536 153522 0 5093416 122884 0 65400 129416
- 252 3 dm-3 3870 0 3870 104 0 0 0 0 0 16 104
- 252 4 dm-4 392 0 1034 28 38 0 137 16 0 24 44
- 252 5 dm-5 3729 0 84279 924 98918 0 1151688 104684 0 58848 105632
- 179 0 mmcblk0 192 3 1560 156 0 0 0 0 0 136 156
- 179 1 mmcblk0p1 17 3 160 24 0 0 0 0 0 24 24
- 179 2 mmcblk0p2 95 0 760 68 0 0 0 0 0 68 68
- 2 0 fd0 2 0 16 80 0 0 0 0 0 80 80
- 254 0 vda 1775784 15386 32670882 8655768 6038856 20711856 213637440 2069221364 0 41614592 2077872228
- 254 1 vda1 668 85 5984 956 207 4266 35784 32772 0 8808 33720
- 254 2 vda2 1774936 15266 32663262 8654692 5991028 20707590 213601656 2069152216 0 41607628 2077801992
- 11 0 sr0 0 0 0 0 0 0 0 0 0 0 0
- 259 0 nvme0n1 47114 4 4643973 21650 1078320 43950 39451633 1011053 0 222766 1032546
- 259 1 nvme0n1p1 1140 0 9370 16 1 0 1 0 0 16 16
- 259 2 nvme0n1p2 45914 4 4631243 21626 1036885 43950 39451632 919480 0 131580 940970
- 8 0 sdb 326552 841 9657779 84 41822 2895 1972905 5007 0 60730 67070 68851 0 1925173784 11130
- 8 1 sdb1 231 3 34466 4 24 23 106 0 0 64 64 0 0 0 0
- 8 2 sdb2 326310 838 9622281 67 40726 2872 1972799 4924 0 58250 64567 68851 0 1925173784 11130
-Mode: 664
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/proc/fs
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/proc/fs/xfs
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/fs/xfs/stat
-Lines: 23
-extent_alloc 92447 97589 92448 93751
-abt 0 0 0 0
-blk_map 1767055 188820 184891 92447 92448 2140766 0
-bmbt 0 0 0 0
-dir 185039 92447 92444 136422
-trans 706 944304 0
-ig 185045 58807 0 126238 0 33637 22
-log 2883 113448 9 17360 739
-push_ail 945014 0 134260 15483 0 3940 464 159985 0 40
-xstrat 92447 0
-rw 107739 94045
-attr 4 0 0 0
-icluster 8677 7849 135802
-vnodes 92601 0 0 0 92444 92444 92444 0
-buf 2666287 7122 2659202 3599 2 7085 0 10297 7085
-abtb2 184941 1277345 13257 13278 0 0 0 0 0 0 0 0 0 0 2746147
-abtc2 345295 2416764 172637 172658 0 0 0 0 0 0 0 0 0 0 21406023
-bmbt2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-ibt2 343004 1358467 0 0 0 0 0 0 0 0 0 0 0 0 0
-fibt2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-qm 0 0 0 0 0 0 0 0
-xpc 399724544 92823103 86219234
-debug 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/mdstat
-Lines: 56
-Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
-
-md3 : active raid6 sda1[8] sdh1[7] sdg1[6] sdf1[5] sde1[11] sdd1[3] sdc1[10] sdb1[9] sdd1[10](S) sdd2[11](S)
- 5853468288 blocks super 1.2 level 6, 64k chunk, algorithm 2 [8/8] [UUUUUUUU]
-
-md127 : active raid1 sdi2[0] sdj2[1]
- 312319552 blocks [2/2] [UU]
-
-md0 : active raid1 sdi1[0] sdj1[1]
- 248896 blocks [2/2] [UU]
-
-md4 : inactive raid1 sda3[0](F) sdb3[1](S)
- 4883648 blocks [2/2] [UU]
-
-md6 : active raid1 sdb2[2](F) sdc[1](S) sda2[0]
- 195310144 blocks [2/1] [U_]
- [=>...................] recovery = 8.5% (16775552/195310144) finish=17.0min speed=259783K/sec
-
-md8 : active raid1 sdb1[1] sda1[0] sdc[2](S) sde[3](S)
- 195310144 blocks [2/2] [UU]
- [=>...................] resync = 8.5% (16775552/195310144) finish=17.0min speed=259783K/sec
-
-md7 : active raid6 sdb1[0] sde1[3] sdd1[2] sdc1[1](F)
- 7813735424 blocks super 1.2 level 6, 512k chunk, algorithm 2 [4/3] [U_UU]
- bitmap: 0/30 pages [0KB], 65536KB chunk
-
-md9 : active raid1 sdc2[2] sdd2[3] sdb2[1] sda2[0] sde[4](F) sdf[5](F) sdg[6](S)
- 523968 blocks super 1.2 [4/4] [UUUU]
- resync=DELAYED
-
-md10 : active raid0 sda1[0] sdb1[1]
- 314159265 blocks 64k chunks
-
-md11 : active (auto-read-only) raid1 sdb2[0] sdc2[1] sdc3[2](F) hda[4](S) ssdc2[3](S)
- 4190208 blocks super 1.2 [2/2] [UU]
- resync=PENDING
-
-md12 : active raid0 sdc2[0] sdd2[1]
- 3886394368 blocks super 1.2 512k chunks
-
-md126 : active raid0 sdb[1] sdc[0]
- 1855870976 blocks super external:/md127/0 128k chunks
-
-md219 : inactive sdb[2](S) sdc[1](S) sda[0](S)
- 7932 blocks super external:imsm
-
-md00 : active raid0 xvdb[0]
- 4186624 blocks super 1.2 256k chunks
-
-md120 : active linear sda1[1] sdb1[0]
- 2095104 blocks super 1.2 0k rounding
-
-md101 : active (read-only) raid0 sdb[2] sdd[1] sdc[0]
- 322560 blocks super 1.2 512k chunks
-
-unused devices:
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/meminfo
-Lines: 42
-MemTotal: 15666184 kB
-MemFree: 440324 kB
-Buffers: 1020128 kB
-Cached: 12007640 kB
-SwapCached: 0 kB
-Active: 6761276 kB
-Inactive: 6532708 kB
-Active(anon): 267256 kB
-Inactive(anon): 268 kB
-Active(file): 6494020 kB
-Inactive(file): 6532440 kB
-Unevictable: 0 kB
-Mlocked: 0 kB
-SwapTotal: 0 kB
-SwapFree: 0 kB
-Dirty: 768 kB
-Writeback: 0 kB
-AnonPages: 266216 kB
-Mapped: 44204 kB
-Shmem: 1308 kB
-Slab: 1807264 kB
-SReclaimable: 1738124 kB
-SUnreclaim: 69140 kB
-KernelStack: 1616 kB
-PageTables: 5288 kB
-NFS_Unstable: 0 kB
-Bounce: 0 kB
-WritebackTmp: 0 kB
-CommitLimit: 7833092 kB
-Committed_AS: 530844 kB
-VmallocTotal: 34359738367 kB
-VmallocUsed: 36596 kB
-VmallocChunk: 34359637840 kB
-HardwareCorrupted: 0 kB
-AnonHugePages: 12288 kB
-HugePages_Total: 0
-HugePages_Free: 0
-HugePages_Rsvd: 0
-HugePages_Surp: 0
-Hugepagesize: 2048 kB
-DirectMap4k: 91136 kB
-DirectMap2M: 16039936 kB
-Mode: 664
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/proc/net
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/net/arp
-Lines: 2
-IP address HW type Flags HW address Mask Device
-192.168.224.1 0x1 0x2 00:50:56:c0:00:08 * ens33
-Mode: 664
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/net/dev
-Lines: 6
-Inter-| Receive | Transmit
- face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
-vethf345468: 648 8 0 0 0 0 0 0 438 5 0 0 0 0 0 0
- lo: 1664039048 1566805 0 0 0 0 0 0 1664039048 1566805 0 0 0 0 0 0
-docker0: 2568 38 0 0 0 0 0 0 438 5 0 0 0 0 0 0
- eth0: 874354587 1036395 0 0 0 0 0 0 563352563 732147 0 0 0 0 0 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/net/ip_vs
-Lines: 21
-IP Virtual Server version 1.2.1 (size=4096)
-Prot LocalAddress:Port Scheduler Flags
- -> RemoteAddress:Port Forward Weight ActiveConn InActConn
-TCP C0A80016:0CEA wlc
- -> C0A85216:0CEA Tunnel 100 248 2
- -> C0A85318:0CEA Tunnel 100 248 2
- -> C0A85315:0CEA Tunnel 100 248 1
-TCP C0A80039:0CEA wlc
- -> C0A85416:0CEA Tunnel 0 0 0
- -> C0A85215:0CEA Tunnel 100 1499 0
- -> C0A83215:0CEA Tunnel 100 1498 0
-TCP C0A80037:0CEA wlc
- -> C0A8321A:0CEA Tunnel 0 0 0
- -> C0A83120:0CEA Tunnel 100 0 0
-TCP [2620:0000:0000:0000:0000:0000:0000:0001]:0050 sh
- -> [2620:0000:0000:0000:0000:0000:0000:0002]:0050 Route 1 0 0
- -> [2620:0000:0000:0000:0000:0000:0000:0003]:0050 Route 1 0 0
- -> [2620:0000:0000:0000:0000:0000:0000:0004]:0050 Route 1 1 1
-FWM 10001000 wlc
- -> C0A8321A:0CEA Route 0 0 1
- -> C0A83215:0CEA Route 0 0 2
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/net/ip_vs_stats
-Lines: 6
- Total Incoming Outgoing Incoming Outgoing
- Conns Packets Packets Bytes Bytes
- 16AA370 E33656E5 0 51D8C8883AB3 0
-
- Conns/s Pkts/s Pkts/s Bytes/s Bytes/s
- 4 1FB3C 0 1282A8F 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/proc/net/rpc
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/net/rpc/nfs
-Lines: 5
-net 18628 0 18628 6
-rpc 4329785 0 4338291
-proc2 18 2 69 0 0 4410 0 0 0 0 0 0 0 0 0 0 0 99 2
-proc3 22 1 4084749 29200 94754 32580 186 47747 7981 8639 0 6356 0 6962 0 7958 0 0 241 4 4 2 39
-proc4 61 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/net/rpc/nfsd
-Lines: 11
-rc 0 6 18622
-fh 0 0 0 0 0
-io 157286400 0
-th 8 0 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
-ra 32 0 0 0 0 0 0 0 0 0 0 0
-net 18628 0 18628 6
-rpc 18628 0 0 0 0
-proc2 18 2 69 0 0 4410 0 0 0 0 0 0 0 0 0 0 0 99 2
-proc3 22 2 112 0 2719 111 0 0 0 0 0 0 0 0 0 0 0 27 216 0 2 1 0
-proc4 2 2 10853
-proc4ops 72 0 0 0 1098 2 0 0 0 0 8179 5896 0 0 0 0 5900 0 0 2 0 2 0 9609 0 2 150 1272 0 0 0 1236 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/net/sockstat
-Lines: 6
-sockets: used 1602
-TCP: inuse 35 orphan 0 tw 4 alloc 59 mem 22
-UDP: inuse 12 mem 62
-UDPLITE: inuse 0
-RAW: inuse 0
-FRAG: inuse 0 memory 0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/net/sockstat6
-Lines: 5
-TCP6: inuse 17
-UDP6: inuse 9
-UDPLITE6: inuse 0
-RAW6: inuse 1
-FRAG6: inuse 0 memory 0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/net/softnet_stat
-Lines: 1
-00015c73 00020e76 F0000769 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/net/unix
-Lines: 6
-Num RefCount Protocol Flags Type St Inode Path
-0000000000000000: 00000002 00000000 00010000 0001 01 3442596 /var/run/postgresql/.s.PGSQL.5432
-0000000000000000: 0000000a 00000000 00010000 0005 01 10061 /run/udev/control
-0000000000000000: 00000007 00000000 00000000 0002 01 12392 /dev/log
-0000000000000000: 00000003 00000000 00000000 0001 03 4787297 /var/run/postgresql/.s.PGSQL.5432
-0000000000000000: 00000003 00000000 00000000 0001 03 5091797
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/net/unix_without_inode
-Lines: 6
-Num RefCount Protocol Flags Type St Path
-0000000000000000: 00000002 00000000 00010000 0001 01 /var/run/postgresql/.s.PGSQL.5432
-0000000000000000: 0000000a 00000000 00010000 0005 01 /run/udev/control
-0000000000000000: 00000007 00000000 00000000 0002 01 /dev/log
-0000000000000000: 00000003 00000000 00000000 0001 03 /var/run/postgresql/.s.PGSQL.5432
-0000000000000000: 00000003 00000000 00000000 0001 03
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/net/xfrm_stat
-Lines: 28
-XfrmInError 1
-XfrmInBufferError 2
-XfrmInHdrError 4
-XfrmInNoStates 3
-XfrmInStateProtoError 40
-XfrmInStateModeError 100
-XfrmInStateSeqError 6000
-XfrmInStateExpired 4
-XfrmInStateMismatch 23451
-XfrmInStateInvalid 55555
-XfrmInTmplMismatch 51
-XfrmInNoPols 65432
-XfrmInPolBlock 100
-XfrmInPolError 10000
-XfrmOutError 1000000
-XfrmOutBundleGenError 43321
-XfrmOutBundleCheckError 555
-XfrmOutNoStates 869
-XfrmOutStateProtoError 4542
-XfrmOutStateModeError 4
-XfrmOutStateSeqError 543
-XfrmOutStateExpired 565
-XfrmOutPolBlock 43456
-XfrmOutPolDead 7656
-XfrmOutPolError 1454
-XfrmFwdHdrError 6654
-XfrmOutStateInvalid 28765
-XfrmAcquireError 24532
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/proc/pressure
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/pressure/cpu
-Lines: 1
-some avg10=0.10 avg60=2.00 avg300=3.85 total=15
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/pressure/io
-Lines: 2
-some avg10=0.10 avg60=2.00 avg300=3.85 total=15
-full avg10=0.20 avg60=3.00 avg300=4.95 total=25
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/pressure/memory
-Lines: 2
-some avg10=0.10 avg60=2.00 avg300=3.85 total=15
-full avg10=0.20 avg60=3.00 avg300=4.95 total=25
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/schedstat
-Lines: 6
-version 15
-timestamp 15819019232
-cpu0 498494191 0 3533438552 2553969831 3853684107 2465731542 2045936778163039 343796328169361 4767485306
-domain0 00000000,00000003 212499247 210112015 1861015 1860405436 536440 369895 32599 210079416 25368550 24241256 384652 927363878 807233 6366 1647 24239609 2122447165 1886868564 121112060 2848625533 125678146 241025 1032026 1885836538 2545 12 2533 0 0 0 0 0 0 1387952561 21076581 0
-cpu1 518377256 0 4155211005 2778589869 10466382 2867629021 1904686152592476 364107263788241 5145567945
-domain0 00000000,00000003 217653037 215526982 1577949 1580427380 557469 393576 28538 215498444 28721913 27662819 371153 870843407 745912 5523 1639 27661180 2331056874 2107732788 111442342 652402556 123615235 196159 1045245 2106687543 2400 3 2397 0 0 0 0 0 0 1437804657 26220076 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/self
-SymlinkTo: 26231
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/stat
-Lines: 16
-cpu 301854 612 111922 8979004 3552 2 3944 0 0 0
-cpu0 44490 19 21045 1087069 220 1 3410 0 0 0
-cpu1 47869 23 16474 1110787 591 0 46 0 0 0
-cpu2 46504 36 15916 1112321 441 0 326 0 0 0
-cpu3 47054 102 15683 1113230 533 0 60 0 0 0
-cpu4 28413 25 10776 1140321 217 0 8 0 0 0
-cpu5 29271 101 11586 1136270 672 0 30 0 0 0
-cpu6 29152 36 10276 1139721 319 0 29 0 0 0
-cpu7 29098 268 10164 1139282 555 0 31 0 0 0
-intr 8885917 17 0 0 0 0 0 0 0 1 79281 0 0 0 0 0 0 0 231237 0 0 0 0 250586 103 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 223424 190745 13 906 1283803 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-ctxt 38014093
-btime 1418183276
-processes 26442
-procs_running 2
-procs_blocked 1
-softirq 5057579 250191 1481983 1647 211099 186066 0 1783454 622196 12499 508444
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/proc/symlinktargets
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/symlinktargets/README
-Lines: 2
-This directory contains some empty files that are the symlinks the files in the "fd" directory point to.
-They are otherwise ignored by the tests
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/symlinktargets/abc
-Lines: 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/symlinktargets/def
-Lines: 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/symlinktargets/ghi
-Lines: 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/symlinktargets/uvw
-Lines: 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/symlinktargets/xyz
-Lines: 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/proc/sys
-Mode: 775
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/proc/sys/vm
-Mode: 775
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/admin_reserve_kbytes
-Lines: 1
-8192
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/block_dump
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/compact_unevictable_allowed
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/dirty_background_bytes
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/dirty_background_ratio
-Lines: 1
-10
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/dirty_bytes
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/dirty_expire_centisecs
-Lines: 1
-3000
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/dirty_ratio
-Lines: 1
-20
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/dirty_writeback_centisecs
-Lines: 1
-500
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/dirtytime_expire_seconds
-Lines: 1
-43200
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/drop_caches
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/extfrag_threshold
-Lines: 1
-500
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/hugetlb_shm_group
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/laptop_mode
-Lines: 1
-5
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/legacy_va_layout
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/lowmem_reserve_ratio
-Lines: 1
-256 256 32 0 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/max_map_count
-Lines: 1
-65530
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/memory_failure_early_kill
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/memory_failure_recovery
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/min_free_kbytes
-Lines: 1
-67584
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/min_slab_ratio
-Lines: 1
-5
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/min_unmapped_ratio
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/mmap_min_addr
-Lines: 1
-65536
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/nr_hugepages
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/nr_hugepages_mempolicy
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/nr_overcommit_hugepages
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/numa_stat
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/numa_zonelist_order
-Lines: 1
-Node
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/oom_dump_tasks
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/oom_kill_allocating_task
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/overcommit_kbytes
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/overcommit_memory
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/overcommit_ratio
-Lines: 1
-50
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/page-cluster
-Lines: 1
-3
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/panic_on_oom
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/percpu_pagelist_fraction
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/stat_interval
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/swappiness
-Lines: 1
-60
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/user_reserve_kbytes
-Lines: 1
-131072
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/vfs_cache_pressure
-Lines: 1
-100
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/watermark_boost_factor
-Lines: 1
-15000
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/watermark_scale_factor
-Lines: 1
-10
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/sys/vm/zone_reclaim_mode
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/proc/zoneinfo
-Lines: 262
-Node 0, zone DMA
- per-node stats
- nr_inactive_anon 230981
- nr_active_anon 547580
- nr_inactive_file 316904
- nr_active_file 346282
- nr_unevictable 115467
- nr_slab_reclaimable 131220
- nr_slab_unreclaimable 47320
- nr_isolated_anon 0
- nr_isolated_file 0
- workingset_nodes 11627
- workingset_refault 466886
- workingset_activate 276925
- workingset_restore 84055
- workingset_nodereclaim 487
- nr_anon_pages 795576
- nr_mapped 215483
- nr_file_pages 761874
- nr_dirty 908
- nr_writeback 0
- nr_writeback_temp 0
- nr_shmem 224925
- nr_shmem_hugepages 0
- nr_shmem_pmdmapped 0
- nr_anon_transparent_hugepages 0
- nr_unstable 0
- nr_vmscan_write 12950
- nr_vmscan_immediate_reclaim 3033
- nr_dirtied 8007423
- nr_written 7752121
- nr_kernel_misc_reclaimable 0
- pages free 3952
- min 33
- low 41
- high 49
- spanned 4095
- present 3975
- managed 3956
- protection: (0, 2877, 7826, 7826, 7826)
- nr_free_pages 3952
- nr_zone_inactive_anon 0
- nr_zone_active_anon 0
- nr_zone_inactive_file 0
- nr_zone_active_file 0
- nr_zone_unevictable 0
- nr_zone_write_pending 0
- nr_mlock 0
- nr_page_table_pages 0
- nr_kernel_stack 0
- nr_bounce 0
- nr_zspages 0
- nr_free_cma 0
- numa_hit 1
- numa_miss 0
- numa_foreign 0
- numa_interleave 0
- numa_local 1
- numa_other 0
- pagesets
- cpu: 0
- count: 0
- high: 0
- batch: 1
- vm stats threshold: 8
- cpu: 1
- count: 0
- high: 0
- batch: 1
- vm stats threshold: 8
- cpu: 2
- count: 0
- high: 0
- batch: 1
- vm stats threshold: 8
- cpu: 3
- count: 0
- high: 0
- batch: 1
- vm stats threshold: 8
- cpu: 4
- count: 0
- high: 0
- batch: 1
- vm stats threshold: 8
- cpu: 5
- count: 0
- high: 0
- batch: 1
- vm stats threshold: 8
- cpu: 6
- count: 0
- high: 0
- batch: 1
- vm stats threshold: 8
- cpu: 7
- count: 0
- high: 0
- batch: 1
- vm stats threshold: 8
- node_unreclaimable: 0
- start_pfn: 1
-Node 0, zone DMA32
- pages free 204252
- min 19510
- low 21059
- high 22608
- spanned 1044480
- present 759231
- managed 742806
- protection: (0, 0, 4949, 4949, 4949)
- nr_free_pages 204252
- nr_zone_inactive_anon 118558
- nr_zone_active_anon 106598
- nr_zone_inactive_file 75475
- nr_zone_active_file 70293
- nr_zone_unevictable 66195
- nr_zone_write_pending 64
- nr_mlock 4
- nr_page_table_pages 1756
- nr_kernel_stack 2208
- nr_bounce 0
- nr_zspages 0
- nr_free_cma 0
- numa_hit 113952967
- numa_miss 0
- numa_foreign 0
- numa_interleave 0
- numa_local 113952967
- numa_other 0
- pagesets
- cpu: 0
- count: 345
- high: 378
- batch: 63
- vm stats threshold: 48
- cpu: 1
- count: 356
- high: 378
- batch: 63
- vm stats threshold: 48
- cpu: 2
- count: 325
- high: 378
- batch: 63
- vm stats threshold: 48
- cpu: 3
- count: 346
- high: 378
- batch: 63
- vm stats threshold: 48
- cpu: 4
- count: 321
- high: 378
- batch: 63
- vm stats threshold: 48
- cpu: 5
- count: 316
- high: 378
- batch: 63
- vm stats threshold: 48
- cpu: 6
- count: 373
- high: 378
- batch: 63
- vm stats threshold: 48
- cpu: 7
- count: 339
- high: 378
- batch: 63
- vm stats threshold: 48
- node_unreclaimable: 0
- start_pfn: 4096
-Node 0, zone Normal
- pages free 18553
- min 11176
- low 13842
- high 16508
- spanned 1308160
- present 1308160
- managed 1268711
- protection: (0, 0, 0, 0, 0)
- nr_free_pages 18553
- nr_zone_inactive_anon 112423
- nr_zone_active_anon 440982
- nr_zone_inactive_file 241429
- nr_zone_active_file 275989
- nr_zone_unevictable 49272
- nr_zone_write_pending 844
- nr_mlock 154
- nr_page_table_pages 9750
- nr_kernel_stack 15136
- nr_bounce 0
- nr_zspages 0
- nr_free_cma 0
- numa_hit 162718019
- numa_miss 0
- numa_foreign 0
- numa_interleave 26812
- numa_local 162718019
- numa_other 0
- pagesets
- cpu: 0
- count: 316
- high: 378
- batch: 63
- vm stats threshold: 56
- cpu: 1
- count: 366
- high: 378
- batch: 63
- vm stats threshold: 56
- cpu: 2
- count: 60
- high: 378
- batch: 63
- vm stats threshold: 56
- cpu: 3
- count: 256
- high: 378
- batch: 63
- vm stats threshold: 56
- cpu: 4
- count: 253
- high: 378
- batch: 63
- vm stats threshold: 56
- cpu: 5
- count: 159
- high: 378
- batch: 63
- vm stats threshold: 56
- cpu: 6
- count: 311
- high: 378
- batch: 63
- vm stats threshold: 56
- cpu: 7
- count: 264
- high: 378
- batch: 63
- vm stats threshold: 56
- node_unreclaimable: 0
- start_pfn: 1048576
-Node 0, zone Movable
- pages free 0
- min 0
- low 0
- high 0
- spanned 0
- present 0
- managed 0
- protection: (0, 0, 0, 0, 0)
-Node 0, zone Device
- pages free 0
- min 0
- low 0
- high 0
- spanned 0
- present 0
- managed 0
- protection: (0, 0, 0, 0, 0)
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/block
-Mode: 775
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/block/dm-0
-Mode: 775
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/block/dm-0/stat
-Lines: 1
-6447303 0 710266738 1529043 953216 0 31201176 4557464 0 796160 6088971
-Mode: 664
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/block/sda
-Mode: 775
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/block/sda/stat
-Lines: 1
-9652963 396792 759304206 412943 8422549 6731723 286915323 13947418 0 5658367 19174573 1 2 3 12
-Mode: 664
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/class
-Mode: 775
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/class/infiniband
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/class/infiniband/mlx4_0
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/board_id
-Lines: 1
-SM_1141000001000
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/fw_ver
-Lines: 1
-2.31.5050
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/hca_type
-Lines: 1
-MT4099
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/class/infiniband/mlx4_0/ports
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/class/infiniband/mlx4_0/ports/1
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/excessive_buffer_overrun_errors
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/link_downed
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/link_error_recovery
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/local_link_integrity_errors
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_rcv_constraint_errors
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_rcv_data
-Lines: 1
-2221223609
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_rcv_errors
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_rcv_packets
-Lines: 1
-87169372
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_rcv_remote_physical_errors
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_rcv_switch_relay_errors
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_xmit_constraint_errors
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_xmit_data
-Lines: 1
-26509113295
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_xmit_discards
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_xmit_packets
-Lines: 1
-85734114
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_xmit_wait
-Lines: 1
-3599
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/symbol_error
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/phys_state
-Lines: 1
-5: LinkUp
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/rate
-Lines: 1
-40 Gb/sec (4X QDR)
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/state
-Lines: 1
-4: ACTIVE
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/class/infiniband/mlx4_0/ports/2
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/excessive_buffer_overrun_errors
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/link_downed
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/link_error_recovery
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/local_link_integrity_errors
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_rcv_constraint_errors
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_rcv_data
-Lines: 1
-2460436784
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_rcv_errors
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_rcv_packets
-Lines: 1
-89332064
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_rcv_remote_physical_errors
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_rcv_switch_relay_errors
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_xmit_constraint_errors
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_xmit_data
-Lines: 1
-26540356890
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_xmit_discards
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_xmit_packets
-Lines: 1
-88622850
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_xmit_wait
-Lines: 1
-3846
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/symbol_error
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/phys_state
-Lines: 1
-5: LinkUp
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/rate
-Lines: 1
-40 Gb/sec (4X QDR)
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/state
-Lines: 1
-4: ACTIVE
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/class/net
-Mode: 775
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/class/net/eth0
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/addr_assign_type
-Lines: 1
-3
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/addr_len
-Lines: 1
-6
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/address
-Lines: 1
-01:01:01:01:01:01
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/broadcast
-Lines: 1
-ff:ff:ff:ff:ff:ff
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/carrier
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/carrier_changes
-Lines: 1
-2
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/carrier_down_count
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/carrier_up_count
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/dev_id
-Lines: 1
-0x20
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/device
-SymlinkTo: ../../../devices/pci0000:00/0000:00:1f.6/
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/dormant
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/duplex
-Lines: 1
-full
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/flags
-Lines: 1
-0x1303
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/ifalias
-Lines: 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/ifindex
-Lines: 1
-2
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/iflink
-Lines: 1
-2
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/link_mode
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/mtu
-Lines: 1
-1500
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/name_assign_type
-Lines: 1
-2
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/netdev_group
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/operstate
-Lines: 1
-up
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/phys_port_id
-Lines: 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/phys_port_name
-Lines: 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/phys_switch_id
-Lines: 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/speed
-Lines: 1
-1000
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/tx_queue_len
-Lines: 1
-1000
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/net/eth0/type
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/class/power_supply
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/power_supply/AC
-SymlinkTo: ../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/power_supply/BAT0
-SymlinkTo: ../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/class/powercap
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/class/powercap/intel-rapl
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl/enabled
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl/uevent
-Lines: 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/class/powercap/intel-rapl:0
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl:0/constraint_0_max_power_uw
-Lines: 1
-95000000
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl:0/constraint_0_name
-Lines: 1
-long_term
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl:0/constraint_0_power_limit_uw
-Lines: 1
-4090000000
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl:0/constraint_0_time_window_us
-Lines: 1
-999424
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl:0/constraint_1_max_power_uw
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl:0/constraint_1_name
-Lines: 1
-short_term
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl:0/constraint_1_power_limit_uw
-Lines: 1
-4090000000
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl:0/constraint_1_time_window_us
-Lines: 1
-2440
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl:0/enabled
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl:0/energy_uj
-Lines: 1
-240422366267
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl:0/max_energy_range_uj
-Lines: 1
-262143328850
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl:0/name
-Lines: 1
-package-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl:0/uevent
-Lines: 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/class/powercap/intel-rapl:0:0
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl:0:0/constraint_0_max_power_uw
-Lines: 0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl:0:0/constraint_0_name
-Lines: 1
-long_term
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl:0:0/constraint_0_power_limit_uw
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl:0:0/constraint_0_time_window_us
-Lines: 1
-976
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl:0:0/enabled
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl:0:0/energy_uj
-Lines: 1
-118821284256
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl:0:0/max_energy_range_uj
-Lines: 1
-262143328850
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl:0:0/name
-Lines: 1
-core
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/powercap/intel-rapl:0:0/uevent
-Lines: 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/class/thermal
-Mode: 775
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/class/thermal/cooling_device0
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/thermal/cooling_device0/cur_state
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/thermal/cooling_device0/max_state
-Lines: 1
-50
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/thermal/cooling_device0/type
-Lines: 1
-Processor
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/class/thermal/cooling_device1
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/thermal/cooling_device1/cur_state
-Lines: 1
--1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/thermal/cooling_device1/max_state
-Lines: 1
-27
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/thermal/cooling_device1/type
-Lines: 1
-intel_powerclamp
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/class/thermal/thermal_zone0
-Mode: 775
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/thermal/thermal_zone0/policy
-Lines: 1
-step_wise
-Mode: 664
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/thermal/thermal_zone0/temp
-Lines: 1
-49925
-Mode: 664
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/thermal/thermal_zone0/type
-Lines: 1
-bcm2835_thermal
-Mode: 664
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/class/thermal/thermal_zone1
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/thermal/thermal_zone1/mode
-Lines: 1
-enabled
-Mode: 664
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/thermal/thermal_zone1/passive
-Lines: 1
-0
-Mode: 664
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/thermal/thermal_zone1/policy
-Lines: 1
-step_wise
-Mode: 664
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/thermal/thermal_zone1/temp
-Lines: 1
-44000
-Mode: 664
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/class/thermal/thermal_zone1/type
-Lines: 1
-acpitz
-Mode: 664
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/LNXSYSTM:00
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/device
-SymlinkTo: ../../../ACPI0003:00
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/online
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/power
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/power/async
-Lines: 1
-disabled
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/power/autosuspend_delay_ms
-Lines: 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/power/control
-Lines: 1
-auto
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/power/runtime_active_kids
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/power/runtime_active_time
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/power/runtime_enabled
-Lines: 1
-disabled
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/power/runtime_status
-Lines: 1
-unsupported
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/power/runtime_suspended_time
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/power/runtime_usage
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/power/wakeup
-Lines: 1
-enabled
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/power/wakeup_abort_count
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/power/wakeup_active
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/power/wakeup_active_count
-Lines: 1
-1
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/power/wakeup_count
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/power/wakeup_expire_count
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/power/wakeup_last_time_ms
-Lines: 1
-10598
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/power/wakeup_max_time_ms
-Lines: 1
-1
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/power/wakeup_prevent_sleep_time_ms
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/power/wakeup_total_time_ms
-Lines: 1
-1
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/subsystem
-SymlinkTo: ../../../../../../../../../class/power_supply
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/type
-Lines: 1
-Mains
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC/uevent
-Lines: 2
-POWER_SUPPLY_NAME=AC
-POWER_SUPPLY_ONLINE=0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/alarm
-Lines: 1
-2369000
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/capacity
-Lines: 1
-98
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/capacity_level
-Lines: 1
-Normal
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/charge_start_threshold
-Lines: 1
-95
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/charge_stop_threshold
-Lines: 1
-100
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/cycle_count
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/device
-SymlinkTo: ../../../PNP0C0A:00
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_full
-Lines: 1
-50060000
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_full_design
-Lines: 1
-47520000
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_now
-Lines: 1
-49450000
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/manufacturer
-Lines: 1
-LGC
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/model_name
-Lines: 1
-LNV-45N1
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/power
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/power/async
-Lines: 1
-disabled
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/power/autosuspend_delay_ms
-Lines: 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/power/control
-Lines: 1
-auto
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/power/runtime_active_kids
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/power/runtime_active_time
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/power/runtime_enabled
-Lines: 1
-disabled
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/power/runtime_status
-Lines: 1
-unsupported
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/power/runtime_suspended_time
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/power/runtime_usage
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/power_now
-Lines: 1
-4830000
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/present
-Lines: 1
-1
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/serial_number
-Lines: 1
-38109
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/status
-Lines: 1
-Discharging
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/subsystem
-SymlinkTo: ../../../../../../../../../class/power_supply
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/technology
-Lines: 1
-Li-ion
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/type
-Lines: 1
-Battery
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/uevent
-Lines: 16
-POWER_SUPPLY_NAME=BAT0
-POWER_SUPPLY_STATUS=Discharging
-POWER_SUPPLY_PRESENT=1
-POWER_SUPPLY_TECHNOLOGY=Li-ion
-POWER_SUPPLY_CYCLE_COUNT=0
-POWER_SUPPLY_VOLTAGE_MIN_DESIGN=10800000
-POWER_SUPPLY_VOLTAGE_NOW=11750000
-POWER_SUPPLY_POWER_NOW=5064000
-POWER_SUPPLY_ENERGY_FULL_DESIGN=47520000
-POWER_SUPPLY_ENERGY_FULL=47390000
-POWER_SUPPLY_ENERGY_NOW=40730000
-POWER_SUPPLY_CAPACITY=85
-POWER_SUPPLY_CAPACITY_LEVEL=Normal
-POWER_SUPPLY_MODEL_NAME=LNV-45N1
-POWER_SUPPLY_MANUFACTURER=LGC
-POWER_SUPPLY_SERIAL_NUMBER=38109
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/voltage_min_design
-Lines: 1
-10800000
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/voltage_now
-Lines: 1
-12229000
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/pci0000:00
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/pci0000:00/0000:00:0d.0
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/dirty_data
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_day
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_day/bypassed
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_day/cache_bypass_hits
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_day/cache_bypass_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_day/cache_hit_ratio
-Lines: 1
-100
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_day/cache_hits
-Lines: 1
-289
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_day/cache_miss_collisions
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_day/cache_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_day/cache_readaheads
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_five_minute
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_five_minute/bypassed
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_five_minute/cache_bypass_hits
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_five_minute/cache_bypass_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_five_minute/cache_hit_ratio
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_five_minute/cache_hits
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_five_minute/cache_miss_collisions
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_five_minute/cache_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_five_minute/cache_readaheads
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_hour
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_hour/bypassed
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_hour/cache_bypass_hits
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_hour/cache_bypass_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_hour/cache_hit_ratio
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_hour/cache_hits
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_hour/cache_miss_collisions
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_hour/cache_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_hour/cache_readaheads
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_total
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_total/bypassed
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_total/cache_bypass_hits
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_total/cache_bypass_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_total/cache_hit_ratio
-Lines: 1
-100
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_total/cache_hits
-Lines: 1
-546
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_total/cache_miss_collisions
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_total/cache_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata4/host3/target3:0:0/3:0:0:0/block/sdb/bcache/stats_total/cache_readaheads
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata5
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata5/host4
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc/bcache
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc/bcache/io_errors
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc/bcache/metadata_written
-Lines: 1
-512
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc/bcache/priority_stats
-Lines: 5
-Unused: 99%
-Metadata: 0%
-Average: 10473
-Sectors per Q: 64
-Quantiles: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946]
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:0d.0/ata5/host4/target4:0:0/4:0:0:0/block/sdc/bcache/written
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/pci0000:00/0000:00:1f.6
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/ari_enabled
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/broken_parity_status
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/class
-Lines: 1
-0x020000
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/consistent_dma_mask_bits
-Lines: 1
-64
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/d3cold_allowed
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/device
-Lines: 1
-0x15d7
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/dma_mask_bits
-Lines: 1
-64
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/driver_override
-Lines: 1
-(null)
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/enable
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/irq
-Lines: 1
-140
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/local_cpulist
-Lines: 1
-0-7
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/local_cpus
-Lines: 1
-ff
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/modalias
-Lines: 1
-pci:v00008086d000015D7sv000017AAsd0000225Abc02sc00i00
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/msi_bus
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/numa_node
-Lines: 1
--1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/resource
-Lines: 13
-0x00000000ec200000 0x00000000ec21ffff 0x0000000000040200
-0x0000000000000000 0x0000000000000000 0x0000000000000000
-0x0000000000000000 0x0000000000000000 0x0000000000000000
-0x0000000000000000 0x0000000000000000 0x0000000000000000
-0x0000000000000000 0x0000000000000000 0x0000000000000000
-0x0000000000000000 0x0000000000000000 0x0000000000000000
-0x0000000000000000 0x0000000000000000 0x0000000000000000
-0x0000000000000000 0x0000000000000000 0x0000000000000000
-0x0000000000000000 0x0000000000000000 0x0000000000000000
-0x0000000000000000 0x0000000000000000 0x0000000000000000
-0x0000000000000000 0x0000000000000000 0x0000000000000000
-0x0000000000000000 0x0000000000000000 0x0000000000000000
-0x0000000000000000 0x0000000000000000 0x0000000000000000
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/revision
-Lines: 1
-0x21
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/subsystem_device
-Lines: 1
-0x225a
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/subsystem_vendor
-Lines: 1
-0x17aa
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/uevent
-Lines: 6
-DRIVER=e1000e
-PCI_CLASS=20000
-PCI_ID=8086:15D7
-PCI_SUBSYS_ID=17AA:225A
-PCI_SLOT_NAME=0000:00:1f.6
-MODALIAS=pci:v00008086d000015D7sv000017AAsd0000225Abc02sc00i00
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/vendor
-Lines: 1
-0x8086
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/rbd
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/rbd/0
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/rbd/0/name
-Lines: 1
-demo
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/rbd/0/pool
-Lines: 1
-iscsi-images
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/rbd/1
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/rbd/1/name
-Lines: 1
-wrong
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/rbd/1/pool
-Lines: 1
-wrong-images
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/system
-Mode: 775
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/system/clocksource
-Mode: 775
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/system/clocksource/clocksource0
-Mode: 775
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/clocksource/clocksource0/available_clocksource
-Lines: 1
-tsc hpet acpi_pm
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/clocksource/clocksource0/current_clocksource
-Lines: 1
-tsc
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/system/cpu
-Mode: 775
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/system/cpu/cpu0
-Mode: 775
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu0/cpufreq
-SymlinkTo: ../cpufreq/policy0
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/system/cpu/cpu0/thermal_throttle
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu0/thermal_throttle/core_throttle_count
-Lines: 1
-10084
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu0/thermal_throttle/package_throttle_count
-Lines: 1
-34818
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/system/cpu/cpu0/topology
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu0/topology/core_id
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu0/topology/core_siblings
-Lines: 1
-ff
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu0/topology/core_siblings_list
-Lines: 1
-0-7
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu0/topology/physical_package_id
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu0/topology/thread_siblings
-Lines: 1
-11
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu0/topology/thread_siblings_list
-Lines: 1
-0,4
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/system/cpu/cpu1
-Mode: 775
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/system/cpu/cpu1/cpufreq
-Mode: 775
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_cur_freq
-Lines: 1
-1200195
-Mode: 400
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_max_freq
-Lines: 1
-3300000
-Mode: 664
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_min_freq
-Lines: 1
-1200000
-Mode: 664
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_transition_latency
-Lines: 1
-4294967295
-Mode: 664
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu1/cpufreq/related_cpus
-Lines: 1
-1
-Mode: 664
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu1/cpufreq/scaling_available_governors
-Lines: 1
-performance powersave
-Mode: 664
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu1/cpufreq/scaling_driver
-Lines: 1
-intel_pstate
-Mode: 664
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
-Lines: 1
-powersave
-Mode: 664
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
-Lines: 1
-3300000
-Mode: 664
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
-Lines: 1
-1200000
-Mode: 664
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu1/cpufreq/scaling_setspeed
-Lines: 1
-
-Mode: 664
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/system/cpu/cpu1/thermal_throttle
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu1/thermal_throttle/core_throttle_count
-Lines: 1
-523
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu1/thermal_throttle/package_throttle_count
-Lines: 1
-34818
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/system/cpu/cpu1/topology
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu1/topology/core_id
-Lines: 1
-1
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu1/topology/core_siblings
-Lines: 1
-ff
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu1/topology/core_siblings_list
-Lines: 1
-0-7
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu1/topology/physical_package_id
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu1/topology/thread_siblings
-Lines: 1
-22
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpu1/topology/thread_siblings_list
-Lines: 1
-1,5
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/system/cpu/cpufreq
-Mode: 775
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/system/cpu/cpufreq/policy0
-Mode: 775
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpufreq/policy0/affected_cpus
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_max_freq
-Lines: 1
-2400000
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_min_freq
-Lines: 1
-800000
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_transition_latency
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpufreq/policy0/related_cpus
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpufreq/policy0/scaling_available_governors
-Lines: 1
-performance powersave
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq
-Lines: 1
-1219917
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpufreq/policy0/scaling_driver
-Lines: 1
-intel_pstate
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpufreq/policy0/scaling_governor
-Lines: 1
-powersave
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq
-Lines: 1
-2400000
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
-Lines: 1
-800000
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed
-Lines: 1
-
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/devices/system/cpu/cpufreq/policy1
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/bcache
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/average_key_size
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0
-Mode: 777
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/dirty_data
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_day
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_day/bypassed
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_day/cache_bypass_hits
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_day/cache_bypass_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_day/cache_hit_ratio
-Lines: 1
-100
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_day/cache_hits
-Lines: 1
-289
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_day/cache_miss_collisions
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_day/cache_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_day/cache_readaheads
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_five_minute
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_five_minute/bypassed
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_five_minute/cache_bypass_hits
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_five_minute/cache_bypass_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_five_minute/cache_hit_ratio
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_five_minute/cache_hits
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_five_minute/cache_miss_collisions
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_five_minute/cache_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_five_minute/cache_readaheads
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_hour
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_hour/bypassed
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_hour/cache_bypass_hits
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_hour/cache_bypass_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_hour/cache_hit_ratio
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_hour/cache_hits
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_hour/cache_miss_collisions
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_hour/cache_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_hour/cache_readaheads
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_total
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_total/bypassed
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_total/cache_bypass_hits
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_total/cache_bypass_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_total/cache_hit_ratio
-Lines: 1
-100
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_total/cache_hits
-Lines: 1
-546
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_total/cache_miss_collisions
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_total/cache_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/stats_total/cache_readaheads
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/btree_cache_size
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/cache0
-Mode: 777
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/cache0/io_errors
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/cache0/metadata_written
-Lines: 1
-512
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/cache0/priority_stats
-Lines: 5
-Unused: 99%
-Metadata: 0%
-Average: 10473
-Sectors per Q: 64
-Quantiles: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946 20946]
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/cache0/written
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/cache_available_percent
-Lines: 1
-100
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/congested
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/internal
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/internal/active_journal_entries
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/internal/btree_nodes
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/internal/btree_read_average_duration_us
-Lines: 1
-1305
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/internal/cache_read_races
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/root_usage_percent
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_day
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_day/bypassed
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_day/cache_bypass_hits
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_day/cache_bypass_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_day/cache_hit_ratio
-Lines: 1
-100
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_day/cache_hits
-Lines: 1
-289
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_day/cache_miss_collisions
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_day/cache_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_day/cache_readaheads
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_five_minute
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_five_minute/bypassed
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_five_minute/cache_bypass_hits
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_five_minute/cache_bypass_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_five_minute/cache_hit_ratio
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_five_minute/cache_hits
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_five_minute/cache_miss_collisions
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_five_minute/cache_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_five_minute/cache_readaheads
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_hour
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_hour/bypassed
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_hour/cache_bypass_hits
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_hour/cache_bypass_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_hour/cache_hit_ratio
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_hour/cache_hits
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_hour/cache_miss_collisions
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_hour/cache_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_hour/cache_readaheads
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_total
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_total/bypassed
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_total/cache_bypass_hits
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_total/cache_bypass_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_total/cache_hit_ratio
-Lines: 1
-100
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_total/cache_hits
-Lines: 1
-546
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_total/cache_miss_collisions
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_total/cache_misses
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/stats_total/cache_readaheads
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/tree_depth
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/btrfs
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/bytes_may_use
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/bytes_pinned
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/bytes_readonly
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/bytes_reserved
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/bytes_used
-Lines: 1
-808189952
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/disk_total
-Lines: 1
-2147483648
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/disk_used
-Lines: 1
-808189952
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/flags
-Lines: 1
-1
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/raid0
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/raid0/total_bytes
-Lines: 1
-2147483648
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/raid0/used_bytes
-Lines: 1
-808189952
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/total_bytes
-Lines: 1
-2147483648
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/total_bytes_pinned
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/global_rsv_reserved
-Lines: 1
-16777216
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/global_rsv_size
-Lines: 1
-16777216
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/bytes_may_use
-Lines: 1
-16777216
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/bytes_pinned
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/bytes_readonly
-Lines: 1
-131072
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/bytes_reserved
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/bytes_used
-Lines: 1
-933888
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/disk_total
-Lines: 1
-2147483648
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/disk_used
-Lines: 1
-1867776
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/flags
-Lines: 1
-4
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/raid1
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/raid1/total_bytes
-Lines: 1
-1073741824
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/raid1/used_bytes
-Lines: 1
-933888
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/total_bytes
-Lines: 1
-1073741824
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/total_bytes_pinned
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/bytes_may_use
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/bytes_pinned
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/bytes_readonly
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/bytes_reserved
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/bytes_used
-Lines: 1
-16384
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/disk_total
-Lines: 1
-16777216
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/disk_used
-Lines: 1
-32768
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/flags
-Lines: 1
-2
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/raid1
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/raid1/total_bytes
-Lines: 1
-8388608
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/raid1/used_bytes
-Lines: 1
-16384
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/total_bytes
-Lines: 1
-8388608
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/total_bytes_pinned
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/clone_alignment
-Lines: 1
-4096
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/devices
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/devices/loop25
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/devices/loop25/size
-Lines: 1
-20971520
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/devices/loop26
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/devices/loop26/size
-Lines: 1
-20971520
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/features
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/features/big_metadata
-Lines: 1
-1
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/features/extended_iref
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/features/mixed_backref
-Lines: 1
-1
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/features/skinny_metadata
-Lines: 1
-1
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/label
-Lines: 1
-fixture
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/metadata_uuid
-Lines: 1
-0abb23a9-579b-43e6-ad30-227ef47fcb9d
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/nodesize
-Lines: 1
-16384
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/quota_override
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/sectorsize
-Lines: 1
-4096
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/bytes_may_use
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/bytes_pinned
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/bytes_readonly
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/bytes_reserved
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/bytes_used
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/disk_total
-Lines: 1
-644087808
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/disk_used
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/flags
-Lines: 1
-1
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/raid5
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/raid5/total_bytes
-Lines: 1
-644087808
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/raid5/used_bytes
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/total_bytes
-Lines: 1
-644087808
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/total_bytes_pinned
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/global_rsv_reserved
-Lines: 1
-16777216
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/global_rsv_size
-Lines: 1
-16777216
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/bytes_may_use
-Lines: 1
-16777216
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/bytes_pinned
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/bytes_readonly
-Lines: 1
-262144
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/bytes_reserved
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/bytes_used
-Lines: 1
-114688
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/disk_total
-Lines: 1
-429391872
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/disk_used
-Lines: 1
-114688
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/flags
-Lines: 1
-4
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/raid6
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/raid6/total_bytes
-Lines: 1
-429391872
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/raid6/used_bytes
-Lines: 1
-114688
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/total_bytes
-Lines: 1
-429391872
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/total_bytes_pinned
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/bytes_may_use
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/bytes_pinned
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/bytes_readonly
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/bytes_reserved
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/bytes_used
-Lines: 1
-16384
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/disk_total
-Lines: 1
-16777216
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/disk_used
-Lines: 1
-16384
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/flags
-Lines: 1
-2
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/raid6
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/raid6/total_bytes
-Lines: 1
-16777216
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/raid6/used_bytes
-Lines: 1
-16384
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/total_bytes
-Lines: 1
-16777216
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/total_bytes_pinned
-Lines: 1
-0
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/clone_alignment
-Lines: 1
-4096
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/devices
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/devices/loop22
-SymlinkTo: ../../../../devices/virtual/block/loop22
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/devices/loop23
-SymlinkTo: ../../../../devices/virtual/block/loop23
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/devices/loop24
-SymlinkTo: ../../../../devices/virtual/block/loop24
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/devices/loop25
-SymlinkTo: ../../../../devices/virtual/block/loop25
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/features
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/features/big_metadata
-Lines: 1
-1
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/features/extended_iref
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/features/mixed_backref
-Lines: 1
-1
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/features/raid56
-Lines: 1
-1
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/features/skinny_metadata
-Lines: 1
-1
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/label
-Lines: 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/metadata_uuid
-Lines: 1
-7f07c59f-6136-449c-ab87-e1cf2328731b
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/nodesize
-Lines: 1
-16384
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/quota_override
-Lines: 1
-0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/sectorsize
-Lines: 1
-4096
-Mode: 444
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/xfs
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/xfs/sda1
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/xfs/sda1/stats
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/xfs/sda1/stats/stats
-Lines: 1
-extent_alloc 1 0 0 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/xfs/sdb1
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/fs/xfs/sdb1/stats
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/fs/xfs/sdb1/stats/stats
-Lines: 1
-extent_alloc 2 0 0 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/core
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/core/fileio_0
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/core/fileio_1
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/core/fileio_1/file_lio_1G
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/core/fileio_1/file_lio_1G/enable
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/core/fileio_1/file_lio_1G/udev_path
-Lines: 1
-/home/iscsi/file_back_1G
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/core/iblock_0
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/core/iblock_0/block_lio_rbd1
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/core/iblock_0/block_lio_rbd1/enable
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/core/iblock_0/block_lio_rbd1/udev_path
-Lines: 1
-/dev/rbd1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/core/rbd_0
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/core/rbd_0/iscsi-images-demo
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/core/rbd_0/iscsi-images-demo/enable
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/core/rbd_0/iscsi-images-demo/udev_path
-Lines: 1
-/dev/rbd/iscsi-images/demo
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/core/rd_mcp_119
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/core/rd_mcp_119/ramdisk_lio_1G
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/core/rd_mcp_119/ramdisk_lio_1G/enable
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/core/rd_mcp_119/ramdisk_lio_1G/udev_path
-Lines: 0
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/enable
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun/lun_0
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun/lun_0/7f4a4eb56d
-SymlinkTo: ../../../../../../target/core/rd_mcp_119/ramdisk_lio_1G
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun/lun_0/statistics
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/in_cmds
-Lines: 1
-204950
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/read_mbytes
-Lines: 1
-10325
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/write_mbytes
-Lines: 1
-40325
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/enable
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun/lun_0
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun/lun_0/795b7c7026
-SymlinkTo: ../../../../../../target/core/iblock_0/block_lio_rbd1
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun/lun_0/statistics
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun/lun_0/statistics/scsi_tgt_port
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/in_cmds
-Lines: 1
-104950
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/read_mbytes
-Lines: 1
-20095
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/write_mbytes
-Lines: 1
-71235
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/enable
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun/lun_0
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun/lun_0/fff5e16686
-SymlinkTo: ../../../../../../target/core/fileio_1/file_lio_1G
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun/lun_0/statistics
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/in_cmds
-Lines: 1
-301950
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/read_mbytes
-Lines: 1
-10195
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/write_mbytes
-Lines: 1
-30195
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/enable
-Lines: 1
-1
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun/lun_0
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun/lun_0/eba1edf893
-SymlinkTo: ../../../../../../target/core/rbd_0/iscsi-images-demo
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun/lun_0/statistics
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun/lun_0/statistics/scsi_tgt_port
-Mode: 755
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/in_cmds
-Lines: 1
-1234
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/read_mbytes
-Lines: 1
-1504
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/write_mbytes
-Lines: 1
-4733
-Mode: 644
-# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/vendor/github.com/prometheus/procfs/fs.go b/vendor/github.com/prometheus/procfs/fs.go
deleted file mode 100644
index 0102ab0..0000000
--- a/vendor/github.com/prometheus/procfs/fs.go
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "github.com/prometheus/procfs/internal/fs"
-)
-
-// FS represents the pseudo-filesystem sys, which provides an interface to
-// kernel data structures.
-type FS struct {
- proc fs.FS
-}
-
-// DefaultMountPoint is the common mount point of the proc filesystem.
-const DefaultMountPoint = fs.DefaultProcMountPoint
-
-// NewDefaultFS returns a new proc FS mounted under the default proc mountPoint.
-// It will error if the mount point directory can't be read or is a file.
-func NewDefaultFS() (FS, error) {
- return NewFS(DefaultMountPoint)
-}
-
-// NewFS returns a new proc FS mounted under the given proc mountPoint. It will error
-// if the mount point directory can't be read or is a file.
-func NewFS(mountPoint string) (FS, error) {
- fs, err := fs.NewFS(mountPoint)
- if err != nil {
- return FS{}, err
- }
- return FS{fs}, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/go.mod b/vendor/github.com/prometheus/procfs/go.mod
deleted file mode 100644
index 0e04e5d..0000000
--- a/vendor/github.com/prometheus/procfs/go.mod
+++ /dev/null
@@ -1,8 +0,0 @@
-module github.com/prometheus/procfs
-
-go 1.12
-
-require (
- github.com/google/go-cmp v0.3.1
- golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
-)
diff --git a/vendor/github.com/prometheus/procfs/go.sum b/vendor/github.com/prometheus/procfs/go.sum
deleted file mode 100644
index 33b824b..0000000
--- a/vendor/github.com/prometheus/procfs/go.sum
+++ /dev/null
@@ -1,4 +0,0 @@
-github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg=
-github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
-golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=
-golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
diff --git a/vendor/github.com/prometheus/procfs/internal/fs/fs.go b/vendor/github.com/prometheus/procfs/internal/fs/fs.go
deleted file mode 100644
index 565e89e..0000000
--- a/vendor/github.com/prometheus/procfs/internal/fs/fs.go
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package fs
-
-import (
- "fmt"
- "os"
- "path/filepath"
-)
-
-const (
- // DefaultProcMountPoint is the common mount point of the proc filesystem.
- DefaultProcMountPoint = "/proc"
-
- // DefaultSysMountPoint is the common mount point of the sys filesystem.
- DefaultSysMountPoint = "/sys"
-
- // DefaultConfigfsMountPoint is the common mount point of the configfs
- DefaultConfigfsMountPoint = "/sys/kernel/config"
-)
-
-// FS represents a pseudo-filesystem, normally /proc or /sys, which provides an
-// interface to kernel data structures.
-type FS string
-
-// NewFS returns a new FS mounted under the given mountPoint. It will error
-// if the mount point can't be read.
-func NewFS(mountPoint string) (FS, error) {
- info, err := os.Stat(mountPoint)
- if err != nil {
- return "", fmt.Errorf("could not read %s: %s", mountPoint, err)
- }
- if !info.IsDir() {
- return "", fmt.Errorf("mount point %s is not a directory", mountPoint)
- }
-
- return FS(mountPoint), nil
-}
-
-// Path appends the given path elements to the filesystem path, adding separators
-// as necessary.
-func (fs FS) Path(p ...string) string {
- return filepath.Join(append([]string{string(fs)}, p...)...)
-}
diff --git a/vendor/github.com/prometheus/procfs/internal/util/parse.go b/vendor/github.com/prometheus/procfs/internal/util/parse.go
deleted file mode 100644
index 755591d..0000000
--- a/vendor/github.com/prometheus/procfs/internal/util/parse.go
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package util
-
-import (
- "io/ioutil"
- "strconv"
- "strings"
-)
-
-// ParseUint32s parses a slice of strings into a slice of uint32s.
-func ParseUint32s(ss []string) ([]uint32, error) {
- us := make([]uint32, 0, len(ss))
- for _, s := range ss {
- u, err := strconv.ParseUint(s, 10, 32)
- if err != nil {
- return nil, err
- }
-
- us = append(us, uint32(u))
- }
-
- return us, nil
-}
-
-// ParseUint64s parses a slice of strings into a slice of uint64s.
-func ParseUint64s(ss []string) ([]uint64, error) {
- us := make([]uint64, 0, len(ss))
- for _, s := range ss {
- u, err := strconv.ParseUint(s, 10, 64)
- if err != nil {
- return nil, err
- }
-
- us = append(us, u)
- }
-
- return us, nil
-}
-
-// ParsePInt64s parses a slice of strings into a slice of int64 pointers.
-func ParsePInt64s(ss []string) ([]*int64, error) {
- us := make([]*int64, 0, len(ss))
- for _, s := range ss {
- u, err := strconv.ParseInt(s, 10, 64)
- if err != nil {
- return nil, err
- }
-
- us = append(us, &u)
- }
-
- return us, nil
-}
-
-// ReadUintFromFile reads a file and attempts to parse a uint64 from it.
-func ReadUintFromFile(path string) (uint64, error) {
- data, err := ioutil.ReadFile(path)
- if err != nil {
- return 0, err
- }
- return strconv.ParseUint(strings.TrimSpace(string(data)), 10, 64)
-}
-
-// ParseBool parses a string into a boolean pointer.
-func ParseBool(b string) *bool {
- var truth bool
- switch b {
- case "enabled":
- truth = true
- case "disabled":
- truth = false
- default:
- return nil
- }
- return &truth
-}
diff --git a/vendor/github.com/prometheus/procfs/internal/util/readfile.go b/vendor/github.com/prometheus/procfs/internal/util/readfile.go
deleted file mode 100644
index 8051161..0000000
--- a/vendor/github.com/prometheus/procfs/internal/util/readfile.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package util
-
-import (
- "io"
- "io/ioutil"
- "os"
-)
-
-// ReadFileNoStat uses ioutil.ReadAll to read contents of entire file.
-// This is similar to ioutil.ReadFile but without the call to os.Stat, because
-// many files in /proc and /sys report incorrect file sizes (either 0 or 4096).
-// Reads a max file size of 512kB. For files larger than this, a scanner
-// should be used.
-func ReadFileNoStat(filename string) ([]byte, error) {
- const maxBufferSize = 1024 * 512
-
- f, err := os.Open(filename)
- if err != nil {
- return nil, err
- }
- defer f.Close()
-
- reader := io.LimitReader(f, maxBufferSize)
- return ioutil.ReadAll(reader)
-}
diff --git a/vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go b/vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go
deleted file mode 100644
index c07de0b..0000000
--- a/vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build linux,!appengine
-
-package util
-
-import (
- "bytes"
- "os"
- "syscall"
-)
-
-// SysReadFile is a simplified ioutil.ReadFile that invokes syscall.Read directly.
-// https://github.com/prometheus/node_exporter/pull/728/files
-//
-// Note that this function will not read files larger than 128 bytes.
-func SysReadFile(file string) (string, error) {
- f, err := os.Open(file)
- if err != nil {
- return "", err
- }
- defer f.Close()
-
- // On some machines, hwmon drivers are broken and return EAGAIN. This causes
- // Go's ioutil.ReadFile implementation to poll forever.
- //
- // Since we either want to read data or bail immediately, do the simplest
- // possible read using syscall directly.
- const sysFileBufferSize = 128
- b := make([]byte, sysFileBufferSize)
- n, err := syscall.Read(int(f.Fd()), b)
- if err != nil {
- return "", err
- }
-
- return string(bytes.TrimSpace(b[:n])), nil
-}
diff --git a/vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go b/vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go
deleted file mode 100644
index bd55b45..0000000
--- a/vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build linux,appengine !linux
-
-package util
-
-import (
- "fmt"
-)
-
-// SysReadFile is here implemented as a noop for builds that do not support
-// the read syscall. For example Windows, or Linux on Google App Engine.
-func SysReadFile(file string) (string, error) {
- return "", fmt.Errorf("not supported on this platform")
-}
diff --git a/vendor/github.com/prometheus/procfs/internal/util/valueparser.go b/vendor/github.com/prometheus/procfs/internal/util/valueparser.go
deleted file mode 100644
index fe2355d..0000000
--- a/vendor/github.com/prometheus/procfs/internal/util/valueparser.go
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package util
-
-import (
- "strconv"
-)
-
-// TODO(mdlayher): util packages are an anti-pattern and this should be moved
-// somewhere else that is more focused in the future.
-
-// A ValueParser enables parsing a single string into a variety of data types
-// in a concise and safe way. The Err method must be invoked after invoking
-// any other methods to ensure a value was successfully parsed.
-type ValueParser struct {
- v string
- err error
-}
-
-// NewValueParser creates a ValueParser using the input string.
-func NewValueParser(v string) *ValueParser {
- return &ValueParser{v: v}
-}
-
-// Int interprets the underlying value as an int and returns that value.
-func (vp *ValueParser) Int() int { return int(vp.int64()) }
-
-// PInt64 interprets the underlying value as an int64 and returns a pointer to
-// that value.
-func (vp *ValueParser) PInt64() *int64 {
- if vp.err != nil {
- return nil
- }
-
- v := vp.int64()
- return &v
-}
-
-// int64 interprets the underlying value as an int64 and returns that value.
-// TODO: export if/when necessary.
-func (vp *ValueParser) int64() int64 {
- if vp.err != nil {
- return 0
- }
-
- // A base value of zero makes ParseInt infer the correct base using the
- // string's prefix, if any.
- const base = 0
- v, err := strconv.ParseInt(vp.v, base, 64)
- if err != nil {
- vp.err = err
- return 0
- }
-
- return v
-}
-
-// PUInt64 interprets the underlying value as an uint64 and returns a pointer to
-// that value.
-func (vp *ValueParser) PUInt64() *uint64 {
- if vp.err != nil {
- return nil
- }
-
- // A base value of zero makes ParseInt infer the correct base using the
- // string's prefix, if any.
- const base = 0
- v, err := strconv.ParseUint(vp.v, base, 64)
- if err != nil {
- vp.err = err
- return nil
- }
-
- return &v
-}
-
-// Err returns the last error, if any, encountered by the ValueParser.
-func (vp *ValueParser) Err() error {
- return vp.err
-}
diff --git a/vendor/github.com/prometheus/procfs/ipvs.go b/vendor/github.com/prometheus/procfs/ipvs.go
deleted file mode 100644
index 89e4477..0000000
--- a/vendor/github.com/prometheus/procfs/ipvs.go
+++ /dev/null
@@ -1,241 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "encoding/hex"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "net"
- "os"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// IPVSStats holds IPVS statistics, as exposed by the kernel in `/proc/net/ip_vs_stats`.
-type IPVSStats struct {
- // Total count of connections.
- Connections uint64
- // Total incoming packages processed.
- IncomingPackets uint64
- // Total outgoing packages processed.
- OutgoingPackets uint64
- // Total incoming traffic.
- IncomingBytes uint64
- // Total outgoing traffic.
- OutgoingBytes uint64
-}
-
-// IPVSBackendStatus holds current metrics of one virtual / real address pair.
-type IPVSBackendStatus struct {
- // The local (virtual) IP address.
- LocalAddress net.IP
- // The remote (real) IP address.
- RemoteAddress net.IP
- // The local (virtual) port.
- LocalPort uint16
- // The remote (real) port.
- RemotePort uint16
- // The local firewall mark
- LocalMark string
- // The transport protocol (TCP, UDP).
- Proto string
- // The current number of active connections for this virtual/real address pair.
- ActiveConn uint64
- // The current number of inactive connections for this virtual/real address pair.
- InactConn uint64
- // The current weight of this virtual/real address pair.
- Weight uint64
-}
-
-// IPVSStats reads the IPVS statistics from the specified `proc` filesystem.
-func (fs FS) IPVSStats() (IPVSStats, error) {
- data, err := util.ReadFileNoStat(fs.proc.Path("net/ip_vs_stats"))
- if err != nil {
- return IPVSStats{}, err
- }
-
- return parseIPVSStats(bytes.NewReader(data))
-}
-
-// parseIPVSStats performs the actual parsing of `ip_vs_stats`.
-func parseIPVSStats(r io.Reader) (IPVSStats, error) {
- var (
- statContent []byte
- statLines []string
- statFields []string
- stats IPVSStats
- )
-
- statContent, err := ioutil.ReadAll(r)
- if err != nil {
- return IPVSStats{}, err
- }
-
- statLines = strings.SplitN(string(statContent), "\n", 4)
- if len(statLines) != 4 {
- return IPVSStats{}, errors.New("ip_vs_stats corrupt: too short")
- }
-
- statFields = strings.Fields(statLines[2])
- if len(statFields) != 5 {
- return IPVSStats{}, errors.New("ip_vs_stats corrupt: unexpected number of fields")
- }
-
- stats.Connections, err = strconv.ParseUint(statFields[0], 16, 64)
- if err != nil {
- return IPVSStats{}, err
- }
- stats.IncomingPackets, err = strconv.ParseUint(statFields[1], 16, 64)
- if err != nil {
- return IPVSStats{}, err
- }
- stats.OutgoingPackets, err = strconv.ParseUint(statFields[2], 16, 64)
- if err != nil {
- return IPVSStats{}, err
- }
- stats.IncomingBytes, err = strconv.ParseUint(statFields[3], 16, 64)
- if err != nil {
- return IPVSStats{}, err
- }
- stats.OutgoingBytes, err = strconv.ParseUint(statFields[4], 16, 64)
- if err != nil {
- return IPVSStats{}, err
- }
-
- return stats, nil
-}
-
-// IPVSBackendStatus reads and returns the status of all (virtual,real) server pairs from the specified `proc` filesystem.
-func (fs FS) IPVSBackendStatus() ([]IPVSBackendStatus, error) {
- file, err := os.Open(fs.proc.Path("net/ip_vs"))
- if err != nil {
- return nil, err
- }
- defer file.Close()
-
- return parseIPVSBackendStatus(file)
-}
-
-func parseIPVSBackendStatus(file io.Reader) ([]IPVSBackendStatus, error) {
- var (
- status []IPVSBackendStatus
- scanner = bufio.NewScanner(file)
- proto string
- localMark string
- localAddress net.IP
- localPort uint16
- err error
- )
-
- for scanner.Scan() {
- fields := strings.Fields(scanner.Text())
- if len(fields) == 0 {
- continue
- }
- switch {
- case fields[0] == "IP" || fields[0] == "Prot" || fields[1] == "RemoteAddress:Port":
- continue
- case fields[0] == "TCP" || fields[0] == "UDP":
- if len(fields) < 2 {
- continue
- }
- proto = fields[0]
- localMark = ""
- localAddress, localPort, err = parseIPPort(fields[1])
- if err != nil {
- return nil, err
- }
- case fields[0] == "FWM":
- if len(fields) < 2 {
- continue
- }
- proto = fields[0]
- localMark = fields[1]
- localAddress = nil
- localPort = 0
- case fields[0] == "->":
- if len(fields) < 6 {
- continue
- }
- remoteAddress, remotePort, err := parseIPPort(fields[1])
- if err != nil {
- return nil, err
- }
- weight, err := strconv.ParseUint(fields[3], 10, 64)
- if err != nil {
- return nil, err
- }
- activeConn, err := strconv.ParseUint(fields[4], 10, 64)
- if err != nil {
- return nil, err
- }
- inactConn, err := strconv.ParseUint(fields[5], 10, 64)
- if err != nil {
- return nil, err
- }
- status = append(status, IPVSBackendStatus{
- LocalAddress: localAddress,
- LocalPort: localPort,
- LocalMark: localMark,
- RemoteAddress: remoteAddress,
- RemotePort: remotePort,
- Proto: proto,
- Weight: weight,
- ActiveConn: activeConn,
- InactConn: inactConn,
- })
- }
- }
- return status, nil
-}
-
-func parseIPPort(s string) (net.IP, uint16, error) {
- var (
- ip net.IP
- err error
- )
-
- switch len(s) {
- case 13:
- ip, err = hex.DecodeString(s[0:8])
- if err != nil {
- return nil, 0, err
- }
- case 46:
- ip = net.ParseIP(s[1:40])
- if ip == nil {
- return nil, 0, fmt.Errorf("invalid IPv6 address: %s", s[1:40])
- }
- default:
- return nil, 0, fmt.Errorf("unexpected IP:Port: %s", s)
- }
-
- portString := s[len(s)-4:]
- if len(portString) != 4 {
- return nil, 0, fmt.Errorf("unexpected port string format: %s", portString)
- }
- port, err := strconv.ParseUint(portString, 16, 16)
- if err != nil {
- return nil, 0, err
- }
-
- return ip, uint16(port), nil
-}
diff --git a/vendor/github.com/prometheus/procfs/mdstat.go b/vendor/github.com/prometheus/procfs/mdstat.go
deleted file mode 100644
index 2af3ada..0000000
--- a/vendor/github.com/prometheus/procfs/mdstat.go
+++ /dev/null
@@ -1,194 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "fmt"
- "io/ioutil"
- "regexp"
- "strconv"
- "strings"
-)
-
-var (
- statusLineRE = regexp.MustCompile(`(\d+) blocks .*\[(\d+)/(\d+)\] \[[U_]+\]`)
- recoveryLineRE = regexp.MustCompile(`\((\d+)/\d+\)`)
-)
-
-// MDStat holds info parsed from /proc/mdstat.
-type MDStat struct {
- // Name of the device.
- Name string
- // activity-state of the device.
- ActivityState string
- // Number of active disks.
- DisksActive int64
- // Total number of disks the device requires.
- DisksTotal int64
- // Number of failed disks.
- DisksFailed int64
- // Spare disks in the device.
- DisksSpare int64
- // Number of blocks the device holds.
- BlocksTotal int64
- // Number of blocks on the device that are in sync.
- BlocksSynced int64
-}
-
-// MDStat parses an mdstat-file (/proc/mdstat) and returns a slice of
-// structs containing the relevant info. More information available here:
-// https://raid.wiki.kernel.org/index.php/Mdstat
-func (fs FS) MDStat() ([]MDStat, error) {
- data, err := ioutil.ReadFile(fs.proc.Path("mdstat"))
- if err != nil {
- return nil, fmt.Errorf("error parsing mdstat %s: %s", fs.proc.Path("mdstat"), err)
- }
- mdstat, err := parseMDStat(data)
- if err != nil {
- return nil, fmt.Errorf("error parsing mdstat %s: %s", fs.proc.Path("mdstat"), err)
- }
- return mdstat, nil
-}
-
-// parseMDStat parses data from mdstat file (/proc/mdstat) and returns a slice of
-// structs containing the relevant info.
-func parseMDStat(mdStatData []byte) ([]MDStat, error) {
- mdStats := []MDStat{}
- lines := strings.Split(string(mdStatData), "\n")
-
- for i, line := range lines {
- if strings.TrimSpace(line) == "" || line[0] == ' ' ||
- strings.HasPrefix(line, "Personalities") ||
- strings.HasPrefix(line, "unused") {
- continue
- }
-
- deviceFields := strings.Fields(line)
- if len(deviceFields) < 3 {
- return nil, fmt.Errorf("not enough fields in mdline (expected at least 3): %s", line)
- }
- mdName := deviceFields[0] // mdx
- state := deviceFields[2] // active or inactive
-
- if len(lines) <= i+3 {
- return nil, fmt.Errorf(
- "error parsing %s: too few lines for md device",
- mdName,
- )
- }
-
- // Failed disks have the suffix (F) & Spare disks have the suffix (S).
- fail := int64(strings.Count(line, "(F)"))
- spare := int64(strings.Count(line, "(S)"))
- active, total, size, err := evalStatusLine(lines[i], lines[i+1])
-
- if err != nil {
- return nil, fmt.Errorf("error parsing md device lines: %s", err)
- }
-
- syncLineIdx := i + 2
- if strings.Contains(lines[i+2], "bitmap") { // skip bitmap line
- syncLineIdx++
- }
-
- // If device is syncing at the moment, get the number of currently
- // synced bytes, otherwise that number equals the size of the device.
- syncedBlocks := size
- recovering := strings.Contains(lines[syncLineIdx], "recovery")
- resyncing := strings.Contains(lines[syncLineIdx], "resync")
-
- // Append recovery and resyncing state info.
- if recovering || resyncing {
- if recovering {
- state = "recovering"
- } else {
- state = "resyncing"
- }
-
- // Handle case when resync=PENDING or resync=DELAYED.
- if strings.Contains(lines[syncLineIdx], "PENDING") ||
- strings.Contains(lines[syncLineIdx], "DELAYED") {
- syncedBlocks = 0
- } else {
- syncedBlocks, err = evalRecoveryLine(lines[syncLineIdx])
- if err != nil {
- return nil, fmt.Errorf("error parsing sync line in md device %s: %s", mdName, err)
- }
- }
- }
-
- mdStats = append(mdStats, MDStat{
- Name: mdName,
- ActivityState: state,
- DisksActive: active,
- DisksFailed: fail,
- DisksSpare: spare,
- DisksTotal: total,
- BlocksTotal: size,
- BlocksSynced: syncedBlocks,
- })
- }
-
- return mdStats, nil
-}
-
-func evalStatusLine(deviceLine, statusLine string) (active, total, size int64, err error) {
-
- sizeStr := strings.Fields(statusLine)[0]
- size, err = strconv.ParseInt(sizeStr, 10, 64)
- if err != nil {
- return 0, 0, 0, fmt.Errorf("unexpected statusLine %s: %s", statusLine, err)
- }
-
- if strings.Contains(deviceLine, "raid0") || strings.Contains(deviceLine, "linear") {
- // In the device deviceLine, only disks have a number associated with them in [].
- total = int64(strings.Count(deviceLine, "["))
- return total, total, size, nil
- }
-
- if strings.Contains(deviceLine, "inactive") {
- return 0, 0, size, nil
- }
-
- matches := statusLineRE.FindStringSubmatch(statusLine)
- if len(matches) != 4 {
- return 0, 0, 0, fmt.Errorf("couldn't find all the substring matches: %s", statusLine)
- }
-
- total, err = strconv.ParseInt(matches[2], 10, 64)
- if err != nil {
- return 0, 0, 0, fmt.Errorf("unexpected statusLine %s: %s", statusLine, err)
- }
-
- active, err = strconv.ParseInt(matches[3], 10, 64)
- if err != nil {
- return 0, 0, 0, fmt.Errorf("unexpected statusLine %s: %s", statusLine, err)
- }
-
- return active, total, size, nil
-}
-
-func evalRecoveryLine(recoveryLine string) (syncedBlocks int64, err error) {
- matches := recoveryLineRE.FindStringSubmatch(recoveryLine)
- if len(matches) != 2 {
- return 0, fmt.Errorf("unexpected recoveryLine: %s", recoveryLine)
- }
-
- syncedBlocks, err = strconv.ParseInt(matches[1], 10, 64)
- if err != nil {
- return 0, fmt.Errorf("%s in recoveryLine: %s", err, recoveryLine)
- }
-
- return syncedBlocks, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/meminfo.go b/vendor/github.com/prometheus/procfs/meminfo.go
deleted file mode 100644
index 50dab4b..0000000
--- a/vendor/github.com/prometheus/procfs/meminfo.go
+++ /dev/null
@@ -1,277 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// Meminfo represents memory statistics.
-type Meminfo struct {
- // Total usable ram (i.e. physical ram minus a few reserved
- // bits and the kernel binary code)
- MemTotal uint64
- // The sum of LowFree+HighFree
- MemFree uint64
- // An estimate of how much memory is available for starting
- // new applications, without swapping. Calculated from
- // MemFree, SReclaimable, the size of the file LRU lists, and
- // the low watermarks in each zone. The estimate takes into
- // account that the system needs some page cache to function
- // well, and that not all reclaimable slab will be
- // reclaimable, due to items being in use. The impact of those
- // factors will vary from system to system.
- MemAvailable uint64
- // Relatively temporary storage for raw disk blocks shouldn't
- // get tremendously large (20MB or so)
- Buffers uint64
- Cached uint64
- // Memory that once was swapped out, is swapped back in but
- // still also is in the swapfile (if memory is needed it
- // doesn't need to be swapped out AGAIN because it is already
- // in the swapfile. This saves I/O)
- SwapCached uint64
- // Memory that has been used more recently and usually not
- // reclaimed unless absolutely necessary.
- Active uint64
- // Memory which has been less recently used. It is more
- // eligible to be reclaimed for other purposes
- Inactive uint64
- ActiveAnon uint64
- InactiveAnon uint64
- ActiveFile uint64
- InactiveFile uint64
- Unevictable uint64
- Mlocked uint64
- // total amount of swap space available
- SwapTotal uint64
- // Memory which has been evicted from RAM, and is temporarily
- // on the disk
- SwapFree uint64
- // Memory which is waiting to get written back to the disk
- Dirty uint64
- // Memory which is actively being written back to the disk
- Writeback uint64
- // Non-file backed pages mapped into userspace page tables
- AnonPages uint64
- // files which have been mapped, such as libraries
- Mapped uint64
- Shmem uint64
- // in-kernel data structures cache
- Slab uint64
- // Part of Slab, that might be reclaimed, such as caches
- SReclaimable uint64
- // Part of Slab, that cannot be reclaimed on memory pressure
- SUnreclaim uint64
- KernelStack uint64
- // amount of memory dedicated to the lowest level of page
- // tables.
- PageTables uint64
- // NFS pages sent to the server, but not yet committed to
- // stable storage
- NFSUnstable uint64
- // Memory used for block device "bounce buffers"
- Bounce uint64
- // Memory used by FUSE for temporary writeback buffers
- WritebackTmp uint64
- // Based on the overcommit ratio ('vm.overcommit_ratio'),
- // this is the total amount of memory currently available to
- // be allocated on the system. This limit is only adhered to
- // if strict overcommit accounting is enabled (mode 2 in
- // 'vm.overcommit_memory').
- // The CommitLimit is calculated with the following formula:
- // CommitLimit = ([total RAM pages] - [total huge TLB pages]) *
- // overcommit_ratio / 100 + [total swap pages]
- // For example, on a system with 1G of physical RAM and 7G
- // of swap with a `vm.overcommit_ratio` of 30 it would
- // yield a CommitLimit of 7.3G.
- // For more details, see the memory overcommit documentation
- // in vm/overcommit-accounting.
- CommitLimit uint64
- // The amount of memory presently allocated on the system.
- // The committed memory is a sum of all of the memory which
- // has been allocated by processes, even if it has not been
- // "used" by them as of yet. A process which malloc()'s 1G
- // of memory, but only touches 300M of it will show up as
- // using 1G. This 1G is memory which has been "committed" to
- // by the VM and can be used at any time by the allocating
- // application. With strict overcommit enabled on the system
- // (mode 2 in 'vm.overcommit_memory'),allocations which would
- // exceed the CommitLimit (detailed above) will not be permitted.
- // This is useful if one needs to guarantee that processes will
- // not fail due to lack of memory once that memory has been
- // successfully allocated.
- CommittedAS uint64
- // total size of vmalloc memory area
- VmallocTotal uint64
- // amount of vmalloc area which is used
- VmallocUsed uint64
- // largest contiguous block of vmalloc area which is free
- VmallocChunk uint64
- HardwareCorrupted uint64
- AnonHugePages uint64
- ShmemHugePages uint64
- ShmemPmdMapped uint64
- CmaTotal uint64
- CmaFree uint64
- HugePagesTotal uint64
- HugePagesFree uint64
- HugePagesRsvd uint64
- HugePagesSurp uint64
- Hugepagesize uint64
- DirectMap4k uint64
- DirectMap2M uint64
- DirectMap1G uint64
-}
-
-// Meminfo returns an information about current kernel/system memory statistics.
-// See https://www.kernel.org/doc/Documentation/filesystems/proc.txt
-func (fs FS) Meminfo() (Meminfo, error) {
- b, err := util.ReadFileNoStat(fs.proc.Path("meminfo"))
- if err != nil {
- return Meminfo{}, err
- }
-
- m, err := parseMemInfo(bytes.NewReader(b))
- if err != nil {
- return Meminfo{}, fmt.Errorf("failed to parse meminfo: %v", err)
- }
-
- return *m, nil
-}
-
-func parseMemInfo(r io.Reader) (*Meminfo, error) {
- var m Meminfo
- s := bufio.NewScanner(r)
- for s.Scan() {
- // Each line has at least a name and value; we ignore the unit.
- fields := strings.Fields(s.Text())
- if len(fields) < 2 {
- return nil, fmt.Errorf("malformed meminfo line: %q", s.Text())
- }
-
- v, err := strconv.ParseUint(fields[1], 0, 64)
- if err != nil {
- return nil, err
- }
-
- switch fields[0] {
- case "MemTotal:":
- m.MemTotal = v
- case "MemFree:":
- m.MemFree = v
- case "MemAvailable:":
- m.MemAvailable = v
- case "Buffers:":
- m.Buffers = v
- case "Cached:":
- m.Cached = v
- case "SwapCached:":
- m.SwapCached = v
- case "Active:":
- m.Active = v
- case "Inactive:":
- m.Inactive = v
- case "Active(anon):":
- m.ActiveAnon = v
- case "Inactive(anon):":
- m.InactiveAnon = v
- case "Active(file):":
- m.ActiveFile = v
- case "Inactive(file):":
- m.InactiveFile = v
- case "Unevictable:":
- m.Unevictable = v
- case "Mlocked:":
- m.Mlocked = v
- case "SwapTotal:":
- m.SwapTotal = v
- case "SwapFree:":
- m.SwapFree = v
- case "Dirty:":
- m.Dirty = v
- case "Writeback:":
- m.Writeback = v
- case "AnonPages:":
- m.AnonPages = v
- case "Mapped:":
- m.Mapped = v
- case "Shmem:":
- m.Shmem = v
- case "Slab:":
- m.Slab = v
- case "SReclaimable:":
- m.SReclaimable = v
- case "SUnreclaim:":
- m.SUnreclaim = v
- case "KernelStack:":
- m.KernelStack = v
- case "PageTables:":
- m.PageTables = v
- case "NFS_Unstable:":
- m.NFSUnstable = v
- case "Bounce:":
- m.Bounce = v
- case "WritebackTmp:":
- m.WritebackTmp = v
- case "CommitLimit:":
- m.CommitLimit = v
- case "Committed_AS:":
- m.CommittedAS = v
- case "VmallocTotal:":
- m.VmallocTotal = v
- case "VmallocUsed:":
- m.VmallocUsed = v
- case "VmallocChunk:":
- m.VmallocChunk = v
- case "HardwareCorrupted:":
- m.HardwareCorrupted = v
- case "AnonHugePages:":
- m.AnonHugePages = v
- case "ShmemHugePages:":
- m.ShmemHugePages = v
- case "ShmemPmdMapped:":
- m.ShmemPmdMapped = v
- case "CmaTotal:":
- m.CmaTotal = v
- case "CmaFree:":
- m.CmaFree = v
- case "HugePages_Total:":
- m.HugePagesTotal = v
- case "HugePages_Free:":
- m.HugePagesFree = v
- case "HugePages_Rsvd:":
- m.HugePagesRsvd = v
- case "HugePages_Surp:":
- m.HugePagesSurp = v
- case "Hugepagesize:":
- m.Hugepagesize = v
- case "DirectMap4k:":
- m.DirectMap4k = v
- case "DirectMap2M:":
- m.DirectMap2M = v
- case "DirectMap1G:":
- m.DirectMap1G = v
- }
- }
-
- return &m, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/mountinfo.go b/vendor/github.com/prometheus/procfs/mountinfo.go
deleted file mode 100644
index bb01bb5..0000000
--- a/vendor/github.com/prometheus/procfs/mountinfo.go
+++ /dev/null
@@ -1,180 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// A MountInfo is a type that describes the details, options
-// for each mount, parsed from /proc/self/mountinfo.
-// The fields described in each entry of /proc/self/mountinfo
-// is described in the following man page.
-// http://man7.org/linux/man-pages/man5/proc.5.html
-type MountInfo struct {
- // Unique Id for the mount
- MountId int
- // The Id of the parent mount
- ParentId int
- // The value of `st_dev` for the files on this FS
- MajorMinorVer string
- // The pathname of the directory in the FS that forms
- // the root for this mount
- Root string
- // The pathname of the mount point relative to the root
- MountPoint string
- // Mount options
- Options map[string]string
- // Zero or more optional fields
- OptionalFields map[string]string
- // The Filesystem type
- FSType string
- // FS specific information or "none"
- Source string
- // Superblock options
- SuperOptions map[string]string
-}
-
-// Reads each line of the mountinfo file, and returns a list of formatted MountInfo structs.
-func parseMountInfo(info []byte) ([]*MountInfo, error) {
- mounts := []*MountInfo{}
- scanner := bufio.NewScanner(bytes.NewReader(info))
- for scanner.Scan() {
- mountString := scanner.Text()
- parsedMounts, err := parseMountInfoString(mountString)
- if err != nil {
- return nil, err
- }
- mounts = append(mounts, parsedMounts)
- }
-
- err := scanner.Err()
- return mounts, err
-}
-
-// Parses a mountinfo file line, and converts it to a MountInfo struct.
-// An important check here is to see if the hyphen separator, as if it does not exist,
-// it means that the line is malformed.
-func parseMountInfoString(mountString string) (*MountInfo, error) {
- var err error
-
- mountInfo := strings.Split(mountString, " ")
- mountInfoLength := len(mountInfo)
- if mountInfoLength < 11 {
- return nil, fmt.Errorf("couldn't find enough fields in mount string: %s", mountString)
- }
-
- if mountInfo[mountInfoLength-4] != "-" {
- return nil, fmt.Errorf("couldn't find separator in expected field: %s", mountInfo[mountInfoLength-4])
- }
-
- mount := &MountInfo{
- MajorMinorVer: mountInfo[2],
- Root: mountInfo[3],
- MountPoint: mountInfo[4],
- Options: mountOptionsParser(mountInfo[5]),
- OptionalFields: nil,
- FSType: mountInfo[mountInfoLength-3],
- Source: mountInfo[mountInfoLength-2],
- SuperOptions: mountOptionsParser(mountInfo[mountInfoLength-1]),
- }
-
- mount.MountId, err = strconv.Atoi(mountInfo[0])
- if err != nil {
- return nil, fmt.Errorf("failed to parse mount ID")
- }
- mount.ParentId, err = strconv.Atoi(mountInfo[1])
- if err != nil {
- return nil, fmt.Errorf("failed to parse parent ID")
- }
- // Has optional fields, which is a space separated list of values.
- // Example: shared:2 master:7
- if mountInfo[6] != "" {
- mount.OptionalFields, err = mountOptionsParseOptionalFields(mountInfo[6 : mountInfoLength-4])
- if err != nil {
- return nil, err
- }
- }
- return mount, nil
-}
-
-// mountOptionsIsValidField checks a string against a valid list of optional fields keys.
-func mountOptionsIsValidField(s string) bool {
- switch s {
- case
- "shared",
- "master",
- "propagate_from",
- "unbindable":
- return true
- }
- return false
-}
-
-// mountOptionsParseOptionalFields parses a list of optional fields strings into a double map of strings.
-func mountOptionsParseOptionalFields(o []string) (map[string]string, error) {
- optionalFields := make(map[string]string)
- for _, field := range o {
- optionSplit := strings.SplitN(field, ":", 2)
- value := ""
- if len(optionSplit) == 2 {
- value = optionSplit[1]
- }
- if mountOptionsIsValidField(optionSplit[0]) {
- optionalFields[optionSplit[0]] = value
- }
- }
- return optionalFields, nil
-}
-
-// Parses the mount options, superblock options.
-func mountOptionsParser(mountOptions string) map[string]string {
- opts := make(map[string]string)
- options := strings.Split(mountOptions, ",")
- for _, opt := range options {
- splitOption := strings.Split(opt, "=")
- if len(splitOption) < 2 {
- key := splitOption[0]
- opts[key] = ""
- } else {
- key, value := splitOption[0], splitOption[1]
- opts[key] = value
- }
- }
- return opts
-}
-
-// Retrieves mountinfo information from `/proc/self/mountinfo`.
-func GetMounts() ([]*MountInfo, error) {
- data, err := util.ReadFileNoStat("/proc/self/mountinfo")
- if err != nil {
- return nil, err
- }
- return parseMountInfo(data)
-}
-
-// Retrieves mountinfo information from a processes' `/proc//mountinfo`.
-func GetProcMounts(pid int) ([]*MountInfo, error) {
- data, err := util.ReadFileNoStat(fmt.Sprintf("/proc/%d/mountinfo", pid))
- if err != nil {
- return nil, err
- }
- return parseMountInfo(data)
-}
diff --git a/vendor/github.com/prometheus/procfs/mountstats.go b/vendor/github.com/prometheus/procfs/mountstats.go
deleted file mode 100644
index 35b2ef3..0000000
--- a/vendor/github.com/prometheus/procfs/mountstats.go
+++ /dev/null
@@ -1,621 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-// While implementing parsing of /proc/[pid]/mountstats, this blog was used
-// heavily as a reference:
-// https://utcc.utoronto.ca/~cks/space/blog/linux/NFSMountstatsIndex
-//
-// Special thanks to Chris Siebenmann for all of his posts explaining the
-// various statistics available for NFS.
-
-import (
- "bufio"
- "fmt"
- "io"
- "strconv"
- "strings"
- "time"
-)
-
-// Constants shared between multiple functions.
-const (
- deviceEntryLen = 8
-
- fieldBytesLen = 8
- fieldEventsLen = 27
-
- statVersion10 = "1.0"
- statVersion11 = "1.1"
-
- fieldTransport10TCPLen = 10
- fieldTransport10UDPLen = 7
-
- fieldTransport11TCPLen = 13
- fieldTransport11UDPLen = 10
-)
-
-// A Mount is a device mount parsed from /proc/[pid]/mountstats.
-type Mount struct {
- // Name of the device.
- Device string
- // The mount point of the device.
- Mount string
- // The filesystem type used by the device.
- Type string
- // If available additional statistics related to this Mount.
- // Use a type assertion to determine if additional statistics are available.
- Stats MountStats
-}
-
-// A MountStats is a type which contains detailed statistics for a specific
-// type of Mount.
-type MountStats interface {
- mountStats()
-}
-
-// A MountStatsNFS is a MountStats implementation for NFSv3 and v4 mounts.
-type MountStatsNFS struct {
- // The version of statistics provided.
- StatVersion string
- // The mount options of the NFS mount.
- Opts map[string]string
- // The age of the NFS mount.
- Age time.Duration
- // Statistics related to byte counters for various operations.
- Bytes NFSBytesStats
- // Statistics related to various NFS event occurrences.
- Events NFSEventsStats
- // Statistics broken down by filesystem operation.
- Operations []NFSOperationStats
- // Statistics about the NFS RPC transport.
- Transport NFSTransportStats
-}
-
-// mountStats implements MountStats.
-func (m MountStatsNFS) mountStats() {}
-
-// A NFSBytesStats contains statistics about the number of bytes read and written
-// by an NFS client to and from an NFS server.
-type NFSBytesStats struct {
- // Number of bytes read using the read() syscall.
- Read uint64
- // Number of bytes written using the write() syscall.
- Write uint64
- // Number of bytes read using the read() syscall in O_DIRECT mode.
- DirectRead uint64
- // Number of bytes written using the write() syscall in O_DIRECT mode.
- DirectWrite uint64
- // Number of bytes read from the NFS server, in total.
- ReadTotal uint64
- // Number of bytes written to the NFS server, in total.
- WriteTotal uint64
- // Number of pages read directly via mmap()'d files.
- ReadPages uint64
- // Number of pages written directly via mmap()'d files.
- WritePages uint64
-}
-
-// A NFSEventsStats contains statistics about NFS event occurrences.
-type NFSEventsStats struct {
- // Number of times cached inode attributes are re-validated from the server.
- InodeRevalidate uint64
- // Number of times cached dentry nodes are re-validated from the server.
- DnodeRevalidate uint64
- // Number of times an inode cache is cleared.
- DataInvalidate uint64
- // Number of times cached inode attributes are invalidated.
- AttributeInvalidate uint64
- // Number of times files or directories have been open()'d.
- VFSOpen uint64
- // Number of times a directory lookup has occurred.
- VFSLookup uint64
- // Number of times permissions have been checked.
- VFSAccess uint64
- // Number of updates (and potential writes) to pages.
- VFSUpdatePage uint64
- // Number of pages read directly via mmap()'d files.
- VFSReadPage uint64
- // Number of times a group of pages have been read.
- VFSReadPages uint64
- // Number of pages written directly via mmap()'d files.
- VFSWritePage uint64
- // Number of times a group of pages have been written.
- VFSWritePages uint64
- // Number of times directory entries have been read with getdents().
- VFSGetdents uint64
- // Number of times attributes have been set on inodes.
- VFSSetattr uint64
- // Number of pending writes that have been forcefully flushed to the server.
- VFSFlush uint64
- // Number of times fsync() has been called on directories and files.
- VFSFsync uint64
- // Number of times locking has been attempted on a file.
- VFSLock uint64
- // Number of times files have been closed and released.
- VFSFileRelease uint64
- // Unknown. Possibly unused.
- CongestionWait uint64
- // Number of times files have been truncated.
- Truncation uint64
- // Number of times a file has been grown due to writes beyond its existing end.
- WriteExtension uint64
- // Number of times a file was removed while still open by another process.
- SillyRename uint64
- // Number of times the NFS server gave less data than expected while reading.
- ShortRead uint64
- // Number of times the NFS server wrote less data than expected while writing.
- ShortWrite uint64
- // Number of times the NFS server indicated EJUKEBOX; retrieving data from
- // offline storage.
- JukeboxDelay uint64
- // Number of NFS v4.1+ pNFS reads.
- PNFSRead uint64
- // Number of NFS v4.1+ pNFS writes.
- PNFSWrite uint64
-}
-
-// A NFSOperationStats contains statistics for a single operation.
-type NFSOperationStats struct {
- // The name of the operation.
- Operation string
- // Number of requests performed for this operation.
- Requests uint64
- // Number of times an actual RPC request has been transmitted for this operation.
- Transmissions uint64
- // Number of times a request has had a major timeout.
- MajorTimeouts uint64
- // Number of bytes sent for this operation, including RPC headers and payload.
- BytesSent uint64
- // Number of bytes received for this operation, including RPC headers and payload.
- BytesReceived uint64
- // Duration all requests spent queued for transmission before they were sent.
- CumulativeQueueMilliseconds uint64
- // Duration it took to get a reply back after the request was transmitted.
- CumulativeTotalResponseMilliseconds uint64
- // Duration from when a request was enqueued to when it was completely handled.
- CumulativeTotalRequestMilliseconds uint64
-}
-
-// A NFSTransportStats contains statistics for the NFS mount RPC requests and
-// responses.
-type NFSTransportStats struct {
- // The transport protocol used for the NFS mount.
- Protocol string
- // The local port used for the NFS mount.
- Port uint64
- // Number of times the client has had to establish a connection from scratch
- // to the NFS server.
- Bind uint64
- // Number of times the client has made a TCP connection to the NFS server.
- Connect uint64
- // Duration (in jiffies, a kernel internal unit of time) the NFS mount has
- // spent waiting for connections to the server to be established.
- ConnectIdleTime uint64
- // Duration since the NFS mount last saw any RPC traffic.
- IdleTimeSeconds uint64
- // Number of RPC requests for this mount sent to the NFS server.
- Sends uint64
- // Number of RPC responses for this mount received from the NFS server.
- Receives uint64
- // Number of times the NFS server sent a response with a transaction ID
- // unknown to this client.
- BadTransactionIDs uint64
- // A running counter, incremented on each request as the current difference
- // ebetween sends and receives.
- CumulativeActiveRequests uint64
- // A running counter, incremented on each request by the current backlog
- // queue size.
- CumulativeBacklog uint64
-
- // Stats below only available with stat version 1.1.
-
- // Maximum number of simultaneously active RPC requests ever used.
- MaximumRPCSlotsUsed uint64
- // A running counter, incremented on each request as the current size of the
- // sending queue.
- CumulativeSendingQueue uint64
- // A running counter, incremented on each request as the current size of the
- // pending queue.
- CumulativePendingQueue uint64
-}
-
-// parseMountStats parses a /proc/[pid]/mountstats file and returns a slice
-// of Mount structures containing detailed information about each mount.
-// If available, statistics for each mount are parsed as well.
-func parseMountStats(r io.Reader) ([]*Mount, error) {
- const (
- device = "device"
- statVersionPrefix = "statvers="
-
- nfs3Type = "nfs"
- nfs4Type = "nfs4"
- )
-
- var mounts []*Mount
-
- s := bufio.NewScanner(r)
- for s.Scan() {
- // Only look for device entries in this function
- ss := strings.Fields(string(s.Bytes()))
- if len(ss) == 0 || ss[0] != device {
- continue
- }
-
- m, err := parseMount(ss)
- if err != nil {
- return nil, err
- }
-
- // Does this mount also possess statistics information?
- if len(ss) > deviceEntryLen {
- // Only NFSv3 and v4 are supported for parsing statistics
- if m.Type != nfs3Type && m.Type != nfs4Type {
- return nil, fmt.Errorf("cannot parse MountStats for fstype %q", m.Type)
- }
-
- statVersion := strings.TrimPrefix(ss[8], statVersionPrefix)
-
- stats, err := parseMountStatsNFS(s, statVersion)
- if err != nil {
- return nil, err
- }
-
- m.Stats = stats
- }
-
- mounts = append(mounts, m)
- }
-
- return mounts, s.Err()
-}
-
-// parseMount parses an entry in /proc/[pid]/mountstats in the format:
-// device [device] mounted on [mount] with fstype [type]
-func parseMount(ss []string) (*Mount, error) {
- if len(ss) < deviceEntryLen {
- return nil, fmt.Errorf("invalid device entry: %v", ss)
- }
-
- // Check for specific words appearing at specific indices to ensure
- // the format is consistent with what we expect
- format := []struct {
- i int
- s string
- }{
- {i: 0, s: "device"},
- {i: 2, s: "mounted"},
- {i: 3, s: "on"},
- {i: 5, s: "with"},
- {i: 6, s: "fstype"},
- }
-
- for _, f := range format {
- if ss[f.i] != f.s {
- return nil, fmt.Errorf("invalid device entry: %v", ss)
- }
- }
-
- return &Mount{
- Device: ss[1],
- Mount: ss[4],
- Type: ss[7],
- }, nil
-}
-
-// parseMountStatsNFS parses a MountStatsNFS by scanning additional information
-// related to NFS statistics.
-func parseMountStatsNFS(s *bufio.Scanner, statVersion string) (*MountStatsNFS, error) {
- // Field indicators for parsing specific types of data
- const (
- fieldOpts = "opts:"
- fieldAge = "age:"
- fieldBytes = "bytes:"
- fieldEvents = "events:"
- fieldPerOpStats = "per-op"
- fieldTransport = "xprt:"
- )
-
- stats := &MountStatsNFS{
- StatVersion: statVersion,
- }
-
- for s.Scan() {
- ss := strings.Fields(string(s.Bytes()))
- if len(ss) == 0 {
- break
- }
- if len(ss) < 2 {
- return nil, fmt.Errorf("not enough information for NFS stats: %v", ss)
- }
-
- switch ss[0] {
- case fieldOpts:
- if stats.Opts == nil {
- stats.Opts = map[string]string{}
- }
- for _, opt := range strings.Split(ss[1], ",") {
- split := strings.Split(opt, "=")
- if len(split) == 2 {
- stats.Opts[split[0]] = split[1]
- } else {
- stats.Opts[opt] = ""
- }
- }
- case fieldAge:
- // Age integer is in seconds
- d, err := time.ParseDuration(ss[1] + "s")
- if err != nil {
- return nil, err
- }
-
- stats.Age = d
- case fieldBytes:
- bstats, err := parseNFSBytesStats(ss[1:])
- if err != nil {
- return nil, err
- }
-
- stats.Bytes = *bstats
- case fieldEvents:
- estats, err := parseNFSEventsStats(ss[1:])
- if err != nil {
- return nil, err
- }
-
- stats.Events = *estats
- case fieldTransport:
- if len(ss) < 3 {
- return nil, fmt.Errorf("not enough information for NFS transport stats: %v", ss)
- }
-
- tstats, err := parseNFSTransportStats(ss[1:], statVersion)
- if err != nil {
- return nil, err
- }
-
- stats.Transport = *tstats
- }
-
- // When encountering "per-operation statistics", we must break this
- // loop and parse them separately to ensure we can terminate parsing
- // before reaching another device entry; hence why this 'if' statement
- // is not just another switch case
- if ss[0] == fieldPerOpStats {
- break
- }
- }
-
- if err := s.Err(); err != nil {
- return nil, err
- }
-
- // NFS per-operation stats appear last before the next device entry
- perOpStats, err := parseNFSOperationStats(s)
- if err != nil {
- return nil, err
- }
-
- stats.Operations = perOpStats
-
- return stats, nil
-}
-
-// parseNFSBytesStats parses a NFSBytesStats line using an input set of
-// integer fields.
-func parseNFSBytesStats(ss []string) (*NFSBytesStats, error) {
- if len(ss) != fieldBytesLen {
- return nil, fmt.Errorf("invalid NFS bytes stats: %v", ss)
- }
-
- ns := make([]uint64, 0, fieldBytesLen)
- for _, s := range ss {
- n, err := strconv.ParseUint(s, 10, 64)
- if err != nil {
- return nil, err
- }
-
- ns = append(ns, n)
- }
-
- return &NFSBytesStats{
- Read: ns[0],
- Write: ns[1],
- DirectRead: ns[2],
- DirectWrite: ns[3],
- ReadTotal: ns[4],
- WriteTotal: ns[5],
- ReadPages: ns[6],
- WritePages: ns[7],
- }, nil
-}
-
-// parseNFSEventsStats parses a NFSEventsStats line using an input set of
-// integer fields.
-func parseNFSEventsStats(ss []string) (*NFSEventsStats, error) {
- if len(ss) != fieldEventsLen {
- return nil, fmt.Errorf("invalid NFS events stats: %v", ss)
- }
-
- ns := make([]uint64, 0, fieldEventsLen)
- for _, s := range ss {
- n, err := strconv.ParseUint(s, 10, 64)
- if err != nil {
- return nil, err
- }
-
- ns = append(ns, n)
- }
-
- return &NFSEventsStats{
- InodeRevalidate: ns[0],
- DnodeRevalidate: ns[1],
- DataInvalidate: ns[2],
- AttributeInvalidate: ns[3],
- VFSOpen: ns[4],
- VFSLookup: ns[5],
- VFSAccess: ns[6],
- VFSUpdatePage: ns[7],
- VFSReadPage: ns[8],
- VFSReadPages: ns[9],
- VFSWritePage: ns[10],
- VFSWritePages: ns[11],
- VFSGetdents: ns[12],
- VFSSetattr: ns[13],
- VFSFlush: ns[14],
- VFSFsync: ns[15],
- VFSLock: ns[16],
- VFSFileRelease: ns[17],
- CongestionWait: ns[18],
- Truncation: ns[19],
- WriteExtension: ns[20],
- SillyRename: ns[21],
- ShortRead: ns[22],
- ShortWrite: ns[23],
- JukeboxDelay: ns[24],
- PNFSRead: ns[25],
- PNFSWrite: ns[26],
- }, nil
-}
-
-// parseNFSOperationStats parses a slice of NFSOperationStats by scanning
-// additional information about per-operation statistics until an empty
-// line is reached.
-func parseNFSOperationStats(s *bufio.Scanner) ([]NFSOperationStats, error) {
- const (
- // Number of expected fields in each per-operation statistics set
- numFields = 9
- )
-
- var ops []NFSOperationStats
-
- for s.Scan() {
- ss := strings.Fields(string(s.Bytes()))
- if len(ss) == 0 {
- // Must break when reading a blank line after per-operation stats to
- // enable top-level function to parse the next device entry
- break
- }
-
- if len(ss) != numFields {
- return nil, fmt.Errorf("invalid NFS per-operations stats: %v", ss)
- }
-
- // Skip string operation name for integers
- ns := make([]uint64, 0, numFields-1)
- for _, st := range ss[1:] {
- n, err := strconv.ParseUint(st, 10, 64)
- if err != nil {
- return nil, err
- }
-
- ns = append(ns, n)
- }
-
- ops = append(ops, NFSOperationStats{
- Operation: strings.TrimSuffix(ss[0], ":"),
- Requests: ns[0],
- Transmissions: ns[1],
- MajorTimeouts: ns[2],
- BytesSent: ns[3],
- BytesReceived: ns[4],
- CumulativeQueueMilliseconds: ns[5],
- CumulativeTotalResponseMilliseconds: ns[6],
- CumulativeTotalRequestMilliseconds: ns[7],
- })
- }
-
- return ops, s.Err()
-}
-
-// parseNFSTransportStats parses a NFSTransportStats line using an input set of
-// integer fields matched to a specific stats version.
-func parseNFSTransportStats(ss []string, statVersion string) (*NFSTransportStats, error) {
- // Extract the protocol field. It is the only string value in the line
- protocol := ss[0]
- ss = ss[1:]
-
- switch statVersion {
- case statVersion10:
- var expectedLength int
- if protocol == "tcp" {
- expectedLength = fieldTransport10TCPLen
- } else if protocol == "udp" {
- expectedLength = fieldTransport10UDPLen
- } else {
- return nil, fmt.Errorf("invalid NFS protocol \"%s\" in stats 1.0 statement: %v", protocol, ss)
- }
- if len(ss) != expectedLength {
- return nil, fmt.Errorf("invalid NFS transport stats 1.0 statement: %v", ss)
- }
- case statVersion11:
- var expectedLength int
- if protocol == "tcp" {
- expectedLength = fieldTransport11TCPLen
- } else if protocol == "udp" {
- expectedLength = fieldTransport11UDPLen
- } else {
- return nil, fmt.Errorf("invalid NFS protocol \"%s\" in stats 1.1 statement: %v", protocol, ss)
- }
- if len(ss) != expectedLength {
- return nil, fmt.Errorf("invalid NFS transport stats 1.1 statement: %v", ss)
- }
- default:
- return nil, fmt.Errorf("unrecognized NFS transport stats version: %q", statVersion)
- }
-
- // Allocate enough for v1.1 stats since zero value for v1.1 stats will be okay
- // in a v1.0 response. Since the stat length is bigger for TCP stats, we use
- // the TCP length here.
- //
- // Note: slice length must be set to length of v1.1 stats to avoid a panic when
- // only v1.0 stats are present.
- // See: https://github.com/prometheus/node_exporter/issues/571.
- ns := make([]uint64, fieldTransport11TCPLen)
- for i, s := range ss {
- n, err := strconv.ParseUint(s, 10, 64)
- if err != nil {
- return nil, err
- }
-
- ns[i] = n
- }
-
- // The fields differ depending on the transport protocol (TCP or UDP)
- // From https://utcc.utoronto.ca/%7Ecks/space/blog/linux/NFSMountstatsXprt
- //
- // For the udp RPC transport there is no connection count, connect idle time,
- // or idle time (fields #3, #4, and #5); all other fields are the same. So
- // we set them to 0 here.
- if protocol == "udp" {
- ns = append(ns[:2], append(make([]uint64, 3), ns[2:]...)...)
- }
-
- return &NFSTransportStats{
- Protocol: protocol,
- Port: ns[0],
- Bind: ns[1],
- Connect: ns[2],
- ConnectIdleTime: ns[3],
- IdleTimeSeconds: ns[4],
- Sends: ns[5],
- Receives: ns[6],
- BadTransactionIDs: ns[7],
- CumulativeActiveRequests: ns[8],
- CumulativeBacklog: ns[9],
- MaximumRPCSlotsUsed: ns[10],
- CumulativeSendingQueue: ns[11],
- CumulativePendingQueue: ns[12],
- }, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/net_dev.go b/vendor/github.com/prometheus/procfs/net_dev.go
deleted file mode 100644
index 47a710b..0000000
--- a/vendor/github.com/prometheus/procfs/net_dev.go
+++ /dev/null
@@ -1,205 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "errors"
- "os"
- "sort"
- "strconv"
- "strings"
-)
-
-// NetDevLine is single line parsed from /proc/net/dev or /proc/[pid]/net/dev.
-type NetDevLine struct {
- Name string `json:"name"` // The name of the interface.
- RxBytes uint64 `json:"rx_bytes"` // Cumulative count of bytes received.
- RxPackets uint64 `json:"rx_packets"` // Cumulative count of packets received.
- RxErrors uint64 `json:"rx_errors"` // Cumulative count of receive errors encountered.
- RxDropped uint64 `json:"rx_dropped"` // Cumulative count of packets dropped while receiving.
- RxFIFO uint64 `json:"rx_fifo"` // Cumulative count of FIFO buffer errors.
- RxFrame uint64 `json:"rx_frame"` // Cumulative count of packet framing errors.
- RxCompressed uint64 `json:"rx_compressed"` // Cumulative count of compressed packets received by the device driver.
- RxMulticast uint64 `json:"rx_multicast"` // Cumulative count of multicast frames received by the device driver.
- TxBytes uint64 `json:"tx_bytes"` // Cumulative count of bytes transmitted.
- TxPackets uint64 `json:"tx_packets"` // Cumulative count of packets transmitted.
- TxErrors uint64 `json:"tx_errors"` // Cumulative count of transmit errors encountered.
- TxDropped uint64 `json:"tx_dropped"` // Cumulative count of packets dropped while transmitting.
- TxFIFO uint64 `json:"tx_fifo"` // Cumulative count of FIFO buffer errors.
- TxCollisions uint64 `json:"tx_collisions"` // Cumulative count of collisions detected on the interface.
- TxCarrier uint64 `json:"tx_carrier"` // Cumulative count of carrier losses detected by the device driver.
- TxCompressed uint64 `json:"tx_compressed"` // Cumulative count of compressed packets transmitted by the device driver.
-}
-
-// NetDev is parsed from /proc/net/dev or /proc/[pid]/net/dev. The map keys
-// are interface names.
-type NetDev map[string]NetDevLine
-
-// NetDev returns kernel/system statistics read from /proc/net/dev.
-func (fs FS) NetDev() (NetDev, error) {
- return newNetDev(fs.proc.Path("net/dev"))
-}
-
-// NetDev returns kernel/system statistics read from /proc/[pid]/net/dev.
-func (p Proc) NetDev() (NetDev, error) {
- return newNetDev(p.path("net/dev"))
-}
-
-// newNetDev creates a new NetDev from the contents of the given file.
-func newNetDev(file string) (NetDev, error) {
- f, err := os.Open(file)
- if err != nil {
- return NetDev{}, err
- }
- defer f.Close()
-
- netDev := NetDev{}
- s := bufio.NewScanner(f)
- for n := 0; s.Scan(); n++ {
- // Skip the 2 header lines.
- if n < 2 {
- continue
- }
-
- line, err := netDev.parseLine(s.Text())
- if err != nil {
- return netDev, err
- }
-
- netDev[line.Name] = *line
- }
-
- return netDev, s.Err()
-}
-
-// parseLine parses a single line from the /proc/net/dev file. Header lines
-// must be filtered prior to calling this method.
-func (netDev NetDev) parseLine(rawLine string) (*NetDevLine, error) {
- parts := strings.SplitN(rawLine, ":", 2)
- if len(parts) != 2 {
- return nil, errors.New("invalid net/dev line, missing colon")
- }
- fields := strings.Fields(strings.TrimSpace(parts[1]))
-
- var err error
- line := &NetDevLine{}
-
- // Interface Name
- line.Name = strings.TrimSpace(parts[0])
- if line.Name == "" {
- return nil, errors.New("invalid net/dev line, empty interface name")
- }
-
- // RX
- line.RxBytes, err = strconv.ParseUint(fields[0], 10, 64)
- if err != nil {
- return nil, err
- }
- line.RxPackets, err = strconv.ParseUint(fields[1], 10, 64)
- if err != nil {
- return nil, err
- }
- line.RxErrors, err = strconv.ParseUint(fields[2], 10, 64)
- if err != nil {
- return nil, err
- }
- line.RxDropped, err = strconv.ParseUint(fields[3], 10, 64)
- if err != nil {
- return nil, err
- }
- line.RxFIFO, err = strconv.ParseUint(fields[4], 10, 64)
- if err != nil {
- return nil, err
- }
- line.RxFrame, err = strconv.ParseUint(fields[5], 10, 64)
- if err != nil {
- return nil, err
- }
- line.RxCompressed, err = strconv.ParseUint(fields[6], 10, 64)
- if err != nil {
- return nil, err
- }
- line.RxMulticast, err = strconv.ParseUint(fields[7], 10, 64)
- if err != nil {
- return nil, err
- }
-
- // TX
- line.TxBytes, err = strconv.ParseUint(fields[8], 10, 64)
- if err != nil {
- return nil, err
- }
- line.TxPackets, err = strconv.ParseUint(fields[9], 10, 64)
- if err != nil {
- return nil, err
- }
- line.TxErrors, err = strconv.ParseUint(fields[10], 10, 64)
- if err != nil {
- return nil, err
- }
- line.TxDropped, err = strconv.ParseUint(fields[11], 10, 64)
- if err != nil {
- return nil, err
- }
- line.TxFIFO, err = strconv.ParseUint(fields[12], 10, 64)
- if err != nil {
- return nil, err
- }
- line.TxCollisions, err = strconv.ParseUint(fields[13], 10, 64)
- if err != nil {
- return nil, err
- }
- line.TxCarrier, err = strconv.ParseUint(fields[14], 10, 64)
- if err != nil {
- return nil, err
- }
- line.TxCompressed, err = strconv.ParseUint(fields[15], 10, 64)
- if err != nil {
- return nil, err
- }
-
- return line, nil
-}
-
-// Total aggregates the values across interfaces and returns a new NetDevLine.
-// The Name field will be a sorted comma separated list of interface names.
-func (netDev NetDev) Total() NetDevLine {
- total := NetDevLine{}
-
- names := make([]string, 0, len(netDev))
- for _, ifc := range netDev {
- names = append(names, ifc.Name)
- total.RxBytes += ifc.RxBytes
- total.RxPackets += ifc.RxPackets
- total.RxErrors += ifc.RxErrors
- total.RxDropped += ifc.RxDropped
- total.RxFIFO += ifc.RxFIFO
- total.RxFrame += ifc.RxFrame
- total.RxCompressed += ifc.RxCompressed
- total.RxMulticast += ifc.RxMulticast
- total.TxBytes += ifc.TxBytes
- total.TxPackets += ifc.TxPackets
- total.TxErrors += ifc.TxErrors
- total.TxDropped += ifc.TxDropped
- total.TxFIFO += ifc.TxFIFO
- total.TxCollisions += ifc.TxCollisions
- total.TxCarrier += ifc.TxCarrier
- total.TxCompressed += ifc.TxCompressed
- }
- sort.Strings(names)
- total.Name = strings.Join(names, ", ")
-
- return total
-}
diff --git a/vendor/github.com/prometheus/procfs/net_sockstat.go b/vendor/github.com/prometheus/procfs/net_sockstat.go
deleted file mode 100644
index f91ef55..0000000
--- a/vendor/github.com/prometheus/procfs/net_sockstat.go
+++ /dev/null
@@ -1,163 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "errors"
- "fmt"
- "io"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// A NetSockstat contains the output of /proc/net/sockstat{,6} for IPv4 or IPv6,
-// respectively.
-type NetSockstat struct {
- // Used is non-nil for IPv4 sockstat results, but nil for IPv6.
- Used *int
- Protocols []NetSockstatProtocol
-}
-
-// A NetSockstatProtocol contains statistics about a given socket protocol.
-// Pointer fields indicate that the value may or may not be present on any
-// given protocol.
-type NetSockstatProtocol struct {
- Protocol string
- InUse int
- Orphan *int
- TW *int
- Alloc *int
- Mem *int
- Memory *int
-}
-
-// NetSockstat retrieves IPv4 socket statistics.
-func (fs FS) NetSockstat() (*NetSockstat, error) {
- return readSockstat(fs.proc.Path("net", "sockstat"))
-}
-
-// NetSockstat6 retrieves IPv6 socket statistics.
-//
-// If IPv6 is disabled on this kernel, the returned error can be checked with
-// os.IsNotExist.
-func (fs FS) NetSockstat6() (*NetSockstat, error) {
- return readSockstat(fs.proc.Path("net", "sockstat6"))
-}
-
-// readSockstat opens and parses a NetSockstat from the input file.
-func readSockstat(name string) (*NetSockstat, error) {
- // This file is small and can be read with one syscall.
- b, err := util.ReadFileNoStat(name)
- if err != nil {
- // Do not wrap this error so the caller can detect os.IsNotExist and
- // similar conditions.
- return nil, err
- }
-
- stat, err := parseSockstat(bytes.NewReader(b))
- if err != nil {
- return nil, fmt.Errorf("failed to read sockstats from %q: %v", name, err)
- }
-
- return stat, nil
-}
-
-// parseSockstat reads the contents of a sockstat file and parses a NetSockstat.
-func parseSockstat(r io.Reader) (*NetSockstat, error) {
- var stat NetSockstat
- s := bufio.NewScanner(r)
- for s.Scan() {
- // Expect a minimum of a protocol and one key/value pair.
- fields := strings.Split(s.Text(), " ")
- if len(fields) < 3 {
- return nil, fmt.Errorf("malformed sockstat line: %q", s.Text())
- }
-
- // The remaining fields are key/value pairs.
- kvs, err := parseSockstatKVs(fields[1:])
- if err != nil {
- return nil, fmt.Errorf("error parsing sockstat key/value pairs from %q: %v", s.Text(), err)
- }
-
- // The first field is the protocol. We must trim its colon suffix.
- proto := strings.TrimSuffix(fields[0], ":")
- switch proto {
- case "sockets":
- // Special case: IPv4 has a sockets "used" key/value pair that we
- // embed at the top level of the structure.
- used := kvs["used"]
- stat.Used = &used
- default:
- // Parse all other lines as individual protocols.
- nsp := parseSockstatProtocol(kvs)
- nsp.Protocol = proto
- stat.Protocols = append(stat.Protocols, nsp)
- }
- }
-
- if err := s.Err(); err != nil {
- return nil, err
- }
-
- return &stat, nil
-}
-
-// parseSockstatKVs parses a string slice into a map of key/value pairs.
-func parseSockstatKVs(kvs []string) (map[string]int, error) {
- if len(kvs)%2 != 0 {
- return nil, errors.New("odd number of fields in key/value pairs")
- }
-
- // Iterate two values at a time to gather key/value pairs.
- out := make(map[string]int, len(kvs)/2)
- for i := 0; i < len(kvs); i += 2 {
- vp := util.NewValueParser(kvs[i+1])
- out[kvs[i]] = vp.Int()
-
- if err := vp.Err(); err != nil {
- return nil, err
- }
- }
-
- return out, nil
-}
-
-// parseSockstatProtocol parses a NetSockstatProtocol from the input kvs map.
-func parseSockstatProtocol(kvs map[string]int) NetSockstatProtocol {
- var nsp NetSockstatProtocol
- for k, v := range kvs {
- // Capture the range variable to ensure we get unique pointers for
- // each of the optional fields.
- v := v
- switch k {
- case "inuse":
- nsp.InUse = v
- case "orphan":
- nsp.Orphan = &v
- case "tw":
- nsp.TW = &v
- case "alloc":
- nsp.Alloc = &v
- case "mem":
- nsp.Mem = &v
- case "memory":
- nsp.Memory = &v
- }
- }
-
- return nsp
-}
diff --git a/vendor/github.com/prometheus/procfs/net_softnet.go b/vendor/github.com/prometheus/procfs/net_softnet.go
deleted file mode 100644
index 6fcad20..0000000
--- a/vendor/github.com/prometheus/procfs/net_softnet.go
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "fmt"
- "io/ioutil"
- "strconv"
- "strings"
-)
-
-// For the proc file format details,
-// see https://elixir.bootlin.com/linux/v4.17/source/net/core/net-procfs.c#L162
-// and https://elixir.bootlin.com/linux/v4.17/source/include/linux/netdevice.h#L2810.
-
-// SoftnetEntry contains a single row of data from /proc/net/softnet_stat
-type SoftnetEntry struct {
- // Number of processed packets
- Processed uint
- // Number of dropped packets
- Dropped uint
- // Number of times processing packets ran out of quota
- TimeSqueezed uint
-}
-
-// GatherSoftnetStats reads /proc/net/softnet_stat, parse the relevant columns,
-// and then return a slice of SoftnetEntry's.
-func (fs FS) GatherSoftnetStats() ([]SoftnetEntry, error) {
- data, err := ioutil.ReadFile(fs.proc.Path("net/softnet_stat"))
- if err != nil {
- return nil, fmt.Errorf("error reading softnet %s: %s", fs.proc.Path("net/softnet_stat"), err)
- }
-
- return parseSoftnetEntries(data)
-}
-
-func parseSoftnetEntries(data []byte) ([]SoftnetEntry, error) {
- lines := strings.Split(string(data), "\n")
- entries := make([]SoftnetEntry, 0)
- var err error
- const (
- expectedColumns = 11
- )
- for _, line := range lines {
- columns := strings.Fields(line)
- width := len(columns)
- if width == 0 {
- continue
- }
- if width != expectedColumns {
- return []SoftnetEntry{}, fmt.Errorf("%d columns were detected, but %d were expected", width, expectedColumns)
- }
- var entry SoftnetEntry
- if entry, err = parseSoftnetEntry(columns); err != nil {
- return []SoftnetEntry{}, err
- }
- entries = append(entries, entry)
- }
-
- return entries, nil
-}
-
-func parseSoftnetEntry(columns []string) (SoftnetEntry, error) {
- var err error
- var processed, dropped, timeSqueezed uint64
- if processed, err = strconv.ParseUint(columns[0], 16, 32); err != nil {
- return SoftnetEntry{}, fmt.Errorf("Unable to parse column 0: %s", err)
- }
- if dropped, err = strconv.ParseUint(columns[1], 16, 32); err != nil {
- return SoftnetEntry{}, fmt.Errorf("Unable to parse column 1: %s", err)
- }
- if timeSqueezed, err = strconv.ParseUint(columns[2], 16, 32); err != nil {
- return SoftnetEntry{}, fmt.Errorf("Unable to parse column 2: %s", err)
- }
- return SoftnetEntry{
- Processed: uint(processed),
- Dropped: uint(dropped),
- TimeSqueezed: uint(timeSqueezed),
- }, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/net_unix.go b/vendor/github.com/prometheus/procfs/net_unix.go
deleted file mode 100644
index 93bd58f..0000000
--- a/vendor/github.com/prometheus/procfs/net_unix.go
+++ /dev/null
@@ -1,271 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "errors"
- "fmt"
- "io"
- "os"
- "strconv"
- "strings"
-)
-
-// For the proc file format details,
-// see https://elixir.bootlin.com/linux/v4.17/source/net/unix/af_unix.c#L2815
-// and https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/net.h#L48.
-
-const (
- netUnixKernelPtrIdx = iota
- netUnixRefCountIdx
- _
- netUnixFlagsIdx
- netUnixTypeIdx
- netUnixStateIdx
- netUnixInodeIdx
-
- // Inode and Path are optional.
- netUnixStaticFieldsCnt = 6
-)
-
-const (
- netUnixTypeStream = 1
- netUnixTypeDgram = 2
- netUnixTypeSeqpacket = 5
-
- netUnixFlagListen = 1 << 16
-
- netUnixStateUnconnected = 1
- netUnixStateConnecting = 2
- netUnixStateConnected = 3
- netUnixStateDisconnected = 4
-)
-
-var errInvalidKernelPtrFmt = errors.New("Invalid Num(the kernel table slot number) format")
-
-// NetUnixType is the type of the type field.
-type NetUnixType uint64
-
-// NetUnixFlags is the type of the flags field.
-type NetUnixFlags uint64
-
-// NetUnixState is the type of the state field.
-type NetUnixState uint64
-
-// NetUnixLine represents a line of /proc/net/unix.
-type NetUnixLine struct {
- KernelPtr string
- RefCount uint64
- Protocol uint64
- Flags NetUnixFlags
- Type NetUnixType
- State NetUnixState
- Inode uint64
- Path string
-}
-
-// NetUnix holds the data read from /proc/net/unix.
-type NetUnix struct {
- Rows []*NetUnixLine
-}
-
-// NewNetUnix returns data read from /proc/net/unix.
-func NewNetUnix() (*NetUnix, error) {
- fs, err := NewFS(DefaultMountPoint)
- if err != nil {
- return nil, err
- }
-
- return fs.NewNetUnix()
-}
-
-// NewNetUnix returns data read from /proc/net/unix.
-func (fs FS) NewNetUnix() (*NetUnix, error) {
- return NewNetUnixByPath(fs.proc.Path("net/unix"))
-}
-
-// NewNetUnixByPath returns data read from /proc/net/unix by file path.
-// It might returns an error with partial parsed data, if an error occur after some data parsed.
-func NewNetUnixByPath(path string) (*NetUnix, error) {
- f, err := os.Open(path)
- if err != nil {
- return nil, err
- }
- defer f.Close()
- return NewNetUnixByReader(f)
-}
-
-// NewNetUnixByReader returns data read from /proc/net/unix by a reader.
-// It might returns an error with partial parsed data, if an error occur after some data parsed.
-func NewNetUnixByReader(reader io.Reader) (*NetUnix, error) {
- nu := &NetUnix{
- Rows: make([]*NetUnixLine, 0, 32),
- }
- scanner := bufio.NewScanner(reader)
- // Omit the header line.
- scanner.Scan()
- header := scanner.Text()
- // From the man page of proc(5), it does not contain an Inode field,
- // but in actually it exists.
- // This code works for both cases.
- hasInode := strings.Contains(header, "Inode")
-
- minFieldsCnt := netUnixStaticFieldsCnt
- if hasInode {
- minFieldsCnt++
- }
- for scanner.Scan() {
- line := scanner.Text()
- item, err := nu.parseLine(line, hasInode, minFieldsCnt)
- if err != nil {
- return nu, err
- }
- nu.Rows = append(nu.Rows, item)
- }
-
- return nu, scanner.Err()
-}
-
-func (u *NetUnix) parseLine(line string, hasInode bool, minFieldsCnt int) (*NetUnixLine, error) {
- fields := strings.Fields(line)
- fieldsLen := len(fields)
- if fieldsLen < minFieldsCnt {
- return nil, fmt.Errorf(
- "Parse Unix domain failed: expect at least %d fields but got %d",
- minFieldsCnt, fieldsLen)
- }
- kernelPtr, err := u.parseKernelPtr(fields[netUnixKernelPtrIdx])
- if err != nil {
- return nil, fmt.Errorf("Parse Unix domain num(%s) failed: %s", fields[netUnixKernelPtrIdx], err)
- }
- users, err := u.parseUsers(fields[netUnixRefCountIdx])
- if err != nil {
- return nil, fmt.Errorf("Parse Unix domain ref count(%s) failed: %s", fields[netUnixRefCountIdx], err)
- }
- flags, err := u.parseFlags(fields[netUnixFlagsIdx])
- if err != nil {
- return nil, fmt.Errorf("Parse Unix domain flags(%s) failed: %s", fields[netUnixFlagsIdx], err)
- }
- typ, err := u.parseType(fields[netUnixTypeIdx])
- if err != nil {
- return nil, fmt.Errorf("Parse Unix domain type(%s) failed: %s", fields[netUnixTypeIdx], err)
- }
- state, err := u.parseState(fields[netUnixStateIdx])
- if err != nil {
- return nil, fmt.Errorf("Parse Unix domain state(%s) failed: %s", fields[netUnixStateIdx], err)
- }
- var inode uint64
- if hasInode {
- inodeStr := fields[netUnixInodeIdx]
- inode, err = u.parseInode(inodeStr)
- if err != nil {
- return nil, fmt.Errorf("Parse Unix domain inode(%s) failed: %s", inodeStr, err)
- }
- }
-
- nuLine := &NetUnixLine{
- KernelPtr: kernelPtr,
- RefCount: users,
- Type: typ,
- Flags: flags,
- State: state,
- Inode: inode,
- }
-
- // Path field is optional.
- if fieldsLen > minFieldsCnt {
- pathIdx := netUnixInodeIdx + 1
- if !hasInode {
- pathIdx--
- }
- nuLine.Path = fields[pathIdx]
- }
-
- return nuLine, nil
-}
-
-func (u NetUnix) parseKernelPtr(str string) (string, error) {
- if !strings.HasSuffix(str, ":") {
- return "", errInvalidKernelPtrFmt
- }
- return str[:len(str)-1], nil
-}
-
-func (u NetUnix) parseUsers(hexStr string) (uint64, error) {
- return strconv.ParseUint(hexStr, 16, 32)
-}
-
-func (u NetUnix) parseType(hexStr string) (NetUnixType, error) {
- typ, err := strconv.ParseUint(hexStr, 16, 16)
- if err != nil {
- return 0, err
- }
- return NetUnixType(typ), nil
-}
-
-func (u NetUnix) parseFlags(hexStr string) (NetUnixFlags, error) {
- flags, err := strconv.ParseUint(hexStr, 16, 32)
- if err != nil {
- return 0, err
- }
- return NetUnixFlags(flags), nil
-}
-
-func (u NetUnix) parseState(hexStr string) (NetUnixState, error) {
- st, err := strconv.ParseInt(hexStr, 16, 8)
- if err != nil {
- return 0, err
- }
- return NetUnixState(st), nil
-}
-
-func (u NetUnix) parseInode(inodeStr string) (uint64, error) {
- return strconv.ParseUint(inodeStr, 10, 64)
-}
-
-func (t NetUnixType) String() string {
- switch t {
- case netUnixTypeStream:
- return "stream"
- case netUnixTypeDgram:
- return "dgram"
- case netUnixTypeSeqpacket:
- return "seqpacket"
- }
- return "unknown"
-}
-
-func (f NetUnixFlags) String() string {
- switch f {
- case netUnixFlagListen:
- return "listen"
- default:
- return "default"
- }
-}
-
-func (s NetUnixState) String() string {
- switch s {
- case netUnixStateUnconnected:
- return "unconnected"
- case netUnixStateConnecting:
- return "connecting"
- case netUnixStateConnected:
- return "connected"
- case netUnixStateDisconnected:
- return "disconnected"
- }
- return "unknown"
-}
diff --git a/vendor/github.com/prometheus/procfs/proc.go b/vendor/github.com/prometheus/procfs/proc.go
deleted file mode 100644
index 330e472..0000000
--- a/vendor/github.com/prometheus/procfs/proc.go
+++ /dev/null
@@ -1,298 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bytes"
- "fmt"
- "io/ioutil"
- "os"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/fs"
- "github.com/prometheus/procfs/internal/util"
-)
-
-// Proc provides information about a running process.
-type Proc struct {
- // The process ID.
- PID int
-
- fs fs.FS
-}
-
-// Procs represents a list of Proc structs.
-type Procs []Proc
-
-func (p Procs) Len() int { return len(p) }
-func (p Procs) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-func (p Procs) Less(i, j int) bool { return p[i].PID < p[j].PID }
-
-// Self returns a process for the current process read via /proc/self.
-func Self() (Proc, error) {
- fs, err := NewFS(DefaultMountPoint)
- if err != nil {
- return Proc{}, err
- }
- return fs.Self()
-}
-
-// NewProc returns a process for the given pid under /proc.
-func NewProc(pid int) (Proc, error) {
- fs, err := NewFS(DefaultMountPoint)
- if err != nil {
- return Proc{}, err
- }
- return fs.Proc(pid)
-}
-
-// AllProcs returns a list of all currently available processes under /proc.
-func AllProcs() (Procs, error) {
- fs, err := NewFS(DefaultMountPoint)
- if err != nil {
- return Procs{}, err
- }
- return fs.AllProcs()
-}
-
-// Self returns a process for the current process.
-func (fs FS) Self() (Proc, error) {
- p, err := os.Readlink(fs.proc.Path("self"))
- if err != nil {
- return Proc{}, err
- }
- pid, err := strconv.Atoi(strings.Replace(p, string(fs.proc), "", -1))
- if err != nil {
- return Proc{}, err
- }
- return fs.Proc(pid)
-}
-
-// NewProc returns a process for the given pid.
-//
-// Deprecated: use fs.Proc() instead
-func (fs FS) NewProc(pid int) (Proc, error) {
- return fs.Proc(pid)
-}
-
-// Proc returns a process for the given pid.
-func (fs FS) Proc(pid int) (Proc, error) {
- if _, err := os.Stat(fs.proc.Path(strconv.Itoa(pid))); err != nil {
- return Proc{}, err
- }
- return Proc{PID: pid, fs: fs.proc}, nil
-}
-
-// AllProcs returns a list of all currently available processes.
-func (fs FS) AllProcs() (Procs, error) {
- d, err := os.Open(fs.proc.Path())
- if err != nil {
- return Procs{}, err
- }
- defer d.Close()
-
- names, err := d.Readdirnames(-1)
- if err != nil {
- return Procs{}, fmt.Errorf("could not read %s: %s", d.Name(), err)
- }
-
- p := Procs{}
- for _, n := range names {
- pid, err := strconv.ParseInt(n, 10, 64)
- if err != nil {
- continue
- }
- p = append(p, Proc{PID: int(pid), fs: fs.proc})
- }
-
- return p, nil
-}
-
-// CmdLine returns the command line of a process.
-func (p Proc) CmdLine() ([]string, error) {
- data, err := util.ReadFileNoStat(p.path("cmdline"))
- if err != nil {
- return nil, err
- }
-
- if len(data) < 1 {
- return []string{}, nil
- }
-
- return strings.Split(string(bytes.TrimRight(data, string("\x00"))), string(byte(0))), nil
-}
-
-// Comm returns the command name of a process.
-func (p Proc) Comm() (string, error) {
- data, err := util.ReadFileNoStat(p.path("comm"))
- if err != nil {
- return "", err
- }
-
- return strings.TrimSpace(string(data)), nil
-}
-
-// Executable returns the absolute path of the executable command of a process.
-func (p Proc) Executable() (string, error) {
- exe, err := os.Readlink(p.path("exe"))
- if os.IsNotExist(err) {
- return "", nil
- }
-
- return exe, err
-}
-
-// Cwd returns the absolute path to the current working directory of the process.
-func (p Proc) Cwd() (string, error) {
- wd, err := os.Readlink(p.path("cwd"))
- if os.IsNotExist(err) {
- return "", nil
- }
-
- return wd, err
-}
-
-// RootDir returns the absolute path to the process's root directory (as set by chroot)
-func (p Proc) RootDir() (string, error) {
- rdir, err := os.Readlink(p.path("root"))
- if os.IsNotExist(err) {
- return "", nil
- }
-
- return rdir, err
-}
-
-// FileDescriptors returns the currently open file descriptors of a process.
-func (p Proc) FileDescriptors() ([]uintptr, error) {
- names, err := p.fileDescriptors()
- if err != nil {
- return nil, err
- }
-
- fds := make([]uintptr, len(names))
- for i, n := range names {
- fd, err := strconv.ParseInt(n, 10, 32)
- if err != nil {
- return nil, fmt.Errorf("could not parse fd %s: %s", n, err)
- }
- fds[i] = uintptr(fd)
- }
-
- return fds, nil
-}
-
-// FileDescriptorTargets returns the targets of all file descriptors of a process.
-// If a file descriptor is not a symlink to a file (like a socket), that value will be the empty string.
-func (p Proc) FileDescriptorTargets() ([]string, error) {
- names, err := p.fileDescriptors()
- if err != nil {
- return nil, err
- }
-
- targets := make([]string, len(names))
-
- for i, name := range names {
- target, err := os.Readlink(p.path("fd", name))
- if err == nil {
- targets[i] = target
- }
- }
-
- return targets, nil
-}
-
-// FileDescriptorsLen returns the number of currently open file descriptors of
-// a process.
-func (p Proc) FileDescriptorsLen() (int, error) {
- fds, err := p.fileDescriptors()
- if err != nil {
- return 0, err
- }
-
- return len(fds), nil
-}
-
-// MountStats retrieves statistics and configuration for mount points in a
-// process's namespace.
-func (p Proc) MountStats() ([]*Mount, error) {
- f, err := os.Open(p.path("mountstats"))
- if err != nil {
- return nil, err
- }
- defer f.Close()
-
- return parseMountStats(f)
-}
-
-// MountInfo retrieves mount information for mount points in a
-// process's namespace.
-// It supplies information missing in `/proc/self/mounts` and
-// fixes various other problems with that file too.
-func (p Proc) MountInfo() ([]*MountInfo, error) {
- data, err := util.ReadFileNoStat(p.path("mountinfo"))
- if err != nil {
- return nil, err
- }
- return parseMountInfo(data)
-}
-
-func (p Proc) fileDescriptors() ([]string, error) {
- d, err := os.Open(p.path("fd"))
- if err != nil {
- return nil, err
- }
- defer d.Close()
-
- names, err := d.Readdirnames(-1)
- if err != nil {
- return nil, fmt.Errorf("could not read %s: %s", d.Name(), err)
- }
-
- return names, nil
-}
-
-func (p Proc) path(pa ...string) string {
- return p.fs.Path(append([]string{strconv.Itoa(p.PID)}, pa...)...)
-}
-
-// FileDescriptorsInfo retrieves information about all file descriptors of
-// the process.
-func (p Proc) FileDescriptorsInfo() (ProcFDInfos, error) {
- names, err := p.fileDescriptors()
- if err != nil {
- return nil, err
- }
-
- var fdinfos ProcFDInfos
-
- for _, n := range names {
- fdinfo, err := p.FDInfo(n)
- if err != nil {
- continue
- }
- fdinfos = append(fdinfos, *fdinfo)
- }
-
- return fdinfos, nil
-}
-
-// Schedstat returns task scheduling information for the process.
-func (p Proc) Schedstat() (ProcSchedstat, error) {
- contents, err := ioutil.ReadFile(p.path("schedstat"))
- if err != nil {
- return ProcSchedstat{}, err
- }
- return parseProcSchedstat(string(contents))
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_environ.go b/vendor/github.com/prometheus/procfs/proc_environ.go
deleted file mode 100644
index 6134b35..0000000
--- a/vendor/github.com/prometheus/procfs/proc_environ.go
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// Environ reads process environments from /proc//environ
-func (p Proc) Environ() ([]string, error) {
- environments := make([]string, 0)
-
- data, err := util.ReadFileNoStat(p.path("environ"))
- if err != nil {
- return environments, err
- }
-
- environments = strings.Split(string(data), "\000")
- if len(environments) > 0 {
- environments = environments[:len(environments)-1]
- }
-
- return environments, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_fdinfo.go b/vendor/github.com/prometheus/procfs/proc_fdinfo.go
deleted file mode 100644
index 4e7597f..0000000
--- a/vendor/github.com/prometheus/procfs/proc_fdinfo.go
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "regexp"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// Regexp variables
-var (
- rPos = regexp.MustCompile(`^pos:\s+(\d+)$`)
- rFlags = regexp.MustCompile(`^flags:\s+(\d+)$`)
- rMntID = regexp.MustCompile(`^mnt_id:\s+(\d+)$`)
- rInotify = regexp.MustCompile(`^inotify`)
-)
-
-// ProcFDInfo contains represents file descriptor information.
-type ProcFDInfo struct {
- // File descriptor
- FD string
- // File offset
- Pos string
- // File access mode and status flags
- Flags string
- // Mount point ID
- MntID string
- // List of inotify lines (structed) in the fdinfo file (kernel 3.8+ only)
- InotifyInfos []InotifyInfo
-}
-
-// FDInfo constructor. On kernels older than 3.8, InotifyInfos will always be empty.
-func (p Proc) FDInfo(fd string) (*ProcFDInfo, error) {
- data, err := util.ReadFileNoStat(p.path("fdinfo", fd))
- if err != nil {
- return nil, err
- }
-
- var text, pos, flags, mntid string
- var inotify []InotifyInfo
-
- scanner := bufio.NewScanner(bytes.NewReader(data))
- for scanner.Scan() {
- text = scanner.Text()
- if rPos.MatchString(text) {
- pos = rPos.FindStringSubmatch(text)[1]
- } else if rFlags.MatchString(text) {
- flags = rFlags.FindStringSubmatch(text)[1]
- } else if rMntID.MatchString(text) {
- mntid = rMntID.FindStringSubmatch(text)[1]
- } else if rInotify.MatchString(text) {
- newInotify, err := parseInotifyInfo(text)
- if err != nil {
- return nil, err
- }
- inotify = append(inotify, *newInotify)
- }
- }
-
- i := &ProcFDInfo{
- FD: fd,
- Pos: pos,
- Flags: flags,
- MntID: mntid,
- InotifyInfos: inotify,
- }
-
- return i, nil
-}
-
-// InotifyInfo represents a single inotify line in the fdinfo file.
-type InotifyInfo struct {
- // Watch descriptor number
- WD string
- // Inode number
- Ino string
- // Device ID
- Sdev string
- // Mask of events being monitored
- Mask string
-}
-
-// InotifyInfo constructor. Only available on kernel 3.8+.
-func parseInotifyInfo(line string) (*InotifyInfo, error) {
- r := regexp.MustCompile(`^inotify\s+wd:([0-9a-f]+)\s+ino:([0-9a-f]+)\s+sdev:([0-9a-f]+)\s+mask:([0-9a-f]+)`)
- m := r.FindStringSubmatch(line)
- i := &InotifyInfo{
- WD: m[1],
- Ino: m[2],
- Sdev: m[3],
- Mask: m[4],
- }
- return i, nil
-}
-
-// ProcFDInfos represents a list of ProcFDInfo structs.
-type ProcFDInfos []ProcFDInfo
-
-func (p ProcFDInfos) Len() int { return len(p) }
-func (p ProcFDInfos) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-func (p ProcFDInfos) Less(i, j int) bool { return p[i].FD < p[j].FD }
-
-// InotifyWatchLen returns the total number of inotify watches
-func (p ProcFDInfos) InotifyWatchLen() (int, error) {
- length := 0
- for _, f := range p {
- length += len(f.InotifyInfos)
- }
-
- return length, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_io.go b/vendor/github.com/prometheus/procfs/proc_io.go
deleted file mode 100644
index 776f349..0000000
--- a/vendor/github.com/prometheus/procfs/proc_io.go
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "fmt"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// ProcIO models the content of /proc//io.
-type ProcIO struct {
- // Chars read.
- RChar uint64
- // Chars written.
- WChar uint64
- // Read syscalls.
- SyscR uint64
- // Write syscalls.
- SyscW uint64
- // Bytes read.
- ReadBytes uint64
- // Bytes written.
- WriteBytes uint64
- // Bytes written, but taking into account truncation. See
- // Documentation/filesystems/proc.txt in the kernel sources for
- // detailed explanation.
- CancelledWriteBytes int64
-}
-
-// IO creates a new ProcIO instance from a given Proc instance.
-func (p Proc) IO() (ProcIO, error) {
- pio := ProcIO{}
-
- data, err := util.ReadFileNoStat(p.path("io"))
- if err != nil {
- return pio, err
- }
-
- ioFormat := "rchar: %d\nwchar: %d\nsyscr: %d\nsyscw: %d\n" +
- "read_bytes: %d\nwrite_bytes: %d\n" +
- "cancelled_write_bytes: %d\n"
-
- _, err = fmt.Sscanf(string(data), ioFormat, &pio.RChar, &pio.WChar, &pio.SyscR,
- &pio.SyscW, &pio.ReadBytes, &pio.WriteBytes, &pio.CancelledWriteBytes)
-
- return pio, err
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_limits.go b/vendor/github.com/prometheus/procfs/proc_limits.go
deleted file mode 100644
index 91ee24d..0000000
--- a/vendor/github.com/prometheus/procfs/proc_limits.go
+++ /dev/null
@@ -1,157 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "fmt"
- "os"
- "regexp"
- "strconv"
-)
-
-// ProcLimits represents the soft limits for each of the process's resource
-// limits. For more information see getrlimit(2):
-// http://man7.org/linux/man-pages/man2/getrlimit.2.html.
-type ProcLimits struct {
- // CPU time limit in seconds.
- CPUTime int64
- // Maximum size of files that the process may create.
- FileSize int64
- // Maximum size of the process's data segment (initialized data,
- // uninitialized data, and heap).
- DataSize int64
- // Maximum size of the process stack in bytes.
- StackSize int64
- // Maximum size of a core file.
- CoreFileSize int64
- // Limit of the process's resident set in pages.
- ResidentSet int64
- // Maximum number of processes that can be created for the real user ID of
- // the calling process.
- Processes int64
- // Value one greater than the maximum file descriptor number that can be
- // opened by this process.
- OpenFiles int64
- // Maximum number of bytes of memory that may be locked into RAM.
- LockedMemory int64
- // Maximum size of the process's virtual memory address space in bytes.
- AddressSpace int64
- // Limit on the combined number of flock(2) locks and fcntl(2) leases that
- // this process may establish.
- FileLocks int64
- // Limit of signals that may be queued for the real user ID of the calling
- // process.
- PendingSignals int64
- // Limit on the number of bytes that can be allocated for POSIX message
- // queues for the real user ID of the calling process.
- MsqqueueSize int64
- // Limit of the nice priority set using setpriority(2) or nice(2).
- NicePriority int64
- // Limit of the real-time priority set using sched_setscheduler(2) or
- // sched_setparam(2).
- RealtimePriority int64
- // Limit (in microseconds) on the amount of CPU time that a process
- // scheduled under a real-time scheduling policy may consume without making
- // a blocking system call.
- RealtimeTimeout int64
-}
-
-const (
- limitsFields = 3
- limitsUnlimited = "unlimited"
-)
-
-var (
- limitsDelimiter = regexp.MustCompile(" +")
-)
-
-// NewLimits returns the current soft limits of the process.
-//
-// Deprecated: use p.Limits() instead
-func (p Proc) NewLimits() (ProcLimits, error) {
- return p.Limits()
-}
-
-// Limits returns the current soft limits of the process.
-func (p Proc) Limits() (ProcLimits, error) {
- f, err := os.Open(p.path("limits"))
- if err != nil {
- return ProcLimits{}, err
- }
- defer f.Close()
-
- var (
- l = ProcLimits{}
- s = bufio.NewScanner(f)
- )
- for s.Scan() {
- fields := limitsDelimiter.Split(s.Text(), limitsFields)
- if len(fields) != limitsFields {
- return ProcLimits{}, fmt.Errorf(
- "couldn't parse %s line %s", f.Name(), s.Text())
- }
-
- switch fields[0] {
- case "Max cpu time":
- l.CPUTime, err = parseInt(fields[1])
- case "Max file size":
- l.FileSize, err = parseInt(fields[1])
- case "Max data size":
- l.DataSize, err = parseInt(fields[1])
- case "Max stack size":
- l.StackSize, err = parseInt(fields[1])
- case "Max core file size":
- l.CoreFileSize, err = parseInt(fields[1])
- case "Max resident set":
- l.ResidentSet, err = parseInt(fields[1])
- case "Max processes":
- l.Processes, err = parseInt(fields[1])
- case "Max open files":
- l.OpenFiles, err = parseInt(fields[1])
- case "Max locked memory":
- l.LockedMemory, err = parseInt(fields[1])
- case "Max address space":
- l.AddressSpace, err = parseInt(fields[1])
- case "Max file locks":
- l.FileLocks, err = parseInt(fields[1])
- case "Max pending signals":
- l.PendingSignals, err = parseInt(fields[1])
- case "Max msgqueue size":
- l.MsqqueueSize, err = parseInt(fields[1])
- case "Max nice priority":
- l.NicePriority, err = parseInt(fields[1])
- case "Max realtime priority":
- l.RealtimePriority, err = parseInt(fields[1])
- case "Max realtime timeout":
- l.RealtimeTimeout, err = parseInt(fields[1])
- }
- if err != nil {
- return ProcLimits{}, err
- }
- }
-
- return l, s.Err()
-}
-
-func parseInt(s string) (int64, error) {
- if s == limitsUnlimited {
- return -1, nil
- }
- i, err := strconv.ParseInt(s, 10, 64)
- if err != nil {
- return 0, fmt.Errorf("couldn't parse value %s: %s", s, err)
- }
- return i, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_ns.go b/vendor/github.com/prometheus/procfs/proc_ns.go
deleted file mode 100644
index c66740f..0000000
--- a/vendor/github.com/prometheus/procfs/proc_ns.go
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "fmt"
- "os"
- "strconv"
- "strings"
-)
-
-// Namespace represents a single namespace of a process.
-type Namespace struct {
- Type string // Namespace type.
- Inode uint32 // Inode number of the namespace. If two processes are in the same namespace their inodes will match.
-}
-
-// Namespaces contains all of the namespaces that the process is contained in.
-type Namespaces map[string]Namespace
-
-// Namespaces reads from /proc//ns/* to get the namespaces of which the
-// process is a member.
-func (p Proc) Namespaces() (Namespaces, error) {
- d, err := os.Open(p.path("ns"))
- if err != nil {
- return nil, err
- }
- defer d.Close()
-
- names, err := d.Readdirnames(-1)
- if err != nil {
- return nil, fmt.Errorf("failed to read contents of ns dir: %v", err)
- }
-
- ns := make(Namespaces, len(names))
- for _, name := range names {
- target, err := os.Readlink(p.path("ns", name))
- if err != nil {
- return nil, err
- }
-
- fields := strings.SplitN(target, ":", 2)
- if len(fields) != 2 {
- return nil, fmt.Errorf("failed to parse namespace type and inode from '%v'", target)
- }
-
- typ := fields[0]
- inode, err := strconv.ParseUint(strings.Trim(fields[1], "[]"), 10, 32)
- if err != nil {
- return nil, fmt.Errorf("failed to parse inode from '%v': %v", fields[1], err)
- }
-
- ns[name] = Namespace{typ, uint32(inode)}
- }
-
- return ns, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_psi.go b/vendor/github.com/prometheus/procfs/proc_psi.go
deleted file mode 100644
index 0d7bee5..0000000
--- a/vendor/github.com/prometheus/procfs/proc_psi.go
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-// The PSI / pressure interface is described at
-// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/accounting/psi.txt
-// Each resource (cpu, io, memory, ...) is exposed as a single file.
-// Each file may contain up to two lines, one for "some" pressure and one for "full" pressure.
-// Each line contains several averages (over n seconds) and a total in µs.
-//
-// Example io pressure file:
-// > some avg10=0.06 avg60=0.21 avg300=0.99 total=8537362
-// > full avg10=0.00 avg60=0.13 avg300=0.96 total=8183134
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-const lineFormat = "avg10=%f avg60=%f avg300=%f total=%d"
-
-// PSILine is a single line of values as returned by /proc/pressure/*
-// The Avg entries are averages over n seconds, as a percentage
-// The Total line is in microseconds
-type PSILine struct {
- Avg10 float64
- Avg60 float64
- Avg300 float64
- Total uint64
-}
-
-// PSIStats represent pressure stall information from /proc/pressure/*
-// Some indicates the share of time in which at least some tasks are stalled
-// Full indicates the share of time in which all non-idle tasks are stalled simultaneously
-type PSIStats struct {
- Some *PSILine
- Full *PSILine
-}
-
-// PSIStatsForResource reads pressure stall information for the specified
-// resource from /proc/pressure/. At time of writing this can be
-// either "cpu", "memory" or "io".
-func (fs FS) PSIStatsForResource(resource string) (PSIStats, error) {
- data, err := util.ReadFileNoStat(fs.proc.Path(fmt.Sprintf("%s/%s", "pressure", resource)))
- if err != nil {
- return PSIStats{}, fmt.Errorf("psi_stats: unavailable for %s", resource)
- }
-
- return parsePSIStats(resource, bytes.NewReader(data))
-}
-
-// parsePSIStats parses the specified file for pressure stall information
-func parsePSIStats(resource string, r io.Reader) (PSIStats, error) {
- psiStats := PSIStats{}
-
- scanner := bufio.NewScanner(r)
- for scanner.Scan() {
- l := scanner.Text()
- prefix := strings.Split(l, " ")[0]
- switch prefix {
- case "some":
- psi := PSILine{}
- _, err := fmt.Sscanf(l, fmt.Sprintf("some %s", lineFormat), &psi.Avg10, &psi.Avg60, &psi.Avg300, &psi.Total)
- if err != nil {
- return PSIStats{}, err
- }
- psiStats.Some = &psi
- case "full":
- psi := PSILine{}
- _, err := fmt.Sscanf(l, fmt.Sprintf("full %s", lineFormat), &psi.Avg10, &psi.Avg60, &psi.Avg300, &psi.Total)
- if err != nil {
- return PSIStats{}, err
- }
- psiStats.Full = &psi
- default:
- // If we encounter a line with an unknown prefix, ignore it and move on
- // Should new measurement types be added in the future we'll simply ignore them instead
- // of erroring on retrieval
- continue
- }
- }
-
- return psiStats, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_stat.go b/vendor/github.com/prometheus/procfs/proc_stat.go
deleted file mode 100644
index 4517d2e..0000000
--- a/vendor/github.com/prometheus/procfs/proc_stat.go
+++ /dev/null
@@ -1,192 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bytes"
- "fmt"
- "os"
-
- "github.com/prometheus/procfs/internal/fs"
- "github.com/prometheus/procfs/internal/util"
-)
-
-// Originally, this USER_HZ value was dynamically retrieved via a sysconf call
-// which required cgo. However, that caused a lot of problems regarding
-// cross-compilation. Alternatives such as running a binary to determine the
-// value, or trying to derive it in some other way were all problematic. After
-// much research it was determined that USER_HZ is actually hardcoded to 100 on
-// all Go-supported platforms as of the time of this writing. This is why we
-// decided to hardcode it here as well. It is not impossible that there could
-// be systems with exceptions, but they should be very exotic edge cases, and
-// in that case, the worst outcome will be two misreported metrics.
-//
-// See also the following discussions:
-//
-// - https://github.com/prometheus/node_exporter/issues/52
-// - https://github.com/prometheus/procfs/pull/2
-// - http://stackoverflow.com/questions/17410841/how-does-user-hz-solve-the-jiffy-scaling-issue
-const userHZ = 100
-
-// ProcStat provides status information about the process,
-// read from /proc/[pid]/stat.
-type ProcStat struct {
- // The process ID.
- PID int
- // The filename of the executable.
- Comm string
- // The process state.
- State string
- // The PID of the parent of this process.
- PPID int
- // The process group ID of the process.
- PGRP int
- // The session ID of the process.
- Session int
- // The controlling terminal of the process.
- TTY int
- // The ID of the foreground process group of the controlling terminal of
- // the process.
- TPGID int
- // The kernel flags word of the process.
- Flags uint
- // The number of minor faults the process has made which have not required
- // loading a memory page from disk.
- MinFlt uint
- // The number of minor faults that the process's waited-for children have
- // made.
- CMinFlt uint
- // The number of major faults the process has made which have required
- // loading a memory page from disk.
- MajFlt uint
- // The number of major faults that the process's waited-for children have
- // made.
- CMajFlt uint
- // Amount of time that this process has been scheduled in user mode,
- // measured in clock ticks.
- UTime uint
- // Amount of time that this process has been scheduled in kernel mode,
- // measured in clock ticks.
- STime uint
- // Amount of time that this process's waited-for children have been
- // scheduled in user mode, measured in clock ticks.
- CUTime uint
- // Amount of time that this process's waited-for children have been
- // scheduled in kernel mode, measured in clock ticks.
- CSTime uint
- // For processes running a real-time scheduling policy, this is the negated
- // scheduling priority, minus one.
- Priority int
- // The nice value, a value in the range 19 (low priority) to -20 (high
- // priority).
- Nice int
- // Number of threads in this process.
- NumThreads int
- // The time the process started after system boot, the value is expressed
- // in clock ticks.
- Starttime uint64
- // Virtual memory size in bytes.
- VSize uint
- // Resident set size in pages.
- RSS int
-
- proc fs.FS
-}
-
-// NewStat returns the current status information of the process.
-//
-// Deprecated: use p.Stat() instead
-func (p Proc) NewStat() (ProcStat, error) {
- return p.Stat()
-}
-
-// Stat returns the current status information of the process.
-func (p Proc) Stat() (ProcStat, error) {
- data, err := util.ReadFileNoStat(p.path("stat"))
- if err != nil {
- return ProcStat{}, err
- }
-
- var (
- ignore int
-
- s = ProcStat{PID: p.PID, proc: p.fs}
- l = bytes.Index(data, []byte("("))
- r = bytes.LastIndex(data, []byte(")"))
- )
-
- if l < 0 || r < 0 {
- return ProcStat{}, fmt.Errorf(
- "unexpected format, couldn't extract comm: %s",
- data,
- )
- }
-
- s.Comm = string(data[l+1 : r])
- _, err = fmt.Fscan(
- bytes.NewBuffer(data[r+2:]),
- &s.State,
- &s.PPID,
- &s.PGRP,
- &s.Session,
- &s.TTY,
- &s.TPGID,
- &s.Flags,
- &s.MinFlt,
- &s.CMinFlt,
- &s.MajFlt,
- &s.CMajFlt,
- &s.UTime,
- &s.STime,
- &s.CUTime,
- &s.CSTime,
- &s.Priority,
- &s.Nice,
- &s.NumThreads,
- &ignore,
- &s.Starttime,
- &s.VSize,
- &s.RSS,
- )
- if err != nil {
- return ProcStat{}, err
- }
-
- return s, nil
-}
-
-// VirtualMemory returns the virtual memory size in bytes.
-func (s ProcStat) VirtualMemory() uint {
- return s.VSize
-}
-
-// ResidentMemory returns the resident memory size in bytes.
-func (s ProcStat) ResidentMemory() int {
- return s.RSS * os.Getpagesize()
-}
-
-// StartTime returns the unix timestamp of the process in seconds.
-func (s ProcStat) StartTime() (float64, error) {
- fs := FS{proc: s.proc}
- stat, err := fs.Stat()
- if err != nil {
- return 0, err
- }
- return float64(stat.BootTime) + (float64(s.Starttime) / userHZ), nil
-}
-
-// CPUTime returns the total CPU user and system time in seconds.
-func (s ProcStat) CPUTime() float64 {
- return float64(s.UTime+s.STime) / userHZ
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_status.go b/vendor/github.com/prometheus/procfs/proc_status.go
deleted file mode 100644
index e30c2b8..0000000
--- a/vendor/github.com/prometheus/procfs/proc_status.go
+++ /dev/null
@@ -1,161 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bytes"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// ProcStatus provides status information about the process,
-// read from /proc/[pid]/stat.
-type ProcStatus struct {
- // The process ID.
- PID int
- // The process name.
- Name string
-
- // Thread group ID.
- TGID int
-
- // Peak virtual memory size.
- VmPeak uint64
- // Virtual memory size.
- VmSize uint64
- // Locked memory size.
- VmLck uint64
- // Pinned memory size.
- VmPin uint64
- // Peak resident set size.
- VmHWM uint64
- // Resident set size (sum of RssAnnon RssFile and RssShmem).
- VmRSS uint64
- // Size of resident anonymous memory.
- RssAnon uint64
- // Size of resident file mappings.
- RssFile uint64
- // Size of resident shared memory.
- RssShmem uint64
- // Size of data segments.
- VmData uint64
- // Size of stack segments.
- VmStk uint64
- // Size of text segments.
- VmExe uint64
- // Shared library code size.
- VmLib uint64
- // Page table entries size.
- VmPTE uint64
- // Size of second-level page tables.
- VmPMD uint64
- // Swapped-out virtual memory size by anonymous private.
- VmSwap uint64
- // Size of hugetlb memory portions
- HugetlbPages uint64
-
- // Number of voluntary context switches.
- VoluntaryCtxtSwitches uint64
- // Number of involuntary context switches.
- NonVoluntaryCtxtSwitches uint64
-}
-
-// NewStatus returns the current status information of the process.
-func (p Proc) NewStatus() (ProcStatus, error) {
- data, err := util.ReadFileNoStat(p.path("status"))
- if err != nil {
- return ProcStatus{}, err
- }
-
- s := ProcStatus{PID: p.PID}
-
- lines := strings.Split(string(data), "\n")
- for _, line := range lines {
- if !bytes.Contains([]byte(line), []byte(":")) {
- continue
- }
-
- kv := strings.SplitN(line, ":", 2)
-
- // removes spaces
- k := string(strings.TrimSpace(kv[0]))
- v := string(strings.TrimSpace(kv[1]))
- // removes "kB"
- v = string(bytes.Trim([]byte(v), " kB"))
-
- // value to int when possible
- // we can skip error check here, 'cause vKBytes is not used when value is a string
- vKBytes, _ := strconv.ParseUint(v, 10, 64)
- // convert kB to B
- vBytes := vKBytes * 1024
-
- s.fillStatus(k, v, vKBytes, vBytes)
- }
-
- return s, nil
-}
-
-func (s *ProcStatus) fillStatus(k string, vString string, vUint uint64, vUintBytes uint64) {
- switch k {
- case "Tgid":
- s.TGID = int(vUint)
- case "Name":
- s.Name = vString
- case "VmPeak":
- s.VmPeak = vUintBytes
- case "VmSize":
- s.VmSize = vUintBytes
- case "VmLck":
- s.VmLck = vUintBytes
- case "VmPin":
- s.VmPin = vUintBytes
- case "VmHWM":
- s.VmHWM = vUintBytes
- case "VmRSS":
- s.VmRSS = vUintBytes
- case "RssAnon":
- s.RssAnon = vUintBytes
- case "RssFile":
- s.RssFile = vUintBytes
- case "RssShmem":
- s.RssShmem = vUintBytes
- case "VmData":
- s.VmData = vUintBytes
- case "VmStk":
- s.VmStk = vUintBytes
- case "VmExe":
- s.VmExe = vUintBytes
- case "VmLib":
- s.VmLib = vUintBytes
- case "VmPTE":
- s.VmPTE = vUintBytes
- case "VmPMD":
- s.VmPMD = vUintBytes
- case "VmSwap":
- s.VmSwap = vUintBytes
- case "HugetlbPages":
- s.HugetlbPages = vUintBytes
- case "voluntary_ctxt_switches":
- s.VoluntaryCtxtSwitches = vUint
- case "nonvoluntary_ctxt_switches":
- s.NonVoluntaryCtxtSwitches = vUint
- }
-}
-
-// TotalCtxtSwitches returns the total context switch.
-func (s ProcStatus) TotalCtxtSwitches() uint64 {
- return s.VoluntaryCtxtSwitches + s.NonVoluntaryCtxtSwitches
-}
diff --git a/vendor/github.com/prometheus/procfs/schedstat.go b/vendor/github.com/prometheus/procfs/schedstat.go
deleted file mode 100644
index a4c4089..0000000
--- a/vendor/github.com/prometheus/procfs/schedstat.go
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "errors"
- "os"
- "regexp"
- "strconv"
-)
-
-var (
- cpuLineRE = regexp.MustCompile(`cpu(\d+) (\d+) (\d+) (\d+) (\d+) (\d+) (\d+) (\d+) (\d+) (\d+)`)
- procLineRE = regexp.MustCompile(`(\d+) (\d+) (\d+)`)
-)
-
-// Schedstat contains scheduler statistics from /proc/schedstat
-//
-// See
-// https://www.kernel.org/doc/Documentation/scheduler/sched-stats.txt
-// for a detailed description of what these numbers mean.
-//
-// Note the current kernel documentation claims some of the time units are in
-// jiffies when they are actually in nanoseconds since 2.6.23 with the
-// introduction of CFS. A fix to the documentation is pending. See
-// https://lore.kernel.org/patchwork/project/lkml/list/?series=403473
-type Schedstat struct {
- CPUs []*SchedstatCPU
-}
-
-// SchedstatCPU contains the values from one "cpu" line
-type SchedstatCPU struct {
- CPUNum string
-
- RunningNanoseconds uint64
- WaitingNanoseconds uint64
- RunTimeslices uint64
-}
-
-// ProcSchedstat contains the values from /proc//schedstat
-type ProcSchedstat struct {
- RunningNanoseconds uint64
- WaitingNanoseconds uint64
- RunTimeslices uint64
-}
-
-// Schedstat reads data from /proc/schedstat
-func (fs FS) Schedstat() (*Schedstat, error) {
- file, err := os.Open(fs.proc.Path("schedstat"))
- if err != nil {
- return nil, err
- }
- defer file.Close()
-
- stats := &Schedstat{}
- scanner := bufio.NewScanner(file)
-
- for scanner.Scan() {
- match := cpuLineRE.FindStringSubmatch(scanner.Text())
- if match != nil {
- cpu := &SchedstatCPU{}
- cpu.CPUNum = match[1]
-
- cpu.RunningNanoseconds, err = strconv.ParseUint(match[8], 10, 64)
- if err != nil {
- continue
- }
-
- cpu.WaitingNanoseconds, err = strconv.ParseUint(match[9], 10, 64)
- if err != nil {
- continue
- }
-
- cpu.RunTimeslices, err = strconv.ParseUint(match[10], 10, 64)
- if err != nil {
- continue
- }
-
- stats.CPUs = append(stats.CPUs, cpu)
- }
- }
-
- return stats, nil
-}
-
-func parseProcSchedstat(contents string) (stats ProcSchedstat, err error) {
- match := procLineRE.FindStringSubmatch(contents)
-
- if match != nil {
- stats.RunningNanoseconds, err = strconv.ParseUint(match[1], 10, 64)
- if err != nil {
- return
- }
-
- stats.WaitingNanoseconds, err = strconv.ParseUint(match[2], 10, 64)
- if err != nil {
- return
- }
-
- stats.RunTimeslices, err = strconv.ParseUint(match[3], 10, 64)
- return
- }
-
- err = errors.New("could not parse schedstat")
- return
-}
diff --git a/vendor/github.com/prometheus/procfs/stat.go b/vendor/github.com/prometheus/procfs/stat.go
deleted file mode 100644
index b2a6fc9..0000000
--- a/vendor/github.com/prometheus/procfs/stat.go
+++ /dev/null
@@ -1,244 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/fs"
- "github.com/prometheus/procfs/internal/util"
-)
-
-// CPUStat shows how much time the cpu spend in various stages.
-type CPUStat struct {
- User float64
- Nice float64
- System float64
- Idle float64
- Iowait float64
- IRQ float64
- SoftIRQ float64
- Steal float64
- Guest float64
- GuestNice float64
-}
-
-// SoftIRQStat represent the softirq statistics as exported in the procfs stat file.
-// A nice introduction can be found at https://0xax.gitbooks.io/linux-insides/content/interrupts/interrupts-9.html
-// It is possible to get per-cpu stats by reading /proc/softirqs
-type SoftIRQStat struct {
- Hi uint64
- Timer uint64
- NetTx uint64
- NetRx uint64
- Block uint64
- BlockIoPoll uint64
- Tasklet uint64
- Sched uint64
- Hrtimer uint64
- Rcu uint64
-}
-
-// Stat represents kernel/system statistics.
-type Stat struct {
- // Boot time in seconds since the Epoch.
- BootTime uint64
- // Summed up cpu statistics.
- CPUTotal CPUStat
- // Per-CPU statistics.
- CPU []CPUStat
- // Number of times interrupts were handled, which contains numbered and unnumbered IRQs.
- IRQTotal uint64
- // Number of times a numbered IRQ was triggered.
- IRQ []uint64
- // Number of times a context switch happened.
- ContextSwitches uint64
- // Number of times a process was created.
- ProcessCreated uint64
- // Number of processes currently running.
- ProcessesRunning uint64
- // Number of processes currently blocked (waiting for IO).
- ProcessesBlocked uint64
- // Number of times a softirq was scheduled.
- SoftIRQTotal uint64
- // Detailed softirq statistics.
- SoftIRQ SoftIRQStat
-}
-
-// Parse a cpu statistics line and returns the CPUStat struct plus the cpu id (or -1 for the overall sum).
-func parseCPUStat(line string) (CPUStat, int64, error) {
- cpuStat := CPUStat{}
- var cpu string
-
- count, err := fmt.Sscanf(line, "%s %f %f %f %f %f %f %f %f %f %f",
- &cpu,
- &cpuStat.User, &cpuStat.Nice, &cpuStat.System, &cpuStat.Idle,
- &cpuStat.Iowait, &cpuStat.IRQ, &cpuStat.SoftIRQ, &cpuStat.Steal,
- &cpuStat.Guest, &cpuStat.GuestNice)
-
- if err != nil && err != io.EOF {
- return CPUStat{}, -1, fmt.Errorf("couldn't parse %s (cpu): %s", line, err)
- }
- if count == 0 {
- return CPUStat{}, -1, fmt.Errorf("couldn't parse %s (cpu): 0 elements parsed", line)
- }
-
- cpuStat.User /= userHZ
- cpuStat.Nice /= userHZ
- cpuStat.System /= userHZ
- cpuStat.Idle /= userHZ
- cpuStat.Iowait /= userHZ
- cpuStat.IRQ /= userHZ
- cpuStat.SoftIRQ /= userHZ
- cpuStat.Steal /= userHZ
- cpuStat.Guest /= userHZ
- cpuStat.GuestNice /= userHZ
-
- if cpu == "cpu" {
- return cpuStat, -1, nil
- }
-
- cpuID, err := strconv.ParseInt(cpu[3:], 10, 64)
- if err != nil {
- return CPUStat{}, -1, fmt.Errorf("couldn't parse %s (cpu/cpuid): %s", line, err)
- }
-
- return cpuStat, cpuID, nil
-}
-
-// Parse a softirq line.
-func parseSoftIRQStat(line string) (SoftIRQStat, uint64, error) {
- softIRQStat := SoftIRQStat{}
- var total uint64
- var prefix string
-
- _, err := fmt.Sscanf(line, "%s %d %d %d %d %d %d %d %d %d %d %d",
- &prefix, &total,
- &softIRQStat.Hi, &softIRQStat.Timer, &softIRQStat.NetTx, &softIRQStat.NetRx,
- &softIRQStat.Block, &softIRQStat.BlockIoPoll,
- &softIRQStat.Tasklet, &softIRQStat.Sched,
- &softIRQStat.Hrtimer, &softIRQStat.Rcu)
-
- if err != nil {
- return SoftIRQStat{}, 0, fmt.Errorf("couldn't parse %s (softirq): %s", line, err)
- }
-
- return softIRQStat, total, nil
-}
-
-// NewStat returns information about current cpu/process statistics.
-// See https://www.kernel.org/doc/Documentation/filesystems/proc.txt
-//
-// Deprecated: use fs.Stat() instead
-func NewStat() (Stat, error) {
- fs, err := NewFS(fs.DefaultProcMountPoint)
- if err != nil {
- return Stat{}, err
- }
- return fs.Stat()
-}
-
-// NewStat returns information about current cpu/process statistics.
-// See https://www.kernel.org/doc/Documentation/filesystems/proc.txt
-//
-// Deprecated: use fs.Stat() instead
-func (fs FS) NewStat() (Stat, error) {
- return fs.Stat()
-}
-
-// Stat returns information about current cpu/process statistics.
-// See https://www.kernel.org/doc/Documentation/filesystems/proc.txt
-func (fs FS) Stat() (Stat, error) {
- fileName := fs.proc.Path("stat")
- data, err := util.ReadFileNoStat(fileName)
- if err != nil {
- return Stat{}, err
- }
-
- stat := Stat{}
-
- scanner := bufio.NewScanner(bytes.NewReader(data))
- for scanner.Scan() {
- line := scanner.Text()
- parts := strings.Fields(scanner.Text())
- // require at least
- if len(parts) < 2 {
- continue
- }
- switch {
- case parts[0] == "btime":
- if stat.BootTime, err = strconv.ParseUint(parts[1], 10, 64); err != nil {
- return Stat{}, fmt.Errorf("couldn't parse %s (btime): %s", parts[1], err)
- }
- case parts[0] == "intr":
- if stat.IRQTotal, err = strconv.ParseUint(parts[1], 10, 64); err != nil {
- return Stat{}, fmt.Errorf("couldn't parse %s (intr): %s", parts[1], err)
- }
- numberedIRQs := parts[2:]
- stat.IRQ = make([]uint64, len(numberedIRQs))
- for i, count := range numberedIRQs {
- if stat.IRQ[i], err = strconv.ParseUint(count, 10, 64); err != nil {
- return Stat{}, fmt.Errorf("couldn't parse %s (intr%d): %s", count, i, err)
- }
- }
- case parts[0] == "ctxt":
- if stat.ContextSwitches, err = strconv.ParseUint(parts[1], 10, 64); err != nil {
- return Stat{}, fmt.Errorf("couldn't parse %s (ctxt): %s", parts[1], err)
- }
- case parts[0] == "processes":
- if stat.ProcessCreated, err = strconv.ParseUint(parts[1], 10, 64); err != nil {
- return Stat{}, fmt.Errorf("couldn't parse %s (processes): %s", parts[1], err)
- }
- case parts[0] == "procs_running":
- if stat.ProcessesRunning, err = strconv.ParseUint(parts[1], 10, 64); err != nil {
- return Stat{}, fmt.Errorf("couldn't parse %s (procs_running): %s", parts[1], err)
- }
- case parts[0] == "procs_blocked":
- if stat.ProcessesBlocked, err = strconv.ParseUint(parts[1], 10, 64); err != nil {
- return Stat{}, fmt.Errorf("couldn't parse %s (procs_blocked): %s", parts[1], err)
- }
- case parts[0] == "softirq":
- softIRQStats, total, err := parseSoftIRQStat(line)
- if err != nil {
- return Stat{}, err
- }
- stat.SoftIRQTotal = total
- stat.SoftIRQ = softIRQStats
- case strings.HasPrefix(parts[0], "cpu"):
- cpuStat, cpuID, err := parseCPUStat(line)
- if err != nil {
- return Stat{}, err
- }
- if cpuID == -1 {
- stat.CPUTotal = cpuStat
- } else {
- for int64(len(stat.CPU)) <= cpuID {
- stat.CPU = append(stat.CPU, CPUStat{})
- }
- stat.CPU[cpuID] = cpuStat
- }
- }
- }
-
- if err := scanner.Err(); err != nil {
- return Stat{}, fmt.Errorf("couldn't parse %s: %s", fileName, err)
- }
-
- return stat, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/ttar b/vendor/github.com/prometheus/procfs/ttar
deleted file mode 100644
index 19ef02b..0000000
--- a/vendor/github.com/prometheus/procfs/ttar
+++ /dev/null
@@ -1,413 +0,0 @@
-#!/usr/bin/env bash
-
-# Purpose: plain text tar format
-# Limitations: - only suitable for text files, directories, and symlinks
-# - stores only filename, content, and mode
-# - not designed for untrusted input
-#
-# Note: must work with bash version 3.2 (macOS)
-
-# Copyright 2017 Roger Luethi
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-set -o errexit -o nounset
-
-# Sanitize environment (for instance, standard sorting of glob matches)
-export LC_ALL=C
-
-path=""
-CMD=""
-ARG_STRING="$*"
-
-#------------------------------------------------------------------------------
-# Not all sed implementations can work on null bytes. In order to make ttar
-# work out of the box on macOS, use Python as a stream editor.
-
-USE_PYTHON=0
-
-PYTHON_CREATE_FILTER=$(cat << 'PCF'
-#!/usr/bin/env python
-
-import re
-import sys
-
-for line in sys.stdin:
- line = re.sub(r'EOF', r'\EOF', line)
- line = re.sub(r'NULLBYTE', r'\NULLBYTE', line)
- line = re.sub('\x00', r'NULLBYTE', line)
- sys.stdout.write(line)
-PCF
-)
-
-PYTHON_EXTRACT_FILTER=$(cat << 'PEF'
-#!/usr/bin/env python
-
-import re
-import sys
-
-for line in sys.stdin:
- line = re.sub(r'(?/dev/null; then
- echo "ERROR Python not found. Aborting."
- exit 2
- fi
- USE_PYTHON=1
- fi
-}
-
-#------------------------------------------------------------------------------
-
-function usage {
- bname=$(basename "$0")
- cat << USAGE
-Usage: $bname [-C ] -c -f (create archive)
- $bname -t -f (list archive contents)
- $bname [-C ] -x -f (extract archive)
-
-Options:
- -C (change directory)
- -v (verbose)
- --recursive-unlink (recursively delete existing directory if path
- collides with file or directory to extract)
-
-Example: Change to sysfs directory, create ttar file from fixtures directory
- $bname -C sysfs -c -f sysfs/fixtures.ttar fixtures/
-USAGE
-exit "$1"
-}
-
-function vecho {
- if [ "${VERBOSE:-}" == "yes" ]; then
- echo >&7 "$@"
- fi
-}
-
-function set_cmd {
- if [ -n "$CMD" ]; then
- echo "ERROR: more than one command given"
- echo
- usage 2
- fi
- CMD=$1
-}
-
-unset VERBOSE
-unset RECURSIVE_UNLINK
-
-while getopts :cf:-:htxvC: opt; do
- case $opt in
- c)
- set_cmd "create"
- ;;
- f)
- ARCHIVE=$OPTARG
- ;;
- h)
- usage 0
- ;;
- t)
- set_cmd "list"
- ;;
- x)
- set_cmd "extract"
- ;;
- v)
- VERBOSE=yes
- exec 7>&1
- ;;
- C)
- CDIR=$OPTARG
- ;;
- -)
- case $OPTARG in
- recursive-unlink)
- RECURSIVE_UNLINK="yes"
- ;;
- *)
- echo -e "Error: invalid option -$OPTARG"
- echo
- usage 1
- ;;
- esac
- ;;
- *)
- echo >&2 "ERROR: invalid option -$OPTARG"
- echo
- usage 1
- ;;
- esac
-done
-
-# Remove processed options from arguments
-shift $(( OPTIND - 1 ));
-
-if [ "${CMD:-}" == "" ]; then
- echo >&2 "ERROR: no command given"
- echo
- usage 1
-elif [ "${ARCHIVE:-}" == "" ]; then
- echo >&2 "ERROR: no archive name given"
- echo
- usage 1
-fi
-
-function list {
- local path=""
- local size=0
- local line_no=0
- local ttar_file=$1
- if [ -n "${2:-}" ]; then
- echo >&2 "ERROR: too many arguments."
- echo
- usage 1
- fi
- if [ ! -e "$ttar_file" ]; then
- echo >&2 "ERROR: file not found ($ttar_file)"
- echo
- usage 1
- fi
- while read -r line; do
- line_no=$(( line_no + 1 ))
- if [ $size -gt 0 ]; then
- size=$(( size - 1 ))
- continue
- fi
- if [[ $line =~ ^Path:\ (.*)$ ]]; then
- path=${BASH_REMATCH[1]}
- elif [[ $line =~ ^Lines:\ (.*)$ ]]; then
- size=${BASH_REMATCH[1]}
- echo "$path"
- elif [[ $line =~ ^Directory:\ (.*)$ ]]; then
- path=${BASH_REMATCH[1]}
- echo "$path/"
- elif [[ $line =~ ^SymlinkTo:\ (.*)$ ]]; then
- echo "$path -> ${BASH_REMATCH[1]}"
- fi
- done < "$ttar_file"
-}
-
-function extract {
- local path=""
- local size=0
- local line_no=0
- local ttar_file=$1
- if [ -n "${2:-}" ]; then
- echo >&2 "ERROR: too many arguments."
- echo
- usage 1
- fi
- if [ ! -e "$ttar_file" ]; then
- echo >&2 "ERROR: file not found ($ttar_file)"
- echo
- usage 1
- fi
- while IFS= read -r line; do
- line_no=$(( line_no + 1 ))
- local eof_without_newline
- if [ "$size" -gt 0 ]; then
- if [[ "$line" =~ [^\\]EOF ]]; then
- # An EOF not preceded by a backslash indicates that the line
- # does not end with a newline
- eof_without_newline=1
- else
- eof_without_newline=0
- fi
- # Replace NULLBYTE with null byte if at beginning of line
- # Replace NULLBYTE with null byte unless preceded by backslash
- # Remove one backslash in front of NULLBYTE (if any)
- # Remove EOF unless preceded by backslash
- # Remove one backslash in front of EOF
- if [ $USE_PYTHON -eq 1 ]; then
- echo -n "$line" | python -c "$PYTHON_EXTRACT_FILTER" >> "$path"
- else
- # The repeated pattern makes up for sed's lack of negative
- # lookbehind assertions (for consecutive null bytes).
- echo -n "$line" | \
- sed -e 's/^NULLBYTE/\x0/g;
- s/\([^\\]\)NULLBYTE/\1\x0/g;
- s/\([^\\]\)NULLBYTE/\1\x0/g;
- s/\\NULLBYTE/NULLBYTE/g;
- s/\([^\\]\)EOF/\1/g;
- s/\\EOF/EOF/g;
- ' >> "$path"
- fi
- if [[ "$eof_without_newline" -eq 0 ]]; then
- echo >> "$path"
- fi
- size=$(( size - 1 ))
- continue
- fi
- if [[ $line =~ ^Path:\ (.*)$ ]]; then
- path=${BASH_REMATCH[1]}
- if [ -L "$path" ]; then
- rm "$path"
- elif [ -d "$path" ]; then
- if [ "${RECURSIVE_UNLINK:-}" == "yes" ]; then
- rm -r "$path"
- else
- # Safe because symlinks to directories are dealt with above
- rmdir "$path"
- fi
- elif [ -e "$path" ]; then
- rm "$path"
- fi
- elif [[ $line =~ ^Lines:\ (.*)$ ]]; then
- size=${BASH_REMATCH[1]}
- # Create file even if it is zero-length.
- touch "$path"
- vecho " $path"
- elif [[ $line =~ ^Mode:\ (.*)$ ]]; then
- mode=${BASH_REMATCH[1]}
- chmod "$mode" "$path"
- vecho "$mode"
- elif [[ $line =~ ^Directory:\ (.*)$ ]]; then
- path=${BASH_REMATCH[1]}
- mkdir -p "$path"
- vecho " $path/"
- elif [[ $line =~ ^SymlinkTo:\ (.*)$ ]]; then
- ln -s "${BASH_REMATCH[1]}" "$path"
- vecho " $path -> ${BASH_REMATCH[1]}"
- elif [[ $line =~ ^# ]]; then
- # Ignore comments between files
- continue
- else
- echo >&2 "ERROR: Unknown keyword on line $line_no: $line"
- exit 1
- fi
- done < "$ttar_file"
-}
-
-function div {
- echo "# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" \
- "- - - - - -"
-}
-
-function get_mode {
- local mfile=$1
- if [ -z "${STAT_OPTION:-}" ]; then
- if stat -c '%a' "$mfile" >/dev/null 2>&1; then
- # GNU stat
- STAT_OPTION='-c'
- STAT_FORMAT='%a'
- else
- # BSD stat
- STAT_OPTION='-f'
- # Octal output, user/group/other (omit file type, sticky bit)
- STAT_FORMAT='%OLp'
- fi
- fi
- stat "${STAT_OPTION}" "${STAT_FORMAT}" "$mfile"
-}
-
-function _create {
- shopt -s nullglob
- local mode
- local eof_without_newline
- while (( "$#" )); do
- file=$1
- if [ -L "$file" ]; then
- echo "Path: $file"
- symlinkTo=$(readlink "$file")
- echo "SymlinkTo: $symlinkTo"
- vecho " $file -> $symlinkTo"
- div
- elif [ -d "$file" ]; then
- # Strip trailing slash (if there is one)
- file=${file%/}
- echo "Directory: $file"
- mode=$(get_mode "$file")
- echo "Mode: $mode"
- vecho "$mode $file/"
- div
- # Find all files and dirs, including hidden/dot files
- for x in "$file/"{*,.[^.]*}; do
- _create "$x"
- done
- elif [ -f "$file" ]; then
- echo "Path: $file"
- lines=$(wc -l "$file"|awk '{print $1}')
- eof_without_newline=0
- if [[ "$(wc -c "$file"|awk '{print $1}')" -gt 0 ]] && \
- [[ "$(tail -c 1 "$file" | wc -l)" -eq 0 ]]; then
- eof_without_newline=1
- lines=$((lines+1))
- fi
- echo "Lines: $lines"
- # Add backslash in front of EOF
- # Add backslash in front of NULLBYTE
- # Replace null byte with NULLBYTE
- if [ $USE_PYTHON -eq 1 ]; then
- < "$file" python -c "$PYTHON_CREATE_FILTER"
- else
- < "$file" \
- sed 's/EOF/\\EOF/g;
- s/NULLBYTE/\\NULLBYTE/g;
- s/\x0/NULLBYTE/g;
- '
- fi
- if [[ "$eof_without_newline" -eq 1 ]]; then
- # Finish line with EOF to indicate that the original line did
- # not end with a linefeed
- echo "EOF"
- fi
- mode=$(get_mode "$file")
- echo "Mode: $mode"
- vecho "$mode $file"
- div
- else
- echo >&2 "ERROR: file not found ($file in $(pwd))"
- exit 2
- fi
- shift
- done
-}
-
-function create {
- ttar_file=$1
- shift
- if [ -z "${1:-}" ]; then
- echo >&2 "ERROR: missing arguments."
- echo
- usage 1
- fi
- if [ -e "$ttar_file" ]; then
- rm "$ttar_file"
- fi
- exec > "$ttar_file"
- echo "# Archive created by ttar $ARG_STRING"
- _create "$@"
-}
-
-test_environment
-
-if [ -n "${CDIR:-}" ]; then
- if [[ "$ARCHIVE" != /* ]]; then
- # Relative path: preserve the archive's location before changing
- # directory
- ARCHIVE="$(pwd)/$ARCHIVE"
- fi
- cd "$CDIR"
-fi
-
-"$CMD" "$ARCHIVE" "$@"
diff --git a/vendor/github.com/prometheus/procfs/vm.go b/vendor/github.com/prometheus/procfs/vm.go
deleted file mode 100644
index cb13891..0000000
--- a/vendor/github.com/prometheus/procfs/vm.go
+++ /dev/null
@@ -1,210 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build !windows
-
-package procfs
-
-import (
- "fmt"
- "io/ioutil"
- "os"
- "path/filepath"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// The VM interface is described at
-// https://www.kernel.org/doc/Documentation/sysctl/vm.txt
-// Each setting is exposed as a single file.
-// Each file contains one line with a single numerical value, except lowmem_reserve_ratio which holds an array
-// and numa_zonelist_order (deprecated) which is a string
-type VM struct {
- AdminReserveKbytes *int64 // /proc/sys/vm/admin_reserve_kbytes
- BlockDump *int64 // /proc/sys/vm/block_dump
- CompactUnevictableAllowed *int64 // /proc/sys/vm/compact_unevictable_allowed
- DirtyBackgroundBytes *int64 // /proc/sys/vm/dirty_background_bytes
- DirtyBackgroundRatio *int64 // /proc/sys/vm/dirty_background_ratio
- DirtyBytes *int64 // /proc/sys/vm/dirty_bytes
- DirtyExpireCentisecs *int64 // /proc/sys/vm/dirty_expire_centisecs
- DirtyRatio *int64 // /proc/sys/vm/dirty_ratio
- DirtytimeExpireSeconds *int64 // /proc/sys/vm/dirtytime_expire_seconds
- DirtyWritebackCentisecs *int64 // /proc/sys/vm/dirty_writeback_centisecs
- DropCaches *int64 // /proc/sys/vm/drop_caches
- ExtfragThreshold *int64 // /proc/sys/vm/extfrag_threshold
- HugetlbShmGroup *int64 // /proc/sys/vm/hugetlb_shm_group
- LaptopMode *int64 // /proc/sys/vm/laptop_mode
- LegacyVaLayout *int64 // /proc/sys/vm/legacy_va_layout
- LowmemReserveRatio []*int64 // /proc/sys/vm/lowmem_reserve_ratio
- MaxMapCount *int64 // /proc/sys/vm/max_map_count
- MemoryFailureEarlyKill *int64 // /proc/sys/vm/memory_failure_early_kill
- MemoryFailureRecovery *int64 // /proc/sys/vm/memory_failure_recovery
- MinFreeKbytes *int64 // /proc/sys/vm/min_free_kbytes
- MinSlabRatio *int64 // /proc/sys/vm/min_slab_ratio
- MinUnmappedRatio *int64 // /proc/sys/vm/min_unmapped_ratio
- MmapMinAddr *int64 // /proc/sys/vm/mmap_min_addr
- NrHugepages *int64 // /proc/sys/vm/nr_hugepages
- NrHugepagesMempolicy *int64 // /proc/sys/vm/nr_hugepages_mempolicy
- NrOvercommitHugepages *int64 // /proc/sys/vm/nr_overcommit_hugepages
- NumaStat *int64 // /proc/sys/vm/numa_stat
- NumaZonelistOrder string // /proc/sys/vm/numa_zonelist_order
- OomDumpTasks *int64 // /proc/sys/vm/oom_dump_tasks
- OomKillAllocatingTask *int64 // /proc/sys/vm/oom_kill_allocating_task
- OvercommitKbytes *int64 // /proc/sys/vm/overcommit_kbytes
- OvercommitMemory *int64 // /proc/sys/vm/overcommit_memory
- OvercommitRatio *int64 // /proc/sys/vm/overcommit_ratio
- PageCluster *int64 // /proc/sys/vm/page-cluster
- PanicOnOom *int64 // /proc/sys/vm/panic_on_oom
- PercpuPagelistFraction *int64 // /proc/sys/vm/percpu_pagelist_fraction
- StatInterval *int64 // /proc/sys/vm/stat_interval
- Swappiness *int64 // /proc/sys/vm/swappiness
- UserReserveKbytes *int64 // /proc/sys/vm/user_reserve_kbytes
- VfsCachePressure *int64 // /proc/sys/vm/vfs_cache_pressure
- WatermarkBoostFactor *int64 // /proc/sys/vm/watermark_boost_factor
- WatermarkScaleFactor *int64 // /proc/sys/vm/watermark_scale_factor
- ZoneReclaimMode *int64 // /proc/sys/vm/zone_reclaim_mode
-}
-
-// VM reads the VM statistics from the specified `proc` filesystem.
-func (fs FS) VM() (*VM, error) {
- path := fs.proc.Path("sys/vm")
- file, err := os.Stat(path)
- if err != nil {
- return nil, err
- }
- if !file.Mode().IsDir() {
- return nil, fmt.Errorf("%s is not a directory", path)
- }
-
- files, err := ioutil.ReadDir(path)
- if err != nil {
- return nil, err
- }
-
- var vm VM
- for _, f := range files {
- if f.IsDir() {
- continue
- }
-
- name := filepath.Join(path, f.Name())
- // ignore errors on read, as there are some write only
- // in /proc/sys/vm
- value, err := util.SysReadFile(name)
- if err != nil {
- continue
- }
- vp := util.NewValueParser(value)
-
- switch f.Name() {
- case "admin_reserve_kbytes":
- vm.AdminReserveKbytes = vp.PInt64()
- case "block_dump":
- vm.BlockDump = vp.PInt64()
- case "compact_unevictable_allowed":
- vm.CompactUnevictableAllowed = vp.PInt64()
- case "dirty_background_bytes":
- vm.DirtyBackgroundBytes = vp.PInt64()
- case "dirty_background_ratio":
- vm.DirtyBackgroundRatio = vp.PInt64()
- case "dirty_bytes":
- vm.DirtyBytes = vp.PInt64()
- case "dirty_expire_centisecs":
- vm.DirtyExpireCentisecs = vp.PInt64()
- case "dirty_ratio":
- vm.DirtyRatio = vp.PInt64()
- case "dirtytime_expire_seconds":
- vm.DirtytimeExpireSeconds = vp.PInt64()
- case "dirty_writeback_centisecs":
- vm.DirtyWritebackCentisecs = vp.PInt64()
- case "drop_caches":
- vm.DropCaches = vp.PInt64()
- case "extfrag_threshold":
- vm.ExtfragThreshold = vp.PInt64()
- case "hugetlb_shm_group":
- vm.HugetlbShmGroup = vp.PInt64()
- case "laptop_mode":
- vm.LaptopMode = vp.PInt64()
- case "legacy_va_layout":
- vm.LegacyVaLayout = vp.PInt64()
- case "lowmem_reserve_ratio":
- stringSlice := strings.Fields(value)
- pint64Slice := make([]*int64, 0, len(stringSlice))
- for _, value := range stringSlice {
- vp := util.NewValueParser(value)
- pint64Slice = append(pint64Slice, vp.PInt64())
- }
- vm.LowmemReserveRatio = pint64Slice
- case "max_map_count":
- vm.MaxMapCount = vp.PInt64()
- case "memory_failure_early_kill":
- vm.MemoryFailureEarlyKill = vp.PInt64()
- case "memory_failure_recovery":
- vm.MemoryFailureRecovery = vp.PInt64()
- case "min_free_kbytes":
- vm.MinFreeKbytes = vp.PInt64()
- case "min_slab_ratio":
- vm.MinSlabRatio = vp.PInt64()
- case "min_unmapped_ratio":
- vm.MinUnmappedRatio = vp.PInt64()
- case "mmap_min_addr":
- vm.MmapMinAddr = vp.PInt64()
- case "nr_hugepages":
- vm.NrHugepages = vp.PInt64()
- case "nr_hugepages_mempolicy":
- vm.NrHugepagesMempolicy = vp.PInt64()
- case "nr_overcommit_hugepages":
- vm.NrOvercommitHugepages = vp.PInt64()
- case "numa_stat":
- vm.NumaStat = vp.PInt64()
- case "numa_zonelist_order":
- vm.NumaZonelistOrder = value
- case "oom_dump_tasks":
- vm.OomDumpTasks = vp.PInt64()
- case "oom_kill_allocating_task":
- vm.OomKillAllocatingTask = vp.PInt64()
- case "overcommit_kbytes":
- vm.OvercommitKbytes = vp.PInt64()
- case "overcommit_memory":
- vm.OvercommitMemory = vp.PInt64()
- case "overcommit_ratio":
- vm.OvercommitRatio = vp.PInt64()
- case "page-cluster":
- vm.PageCluster = vp.PInt64()
- case "panic_on_oom":
- vm.PanicOnOom = vp.PInt64()
- case "percpu_pagelist_fraction":
- vm.PercpuPagelistFraction = vp.PInt64()
- case "stat_interval":
- vm.StatInterval = vp.PInt64()
- case "swappiness":
- vm.Swappiness = vp.PInt64()
- case "user_reserve_kbytes":
- vm.UserReserveKbytes = vp.PInt64()
- case "vfs_cache_pressure":
- vm.VfsCachePressure = vp.PInt64()
- case "watermark_boost_factor":
- vm.WatermarkBoostFactor = vp.PInt64()
- case "watermark_scale_factor":
- vm.WatermarkScaleFactor = vp.PInt64()
- case "zone_reclaim_mode":
- vm.ZoneReclaimMode = vp.PInt64()
- }
- if err := vp.Err(); err != nil {
- return nil, err
- }
- }
-
- return &vm, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/xfrm.go b/vendor/github.com/prometheus/procfs/xfrm.go
deleted file mode 100644
index 30aa417..0000000
--- a/vendor/github.com/prometheus/procfs/xfrm.go
+++ /dev/null
@@ -1,187 +0,0 @@
-// Copyright 2017 Prometheus Team
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "fmt"
- "os"
- "strconv"
- "strings"
-)
-
-// XfrmStat models the contents of /proc/net/xfrm_stat.
-type XfrmStat struct {
- // All errors which are not matched by other
- XfrmInError int
- // No buffer is left
- XfrmInBufferError int
- // Header Error
- XfrmInHdrError int
- // No state found
- // i.e. either inbound SPI, address, or IPSEC protocol at SA is wrong
- XfrmInNoStates int
- // Transformation protocol specific error
- // e.g. SA Key is wrong
- XfrmInStateProtoError int
- // Transformation mode specific error
- XfrmInStateModeError int
- // Sequence error
- // e.g. sequence number is out of window
- XfrmInStateSeqError int
- // State is expired
- XfrmInStateExpired int
- // State has mismatch option
- // e.g. UDP encapsulation type is mismatched
- XfrmInStateMismatch int
- // State is invalid
- XfrmInStateInvalid int
- // No matching template for states
- // e.g. Inbound SAs are correct but SP rule is wrong
- XfrmInTmplMismatch int
- // No policy is found for states
- // e.g. Inbound SAs are correct but no SP is found
- XfrmInNoPols int
- // Policy discards
- XfrmInPolBlock int
- // Policy error
- XfrmInPolError int
- // All errors which are not matched by others
- XfrmOutError int
- // Bundle generation error
- XfrmOutBundleGenError int
- // Bundle check error
- XfrmOutBundleCheckError int
- // No state was found
- XfrmOutNoStates int
- // Transformation protocol specific error
- XfrmOutStateProtoError int
- // Transportation mode specific error
- XfrmOutStateModeError int
- // Sequence error
- // i.e sequence number overflow
- XfrmOutStateSeqError int
- // State is expired
- XfrmOutStateExpired int
- // Policy discads
- XfrmOutPolBlock int
- // Policy is dead
- XfrmOutPolDead int
- // Policy Error
- XfrmOutPolError int
- XfrmFwdHdrError int
- XfrmOutStateInvalid int
- XfrmAcquireError int
-}
-
-// NewXfrmStat reads the xfrm_stat statistics.
-func NewXfrmStat() (XfrmStat, error) {
- fs, err := NewFS(DefaultMountPoint)
- if err != nil {
- return XfrmStat{}, err
- }
-
- return fs.NewXfrmStat()
-}
-
-// NewXfrmStat reads the xfrm_stat statistics from the 'proc' filesystem.
-func (fs FS) NewXfrmStat() (XfrmStat, error) {
- file, err := os.Open(fs.proc.Path("net/xfrm_stat"))
- if err != nil {
- return XfrmStat{}, err
- }
- defer file.Close()
-
- var (
- x = XfrmStat{}
- s = bufio.NewScanner(file)
- )
-
- for s.Scan() {
- fields := strings.Fields(s.Text())
-
- if len(fields) != 2 {
- return XfrmStat{}, fmt.Errorf(
- "couldn't parse %s line %s", file.Name(), s.Text())
- }
-
- name := fields[0]
- value, err := strconv.Atoi(fields[1])
- if err != nil {
- return XfrmStat{}, err
- }
-
- switch name {
- case "XfrmInError":
- x.XfrmInError = value
- case "XfrmInBufferError":
- x.XfrmInBufferError = value
- case "XfrmInHdrError":
- x.XfrmInHdrError = value
- case "XfrmInNoStates":
- x.XfrmInNoStates = value
- case "XfrmInStateProtoError":
- x.XfrmInStateProtoError = value
- case "XfrmInStateModeError":
- x.XfrmInStateModeError = value
- case "XfrmInStateSeqError":
- x.XfrmInStateSeqError = value
- case "XfrmInStateExpired":
- x.XfrmInStateExpired = value
- case "XfrmInStateInvalid":
- x.XfrmInStateInvalid = value
- case "XfrmInTmplMismatch":
- x.XfrmInTmplMismatch = value
- case "XfrmInNoPols":
- x.XfrmInNoPols = value
- case "XfrmInPolBlock":
- x.XfrmInPolBlock = value
- case "XfrmInPolError":
- x.XfrmInPolError = value
- case "XfrmOutError":
- x.XfrmOutError = value
- case "XfrmInStateMismatch":
- x.XfrmInStateMismatch = value
- case "XfrmOutBundleGenError":
- x.XfrmOutBundleGenError = value
- case "XfrmOutBundleCheckError":
- x.XfrmOutBundleCheckError = value
- case "XfrmOutNoStates":
- x.XfrmOutNoStates = value
- case "XfrmOutStateProtoError":
- x.XfrmOutStateProtoError = value
- case "XfrmOutStateModeError":
- x.XfrmOutStateModeError = value
- case "XfrmOutStateSeqError":
- x.XfrmOutStateSeqError = value
- case "XfrmOutStateExpired":
- x.XfrmOutStateExpired = value
- case "XfrmOutPolBlock":
- x.XfrmOutPolBlock = value
- case "XfrmOutPolDead":
- x.XfrmOutPolDead = value
- case "XfrmOutPolError":
- x.XfrmOutPolError = value
- case "XfrmFwdHdrError":
- x.XfrmFwdHdrError = value
- case "XfrmOutStateInvalid":
- x.XfrmOutStateInvalid = value
- case "XfrmAcquireError":
- x.XfrmAcquireError = value
- }
-
- }
-
- return x, s.Err()
-}
diff --git a/vendor/github.com/prometheus/procfs/zoneinfo.go b/vendor/github.com/prometheus/procfs/zoneinfo.go
deleted file mode 100644
index e941503..0000000
--- a/vendor/github.com/prometheus/procfs/zoneinfo.go
+++ /dev/null
@@ -1,196 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build !windows
-
-package procfs
-
-import (
- "bytes"
- "fmt"
- "io/ioutil"
- "regexp"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// Zoneinfo holds info parsed from /proc/zoneinfo.
-type Zoneinfo struct {
- Node string
- Zone string
- NrFreePages *int64
- Min *int64
- Low *int64
- High *int64
- Scanned *int64
- Spanned *int64
- Present *int64
- Managed *int64
- NrActiveAnon *int64
- NrInactiveAnon *int64
- NrIsolatedAnon *int64
- NrAnonPages *int64
- NrAnonTransparentHugepages *int64
- NrActiveFile *int64
- NrInactiveFile *int64
- NrIsolatedFile *int64
- NrFilePages *int64
- NrSlabReclaimable *int64
- NrSlabUnreclaimable *int64
- NrMlockStack *int64
- NrKernelStack *int64
- NrMapped *int64
- NrDirty *int64
- NrWriteback *int64
- NrUnevictable *int64
- NrShmem *int64
- NrDirtied *int64
- NrWritten *int64
- NumaHit *int64
- NumaMiss *int64
- NumaForeign *int64
- NumaInterleave *int64
- NumaLocal *int64
- NumaOther *int64
- Protection []*int64
-}
-
-var nodeZoneRE = regexp.MustCompile(`(\d+), zone\s+(\w+)`)
-
-// Zoneinfo parses an zoneinfo-file (/proc/zoneinfo) and returns a slice of
-// structs containing the relevant info. More information available here:
-// https://www.kernel.org/doc/Documentation/sysctl/vm.txt
-func (fs FS) Zoneinfo() ([]Zoneinfo, error) {
- data, err := ioutil.ReadFile(fs.proc.Path("zoneinfo"))
- if err != nil {
- return nil, fmt.Errorf("error reading zoneinfo %s: %s", fs.proc.Path("zoneinfo"), err)
- }
- zoneinfo, err := parseZoneinfo(data)
- if err != nil {
- return nil, fmt.Errorf("error parsing zoneinfo %s: %s", fs.proc.Path("zoneinfo"), err)
- }
- return zoneinfo, nil
-}
-
-func parseZoneinfo(zoneinfoData []byte) ([]Zoneinfo, error) {
-
- zoneinfo := []Zoneinfo{}
-
- zoneinfoBlocks := bytes.Split(zoneinfoData, []byte("\nNode"))
- for _, block := range zoneinfoBlocks {
- var zoneinfoElement Zoneinfo
- lines := strings.Split(string(block), "\n")
- for _, line := range lines {
-
- if nodeZone := nodeZoneRE.FindStringSubmatch(line); nodeZone != nil {
- zoneinfoElement.Node = nodeZone[1]
- zoneinfoElement.Zone = nodeZone[2]
- continue
- }
- if strings.HasPrefix(strings.TrimSpace(line), "per-node stats") {
- zoneinfoElement.Zone = ""
- continue
- }
- parts := strings.Fields(strings.TrimSpace(line))
- if len(parts) < 2 {
- continue
- }
- vp := util.NewValueParser(parts[1])
- switch parts[0] {
- case "nr_free_pages":
- zoneinfoElement.NrFreePages = vp.PInt64()
- case "min":
- zoneinfoElement.Min = vp.PInt64()
- case "low":
- zoneinfoElement.Low = vp.PInt64()
- case "high":
- zoneinfoElement.High = vp.PInt64()
- case "scanned":
- zoneinfoElement.Scanned = vp.PInt64()
- case "spanned":
- zoneinfoElement.Spanned = vp.PInt64()
- case "present":
- zoneinfoElement.Present = vp.PInt64()
- case "managed":
- zoneinfoElement.Managed = vp.PInt64()
- case "nr_active_anon":
- zoneinfoElement.NrActiveAnon = vp.PInt64()
- case "nr_inactive_anon":
- zoneinfoElement.NrInactiveAnon = vp.PInt64()
- case "nr_isolated_anon":
- zoneinfoElement.NrIsolatedAnon = vp.PInt64()
- case "nr_anon_pages":
- zoneinfoElement.NrAnonPages = vp.PInt64()
- case "nr_anon_transparent_hugepages":
- zoneinfoElement.NrAnonTransparentHugepages = vp.PInt64()
- case "nr_active_file":
- zoneinfoElement.NrActiveFile = vp.PInt64()
- case "nr_inactive_file":
- zoneinfoElement.NrInactiveFile = vp.PInt64()
- case "nr_isolated_file":
- zoneinfoElement.NrIsolatedFile = vp.PInt64()
- case "nr_file_pages":
- zoneinfoElement.NrFilePages = vp.PInt64()
- case "nr_slab_reclaimable":
- zoneinfoElement.NrSlabReclaimable = vp.PInt64()
- case "nr_slab_unreclaimable":
- zoneinfoElement.NrSlabUnreclaimable = vp.PInt64()
- case "nr_mlock_stack":
- zoneinfoElement.NrMlockStack = vp.PInt64()
- case "nr_kernel_stack":
- zoneinfoElement.NrKernelStack = vp.PInt64()
- case "nr_mapped":
- zoneinfoElement.NrMapped = vp.PInt64()
- case "nr_dirty":
- zoneinfoElement.NrDirty = vp.PInt64()
- case "nr_writeback":
- zoneinfoElement.NrWriteback = vp.PInt64()
- case "nr_unevictable":
- zoneinfoElement.NrUnevictable = vp.PInt64()
- case "nr_shmem":
- zoneinfoElement.NrShmem = vp.PInt64()
- case "nr_dirtied":
- zoneinfoElement.NrDirtied = vp.PInt64()
- case "nr_written":
- zoneinfoElement.NrWritten = vp.PInt64()
- case "numa_hit":
- zoneinfoElement.NumaHit = vp.PInt64()
- case "numa_miss":
- zoneinfoElement.NumaMiss = vp.PInt64()
- case "numa_foreign":
- zoneinfoElement.NumaForeign = vp.PInt64()
- case "numa_interleave":
- zoneinfoElement.NumaInterleave = vp.PInt64()
- case "numa_local":
- zoneinfoElement.NumaLocal = vp.PInt64()
- case "numa_other":
- zoneinfoElement.NumaOther = vp.PInt64()
- case "protection:":
- protectionParts := strings.Split(line, ":")
- protectionValues := strings.Replace(protectionParts[1], "(", "", 1)
- protectionValues = strings.Replace(protectionValues, ")", "", 1)
- protectionValues = strings.TrimSpace(protectionValues)
- protectionStringMap := strings.Split(protectionValues, ", ")
- val, err := util.ParsePInt64s(protectionStringMap)
- if err == nil {
- zoneinfoElement.Protection = val
- }
- }
-
- }
-
- zoneinfo = append(zoneinfo, zoneinfoElement)
- }
- return zoneinfo, nil
-}
diff --git a/vendor/github.com/sirupsen/logrus/.gitignore b/vendor/github.com/sirupsen/logrus/.gitignore
deleted file mode 100644
index 6b7d7d1..0000000
--- a/vendor/github.com/sirupsen/logrus/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-logrus
-vendor
diff --git a/vendor/github.com/sirupsen/logrus/.travis.yml b/vendor/github.com/sirupsen/logrus/.travis.yml
deleted file mode 100644
index 848938a..0000000
--- a/vendor/github.com/sirupsen/logrus/.travis.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-language: go
-go_import_path: github.com/sirupsen/logrus
-git:
- depth: 1
-env:
- - GO111MODULE=on
- - GO111MODULE=off
-go: [ 1.11.x, 1.12.x ]
-os: [ linux, osx ]
-matrix:
- exclude:
- - go: 1.12.x
- env: GO111MODULE=off
- - go: 1.11.x
- os: osx
-install:
- - ./travis/install.sh
- - if [[ "$GO111MODULE" == "on" ]]; then go mod download; fi
- - if [[ "$GO111MODULE" == "off" ]]; then go get github.com/stretchr/testify/assert golang.org/x/sys/unix github.com/konsorten/go-windows-terminal-sequences; fi
-script:
- - ./travis/cross_build.sh
- - export GOMAXPROCS=4
- - export GORACE=halt_on_error=1
- - go test -race -v ./...
- - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then go test -race -v -tags appengine ./... ; fi
diff --git a/vendor/github.com/sirupsen/logrus/CHANGELOG.md b/vendor/github.com/sirupsen/logrus/CHANGELOG.md
deleted file mode 100644
index 51a7ab0..0000000
--- a/vendor/github.com/sirupsen/logrus/CHANGELOG.md
+++ /dev/null
@@ -1,200 +0,0 @@
-# 1.4.2
- * Fixes build break for plan9, nacl, solaris
-# 1.4.1
-This new release introduces:
- * Enhance TextFormatter to not print caller information when they are empty (#944)
- * Remove dependency on golang.org/x/crypto (#932, #943)
-
-Fixes:
- * Fix Entry.WithContext method to return a copy of the initial entry (#941)
-
-# 1.4.0
-This new release introduces:
- * Add `DeferExitHandler`, similar to `RegisterExitHandler` but prepending the handler to the list of handlers (semantically like `defer`) (#848).
- * Add `CallerPrettyfier` to `JSONFormatter` and `TextFormatter (#909, #911)
- * Add `Entry.WithContext()` and `Entry.Context`, to set a context on entries to be used e.g. in hooks (#919).
-
-Fixes:
- * Fix wrong method calls `Logger.Print` and `Logger.Warningln` (#893).
- * Update `Entry.Logf` to not do string formatting unless the log level is enabled (#903)
- * Fix infinite recursion on unknown `Level.String()` (#907)
- * Fix race condition in `getCaller` (#916).
-
-
-# 1.3.0
-This new release introduces:
- * Log, Logf, Logln functions for Logger and Entry that take a Level
-
-Fixes:
- * Building prometheus node_exporter on AIX (#840)
- * Race condition in TextFormatter (#468)
- * Travis CI import path (#868)
- * Remove coloured output on Windows (#862)
- * Pointer to func as field in JSONFormatter (#870)
- * Properly marshal Levels (#873)
-
-# 1.2.0
-This new release introduces:
- * A new method `SetReportCaller` in the `Logger` to enable the file, line and calling function from which the trace has been issued
- * A new trace level named `Trace` whose level is below `Debug`
- * A configurable exit function to be called upon a Fatal trace
- * The `Level` object now implements `encoding.TextUnmarshaler` interface
-
-# 1.1.1
-This is a bug fix release.
- * fix the build break on Solaris
- * don't drop a whole trace in JSONFormatter when a field param is a function pointer which can not be serialized
-
-# 1.1.0
-This new release introduces:
- * several fixes:
- * a fix for a race condition on entry formatting
- * proper cleanup of previously used entries before putting them back in the pool
- * the extra new line at the end of message in text formatter has been removed
- * a new global public API to check if a level is activated: IsLevelEnabled
- * the following methods have been added to the Logger object
- * IsLevelEnabled
- * SetFormatter
- * SetOutput
- * ReplaceHooks
- * introduction of go module
- * an indent configuration for the json formatter
- * output colour support for windows
- * the field sort function is now configurable for text formatter
- * the CLICOLOR and CLICOLOR\_FORCE environment variable support in text formater
-
-# 1.0.6
-
-This new release introduces:
- * a new api WithTime which allows to easily force the time of the log entry
- which is mostly useful for logger wrapper
- * a fix reverting the immutability of the entry given as parameter to the hooks
- a new configuration field of the json formatter in order to put all the fields
- in a nested dictionnary
- * a new SetOutput method in the Logger
- * a new configuration of the textformatter to configure the name of the default keys
- * a new configuration of the text formatter to disable the level truncation
-
-# 1.0.5
-
-* Fix hooks race (#707)
-* Fix panic deadlock (#695)
-
-# 1.0.4
-
-* Fix race when adding hooks (#612)
-* Fix terminal check in AppEngine (#635)
-
-# 1.0.3
-
-* Replace example files with testable examples
-
-# 1.0.2
-
-* bug: quote non-string values in text formatter (#583)
-* Make (*Logger) SetLevel a public method
-
-# 1.0.1
-
-* bug: fix escaping in text formatter (#575)
-
-# 1.0.0
-
-* Officially changed name to lower-case
-* bug: colors on Windows 10 (#541)
-* bug: fix race in accessing level (#512)
-
-# 0.11.5
-
-* feature: add writer and writerlevel to entry (#372)
-
-# 0.11.4
-
-* bug: fix undefined variable on solaris (#493)
-
-# 0.11.3
-
-* formatter: configure quoting of empty values (#484)
-* formatter: configure quoting character (default is `"`) (#484)
-* bug: fix not importing io correctly in non-linux environments (#481)
-
-# 0.11.2
-
-* bug: fix windows terminal detection (#476)
-
-# 0.11.1
-
-* bug: fix tty detection with custom out (#471)
-
-# 0.11.0
-
-* performance: Use bufferpool to allocate (#370)
-* terminal: terminal detection for app-engine (#343)
-* feature: exit handler (#375)
-
-# 0.10.0
-
-* feature: Add a test hook (#180)
-* feature: `ParseLevel` is now case-insensitive (#326)
-* feature: `FieldLogger` interface that generalizes `Logger` and `Entry` (#308)
-* performance: avoid re-allocations on `WithFields` (#335)
-
-# 0.9.0
-
-* logrus/text_formatter: don't emit empty msg
-* logrus/hooks/airbrake: move out of main repository
-* logrus/hooks/sentry: move out of main repository
-* logrus/hooks/papertrail: move out of main repository
-* logrus/hooks/bugsnag: move out of main repository
-* logrus/core: run tests with `-race`
-* logrus/core: detect TTY based on `stderr`
-* logrus/core: support `WithError` on logger
-* logrus/core: Solaris support
-
-# 0.8.7
-
-* logrus/core: fix possible race (#216)
-* logrus/doc: small typo fixes and doc improvements
-
-
-# 0.8.6
-
-* hooks/raven: allow passing an initialized client
-
-# 0.8.5
-
-* logrus/core: revert #208
-
-# 0.8.4
-
-* formatter/text: fix data race (#218)
-
-# 0.8.3
-
-* logrus/core: fix entry log level (#208)
-* logrus/core: improve performance of text formatter by 40%
-* logrus/core: expose `LevelHooks` type
-* logrus/core: add support for DragonflyBSD and NetBSD
-* formatter/text: print structs more verbosely
-
-# 0.8.2
-
-* logrus: fix more Fatal family functions
-
-# 0.8.1
-
-* logrus: fix not exiting on `Fatalf` and `Fatalln`
-
-# 0.8.0
-
-* logrus: defaults to stderr instead of stdout
-* hooks/sentry: add special field for `*http.Request`
-* formatter/text: ignore Windows for colors
-
-# 0.7.3
-
-* formatter/\*: allow configuration of timestamp layout
-
-# 0.7.2
-
-* formatter/text: Add configuration option for time format (#158)
diff --git a/vendor/github.com/sirupsen/logrus/LICENSE b/vendor/github.com/sirupsen/logrus/LICENSE
deleted file mode 100644
index f090cb4..0000000
--- a/vendor/github.com/sirupsen/logrus/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014 Simon Eskildsen
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/vendor/github.com/sirupsen/logrus/README.md b/vendor/github.com/sirupsen/logrus/README.md
deleted file mode 100644
index a4796eb..0000000
--- a/vendor/github.com/sirupsen/logrus/README.md
+++ /dev/null
@@ -1,495 +0,0 @@
-# Logrus [![Build Status](https://travis-ci.org/sirupsen/logrus.svg?branch=master)](https://travis-ci.org/sirupsen/logrus) [![GoDoc](https://godoc.org/github.com/sirupsen/logrus?status.svg)](https://godoc.org/github.com/sirupsen/logrus)
-
-Logrus is a structured logger for Go (golang), completely API compatible with
-the standard library logger.
-
-**Seeing weird case-sensitive problems?** It's in the past been possible to
-import Logrus as both upper- and lower-case. Due to the Go package environment,
-this caused issues in the community and we needed a standard. Some environments
-experienced problems with the upper-case variant, so the lower-case was decided.
-Everything using `logrus` will need to use the lower-case:
-`github.com/sirupsen/logrus`. Any package that isn't, should be changed.
-
-To fix Glide, see [these
-comments](https://github.com/sirupsen/logrus/issues/553#issuecomment-306591437).
-For an in-depth explanation of the casing issue, see [this
-comment](https://github.com/sirupsen/logrus/issues/570#issuecomment-313933276).
-
-**Are you interested in assisting in maintaining Logrus?** Currently I have a
-lot of obligations, and I am unable to provide Logrus with the maintainership it
-needs. If you'd like to help, please reach out to me at `simon at author's
-username dot com`.
-
-Nicely color-coded in development (when a TTY is attached, otherwise just
-plain text):
-
-![Colored](http://i.imgur.com/PY7qMwd.png)
-
-With `log.SetFormatter(&log.JSONFormatter{})`, for easy parsing by logstash
-or Splunk:
-
-```json
-{"animal":"walrus","level":"info","msg":"A group of walrus emerges from the
-ocean","size":10,"time":"2014-03-10 19:57:38.562264131 -0400 EDT"}
-
-{"level":"warning","msg":"The group's number increased tremendously!",
-"number":122,"omg":true,"time":"2014-03-10 19:57:38.562471297 -0400 EDT"}
-
-{"animal":"walrus","level":"info","msg":"A giant walrus appears!",
-"size":10,"time":"2014-03-10 19:57:38.562500591 -0400 EDT"}
-
-{"animal":"walrus","level":"info","msg":"Tremendously sized cow enters the ocean.",
-"size":9,"time":"2014-03-10 19:57:38.562527896 -0400 EDT"}
-
-{"level":"fatal","msg":"The ice breaks!","number":100,"omg":true,
-"time":"2014-03-10 19:57:38.562543128 -0400 EDT"}
-```
-
-With the default `log.SetFormatter(&log.TextFormatter{})` when a TTY is not
-attached, the output is compatible with the
-[logfmt](http://godoc.org/github.com/kr/logfmt) format:
-
-```text
-time="2015-03-26T01:27:38-04:00" level=debug msg="Started observing beach" animal=walrus number=8
-time="2015-03-26T01:27:38-04:00" level=info msg="A group of walrus emerges from the ocean" animal=walrus size=10
-time="2015-03-26T01:27:38-04:00" level=warning msg="The group's number increased tremendously!" number=122 omg=true
-time="2015-03-26T01:27:38-04:00" level=debug msg="Temperature changes" temperature=-4
-time="2015-03-26T01:27:38-04:00" level=panic msg="It's over 9000!" animal=orca size=9009
-time="2015-03-26T01:27:38-04:00" level=fatal msg="The ice breaks!" err=&{0x2082280c0 map[animal:orca size:9009] 2015-03-26 01:27:38.441574009 -0400 EDT panic It's over 9000!} number=100 omg=true
-```
-To ensure this behaviour even if a TTY is attached, set your formatter as follows:
-
-```go
- log.SetFormatter(&log.TextFormatter{
- DisableColors: true,
- FullTimestamp: true,
- })
-```
-
-#### Logging Method Name
-
-If you wish to add the calling method as a field, instruct the logger via:
-```go
-log.SetReportCaller(true)
-```
-This adds the caller as 'method' like so:
-
-```json
-{"animal":"penguin","level":"fatal","method":"github.com/sirupsen/arcticcreatures.migrate","msg":"a penguin swims by",
-"time":"2014-03-10 19:57:38.562543129 -0400 EDT"}
-```
-
-```text
-time="2015-03-26T01:27:38-04:00" level=fatal method=github.com/sirupsen/arcticcreatures.migrate msg="a penguin swims by" animal=penguin
-```
-Note that this does add measurable overhead - the cost will depend on the version of Go, but is
-between 20 and 40% in recent tests with 1.6 and 1.7. You can validate this in your
-environment via benchmarks:
-```
-go test -bench=.*CallerTracing
-```
-
-
-#### Case-sensitivity
-
-The organization's name was changed to lower-case--and this will not be changed
-back. If you are getting import conflicts due to case sensitivity, please use
-the lower-case import: `github.com/sirupsen/logrus`.
-
-#### Example
-
-The simplest way to use Logrus is simply the package-level exported logger:
-
-```go
-package main
-
-import (
- log "github.com/sirupsen/logrus"
-)
-
-func main() {
- log.WithFields(log.Fields{
- "animal": "walrus",
- }).Info("A walrus appears")
-}
-```
-
-Note that it's completely api-compatible with the stdlib logger, so you can
-replace your `log` imports everywhere with `log "github.com/sirupsen/logrus"`
-and you'll now have the flexibility of Logrus. You can customize it all you
-want:
-
-```go
-package main
-
-import (
- "os"
- log "github.com/sirupsen/logrus"
-)
-
-func init() {
- // Log as JSON instead of the default ASCII formatter.
- log.SetFormatter(&log.JSONFormatter{})
-
- // Output to stdout instead of the default stderr
- // Can be any io.Writer, see below for File example
- log.SetOutput(os.Stdout)
-
- // Only log the warning severity or above.
- log.SetLevel(log.WarnLevel)
-}
-
-func main() {
- log.WithFields(log.Fields{
- "animal": "walrus",
- "size": 10,
- }).Info("A group of walrus emerges from the ocean")
-
- log.WithFields(log.Fields{
- "omg": true,
- "number": 122,
- }).Warn("The group's number increased tremendously!")
-
- log.WithFields(log.Fields{
- "omg": true,
- "number": 100,
- }).Fatal("The ice breaks!")
-
- // A common pattern is to re-use fields between logging statements by re-using
- // the logrus.Entry returned from WithFields()
- contextLogger := log.WithFields(log.Fields{
- "common": "this is a common field",
- "other": "I also should be logged always",
- })
-
- contextLogger.Info("I'll be logged with common and other field")
- contextLogger.Info("Me too")
-}
-```
-
-For more advanced usage such as logging to multiple locations from the same
-application, you can also create an instance of the `logrus` Logger:
-
-```go
-package main
-
-import (
- "os"
- "github.com/sirupsen/logrus"
-)
-
-// Create a new instance of the logger. You can have any number of instances.
-var log = logrus.New()
-
-func main() {
- // The API for setting attributes is a little different than the package level
- // exported logger. See Godoc.
- log.Out = os.Stdout
-
- // You could set this to any `io.Writer` such as a file
- // file, err := os.OpenFile("logrus.log", os.O_CREATE|os.O_WRONLY, 0666)
- // if err == nil {
- // log.Out = file
- // } else {
- // log.Info("Failed to log to file, using default stderr")
- // }
-
- log.WithFields(logrus.Fields{
- "animal": "walrus",
- "size": 10,
- }).Info("A group of walrus emerges from the ocean")
-}
-```
-
-#### Fields
-
-Logrus encourages careful, structured logging through logging fields instead of
-long, unparseable error messages. For example, instead of: `log.Fatalf("Failed
-to send event %s to topic %s with key %d")`, you should log the much more
-discoverable:
-
-```go
-log.WithFields(log.Fields{
- "event": event,
- "topic": topic,
- "key": key,
-}).Fatal("Failed to send event")
-```
-
-We've found this API forces you to think about logging in a way that produces
-much more useful logging messages. We've been in countless situations where just
-a single added field to a log statement that was already there would've saved us
-hours. The `WithFields` call is optional.
-
-In general, with Logrus using any of the `printf`-family functions should be
-seen as a hint you should add a field, however, you can still use the
-`printf`-family functions with Logrus.
-
-#### Default Fields
-
-Often it's helpful to have fields _always_ attached to log statements in an
-application or parts of one. For example, you may want to always log the
-`request_id` and `user_ip` in the context of a request. Instead of writing
-`log.WithFields(log.Fields{"request_id": request_id, "user_ip": user_ip})` on
-every line, you can create a `logrus.Entry` to pass around instead:
-
-```go
-requestLogger := log.WithFields(log.Fields{"request_id": request_id, "user_ip": user_ip})
-requestLogger.Info("something happened on that request") # will log request_id and user_ip
-requestLogger.Warn("something not great happened")
-```
-
-#### Hooks
-
-You can add hooks for logging levels. For example to send errors to an exception
-tracking service on `Error`, `Fatal` and `Panic`, info to StatsD or log to
-multiple places simultaneously, e.g. syslog.
-
-Logrus comes with [built-in hooks](hooks/). Add those, or your custom hook, in
-`init`:
-
-```go
-import (
- log "github.com/sirupsen/logrus"
- "gopkg.in/gemnasium/logrus-airbrake-hook.v2" // the package is named "airbrake"
- logrus_syslog "github.com/sirupsen/logrus/hooks/syslog"
- "log/syslog"
-)
-
-func init() {
-
- // Use the Airbrake hook to report errors that have Error severity or above to
- // an exception tracker. You can create custom hooks, see the Hooks section.
- log.AddHook(airbrake.NewHook(123, "xyz", "production"))
-
- hook, err := logrus_syslog.NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "")
- if err != nil {
- log.Error("Unable to connect to local syslog daemon")
- } else {
- log.AddHook(hook)
- }
-}
-```
-Note: Syslog hook also support connecting to local syslog (Ex. "/dev/log" or "/var/run/syslog" or "/var/run/log"). For the detail, please check the [syslog hook README](hooks/syslog/README.md).
-
-A list of currently known of service hook can be found in this wiki [page](https://github.com/sirupsen/logrus/wiki/Hooks)
-
-
-#### Level logging
-
-Logrus has seven logging levels: Trace, Debug, Info, Warning, Error, Fatal and Panic.
-
-```go
-log.Trace("Something very low level.")
-log.Debug("Useful debugging information.")
-log.Info("Something noteworthy happened!")
-log.Warn("You should probably take a look at this.")
-log.Error("Something failed but I'm not quitting.")
-// Calls os.Exit(1) after logging
-log.Fatal("Bye.")
-// Calls panic() after logging
-log.Panic("I'm bailing.")
-```
-
-You can set the logging level on a `Logger`, then it will only log entries with
-that severity or anything above it:
-
-```go
-// Will log anything that is info or above (warn, error, fatal, panic). Default.
-log.SetLevel(log.InfoLevel)
-```
-
-It may be useful to set `log.Level = logrus.DebugLevel` in a debug or verbose
-environment if your application has that.
-
-#### Entries
-
-Besides the fields added with `WithField` or `WithFields` some fields are
-automatically added to all logging events:
-
-1. `time`. The timestamp when the entry was created.
-2. `msg`. The logging message passed to `{Info,Warn,Error,Fatal,Panic}` after
- the `AddFields` call. E.g. `Failed to send event.`
-3. `level`. The logging level. E.g. `info`.
-
-#### Environments
-
-Logrus has no notion of environment.
-
-If you wish for hooks and formatters to only be used in specific environments,
-you should handle that yourself. For example, if your application has a global
-variable `Environment`, which is a string representation of the environment you
-could do:
-
-```go
-import (
- log "github.com/sirupsen/logrus"
-)
-
-init() {
- // do something here to set environment depending on an environment variable
- // or command-line flag
- if Environment == "production" {
- log.SetFormatter(&log.JSONFormatter{})
- } else {
- // The TextFormatter is default, you don't actually have to do this.
- log.SetFormatter(&log.TextFormatter{})
- }
-}
-```
-
-This configuration is how `logrus` was intended to be used, but JSON in
-production is mostly only useful if you do log aggregation with tools like
-Splunk or Logstash.
-
-#### Formatters
-
-The built-in logging formatters are:
-
-* `logrus.TextFormatter`. Logs the event in colors if stdout is a tty, otherwise
- without colors.
- * *Note:* to force colored output when there is no TTY, set the `ForceColors`
- field to `true`. To force no colored output even if there is a TTY set the
- `DisableColors` field to `true`. For Windows, see
- [github.com/mattn/go-colorable](https://github.com/mattn/go-colorable).
- * When colors are enabled, levels are truncated to 4 characters by default. To disable
- truncation set the `DisableLevelTruncation` field to `true`.
- * All options are listed in the [generated docs](https://godoc.org/github.com/sirupsen/logrus#TextFormatter).
-* `logrus.JSONFormatter`. Logs fields as JSON.
- * All options are listed in the [generated docs](https://godoc.org/github.com/sirupsen/logrus#JSONFormatter).
-
-Third party logging formatters:
-
-* [`FluentdFormatter`](https://github.com/joonix/log). Formats entries that can be parsed by Kubernetes and Google Container Engine.
-* [`GELF`](https://github.com/fabienm/go-logrus-formatters). Formats entries so they comply to Graylog's [GELF 1.1 specification](http://docs.graylog.org/en/2.4/pages/gelf.html).
-* [`logstash`](https://github.com/bshuster-repo/logrus-logstash-hook). Logs fields as [Logstash](http://logstash.net) Events.
-* [`prefixed`](https://github.com/x-cray/logrus-prefixed-formatter). Displays log entry source along with alternative layout.
-* [`zalgo`](https://github.com/aybabtme/logzalgo). Invoking the P͉̫o̳̼̊w̖͈̰͎e̬͔̭͂r͚̼̹̲ ̫͓͉̳͈ō̠͕͖̚f̝͍̠ ͕̲̞͖͑Z̖̫̤̫ͪa͉̬͈̗l͖͎g̳̥o̰̥̅!̣͔̲̻͊̄ ̙̘̦̹̦.
-* [`nested-logrus-formatter`](https://github.com/antonfisher/nested-logrus-formatter). Converts logrus fields to a nested structure.
-
-You can define your formatter by implementing the `Formatter` interface,
-requiring a `Format` method. `Format` takes an `*Entry`. `entry.Data` is a
-`Fields` type (`map[string]interface{}`) with all your fields as well as the
-default ones (see Entries section above):
-
-```go
-type MyJSONFormatter struct {
-}
-
-log.SetFormatter(new(MyJSONFormatter))
-
-func (f *MyJSONFormatter) Format(entry *Entry) ([]byte, error) {
- // Note this doesn't include Time, Level and Message which are available on
- // the Entry. Consult `godoc` on information about those fields or read the
- // source of the official loggers.
- serialized, err := json.Marshal(entry.Data)
- if err != nil {
- return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err)
- }
- return append(serialized, '\n'), nil
-}
-```
-
-#### Logger as an `io.Writer`
-
-Logrus can be transformed into an `io.Writer`. That writer is the end of an `io.Pipe` and it is your responsibility to close it.
-
-```go
-w := logger.Writer()
-defer w.Close()
-
-srv := http.Server{
- // create a stdlib log.Logger that writes to
- // logrus.Logger.
- ErrorLog: log.New(w, "", 0),
-}
-```
-
-Each line written to that writer will be printed the usual way, using formatters
-and hooks. The level for those entries is `info`.
-
-This means that we can override the standard library logger easily:
-
-```go
-logger := logrus.New()
-logger.Formatter = &logrus.JSONFormatter{}
-
-// Use logrus for standard log output
-// Note that `log` here references stdlib's log
-// Not logrus imported under the name `log`.
-log.SetOutput(logger.Writer())
-```
-
-#### Rotation
-
-Log rotation is not provided with Logrus. Log rotation should be done by an
-external program (like `logrotate(8)`) that can compress and delete old log
-entries. It should not be a feature of the application-level logger.
-
-#### Tools
-
-| Tool | Description |
-| ---- | ----------- |
-|[Logrus Mate](https://github.com/gogap/logrus_mate)|Logrus mate is a tool for Logrus to manage loggers, you can initial logger's level, hook and formatter by config file, the logger will generated with different config at different environment.|
-|[Logrus Viper Helper](https://github.com/heirko/go-contrib/tree/master/logrusHelper)|An Helper around Logrus to wrap with spf13/Viper to load configuration with fangs! And to simplify Logrus configuration use some behavior of [Logrus Mate](https://github.com/gogap/logrus_mate). [sample](https://github.com/heirko/iris-contrib/blob/master/middleware/logrus-logger/example) |
-
-#### Testing
-
-Logrus has a built in facility for asserting the presence of log messages. This is implemented through the `test` hook and provides:
-
-* decorators for existing logger (`test.NewLocal` and `test.NewGlobal`) which basically just add the `test` hook
-* a test logger (`test.NewNullLogger`) that just records log messages (and does not output any):
-
-```go
-import(
- "github.com/sirupsen/logrus"
- "github.com/sirupsen/logrus/hooks/test"
- "github.com/stretchr/testify/assert"
- "testing"
-)
-
-func TestSomething(t*testing.T){
- logger, hook := test.NewNullLogger()
- logger.Error("Helloerror")
-
- assert.Equal(t, 1, len(hook.Entries))
- assert.Equal(t, logrus.ErrorLevel, hook.LastEntry().Level)
- assert.Equal(t, "Helloerror", hook.LastEntry().Message)
-
- hook.Reset()
- assert.Nil(t, hook.LastEntry())
-}
-```
-
-#### Fatal handlers
-
-Logrus can register one or more functions that will be called when any `fatal`
-level message is logged. The registered handlers will be executed before
-logrus performs a `os.Exit(1)`. This behavior may be helpful if callers need
-to gracefully shutdown. Unlike a `panic("Something went wrong...")` call which can be intercepted with a deferred `recover` a call to `os.Exit(1)` can not be intercepted.
-
-```
-...
-handler := func() {
- // gracefully shutdown something...
-}
-logrus.RegisterExitHandler(handler)
-...
-```
-
-#### Thread safety
-
-By default, Logger is protected by a mutex for concurrent writes. The mutex is held when calling hooks and writing logs.
-If you are sure such locking is not needed, you can call logger.SetNoLock() to disable the locking.
-
-Situation when locking is not needed includes:
-
-* You have no hooks registered, or hooks calling is already thread-safe.
-
-* Writing to logger.Out is already thread-safe, for example:
-
- 1) logger.Out is protected by locks.
-
- 2) logger.Out is a os.File handler opened with `O_APPEND` flag, and every write is smaller than 4k. (This allow multi-thread/multi-process writing)
-
- (Refer to http://www.notthewizard.com/2014/06/17/are-files-appends-really-atomic/)
diff --git a/vendor/github.com/sirupsen/logrus/alt_exit.go b/vendor/github.com/sirupsen/logrus/alt_exit.go
deleted file mode 100644
index 8fd189e..0000000
--- a/vendor/github.com/sirupsen/logrus/alt_exit.go
+++ /dev/null
@@ -1,76 +0,0 @@
-package logrus
-
-// The following code was sourced and modified from the
-// https://github.com/tebeka/atexit package governed by the following license:
-//
-// Copyright (c) 2012 Miki Tebeka .
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy of
-// this software and associated documentation files (the "Software"), to deal in
-// the Software without restriction, including without limitation the rights to
-// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-// the Software, and to permit persons to whom the Software is furnished to do so,
-// subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in all
-// copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-import (
- "fmt"
- "os"
-)
-
-var handlers = []func(){}
-
-func runHandler(handler func()) {
- defer func() {
- if err := recover(); err != nil {
- fmt.Fprintln(os.Stderr, "Error: Logrus exit handler error:", err)
- }
- }()
-
- handler()
-}
-
-func runHandlers() {
- for _, handler := range handlers {
- runHandler(handler)
- }
-}
-
-// Exit runs all the Logrus atexit handlers and then terminates the program using os.Exit(code)
-func Exit(code int) {
- runHandlers()
- os.Exit(code)
-}
-
-// RegisterExitHandler appends a Logrus Exit handler to the list of handlers,
-// call logrus.Exit to invoke all handlers. The handlers will also be invoked when
-// any Fatal log entry is made.
-//
-// This method is useful when a caller wishes to use logrus to log a fatal
-// message but also needs to gracefully shutdown. An example usecase could be
-// closing database connections, or sending a alert that the application is
-// closing.
-func RegisterExitHandler(handler func()) {
- handlers = append(handlers, handler)
-}
-
-// DeferExitHandler prepends a Logrus Exit handler to the list of handlers,
-// call logrus.Exit to invoke all handlers. The handlers will also be invoked when
-// any Fatal log entry is made.
-//
-// This method is useful when a caller wishes to use logrus to log a fatal
-// message but also needs to gracefully shutdown. An example usecase could be
-// closing database connections, or sending a alert that the application is
-// closing.
-func DeferExitHandler(handler func()) {
- handlers = append([]func(){handler}, handlers...)
-}
diff --git a/vendor/github.com/sirupsen/logrus/appveyor.yml b/vendor/github.com/sirupsen/logrus/appveyor.yml
deleted file mode 100644
index 96c2ce1..0000000
--- a/vendor/github.com/sirupsen/logrus/appveyor.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-version: "{build}"
-platform: x64
-clone_folder: c:\gopath\src\github.com\sirupsen\logrus
-environment:
- GOPATH: c:\gopath
-branches:
- only:
- - master
-install:
- - set PATH=%GOPATH%\bin;c:\go\bin;%PATH%
- - go version
-build_script:
- - go get -t
- - go test
diff --git a/vendor/github.com/sirupsen/logrus/doc.go b/vendor/github.com/sirupsen/logrus/doc.go
deleted file mode 100644
index da67aba..0000000
--- a/vendor/github.com/sirupsen/logrus/doc.go
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-Package logrus is a structured logger for Go, completely API compatible with the standard library logger.
-
-
-The simplest way to use Logrus is simply the package-level exported logger:
-
- package main
-
- import (
- log "github.com/sirupsen/logrus"
- )
-
- func main() {
- log.WithFields(log.Fields{
- "animal": "walrus",
- "number": 1,
- "size": 10,
- }).Info("A walrus appears")
- }
-
-Output:
- time="2015-09-07T08:48:33Z" level=info msg="A walrus appears" animal=walrus number=1 size=10
-
-For a full guide visit https://github.com/sirupsen/logrus
-*/
-package logrus
diff --git a/vendor/github.com/sirupsen/logrus/entry.go b/vendor/github.com/sirupsen/logrus/entry.go
deleted file mode 100644
index 63e2558..0000000
--- a/vendor/github.com/sirupsen/logrus/entry.go
+++ /dev/null
@@ -1,407 +0,0 @@
-package logrus
-
-import (
- "bytes"
- "context"
- "fmt"
- "os"
- "reflect"
- "runtime"
- "strings"
- "sync"
- "time"
-)
-
-var (
- bufferPool *sync.Pool
-
- // qualified package name, cached at first use
- logrusPackage string
-
- // Positions in the call stack when tracing to report the calling method
- minimumCallerDepth int
-
- // Used for caller information initialisation
- callerInitOnce sync.Once
-)
-
-const (
- maximumCallerDepth int = 25
- knownLogrusFrames int = 4
-)
-
-func init() {
- bufferPool = &sync.Pool{
- New: func() interface{} {
- return new(bytes.Buffer)
- },
- }
-
- // start at the bottom of the stack before the package-name cache is primed
- minimumCallerDepth = 1
-}
-
-// Defines the key when adding errors using WithError.
-var ErrorKey = "error"
-
-// An entry is the final or intermediate Logrus logging entry. It contains all
-// the fields passed with WithField{,s}. It's finally logged when Trace, Debug,
-// Info, Warn, Error, Fatal or Panic is called on it. These objects can be
-// reused and passed around as much as you wish to avoid field duplication.
-type Entry struct {
- Logger *Logger
-
- // Contains all the fields set by the user.
- Data Fields
-
- // Time at which the log entry was created
- Time time.Time
-
- // Level the log entry was logged at: Trace, Debug, Info, Warn, Error, Fatal or Panic
- // This field will be set on entry firing and the value will be equal to the one in Logger struct field.
- Level Level
-
- // Calling method, with package name
- Caller *runtime.Frame
-
- // Message passed to Trace, Debug, Info, Warn, Error, Fatal or Panic
- Message string
-
- // When formatter is called in entry.log(), a Buffer may be set to entry
- Buffer *bytes.Buffer
-
- // Contains the context set by the user. Useful for hook processing etc.
- Context context.Context
-
- // err may contain a field formatting error
- err string
-}
-
-func NewEntry(logger *Logger) *Entry {
- return &Entry{
- Logger: logger,
- // Default is three fields, plus one optional. Give a little extra room.
- Data: make(Fields, 6),
- }
-}
-
-// Returns the string representation from the reader and ultimately the
-// formatter.
-func (entry *Entry) String() (string, error) {
- serialized, err := entry.Logger.Formatter.Format(entry)
- if err != nil {
- return "", err
- }
- str := string(serialized)
- return str, nil
-}
-
-// Add an error as single field (using the key defined in ErrorKey) to the Entry.
-func (entry *Entry) WithError(err error) *Entry {
- return entry.WithField(ErrorKey, err)
-}
-
-// Add a context to the Entry.
-func (entry *Entry) WithContext(ctx context.Context) *Entry {
- return &Entry{Logger: entry.Logger, Data: entry.Data, Time: entry.Time, err: entry.err, Context: ctx}
-}
-
-// Add a single field to the Entry.
-func (entry *Entry) WithField(key string, value interface{}) *Entry {
- return entry.WithFields(Fields{key: value})
-}
-
-// Add a map of fields to the Entry.
-func (entry *Entry) WithFields(fields Fields) *Entry {
- data := make(Fields, len(entry.Data)+len(fields))
- for k, v := range entry.Data {
- data[k] = v
- }
- fieldErr := entry.err
- for k, v := range fields {
- isErrField := false
- if t := reflect.TypeOf(v); t != nil {
- switch t.Kind() {
- case reflect.Func:
- isErrField = true
- case reflect.Ptr:
- isErrField = t.Elem().Kind() == reflect.Func
- }
- }
- if isErrField {
- tmp := fmt.Sprintf("can not add field %q", k)
- if fieldErr != "" {
- fieldErr = entry.err + ", " + tmp
- } else {
- fieldErr = tmp
- }
- } else {
- data[k] = v
- }
- }
- return &Entry{Logger: entry.Logger, Data: data, Time: entry.Time, err: fieldErr, Context: entry.Context}
-}
-
-// Overrides the time of the Entry.
-func (entry *Entry) WithTime(t time.Time) *Entry {
- return &Entry{Logger: entry.Logger, Data: entry.Data, Time: t, err: entry.err, Context: entry.Context}
-}
-
-// getPackageName reduces a fully qualified function name to the package name
-// There really ought to be to be a better way...
-func getPackageName(f string) string {
- for {
- lastPeriod := strings.LastIndex(f, ".")
- lastSlash := strings.LastIndex(f, "/")
- if lastPeriod > lastSlash {
- f = f[:lastPeriod]
- } else {
- break
- }
- }
-
- return f
-}
-
-// getCaller retrieves the name of the first non-logrus calling function
-func getCaller() *runtime.Frame {
-
- // cache this package's fully-qualified name
- callerInitOnce.Do(func() {
- pcs := make([]uintptr, 2)
- _ = runtime.Callers(0, pcs)
- logrusPackage = getPackageName(runtime.FuncForPC(pcs[1]).Name())
-
- // now that we have the cache, we can skip a minimum count of known-logrus functions
- // XXX this is dubious, the number of frames may vary
- minimumCallerDepth = knownLogrusFrames
- })
-
- // Restrict the lookback frames to avoid runaway lookups
- pcs := make([]uintptr, maximumCallerDepth)
- depth := runtime.Callers(minimumCallerDepth, pcs)
- frames := runtime.CallersFrames(pcs[:depth])
-
- for f, again := frames.Next(); again; f, again = frames.Next() {
- pkg := getPackageName(f.Function)
-
- // If the caller isn't part of this package, we're done
- if pkg != logrusPackage {
- return &f
- }
- }
-
- // if we got here, we failed to find the caller's context
- return nil
-}
-
-func (entry Entry) HasCaller() (has bool) {
- return entry.Logger != nil &&
- entry.Logger.ReportCaller &&
- entry.Caller != nil
-}
-
-// This function is not declared with a pointer value because otherwise
-// race conditions will occur when using multiple goroutines
-func (entry Entry) log(level Level, msg string) {
- var buffer *bytes.Buffer
-
- // Default to now, but allow users to override if they want.
- //
- // We don't have to worry about polluting future calls to Entry#log()
- // with this assignment because this function is declared with a
- // non-pointer receiver.
- if entry.Time.IsZero() {
- entry.Time = time.Now()
- }
-
- entry.Level = level
- entry.Message = msg
- if entry.Logger.ReportCaller {
- entry.Caller = getCaller()
- }
-
- entry.fireHooks()
-
- buffer = bufferPool.Get().(*bytes.Buffer)
- buffer.Reset()
- defer bufferPool.Put(buffer)
- entry.Buffer = buffer
-
- entry.write()
-
- entry.Buffer = nil
-
- // To avoid Entry#log() returning a value that only would make sense for
- // panic() to use in Entry#Panic(), we avoid the allocation by checking
- // directly here.
- if level <= PanicLevel {
- panic(&entry)
- }
-}
-
-func (entry *Entry) fireHooks() {
- entry.Logger.mu.Lock()
- defer entry.Logger.mu.Unlock()
- err := entry.Logger.Hooks.Fire(entry.Level, entry)
- if err != nil {
- fmt.Fprintf(os.Stderr, "Failed to fire hook: %v\n", err)
- }
-}
-
-func (entry *Entry) write() {
- entry.Logger.mu.Lock()
- defer entry.Logger.mu.Unlock()
- serialized, err := entry.Logger.Formatter.Format(entry)
- if err != nil {
- fmt.Fprintf(os.Stderr, "Failed to obtain reader, %v\n", err)
- } else {
- _, err = entry.Logger.Out.Write(serialized)
- if err != nil {
- fmt.Fprintf(os.Stderr, "Failed to write to log, %v\n", err)
- }
- }
-}
-
-func (entry *Entry) Log(level Level, args ...interface{}) {
- if entry.Logger.IsLevelEnabled(level) {
- entry.log(level, fmt.Sprint(args...))
- }
-}
-
-func (entry *Entry) Trace(args ...interface{}) {
- entry.Log(TraceLevel, args...)
-}
-
-func (entry *Entry) Debug(args ...interface{}) {
- entry.Log(DebugLevel, args...)
-}
-
-func (entry *Entry) Print(args ...interface{}) {
- entry.Info(args...)
-}
-
-func (entry *Entry) Info(args ...interface{}) {
- entry.Log(InfoLevel, args...)
-}
-
-func (entry *Entry) Warn(args ...interface{}) {
- entry.Log(WarnLevel, args...)
-}
-
-func (entry *Entry) Warning(args ...interface{}) {
- entry.Warn(args...)
-}
-
-func (entry *Entry) Error(args ...interface{}) {
- entry.Log(ErrorLevel, args...)
-}
-
-func (entry *Entry) Fatal(args ...interface{}) {
- entry.Log(FatalLevel, args...)
- entry.Logger.Exit(1)
-}
-
-func (entry *Entry) Panic(args ...interface{}) {
- entry.Log(PanicLevel, args...)
- panic(fmt.Sprint(args...))
-}
-
-// Entry Printf family functions
-
-func (entry *Entry) Logf(level Level, format string, args ...interface{}) {
- if entry.Logger.IsLevelEnabled(level) {
- entry.Log(level, fmt.Sprintf(format, args...))
- }
-}
-
-func (entry *Entry) Tracef(format string, args ...interface{}) {
- entry.Logf(TraceLevel, format, args...)
-}
-
-func (entry *Entry) Debugf(format string, args ...interface{}) {
- entry.Logf(DebugLevel, format, args...)
-}
-
-func (entry *Entry) Infof(format string, args ...interface{}) {
- entry.Logf(InfoLevel, format, args...)
-}
-
-func (entry *Entry) Printf(format string, args ...interface{}) {
- entry.Infof(format, args...)
-}
-
-func (entry *Entry) Warnf(format string, args ...interface{}) {
- entry.Logf(WarnLevel, format, args...)
-}
-
-func (entry *Entry) Warningf(format string, args ...interface{}) {
- entry.Warnf(format, args...)
-}
-
-func (entry *Entry) Errorf(format string, args ...interface{}) {
- entry.Logf(ErrorLevel, format, args...)
-}
-
-func (entry *Entry) Fatalf(format string, args ...interface{}) {
- entry.Logf(FatalLevel, format, args...)
- entry.Logger.Exit(1)
-}
-
-func (entry *Entry) Panicf(format string, args ...interface{}) {
- entry.Logf(PanicLevel, format, args...)
-}
-
-// Entry Println family functions
-
-func (entry *Entry) Logln(level Level, args ...interface{}) {
- if entry.Logger.IsLevelEnabled(level) {
- entry.Log(level, entry.sprintlnn(args...))
- }
-}
-
-func (entry *Entry) Traceln(args ...interface{}) {
- entry.Logln(TraceLevel, args...)
-}
-
-func (entry *Entry) Debugln(args ...interface{}) {
- entry.Logln(DebugLevel, args...)
-}
-
-func (entry *Entry) Infoln(args ...interface{}) {
- entry.Logln(InfoLevel, args...)
-}
-
-func (entry *Entry) Println(args ...interface{}) {
- entry.Infoln(args...)
-}
-
-func (entry *Entry) Warnln(args ...interface{}) {
- entry.Logln(WarnLevel, args...)
-}
-
-func (entry *Entry) Warningln(args ...interface{}) {
- entry.Warnln(args...)
-}
-
-func (entry *Entry) Errorln(args ...interface{}) {
- entry.Logln(ErrorLevel, args...)
-}
-
-func (entry *Entry) Fatalln(args ...interface{}) {
- entry.Logln(FatalLevel, args...)
- entry.Logger.Exit(1)
-}
-
-func (entry *Entry) Panicln(args ...interface{}) {
- entry.Logln(PanicLevel, args...)
-}
-
-// Sprintlnn => Sprint no newline. This is to get the behavior of how
-// fmt.Sprintln where spaces are always added between operands, regardless of
-// their type. Instead of vendoring the Sprintln implementation to spare a
-// string allocation, we do the simplest thing.
-func (entry *Entry) sprintlnn(args ...interface{}) string {
- msg := fmt.Sprintln(args...)
- return msg[:len(msg)-1]
-}
diff --git a/vendor/github.com/sirupsen/logrus/exported.go b/vendor/github.com/sirupsen/logrus/exported.go
deleted file mode 100644
index 62fc2f2..0000000
--- a/vendor/github.com/sirupsen/logrus/exported.go
+++ /dev/null
@@ -1,225 +0,0 @@
-package logrus
-
-import (
- "context"
- "io"
- "time"
-)
-
-var (
- // std is the name of the standard logger in stdlib `log`
- std = New()
-)
-
-func StandardLogger() *Logger {
- return std
-}
-
-// SetOutput sets the standard logger output.
-func SetOutput(out io.Writer) {
- std.SetOutput(out)
-}
-
-// SetFormatter sets the standard logger formatter.
-func SetFormatter(formatter Formatter) {
- std.SetFormatter(formatter)
-}
-
-// SetReportCaller sets whether the standard logger will include the calling
-// method as a field.
-func SetReportCaller(include bool) {
- std.SetReportCaller(include)
-}
-
-// SetLevel sets the standard logger level.
-func SetLevel(level Level) {
- std.SetLevel(level)
-}
-
-// GetLevel returns the standard logger level.
-func GetLevel() Level {
- return std.GetLevel()
-}
-
-// IsLevelEnabled checks if the log level of the standard logger is greater than the level param
-func IsLevelEnabled(level Level) bool {
- return std.IsLevelEnabled(level)
-}
-
-// AddHook adds a hook to the standard logger hooks.
-func AddHook(hook Hook) {
- std.AddHook(hook)
-}
-
-// WithError creates an entry from the standard logger and adds an error to it, using the value defined in ErrorKey as key.
-func WithError(err error) *Entry {
- return std.WithField(ErrorKey, err)
-}
-
-// WithContext creates an entry from the standard logger and adds a context to it.
-func WithContext(ctx context.Context) *Entry {
- return std.WithContext(ctx)
-}
-
-// WithField creates an entry from the standard logger and adds a field to
-// it. If you want multiple fields, use `WithFields`.
-//
-// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
-// or Panic on the Entry it returns.
-func WithField(key string, value interface{}) *Entry {
- return std.WithField(key, value)
-}
-
-// WithFields creates an entry from the standard logger and adds multiple
-// fields to it. This is simply a helper for `WithField`, invoking it
-// once for each field.
-//
-// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
-// or Panic on the Entry it returns.
-func WithFields(fields Fields) *Entry {
- return std.WithFields(fields)
-}
-
-// WithTime creats an entry from the standard logger and overrides the time of
-// logs generated with it.
-//
-// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
-// or Panic on the Entry it returns.
-func WithTime(t time.Time) *Entry {
- return std.WithTime(t)
-}
-
-// Trace logs a message at level Trace on the standard logger.
-func Trace(args ...interface{}) {
- std.Trace(args...)
-}
-
-// Debug logs a message at level Debug on the standard logger.
-func Debug(args ...interface{}) {
- std.Debug(args...)
-}
-
-// Print logs a message at level Info on the standard logger.
-func Print(args ...interface{}) {
- std.Print(args...)
-}
-
-// Info logs a message at level Info on the standard logger.
-func Info(args ...interface{}) {
- std.Info(args...)
-}
-
-// Warn logs a message at level Warn on the standard logger.
-func Warn(args ...interface{}) {
- std.Warn(args...)
-}
-
-// Warning logs a message at level Warn on the standard logger.
-func Warning(args ...interface{}) {
- std.Warning(args...)
-}
-
-// Error logs a message at level Error on the standard logger.
-func Error(args ...interface{}) {
- std.Error(args...)
-}
-
-// Panic logs a message at level Panic on the standard logger.
-func Panic(args ...interface{}) {
- std.Panic(args...)
-}
-
-// Fatal logs a message at level Fatal on the standard logger then the process will exit with status set to 1.
-func Fatal(args ...interface{}) {
- std.Fatal(args...)
-}
-
-// Tracef logs a message at level Trace on the standard logger.
-func Tracef(format string, args ...interface{}) {
- std.Tracef(format, args...)
-}
-
-// Debugf logs a message at level Debug on the standard logger.
-func Debugf(format string, args ...interface{}) {
- std.Debugf(format, args...)
-}
-
-// Printf logs a message at level Info on the standard logger.
-func Printf(format string, args ...interface{}) {
- std.Printf(format, args...)
-}
-
-// Infof logs a message at level Info on the standard logger.
-func Infof(format string, args ...interface{}) {
- std.Infof(format, args...)
-}
-
-// Warnf logs a message at level Warn on the standard logger.
-func Warnf(format string, args ...interface{}) {
- std.Warnf(format, args...)
-}
-
-// Warningf logs a message at level Warn on the standard logger.
-func Warningf(format string, args ...interface{}) {
- std.Warningf(format, args...)
-}
-
-// Errorf logs a message at level Error on the standard logger.
-func Errorf(format string, args ...interface{}) {
- std.Errorf(format, args...)
-}
-
-// Panicf logs a message at level Panic on the standard logger.
-func Panicf(format string, args ...interface{}) {
- std.Panicf(format, args...)
-}
-
-// Fatalf logs a message at level Fatal on the standard logger then the process will exit with status set to 1.
-func Fatalf(format string, args ...interface{}) {
- std.Fatalf(format, args...)
-}
-
-// Traceln logs a message at level Trace on the standard logger.
-func Traceln(args ...interface{}) {
- std.Traceln(args...)
-}
-
-// Debugln logs a message at level Debug on the standard logger.
-func Debugln(args ...interface{}) {
- std.Debugln(args...)
-}
-
-// Println logs a message at level Info on the standard logger.
-func Println(args ...interface{}) {
- std.Println(args...)
-}
-
-// Infoln logs a message at level Info on the standard logger.
-func Infoln(args ...interface{}) {
- std.Infoln(args...)
-}
-
-// Warnln logs a message at level Warn on the standard logger.
-func Warnln(args ...interface{}) {
- std.Warnln(args...)
-}
-
-// Warningln logs a message at level Warn on the standard logger.
-func Warningln(args ...interface{}) {
- std.Warningln(args...)
-}
-
-// Errorln logs a message at level Error on the standard logger.
-func Errorln(args ...interface{}) {
- std.Errorln(args...)
-}
-
-// Panicln logs a message at level Panic on the standard logger.
-func Panicln(args ...interface{}) {
- std.Panicln(args...)
-}
-
-// Fatalln logs a message at level Fatal on the standard logger then the process will exit with status set to 1.
-func Fatalln(args ...interface{}) {
- std.Fatalln(args...)
-}
diff --git a/vendor/github.com/sirupsen/logrus/formatter.go b/vendor/github.com/sirupsen/logrus/formatter.go
deleted file mode 100644
index 4088837..0000000
--- a/vendor/github.com/sirupsen/logrus/formatter.go
+++ /dev/null
@@ -1,78 +0,0 @@
-package logrus
-
-import "time"
-
-// Default key names for the default fields
-const (
- defaultTimestampFormat = time.RFC3339
- FieldKeyMsg = "msg"
- FieldKeyLevel = "level"
- FieldKeyTime = "time"
- FieldKeyLogrusError = "logrus_error"
- FieldKeyFunc = "func"
- FieldKeyFile = "file"
-)
-
-// The Formatter interface is used to implement a custom Formatter. It takes an
-// `Entry`. It exposes all the fields, including the default ones:
-//
-// * `entry.Data["msg"]`. The message passed from Info, Warn, Error ..
-// * `entry.Data["time"]`. The timestamp.
-// * `entry.Data["level"]. The level the entry was logged at.
-//
-// Any additional fields added with `WithField` or `WithFields` are also in
-// `entry.Data`. Format is expected to return an array of bytes which are then
-// logged to `logger.Out`.
-type Formatter interface {
- Format(*Entry) ([]byte, error)
-}
-
-// This is to not silently overwrite `time`, `msg`, `func` and `level` fields when
-// dumping it. If this code wasn't there doing:
-//
-// logrus.WithField("level", 1).Info("hello")
-//
-// Would just silently drop the user provided level. Instead with this code
-// it'll logged as:
-//
-// {"level": "info", "fields.level": 1, "msg": "hello", "time": "..."}
-//
-// It's not exported because it's still using Data in an opinionated way. It's to
-// avoid code duplication between the two default formatters.
-func prefixFieldClashes(data Fields, fieldMap FieldMap, reportCaller bool) {
- timeKey := fieldMap.resolve(FieldKeyTime)
- if t, ok := data[timeKey]; ok {
- data["fields."+timeKey] = t
- delete(data, timeKey)
- }
-
- msgKey := fieldMap.resolve(FieldKeyMsg)
- if m, ok := data[msgKey]; ok {
- data["fields."+msgKey] = m
- delete(data, msgKey)
- }
-
- levelKey := fieldMap.resolve(FieldKeyLevel)
- if l, ok := data[levelKey]; ok {
- data["fields."+levelKey] = l
- delete(data, levelKey)
- }
-
- logrusErrKey := fieldMap.resolve(FieldKeyLogrusError)
- if l, ok := data[logrusErrKey]; ok {
- data["fields."+logrusErrKey] = l
- delete(data, logrusErrKey)
- }
-
- // If reportCaller is not set, 'func' will not conflict.
- if reportCaller {
- funcKey := fieldMap.resolve(FieldKeyFunc)
- if l, ok := data[funcKey]; ok {
- data["fields."+funcKey] = l
- }
- fileKey := fieldMap.resolve(FieldKeyFile)
- if l, ok := data[fileKey]; ok {
- data["fields."+fileKey] = l
- }
- }
-}
diff --git a/vendor/github.com/sirupsen/logrus/go.mod b/vendor/github.com/sirupsen/logrus/go.mod
deleted file mode 100644
index 12fdf98..0000000
--- a/vendor/github.com/sirupsen/logrus/go.mod
+++ /dev/null
@@ -1,10 +0,0 @@
-module github.com/sirupsen/logrus
-
-require (
- github.com/davecgh/go-spew v1.1.1 // indirect
- github.com/konsorten/go-windows-terminal-sequences v1.0.1
- github.com/pmezard/go-difflib v1.0.0 // indirect
- github.com/stretchr/objx v0.1.1 // indirect
- github.com/stretchr/testify v1.2.2
- golang.org/x/sys v0.0.0-20190422165155-953cdadca894
-)
diff --git a/vendor/github.com/sirupsen/logrus/go.sum b/vendor/github.com/sirupsen/logrus/go.sum
deleted file mode 100644
index 596c318..0000000
--- a/vendor/github.com/sirupsen/logrus/go.sum
+++ /dev/null
@@ -1,16 +0,0 @@
-github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
-github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe h1:CHRGQ8V7OlCYtwaKPJi3iA7J+YdNKdo8j7nG5IgDhjs=
-github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
-github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
-github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
-github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
-github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
-github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
-github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
-github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
-github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
-golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8=
-golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
-golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
diff --git a/vendor/github.com/sirupsen/logrus/hooks.go b/vendor/github.com/sirupsen/logrus/hooks.go
deleted file mode 100644
index 3f151cd..0000000
--- a/vendor/github.com/sirupsen/logrus/hooks.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package logrus
-
-// A hook to be fired when logging on the logging levels returned from
-// `Levels()` on your implementation of the interface. Note that this is not
-// fired in a goroutine or a channel with workers, you should handle such
-// functionality yourself if your call is non-blocking and you don't wish for
-// the logging calls for levels returned from `Levels()` to block.
-type Hook interface {
- Levels() []Level
- Fire(*Entry) error
-}
-
-// Internal type for storing the hooks on a logger instance.
-type LevelHooks map[Level][]Hook
-
-// Add a hook to an instance of logger. This is called with
-// `log.Hooks.Add(new(MyHook))` where `MyHook` implements the `Hook` interface.
-func (hooks LevelHooks) Add(hook Hook) {
- for _, level := range hook.Levels() {
- hooks[level] = append(hooks[level], hook)
- }
-}
-
-// Fire all the hooks for the passed level. Used by `entry.log` to fire
-// appropriate hooks for a log entry.
-func (hooks LevelHooks) Fire(level Level, entry *Entry) error {
- for _, hook := range hooks[level] {
- if err := hook.Fire(entry); err != nil {
- return err
- }
- }
-
- return nil
-}
diff --git a/vendor/github.com/sirupsen/logrus/json_formatter.go b/vendor/github.com/sirupsen/logrus/json_formatter.go
deleted file mode 100644
index 098a21a..0000000
--- a/vendor/github.com/sirupsen/logrus/json_formatter.go
+++ /dev/null
@@ -1,121 +0,0 @@
-package logrus
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "runtime"
-)
-
-type fieldKey string
-
-// FieldMap allows customization of the key names for default fields.
-type FieldMap map[fieldKey]string
-
-func (f FieldMap) resolve(key fieldKey) string {
- if k, ok := f[key]; ok {
- return k
- }
-
- return string(key)
-}
-
-// JSONFormatter formats logs into parsable json
-type JSONFormatter struct {
- // TimestampFormat sets the format used for marshaling timestamps.
- TimestampFormat string
-
- // DisableTimestamp allows disabling automatic timestamps in output
- DisableTimestamp bool
-
- // DataKey allows users to put all the log entry parameters into a nested dictionary at a given key.
- DataKey string
-
- // FieldMap allows users to customize the names of keys for default fields.
- // As an example:
- // formatter := &JSONFormatter{
- // FieldMap: FieldMap{
- // FieldKeyTime: "@timestamp",
- // FieldKeyLevel: "@level",
- // FieldKeyMsg: "@message",
- // FieldKeyFunc: "@caller",
- // },
- // }
- FieldMap FieldMap
-
- // CallerPrettyfier can be set by the user to modify the content
- // of the function and file keys in the json data when ReportCaller is
- // activated. If any of the returned value is the empty string the
- // corresponding key will be removed from json fields.
- CallerPrettyfier func(*runtime.Frame) (function string, file string)
-
- // PrettyPrint will indent all json logs
- PrettyPrint bool
-}
-
-// Format renders a single log entry
-func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) {
- data := make(Fields, len(entry.Data)+4)
- for k, v := range entry.Data {
- switch v := v.(type) {
- case error:
- // Otherwise errors are ignored by `encoding/json`
- // https://github.com/sirupsen/logrus/issues/137
- data[k] = v.Error()
- default:
- data[k] = v
- }
- }
-
- if f.DataKey != "" {
- newData := make(Fields, 4)
- newData[f.DataKey] = data
- data = newData
- }
-
- prefixFieldClashes(data, f.FieldMap, entry.HasCaller())
-
- timestampFormat := f.TimestampFormat
- if timestampFormat == "" {
- timestampFormat = defaultTimestampFormat
- }
-
- if entry.err != "" {
- data[f.FieldMap.resolve(FieldKeyLogrusError)] = entry.err
- }
- if !f.DisableTimestamp {
- data[f.FieldMap.resolve(FieldKeyTime)] = entry.Time.Format(timestampFormat)
- }
- data[f.FieldMap.resolve(FieldKeyMsg)] = entry.Message
- data[f.FieldMap.resolve(FieldKeyLevel)] = entry.Level.String()
- if entry.HasCaller() {
- funcVal := entry.Caller.Function
- fileVal := fmt.Sprintf("%s:%d", entry.Caller.File, entry.Caller.Line)
- if f.CallerPrettyfier != nil {
- funcVal, fileVal = f.CallerPrettyfier(entry.Caller)
- }
- if funcVal != "" {
- data[f.FieldMap.resolve(FieldKeyFunc)] = funcVal
- }
- if fileVal != "" {
- data[f.FieldMap.resolve(FieldKeyFile)] = fileVal
- }
- }
-
- var b *bytes.Buffer
- if entry.Buffer != nil {
- b = entry.Buffer
- } else {
- b = &bytes.Buffer{}
- }
-
- encoder := json.NewEncoder(b)
- if f.PrettyPrint {
- encoder.SetIndent("", " ")
- }
- if err := encoder.Encode(data); err != nil {
- return nil, fmt.Errorf("failed to marshal fields to JSON, %v", err)
- }
-
- return b.Bytes(), nil
-}
diff --git a/vendor/github.com/sirupsen/logrus/logger.go b/vendor/github.com/sirupsen/logrus/logger.go
deleted file mode 100644
index c0c0b1e..0000000
--- a/vendor/github.com/sirupsen/logrus/logger.go
+++ /dev/null
@@ -1,351 +0,0 @@
-package logrus
-
-import (
- "context"
- "io"
- "os"
- "sync"
- "sync/atomic"
- "time"
-)
-
-type Logger struct {
- // The logs are `io.Copy`'d to this in a mutex. It's common to set this to a
- // file, or leave it default which is `os.Stderr`. You can also set this to
- // something more adventurous, such as logging to Kafka.
- Out io.Writer
- // Hooks for the logger instance. These allow firing events based on logging
- // levels and log entries. For example, to send errors to an error tracking
- // service, log to StatsD or dump the core on fatal errors.
- Hooks LevelHooks
- // All log entries pass through the formatter before logged to Out. The
- // included formatters are `TextFormatter` and `JSONFormatter` for which
- // TextFormatter is the default. In development (when a TTY is attached) it
- // logs with colors, but to a file it wouldn't. You can easily implement your
- // own that implements the `Formatter` interface, see the `README` or included
- // formatters for examples.
- Formatter Formatter
-
- // Flag for whether to log caller info (off by default)
- ReportCaller bool
-
- // The logging level the logger should log at. This is typically (and defaults
- // to) `logrus.Info`, which allows Info(), Warn(), Error() and Fatal() to be
- // logged.
- Level Level
- // Used to sync writing to the log. Locking is enabled by Default
- mu MutexWrap
- // Reusable empty entry
- entryPool sync.Pool
- // Function to exit the application, defaults to `os.Exit()`
- ExitFunc exitFunc
-}
-
-type exitFunc func(int)
-
-type MutexWrap struct {
- lock sync.Mutex
- disabled bool
-}
-
-func (mw *MutexWrap) Lock() {
- if !mw.disabled {
- mw.lock.Lock()
- }
-}
-
-func (mw *MutexWrap) Unlock() {
- if !mw.disabled {
- mw.lock.Unlock()
- }
-}
-
-func (mw *MutexWrap) Disable() {
- mw.disabled = true
-}
-
-// Creates a new logger. Configuration should be set by changing `Formatter`,
-// `Out` and `Hooks` directly on the default logger instance. You can also just
-// instantiate your own:
-//
-// var log = &Logger{
-// Out: os.Stderr,
-// Formatter: new(JSONFormatter),
-// Hooks: make(LevelHooks),
-// Level: logrus.DebugLevel,
-// }
-//
-// It's recommended to make this a global instance called `log`.
-func New() *Logger {
- return &Logger{
- Out: os.Stderr,
- Formatter: new(TextFormatter),
- Hooks: make(LevelHooks),
- Level: InfoLevel,
- ExitFunc: os.Exit,
- ReportCaller: false,
- }
-}
-
-func (logger *Logger) newEntry() *Entry {
- entry, ok := logger.entryPool.Get().(*Entry)
- if ok {
- return entry
- }
- return NewEntry(logger)
-}
-
-func (logger *Logger) releaseEntry(entry *Entry) {
- entry.Data = map[string]interface{}{}
- logger.entryPool.Put(entry)
-}
-
-// Adds a field to the log entry, note that it doesn't log until you call
-// Debug, Print, Info, Warn, Error, Fatal or Panic. It only creates a log entry.
-// If you want multiple fields, use `WithFields`.
-func (logger *Logger) WithField(key string, value interface{}) *Entry {
- entry := logger.newEntry()
- defer logger.releaseEntry(entry)
- return entry.WithField(key, value)
-}
-
-// Adds a struct of fields to the log entry. All it does is call `WithField` for
-// each `Field`.
-func (logger *Logger) WithFields(fields Fields) *Entry {
- entry := logger.newEntry()
- defer logger.releaseEntry(entry)
- return entry.WithFields(fields)
-}
-
-// Add an error as single field to the log entry. All it does is call
-// `WithError` for the given `error`.
-func (logger *Logger) WithError(err error) *Entry {
- entry := logger.newEntry()
- defer logger.releaseEntry(entry)
- return entry.WithError(err)
-}
-
-// Add a context to the log entry.
-func (logger *Logger) WithContext(ctx context.Context) *Entry {
- entry := logger.newEntry()
- defer logger.releaseEntry(entry)
- return entry.WithContext(ctx)
-}
-
-// Overrides the time of the log entry.
-func (logger *Logger) WithTime(t time.Time) *Entry {
- entry := logger.newEntry()
- defer logger.releaseEntry(entry)
- return entry.WithTime(t)
-}
-
-func (logger *Logger) Logf(level Level, format string, args ...interface{}) {
- if logger.IsLevelEnabled(level) {
- entry := logger.newEntry()
- entry.Logf(level, format, args...)
- logger.releaseEntry(entry)
- }
-}
-
-func (logger *Logger) Tracef(format string, args ...interface{}) {
- logger.Logf(TraceLevel, format, args...)
-}
-
-func (logger *Logger) Debugf(format string, args ...interface{}) {
- logger.Logf(DebugLevel, format, args...)
-}
-
-func (logger *Logger) Infof(format string, args ...interface{}) {
- logger.Logf(InfoLevel, format, args...)
-}
-
-func (logger *Logger) Printf(format string, args ...interface{}) {
- entry := logger.newEntry()
- entry.Printf(format, args...)
- logger.releaseEntry(entry)
-}
-
-func (logger *Logger) Warnf(format string, args ...interface{}) {
- logger.Logf(WarnLevel, format, args...)
-}
-
-func (logger *Logger) Warningf(format string, args ...interface{}) {
- logger.Warnf(format, args...)
-}
-
-func (logger *Logger) Errorf(format string, args ...interface{}) {
- logger.Logf(ErrorLevel, format, args...)
-}
-
-func (logger *Logger) Fatalf(format string, args ...interface{}) {
- logger.Logf(FatalLevel, format, args...)
- logger.Exit(1)
-}
-
-func (logger *Logger) Panicf(format string, args ...interface{}) {
- logger.Logf(PanicLevel, format, args...)
-}
-
-func (logger *Logger) Log(level Level, args ...interface{}) {
- if logger.IsLevelEnabled(level) {
- entry := logger.newEntry()
- entry.Log(level, args...)
- logger.releaseEntry(entry)
- }
-}
-
-func (logger *Logger) Trace(args ...interface{}) {
- logger.Log(TraceLevel, args...)
-}
-
-func (logger *Logger) Debug(args ...interface{}) {
- logger.Log(DebugLevel, args...)
-}
-
-func (logger *Logger) Info(args ...interface{}) {
- logger.Log(InfoLevel, args...)
-}
-
-func (logger *Logger) Print(args ...interface{}) {
- entry := logger.newEntry()
- entry.Print(args...)
- logger.releaseEntry(entry)
-}
-
-func (logger *Logger) Warn(args ...interface{}) {
- logger.Log(WarnLevel, args...)
-}
-
-func (logger *Logger) Warning(args ...interface{}) {
- logger.Warn(args...)
-}
-
-func (logger *Logger) Error(args ...interface{}) {
- logger.Log(ErrorLevel, args...)
-}
-
-func (logger *Logger) Fatal(args ...interface{}) {
- logger.Log(FatalLevel, args...)
- logger.Exit(1)
-}
-
-func (logger *Logger) Panic(args ...interface{}) {
- logger.Log(PanicLevel, args...)
-}
-
-func (logger *Logger) Logln(level Level, args ...interface{}) {
- if logger.IsLevelEnabled(level) {
- entry := logger.newEntry()
- entry.Logln(level, args...)
- logger.releaseEntry(entry)
- }
-}
-
-func (logger *Logger) Traceln(args ...interface{}) {
- logger.Logln(TraceLevel, args...)
-}
-
-func (logger *Logger) Debugln(args ...interface{}) {
- logger.Logln(DebugLevel, args...)
-}
-
-func (logger *Logger) Infoln(args ...interface{}) {
- logger.Logln(InfoLevel, args...)
-}
-
-func (logger *Logger) Println(args ...interface{}) {
- entry := logger.newEntry()
- entry.Println(args...)
- logger.releaseEntry(entry)
-}
-
-func (logger *Logger) Warnln(args ...interface{}) {
- logger.Logln(WarnLevel, args...)
-}
-
-func (logger *Logger) Warningln(args ...interface{}) {
- logger.Warnln(args...)
-}
-
-func (logger *Logger) Errorln(args ...interface{}) {
- logger.Logln(ErrorLevel, args...)
-}
-
-func (logger *Logger) Fatalln(args ...interface{}) {
- logger.Logln(FatalLevel, args...)
- logger.Exit(1)
-}
-
-func (logger *Logger) Panicln(args ...interface{}) {
- logger.Logln(PanicLevel, args...)
-}
-
-func (logger *Logger) Exit(code int) {
- runHandlers()
- if logger.ExitFunc == nil {
- logger.ExitFunc = os.Exit
- }
- logger.ExitFunc(code)
-}
-
-//When file is opened with appending mode, it's safe to
-//write concurrently to a file (within 4k message on Linux).
-//In these cases user can choose to disable the lock.
-func (logger *Logger) SetNoLock() {
- logger.mu.Disable()
-}
-
-func (logger *Logger) level() Level {
- return Level(atomic.LoadUint32((*uint32)(&logger.Level)))
-}
-
-// SetLevel sets the logger level.
-func (logger *Logger) SetLevel(level Level) {
- atomic.StoreUint32((*uint32)(&logger.Level), uint32(level))
-}
-
-// GetLevel returns the logger level.
-func (logger *Logger) GetLevel() Level {
- return logger.level()
-}
-
-// AddHook adds a hook to the logger hooks.
-func (logger *Logger) AddHook(hook Hook) {
- logger.mu.Lock()
- defer logger.mu.Unlock()
- logger.Hooks.Add(hook)
-}
-
-// IsLevelEnabled checks if the log level of the logger is greater than the level param
-func (logger *Logger) IsLevelEnabled(level Level) bool {
- return logger.level() >= level
-}
-
-// SetFormatter sets the logger formatter.
-func (logger *Logger) SetFormatter(formatter Formatter) {
- logger.mu.Lock()
- defer logger.mu.Unlock()
- logger.Formatter = formatter
-}
-
-// SetOutput sets the logger output.
-func (logger *Logger) SetOutput(output io.Writer) {
- logger.mu.Lock()
- defer logger.mu.Unlock()
- logger.Out = output
-}
-
-func (logger *Logger) SetReportCaller(reportCaller bool) {
- logger.mu.Lock()
- defer logger.mu.Unlock()
- logger.ReportCaller = reportCaller
-}
-
-// ReplaceHooks replaces the logger hooks and returns the old ones
-func (logger *Logger) ReplaceHooks(hooks LevelHooks) LevelHooks {
- logger.mu.Lock()
- oldHooks := logger.Hooks
- logger.Hooks = hooks
- logger.mu.Unlock()
- return oldHooks
-}
diff --git a/vendor/github.com/sirupsen/logrus/logrus.go b/vendor/github.com/sirupsen/logrus/logrus.go
deleted file mode 100644
index 8644761..0000000
--- a/vendor/github.com/sirupsen/logrus/logrus.go
+++ /dev/null
@@ -1,186 +0,0 @@
-package logrus
-
-import (
- "fmt"
- "log"
- "strings"
-)
-
-// Fields type, used to pass to `WithFields`.
-type Fields map[string]interface{}
-
-// Level type
-type Level uint32
-
-// Convert the Level to a string. E.g. PanicLevel becomes "panic".
-func (level Level) String() string {
- if b, err := level.MarshalText(); err == nil {
- return string(b)
- } else {
- return "unknown"
- }
-}
-
-// ParseLevel takes a string level and returns the Logrus log level constant.
-func ParseLevel(lvl string) (Level, error) {
- switch strings.ToLower(lvl) {
- case "panic":
- return PanicLevel, nil
- case "fatal":
- return FatalLevel, nil
- case "error":
- return ErrorLevel, nil
- case "warn", "warning":
- return WarnLevel, nil
- case "info":
- return InfoLevel, nil
- case "debug":
- return DebugLevel, nil
- case "trace":
- return TraceLevel, nil
- }
-
- var l Level
- return l, fmt.Errorf("not a valid logrus Level: %q", lvl)
-}
-
-// UnmarshalText implements encoding.TextUnmarshaler.
-func (level *Level) UnmarshalText(text []byte) error {
- l, err := ParseLevel(string(text))
- if err != nil {
- return err
- }
-
- *level = Level(l)
-
- return nil
-}
-
-func (level Level) MarshalText() ([]byte, error) {
- switch level {
- case TraceLevel:
- return []byte("trace"), nil
- case DebugLevel:
- return []byte("debug"), nil
- case InfoLevel:
- return []byte("info"), nil
- case WarnLevel:
- return []byte("warning"), nil
- case ErrorLevel:
- return []byte("error"), nil
- case FatalLevel:
- return []byte("fatal"), nil
- case PanicLevel:
- return []byte("panic"), nil
- }
-
- return nil, fmt.Errorf("not a valid logrus level %d", level)
-}
-
-// A constant exposing all logging levels
-var AllLevels = []Level{
- PanicLevel,
- FatalLevel,
- ErrorLevel,
- WarnLevel,
- InfoLevel,
- DebugLevel,
- TraceLevel,
-}
-
-// These are the different logging levels. You can set the logging level to log
-// on your instance of logger, obtained with `logrus.New()`.
-const (
- // PanicLevel level, highest level of severity. Logs and then calls panic with the
- // message passed to Debug, Info, ...
- PanicLevel Level = iota
- // FatalLevel level. Logs and then calls `logger.Exit(1)`. It will exit even if the
- // logging level is set to Panic.
- FatalLevel
- // ErrorLevel level. Logs. Used for errors that should definitely be noted.
- // Commonly used for hooks to send errors to an error tracking service.
- ErrorLevel
- // WarnLevel level. Non-critical entries that deserve eyes.
- WarnLevel
- // InfoLevel level. General operational entries about what's going on inside the
- // application.
- InfoLevel
- // DebugLevel level. Usually only enabled when debugging. Very verbose logging.
- DebugLevel
- // TraceLevel level. Designates finer-grained informational events than the Debug.
- TraceLevel
-)
-
-// Won't compile if StdLogger can't be realized by a log.Logger
-var (
- _ StdLogger = &log.Logger{}
- _ StdLogger = &Entry{}
- _ StdLogger = &Logger{}
-)
-
-// StdLogger is what your logrus-enabled library should take, that way
-// it'll accept a stdlib logger and a logrus logger. There's no standard
-// interface, this is the closest we get, unfortunately.
-type StdLogger interface {
- Print(...interface{})
- Printf(string, ...interface{})
- Println(...interface{})
-
- Fatal(...interface{})
- Fatalf(string, ...interface{})
- Fatalln(...interface{})
-
- Panic(...interface{})
- Panicf(string, ...interface{})
- Panicln(...interface{})
-}
-
-// The FieldLogger interface generalizes the Entry and Logger types
-type FieldLogger interface {
- WithField(key string, value interface{}) *Entry
- WithFields(fields Fields) *Entry
- WithError(err error) *Entry
-
- Debugf(format string, args ...interface{})
- Infof(format string, args ...interface{})
- Printf(format string, args ...interface{})
- Warnf(format string, args ...interface{})
- Warningf(format string, args ...interface{})
- Errorf(format string, args ...interface{})
- Fatalf(format string, args ...interface{})
- Panicf(format string, args ...interface{})
-
- Debug(args ...interface{})
- Info(args ...interface{})
- Print(args ...interface{})
- Warn(args ...interface{})
- Warning(args ...interface{})
- Error(args ...interface{})
- Fatal(args ...interface{})
- Panic(args ...interface{})
-
- Debugln(args ...interface{})
- Infoln(args ...interface{})
- Println(args ...interface{})
- Warnln(args ...interface{})
- Warningln(args ...interface{})
- Errorln(args ...interface{})
- Fatalln(args ...interface{})
- Panicln(args ...interface{})
-
- // IsDebugEnabled() bool
- // IsInfoEnabled() bool
- // IsWarnEnabled() bool
- // IsErrorEnabled() bool
- // IsFatalEnabled() bool
- // IsPanicEnabled() bool
-}
-
-// Ext1FieldLogger (the first extension to FieldLogger) is superfluous, it is
-// here for consistancy. Do not use. Use Logger or Entry instead.
-type Ext1FieldLogger interface {
- FieldLogger
- Tracef(format string, args ...interface{})
- Trace(args ...interface{})
- Traceln(args ...interface{})
-}
diff --git a/vendor/github.com/sirupsen/logrus/terminal_check_appengine.go b/vendor/github.com/sirupsen/logrus/terminal_check_appengine.go
deleted file mode 100644
index 2403de9..0000000
--- a/vendor/github.com/sirupsen/logrus/terminal_check_appengine.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// +build appengine
-
-package logrus
-
-import (
- "io"
-)
-
-func checkIfTerminal(w io.Writer) bool {
- return true
-}
diff --git a/vendor/github.com/sirupsen/logrus/terminal_check_bsd.go b/vendor/github.com/sirupsen/logrus/terminal_check_bsd.go
deleted file mode 100644
index 3c4f43f..0000000
--- a/vendor/github.com/sirupsen/logrus/terminal_check_bsd.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build darwin dragonfly freebsd netbsd openbsd
-
-package logrus
-
-import "golang.org/x/sys/unix"
-
-const ioctlReadTermios = unix.TIOCGETA
-
-func isTerminal(fd int) bool {
- _, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
- return err == nil
-}
-
diff --git a/vendor/github.com/sirupsen/logrus/terminal_check_no_terminal.go b/vendor/github.com/sirupsen/logrus/terminal_check_no_terminal.go
deleted file mode 100644
index 97af92c..0000000
--- a/vendor/github.com/sirupsen/logrus/terminal_check_no_terminal.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// +build js nacl plan9
-
-package logrus
-
-import (
- "io"
-)
-
-func checkIfTerminal(w io.Writer) bool {
- return false
-}
diff --git a/vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go b/vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go
deleted file mode 100644
index 3293fb3..0000000
--- a/vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// +build !appengine,!js,!windows,!nacl,!plan9
-
-package logrus
-
-import (
- "io"
- "os"
-)
-
-func checkIfTerminal(w io.Writer) bool {
- switch v := w.(type) {
- case *os.File:
- return isTerminal(int(v.Fd()))
- default:
- return false
- }
-}
diff --git a/vendor/github.com/sirupsen/logrus/terminal_check_solaris.go b/vendor/github.com/sirupsen/logrus/terminal_check_solaris.go
deleted file mode 100644
index f6710b3..0000000
--- a/vendor/github.com/sirupsen/logrus/terminal_check_solaris.go
+++ /dev/null
@@ -1,11 +0,0 @@
-package logrus
-
-import (
- "golang.org/x/sys/unix"
-)
-
-// IsTerminal returns true if the given file descriptor is a terminal.
-func isTerminal(fd int) bool {
- _, err := unix.IoctlGetTermio(fd, unix.TCGETA)
- return err == nil
-}
diff --git a/vendor/github.com/sirupsen/logrus/terminal_check_unix.go b/vendor/github.com/sirupsen/logrus/terminal_check_unix.go
deleted file mode 100644
index 355dc96..0000000
--- a/vendor/github.com/sirupsen/logrus/terminal_check_unix.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build linux aix
-
-package logrus
-
-import "golang.org/x/sys/unix"
-
-const ioctlReadTermios = unix.TCGETS
-
-func isTerminal(fd int) bool {
- _, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
- return err == nil
-}
-
diff --git a/vendor/github.com/sirupsen/logrus/terminal_check_windows.go b/vendor/github.com/sirupsen/logrus/terminal_check_windows.go
deleted file mode 100644
index 572889d..0000000
--- a/vendor/github.com/sirupsen/logrus/terminal_check_windows.go
+++ /dev/null
@@ -1,34 +0,0 @@
-// +build !appengine,!js,windows
-
-package logrus
-
-import (
- "io"
- "os"
- "syscall"
-
- sequences "github.com/konsorten/go-windows-terminal-sequences"
-)
-
-func initTerminal(w io.Writer) {
- switch v := w.(type) {
- case *os.File:
- sequences.EnableVirtualTerminalProcessing(syscall.Handle(v.Fd()), true)
- }
-}
-
-func checkIfTerminal(w io.Writer) bool {
- var ret bool
- switch v := w.(type) {
- case *os.File:
- var mode uint32
- err := syscall.GetConsoleMode(syscall.Handle(v.Fd()), &mode)
- ret = (err == nil)
- default:
- ret = false
- }
- if ret {
- initTerminal(w)
- }
- return ret
-}
diff --git a/vendor/github.com/sirupsen/logrus/text_formatter.go b/vendor/github.com/sirupsen/logrus/text_formatter.go
deleted file mode 100644
index e01587c..0000000
--- a/vendor/github.com/sirupsen/logrus/text_formatter.go
+++ /dev/null
@@ -1,295 +0,0 @@
-package logrus
-
-import (
- "bytes"
- "fmt"
- "os"
- "runtime"
- "sort"
- "strings"
- "sync"
- "time"
-)
-
-const (
- red = 31
- yellow = 33
- blue = 36
- gray = 37
-)
-
-var baseTimestamp time.Time
-
-func init() {
- baseTimestamp = time.Now()
-}
-
-// TextFormatter formats logs into text
-type TextFormatter struct {
- // Set to true to bypass checking for a TTY before outputting colors.
- ForceColors bool
-
- // Force disabling colors.
- DisableColors bool
-
- // Override coloring based on CLICOLOR and CLICOLOR_FORCE. - https://bixense.com/clicolors/
- EnvironmentOverrideColors bool
-
- // Disable timestamp logging. useful when output is redirected to logging
- // system that already adds timestamps.
- DisableTimestamp bool
-
- // Enable logging the full timestamp when a TTY is attached instead of just
- // the time passed since beginning of execution.
- FullTimestamp bool
-
- // TimestampFormat to use for display when a full timestamp is printed
- TimestampFormat string
-
- // The fields are sorted by default for a consistent output. For applications
- // that log extremely frequently and don't use the JSON formatter this may not
- // be desired.
- DisableSorting bool
-
- // The keys sorting function, when uninitialized it uses sort.Strings.
- SortingFunc func([]string)
-
- // Disables the truncation of the level text to 4 characters.
- DisableLevelTruncation bool
-
- // QuoteEmptyFields will wrap empty fields in quotes if true
- QuoteEmptyFields bool
-
- // Whether the logger's out is to a terminal
- isTerminal bool
-
- // FieldMap allows users to customize the names of keys for default fields.
- // As an example:
- // formatter := &TextFormatter{
- // FieldMap: FieldMap{
- // FieldKeyTime: "@timestamp",
- // FieldKeyLevel: "@level",
- // FieldKeyMsg: "@message"}}
- FieldMap FieldMap
-
- // CallerPrettyfier can be set by the user to modify the content
- // of the function and file keys in the data when ReportCaller is
- // activated. If any of the returned value is the empty string the
- // corresponding key will be removed from fields.
- CallerPrettyfier func(*runtime.Frame) (function string, file string)
-
- terminalInitOnce sync.Once
-}
-
-func (f *TextFormatter) init(entry *Entry) {
- if entry.Logger != nil {
- f.isTerminal = checkIfTerminal(entry.Logger.Out)
- }
-}
-
-func (f *TextFormatter) isColored() bool {
- isColored := f.ForceColors || (f.isTerminal && (runtime.GOOS != "windows"))
-
- if f.EnvironmentOverrideColors {
- if force, ok := os.LookupEnv("CLICOLOR_FORCE"); ok && force != "0" {
- isColored = true
- } else if ok && force == "0" {
- isColored = false
- } else if os.Getenv("CLICOLOR") == "0" {
- isColored = false
- }
- }
-
- return isColored && !f.DisableColors
-}
-
-// Format renders a single log entry
-func (f *TextFormatter) Format(entry *Entry) ([]byte, error) {
- data := make(Fields)
- for k, v := range entry.Data {
- data[k] = v
- }
- prefixFieldClashes(data, f.FieldMap, entry.HasCaller())
- keys := make([]string, 0, len(data))
- for k := range data {
- keys = append(keys, k)
- }
-
- var funcVal, fileVal string
-
- fixedKeys := make([]string, 0, 4+len(data))
- if !f.DisableTimestamp {
- fixedKeys = append(fixedKeys, f.FieldMap.resolve(FieldKeyTime))
- }
- fixedKeys = append(fixedKeys, f.FieldMap.resolve(FieldKeyLevel))
- if entry.Message != "" {
- fixedKeys = append(fixedKeys, f.FieldMap.resolve(FieldKeyMsg))
- }
- if entry.err != "" {
- fixedKeys = append(fixedKeys, f.FieldMap.resolve(FieldKeyLogrusError))
- }
- if entry.HasCaller() {
- if f.CallerPrettyfier != nil {
- funcVal, fileVal = f.CallerPrettyfier(entry.Caller)
- } else {
- funcVal = entry.Caller.Function
- fileVal = fmt.Sprintf("%s:%d", entry.Caller.File, entry.Caller.Line)
- }
-
- if funcVal != "" {
- fixedKeys = append(fixedKeys, f.FieldMap.resolve(FieldKeyFunc))
- }
- if fileVal != "" {
- fixedKeys = append(fixedKeys, f.FieldMap.resolve(FieldKeyFile))
- }
- }
-
- if !f.DisableSorting {
- if f.SortingFunc == nil {
- sort.Strings(keys)
- fixedKeys = append(fixedKeys, keys...)
- } else {
- if !f.isColored() {
- fixedKeys = append(fixedKeys, keys...)
- f.SortingFunc(fixedKeys)
- } else {
- f.SortingFunc(keys)
- }
- }
- } else {
- fixedKeys = append(fixedKeys, keys...)
- }
-
- var b *bytes.Buffer
- if entry.Buffer != nil {
- b = entry.Buffer
- } else {
- b = &bytes.Buffer{}
- }
-
- f.terminalInitOnce.Do(func() { f.init(entry) })
-
- timestampFormat := f.TimestampFormat
- if timestampFormat == "" {
- timestampFormat = defaultTimestampFormat
- }
- if f.isColored() {
- f.printColored(b, entry, keys, data, timestampFormat)
- } else {
-
- for _, key := range fixedKeys {
- var value interface{}
- switch {
- case key == f.FieldMap.resolve(FieldKeyTime):
- value = entry.Time.Format(timestampFormat)
- case key == f.FieldMap.resolve(FieldKeyLevel):
- value = entry.Level.String()
- case key == f.FieldMap.resolve(FieldKeyMsg):
- value = entry.Message
- case key == f.FieldMap.resolve(FieldKeyLogrusError):
- value = entry.err
- case key == f.FieldMap.resolve(FieldKeyFunc) && entry.HasCaller():
- value = funcVal
- case key == f.FieldMap.resolve(FieldKeyFile) && entry.HasCaller():
- value = fileVal
- default:
- value = data[key]
- }
- f.appendKeyValue(b, key, value)
- }
- }
-
- b.WriteByte('\n')
- return b.Bytes(), nil
-}
-
-func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []string, data Fields, timestampFormat string) {
- var levelColor int
- switch entry.Level {
- case DebugLevel, TraceLevel:
- levelColor = gray
- case WarnLevel:
- levelColor = yellow
- case ErrorLevel, FatalLevel, PanicLevel:
- levelColor = red
- default:
- levelColor = blue
- }
-
- levelText := strings.ToUpper(entry.Level.String())
- if !f.DisableLevelTruncation {
- levelText = levelText[0:4]
- }
-
- // Remove a single newline if it already exists in the message to keep
- // the behavior of logrus text_formatter the same as the stdlib log package
- entry.Message = strings.TrimSuffix(entry.Message, "\n")
-
- caller := ""
- if entry.HasCaller() {
- funcVal := fmt.Sprintf("%s()", entry.Caller.Function)
- fileVal := fmt.Sprintf("%s:%d", entry.Caller.File, entry.Caller.Line)
-
- if f.CallerPrettyfier != nil {
- funcVal, fileVal = f.CallerPrettyfier(entry.Caller)
- }
-
- if fileVal == "" {
- caller = funcVal
- } else if funcVal == "" {
- caller = fileVal
- } else {
- caller = fileVal + " " + funcVal
- }
- }
-
- if f.DisableTimestamp {
- fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m%s %-44s ", levelColor, levelText, caller, entry.Message)
- } else if !f.FullTimestamp {
- fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%04d]%s %-44s ", levelColor, levelText, int(entry.Time.Sub(baseTimestamp)/time.Second), caller, entry.Message)
- } else {
- fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%s]%s %-44s ", levelColor, levelText, entry.Time.Format(timestampFormat), caller, entry.Message)
- }
- for _, k := range keys {
- v := data[k]
- fmt.Fprintf(b, " \x1b[%dm%s\x1b[0m=", levelColor, k)
- f.appendValue(b, v)
- }
-}
-
-func (f *TextFormatter) needsQuoting(text string) bool {
- if f.QuoteEmptyFields && len(text) == 0 {
- return true
- }
- for _, ch := range text {
- if !((ch >= 'a' && ch <= 'z') ||
- (ch >= 'A' && ch <= 'Z') ||
- (ch >= '0' && ch <= '9') ||
- ch == '-' || ch == '.' || ch == '_' || ch == '/' || ch == '@' || ch == '^' || ch == '+') {
- return true
- }
- }
- return false
-}
-
-func (f *TextFormatter) appendKeyValue(b *bytes.Buffer, key string, value interface{}) {
- if b.Len() > 0 {
- b.WriteByte(' ')
- }
- b.WriteString(key)
- b.WriteByte('=')
- f.appendValue(b, value)
-}
-
-func (f *TextFormatter) appendValue(b *bytes.Buffer, value interface{}) {
- stringVal, ok := value.(string)
- if !ok {
- stringVal = fmt.Sprint(value)
- }
-
- if !f.needsQuoting(stringVal) {
- b.WriteString(stringVal)
- } else {
- b.WriteString(fmt.Sprintf("%q", stringVal))
- }
-}
diff --git a/vendor/github.com/sirupsen/logrus/writer.go b/vendor/github.com/sirupsen/logrus/writer.go
deleted file mode 100644
index 9e1f751..0000000
--- a/vendor/github.com/sirupsen/logrus/writer.go
+++ /dev/null
@@ -1,64 +0,0 @@
-package logrus
-
-import (
- "bufio"
- "io"
- "runtime"
-)
-
-func (logger *Logger) Writer() *io.PipeWriter {
- return logger.WriterLevel(InfoLevel)
-}
-
-func (logger *Logger) WriterLevel(level Level) *io.PipeWriter {
- return NewEntry(logger).WriterLevel(level)
-}
-
-func (entry *Entry) Writer() *io.PipeWriter {
- return entry.WriterLevel(InfoLevel)
-}
-
-func (entry *Entry) WriterLevel(level Level) *io.PipeWriter {
- reader, writer := io.Pipe()
-
- var printFunc func(args ...interface{})
-
- switch level {
- case TraceLevel:
- printFunc = entry.Trace
- case DebugLevel:
- printFunc = entry.Debug
- case InfoLevel:
- printFunc = entry.Info
- case WarnLevel:
- printFunc = entry.Warn
- case ErrorLevel:
- printFunc = entry.Error
- case FatalLevel:
- printFunc = entry.Fatal
- case PanicLevel:
- printFunc = entry.Panic
- default:
- printFunc = entry.Print
- }
-
- go entry.writerScanner(reader, printFunc)
- runtime.SetFinalizer(writer, writerFinalizer)
-
- return writer
-}
-
-func (entry *Entry) writerScanner(reader *io.PipeReader, printFunc func(args ...interface{})) {
- scanner := bufio.NewScanner(reader)
- for scanner.Scan() {
- printFunc(scanner.Text())
- }
- if err := scanner.Err(); err != nil {
- entry.Errorf("Error while reading from Writer: %s", err)
- }
- reader.Close()
-}
-
-func writerFinalizer(writer *io.PipeWriter) {
- writer.Close()
-}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/LICENSE b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/LICENSE
deleted file mode 100644
index efc75a2..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright (c) 2017-2018 Tencent Ltd.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdb/v20170320/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdb/v20170320/client.go
deleted file mode 100644
index a81ae4f..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdb/v20170320/client.go
+++ /dev/null
@@ -1,1920 +0,0 @@
-// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package v20170320
-
-import (
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
- tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
-)
-
-const APIVersion = "2017-03-20"
-
-type Client struct {
- common.Client
-}
-
-// Deprecated
-func NewClientWithSecretId(secretId, secretKey, region string) (client *Client, err error) {
- cpf := profile.NewClientProfile()
- client = &Client{}
- client.Init(region).WithSecretId(secretId, secretKey).WithProfile(cpf)
- return
-}
-
-func NewClient(credential *common.Credential, region string, clientProfile *profile.ClientProfile) (client *Client, err error) {
- client = &Client{}
- client.Init(region).
- WithCredential(credential).
- WithProfile(clientProfile)
- return
-}
-
-
-func NewAddTimeWindowRequest() (request *AddTimeWindowRequest) {
- request = &AddTimeWindowRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "AddTimeWindow")
- return
-}
-
-func NewAddTimeWindowResponse() (response *AddTimeWindowResponse) {
- response = &AddTimeWindowResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(AddTimeWindow)用于添加云数据库实例的维护时间窗口,以指定实例在哪些时间段可以自动执行切换访问操作。
-func (c *Client) AddTimeWindow(request *AddTimeWindowRequest) (response *AddTimeWindowResponse, err error) {
- if request == nil {
- request = NewAddTimeWindowRequest()
- }
- response = NewAddTimeWindowResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewAssociateSecurityGroupsRequest() (request *AssociateSecurityGroupsRequest) {
- request = &AssociateSecurityGroupsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "AssociateSecurityGroups")
- return
-}
-
-func NewAssociateSecurityGroupsResponse() (response *AssociateSecurityGroupsResponse) {
- response = &AssociateSecurityGroupsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(AssociateSecurityGroups)用于安全组批量绑定实例。
-func (c *Client) AssociateSecurityGroups(request *AssociateSecurityGroupsRequest) (response *AssociateSecurityGroupsResponse, err error) {
- if request == nil {
- request = NewAssociateSecurityGroupsRequest()
- }
- response = NewAssociateSecurityGroupsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCloseWanServiceRequest() (request *CloseWanServiceRequest) {
- request = &CloseWanServiceRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "CloseWanService")
- return
-}
-
-func NewCloseWanServiceResponse() (response *CloseWanServiceResponse) {
- response = &CloseWanServiceResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CloseWanService)用于关闭云数据库实例的外网访问。关闭外网访问后,外网地址将不可访问。
-func (c *Client) CloseWanService(request *CloseWanServiceRequest) (response *CloseWanServiceResponse, err error) {
- if request == nil {
- request = NewCloseWanServiceRequest()
- }
- response = NewCloseWanServiceResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateAccountsRequest() (request *CreateAccountsRequest) {
- request = &CreateAccountsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "CreateAccounts")
- return
-}
-
-func NewCreateAccountsResponse() (response *CreateAccountsResponse) {
- response = &CreateAccountsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateAccounts)用于创建云数据库的账户,需要指定新的账户名和域名,以及所对应的密码,同时可以设置账号的备注信息。
-func (c *Client) CreateAccounts(request *CreateAccountsRequest) (response *CreateAccountsResponse, err error) {
- if request == nil {
- request = NewCreateAccountsRequest()
- }
- response = NewCreateAccountsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateBackupRequest() (request *CreateBackupRequest) {
- request = &CreateBackupRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "CreateBackup")
- return
-}
-
-func NewCreateBackupResponse() (response *CreateBackupResponse) {
- response = &CreateBackupResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateBackup)用于创建数据库备份。
-func (c *Client) CreateBackup(request *CreateBackupRequest) (response *CreateBackupResponse, err error) {
- if request == nil {
- request = NewCreateBackupRequest()
- }
- response = NewCreateBackupResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateDBImportJobRequest() (request *CreateDBImportJobRequest) {
- request = &CreateDBImportJobRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "CreateDBImportJob")
- return
-}
-
-func NewCreateDBImportJobResponse() (response *CreateDBImportJobResponse) {
- response = &CreateDBImportJobResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateDBImportJob)用于创建云数据库数据导入任务。
-//
-// 注意,用户进行数据导入任务的文件,必须提前上传到腾讯云。用户须在控制台进行文件导入。
-func (c *Client) CreateDBImportJob(request *CreateDBImportJobRequest) (response *CreateDBImportJobResponse, err error) {
- if request == nil {
- request = NewCreateDBImportJobRequest()
- }
- response = NewCreateDBImportJobResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateDBInstanceRequest() (request *CreateDBInstanceRequest) {
- request = &CreateDBInstanceRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "CreateDBInstance")
- return
-}
-
-func NewCreateDBInstanceResponse() (response *CreateDBInstanceResponse) {
- response = &CreateDBInstanceResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateDBInstance)用于创建包年包月的云数据库实例(包括主实例、灾备实例和只读实例),可通过传入实例规格、MySQL 版本号、购买时长和数量等信息创建云数据库实例。
-//
-// 该接口为异步接口,您还可以使用 [查询实例列表](https://cloud.tencent.com/document/api/236/15872) 接口查询该实例的详细信息。当该实例的 Status 为1,且 TaskStatus 为0,表示实例已经发货成功。
-//
-// 1. 首先请使用 [获取云数据库可售卖规格](https://cloud.tencent.com/document/api/236/17229) 接口查询可创建的实例规格信息,然后请使用 [查询数据库价格](https://cloud.tencent.com/document/api/236/18566) 接口查询可创建实例的售卖价格;
-// 2. 单次创建实例最大支持 100 个,实例时长最大支持 36 个月;
-// 3. 支持创建 MySQL 5.5 、 MySQL 5.6 、 MySQL 5.7 版本;
-// 4. 支持创建主实例、只读实例、灾备实例;
-// 5. 当入参指定 Port,ParamList 或 Password 时,该实例会进行初始化操作;
-func (c *Client) CreateDBInstance(request *CreateDBInstanceRequest) (response *CreateDBInstanceResponse, err error) {
- if request == nil {
- request = NewCreateDBInstanceRequest()
- }
- response = NewCreateDBInstanceResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateDBInstanceHourRequest() (request *CreateDBInstanceHourRequest) {
- request = &CreateDBInstanceHourRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "CreateDBInstanceHour")
- return
-}
-
-func NewCreateDBInstanceHourResponse() (response *CreateDBInstanceHourResponse) {
- response = &CreateDBInstanceHourResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateDBInstanceHour)用于创建按量计费的实例,可通过传入实例规格、MySQL 版本号和数量等信息创建云数据库实例,支持主实例、灾备实例和只读实例的创建。
-//
-// 该接口为异步接口,您还可以使用 [查询实例列表](https://cloud.tencent.com/document/api/236/15872) 接口查询该实例的详细信息。当该实例的 Status 为 1,且 TaskStatus 为 0,表示实例已经发货成功。
-//
-// 1. 首先请使用 [获取云数据库可售卖规格](https://cloud.tencent.com/document/api/236/17229) 接口查询可创建的实例规格信息,然后请使用 [查询数据库价格](https://cloud.tencent.com/document/api/236/18566) 接口查询可创建实例的售卖价格;
-// 2. 单次创建实例最大支持 100 个,实例时长最大支持 36 个月;
-// 3. 支持创建 MySQL 5.5、MySQL 5.6 和 MySQL 5.7 版本;
-// 4. 支持创建主实例、灾备实例和只读实例;
-// 5. 当入参指定 Port,ParamList 或 Password 时,该实例会进行初始化操作;
-func (c *Client) CreateDBInstanceHour(request *CreateDBInstanceHourRequest) (response *CreateDBInstanceHourResponse, err error) {
- if request == nil {
- request = NewCreateDBInstanceHourRequest()
- }
- response = NewCreateDBInstanceHourResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateParamTemplateRequest() (request *CreateParamTemplateRequest) {
- request = &CreateParamTemplateRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "CreateParamTemplate")
- return
-}
-
-func NewCreateParamTemplateResponse() (response *CreateParamTemplateResponse) {
- response = &CreateParamTemplateResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 该接口(CreateParamTemplate)用于创建参数模板。
-func (c *Client) CreateParamTemplate(request *CreateParamTemplateRequest) (response *CreateParamTemplateResponse, err error) {
- if request == nil {
- request = NewCreateParamTemplateRequest()
- }
- response = NewCreateParamTemplateResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteAccountsRequest() (request *DeleteAccountsRequest) {
- request = &DeleteAccountsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DeleteAccounts")
- return
-}
-
-func NewDeleteAccountsResponse() (response *DeleteAccountsResponse) {
- response = &DeleteAccountsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DeleteAccounts)用于删除云数据库的账户。
-func (c *Client) DeleteAccounts(request *DeleteAccountsRequest) (response *DeleteAccountsResponse, err error) {
- if request == nil {
- request = NewDeleteAccountsRequest()
- }
- response = NewDeleteAccountsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteBackupRequest() (request *DeleteBackupRequest) {
- request = &DeleteBackupRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DeleteBackup")
- return
-}
-
-func NewDeleteBackupResponse() (response *DeleteBackupResponse) {
- response = &DeleteBackupResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DeleteBackup)用于删除数据库备份。
-func (c *Client) DeleteBackup(request *DeleteBackupRequest) (response *DeleteBackupResponse, err error) {
- if request == nil {
- request = NewDeleteBackupRequest()
- }
- response = NewDeleteBackupResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteParamTemplateRequest() (request *DeleteParamTemplateRequest) {
- request = &DeleteParamTemplateRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DeleteParamTemplate")
- return
-}
-
-func NewDeleteParamTemplateResponse() (response *DeleteParamTemplateResponse) {
- response = &DeleteParamTemplateResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 该接口(DeleteParamTemplate)用于删除参数模板。
-func (c *Client) DeleteParamTemplate(request *DeleteParamTemplateRequest) (response *DeleteParamTemplateResponse, err error) {
- if request == nil {
- request = NewDeleteParamTemplateRequest()
- }
- response = NewDeleteParamTemplateResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteTimeWindowRequest() (request *DeleteTimeWindowRequest) {
- request = &DeleteTimeWindowRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DeleteTimeWindow")
- return
-}
-
-func NewDeleteTimeWindowResponse() (response *DeleteTimeWindowResponse) {
- response = &DeleteTimeWindowResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DeleteTimeWindow)用于删除云数据库实例的维护时间窗口。删除实例维护时间窗口之后,默认的维护时间窗为 03:00-04:00,即当选择在维护时间窗口内切换访问新实例时,默认会在 03:00-04:00 点进行切换访问新实例。
-func (c *Client) DeleteTimeWindow(request *DeleteTimeWindowRequest) (response *DeleteTimeWindowResponse, err error) {
- if request == nil {
- request = NewDeleteTimeWindowRequest()
- }
- response = NewDeleteTimeWindowResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeAccountPrivilegesRequest() (request *DescribeAccountPrivilegesRequest) {
- request = &DescribeAccountPrivilegesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeAccountPrivileges")
- return
-}
-
-func NewDescribeAccountPrivilegesResponse() (response *DescribeAccountPrivilegesResponse) {
- response = &DescribeAccountPrivilegesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeAccountPrivileges)用于查询云数据库账户支持的权限信息。
-func (c *Client) DescribeAccountPrivileges(request *DescribeAccountPrivilegesRequest) (response *DescribeAccountPrivilegesResponse, err error) {
- if request == nil {
- request = NewDescribeAccountPrivilegesRequest()
- }
- response = NewDescribeAccountPrivilegesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeAccountsRequest() (request *DescribeAccountsRequest) {
- request = &DescribeAccountsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeAccounts")
- return
-}
-
-func NewDescribeAccountsResponse() (response *DescribeAccountsResponse) {
- response = &DescribeAccountsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeAccounts)用于查询云数据库的所有账户信息。
-func (c *Client) DescribeAccounts(request *DescribeAccountsRequest) (response *DescribeAccountsResponse, err error) {
- if request == nil {
- request = NewDescribeAccountsRequest()
- }
- response = NewDescribeAccountsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeAsyncRequestInfoRequest() (request *DescribeAsyncRequestInfoRequest) {
- request = &DescribeAsyncRequestInfoRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeAsyncRequestInfo")
- return
-}
-
-func NewDescribeAsyncRequestInfoResponse() (response *DescribeAsyncRequestInfoResponse) {
- response = &DescribeAsyncRequestInfoResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeAsyncRequestInfo)用于查询云数据库实例异步任务的执行结果。
-func (c *Client) DescribeAsyncRequestInfo(request *DescribeAsyncRequestInfoRequest) (response *DescribeAsyncRequestInfoResponse, err error) {
- if request == nil {
- request = NewDescribeAsyncRequestInfoRequest()
- }
- response = NewDescribeAsyncRequestInfoResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeBackupConfigRequest() (request *DescribeBackupConfigRequest) {
- request = &DescribeBackupConfigRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeBackupConfig")
- return
-}
-
-func NewDescribeBackupConfigResponse() (response *DescribeBackupConfigResponse) {
- response = &DescribeBackupConfigResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeBackupConfig)用于查询数据库备份配置信息。
-func (c *Client) DescribeBackupConfig(request *DescribeBackupConfigRequest) (response *DescribeBackupConfigResponse, err error) {
- if request == nil {
- request = NewDescribeBackupConfigRequest()
- }
- response = NewDescribeBackupConfigResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeBackupDatabasesRequest() (request *DescribeBackupDatabasesRequest) {
- request = &DescribeBackupDatabasesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeBackupDatabases")
- return
-}
-
-func NewDescribeBackupDatabasesResponse() (response *DescribeBackupDatabasesResponse) {
- response = &DescribeBackupDatabasesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeBackupDatabases)用于查询备份数据库列表 (将废弃)。
-func (c *Client) DescribeBackupDatabases(request *DescribeBackupDatabasesRequest) (response *DescribeBackupDatabasesResponse, err error) {
- if request == nil {
- request = NewDescribeBackupDatabasesRequest()
- }
- response = NewDescribeBackupDatabasesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeBackupTablesRequest() (request *DescribeBackupTablesRequest) {
- request = &DescribeBackupTablesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeBackupTables")
- return
-}
-
-func NewDescribeBackupTablesResponse() (response *DescribeBackupTablesResponse) {
- response = &DescribeBackupTablesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeBackupTables)用于查询指定的数据库的备份数据表名 (将废弃)。
-func (c *Client) DescribeBackupTables(request *DescribeBackupTablesRequest) (response *DescribeBackupTablesResponse, err error) {
- if request == nil {
- request = NewDescribeBackupTablesRequest()
- }
- response = NewDescribeBackupTablesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeBackupsRequest() (request *DescribeBackupsRequest) {
- request = &DescribeBackupsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeBackups")
- return
-}
-
-func NewDescribeBackupsResponse() (response *DescribeBackupsResponse) {
- response = &DescribeBackupsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeBackups)用于查询云数据库实例的备份数据。
-func (c *Client) DescribeBackups(request *DescribeBackupsRequest) (response *DescribeBackupsResponse, err error) {
- if request == nil {
- request = NewDescribeBackupsRequest()
- }
- response = NewDescribeBackupsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeBinlogsRequest() (request *DescribeBinlogsRequest) {
- request = &DescribeBinlogsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeBinlogs")
- return
-}
-
-func NewDescribeBinlogsResponse() (response *DescribeBinlogsResponse) {
- response = &DescribeBinlogsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeBinlogs)用于查询云数据库实例的二进制数据。
-func (c *Client) DescribeBinlogs(request *DescribeBinlogsRequest) (response *DescribeBinlogsResponse, err error) {
- if request == nil {
- request = NewDescribeBinlogsRequest()
- }
- response = NewDescribeBinlogsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeDBImportRecordsRequest() (request *DescribeDBImportRecordsRequest) {
- request = &DescribeDBImportRecordsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeDBImportRecords")
- return
-}
-
-func NewDescribeDBImportRecordsResponse() (response *DescribeDBImportRecordsResponse) {
- response = &DescribeDBImportRecordsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeDBImportRecords)用于查询云数据库导入任务操作日志。
-func (c *Client) DescribeDBImportRecords(request *DescribeDBImportRecordsRequest) (response *DescribeDBImportRecordsResponse, err error) {
- if request == nil {
- request = NewDescribeDBImportRecordsRequest()
- }
- response = NewDescribeDBImportRecordsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeDBInstanceCharsetRequest() (request *DescribeDBInstanceCharsetRequest) {
- request = &DescribeDBInstanceCharsetRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeDBInstanceCharset")
- return
-}
-
-func NewDescribeDBInstanceCharsetResponse() (response *DescribeDBInstanceCharsetResponse) {
- response = &DescribeDBInstanceCharsetResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeDBInstanceCharset)用于查询云数据库实例的字符集,获取字符集的名称。
-func (c *Client) DescribeDBInstanceCharset(request *DescribeDBInstanceCharsetRequest) (response *DescribeDBInstanceCharsetResponse, err error) {
- if request == nil {
- request = NewDescribeDBInstanceCharsetRequest()
- }
- response = NewDescribeDBInstanceCharsetResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeDBInstanceConfigRequest() (request *DescribeDBInstanceConfigRequest) {
- request = &DescribeDBInstanceConfigRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeDBInstanceConfig")
- return
-}
-
-func NewDescribeDBInstanceConfigResponse() (response *DescribeDBInstanceConfigResponse) {
- response = &DescribeDBInstanceConfigResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeDBInstanceConfig)用于云数据库实例的配置信息,包括同步模式,部署模式等。
-func (c *Client) DescribeDBInstanceConfig(request *DescribeDBInstanceConfigRequest) (response *DescribeDBInstanceConfigResponse, err error) {
- if request == nil {
- request = NewDescribeDBInstanceConfigRequest()
- }
- response = NewDescribeDBInstanceConfigResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeDBInstanceGTIDRequest() (request *DescribeDBInstanceGTIDRequest) {
- request = &DescribeDBInstanceGTIDRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeDBInstanceGTID")
- return
-}
-
-func NewDescribeDBInstanceGTIDResponse() (response *DescribeDBInstanceGTIDResponse) {
- response = &DescribeDBInstanceGTIDResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeDBInstanceGTID)用于查询云数据库实例是否开通了 GTID,不支持版本为 5.5 以及以下的实例。
-func (c *Client) DescribeDBInstanceGTID(request *DescribeDBInstanceGTIDRequest) (response *DescribeDBInstanceGTIDResponse, err error) {
- if request == nil {
- request = NewDescribeDBInstanceGTIDRequest()
- }
- response = NewDescribeDBInstanceGTIDResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeDBInstanceRebootTimeRequest() (request *DescribeDBInstanceRebootTimeRequest) {
- request = &DescribeDBInstanceRebootTimeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeDBInstanceRebootTime")
- return
-}
-
-func NewDescribeDBInstanceRebootTimeResponse() (response *DescribeDBInstanceRebootTimeResponse) {
- response = &DescribeDBInstanceRebootTimeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeDBInstanceRebootTime)用于查询云数据库实例重启预计所需的时间。
-func (c *Client) DescribeDBInstanceRebootTime(request *DescribeDBInstanceRebootTimeRequest) (response *DescribeDBInstanceRebootTimeResponse, err error) {
- if request == nil {
- request = NewDescribeDBInstanceRebootTimeRequest()
- }
- response = NewDescribeDBInstanceRebootTimeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeDBInstancesRequest() (request *DescribeDBInstancesRequest) {
- request = &DescribeDBInstancesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeDBInstances")
- return
-}
-
-func NewDescribeDBInstancesResponse() (response *DescribeDBInstancesResponse) {
- response = &DescribeDBInstancesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeDBInstances)用于查询云数据库实例列表,支持通过项目 ID、实例 ID、访问地址、实例状态等过滤条件来筛选实例。支持查询主实例、灾备实例和只读实例信息列表。
-func (c *Client) DescribeDBInstances(request *DescribeDBInstancesRequest) (response *DescribeDBInstancesResponse, err error) {
- if request == nil {
- request = NewDescribeDBInstancesRequest()
- }
- response = NewDescribeDBInstancesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeDBPriceRequest() (request *DescribeDBPriceRequest) {
- request = &DescribeDBPriceRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeDBPrice")
- return
-}
-
-func NewDescribeDBPriceResponse() (response *DescribeDBPriceResponse) {
- response = &DescribeDBPriceResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeDBPrice)用于查询云数据库实例的价格,支持查询按量计费或者包年包月的价格。可传入实例类型、购买时长、购买数量、内存大小、硬盘大小和可用区信息等来查询实例价格。
-//
-// 注意:对某个地域进行询价,请使用对应地域的接入点,接入点信息请参照 服务地址 文档。例如:对广州地域进行询价,请把请求发到:cdb.ap-guangzhou.tencentcloudapi.com。同理对上海地域询价,把请求发到:cdb.ap-shanghai.tencentcloudapi.com。
-func (c *Client) DescribeDBPrice(request *DescribeDBPriceRequest) (response *DescribeDBPriceResponse, err error) {
- if request == nil {
- request = NewDescribeDBPriceRequest()
- }
- response = NewDescribeDBPriceResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeDBSecurityGroupsRequest() (request *DescribeDBSecurityGroupsRequest) {
- request = &DescribeDBSecurityGroupsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeDBSecurityGroups")
- return
-}
-
-func NewDescribeDBSecurityGroupsResponse() (response *DescribeDBSecurityGroupsResponse) {
- response = &DescribeDBSecurityGroupsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeDBSecurityGroups)用于查询实例的安全组详情。
-func (c *Client) DescribeDBSecurityGroups(request *DescribeDBSecurityGroupsRequest) (response *DescribeDBSecurityGroupsResponse, err error) {
- if request == nil {
- request = NewDescribeDBSecurityGroupsRequest()
- }
- response = NewDescribeDBSecurityGroupsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeDBSwitchRecordsRequest() (request *DescribeDBSwitchRecordsRequest) {
- request = &DescribeDBSwitchRecordsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeDBSwitchRecords")
- return
-}
-
-func NewDescribeDBSwitchRecordsResponse() (response *DescribeDBSwitchRecordsResponse) {
- response = &DescribeDBSwitchRecordsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeDBSwitchRecords)用于查询云数据库实例切换记录。
-func (c *Client) DescribeDBSwitchRecords(request *DescribeDBSwitchRecordsRequest) (response *DescribeDBSwitchRecordsResponse, err error) {
- if request == nil {
- request = NewDescribeDBSwitchRecordsRequest()
- }
- response = NewDescribeDBSwitchRecordsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeDBZoneConfigRequest() (request *DescribeDBZoneConfigRequest) {
- request = &DescribeDBZoneConfigRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeDBZoneConfig")
- return
-}
-
-func NewDescribeDBZoneConfigResponse() (response *DescribeDBZoneConfigResponse) {
- response = &DescribeDBZoneConfigResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeDBZoneConfig)用于查询可创建的云数据库各地域可售卖的规格配置。
-func (c *Client) DescribeDBZoneConfig(request *DescribeDBZoneConfigRequest) (response *DescribeDBZoneConfigResponse, err error) {
- if request == nil {
- request = NewDescribeDBZoneConfigRequest()
- }
- response = NewDescribeDBZoneConfigResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeDatabasesRequest() (request *DescribeDatabasesRequest) {
- request = &DescribeDatabasesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeDatabases")
- return
-}
-
-func NewDescribeDatabasesResponse() (response *DescribeDatabasesResponse) {
- response = &DescribeDatabasesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeDatabases)用于查询云数据库实例的数据库信息。
-func (c *Client) DescribeDatabases(request *DescribeDatabasesRequest) (response *DescribeDatabasesResponse, err error) {
- if request == nil {
- request = NewDescribeDatabasesRequest()
- }
- response = NewDescribeDatabasesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeDefaultParamsRequest() (request *DescribeDefaultParamsRequest) {
- request = &DescribeDefaultParamsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeDefaultParams")
- return
-}
-
-func NewDescribeDefaultParamsResponse() (response *DescribeDefaultParamsResponse) {
- response = &DescribeDefaultParamsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 该接口(DescribeDefaultParams)用于查询默认的可设置参数列表。
-func (c *Client) DescribeDefaultParams(request *DescribeDefaultParamsRequest) (response *DescribeDefaultParamsResponse, err error) {
- if request == nil {
- request = NewDescribeDefaultParamsRequest()
- }
- response = NewDescribeDefaultParamsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeDeviceMonitorInfoRequest() (request *DescribeDeviceMonitorInfoRequest) {
- request = &DescribeDeviceMonitorInfoRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeDeviceMonitorInfo")
- return
-}
-
-func NewDescribeDeviceMonitorInfoResponse() (response *DescribeDeviceMonitorInfoResponse) {
- response = &DescribeDeviceMonitorInfoResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeDeviceMonitorInfo)用于查询云数据库物理机当天的监控信息,暂只支持内存488G、硬盘6T的实例查询。
-func (c *Client) DescribeDeviceMonitorInfo(request *DescribeDeviceMonitorInfoRequest) (response *DescribeDeviceMonitorInfoResponse, err error) {
- if request == nil {
- request = NewDescribeDeviceMonitorInfoRequest()
- }
- response = NewDescribeDeviceMonitorInfoResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeInstanceParamRecordsRequest() (request *DescribeInstanceParamRecordsRequest) {
- request = &DescribeInstanceParamRecordsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeInstanceParamRecords")
- return
-}
-
-func NewDescribeInstanceParamRecordsResponse() (response *DescribeInstanceParamRecordsResponse) {
- response = &DescribeInstanceParamRecordsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 该接口(DescribeInstanceParamRecords)用于查询实例参数修改历史。
-func (c *Client) DescribeInstanceParamRecords(request *DescribeInstanceParamRecordsRequest) (response *DescribeInstanceParamRecordsResponse, err error) {
- if request == nil {
- request = NewDescribeInstanceParamRecordsRequest()
- }
- response = NewDescribeInstanceParamRecordsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeInstanceParamsRequest() (request *DescribeInstanceParamsRequest) {
- request = &DescribeInstanceParamsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeInstanceParams")
- return
-}
-
-func NewDescribeInstanceParamsResponse() (response *DescribeInstanceParamsResponse) {
- response = &DescribeInstanceParamsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 该接口(DescribeInstanceParams)用于查询实例的参数列表。
-func (c *Client) DescribeInstanceParams(request *DescribeInstanceParamsRequest) (response *DescribeInstanceParamsResponse, err error) {
- if request == nil {
- request = NewDescribeInstanceParamsRequest()
- }
- response = NewDescribeInstanceParamsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeParamTemplateInfoRequest() (request *DescribeParamTemplateInfoRequest) {
- request = &DescribeParamTemplateInfoRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeParamTemplateInfo")
- return
-}
-
-func NewDescribeParamTemplateInfoResponse() (response *DescribeParamTemplateInfoResponse) {
- response = &DescribeParamTemplateInfoResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 该接口(DescribeParamTemplateInfo)用于查询参数模板详情。
-func (c *Client) DescribeParamTemplateInfo(request *DescribeParamTemplateInfoRequest) (response *DescribeParamTemplateInfoResponse, err error) {
- if request == nil {
- request = NewDescribeParamTemplateInfoRequest()
- }
- response = NewDescribeParamTemplateInfoResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeParamTemplatesRequest() (request *DescribeParamTemplatesRequest) {
- request = &DescribeParamTemplatesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeParamTemplates")
- return
-}
-
-func NewDescribeParamTemplatesResponse() (response *DescribeParamTemplatesResponse) {
- response = &DescribeParamTemplatesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 该接口(DescribeParamTemplates)查询参数模板列表。
-func (c *Client) DescribeParamTemplates(request *DescribeParamTemplatesRequest) (response *DescribeParamTemplatesResponse, err error) {
- if request == nil {
- request = NewDescribeParamTemplatesRequest()
- }
- response = NewDescribeParamTemplatesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeProjectSecurityGroupsRequest() (request *DescribeProjectSecurityGroupsRequest) {
- request = &DescribeProjectSecurityGroupsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeProjectSecurityGroups")
- return
-}
-
-func NewDescribeProjectSecurityGroupsResponse() (response *DescribeProjectSecurityGroupsResponse) {
- response = &DescribeProjectSecurityGroupsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeProjectSecurityGroups)用于查询项目的安全组详情。
-func (c *Client) DescribeProjectSecurityGroups(request *DescribeProjectSecurityGroupsRequest) (response *DescribeProjectSecurityGroupsResponse, err error) {
- if request == nil {
- request = NewDescribeProjectSecurityGroupsRequest()
- }
- response = NewDescribeProjectSecurityGroupsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeRollbackRangeTimeRequest() (request *DescribeRollbackRangeTimeRequest) {
- request = &DescribeRollbackRangeTimeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeRollbackRangeTime")
- return
-}
-
-func NewDescribeRollbackRangeTimeResponse() (response *DescribeRollbackRangeTimeResponse) {
- response = &DescribeRollbackRangeTimeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeRollbackRangeTime)用于查询云数据库实例可回档的时间范围。
-func (c *Client) DescribeRollbackRangeTime(request *DescribeRollbackRangeTimeRequest) (response *DescribeRollbackRangeTimeResponse, err error) {
- if request == nil {
- request = NewDescribeRollbackRangeTimeRequest()
- }
- response = NewDescribeRollbackRangeTimeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeSlowLogsRequest() (request *DescribeSlowLogsRequest) {
- request = &DescribeSlowLogsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeSlowLogs")
- return
-}
-
-func NewDescribeSlowLogsResponse() (response *DescribeSlowLogsResponse) {
- response = &DescribeSlowLogsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeSlowLogs)用于获取云数据库实例的慢查询日志。
-func (c *Client) DescribeSlowLogs(request *DescribeSlowLogsRequest) (response *DescribeSlowLogsResponse, err error) {
- if request == nil {
- request = NewDescribeSlowLogsRequest()
- }
- response = NewDescribeSlowLogsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeSupportedPrivilegesRequest() (request *DescribeSupportedPrivilegesRequest) {
- request = &DescribeSupportedPrivilegesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeSupportedPrivileges")
- return
-}
-
-func NewDescribeSupportedPrivilegesResponse() (response *DescribeSupportedPrivilegesResponse) {
- response = &DescribeSupportedPrivilegesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeSupportedPrivileges)用于查询云数据库的支持的权限信息,包括全局权限,数据库权限,表权限以及列权限。
-func (c *Client) DescribeSupportedPrivileges(request *DescribeSupportedPrivilegesRequest) (response *DescribeSupportedPrivilegesResponse, err error) {
- if request == nil {
- request = NewDescribeSupportedPrivilegesRequest()
- }
- response = NewDescribeSupportedPrivilegesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeTablesRequest() (request *DescribeTablesRequest) {
- request = &DescribeTablesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeTables")
- return
-}
-
-func NewDescribeTablesResponse() (response *DescribeTablesResponse) {
- response = &DescribeTablesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeTables)用于查询云数据库实例的数据库表信息。
-func (c *Client) DescribeTables(request *DescribeTablesRequest) (response *DescribeTablesResponse, err error) {
- if request == nil {
- request = NewDescribeTablesRequest()
- }
- response = NewDescribeTablesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeTagsOfInstanceIdsRequest() (request *DescribeTagsOfInstanceIdsRequest) {
- request = &DescribeTagsOfInstanceIdsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeTagsOfInstanceIds")
- return
-}
-
-func NewDescribeTagsOfInstanceIdsResponse() (response *DescribeTagsOfInstanceIdsResponse) {
- response = &DescribeTagsOfInstanceIdsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeTagsOfInstanceIds)用于获取云数据库实例的标签信息。
-func (c *Client) DescribeTagsOfInstanceIds(request *DescribeTagsOfInstanceIdsRequest) (response *DescribeTagsOfInstanceIdsResponse, err error) {
- if request == nil {
- request = NewDescribeTagsOfInstanceIdsRequest()
- }
- response = NewDescribeTagsOfInstanceIdsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeTasksRequest() (request *DescribeTasksRequest) {
- request = &DescribeTasksRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeTasks")
- return
-}
-
-func NewDescribeTasksResponse() (response *DescribeTasksResponse) {
- response = &DescribeTasksResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeTasks)用于查询云数据库实例任务列表。
-func (c *Client) DescribeTasks(request *DescribeTasksRequest) (response *DescribeTasksResponse, err error) {
- if request == nil {
- request = NewDescribeTasksRequest()
- }
- response = NewDescribeTasksResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeTimeWindowRequest() (request *DescribeTimeWindowRequest) {
- request = &DescribeTimeWindowRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeTimeWindow")
- return
-}
-
-func NewDescribeTimeWindowResponse() (response *DescribeTimeWindowResponse) {
- response = &DescribeTimeWindowResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeTimeWindow)用于查询云数据库实例的维护时间窗口。
-func (c *Client) DescribeTimeWindow(request *DescribeTimeWindowRequest) (response *DescribeTimeWindowResponse, err error) {
- if request == nil {
- request = NewDescribeTimeWindowRequest()
- }
- response = NewDescribeTimeWindowResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeUploadedFilesRequest() (request *DescribeUploadedFilesRequest) {
- request = &DescribeUploadedFilesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DescribeUploadedFiles")
- return
-}
-
-func NewDescribeUploadedFilesResponse() (response *DescribeUploadedFilesResponse) {
- response = &DescribeUploadedFilesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeUploadedFiles)用于查询用户导入的SQL文件列表。
-func (c *Client) DescribeUploadedFiles(request *DescribeUploadedFilesRequest) (response *DescribeUploadedFilesResponse, err error) {
- if request == nil {
- request = NewDescribeUploadedFilesRequest()
- }
- response = NewDescribeUploadedFilesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDisassociateSecurityGroupsRequest() (request *DisassociateSecurityGroupsRequest) {
- request = &DisassociateSecurityGroupsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "DisassociateSecurityGroups")
- return
-}
-
-func NewDisassociateSecurityGroupsResponse() (response *DisassociateSecurityGroupsResponse) {
- response = &DisassociateSecurityGroupsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DisassociateSecurityGroups)用于安全组批量解绑实例。
-func (c *Client) DisassociateSecurityGroups(request *DisassociateSecurityGroupsRequest) (response *DisassociateSecurityGroupsResponse, err error) {
- if request == nil {
- request = NewDisassociateSecurityGroupsRequest()
- }
- response = NewDisassociateSecurityGroupsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewInitDBInstancesRequest() (request *InitDBInstancesRequest) {
- request = &InitDBInstancesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "InitDBInstances")
- return
-}
-
-func NewInitDBInstancesResponse() (response *InitDBInstancesResponse) {
- response = &InitDBInstancesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(InitDBInstances)用于初始化云数据库实例,包括初始化密码、默认字符集、实例端口号等
-func (c *Client) InitDBInstances(request *InitDBInstancesRequest) (response *InitDBInstancesResponse, err error) {
- if request == nil {
- request = NewInitDBInstancesRequest()
- }
- response = NewInitDBInstancesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewInquiryPriceUpgradeInstancesRequest() (request *InquiryPriceUpgradeInstancesRequest) {
- request = &InquiryPriceUpgradeInstancesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "InquiryPriceUpgradeInstances")
- return
-}
-
-func NewInquiryPriceUpgradeInstancesResponse() (response *InquiryPriceUpgradeInstancesResponse) {
- response = &InquiryPriceUpgradeInstancesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(InquiryPriceUpgradeInstances)用于查询云数据库实例升级的价格,支持查询按量计费或者包年包月实例的升级价格,实例类型支持主实例、灾备实例和只读实例。
-func (c *Client) InquiryPriceUpgradeInstances(request *InquiryPriceUpgradeInstancesRequest) (response *InquiryPriceUpgradeInstancesResponse, err error) {
- if request == nil {
- request = NewInquiryPriceUpgradeInstancesRequest()
- }
- response = NewInquiryPriceUpgradeInstancesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewIsolateDBInstanceRequest() (request *IsolateDBInstanceRequest) {
- request = &IsolateDBInstanceRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "IsolateDBInstance")
- return
-}
-
-func NewIsolateDBInstanceResponse() (response *IsolateDBInstanceResponse) {
- response = &IsolateDBInstanceResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(IsolateDBInstance)用于销毁云数据库实例,销毁之后不能通过IP和端口访问数据库,按量计费实例销毁后直接下线。
-func (c *Client) IsolateDBInstance(request *IsolateDBInstanceRequest) (response *IsolateDBInstanceResponse, err error) {
- if request == nil {
- request = NewIsolateDBInstanceRequest()
- }
- response = NewIsolateDBInstanceResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyAccountDescriptionRequest() (request *ModifyAccountDescriptionRequest) {
- request = &ModifyAccountDescriptionRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "ModifyAccountDescription")
- return
-}
-
-func NewModifyAccountDescriptionResponse() (response *ModifyAccountDescriptionResponse) {
- response = &ModifyAccountDescriptionResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyAccountDescription)用于修改云数据库账户的备注信息。
-func (c *Client) ModifyAccountDescription(request *ModifyAccountDescriptionRequest) (response *ModifyAccountDescriptionResponse, err error) {
- if request == nil {
- request = NewModifyAccountDescriptionRequest()
- }
- response = NewModifyAccountDescriptionResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyAccountPasswordRequest() (request *ModifyAccountPasswordRequest) {
- request = &ModifyAccountPasswordRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "ModifyAccountPassword")
- return
-}
-
-func NewModifyAccountPasswordResponse() (response *ModifyAccountPasswordResponse) {
- response = &ModifyAccountPasswordResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyAccountPassword)用于修改云数据库账户的密码。
-func (c *Client) ModifyAccountPassword(request *ModifyAccountPasswordRequest) (response *ModifyAccountPasswordResponse, err error) {
- if request == nil {
- request = NewModifyAccountPasswordRequest()
- }
- response = NewModifyAccountPasswordResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyAccountPrivilegesRequest() (request *ModifyAccountPrivilegesRequest) {
- request = &ModifyAccountPrivilegesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "ModifyAccountPrivileges")
- return
-}
-
-func NewModifyAccountPrivilegesResponse() (response *ModifyAccountPrivilegesResponse) {
- response = &ModifyAccountPrivilegesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyAccountPrivileges)用于修改云数据库的账户的权限信息。
-func (c *Client) ModifyAccountPrivileges(request *ModifyAccountPrivilegesRequest) (response *ModifyAccountPrivilegesResponse, err error) {
- if request == nil {
- request = NewModifyAccountPrivilegesRequest()
- }
- response = NewModifyAccountPrivilegesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyAutoRenewFlagRequest() (request *ModifyAutoRenewFlagRequest) {
- request = &ModifyAutoRenewFlagRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "ModifyAutoRenewFlag")
- return
-}
-
-func NewModifyAutoRenewFlagResponse() (response *ModifyAutoRenewFlagResponse) {
- response = &ModifyAutoRenewFlagResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyAutoRenewFlag)用于修改云数据库实例的自动续费标记。仅支持包年包月的实例设置自动续费标记。
-func (c *Client) ModifyAutoRenewFlag(request *ModifyAutoRenewFlagRequest) (response *ModifyAutoRenewFlagResponse, err error) {
- if request == nil {
- request = NewModifyAutoRenewFlagRequest()
- }
- response = NewModifyAutoRenewFlagResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyBackupConfigRequest() (request *ModifyBackupConfigRequest) {
- request = &ModifyBackupConfigRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "ModifyBackupConfig")
- return
-}
-
-func NewModifyBackupConfigResponse() (response *ModifyBackupConfigResponse) {
- response = &ModifyBackupConfigResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyBackupConfig)用于修改数据库备份配置信息。
-func (c *Client) ModifyBackupConfig(request *ModifyBackupConfigRequest) (response *ModifyBackupConfigResponse, err error) {
- if request == nil {
- request = NewModifyBackupConfigRequest()
- }
- response = NewModifyBackupConfigResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyDBInstanceNameRequest() (request *ModifyDBInstanceNameRequest) {
- request = &ModifyDBInstanceNameRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "ModifyDBInstanceName")
- return
-}
-
-func NewModifyDBInstanceNameResponse() (response *ModifyDBInstanceNameResponse) {
- response = &ModifyDBInstanceNameResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyDBInstanceName)用于修改云数据库实例的名称。
-func (c *Client) ModifyDBInstanceName(request *ModifyDBInstanceNameRequest) (response *ModifyDBInstanceNameResponse, err error) {
- if request == nil {
- request = NewModifyDBInstanceNameRequest()
- }
- response = NewModifyDBInstanceNameResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyDBInstanceProjectRequest() (request *ModifyDBInstanceProjectRequest) {
- request = &ModifyDBInstanceProjectRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "ModifyDBInstanceProject")
- return
-}
-
-func NewModifyDBInstanceProjectResponse() (response *ModifyDBInstanceProjectResponse) {
- response = &ModifyDBInstanceProjectResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyDBInstanceProject)用于修改云数据库实例的所属项目。
-func (c *Client) ModifyDBInstanceProject(request *ModifyDBInstanceProjectRequest) (response *ModifyDBInstanceProjectResponse, err error) {
- if request == nil {
- request = NewModifyDBInstanceProjectRequest()
- }
- response = NewModifyDBInstanceProjectResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyDBInstanceSecurityGroupsRequest() (request *ModifyDBInstanceSecurityGroupsRequest) {
- request = &ModifyDBInstanceSecurityGroupsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "ModifyDBInstanceSecurityGroups")
- return
-}
-
-func NewModifyDBInstanceSecurityGroupsResponse() (response *ModifyDBInstanceSecurityGroupsResponse) {
- response = &ModifyDBInstanceSecurityGroupsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyDBInstanceSecurityGroups)用于修改实例绑定的安全组。
-func (c *Client) ModifyDBInstanceSecurityGroups(request *ModifyDBInstanceSecurityGroupsRequest) (response *ModifyDBInstanceSecurityGroupsResponse, err error) {
- if request == nil {
- request = NewModifyDBInstanceSecurityGroupsRequest()
- }
- response = NewModifyDBInstanceSecurityGroupsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyDBInstanceVipVportRequest() (request *ModifyDBInstanceVipVportRequest) {
- request = &ModifyDBInstanceVipVportRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "ModifyDBInstanceVipVport")
- return
-}
-
-func NewModifyDBInstanceVipVportResponse() (response *ModifyDBInstanceVipVportResponse) {
- response = &ModifyDBInstanceVipVportResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyDBInstanceVipVport)用于修改云数据库实例的IP和端口号,也可进行基础网络转 VPC 网络和 VPC 网络下的子网变更。
-func (c *Client) ModifyDBInstanceVipVport(request *ModifyDBInstanceVipVportRequest) (response *ModifyDBInstanceVipVportResponse, err error) {
- if request == nil {
- request = NewModifyDBInstanceVipVportRequest()
- }
- response = NewModifyDBInstanceVipVportResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyInstanceParamRequest() (request *ModifyInstanceParamRequest) {
- request = &ModifyInstanceParamRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "ModifyInstanceParam")
- return
-}
-
-func NewModifyInstanceParamResponse() (response *ModifyInstanceParamResponse) {
- response = &ModifyInstanceParamResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyInstanceParam)用于修改云数据库实例的参数。
-func (c *Client) ModifyInstanceParam(request *ModifyInstanceParamRequest) (response *ModifyInstanceParamResponse, err error) {
- if request == nil {
- request = NewModifyInstanceParamRequest()
- }
- response = NewModifyInstanceParamResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyInstanceTagRequest() (request *ModifyInstanceTagRequest) {
- request = &ModifyInstanceTagRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "ModifyInstanceTag")
- return
-}
-
-func NewModifyInstanceTagResponse() (response *ModifyInstanceTagResponse) {
- response = &ModifyInstanceTagResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyInstanceTag)用于对实例标签进行添加、修改或者删除。
-func (c *Client) ModifyInstanceTag(request *ModifyInstanceTagRequest) (response *ModifyInstanceTagResponse, err error) {
- if request == nil {
- request = NewModifyInstanceTagRequest()
- }
- response = NewModifyInstanceTagResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyParamTemplateRequest() (request *ModifyParamTemplateRequest) {
- request = &ModifyParamTemplateRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "ModifyParamTemplate")
- return
-}
-
-func NewModifyParamTemplateResponse() (response *ModifyParamTemplateResponse) {
- response = &ModifyParamTemplateResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 该接口(ModifyParamTemplate)用于修改参数模板。
-func (c *Client) ModifyParamTemplate(request *ModifyParamTemplateRequest) (response *ModifyParamTemplateResponse, err error) {
- if request == nil {
- request = NewModifyParamTemplateRequest()
- }
- response = NewModifyParamTemplateResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyTimeWindowRequest() (request *ModifyTimeWindowRequest) {
- request = &ModifyTimeWindowRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "ModifyTimeWindow")
- return
-}
-
-func NewModifyTimeWindowResponse() (response *ModifyTimeWindowResponse) {
- response = &ModifyTimeWindowResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyTimeWindow)用于更新云数据库实例的维护时间窗口。
-func (c *Client) ModifyTimeWindow(request *ModifyTimeWindowRequest) (response *ModifyTimeWindowResponse, err error) {
- if request == nil {
- request = NewModifyTimeWindowRequest()
- }
- response = NewModifyTimeWindowResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewOpenDBInstanceGTIDRequest() (request *OpenDBInstanceGTIDRequest) {
- request = &OpenDBInstanceGTIDRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "OpenDBInstanceGTID")
- return
-}
-
-func NewOpenDBInstanceGTIDResponse() (response *OpenDBInstanceGTIDResponse) {
- response = &OpenDBInstanceGTIDResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(OpenDBInstanceGTID)用于开启云数据库实例的 GTID,只支持版本为 5.6 以及以上的实例。
-func (c *Client) OpenDBInstanceGTID(request *OpenDBInstanceGTIDRequest) (response *OpenDBInstanceGTIDResponse, err error) {
- if request == nil {
- request = NewOpenDBInstanceGTIDRequest()
- }
- response = NewOpenDBInstanceGTIDResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewOpenWanServiceRequest() (request *OpenWanServiceRequest) {
- request = &OpenWanServiceRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "OpenWanService")
- return
-}
-
-func NewOpenWanServiceResponse() (response *OpenWanServiceResponse) {
- response = &OpenWanServiceResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(OpenWanService)用于开通实例外网访问。
-//
-// 注意,实例开通外网访问之前,需要先将实例进行 [实例初始化](https://cloud.tencent.com/document/api/236/15873) 操作。
-func (c *Client) OpenWanService(request *OpenWanServiceRequest) (response *OpenWanServiceResponse, err error) {
- if request == nil {
- request = NewOpenWanServiceRequest()
- }
- response = NewOpenWanServiceResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewRenewDBInstanceRequest() (request *RenewDBInstanceRequest) {
- request = &RenewDBInstanceRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "RenewDBInstance")
- return
-}
-
-func NewRenewDBInstanceResponse() (response *RenewDBInstanceResponse) {
- response = &RenewDBInstanceResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(RenewDBInstance)用于续费云数据库实例,仅支持付费模式为包年包月的实例。按量计费实例不需要续费。
-func (c *Client) RenewDBInstance(request *RenewDBInstanceRequest) (response *RenewDBInstanceResponse, err error) {
- if request == nil {
- request = NewRenewDBInstanceRequest()
- }
- response = NewRenewDBInstanceResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewRestartDBInstancesRequest() (request *RestartDBInstancesRequest) {
- request = &RestartDBInstancesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "RestartDBInstances")
- return
-}
-
-func NewRestartDBInstancesResponse() (response *RestartDBInstancesResponse) {
- response = &RestartDBInstancesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(RestartDBInstances)用于重启云数据库实例。
-//
-// 注意:
-// 1、本接口只支持主实例进行重启操作;
-// 2、实例状态必须为正常,并且没有其他异步任务在执行中。
-func (c *Client) RestartDBInstances(request *RestartDBInstancesRequest) (response *RestartDBInstancesResponse, err error) {
- if request == nil {
- request = NewRestartDBInstancesRequest()
- }
- response = NewRestartDBInstancesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewStartBatchRollbackRequest() (request *StartBatchRollbackRequest) {
- request = &StartBatchRollbackRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "StartBatchRollback")
- return
-}
-
-func NewStartBatchRollbackResponse() (response *StartBatchRollbackResponse) {
- response = &StartBatchRollbackResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 该接口(StartBatchRollback)用于批量回档云数据库实例的库表。
-func (c *Client) StartBatchRollback(request *StartBatchRollbackRequest) (response *StartBatchRollbackResponse, err error) {
- if request == nil {
- request = NewStartBatchRollbackRequest()
- }
- response = NewStartBatchRollbackResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewStopDBImportJobRequest() (request *StopDBImportJobRequest) {
- request = &StopDBImportJobRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "StopDBImportJob")
- return
-}
-
-func NewStopDBImportJobResponse() (response *StopDBImportJobResponse) {
- response = &StopDBImportJobResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(StopDBImportJob)用于终止数据导入任务。
-func (c *Client) StopDBImportJob(request *StopDBImportJobRequest) (response *StopDBImportJobResponse, err error) {
- if request == nil {
- request = NewStopDBImportJobRequest()
- }
- response = NewStopDBImportJobResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewSwitchForUpgradeRequest() (request *SwitchForUpgradeRequest) {
- request = &SwitchForUpgradeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "SwitchForUpgrade")
- return
-}
-
-func NewSwitchForUpgradeResponse() (response *SwitchForUpgradeResponse) {
- response = &SwitchForUpgradeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(SwitchForUpgrade)用于切换访问新实例,针对主升级中的实例处于待切换状态时,用户可主动发起该流程。
-func (c *Client) SwitchForUpgrade(request *SwitchForUpgradeRequest) (response *SwitchForUpgradeResponse, err error) {
- if request == nil {
- request = NewSwitchForUpgradeRequest()
- }
- response = NewSwitchForUpgradeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewUpgradeDBInstanceRequest() (request *UpgradeDBInstanceRequest) {
- request = &UpgradeDBInstanceRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "UpgradeDBInstance")
- return
-}
-
-func NewUpgradeDBInstanceResponse() (response *UpgradeDBInstanceResponse) {
- response = &UpgradeDBInstanceResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(UpgradeDBInstance)用于升级云数据库实例,实例类型支持主实例、灾备实例和只读实例。
-func (c *Client) UpgradeDBInstance(request *UpgradeDBInstanceRequest) (response *UpgradeDBInstanceResponse, err error) {
- if request == nil {
- request = NewUpgradeDBInstanceRequest()
- }
- response = NewUpgradeDBInstanceResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewUpgradeDBInstanceEngineVersionRequest() (request *UpgradeDBInstanceEngineVersionRequest) {
- request = &UpgradeDBInstanceEngineVersionRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "UpgradeDBInstanceEngineVersion")
- return
-}
-
-func NewUpgradeDBInstanceEngineVersionResponse() (response *UpgradeDBInstanceEngineVersionResponse) {
- response = &UpgradeDBInstanceEngineVersionResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(UpgradeDBInstanceEngineVersion)用于升级云数据库实例版本,实例类型支持主实例、灾备实例和只读实例。
-func (c *Client) UpgradeDBInstanceEngineVersion(request *UpgradeDBInstanceEngineVersionRequest) (response *UpgradeDBInstanceEngineVersionResponse, err error) {
- if request == nil {
- request = NewUpgradeDBInstanceEngineVersionRequest()
- }
- response = NewUpgradeDBInstanceEngineVersionResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewVerifyRootAccountRequest() (request *VerifyRootAccountRequest) {
- request = &VerifyRootAccountRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cdb", APIVersion, "VerifyRootAccount")
- return
-}
-
-func NewVerifyRootAccountResponse() (response *VerifyRootAccountResponse) {
- response = &VerifyRootAccountResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(VerifyRootAccount)用于校验云数据库实例的 ROOT 账号是否有足够的权限进行授权操作。
-func (c *Client) VerifyRootAccount(request *VerifyRootAccountRequest) (response *VerifyRootAccountResponse, err error) {
- if request == nil {
- request = NewVerifyRootAccountRequest()
- }
- response = NewVerifyRootAccountResponse()
- err = c.Send(request, response)
- return
-}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdb/v20170320/models.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdb/v20170320/models.go
deleted file mode 100644
index 263e298..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdb/v20170320/models.go
+++ /dev/null
@@ -1,4513 +0,0 @@
-// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package v20170320
-
-import (
- "encoding/json"
-
- tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http"
-)
-
-type Account struct {
-
- // 新账户的名称
- User *string `json:"User,omitempty" name:"User"`
-
- // 新账户的域名
- Host *string `json:"Host,omitempty" name:"Host"`
-}
-
-type AccountInfo struct {
-
- // 账号备注信息
- Notes *string `json:"Notes,omitempty" name:"Notes"`
-
- // 账号的域名
- Host *string `json:"Host,omitempty" name:"Host"`
-
- // 账号的名称
- User *string `json:"User,omitempty" name:"User"`
-
- // 账号信息修改时间
- ModifyTime *string `json:"ModifyTime,omitempty" name:"ModifyTime"`
-
- // 修改密码的时间
- ModifyPasswordTime *string `json:"ModifyPasswordTime,omitempty" name:"ModifyPasswordTime"`
-
- // 账号的创建时间
- CreateTime *string `json:"CreateTime,omitempty" name:"CreateTime"`
-}
-
-type AddTimeWindowRequest struct {
- *tchttp.BaseRequest
-
- // 实例ID,格式如:cdb-c1nl9rpv 或者 cdbro-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 星期一的可维护时间段,其中每一个时间段的格式形如:10:00-12:00;起始时间按半个小时对齐;最短半个小时,最长三个小时;最多设置两个时间段;下同。
- Monday []*string `json:"Monday,omitempty" name:"Monday" list`
-
- // 星期二的可维护时间窗口。
- Tuesday []*string `json:"Tuesday,omitempty" name:"Tuesday" list`
-
- // 星期三的可维护时间窗口。
- Wednesday []*string `json:"Wednesday,omitempty" name:"Wednesday" list`
-
- // 星期四的可维护时间窗口。
- Thursday []*string `json:"Thursday,omitempty" name:"Thursday" list`
-
- // 星期五的可维护时间窗口。
- Friday []*string `json:"Friday,omitempty" name:"Friday" list`
-
- // 星期六的可维护时间窗口。
- Saturday []*string `json:"Saturday,omitempty" name:"Saturday" list`
-
- // 星期日的可维护时间窗口。
- Sunday []*string `json:"Sunday,omitempty" name:"Sunday" list`
-}
-
-func (r *AddTimeWindowRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AddTimeWindowRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AddTimeWindowResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *AddTimeWindowResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AddTimeWindowResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AssociateSecurityGroupsRequest struct {
- *tchttp.BaseRequest
-
- // 安全组 ID。
- SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"`
-
- // 实例 ID 列表,一个或者多个实例 ID 组成的数组。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-}
-
-func (r *AssociateSecurityGroupsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AssociateSecurityGroupsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AssociateSecurityGroupsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *AssociateSecurityGroupsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AssociateSecurityGroupsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type BackupConfig struct {
-
- // 第二个从库复制方式,可能的返回值:async-异步,semisync-半同步
- ReplicationMode *string `json:"ReplicationMode,omitempty" name:"ReplicationMode"`
-
- // 第二个从库可用区的正式名称,如ap-shanghai-1
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-
- // 第二个从库内网IP地址
- Vip *string `json:"Vip,omitempty" name:"Vip"`
-
- // 第二个从库访问端口
- Vport *uint64 `json:"Vport,omitempty" name:"Vport"`
-}
-
-type BackupInfo struct {
-
- // 备份文件名
- Name *string `json:"Name,omitempty" name:"Name"`
-
- // 备份文件大小,单位:Byte
- Size *int64 `json:"Size,omitempty" name:"Size"`
-
- // 备份快照时间,时间格式:2016-03-17 02:10:37
- Date *string `json:"Date,omitempty" name:"Date"`
-
- // 内网下载地址
- IntranetUrl *string `json:"IntranetUrl,omitempty" name:"IntranetUrl"`
-
- // 外网下载地址
- InternetUrl *string `json:"InternetUrl,omitempty" name:"InternetUrl"`
-
- // 日志具体类型,可能的值有:logic - 逻辑冷备,physical - 物理冷备
- Type *string `json:"Type,omitempty" name:"Type"`
-
- // 备份子任务的ID,删除备份文件时使用
- BackupId *int64 `json:"BackupId,omitempty" name:"BackupId"`
-
- // 备份任务状态
- Status *string `json:"Status,omitempty" name:"Status"`
-
- // 备份任务的完成时间
- FinishTime *string `json:"FinishTime,omitempty" name:"FinishTime"`
-
- // 备份的创建者,可能的值:SYSTEM - 系统创建,Uin - 发起者Uin值
- Creator *string `json:"Creator,omitempty" name:"Creator"`
-}
-
-type BackupItem struct {
-
- // 需要备份的库名
- Db *string `json:"Db,omitempty" name:"Db"`
-
- // 需要备份的表名。 如果传该参数,表示备份该库中的指定表。如果不传该参数则备份该db库
- Table *string `json:"Table,omitempty" name:"Table"`
-}
-
-type BinlogInfo struct {
-
- // 备份文件名
- Name *string `json:"Name,omitempty" name:"Name"`
-
- // 备份文件大小,单位:Byte
- Size *int64 `json:"Size,omitempty" name:"Size"`
-
- // 备份快照时间,时间格式:2016-03-17 02:10:37
- Date *string `json:"Date,omitempty" name:"Date"`
-
- // 内网下载地址
- IntranetUrl *string `json:"IntranetUrl,omitempty" name:"IntranetUrl"`
-
- // 外网下载地址
- InternetUrl *string `json:"InternetUrl,omitempty" name:"InternetUrl"`
-
- // 日志具体类型,可能的值有:binlog - 二进制日志
- Type *string `json:"Type,omitempty" name:"Type"`
-}
-
-type CloseWanServiceRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同,可使用 [查询实例列表](https://cloud.tencent.com/document/api/236/15872) 接口获取,其值为输出参数中字段 InstanceId 的值。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *CloseWanServiceRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CloseWanServiceRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CloseWanServiceResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 异步任务的请求 ID,可使用此 ID 查询异步任务的执行结果。
- AsyncRequestId *string `json:"AsyncRequestId,omitempty" name:"AsyncRequestId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CloseWanServiceResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CloseWanServiceResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ColumnPrivilege struct {
-
- // 数据库名
- Database *string `json:"Database,omitempty" name:"Database"`
-
- // 数据库表名
- Table *string `json:"Table,omitempty" name:"Table"`
-
- // 数据库列名
- Column *string `json:"Column,omitempty" name:"Column"`
-
- // 权限信息
- Privileges []*string `json:"Privileges,omitempty" name:"Privileges" list`
-}
-
-type CreateAccountsRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 云数据库账号。
- Accounts []*Account `json:"Accounts,omitempty" name:"Accounts" list`
-
- // 新账户的密码。
- Password *string `json:"Password,omitempty" name:"Password"`
-
- // 备注信息。
- Description *string `json:"Description,omitempty" name:"Description"`
-}
-
-func (r *CreateAccountsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateAccountsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateAccountsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 异步任务的请求 ID,可使用此 ID 查询异步任务的执行结果。
- AsyncRequestId *string `json:"AsyncRequestId,omitempty" name:"AsyncRequestId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateAccountsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateAccountsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateBackupRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv。与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 目标备份方法,可选的值:logical - 逻辑冷备,physical - 物理冷备。
- BackupMethod *string `json:"BackupMethod,omitempty" name:"BackupMethod"`
-
- // 需要备份的库表信息,如果不设置该参数,则默认整实例备份。在 BackupMethod=logical 逻辑备份中才可设置该参数。指定的库表必须存在,否则可能导致备份失败。
- // 例:如果需要备份 db1 库的 tb1、tb2 表 和 db2 库。则该参数设置为 [{"Db": "db1", "Table": "tb1"}, {"Db": "db1", "Table": "tb2"}, {"Db": "db2"} ]。
- BackupDBTableList []*BackupItem `json:"BackupDBTableList,omitempty" name:"BackupDBTableList" list`
-}
-
-func (r *CreateBackupRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateBackupRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateBackupResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 备份任务 ID。
- BackupId *uint64 `json:"BackupId,omitempty" name:"BackupId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateBackupResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateBackupResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateDBImportJobRequest struct {
- *tchttp.BaseRequest
-
- // 实例的 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 文件名称。该文件是指用户已上传到腾讯云的文件。
- FileName *string `json:"FileName,omitempty" name:"FileName"`
-
- // 云数据库的用户名。
- User *string `json:"User,omitempty" name:"User"`
-
- // 云数据库实例 User 账号的密码。
- Password *string `json:"Password,omitempty" name:"Password"`
-
- // 导入的目标数据库名,不传表示不指定数据库。
- DbName *string `json:"DbName,omitempty" name:"DbName"`
-}
-
-func (r *CreateDBImportJobRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateDBImportJobRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateDBImportJobResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 异步任务的请求 ID,可使用此 ID 查询异步任务的执行结果。
- AsyncRequestId *string `json:"AsyncRequestId,omitempty" name:"AsyncRequestId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateDBImportJobResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateDBImportJobResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateDBInstanceHourRequest struct {
- *tchttp.BaseRequest
-
- // 实例数量,默认值为 1,最小值 1,最大值为 100。
- GoodsNum *int64 `json:"GoodsNum,omitempty" name:"GoodsNum"`
-
- // 实例内存大小,单位:MB,请使用 [获取云数据库可售卖规格](https://cloud.tencent.com/document/api/236/17229) 接口获取可创建的内存规格。
- Memory *int64 `json:"Memory,omitempty" name:"Memory"`
-
- // 实例硬盘大小,单位:GB,请使用 [获取云数据库可售卖规格](https://cloud.tencent.com/document/api/236/17229) 接口获取可创建的硬盘范围。
- Volume *int64 `json:"Volume,omitempty" name:"Volume"`
-
- // MySQL 版本,值包括:5.5、5.6 和 5.7,请使用 [获取云数据库可售卖规格](https://cloud.tencent.com/document/api/236/17229) 接口获取可创建的实例版本。
- EngineVersion *string `json:"EngineVersion,omitempty" name:"EngineVersion"`
-
- // 私有网络 ID,如果不传则默认选择基础网络,请使用 [查询私有网络列表](/document/api/215/15778) 。
- UniqVpcId *string `json:"UniqVpcId,omitempty" name:"UniqVpcId"`
-
- // 私有网络下的子网 ID,如果设置了 UniqVpcId,则 UniqSubnetId 必填,请使用[查询子网列表](/document/api/215/15784)。
- UniqSubnetId *string `json:"UniqSubnetId,omitempty" name:"UniqSubnetId"`
-
- // 项目 ID,不填为默认项目。请使用 [查询项目列表](https://cloud.tencent.com/document/product/378/4400) 接口获取项目 ID。
- ProjectId *int64 `json:"ProjectId,omitempty" name:"ProjectId"`
-
- // 可用区信息,该参数缺省时,系统会自动选择一个可用区,请使用 [获取云数据库可售卖规格](https://cloud.tencent.com/document/api/236/17229) 接口获取可创建的可用区。
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-
- // 实例 ID,购买只读实例或者灾备实例时必填,该字段表示只读实例或者灾备实例的主实例 ID,请使用 [查询实例列表](https://cloud.tencent.com/document/api/236/15872) 接口查询云数据库实例 ID。
- MasterInstanceId *string `json:"MasterInstanceId,omitempty" name:"MasterInstanceId"`
-
- // 实例类型,默认为 master,支持值包括:master - 表示主实例,dr - 表示灾备实例,ro - 表示只读实例。
- InstanceRole *string `json:"InstanceRole,omitempty" name:"InstanceRole"`
-
- // 主实例的可用区信息,购买灾备实例时必填。
- MasterRegion *string `json:"MasterRegion,omitempty" name:"MasterRegion"`
-
- // 自定义端口,端口支持范围:[ 1024-65535 ] 。
- Port *int64 `json:"Port,omitempty" name:"Port"`
-
- // 设置 root 帐号密码,密码规则:8 - 64 个字符,至少包含字母、数字、字符(支持的字符:_+-&=!@#$%^*())中的两种,购买主实例时可指定该参数,购买只读实例或者灾备实例时指定该参数无意义。
- Password *string `json:"Password,omitempty" name:"Password"`
-
- // 参数列表,参数格式如 ParamList.0.Name=auto_increment&ParamList.0.Value=1。可通过 [查询默认的可设置参数列表](https://cloud.tencent.com/document/api/236/32662) 查询支持设置的参数。
- ParamList []*ParamInfo `json:"ParamList,omitempty" name:"ParamList" list`
-
- // 数据复制方式,默认为 0,支持值包括:0 - 表示异步复制,1 - 表示半同步复制,2 - 表示强同步复制,购买主实例时可指定该参数,购买只读实例或者灾备实例时指定该参数无意义。
- ProtectMode *int64 `json:"ProtectMode,omitempty" name:"ProtectMode"`
-
- // 多可用区域,默认为 0,支持值包括:0 - 表示单可用区,1 - 表示多可用区,购买主实例时可指定该参数,购买只读实例或者灾备实例时指定该参数无意义。
- DeployMode *int64 `json:"DeployMode,omitempty" name:"DeployMode"`
-
- // 备库 1 的可用区信息,默认为 Zone 的值,购买主实例时可指定该参数,购买只读实例或者灾备实例时指定该参数无意义。
- SlaveZone *string `json:"SlaveZone,omitempty" name:"SlaveZone"`
-
- // 备库 2 的可用区信息,默认为空,购买强同步主实例时可指定该参数,购买其他类型实例时指定该参数无意义。
- BackupZone *string `json:"BackupZone,omitempty" name:"BackupZone"`
-
- // 安全组参数,可使用 [查询项目安全组信息](https://cloud.tencent.com/document/api/236/15850) 接口查询某个项目的安全组详情。
- SecurityGroup []*string `json:"SecurityGroup,omitempty" name:"SecurityGroup" list`
-
- // 只读实例信息。购买只读实例时,该参数必传。
- RoGroup *RoGroup `json:"RoGroup,omitempty" name:"RoGroup"`
-
- // 购买按量计费实例该字段无意义。
- AutoRenewFlag *int64 `json:"AutoRenewFlag,omitempty" name:"AutoRenewFlag"`
-
- // 实例名称。
- InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"`
-
- // 实例标签信息。
- ResourceTags []*TagInfo `json:"ResourceTags,omitempty" name:"ResourceTags" list`
-}
-
-func (r *CreateDBInstanceHourRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateDBInstanceHourRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateDBInstanceHourResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 短订单 ID。
- DealIds []*string `json:"DealIds,omitempty" name:"DealIds" list`
-
- // 实例 ID 列表。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateDBInstanceHourResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateDBInstanceHourResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateDBInstanceRequest struct {
- *tchttp.BaseRequest
-
- // 实例内存大小,单位:MB,请使用 [获取云数据库可售卖规格](https://cloud.tencent.com/document/api/236/17229) 接口获取可创建的内存规格。
- Memory *int64 `json:"Memory,omitempty" name:"Memory"`
-
- // 实例硬盘大小,单位:GB,请使用 [获取云数据库可售卖规格](https://cloud.tencent.com/document/api/236/17229) 接口获取可创建的硬盘范围。
- Volume *int64 `json:"Volume,omitempty" name:"Volume"`
-
- // 实例时长,单位:月,可选值包括 [1,2,3,4,5,6,7,8,9,10,11,12,24,36]。
- Period *int64 `json:"Period,omitempty" name:"Period"`
-
- // 实例数量,默认值为1, 最小值1,最大值为100。
- GoodsNum *int64 `json:"GoodsNum,omitempty" name:"GoodsNum"`
-
- // 可用区信息,该参数缺省时,系统会自动选择一个可用区,请使用 [获取云数据库可售卖规格](https://cloud.tencent.com/document/api/236/17229) 接口获取可创建的可用区。
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-
- // 私有网络 ID,如果不传则默认选择基础网络,请使用 [查询私有网络列表](/document/api/215/15778) 。
- UniqVpcId *string `json:"UniqVpcId,omitempty" name:"UniqVpcId"`
-
- // 私有网络下的子网 ID,如果设置了 UniqVpcId,则 UniqSubnetId 必填,请使用 [查询子网列表](/document/api/215/15784)。
- UniqSubnetId *string `json:"UniqSubnetId,omitempty" name:"UniqSubnetId"`
-
- // 项目 ID,不填为默认项目。请使用 [查询项目列表](https://cloud.tencent.com/document/product/378/4400) 接口获取项目 ID。购买只读实例和灾备实例时,项目 ID 默认和主实例保持一致。
- ProjectId *int64 `json:"ProjectId,omitempty" name:"ProjectId"`
-
- // 自定义端口,端口支持范围:[ 1024-65535 ]。
- Port *int64 `json:"Port,omitempty" name:"Port"`
-
- // 实例类型,默认为 master,支持值包括:master - 表示主实例,dr - 表示灾备实例,ro - 表示只读实例。
- InstanceRole *string `json:"InstanceRole,omitempty" name:"InstanceRole"`
-
- // 实例 ID,购买只读实例时必填,该字段表示只读实例的主实例ID,请使用 [查询实例列表](https://cloud.tencent.com/document/api/236/15872) 接口查询云数据库实例 ID。
- MasterInstanceId *string `json:"MasterInstanceId,omitempty" name:"MasterInstanceId"`
-
- // MySQL 版本,值包括:5.5、5.6 和 5.7,请使用 [获取云数据库可售卖规格](https://cloud.tencent.com/document/api/236/17229) 接口获取可创建的实例版本。
- EngineVersion *string `json:"EngineVersion,omitempty" name:"EngineVersion"`
-
- // 设置 root 帐号密码,密码规则:8 - 64 个字符,至少包含字母、数字、字符(支持的字符:_+-&=!@#$%^*())中的两种,购买主实例时可指定该参数,购买只读实例或者灾备实例时指定该参数无意义。
- Password *string `json:"Password,omitempty" name:"Password"`
-
- // 数据复制方式,默认为 0,支持值包括:0 - 表示异步复制,1 - 表示半同步复制,2 - 表示强同步复制。
- ProtectMode *int64 `json:"ProtectMode,omitempty" name:"ProtectMode"`
-
- // 多可用区域,默认为 0,支持值包括:0 - 表示单可用区,1 - 表示多可用区。
- DeployMode *int64 `json:"DeployMode,omitempty" name:"DeployMode"`
-
- // 备库 1 的可用区信息,默认为 Zone 的值。
- SlaveZone *string `json:"SlaveZone,omitempty" name:"SlaveZone"`
-
- // 参数列表,参数格式如 ParamList.0.Name=auto_increment&ParamList.0.Value=1。可通过 [查询默认的可设置参数列表](https://cloud.tencent.com/document/api/236/32662) 查询支持设置的参数。
- ParamList []*ParamInfo `json:"ParamList,omitempty" name:"ParamList" list`
-
- // 备库 2 的可用区信息,默认为空,购买强同步主实例时可指定该参数,购买其他类型实例时指定该参数无意义。
- BackupZone *string `json:"BackupZone,omitempty" name:"BackupZone"`
-
- // 自动续费标记,可选值为:0 - 不自动续费;1 - 自动续费。
- AutoRenewFlag *int64 `json:"AutoRenewFlag,omitempty" name:"AutoRenewFlag"`
-
- // 主实例地域信息,购买灾备实例时,该字段必填。
- MasterRegion *string `json:"MasterRegion,omitempty" name:"MasterRegion"`
-
- // 安全组参数,可使用 [查询项目安全组信息](https://cloud.tencent.com/document/api/236/15850) 接口查询某个项目的安全组详情。
- SecurityGroup []*string `json:"SecurityGroup,omitempty" name:"SecurityGroup" list`
-
- // 只读实例参数。购买只读实例时,该参数必传。
- RoGroup *RoGroup `json:"RoGroup,omitempty" name:"RoGroup"`
-
- // 实例名称。
- InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"`
-
- // 实例标签信息。
- ResourceTags []*TagInfo `json:"ResourceTags,omitempty" name:"ResourceTags" list`
-}
-
-func (r *CreateDBInstanceRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateDBInstanceRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateDBInstanceResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 短订单 ID。
- DealIds []*string `json:"DealIds,omitempty" name:"DealIds" list`
-
- // 实例 ID 列表。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateDBInstanceResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateDBInstanceResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateParamTemplateRequest struct {
- *tchttp.BaseRequest
-
- // 参数模板名称。
- Name *string `json:"Name,omitempty" name:"Name"`
-
- // 参数模板描述。
- Description *string `json:"Description,omitempty" name:"Description"`
-
- // mysql版本。
- EngineVersion *string `json:"EngineVersion,omitempty" name:"EngineVersion"`
-
- // 源参数模板ID。
- TemplateId *int64 `json:"TemplateId,omitempty" name:"TemplateId"`
-
- // 参数列表。
- ParamList []*Parameter `json:"ParamList,omitempty" name:"ParamList" list`
-}
-
-func (r *CreateParamTemplateRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateParamTemplateRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateParamTemplateResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 参数模板ID。
- TemplateId *int64 `json:"TemplateId,omitempty" name:"TemplateId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateParamTemplateResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateParamTemplateResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DBSwitchInfo struct {
-
- // 切换时间,格式为:2017-09-03 01:34:31
- SwitchTime *string `json:"SwitchTime,omitempty" name:"SwitchTime"`
-
- // 切换类型,可能的返回值为:TRANSFER - 数据迁移;MASTER2SLAVE - 主备切换;RECOVERY - 主从恢复
- SwitchType *string `json:"SwitchType,omitempty" name:"SwitchType"`
-}
-
-type DatabaseName struct {
-
- // 数据库表名
- DatabaseName *string `json:"DatabaseName,omitempty" name:"DatabaseName"`
-}
-
-type DatabasePrivilege struct {
-
- // 权限信息
- Privileges []*string `json:"Privileges,omitempty" name:"Privileges" list`
-
- // 数据库名
- Database *string `json:"Database,omitempty" name:"Database"`
-}
-
-type DeleteAccountsRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 云数据库账号。
- Accounts []*Account `json:"Accounts,omitempty" name:"Accounts" list`
-}
-
-func (r *DeleteAccountsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteAccountsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteAccountsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 异步任务的请求 ID,可使用此 ID 查询异步任务的执行结果。
- AsyncRequestId *string `json:"AsyncRequestId,omitempty" name:"AsyncRequestId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteAccountsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteAccountsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteBackupRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv。与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 备份任务 ID。该任务 ID 为 [创建云数据库备份](https://cloud.tencent.com/document/api/236/15844) 接口返回的任务 ID。
- BackupId *int64 `json:"BackupId,omitempty" name:"BackupId"`
-}
-
-func (r *DeleteBackupRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteBackupRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteBackupResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteBackupResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteBackupResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteParamTemplateRequest struct {
- *tchttp.BaseRequest
-
- // 参数模板ID。
- TemplateId *int64 `json:"TemplateId,omitempty" name:"TemplateId"`
-}
-
-func (r *DeleteParamTemplateRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteParamTemplateRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteParamTemplateResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteParamTemplateResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteParamTemplateResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteTimeWindowRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv 或者 cdbro-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *DeleteTimeWindowRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteTimeWindowRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteTimeWindowResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteTimeWindowResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteTimeWindowResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeAccountPrivilegesRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 数据库的账号名称。
- User *string `json:"User,omitempty" name:"User"`
-
- // 数据库的账号域名。
- Host *string `json:"Host,omitempty" name:"Host"`
-}
-
-func (r *DescribeAccountPrivilegesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeAccountPrivilegesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeAccountPrivilegesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 全局权限数组。
- GlobalPrivileges []*string `json:"GlobalPrivileges,omitempty" name:"GlobalPrivileges" list`
-
- // 数据库权限数组。
- DatabasePrivileges []*DatabasePrivilege `json:"DatabasePrivileges,omitempty" name:"DatabasePrivileges" list`
-
- // 数据库中的表权限数组。
- TablePrivileges []*TablePrivilege `json:"TablePrivileges,omitempty" name:"TablePrivileges" list`
-
- // 数据库表中的列权限数组。
- ColumnPrivileges []*ColumnPrivilege `json:"ColumnPrivileges,omitempty" name:"ColumnPrivileges" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeAccountPrivilegesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeAccountPrivilegesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeAccountsRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 记录偏移量,默认值为0。
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 单次请求返回的数量,默认值为20,最小值为1,最大值为100。
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeAccountsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeAccountsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeAccountsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合查询条件的账号数量。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 符合查询条件的账号详细信息。
- Items []*AccountInfo `json:"Items,omitempty" name:"Items" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeAccountsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeAccountsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeAsyncRequestInfoRequest struct {
- *tchttp.BaseRequest
-
- // 异步任务的请求 ID。
- AsyncRequestId *string `json:"AsyncRequestId,omitempty" name:"AsyncRequestId"`
-}
-
-func (r *DescribeAsyncRequestInfoRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeAsyncRequestInfoRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeAsyncRequestInfoResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 任务执行结果。可能的取值:INITIAL - 初始化,RUNNING - 运行中,SUCCESS - 执行成功,FAILED - 执行失败,KILLED - 已终止,REMOVED - 已删除,PAUSED - 终止中。
- Status *string `json:"Status,omitempty" name:"Status"`
-
- // 任务执行信息描述。
- Info *string `json:"Info,omitempty" name:"Info"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeAsyncRequestInfoResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeAsyncRequestInfoResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeBackupConfigRequest struct {
- *tchttp.BaseRequest
-
- // 实例短实例 ID,格式如:cdb-c1nl9rpv。与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *DescribeBackupConfigRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeBackupConfigRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeBackupConfigResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 备份开始的最早时间点,单位为时刻。例如,2 - 凌晨 2:00。
- StartTimeMin *int64 `json:"StartTimeMin,omitempty" name:"StartTimeMin"`
-
- // 备份开始的最晚时间点,单位为时刻。例如,6 - 凌晨 6:00。
- StartTimeMax *int64 `json:"StartTimeMax,omitempty" name:"StartTimeMax"`
-
- // 备份过期时间,单位为天。
- BackupExpireDays *int64 `json:"BackupExpireDays,omitempty" name:"BackupExpireDays"`
-
- // 备份方式,可能的值为:physical - 物理备份,logical - 逻辑备份。
- BackupMethod *string `json:"BackupMethod,omitempty" name:"BackupMethod"`
-
- // Binlog 过期时间,单位为天。
- BinlogExpireDays *int64 `json:"BinlogExpireDays,omitempty" name:"BinlogExpireDays"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeBackupConfigResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeBackupConfigResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeBackupDatabasesRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv。与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 开始时间,格式为:2017-07-12 10:29:20。
- StartTime *string `json:"StartTime,omitempty" name:"StartTime"`
-
- // 要查询的数据库名前缀。
- SearchDatabase *string `json:"SearchDatabase,omitempty" name:"SearchDatabase"`
-
- // 分页偏移量。
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 分页大小,最小值为1,最大值为2000。
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeBackupDatabasesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeBackupDatabasesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeBackupDatabasesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 返回的数据个数。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 符合查询条件的数据库数组。
- Items []*DatabaseName `json:"Items,omitempty" name:"Items" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeBackupDatabasesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeBackupDatabasesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeBackupTablesRequest struct {
- *tchttp.BaseRequest
-
- // 实例ID,格式如:cdb-c1nl9rpv。与云数据库控制台页面中显示的实例ID相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 开始时间,格式为:2017-07-12 10:29:20。
- StartTime *string `json:"StartTime,omitempty" name:"StartTime"`
-
- // 指定的数据库名。
- DatabaseName *string `json:"DatabaseName,omitempty" name:"DatabaseName"`
-
- // 要查询的数据表名前缀。
- SearchTable *string `json:"SearchTable,omitempty" name:"SearchTable"`
-
- // 分页偏移。
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 分页大小,最小值为1,最大值为2000。
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeBackupTablesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeBackupTablesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeBackupTablesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 返回的数据个数。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 符合条件的数据表数组。
- Items []*TableName `json:"Items,omitempty" name:"Items" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeBackupTablesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeBackupTablesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeBackupsRequest struct {
- *tchttp.BaseRequest
-
- // 实例ID,格式如:cdb-c1nl9rpv。与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 偏移量,最小值为0。
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 分页大小,默认值为20,最小值为1,最大值为100。
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeBackupsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeBackupsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeBackupsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合查询条件的实例总数。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 符合查询条件的备份信息详情。
- Items []*BackupInfo `json:"Items,omitempty" name:"Items" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeBackupsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeBackupsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeBinlogsRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv。与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 偏移量,最小值为0。
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 分页大小,默认值为20,最小值为1,最大值为100。
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeBinlogsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeBinlogsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeBinlogsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合查询条件的日志文件总数。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 符合查询条件的二进制日志文件详情。
- Items []*BinlogInfo `json:"Items,omitempty" name:"Items" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeBinlogsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeBinlogsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDBImportRecordsRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 开始时间,时间格式如:2016-01-01 00:00:01。
- StartTime *string `json:"StartTime,omitempty" name:"StartTime"`
-
- // 结束时间,时间格式如:2016-01-01 23:59:59。
- EndTime *string `json:"EndTime,omitempty" name:"EndTime"`
-
- // 分页参数,偏移量,默认值为0。
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 分页参数,单次请求返回的数量,默认值为20,最小值为1,最大值为100。
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeDBImportRecordsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDBImportRecordsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDBImportRecordsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合查询条件的导入任务操作日志总数。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 返回的导入操作记录列表。
- Items []*ImportRecord `json:"Items,omitempty" name:"Items" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeDBImportRecordsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDBImportRecordsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDBInstanceCharsetRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同,可使用 [查询实例列表](https://cloud.tencent.com/document/api/236/15872) 接口获取,其值为输出参数中字段 InstanceId 的值。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *DescribeDBInstanceCharsetRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDBInstanceCharsetRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDBInstanceCharsetResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 实例的默认字符集,如 "latin1","utf8" 等。
- Charset *string `json:"Charset,omitempty" name:"Charset"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeDBInstanceCharsetResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDBInstanceCharsetResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDBInstanceConfigRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *DescribeDBInstanceConfigRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDBInstanceConfigRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDBInstanceConfigResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 主实例数据保护方式,可能的返回值:0 - 异步复制方式,1 - 半同步复制方式,2 - 强同步复制方式。
- ProtectMode *int64 `json:"ProtectMode,omitempty" name:"ProtectMode"`
-
- // 主实例部署方式,可能的返回值:0 - 单可用部署,1 - 多可用区部署。
- DeployMode *int64 `json:"DeployMode,omitempty" name:"DeployMode"`
-
- // 实例可用区信息,格式如 "ap-shanghai-1"。
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-
- // 备库的配置信息。
- SlaveConfig *SlaveConfig `json:"SlaveConfig,omitempty" name:"SlaveConfig"`
-
- // 强同步实例第二备库的配置信息。
- BackupConfig *BackupConfig `json:"BackupConfig,omitempty" name:"BackupConfig"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeDBInstanceConfigResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDBInstanceConfigResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDBInstanceGTIDRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同,可使用 [查询实例列表](https://cloud.tencent.com/document/api/236/15872) 接口获取,其值为输出参数中字段 InstanceId 的值。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *DescribeDBInstanceGTIDRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDBInstanceGTIDRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDBInstanceGTIDResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // GTID 是否开通的标记,可能的取值为:0 - 未开通,1 - 已开通。
- IsGTIDOpen *int64 `json:"IsGTIDOpen,omitempty" name:"IsGTIDOpen"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeDBInstanceGTIDResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDBInstanceGTIDResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDBInstanceRebootTimeRequest struct {
- *tchttp.BaseRequest
-
- // 实例的 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-}
-
-func (r *DescribeDBInstanceRebootTimeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDBInstanceRebootTimeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDBInstanceRebootTimeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合查询条件的实例总数。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 返回的参数信息。
- Items []*InstanceRebootTime `json:"Items,omitempty" name:"Items" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeDBInstanceRebootTimeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDBInstanceRebootTimeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDBInstancesRequest struct {
- *tchttp.BaseRequest
-
- // 项目 ID,可使用 [查询项目列表](https://cloud.tencent.com/document/product/378/4400) 接口查询项目 ID。
- ProjectId *int64 `json:"ProjectId,omitempty" name:"ProjectId"`
-
- // 实例类型,可取值:1 - 主实例,2 - 灾备实例,3 - 只读实例。
- InstanceTypes []*uint64 `json:"InstanceTypes,omitempty" name:"InstanceTypes" list`
-
- // 实例的内网 IP 地址。
- Vips []*string `json:"Vips,omitempty" name:"Vips" list`
-
- // 实例状态,可取值:
0 - 创建中
1 - 运行中
4 - 正在进行隔离操作
5 - 隔离中(可在回收站恢复开机)
- Status []*uint64 `json:"Status,omitempty" name:"Status" list`
-
- // 偏移量,默认值为 0。
- Offset *uint64 `json:"Offset,omitempty" name:"Offset"`
-
- // 单次请求返回的数量,默认值为 20,最大值为 2000。
- Limit *uint64 `json:"Limit,omitempty" name:"Limit"`
-
- // 安全组 ID。
- SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"`
-
- // 付费类型,可取值:0 - 包年包月,1 - 小时计费。
- PayTypes []*uint64 `json:"PayTypes,omitempty" name:"PayTypes" list`
-
- // 实例名称。
- InstanceNames []*string `json:"InstanceNames,omitempty" name:"InstanceNames" list`
-
- // 实例任务状态,可能取值:
0 - 没有任务
1 - 升级中
2 - 数据导入中
3 - 开放Slave中
4 - 外网访问开通中
5 - 批量操作执行中
6 - 回档中
7 - 外网访问关闭中
8 - 密码修改中
9 - 实例名修改中
10 - 重启中
12 - 自建迁移中
13 - 删除库表中
14 - 灾备实例创建同步中
15 - 升级待切换
16 - 升级切换中
17 - 升级切换完成
- TaskStatus []*uint64 `json:"TaskStatus,omitempty" name:"TaskStatus" list`
-
- // 实例数据库引擎版本,可能取值:5.1、5.5、5.6 和 5.7。
- EngineVersions []*string `json:"EngineVersions,omitempty" name:"EngineVersions" list`
-
- // 私有网络的 ID。
- VpcIds []*uint64 `json:"VpcIds,omitempty" name:"VpcIds" list`
-
- // 可用区的 ID。
- ZoneIds []*uint64 `json:"ZoneIds,omitempty" name:"ZoneIds" list`
-
- // 子网 ID。
- SubnetIds []*uint64 `json:"SubnetIds,omitempty" name:"SubnetIds" list`
-
- // 是否锁定标记。
- CdbErrors []*int64 `json:"CdbErrors,omitempty" name:"CdbErrors" list`
-
- // 返回结果集排序的字段,目前支持:"InstanceId","InstanceName","CreateTime","DeadlineTime"。
- OrderBy *string `json:"OrderBy,omitempty" name:"OrderBy"`
-
- // 返回结果集排序方式,目前支持:"ASC" 或者 "DESC"。
- OrderDirection *string `json:"OrderDirection,omitempty" name:"OrderDirection"`
-
- // 是否包含安全组详细信息,可取值:0 - 不包含,1 - 包含。
- WithSecurityGroup *int64 `json:"WithSecurityGroup,omitempty" name:"WithSecurityGroup"`
-
- // 是否包含独享集群详细信息,可取值:0 - 不包含,1 - 包含。
- WithExCluster *int64 `json:"WithExCluster,omitempty" name:"WithExCluster"`
-
- // 独享集群 ID。
- ExClusterId *string `json:"ExClusterId,omitempty" name:"ExClusterId"`
-
- // 实例 ID。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 初始化标记,可取值:0 - 未初始化,1 - 初始化。
- InitFlag *int64 `json:"InitFlag,omitempty" name:"InitFlag"`
-
- // 是否包含灾备实例,可取值:0 - 不包含,1 - 包含。
- WithDr *int64 `json:"WithDr,omitempty" name:"WithDr"`
-
- // 是否包含只读实例,可取值:0 - 不包含,1 - 包含。
- WithRo *int64 `json:"WithRo,omitempty" name:"WithRo"`
-
- // 是否包含主实例,可取值:0 - 不包含,1 - 包含。
- WithMaster *int64 `json:"WithMaster,omitempty" name:"WithMaster"`
-}
-
-func (r *DescribeDBInstancesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDBInstancesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDBInstancesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合查询条件的实例总数。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 实例详细信息。
- Items []*InstanceInfo `json:"Items,omitempty" name:"Items" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeDBInstancesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDBInstancesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDBPriceRequest struct {
- *tchttp.BaseRequest
-
- // 可用区信息,格式如 "ap-guangzhou-2"。具体能设置的值请通过 DescribeDBZoneConfig 接口查询。
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-
- // 实例数量,默认值为 1,最小值 1,最大值为 100。
- GoodsNum *int64 `json:"GoodsNum,omitempty" name:"GoodsNum"`
-
- // 实例内存大小,单位:MB。
- Memory *int64 `json:"Memory,omitempty" name:"Memory"`
-
- // 实例硬盘大小,单位:GB。
- Volume *int64 `json:"Volume,omitempty" name:"Volume"`
-
- // 付费类型,支持值包括:PRE_PAID - 包年包月,HOUR_PAID - 按量计费。
- PayType *string `json:"PayType,omitempty" name:"PayType"`
-
- // 实例时长,单位:月,最小值 1,最大值为 36;查询按量计费价格时,该字段无效。
- Period *int64 `json:"Period,omitempty" name:"Period"`
-
- // 实例类型,默认为 master,支持值包括:master - 表示主实例,ro - 表示只读实例,dr - 表示灾备实例。
- InstanceRole *string `json:"InstanceRole,omitempty" name:"InstanceRole"`
-
- // 数据复制方式,默认为 0,支持值包括:0 - 表示异步复制,1 - 表示半同步复制,2 - 表示强同步复制。
- ProtectMode *int64 `json:"ProtectMode,omitempty" name:"ProtectMode"`
-}
-
-func (r *DescribeDBPriceRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDBPriceRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDBPriceResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 实例价格,单位:分(人民币)。
- Price *int64 `json:"Price,omitempty" name:"Price"`
-
- // 实例原价,单位:分(人民币)。
- OriginalPrice *int64 `json:"OriginalPrice,omitempty" name:"OriginalPrice"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeDBPriceResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDBPriceResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDBSecurityGroupsRequest struct {
- *tchttp.BaseRequest
-
- // 实例ID,格式如:cdb-c1nl9rpv或者cdbro-c1nl9rpv,与云数据库控制台页面中显示的实例ID相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *DescribeDBSecurityGroupsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDBSecurityGroupsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDBSecurityGroupsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 安全组详情。
- Groups []*SecurityGroup `json:"Groups,omitempty" name:"Groups" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeDBSecurityGroupsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDBSecurityGroupsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDBSwitchRecordsRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv 或者 cdbro-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 分页偏移量。
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 分页大小,默认值为 50,最小值为 1,最大值为 2000。
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeDBSwitchRecordsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDBSwitchRecordsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDBSwitchRecordsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 实例切换记录的总数。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 实例切换记录详情。
- Items []*DBSwitchInfo `json:"Items,omitempty" name:"Items" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeDBSwitchRecordsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDBSwitchRecordsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDBZoneConfigRequest struct {
- *tchttp.BaseRequest
-}
-
-func (r *DescribeDBZoneConfigRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDBZoneConfigRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDBZoneConfigResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 可售卖地域配置数量
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 可售卖地域配置详情
- Items []*RegionSellConf `json:"Items,omitempty" name:"Items" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeDBZoneConfigResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDBZoneConfigResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDatabasesRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 偏移量,最小值为0。
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 单次请求数量,默认值为20,最小值为1,最大值为100。
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-
- // 匹配数据库库名的正则表达式,规则同 MySQL 官网
- DatabaseRegexp *string `json:"DatabaseRegexp,omitempty" name:"DatabaseRegexp"`
-}
-
-func (r *DescribeDatabasesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDatabasesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDatabasesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合查询条件的实例总数。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 返回的实例信息。
- Items []*string `json:"Items,omitempty" name:"Items" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeDatabasesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDatabasesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDefaultParamsRequest struct {
- *tchttp.BaseRequest
-
- // mysql版本,目前支持 ["5.1", "5.5", "5.6", "5.7"]。
- EngineVersion *string `json:"EngineVersion,omitempty" name:"EngineVersion"`
-}
-
-func (r *DescribeDefaultParamsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDefaultParamsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDefaultParamsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 参数个数。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 参数详情。
- Items []*ParameterDetail `json:"Items,omitempty" name:"Items" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeDefaultParamsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDefaultParamsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDeviceMonitorInfoRequest struct {
- *tchttp.BaseRequest
-
- // 实例ID,格式如:cdb-c1nl9rpv。与云数据库控制台页面中显示的实例ID相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 返回当天最近Count个5分钟粒度的监控数据。最小值1,最大值288,不传该参数默认返回当天所有5分钟粒度监控数据。
- Count *uint64 `json:"Count,omitempty" name:"Count"`
-}
-
-func (r *DescribeDeviceMonitorInfoRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDeviceMonitorInfoRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDeviceMonitorInfoResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 实例CPU监控数据
- Cpu *DeviceCpuInfo `json:"Cpu,omitempty" name:"Cpu"`
-
- // 实例内存监控数据
- Mem *DeviceMemInfo `json:"Mem,omitempty" name:"Mem"`
-
- // 实例网络监控数据
- Net *DeviceNetInfo `json:"Net,omitempty" name:"Net"`
-
- // 实例磁盘监控数据
- Disk *DeviceDiskInfo `json:"Disk,omitempty" name:"Disk"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeDeviceMonitorInfoResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDeviceMonitorInfoResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceParamRecordsRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同,可使用 [查询实例列表](https://cloud.tencent.com/document/api/236/15872) 接口获取,其值为输出参数中字段 InstanceId 的值。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 分页偏移量。
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 分页大小。
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeInstanceParamRecordsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceParamRecordsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceParamRecordsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合条件的记录数。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 参数修改记录。
- Items []*ParamRecord `json:"Items,omitempty" name:"Items" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeInstanceParamRecordsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceParamRecordsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceParamsRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同,可使用 [查询实例列表](https://cloud.tencent.com/document/api/236/15872) 接口获取,其值为输出参数中字段 InstanceId 的值。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *DescribeInstanceParamsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceParamsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceParamsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 实例的参数总数。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 参数详情。
- Items []*ParameterDetail `json:"Items,omitempty" name:"Items" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeInstanceParamsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceParamsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeParamTemplateInfoRequest struct {
- *tchttp.BaseRequest
-
- // 参数模板 ID。
- TemplateId *int64 `json:"TemplateId,omitempty" name:"TemplateId"`
-}
-
-func (r *DescribeParamTemplateInfoRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeParamTemplateInfoRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeParamTemplateInfoResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 参数模板 ID。
- TemplateId *int64 `json:"TemplateId,omitempty" name:"TemplateId"`
-
- // 参数模板名称。
- Name *string `json:"Name,omitempty" name:"Name"`
-
- // 参数模板描述
- EngineVersion *string `json:"EngineVersion,omitempty" name:"EngineVersion"`
-
- // 参数模板中的参数数量
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 参数详情
- Items []*ParameterDetail `json:"Items,omitempty" name:"Items" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeParamTemplateInfoResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeParamTemplateInfoResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeParamTemplatesRequest struct {
- *tchttp.BaseRequest
-}
-
-func (r *DescribeParamTemplatesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeParamTemplatesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeParamTemplatesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 该用户的参数模板数量。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 参数模板详情。
- Items []*ParamTemplateInfo `json:"Items,omitempty" name:"Items" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeParamTemplatesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeParamTemplatesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeProjectSecurityGroupsRequest struct {
- *tchttp.BaseRequest
-
- // 项目ID。
- ProjectId *int64 `json:"ProjectId,omitempty" name:"ProjectId"`
-}
-
-func (r *DescribeProjectSecurityGroupsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeProjectSecurityGroupsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeProjectSecurityGroupsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 安全组详情。
- Groups []*SecurityGroup `json:"Groups,omitempty" name:"Groups" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeProjectSecurityGroupsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeProjectSecurityGroupsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeRollbackRangeTimeRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID 列表,单个实例Id的格式如:cdb-c1nl9rpv。与云数据库控制台页面中显示的实例 ID 相同。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-}
-
-func (r *DescribeRollbackRangeTimeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeRollbackRangeTimeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeRollbackRangeTimeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合查询条件的实例总数。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 返回的参数信息。
- Items []*InstanceRollbackRangeTime `json:"Items,omitempty" name:"Items" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeRollbackRangeTimeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeRollbackRangeTimeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeSlowLogsRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv。与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 偏移量,最小值为0。
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 分页大小,默认值为20,最小值为1,最大值为100。
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeSlowLogsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeSlowLogsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeSlowLogsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合查询条件的慢查询日志总数。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 符合查询条件的慢查询日志详情。
- Items []*SlowLogInfo `json:"Items,omitempty" name:"Items" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeSlowLogsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeSlowLogsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeSupportedPrivilegesRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *DescribeSupportedPrivilegesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeSupportedPrivilegesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeSupportedPrivilegesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 实例支持的全局权限。
- GlobalSupportedPrivileges []*string `json:"GlobalSupportedPrivileges,omitempty" name:"GlobalSupportedPrivileges" list`
-
- // 实例支持的数据库权限。
- DatabaseSupportedPrivileges []*string `json:"DatabaseSupportedPrivileges,omitempty" name:"DatabaseSupportedPrivileges" list`
-
- // 实例支持的数据库表权限。
- TableSupportedPrivileges []*string `json:"TableSupportedPrivileges,omitempty" name:"TableSupportedPrivileges" list`
-
- // 实例支持的数据库列权限。
- ColumnSupportedPrivileges []*string `json:"ColumnSupportedPrivileges,omitempty" name:"ColumnSupportedPrivileges" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeSupportedPrivilegesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeSupportedPrivilegesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeTablesRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 数据库的名称。
- Database *string `json:"Database,omitempty" name:"Database"`
-
- // 记录偏移量,默认值为0。
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 单次请求返回的数量,默认值为20,最大值为2000。
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-
- // 匹配数据库表名的正则表达式,规则同 MySQL 官网
- TableRegexp *string `json:"TableRegexp,omitempty" name:"TableRegexp"`
-}
-
-func (r *DescribeTablesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeTablesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeTablesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合查询条件的数据库表总数。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 返回的数据库表信息。
- Items []*string `json:"Items,omitempty" name:"Items" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeTablesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeTablesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeTagsOfInstanceIdsRequest struct {
- *tchttp.BaseRequest
-
- // 实例列表。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 偏移量。
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 每页返回多少个标签。
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeTagsOfInstanceIdsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeTagsOfInstanceIdsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeTagsOfInstanceIdsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 偏移量。
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 每页返回多少个标签。
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-
- // 实例标签信息。
- Rows []*TagsInfoOfInstance `json:"Rows,omitempty" name:"Rows" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeTagsOfInstanceIdsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeTagsOfInstanceIdsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeTasksRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同,可使用 [查询实例列表](https://cloud.tencent.com/document/api/236/15872) 接口获取,其值为输出参数中字段 InstanceId 的值。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 异步任务请求 ID,执行 CDB 相关操作返回的 AsyncRequestId。
- AsyncRequestId *string `json:"AsyncRequestId,omitempty" name:"AsyncRequestId"`
-
- // 任务类型,不传值则查询所有任务类型,可能的值:1-数据库回档;2-SQL操作;3-数据导入;5-参数设置;6-初始化;7-重启;8-开启GTID;9-只读实例升级;10-数据库批量回档;11-主实例升级;12-删除库表;13-切换为主实例。
- TaskTypes []*int64 `json:"TaskTypes,omitempty" name:"TaskTypes" list`
-
- // 任务状态,不传值则查询所有任务状态,可能的值:-1-未定义;0-初始化; 1-运行中;2-执行成功;3-执行失败;4-已终止;5-已删除;6-已暂停。
- TaskStatus []*int64 `json:"TaskStatus,omitempty" name:"TaskStatus" list`
-
- // 第一个任务的开始时间,用于范围查询,时间格式如:2017-12-31 10:40:01。
- StartTimeBegin *string `json:"StartTimeBegin,omitempty" name:"StartTimeBegin"`
-
- // 最后一个任务的开始时间,用于范围查询,时间格式如:2017-12-31 10:40:01。
- StartTimeEnd *string `json:"StartTimeEnd,omitempty" name:"StartTimeEnd"`
-
- // 记录偏移量,默认值为0。
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 单次请求返回的数量,默认值为20,最大值为100。
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeTasksRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeTasksRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeTasksResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合查询条件的实例总数。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 返回的实例任务信息。
- Items []*string `json:"Items,omitempty" name:"Items" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeTasksResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeTasksResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeTimeWindowRequest struct {
- *tchttp.BaseRequest
-
- // 实例ID,格式如:cdb-c1nl9rpv或者cdbro-c1nl9rpv,与云数据库控制台页面中显示的实例ID相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *DescribeTimeWindowRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeTimeWindowRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeTimeWindowResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 星期一的可维护时间列表。
- Monday []*string `json:"Monday,omitempty" name:"Monday" list`
-
- // 星期二的可维护时间列表。
- Tuesday []*string `json:"Tuesday,omitempty" name:"Tuesday" list`
-
- // 星期三的可维护时间列表。
- Wednesday []*string `json:"Wednesday,omitempty" name:"Wednesday" list`
-
- // 星期四的可维护时间列表。
- Thursday []*string `json:"Thursday,omitempty" name:"Thursday" list`
-
- // 星期五的可维护时间列表。
- Friday []*string `json:"Friday,omitempty" name:"Friday" list`
-
- // 星期六的可维护时间列表。
- Saturday []*string `json:"Saturday,omitempty" name:"Saturday" list`
-
- // 星期日的可维护时间列表。
- Sunday []*string `json:"Sunday,omitempty" name:"Sunday" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeTimeWindowResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeTimeWindowResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeUploadedFilesRequest struct {
- *tchttp.BaseRequest
-
- // 文件路径。该字段应填用户主账号的OwnerUin信息。
- Path *string `json:"Path,omitempty" name:"Path"`
-
- // 记录偏移量,默认值为0。
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 单次请求返回的数量,默认值为20。
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeUploadedFilesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeUploadedFilesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeUploadedFilesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合查询条件的SQL文件总数。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 返回的SQL文件列表。
- Items []*SqlFileInfo `json:"Items,omitempty" name:"Items" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeUploadedFilesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeUploadedFilesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeviceCpuInfo struct {
-
- // 实例CPU平均使用率
- Rate []*DeviceCpuRateInfo `json:"Rate,omitempty" name:"Rate" list`
-
- // 实例CPU监控数据
- Load []*int64 `json:"Load,omitempty" name:"Load" list`
-}
-
-type DeviceCpuRateInfo struct {
-
- // Cpu核编号
- CpuCore *int64 `json:"CpuCore,omitempty" name:"CpuCore"`
-
- // Cpu使用率
- Rate []*int64 `json:"Rate,omitempty" name:"Rate" list`
-}
-
-type DeviceDiskInfo struct {
-
- // 平均每秒有百分之几的时间用于IO操作
- IoRatioPerSec []*int64 `json:"IoRatioPerSec,omitempty" name:"IoRatioPerSec" list`
-
- // 平均每次设备I/O操作的等待时间*100,单位为毫秒。例如:该值为201,表示平均每次I/O操作等待时间为:201/100=2.1毫秒
- IoWaitTime []*int64 `json:"IoWaitTime,omitempty" name:"IoWaitTime" list`
-
- // 磁盘平均每秒完成的读操作次数总和*100。例如:该值为2002,表示磁盘平均每秒完成读操作为:2002/100=20.2次
- Read []*int64 `json:"Read,omitempty" name:"Read" list`
-
- // 磁盘平均每秒完成的写操作次数总和*100。例如:该值为30001,表示磁盘平均每秒完成写操作为:30001/100=300.01次
- Write []*int64 `json:"Write,omitempty" name:"Write" list`
-}
-
-type DeviceMemInfo struct {
-
- // 总内存大小。free命令中Mem:一行total的值,单位:KB
- Total []*int64 `json:"Total,omitempty" name:"Total" list`
-
- // 已使用内存。free命令中Mem:一行used的值,单位:KB
- Used []*int64 `json:"Used,omitempty" name:"Used" list`
-}
-
-type DeviceNetInfo struct {
-
- // tcp连接数
- Conn []*int64 `json:"Conn,omitempty" name:"Conn" list`
-
- // 网卡入包量
- PackageIn []*int64 `json:"PackageIn,omitempty" name:"PackageIn" list`
-
- // 网卡出包量
- PackageOut []*int64 `json:"PackageOut,omitempty" name:"PackageOut" list`
-
- // 入流量,单位:KB
- FlowIn []*int64 `json:"FlowIn,omitempty" name:"FlowIn" list`
-
- // 出流量,单位:KB
- FlowOut []*int64 `json:"FlowOut,omitempty" name:"FlowOut" list`
-}
-
-type DisassociateSecurityGroupsRequest struct {
- *tchttp.BaseRequest
-
- // 安全组 ID。
- SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"`
-
- // 实例 ID 列表,一个或者多个实例 ID 组成的数组。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-}
-
-func (r *DisassociateSecurityGroupsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DisassociateSecurityGroupsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DisassociateSecurityGroupsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DisassociateSecurityGroupsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DisassociateSecurityGroupsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DrInfo struct {
-
- // 灾备实例状态
- Status *int64 `json:"Status,omitempty" name:"Status"`
-
- // 可用区信息
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-
- // 实例ID
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 地域信息
- Region *string `json:"Region,omitempty" name:"Region"`
-
- // 实例同步状态
- SyncStatus *int64 `json:"SyncStatus,omitempty" name:"SyncStatus"`
-
- // 实例名称
- InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"`
-
- // 实例类型
- InstanceType *int64 `json:"InstanceType,omitempty" name:"InstanceType"`
-}
-
-type ImportRecord struct {
-
- // 状态值
- Status *int64 `json:"Status,omitempty" name:"Status"`
-
- // 状态值
- Code *int64 `json:"Code,omitempty" name:"Code"`
-
- // 执行时间
- CostTime *int64 `json:"CostTime,omitempty" name:"CostTime"`
-
- // 实例ID
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 后端任务ID
- WorkId *string `json:"WorkId,omitempty" name:"WorkId"`
-
- // 导入文件名
- FileName *string `json:"FileName,omitempty" name:"FileName"`
-
- // 执行进度
- Process *int64 `json:"Process,omitempty" name:"Process"`
-
- // 任务创建时间
- CreateTime *string `json:"CreateTime,omitempty" name:"CreateTime"`
-
- // 文件大小
- FileSize *string `json:"FileSize,omitempty" name:"FileSize"`
-
- // 任务执行信息
- Message *string `json:"Message,omitempty" name:"Message"`
-
- // 任务ID
- JobId *int64 `json:"JobId,omitempty" name:"JobId"`
-
- // 导入库表名
- DbName *string `json:"DbName,omitempty" name:"DbName"`
-
- // 异步任务的请求ID
- AsyncRequestId *string `json:"AsyncRequestId,omitempty" name:"AsyncRequestId"`
-}
-
-type Inbound struct {
-
- // 策略,ACCEPT 或者 DROP
- Action *string `json:"Action,omitempty" name:"Action"`
-
- // 来源 IP 或 IP 段,例如192.168.0.0/16
- CidrIp *string `json:"CidrIp,omitempty" name:"CidrIp"`
-
- // 端口
- PortRange *string `json:"PortRange,omitempty" name:"PortRange"`
-
- // 网络协议,支持 UDP、TCP 等
- IpProtocol *string `json:"IpProtocol,omitempty" name:"IpProtocol"`
-
- // 规则限定的方向,进站规则为 INPUT
- Dir *string `json:"Dir,omitempty" name:"Dir"`
-}
-
-type InitDBInstancesRequest struct {
- *tchttp.BaseRequest
-
- // 实例ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例ID相同,可使用[查询实例列表](https://cloud.tencent.com/document/api/236/15872) 接口获取,其值为输出参数中字段 InstanceId 的值。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 实例新的密码,密码规则:8-64个字符,至少包含字母、数字、字符(支持的字符:!@#$%^*())中的两种。
- NewPassword *string `json:"NewPassword,omitempty" name:"NewPassword"`
-
- // 实例的参数列表,目前支持设置“character_set_server”、“lower_case_table_names”参数。其中,“character_set_server”参数可选值为["utf8","latin1","gbk","utf8mb4"];“lower_case_table_names”可选值为[“0”,“1”]。
- Parameters []*ParamInfo `json:"Parameters,omitempty" name:"Parameters" list`
-
- // 实例的端口,取值范围为[1024, 65535]
- Vport *int64 `json:"Vport,omitempty" name:"Vport"`
-}
-
-func (r *InitDBInstancesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InitDBInstancesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InitDBInstancesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 异步任务的请求ID数组,可使用此ID查询异步任务的执行结果
- AsyncRequestIds []*string `json:"AsyncRequestIds,omitempty" name:"AsyncRequestIds" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *InitDBInstancesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InitDBInstancesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InquiryPriceUpgradeInstancesRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv 或者 cdbro-c1nl9rpv。与云数据库控制台页面中显示的实例 ID 相同,可使用 [查询实例列表](https://cloud.tencent.com/document/api/236/15872) 接口获取,其值为输出参数中字段 InstanceId 的值。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 升级后的内存大小,单位:MB,为保证传入 Memory 值有效,请使用 [获取云数据库可售卖规格](https://cloud.tencent.com/document/product/236/17229) 接口获取可升级的内存规格。
- Memory *uint64 `json:"Memory,omitempty" name:"Memory"`
-
- // 升级后的硬盘大小,单位:GB,为保证传入 Volume 值有效,请使用 [获取云数据库可售卖规格](https://cloud.tencent.com/document/product/236/17229) 接口获取可升级的硬盘范围。
- Volume *uint64 `json:"Volume,omitempty" name:"Volume"`
-
- // 升级后的核心数目,单位:核,为保证传入 CPU 值有效,请使用 [获取云数据库可售卖规格](https://cloud.tencent.com/document/product/236/17229) 接口获取可升级的核心数目,当未指定该值时,将按照 Memory 大小补全一个默认值。
- Cpu *uint64 `json:"Cpu,omitempty" name:"Cpu"`
-
- // 数据复制方式,支持值包括:0 - 异步复制,1 - 半同步复制,2 - 强同步复制,升级主实例时可指定该参数,升级只读实例或者灾备实例时指定该参数无意义。
- ProtectMode *uint64 `json:"ProtectMode,omitempty" name:"ProtectMode"`
-}
-
-func (r *InquiryPriceUpgradeInstancesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InquiryPriceUpgradeInstancesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InquiryPriceUpgradeInstancesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 实例价格,单位:分(人民币)。
- Price *int64 `json:"Price,omitempty" name:"Price"`
-
- // 实例原价,单位:分(人民币)。
- OriginalPrice *int64 `json:"OriginalPrice,omitempty" name:"OriginalPrice"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *InquiryPriceUpgradeInstancesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InquiryPriceUpgradeInstancesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InstanceInfo struct {
-
- // 外网状态,可能的返回值为:0-未开通外网;1-已开通外网;2-已关闭外网
- WanStatus *int64 `json:"WanStatus,omitempty" name:"WanStatus"`
-
- // 可用区信息
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-
- // 初始化标志,可能的返回值为:0-未初始化;1-已初始化
- InitFlag *int64 `json:"InitFlag,omitempty" name:"InitFlag"`
-
- // 只读vip信息。单独开通只读实例访问的只读实例才有该字段
- RoVipInfo *RoVipInfo `json:"RoVipInfo,omitempty" name:"RoVipInfo"`
-
- // 内存容量,单位为MB
- Memory *int64 `json:"Memory,omitempty" name:"Memory"`
-
- // 实例状态,可能的返回值:0-创建中;1-运行中;4-隔离中;5-已隔离
- Status *int64 `json:"Status,omitempty" name:"Status"`
-
- // 私有网络ID,例如:51102
- VpcId *int64 `json:"VpcId,omitempty" name:"VpcId"`
-
- // 备机信息
- SlaveInfo *SlaveInfo `json:"SlaveInfo,omitempty" name:"SlaveInfo"`
-
- // 实例ID
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 硬盘容量,单位为GB
- Volume *int64 `json:"Volume,omitempty" name:"Volume"`
-
- // 自动续费标志,可能的返回值:0-未开通自动续费;1-已开通自动续费;2-已关闭自动续费
- AutoRenew *int64 `json:"AutoRenew,omitempty" name:"AutoRenew"`
-
- // 数据复制方式
- ProtectMode *int64 `json:"ProtectMode,omitempty" name:"ProtectMode"`
-
- // 只读组详细信息
- RoGroups []*RoGroup `json:"RoGroups,omitempty" name:"RoGroups" list`
-
- // 子网ID,例如:2333
- SubnetId *int64 `json:"SubnetId,omitempty" name:"SubnetId"`
-
- // 实例类型,可能的返回值:1-主实例;2-灾备实例;3-只读实例
- InstanceType *int64 `json:"InstanceType,omitempty" name:"InstanceType"`
-
- // 项目ID
- ProjectId *int64 `json:"ProjectId,omitempty" name:"ProjectId"`
-
- // 地域信息
- Region *string `json:"Region,omitempty" name:"Region"`
-
- // 实例到期时间
- DeadlineTime *string `json:"DeadlineTime,omitempty" name:"DeadlineTime"`
-
- // 可用区部署方式
- DeployMode *int64 `json:"DeployMode,omitempty" name:"DeployMode"`
-
- // 实例任务状态
- TaskStatus *int64 `json:"TaskStatus,omitempty" name:"TaskStatus"`
-
- // 主实例详细信息
- MasterInfo *MasterInfo `json:"MasterInfo,omitempty" name:"MasterInfo"`
-
- // 实例类型,可能的返回值:“HA”-高可用版;“BASIC”-基础版
- DeviceType *string `json:"DeviceType,omitempty" name:"DeviceType"`
-
- // 内核版本
- EngineVersion *string `json:"EngineVersion,omitempty" name:"EngineVersion"`
-
- // 实例名称
- InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"`
-
- // 灾备实例详细信息
- DrInfo []*DrInfo `json:"DrInfo,omitempty" name:"DrInfo" list`
-
- // 外网域名
- WanDomain *string `json:"WanDomain,omitempty" name:"WanDomain"`
-
- // 外网端口号
- WanPort *int64 `json:"WanPort,omitempty" name:"WanPort"`
-
- // 付费类型,可能的返回值:0-包年包月;1-按量计费
- PayType *int64 `json:"PayType,omitempty" name:"PayType"`
-
- // 实例创建时间
- CreateTime *string `json:"CreateTime,omitempty" name:"CreateTime"`
-
- // 实例IP
- Vip *string `json:"Vip,omitempty" name:"Vip"`
-
- // 端口号
- Vport *int64 `json:"Vport,omitempty" name:"Vport"`
-
- // 是否锁定标记
- CdbError *int64 `json:"CdbError,omitempty" name:"CdbError"`
-
- // 私有网络描述符,例如:“vpc-5v8wn9mg”
- UniqVpcId *string `json:"UniqVpcId,omitempty" name:"UniqVpcId"`
-
- // 子网描述符,例如:“subnet-1typ0s7d”
- UniqSubnetId *string `json:"UniqSubnetId,omitempty" name:"UniqSubnetId"`
-
- // 物理ID
- PhysicalId *string `json:"PhysicalId,omitempty" name:"PhysicalId"`
-
- // 核心数
- Cpu *int64 `json:"Cpu,omitempty" name:"Cpu"`
-
- // 每秒查询数量
- Qps *int64 `json:"Qps,omitempty" name:"Qps"`
-
- // 可用区中文名称
- ZoneName *string `json:"ZoneName,omitempty" name:"ZoneName"`
-
- // 物理机型
- // 注意:此字段可能返回 null,表示取不到有效值。
- DeviceClass *string `json:"DeviceClass,omitempty" name:"DeviceClass"`
-}
-
-type InstanceRebootTime struct {
-
- // 实例ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例ID相同
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 预期重启时间
- TimeInSeconds *int64 `json:"TimeInSeconds,omitempty" name:"TimeInSeconds"`
-}
-
-type InstanceRollbackRangeTime struct {
-
- // 查询数据库错误码
- Code *int64 `json:"Code,omitempty" name:"Code"`
-
- // 查询数据库错误信息
- Message *string `json:"Message,omitempty" name:"Message"`
-
- // 实例ID列表,单个实例Id的格式如:cdb-c1nl9rpv。与云数据库控制台页面中显示的实例ID相同
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 可回档时间范围
- Times []*RollbackTimeRange `json:"Times,omitempty" name:"Times" list`
-}
-
-type IsolateDBInstanceRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同,可使用 [查询实例列表](https://cloud.tencent.com/document/api/236/15872) 接口获取,其值为输出参数中字段 InstanceId 的值。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *IsolateDBInstanceRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *IsolateDBInstanceRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type IsolateDBInstanceResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 异步任务的请求 ID,可使用此 ID 查询异步任务的执行结果。
- AsyncRequestId *string `json:"AsyncRequestId,omitempty" name:"AsyncRequestId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *IsolateDBInstanceResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *IsolateDBInstanceResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type MasterInfo struct {
-
- // 地域信息
- Region *string `json:"Region,omitempty" name:"Region"`
-
- // 地域ID
- RegionId *int64 `json:"RegionId,omitempty" name:"RegionId"`
-
- // 可用区ID
- ZoneId *int64 `json:"ZoneId,omitempty" name:"ZoneId"`
-
- // 可用区信息
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-
- // 实例ID
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 实例长ID
- ResourceId *string `json:"ResourceId,omitempty" name:"ResourceId"`
-
- // 实例状态
- Status *int64 `json:"Status,omitempty" name:"Status"`
-
- // 实例名称
- InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"`
-
- // 实例类型
- InstanceType *int64 `json:"InstanceType,omitempty" name:"InstanceType"`
-
- // 任务状态
- TaskStatus *int64 `json:"TaskStatus,omitempty" name:"TaskStatus"`
-
- // 内存容量
- Memory *int64 `json:"Memory,omitempty" name:"Memory"`
-
- // 硬盘容量
- Volume *int64 `json:"Volume,omitempty" name:"Volume"`
-
- // 实例机型
- DeviceType *string `json:"DeviceType,omitempty" name:"DeviceType"`
-
- // 每秒查询数
- Qps *int64 `json:"Qps,omitempty" name:"Qps"`
-
- // 私有网络ID
- VpcId *int64 `json:"VpcId,omitempty" name:"VpcId"`
-
- // 子网ID
- SubnetId *int64 `json:"SubnetId,omitempty" name:"SubnetId"`
-
- // 独享集群ID
- ExClusterId *string `json:"ExClusterId,omitempty" name:"ExClusterId"`
-
- // 独享集群名称
- ExClusterName *string `json:"ExClusterName,omitempty" name:"ExClusterName"`
-}
-
-type ModifyAccountDescriptionRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 云数据库账号。
- Accounts []*Account `json:"Accounts,omitempty" name:"Accounts" list`
-
- // 数据库账号的备注信息。
- Description *string `json:"Description,omitempty" name:"Description"`
-}
-
-func (r *ModifyAccountDescriptionRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyAccountDescriptionRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyAccountDescriptionResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 异步任务的请求 ID,可使用此 ID 查询异步任务的执行结果。
- AsyncRequestId *string `json:"AsyncRequestId,omitempty" name:"AsyncRequestId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyAccountDescriptionResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyAccountDescriptionResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyAccountPasswordRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 数据库账号的新密码。密码应至少包含字母、数字和字符(_+-&=!@#$%^*())中的两种,长度为8-64个字符。
- NewPassword *string `json:"NewPassword,omitempty" name:"NewPassword"`
-
- // 云数据库账号。
- Accounts []*Account `json:"Accounts,omitempty" name:"Accounts" list`
-}
-
-func (r *ModifyAccountPasswordRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyAccountPasswordRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyAccountPasswordResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 异步任务的请求 ID,可使用此 ID 查询异步任务的执行结果。
- AsyncRequestId *string `json:"AsyncRequestId,omitempty" name:"AsyncRequestId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyAccountPasswordResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyAccountPasswordResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyAccountPrivilegesRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 数据库的账号,包括用户名和域名。
- Accounts []*Account `json:"Accounts,omitempty" name:"Accounts" list`
-
- // 全局权限。其中,GlobalPrivileges 中权限的可选值为:"SELECT","INSERT","UPDATE","DELETE","CREATE", "DROP","REFERENCES","INDEX","ALTER","SHOW DATABASES","CREATE TEMPORARY TABLES","LOCK TABLES","EXECUTE","CREATE VIEW","SHOW VIEW","CREATE ROUTINE","ALTER ROUTINE","EVENT","TRIGGER"。
- GlobalPrivileges []*string `json:"GlobalPrivileges,omitempty" name:"GlobalPrivileges" list`
-
- // 数据库的权限。Privileges 权限的可选值为:"SELECT","INSERT","UPDATE","DELETE","CREATE", "DROP","REFERENCES","INDEX","ALTER","CREATE TEMPORARY TABLES","LOCK TABLES","EXECUTE","CREATE VIEW","SHOW VIEW","CREATE ROUTINE","ALTER ROUTINE","EVENT","TRIGGER"。
- DatabasePrivileges []*DatabasePrivilege `json:"DatabasePrivileges,omitempty" name:"DatabasePrivileges" list`
-
- // 数据库中表的权限。Privileges 权限的可选值为:权限的可选值为:"SELECT","INSERT","UPDATE","DELETE","CREATE", "DROP","REFERENCES","INDEX","ALTER","CREATE VIEW","SHOW VIEW", "TRIGGER"。
- TablePrivileges []*TablePrivilege `json:"TablePrivileges,omitempty" name:"TablePrivileges" list`
-
- // 数据库表中列的权限。Privileges 权限的可选值为:"SELECT","INSERT","UPDATE","REFERENCES"。
- ColumnPrivileges []*ColumnPrivilege `json:"ColumnPrivileges,omitempty" name:"ColumnPrivileges" list`
-}
-
-func (r *ModifyAccountPrivilegesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyAccountPrivilegesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyAccountPrivilegesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 异步任务的请求 ID,可使用此 ID 查询异步任务的执行结果。
- AsyncRequestId *string `json:"AsyncRequestId,omitempty" name:"AsyncRequestId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyAccountPrivilegesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyAccountPrivilegesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyAutoRenewFlagRequest struct {
- *tchttp.BaseRequest
-
- // 实例的 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 自动续费标记,可取值的有:0 - 不自动续费,1 - 自动续费。
- AutoRenew *int64 `json:"AutoRenew,omitempty" name:"AutoRenew"`
-}
-
-func (r *ModifyAutoRenewFlagRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyAutoRenewFlagRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyAutoRenewFlagResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyAutoRenewFlagResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyAutoRenewFlagResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyBackupConfigRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv。与云数据库控制台页面中显示的实例ID相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 备份过期时间,单位为天,最小值为7天,最大值为732天。
- ExpireDays *int64 `json:"ExpireDays,omitempty" name:"ExpireDays"`
-
- // 备份时间范围,格式为:02:00-06:00,起点和终点时间目前限制为整点,目前可以选择的范围为: 02:00-06:00,06:00-10:00,10:00-14:00,14:00-18:00,18:00-22:00,22:00-02:00。
- StartTime *string `json:"StartTime,omitempty" name:"StartTime"`
-
- // 目标备份方法,可选的值:logical - 逻辑冷备,physical - 物理冷备;默认备份方法为 逻辑冷备。
- BackupMethod *string `json:"BackupMethod,omitempty" name:"BackupMethod"`
-}
-
-func (r *ModifyBackupConfigRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyBackupConfigRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyBackupConfigResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyBackupConfigResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyBackupConfigResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyDBInstanceNameRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同,可使用 [查询实例列表](https://cloud.tencent.com/document/api/236/15872) 接口获取,其值为输出参数中字段 InstanceId 的值。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 实例名称。
- InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"`
-}
-
-func (r *ModifyDBInstanceNameRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyDBInstanceNameRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyDBInstanceNameResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyDBInstanceNameResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyDBInstanceNameResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyDBInstanceProjectRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID 数组,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同,可使用 [查询实例列表](https://cloud.tencent.com/document/api/236/15872) 接口获取,其值为输出参数中字段 InstanceId 的值。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 项目的 ID。
- NewProjectId *int64 `json:"NewProjectId,omitempty" name:"NewProjectId"`
-}
-
-func (r *ModifyDBInstanceProjectRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyDBInstanceProjectRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyDBInstanceProjectResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyDBInstanceProjectResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyDBInstanceProjectResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyDBInstanceSecurityGroupsRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv 或者 cdbro-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 要修改的安全组 ID 列表,一个或者多个安全组 ID 组成的数组。
- SecurityGroupIds []*string `json:"SecurityGroupIds,omitempty" name:"SecurityGroupIds" list`
-}
-
-func (r *ModifyDBInstanceSecurityGroupsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyDBInstanceSecurityGroupsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyDBInstanceSecurityGroupsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyDBInstanceSecurityGroupsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyDBInstanceSecurityGroupsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyDBInstanceVipVportRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同,可使用 [查询实例列表](https://cloud.tencent.com/document/api/236/15872) 接口获取,其值为输出参数中字段 InstanceId 的值。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 目标 IP。该参数和 DstPort 参数,两者必传一个。
- DstIp *string `json:"DstIp,omitempty" name:"DstIp"`
-
- // 目标端口,支持范围为:[1024-65535]。该参数和 DstIp 参数,两者必传一个。
- DstPort *int64 `json:"DstPort,omitempty" name:"DstPort"`
-
- // 私有网络统一 ID。
- UniqVpcId *string `json:"UniqVpcId,omitempty" name:"UniqVpcId"`
-
- // 子网统一 ID。
- UniqSubnetId *string `json:"UniqSubnetId,omitempty" name:"UniqSubnetId"`
-}
-
-func (r *ModifyDBInstanceVipVportRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyDBInstanceVipVportRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyDBInstanceVipVportResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 异步任务ID。
- AsyncRequestId *string `json:"AsyncRequestId,omitempty" name:"AsyncRequestId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyDBInstanceVipVportResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyDBInstanceVipVportResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyInstanceParamRequest struct {
- *tchttp.BaseRequest
-
- // 实例短 ID 列表。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 要修改的参数列表。每一个元素是 Name 和 CurrentValue 的组合。Name 是参数名,CurrentValue 是要修改成的值。
- ParamList []*Parameter `json:"ParamList,omitempty" name:"ParamList" list`
-}
-
-func (r *ModifyInstanceParamRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyInstanceParamRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyInstanceParamResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 异步任务 ID,可用于查询任务进度。
- AsyncRequestId *string `json:"AsyncRequestId,omitempty" name:"AsyncRequestId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyInstanceParamResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyInstanceParamResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyInstanceTagRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 要增加或修改的标签。
- ReplaceTags []*TagInfo `json:"ReplaceTags,omitempty" name:"ReplaceTags" list`
-
- // 要删除的标签。
- DeleteTags []*TagInfo `json:"DeleteTags,omitempty" name:"DeleteTags" list`
-}
-
-func (r *ModifyInstanceTagRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyInstanceTagRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyInstanceTagResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyInstanceTagResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyInstanceTagResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyParamTemplateRequest struct {
- *tchttp.BaseRequest
-
- // 模板 ID。
- TemplateId *int64 `json:"TemplateId,omitempty" name:"TemplateId"`
-
- // 模板名称。
- Name *string `json:"Name,omitempty" name:"Name"`
-
- // 模板描述。
- Description *string `json:"Description,omitempty" name:"Description"`
-
- // 参数列表。
- ParamList []*Parameter `json:"ParamList,omitempty" name:"ParamList" list`
-}
-
-func (r *ModifyParamTemplateRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyParamTemplateRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyParamTemplateResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyParamTemplateResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyParamTemplateResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyTimeWindowRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv 或者 cdbro-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 修改后的可维护时间段,其中每一个时间段的格式形如:10:00-12:00;起止时间按半个小时对齐;最短半个小时,最长三个小时;最多设置两个时间段;起止时间范围为:[00:00, 24:00]。
- TimeRanges []*string `json:"TimeRanges,omitempty" name:"TimeRanges" list`
-
- // 指定修改哪一天的客户时间段,可能的取值为:monday,tuesday,wednesday,thursday,friday,saturday,sunday。如果不指定该值或者为空,则默认一周七天都修改。
- Weekdays []*string `json:"Weekdays,omitempty" name:"Weekdays" list`
-}
-
-func (r *ModifyTimeWindowRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyTimeWindowRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyTimeWindowResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyTimeWindowResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyTimeWindowResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type OpenDBInstanceGTIDRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *OpenDBInstanceGTIDRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *OpenDBInstanceGTIDRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type OpenDBInstanceGTIDResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 异步任务的请求 ID,可使用此 ID 查询异步任务的执行结果。
- AsyncRequestId *string `json:"AsyncRequestId,omitempty" name:"AsyncRequestId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *OpenDBInstanceGTIDResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *OpenDBInstanceGTIDResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type OpenWanServiceRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同,可使用 [查询实例列表](https://cloud.tencent.com/document/api/236/15872) 接口获取,其值为输出参数中字段 InstanceId 的值。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *OpenWanServiceRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *OpenWanServiceRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type OpenWanServiceResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 异步任务的请求 ID,可使用此 ID 查询异步任务的执行结果。
- AsyncRequestId *string `json:"AsyncRequestId,omitempty" name:"AsyncRequestId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *OpenWanServiceResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *OpenWanServiceResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type Outbound struct {
-
- // 策略,ACCEPT 或者 DROP
- Action *string `json:"Action,omitempty" name:"Action"`
-
- // 目的 IP 或 IP 段,例如172.16.0.0/12
- CidrIp *string `json:"CidrIp,omitempty" name:"CidrIp"`
-
- // 端口或者端口范围
- PortRange *string `json:"PortRange,omitempty" name:"PortRange"`
-
- // 网络协议,支持 UDP、TCP等
- IpProtocol *string `json:"IpProtocol,omitempty" name:"IpProtocol"`
-
- // 规则限定的方向,进站规则为 OUTPUT
- Dir *string `json:"Dir,omitempty" name:"Dir"`
-}
-
-type ParamInfo struct {
-
- // 参数名
- Name *string `json:"Name,omitempty" name:"Name"`
-
- // 参数值
- Value *string `json:"Value,omitempty" name:"Value"`
-}
-
-type ParamRecord struct {
-
- // 实例ID
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 参数名称
- ParamName *string `json:"ParamName,omitempty" name:"ParamName"`
-
- // 参数修改前的值
- OldValue *string `json:"OldValue,omitempty" name:"OldValue"`
-
- // 参数修改后的值
- NewValue *string `json:"NewValue,omitempty" name:"NewValue"`
-
- // 参数是否修改成功
- IsSucess *bool `json:"IsSucess,omitempty" name:"IsSucess"`
-
- // 修改时间
- ModifyTime *string `json:"ModifyTime,omitempty" name:"ModifyTime"`
-}
-
-type ParamTemplateInfo struct {
-
- // 参数模板ID
- TemplateId *int64 `json:"TemplateId,omitempty" name:"TemplateId"`
-
- // 参数模板名称
- Name *string `json:"Name,omitempty" name:"Name"`
-
- // 参数模板描述
- Description *string `json:"Description,omitempty" name:"Description"`
-
- // 实例引擎版本
- EngineVersion *string `json:"EngineVersion,omitempty" name:"EngineVersion"`
-}
-
-type Parameter struct {
-
- // 参数名称
- Name *string `json:"Name,omitempty" name:"Name"`
-
- // 参数值
- CurrentValue *string `json:"CurrentValue,omitempty" name:"CurrentValue"`
-}
-
-type ParameterDetail struct {
-
- // 参数名称
- Name *string `json:"Name,omitempty" name:"Name"`
-
- // 参数类型
- ParamType *string `json:"ParamType,omitempty" name:"ParamType"`
-
- // 参数默认值
- Default *string `json:"Default,omitempty" name:"Default"`
-
- // 参数描述
- Description *string `json:"Description,omitempty" name:"Description"`
-
- // 参数当前值
- CurrentValue *string `json:"CurrentValue,omitempty" name:"CurrentValue"`
-
- // 修改参数后,是否需要重启数据库以使参数生效。可能的值包括:0-不需要重启;1-需要重启
- NeedReboot *int64 `json:"NeedReboot,omitempty" name:"NeedReboot"`
-
- // 参数允许的最大值
- Max *int64 `json:"Max,omitempty" name:"Max"`
-
- // 参数允许的最小值
- Min *int64 `json:"Min,omitempty" name:"Min"`
-
- // 参数的可选枚举值。如果为非枚举参数,则为空
- EnumValue []*string `json:"EnumValue,omitempty" name:"EnumValue" list`
-}
-
-type RegionSellConf struct {
-
- // 地域中文名称
- RegionName *string `json:"RegionName,omitempty" name:"RegionName"`
-
- // 所属大区
- Area *string `json:"Area,omitempty" name:"Area"`
-
- // 是否为默认地域
- IsDefaultRegion *int64 `json:"IsDefaultRegion,omitempty" name:"IsDefaultRegion"`
-
- // 地域名称
- Region *string `json:"Region,omitempty" name:"Region"`
-
- // 可用区售卖配置
- ZonesConf []*ZoneSellConf `json:"ZonesConf,omitempty" name:"ZonesConf" list`
-}
-
-type RenewDBInstanceRequest struct {
- *tchttp.BaseRequest
-
- // 待续费的实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同,可使用 [查询实例列表](https://cloud.tencent.com/document/api/236/15872)。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 续费时长,单位:月,可选值包括 [1,2,3,4,5,6,7,8,9,10,11,12,24,36]。
- TimeSpan *int64 `json:"TimeSpan,omitempty" name:"TimeSpan"`
-}
-
-func (r *RenewDBInstanceRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RenewDBInstanceRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RenewDBInstanceResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 订单 ID。
- DealId *string `json:"DealId,omitempty" name:"DealId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *RenewDBInstanceResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RenewDBInstanceResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RestartDBInstancesRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID 数组,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-}
-
-func (r *RestartDBInstancesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RestartDBInstancesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RestartDBInstancesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 异步任务的请求 ID,可使用此 ID 查询异步任务的执行结果。
- AsyncRequestId *string `json:"AsyncRequestId,omitempty" name:"AsyncRequestId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *RestartDBInstancesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RestartDBInstancesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RoGroup struct {
-
- // 只读组模式,可选值为:alone-系统自动分配只读组;allinone-新建只读组;join-使用现有只读组
- RoGroupMode *string `json:"RoGroupMode,omitempty" name:"RoGroupMode"`
-
- // 只读组ID
- RoGroupId *string `json:"RoGroupId,omitempty" name:"RoGroupId"`
-
- // 只读组名称
- RoGroupName *string `json:"RoGroupName,omitempty" name:"RoGroupName"`
-
- // 是否启用延迟超限剔除功能,启用该功能后,只读实例与主实例的延迟超过延迟阈值,只读实例将被隔离。可选值:1-启用;0-不启用
- RoOfflineDelay *int64 `json:"RoOfflineDelay,omitempty" name:"RoOfflineDelay"`
-
- // 延迟阈值
- RoMaxDelayTime *int64 `json:"RoMaxDelayTime,omitempty" name:"RoMaxDelayTime"`
-
- // 最少实例保留个数,若购买只读实例数量小于设置数量将不做剔除
- MinRoInGroup *int64 `json:"MinRoInGroup,omitempty" name:"MinRoInGroup"`
-
- // 读写权重分配模式,可选值:system-系统自动分配;custom-自定义
- WeightMode *string `json:"WeightMode,omitempty" name:"WeightMode"`
-
- // 权重值
- Weight *int64 `json:"Weight,omitempty" name:"Weight"`
-
- // 只读组中的只读实例详情
- RoInstances []*RoInstanceInfo `json:"RoInstances,omitempty" name:"RoInstances" list`
-
- // 只读组的内网IP
- Vip *string `json:"Vip,omitempty" name:"Vip"`
-
- // 只读组的内网端口号
- Vport *int64 `json:"Vport,omitempty" name:"Vport"`
-}
-
-type RoInstanceInfo struct {
-
- // RO组对应的主实例的ID
- MasterInstanceId *string `json:"MasterInstanceId,omitempty" name:"MasterInstanceId"`
-
- // RO实例在RO组内的状态,可能的值:online-在线,offline-下线
- RoStatus *string `json:"RoStatus,omitempty" name:"RoStatus"`
-
- // RO实例在RO组内上一次下线的时间
- OfflineTime *string `json:"OfflineTime,omitempty" name:"OfflineTime"`
-
- // RO实例在RO组内的权重
- Weight *int64 `json:"Weight,omitempty" name:"Weight"`
-
- // RO实例所在区域名称,如ap-shanghai
- Region *string `json:"Region,omitempty" name:"Region"`
-
- // RO可用区的正式名称,如ap-shanghai-1
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-
- // RO实例ID,格式如:cdbro-c1nl9rpv
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // RO实例状态,可能返回值:0-创建中,1-运行中,4-删除中
- Status *int64 `json:"Status,omitempty" name:"Status"`
-
- // 实例类型,可能返回值:1-主实例,2-灾备实例,3-只读实例
- InstanceType *int64 `json:"InstanceType,omitempty" name:"InstanceType"`
-
- // RO实例名称
- InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"`
-
- // 按量计费状态,可能的取值:1-正常,2-欠费
- HourFeeStatus *int64 `json:"HourFeeStatus,omitempty" name:"HourFeeStatus"`
-
- // RO实例任务状态,可能返回值:
0-没有任务
1-升级中
2-数据导入中
3-开放Slave中
4-外网访问开通中
5-批量操作执行中
6-回档中
7-外网访问关闭中
8-密码修改中
9-实例名修改中
10-重启中
12-自建迁移中
13-删除库表中
14-灾备实例创建同步中
- TaskStatus *int64 `json:"TaskStatus,omitempty" name:"TaskStatus"`
-
- // RO实例内存大小,单位:MB
- Memory *int64 `json:"Memory,omitempty" name:"Memory"`
-
- // RO实例硬盘大小,单位:GB
- Volume *int64 `json:"Volume,omitempty" name:"Volume"`
-
- // 每次查询数量
- Qps *int64 `json:"Qps,omitempty" name:"Qps"`
-
- // RO实例的内网IP地址
- Vip *string `json:"Vip,omitempty" name:"Vip"`
-
- // RO实例访问端口
- Vport *int64 `json:"Vport,omitempty" name:"Vport"`
-
- // RO实例所在私有网络ID
- VpcId *int64 `json:"VpcId,omitempty" name:"VpcId"`
-
- // RO实例所在私有网络子网ID
- SubnetId *int64 `json:"SubnetId,omitempty" name:"SubnetId"`
-
- // RO实例规格描述,目前可取值 CUSTOM
- DeviceType *string `json:"DeviceType,omitempty" name:"DeviceType"`
-
- // RO实例数据库引擎版本,可能返回值:5.1、5.5、5.6和5.7
- EngineVersion *string `json:"EngineVersion,omitempty" name:"EngineVersion"`
-
- // RO实例到期时间,时间格式:yyyy-mm-dd hh:mm:ss,如实例为按量计费模式,则此字段值为0000-00-00 00:00:00
- DeadlineTime *string `json:"DeadlineTime,omitempty" name:"DeadlineTime"`
-
- // RO实例计费类型,可能返回值:0-包年包月,1-按量计费,2-后付费月结
- PayType *int64 `json:"PayType,omitempty" name:"PayType"`
-}
-
-type RoVipInfo struct {
-
- // 只读vip状态
- RoVipStatus *int64 `json:"RoVipStatus,omitempty" name:"RoVipStatus"`
-
- // 只读vip的子网
- RoSubnetId *int64 `json:"RoSubnetId,omitempty" name:"RoSubnetId"`
-
- // 只读vip的私有网络
- RoVpcId *int64 `json:"RoVpcId,omitempty" name:"RoVpcId"`
-
- // 只读vip的端口号
- RoVport *int64 `json:"RoVport,omitempty" name:"RoVport"`
-
- // 只读vip
- RoVip *string `json:"RoVip,omitempty" name:"RoVip"`
-}
-
-type RollbackDBName struct {
-
- // 回档前的原数据库名
- DatabaseName *string `json:"DatabaseName,omitempty" name:"DatabaseName"`
-
- // 回档后的新数据库名
- NewDatabaseName *string `json:"NewDatabaseName,omitempty" name:"NewDatabaseName"`
-}
-
-type RollbackInstancesInfo struct {
-
- // 云数据库实例ID
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 回档策略。可选值为:table、db、full;默认值为full。table - 急速回档模式,仅导入所选中表级别的备份和binlog,如有跨表操作,且关联表未被同时选中,将会导致回档失败,该模式下参数Databases必须为空;db - 快速模式,仅导入所选中库级别的备份和binlog,如有跨库操作,且关联库未被同时选中,将会导致回档失败;full - 普通回档模式,将导入整个实例的备份和binlog,速度较慢。
- Strategy *string `json:"Strategy,omitempty" name:"Strategy"`
-
- // 数据库回档时间,时间格式为:yyyy-mm-dd hh:mm:ss
- RollbackTime *string `json:"RollbackTime,omitempty" name:"RollbackTime"`
-
- // 待回档的数据库信息,表示整库回档
- Databases []*RollbackDBName `json:"Databases,omitempty" name:"Databases" list`
-
- // 待回档的数据库表信息,表示按表回档
- Tables []*RollbackTables `json:"Tables,omitempty" name:"Tables" list`
-}
-
-type RollbackTableName struct {
-
- // 回档前的原数据库表名
- TableName *string `json:"TableName,omitempty" name:"TableName"`
-
- // 回档后的新数据库表名
- NewTableName *string `json:"NewTableName,omitempty" name:"NewTableName"`
-}
-
-type RollbackTables struct {
-
- // 数据库名
- Database *string `json:"Database,omitempty" name:"Database"`
-
- // 数据库表详情
- Table []*RollbackTableName `json:"Table,omitempty" name:"Table" list`
-}
-
-type RollbackTimeRange struct {
-
- // 实例可回档开始时间,时间格式:2016-10-29 01:06:04
- Begin *string `json:"Begin,omitempty" name:"Begin"`
-
- // 实例可回档结束时间,时间格式:2016-11-02 11:44:47
- End *string `json:"End,omitempty" name:"End"`
-}
-
-type SecurityGroup struct {
-
- // 项目ID
- ProjectId *int64 `json:"ProjectId,omitempty" name:"ProjectId"`
-
- // 创建时间,时间格式:yyyy-mm-dd hh:mm:ss
- CreateTime *string `json:"CreateTime,omitempty" name:"CreateTime"`
-
- // 入站规则
- Inbound []*Inbound `json:"Inbound,omitempty" name:"Inbound" list`
-
- // 出站规则
- Outbound []*Outbound `json:"Outbound,omitempty" name:"Outbound" list`
-
- // 安全组ID
- SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"`
-
- // 安全组名称
- SecurityGroupName *string `json:"SecurityGroupName,omitempty" name:"SecurityGroupName"`
-
- // 安全组备注
- SecurityGroupRemark *string `json:"SecurityGroupRemark,omitempty" name:"SecurityGroupRemark"`
-}
-
-type SellConfig struct {
-
- // 设备类型
- Device *string `json:"Device,omitempty" name:"Device"`
-
- // 售卖规格描述
- Type *string `json:"Type,omitempty" name:"Type"`
-
- // 实例类型
- CdbType *string `json:"CdbType,omitempty" name:"CdbType"`
-
- // 内存大小,单位为MB
- Memory *int64 `json:"Memory,omitempty" name:"Memory"`
-
- // CPU核心数
- Cpu *int64 `json:"Cpu,omitempty" name:"Cpu"`
-
- // 磁盘最小规格,单位为GB
- VolumeMin *int64 `json:"VolumeMin,omitempty" name:"VolumeMin"`
-
- // 磁盘最大规格,单位为GB
- VolumeMax *int64 `json:"VolumeMax,omitempty" name:"VolumeMax"`
-
- // 磁盘步长,单位为GB
- VolumeStep *int64 `json:"VolumeStep,omitempty" name:"VolumeStep"`
-
- // 链接数
- Connection *int64 `json:"Connection,omitempty" name:"Connection"`
-
- // 每秒查询数量
- Qps *int64 `json:"Qps,omitempty" name:"Qps"`
-
- // 每秒IO数量
- Iops *int64 `json:"Iops,omitempty" name:"Iops"`
-
- // 应用场景描述
- Info *string `json:"Info,omitempty" name:"Info"`
-
- // 状态值
- Status *int64 `json:"Status,omitempty" name:"Status"`
-}
-
-type SellType struct {
-
- // 售卖实例名称
- TypeName *string `json:"TypeName,omitempty" name:"TypeName"`
-
- // 内核版本号
- EngineVersion []*string `json:"EngineVersion,omitempty" name:"EngineVersion" list`
-
- // 售卖规格详细配置
- Configs []*SellConfig `json:"Configs,omitempty" name:"Configs" list`
-}
-
-type SlaveConfig struct {
-
- // 从库复制方式,可能的返回值:aysnc-异步,semisync-半同步
- ReplicationMode *string `json:"ReplicationMode,omitempty" name:"ReplicationMode"`
-
- // 从库可用区的正式名称,如ap-shanghai-1
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-}
-
-type SlaveInfo struct {
-
- // 第一备机信息
- First *SlaveInstanceInfo `json:"First,omitempty" name:"First"`
-
- // 第二备机信息
- Second *SlaveInstanceInfo `json:"Second,omitempty" name:"Second"`
-}
-
-type SlaveInstanceInfo struct {
-
- // 端口号
- Vport *int64 `json:"Vport,omitempty" name:"Vport"`
-
- // 地域信息
- Region *string `json:"Region,omitempty" name:"Region"`
-
- // 虚拟 IP 信息
- Vip *string `json:"Vip,omitempty" name:"Vip"`
-
- // 可用区信息
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-}
-
-type SlowLogInfo struct {
-
- // 备份文件名
- Name *string `json:"Name,omitempty" name:"Name"`
-
- // 备份文件大小,单位:Byte
- Size *int64 `json:"Size,omitempty" name:"Size"`
-
- // 备份快照时间,时间格式:2016-03-17 02:10:37
- Date *string `json:"Date,omitempty" name:"Date"`
-
- // 内网下载地址
- IntranetUrl *string `json:"IntranetUrl,omitempty" name:"IntranetUrl"`
-
- // 外网下载地址
- InternetUrl *string `json:"InternetUrl,omitempty" name:"InternetUrl"`
-
- // 日志具体类型,可能的值:slowlog - 慢日志
- Type *string `json:"Type,omitempty" name:"Type"`
-}
-
-type SqlFileInfo struct {
-
- // 上传时间
- UploadTime *string `json:"UploadTime,omitempty" name:"UploadTime"`
-
- // 上传进度
- UploadInfo *UploadInfo `json:"UploadInfo,omitempty" name:"UploadInfo"`
-
- // 文件名
- FileName *string `json:"FileName,omitempty" name:"FileName"`
-
- // 文件大小,单位为Bytes
- FileSize *int64 `json:"FileSize,omitempty" name:"FileSize"`
-
- // 上传是否完成标志,可选值:0 - 未完成,1 - 已完成
- IsUploadFinished *int64 `json:"IsUploadFinished,omitempty" name:"IsUploadFinished"`
-
- // 文件ID
- FileId *string `json:"FileId,omitempty" name:"FileId"`
-}
-
-type StartBatchRollbackRequest struct {
- *tchttp.BaseRequest
-
- // 用于回档的实例详情信息。
- Instances []*RollbackInstancesInfo `json:"Instances,omitempty" name:"Instances" list`
-}
-
-func (r *StartBatchRollbackRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *StartBatchRollbackRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type StartBatchRollbackResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 异步任务的请求 ID,可使用此 ID 查询异步任务的执行结果。
- AsyncRequestId *string `json:"AsyncRequestId,omitempty" name:"AsyncRequestId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *StartBatchRollbackResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *StartBatchRollbackResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type StopDBImportJobRequest struct {
- *tchttp.BaseRequest
-
- // 异步任务的请求 ID。
- AsyncRequestId *string `json:"AsyncRequestId,omitempty" name:"AsyncRequestId"`
-}
-
-func (r *StopDBImportJobRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *StopDBImportJobRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type StopDBImportJobResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *StopDBImportJobResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *StopDBImportJobResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type SwitchForUpgradeRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *SwitchForUpgradeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *SwitchForUpgradeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type SwitchForUpgradeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *SwitchForUpgradeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *SwitchForUpgradeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type TableName struct {
-
- // 表名
- TableName *string `json:"TableName,omitempty" name:"TableName"`
-}
-
-type TablePrivilege struct {
-
- // 数据库名
- Database *string `json:"Database,omitempty" name:"Database"`
-
- // 数据库表名
- Table *string `json:"Table,omitempty" name:"Table"`
-
- // 权限信息
- Privileges []*string `json:"Privileges,omitempty" name:"Privileges" list`
-}
-
-type TagInfo struct {
-
- // 标签键
- TagKey *string `json:"TagKey,omitempty" name:"TagKey"`
-
- // 标签值
- TagValue []*string `json:"TagValue,omitempty" name:"TagValue" list`
-}
-
-type TagInfoUnit struct {
-
- // 标签键
- TagKey *string `json:"TagKey,omitempty" name:"TagKey"`
-
- // 标签值
- TagValue *string `json:"TagValue,omitempty" name:"TagValue"`
-}
-
-type TagsInfoOfInstance struct {
-
- // 实例Id
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 标签信息
- Tags []*TagInfoUnit `json:"Tags,omitempty" name:"Tags" list`
-}
-
-type UpgradeDBInstanceEngineVersionRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv 或者 cdbro-c1nl9rpv。与云数据库控制台页面中显示的实例 ID 相同,可使用 [查询实例列表](https://cloud.tencent.com/document/api/236/15872) 接口获取,其值为输出参数中字段 InstanceId 的值。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 主实例数据库引擎版本,支持值包括:5.6 和 5.7。
- EngineVersion *string `json:"EngineVersion,omitempty" name:"EngineVersion"`
-
- // 切换访问新实例的方式,默认为 0。支持值包括:0 - 立刻切换,1 - 时间窗切换;当该值为 1 时,升级中过程中,切换访问新实例的流程将会在时间窗内进行,或者用户主动调用接口 [切换访问新实例](https://cloud.tencent.com/document/product/236/15864) 触发该流程。
- WaitSwitch *int64 `json:"WaitSwitch,omitempty" name:"WaitSwitch"`
-}
-
-func (r *UpgradeDBInstanceEngineVersionRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *UpgradeDBInstanceEngineVersionRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type UpgradeDBInstanceEngineVersionResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 异步任务 ID,可使用 [查询异步任务的执行结果](https://cloud.tencent.com/document/api/236/20410) 获取其执行情况。
- AsyncRequestId *string `json:"AsyncRequestId,omitempty" name:"AsyncRequestId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *UpgradeDBInstanceEngineVersionResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *UpgradeDBInstanceEngineVersionResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type UpgradeDBInstanceRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv 或者 cdbro-c1nl9rpv。与云数据库控制台页面中显示的实例 ID 相同,可使用 [查询实例列表](https://cloud.tencent.com/document/api/236/15872) 接口获取,其值为输出参数中字段 InstanceId 的值。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 升级后的内存大小,单位:MB,为保证传入 Memory 值有效,请使用 [获取云数据库可售卖规格](https://cloud.tencent.com/document/product/236/17229) 接口获取可升级的内存规格。
- Memory *int64 `json:"Memory,omitempty" name:"Memory"`
-
- // 升级后的硬盘大小,单位:GB,为保证传入 Volume 值有效,请使用 [获取云数据库可售卖规格](https://cloud.tencent.com/document/product/236/17229) 接口获取可升级的硬盘范围。
- Volume *int64 `json:"Volume,omitempty" name:"Volume"`
-
- // 数据复制方式,支持值包括:0 - 异步复制,1 - 半同步复制,2 - 强同步复制,升级主实例时可指定该参数,升级只读实例或者灾备实例时指定该参数无意义。
- ProtectMode *int64 `json:"ProtectMode,omitempty" name:"ProtectMode"`
-
- // 部署模式,默认为 0,支持值包括:0 - 单可用区部署,1 - 多可用区部署,升级主实例时可指定该参数,升级只读实例或者灾备实例时指定该参数无意义。
- DeployMode *int64 `json:"DeployMode,omitempty" name:"DeployMode"`
-
- // 备库1的可用区信息,默认和实例的 Zone 参数一致,升级主实例为多可用区部署时可指定该参数,升级只读实例或者灾备实例时指定该参数无意义。可通过 [获取云数据库可售卖规格](https://cloud.tencent.com/document/product/236/17229) 接口查询支持的可用区。
- SlaveZone *string `json:"SlaveZone,omitempty" name:"SlaveZone"`
-
- // 主实例数据库引擎版本,支持值包括:5.5、5.6 和 5.7。
- EngineVersion *string `json:"EngineVersion,omitempty" name:"EngineVersion"`
-
- // 切换访问新实例的方式,默认为 0。支持值包括:0 - 立刻切换,1 - 时间窗切换;当该值为 1 时,升级中过程中,切换访问新实例的流程将会在时间窗内进行,或者用户主动调用接口 [切换访问新实例](https://cloud.tencent.com/document/product/236/15864) 触发该流程。
- WaitSwitch *int64 `json:"WaitSwitch,omitempty" name:"WaitSwitch"`
-
- // 备库 2 的可用区信息,默认为空,升级主实例时可指定该参数,升级只读实例或者灾备实例时指定该参数无意义。
- BackupZone *string `json:"BackupZone,omitempty" name:"BackupZone"`
-
- // 实例类型,默认为 master,支持值包括:master - 表示主实例,dr - 表示灾备实例,ro - 表示只读实例。
- InstanceRole *string `json:"InstanceRole,omitempty" name:"InstanceRole"`
-}
-
-func (r *UpgradeDBInstanceRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *UpgradeDBInstanceRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type UpgradeDBInstanceResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 订单 ID。
- DealIds []*string `json:"DealIds,omitempty" name:"DealIds" list`
-
- // 异步任务的请求 ID,可使用此 ID 查询异步任务的执行结果。
- AsyncRequestId *string `json:"AsyncRequestId,omitempty" name:"AsyncRequestId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *UpgradeDBInstanceResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *UpgradeDBInstanceResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type UploadInfo struct {
-
- // 文件所有分片数
- AllSliceNum *int64 `json:"AllSliceNum,omitempty" name:"AllSliceNum"`
-
- // 已完成分片数
- CompleteNum *int64 `json:"CompleteNum,omitempty" name:"CompleteNum"`
-}
-
-type VerifyRootAccountRequest struct {
- *tchttp.BaseRequest
-
- // 实例 ID,格式如:cdb-c1nl9rpv,与云数据库控制台页面中显示的实例 ID 相同。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 实例 ROOT 账号的密码。
- Password *string `json:"Password,omitempty" name:"Password"`
-}
-
-func (r *VerifyRootAccountRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *VerifyRootAccountRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type VerifyRootAccountResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 异步任务的请求 ID,可使用此 ID 查询异步任务的执行结果
- AsyncRequestId *string `json:"AsyncRequestId,omitempty" name:"AsyncRequestId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *VerifyRootAccountResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *VerifyRootAccountResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ZoneConf struct {
-
- // 可用区部署方式,可能的值为:0-单可用区;1-多可用区
- DeployMode []*int64 `json:"DeployMode,omitempty" name:"DeployMode" list`
-
- // 主实例所在的可用区
- MasterZone []*string `json:"MasterZone,omitempty" name:"MasterZone" list`
-
- // 实例为多可用区部署时,备库1所在的可用区
- SlaveZone []*string `json:"SlaveZone,omitempty" name:"SlaveZone" list`
-
- // 实例为多可用区部署时,备库2所在的可用区
- BackupZone []*string `json:"BackupZone,omitempty" name:"BackupZone" list`
-}
-
-type ZoneSellConf struct {
-
- // 可用区状态。可能的返回值为:0-未上线;1-上线;2-开放;3-停售;4-不展示
- Status *int64 `json:"Status,omitempty" name:"Status"`
-
- // 可用区中文名称
- ZoneName *string `json:"ZoneName,omitempty" name:"ZoneName"`
-
- // 实例类型是否为自定义类型
- IsCustom *bool `json:"IsCustom,omitempty" name:"IsCustom"`
-
- // 是否支持灾备
- IsSupportDr *bool `json:"IsSupportDr,omitempty" name:"IsSupportDr"`
-
- // 是否支持私有网络
- IsSupportVpc *bool `json:"IsSupportVpc,omitempty" name:"IsSupportVpc"`
-
- // 小时计费实例最大售卖数量
- HourInstanceSaleMaxNum *int64 `json:"HourInstanceSaleMaxNum,omitempty" name:"HourInstanceSaleMaxNum"`
-
- // 是否为默认可用区
- IsDefaultZone *bool `json:"IsDefaultZone,omitempty" name:"IsDefaultZone"`
-
- // 是否为黑石区
- IsBm *bool `json:"IsBm,omitempty" name:"IsBm"`
-
- // 支持的付费类型。可能的返回值为:0-包年包月;1-小时计费;2-后付费
- PayType []*string `json:"PayType,omitempty" name:"PayType" list`
-
- // 数据复制类型。0-异步复制;1-半同步复制;2-强同步复制
- ProtectMode []*string `json:"ProtectMode,omitempty" name:"ProtectMode" list`
-
- // 可用区名称
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-
- // 售卖实例类型数组
- SellType []*SellType `json:"SellType,omitempty" name:"SellType" list`
-
- // 多可用区信息
- ZoneConf *ZoneConf `json:"ZoneConf,omitempty" name:"ZoneConf"`
-
- // 可支持的灾备可用区信息
- DrZone []*string `json:"DrZone,omitempty" name:"DrZone" list`
-}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb/v20180317/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb/v20180317/client.go
deleted file mode 100644
index 92675ea..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb/v20180317/client.go
+++ /dev/null
@@ -1,836 +0,0 @@
-// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package v20180317
-
-import (
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
- tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
-)
-
-const APIVersion = "2018-03-17"
-
-type Client struct {
- common.Client
-}
-
-// Deprecated
-func NewClientWithSecretId(secretId, secretKey, region string) (client *Client, err error) {
- cpf := profile.NewClientProfile()
- client = &Client{}
- client.Init(region).WithSecretId(secretId, secretKey).WithProfile(cpf)
- return
-}
-
-func NewClient(credential *common.Credential, region string, clientProfile *profile.ClientProfile) (client *Client, err error) {
- client = &Client{}
- client.Init(region).
- WithCredential(credential).
- WithProfile(clientProfile)
- return
-}
-
-
-func NewAutoRewriteRequest() (request *AutoRewriteRequest) {
- request = &AutoRewriteRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "AutoRewrite")
- return
-}
-
-func NewAutoRewriteResponse() (response *AutoRewriteResponse) {
- response = &AutoRewriteResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 系统自动为已存在的HTTPS:443监听器创建HTTP监听器进行转发,默认使用80端口。创建成功后可以通过HTTP:80地址自动跳转为HTTPS:443地址进行访问。
-func (c *Client) AutoRewrite(request *AutoRewriteRequest) (response *AutoRewriteResponse, err error) {
- if request == nil {
- request = NewAutoRewriteRequest()
- }
- response = NewAutoRewriteResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewBatchModifyTargetWeightRequest() (request *BatchModifyTargetWeightRequest) {
- request = &BatchModifyTargetWeightRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "BatchModifyTargetWeight")
- return
-}
-
-func NewBatchModifyTargetWeightResponse() (response *BatchModifyTargetWeightResponse) {
- response = &BatchModifyTargetWeightResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// BatchModifyTargetWeight接口用于批量修改监听器绑定的后端机器的转发权重,当前接口只支持应用型HTTP/HTTPS监听器。
-// 本接口为异步接口,本接口返回成功后需以返回的RequestID为入参,调用DescribeTaskStatus接口查询本次任务是否成功。
-func (c *Client) BatchModifyTargetWeight(request *BatchModifyTargetWeightRequest) (response *BatchModifyTargetWeightResponse, err error) {
- if request == nil {
- request = NewBatchModifyTargetWeightRequest()
- }
- response = NewBatchModifyTargetWeightResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateListenerRequest() (request *CreateListenerRequest) {
- request = &CreateListenerRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "CreateListener")
- return
-}
-
-func NewCreateListenerResponse() (response *CreateListenerResponse) {
- response = &CreateListenerResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 在一个负载均衡实例下创建监听器。
-// 本接口为异步接口,本接口返回成功后需以返回的RequestID为入参,调用DescribeTaskStatus接口查询本次任务是否成功。
-func (c *Client) CreateListener(request *CreateListenerRequest) (response *CreateListenerResponse, err error) {
- if request == nil {
- request = NewCreateListenerRequest()
- }
- response = NewCreateListenerResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateLoadBalancerRequest() (request *CreateLoadBalancerRequest) {
- request = &CreateLoadBalancerRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "CreateLoadBalancer")
- return
-}
-
-func NewCreateLoadBalancerResponse() (response *CreateLoadBalancerResponse) {
- response = &CreateLoadBalancerResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// CreateLoadBalancer 接口用来创建负载均衡实例。为了使用负载均衡服务,您必须要购买一个或者多个负载均衡实例。通过成功调用该接口,会返回负载均衡实例的唯一 ID。用户可以购买的负载均衡实例类型分为:公网(应用型)、内网(应用型)。可以参考产品说明的产品类型。
-// 本接口成功返回后,可使用查询负载均衡实例列表接口DescribeLoadBalancers查询负载均衡实例的状态,以确定是否创建成功。
-func (c *Client) CreateLoadBalancer(request *CreateLoadBalancerRequest) (response *CreateLoadBalancerResponse, err error) {
- if request == nil {
- request = NewCreateLoadBalancerRequest()
- }
- response = NewCreateLoadBalancerResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateRuleRequest() (request *CreateRuleRequest) {
- request = &CreateRuleRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "CreateRule")
- return
-}
-
-func NewCreateRuleResponse() (response *CreateRuleResponse) {
- response = &CreateRuleResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// CreateRule 接口用于在一个已存在的应用型负载均衡七层监听器下创建转发规则,七层监听器中,后端机器必须绑定到规则上而非监听器上。
-// 本接口为异步接口,本接口返回成功后需以返回的RequestID为入参,调用DescribeTaskStatus接口查询本次任务是否成功。
-func (c *Client) CreateRule(request *CreateRuleRequest) (response *CreateRuleResponse, err error) {
- if request == nil {
- request = NewCreateRuleRequest()
- }
- response = NewCreateRuleResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteListenerRequest() (request *DeleteListenerRequest) {
- request = &DeleteListenerRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "DeleteListener")
- return
-}
-
-func NewDeleteListenerResponse() (response *DeleteListenerResponse) {
- response = &DeleteListenerResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口用来删除应用型(四层和七层)负载均衡实例下的监听器。
-// 本接口为异步接口,本接口返回成功后需以返回的RequestID为入参,调用DescribeTaskStatus接口查询本次任务是否成功。
-func (c *Client) DeleteListener(request *DeleteListenerRequest) (response *DeleteListenerResponse, err error) {
- if request == nil {
- request = NewDeleteListenerRequest()
- }
- response = NewDeleteListenerResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteLoadBalancerRequest() (request *DeleteLoadBalancerRequest) {
- request = &DeleteLoadBalancerRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "DeleteLoadBalancer")
- return
-}
-
-func NewDeleteLoadBalancerResponse() (response *DeleteLoadBalancerResponse) {
- response = &DeleteLoadBalancerResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// DeleteLoadBalancer 接口用来删除用户指定的一个负载均衡实例。
-// 本接口为异步接口,本接口返回成功后需以返回的RequestID为入参,调用DescribeTaskStatus接口查询本次任务是否成功。
-func (c *Client) DeleteLoadBalancer(request *DeleteLoadBalancerRequest) (response *DeleteLoadBalancerResponse, err error) {
- if request == nil {
- request = NewDeleteLoadBalancerRequest()
- }
- response = NewDeleteLoadBalancerResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteRewriteRequest() (request *DeleteRewriteRequest) {
- request = &DeleteRewriteRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "DeleteRewrite")
- return
-}
-
-func NewDeleteRewriteResponse() (response *DeleteRewriteResponse) {
- response = &DeleteRewriteResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// DeleteRewrite 接口支持删除指定转发规则之间的重定向关系。
-func (c *Client) DeleteRewrite(request *DeleteRewriteRequest) (response *DeleteRewriteResponse, err error) {
- if request == nil {
- request = NewDeleteRewriteRequest()
- }
- response = NewDeleteRewriteResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteRuleRequest() (request *DeleteRuleRequest) {
- request = &DeleteRuleRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "DeleteRule")
- return
-}
-
-func NewDeleteRuleResponse() (response *DeleteRuleResponse) {
- response = &DeleteRuleResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// DeleteRule 接口用来删除应用型负载均衡实例七层监听器下的转发规则。
-// 本接口为异步接口,本接口返回成功后需以返回的RequestID为入参,调用DescribeTaskStatus接口查询本次任务是否成功。
-func (c *Client) DeleteRule(request *DeleteRuleRequest) (response *DeleteRuleResponse, err error) {
- if request == nil {
- request = NewDeleteRuleRequest()
- }
- response = NewDeleteRuleResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeregisterTargetsRequest() (request *DeregisterTargetsRequest) {
- request = &DeregisterTargetsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "DeregisterTargets")
- return
-}
-
-func NewDeregisterTargetsResponse() (response *DeregisterTargetsResponse) {
- response = &DeregisterTargetsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// DeregisterTargets 接口用来将一台或多台后端机器从应用型负载均衡的监听器上解绑,对于四层监听器(TCP、UDP),只需指定监听器ID即可,对于七层监听器(HTTP、HTTPS),还需通过LocationId或者Domain+Url指定转发规则。
-// 本接口为异步接口,本接口返回成功后需以返回的RequestID为入参,调用DescribeTaskStatus接口查询本次任务是否成功。
-func (c *Client) DeregisterTargets(request *DeregisterTargetsRequest) (response *DeregisterTargetsResponse, err error) {
- if request == nil {
- request = NewDeregisterTargetsRequest()
- }
- response = NewDeregisterTargetsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeregisterTargetsFromClassicalLBRequest() (request *DeregisterTargetsFromClassicalLBRequest) {
- request = &DeregisterTargetsFromClassicalLBRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "DeregisterTargetsFromClassicalLB")
- return
-}
-
-func NewDeregisterTargetsFromClassicalLBResponse() (response *DeregisterTargetsFromClassicalLBResponse) {
- response = &DeregisterTargetsFromClassicalLBResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// DeregisterTargetsFromClassicalLB用于解绑后端服务器
-func (c *Client) DeregisterTargetsFromClassicalLB(request *DeregisterTargetsFromClassicalLBRequest) (response *DeregisterTargetsFromClassicalLBResponse, err error) {
- if request == nil {
- request = NewDeregisterTargetsFromClassicalLBRequest()
- }
- response = NewDeregisterTargetsFromClassicalLBResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeClassicalLBByInstanceIdRequest() (request *DescribeClassicalLBByInstanceIdRequest) {
- request = &DescribeClassicalLBByInstanceIdRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "DescribeClassicalLBByInstanceId")
- return
-}
-
-func NewDescribeClassicalLBByInstanceIdResponse() (response *DescribeClassicalLBByInstanceIdResponse) {
- response = &DescribeClassicalLBByInstanceIdResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// DescribeClassicalLBByInstanceId用于通过后端实例ID获取传统型负载均衡ID列表
-func (c *Client) DescribeClassicalLBByInstanceId(request *DescribeClassicalLBByInstanceIdRequest) (response *DescribeClassicalLBByInstanceIdResponse, err error) {
- if request == nil {
- request = NewDescribeClassicalLBByInstanceIdRequest()
- }
- response = NewDescribeClassicalLBByInstanceIdResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeClassicalLBHealthStatusRequest() (request *DescribeClassicalLBHealthStatusRequest) {
- request = &DescribeClassicalLBHealthStatusRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "DescribeClassicalLBHealthStatus")
- return
-}
-
-func NewDescribeClassicalLBHealthStatusResponse() (response *DescribeClassicalLBHealthStatusResponse) {
- response = &DescribeClassicalLBHealthStatusResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// DescribeClassicalLBHealthStatus用于获取传统型负载均衡后端的健康状态
-func (c *Client) DescribeClassicalLBHealthStatus(request *DescribeClassicalLBHealthStatusRequest) (response *DescribeClassicalLBHealthStatusResponse, err error) {
- if request == nil {
- request = NewDescribeClassicalLBHealthStatusRequest()
- }
- response = NewDescribeClassicalLBHealthStatusResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeClassicalLBListenersRequest() (request *DescribeClassicalLBListenersRequest) {
- request = &DescribeClassicalLBListenersRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "DescribeClassicalLBListeners")
- return
-}
-
-func NewDescribeClassicalLBListenersResponse() (response *DescribeClassicalLBListenersResponse) {
- response = &DescribeClassicalLBListenersResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// DescribeClassicalLBListeners用于获取传统型负载均衡信息
-func (c *Client) DescribeClassicalLBListeners(request *DescribeClassicalLBListenersRequest) (response *DescribeClassicalLBListenersResponse, err error) {
- if request == nil {
- request = NewDescribeClassicalLBListenersRequest()
- }
- response = NewDescribeClassicalLBListenersResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeClassicalLBTargetsRequest() (request *DescribeClassicalLBTargetsRequest) {
- request = &DescribeClassicalLBTargetsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "DescribeClassicalLBTargets")
- return
-}
-
-func NewDescribeClassicalLBTargetsResponse() (response *DescribeClassicalLBTargetsResponse) {
- response = &DescribeClassicalLBTargetsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// DescribeClassicalLBTargets用于获取传统型负载均衡绑定的后端服务
-func (c *Client) DescribeClassicalLBTargets(request *DescribeClassicalLBTargetsRequest) (response *DescribeClassicalLBTargetsResponse, err error) {
- if request == nil {
- request = NewDescribeClassicalLBTargetsRequest()
- }
- response = NewDescribeClassicalLBTargetsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeListenersRequest() (request *DescribeListenersRequest) {
- request = &DescribeListenersRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "DescribeListeners")
- return
-}
-
-func NewDescribeListenersResponse() (response *DescribeListenersResponse) {
- response = &DescribeListenersResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// DescribeListeners 接口可根据负载均衡器 ID,监听器的协议或者端口作为过滤条件获取监听器列表。如果不指定任何过滤条件,默认返该负载均衡器下的默认数据长度(20 个)的监听器。
-func (c *Client) DescribeListeners(request *DescribeListenersRequest) (response *DescribeListenersResponse, err error) {
- if request == nil {
- request = NewDescribeListenersRequest()
- }
- response = NewDescribeListenersResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeLoadBalancersRequest() (request *DescribeLoadBalancersRequest) {
- request = &DescribeLoadBalancersRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "DescribeLoadBalancers")
- return
-}
-
-func NewDescribeLoadBalancersResponse() (response *DescribeLoadBalancersResponse) {
- response = &DescribeLoadBalancersResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 查询负载均衡实例列表
-func (c *Client) DescribeLoadBalancers(request *DescribeLoadBalancersRequest) (response *DescribeLoadBalancersResponse, err error) {
- if request == nil {
- request = NewDescribeLoadBalancersRequest()
- }
- response = NewDescribeLoadBalancersResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeRewriteRequest() (request *DescribeRewriteRequest) {
- request = &DescribeRewriteRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "DescribeRewrite")
- return
-}
-
-func NewDescribeRewriteResponse() (response *DescribeRewriteResponse) {
- response = &DescribeRewriteResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// DescribeRewrite 接口可根据负载均衡实例ID,查询一个负载均衡实例下转发规则的重定向关系。如果不指定监听器ID或转发规则ID,则返回该负载均衡实例下的所有重定向关系。
-func (c *Client) DescribeRewrite(request *DescribeRewriteRequest) (response *DescribeRewriteResponse, err error) {
- if request == nil {
- request = NewDescribeRewriteRequest()
- }
- response = NewDescribeRewriteResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeTargetHealthRequest() (request *DescribeTargetHealthRequest) {
- request = &DescribeTargetHealthRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "DescribeTargetHealth")
- return
-}
-
-func NewDescribeTargetHealthResponse() (response *DescribeTargetHealthResponse) {
- response = &DescribeTargetHealthResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// DescribeTargetHealth 接口用来获取应用型负载均衡后端的健康检查结果。
-func (c *Client) DescribeTargetHealth(request *DescribeTargetHealthRequest) (response *DescribeTargetHealthResponse, err error) {
- if request == nil {
- request = NewDescribeTargetHealthRequest()
- }
- response = NewDescribeTargetHealthResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeTargetsRequest() (request *DescribeTargetsRequest) {
- request = &DescribeTargetsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "DescribeTargets")
- return
-}
-
-func NewDescribeTargetsResponse() (response *DescribeTargetsResponse) {
- response = &DescribeTargetsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// DescribeTargets 接口用来查询应用型负载均衡实例的某些监听器后端绑定的机器列表。
-func (c *Client) DescribeTargets(request *DescribeTargetsRequest) (response *DescribeTargetsResponse, err error) {
- if request == nil {
- request = NewDescribeTargetsRequest()
- }
- response = NewDescribeTargetsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeTaskStatusRequest() (request *DescribeTaskStatusRequest) {
- request = &DescribeTaskStatusRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "DescribeTaskStatus")
- return
-}
-
-func NewDescribeTaskStatusResponse() (response *DescribeTaskStatusResponse) {
- response = &DescribeTaskStatusResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口用于查询异步执行任务的状态,对于非查询类的接口(创建/删除负载均衡实例、监听器、规则以及绑定或解绑后端机器等),在调用成功后都需要使用本接口查询任务是否最终执行成功。
-func (c *Client) DescribeTaskStatus(request *DescribeTaskStatusRequest) (response *DescribeTaskStatusResponse, err error) {
- if request == nil {
- request = NewDescribeTaskStatusRequest()
- }
- response = NewDescribeTaskStatusResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewManualRewriteRequest() (request *ManualRewriteRequest) {
- request = &ManualRewriteRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "ManualRewrite")
- return
-}
-
-func NewManualRewriteResponse() (response *ManualRewriteResponse) {
- response = &ManualRewriteResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 用户手动配置原访问地址和重定向地址,系统自动将原访问地址的请求重定向至对应路径的目的地址。同一域名下可以配置多条路径作为重定向策略,实现http/https之间请求的自动跳转。
-func (c *Client) ManualRewrite(request *ManualRewriteRequest) (response *ManualRewriteResponse, err error) {
- if request == nil {
- request = NewManualRewriteRequest()
- }
- response = NewManualRewriteResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyDomainRequest() (request *ModifyDomainRequest) {
- request = &ModifyDomainRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "ModifyDomain")
- return
-}
-
-func NewModifyDomainResponse() (response *ModifyDomainResponse) {
- response = &ModifyDomainResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// ModifyDomain接口用来修改应用型负载均衡七层监听器下的域名。
-// 本接口为异步接口,本接口返回成功后需以返回的RequestID为入参,调用DescribeTaskStatus接口查询本次任务是否成功。
-func (c *Client) ModifyDomain(request *ModifyDomainRequest) (response *ModifyDomainResponse, err error) {
- if request == nil {
- request = NewModifyDomainRequest()
- }
- response = NewModifyDomainResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyListenerRequest() (request *ModifyListenerRequest) {
- request = &ModifyListenerRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "ModifyListener")
- return
-}
-
-func NewModifyListenerResponse() (response *ModifyListenerResponse) {
- response = &ModifyListenerResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// ModifyListener接口用来修改应用型负载均衡监听器的属性,包括监听器名称、健康检查参数、证书信息、转发策略等。
-// 本接口为异步接口,本接口返回成功后需以返回的RequestID为入参,调用DescribeTaskStatus接口查询本次任务是否成功。
-func (c *Client) ModifyListener(request *ModifyListenerRequest) (response *ModifyListenerResponse, err error) {
- if request == nil {
- request = NewModifyListenerRequest()
- }
- response = NewModifyListenerResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyLoadBalancerAttributesRequest() (request *ModifyLoadBalancerAttributesRequest) {
- request = &ModifyLoadBalancerAttributesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "ModifyLoadBalancerAttributes")
- return
-}
-
-func NewModifyLoadBalancerAttributesResponse() (response *ModifyLoadBalancerAttributesResponse) {
- response = &ModifyLoadBalancerAttributesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 修改负载均衡实例的属性,支持修改负载均衡实例的名称、设置负载均衡的跨域属性。
-// 本接口为异步接口,本接口返回成功后需以返回的RequestID为入参,调用DescribeTaskStatus接口查询本次任务是否成功。
-func (c *Client) ModifyLoadBalancerAttributes(request *ModifyLoadBalancerAttributesRequest) (response *ModifyLoadBalancerAttributesResponse, err error) {
- if request == nil {
- request = NewModifyLoadBalancerAttributesRequest()
- }
- response = NewModifyLoadBalancerAttributesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyRuleRequest() (request *ModifyRuleRequest) {
- request = &ModifyRuleRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "ModifyRule")
- return
-}
-
-func NewModifyRuleResponse() (response *ModifyRuleResponse) {
- response = &ModifyRuleResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// ModifyRule 接口用来修改应用型负载均衡七层监听器下的转发规则的各项属性,包括转发路径、健康检查属性、转发策略等。
-// 本接口为异步接口,本接口返回成功后需以返回的RequestID为入参,调用DescribeTaskStatus接口查询本次任务是否成功。
-func (c *Client) ModifyRule(request *ModifyRuleRequest) (response *ModifyRuleResponse, err error) {
- if request == nil {
- request = NewModifyRuleRequest()
- }
- response = NewModifyRuleResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyTargetPortRequest() (request *ModifyTargetPortRequest) {
- request = &ModifyTargetPortRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "ModifyTargetPort")
- return
-}
-
-func NewModifyTargetPortResponse() (response *ModifyTargetPortResponse) {
- response = &ModifyTargetPortResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// ModifyTargetPort接口用于修改监听器绑定的后端云服务器的端口。
-// 本接口为异步接口,本接口返回成功后需以返回的RequestID为入参,调用DescribeTaskStatus接口查询本次任务是否成功。
-func (c *Client) ModifyTargetPort(request *ModifyTargetPortRequest) (response *ModifyTargetPortResponse, err error) {
- if request == nil {
- request = NewModifyTargetPortRequest()
- }
- response = NewModifyTargetPortResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyTargetWeightRequest() (request *ModifyTargetWeightRequest) {
- request = &ModifyTargetWeightRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "ModifyTargetWeight")
- return
-}
-
-func NewModifyTargetWeightResponse() (response *ModifyTargetWeightResponse) {
- response = &ModifyTargetWeightResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// ModifyTargetWeight 接口用于修改监听器绑定的后端机器的转发权重。
-// 本接口为异步接口,本接口返回成功后需以返回的RequestID为入参,调用DescribeTaskStatus接口查询本次任务是否成功。
-func (c *Client) ModifyTargetWeight(request *ModifyTargetWeightRequest) (response *ModifyTargetWeightResponse, err error) {
- if request == nil {
- request = NewModifyTargetWeightRequest()
- }
- response = NewModifyTargetWeightResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewRegisterTargetsRequest() (request *RegisterTargetsRequest) {
- request = &RegisterTargetsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "RegisterTargets")
- return
-}
-
-func NewRegisterTargetsResponse() (response *RegisterTargetsResponse) {
- response = &RegisterTargetsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// RegisterTargets 接口用来将一台或多台后端机器注册到应用型负载均衡的监听器,对于四层监听器(TCP、UDP),只需指定监听器ID即可,对于七层监听器(HTTP、HTTPS),还需通过LocationId或者Domain+Url指定转发规则。
-// 本接口为异步接口,本接口返回成功后需以返回的RequestID为入参,调用DescribeTaskStatus接口查询本次任务是否成功。
-func (c *Client) RegisterTargets(request *RegisterTargetsRequest) (response *RegisterTargetsResponse, err error) {
- if request == nil {
- request = NewRegisterTargetsRequest()
- }
- response = NewRegisterTargetsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewRegisterTargetsWithClassicalLBRequest() (request *RegisterTargetsWithClassicalLBRequest) {
- request = &RegisterTargetsWithClassicalLBRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "RegisterTargetsWithClassicalLB")
- return
-}
-
-func NewRegisterTargetsWithClassicalLBResponse() (response *RegisterTargetsWithClassicalLBResponse) {
- response = &RegisterTargetsWithClassicalLBResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// RegisterTargetsWithClassicalLB用于绑定后端服务到传统型负载均衡
-func (c *Client) RegisterTargetsWithClassicalLB(request *RegisterTargetsWithClassicalLBRequest) (response *RegisterTargetsWithClassicalLBResponse, err error) {
- if request == nil {
- request = NewRegisterTargetsWithClassicalLBRequest()
- }
- response = NewRegisterTargetsWithClassicalLBResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewSetLoadBalancerSecurityGroupsRequest() (request *SetLoadBalancerSecurityGroupsRequest) {
- request = &SetLoadBalancerSecurityGroupsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("clb", APIVersion, "SetLoadBalancerSecurityGroups")
- return
-}
-
-func NewSetLoadBalancerSecurityGroupsResponse() (response *SetLoadBalancerSecurityGroupsResponse) {
- response = &SetLoadBalancerSecurityGroupsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// SetLoadBalancerSecurityGroups 接口支持对一个负载均衡实例执行设置(绑定、解绑)安全组操作,查询一个负载均衡实例目前已绑定的安全组,可使用 DescribeLoadBalancers 接口。
-// 绑定操作时,入参需要传入负载均衡实例要绑定的所有安全组(已绑定的+新增绑定的)。
-// 解绑操作时,入参需要传入负载均衡实例执行解绑后所绑定的所有安全组;如果要解绑所有安全组,可传入空数组。
-func (c *Client) SetLoadBalancerSecurityGroups(request *SetLoadBalancerSecurityGroupsRequest) (response *SetLoadBalancerSecurityGroupsResponse, err error) {
- if request == nil {
- request = NewSetLoadBalancerSecurityGroupsRequest()
- }
- response = NewSetLoadBalancerSecurityGroupsResponse()
- err = c.Send(request, response)
- return
-}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb/v20180317/models.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb/v20180317/models.go
deleted file mode 100644
index d0c77da..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb/v20180317/models.go
+++ /dev/null
@@ -1,2035 +0,0 @@
-// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package v20180317
-
-import (
- "encoding/json"
-
- tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http"
-)
-
-type AutoRewriteRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 监听器ID
- ListenerId *string `json:"ListenerId,omitempty" name:"ListenerId"`
-
- // 需要重定向的域名
- Domains []*string `json:"Domains,omitempty" name:"Domains" list`
-}
-
-func (r *AutoRewriteRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AutoRewriteRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AutoRewriteResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *AutoRewriteResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AutoRewriteResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type Backend struct {
-
- // 转发目标的类型,目前仅可取值为 CVM
- Type *string `json:"Type,omitempty" name:"Type"`
-
- // 云服务器的唯一 ID,可通过 DescribeInstances 接口返回字段中的 unInstanceId 字段获取
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 后端云服务器监听端口
- Port *int64 `json:"Port,omitempty" name:"Port"`
-
- // 后端云服务器的转发权重,取值范围:0~100,默认为 10。
- Weight *int64 `json:"Weight,omitempty" name:"Weight"`
-
- // 云服务器的外网 IP
- // 注意:此字段可能返回 null,表示取不到有效值。
- PublicIpAddresses []*string `json:"PublicIpAddresses,omitempty" name:"PublicIpAddresses" list`
-
- // 云服务器的内网 IP
- // 注意:此字段可能返回 null,表示取不到有效值。
- PrivateIpAddresses []*string `json:"PrivateIpAddresses,omitempty" name:"PrivateIpAddresses" list`
-
- // 云服务器实例名称
- // 注意:此字段可能返回 null,表示取不到有效值。
- InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"`
-
- // 云服务器被绑定到监听器的时间
- // 注意:此字段可能返回 null,表示取不到有效值。
- RegisteredTime *string `json:"RegisteredTime,omitempty" name:"RegisteredTime"`
-}
-
-type BatchModifyTargetWeightRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例 ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 要批量修改权重的列表
- ModifyList []*RsWeightRule `json:"ModifyList,omitempty" name:"ModifyList" list`
-}
-
-func (r *BatchModifyTargetWeightRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *BatchModifyTargetWeightRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type BatchModifyTargetWeightResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *BatchModifyTargetWeightResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *BatchModifyTargetWeightResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CertificateInput struct {
-
- // 认证类型,UNIDIRECTIONAL:单向认证,MUTUAL:双向认证
- SSLMode *string `json:"SSLMode,omitempty" name:"SSLMode"`
-
- // 服务端证书的 ID,如果不填写此项则必须上传证书,包括 CertContent,CertKey,CertName。
- CertId *string `json:"CertId,omitempty" name:"CertId"`
-
- // 客户端证书的 ID,如果 SSLMode=mutual,监听器如果不填写此项则必须上传客户端证书,包括 CertCaContent,CertCaName。
- CertCaId *string `json:"CertCaId,omitempty" name:"CertCaId"`
-
- // 上传服务端证书的名称,如果没有 CertId,则此项必传。
- CertName *string `json:"CertName,omitempty" name:"CertName"`
-
- // 上传服务端证书的 key,如果没有 CertId,则此项必传。
- CertKey *string `json:"CertKey,omitempty" name:"CertKey"`
-
- // 上传服务端证书的内容,如果没有 CertId,则此项必传。
- CertContent *string `json:"CertContent,omitempty" name:"CertContent"`
-
- // 上传客户端 CA 证书的名称,如果 SSLMode=mutual,如果没有 CertCaId,则此项必传。
- CertCaName *string `json:"CertCaName,omitempty" name:"CertCaName"`
-
- // 上传客户端证书的内容,如果 SSLMode=mutual,如果没有 CertCaId,则此项必传。
- CertCaContent *string `json:"CertCaContent,omitempty" name:"CertCaContent"`
-}
-
-type CertificateOutput struct {
-
- // 认证类型,unidirectional:单向认证,mutual:双向认证
- SSLMode *string `json:"SSLMode,omitempty" name:"SSLMode"`
-
- // 服务端证书的 ID。
- CertId *string `json:"CertId,omitempty" name:"CertId"`
-
- // 客户端证书的 ID。
- // 注意:此字段可能返回 null,表示取不到有效值。
- CertCaId *string `json:"CertCaId,omitempty" name:"CertCaId"`
-}
-
-type ClassicalHealth struct {
-
- // 云服务器内网 IP
- IP *string `json:"IP,omitempty" name:"IP"`
-
- // 云服务器端口
- Port *int64 `json:"Port,omitempty" name:"Port"`
-
- // 负载均衡监听端口
- ListenerPort *int64 `json:"ListenerPort,omitempty" name:"ListenerPort"`
-
- // 转发协议
- Protocol *string `json:"Protocol,omitempty" name:"Protocol"`
-
- // 健康检查结果,1 表示健康,0 表示不健康
- HealthStatus *int64 `json:"HealthStatus,omitempty" name:"HealthStatus"`
-}
-
-type ClassicalListener struct {
-
- // 负载均衡监听器ID
- ListenerId *string `json:"ListenerId,omitempty" name:"ListenerId"`
-
- // 负载均衡监听器端口
- ListenerPort *int64 `json:"ListenerPort,omitempty" name:"ListenerPort"`
-
- // 监听器后端转发端口
- InstancePort *int64 `json:"InstancePort,omitempty" name:"InstancePort"`
-
- // 监听器名称
- ListenerName *string `json:"ListenerName,omitempty" name:"ListenerName"`
-
- // 监听器协议类型
- Protocol *string `json:"Protocol,omitempty" name:"Protocol"`
-
- // 会话保持时间
- SessionExpire *int64 `json:"SessionExpire,omitempty" name:"SessionExpire"`
-
- // 是否开启了检查:1(开启)、0(关闭)
- HealthSwitch *int64 `json:"HealthSwitch,omitempty" name:"HealthSwitch"`
-
- // 响应超时时间
- TimeOut *int64 `json:"TimeOut,omitempty" name:"TimeOut"`
-
- // 检查间隔
- IntervalTime *int64 `json:"IntervalTime,omitempty" name:"IntervalTime"`
-
- // 健康阈值
- HealthNum *int64 `json:"HealthNum,omitempty" name:"HealthNum"`
-
- // 不健康阈值
- UnhealthNum *int64 `json:"UnhealthNum,omitempty" name:"UnhealthNum"`
-
- // 公网固定IP型的 HTTP、HTTPS 协议监听器的轮询方法。wrr 表示按权重轮询,ip_hash 表示根据访问的源 IP 进行一致性哈希方式来分发
- HttpHash *string `json:"HttpHash,omitempty" name:"HttpHash"`
-
- // 公网固定IP型的 HTTP、HTTPS 协议监听器的健康检查返回码。具体可参考创建监听器中对该字段的解释
- HttpCode *int64 `json:"HttpCode,omitempty" name:"HttpCode"`
-
- // 公网固定IP型的 HTTP、HTTPS 协议监听器的健康检查路径
- HttpCheckPath *string `json:"HttpCheckPath,omitempty" name:"HttpCheckPath"`
-
- // 公网固定IP型的 HTTPS 协议监听器的认证方式
- SSLMode *string `json:"SSLMode,omitempty" name:"SSLMode"`
-
- // 公网固定IP型的 HTTPS 协议监听器服务端证书 ID
- CertId *string `json:"CertId,omitempty" name:"CertId"`
-
- // 公网固定IP型的 HTTPS 协议监听器客户端证书 ID
- CertCaId *string `json:"CertCaId,omitempty" name:"CertCaId"`
-
- // 监听器的状态,0 表示创建中,1 表示运行中
- Status *int64 `json:"Status,omitempty" name:"Status"`
-}
-
-type ClassicalLoadBalancerInfo struct {
-
- // 后端实例ID
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 负载均衡实例ID列表
- // 注意:此字段可能返回 null,表示取不到有效值。
- LoadBalancerIds []*string `json:"LoadBalancerIds,omitempty" name:"LoadBalancerIds" list`
-}
-
-type ClassicalTarget struct {
-
- // 转发目标的类型,目前仅可取值为 CVM
- Type *string `json:"Type,omitempty" name:"Type"`
-
- // 云服务器的唯一 ID,可通过 DescribeInstances 接口返回字段中的 unInstanceId 字段获取
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 后端云服务器的转发权重,取值范围:0~100,默认为 10。
- Weight *int64 `json:"Weight,omitempty" name:"Weight"`
-
- // 云服务器的外网 IP
- // 注意:此字段可能返回 null,表示取不到有效值。
- PublicIpAddresses []*string `json:"PublicIpAddresses,omitempty" name:"PublicIpAddresses" list`
-
- // 云服务器的内网 IP
- // 注意:此字段可能返回 null,表示取不到有效值。
- PrivateIpAddresses []*string `json:"PrivateIpAddresses,omitempty" name:"PrivateIpAddresses" list`
-
- // 云服务器实例名称
- // 注意:此字段可能返回 null,表示取不到有效值。
- InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"`
-
- // 云服务器状态
- // 1:故障,2:运行中,3:创建中,4:已关机,5:已退还,6:退还中, 7:重启中,8:开机中,9:关机中,10:密码重置中,11:格式化中,12:镜像制作中,13:带宽设置中,14:重装系统中,19:升级中,21:热迁移中
- // 注意:此字段可能返回 null,表示取不到有效值。
- RunFlag *int64 `json:"RunFlag,omitempty" name:"RunFlag"`
-}
-
-type ClassicalTargetInfo struct {
-
- // 后端实例ID
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 权重 取值为0-100
- Weight *int64 `json:"Weight,omitempty" name:"Weight"`
-}
-
-type CreateListenerRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例 ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 要将监听器创建到哪些端口,每个端口对应一个新的监听器
- Ports []*int64 `json:"Ports,omitempty" name:"Ports" list`
-
- // 监听器协议: TCP | UDP | HTTP | HTTPS | TCP_SSL(TCP_SSL 正在内测中,如需使用请通过工单申请)
- Protocol *string `json:"Protocol,omitempty" name:"Protocol"`
-
- // 要创建的监听器名称列表,名称与Ports数组按序一一对应,如不需立即命名,则无需提供此参数
- ListenerNames []*string `json:"ListenerNames,omitempty" name:"ListenerNames" list`
-
- // 健康检查相关参数,此参数仅适用于TCP/UDP/TCP_SSL监听器
- HealthCheck *HealthCheck `json:"HealthCheck,omitempty" name:"HealthCheck"`
-
- // 证书相关信息,此参数仅适用于HTTPS/TCP_SSL监听器
- Certificate *CertificateInput `json:"Certificate,omitempty" name:"Certificate"`
-
- // 会话保持时间,单位:秒。可选值:30~3600,默认 0,表示不开启。此参数仅适用于TCP/UDP监听器。
- SessionExpireTime *int64 `json:"SessionExpireTime,omitempty" name:"SessionExpireTime"`
-
- // 监听器转发的方式。可选值:WRR、LEAST_CONN
- // 分别表示按权重轮询、最小连接数, 默认为 WRR。此参数仅适用于TCP/UDP/TCP_SSL监听器。
- Scheduler *string `json:"Scheduler,omitempty" name:"Scheduler"`
-
- // 是否开启SNI特性,此参数仅适用于HTTPS监听器。
- SniSwitch *int64 `json:"SniSwitch,omitempty" name:"SniSwitch"`
-}
-
-func (r *CreateListenerRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateListenerRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateListenerResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 创建的监听器的唯一标识数组
- ListenerIds []*string `json:"ListenerIds,omitempty" name:"ListenerIds" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateListenerResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateListenerResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateLoadBalancerRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例的网络类型:
- // OPEN:公网属性, INTERNAL:内网属性。
- LoadBalancerType *string `json:"LoadBalancerType,omitempty" name:"LoadBalancerType"`
-
- // 负载均衡实例。1:应用型,0:传统型,默认为应用型负载均衡实例。
- Forward *int64 `json:"Forward,omitempty" name:"Forward"`
-
- // 负载均衡实例的名称,只用来创建一个的时候生效。规则:1-50 个英文、汉字、数字、连接线“-”或下划线“_”。
- // 注意:如果名称与系统中已有负载均衡实例的名称重复的话,则系统将会自动生成此次创建的负载均衡实例的名称。
- LoadBalancerName *string `json:"LoadBalancerName,omitempty" name:"LoadBalancerName"`
-
- // 负载均衡后端实例所属网络 ID,可以通过 DescribeVpcEx 接口获取。 不填则默认为基础网络。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 在私有网络内购买内网负载均衡实例的时候需要指定子网 ID,内网负载均衡实例的 VIP 将从这个子网中产生。其他情况不用填写该字段。
- SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"`
-
- // 负载均衡实例所属的项目 ID,可以通过 DescribeProject 接口获取。不填则属于默认项目。
- ProjectId *int64 `json:"ProjectId,omitempty" name:"ProjectId"`
-}
-
-func (r *CreateLoadBalancerRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateLoadBalancerRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateLoadBalancerResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 由负载均衡实例统一 ID 组成的数组。
- LoadBalancerIds []*string `json:"LoadBalancerIds,omitempty" name:"LoadBalancerIds" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateLoadBalancerResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateLoadBalancerResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateRuleRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例 ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 监听器 ID
- ListenerId *string `json:"ListenerId,omitempty" name:"ListenerId"`
-
- // 新建转发规则的信息
- Rules []*RuleInput `json:"Rules,omitempty" name:"Rules" list`
-}
-
-func (r *CreateRuleRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateRuleRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateRuleResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateRuleResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateRuleResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteListenerRequest struct {
- *tchttp.BaseRequest
-
- // 应用型负载均衡实例 ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 要删除的监听器 ID
- ListenerId *string `json:"ListenerId,omitempty" name:"ListenerId"`
-}
-
-func (r *DeleteListenerRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteListenerRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteListenerResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteListenerResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteListenerResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteLoadBalancerRequest struct {
- *tchttp.BaseRequest
-
- // 要删除的负载均衡实例 ID数组
- LoadBalancerIds []*string `json:"LoadBalancerIds,omitempty" name:"LoadBalancerIds" list`
-}
-
-func (r *DeleteLoadBalancerRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteLoadBalancerRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteLoadBalancerResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteLoadBalancerResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteLoadBalancerResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteRewriteRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 源监听器ID
- SourceListenerId *string `json:"SourceListenerId,omitempty" name:"SourceListenerId"`
-
- // 目标监听器ID
- TargetListenerId *string `json:"TargetListenerId,omitempty" name:"TargetListenerId"`
-
- // 转发规则之间的重定向关系
- RewriteInfos []*RewriteLocationMap `json:"RewriteInfos,omitempty" name:"RewriteInfos" list`
-}
-
-func (r *DeleteRewriteRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteRewriteRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteRewriteResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteRewriteResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteRewriteResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteRuleRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例 ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 应用型负载均衡监听器 ID
- ListenerId *string `json:"ListenerId,omitempty" name:"ListenerId"`
-
- // 要删除的转发规则的ID组成的数组
- LocationIds []*string `json:"LocationIds,omitempty" name:"LocationIds" list`
-
- // 要删除的转发规则的域名,已提供LocationIds参数时本参数不生效
- Domain *string `json:"Domain,omitempty" name:"Domain"`
-
- // 要删除的转发规则的转发路径,已提供LocationIds参数时本参数不生效
- Url *string `json:"Url,omitempty" name:"Url"`
-}
-
-func (r *DeleteRuleRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteRuleRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteRuleResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteRuleResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteRuleResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeregisterTargetsFromClassicalLBRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例 ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 后端实例ID列表
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-}
-
-func (r *DeregisterTargetsFromClassicalLBRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeregisterTargetsFromClassicalLBRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeregisterTargetsFromClassicalLBResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeregisterTargetsFromClassicalLBResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeregisterTargetsFromClassicalLBResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeregisterTargetsRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例 ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 监听器 ID
- ListenerId *string `json:"ListenerId,omitempty" name:"ListenerId"`
-
- // 要解绑的后端机器列表,数组长度最大支持20
- Targets []*Target `json:"Targets,omitempty" name:"Targets" list`
-
- // 转发规则的ID,当从七层转发规则解绑机器时,必须提供此参数或Domain+Url两者之一
- LocationId *string `json:"LocationId,omitempty" name:"LocationId"`
-
- // 目标规则的域名,提供LocationId参数时本参数不生效
- Domain *string `json:"Domain,omitempty" name:"Domain"`
-
- // 目标规则的URL,提供LocationId参数时本参数不生效
- Url *string `json:"Url,omitempty" name:"Url"`
-}
-
-func (r *DeregisterTargetsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeregisterTargetsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeregisterTargetsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeregisterTargetsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeregisterTargetsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeClassicalLBByInstanceIdRequest struct {
- *tchttp.BaseRequest
-
- // 后端实例ID列表
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-}
-
-func (r *DescribeClassicalLBByInstanceIdRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeClassicalLBByInstanceIdRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeClassicalLBByInstanceIdResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 负载均衡相关信息列表
- LoadBalancerInfoList []*ClassicalLoadBalancerInfo `json:"LoadBalancerInfoList,omitempty" name:"LoadBalancerInfoList" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeClassicalLBByInstanceIdResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeClassicalLBByInstanceIdResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeClassicalLBHealthStatusRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例 ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 负载均衡监听器ID
- ListenerId *string `json:"ListenerId,omitempty" name:"ListenerId"`
-}
-
-func (r *DescribeClassicalLBHealthStatusRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeClassicalLBHealthStatusRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeClassicalLBHealthStatusResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 后端健康状态列表
- // 注意:此字段可能返回 null,表示取不到有效值。
- HealthList []*ClassicalHealth `json:"HealthList,omitempty" name:"HealthList" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeClassicalLBHealthStatusResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeClassicalLBHealthStatusResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeClassicalLBListenersRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例 ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 负载均衡监听器ID列表, 范围[1-65535]
- ListenerIds []*string `json:"ListenerIds,omitempty" name:"ListenerIds" list`
-
- // 负载均衡监听的协议, 'TCP', 'UDP', 'HTTP', 'HTTPS'
- Protocol *string `json:"Protocol,omitempty" name:"Protocol"`
-
- // 负载均衡监听端口
- ListenerPort *int64 `json:"ListenerPort,omitempty" name:"ListenerPort"`
-
- // 监听器的状态,0 表示创建中,1 表示运行中
- Status *int64 `json:"Status,omitempty" name:"Status"`
-}
-
-func (r *DescribeClassicalLBListenersRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeClassicalLBListenersRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeClassicalLBListenersResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 监听器列表
- // 注意:此字段可能返回 null,表示取不到有效值。
- Listeners []*ClassicalListener `json:"Listeners,omitempty" name:"Listeners" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeClassicalLBListenersResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeClassicalLBListenersResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeClassicalLBTargetsRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例 ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-}
-
-func (r *DescribeClassicalLBTargetsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeClassicalLBTargetsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeClassicalLBTargetsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 后端服务列表
- // 注意:此字段可能返回 null,表示取不到有效值。
- Targets []*ClassicalTarget `json:"Targets,omitempty" name:"Targets" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeClassicalLBTargetsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeClassicalLBTargetsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeListenersRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例 ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 要查询的应用型负载均衡监听器 ID数组
- ListenerIds []*string `json:"ListenerIds,omitempty" name:"ListenerIds" list`
-
- // 要查询的监听器协议类型,取值 TCP | UDP | HTTP | HTTPS | TCP_SSL
- Protocol *string `json:"Protocol,omitempty" name:"Protocol"`
-
- // 要查询的监听器的端口
- Port *int64 `json:"Port,omitempty" name:"Port"`
-}
-
-func (r *DescribeListenersRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeListenersRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeListenersResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 监听器列表
- Listeners []*Listener `json:"Listeners,omitempty" name:"Listeners" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeListenersResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeListenersResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeLoadBalancersRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例 ID。
- LoadBalancerIds []*string `json:"LoadBalancerIds,omitempty" name:"LoadBalancerIds" list`
-
- // 负载均衡实例的网络类型:
- // OPEN:公网属性, INTERNAL:内网属性。
- LoadBalancerType *string `json:"LoadBalancerType,omitempty" name:"LoadBalancerType"`
-
- // 1:应用型,0:传统型。
- Forward *int64 `json:"Forward,omitempty" name:"Forward"`
-
- // 负载均衡实例名称。
- LoadBalancerName *string `json:"LoadBalancerName,omitempty" name:"LoadBalancerName"`
-
- // 腾讯云为负载均衡实例分配的域名,应用型负载均衡该字段无意义。
- Domain *string `json:"Domain,omitempty" name:"Domain"`
-
- // 负载均衡实例的 VIP 地址,支持多个。
- LoadBalancerVips []*string `json:"LoadBalancerVips,omitempty" name:"LoadBalancerVips" list`
-
- // 后端云服务器的外网 IP。
- BackendPublicIps []*string `json:"BackendPublicIps,omitempty" name:"BackendPublicIps" list`
-
- // 后端云服务器的内网 IP。
- BackendPrivateIps []*string `json:"BackendPrivateIps,omitempty" name:"BackendPrivateIps" list`
-
- // 数据偏移量,默认为 0。
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 返回负载均衡个数,默认为 20。
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-
- // 排序字段,支持以下字段:LoadBalancerName,CreateTime,Domain,LoadBalancerType。
- OrderBy *string `json:"OrderBy,omitempty" name:"OrderBy"`
-
- // 1:倒序,0:顺序,默认按照创建时间倒序。
- OrderType *int64 `json:"OrderType,omitempty" name:"OrderType"`
-
- // 搜索字段,模糊匹配名称、域名、VIP。
- SearchKey *string `json:"SearchKey,omitempty" name:"SearchKey"`
-
- // 负载均衡实例所属的项目 ID,可以通过 DescribeProject 接口获取。
- ProjectId *int64 `json:"ProjectId,omitempty" name:"ProjectId"`
-
- // 查询的负载均衡是否绑定后端服务器,0:没有绑定云服务器,1:绑定云服务器,-1:查询全部。
- WithRs *int64 `json:"WithRs,omitempty" name:"WithRs"`
-
- // 负载均衡实例所属私有网络,如 vpc-bhqkbhdx,
- // 基础网络不支持通过VpcId查询。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 安全组ID,如 sg-m1cc9123
- SecurityGroup *string `json:"SecurityGroup,omitempty" name:"SecurityGroup"`
-}
-
-func (r *DescribeLoadBalancersRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeLoadBalancersRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeLoadBalancersResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 满足过滤条件的负载均衡实例总数。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 返回的负载均衡实例数组。
- LoadBalancerSet []*LoadBalancer `json:"LoadBalancerSet,omitempty" name:"LoadBalancerSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeLoadBalancersResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeLoadBalancersResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeRewriteRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 负载均衡监听器ID数组
- SourceListenerIds []*string `json:"SourceListenerIds,omitempty" name:"SourceListenerIds" list`
-
- // 负载均衡转发规则的ID数组
- SourceLocationIds []*string `json:"SourceLocationIds,omitempty" name:"SourceLocationIds" list`
-}
-
-func (r *DescribeRewriteRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeRewriteRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeRewriteResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 重定向转发规则构成的数组,若无重定向规则,则返回空数组
- RewriteSet []*RuleOutput `json:"RewriteSet,omitempty" name:"RewriteSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeRewriteResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeRewriteResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeTargetHealthRequest struct {
- *tchttp.BaseRequest
-
- // 要查询的负载均衡实例 ID列表
- LoadBalancerIds []*string `json:"LoadBalancerIds,omitempty" name:"LoadBalancerIds" list`
-}
-
-func (r *DescribeTargetHealthRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeTargetHealthRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeTargetHealthResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 负载均衡实例列表
- // 注意:此字段可能返回 null,表示取不到有效值。
- LoadBalancers []*LoadBalancerHealth `json:"LoadBalancers,omitempty" name:"LoadBalancers" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeTargetHealthResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeTargetHealthResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeTargetsRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例 ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 监听器 ID列表
- ListenerIds []*string `json:"ListenerIds,omitempty" name:"ListenerIds" list`
-
- // 监听器协议类型
- Protocol *string `json:"Protocol,omitempty" name:"Protocol"`
-
- // 负载均衡监听器端口
- Port *int64 `json:"Port,omitempty" name:"Port"`
-}
-
-func (r *DescribeTargetsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeTargetsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeTargetsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 监听器后端绑定的机器信息
- Listeners []*ListenerBackend `json:"Listeners,omitempty" name:"Listeners" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeTargetsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeTargetsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeTaskStatusRequest struct {
- *tchttp.BaseRequest
-
- // 请求ID,即接口返回的RequestId
- TaskId *string `json:"TaskId,omitempty" name:"TaskId"`
-}
-
-func (r *DescribeTaskStatusRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeTaskStatusRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeTaskStatusResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 任务的当前状态。 0:成功,1:失败,2:进行中。
- Status *int64 `json:"Status,omitempty" name:"Status"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeTaskStatusResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeTaskStatusResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type HealthCheck struct {
-
- // 是否开启健康检查:1(开启)、0(关闭)。
- HealthSwitch *int64 `json:"HealthSwitch,omitempty" name:"HealthSwitch"`
-
- // 健康检查的响应超时时间,可选值:2~60,默认值:2,单位:秒。响应超时时间要小于检查间隔时间。
- // 注意:此字段可能返回 null,表示取不到有效值。
- TimeOut *int64 `json:"TimeOut,omitempty" name:"TimeOut"`
-
- // 健康检查探测间隔时间,默认值:5,可选值:5~300,单位:秒。
- // 注意:此字段可能返回 null,表示取不到有效值。
- IntervalTime *int64 `json:"IntervalTime,omitempty" name:"IntervalTime"`
-
- // 健康阈值,默认值:3,表示当连续探测三次健康则表示该转发正常,可选值:2~10,单位:次。
- // 注意:此字段可能返回 null,表示取不到有效值。
- HealthNum *int64 `json:"HealthNum,omitempty" name:"HealthNum"`
-
- // 不健康阈值,默认值:3,表示当连续探测三次不健康则表示该转发异常,可选值:2~10,单位:次。
- // 注意:此字段可能返回 null,表示取不到有效值。
- UnHealthNum *int64 `json:"UnHealthNum,omitempty" name:"UnHealthNum"`
-
- // 健康检查状态码(仅适用于HTTP/HTTPS转发规则)。可选值:1~31,默认 31。
- // 1 表示探测后返回值 1xx 表示健康,2 表示返回 2xx 表示健康,4 表示返回 3xx 表示健康,8 表示返回 4xx 表示健康,16 表示返回 5xx 表示健康。若希望多种码都表示健康,则将相应的值相加。
- // 注意:此字段可能返回 null,表示取不到有效值。
- HttpCode *int64 `json:"HttpCode,omitempty" name:"HttpCode"`
-
- // 健康检查路径(仅适用于HTTP/HTTPS转发规则)。
- // 注意:此字段可能返回 null,表示取不到有效值。
- HttpCheckPath *string `json:"HttpCheckPath,omitempty" name:"HttpCheckPath"`
-
- // 健康检查域名(仅适用于HTTP/HTTPS转发规则)。
- // 注意:此字段可能返回 null,表示取不到有效值。
- HttpCheckDomain *string `json:"HttpCheckDomain,omitempty" name:"HttpCheckDomain"`
-
- // 健康检查方法(仅适用于HTTP/HTTPS转发规则),取值为HEAD或GET。
- // 注意:此字段可能返回 null,表示取不到有效值。
- HttpCheckMethod *string `json:"HttpCheckMethod,omitempty" name:"HttpCheckMethod"`
-}
-
-type Listener struct {
-
- // 应用型负载均衡监听器 ID
- ListenerId *string `json:"ListenerId,omitempty" name:"ListenerId"`
-
- // 监听器协议
- Protocol *string `json:"Protocol,omitempty" name:"Protocol"`
-
- // 监听器端口
- Port *int64 `json:"Port,omitempty" name:"Port"`
-
- // 监听器绑定的证书信息
- // 注意:此字段可能返回 null,表示取不到有效值。
- Certificate *CertificateOutput `json:"Certificate,omitempty" name:"Certificate"`
-
- // 监听器的健康检查信息
- // 注意:此字段可能返回 null,表示取不到有效值。
- HealthCheck *HealthCheck `json:"HealthCheck,omitempty" name:"HealthCheck"`
-
- // 请求的调度方式
- // 注意:此字段可能返回 null,表示取不到有效值。
- Scheduler *string `json:"Scheduler,omitempty" name:"Scheduler"`
-
- // 会话保持时间
- // 注意:此字段可能返回 null,表示取不到有效值。
- SessionExpireTime *int64 `json:"SessionExpireTime,omitempty" name:"SessionExpireTime"`
-
- // 是否开启SNI特性(本参数仅对于HTTPS监听器有意义)
- // 注意:此字段可能返回 null,表示取不到有效值。
- SniSwitch *int64 `json:"SniSwitch,omitempty" name:"SniSwitch"`
-
- // 监听器下的全部转发规则(本参数仅对于HTTP/HTTPS监听器有意义)
- // 注意:此字段可能返回 null,表示取不到有效值。
- Rules []*RuleOutput `json:"Rules,omitempty" name:"Rules" list`
-
- // 监听器的名称
- // 注意:此字段可能返回 null,表示取不到有效值。
- ListenerName *string `json:"ListenerName,omitempty" name:"ListenerName"`
-}
-
-type ListenerBackend struct {
-
- // 监听器 ID
- ListenerId *string `json:"ListenerId,omitempty" name:"ListenerId"`
-
- // 监听器的协议
- Protocol *string `json:"Protocol,omitempty" name:"Protocol"`
-
- // 监听器的端口
- Port *int64 `json:"Port,omitempty" name:"Port"`
-
- // 监听器下的规则信息(仅适用于HTTP/HTTPS监听器)
- // 注意:此字段可能返回 null,表示取不到有效值。
- Rules []*RuleTargets `json:"Rules,omitempty" name:"Rules" list`
-
- // 监听器上注册的机器列表(仅适用于TCP/UDP/TCP_SSL监听器)
- // 注意:此字段可能返回 null,表示取不到有效值。
- Targets []*Backend `json:"Targets,omitempty" name:"Targets" list`
-}
-
-type ListenerHealth struct {
-
- // 监听器ID
- ListenerId *string `json:"ListenerId,omitempty" name:"ListenerId"`
-
- // 监听器名称
- // 注意:此字段可能返回 null,表示取不到有效值。
- ListenerName *string `json:"ListenerName,omitempty" name:"ListenerName"`
-
- // 监听器的协议
- Protocol *string `json:"Protocol,omitempty" name:"Protocol"`
-
- // 监听器的端口
- Port *int64 `json:"Port,omitempty" name:"Port"`
-
- // 监听器的转发规则列表
- // 注意:此字段可能返回 null,表示取不到有效值。
- Rules []*RuleHealth `json:"Rules,omitempty" name:"Rules" list`
-}
-
-type LoadBalancer struct {
-
- // 负载均衡实例 ID。
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 负载均衡实例的名称。
- LoadBalancerName *string `json:"LoadBalancerName,omitempty" name:"LoadBalancerName"`
-
- // 负载均衡实例的网络类型:
- // OPEN:公网属性, INTERNAL:内网属性。
- LoadBalancerType *string `json:"LoadBalancerType,omitempty" name:"LoadBalancerType"`
-
- // 应用型负载均衡标识,1:应用型负载均衡,0:传统型的负载均衡。
- Forward *uint64 `json:"Forward,omitempty" name:"Forward"`
-
- // 负载均衡实例的域名,内网类型负载均衡以及应用型负载均衡实例不提供该字段
- // 注意:此字段可能返回 null,表示取不到有效值。
- Domain *string `json:"Domain,omitempty" name:"Domain"`
-
- // 负载均衡实例的 VIP 列表。
- // 注意:此字段可能返回 null,表示取不到有效值。
- LoadBalancerVips []*string `json:"LoadBalancerVips,omitempty" name:"LoadBalancerVips" list`
-
- // 负载均衡实例的状态,包括
- // 0:创建中,1:正常运行。
- // 注意:此字段可能返回 null,表示取不到有效值。
- Status *uint64 `json:"Status,omitempty" name:"Status"`
-
- // 负载均衡实例的创建时间。
- // 注意:此字段可能返回 null,表示取不到有效值。
- CreateTime *string `json:"CreateTime,omitempty" name:"CreateTime"`
-
- // 负载均衡实例的上次状态转换时间。
- // 注意:此字段可能返回 null,表示取不到有效值。
- StatusTime *string `json:"StatusTime,omitempty" name:"StatusTime"`
-
- // 负载均衡实例所属的项目 ID, 0 表示默认项目。
- ProjectId *uint64 `json:"ProjectId,omitempty" name:"ProjectId"`
-
- // 私有网络的 ID
- // 注意:此字段可能返回 null,表示取不到有效值。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 高防 LB 的标识,1:高防负载均衡 0:非高防负载均衡。
- // 注意:此字段可能返回 null,表示取不到有效值。
- OpenBgp *uint64 `json:"OpenBgp,omitempty" name:"OpenBgp"`
-
- // 在 2016 年 12 月份之前的传统型内网负载均衡都是开启了 snat 的。
- // 注意:此字段可能返回 null,表示取不到有效值。
- Snat *bool `json:"Snat,omitempty" name:"Snat"`
-
- // 0:表示未被隔离,1:表示被隔离。
- // 注意:此字段可能返回 null,表示取不到有效值。
- Isolation *uint64 `json:"Isolation,omitempty" name:"Isolation"`
-
- // 用户开启日志的信息,日志只有公网属性创建了 HTTP 、HTTPS 监听器的负载均衡才会有日志。
- // 注意:此字段可能返回 null,表示取不到有效值。
- Log *string `json:"Log,omitempty" name:"Log"`
-
- // 负载均衡实例所在的子网(仅对内网VPC型LB有意义)
- // 注意:此字段可能返回 null,表示取不到有效值。
- SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"`
-
- // 负载均衡实例的标签信息
- // 注意:此字段可能返回 null,表示取不到有效值。
- Tags []*TagInfo `json:"Tags,omitempty" name:"Tags" list`
-
- // 负载均衡实例的安全组
- // 注意:此字段可能返回 null,表示取不到有效值。
- SecureGroups []*string `json:"SecureGroups,omitempty" name:"SecureGroups" list`
-
- // 负载均衡实例绑定的后端设备的基本信息
- // 注意:此字段可能返回 null,表示取不到有效值。
- TargetRegionInfo *TargetRegionInfo `json:"TargetRegionInfo,omitempty" name:"TargetRegionInfo"`
-
- // anycast负载均衡的发布域,对于非anycast的负载均衡,此字段返回为空字符串
- // 注意:此字段可能返回 null,表示取不到有效值。
- AnycastZone *string `json:"AnycastZone,omitempty" name:"AnycastZone"`
-
- // IP版本,ipv4 | ipv6
- // 注意:此字段可能返回 null,表示取不到有效值。
- AddressIPVersion *string `json:"AddressIPVersion,omitempty" name:"AddressIPVersion"`
-
- // 数值形式的私有网络 ID
- // 注意:此字段可能返回 null,表示取不到有效值。
- NumericalVpcId *uint64 `json:"NumericalVpcId,omitempty" name:"NumericalVpcId"`
-}
-
-type LoadBalancerHealth struct {
-
- // 负载均衡实例ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 负载均衡实例名称
- // 注意:此字段可能返回 null,表示取不到有效值。
- LoadBalancerName *string `json:"LoadBalancerName,omitempty" name:"LoadBalancerName"`
-
- // 监听器列表
- // 注意:此字段可能返回 null,表示取不到有效值。
- Listeners []*ListenerHealth `json:"Listeners,omitempty" name:"Listeners" list`
-}
-
-type ManualRewriteRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 源监听器ID
- SourceListenerId *string `json:"SourceListenerId,omitempty" name:"SourceListenerId"`
-
- // 目标监听器ID
- TargetListenerId *string `json:"TargetListenerId,omitempty" name:"TargetListenerId"`
-
- // 转发规则之间的重定向关系
- RewriteInfos []*RewriteLocationMap `json:"RewriteInfos,omitempty" name:"RewriteInfos" list`
-}
-
-func (r *ManualRewriteRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ManualRewriteRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ManualRewriteResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ManualRewriteResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ManualRewriteResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyDomainRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例 ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 应用型负载均衡监听器 ID
- ListenerId *string `json:"ListenerId,omitempty" name:"ListenerId"`
-
- // 监听器下的某个旧域名。
- Domain *string `json:"Domain,omitempty" name:"Domain"`
-
- // 新域名, 长度限制为:1-80。有三种使用格式:非正则表达式格式,通配符格式,正则表达式格式。非正则表达式格式只能使用字母、数字、‘-’、‘.’。通配符格式的使用 ‘*’ 只能在开头或者结尾。正则表达式以'~'开头。
- NewDomain *string `json:"NewDomain,omitempty" name:"NewDomain"`
-}
-
-func (r *ModifyDomainRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyDomainRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyDomainResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyDomainResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyDomainResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyListenerRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例 ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 负载均衡监听器 ID
- ListenerId *string `json:"ListenerId,omitempty" name:"ListenerId"`
-
- // 新的监听器名称
- ListenerName *string `json:"ListenerName,omitempty" name:"ListenerName"`
-
- // 会话保持时间,单位:秒。可选值:30~3600,默认 0,表示不开启。此参数仅适用于TCP/UDP监听器。
- SessionExpireTime *int64 `json:"SessionExpireTime,omitempty" name:"SessionExpireTime"`
-
- // 健康检查相关参数,此参数仅适用于TCP/UDP/TCP_SSL监听器
- HealthCheck *HealthCheck `json:"HealthCheck,omitempty" name:"HealthCheck"`
-
- // 证书相关信息,此参数仅适用于HTTPS/TCP_SSL监听器
- Certificate *CertificateInput `json:"Certificate,omitempty" name:"Certificate"`
-
- // 监听器转发的方式。可选值:WRR、LEAST_CONN
- // 分别表示按权重轮询、最小连接数, 默认为 WRR。
- Scheduler *string `json:"Scheduler,omitempty" name:"Scheduler"`
-}
-
-func (r *ModifyListenerRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyListenerRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyListenerResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyListenerResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyListenerResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyLoadBalancerAttributesRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡的唯一ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 负载均衡实例名称
- LoadBalancerName *string `json:"LoadBalancerName,omitempty" name:"LoadBalancerName"`
-
- // 负载均衡绑定的后端服务的地域信息
- TargetRegionInfo *TargetRegionInfo `json:"TargetRegionInfo,omitempty" name:"TargetRegionInfo"`
-}
-
-func (r *ModifyLoadBalancerAttributesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyLoadBalancerAttributesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyLoadBalancerAttributesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyLoadBalancerAttributesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyLoadBalancerAttributesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyRuleRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例 ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 应用型负载均衡监听器 ID
- ListenerId *string `json:"ListenerId,omitempty" name:"ListenerId"`
-
- // 要修改的转发规则的 ID。
- LocationId *string `json:"LocationId,omitempty" name:"LocationId"`
-
- // 转发规则的新的转发路径,如不需修改Url,则不需提供此参数
- Url *string `json:"Url,omitempty" name:"Url"`
-
- // 健康检查信息
- HealthCheck *HealthCheck `json:"HealthCheck,omitempty" name:"HealthCheck"`
-
- // 规则的请求转发方式
- Scheduler *string `json:"Scheduler,omitempty" name:"Scheduler"`
-
- // 会话保持时间
- SessionExpireTime *int64 `json:"SessionExpireTime,omitempty" name:"SessionExpireTime"`
-}
-
-func (r *ModifyRuleRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyRuleRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyRuleResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyRuleResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyRuleResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyTargetPortRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例 ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 负载均衡监听器 ID
- ListenerId *string `json:"ListenerId,omitempty" name:"ListenerId"`
-
- // 要修改端口的后端机器列表
- Targets []*Target `json:"Targets,omitempty" name:"Targets" list`
-
- // 后端机器绑定到监听器的新端口
- NewPort *int64 `json:"NewPort,omitempty" name:"NewPort"`
-
- // 转发规则的ID
- LocationId *string `json:"LocationId,omitempty" name:"LocationId"`
-
- // 目标规则的域名,提供LocationId参数时本参数不生效
- Domain *string `json:"Domain,omitempty" name:"Domain"`
-
- // 目标规则的URL,提供LocationId参数时本参数不生效
- Url *string `json:"Url,omitempty" name:"Url"`
-}
-
-func (r *ModifyTargetPortRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyTargetPortRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyTargetPortResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyTargetPortResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyTargetPortResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyTargetWeightRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例 ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 负载均衡监听器 ID
- ListenerId *string `json:"ListenerId,omitempty" name:"ListenerId"`
-
- // 后端云服务器新的转发权重,取值范围:0~100。
- Weight *int64 `json:"Weight,omitempty" name:"Weight"`
-
- // 转发规则的ID,当绑定机器到七层转发规则时,必须提供此参数或Domain+Url两者之一
- LocationId *string `json:"LocationId,omitempty" name:"LocationId"`
-
- // 目标规则的域名,提供LocationId参数时本参数不生效
- Domain *string `json:"Domain,omitempty" name:"Domain"`
-
- // 目标规则的URL,提供LocationId参数时本参数不生效
- Url *string `json:"Url,omitempty" name:"Url"`
-
- // 要修改权重的后端机器列表
- Targets []*Target `json:"Targets,omitempty" name:"Targets" list`
-}
-
-func (r *ModifyTargetWeightRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyTargetWeightRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyTargetWeightResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyTargetWeightResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyTargetWeightResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RegisterTargetsRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例 ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 负载均衡监听器 ID
- ListenerId *string `json:"ListenerId,omitempty" name:"ListenerId"`
-
- // 要注册的后端机器列表,数组长度最大支持20
- Targets []*Target `json:"Targets,omitempty" name:"Targets" list`
-
- // 转发规则的ID,当注册机器到七层转发规则时,必须提供此参数或Domain+Url两者之一
- LocationId *string `json:"LocationId,omitempty" name:"LocationId"`
-
- // 目标规则的域名,提供LocationId参数时本参数不生效
- Domain *string `json:"Domain,omitempty" name:"Domain"`
-
- // 目标规则的URL,提供LocationId参数时本参数不生效
- Url *string `json:"Url,omitempty" name:"Url"`
-}
-
-func (r *RegisterTargetsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RegisterTargetsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RegisterTargetsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *RegisterTargetsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RegisterTargetsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RegisterTargetsWithClassicalLBRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例 ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 后端服务信息
- Targets []*ClassicalTargetInfo `json:"Targets,omitempty" name:"Targets" list`
-}
-
-func (r *RegisterTargetsWithClassicalLBRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RegisterTargetsWithClassicalLBRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RegisterTargetsWithClassicalLBResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *RegisterTargetsWithClassicalLBResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RegisterTargetsWithClassicalLBResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RewriteLocationMap struct {
-
- // 源转发规则ID
- SourceLocationId *string `json:"SourceLocationId,omitempty" name:"SourceLocationId"`
-
- // 重定向至的目标转发规则ID
- TargetLocationId *string `json:"TargetLocationId,omitempty" name:"TargetLocationId"`
-}
-
-type RewriteTarget struct {
-
- // 重定向目标的监听器ID
- // 注意:此字段可能返回 null,表示无重定向。
- // 注意:此字段可能返回 null,表示取不到有效值。
- TargetListenerId *string `json:"TargetListenerId,omitempty" name:"TargetListenerId"`
-
- // 重定向目标的转发规则ID
- // 注意:此字段可能返回 null,表示无重定向。
- // 注意:此字段可能返回 null,表示取不到有效值。
- TargetLocationId *string `json:"TargetLocationId,omitempty" name:"TargetLocationId"`
-}
-
-type RsWeightRule struct {
-
- // 负载均衡监听器 ID
- ListenerId *string `json:"ListenerId,omitempty" name:"ListenerId"`
-
- // 转发规则的ID
- LocationId *string `json:"LocationId,omitempty" name:"LocationId"`
-
- // 要修改权重的后端机器列表
- Targets []*Target `json:"Targets,omitempty" name:"Targets" list`
-
- // 目标规则的域名,提供LocationId参数时本参数不生效
- Domain *string `json:"Domain,omitempty" name:"Domain"`
-
- // 目标规则的URL,提供LocationId参数时本参数不生效
- Url *string `json:"Url,omitempty" name:"Url"`
-
- // 后端云服务器新的转发权重,取值范围:0~100。
- Weight *int64 `json:"Weight,omitempty" name:"Weight"`
-}
-
-type RuleHealth struct {
-
- // 转发规则ID
- LocationId *string `json:"LocationId,omitempty" name:"LocationId"`
-
- // 转发规则的域名
- // 注意:此字段可能返回 null,表示取不到有效值。
- Domain *string `json:"Domain,omitempty" name:"Domain"`
-
- // 转发规则的Url
- // 注意:此字段可能返回 null,表示取不到有效值。
- Url *string `json:"Url,omitempty" name:"Url"`
-
- // 本规则上绑定的后端的健康检查状态
- // 注意:此字段可能返回 null,表示取不到有效值。
- Targets []*TargetHealth `json:"Targets,omitempty" name:"Targets" list`
-}
-
-type RuleInput struct {
-
- // 转发规则的域名。
- Domain *string `json:"Domain,omitempty" name:"Domain"`
-
- // 转发规则的路径。
- Url *string `json:"Url,omitempty" name:"Url"`
-
- // 会话保持时间
- SessionExpireTime *int64 `json:"SessionExpireTime,omitempty" name:"SessionExpireTime"`
-
- // 健康检查信息
- HealthCheck *HealthCheck `json:"HealthCheck,omitempty" name:"HealthCheck"`
-
- // 证书信息
- Certificate *CertificateInput `json:"Certificate,omitempty" name:"Certificate"`
-
- // 规则的请求转发方式
- Scheduler *string `json:"Scheduler,omitempty" name:"Scheduler"`
-}
-
-type RuleOutput struct {
-
- // 转发规则的 ID
- LocationId *string `json:"LocationId,omitempty" name:"LocationId"`
-
- // 转发规则的域名。
- // 注意:此字段可能返回 null,表示取不到有效值。
- Domain *string `json:"Domain,omitempty" name:"Domain"`
-
- // 转发规则的路径。
- // 注意:此字段可能返回 null,表示取不到有效值。
- Url *string `json:"Url,omitempty" name:"Url"`
-
- // 会话保持时间
- SessionExpireTime *int64 `json:"SessionExpireTime,omitempty" name:"SessionExpireTime"`
-
- // 健康检查信息
- // 注意:此字段可能返回 null,表示取不到有效值。
- HealthCheck *HealthCheck `json:"HealthCheck,omitempty" name:"HealthCheck"`
-
- // 证书信息
- // 注意:此字段可能返回 null,表示取不到有效值。
- Certificate *CertificateOutput `json:"Certificate,omitempty" name:"Certificate"`
-
- // 规则的请求转发方式
- Scheduler *string `json:"Scheduler,omitempty" name:"Scheduler"`
-
- // 转发规则所属的监听器 ID
- ListenerId *string `json:"ListenerId,omitempty" name:"ListenerId"`
-
- // 转发规则的重定向目标信息
- // 注意:此字段可能返回 null,表示取不到有效值。
- RewriteTarget *RewriteTarget `json:"RewriteTarget,omitempty" name:"RewriteTarget"`
-
- // 是否开启gzip
- HttpGzip *bool `json:"HttpGzip,omitempty" name:"HttpGzip"`
-
- // 转发规则是否为自动创建
- BeAutoCreated *bool `json:"BeAutoCreated,omitempty" name:"BeAutoCreated"`
-
- // 是否作为默认域名
- DefaultServer *bool `json:"DefaultServer,omitempty" name:"DefaultServer"`
-
- // 是否开启Http2
- Http2 *bool `json:"Http2,omitempty" name:"Http2"`
-}
-
-type RuleTargets struct {
-
- // 转发规则的 ID
- LocationId *string `json:"LocationId,omitempty" name:"LocationId"`
-
- // 转发规则的域名
- Domain *string `json:"Domain,omitempty" name:"Domain"`
-
- // 转发规则的路径。
- Url *string `json:"Url,omitempty" name:"Url"`
-
- // 后端机器的信息
- // 注意:此字段可能返回 null,表示取不到有效值。
- Targets []*Backend `json:"Targets,omitempty" name:"Targets" list`
-}
-
-type SetLoadBalancerSecurityGroupsRequest struct {
- *tchttp.BaseRequest
-
- // 负载均衡实例 ID
- LoadBalancerId *string `json:"LoadBalancerId,omitempty" name:"LoadBalancerId"`
-
- // 安全组ID构成的数组,一个负载均衡实例最多关联50个安全组,如果要解绑所有安全组,可不传此参数。
- SecurityGroups []*string `json:"SecurityGroups,omitempty" name:"SecurityGroups" list`
-}
-
-func (r *SetLoadBalancerSecurityGroupsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *SetLoadBalancerSecurityGroupsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type SetLoadBalancerSecurityGroupsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *SetLoadBalancerSecurityGroupsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *SetLoadBalancerSecurityGroupsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type TagInfo struct {
-
- // 标签的键
- TagKey *string `json:"TagKey,omitempty" name:"TagKey"`
-
- // 标签的值
- TagValue *string `json:"TagValue,omitempty" name:"TagValue"`
-}
-
-type Target struct {
-
- // 云服务器的唯一 ID,可通过 DescribeInstances 接口返回字段中的 unInstanceId 字段获取
- // 注意:此字段可能返回 null,表示取不到有效值。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 后端云服务器监听端口
- // 注意:此字段可能返回 null,表示取不到有效值。
- Port *int64 `json:"Port,omitempty" name:"Port"`
-
- // 转发目标的类型,目前仅可取值为 CVM
- // 注意:此字段可能返回 null,表示取不到有效值。
- Type *string `json:"Type,omitempty" name:"Type"`
-
- // 后端云服务器的转发权重,取值范围:0~100,默认为 10。
- Weight *int64 `json:"Weight,omitempty" name:"Weight"`
-}
-
-type TargetHealth struct {
-
- // Target的内网IP
- IP *string `json:"IP,omitempty" name:"IP"`
-
- // Target绑定的端口
- Port *int64 `json:"Port,omitempty" name:"Port"`
-
- // 当前健康状态,true:健康,false:不健康。
- HealthStatus *bool `json:"HealthStatus,omitempty" name:"HealthStatus"`
-
- // Target的实例ID,如 ins-12345678
- TargetId *string `json:"TargetId,omitempty" name:"TargetId"`
-}
-
-type TargetRegionInfo struct {
-
- // Target所属地域,如 ap-guangzhou
- Region *string `json:"Region,omitempty" name:"Region"`
-
- // Target所属网络,私有网络格式如 vpc-abcd1234,如果是基础网络,则为"0"
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/client.go
deleted file mode 100644
index 1927cb5..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/client.go
+++ /dev/null
@@ -1,261 +0,0 @@
-package common
-
-import (
- "encoding/hex"
- "encoding/json"
- "fmt"
- "log"
- "net/http"
- "net/http/httputil"
- "strconv"
- "strings"
- "time"
-
- tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
-)
-
-type Client struct {
- region string
- httpClient *http.Client
- httpProfile *profile.HttpProfile
- profile *profile.ClientProfile
- credential *Credential
- signMethod string
- unsignedPayload bool
- debug bool
-}
-
-func (c *Client) Send(request tchttp.Request, response tchttp.Response) (err error) {
- if request.GetDomain() == "" {
- domain := c.httpProfile.Endpoint
- if domain == "" {
- domain = tchttp.GetServiceDomain(request.GetService())
- }
- request.SetDomain(domain)
- }
-
- if request.GetHttpMethod() == "" {
- request.SetHttpMethod(c.httpProfile.ReqMethod)
- }
-
- tchttp.CompleteCommonParams(request, c.GetRegion())
-
- if c.signMethod == "HmacSHA1" || c.signMethod == "HmacSHA256" {
- return c.sendWithSignatureV1(request, response)
- } else {
- return c.sendWithSignatureV3(request, response)
- }
-}
-
-func (c *Client) sendWithSignatureV1(request tchttp.Request, response tchttp.Response) (err error) {
- // TODO: not an elegant way, it should be done in common params, but finally it need to refactor
- request.GetParams()["Language"] = c.profile.Language
- err = tchttp.ConstructParams(request)
- if err != nil {
- return err
- }
- err = signRequest(request, c.credential, c.signMethod)
- if err != nil {
- return err
- }
- httpRequest, err := http.NewRequest(request.GetHttpMethod(), request.GetUrl(), request.GetBodyReader())
- if err != nil {
- return err
- }
- if request.GetHttpMethod() == "POST" {
- httpRequest.Header["Content-Type"] = []string{"application/x-www-form-urlencoded"}
- }
- if c.debug {
- outbytes, err := httputil.DumpRequest(httpRequest, true)
- if err != nil {
- log.Printf("[ERROR] dump request failed because %s", err)
- return err
- }
- log.Printf("[DEBUG] http request = %s", outbytes)
- }
- httpResponse, err := c.httpClient.Do(httpRequest)
- if err != nil {
- return err
- }
- err = tchttp.ParseFromHttpResponse(httpResponse, response)
- return err
-}
-
-func (c *Client) sendWithSignatureV3(request tchttp.Request, response tchttp.Response) (err error) {
- headers := map[string]string{
- "Host": request.GetDomain(),
- "X-TC-Action": request.GetAction(),
- "X-TC-Version": request.GetVersion(),
- "X-TC-Timestamp": request.GetParams()["Timestamp"],
- "X-TC-RequestClient": request.GetParams()["RequestClient"],
- "X-TC-Language": c.profile.Language,
- }
- if c.region != "" {
- headers["X-TC-Region"] = c.region
- }
- if c.credential.Token != "" {
- headers["X-TC-Token"] = c.credential.Token
- }
- if request.GetHttpMethod() == "GET" {
- headers["Content-Type"] = "application/x-www-form-urlencoded"
- } else {
- headers["Content-Type"] = "application/json"
- }
-
- // start signature v3 process
-
- // build canonical request string
- httpRequestMethod := request.GetHttpMethod()
- canonicalURI := "/"
- canonicalQueryString := ""
- if httpRequestMethod == "GET" {
- err = tchttp.ConstructParams(request)
- if err != nil {
- return err
- }
- params := make(map[string]string)
- for key, value := range request.GetParams() {
- params[key] = value
- }
- delete(params, "Action")
- delete(params, "Version")
- delete(params, "Nonce")
- delete(params, "Region")
- delete(params, "RequestClient")
- delete(params, "Timestamp")
- canonicalQueryString = tchttp.GetUrlQueriesEncoded(params)
- }
- canonicalHeaders := fmt.Sprintf("content-type:%s\nhost:%s\n", headers["Content-Type"], headers["Host"])
- signedHeaders := "content-type;host"
- requestPayload := ""
- if httpRequestMethod == "POST" {
- b, err := json.Marshal(request)
- if err != nil {
- return err
- }
- requestPayload = string(b)
- }
- hashedRequestPayload := ""
- if c.unsignedPayload {
- hashedRequestPayload = sha256hex("UNSIGNED-PAYLOAD")
- headers["X-TC-Content-SHA256"] = "UNSIGNED-PAYLOAD"
- } else {
- hashedRequestPayload = sha256hex(requestPayload)
- }
- canonicalRequest := fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n%s",
- httpRequestMethod,
- canonicalURI,
- canonicalQueryString,
- canonicalHeaders,
- signedHeaders,
- hashedRequestPayload)
- //log.Println("canonicalRequest:", canonicalRequest)
-
- // build string to sign
- algorithm := "TC3-HMAC-SHA256"
- requestTimestamp := headers["X-TC-Timestamp"]
- timestamp, _ := strconv.ParseInt(requestTimestamp, 10, 64)
- t := time.Unix(timestamp, 0).UTC()
- // must be the format 2006-01-02, ref to package time for more info
- date := t.Format("2006-01-02")
- credentialScope := fmt.Sprintf("%s/%s/tc3_request", date, request.GetService())
- hashedCanonicalRequest := sha256hex(canonicalRequest)
- string2sign := fmt.Sprintf("%s\n%s\n%s\n%s",
- algorithm,
- requestTimestamp,
- credentialScope,
- hashedCanonicalRequest)
- //log.Println("string2sign", string2sign)
-
- // sign string
- secretDate := hmacsha256(date, "TC3"+c.credential.SecretKey)
- secretService := hmacsha256(request.GetService(), secretDate)
- secretKey := hmacsha256("tc3_request", secretService)
- signature := hex.EncodeToString([]byte(hmacsha256(string2sign, secretKey)))
- //log.Println("signature", signature)
-
- // build authorization
- authorization := fmt.Sprintf("%s Credential=%s/%s, SignedHeaders=%s, Signature=%s",
- algorithm,
- c.credential.SecretId,
- credentialScope,
- signedHeaders,
- signature)
- //log.Println("authorization", authorization)
-
- headers["Authorization"] = authorization
- url := "https://" + request.GetDomain() + request.GetPath()
- if canonicalQueryString != "" {
- url = url + "?" + canonicalQueryString
- }
- httpRequest, err := http.NewRequest(httpRequestMethod, url, strings.NewReader(requestPayload))
- if err != nil {
- return err
- }
- for k, v := range headers {
- httpRequest.Header[k] = []string{v}
- }
- if c.debug {
- outbytes, err := httputil.DumpRequest(httpRequest, true)
- if err != nil {
- log.Printf("[ERROR] dump request failed because %s", err)
- return err
- }
- log.Printf("[DEBUG] http request = %s", outbytes)
- }
- httpResponse, err := c.httpClient.Do(httpRequest)
- if err != nil {
- return err
- }
- err = tchttp.ParseFromHttpResponse(httpResponse, response)
- return err
-}
-
-func (c *Client) GetRegion() string {
- return c.region
-}
-
-func (c *Client) Init(region string) *Client {
- c.httpClient = &http.Client{}
- c.region = region
- c.signMethod = "TC3-HMAC-SHA256"
- c.debug = false
- log.SetFlags(log.LstdFlags | log.Lshortfile)
- return c
-}
-
-func (c *Client) WithSecretId(secretId, secretKey string) *Client {
- c.credential = NewCredential(secretId, secretKey)
- return c
-}
-
-func (c *Client) WithCredential(cred *Credential) *Client {
- c.credential = cred
- return c
-}
-
-func (c *Client) WithProfile(clientProfile *profile.ClientProfile) *Client {
- c.profile = clientProfile
- c.signMethod = clientProfile.SignMethod
- c.unsignedPayload = clientProfile.UnsignedPayload
- c.httpProfile = clientProfile.HttpProfile
- c.httpClient.Timeout = time.Duration(c.httpProfile.ReqTimeout) * time.Second
- return c
-}
-
-func (c *Client) WithSignatureMethod(method string) *Client {
- c.signMethod = method
- return c
-}
-
-func (c *Client) WithHttpTransport(transport http.RoundTripper) *Client {
- c.httpClient.Transport = transport
- return c
-}
-
-func NewClientWithSecretId(secretId, secretKey, region string) (client *Client, err error) {
- client = &Client{}
- client.Init(region).WithSecretId(secretId, secretKey)
- return
-}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/credentials.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/credentials.go
deleted file mode 100644
index b734c13..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/credentials.go
+++ /dev/null
@@ -1,58 +0,0 @@
-package common
-
-type Credential struct {
- SecretId string
- SecretKey string
- Token string
-}
-
-func NewCredential(secretId, secretKey string) *Credential {
- return &Credential{
- SecretId: secretId,
- SecretKey: secretKey,
- }
-}
-
-func NewTokenCredential(secretId, secretKey, token string) *Credential {
- return &Credential{
- SecretId: secretId,
- SecretKey: secretKey,
- Token: token,
- }
-}
-
-func (c *Credential) GetCredentialParams() map[string]string {
- p := map[string]string{
- "SecretId": c.SecretId,
- }
- if c.Token != "" {
- p["Token"] = c.Token
- }
- return p
-}
-
-// Nowhere use them and we haven't well designed these structures and
-// underlying method, which leads to the situation that it is hard to
-// refactor it to interfaces.
-// Hence they are removed and merged into Credential.
-
-//type TokenCredential struct {
-// SecretId string
-// SecretKey string
-// Token string
-//}
-
-//func NewTokenCredential(secretId, secretKey, token string) *TokenCredential {
-// return &TokenCredential{
-// SecretId: secretId,
-// SecretKey: secretKey,
-// Token: token,
-// }
-//}
-
-//func (c *TokenCredential) GetCredentialParams() map[string]string {
-// return map[string]string{
-// "SecretId": c.SecretId,
-// "Token": c.Token,
-// }
-//}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors/errors.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors/errors.go
deleted file mode 100644
index 27589e5..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors/errors.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package errors
-
-import (
- "fmt"
-)
-
-type TencentCloudSDKError struct {
- Code string
- Message string
- RequestId string
-}
-
-func (e *TencentCloudSDKError) Error() string {
- return fmt.Sprintf("[TencentCloudSDKError] Code=%s, Message=%s, RequestId=%s", e.Code, e.Message, e.RequestId)
-}
-
-func NewTencentCloudSDKError(code, message, requestId string) error {
- return &TencentCloudSDKError{
- Code: code,
- Message: message,
- RequestId: requestId,
- }
-}
-
-func (e *TencentCloudSDKError) GetCode() string {
- return e.Code
-}
-
-func (e *TencentCloudSDKError) GetMessage() string {
- return e.Message
-}
-
-func (e *TencentCloudSDKError) GetRequestId() string {
- return e.RequestId
-}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go
deleted file mode 100644
index 4414ac5..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go
+++ /dev/null
@@ -1,229 +0,0 @@
-package common
-
-import (
- "io"
- //"log"
- "math/rand"
- "net/url"
- "reflect"
- "strconv"
- "strings"
- "time"
-)
-
-const (
- POST = "POST"
- GET = "GET"
-
- RootDomain = "tencentcloudapi.com"
- Path = "/"
-)
-
-type Request interface {
- GetAction() string
- GetBodyReader() io.Reader
- GetDomain() string
- GetHttpMethod() string
- GetParams() map[string]string
- GetPath() string
- GetService() string
- GetUrl() string
- GetVersion() string
- SetDomain(string)
- SetHttpMethod(string)
-}
-
-type BaseRequest struct {
- httpMethod string
- domain string
- path string
- params map[string]string
- formParams map[string]string
-
- service string
- version string
- action string
-}
-
-func (r *BaseRequest) GetAction() string {
- return r.action
-}
-
-func (r *BaseRequest) GetHttpMethod() string {
- return r.httpMethod
-}
-
-func (r *BaseRequest) GetParams() map[string]string {
- return r.params
-}
-
-func (r *BaseRequest) GetPath() string {
- return r.path
-}
-
-func (r *BaseRequest) GetDomain() string {
- return r.domain
-}
-
-func (r *BaseRequest) SetDomain(domain string) {
- r.domain = domain
-}
-
-func (r *BaseRequest) SetHttpMethod(method string) {
- switch strings.ToUpper(method) {
- case POST:
- {
- r.httpMethod = POST
- }
- case GET:
- {
- r.httpMethod = GET
- }
- default:
- {
- r.httpMethod = GET
- }
- }
-}
-
-func (r *BaseRequest) GetService() string {
- return r.service
-}
-
-func (r *BaseRequest) GetUrl() string {
- if r.httpMethod == GET {
- return "https://" + r.domain + r.path + "?" + GetUrlQueriesEncoded(r.params)
- } else if r.httpMethod == POST {
- return "https://" + r.domain + r.path
- } else {
- return ""
- }
-}
-
-func (r *BaseRequest) GetVersion() string {
- return r.version
-}
-
-func GetUrlQueriesEncoded(params map[string]string) string {
- values := url.Values{}
- for key, value := range params {
- if value != "" {
- values.Add(key, value)
- }
- }
- return values.Encode()
-}
-
-func (r *BaseRequest) GetBodyReader() io.Reader {
- if r.httpMethod == POST {
- s := GetUrlQueriesEncoded(r.params)
- return strings.NewReader(s)
- } else {
- return strings.NewReader("")
- }
-}
-
-func (r *BaseRequest) Init() *BaseRequest {
- r.domain = ""
- r.path = Path
- r.params = make(map[string]string)
- r.formParams = make(map[string]string)
- return r
-}
-
-func (r *BaseRequest) WithApiInfo(service, version, action string) *BaseRequest {
- r.service = service
- r.version = version
- r.action = action
- return r
-}
-
-func GetServiceDomain(service string) (domain string) {
- domain = service + "." + RootDomain
- return
-}
-
-func CompleteCommonParams(request Request, region string) {
- params := request.GetParams()
- params["Region"] = region
- if request.GetVersion() != "" {
- params["Version"] = request.GetVersion()
- }
- params["Action"] = request.GetAction()
- params["Timestamp"] = strconv.FormatInt(time.Now().Unix(), 10)
- params["Nonce"] = strconv.Itoa(rand.Int())
- params["RequestClient"] = "SDK_GO_3.0.73"
-}
-
-func ConstructParams(req Request) (err error) {
- value := reflect.ValueOf(req).Elem()
- err = flatStructure(value, req, "")
- //log.Printf("[DEBUG] params=%s", req.GetParams())
- return
-}
-
-func flatStructure(value reflect.Value, request Request, prefix string) (err error) {
- //log.Printf("[DEBUG] reflect value: %v", value.Type())
- valueType := value.Type()
- for i := 0; i < valueType.NumField(); i++ {
- tag := valueType.Field(i).Tag
- nameTag, hasNameTag := tag.Lookup("name")
- if !hasNameTag {
- continue
- }
- field := value.Field(i)
- kind := field.Kind()
- if kind == reflect.Ptr && field.IsNil() {
- continue
- }
- if kind == reflect.Ptr {
- field = field.Elem()
- kind = field.Kind()
- }
- key := prefix + nameTag
- if kind == reflect.String {
- s := field.String()
- if s != "" {
- request.GetParams()[key] = s
- }
- } else if kind == reflect.Bool {
- request.GetParams()[key] = strconv.FormatBool(field.Bool())
- } else if kind == reflect.Int || kind == reflect.Int64 {
- request.GetParams()[key] = strconv.FormatInt(field.Int(), 10)
- } else if kind == reflect.Uint || kind == reflect.Uint64 {
- request.GetParams()[key] = strconv.FormatUint(field.Uint(), 10)
- } else if kind == reflect.Float64 {
- request.GetParams()[key] = strconv.FormatFloat(field.Float(), 'f', -1, 64)
- } else if kind == reflect.Slice {
- list := value.Field(i)
- for j := 0; j < list.Len(); j++ {
- vj := list.Index(j)
- key := prefix + nameTag + "." + strconv.Itoa(j)
- kind = vj.Kind()
- if kind == reflect.Ptr && vj.IsNil() {
- continue
- }
- if kind == reflect.Ptr {
- vj = vj.Elem()
- kind = vj.Kind()
- }
- if kind == reflect.String {
- request.GetParams()[key] = vj.String()
- } else if kind == reflect.Bool {
- request.GetParams()[key] = strconv.FormatBool(vj.Bool())
- } else if kind == reflect.Int || kind == reflect.Int64 {
- request.GetParams()[key] = strconv.FormatInt(vj.Int(), 10)
- } else if kind == reflect.Uint || kind == reflect.Uint64 {
- request.GetParams()[key] = strconv.FormatUint(vj.Uint(), 10)
- } else if kind == reflect.Float64 {
- request.GetParams()[key] = strconv.FormatFloat(vj.Float(), 'f', -1, 64)
- } else {
- flatStructure(vj, request, key+".")
- }
- }
- } else {
- flatStructure(reflect.ValueOf(field.Interface()), request, prefix+nameTag+".")
- }
- }
- return
-}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/response.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/response.go
deleted file mode 100644
index c8e27f7..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/response.go
+++ /dev/null
@@ -1,76 +0,0 @@
-package common
-
-import (
- "encoding/json"
- "fmt"
- "io/ioutil"
- "log"
- "net/http"
-
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors"
-)
-
-type Response interface {
- ParseErrorFromHTTPResponse(body []byte) error
-}
-
-type BaseResponse struct {
-}
-
-type ErrorResponse struct {
- Response struct {
- Error struct {
- Code string `json:"Code"`
- Message string `json:"Message"`
- } `json:"Error" omitempty`
- RequestId string `json:"RequestId"`
- } `json:"Response"`
-}
-
-type DeprecatedAPIErrorResponse struct {
- Code int `json:"code"`
- Message string `json:"message"`
- CodeDesc string `json:"codeDesc"`
-}
-
-func (r *BaseResponse) ParseErrorFromHTTPResponse(body []byte) (err error) {
- resp := &ErrorResponse{}
- err = json.Unmarshal(body, resp)
- if err != nil {
- return
- }
- if resp.Response.Error.Code != "" {
- return errors.NewTencentCloudSDKError(resp.Response.Error.Code, resp.Response.Error.Message, resp.Response.RequestId)
- }
-
- deprecated := &DeprecatedAPIErrorResponse{}
- err = json.Unmarshal(body, deprecated)
- if err != nil {
- return
- }
- if deprecated.Code != 0 {
- return errors.NewTencentCloudSDKError(deprecated.CodeDesc, deprecated.Message, "")
- }
- return nil
-}
-
-func ParseFromHttpResponse(hr *http.Response, response Response) (err error) {
- defer hr.Body.Close()
- body, err := ioutil.ReadAll(hr.Body)
- if err != nil {
- return
- }
- if hr.StatusCode != 200 {
- return fmt.Errorf("Request fail with status: %s, with body: %s", hr.Status, body)
- }
- //log.Printf("[DEBUG] Response Body=%s", body)
- err = response.ParseErrorFromHTTPResponse(body)
- if err != nil {
- return
- }
- err = json.Unmarshal(body, &response)
- if err != nil {
- log.Printf("Unexpected Error occurs when parsing API response\n%s\n", string(body[:]))
- }
- return
-}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/client_profile.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/client_profile.go
deleted file mode 100644
index 21069ff..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/client_profile.go
+++ /dev/null
@@ -1,21 +0,0 @@
-package profile
-
-type ClientProfile struct {
- HttpProfile *HttpProfile
- // Valid choices: HmacSHA1, HmacSHA256, TC3-HMAC-SHA256.
- // Default value is TC3-HMAC-SHA256.
- SignMethod string
- UnsignedPayload bool
- // Valid choices: zh-CN, en-US.
- // Default value is zh-CN.
- Language string
-}
-
-func NewClientProfile() *ClientProfile {
- return &ClientProfile{
- HttpProfile: NewHttpProfile(),
- SignMethod: "TC3-HMAC-SHA256",
- UnsignedPayload: false,
- Language: "zh-CN",
- }
-}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/http_profile.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/http_profile.go
deleted file mode 100644
index 8d4bf8f..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/http_profile.go
+++ /dev/null
@@ -1,17 +0,0 @@
-package profile
-
-type HttpProfile struct {
- ReqMethod string
- ReqTimeout int
- Endpoint string
- Protocol string
-}
-
-func NewHttpProfile() *HttpProfile {
- return &HttpProfile{
- ReqMethod: "POST",
- ReqTimeout: 60,
- Endpoint: "",
- Protocol: "HTTPS",
- }
-}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/sign.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/sign.go
deleted file mode 100644
index 63efd92..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/sign.go
+++ /dev/null
@@ -1,87 +0,0 @@
-package common
-
-import (
- "crypto/hmac"
- "crypto/sha1"
- "crypto/sha256"
- "encoding/base64"
- "encoding/hex"
- "fmt"
- "sort"
- "strings"
-
- tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http"
-)
-
-const (
- SHA256 = "HmacSHA256"
- SHA1 = "HmacSHA1"
-)
-
-func Sign(s, secretKey, method string) string {
- hashed := hmac.New(sha1.New, []byte(secretKey))
- if method == SHA256 {
- hashed = hmac.New(sha256.New, []byte(secretKey))
- }
- hashed.Write([]byte(s))
-
- return base64.StdEncoding.EncodeToString(hashed.Sum(nil))
-}
-
-func sha256hex(s string) string {
- b := sha256.Sum256([]byte(s))
- return hex.EncodeToString(b[:])
-}
-
-func hmacsha256(s, key string) string {
- hashed := hmac.New(sha256.New, []byte(key))
- hashed.Write([]byte(s))
- return string(hashed.Sum(nil))
-}
-
-func signRequest(request tchttp.Request, credential *Credential, method string) (err error) {
- if method != SHA256 {
- method = SHA1
- }
- checkAuthParams(request, credential, method)
- s := getStringToSign(request)
- signature := Sign(s, credential.SecretKey, method)
- request.GetParams()["Signature"] = signature
- return
-}
-
-func checkAuthParams(request tchttp.Request, credential *Credential, method string) {
- params := request.GetParams()
- credentialParams := credential.GetCredentialParams()
- for key, value := range credentialParams {
- params[key] = value
- }
- params["SignatureMethod"] = method
- delete(params, "Signature")
-}
-
-func getStringToSign(request tchttp.Request) string {
- method := request.GetHttpMethod()
- domain := request.GetDomain()
- path := request.GetPath()
-
- text := method + domain + path + "?"
-
- params := request.GetParams()
- // sort params
- keys := make([]string, 0, len(params))
- for k, _ := range params {
- keys = append(keys, k)
- }
- sort.Strings(keys)
-
- for i := range keys {
- k := keys[i]
- if params[k] == "" {
- continue
- }
- text += fmt.Sprintf("%v=%v&", strings.Replace(k, "_", ".", -1), params[k])
- }
- text = text[:len(text)-1]
- return text
-}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/types.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/types.go
deleted file mode 100644
index ec2c786..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/types.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package common
-
-func IntPtr(v int) *int {
- return &v
-}
-
-func Int64Ptr(v int64) *int64 {
- return &v
-}
-
-func UintPtr(v uint) *uint {
- return &v
-}
-
-func Uint64Ptr(v uint64) *uint64 {
- return &v
-}
-
-func Float64Ptr(v float64) *float64 {
- return &v
-}
-
-func StringPtr(v string) *string {
- return &v
-}
-
-func StringValues(ptrs []*string) []string {
- values := make([]string, len(ptrs))
- for i := 0; i < len(ptrs); i++ {
- if ptrs[i] != nil {
- values[i] = *ptrs[i]
- }
- }
- return values
-}
-
-func StringPtrs(vals []string) []*string {
- ptrs := make([]*string, len(vals))
- for i := 0; i < len(vals); i++ {
- ptrs[i] = &vals[i]
- }
- return ptrs
-}
-
-func BoolPtr(v bool) *bool {
- return &v
-}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312/client.go
deleted file mode 100644
index 3305127..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312/client.go
+++ /dev/null
@@ -1,1758 +0,0 @@
-// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package v20170312
-
-import (
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
- tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
-)
-
-const APIVersion = "2017-03-12"
-
-type Client struct {
- common.Client
-}
-
-// Deprecated
-func NewClientWithSecretId(secretId, secretKey, region string) (client *Client, err error) {
- cpf := profile.NewClientProfile()
- client = &Client{}
- client.Init(region).WithSecretId(secretId, secretKey).WithProfile(cpf)
- return
-}
-
-func NewClient(credential *common.Credential, region string, clientProfile *profile.ClientProfile) (client *Client, err error) {
- client = &Client{}
- client.Init(region).
- WithCredential(credential).
- WithProfile(clientProfile)
- return
-}
-
-
-func NewAllocateHostsRequest() (request *AllocateHostsRequest) {
- request = &AllocateHostsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "AllocateHosts")
- return
-}
-
-func NewAllocateHostsResponse() (response *AllocateHostsResponse) {
- response = &AllocateHostsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (AllocateHosts) 用于创建一个或多个指定配置的CDH实例。
-// * 当HostChargeType为PREPAID时,必须指定HostChargePrepaid参数。
-func (c *Client) AllocateHosts(request *AllocateHostsRequest) (response *AllocateHostsResponse, err error) {
- if request == nil {
- request = NewAllocateHostsRequest()
- }
- response = NewAllocateHostsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewAssociateInstancesKeyPairsRequest() (request *AssociateInstancesKeyPairsRequest) {
- request = &AssociateInstancesKeyPairsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "AssociateInstancesKeyPairs")
- return
-}
-
-func NewAssociateInstancesKeyPairsResponse() (response *AssociateInstancesKeyPairsResponse) {
- response = &AssociateInstancesKeyPairsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (AssociateInstancesKeyPairs) 用于将密钥绑定到实例上。
-//
-// * 将密钥的公钥写入到实例的`SSH`配置当中,用户就可以通过该密钥的私钥来登录实例。
-// * 如果实例原来绑定过密钥,那么原来的密钥将失效。
-// * 如果实例原来是通过密码登录,绑定密钥后无法使用密码登录。
-// * 支持批量操作。每次请求批量实例的上限为100。如果批量实例存在不允许操作的实例,操作会以特定错误码返回。
-func (c *Client) AssociateInstancesKeyPairs(request *AssociateInstancesKeyPairsRequest) (response *AssociateInstancesKeyPairsResponse, err error) {
- if request == nil {
- request = NewAssociateInstancesKeyPairsRequest()
- }
- response = NewAssociateInstancesKeyPairsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewAssociateSecurityGroupsRequest() (request *AssociateSecurityGroupsRequest) {
- request = &AssociateSecurityGroupsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "AssociateSecurityGroups")
- return
-}
-
-func NewAssociateSecurityGroupsResponse() (response *AssociateSecurityGroupsResponse) {
- response = &AssociateSecurityGroupsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (AssociateSecurityGroups) 用于绑定安全组到指定实例。
-func (c *Client) AssociateSecurityGroups(request *AssociateSecurityGroupsRequest) (response *AssociateSecurityGroupsResponse, err error) {
- if request == nil {
- request = NewAssociateSecurityGroupsRequest()
- }
- response = NewAssociateSecurityGroupsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateDisasterRecoverGroupRequest() (request *CreateDisasterRecoverGroupRequest) {
- request = &CreateDisasterRecoverGroupRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "CreateDisasterRecoverGroup")
- return
-}
-
-func NewCreateDisasterRecoverGroupResponse() (response *CreateDisasterRecoverGroupResponse) {
- response = &CreateDisasterRecoverGroupResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (CreateDisasterRecoverGroup)用于创建[分散置放群组](https://cloud.tencent.com/document/product/213/15486)。创建好的置放群组,可在[创建实例](https://cloud.tencent.com/document/api/213/15730)时指定。
-func (c *Client) CreateDisasterRecoverGroup(request *CreateDisasterRecoverGroupRequest) (response *CreateDisasterRecoverGroupResponse, err error) {
- if request == nil {
- request = NewCreateDisasterRecoverGroupRequest()
- }
- response = NewCreateDisasterRecoverGroupResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateImageRequest() (request *CreateImageRequest) {
- request = &CreateImageRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "CreateImage")
- return
-}
-
-func NewCreateImageResponse() (response *CreateImageResponse) {
- response = &CreateImageResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateImage)用于将实例的系统盘制作为新镜像,创建后的镜像可以用于创建实例。
-func (c *Client) CreateImage(request *CreateImageRequest) (response *CreateImageResponse, err error) {
- if request == nil {
- request = NewCreateImageRequest()
- }
- response = NewCreateImageResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateKeyPairRequest() (request *CreateKeyPairRequest) {
- request = &CreateKeyPairRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "CreateKeyPair")
- return
-}
-
-func NewCreateKeyPairResponse() (response *CreateKeyPairResponse) {
- response = &CreateKeyPairResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (CreateKeyPair) 用于创建一个 `OpenSSH RSA` 密钥对,可以用于登录 `Linux` 实例。
-//
-// * 开发者只需指定密钥对名称,即可由系统自动创建密钥对,并返回所生成的密钥对的 `ID` 及其公钥、私钥的内容。
-// * 密钥对名称不能和已经存在的密钥对的名称重复。
-// * 私钥的内容可以保存到文件中作为 `SSH` 的一种认证方式。
-// * 腾讯云不会保存用户的私钥,请妥善保管。
-func (c *Client) CreateKeyPair(request *CreateKeyPairRequest) (response *CreateKeyPairResponse, err error) {
- if request == nil {
- request = NewCreateKeyPairRequest()
- }
- response = NewCreateKeyPairResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteDisasterRecoverGroupsRequest() (request *DeleteDisasterRecoverGroupsRequest) {
- request = &DeleteDisasterRecoverGroupsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DeleteDisasterRecoverGroups")
- return
-}
-
-func NewDeleteDisasterRecoverGroupsResponse() (response *DeleteDisasterRecoverGroupsResponse) {
- response = &DeleteDisasterRecoverGroupsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (DeleteDisasterRecoverGroups)用于删除[分散置放群组](https://cloud.tencent.com/document/product/213/15486)。只有空的置放群组才能被删除,非空的群组需要先销毁组内所有云主机,才能执行删除操作,不然会产生删除置放群组失败的错误。
-func (c *Client) DeleteDisasterRecoverGroups(request *DeleteDisasterRecoverGroupsRequest) (response *DeleteDisasterRecoverGroupsResponse, err error) {
- if request == nil {
- request = NewDeleteDisasterRecoverGroupsRequest()
- }
- response = NewDeleteDisasterRecoverGroupsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteImagesRequest() (request *DeleteImagesRequest) {
- request = &DeleteImagesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DeleteImages")
- return
-}
-
-func NewDeleteImagesResponse() (response *DeleteImagesResponse) {
- response = &DeleteImagesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DeleteImages)用于删除一个或多个镜像。
-//
-// * 当[镜像状态](https://cloud.tencent.com/document/api/213/9452#image_state)为`创建中`和`使用中`时, 不允许删除。镜像状态可以通过[DescribeImages](https://cloud.tencent.com/document/api/213/9418)获取。
-// * 每个地域最多只支持创建10个自定义镜像,删除镜像可以释放账户的配额。
-// * 当镜像正在被其它账户分享时,不允许删除。
-func (c *Client) DeleteImages(request *DeleteImagesRequest) (response *DeleteImagesResponse, err error) {
- if request == nil {
- request = NewDeleteImagesRequest()
- }
- response = NewDeleteImagesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteKeyPairsRequest() (request *DeleteKeyPairsRequest) {
- request = &DeleteKeyPairsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DeleteKeyPairs")
- return
-}
-
-func NewDeleteKeyPairsResponse() (response *DeleteKeyPairsResponse) {
- response = &DeleteKeyPairsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (DeleteKeyPairs) 用于删除已在腾讯云托管的密钥对。
-//
-// * 可以同时删除多个密钥对。
-// * 不能删除已被实例或镜像引用的密钥对,所以需要独立判断是否所有密钥对都被成功删除。
-func (c *Client) DeleteKeyPairs(request *DeleteKeyPairsRequest) (response *DeleteKeyPairsResponse, err error) {
- if request == nil {
- request = NewDeleteKeyPairsRequest()
- }
- response = NewDeleteKeyPairsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeDisasterRecoverGroupQuotaRequest() (request *DescribeDisasterRecoverGroupQuotaRequest) {
- request = &DescribeDisasterRecoverGroupQuotaRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DescribeDisasterRecoverGroupQuota")
- return
-}
-
-func NewDescribeDisasterRecoverGroupQuotaResponse() (response *DescribeDisasterRecoverGroupQuotaResponse) {
- response = &DescribeDisasterRecoverGroupQuotaResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (DescribeDisasterRecoverGroupQuota)用于查询[分散置放群组](https://cloud.tencent.com/document/product/213/15486)配额。
-func (c *Client) DescribeDisasterRecoverGroupQuota(request *DescribeDisasterRecoverGroupQuotaRequest) (response *DescribeDisasterRecoverGroupQuotaResponse, err error) {
- if request == nil {
- request = NewDescribeDisasterRecoverGroupQuotaRequest()
- }
- response = NewDescribeDisasterRecoverGroupQuotaResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeDisasterRecoverGroupsRequest() (request *DescribeDisasterRecoverGroupsRequest) {
- request = &DescribeDisasterRecoverGroupsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DescribeDisasterRecoverGroups")
- return
-}
-
-func NewDescribeDisasterRecoverGroupsResponse() (response *DescribeDisasterRecoverGroupsResponse) {
- response = &DescribeDisasterRecoverGroupsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (DescribeDisasterRecoverGroups)用于查询[分散置放群组](https://cloud.tencent.com/document/product/213/15486)信息。
-func (c *Client) DescribeDisasterRecoverGroups(request *DescribeDisasterRecoverGroupsRequest) (response *DescribeDisasterRecoverGroupsResponse, err error) {
- if request == nil {
- request = NewDescribeDisasterRecoverGroupsRequest()
- }
- response = NewDescribeDisasterRecoverGroupsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeHostsRequest() (request *DescribeHostsRequest) {
- request = &DescribeHostsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DescribeHosts")
- return
-}
-
-func NewDescribeHostsResponse() (response *DescribeHostsResponse) {
- response = &DescribeHostsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (DescribeHosts) 用于获取一个或多个CDH实例的详细信息。
-func (c *Client) DescribeHosts(request *DescribeHostsRequest) (response *DescribeHostsResponse, err error) {
- if request == nil {
- request = NewDescribeHostsRequest()
- }
- response = NewDescribeHostsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeImageQuotaRequest() (request *DescribeImageQuotaRequest) {
- request = &DescribeImageQuotaRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DescribeImageQuota")
- return
-}
-
-func NewDescribeImageQuotaResponse() (response *DescribeImageQuotaResponse) {
- response = &DescribeImageQuotaResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeImageQuota)用于查询用户帐号的镜像配额。
-func (c *Client) DescribeImageQuota(request *DescribeImageQuotaRequest) (response *DescribeImageQuotaResponse, err error) {
- if request == nil {
- request = NewDescribeImageQuotaRequest()
- }
- response = NewDescribeImageQuotaResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeImageSharePermissionRequest() (request *DescribeImageSharePermissionRequest) {
- request = &DescribeImageSharePermissionRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DescribeImageSharePermission")
- return
-}
-
-func NewDescribeImageSharePermissionResponse() (response *DescribeImageSharePermissionResponse) {
- response = &DescribeImageSharePermissionResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeImageSharePermission)用于查询镜像分享信息。
-func (c *Client) DescribeImageSharePermission(request *DescribeImageSharePermissionRequest) (response *DescribeImageSharePermissionResponse, err error) {
- if request == nil {
- request = NewDescribeImageSharePermissionRequest()
- }
- response = NewDescribeImageSharePermissionResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeImagesRequest() (request *DescribeImagesRequest) {
- request = &DescribeImagesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DescribeImages")
- return
-}
-
-func NewDescribeImagesResponse() (response *DescribeImagesResponse) {
- response = &DescribeImagesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeImages) 用于查看镜像列表。
-//
-// * 可以通过指定镜像ID来查询指定镜像的详细信息,或通过设定过滤器来查询满足过滤条件的镜像的详细信息。
-// * 指定偏移(Offset)和限制(Limit)来选择结果中的一部分,默认返回满足条件的前20个镜像信息。
-func (c *Client) DescribeImages(request *DescribeImagesRequest) (response *DescribeImagesResponse, err error) {
- if request == nil {
- request = NewDescribeImagesRequest()
- }
- response = NewDescribeImagesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeImportImageOsRequest() (request *DescribeImportImageOsRequest) {
- request = &DescribeImportImageOsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DescribeImportImageOs")
- return
-}
-
-func NewDescribeImportImageOsResponse() (response *DescribeImportImageOsResponse) {
- response = &DescribeImportImageOsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 查看可以导入的镜像操作系统信息。
-func (c *Client) DescribeImportImageOs(request *DescribeImportImageOsRequest) (response *DescribeImportImageOsResponse, err error) {
- if request == nil {
- request = NewDescribeImportImageOsRequest()
- }
- response = NewDescribeImportImageOsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeInstanceFamilyConfigsRequest() (request *DescribeInstanceFamilyConfigsRequest) {
- request = &DescribeInstanceFamilyConfigsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DescribeInstanceFamilyConfigs")
- return
-}
-
-func NewDescribeInstanceFamilyConfigsResponse() (response *DescribeInstanceFamilyConfigsResponse) {
- response = &DescribeInstanceFamilyConfigsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeInstanceFamilyConfigs)查询当前用户和地域所支持的机型族列表信息。
-func (c *Client) DescribeInstanceFamilyConfigs(request *DescribeInstanceFamilyConfigsRequest) (response *DescribeInstanceFamilyConfigsResponse, err error) {
- if request == nil {
- request = NewDescribeInstanceFamilyConfigsRequest()
- }
- response = NewDescribeInstanceFamilyConfigsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeInstanceInternetBandwidthConfigsRequest() (request *DescribeInstanceInternetBandwidthConfigsRequest) {
- request = &DescribeInstanceInternetBandwidthConfigsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DescribeInstanceInternetBandwidthConfigs")
- return
-}
-
-func NewDescribeInstanceInternetBandwidthConfigsResponse() (response *DescribeInstanceInternetBandwidthConfigsResponse) {
- response = &DescribeInstanceInternetBandwidthConfigsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (DescribeInstanceInternetBandwidthConfigs) 用于查询实例带宽配置。
-//
-// * 只支持查询`BANDWIDTH_PREPAID`计费模式的带宽配置。
-// * 接口返回实例的所有带宽配置信息(包含历史的带宽配置信息)。
-func (c *Client) DescribeInstanceInternetBandwidthConfigs(request *DescribeInstanceInternetBandwidthConfigsRequest) (response *DescribeInstanceInternetBandwidthConfigsResponse, err error) {
- if request == nil {
- request = NewDescribeInstanceInternetBandwidthConfigsRequest()
- }
- response = NewDescribeInstanceInternetBandwidthConfigsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeInstanceTypeConfigsRequest() (request *DescribeInstanceTypeConfigsRequest) {
- request = &DescribeInstanceTypeConfigsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DescribeInstanceTypeConfigs")
- return
-}
-
-func NewDescribeInstanceTypeConfigsResponse() (response *DescribeInstanceTypeConfigsResponse) {
- response = &DescribeInstanceTypeConfigsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (DescribeInstanceTypeConfigs) 用于查询实例机型配置。
-//
-// * 可以根据`zone`、`instance-family`来查询实例机型配置。过滤条件详见过滤器`Filter`。
-// * 如果参数为空,返回指定地域的所有实例机型配置。
-func (c *Client) DescribeInstanceTypeConfigs(request *DescribeInstanceTypeConfigsRequest) (response *DescribeInstanceTypeConfigsResponse, err error) {
- if request == nil {
- request = NewDescribeInstanceTypeConfigsRequest()
- }
- response = NewDescribeInstanceTypeConfigsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeInstanceVncUrlRequest() (request *DescribeInstanceVncUrlRequest) {
- request = &DescribeInstanceVncUrlRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DescribeInstanceVncUrl")
- return
-}
-
-func NewDescribeInstanceVncUrlResponse() (response *DescribeInstanceVncUrlResponse) {
- response = &DescribeInstanceVncUrlResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 ( DescribeInstanceVncUrl ) 用于查询实例管理终端地址。
-//
-// * 处于 `STOPPED` 状态的机器无法使用此功能。
-// * 管理终端地址的有效期为 15 秒,调用接口成功后如果 15 秒内不使用该链接进行访问,管理终端地址自动失效,您需要重新查询。
-// * 管理终端地址一旦被访问,将自动失效,您需要重新查询。
-// * 如果连接断开,每分钟内重新连接的次数不能超过 30 次。
-// * 获取到 `InstanceVncUrl` 后,您需要在在链接 末尾加上参数 `InstanceVncUrl=xxxx` 。
-// - 参数 `InstanceVncUrl` :调用接口成功后会返回的 `InstanceVncUrl` 的值。
-//
-// 最后组成的 URL 格式如下:
-//
-// ```
-// https://img.qcloud.com/qcloud/app/active_vnc/index.html?InstanceVncUrl=wss%3A%2F%2Fbjvnc.qcloud.com%3A26789%2Fvnc%3Fs%3DaHpjWnRVMFNhYmxKdDM5MjRHNlVTSVQwajNUSW0wb2tBbmFtREFCTmFrcy8vUUNPMG0wSHZNOUUxRm5PMmUzWmFDcWlOdDJIbUJxSTZDL0RXcHZxYnZZMmRkWWZWcEZia2lyb09XMzdKNmM9
-// ```
-func (c *Client) DescribeInstanceVncUrl(request *DescribeInstanceVncUrlRequest) (response *DescribeInstanceVncUrlResponse, err error) {
- if request == nil {
- request = NewDescribeInstanceVncUrlRequest()
- }
- response = NewDescribeInstanceVncUrlResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeInstancesRequest() (request *DescribeInstancesRequest) {
- request = &DescribeInstancesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DescribeInstances")
- return
-}
-
-func NewDescribeInstancesResponse() (response *DescribeInstancesResponse) {
- response = &DescribeInstancesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (DescribeInstances) 用于查询一个或多个实例的详细信息。
-//
-// * 可以根据实例`ID`、实例名称或者实例计费模式等信息来查询实例的详细信息。过滤信息详细请见过滤器`Filter`。
-// * 如果参数为空,返回当前用户一定数量(`Limit`所指定的数量,默认为20)的实例。
-func (c *Client) DescribeInstances(request *DescribeInstancesRequest) (response *DescribeInstancesResponse, err error) {
- if request == nil {
- request = NewDescribeInstancesRequest()
- }
- response = NewDescribeInstancesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeInstancesOperationLimitRequest() (request *DescribeInstancesOperationLimitRequest) {
- request = &DescribeInstancesOperationLimitRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DescribeInstancesOperationLimit")
- return
-}
-
-func NewDescribeInstancesOperationLimitResponse() (response *DescribeInstancesOperationLimitResponse) {
- response = &DescribeInstancesOperationLimitResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeInstancesOperationLimit)用于查询实例操作限制。
-//
-// * 目前支持调整配置操作限制次数查询。
-func (c *Client) DescribeInstancesOperationLimit(request *DescribeInstancesOperationLimitRequest) (response *DescribeInstancesOperationLimitResponse, err error) {
- if request == nil {
- request = NewDescribeInstancesOperationLimitRequest()
- }
- response = NewDescribeInstancesOperationLimitResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeInstancesStatusRequest() (request *DescribeInstancesStatusRequest) {
- request = &DescribeInstancesStatusRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DescribeInstancesStatus")
- return
-}
-
-func NewDescribeInstancesStatusResponse() (response *DescribeInstancesStatusResponse) {
- response = &DescribeInstancesStatusResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (DescribeInstancesStatus) 用于查询一个或多个实例的状态。
-//
-// * 可以根据实例`ID`来查询实例的状态。
-// * 如果参数为空,返回当前用户一定数量(Limit所指定的数量,默认为20)的实例状态。
-func (c *Client) DescribeInstancesStatus(request *DescribeInstancesStatusRequest) (response *DescribeInstancesStatusResponse, err error) {
- if request == nil {
- request = NewDescribeInstancesStatusRequest()
- }
- response = NewDescribeInstancesStatusResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeInternetChargeTypeConfigsRequest() (request *DescribeInternetChargeTypeConfigsRequest) {
- request = &DescribeInternetChargeTypeConfigsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DescribeInternetChargeTypeConfigs")
- return
-}
-
-func NewDescribeInternetChargeTypeConfigsResponse() (response *DescribeInternetChargeTypeConfigsResponse) {
- response = &DescribeInternetChargeTypeConfigsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeInternetChargeTypeConfigs)用于查询网络的计费类型。
-func (c *Client) DescribeInternetChargeTypeConfigs(request *DescribeInternetChargeTypeConfigsRequest) (response *DescribeInternetChargeTypeConfigsResponse, err error) {
- if request == nil {
- request = NewDescribeInternetChargeTypeConfigsRequest()
- }
- response = NewDescribeInternetChargeTypeConfigsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeKeyPairsRequest() (request *DescribeKeyPairsRequest) {
- request = &DescribeKeyPairsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DescribeKeyPairs")
- return
-}
-
-func NewDescribeKeyPairsResponse() (response *DescribeKeyPairsResponse) {
- response = &DescribeKeyPairsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (DescribeKeyPairs) 用于查询密钥对信息。
-//
-// * 密钥对是通过一种算法生成的一对密钥,在生成的密钥对中,一个向外界公开,称为公钥;另一个用户自己保留,称为私钥。密钥对的公钥内容可以通过这个接口查询,但私钥内容系统不保留。
-func (c *Client) DescribeKeyPairs(request *DescribeKeyPairsRequest) (response *DescribeKeyPairsResponse, err error) {
- if request == nil {
- request = NewDescribeKeyPairsRequest()
- }
- response = NewDescribeKeyPairsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeRegionsRequest() (request *DescribeRegionsRequest) {
- request = &DescribeRegionsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DescribeRegions")
- return
-}
-
-func NewDescribeRegionsResponse() (response *DescribeRegionsResponse) {
- response = &DescribeRegionsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeRegions)用于查询地域信息。
-func (c *Client) DescribeRegions(request *DescribeRegionsRequest) (response *DescribeRegionsResponse, err error) {
- if request == nil {
- request = NewDescribeRegionsRequest()
- }
- response = NewDescribeRegionsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeZoneInstanceConfigInfosRequest() (request *DescribeZoneInstanceConfigInfosRequest) {
- request = &DescribeZoneInstanceConfigInfosRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DescribeZoneInstanceConfigInfos")
- return
-}
-
-func NewDescribeZoneInstanceConfigInfosResponse() (response *DescribeZoneInstanceConfigInfosResponse) {
- response = &DescribeZoneInstanceConfigInfosResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeZoneInstanceConfigInfos) 获取可用区的机型信息。
-func (c *Client) DescribeZoneInstanceConfigInfos(request *DescribeZoneInstanceConfigInfosRequest) (response *DescribeZoneInstanceConfigInfosResponse, err error) {
- if request == nil {
- request = NewDescribeZoneInstanceConfigInfosRequest()
- }
- response = NewDescribeZoneInstanceConfigInfosResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeZonesRequest() (request *DescribeZonesRequest) {
- request = &DescribeZonesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DescribeZones")
- return
-}
-
-func NewDescribeZonesResponse() (response *DescribeZonesResponse) {
- response = &DescribeZonesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeZones)用于查询可用区信息。
-func (c *Client) DescribeZones(request *DescribeZonesRequest) (response *DescribeZonesResponse, err error) {
- if request == nil {
- request = NewDescribeZonesRequest()
- }
- response = NewDescribeZonesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDisassociateInstancesKeyPairsRequest() (request *DisassociateInstancesKeyPairsRequest) {
- request = &DisassociateInstancesKeyPairsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DisassociateInstancesKeyPairs")
- return
-}
-
-func NewDisassociateInstancesKeyPairsResponse() (response *DisassociateInstancesKeyPairsResponse) {
- response = &DisassociateInstancesKeyPairsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (DisassociateInstancesKeyPairs) 用于解除实例的密钥绑定关系。
-//
-// * 只支持[`STOPPED`](https://cloud.tencent.com/document/api/213/9452#INSTANCE_STATE)状态的`Linux`操作系统的实例。
-// * 解绑密钥后,实例可以通过原来设置的密码登录。
-// * 如果原来没有设置密码,解绑后将无法使用 `SSH` 登录。可以调用 [ResetInstancesPassword](https://cloud.tencent.com/document/api/213/15736) 接口来设置登录密码。
-// * 支持批量操作。每次请求批量实例的上限为100。如果批量实例存在不允许操作的实例,操作会以特定错误码返回。
-func (c *Client) DisassociateInstancesKeyPairs(request *DisassociateInstancesKeyPairsRequest) (response *DisassociateInstancesKeyPairsResponse, err error) {
- if request == nil {
- request = NewDisassociateInstancesKeyPairsRequest()
- }
- response = NewDisassociateInstancesKeyPairsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDisassociateSecurityGroupsRequest() (request *DisassociateSecurityGroupsRequest) {
- request = &DisassociateSecurityGroupsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "DisassociateSecurityGroups")
- return
-}
-
-func NewDisassociateSecurityGroupsResponse() (response *DisassociateSecurityGroupsResponse) {
- response = &DisassociateSecurityGroupsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (DisassociateSecurityGroups) 用于解绑实例的指定安全组。
-func (c *Client) DisassociateSecurityGroups(request *DisassociateSecurityGroupsRequest) (response *DisassociateSecurityGroupsResponse, err error) {
- if request == nil {
- request = NewDisassociateSecurityGroupsRequest()
- }
- response = NewDisassociateSecurityGroupsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewImportImageRequest() (request *ImportImageRequest) {
- request = &ImportImageRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "ImportImage")
- return
-}
-
-func NewImportImageResponse() (response *ImportImageResponse) {
- response = &ImportImageResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ImportImage)用于导入镜像,导入后的镜像可用于创建实例。
-func (c *Client) ImportImage(request *ImportImageRequest) (response *ImportImageResponse, err error) {
- if request == nil {
- request = NewImportImageRequest()
- }
- response = NewImportImageResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewImportKeyPairRequest() (request *ImportKeyPairRequest) {
- request = &ImportKeyPairRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "ImportKeyPair")
- return
-}
-
-func NewImportKeyPairResponse() (response *ImportKeyPairResponse) {
- response = &ImportKeyPairResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (ImportKeyPair) 用于导入密钥对。
-//
-// * 本接口的功能是将密钥对导入到用户账户,并不会自动绑定到实例。如需绑定可以使用[AssociasteInstancesKeyPair](https://cloud.tencent.com/document/api/213/9404)接口。
-// * 需指定密钥对名称以及该密钥对的公钥文本。
-// * 如果用户只有私钥,可以通过 `SSL` 工具将私钥转换成公钥后再导入。
-func (c *Client) ImportKeyPair(request *ImportKeyPairRequest) (response *ImportKeyPairResponse, err error) {
- if request == nil {
- request = NewImportKeyPairRequest()
- }
- response = NewImportKeyPairResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewInquiryPriceModifyInstancesChargeTypeRequest() (request *InquiryPriceModifyInstancesChargeTypeRequest) {
- request = &InquiryPriceModifyInstancesChargeTypeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "InquiryPriceModifyInstancesChargeType")
- return
-}
-
-func NewInquiryPriceModifyInstancesChargeTypeResponse() (response *InquiryPriceModifyInstancesChargeTypeResponse) {
- response = &InquiryPriceModifyInstancesChargeTypeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (InquiryPriceModifyInstancesChargeType) 用于切换实例的计费模式询价。
-//
-// * 只支持从 `POSTPAID_BY_HOUR` 计费模式切换为`PREPAID`计费模式。
-// * 关机不收费的实例、`BC1`和`BS1`机型族的实例、设置定时销毁的实例不支持该操作。
-func (c *Client) InquiryPriceModifyInstancesChargeType(request *InquiryPriceModifyInstancesChargeTypeRequest) (response *InquiryPriceModifyInstancesChargeTypeResponse, err error) {
- if request == nil {
- request = NewInquiryPriceModifyInstancesChargeTypeRequest()
- }
- response = NewInquiryPriceModifyInstancesChargeTypeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewInquiryPriceRenewInstancesRequest() (request *InquiryPriceRenewInstancesRequest) {
- request = &InquiryPriceRenewInstancesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "InquiryPriceRenewInstances")
- return
-}
-
-func NewInquiryPriceRenewInstancesResponse() (response *InquiryPriceRenewInstancesResponse) {
- response = &InquiryPriceRenewInstancesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (InquiryPriceRenewInstances) 用于续费包年包月实例询价。
-//
-// * 只支持查询包年包月实例的续费价格。
-func (c *Client) InquiryPriceRenewInstances(request *InquiryPriceRenewInstancesRequest) (response *InquiryPriceRenewInstancesResponse, err error) {
- if request == nil {
- request = NewInquiryPriceRenewInstancesRequest()
- }
- response = NewInquiryPriceRenewInstancesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewInquiryPriceResetInstanceRequest() (request *InquiryPriceResetInstanceRequest) {
- request = &InquiryPriceResetInstanceRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "InquiryPriceResetInstance")
- return
-}
-
-func NewInquiryPriceResetInstanceResponse() (response *InquiryPriceResetInstanceResponse) {
- response = &InquiryPriceResetInstanceResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (InquiryPriceResetInstance) 用于重装实例询价。* 如果指定了`ImageId`参数,则使用指定的镜像进行重装询价;否则按照当前实例使用的镜像进行重装询价。* 目前只支持[系统盘类型](/document/api/213/9452#block_device)是`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`类型的实例使用该接口实现`Linux`和`Windows`操作系统切换的重装询价。* 目前不支持海外地域的实例使用该接口实现`Linux`和`Windows`操作系统切换的重装询价。
-func (c *Client) InquiryPriceResetInstance(request *InquiryPriceResetInstanceRequest) (response *InquiryPriceResetInstanceResponse, err error) {
- if request == nil {
- request = NewInquiryPriceResetInstanceRequest()
- }
- response = NewInquiryPriceResetInstanceResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewInquiryPriceResetInstancesInternetMaxBandwidthRequest() (request *InquiryPriceResetInstancesInternetMaxBandwidthRequest) {
- request = &InquiryPriceResetInstancesInternetMaxBandwidthRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "InquiryPriceResetInstancesInternetMaxBandwidth")
- return
-}
-
-func NewInquiryPriceResetInstancesInternetMaxBandwidthResponse() (response *InquiryPriceResetInstancesInternetMaxBandwidthResponse) {
- response = &InquiryPriceResetInstancesInternetMaxBandwidthResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (InquiryPriceResetInstancesInternetMaxBandwidth) 用于调整实例公网带宽上限询价。
-//
-// * 不同机型带宽上限范围不一致,具体限制详见[购买网络带宽](https://cloud.tencent.com/document/product/213/509)。
-// * 对于`BANDWIDTH_PREPAID`计费方式的带宽,需要输入参数`StartTime`和`EndTime`,指定调整后的带宽的生效时间段。在这种场景下目前不支持调小带宽,会涉及扣费,请确保账户余额充足。可通过[`DescribeAccountBalance`](https://cloud.tencent.com/document/product/378/4397)接口查询账户余额。
-// * 对于 `TRAFFIC_POSTPAID_BY_HOUR`、 `BANDWIDTH_POSTPAID_BY_HOUR` 和 `BANDWIDTH_PACKAGE` 计费方式的带宽,使用该接口调整带宽上限是实时生效的,可以在带宽允许的范围内调大或者调小带宽,不支持输入参数 `StartTime` 和 `EndTime` 。
-// * 接口不支持调整`BANDWIDTH_POSTPAID_BY_MONTH`计费方式的带宽。
-// * 接口不支持批量调整 `BANDWIDTH_PREPAID` 和 `BANDWIDTH_POSTPAID_BY_HOUR` 计费方式的带宽。
-// * 接口不支持批量调整混合计费方式的带宽。例如不支持同时调整`TRAFFIC_POSTPAID_BY_HOUR`和`BANDWIDTH_PACKAGE`计费方式的带宽。
-func (c *Client) InquiryPriceResetInstancesInternetMaxBandwidth(request *InquiryPriceResetInstancesInternetMaxBandwidthRequest) (response *InquiryPriceResetInstancesInternetMaxBandwidthResponse, err error) {
- if request == nil {
- request = NewInquiryPriceResetInstancesInternetMaxBandwidthRequest()
- }
- response = NewInquiryPriceResetInstancesInternetMaxBandwidthResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewInquiryPriceResetInstancesTypeRequest() (request *InquiryPriceResetInstancesTypeRequest) {
- request = &InquiryPriceResetInstancesTypeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "InquiryPriceResetInstancesType")
- return
-}
-
-func NewInquiryPriceResetInstancesTypeResponse() (response *InquiryPriceResetInstancesTypeResponse) {
- response = &InquiryPriceResetInstancesTypeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (InquiryPriceResetInstancesType) 用于调整实例的机型询价。
-//
-// * 目前只支持[系统盘类型](https://cloud.tencent.com/document/api/213/9452#block_device)是`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`类型的实例使用该接口进行调整机型询价。
-// * 目前不支持[CDH](https://cloud.tencent.com/document/product/416)实例使用该接口调整机型询价。
-// * 对于包年包月实例,使用该接口会涉及扣费,请确保账户余额充足。可通过[`DescribeAccountBalance`](https://cloud.tencent.com/document/product/378/4397)接口查询账户余额。
-func (c *Client) InquiryPriceResetInstancesType(request *InquiryPriceResetInstancesTypeRequest) (response *InquiryPriceResetInstancesTypeResponse, err error) {
- if request == nil {
- request = NewInquiryPriceResetInstancesTypeRequest()
- }
- response = NewInquiryPriceResetInstancesTypeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewInquiryPriceResizeInstanceDisksRequest() (request *InquiryPriceResizeInstanceDisksRequest) {
- request = &InquiryPriceResizeInstanceDisksRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "InquiryPriceResizeInstanceDisks")
- return
-}
-
-func NewInquiryPriceResizeInstanceDisksResponse() (response *InquiryPriceResizeInstanceDisksResponse) {
- response = &InquiryPriceResizeInstanceDisksResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (InquiryPriceResizeInstanceDisks) 用于扩容实例的数据盘询价。
-//
-// * 目前只支持扩容非弹性数据盘([`DescribeDisks`](https://cloud.tencent.com/document/api/362/16315)接口返回值中的`Portable`为`false`表示非弹性)询价,且[数据盘类型](/document/api/213/9452#block_device)为:`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`。
-// * 目前不支持[CDH](https://cloud.tencent.com/document/product/416)实例使用该接口扩容数据盘询价。* 仅支持包年包月实例随机器购买的数据盘。* 目前只支持扩容一块数据盘询价。
-func (c *Client) InquiryPriceResizeInstanceDisks(request *InquiryPriceResizeInstanceDisksRequest) (response *InquiryPriceResizeInstanceDisksResponse, err error) {
- if request == nil {
- request = NewInquiryPriceResizeInstanceDisksRequest()
- }
- response = NewInquiryPriceResizeInstanceDisksResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewInquiryPriceRunInstancesRequest() (request *InquiryPriceRunInstancesRequest) {
- request = &InquiryPriceRunInstancesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "InquiryPriceRunInstances")
- return
-}
-
-func NewInquiryPriceRunInstancesResponse() (response *InquiryPriceRunInstancesResponse) {
- response = &InquiryPriceRunInstancesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(InquiryPriceRunInstances)用于创建实例询价。本接口仅允许针对购买限制范围内的实例配置进行询价, 详见:[创建实例](https://cloud.tencent.com/document/api/213/15730)。
-func (c *Client) InquiryPriceRunInstances(request *InquiryPriceRunInstancesRequest) (response *InquiryPriceRunInstancesResponse, err error) {
- if request == nil {
- request = NewInquiryPriceRunInstancesRequest()
- }
- response = NewInquiryPriceRunInstancesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyDisasterRecoverGroupAttributeRequest() (request *ModifyDisasterRecoverGroupAttributeRequest) {
- request = &ModifyDisasterRecoverGroupAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "ModifyDisasterRecoverGroupAttribute")
- return
-}
-
-func NewModifyDisasterRecoverGroupAttributeResponse() (response *ModifyDisasterRecoverGroupAttributeResponse) {
- response = &ModifyDisasterRecoverGroupAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (ModifyDisasterRecoverGroupAttribute)用于修改[分散置放群组](https://cloud.tencent.com/document/product/213/15486)属性。
-func (c *Client) ModifyDisasterRecoverGroupAttribute(request *ModifyDisasterRecoverGroupAttributeRequest) (response *ModifyDisasterRecoverGroupAttributeResponse, err error) {
- if request == nil {
- request = NewModifyDisasterRecoverGroupAttributeRequest()
- }
- response = NewModifyDisasterRecoverGroupAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyHostsAttributeRequest() (request *ModifyHostsAttributeRequest) {
- request = &ModifyHostsAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "ModifyHostsAttribute")
- return
-}
-
-func NewModifyHostsAttributeResponse() (response *ModifyHostsAttributeResponse) {
- response = &ModifyHostsAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyHostsAttribute)用于修改CDH实例的属性,如实例名称和续费标记等。参数HostName和RenewFlag必须设置其中一个,但不能同时设置。
-func (c *Client) ModifyHostsAttribute(request *ModifyHostsAttributeRequest) (response *ModifyHostsAttributeResponse, err error) {
- if request == nil {
- request = NewModifyHostsAttributeRequest()
- }
- response = NewModifyHostsAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyImageAttributeRequest() (request *ModifyImageAttributeRequest) {
- request = &ModifyImageAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "ModifyImageAttribute")
- return
-}
-
-func NewModifyImageAttributeResponse() (response *ModifyImageAttributeResponse) {
- response = &ModifyImageAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyImageAttribute)用于修改镜像属性。
-//
-// * 已分享的镜像无法修改属性。
-func (c *Client) ModifyImageAttribute(request *ModifyImageAttributeRequest) (response *ModifyImageAttributeResponse, err error) {
- if request == nil {
- request = NewModifyImageAttributeRequest()
- }
- response = NewModifyImageAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyImageSharePermissionRequest() (request *ModifyImageSharePermissionRequest) {
- request = &ModifyImageSharePermissionRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "ModifyImageSharePermission")
- return
-}
-
-func NewModifyImageSharePermissionResponse() (response *ModifyImageSharePermissionResponse) {
- response = &ModifyImageSharePermissionResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyImageSharePermission)用于修改镜像分享信息。
-//
-// * 分享镜像后,被分享账户可以通过该镜像创建实例。
-// * 每个自定义镜像最多可共享给50个账户。
-// * 分享镜像无法更改名称,描述,仅可用于创建实例。
-// * 只支持分享到对方账户相同地域。
-func (c *Client) ModifyImageSharePermission(request *ModifyImageSharePermissionRequest) (response *ModifyImageSharePermissionResponse, err error) {
- if request == nil {
- request = NewModifyImageSharePermissionRequest()
- }
- response = NewModifyImageSharePermissionResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyInstancesAttributeRequest() (request *ModifyInstancesAttributeRequest) {
- request = &ModifyInstancesAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "ModifyInstancesAttribute")
- return
-}
-
-func NewModifyInstancesAttributeResponse() (response *ModifyInstancesAttributeResponse) {
- response = &ModifyInstancesAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (ModifyInstancesAttribute) 用于修改实例的属性(目前只支持修改实例的名称和关联的安全组)。
-//
-// * “实例名称”仅为方便用户自己管理之用,腾讯云并不以此名称作为提交工单或是进行实例管理操作的依据。
-// * 支持批量操作。每次请求批量实例的上限为100。
-// * 修改关联安全组时,子机原来关联的安全组会被解绑。
-func (c *Client) ModifyInstancesAttribute(request *ModifyInstancesAttributeRequest) (response *ModifyInstancesAttributeResponse, err error) {
- if request == nil {
- request = NewModifyInstancesAttributeRequest()
- }
- response = NewModifyInstancesAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyInstancesChargeTypeRequest() (request *ModifyInstancesChargeTypeRequest) {
- request = &ModifyInstancesChargeTypeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "ModifyInstancesChargeType")
- return
-}
-
-func NewModifyInstancesChargeTypeResponse() (response *ModifyInstancesChargeTypeResponse) {
- response = &ModifyInstancesChargeTypeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (ModifyInstancesChargeType) 用于切换实例的计费模式。
-//
-// * 只支持从 `POSTPAID_BY_HOUR` 计费模式切换为`PREPAID`计费模式。
-// * 关机不收费的实例、`BC1`和`BS1`机型族的实例、设置定时销毁的实例不支持该操作。
-func (c *Client) ModifyInstancesChargeType(request *ModifyInstancesChargeTypeRequest) (response *ModifyInstancesChargeTypeResponse, err error) {
- if request == nil {
- request = NewModifyInstancesChargeTypeRequest()
- }
- response = NewModifyInstancesChargeTypeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyInstancesProjectRequest() (request *ModifyInstancesProjectRequest) {
- request = &ModifyInstancesProjectRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "ModifyInstancesProject")
- return
-}
-
-func NewModifyInstancesProjectResponse() (response *ModifyInstancesProjectResponse) {
- response = &ModifyInstancesProjectResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (ModifyInstancesProject) 用于修改实例所属项目。
-//
-// * 项目为一个虚拟概念,用户可以在一个账户下面建立多个项目,每个项目中管理不同的资源;将多个不同实例分属到不同项目中,后续使用 [`DescribeInstances`](https://cloud.tencent.com/document/api/213/9388)接口查询实例,项目ID可用于过滤结果。
-// * 绑定负载均衡的实例不支持修改实例所属项目,请先使用[`DeregisterInstancesFromLoadBalancer`](https://cloud.tencent.com/document/api/214/1258)接口解绑负载均衡。
-// * 修改实例所属项目会自动解关联实例原来关联的安全组,修改完成后可能使用[`ModifySecurityGroupsOfInstance`](https://cloud.tencent.com/document/api/213/1367)接口关联安全组。
-// * 支持批量操作。每次请求批量实例的上限为100。
-func (c *Client) ModifyInstancesProject(request *ModifyInstancesProjectRequest) (response *ModifyInstancesProjectResponse, err error) {
- if request == nil {
- request = NewModifyInstancesProjectRequest()
- }
- response = NewModifyInstancesProjectResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyInstancesRenewFlagRequest() (request *ModifyInstancesRenewFlagRequest) {
- request = &ModifyInstancesRenewFlagRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "ModifyInstancesRenewFlag")
- return
-}
-
-func NewModifyInstancesRenewFlagResponse() (response *ModifyInstancesRenewFlagResponse) {
- response = &ModifyInstancesRenewFlagResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (ModifyInstancesRenewFlag) 用于修改包年包月实例续费标识。
-//
-// * 实例被标识为自动续费后,每次在实例到期时,会自动续费一个月。
-// * 支持批量操作。每次请求批量实例的上限为100。
-func (c *Client) ModifyInstancesRenewFlag(request *ModifyInstancesRenewFlagRequest) (response *ModifyInstancesRenewFlagResponse, err error) {
- if request == nil {
- request = NewModifyInstancesRenewFlagRequest()
- }
- response = NewModifyInstancesRenewFlagResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyInstancesVpcAttributeRequest() (request *ModifyInstancesVpcAttributeRequest) {
- request = &ModifyInstancesVpcAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "ModifyInstancesVpcAttribute")
- return
-}
-
-func NewModifyInstancesVpcAttributeResponse() (response *ModifyInstancesVpcAttributeResponse) {
- response = &ModifyInstancesVpcAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyInstancesVpcAttribute)用于修改实例vpc属性,如私有网络ip。
-// * 此操作默认会关闭实例,完成后再启动。
-// * 当指定私有网络ID和子网ID(子网必须在实例所在的可用区)与指定实例所在私有网络不一致时,会将实例迁移至指定的私有网络的子网下。执行此操作前请确保指定的实例上没有绑定[弹性网卡](https://cloud.tencent.com/document/product/576)和[负载均衡](https://cloud.tencent.com/document/product/214)。
-func (c *Client) ModifyInstancesVpcAttribute(request *ModifyInstancesVpcAttributeRequest) (response *ModifyInstancesVpcAttributeResponse, err error) {
- if request == nil {
- request = NewModifyInstancesVpcAttributeRequest()
- }
- response = NewModifyInstancesVpcAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyKeyPairAttributeRequest() (request *ModifyKeyPairAttributeRequest) {
- request = &ModifyKeyPairAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "ModifyKeyPairAttribute")
- return
-}
-
-func NewModifyKeyPairAttributeResponse() (response *ModifyKeyPairAttributeResponse) {
- response = &ModifyKeyPairAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (ModifyKeyPairAttribute) 用于修改密钥对属性。
-//
-// * 修改密钥对ID所指定的密钥对的名称和描述信息。
-// * 密钥对名称不能和已经存在的密钥对的名称重复。
-// * 密钥对ID是密钥对的唯一标识,不可修改。
-func (c *Client) ModifyKeyPairAttribute(request *ModifyKeyPairAttributeRequest) (response *ModifyKeyPairAttributeResponse, err error) {
- if request == nil {
- request = NewModifyKeyPairAttributeRequest()
- }
- response = NewModifyKeyPairAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewRebootInstancesRequest() (request *RebootInstancesRequest) {
- request = &RebootInstancesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "RebootInstances")
- return
-}
-
-func NewRebootInstancesResponse() (response *RebootInstancesResponse) {
- response = &RebootInstancesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (RebootInstances) 用于重启实例。
-//
-// * 只有状态为`RUNNING`的实例才可以进行此操作。
-// * 接口调用成功时,实例会进入`REBOOTING`状态;重启实例成功时,实例会进入`RUNNING`状态。
-// * 支持强制重启。强制重启的效果等同于关闭物理计算机的电源开关再重新启动。强制重启可能会导致数据丢失或文件系统损坏,请仅在服务器不能正常重启时使用。
-// * 支持批量操作,每次请求批量实例的上限为100。
-func (c *Client) RebootInstances(request *RebootInstancesRequest) (response *RebootInstancesResponse, err error) {
- if request == nil {
- request = NewRebootInstancesRequest()
- }
- response = NewRebootInstancesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewRenewHostsRequest() (request *RenewHostsRequest) {
- request = &RenewHostsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "RenewHosts")
- return
-}
-
-func NewRenewHostsResponse() (response *RenewHostsResponse) {
- response = &RenewHostsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (RenewHosts) 用于续费包年包月CDH实例。
-//
-// * 只支持操作包年包月实例,否则操作会以特定[错误码](#4.-.E9.94.99.E8.AF.AF.E7.A0.81)返回。
-// * 续费时请确保账户余额充足。可通过[`DescribeAccountBalance`](https://cloud.tencent.com/document/product/378/4397)接口查询账户余额。
-func (c *Client) RenewHosts(request *RenewHostsRequest) (response *RenewHostsResponse, err error) {
- if request == nil {
- request = NewRenewHostsRequest()
- }
- response = NewRenewHostsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewRenewInstancesRequest() (request *RenewInstancesRequest) {
- request = &RenewInstancesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "RenewInstances")
- return
-}
-
-func NewRenewInstancesResponse() (response *RenewInstancesResponse) {
- response = &RenewInstancesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (RenewInstances) 用于续费包年包月实例。
-//
-// * 只支持操作包年包月实例。
-// * 续费时请确保账户余额充足。可通过[`DescribeAccountBalance`](https://cloud.tencent.com/document/product/378/4397)接口查询账户余额。
-func (c *Client) RenewInstances(request *RenewInstancesRequest) (response *RenewInstancesResponse, err error) {
- if request == nil {
- request = NewRenewInstancesRequest()
- }
- response = NewRenewInstancesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewResetInstanceRequest() (request *ResetInstanceRequest) {
- request = &ResetInstanceRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "ResetInstance")
- return
-}
-
-func NewResetInstanceResponse() (response *ResetInstanceResponse) {
- response = &ResetInstanceResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (ResetInstance) 用于重装指定实例上的操作系统。
-//
-// * 如果指定了`ImageId`参数,则使用指定的镜像重装;否则按照当前实例使用的镜像进行重装。
-// * 系统盘将会被格式化,并重置;请确保系统盘中无重要文件。
-// * `Linux`和`Windows`系统互相切换时,该实例系统盘`ID`将发生变化,系统盘关联快照将无法回滚、恢复数据。
-// * 密码不指定将会通过站内信下发随机密码。
-// * 目前只支持[系统盘类型](https://cloud.tencent.com/document/api/213/9452#block_device)是`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`类型的实例使用该接口实现`Linux`和`Windows`操作系统切换。
-// * 目前不支持海外地域的实例使用该接口实现`Linux`和`Windows`操作系统切换。
-func (c *Client) ResetInstance(request *ResetInstanceRequest) (response *ResetInstanceResponse, err error) {
- if request == nil {
- request = NewResetInstanceRequest()
- }
- response = NewResetInstanceResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewResetInstancesInternetMaxBandwidthRequest() (request *ResetInstancesInternetMaxBandwidthRequest) {
- request = &ResetInstancesInternetMaxBandwidthRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "ResetInstancesInternetMaxBandwidth")
- return
-}
-
-func NewResetInstancesInternetMaxBandwidthResponse() (response *ResetInstancesInternetMaxBandwidthResponse) {
- response = &ResetInstancesInternetMaxBandwidthResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (ResetInstancesInternetMaxBandwidth) 用于调整实例公网带宽上限。
-//
-// * 不同机型带宽上限范围不一致,具体限制详见[购买网络带宽](https://cloud.tencent.com/document/product/213/509)。
-// * 对于 `BANDWIDTH_PREPAID` 计费方式的带宽,需要输入参数 `StartTime` 和 `EndTime` ,指定调整后的带宽的生效时间段。在这种场景下目前不支持调小带宽,会涉及扣费,请确保账户余额充足。可通过 [`DescribeAccountBalance`](https://cloud.tencent.com/document/product/378/4397) 接口查询账户余额。
-// * 对于 `TRAFFIC_POSTPAID_BY_HOUR` 、 `BANDWIDTH_POSTPAID_BY_HOUR` 和 `BANDWIDTH_PACKAGE` 计费方式的带宽,使用该接口调整带宽上限是实时生效的,可以在带宽允许的范围内调大或者调小带宽,不支持输入参数 `StartTime` 和 `EndTime` 。
-// * 接口不支持调整 `BANDWIDTH_POSTPAID_BY_MONTH` 计费方式的带宽。
-// * 接口不支持批量调整 `BANDWIDTH_PREPAID` 和 `BANDWIDTH_POSTPAID_BY_HOUR` 计费方式的带宽。
-// * 接口不支持批量调整混合计费方式的带宽。例如不支持同时调整 `TRAFFIC_POSTPAID_BY_HOUR` 和 `BANDWIDTH_PACKAGE` 计费方式的带宽。
-func (c *Client) ResetInstancesInternetMaxBandwidth(request *ResetInstancesInternetMaxBandwidthRequest) (response *ResetInstancesInternetMaxBandwidthResponse, err error) {
- if request == nil {
- request = NewResetInstancesInternetMaxBandwidthRequest()
- }
- response = NewResetInstancesInternetMaxBandwidthResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewResetInstancesPasswordRequest() (request *ResetInstancesPasswordRequest) {
- request = &ResetInstancesPasswordRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "ResetInstancesPassword")
- return
-}
-
-func NewResetInstancesPasswordResponse() (response *ResetInstancesPasswordResponse) {
- response = &ResetInstancesPasswordResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (ResetInstancesPassword) 用于将实例操作系统的密码重置为用户指定的密码。
-//
-// * 只修改管理员帐号的密码。实例的操作系统不同,管理员帐号也会不一样(`Windows`为`Administrator`,`Ubuntu`为`ubuntu`,其它系统为`root`)。
-// * 重置处于运行中状态的实例,需要显式指定强制关机参数`ForceStop`。如果没有显式指定强制关机参数,则只有处于关机状态的实例才允许执行重置密码操作。
-// * 支持批量操作。将多个实例操作系统的密码重置为相同的密码。每次请求批量实例的上限为100。
-func (c *Client) ResetInstancesPassword(request *ResetInstancesPasswordRequest) (response *ResetInstancesPasswordResponse, err error) {
- if request == nil {
- request = NewResetInstancesPasswordRequest()
- }
- response = NewResetInstancesPasswordResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewResetInstancesTypeRequest() (request *ResetInstancesTypeRequest) {
- request = &ResetInstancesTypeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "ResetInstancesType")
- return
-}
-
-func NewResetInstancesTypeResponse() (response *ResetInstancesTypeResponse) {
- response = &ResetInstancesTypeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (ResetInstancesType) 用于调整实例的机型。
-// * 目前只支持[系统盘类型](/document/api/213/9452#block_device)是`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`类型的实例使用该接口进行机型调整。
-// * 目前不支持[CDH](https://cloud.tencent.com/document/product/416)实例使用该接口调整机型。对于包年包月实例,使用该接口会涉及扣费,请确保账户余额充足。可通过[`DescribeAccountBalance`](https://cloud.tencent.com/document/product/378/4397)接口查询账户余额。
-func (c *Client) ResetInstancesType(request *ResetInstancesTypeRequest) (response *ResetInstancesTypeResponse, err error) {
- if request == nil {
- request = NewResetInstancesTypeRequest()
- }
- response = NewResetInstancesTypeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewResizeInstanceDisksRequest() (request *ResizeInstanceDisksRequest) {
- request = &ResizeInstanceDisksRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "ResizeInstanceDisks")
- return
-}
-
-func NewResizeInstanceDisksResponse() (response *ResizeInstanceDisksResponse) {
- response = &ResizeInstanceDisksResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (ResizeInstanceDisks) 用于扩容实例的数据盘。
-//
-// * 目前只支持扩容非弹性数据盘([`DescribeDisks`](https://cloud.tencent.com/document/api/362/16315)接口返回值中的`Portable`为`false`表示非弹性),且[数据盘类型](/document/api/213/9452#block_device)为:`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`。
-// * 目前不支持[CDH](https://cloud.tencent.com/document/product/416)实例使用该接口扩容数据盘。
-// * 对于包年包月实例,使用该接口会涉及扣费,请确保账户余额充足。可通过[`DescribeAccountBalance`](https://cloud.tencent.com/document/product/378/4397)接口查询账户余额。
-// * 目前只支持扩容一块数据盘。
-func (c *Client) ResizeInstanceDisks(request *ResizeInstanceDisksRequest) (response *ResizeInstanceDisksResponse, err error) {
- if request == nil {
- request = NewResizeInstanceDisksRequest()
- }
- response = NewResizeInstanceDisksResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewRunInstancesRequest() (request *RunInstancesRequest) {
- request = &RunInstancesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "RunInstances")
- return
-}
-
-func NewRunInstancesResponse() (response *RunInstancesResponse) {
- response = &RunInstancesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (RunInstances) 用于创建一个或多个指定配置的实例。
-//
-// * 实例创建成功后将自动开机启动,[实例状态](/document/api/213/9452#instance_state)变为“运行中”。
-// * 预付费实例的购买会预先扣除本次实例购买所需金额,按小时后付费实例购买会预先冻结本次实例购买一小时内所需金额,在调用本接口前请确保账户余额充足。
-// * 本接口允许购买的实例数量遵循[CVM实例购买限制](https://cloud.tencent.com/document/product/213/2664),所创建的实例和官网入口创建的实例共用配额。
-// * 本接口为异步接口,当创建请求下发成功后会返回一个实例`ID`列表,此时实例的创建并立即未完成。在此期间实例的状态将会处于“准备中”,可以通过调用 [DescribeInstances](https://cloud.tencent.com/document/api/213/15728) 接口查询对应实例的状态,来判断创建有没有最终成功。如果实例的状态由“准备中”变为“运行中”,则为创建成功。
-func (c *Client) RunInstances(request *RunInstancesRequest) (response *RunInstancesResponse, err error) {
- if request == nil {
- request = NewRunInstancesRequest()
- }
- response = NewRunInstancesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewStartInstancesRequest() (request *StartInstancesRequest) {
- request = &StartInstancesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "StartInstances")
- return
-}
-
-func NewStartInstancesResponse() (response *StartInstancesResponse) {
- response = &StartInstancesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (StartInstances) 用于启动一个或多个实例。
-//
-// * 只有状态为`STOPPED`的实例才可以进行此操作。
-// * 接口调用成功时,实例会进入`STARTING`状态;启动实例成功时,实例会进入`RUNNING`状态。
-// * 支持批量操作。每次请求批量实例的上限为100。
-func (c *Client) StartInstances(request *StartInstancesRequest) (response *StartInstancesResponse, err error) {
- if request == nil {
- request = NewStartInstancesRequest()
- }
- response = NewStartInstancesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewStopInstancesRequest() (request *StopInstancesRequest) {
- request = &StopInstancesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "StopInstances")
- return
-}
-
-func NewStopInstancesResponse() (response *StopInstancesResponse) {
- response = &StopInstancesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (StopInstances) 用于关闭一个或多个实例。
-//
-// * 只有状态为`RUNNING`的实例才可以进行此操作。
-// * 接口调用成功时,实例会进入`STOPPING`状态;关闭实例成功时,实例会进入`STOPPED`状态。
-// * 支持强制关闭。强制关机的效果等同于关闭物理计算机的电源开关。强制关机可能会导致数据丢失或文件系统损坏,请仅在服务器不能正常关机时使用。
-// * 支持批量操作。每次请求批量实例的上限为100。
-func (c *Client) StopInstances(request *StopInstancesRequest) (response *StopInstancesResponse, err error) {
- if request == nil {
- request = NewStopInstancesRequest()
- }
- response = NewStopInstancesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewSyncImagesRequest() (request *SyncImagesRequest) {
- request = &SyncImagesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "SyncImages")
- return
-}
-
-func NewSyncImagesResponse() (response *SyncImagesResponse) {
- response = &SyncImagesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(SyncImages)用于将自定义镜像同步到其它地区。
-//
-// * 该接口每次调用只支持同步一个镜像。
-// * 该接口支持多个同步地域。
-// * 单个帐号在每个地域最多支持存在10个自定义镜像。
-func (c *Client) SyncImages(request *SyncImagesRequest) (response *SyncImagesResponse, err error) {
- if request == nil {
- request = NewSyncImagesRequest()
- }
- response = NewSyncImagesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewTerminateInstancesRequest() (request *TerminateInstancesRequest) {
- request = &TerminateInstancesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("cvm", APIVersion, "TerminateInstances")
- return
-}
-
-func NewTerminateInstancesResponse() (response *TerminateInstancesResponse) {
- response = &TerminateInstancesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (TerminateInstances) 用于主动退还实例。
-//
-// * 不再使用的实例,可通过本接口主动退还。
-// * 按量计费的实例通过本接口可直接退还;包年包月实例如符合[退还规则](https://cloud.tencent.com/document/product/213/9711),也可通过本接口主动退还。
-// * 支持批量操作,每次请求批量实例的上限为100。
-func (c *Client) TerminateInstances(request *TerminateInstancesRequest) (response *TerminateInstancesResponse, err error) {
- if request == nil {
- request = NewTerminateInstancesRequest()
- }
- response = NewTerminateInstancesResponse()
- err = c.Send(request, response)
- return
-}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312/models.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312/models.go
deleted file mode 100644
index aef3f7b..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312/models.go
+++ /dev/null
@@ -1,3435 +0,0 @@
-// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package v20170312
-
-import (
- "encoding/json"
-
- tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http"
-)
-
-type ActionTimer struct {
-
- // 扩展数据
- Externals *Externals `json:"Externals,omitempty" name:"Externals"`
-
- // 定时器名称,目前仅支持销毁一个值:TerminateInstances。
- TimerAction *string `json:"TimerAction,omitempty" name:"TimerAction"`
-
- // 执行时间,格式形如:2018-5-29 11:26:40,执行时间必须大于当前时间5分钟。
- ActionTime *string `json:"ActionTime,omitempty" name:"ActionTime"`
-}
-
-type AllocateHostsRequest struct {
- *tchttp.BaseRequest
-
- // 实例所在的位置。通过该参数可以指定实例所属可用区,所属项目等属性。
- Placement *Placement `json:"Placement,omitempty" name:"Placement"`
-
- // 用于保证请求幂等性的字符串。
- ClientToken *string `json:"ClientToken,omitempty" name:"ClientToken"`
-
- // 预付费模式,即包年包月相关参数设置。通过该参数可以指定包年包月实例的购买时长、是否设置自动续费等属性。若指定实例的付费模式为预付费则该参数必传。
- HostChargePrepaid *ChargePrepaid `json:"HostChargePrepaid,omitempty" name:"HostChargePrepaid"`
-
- // 实例计费类型。目前仅支持:PREPAID(预付费,即包年包月模式)。
- HostChargeType *string `json:"HostChargeType,omitempty" name:"HostChargeType"`
-
- // CDH实例机型,默认为:'HS1'。
- HostType *string `json:"HostType,omitempty" name:"HostType"`
-
- // 购买CDH实例数量。
- HostCount *uint64 `json:"HostCount,omitempty" name:"HostCount"`
-
- // 标签描述列表。通过指定该参数可以同时绑定标签到相应的资源实例。
- TagSpecification []*TagSpecification `json:"TagSpecification,omitempty" name:"TagSpecification" list`
-}
-
-func (r *AllocateHostsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AllocateHostsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AllocateHostsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 新创建云子机的实例id列表。
- HostIdSet []*string `json:"HostIdSet,omitempty" name:"HostIdSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *AllocateHostsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AllocateHostsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AssociateInstancesKeyPairsRequest struct {
- *tchttp.BaseRequest
-
- // 一个或多个待操作的实例ID,每次请求批量实例的上限为100。
可以通过以下方式获取可用的实例ID:
通过登录[控制台](https://console.cloud.tencent.com/cvm/index)查询实例ID。
通过调用接口 [DescribeInstances](https://cloud.tencent.com/document/api/213/15728) ,取返回信息中的`InstanceId`获取实例ID。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 一个或多个待操作的密钥对ID,每次请求批量密钥对的上限为100。密钥对ID形如:`skey-3glfot13`。
可以通过以下方式获取可用的密钥ID:
通过登录[控制台](https://console.cloud.tencent.com/cvm/sshkey)查询密钥ID。
通过调用接口 [DescribeKeyPairs](https://cloud.tencent.com/document/api/213/15699) ,取返回信息中的`KeyId`获取密钥对ID。
- KeyIds []*string `json:"KeyIds,omitempty" name:"KeyIds" list`
-
- // 是否对运行中的实例选择强制关机。建议对运行中的实例先手动关机,然后再绑定密钥。取值范围:
TRUE:表示在正常关机失败后进行强制关机。
FALSE:表示在正常关机失败后不进行强制关机。
默认取值:FALSE。
- ForceStop *bool `json:"ForceStop,omitempty" name:"ForceStop"`
-}
-
-func (r *AssociateInstancesKeyPairsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AssociateInstancesKeyPairsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AssociateInstancesKeyPairsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *AssociateInstancesKeyPairsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AssociateInstancesKeyPairsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AssociateSecurityGroupsRequest struct {
- *tchttp.BaseRequest
-
- // 要绑定的`安全组ID`,类似sg-efil73jd,只支持绑定单个安全组。
- SecurityGroupIds []*string `json:"SecurityGroupIds,omitempty" name:"SecurityGroupIds" list`
-
- // 被绑定的`实例ID`,类似ins-lesecurk,支持指定多个实例。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-}
-
-func (r *AssociateSecurityGroupsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AssociateSecurityGroupsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AssociateSecurityGroupsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *AssociateSecurityGroupsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AssociateSecurityGroupsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ChargePrepaid struct {
-
- // 购买实例的时长,单位:月。取值范围:1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36。
- Period *uint64 `json:"Period,omitempty" name:"Period"`
-
- // 自动续费标识。取值范围:
NOTIFY_AND_AUTO_RENEW:通知过期且自动续费
NOTIFY_AND_MANUAL_RENEW:通知过期不自动续费
DISABLE_NOTIFY_AND_MANUAL_RENEW:不通知过期不自动续费
默认取值:NOTIFY_AND_AUTO_RENEW。若该参数指定为NOTIFY_AND_AUTO_RENEW,在账户余额充足的情况下,实例到期后将按月自动续费。
- RenewFlag *string `json:"RenewFlag,omitempty" name:"RenewFlag"`
-}
-
-type CreateDisasterRecoverGroupRequest struct {
- *tchttp.BaseRequest
-
- // 分散置放群组名称,长度1-60个字符,支持中、英文。
- Name *string `json:"Name,omitempty" name:"Name"`
-
- // 分散置放群组类型,取值范围:
HOST:物理机
SW:交换机
RACK:机架
- Type *string `json:"Type,omitempty" name:"Type"`
-
- // 用于保证请求幂等性的字符串。该字符串由客户生成,需保证不同请求之间唯一,最大值不超过64个ASCII字符。若不指定该参数,则无法保证请求的幂等性。
更多详细信息请参阅:如何保证幂等性。
- ClientToken *string `json:"ClientToken,omitempty" name:"ClientToken"`
-}
-
-func (r *CreateDisasterRecoverGroupRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateDisasterRecoverGroupRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateDisasterRecoverGroupResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 分散置放群组ID列表。
- DisasterRecoverGroupId *string `json:"DisasterRecoverGroupId,omitempty" name:"DisasterRecoverGroupId"`
-
- // 分散置放群组类型,取值范围:
HOST:物理机
SW:交换机
RACK:机架
- Type *string `json:"Type,omitempty" name:"Type"`
-
- // 分散置放群组名称,长度1-60个字符,支持中、英文。
- Name *string `json:"Name,omitempty" name:"Name"`
-
- // 置放群组内可容纳的云主机数量。
- CvmQuotaTotal *int64 `json:"CvmQuotaTotal,omitempty" name:"CvmQuotaTotal"`
-
- // 置放群组内已有的云主机数量。
- CurrentNum *int64 `json:"CurrentNum,omitempty" name:"CurrentNum"`
-
- // 置放群组创建时间。
- CreateTime *string `json:"CreateTime,omitempty" name:"CreateTime"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateDisasterRecoverGroupResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateDisasterRecoverGroupResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateImageRequest struct {
- *tchttp.BaseRequest
-
- // 镜像名称
- ImageName *string `json:"ImageName,omitempty" name:"ImageName"`
-
- // 需要制作镜像的实例ID
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 镜像描述
- ImageDescription *string `json:"ImageDescription,omitempty" name:"ImageDescription"`
-
- // 软关机失败时是否执行强制关机以制作镜像
- ForcePoweroff *string `json:"ForcePoweroff,omitempty" name:"ForcePoweroff"`
-
- // 创建Windows镜像时是否启用Sysprep
- Sysprep *string `json:"Sysprep,omitempty" name:"Sysprep"`
-
- // 实例处于运行中时,是否允许关机执行制作镜像任务。
- Reboot *string `json:"Reboot,omitempty" name:"Reboot"`
-
- // 实例需要制作镜像的数据盘Id
- DataDiskIds []*string `json:"DataDiskIds,omitempty" name:"DataDiskIds" list`
-
- // 需要制作镜像的快照Id,必须包含一个系统盘快照
- SnapshotIds []*string `json:"SnapshotIds,omitempty" name:"SnapshotIds" list`
-
- // 检测请求的合法性,但不会对操作的资源产生任何影响
- DryRun *bool `json:"DryRun,omitempty" name:"DryRun"`
-}
-
-func (r *CreateImageRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateImageRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateImageResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateImageResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateImageResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateKeyPairRequest struct {
- *tchttp.BaseRequest
-
- // 密钥对名称,可由数字,字母和下划线组成,长度不超过25个字符。
- KeyName *string `json:"KeyName,omitempty" name:"KeyName"`
-
- // 密钥对创建后所属的项目ID。
- // 可以通过以下方式获取项目ID:
- // 通过项目列表查询项目ID。
- // 通过调用接口DescribeProject,取返回信息中的`projectId `获取项目ID。
- ProjectId *int64 `json:"ProjectId,omitempty" name:"ProjectId"`
-}
-
-func (r *CreateKeyPairRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateKeyPairRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateKeyPairResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 密钥对信息。
- KeyPair *KeyPair `json:"KeyPair,omitempty" name:"KeyPair"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateKeyPairResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateKeyPairResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DataDisk struct {
-
- // 数据盘大小,单位:GB。最小调整步长为10G,不同数据盘类型取值范围不同,具体限制详见:[CVM实例配置](/document/product/213/2177)。默认值为0,表示不购买数据盘。更多限制详见产品文档。
- DiskSize *int64 `json:"DiskSize,omitempty" name:"DiskSize"`
-
- // 数据盘类型。数据盘类型限制详见[CVM实例配置](/document/product/213/2177)。取值范围:
LOCAL_BASIC:本地硬盘
LOCAL_SSD:本地SSD硬盘
CLOUD_BASIC:普通云硬盘
CLOUD_PREMIUM:高性能云硬盘
CLOUD_SSD:SSD云硬盘
默认取值:LOCAL_BASIC。
该参数对`ResizeInstanceDisk`接口无效。
- DiskType *string `json:"DiskType,omitempty" name:"DiskType"`
-
- // 数据盘ID。LOCAL_BASIC 和 LOCAL_SSD 类型没有ID。暂时不支持该参数。
- DiskId *string `json:"DiskId,omitempty" name:"DiskId"`
-
- // 数据盘是否随子机销毁。取值范围:
- // TRUE:子机销毁时,销毁数据盘,只支持按小时后付费云盘
- // FALSE:子机销毁时,保留数据盘
- // 默认取值:TRUE
- // 该参数目前仅用于 `RunInstances` 接口。
- // 注意:此字段可能返回 null,表示取不到有效值。
- DeleteWithInstance *bool `json:"DeleteWithInstance,omitempty" name:"DeleteWithInstance"`
-
- // 数据盘快照ID。选择的数据盘快照大小需小于数据盘大小。
- // 注意:此字段可能返回 null,表示取不到有效值。
- SnapshotId *string `json:"SnapshotId,omitempty" name:"SnapshotId"`
-}
-
-type DeleteDisasterRecoverGroupsRequest struct {
- *tchttp.BaseRequest
-
- // 分散置放群组ID列表,可通过[DescribeDisasterRecoverGroups](https://cloud.tencent.com/document/api/213/17810)接口获取。
- DisasterRecoverGroupIds []*string `json:"DisasterRecoverGroupIds,omitempty" name:"DisasterRecoverGroupIds" list`
-}
-
-func (r *DeleteDisasterRecoverGroupsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteDisasterRecoverGroupsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteDisasterRecoverGroupsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteDisasterRecoverGroupsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteDisasterRecoverGroupsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteImagesRequest struct {
- *tchttp.BaseRequest
-
- // 准备删除的镜像Id列表
- ImageIds []*string `json:"ImageIds,omitempty" name:"ImageIds" list`
-}
-
-func (r *DeleteImagesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteImagesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteImagesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteImagesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteImagesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteKeyPairsRequest struct {
- *tchttp.BaseRequest
-
- // 一个或多个待操作的密钥对ID。每次请求批量密钥对的上限为100。
可以通过以下方式获取可用的密钥ID:
通过登录[控制台](https://console.cloud.tencent.com/cvm/sshkey)查询密钥ID。
通过调用接口 [DescribeKeyPairs](https://cloud.tencent.com/document/api/213/15699) ,取返回信息中的 `KeyId` 获取密钥对ID。
- KeyIds []*string `json:"KeyIds,omitempty" name:"KeyIds" list`
-}
-
-func (r *DeleteKeyPairsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteKeyPairsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteKeyPairsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteKeyPairsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteKeyPairsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDisasterRecoverGroupQuotaRequest struct {
- *tchttp.BaseRequest
-}
-
-func (r *DescribeDisasterRecoverGroupQuotaRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDisasterRecoverGroupQuotaRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDisasterRecoverGroupQuotaResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 可创建置放群组数量的上限。
- GroupQuota *int64 `json:"GroupQuota,omitempty" name:"GroupQuota"`
-
- // 当前用户已经创建的置放群组数量。
- CurrentNum *int64 `json:"CurrentNum,omitempty" name:"CurrentNum"`
-
- // 物理机类型容灾组内实例的配额数。
- CvmInHostGroupQuota *int64 `json:"CvmInHostGroupQuota,omitempty" name:"CvmInHostGroupQuota"`
-
- // 交换机类型容灾组内实例的配额数。
- CvmInSwGroupQuota *int64 `json:"CvmInSwGroupQuota,omitempty" name:"CvmInSwGroupQuota"`
-
- // 机架类型容灾组内实例的配额数。
- CvmInRackGroupQuota *int64 `json:"CvmInRackGroupQuota,omitempty" name:"CvmInRackGroupQuota"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeDisasterRecoverGroupQuotaResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDisasterRecoverGroupQuotaResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDisasterRecoverGroupsRequest struct {
- *tchttp.BaseRequest
-
- // 分散置放群组ID列表。
- DisasterRecoverGroupIds []*string `json:"DisasterRecoverGroupIds,omitempty" name:"DisasterRecoverGroupIds" list`
-
- // 分散置放群组名称,支持模糊匹配。
- Name *string `json:"Name,omitempty" name:"Name"`
-
- // 偏移量,默认为0。关于`Offset`的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/15688)中的相关小节。
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量,默认为20,最大值为100。关于`Limit`的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/15688)中的相关小节。
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeDisasterRecoverGroupsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDisasterRecoverGroupsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDisasterRecoverGroupsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 分散置放群组信息列表。
- DisasterRecoverGroupSet []*DisasterRecoverGroup `json:"DisasterRecoverGroupSet,omitempty" name:"DisasterRecoverGroupSet" list`
-
- // 用户置放群组总量。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeDisasterRecoverGroupsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDisasterRecoverGroupsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeHostsRequest struct {
- *tchttp.BaseRequest
-
- // 过滤条件。
- // zone - String - 是否必填:否 - (过滤条件)按照可用区过滤。
- // project-id - Integer - 是否必填:否 - (过滤条件)按照项目ID过滤。可通过调用 DescribeProject 查询已创建的项目列表或登录控制台进行查看;也可以调用 AddProject 创建新的项目。
- // host-id - String - 是否必填:否 - (过滤条件)按照CDH ID过滤。CDH ID形如:host-11112222。
- // host-name - String - 是否必填:否 - (过滤条件)按照CDH实例名称过滤。
- // host-state - String - 是否必填:否 - (过滤条件)按照CDH实例状态进行过滤。(PENDING:创建中|LAUNCH_FAILURE:创建失败|RUNNING:运行中|EXPIRED:已过期)
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量,默认为0。
- Offset *uint64 `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量,默认为20,最大值为100。
- Limit *uint64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeHostsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeHostsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeHostsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合查询条件的cdh实例总数
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // cdh实例详细信息列表
- HostSet []*HostItem `json:"HostSet,omitempty" name:"HostSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeHostsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeHostsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeImageQuotaRequest struct {
- *tchttp.BaseRequest
-}
-
-func (r *DescribeImageQuotaRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeImageQuotaRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeImageQuotaResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 账户的镜像配额
- ImageNumQuota *int64 `json:"ImageNumQuota,omitempty" name:"ImageNumQuota"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeImageQuotaResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeImageQuotaResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeImageSharePermissionRequest struct {
- *tchttp.BaseRequest
-
- // 需要共享的镜像Id
- ImageId *string `json:"ImageId,omitempty" name:"ImageId"`
-}
-
-func (r *DescribeImageSharePermissionRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeImageSharePermissionRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeImageSharePermissionResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 镜像共享信息
- SharePermissionSet []*SharePermission `json:"SharePermissionSet,omitempty" name:"SharePermissionSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeImageSharePermissionResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeImageSharePermissionResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeImagesRequest struct {
- *tchttp.BaseRequest
-
- // 镜像ID列表 。镜像ID如:`img-gvbnzy6f`。array型参数的格式可以参考[API简介](https://cloud.tencent.com/document/api/213/15688)。镜像ID可以通过如下方式获取:
通过[DescribeImages](https://cloud.tencent.com/document/api/213/15715)接口返回的`ImageId`获取。
通过[镜像控制台](https://console.cloud.tencent.com/cvm/image)获取。
- ImageIds []*string `json:"ImageIds,omitempty" name:"ImageIds" list`
-
- // 过滤条件,每次请求的`Filters`的上限为0,`Filters.Values`的上限为5。参数不可以同时指定`ImageIds`和`Filters`。详细的过滤条件如下:
- // image-id - String - 是否必填: 否 - (过滤条件)按照镜像ID进行过滤
- // image-type - String - 是否必填: 否 - (过滤条件)按照镜像类型进行过滤。取值范围:详见[镜像类型](https://cloud.tencent.com/document/product/213/9452#image_type)。
- // image-state - String - 是否必填: 否 - (过滤条件)按照镜像状态进行过滤。取值范围:详见[镜像状态](https://cloud.tencent.com/document/product/213/9452#image_state)。
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量,默认为0。关于Offset详见[API简介](/document/api/213/568#.E8.BE.93.E5.85.A5.E5.8F.82.E6.95.B0.E4.B8.8E.E8.BF.94.E5.9B.9E.E5.8F.82.E6.95.B0.E9.87.8A.E4.B9.89)。
- Offset *uint64 `json:"Offset,omitempty" name:"Offset"`
-
- // 数量限制,默认为20,最大值为100。关于Limit详见[API简介](/document/api/213/568#.E8.BE.93.E5.85.A5.E5.8F.82.E6.95.B0.E4.B8.8E.E8.BF.94.E5.9B.9E.E5.8F.82.E6.95.B0.E9.87.8A.E4.B9.89)。
- Limit *uint64 `json:"Limit,omitempty" name:"Limit"`
-
- // 实例类型,如 `S1.SMALL1`
- InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"`
-}
-
-func (r *DescribeImagesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeImagesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeImagesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 一个关于镜像详细信息的结构体,主要包括镜像的主要状态与属性。
- ImageSet []*Image `json:"ImageSet,omitempty" name:"ImageSet" list`
-
- // 符合要求的镜像数量。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeImagesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeImagesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeImportImageOsRequest struct {
- *tchttp.BaseRequest
-}
-
-func (r *DescribeImportImageOsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeImportImageOsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeImportImageOsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 支持的导入镜像的操作系统类型。
- ImportImageOsListSupported *ImageOsList `json:"ImportImageOsListSupported,omitempty" name:"ImportImageOsListSupported"`
-
- // 支持的导入镜像的操作系统版本。
- ImportImageOsVersionSet []*OsVersion `json:"ImportImageOsVersionSet,omitempty" name:"ImportImageOsVersionSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeImportImageOsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeImportImageOsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceFamilyConfigsRequest struct {
- *tchttp.BaseRequest
-}
-
-func (r *DescribeInstanceFamilyConfigsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceFamilyConfigsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceFamilyConfigsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 实例机型组配置的列表信息
- InstanceFamilyConfigSet []*InstanceFamilyConfig `json:"InstanceFamilyConfigSet,omitempty" name:"InstanceFamilyConfigSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeInstanceFamilyConfigsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceFamilyConfigsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceInternetBandwidthConfigsRequest struct {
- *tchttp.BaseRequest
-
- // 待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *DescribeInstanceInternetBandwidthConfigsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceInternetBandwidthConfigsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceInternetBandwidthConfigsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 带宽配置信息列表。
- InternetBandwidthConfigSet []*InternetBandwidthConfig `json:"InternetBandwidthConfigSet,omitempty" name:"InternetBandwidthConfigSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeInstanceInternetBandwidthConfigsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceInternetBandwidthConfigsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceTypeConfigsRequest struct {
- *tchttp.BaseRequest
-
- // 过滤条件。
- // zone - String - 是否必填:否 -(过滤条件)按照[可用区](https://cloud.tencent.com/document/api/213/9452#zone)过滤。
- // instance-family - String - 是否必填:否 -(过滤条件)按照实例机型系列过滤。实例机型系列形如:S1、I1、M1等。
- // 每次请求的`Filters`的上限为10,`Filter.Values`的上限为1。
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-}
-
-func (r *DescribeInstanceTypeConfigsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceTypeConfigsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceTypeConfigsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 实例机型配置列表。
- InstanceTypeConfigSet []*InstanceTypeConfig `json:"InstanceTypeConfigSet,omitempty" name:"InstanceTypeConfigSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeInstanceTypeConfigsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceTypeConfigsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceVncUrlRequest struct {
- *tchttp.BaseRequest
-
- // 一个操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728) API返回值中的`InstanceId`获取。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *DescribeInstanceVncUrlRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceVncUrlRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceVncUrlResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 实例的管理终端地址。
- InstanceVncUrl *string `json:"InstanceVncUrl,omitempty" name:"InstanceVncUrl"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeInstanceVncUrlResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceVncUrlResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstancesOperationLimitRequest struct {
- *tchttp.BaseRequest
-
- // 按照一个或者多个实例ID查询,可通过[DescribeInstances](https://cloud.tencent.com/document/api/213/9388)API返回值中的InstanceId获取。实例ID形如:ins-xxxxxxxx。(此参数的具体格式可参考API[简介](https://cloud.tencent.com/document/api/213/15688)的id.N一节)。每次请求的实例的上限为100。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 实例操作。
- // INSTANCE_DEGRADE:实例降配操作
- Operation *string `json:"Operation,omitempty" name:"Operation"`
-}
-
-func (r *DescribeInstancesOperationLimitRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstancesOperationLimitRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstancesOperationLimitResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 该参数表示调整配置操作(降配)限制次数查询。
- InstanceOperationLimitSet []*OperationCountLimit `json:"InstanceOperationLimitSet,omitempty" name:"InstanceOperationLimitSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeInstancesOperationLimitResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstancesOperationLimitResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstancesRequest struct {
- *tchttp.BaseRequest
-
- // 按照一个或者多个实例ID查询。实例ID形如:`ins-xxxxxxxx`。(此参数的具体格式可参考API[简介](https://cloud.tencent.com/document/api/213/15688)的`id.N`一节)。每次请求的实例的上限为100。参数不支持同时指定`InstanceIds`和`Filters`。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 过滤条件。
- // zone - String - 是否必填:否 -(过滤条件)按照可用区过滤。
- // project-id - Integer - 是否必填:否 -(过滤条件)按照项目ID过滤。可通过调用[DescribeProject](https://cloud.tencent.com/document/api/378/4400)查询已创建的项目列表或登录[控制台](https://console.cloud.tencent.com/cvm/index)进行查看;也可以调用[AddProject](https://cloud.tencent.com/document/api/378/4398)创建新的项目。
- // host-id - String - 是否必填:否 - (过滤条件)按照[CDH](https://cloud.tencent.com/document/product/416) ID过滤。[CDH](https://cloud.tencent.com/document/product/416) ID形如:host-xxxxxxxx。
- // vpc-id - String - 是否必填:否 - (过滤条件)按照VPC ID进行过滤。VPC ID形如:vpc-xxxxxxxx。
- // subnet-id - String - 是否必填:否 - (过滤条件)按照子网ID进行过滤。子网ID形如:subnet-xxxxxxxx。
- // instance-id - String - 是否必填:否 - (过滤条件)按照实例ID过滤。实例ID形如:ins-xxxxxxxx。
- // security-group-id - String - 是否必填:否 - (过滤条件)按照安全组ID过滤,安全组ID形如: sg-8jlk3f3r。
- // instance-name - String - 是否必填:否 - (过滤条件)按照实例名称过滤。
- // instance-charge-type - String - 是否必填:否 -(过滤条件)按照实例计费模式过滤。 (PREPAID:表示预付费,即包年包月 | POSTPAID_BY_HOUR:表示后付费,即按量计费 | CDHPAID:表示[CDH](https://cloud.tencent.com/document/product/416)付费,即只对[CDH](https://cloud.tencent.com/document/product/416)计费,不对[CDH](https://cloud.tencent.com/document/product/416)上的实例计费。 )
- // private-ip-address - String - 是否必填:否 - (过滤条件)按照实例主网卡的内网IP过滤。
- // public-ip-address - String - 是否必填:否 - (过滤条件)按照实例主网卡的公网IP过滤,包含实例创建时自动分配的IP和实例创建后手动绑定的弹性IP。
- // tag-key - String - 是否必填:否 - (过滤条件)按照标签键进行过滤。
- // tag-value - String - 是否必填:否 - (过滤条件)按照标签值进行过滤。
- // tag:tag-key - String - 是否必填:否 - (过滤条件)按照标签键值对进行过滤。 tag-key使用具体的标签键进行替换。使用请参考示例2。
- // 每次请求的`Filters`的上限为10,`Filter.Values`的上限为5。参数不支持同时指定`InstanceIds`和`Filters`。
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量,默认为0。关于`Offset`的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/15688)中的相关小节。
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量,默认为20,最大值为100。关于`Limit`的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/15688)中的相关小节。
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeInstancesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstancesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstancesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合条件的实例数量。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 实例详细信息列表。
- InstanceSet []*Instance `json:"InstanceSet,omitempty" name:"InstanceSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeInstancesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstancesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstancesStatusRequest struct {
- *tchttp.BaseRequest
-
- // 按照一个或者多个实例ID查询。实例ID形如:`ins-11112222`。此参数的具体格式可参考API[简介](https://cloud.tencent.com/document/api/213/15688)的`id.N`一节)。每次请求的实例的上限为100。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 偏移量,默认为0。关于`Offset`的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/15688)中的相关小节。
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量,默认为20,最大值为100。关于`Limit`的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/15688)中的相关小节。
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeInstancesStatusRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstancesStatusRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstancesStatusResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合条件的实例状态数量。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // [实例状态](https://cloud.tencent.com/document/api/213/15738) 列表。
- InstanceStatusSet []*InstanceStatus `json:"InstanceStatusSet,omitempty" name:"InstanceStatusSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeInstancesStatusResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstancesStatusResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInternetChargeTypeConfigsRequest struct {
- *tchttp.BaseRequest
-}
-
-func (r *DescribeInternetChargeTypeConfigsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInternetChargeTypeConfigsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInternetChargeTypeConfigsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 网络计费类型配置。
- InternetChargeTypeConfigSet []*InternetChargeTypeConfig `json:"InternetChargeTypeConfigSet,omitempty" name:"InternetChargeTypeConfigSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeInternetChargeTypeConfigsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInternetChargeTypeConfigsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeKeyPairsRequest struct {
- *tchttp.BaseRequest
-
- // 密钥对ID,密钥对ID形如:`skey-11112222`(此接口支持同时传入多个ID进行过滤。此参数的具体格式可参考 API [简介](https://cloud.tencent.com/document/api/213/15688)的 `id.N` 一节)。参数不支持同时指定 `KeyIds` 和 `Filters`。密钥对ID可以通过登录[控制台](https://console.cloud.tencent.com/cvm/index)查询。
- KeyIds []*string `json:"KeyIds,omitempty" name:"KeyIds" list`
-
- // 过滤条件。
- // project-id - Integer - 是否必填:否 -(过滤条件)按照项目ID过滤。可以通过[项目列表](https://console.cloud.tencent.com/project)查询项目ID,或者调用接口 [DescribeProject](https://cloud.tencent.com/document/api/378/4400),取返回信息中的projectId获取项目ID。
- // key-name - String - 是否必填:否 -(过滤条件)按照密钥对名称过滤。参数不支持同时指定 `KeyIds` 和 `Filters`。
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量,默认为0。关于 `Offset` 的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/15688)中的相关小节。返回数量,默认为20,最大值为100。关于 `Limit` 的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/15688)中的相关小节。
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量,默认为20,最大值为100。关于 `Limit` 的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/15688)中的相关小节。
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeKeyPairsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeKeyPairsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeKeyPairsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合条件的密钥对数量。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 密钥对详细信息列表。
- KeyPairSet []*KeyPair `json:"KeyPairSet,omitempty" name:"KeyPairSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeKeyPairsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeKeyPairsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeRegionsRequest struct {
- *tchttp.BaseRequest
-}
-
-func (r *DescribeRegionsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeRegionsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeRegionsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 地域数量
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 地域列表信息
- RegionSet []*RegionInfo `json:"RegionSet,omitempty" name:"RegionSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeRegionsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeRegionsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeZoneInstanceConfigInfosRequest struct {
- *tchttp.BaseRequest
-
- // 过滤条件。
- //
- // zone - String - 是否必填:否 -(过滤条件)按照可用区过滤。
- //
- // instance-family String - 是否必填:否 -(过滤条件)按照机型系列过滤。按照实例机型系列过滤。实例机型系列形如:S1、I1、M1等。
- //
- // instance-type - String - 是否必填:否 - (过滤条件)按照机型过滤。按照实例机型过滤。不同实例机型指定了不同的资源规格,具体取值可通过调用接口 DescribeInstanceTypeConfigs 来获得最新的规格表或参见实例类型描述。若不指定该参数,则默认机型为S1.SMALL1。
- //
- // instance-charge-type - String - 是否必填:否 -(过滤条件)按照实例计费模式过滤。 (PREPAID:表示预付费,即包年包月 | POSTPAID_BY_HOUR:表示后付费,即按量计费 | CDHPAID:表示CDH付费,即只对CDH计费,不对CDH上的实例计费。 )
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-}
-
-func (r *DescribeZoneInstanceConfigInfosRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeZoneInstanceConfigInfosRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeZoneInstanceConfigInfosResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 可用区机型配置列表。
- InstanceTypeQuotaSet []*InstanceTypeQuotaItem `json:"InstanceTypeQuotaSet,omitempty" name:"InstanceTypeQuotaSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeZoneInstanceConfigInfosResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeZoneInstanceConfigInfosResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeZonesRequest struct {
- *tchttp.BaseRequest
-}
-
-func (r *DescribeZonesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeZonesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeZonesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 可用区数量。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 可用区列表信息。
- ZoneSet []*ZoneInfo `json:"ZoneSet,omitempty" name:"ZoneSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeZonesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeZonesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DisassociateInstancesKeyPairsRequest struct {
- *tchttp.BaseRequest
-
- // 一个或多个待操作的实例ID,每次请求批量实例的上限为100。
可以通过以下方式获取可用的实例ID:
通过登录[控制台](https://console.cloud.tencent.com/cvm/index)查询实例ID。
通过调用接口 [DescribeInstances](https://cloud.tencent.com/document/api/213/15728) ,取返回信息中的 `InstanceId` 获取实例ID。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 密钥对ID列表,每次请求批量密钥对的上限为100。密钥对ID形如:`skey-11112222`。
可以通过以下方式获取可用的密钥ID:
通过登录[控制台](https://console.cloud.tencent.com/cvm/sshkey)查询密钥ID。
通过调用接口 [DescribeKeyPairs](https://cloud.tencent.com/document/api/213/15699) ,取返回信息中的 `KeyId` 获取密钥对ID。
- KeyIds []*string `json:"KeyIds,omitempty" name:"KeyIds" list`
-
- // 是否对运行中的实例选择强制关机。建议对运行中的实例先手动关机,然后再解绑密钥。取值范围:
TRUE:表示在正常关机失败后进行强制关机。
FALSE:表示在正常关机失败后不进行强制关机。
默认取值:FALSE。
- ForceStop *bool `json:"ForceStop,omitempty" name:"ForceStop"`
-}
-
-func (r *DisassociateInstancesKeyPairsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DisassociateInstancesKeyPairsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DisassociateInstancesKeyPairsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DisassociateInstancesKeyPairsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DisassociateInstancesKeyPairsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DisassociateSecurityGroupsRequest struct {
- *tchttp.BaseRequest
-
- // 要解绑的`安全组ID`,类似sg-efil73jd,只支持解绑单个安全组。
- SecurityGroupIds []*string `json:"SecurityGroupIds,omitempty" name:"SecurityGroupIds" list`
-
- // 被解绑的`实例ID`,类似ins-lesecurk,支持指定多个实例 。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-}
-
-func (r *DisassociateSecurityGroupsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DisassociateSecurityGroupsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DisassociateSecurityGroupsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DisassociateSecurityGroupsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DisassociateSecurityGroupsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DisasterRecoverGroup struct {
-
- // 分散置放群组id。
- DisasterRecoverGroupId *string `json:"DisasterRecoverGroupId,omitempty" name:"DisasterRecoverGroupId"`
-
- // 分散置放群组名称,长度1-60个字符。
- Name *string `json:"Name,omitempty" name:"Name"`
-
- // 分散置放群组类型,取值范围:
HOST:物理机
SW:交换机
RACK:机架
- Type *string `json:"Type,omitempty" name:"Type"`
-
- // 分散置放群组内最大容纳云主机数量。
- CvmQuotaTotal *int64 `json:"CvmQuotaTotal,omitempty" name:"CvmQuotaTotal"`
-
- // 分散置放群组内云主机当前数量。
- CurrentNum *int64 `json:"CurrentNum,omitempty" name:"CurrentNum"`
-
- // 分散置放群组内,云主机id列表。
- // 注意:此字段可能返回 null,表示取不到有效值。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 分散置放群组创建时间。
- // 注意:此字段可能返回 null,表示取不到有效值。
- CreateTime *string `json:"CreateTime,omitempty" name:"CreateTime"`
-}
-
-type EnhancedService struct {
-
- // 开启云安全服务。若不指定该参数,则默认开启云安全服务。
- SecurityService *RunSecurityServiceEnabled `json:"SecurityService,omitempty" name:"SecurityService"`
-
- // 开启云监控服务。若不指定该参数,则默认开启云监控服务。
- MonitorService *RunMonitorServiceEnabled `json:"MonitorService,omitempty" name:"MonitorService"`
-}
-
-type Externals struct {
-
- // 释放地址
- // 注意:此字段可能返回 null,表示取不到有效值。
- ReleaseAddress *bool `json:"ReleaseAddress,omitempty" name:"ReleaseAddress"`
-
- // 不支持的网络类型
- // 注意:此字段可能返回 null,表示取不到有效值。
- UnsupportNetworks []*string `json:"UnsupportNetworks,omitempty" name:"UnsupportNetworks" list`
-
- // HDD本地存储属性
- // 注意:此字段可能返回 null,表示取不到有效值。
- StorageBlockAttr *StorageBlock `json:"StorageBlockAttr,omitempty" name:"StorageBlockAttr"`
-}
-
-type Filter struct {
-
- // 需要过滤的字段。
- Name *string `json:"Name,omitempty" name:"Name"`
-
- // 字段的过滤值。
- Values []*string `json:"Values,omitempty" name:"Values" list`
-}
-
-type HostItem struct {
-
- // cdh实例所在的位置。通过该参数可以指定实例所属可用区,所属项目等属性。
- Placement *Placement `json:"Placement,omitempty" name:"Placement"`
-
- // cdh实例id
- HostId *string `json:"HostId,omitempty" name:"HostId"`
-
- // cdh实例类型
- HostType *string `json:"HostType,omitempty" name:"HostType"`
-
- // cdh实例名称
- HostName *string `json:"HostName,omitempty" name:"HostName"`
-
- // cdh实例付费模式
- HostChargeType *string `json:"HostChargeType,omitempty" name:"HostChargeType"`
-
- // cdh实例自动续费标记
- RenewFlag *string `json:"RenewFlag,omitempty" name:"RenewFlag"`
-
- // cdh实例创建时间
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-
- // cdh实例过期时间
- ExpiredTime *string `json:"ExpiredTime,omitempty" name:"ExpiredTime"`
-
- // cdh实例上已创建云子机的实例id列表
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // cdh实例状态
- HostState *string `json:"HostState,omitempty" name:"HostState"`
-
- // cdh实例ip
- HostIp *string `json:"HostIp,omitempty" name:"HostIp"`
-
- // cdh实例资源信息
- HostResource *HostResource `json:"HostResource,omitempty" name:"HostResource"`
-
- // 专用宿主机所属的围笼ID。该字段仅对金融专区围笼内的专用宿主机有效。
- // 注意:此字段可能返回 null,表示取不到有效值。
- CageId *string `json:"CageId,omitempty" name:"CageId"`
-}
-
-type HostResource struct {
-
- // cdh实例总cpu核数
- CpuTotal *uint64 `json:"CpuTotal,omitempty" name:"CpuTotal"`
-
- // cdh实例可用cpu核数
- CpuAvailable *uint64 `json:"CpuAvailable,omitempty" name:"CpuAvailable"`
-
- // cdh实例总内存大小(单位为:GiB)
- MemTotal *float64 `json:"MemTotal,omitempty" name:"MemTotal"`
-
- // cdh实例可用内存大小(单位为:GiB)
- MemAvailable *float64 `json:"MemAvailable,omitempty" name:"MemAvailable"`
-
- // cdh实例总磁盘大小(单位为:GiB)
- DiskTotal *uint64 `json:"DiskTotal,omitempty" name:"DiskTotal"`
-
- // cdh实例可用磁盘大小(单位为:GiB)
- DiskAvailable *uint64 `json:"DiskAvailable,omitempty" name:"DiskAvailable"`
-}
-
-type Image struct {
-
- // 镜像ID
- ImageId *string `json:"ImageId,omitempty" name:"ImageId"`
-
- // 镜像操作系统
- OsName *string `json:"OsName,omitempty" name:"OsName"`
-
- // 镜像类型
- ImageType *string `json:"ImageType,omitempty" name:"ImageType"`
-
- // 镜像创建时间
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-
- // 镜像名称
- ImageName *string `json:"ImageName,omitempty" name:"ImageName"`
-
- // 镜像描述
- ImageDescription *string `json:"ImageDescription,omitempty" name:"ImageDescription"`
-
- // 镜像大小
- ImageSize *int64 `json:"ImageSize,omitempty" name:"ImageSize"`
-
- // 镜像架构
- Architecture *string `json:"Architecture,omitempty" name:"Architecture"`
-
- // 镜像状态
- ImageState *string `json:"ImageState,omitempty" name:"ImageState"`
-
- // 镜像来源平台
- Platform *string `json:"Platform,omitempty" name:"Platform"`
-
- // 镜像创建者
- ImageCreator *string `json:"ImageCreator,omitempty" name:"ImageCreator"`
-
- // 镜像来源
- ImageSource *string `json:"ImageSource,omitempty" name:"ImageSource"`
-
- // 同步百分比
- // 注意:此字段可能返回 null,表示取不到有效值。
- SyncPercent *int64 `json:"SyncPercent,omitempty" name:"SyncPercent"`
-
- // 镜像是否支持cloud-init
- // 注意:此字段可能返回 null,表示取不到有效值。
- IsSupportCloudinit *bool `json:"IsSupportCloudinit,omitempty" name:"IsSupportCloudinit"`
-
- // 镜像关联的快照信息
- // 注意:此字段可能返回 null,表示取不到有效值。
- SnapshotSet []*Snapshot `json:"SnapshotSet,omitempty" name:"SnapshotSet" list`
-}
-
-type ImageOsList struct {
-
- // 支持的windows操作系统。
- // 注意:此字段可能返回 null,表示取不到有效值。
- Windows []*string `json:"Windows,omitempty" name:"Windows" list`
-
- // 支持的linux操作系统
- // 注意:此字段可能返回 null,表示取不到有效值。
- Linux []*string `json:"Linux,omitempty" name:"Linux" list`
-}
-
-type ImportImageRequest struct {
- *tchttp.BaseRequest
-
- // 导入镜像的操作系统架构,`x86_64` 或 `i386`
- Architecture *string `json:"Architecture,omitempty" name:"Architecture"`
-
- // 导入镜像的操作系统类型,通过`DescribeImportImageOs`获取
- OsType *string `json:"OsType,omitempty" name:"OsType"`
-
- // 导入镜像的操作系统版本,通过`DescribeImportImageOs`获取
- OsVersion *string `json:"OsVersion,omitempty" name:"OsVersion"`
-
- // 导入镜像存放的cos地址
- ImageUrl *string `json:"ImageUrl,omitempty" name:"ImageUrl"`
-
- // 镜像名称
- ImageName *string `json:"ImageName,omitempty" name:"ImageName"`
-
- // 镜像描述
- ImageDescription *string `json:"ImageDescription,omitempty" name:"ImageDescription"`
-
- // 只检查参数,不执行任务
- DryRun *bool `json:"DryRun,omitempty" name:"DryRun"`
-
- // 是否强制导入,参考[强制导入镜像](https://cloud.tencent.com/document/product/213/12849)
- Force *bool `json:"Force,omitempty" name:"Force"`
-}
-
-func (r *ImportImageRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ImportImageRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ImportImageResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ImportImageResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ImportImageResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ImportKeyPairRequest struct {
- *tchttp.BaseRequest
-
- // 密钥对名称,可由数字,字母和下划线组成,长度不超过25个字符。
- KeyName *string `json:"KeyName,omitempty" name:"KeyName"`
-
- // 密钥对创建后所属的[项目](/document/product/378/10863)ID。
可以通过以下方式获取项目ID:
通过[项目列表](https://console.cloud.tencent.com/project)查询项目ID。
通过调用接口 [DescribeProject](https://cloud.tencent.com/document/api/378/4400),取返回信息中的 `projectId ` 获取项目ID。
- //
- // 如果是默认项目,直接填0就可以。
- ProjectId *int64 `json:"ProjectId,omitempty" name:"ProjectId"`
-
- // 密钥对的公钥内容,`OpenSSH RSA` 格式。
- PublicKey *string `json:"PublicKey,omitempty" name:"PublicKey"`
-}
-
-func (r *ImportKeyPairRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ImportKeyPairRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ImportKeyPairResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 密钥对ID。
- KeyId *string `json:"KeyId,omitempty" name:"KeyId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ImportKeyPairResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ImportKeyPairResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InquiryPriceModifyInstancesChargeTypeRequest struct {
- *tchttp.BaseRequest
-
- // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。每次请求批量实例的上限为100。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 实例[计费类型](https://cloud.tencent.com/document/product/213/2180)。
PREPAID:预付费,即包年包月。
- InstanceChargeType *string `json:"InstanceChargeType,omitempty" name:"InstanceChargeType"`
-
- // 预付费模式,即包年包月相关参数设置。通过该参数可以指定包年包月实例的续费时长、是否设置自动续费等属性。
- InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid,omitempty" name:"InstanceChargePrepaid"`
-}
-
-func (r *InquiryPriceModifyInstancesChargeTypeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InquiryPriceModifyInstancesChargeTypeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InquiryPriceModifyInstancesChargeTypeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 该参数表示对应配置实例转换计费模式的价格。
- Price *Price `json:"Price,omitempty" name:"Price"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *InquiryPriceModifyInstancesChargeTypeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InquiryPriceModifyInstancesChargeTypeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InquiryPriceRenewInstancesRequest struct {
- *tchttp.BaseRequest
-
- // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。每次请求批量实例的上限为100。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 预付费模式,即包年包月相关参数设置。通过该参数可以指定包年包月实例的续费时长、是否设置自动续费等属性。
- InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid,omitempty" name:"InstanceChargePrepaid"`
-
- // 试运行。
- DryRun *bool `json:"DryRun,omitempty" name:"DryRun"`
-
- // 是否续费弹性数据盘。取值范围:
TRUE:表示续费包年包月实例同时续费其挂载的弹性数据盘
FALSE:表示续费包年包月实例同时不再续费其挂载的弹性数据盘
默认取值:TRUE。
- RenewPortableDataDisk *bool `json:"RenewPortableDataDisk,omitempty" name:"RenewPortableDataDisk"`
-}
-
-func (r *InquiryPriceRenewInstancesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InquiryPriceRenewInstancesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InquiryPriceRenewInstancesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 该参数表示对应配置实例的价格。
- Price *Price `json:"Price,omitempty" name:"Price"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *InquiryPriceRenewInstancesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InquiryPriceRenewInstancesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InquiryPriceResetInstanceRequest struct {
- *tchttp.BaseRequest
-
- // 实例ID。可通过 [DescribeInstances](https://cloud.tencent.com/document/api/213/15728) API返回值中的`InstanceId`获取。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 指定有效的[镜像](/document/product/213/4940)ID,格式形如`img-xxx`。镜像类型分为四种:
公共镜像自定义镜像共享镜像服务市场镜像
可通过以下方式获取可用的镜像ID:
`公共镜像`、`自定义镜像`、`共享镜像`的镜像ID可通过登录[控制台](https://console.cloud.tencent.com/cvm/image?rid=1&imageType=PUBLIC_IMAGE)查询;`服务镜像市场`的镜像ID可通过[云市场](https://market.cloud.tencent.com/list)查询。通过调用接口 [DescribeImages](https://cloud.tencent.com/document/api/213/15715) ,取返回信息中的`ImageId`字段。
- ImageId *string `json:"ImageId,omitempty" name:"ImageId"`
-
- // 实例系统盘配置信息。系统盘为云盘的实例可以通过该参数指定重装后的系统盘大小来实现对系统盘的扩容操作,若不指定则默认系统盘大小保持不变。系统盘大小只支持扩容不支持缩容;重装只支持修改系统盘的大小,不能修改系统盘的类型。
- SystemDisk *SystemDisk `json:"SystemDisk,omitempty" name:"SystemDisk"`
-
- // 实例登录设置。通过该参数可以设置实例的登录方式密码、密钥或保持镜像的原始登录设置。默认情况下会随机生成密码,并以站内信方式知会到用户。
- LoginSettings *LoginSettings `json:"LoginSettings,omitempty" name:"LoginSettings"`
-
- // 增强服务。通过该参数可以指定是否开启云安全、云监控等服务。若不指定该参数,则默认开启云监控、云安全服务。
- EnhancedService *EnhancedService `json:"EnhancedService,omitempty" name:"EnhancedService"`
-}
-
-func (r *InquiryPriceResetInstanceRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InquiryPriceResetInstanceRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InquiryPriceResetInstanceResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 该参数表示重装成对应配置实例的价格。
- Price *Price `json:"Price,omitempty" name:"Price"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *InquiryPriceResetInstanceResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InquiryPriceResetInstanceResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InquiryPriceResetInstancesInternetMaxBandwidthRequest struct {
- *tchttp.BaseRequest
-
- // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。每次请求批量实例的上限为100。当调整 `BANDWIDTH_PREPAID` 和 `BANDWIDTH_POSTPAID_BY_HOUR` 计费方式的带宽时,只支持一个实例。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 公网出带宽配置。不同机型带宽上限范围不一致,具体限制详见带宽限制对账表。暂时只支持`InternetMaxBandwidthOut`参数。
- InternetAccessible *InternetAccessible `json:"InternetAccessible,omitempty" name:"InternetAccessible"`
-
- // 带宽生效的起始时间。格式:`YYYY-MM-DD`,例如:`2016-10-30`。起始时间不能早于当前时间。如果起始时间是今天则新设置的带宽立即生效。该参数只对包年包月带宽有效,其他模式带宽不支持该参数,否则接口会以相应错误码返回。
- StartTime *string `json:"StartTime,omitempty" name:"StartTime"`
-
- // 带宽生效的终止时间。格式:`YYYY-MM-DD`,例如:`2016-10-30`。新设置的带宽的有效期包含终止时间此日期。终止时间不能晚于包年包月实例的到期时间。实例的到期时间可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`ExpiredTime`获取。该参数只对包年包月带宽有效,其他模式带宽不支持该参数,否则接口会以相应错误码返回。
- EndTime *string `json:"EndTime,omitempty" name:"EndTime"`
-}
-
-func (r *InquiryPriceResetInstancesInternetMaxBandwidthRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InquiryPriceResetInstancesInternetMaxBandwidthRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InquiryPriceResetInstancesInternetMaxBandwidthResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 该参数表示带宽调整为对应大小之后的价格。
- Price *Price `json:"Price,omitempty" name:"Price"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *InquiryPriceResetInstancesInternetMaxBandwidthResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InquiryPriceResetInstancesInternetMaxBandwidthResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InquiryPriceResetInstancesTypeRequest struct {
- *tchttp.BaseRequest
-
- // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。每次请求批量实例的上限为1。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 实例机型。不同实例机型指定了不同的资源规格,具体取值可参见附表实例资源规格对照表,也可以调用查询实例资源规格列表接口获得最新的规格表。
- InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"`
-}
-
-func (r *InquiryPriceResetInstancesTypeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InquiryPriceResetInstancesTypeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InquiryPriceResetInstancesTypeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 该参数表示调整成对应机型实例的价格。
- Price *Price `json:"Price,omitempty" name:"Price"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *InquiryPriceResetInstancesTypeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InquiryPriceResetInstancesTypeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InquiryPriceResizeInstanceDisksRequest struct {
- *tchttp.BaseRequest
-
- // 待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 待扩容的数据盘配置信息。只支持扩容非弹性数据盘([`DescribeDisks`](https://cloud.tencent.com/document/api/362/16315)接口返回值中的`Portable`为`false`表示非弹性),且[数据盘类型](/document/api/213/9452#block_device)为:`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`。数据盘容量单位:GB。最小扩容步长:10G。关于数据盘类型的选择请参考硬盘产品简介。可选数据盘类型受到实例类型`InstanceType`限制。另外允许扩容的最大容量也因数据盘类型的不同而有所差异。
- DataDisks []*DataDisk `json:"DataDisks,omitempty" name:"DataDisks" list`
-
- // 是否对运行中的实例选择强制关机。建议对运行中的实例先手动关机,然后再重置用户密码。取值范围:
TRUE:表示在正常关机失败后进行强制关机
FALSE:表示在正常关机失败后不进行强制关机
默认取值:FALSE。
强制关机的效果等同于关闭物理计算机的电源开关。强制关机可能会导致数据丢失或文件系统损坏,请仅在服务器不能正常关机时使用。
- ForceStop *bool `json:"ForceStop,omitempty" name:"ForceStop"`
-}
-
-func (r *InquiryPriceResizeInstanceDisksRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InquiryPriceResizeInstanceDisksRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InquiryPriceResizeInstanceDisksResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 该参数表示磁盘扩容成对应配置的价格。
- Price *Price `json:"Price,omitempty" name:"Price"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *InquiryPriceResizeInstanceDisksResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InquiryPriceResizeInstanceDisksResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InquiryPriceRunInstancesRequest struct {
- *tchttp.BaseRequest
-
- // 实例所在的位置。通过该参数可以指定实例所属可用区,所属项目等属性。
- Placement *Placement `json:"Placement,omitempty" name:"Placement"`
-
- // 指定有效的[镜像](https://cloud.tencent.com/document/product/213/4940)ID,格式形如`img-xxx`。镜像类型分为四种:
公共镜像自定义镜像共享镜像服务市场镜像
可通过以下方式获取可用的镜像ID:
`公共镜像`、`自定义镜像`、`共享镜像`的镜像ID可通过登录[控制台](https://console.cloud.tencent.com/cvm/image?rid=1&imageType=PUBLIC_IMAGE)查询;`服务镜像市场`的镜像ID可通过[云市场](https://market.cloud.tencent.com/list)查询。通过调用接口 [DescribeImages](https://cloud.tencent.com/document/api/213/15715) ,取返回信息中的`ImageId`字段。
- ImageId *string `json:"ImageId,omitempty" name:"ImageId"`
-
- // 实例[计费类型](https://cloud.tencent.com/document/product/213/2180)。
PREPAID:预付费,即包年包月
POSTPAID_BY_HOUR:按小时后付费
默认值:POSTPAID_BY_HOUR。
- InstanceChargeType *string `json:"InstanceChargeType,omitempty" name:"InstanceChargeType"`
-
- // 预付费模式,即包年包月相关参数设置。通过该参数可以指定包年包月实例的购买时长、是否设置自动续费等属性。若指定实例的付费模式为预付费则该参数必传。
- InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid,omitempty" name:"InstanceChargePrepaid"`
-
- // 实例机型。不同实例机型指定了不同的资源规格,具体取值可通过调用接口[DescribeInstanceTypeConfigs](https://cloud.tencent.com/document/api/213/15749)来获得最新的规格表或参见[CVM实例配置](https://cloud.tencent.com/document/product/213/2177)描述。若不指定该参数,则默认机型为S1.SMALL1。
- InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"`
-
- // 实例系统盘配置信息。若不指定该参数,则按照系统默认值进行分配。
- SystemDisk *SystemDisk `json:"SystemDisk,omitempty" name:"SystemDisk"`
-
- // 实例数据盘配置信息。若不指定该参数,则默认不购买数据盘。支持购买的时候指定11块数据盘,其中最多包含1块LOCAL_BASIC数据盘或者LOCAL_SSD数据盘,最多包含10块CLOUD_BASIC数据盘、CLOUD_PREMIUM数据盘或者CLOUD_SSD数据盘。
- DataDisks []*DataDisk `json:"DataDisks,omitempty" name:"DataDisks" list`
-
- // 私有网络相关信息配置。通过该参数可以指定私有网络的ID,子网ID等信息。若不指定该参数,则默认使用基础网络。若在此参数中指定了私有网络ip,那么InstanceCount参数只能为1。
- VirtualPrivateCloud *VirtualPrivateCloud `json:"VirtualPrivateCloud,omitempty" name:"VirtualPrivateCloud"`
-
- // 公网带宽相关信息设置。若不指定该参数,则默认公网带宽为0Mbps。
- InternetAccessible *InternetAccessible `json:"InternetAccessible,omitempty" name:"InternetAccessible"`
-
- // 购买实例数量。取值范围:[1,100]。默认取值:1。指定购买实例的数量不能超过用户所能购买的剩余配额数量,具体配额相关限制详见[CVM实例购买限制](https://cloud.tencent.com/document/product/213/2664)。
- InstanceCount *int64 `json:"InstanceCount,omitempty" name:"InstanceCount"`
-
- // 实例显示名称。
不指定实例显示名称则默认显示‘未命名’。购买多台实例,如果指定模式串`{R:x}`,表示生成数字`[x, x+n-1]`,其中`n`表示购买实例的数量,例如`server_{R:3}`,购买1台时,实例显示名称为`server_3`;购买2台时,实例显示名称分别为`server_3`,`server_4`。支持指定多个模式串`{R:x}`。购买多台实例,如果不指定模式串,则在实例显示名称添加后缀`1、2...n`,其中`n`表示购买实例的数量,例如`server_`,购买2台时,实例显示名称分别为`server_1`,`server_2`。
- InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"`
-
- // 实例登录设置。通过该参数可以设置实例的登录方式密码、密钥或保持镜像的原始登录设置。默认情况下会随机生成密码,并以站内信方式知会到用户。
- LoginSettings *LoginSettings `json:"LoginSettings,omitempty" name:"LoginSettings"`
-
- // 实例所属安全组。该参数可以通过调用 [DescribeSecurityGroups](https://cloud.tencent.com/document/api/215/15808) 的返回值中的sgId字段来获取。若不指定该参数,则默认不绑定安全组。
- SecurityGroupIds []*string `json:"SecurityGroupIds,omitempty" name:"SecurityGroupIds" list`
-
- // 增强服务。通过该参数可以指定是否开启云安全、云监控等服务。若不指定该参数,则默认开启云监控、云安全服务。
- EnhancedService *EnhancedService `json:"EnhancedService,omitempty" name:"EnhancedService"`
-
- // 用于保证请求幂等性的字符串。该字符串由客户生成,需保证不同请求之间唯一,最大值不超过64个ASCII字符。若不指定该参数,则无法保证请求的幂等性。
更多详细信息请参阅:如何保证幂等性。
- ClientToken *string `json:"ClientToken,omitempty" name:"ClientToken"`
-
- // 云服务器的主机名。
点号(.)和短横线(-)不能作为 HostName 的首尾字符,不能连续使用。
Windows 实例:名字符长度为[2, 15],允许字母(不限制大小写)、数字和短横线(-)组成,不支持点号(.),不能全是数字。
其他类型(Linux 等)实例:字符长度为[2, 30],允许支持多个点号,点之间为一段,每段允许字母(不限制大小写)、数字和短横线(-)组成。
- HostName *string `json:"HostName,omitempty" name:"HostName"`
-
- // 标签描述列表。通过指定该参数可以同时绑定标签到相应的资源实例,当前仅支持绑定标签到云主机实例。
- TagSpecification []*TagSpecification `json:"TagSpecification,omitempty" name:"TagSpecification" list`
-
- // 实例的市场相关选项,如竞价实例相关参数
- InstanceMarketOptions *InstanceMarketOptionsRequest `json:"InstanceMarketOptions,omitempty" name:"InstanceMarketOptions"`
-}
-
-func (r *InquiryPriceRunInstancesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InquiryPriceRunInstancesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InquiryPriceRunInstancesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 该参数表示对应配置实例的价格。
- Price *Price `json:"Price,omitempty" name:"Price"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *InquiryPriceRunInstancesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InquiryPriceRunInstancesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type Instance struct {
-
- // 实例所在的位置。
- Placement *Placement `json:"Placement,omitempty" name:"Placement"`
-
- // 实例`ID`。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 实例机型。
- InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"`
-
- // 实例的CPU核数,单位:核。
- CPU *int64 `json:"CPU,omitempty" name:"CPU"`
-
- // 实例内存容量,单位:`GB`。
- Memory *int64 `json:"Memory,omitempty" name:"Memory"`
-
- // 实例业务状态。取值范围:
NORMAL:表示正常状态的实例
EXPIRED:表示过期的实例
PROTECTIVELY_ISOLATED:表示被安全隔离的实例。
- RestrictState *string `json:"RestrictState,omitempty" name:"RestrictState"`
-
- // 实例名称。
- InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"`
-
- // 实例计费模式。取值范围:
`PREPAID`:表示预付费,即包年包月
`POSTPAID_BY_HOUR`:表示后付费,即按量计费
`CDHPAID`:`CDH`付费,即只对`CDH`计费,不对`CDH`上的实例计费。
- InstanceChargeType *string `json:"InstanceChargeType,omitempty" name:"InstanceChargeType"`
-
- // 实例系统盘信息。
- SystemDisk *SystemDisk `json:"SystemDisk,omitempty" name:"SystemDisk"`
-
- // 实例数据盘信息。只包含随实例购买的数据盘。
- DataDisks []*DataDisk `json:"DataDisks,omitempty" name:"DataDisks" list`
-
- // 实例主网卡的内网`IP`列表。
- PrivateIpAddresses []*string `json:"PrivateIpAddresses,omitempty" name:"PrivateIpAddresses" list`
-
- // 实例主网卡的公网`IP`列表。
- // 注意:此字段可能返回 null,表示取不到有效值。
- PublicIpAddresses []*string `json:"PublicIpAddresses,omitempty" name:"PublicIpAddresses" list`
-
- // 实例带宽信息。
- InternetAccessible *InternetAccessible `json:"InternetAccessible,omitempty" name:"InternetAccessible"`
-
- // 实例所属虚拟私有网络信息。
- VirtualPrivateCloud *VirtualPrivateCloud `json:"VirtualPrivateCloud,omitempty" name:"VirtualPrivateCloud"`
-
- // 生产实例所使用的镜像`ID`。
- ImageId *string `json:"ImageId,omitempty" name:"ImageId"`
-
- // 自动续费标识。取值范围:
`NOTIFY_AND_MANUAL_RENEW`:表示通知即将过期,但不自动续费
`NOTIFY_AND_AUTO_RENEW`:表示通知即将过期,而且自动续费
`DISABLE_NOTIFY_AND_MANUAL_RENEW`:表示不通知即将过期,也不自动续费。
- RenewFlag *string `json:"RenewFlag,omitempty" name:"RenewFlag"`
-
- // 创建时间。按照`ISO8601`标准表示,并且使用`UTC`时间。格式为:`YYYY-MM-DDThh:mm:ssZ`。
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-
- // 到期时间。按照`ISO8601`标准表示,并且使用`UTC`时间。格式为:`YYYY-MM-DDThh:mm:ssZ`。
- ExpiredTime *string `json:"ExpiredTime,omitempty" name:"ExpiredTime"`
-
- // 操作系统名称。
- OsName *string `json:"OsName,omitempty" name:"OsName"`
-
- // 实例所属安全组。该参数可以通过调用 [DescribeSecurityGroups](https://cloud.tencent.com/document/api/215/15808) 的返回值中的sgId字段来获取。
- SecurityGroupIds []*string `json:"SecurityGroupIds,omitempty" name:"SecurityGroupIds" list`
-
- // 实例登录设置。目前只返回实例所关联的密钥。
- LoginSettings *LoginSettings `json:"LoginSettings,omitempty" name:"LoginSettings"`
-
- // 实例状态。取值范围:
PENDING:表示创建中
LAUNCH_FAILED:表示创建失败
RUNNING:表示运行中
STOPPED:表示关机
STARTING:表示开机中
STOPPING:表示关机中
REBOOTING:表示重启中
SHUTDOWN:表示停止待销毁
TERMINATING:表示销毁中。
- InstanceState *string `json:"InstanceState,omitempty" name:"InstanceState"`
-
- // 实例关联的标签列表。
- Tags []*Tag `json:"Tags,omitempty" name:"Tags" list`
-
- // 实例的关机计费模式。
- // 取值范围:
KEEP_CHARGING:关机继续收费
STOP_CHARGING:关机停止收费NOT_APPLICABLE:实例处于非关机状态或者不适用关机停止计费的条件
- StopChargingMode *string `json:"StopChargingMode,omitempty" name:"StopChargingMode"`
-}
-
-type InstanceChargePrepaid struct {
-
- // 购买实例的时长,单位:月。取值范围:1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36。
- Period *int64 `json:"Period,omitempty" name:"Period"`
-
- // 自动续费标识。取值范围:
NOTIFY_AND_AUTO_RENEW:通知过期且自动续费
NOTIFY_AND_MANUAL_RENEW:通知过期不自动续费
DISABLE_NOTIFY_AND_MANUAL_RENEW:不通知过期不自动续费
默认取值:NOTIFY_AND_MANUAL_RENEW。若该参数指定为NOTIFY_AND_AUTO_RENEW,在账户余额充足的情况下,实例到期后将按月自动续费。
- RenewFlag *string `json:"RenewFlag,omitempty" name:"RenewFlag"`
-}
-
-type InstanceFamilyConfig struct {
-
- // 机型族名称的中文全称。
- InstanceFamilyName *string `json:"InstanceFamilyName,omitempty" name:"InstanceFamilyName"`
-
- // 机型族名称的英文简称。
- InstanceFamily *string `json:"InstanceFamily,omitempty" name:"InstanceFamily"`
-}
-
-type InstanceMarketOptionsRequest struct {
- *tchttp.BaseRequest
-
- // 竞价相关选项
- SpotOptions *SpotMarketOptions `json:"SpotOptions,omitempty" name:"SpotOptions"`
-
- // 市场选项类型,当前只支持取值:spot
- MarketType *string `json:"MarketType,omitempty" name:"MarketType"`
-}
-
-func (r *InstanceMarketOptionsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InstanceMarketOptionsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InstanceStatus struct {
-
- // 实例`ID`。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // [实例状态](/document/api/213/9452#INSTANCE_STATE)。
- InstanceState *string `json:"InstanceState,omitempty" name:"InstanceState"`
-}
-
-type InstanceTypeConfig struct {
-
- // 可用区。
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-
- // 实例机型。
- InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"`
-
- // 实例机型系列。
- InstanceFamily *string `json:"InstanceFamily,omitempty" name:"InstanceFamily"`
-
- // GPU核数,单位:核。
- GPU *int64 `json:"GPU,omitempty" name:"GPU"`
-
- // CPU核数,单位:核。
- CPU *int64 `json:"CPU,omitempty" name:"CPU"`
-
- // 内存容量,单位:`GB`。
- Memory *int64 `json:"Memory,omitempty" name:"Memory"`
-}
-
-type InstanceTypeQuotaItem struct {
-
- // 可用区。
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-
- // 实例机型。
- InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"`
-
- // 实例计费模式。取值范围:
PREPAID:表示预付费,即包年包月
POSTPAID_BY_HOUR:表示后付费,即按量计费
CDHPAID:表示[CDH](https://cloud.tencent.com/document/product/416)付费,即只对CDH计费,不对CDH上的实例计费。
- InstanceChargeType *string `json:"InstanceChargeType,omitempty" name:"InstanceChargeType"`
-
- // 网卡类型,例如:25代表25G网卡
- NetworkCard *int64 `json:"NetworkCard,omitempty" name:"NetworkCard"`
-
- // 扩展属性。
- // 注意:此字段可能返回 null,表示取不到有效值。
- Externals *Externals `json:"Externals,omitempty" name:"Externals"`
-
- // 实例的CPU核数,单位:核。
- Cpu *int64 `json:"Cpu,omitempty" name:"Cpu"`
-
- // 实例内存容量,单位:`GB`。
- Memory *int64 `json:"Memory,omitempty" name:"Memory"`
-
- // 实例机型系列。
- InstanceFamily *string `json:"InstanceFamily,omitempty" name:"InstanceFamily"`
-
- // 机型名称。
- TypeName *string `json:"TypeName,omitempty" name:"TypeName"`
-
- // 本地磁盘规格列表。当该参数返回为空值时,表示当前情况下无法创建本地盘。
- LocalDiskTypeList []*LocalDiskType `json:"LocalDiskTypeList,omitempty" name:"LocalDiskTypeList" list`
-
- // 实例是否售卖。取值范围:
SELL:表示实例可购买
SOLD_OUT:表示实例已售罄。
- Status *string `json:"Status,omitempty" name:"Status"`
-
- // 实例的售卖价格。
- Price *ItemPrice `json:"Price,omitempty" name:"Price"`
-}
-
-type InternetAccessible struct {
-
- // 网络计费类型。取值范围:
BANDWIDTH_PREPAID:预付费按带宽结算
TRAFFIC_POSTPAID_BY_HOUR:流量按小时后付费
BANDWIDTH_POSTPAID_BY_HOUR:带宽按小时后付费
BANDWIDTH_PACKAGE:带宽包用户
默认取值:非带宽包用户默认与子机付费类型保持一致。
- InternetChargeType *string `json:"InternetChargeType,omitempty" name:"InternetChargeType"`
-
- // 公网出带宽上限,单位:Mbps。默认值:0Mbps。不同机型带宽上限范围不一致,具体限制详见[购买网络带宽](/document/product/213/509)。
- InternetMaxBandwidthOut *int64 `json:"InternetMaxBandwidthOut,omitempty" name:"InternetMaxBandwidthOut"`
-
- // 是否分配公网IP。取值范围:
TRUE:表示分配公网IP
FALSE:表示不分配公网IP
当公网带宽大于0Mbps时,可自由选择开通与否,默认开通公网IP;当公网带宽为0,则不允许分配公网IP。
- PublicIpAssigned *bool `json:"PublicIpAssigned,omitempty" name:"PublicIpAssigned"`
-
- // 带宽包ID。可通过[`DescribeBandwidthPackages`](https://cloud.tencent.com/document/api/215/19209)接口返回值中的`BandwidthPackageId`获取。
- BandwidthPackageId *string `json:"BandwidthPackageId,omitempty" name:"BandwidthPackageId"`
-}
-
-type InternetBandwidthConfig struct {
-
- // 开始时间。按照`ISO8601`标准表示,并且使用`UTC`时间。格式为:`YYYY-MM-DDThh:mm:ssZ`。
- StartTime *string `json:"StartTime,omitempty" name:"StartTime"`
-
- // 结束时间。按照`ISO8601`标准表示,并且使用`UTC`时间。格式为:`YYYY-MM-DDThh:mm:ssZ`。
- EndTime *string `json:"EndTime,omitempty" name:"EndTime"`
-
- // 实例带宽信息。
- InternetAccessible *InternetAccessible `json:"InternetAccessible,omitempty" name:"InternetAccessible"`
-}
-
-type InternetChargeTypeConfig struct {
-
- // 网络计费模式。
- InternetChargeType *string `json:"InternetChargeType,omitempty" name:"InternetChargeType"`
-
- // 网络计费模式描述信息。
- Description *string `json:"Description,omitempty" name:"Description"`
-}
-
-type ItemPrice struct {
-
- // 后续单价,单位:元。
- // 注意:此字段可能返回 null,表示取不到有效值。
- UnitPrice *float64 `json:"UnitPrice,omitempty" name:"UnitPrice"`
-
- // 后续计价单元,可取值范围:
HOUR:表示计价单元是按每小时来计算。当前涉及该计价单元的场景有:实例按小时后付费(POSTPAID_BY_HOUR)、带宽按小时后付费(BANDWIDTH_POSTPAID_BY_HOUR):
GB:表示计价单元是按每GB来计算。当前涉及该计价单元的场景有:流量按小时后付费(TRAFFIC_POSTPAID_BY_HOUR)。
- // 注意:此字段可能返回 null,表示取不到有效值。
- ChargeUnit *string `json:"ChargeUnit,omitempty" name:"ChargeUnit"`
-
- // 预支费用的原价,单位:元。
- // 注意:此字段可能返回 null,表示取不到有效值。
- OriginalPrice *float64 `json:"OriginalPrice,omitempty" name:"OriginalPrice"`
-
- // 预支费用的折扣价,单位:元。
- // 注意:此字段可能返回 null,表示取不到有效值。
- DiscountPrice *float64 `json:"DiscountPrice,omitempty" name:"DiscountPrice"`
-}
-
-type KeyPair struct {
-
- // 密钥对的`ID`,是密钥对的唯一标识。
- KeyId *string `json:"KeyId,omitempty" name:"KeyId"`
-
- // 密钥对名称。
- KeyName *string `json:"KeyName,omitempty" name:"KeyName"`
-
- // 密钥对所属的项目`ID`。
- ProjectId *int64 `json:"ProjectId,omitempty" name:"ProjectId"`
-
- // 密钥对描述信息。
- Description *string `json:"Description,omitempty" name:"Description"`
-
- // 密钥对的纯文本公钥。
- PublicKey *string `json:"PublicKey,omitempty" name:"PublicKey"`
-
- // 密钥对的纯文本私钥。腾讯云不会保管私钥,请用户自行妥善保存。
- PrivateKey *string `json:"PrivateKey,omitempty" name:"PrivateKey"`
-
- // 密钥关联的实例`ID`列表。
- AssociatedInstanceIds []*string `json:"AssociatedInstanceIds,omitempty" name:"AssociatedInstanceIds" list`
-
- // 创建时间。按照`ISO8601`标准表示,并且使用`UTC`时间。格式为:`YYYY-MM-DDThh:mm:ssZ`。
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-}
-
-type LocalDiskType struct {
-
- // 本地磁盘类型。
- Type *string `json:"Type,omitempty" name:"Type"`
-
- // 本地磁盘属性。
- PartitionType *string `json:"PartitionType,omitempty" name:"PartitionType"`
-
- // 本地磁盘最小值。
- MinSize *int64 `json:"MinSize,omitempty" name:"MinSize"`
-
- // 本地磁盘最大值。
- MaxSize *int64 `json:"MaxSize,omitempty" name:"MaxSize"`
-}
-
-type LoginSettings struct {
-
- // 实例登录密码。不同操作系统类型密码复杂度限制不一样,具体如下:
Linux实例密码必须8到16位,至少包括两项[a-z,A-Z]、[0-9] 和 [( ) ` ~ ! @ # $ % ^ & * - + = | { } [ ] : ; ' , . ? / ]中的特殊符号。
Windows实例密码必须12到16位,至少包括三项[a-z],[A-Z],[0-9] 和 [( ) ` ~ ! @ # $ % ^ & * - + = { } [ ] : ; ' , . ? /]中的特殊符号。
若不指定该参数,则由系统随机生成密码,并通过站内信方式通知到用户。
- // 注意:此字段可能返回 null,表示取不到有效值。
- Password *string `json:"Password,omitempty" name:"Password"`
-
- // 密钥ID列表。关联密钥后,就可以通过对应的私钥来访问实例;KeyId可通过接口DescribeKeyPairs获取,密钥与密码不能同时指定,同时Windows操作系统不支持指定密钥。当前仅支持购买的时候指定一个密钥。
- // 注意:此字段可能返回 null,表示取不到有效值。
- KeyIds []*string `json:"KeyIds,omitempty" name:"KeyIds" list`
-
- // 保持镜像的原始设置。该参数与Password或KeyIds.N不能同时指定。只有使用自定义镜像、共享镜像或外部导入镜像创建实例时才能指定该参数为TRUE。取值范围:
TRUE:表示保持镜像的登录设置
FALSE:表示不保持镜像的登录设置
默认取值:FALSE。
- // 注意:此字段可能返回 null,表示取不到有效值。
- KeepImageLogin *string `json:"KeepImageLogin,omitempty" name:"KeepImageLogin"`
-}
-
-type ModifyDisasterRecoverGroupAttributeRequest struct {
- *tchttp.BaseRequest
-
- // 分散置放群组ID,可使用[DescribeDisasterRecoverGroups](https://cloud.tencent.com/document/api/213/17810)接口获取。
- DisasterRecoverGroupId *string `json:"DisasterRecoverGroupId,omitempty" name:"DisasterRecoverGroupId"`
-
- // 分散置放群组名称,长度1-60个字符,支持中、英文。
- Name *string `json:"Name,omitempty" name:"Name"`
-}
-
-func (r *ModifyDisasterRecoverGroupAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyDisasterRecoverGroupAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyDisasterRecoverGroupAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyDisasterRecoverGroupAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyDisasterRecoverGroupAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyHostsAttributeRequest struct {
- *tchttp.BaseRequest
-
- // 一个或多个待操作的CDH实例ID。
- HostIds []*string `json:"HostIds,omitempty" name:"HostIds" list`
-
- // CDH实例显示名称。可任意命名,但不得超过60个字符。
- HostName *string `json:"HostName,omitempty" name:"HostName"`
-
- // 自动续费标识。取值范围:
NOTIFY_AND_AUTO_RENEW:通知过期且自动续费
NOTIFY_AND_MANUAL_RENEW:通知过期不自动续费
DISABLE_NOTIFY_AND_MANUAL_RENEW:不通知过期不自动续费
若该参数指定为NOTIFY_AND_AUTO_RENEW,在账户余额充足的情况下,实例到期后将按月自动续费。
- RenewFlag *string `json:"RenewFlag,omitempty" name:"RenewFlag"`
-}
-
-func (r *ModifyHostsAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyHostsAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyHostsAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyHostsAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyHostsAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyImageAttributeRequest struct {
- *tchttp.BaseRequest
-
- // 镜像ID,形如`img-gvbnzy6f`。镜像ID可以通过如下方式获取:
通过[DescribeImages](https://cloud.tencent.com/document/api/213/15715)接口返回的`ImageId`获取。
通过[镜像控制台](https://console.cloud.tencent.com/cvm/image)获取。
- ImageId *string `json:"ImageId,omitempty" name:"ImageId"`
-
- // 设置新的镜像名称;必须满足下列限制:
不得超过20个字符。
镜像名称不能与已有镜像重复。
- ImageName *string `json:"ImageName,omitempty" name:"ImageName"`
-
- // 设置新的镜像描述;必须满足下列限制:
不得超过60个字符。
- ImageDescription *string `json:"ImageDescription,omitempty" name:"ImageDescription"`
-}
-
-func (r *ModifyImageAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyImageAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyImageAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyImageAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyImageAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyImageSharePermissionRequest struct {
- *tchttp.BaseRequest
-
- // 镜像ID,形如`img-gvbnzy6f`。镜像Id可以通过如下方式获取:
通过[DescribeImages](https://cloud.tencent.com/document/api/213/15715)接口返回的`ImageId`获取。
通过[镜像控制台](https://console.cloud.tencent.com/cvm/image)获取。
镜像ID必须指定为状态为`NORMAL`的镜像。镜像状态请参考[镜像数据表](/document/api/213/9452#image_state)。
- ImageId *string `json:"ImageId,omitempty" name:"ImageId"`
-
- // 接收分享镜像的账号Id列表,array型参数的格式可以参考[API简介](/document/api/213/568)。帐号ID不同于QQ号,查询用户帐号ID请查看[帐号信息](https://console.cloud.tencent.com/developer)中的帐号ID栏。
- AccountIds []*string `json:"AccountIds,omitempty" name:"AccountIds" list`
-
- // 操作,包括 `SHARE`,`CANCEL`。其中`SHARE`代表分享操作,`CANCEL`代表取消分享操作。
- Permission *string `json:"Permission,omitempty" name:"Permission"`
-}
-
-func (r *ModifyImageSharePermissionRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyImageSharePermissionRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyImageSharePermissionResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyImageSharePermissionResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyImageSharePermissionResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyInstancesAttributeRequest struct {
- *tchttp.BaseRequest
-
- // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/9388) API返回值中的`InstanceId`获取。每次请求允许操作的实例数量上限是100。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 实例名称。可任意命名,但不得超过60个字符。
- InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"`
-
- // 指定实例的安全组Id列表,子机将重新关联指定列表的安全组,原本关联的安全组会被解绑。
- SecurityGroups []*string `json:"SecurityGroups,omitempty" name:"SecurityGroups" list`
-}
-
-func (r *ModifyInstancesAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyInstancesAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyInstancesAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyInstancesAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyInstancesAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyInstancesChargeTypeRequest struct {
- *tchttp.BaseRequest
-
- // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/9388)接口返回值中的`InstanceId`获取。每次请求批量实例的上限为100。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 实例[计费类型](https://cloud.tencent.com/document/product/213/2180)。
PREPAID:预付费,即包年包月。
- InstanceChargeType *string `json:"InstanceChargeType,omitempty" name:"InstanceChargeType"`
-
- // 预付费模式,即包年包月相关参数设置。通过该参数可以指定包年包月实例的购买时长、是否设置自动续费等属性。若指定实例的付费模式为预付费则该参数必传。
- InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid,omitempty" name:"InstanceChargePrepaid"`
-}
-
-func (r *ModifyInstancesChargeTypeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyInstancesChargeTypeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyInstancesChargeTypeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyInstancesChargeTypeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyInstancesChargeTypeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyInstancesProjectRequest struct {
- *tchttp.BaseRequest
-
- // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/9388) API返回值中的`InstanceId`获取。每次请求允许操作的实例数量上限是100。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 项目ID。项目可以使用[AddProject](https://cloud.tencent.com/doc/api/403/4398)接口创建。后续使用[DescribeInstances](https://cloud.tencent.com/document/api/213/9388)接口查询实例时,项目ID可用于过滤结果。
- ProjectId *int64 `json:"ProjectId,omitempty" name:"ProjectId"`
-}
-
-func (r *ModifyInstancesProjectRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyInstancesProjectRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyInstancesProjectResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyInstancesProjectResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyInstancesProjectResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyInstancesRenewFlagRequest struct {
- *tchttp.BaseRequest
-
- // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/9388) API返回值中的`InstanceId`获取。每次请求允许操作的实例数量上限是100。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 自动续费标识。取值范围:
NOTIFY_AND_AUTO_RENEW:通知过期且自动续费
NOTIFY_AND_MANUAL_RENEW:通知过期不自动续费
DISABLE_NOTIFY_AND_MANUAL_RENEW:不通知过期不自动续费
若该参数指定为NOTIFY_AND_AUTO_RENEW,在账户余额充足的情况下,实例到期后将按月自动续费。
- RenewFlag *string `json:"RenewFlag,omitempty" name:"RenewFlag"`
-}
-
-func (r *ModifyInstancesRenewFlagRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyInstancesRenewFlagRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyInstancesRenewFlagResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyInstancesRenewFlagResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyInstancesRenewFlagResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyInstancesVpcAttributeRequest struct {
- *tchttp.BaseRequest
-
- // 待操作的实例ID数组。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 私有网络相关信息配置。通过该参数指定私有网络的ID,子网ID,私有网络ip等信息。当指定私有网络ID和子网ID(子网必须在实例所在的可用区)与指定实例所在私有网络不一致时,会将实例迁移至指定的私有网络的子网下。可通过`PrivateIpAddresses`指定私有网络子网IP,若需指定则所有已指定的实例均需要指定子网IP,此时`InstanceIds`与`PrivateIpAddresses`一一对应。不指定`PrivateIpAddresses`时随机分配私有网络子网IP。
- VirtualPrivateCloud *VirtualPrivateCloud `json:"VirtualPrivateCloud,omitempty" name:"VirtualPrivateCloud"`
-
- // 是否对运行中的实例选择强制关机。默认为TRUE。
- ForceStop *bool `json:"ForceStop,omitempty" name:"ForceStop"`
-
- // 是否保留主机名。默认为FALSE。
- ReserveHostName *bool `json:"ReserveHostName,omitempty" name:"ReserveHostName"`
-}
-
-func (r *ModifyInstancesVpcAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyInstancesVpcAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyInstancesVpcAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyInstancesVpcAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyInstancesVpcAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyKeyPairAttributeRequest struct {
- *tchttp.BaseRequest
-
- // 密钥对ID,密钥对ID形如:`skey-xxxxxxxx`。
可以通过以下方式获取可用的密钥 ID:
通过登录[控制台](https://console.cloud.tencent.com/cvm/sshkey)查询密钥 ID。
通过调用接口 [DescribeKeyPairs](https://cloud.tencent.com/document/api/213/9403) ,取返回信息中的 `KeyId` 获取密钥对 ID。
- KeyId *string `json:"KeyId,omitempty" name:"KeyId"`
-
- // 修改后的密钥对名称,可由数字,字母和下划线组成,长度不超过25个字符。
- KeyName *string `json:"KeyName,omitempty" name:"KeyName"`
-
- // 修改后的密钥对描述信息。可任意命名,但不得超过60个字符。
- Description *string `json:"Description,omitempty" name:"Description"`
-}
-
-func (r *ModifyKeyPairAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyKeyPairAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyKeyPairAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyKeyPairAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyKeyPairAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type OperationCountLimit struct {
-
- // 实例操作。
- Operation *string `json:"Operation,omitempty" name:"Operation"`
-
- // 实例ID。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 当前已使用次数,如果返回值为-1表示该操作无次数限制。
- CurrentCount *int64 `json:"CurrentCount,omitempty" name:"CurrentCount"`
-
- // 操作次数最高额度,如果返回值为-1表示该操作无次数限制,如果返回值为0表示不支持调整配置。
- LimitCount *int64 `json:"LimitCount,omitempty" name:"LimitCount"`
-}
-
-type OsVersion struct {
-
- // 操作系统类型
- OsName *string `json:"OsName,omitempty" name:"OsName"`
-
- // 支持的操作系统版本
- OsVersions []*string `json:"OsVersions,omitempty" name:"OsVersions" list`
-
- // 支持的操作系统架构
- Architecture []*string `json:"Architecture,omitempty" name:"Architecture" list`
-}
-
-type Placement struct {
-
- // 实例所属的[可用区](/document/product/213/9452#zone)ID。该参数也可以通过调用 [DescribeZones](/document/api/213/9455) 的返回值中的Zone字段来获取。
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-
- // 实例所属项目ID。该参数可以通过调用 [DescribeProject](/document/api/378/4400) 的返回值中的 projectId 字段来获取。不填为默认项目。
- ProjectId *int64 `json:"ProjectId,omitempty" name:"ProjectId"`
-
- // 实例所属的专用宿主机ID列表。如果您有购买专用宿主机并且指定了该参数,则您购买的实例就会随机的部署在这些专用宿主机上。
- HostIds []*string `json:"HostIds,omitempty" name:"HostIds" list`
-}
-
-type Price struct {
-
- // 描述了实例价格。
- InstancePrice *ItemPrice `json:"InstancePrice,omitempty" name:"InstancePrice"`
-
- // 描述了网络价格。
- BandwidthPrice *ItemPrice `json:"BandwidthPrice,omitempty" name:"BandwidthPrice"`
-}
-
-type RebootInstancesRequest struct {
- *tchttp.BaseRequest
-
- // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/9388)接口返回值中的`InstanceId`获取。每次请求批量实例的上限为100。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 是否在正常重启失败后选择强制重启实例。取值范围:
TRUE:表示在正常重启失败后进行强制重启
FALSE:表示在正常重启失败后不进行强制重启
默认取值:FALSE。
- ForceReboot *bool `json:"ForceReboot,omitempty" name:"ForceReboot"`
-}
-
-func (r *RebootInstancesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RebootInstancesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RebootInstancesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *RebootInstancesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RebootInstancesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RegionInfo struct {
-
- // 地域名称,例如,ap-guangzhou
- Region *string `json:"Region,omitempty" name:"Region"`
-
- // 地域描述,例如,华南地区(广州)
- RegionName *string `json:"RegionName,omitempty" name:"RegionName"`
-
- // 地域是否可用状态
- RegionState *string `json:"RegionState,omitempty" name:"RegionState"`
-}
-
-type RenewHostsRequest struct {
- *tchttp.BaseRequest
-
- // 一个或多个待操作的CDH实例ID。
- HostIds []*string `json:"HostIds,omitempty" name:"HostIds" list`
-
- // 预付费模式,即包年包月相关参数设置。通过该参数可以指定包年包月实例的购买时长、是否设置自动续费等属性。若指定实例的付费模式为预付费则该参数必传。
- HostChargePrepaid *ChargePrepaid `json:"HostChargePrepaid,omitempty" name:"HostChargePrepaid"`
-}
-
-func (r *RenewHostsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RenewHostsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RenewHostsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *RenewHostsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RenewHostsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RenewInstancesRequest struct {
- *tchttp.BaseRequest
-
- // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/9388)接口返回值中的`InstanceId`获取。每次请求批量实例的上限为100。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 预付费模式,即包年包月相关参数设置。通过该参数可以指定包年包月实例的续费时长、是否设置自动续费等属性。包年包月实例该参数为必传参数。
- InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid,omitempty" name:"InstanceChargePrepaid"`
-
- // 是否续费弹性数据盘。取值范围:
TRUE:表示续费包年包月实例同时续费其挂载的弹性数据盘
FALSE:表示续费包年包月实例同时不再续费其挂载的弹性数据盘
默认取值:TRUE。
- RenewPortableDataDisk *bool `json:"RenewPortableDataDisk,omitempty" name:"RenewPortableDataDisk"`
-}
-
-func (r *RenewInstancesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RenewInstancesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RenewInstancesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *RenewInstancesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RenewInstancesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ResetInstanceRequest struct {
- *tchttp.BaseRequest
-
- // 实例ID。可通过 [DescribeInstances](https://cloud.tencent.com/document/api/213/9388) API返回值中的`InstanceId`获取。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 指定有效的[镜像](https://cloud.tencent.com/document/product/213/4940)ID,格式形如`img-xxx`。镜像类型分为四种:
公共镜像自定义镜像共享镜像服务市场镜像
可通过以下方式获取可用的镜像ID:
`公共镜像`、`自定义镜像`、`共享镜像`的镜像ID可通过登录[控制台](https://console.cloud.tencent.com/cvm/image?rid=1&imageType=PUBLIC_IMAGE)查询;`服务镜像市场`的镜像ID可通过[云市场](https://market.cloud.tencent.com/list)查询。通过调用接口 [DescribeImages](https://cloud.tencent.com/document/api/213/9418) ,取返回信息中的`ImageId`字段。
- //
默认取值:默认使用当前镜像。
- ImageId *string `json:"ImageId,omitempty" name:"ImageId"`
-
- // 实例系统盘配置信息。系统盘为云盘的实例可以通过该参数指定重装后的系统盘大小来实现对系统盘的扩容操作,若不指定则默认系统盘大小保持不变。系统盘大小只支持扩容不支持缩容;重装只支持修改系统盘的大小,不能修改系统盘的类型。
- SystemDisk *SystemDisk `json:"SystemDisk,omitempty" name:"SystemDisk"`
-
- // 实例登录设置。通过该参数可以设置实例的登录方式密码、密钥或保持镜像的原始登录设置。默认情况下会随机生成密码,并以站内信方式知会到用户。
- LoginSettings *LoginSettings `json:"LoginSettings,omitempty" name:"LoginSettings"`
-
- // 增强服务。通过该参数可以指定是否开启云安全、云监控等服务。若不指定该参数,则默认开启云监控、云安全服务。
- EnhancedService *EnhancedService `json:"EnhancedService,omitempty" name:"EnhancedService"`
-
- // 重装系统时,可以指定修改实例的HostName。
- HostName *string `json:"HostName,omitempty" name:"HostName"`
-}
-
-func (r *ResetInstanceRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ResetInstanceRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ResetInstanceResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ResetInstanceResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ResetInstanceResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ResetInstancesInternetMaxBandwidthRequest struct {
- *tchttp.BaseRequest
-
- // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/9388)接口返回值中的 `InstanceId` 获取。 每次请求批量实例的上限为100。当调整 `BANDWIDTH_PREPAID` 和 `BANDWIDTH_POSTPAID_BY_HOUR` 计费方式的带宽时,只支持一个实例。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 公网出带宽配置。不同机型带宽上限范围不一致,具体限制详见带宽限制对账表。暂时只支持 `InternetMaxBandwidthOut` 参数。
- InternetAccessible *InternetAccessible `json:"InternetAccessible,omitempty" name:"InternetAccessible"`
-
- // 带宽生效的起始时间。格式:`YYYY-MM-DD`,例如:`2016-10-30`。起始时间不能早于当前时间。如果起始时间是今天则新设置的带宽立即生效。该参数只对包年包月带宽有效,其他模式带宽不支持该参数,否则接口会以相应错误码返回。
- StartTime *string `json:"StartTime,omitempty" name:"StartTime"`
-
- // 带宽生效的终止时间。格式: `YYYY-MM-DD` ,例如:`2016-10-30` 。新设置的带宽的有效期包含终止时间此日期。终止时间不能晚于包年包月实例的到期时间。实例的到期时间可通过 [`DescribeInstances`](https://cloud.tencent.com/document/api/213/9388)接口返回值中的`ExpiredTime`获取。该参数只对包年包月带宽有效,其他模式带宽不支持该参数,否则接口会以相应错误码返回。
- EndTime *string `json:"EndTime,omitempty" name:"EndTime"`
-}
-
-func (r *ResetInstancesInternetMaxBandwidthRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ResetInstancesInternetMaxBandwidthRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ResetInstancesInternetMaxBandwidthResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ResetInstancesInternetMaxBandwidthResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ResetInstancesInternetMaxBandwidthResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ResetInstancesPasswordRequest struct {
- *tchttp.BaseRequest
-
- // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728) API返回值中的`InstanceId`获取。每次请求允许操作的实例数量上限是100。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 实例登录密码。不同操作系统类型密码复杂度限制不一样,具体如下:
`Linux`实例密码必须8到16位,至少包括两项`[a-z,A-Z]、[0-9]`和`[( ) ~ ~ ! @ # $ % ^ & * - + = _ | { } [ ] : ; ' < > , . ? /]`中的符号。密码不允许以`/`符号开头。
`Windows`实例密码必须12到16位,至少包括三项`[a-z],[A-Z],[0-9]`和`[( ) ~ ~ ! @ # $ % ^ & * - + = _ | { } [ ] : ; ' < > , . ? /]`中的符号。密码不允许以`/`符号开头。
如果实例即包含`Linux`实例又包含`Windows`实例,则密码复杂度限制按照`Windows`实例的限制。
- Password *string `json:"Password,omitempty" name:"Password"`
-
- // 待重置密码的实例操作系统用户名。不得超过64个字符。
- UserName *string `json:"UserName,omitempty" name:"UserName"`
-
- // 是否对运行中的实例选择强制关机。建议对运行中的实例先手动关机,然后再重置用户密码。取值范围:
TRUE:表示在正常关机失败后进行强制关机
FALSE:表示在正常关机失败后不进行强制关机
默认取值:FALSE。
强制关机的效果等同于关闭物理计算机的电源开关。强制关机可能会导致数据丢失或文件系统损坏,请仅在服务器不能正常关机时使用。
- ForceStop *bool `json:"ForceStop,omitempty" name:"ForceStop"`
-}
-
-func (r *ResetInstancesPasswordRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ResetInstancesPasswordRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ResetInstancesPasswordResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ResetInstancesPasswordResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ResetInstancesPasswordResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ResetInstancesTypeRequest struct {
- *tchttp.BaseRequest
-
- // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。每次请求批量实例的上限为1。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 实例机型。不同实例机型指定了不同的资源规格,具体取值可通过调用接口[`DescribeInstanceTypeConfigs`](https://cloud.tencent.com/document/api/213/15749)来获得最新的规格表或参见[实例类型](https://cloud.tencent.com/document/product/213/11518)描述。
- InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"`
-
- // 是否对运行中的实例选择强制关机。建议对运行中的实例先手动关机,然后再重置用户密码。取值范围:
TRUE:表示在正常关机失败后进行强制关机
FALSE:表示在正常关机失败后不进行强制关机
默认取值:FALSE。
强制关机的效果等同于关闭物理计算机的电源开关。强制关机可能会导致数据丢失或文件系统损坏,请仅在服务器不能正常关机时使用。
- ForceStop *bool `json:"ForceStop,omitempty" name:"ForceStop"`
-}
-
-func (r *ResetInstancesTypeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ResetInstancesTypeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ResetInstancesTypeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ResetInstancesTypeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ResetInstancesTypeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ResizeInstanceDisksRequest struct {
- *tchttp.BaseRequest
-
- // 待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 待扩容的数据盘配置信息。只支持扩容非弹性数据盘([`DescribeDisks`](https://cloud.tencent.com/document/api/362/16315)接口返回值中的`Portable`为`false`表示非弹性),且[数据盘类型](/document/api/213/9452#block_device)为:`CLOUD_BASIC`、`CLOUD_PREMIUM`、`CLOUD_SSD`。数据盘容量单位:GB。最小扩容步长:10G。关于数据盘类型的选择请参考硬盘产品简介。可选数据盘类型受到实例类型`InstanceType`限制。另外允许扩容的最大容量也因数据盘类型的不同而有所差异。
- DataDisks []*DataDisk `json:"DataDisks,omitempty" name:"DataDisks" list`
-
- // 是否对运行中的实例选择强制关机。建议对运行中的实例先手动关机,然后再重置用户密码。取值范围:
TRUE:表示在正常关机失败后进行强制关机
FALSE:表示在正常关机失败后不进行强制关机
默认取值:FALSE。
强制关机的效果等同于关闭物理计算机的电源开关。强制关机可能会导致数据丢失或文件系统损坏,请仅在服务器不能正常关机时使用。
- ForceStop *bool `json:"ForceStop,omitempty" name:"ForceStop"`
-}
-
-func (r *ResizeInstanceDisksRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ResizeInstanceDisksRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ResizeInstanceDisksResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ResizeInstanceDisksResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ResizeInstanceDisksResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RunInstancesRequest struct {
- *tchttp.BaseRequest
-
- // 实例所在的位置。通过该参数可以指定实例所属可用区,所属项目,所属宿主机(在专用宿主机上创建子机时指定)等属性。
- Placement *Placement `json:"Placement,omitempty" name:"Placement"`
-
- // 指定有效的[镜像](https://cloud.tencent.com/document/product/213/4940)ID,格式形如`img-xxx`。镜像类型分为四种:
公共镜像自定义镜像共享镜像服务市场镜像
可通过以下方式获取可用的镜像ID:
`公共镜像`、`自定义镜像`、`共享镜像`的镜像ID可通过登录[控制台](https://console.cloud.tencent.com/cvm/image?rid=1&imageType=PUBLIC_IMAGE)查询;`服务镜像市场`的镜像ID可通过[云市场](https://market.cloud.tencent.com/list)查询。通过调用接口 [DescribeImages](https://cloud.tencent.com/document/api/213/15715) ,取返回信息中的`ImageId`字段。
- ImageId *string `json:"ImageId,omitempty" name:"ImageId"`
-
- // 实例[计费类型](https://cloud.tencent.com/document/product/213/2180)。
PREPAID:预付费,即包年包月
POSTPAID_BY_HOUR:按小时后付费
CDHPAID:独享子机(基于专用宿主机创建,宿主机部分的资源不收费)
SPOTPAID:竞价付费
默认值:POSTPAID_BY_HOUR。
- InstanceChargeType *string `json:"InstanceChargeType,omitempty" name:"InstanceChargeType"`
-
- // 预付费模式,即包年包月相关参数设置。通过该参数可以指定包年包月实例的购买时长、是否设置自动续费等属性。若指定实例的付费模式为预付费则该参数必传。
- InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid,omitempty" name:"InstanceChargePrepaid"`
-
- // 实例机型。不同实例机型指定了不同的资源规格。
- //
对于付费模式为PREPAID或POSTPAID\_BY\_HOUR的实例创建,具体取值可通过调用接口[DescribeInstanceTypeConfigs](https://cloud.tencent.com/document/api/213/15749)来获得最新的规格表或参见[实例类型](https://cloud.tencent.com/document/product/213/11518)描述。若不指定该参数,则默认机型为S1.SMALL1。
对于付费模式为CDHPAID的实例创建,该参数以"CDH_"为前缀,根据cpu和内存配置生成,具体形式为:CDH_XCXG,例如对于创建cpu为1核,内存为1G大小的专用宿主机的实例,该参数应该为CDH_1C1G。
- InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"`
-
- // 实例系统盘配置信息。若不指定该参数,则按照系统默认值进行分配。
- SystemDisk *SystemDisk `json:"SystemDisk,omitempty" name:"SystemDisk"`
-
- // 实例数据盘配置信息。若不指定该参数,则默认不购买数据盘。支持购买的时候指定11块数据盘,其中最多包含1块LOCAL_BASIC数据盘或者LOCAL_SSD数据盘,最多包含10块CLOUD_BASIC数据盘、CLOUD_PREMIUM数据盘或者CLOUD_SSD数据盘。
- DataDisks []*DataDisk `json:"DataDisks,omitempty" name:"DataDisks" list`
-
- // 私有网络相关信息配置。通过该参数可以指定私有网络的ID,子网ID等信息。若不指定该参数,则默认使用基础网络。若在此参数中指定了私有网络ip,表示每个实例的主网卡ip,而且InstanceCount参数必须与私有网络ip的个数一致。
- VirtualPrivateCloud *VirtualPrivateCloud `json:"VirtualPrivateCloud,omitempty" name:"VirtualPrivateCloud"`
-
- // 公网带宽相关信息设置。若不指定该参数,则默认公网带宽为0Mbps。
- InternetAccessible *InternetAccessible `json:"InternetAccessible,omitempty" name:"InternetAccessible"`
-
- // 购买实例数量。包年包月实例取值范围:[1,300],按量计费实例取值范围:[1,100]。默认取值:1。指定购买实例的数量不能超过用户所能购买的剩余配额数量,具体配额相关限制详见[CVM实例购买限制](https://cloud.tencent.com/document/product/213/2664)。
- InstanceCount *int64 `json:"InstanceCount,omitempty" name:"InstanceCount"`
-
- // 实例显示名称。
不指定实例显示名称则默认显示‘未命名’。购买多台实例,如果指定模式串`{R:x}`,表示生成数字`[x, x+n-1]`,其中`n`表示购买实例的数量,例如`server_{R:3}`,购买1台时,实例显示名称为`server_3`;购买2台时,实例显示名称分别为`server_3`,`server_4`。支持指定多个模式串`{R:x}`。购买多台实例,如果不指定模式串,则在实例显示名称添加后缀`1、2...n`,其中`n`表示购买实例的数量,例如`server_`,购买2台时,实例显示名称分别为`server_1`,`server_2`。
- InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"`
-
- // 实例登录设置。通过该参数可以设置实例的登录方式密码、密钥或保持镜像的原始登录设置。默认情况下会随机生成密码,并以站内信方式知会到用户。
- LoginSettings *LoginSettings `json:"LoginSettings,omitempty" name:"LoginSettings"`
-
- // 实例所属安全组。该参数可以通过调用 [DescribeSecurityGroups](https://cloud.tencent.com/document/api/215/15808) 的返回值中的sgId字段来获取。若不指定该参数,则绑定默认安全组。
- SecurityGroupIds []*string `json:"SecurityGroupIds,omitempty" name:"SecurityGroupIds" list`
-
- // 增强服务。通过该参数可以指定是否开启云安全、云监控等服务。若不指定该参数,则默认开启云监控、云安全服务。
- EnhancedService *EnhancedService `json:"EnhancedService,omitempty" name:"EnhancedService"`
-
- // 用于保证请求幂等性的字符串。该字符串由客户生成,需保证不同请求之间唯一,最大值不超过64个ASCII字符。若不指定该参数,则无法保证请求的幂等性。
更多详细信息请参阅:如何保证幂等性。
- ClientToken *string `json:"ClientToken,omitempty" name:"ClientToken"`
-
- // 云服务器的主机名。
点号(.)和短横线(-)不能作为 HostName 的首尾字符,不能连续使用。
Windows 实例:名字符长度为[2, 15],允许字母(不限制大小写)、数字和短横线(-)组成,不支持点号(.),不能全是数字。
其他类型(Linux 等)实例:字符长度为[2, 60],允许支持多个点号,点之间为一段,每段允许字母(不限制大小写)、数字和短横线(-)组成。
- HostName *string `json:"HostName,omitempty" name:"HostName"`
-
- // 定时任务。通过该参数可以为实例指定定时任务,目前仅支持定时销毁。
- ActionTimer *ActionTimer `json:"ActionTimer,omitempty" name:"ActionTimer"`
-
- // 置放群组id,仅支持指定一个。
- DisasterRecoverGroupIds []*string `json:"DisasterRecoverGroupIds,omitempty" name:"DisasterRecoverGroupIds" list`
-
- // 标签描述列表。通过指定该参数可以同时绑定标签到相应的资源实例,当前仅支持绑定标签到云主机实例。
- TagSpecification []*TagSpecification `json:"TagSpecification,omitempty" name:"TagSpecification" list`
-
- // 实例的市场相关选项,如竞价实例相关参数,若指定实例的付费模式为竞价付费则该参数必传。
- InstanceMarketOptions *InstanceMarketOptionsRequest `json:"InstanceMarketOptions,omitempty" name:"InstanceMarketOptions"`
-
- // 提供给实例使用的用户数据,需要以 base64 方式编码,支持的最大数据大小为 16KB。关于获取此参数的详细介绍,请参阅[Windows](https://cloud.tencent.com/document/product/213/17526)和[Linux](https://cloud.tencent.com/document/product/213/17525)启动时运行命令。
- UserData *string `json:"UserData,omitempty" name:"UserData"`
-}
-
-func (r *RunInstancesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RunInstancesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RunInstancesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 当通过本接口来创建实例时会返回该参数,表示一个或多个实例`ID`。返回实例`ID`列表并不代表实例创建成功,可根据 [DescribeInstances](https://cloud.tencent.com/document/api/213/15728) 接口查询返回的InstancesSet中对应实例的`ID`的状态来判断创建是否完成;如果实例状态由“准备中”变为“正在运行”,则为创建成功。
- InstanceIdSet []*string `json:"InstanceIdSet,omitempty" name:"InstanceIdSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *RunInstancesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RunInstancesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RunMonitorServiceEnabled struct {
-
- // 是否开启[云监控](/document/product/248)服务。取值范围:
TRUE:表示开启云监控服务
FALSE:表示不开启云监控服务
默认取值:TRUE。
- Enabled *bool `json:"Enabled,omitempty" name:"Enabled"`
-}
-
-type RunSecurityServiceEnabled struct {
-
- // 是否开启[云安全](/document/product/296)服务。取值范围:
TRUE:表示开启云安全服务
FALSE:表示不开启云安全服务
默认取值:TRUE。
- Enabled *bool `json:"Enabled,omitempty" name:"Enabled"`
-}
-
-type SharePermission struct {
-
- // 镜像分享时间
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-
- // 镜像分享的账户ID
- AccountId *string `json:"AccountId,omitempty" name:"AccountId"`
-}
-
-type Snapshot struct {
-
- // 快照Id。
- SnapshotId *string `json:"SnapshotId,omitempty" name:"SnapshotId"`
-
- // 创建此快照的云硬盘类型。取值范围:
- // SYSTEM_DISK:系统盘
- // DATA_DISK:数据盘。
- DiskUsage *string `json:"DiskUsage,omitempty" name:"DiskUsage"`
-
- // 创建此快照的云硬盘大小,单位GB。
- DiskSize *int64 `json:"DiskSize,omitempty" name:"DiskSize"`
-}
-
-type SpotMarketOptions struct {
-
- // 竞价出价
- MaxPrice *string `json:"MaxPrice,omitempty" name:"MaxPrice"`
-
- // 竞价请求类型,当前仅支持类型:one-time
- SpotInstanceType *string `json:"SpotInstanceType,omitempty" name:"SpotInstanceType"`
-}
-
-type StartInstancesRequest struct {
- *tchttp.BaseRequest
-
- // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。每次请求批量实例的上限为100。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-}
-
-func (r *StartInstancesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *StartInstancesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type StartInstancesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *StartInstancesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *StartInstancesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type StopInstancesRequest struct {
- *tchttp.BaseRequest
-
- // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。每次请求批量实例的上限为100。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-
- // 是否在正常关闭失败后选择强制关闭实例。取值范围:
TRUE:表示在正常关闭失败后进行强制关闭
FALSE:表示在正常关闭失败后不进行强制关闭
默认取值:FALSE。
- ForceStop *bool `json:"ForceStop,omitempty" name:"ForceStop"`
-
- // 实例的关闭模式。取值范围:
SOFT_FIRST:表示在正常关闭失败后进行强制关闭
HARD:直接强制关闭
SOFT:仅软关机
默认取值:SOFT。
- StopType *string `json:"StopType,omitempty" name:"StopType"`
-
- // 按量计费实例关机收费模式。
- // 取值范围:
KEEP_CHARGING:关机继续收费
STOP_CHARGING:关机停止收费
默认取值:KEEP_CHARGING。
- // 该参数只针对部分按量计费云硬盘实例生效,详情参考[按量计费实例关机不收费说明](https://cloud.tencent.com/document/product/213/19918)
- StoppedMode *string `json:"StoppedMode,omitempty" name:"StoppedMode"`
-}
-
-func (r *StopInstancesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *StopInstancesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type StopInstancesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *StopInstancesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *StopInstancesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type StorageBlock struct {
-
- // HDD本地存储类型,值为:LOCAL_PRO.
- // 注意:此字段可能返回 null,表示取不到有效值。
- Type *string `json:"Type,omitempty" name:"Type"`
-
- // HDD本地存储的最小容量
- // 注意:此字段可能返回 null,表示取不到有效值。
- MinSize *int64 `json:"MinSize,omitempty" name:"MinSize"`
-
- // HDD本地存储的最大容量
- // 注意:此字段可能返回 null,表示取不到有效值。
- MaxSize *int64 `json:"MaxSize,omitempty" name:"MaxSize"`
-}
-
-type SyncImagesRequest struct {
- *tchttp.BaseRequest
-
- // 镜像ID列表 ,镜像ID可以通过如下方式获取:
通过[DescribeImages](https://cloud.tencent.com/document/api/213/15715)接口返回的`ImageId`获取。
通过[镜像控制台](https://console.cloud.tencent.com/cvm/image)获取。
镜像ID必须满足限制:
镜像ID对应的镜像状态必须为`NORMAL`。
镜像大小小于50GB。
镜像状态请参考[镜像数据表](/document/api/213/9452#image_state)。
- ImageIds []*string `json:"ImageIds,omitempty" name:"ImageIds" list`
-
- // 目的同步地域列表;必须满足限制:
不能为源地域,
必须是一个合法的Region。
暂不支持部分地域同步。
具体地域参数请参考[Region](https://cloud.tencent.com/document/product/213/6091)。
- DestinationRegions []*string `json:"DestinationRegions,omitempty" name:"DestinationRegions" list`
-}
-
-func (r *SyncImagesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *SyncImagesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type SyncImagesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *SyncImagesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *SyncImagesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type SystemDisk struct {
-
- // 系统盘类型。系统盘类型限制详见[CVM实例配置](/document/product/213/2177)。取值范围:
LOCAL_BASIC:本地硬盘
LOCAL_SSD:本地SSD硬盘
CLOUD_BASIC:普通云硬盘
CLOUD_SSD:SSD云硬盘
CLOUD_PREMIUM:高性能云硬盘
默认取值:CLOUD_BASIC。
- DiskType *string `json:"DiskType,omitempty" name:"DiskType"`
-
- // 系统盘ID。LOCAL_BASIC 和 LOCAL_SSD 类型没有ID。暂时不支持该参数。
- DiskId *string `json:"DiskId,omitempty" name:"DiskId"`
-
- // 系统盘大小,单位:GB。默认值为 50
- DiskSize *int64 `json:"DiskSize,omitempty" name:"DiskSize"`
-}
-
-type Tag struct {
-
- // 标签键
- Key *string `json:"Key,omitempty" name:"Key"`
-
- // 标签值
- Value *string `json:"Value,omitempty" name:"Value"`
-}
-
-type TagSpecification struct {
-
- // 标签绑定的资源类型,当前支持类型:"instance"和"host"
- ResourceType *string `json:"ResourceType,omitempty" name:"ResourceType"`
-
- // 标签对列表
- Tags []*Tag `json:"Tags,omitempty" name:"Tags" list`
-}
-
-type TerminateInstancesRequest struct {
- *tchttp.BaseRequest
-
- // 一个或多个待操作的实例ID。可通过[`DescribeInstances`](https://cloud.tencent.com/document/api/213/15728)接口返回值中的`InstanceId`获取。每次请求批量实例的上限为100。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-}
-
-func (r *TerminateInstancesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *TerminateInstancesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type TerminateInstancesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *TerminateInstancesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *TerminateInstancesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type VirtualPrivateCloud struct {
-
- // 私有网络ID,形如`vpc-xxx`。有效的VpcId可通过登录[控制台](https://console.cloud.tencent.com/vpc/vpc?rid=1)查询;也可以调用接口 [DescribeVpcEx](/document/api/215/1372) ,从接口返回中的`unVpcId`字段获取。若在创建子机时VpcId与SubnetId同时传入`DEFAULT`,则强制使用默认vpc网络。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 私有网络子网ID,形如`subnet-xxx`。有效的私有网络子网ID可通过登录[控制台](https://console.cloud.tencent.com/vpc/subnet?rid=1)查询;也可以调用接口 [DescribeSubnets](/document/api/215/15784) ,从接口返回中的`unSubnetId`字段获取。若在创建子机时SubnetId与VpcId同时传入`DEFAULT`,则强制使用默认vpc网络。
- SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"`
-
- // 是否用作公网网关。公网网关只有在实例拥有公网IP以及处于私有网络下时才能正常使用。取值范围:
TRUE:表示用作公网网关
FALSE:表示不用作公网网关
默认取值:FALSE。
- AsVpcGateway *bool `json:"AsVpcGateway,omitempty" name:"AsVpcGateway"`
-
- // 私有网络子网 IP 数组,在创建实例、修改实例vpc属性操作中可使用此参数。当前仅批量创建多台实例时支持传入相同子网的多个 IP。
- PrivateIpAddresses []*string `json:"PrivateIpAddresses,omitempty" name:"PrivateIpAddresses" list`
-}
-
-type ZoneInfo struct {
-
- // 可用区名称,例如,ap-guangzhou-3
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-
- // 可用区描述,例如,广州三区
- ZoneName *string `json:"ZoneName,omitempty" name:"ZoneName"`
-
- // 可用区ID
- ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"`
-
- // 可用区状态,包含AVAILABLE和UNAVAILABLE。AVAILABLE代表可用,UNAVAILABLE代表不可用。
- ZoneState *string `json:"ZoneState,omitempty" name:"ZoneState"`
-}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dc/v20180410/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dc/v20180410/client.go
deleted file mode 100644
index 678c1ea..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dc/v20180410/client.go
+++ /dev/null
@@ -1,323 +0,0 @@
-// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package v20180410
-
-import (
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
- tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
-)
-
-const APIVersion = "2018-04-10"
-
-type Client struct {
- common.Client
-}
-
-// Deprecated
-func NewClientWithSecretId(secretId, secretKey, region string) (client *Client, err error) {
- cpf := profile.NewClientProfile()
- client = &Client{}
- client.Init(region).WithSecretId(secretId, secretKey).WithProfile(cpf)
- return
-}
-
-func NewClient(credential *common.Credential, region string, clientProfile *profile.ClientProfile) (client *Client, err error) {
- client = &Client{}
- client.Init(region).
- WithCredential(credential).
- WithProfile(clientProfile)
- return
-}
-
-
-func NewAcceptDirectConnectTunnelRequest() (request *AcceptDirectConnectTunnelRequest) {
- request = &AcceptDirectConnectTunnelRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("dc", APIVersion, "AcceptDirectConnectTunnel")
- return
-}
-
-func NewAcceptDirectConnectTunnelResponse() (response *AcceptDirectConnectTunnelResponse) {
- response = &AcceptDirectConnectTunnelResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 接受专用通道申请
-func (c *Client) AcceptDirectConnectTunnel(request *AcceptDirectConnectTunnelRequest) (response *AcceptDirectConnectTunnelResponse, err error) {
- if request == nil {
- request = NewAcceptDirectConnectTunnelRequest()
- }
- response = NewAcceptDirectConnectTunnelResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateDirectConnectRequest() (request *CreateDirectConnectRequest) {
- request = &CreateDirectConnectRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("dc", APIVersion, "CreateDirectConnect")
- return
-}
-
-func NewCreateDirectConnectResponse() (response *CreateDirectConnectResponse) {
- response = &CreateDirectConnectResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 申请物理专线接入。
-// 调用该接口时,请注意:
-// 账号要进行实名认证,否则不允许申请物理专线;
-// 若账户下存在欠费状态的物理专线,则不能申请更多的物理专线。
-func (c *Client) CreateDirectConnect(request *CreateDirectConnectRequest) (response *CreateDirectConnectResponse, err error) {
- if request == nil {
- request = NewCreateDirectConnectRequest()
- }
- response = NewCreateDirectConnectResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateDirectConnectTunnelRequest() (request *CreateDirectConnectTunnelRequest) {
- request = &CreateDirectConnectTunnelRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("dc", APIVersion, "CreateDirectConnectTunnel")
- return
-}
-
-func NewCreateDirectConnectTunnelResponse() (response *CreateDirectConnectTunnelResponse) {
- response = &CreateDirectConnectTunnelResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 用于创建专用通道的接口
-func (c *Client) CreateDirectConnectTunnel(request *CreateDirectConnectTunnelRequest) (response *CreateDirectConnectTunnelResponse, err error) {
- if request == nil {
- request = NewCreateDirectConnectTunnelRequest()
- }
- response = NewCreateDirectConnectTunnelResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteDirectConnectRequest() (request *DeleteDirectConnectRequest) {
- request = &DeleteDirectConnectRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("dc", APIVersion, "DeleteDirectConnect")
- return
-}
-
-func NewDeleteDirectConnectResponse() (response *DeleteDirectConnectResponse) {
- response = &DeleteDirectConnectResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 删除物理专线。
-// 只能删除处于状态的物理专线。
-func (c *Client) DeleteDirectConnect(request *DeleteDirectConnectRequest) (response *DeleteDirectConnectResponse, err error) {
- if request == nil {
- request = NewDeleteDirectConnectRequest()
- }
- response = NewDeleteDirectConnectResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteDirectConnectTunnelRequest() (request *DeleteDirectConnectTunnelRequest) {
- request = &DeleteDirectConnectTunnelRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("dc", APIVersion, "DeleteDirectConnectTunnel")
- return
-}
-
-func NewDeleteDirectConnectTunnelResponse() (response *DeleteDirectConnectTunnelResponse) {
- response = &DeleteDirectConnectTunnelResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 删除专用通道
-func (c *Client) DeleteDirectConnectTunnel(request *DeleteDirectConnectTunnelRequest) (response *DeleteDirectConnectTunnelResponse, err error) {
- if request == nil {
- request = NewDeleteDirectConnectTunnelRequest()
- }
- response = NewDeleteDirectConnectTunnelResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeAccessPointsRequest() (request *DescribeAccessPointsRequest) {
- request = &DescribeAccessPointsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("dc", APIVersion, "DescribeAccessPoints")
- return
-}
-
-func NewDescribeAccessPointsResponse() (response *DescribeAccessPointsResponse) {
- response = &DescribeAccessPointsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 查询物理专线接入点
-func (c *Client) DescribeAccessPoints(request *DescribeAccessPointsRequest) (response *DescribeAccessPointsResponse, err error) {
- if request == nil {
- request = NewDescribeAccessPointsRequest()
- }
- response = NewDescribeAccessPointsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeDirectConnectTunnelsRequest() (request *DescribeDirectConnectTunnelsRequest) {
- request = &DescribeDirectConnectTunnelsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("dc", APIVersion, "DescribeDirectConnectTunnels")
- return
-}
-
-func NewDescribeDirectConnectTunnelsResponse() (response *DescribeDirectConnectTunnelsResponse) {
- response = &DescribeDirectConnectTunnelsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 用于查询专用通道列表。
-func (c *Client) DescribeDirectConnectTunnels(request *DescribeDirectConnectTunnelsRequest) (response *DescribeDirectConnectTunnelsResponse, err error) {
- if request == nil {
- request = NewDescribeDirectConnectTunnelsRequest()
- }
- response = NewDescribeDirectConnectTunnelsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeDirectConnectsRequest() (request *DescribeDirectConnectsRequest) {
- request = &DescribeDirectConnectsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("dc", APIVersion, "DescribeDirectConnects")
- return
-}
-
-func NewDescribeDirectConnectsResponse() (response *DescribeDirectConnectsResponse) {
- response = &DescribeDirectConnectsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 查询物理专线列表。
-func (c *Client) DescribeDirectConnects(request *DescribeDirectConnectsRequest) (response *DescribeDirectConnectsResponse, err error) {
- if request == nil {
- request = NewDescribeDirectConnectsRequest()
- }
- response = NewDescribeDirectConnectsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyDirectConnectAttributeRequest() (request *ModifyDirectConnectAttributeRequest) {
- request = &ModifyDirectConnectAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("dc", APIVersion, "ModifyDirectConnectAttribute")
- return
-}
-
-func NewModifyDirectConnectAttributeResponse() (response *ModifyDirectConnectAttributeResponse) {
- response = &ModifyDirectConnectAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 修改物理专线的属性。
-func (c *Client) ModifyDirectConnectAttribute(request *ModifyDirectConnectAttributeRequest) (response *ModifyDirectConnectAttributeResponse, err error) {
- if request == nil {
- request = NewModifyDirectConnectAttributeRequest()
- }
- response = NewModifyDirectConnectAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyDirectConnectTunnelAttributeRequest() (request *ModifyDirectConnectTunnelAttributeRequest) {
- request = &ModifyDirectConnectTunnelAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("dc", APIVersion, "ModifyDirectConnectTunnelAttribute")
- return
-}
-
-func NewModifyDirectConnectTunnelAttributeResponse() (response *ModifyDirectConnectTunnelAttributeResponse) {
- response = &ModifyDirectConnectTunnelAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 修改专用通道属性
-func (c *Client) ModifyDirectConnectTunnelAttribute(request *ModifyDirectConnectTunnelAttributeRequest) (response *ModifyDirectConnectTunnelAttributeResponse, err error) {
- if request == nil {
- request = NewModifyDirectConnectTunnelAttributeRequest()
- }
- response = NewModifyDirectConnectTunnelAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewRejectDirectConnectTunnelRequest() (request *RejectDirectConnectTunnelRequest) {
- request = &RejectDirectConnectTunnelRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("dc", APIVersion, "RejectDirectConnectTunnel")
- return
-}
-
-func NewRejectDirectConnectTunnelResponse() (response *RejectDirectConnectTunnelResponse) {
- response = &RejectDirectConnectTunnelResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 拒绝专用通道申请
-func (c *Client) RejectDirectConnectTunnel(request *RejectDirectConnectTunnelRequest) (response *RejectDirectConnectTunnelResponse, err error) {
- if request == nil {
- request = NewRejectDirectConnectTunnelRequest()
- }
- response = NewRejectDirectConnectTunnelResponse()
- err = c.Send(request, response)
- return
-}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dc/v20180410/models.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dc/v20180410/models.go
deleted file mode 100644
index 1d5701c..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dc/v20180410/models.go
+++ /dev/null
@@ -1,791 +0,0 @@
-// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package v20180410
-
-import (
- "encoding/json"
-
- tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http"
-)
-
-type AcceptDirectConnectTunnelRequest struct {
- *tchttp.BaseRequest
-
- // 物理专线拥有者接受共享专用通道申请
- DirectConnectTunnelId *string `json:"DirectConnectTunnelId,omitempty" name:"DirectConnectTunnelId"`
-}
-
-func (r *AcceptDirectConnectTunnelRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AcceptDirectConnectTunnelRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AcceptDirectConnectTunnelResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *AcceptDirectConnectTunnelResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AcceptDirectConnectTunnelResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AccessPoint struct {
-
- // 接入点的名称。
- AccessPointName *string `json:"AccessPointName,omitempty" name:"AccessPointName"`
-
- // 接入点唯一ID。
- AccessPointId *string `json:"AccessPointId,omitempty" name:"AccessPointId"`
-
- // 接入点的状态。可用,不可用。
- State *string `json:"State,omitempty" name:"State"`
-
- // 接入点的位置。
- Location *string `json:"Location,omitempty" name:"Location"`
-
- // 接入点支持的运营商列表。
- LineOperator []*string `json:"LineOperator,omitempty" name:"LineOperator" list`
-
- // 接入点管理的大区ID。
- RegionId *string `json:"RegionId,omitempty" name:"RegionId"`
-}
-
-type BgpPeer struct {
-
- // 用户侧,BGP Asn
- Asn *int64 `json:"Asn,omitempty" name:"Asn"`
-
- // 用户侧BGP密钥
- AuthKey *string `json:"AuthKey,omitempty" name:"AuthKey"`
-}
-
-type CreateDirectConnectRequest struct {
- *tchttp.BaseRequest
-
- // 物理专线的名称。
- DirectConnectName *string `json:"DirectConnectName,omitempty" name:"DirectConnectName"`
-
- // 物理专线所在的接入点。
- // 您可以通过调用 DescribeAccessPoints接口获取地域ID。所选择的接入点必须存在且处于可接入的状态。
- AccessPointId *string `json:"AccessPointId,omitempty" name:"AccessPointId"`
-
- // 提供接入物理专线的运营商。ChinaTelecom:中国电信, ChinaMobile:中国移动,ChinaUnicom:中国联通, In-houseWiring:楼内线,ChinaOther:中国其他, InternationalOperator:境外其他。
- LineOperator *string `json:"LineOperator,omitempty" name:"LineOperator"`
-
- // 本地数据中心的地理位置。
- Location *string `json:"Location,omitempty" name:"Location"`
-
- // 物理专线接入端口类型,取值:100Base-T:百兆电口,1000Base-T(默认值):千兆电口,1000Base-LX:千兆单模光口(10千米),10GBase-T:万兆电口10GBase-LR:万兆单模光口(10千米),默认值,千兆单模光口(10千米)。
- PortType *string `json:"PortType,omitempty" name:"PortType"`
-
- // 运营商或者服务商为物理专线提供的电路编码。
- CircuitCode *string `json:"CircuitCode,omitempty" name:"CircuitCode"`
-
- // 物理专线接入接口带宽,单位为Mbps,默认值为1000,取值范围为 [2, 10240]。
- Bandwidth *int64 `json:"Bandwidth,omitempty" name:"Bandwidth"`
-
- // 冗余物理专线的ID。
- RedundantDirectConnectId *string `json:"RedundantDirectConnectId,omitempty" name:"RedundantDirectConnectId"`
-
- // 物理专线调试VLAN。默认开启VLAN,自动分配VLAN。
- Vlan *int64 `json:"Vlan,omitempty" name:"Vlan"`
-
- // 物理专线调试腾讯侧互联 IP。默认自动分配。
- TencentAddress *string `json:"TencentAddress,omitempty" name:"TencentAddress"`
-
- // 物理专线调试用户侧互联 IP。默认自动分配。
- CustomerAddress *string `json:"CustomerAddress,omitempty" name:"CustomerAddress"`
-
- // 物理专线申请者姓名。默认从账户体系获取。
- CustomerName *string `json:"CustomerName,omitempty" name:"CustomerName"`
-
- // 物理专线申请者联系邮箱。默认从账户体系获取。
- CustomerContactMail *string `json:"CustomerContactMail,omitempty" name:"CustomerContactMail"`
-
- // 物理专线申请者联系号码。默认从账户体系获取。
- CustomerContactNumber *string `json:"CustomerContactNumber,omitempty" name:"CustomerContactNumber"`
-
- // 报障联系人。
- FaultReportContactPerson *string `json:"FaultReportContactPerson,omitempty" name:"FaultReportContactPerson"`
-
- // 报障联系电话。
- FaultReportContactNumber *string `json:"FaultReportContactNumber,omitempty" name:"FaultReportContactNumber"`
-}
-
-func (r *CreateDirectConnectRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateDirectConnectRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateDirectConnectResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 物理专线的ID。
- DirectConnectIdSet []*string `json:"DirectConnectIdSet,omitempty" name:"DirectConnectIdSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateDirectConnectResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateDirectConnectResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateDirectConnectTunnelRequest struct {
- *tchttp.BaseRequest
-
- // 专线 ID,例如:dc-kd7d06of
- DirectConnectId *string `json:"DirectConnectId,omitempty" name:"DirectConnectId"`
-
- // 专用通道名称
- DirectConnectTunnelName *string `json:"DirectConnectTunnelName,omitempty" name:"DirectConnectTunnelName"`
-
- // 物理专线 owner,缺省为当前客户(物理专线 owner)
- // 共享专线时这里需要填写共享专线的开发商账号 ID
- DirectConnectOwnerAccount *string `json:"DirectConnectOwnerAccount,omitempty" name:"DirectConnectOwnerAccount"`
-
- // 网络类型,分别为VPC、BMVPC,CCN,默认是VPC
- // VPC:私有网络
- // BMVPC:黑石网络
- // CCN:云联网
- NetworkType *string `json:"NetworkType,omitempty" name:"NetworkType"`
-
- // 网络地域
- NetworkRegion *string `json:"NetworkRegion,omitempty" name:"NetworkRegion"`
-
- // 私有网络统一 ID 或者黑石网络统一 ID
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 专线网关 ID,例如 dcg-d545ddf
- DirectConnectGatewayId *string `json:"DirectConnectGatewayId,omitempty" name:"DirectConnectGatewayId"`
-
- // 专线带宽,单位:Mbps
- // 默认是物理专线带宽值
- Bandwidth *int64 `json:"Bandwidth,omitempty" name:"Bandwidth"`
-
- // BGP :BGP路由
- // STATIC:静态
- // 默认为 BGP 路由
- RouteType *string `json:"RouteType,omitempty" name:"RouteType"`
-
- // BgpPeer,用户侧bgp信息,包括Asn和AuthKey
- BgpPeer *BgpPeer `json:"BgpPeer,omitempty" name:"BgpPeer"`
-
- // 静态路由,用户IDC的网段地址
- RouteFilterPrefixes []*RouteFilterPrefix `json:"RouteFilterPrefixes,omitempty" name:"RouteFilterPrefixes" list`
-
- // vlan,范围:0 ~ 3000
- // 0:不开启子接口
- // 默认值是非0
- Vlan *int64 `json:"Vlan,omitempty" name:"Vlan"`
-
- // TencentAddress,腾讯侧互联 IP
- TencentAddress *string `json:"TencentAddress,omitempty" name:"TencentAddress"`
-
- // CustomerAddress,用户侧互联 IP
- CustomerAddress *string `json:"CustomerAddress,omitempty" name:"CustomerAddress"`
-}
-
-func (r *CreateDirectConnectTunnelRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateDirectConnectTunnelRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateDirectConnectTunnelResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 专用通道ID
- DirectConnectTunnelIdSet []*string `json:"DirectConnectTunnelIdSet,omitempty" name:"DirectConnectTunnelIdSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateDirectConnectTunnelResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateDirectConnectTunnelResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteDirectConnectRequest struct {
- *tchttp.BaseRequest
-
- // 物理专线的ID。
- DirectConnectId *string `json:"DirectConnectId,omitempty" name:"DirectConnectId"`
-}
-
-func (r *DeleteDirectConnectRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteDirectConnectRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteDirectConnectResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteDirectConnectResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteDirectConnectResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteDirectConnectTunnelRequest struct {
- *tchttp.BaseRequest
-
- // 专用通道ID
- DirectConnectTunnelId *string `json:"DirectConnectTunnelId,omitempty" name:"DirectConnectTunnelId"`
-}
-
-func (r *DeleteDirectConnectTunnelRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteDirectConnectTunnelRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteDirectConnectTunnelResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteDirectConnectTunnelResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteDirectConnectTunnelResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeAccessPointsRequest struct {
- *tchttp.BaseRequest
-
- // 接入点所在的地域。使用DescribeRegions查询
- //
- // 您可以通过调用 DescribeRegions接口获取地域ID。
- RegionId *string `json:"RegionId,omitempty" name:"RegionId"`
-
- // 偏移量,默认为0。
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量,默认为20,最大值为100。
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeAccessPointsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeAccessPointsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeAccessPointsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 接入点信息。
- AccessPointSet []*AccessPoint `json:"AccessPointSet,omitempty" name:"AccessPointSet" list`
-
- // 符合接入点数量。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeAccessPointsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeAccessPointsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDirectConnectTunnelsRequest struct {
- *tchttp.BaseRequest
-
- // 过滤条件:
- // 参数不支持同时指定DirectConnectTunnelIds和Filters。
- // direct-connect-tunnel-name, 专用通道名称。
- // direct-connect-tunnel-id, 专用通道实例ID,如dcx-abcdefgh。
- // direct-connect-id, 物理专线实例ID,如,dc-abcdefgh。
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 专用通道 ID数组
- DirectConnectTunnelIds []*string `json:"DirectConnectTunnelIds,omitempty" name:"DirectConnectTunnelIds" list`
-
- // 偏移量,默认为0
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量,默认为20,最大值为100
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeDirectConnectTunnelsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDirectConnectTunnelsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDirectConnectTunnelsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 专用通道列表
- DirectConnectTunnelSet []*DirectConnectTunnel `json:"DirectConnectTunnelSet,omitempty" name:"DirectConnectTunnelSet" list`
-
- // 符合专用通道数量。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeDirectConnectTunnelsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDirectConnectTunnelsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDirectConnectsRequest struct {
- *tchttp.BaseRequest
-
- // 过滤条件:
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 物理专线 ID数组
- DirectConnectIds []*string `json:"DirectConnectIds,omitempty" name:"DirectConnectIds" list`
-
- // 偏移量,默认为0
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量,默认为20,最大值为100
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeDirectConnectsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDirectConnectsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDirectConnectsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 物理专线列表。
- DirectConnectSet []*DirectConnect `json:"DirectConnectSet,omitempty" name:"DirectConnectSet" list`
-
- // 符合物理专线列表数量。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeDirectConnectsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDirectConnectsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DirectConnect struct {
-
- // 物理专线ID。
- DirectConnectId *string `json:"DirectConnectId,omitempty" name:"DirectConnectId"`
-
- // 物理专线的名称。
- DirectConnectName *string `json:"DirectConnectName,omitempty" name:"DirectConnectName"`
-
- // 物理专线的接入点ID。
- AccessPointId *string `json:"AccessPointId,omitempty" name:"AccessPointId"`
-
- // 物理专线的状态。
- // 申请中:PENDING
- // 申请驳回:REJECTED
- // 待付款:TOPAY
- // 已付款:PAID
- // 建设中:ALLOCATED
- // 已开通:AVAILABLE
- // 删除中 :DELETING
- // 已删除:DELETED 。
- State *string `json:"State,omitempty" name:"State"`
-
- // 物理专线创建时间。
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-
- // 物理专线的开通时间。
- EnabledTime *string `json:"EnabledTime,omitempty" name:"EnabledTime"`
-
- // 提供接入物理专线的运营商。ChinaTelecom:中国电信, ChinaMobile:中国移动,ChinaUnicom:中国联通, In-houseWiring:楼内线,ChinaOther:中国其他, InternationalOperator:境外其他。
- LineOperator *string `json:"LineOperator,omitempty" name:"LineOperator"`
-
- // 本地数据中心的地理位置。
- Location *string `json:"Location,omitempty" name:"Location"`
-
- // 物理专线接入接口带宽,单位为Mbps。
- Bandwidth *int64 `json:"Bandwidth,omitempty" name:"Bandwidth"`
-
- // 用户侧物理专线接入端口类型,取值:100Base-T:百兆电口,1000Base-T(默认值):千兆电口,1000Base-LX:千兆单模光口(10千米),10GBase-T:万兆电口10GBase-LR:万兆单模光口(10千米),默认值,千兆单模光口(10千米)
- PortType *string `json:"PortType,omitempty" name:"PortType"`
-
- // 运营商或者服务商为物理专线提供的电路编码。
- // 注意:此字段可能返回 null,表示取不到有效值。
- CircuitCode *string `json:"CircuitCode,omitempty" name:"CircuitCode"`
-
- // 冗余物理专线的ID。
- RedundantDirectConnectId *string `json:"RedundantDirectConnectId,omitempty" name:"RedundantDirectConnectId"`
-
- // 物理专线调试VLAN。默认开启VLAN,自动分配VLAN。
- // 注意:此字段可能返回 null,表示取不到有效值。
- Vlan *int64 `json:"Vlan,omitempty" name:"Vlan"`
-
- // 物理专线调试腾讯侧互联IP。
- // 注意:此字段可能返回 null,表示取不到有效值。
- TencentAddress *string `json:"TencentAddress,omitempty" name:"TencentAddress"`
-
- // 物理专线调试用户侧互联IP。
- // 注意:此字段可能返回 null,表示取不到有效值。
- CustomerAddress *string `json:"CustomerAddress,omitempty" name:"CustomerAddress"`
-
- // 物理专线申请者姓名。默认从账户体系获取。
- // 注意:此字段可能返回 null,表示取不到有效值。
- CustomerName *string `json:"CustomerName,omitempty" name:"CustomerName"`
-
- // 物理专线申请者联系邮箱。默认从账户体系获取。
- // 注意:此字段可能返回 null,表示取不到有效值。
- CustomerContactMail *string `json:"CustomerContactMail,omitempty" name:"CustomerContactMail"`
-
- // 物理专线申请者联系号码。默认从账户体系获取。
- // 注意:此字段可能返回 null,表示取不到有效值。
- CustomerContactNumber *string `json:"CustomerContactNumber,omitempty" name:"CustomerContactNumber"`
-
- // 物理专线的过期时间。
- // 注意:此字段可能返回 null,表示取不到有效值。
- ExpiredTime *string `json:"ExpiredTime,omitempty" name:"ExpiredTime"`
-
- // 物理专线计费类型。 NON_RECURRING_CHARGE:一次性接入费用;PREPAID_BY_YEAR:按年预付费。
- // 注意:此字段可能返回 null,表示取不到有效值。
- ChargeType *string `json:"ChargeType,omitempty" name:"ChargeType"`
-
- // 报障联系人。
- // 注意:此字段可能返回 null,表示取不到有效值。
- FaultReportContactPerson *string `json:"FaultReportContactPerson,omitempty" name:"FaultReportContactPerson"`
-
- // 报障联系电话。
- // 注意:此字段可能返回 null,表示取不到有效值。
- FaultReportContactNumber *string `json:"FaultReportContactNumber,omitempty" name:"FaultReportContactNumber"`
-}
-
-type DirectConnectTunnel struct {
-
- // 专线通道ID
- DirectConnectTunnelId *string `json:"DirectConnectTunnelId,omitempty" name:"DirectConnectTunnelId"`
-
- // 物理专线ID
- DirectConnectId *string `json:"DirectConnectId,omitempty" name:"DirectConnectId"`
-
- // 专线通道状态
- // AVAILABLE:就绪或者已连接
- // PENDING:申请中
- // ALLOCATING:配置中
- // ALLOCATED:配置完成
- // ALTERING:修改中
- // DELETING:删除中
- // DELETED:删除完成
- // COMFIRMING:待接受
- // REJECTED:拒绝
- State *string `json:"State,omitempty" name:"State"`
-
- // 物理专线的拥有者,开发商账号 ID
- DirectConnectOwnerAccount *string `json:"DirectConnectOwnerAccount,omitempty" name:"DirectConnectOwnerAccount"`
-
- // 专线通道的拥有者,开发商账号 ID
- OwnerAccount *string `json:"OwnerAccount,omitempty" name:"OwnerAccount"`
-
- // 网络类型,分别为VPC、BMVPC、CCN
- // VPC:私有网络 ,BMVPC:黑石网络,CCN:云联网
- NetworkType *string `json:"NetworkType,omitempty" name:"NetworkType"`
-
- // VPC地域
- NetworkRegion *string `json:"NetworkRegion,omitempty" name:"NetworkRegion"`
-
- // 私有网络统一 ID 或者黑石网络统一 ID
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 专线网关 ID
- DirectConnectGatewayId *string `json:"DirectConnectGatewayId,omitempty" name:"DirectConnectGatewayId"`
-
- // BGP :BGP路由 STATIC:静态 默认为 BGP 路由
- RouteType *string `json:"RouteType,omitempty" name:"RouteType"`
-
- // 用户侧BGP,Asn,AuthKey
- BgpPeer *BgpPeer `json:"BgpPeer,omitempty" name:"BgpPeer"`
-
- // 用户侧网段地址
- RouteFilterPrefixes []*RouteFilterPrefix `json:"RouteFilterPrefixes,omitempty" name:"RouteFilterPrefixes" list`
-
- // 专线通道的Vlan
- Vlan *int64 `json:"Vlan,omitempty" name:"Vlan"`
-
- // TencentAddress,腾讯侧互联 IP
- TencentAddress *string `json:"TencentAddress,omitempty" name:"TencentAddress"`
-
- // CustomerAddress,用户侧互联 IP
- CustomerAddress *string `json:"CustomerAddress,omitempty" name:"CustomerAddress"`
-
- // 专线通道名称
- DirectConnectTunnelName *string `json:"DirectConnectTunnelName,omitempty" name:"DirectConnectTunnelName"`
-
- // 专线通道创建时间
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-
- // 专线通道带宽值
- Bandwidth *int64 `json:"Bandwidth,omitempty" name:"Bandwidth"`
-}
-
-type Filter struct {
-
- // 需要过滤的字段。
- Name *string `json:"Name,omitempty" name:"Name"`
-
- // 字段的过滤值。
- Values []*string `json:"Values,omitempty" name:"Values" list`
-}
-
-type ModifyDirectConnectAttributeRequest struct {
- *tchttp.BaseRequest
-
- // 物理专线的ID。
- DirectConnectId *string `json:"DirectConnectId,omitempty" name:"DirectConnectId"`
-
- // 物理专线名称。
- DirectConnectName *string `json:"DirectConnectName,omitempty" name:"DirectConnectName"`
-
- // 运营商或者服务商为物理专线提供的电路编码。
- CircuitCode *string `json:"CircuitCode,omitempty" name:"CircuitCode"`
-
- // 物理专线调试VLAN。
- Vlan *int64 `json:"Vlan,omitempty" name:"Vlan"`
-
- // 物理专线调试腾讯侧互联 IP。
- TencentAddress *string `json:"TencentAddress,omitempty" name:"TencentAddress"`
-
- // 物理专线调试用户侧互联 IP。
- CustomerAddress *string `json:"CustomerAddress,omitempty" name:"CustomerAddress"`
-
- // 物理专线申请者姓名。默认从账户体系获取。
- CustomerName *string `json:"CustomerName,omitempty" name:"CustomerName"`
-
- // 物理专线申请者联系邮箱。默认从账户体系获取。
- CustomerContactMail *string `json:"CustomerContactMail,omitempty" name:"CustomerContactMail"`
-
- // 物理专线申请者联系号码。默认从账户体系获取。
- CustomerContactNumber *string `json:"CustomerContactNumber,omitempty" name:"CustomerContactNumber"`
-
- // 报障联系人。
- FaultReportContactPerson *string `json:"FaultReportContactPerson,omitempty" name:"FaultReportContactPerson"`
-
- // 报障联系电话。
- FaultReportContactNumber *string `json:"FaultReportContactNumber,omitempty" name:"FaultReportContactNumber"`
-}
-
-func (r *ModifyDirectConnectAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyDirectConnectAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyDirectConnectAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyDirectConnectAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyDirectConnectAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyDirectConnectTunnelAttributeRequest struct {
- *tchttp.BaseRequest
-
- // 专用通道ID
- DirectConnectTunnelId *string `json:"DirectConnectTunnelId,omitempty" name:"DirectConnectTunnelId"`
-
- // 专用通道名称
- DirectConnectTunnelName *string `json:"DirectConnectTunnelName,omitempty" name:"DirectConnectTunnelName"`
-
- // 用户侧BGP,包括Asn,AuthKey
- BgpPeer *BgpPeer `json:"BgpPeer,omitempty" name:"BgpPeer"`
-
- // 用户侧网段地址
- RouteFilterPrefixes []*RouteFilterPrefix `json:"RouteFilterPrefixes,omitempty" name:"RouteFilterPrefixes" list`
-
- // 腾讯侧互联IP
- TencentAddress *string `json:"TencentAddress,omitempty" name:"TencentAddress"`
-
- // 用户侧互联IP
- CustomerAddress *string `json:"CustomerAddress,omitempty" name:"CustomerAddress"`
-
- // 专用通道带宽值,单位为M。
- Bandwidth *int64 `json:"Bandwidth,omitempty" name:"Bandwidth"`
-}
-
-func (r *ModifyDirectConnectTunnelAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyDirectConnectTunnelAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyDirectConnectTunnelAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyDirectConnectTunnelAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyDirectConnectTunnelAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RejectDirectConnectTunnelRequest struct {
- *tchttp.BaseRequest
-
- // 无
- DirectConnectTunnelId *string `json:"DirectConnectTunnelId,omitempty" name:"DirectConnectTunnelId"`
-}
-
-func (r *RejectDirectConnectTunnelRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RejectDirectConnectTunnelRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RejectDirectConnectTunnelResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *RejectDirectConnectTunnelResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RejectDirectConnectTunnelResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RouteFilterPrefix struct {
-
- // 用户侧网段地址
- Cidr *string `json:"Cidr,omitempty" name:"Cidr"`
-}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/monitor/v20180724/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/monitor/v20180724/client.go
deleted file mode 100644
index a50f66f..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/monitor/v20180724/client.go
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package v20180724
-
-import (
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
- tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
-)
-
-const APIVersion = "2018-07-24"
-
-type Client struct {
- common.Client
-}
-
-// Deprecated
-func NewClientWithSecretId(secretId, secretKey, region string) (client *Client, err error) {
- cpf := profile.NewClientProfile()
- client = &Client{}
- client.Init(region).WithSecretId(secretId, secretKey).WithProfile(cpf)
- return
-}
-
-func NewClient(credential *common.Credential, region string, clientProfile *profile.ClientProfile) (client *Client, err error) {
- client = &Client{}
- client.Init(region).
- WithCredential(credential).
- WithProfile(clientProfile)
- return
-}
-
-
-func NewDescribeBaseMetricsRequest() (request *DescribeBaseMetricsRequest) {
- request = &DescribeBaseMetricsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("monitor", APIVersion, "DescribeBaseMetrics")
- return
-}
-
-func NewDescribeBaseMetricsResponse() (response *DescribeBaseMetricsResponse) {
- response = &DescribeBaseMetricsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 获取基础指标详情
-func (c *Client) DescribeBaseMetrics(request *DescribeBaseMetricsRequest) (response *DescribeBaseMetricsResponse, err error) {
- if request == nil {
- request = NewDescribeBaseMetricsRequest()
- }
- response = NewDescribeBaseMetricsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewGetMonitorDataRequest() (request *GetMonitorDataRequest) {
- request = &GetMonitorDataRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("monitor", APIVersion, "GetMonitorData")
- return
-}
-
-func NewGetMonitorDataResponse() (response *GetMonitorDataResponse) {
- response = &GetMonitorDataResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 获取云产品的监控数据。传入产品的命名空间、对象维度描述和监控指标即可获得相应的监控数据。
-// 接口调用频率限制为:20次/秒,1200次/分钟。
-// 若您需要调用的指标、对象较多,可能存在因限频出现拉取失败的情况,建议尽量将请求按时间维度均摊。
-func (c *Client) GetMonitorData(request *GetMonitorDataRequest) (response *GetMonitorDataResponse, err error) {
- if request == nil {
- request = NewGetMonitorDataRequest()
- }
- response = NewGetMonitorDataResponse()
- err = c.Send(request, response)
- return
-}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/monitor/v20180724/models.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/monitor/v20180724/models.go
deleted file mode 100644
index 23990b4..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/monitor/v20180724/models.go
+++ /dev/null
@@ -1,203 +0,0 @@
-// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package v20180724
-
-import (
- "encoding/json"
-
- tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http"
-)
-
-type DataPoint struct {
-
- // 实例对象维度组合
- Dimensions []*Dimension `json:"Dimensions,omitempty" name:"Dimensions" list`
-
- // 时间戳数组,表示那些时间点有数据,缺失的时间戳,没有数据点,可以理解为掉点了
- Timestamps []*float64 `json:"Timestamps,omitempty" name:"Timestamps" list`
-
- // 监控值数组,该数组和Timestamps一一对应
- Values []*float64 `json:"Values,omitempty" name:"Values" list`
-}
-
-type DescribeBaseMetricsRequest struct {
- *tchttp.BaseRequest
-
- // 业务命名空间
- Namespace *string `json:"Namespace,omitempty" name:"Namespace"`
-
- // 指标名
- MetricName *string `json:"MetricName,omitempty" name:"MetricName"`
-}
-
-func (r *DescribeBaseMetricsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeBaseMetricsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeBaseMetricsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 查询得到的指标描述列表
- MetricSet []*MetricSet `json:"MetricSet,omitempty" name:"MetricSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeBaseMetricsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeBaseMetricsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type Dimension struct {
-
- // 实例维度名称
- Name *string `json:"Name,omitempty" name:"Name"`
-
- // 实例维度值
- Value *string `json:"Value,omitempty" name:"Value"`
-}
-
-type DimensionsDesc struct {
-
- // 维度名数组
- Dimensions []*string `json:"Dimensions,omitempty" name:"Dimensions" list`
-}
-
-type GetMonitorDataRequest struct {
- *tchttp.BaseRequest
-
- // 命名空间,每个云产品会有一个命名空间
- Namespace *string `json:"Namespace,omitempty" name:"Namespace"`
-
- // 指标名称,各个云产品的详细指标说明请参阅各个产品[监控接口](https://cloud.tencent.com/document/product/248/30384)文档
- MetricName *string `json:"MetricName,omitempty" name:"MetricName"`
-
- // 实例对象的维度组合
- Instances []*Instance `json:"Instances,omitempty" name:"Instances" list`
-
- // 监控统计周期。默认为取值为300,单位为s
- Period *uint64 `json:"Period,omitempty" name:"Period"`
-
- // 起始时间,如2018-09-22T19:51:23+08:00
- StartTime *string `json:"StartTime,omitempty" name:"StartTime"`
-
- // 结束时间,默认为当前时间。 EndTime不能小于EtartTime
- EndTime *string `json:"EndTime,omitempty" name:"EndTime"`
-}
-
-func (r *GetMonitorDataRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *GetMonitorDataRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type GetMonitorDataResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 统计周期
- Period *uint64 `json:"Period,omitempty" name:"Period"`
-
- // 指标名
- MetricName *string `json:"MetricName,omitempty" name:"MetricName"`
-
- // 数据点数组
- DataPoints []*DataPoint `json:"DataPoints,omitempty" name:"DataPoints" list`
-
- // 开始时间
- StartTime *string `json:"StartTime,omitempty" name:"StartTime"`
-
- // 结束时间
- EndTime *string `json:"EndTime,omitempty" name:"EndTime"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *GetMonitorDataResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *GetMonitorDataResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type Instance struct {
-
- // 实例的维度组合
- Dimensions []*Dimension `json:"Dimensions,omitempty" name:"Dimensions" list`
-}
-
-type MetricObjectMeaning struct {
-
- // 指标英文解释
- En *string `json:"En,omitempty" name:"En"`
-
- // 指标中文解释
- Zh *string `json:"Zh,omitempty" name:"Zh"`
-}
-
-type MetricSet struct {
-
- // 命名空间,每个云产品会有一个命名空间
- Namespace *string `json:"Namespace,omitempty" name:"Namespace"`
-
- // 指标名称
- MetricName *string `json:"MetricName,omitempty" name:"MetricName"`
-
- // 指标使用的单位
- Unit *string `json:"Unit,omitempty" name:"Unit"`
-
- // 指标使用的单位
- UnitCname *string `json:"UnitCname,omitempty" name:"UnitCname"`
-
- // 指标支持的统计周期,单位是秒,如60、300
- Period []*int64 `json:"Period,omitempty" name:"Period" list`
-
- // 统计周期内指标方式
- Periods []*PeriodsSt `json:"Periods,omitempty" name:"Periods" list`
-
- // 统计指标含义解释
- Meaning *MetricObjectMeaning `json:"Meaning,omitempty" name:"Meaning"`
-
- // 维度描述信息
- Dimensions []*DimensionsDesc `json:"Dimensions,omitempty" name:"Dimensions" list`
-}
-
-type PeriodsSt struct {
-
- // 周期
- Period *string `json:"Period,omitempty" name:"Period"`
-
- // 统计方式
- StatType []*string `json:"StatType,omitempty" name:"StatType" list`
-}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis/v20180412/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis/v20180412/client.go
deleted file mode 100644
index 33fcbad..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis/v20180412/client.go
+++ /dev/null
@@ -1,769 +0,0 @@
-// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package v20180412
-
-import (
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
- tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
-)
-
-const APIVersion = "2018-04-12"
-
-type Client struct {
- common.Client
-}
-
-// Deprecated
-func NewClientWithSecretId(secretId, secretKey, region string) (client *Client, err error) {
- cpf := profile.NewClientProfile()
- client = &Client{}
- client.Init(region).WithSecretId(secretId, secretKey).WithProfile(cpf)
- return
-}
-
-func NewClient(credential *common.Credential, region string, clientProfile *profile.ClientProfile) (client *Client, err error) {
- client = &Client{}
- client.Init(region).
- WithCredential(credential).
- WithProfile(clientProfile)
- return
-}
-
-
-func NewCleanUpInstanceRequest() (request *CleanUpInstanceRequest) {
- request = &CleanUpInstanceRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "CleanUpInstance")
- return
-}
-
-func NewCleanUpInstanceResponse() (response *CleanUpInstanceResponse) {
- response = &CleanUpInstanceResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 回收站实例立即下线
-func (c *Client) CleanUpInstance(request *CleanUpInstanceRequest) (response *CleanUpInstanceResponse, err error) {
- if request == nil {
- request = NewCleanUpInstanceRequest()
- }
- response = NewCleanUpInstanceResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewClearInstanceRequest() (request *ClearInstanceRequest) {
- request = &ClearInstanceRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "ClearInstance")
- return
-}
-
-func NewClearInstanceResponse() (response *ClearInstanceResponse) {
- response = &ClearInstanceResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 清空Redis实例的实例数据。
-func (c *Client) ClearInstance(request *ClearInstanceRequest) (response *ClearInstanceResponse, err error) {
- if request == nil {
- request = NewClearInstanceRequest()
- }
- response = NewClearInstanceResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateInstancesRequest() (request *CreateInstancesRequest) {
- request = &CreateInstancesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "CreateInstances")
- return
-}
-
-func NewCreateInstancesResponse() (response *CreateInstancesResponse) {
- response = &CreateInstancesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 创建redis实例
-func (c *Client) CreateInstances(request *CreateInstancesRequest) (response *CreateInstancesResponse, err error) {
- if request == nil {
- request = NewCreateInstancesRequest()
- }
- response = NewCreateInstancesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeAutoBackupConfigRequest() (request *DescribeAutoBackupConfigRequest) {
- request = &DescribeAutoBackupConfigRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "DescribeAutoBackupConfig")
- return
-}
-
-func NewDescribeAutoBackupConfigResponse() (response *DescribeAutoBackupConfigResponse) {
- response = &DescribeAutoBackupConfigResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 获取备份配置
-func (c *Client) DescribeAutoBackupConfig(request *DescribeAutoBackupConfigRequest) (response *DescribeAutoBackupConfigResponse, err error) {
- if request == nil {
- request = NewDescribeAutoBackupConfigRequest()
- }
- response = NewDescribeAutoBackupConfigResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeBackupUrlRequest() (request *DescribeBackupUrlRequest) {
- request = &DescribeBackupUrlRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "DescribeBackupUrl")
- return
-}
-
-func NewDescribeBackupUrlResponse() (response *DescribeBackupUrlResponse) {
- response = &DescribeBackupUrlResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 查询备份Rdb下载地址
-func (c *Client) DescribeBackupUrl(request *DescribeBackupUrlRequest) (response *DescribeBackupUrlResponse, err error) {
- if request == nil {
- request = NewDescribeBackupUrlRequest()
- }
- response = NewDescribeBackupUrlResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeInstanceBackupsRequest() (request *DescribeInstanceBackupsRequest) {
- request = &DescribeInstanceBackupsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "DescribeInstanceBackups")
- return
-}
-
-func NewDescribeInstanceBackupsResponse() (response *DescribeInstanceBackupsResponse) {
- response = &DescribeInstanceBackupsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 查询 CRS 实例备份列表
-func (c *Client) DescribeInstanceBackups(request *DescribeInstanceBackupsRequest) (response *DescribeInstanceBackupsResponse, err error) {
- if request == nil {
- request = NewDescribeInstanceBackupsRequest()
- }
- response = NewDescribeInstanceBackupsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeInstanceDealDetailRequest() (request *DescribeInstanceDealDetailRequest) {
- request = &DescribeInstanceDealDetailRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "DescribeInstanceDealDetail")
- return
-}
-
-func NewDescribeInstanceDealDetailResponse() (response *DescribeInstanceDealDetailResponse) {
- response = &DescribeInstanceDealDetailResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 查询订单信息
-func (c *Client) DescribeInstanceDealDetail(request *DescribeInstanceDealDetailRequest) (response *DescribeInstanceDealDetailResponse, err error) {
- if request == nil {
- request = NewDescribeInstanceDealDetailRequest()
- }
- response = NewDescribeInstanceDealDetailResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeInstanceParamRecordsRequest() (request *DescribeInstanceParamRecordsRequest) {
- request = &DescribeInstanceParamRecordsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "DescribeInstanceParamRecords")
- return
-}
-
-func NewDescribeInstanceParamRecordsResponse() (response *DescribeInstanceParamRecordsResponse) {
- response = &DescribeInstanceParamRecordsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 查询参数修改历史列表
-func (c *Client) DescribeInstanceParamRecords(request *DescribeInstanceParamRecordsRequest) (response *DescribeInstanceParamRecordsResponse, err error) {
- if request == nil {
- request = NewDescribeInstanceParamRecordsRequest()
- }
- response = NewDescribeInstanceParamRecordsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeInstanceParamsRequest() (request *DescribeInstanceParamsRequest) {
- request = &DescribeInstanceParamsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "DescribeInstanceParams")
- return
-}
-
-func NewDescribeInstanceParamsResponse() (response *DescribeInstanceParamsResponse) {
- response = &DescribeInstanceParamsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 查询实例参数列表
-func (c *Client) DescribeInstanceParams(request *DescribeInstanceParamsRequest) (response *DescribeInstanceParamsResponse, err error) {
- if request == nil {
- request = NewDescribeInstanceParamsRequest()
- }
- response = NewDescribeInstanceParamsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeInstanceSecurityGroupRequest() (request *DescribeInstanceSecurityGroupRequest) {
- request = &DescribeInstanceSecurityGroupRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "DescribeInstanceSecurityGroup")
- return
-}
-
-func NewDescribeInstanceSecurityGroupResponse() (response *DescribeInstanceSecurityGroupResponse) {
- response = &DescribeInstanceSecurityGroupResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 查询实例安全组信息
-func (c *Client) DescribeInstanceSecurityGroup(request *DescribeInstanceSecurityGroupRequest) (response *DescribeInstanceSecurityGroupResponse, err error) {
- if request == nil {
- request = NewDescribeInstanceSecurityGroupRequest()
- }
- response = NewDescribeInstanceSecurityGroupResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeInstanceShardsRequest() (request *DescribeInstanceShardsRequest) {
- request = &DescribeInstanceShardsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "DescribeInstanceShards")
- return
-}
-
-func NewDescribeInstanceShardsResponse() (response *DescribeInstanceShardsResponse) {
- response = &DescribeInstanceShardsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 获取集群版实例分片信息
-func (c *Client) DescribeInstanceShards(request *DescribeInstanceShardsRequest) (response *DescribeInstanceShardsResponse, err error) {
- if request == nil {
- request = NewDescribeInstanceShardsRequest()
- }
- response = NewDescribeInstanceShardsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeInstancesRequest() (request *DescribeInstancesRequest) {
- request = &DescribeInstancesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "DescribeInstances")
- return
-}
-
-func NewDescribeInstancesResponse() (response *DescribeInstancesResponse) {
- response = &DescribeInstancesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 查询Redis实例列表
-func (c *Client) DescribeInstances(request *DescribeInstancesRequest) (response *DescribeInstancesResponse, err error) {
- if request == nil {
- request = NewDescribeInstancesRequest()
- }
- response = NewDescribeInstancesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeProductInfoRequest() (request *DescribeProductInfoRequest) {
- request = &DescribeProductInfoRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "DescribeProductInfo")
- return
-}
-
-func NewDescribeProductInfoResponse() (response *DescribeProductInfoResponse) {
- response = &DescribeProductInfoResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口查询指定可用区和实例类型下 Redis 的售卖规格, 如果用户不在购买白名单中,将不能查询该可用区或该类型的售卖规格详情。申请购买某地域白名单可以提交工单
-func (c *Client) DescribeProductInfo(request *DescribeProductInfoRequest) (response *DescribeProductInfoResponse, err error) {
- if request == nil {
- request = NewDescribeProductInfoRequest()
- }
- response = NewDescribeProductInfoResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeProjectSecurityGroupRequest() (request *DescribeProjectSecurityGroupRequest) {
- request = &DescribeProjectSecurityGroupRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "DescribeProjectSecurityGroup")
- return
-}
-
-func NewDescribeProjectSecurityGroupResponse() (response *DescribeProjectSecurityGroupResponse) {
- response = &DescribeProjectSecurityGroupResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 查询项目安全组信息
-func (c *Client) DescribeProjectSecurityGroup(request *DescribeProjectSecurityGroupRequest) (response *DescribeProjectSecurityGroupResponse, err error) {
- if request == nil {
- request = NewDescribeProjectSecurityGroupRequest()
- }
- response = NewDescribeProjectSecurityGroupResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeTaskInfoRequest() (request *DescribeTaskInfoRequest) {
- request = &DescribeTaskInfoRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "DescribeTaskInfo")
- return
-}
-
-func NewDescribeTaskInfoResponse() (response *DescribeTaskInfoResponse) {
- response = &DescribeTaskInfoResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 用于查询任务结果
-func (c *Client) DescribeTaskInfo(request *DescribeTaskInfoRequest) (response *DescribeTaskInfoResponse, err error) {
- if request == nil {
- request = NewDescribeTaskInfoRequest()
- }
- response = NewDescribeTaskInfoResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDestroyPostpaidInstanceRequest() (request *DestroyPostpaidInstanceRequest) {
- request = &DestroyPostpaidInstanceRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "DestroyPostpaidInstance")
- return
-}
-
-func NewDestroyPostpaidInstanceResponse() (response *DestroyPostpaidInstanceResponse) {
- response = &DestroyPostpaidInstanceResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 按量计费实例销毁
-func (c *Client) DestroyPostpaidInstance(request *DestroyPostpaidInstanceRequest) (response *DestroyPostpaidInstanceResponse, err error) {
- if request == nil {
- request = NewDestroyPostpaidInstanceRequest()
- }
- response = NewDestroyPostpaidInstanceResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDestroyPrepaidInstanceRequest() (request *DestroyPrepaidInstanceRequest) {
- request = &DestroyPrepaidInstanceRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "DestroyPrepaidInstance")
- return
-}
-
-func NewDestroyPrepaidInstanceResponse() (response *DestroyPrepaidInstanceResponse) {
- response = &DestroyPrepaidInstanceResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 包年包月实例退还
-func (c *Client) DestroyPrepaidInstance(request *DestroyPrepaidInstanceRequest) (response *DestroyPrepaidInstanceResponse, err error) {
- if request == nil {
- request = NewDestroyPrepaidInstanceRequest()
- }
- response = NewDestroyPrepaidInstanceResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDisableReplicaReadonlyRequest() (request *DisableReplicaReadonlyRequest) {
- request = &DisableReplicaReadonlyRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "DisableReplicaReadonly")
- return
-}
-
-func NewDisableReplicaReadonlyResponse() (response *DisableReplicaReadonlyResponse) {
- response = &DisableReplicaReadonlyResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 禁用读写分离
-func (c *Client) DisableReplicaReadonly(request *DisableReplicaReadonlyRequest) (response *DisableReplicaReadonlyResponse, err error) {
- if request == nil {
- request = NewDisableReplicaReadonlyRequest()
- }
- response = NewDisableReplicaReadonlyResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewEnableReplicaReadonlyRequest() (request *EnableReplicaReadonlyRequest) {
- request = &EnableReplicaReadonlyRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "EnableReplicaReadonly")
- return
-}
-
-func NewEnableReplicaReadonlyResponse() (response *EnableReplicaReadonlyResponse) {
- response = &EnableReplicaReadonlyResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 启用读写分离
-func (c *Client) EnableReplicaReadonly(request *EnableReplicaReadonlyRequest) (response *EnableReplicaReadonlyResponse, err error) {
- if request == nil {
- request = NewEnableReplicaReadonlyRequest()
- }
- response = NewEnableReplicaReadonlyResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewManualBackupInstanceRequest() (request *ManualBackupInstanceRequest) {
- request = &ManualBackupInstanceRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "ManualBackupInstance")
- return
-}
-
-func NewManualBackupInstanceResponse() (response *ManualBackupInstanceResponse) {
- response = &ManualBackupInstanceResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 手动备份Redis实例
-func (c *Client) ManualBackupInstance(request *ManualBackupInstanceRequest) (response *ManualBackupInstanceResponse, err error) {
- if request == nil {
- request = NewManualBackupInstanceRequest()
- }
- response = NewManualBackupInstanceResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModfiyInstancePasswordRequest() (request *ModfiyInstancePasswordRequest) {
- request = &ModfiyInstancePasswordRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "ModfiyInstancePassword")
- return
-}
-
-func NewModfiyInstancePasswordResponse() (response *ModfiyInstancePasswordResponse) {
- response = &ModfiyInstancePasswordResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 修改redis密码
-func (c *Client) ModfiyInstancePassword(request *ModfiyInstancePasswordRequest) (response *ModfiyInstancePasswordResponse, err error) {
- if request == nil {
- request = NewModfiyInstancePasswordRequest()
- }
- response = NewModfiyInstancePasswordResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyAutoBackupConfigRequest() (request *ModifyAutoBackupConfigRequest) {
- request = &ModifyAutoBackupConfigRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "ModifyAutoBackupConfig")
- return
-}
-
-func NewModifyAutoBackupConfigResponse() (response *ModifyAutoBackupConfigResponse) {
- response = &ModifyAutoBackupConfigResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 设置自动备份时间
-func (c *Client) ModifyAutoBackupConfig(request *ModifyAutoBackupConfigRequest) (response *ModifyAutoBackupConfigResponse, err error) {
- if request == nil {
- request = NewModifyAutoBackupConfigRequest()
- }
- response = NewModifyAutoBackupConfigResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyInstanceRequest() (request *ModifyInstanceRequest) {
- request = &ModifyInstanceRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "ModifyInstance")
- return
-}
-
-func NewModifyInstanceResponse() (response *ModifyInstanceResponse) {
- response = &ModifyInstanceResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 修改实例相关信息(目前支持:实例重命名)
-func (c *Client) ModifyInstance(request *ModifyInstanceRequest) (response *ModifyInstanceResponse, err error) {
- if request == nil {
- request = NewModifyInstanceRequest()
- }
- response = NewModifyInstanceResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyInstanceParamsRequest() (request *ModifyInstanceParamsRequest) {
- request = &ModifyInstanceParamsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "ModifyInstanceParams")
- return
-}
-
-func NewModifyInstanceParamsResponse() (response *ModifyInstanceParamsResponse) {
- response = &ModifyInstanceParamsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 修改实例参数
-func (c *Client) ModifyInstanceParams(request *ModifyInstanceParamsRequest) (response *ModifyInstanceParamsResponse, err error) {
- if request == nil {
- request = NewModifyInstanceParamsRequest()
- }
- response = NewModifyInstanceParamsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyNetworkConfigRequest() (request *ModifyNetworkConfigRequest) {
- request = &ModifyNetworkConfigRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "ModifyNetworkConfig")
- return
-}
-
-func NewModifyNetworkConfigResponse() (response *ModifyNetworkConfigResponse) {
- response = &ModifyNetworkConfigResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 修改实例网络配置
-func (c *Client) ModifyNetworkConfig(request *ModifyNetworkConfigRequest) (response *ModifyNetworkConfigResponse, err error) {
- if request == nil {
- request = NewModifyNetworkConfigRequest()
- }
- response = NewModifyNetworkConfigResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewRenewInstanceRequest() (request *RenewInstanceRequest) {
- request = &RenewInstanceRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "RenewInstance")
- return
-}
-
-func NewRenewInstanceResponse() (response *RenewInstanceResponse) {
- response = &RenewInstanceResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 续费实例
-func (c *Client) RenewInstance(request *RenewInstanceRequest) (response *RenewInstanceResponse, err error) {
- if request == nil {
- request = NewRenewInstanceRequest()
- }
- response = NewRenewInstanceResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewResetPasswordRequest() (request *ResetPasswordRequest) {
- request = &ResetPasswordRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "ResetPassword")
- return
-}
-
-func NewResetPasswordResponse() (response *ResetPasswordResponse) {
- response = &ResetPasswordResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 重置密码
-func (c *Client) ResetPassword(request *ResetPasswordRequest) (response *ResetPasswordResponse, err error) {
- if request == nil {
- request = NewResetPasswordRequest()
- }
- response = NewResetPasswordResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewRestoreInstanceRequest() (request *RestoreInstanceRequest) {
- request = &RestoreInstanceRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "RestoreInstance")
- return
-}
-
-func NewRestoreInstanceResponse() (response *RestoreInstanceResponse) {
- response = &RestoreInstanceResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 恢复 CRS 实例
-func (c *Client) RestoreInstance(request *RestoreInstanceRequest) (response *RestoreInstanceResponse, err error) {
- if request == nil {
- request = NewRestoreInstanceRequest()
- }
- response = NewRestoreInstanceResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewUpgradeInstanceRequest() (request *UpgradeInstanceRequest) {
- request = &UpgradeInstanceRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("redis", APIVersion, "UpgradeInstance")
- return
-}
-
-func NewUpgradeInstanceResponse() (response *UpgradeInstanceResponse) {
- response = &UpgradeInstanceResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 升级实例
-func (c *Client) UpgradeInstance(request *UpgradeInstanceRequest) (response *UpgradeInstanceResponse, err error) {
- if request == nil {
- request = NewUpgradeInstanceRequest()
- }
- response = NewUpgradeInstanceResponse()
- err = c.Send(request, response)
- return
-}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis/v20180412/models.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis/v20180412/models.go
deleted file mode 100644
index 81c9d4d..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis/v20180412/models.go
+++ /dev/null
@@ -1,1843 +0,0 @@
-// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package v20180412
-
-import (
- "encoding/json"
-
- tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http"
-)
-
-type CleanUpInstanceRequest struct {
- *tchttp.BaseRequest
-
- // 实例Id
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *CleanUpInstanceRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CleanUpInstanceRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CleanUpInstanceResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 任务Id
- TaskId *int64 `json:"TaskId,omitempty" name:"TaskId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CleanUpInstanceResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CleanUpInstanceResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ClearInstanceRequest struct {
- *tchttp.BaseRequest
-
- // 实例Id
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // redis的实例密码
- Password *string `json:"Password,omitempty" name:"Password"`
-}
-
-func (r *ClearInstanceRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ClearInstanceRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ClearInstanceResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 任务Id
- TaskId *int64 `json:"TaskId,omitempty" name:"TaskId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ClearInstanceResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ClearInstanceResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateInstancesRequest struct {
- *tchttp.BaseRequest
-
- // 实例所属的可用区id
- ZoneId *uint64 `json:"ZoneId,omitempty" name:"ZoneId"`
-
- // 实例类型:2 – Redis2.8主从版,3 – Redis3.2主从版(CKV主从版),4 – Redis3.2集群版(CKV集群版),5-Redis2.8单机版,7 – Redis4.0集群版,
- TypeId *uint64 `json:"TypeId,omitempty" name:"TypeId"`
-
- // 实例容量,单位MB, 取值大小以 查询售卖规格接口返回的规格为准
- MemSize *uint64 `json:"MemSize,omitempty" name:"MemSize"`
-
- // 实例数量,单次购买实例数量以 查询售卖规格接口返回的规格为准
- GoodsNum *uint64 `json:"GoodsNum,omitempty" name:"GoodsNum"`
-
- // 购买时长,在创建包年包月实例的时候需要填写,按量计费实例填1即可,单位:月,取值范围 [1,2,3,4,5,6,7,8,9,10,11,12,24,36]
- Period *uint64 `json:"Period,omitempty" name:"Period"`
-
- // 实例密码,密码规则:1.长度为8-16个字符;2:至少包含字母、数字和字符!@^*()中的两种
- Password *string `json:"Password,omitempty" name:"Password"`
-
- // 付费方式:0-按量计费,1-包年包月。
- BillingMode *int64 `json:"BillingMode,omitempty" name:"BillingMode"`
-
- // 私有网络ID,如果不传则默认选择基础网络,请使用私有网络列表查询,如:vpc-sad23jfdfk
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 基础网络下, subnetId无效; vpc子网下,取值以查询子网列表,如:subnet-fdj24n34j2
- SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"`
-
- // 项目id,取值以用户账户>用户账户相关接口查询>项目列表返回的projectId为准
- ProjectId *int64 `json:"ProjectId,omitempty" name:"ProjectId"`
-
- // 自动续费标识。0 - 默认状态(手动续费);1 - 自动续费;2 - 明确不自动续费
- AutoRenew *uint64 `json:"AutoRenew,omitempty" name:"AutoRenew"`
-
- // 安全组id数组
- SecurityGroupIdList []*string `json:"SecurityGroupIdList,omitempty" name:"SecurityGroupIdList" list`
-
- // 用户自定义的端口 不填则默认为6379
- VPort *uint64 `json:"VPort,omitempty" name:"VPort"`
-
- // 实例分片数量,Redis2.8主从版、CKV主从版和Redis2.8单机版不需要填写
- RedisShardNum *int64 `json:"RedisShardNum,omitempty" name:"RedisShardNum"`
-
- // 实例副本数量,Redis2.8主从版、CKV主从版和Redis2.8单机版不需要填写
- RedisReplicasNum *int64 `json:"RedisReplicasNum,omitempty" name:"RedisReplicasNum"`
-
- // 是否支持副本只读,Redis2.8主从版、CKV主从版和Redis2.8单机版不需要填写
- ReplicasReadonly *bool `json:"ReplicasReadonly,omitempty" name:"ReplicasReadonly"`
-
- // 实例名称
- InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"`
-}
-
-func (r *CreateInstancesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateInstancesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateInstancesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 交易的Id
- DealId *string `json:"DealId,omitempty" name:"DealId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateInstancesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateInstancesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeAutoBackupConfigRequest struct {
- *tchttp.BaseRequest
-
- // 实例ID
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *DescribeAutoBackupConfigRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeAutoBackupConfigRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeAutoBackupConfigResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 备份类型。自动备份类型: 1 “定时回档”
- AutoBackupType *int64 `json:"AutoBackupType,omitempty" name:"AutoBackupType"`
-
- // Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday。
- WeekDays []*string `json:"WeekDays,omitempty" name:"WeekDays" list`
-
- // 时间段。
- TimePeriod *string `json:"TimePeriod,omitempty" name:"TimePeriod"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeAutoBackupConfigResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeAutoBackupConfigResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeBackupUrlRequest struct {
- *tchttp.BaseRequest
-
- // 实例Id
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 备份Id,通过DescribeInstanceBackups接口可查
- BackupId *string `json:"BackupId,omitempty" name:"BackupId"`
-}
-
-func (r *DescribeBackupUrlRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeBackupUrlRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeBackupUrlResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 外网下载地址(6小时)
- DownloadUrl []*string `json:"DownloadUrl,omitempty" name:"DownloadUrl" list`
-
- // 内网下载地址(6小时)
- InnerDownloadUrl []*string `json:"InnerDownloadUrl,omitempty" name:"InnerDownloadUrl" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeBackupUrlResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeBackupUrlResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceBackupsRequest struct {
- *tchttp.BaseRequest
-
- // 待操作的实例ID,可通过 DescribeInstance 接口返回值中的 InstanceId 获取。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 实例列表大小,默认大小20
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-
- // 偏移量,取Limit整数倍
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 开始时间,格式如:2017-02-08 16:46:34。查询实例在 [beginTime, endTime] 时间段内开始备份的备份列表。
- BeginTime *string `json:"BeginTime,omitempty" name:"BeginTime"`
-
- // 结束时间,格式如:2017-02-08 19:09:26。查询实例在 [beginTime, endTime] 时间段内开始备份的备份列表。
- EndTime *string `json:"EndTime,omitempty" name:"EndTime"`
-
- // 1:备份在流程中,2:备份正常,3:备份转RDB文件处理中,4:已完成RDB转换,-1:备份已过期,-2:备份已删除。
- Status []*int64 `json:"Status,omitempty" name:"Status" list`
-}
-
-func (r *DescribeInstanceBackupsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceBackupsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceBackupsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 备份总数
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 实例的备份数组
- BackupSet []*RedisBackupSet `json:"BackupSet,omitempty" name:"BackupSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeInstanceBackupsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceBackupsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceDealDetailRequest struct {
- *tchttp.BaseRequest
-
- // 订单ID数组
- DealIds []*string `json:"DealIds,omitempty" name:"DealIds" list`
-}
-
-func (r *DescribeInstanceDealDetailRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceDealDetailRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceDealDetailResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 订单详细信息
- DealDetails []*TradeDealDetail `json:"DealDetails,omitempty" name:"DealDetails" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeInstanceDealDetailResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceDealDetailResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceParamRecordsRequest struct {
- *tchttp.BaseRequest
-
- // 实例Id
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 分页大小
- Limit *uint64 `json:"Limit,omitempty" name:"Limit"`
-
- // 偏移量,取Limit整数倍
- Offset *uint64 `json:"Offset,omitempty" name:"Offset"`
-}
-
-func (r *DescribeInstanceParamRecordsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceParamRecordsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceParamRecordsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 总的修改历史记录数。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 修改历史记录信息。
- InstanceParamHistory []*InstanceParamHistory `json:"InstanceParamHistory,omitempty" name:"InstanceParamHistory" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeInstanceParamRecordsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceParamRecordsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceParamsRequest struct {
- *tchttp.BaseRequest
-
- // 实例Id
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *DescribeInstanceParamsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceParamsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceParamsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 实例参数个数
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 实例枚举类型参数
- InstanceEnumParam []*InstanceEnumParam `json:"InstanceEnumParam,omitempty" name:"InstanceEnumParam" list`
-
- // 实例整型参数
- InstanceIntegerParam []*InstanceIntegerParam `json:"InstanceIntegerParam,omitempty" name:"InstanceIntegerParam" list`
-
- // 实例字符型参数
- InstanceTextParam []*InstanceTextParam `json:"InstanceTextParam,omitempty" name:"InstanceTextParam" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeInstanceParamsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceParamsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceSecurityGroupRequest struct {
- *tchttp.BaseRequest
-
- // 实例列表
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-}
-
-func (r *DescribeInstanceSecurityGroupRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceSecurityGroupRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceSecurityGroupResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 实例安全组信息
- InstanceSecurityGroupsDetail []*InstanceSecurityGroupDetail `json:"InstanceSecurityGroupsDetail,omitempty" name:"InstanceSecurityGroupsDetail" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeInstanceSecurityGroupResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceSecurityGroupResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceShardsRequest struct {
- *tchttp.BaseRequest
-
- // 实例id
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 是否过滤掉从节信息
- FilterSlave *bool `json:"FilterSlave,omitempty" name:"FilterSlave"`
-}
-
-func (r *DescribeInstanceShardsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceShardsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstanceShardsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 实例分片列表信息
- InstanceShards []*InstanceClusterShard `json:"InstanceShards,omitempty" name:"InstanceShards" list`
-
- // 实例分片节点总数
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeInstanceShardsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstanceShardsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstancesRequest struct {
- *tchttp.BaseRequest
-
- // 实例列表的大小,参数默认值20
- Limit *uint64 `json:"Limit,omitempty" name:"Limit"`
-
- // 偏移量,取Limit整数倍
- Offset *uint64 `json:"Offset,omitempty" name:"Offset"`
-
- // 实例Id,如:crs-6ubhgouj
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 枚举范围: projectId,createtime,instancename,type,curDeadline
- OrderBy *string `json:"OrderBy,omitempty" name:"OrderBy"`
-
- // 1倒序,0顺序,默认倒序
- OrderType *int64 `json:"OrderType,omitempty" name:"OrderType"`
-
- // 私有网络ID数组,数组下标从0开始,如果不传则默认选择基础网络,如:47525
- VpcIds []*string `json:"VpcIds,omitempty" name:"VpcIds" list`
-
- // 子网ID数组,数组下标从0开始,如:56854
- SubnetIds []*string `json:"SubnetIds,omitempty" name:"SubnetIds" list`
-
- // 项目ID 组成的数组,数组下标从0开始
- ProjectIds []*int64 `json:"ProjectIds,omitempty" name:"ProjectIds" list`
-
- // 查找实例的ID。
- SearchKey *string `json:"SearchKey,omitempty" name:"SearchKey"`
-
- // 实例名称
- InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"`
-
- // 私有网络ID数组,数组下标从0开始,如果不传则默认选择基础网络,如:vpc-sad23jfdfk
- UniqVpcIds []*string `json:"UniqVpcIds,omitempty" name:"UniqVpcIds" list`
-
- // 子网ID数组,数组下标从0开始,如:subnet-fdj24n34j2
- UniqSubnetIds []*string `json:"UniqSubnetIds,omitempty" name:"UniqSubnetIds" list`
-
- // 地域ID,已经弃用,可通过公共参数Region查询对应地域
- RegionIds []*int64 `json:"RegionIds,omitempty" name:"RegionIds" list`
-
- // 实例状态:0-待初始化,1-流程中,2-运行中,-2-已隔离,-3-待删除
- Status []*int64 `json:"Status,omitempty" name:"Status" list`
-
- // 类型版本:1-单机版,2-主从版,3-集群版
- TypeVersion *int64 `json:"TypeVersion,omitempty" name:"TypeVersion"`
-
- // 引擎信息:Redis-2.8,Redis-4.0,CKV
- EngineName *string `json:"EngineName,omitempty" name:"EngineName"`
-
- // 续费模式:0 - 默认状态(手动续费);1 - 自动续费;2 - 明确不自动续费
- AutoRenew []*int64 `json:"AutoRenew,omitempty" name:"AutoRenew" list`
-
- // 计费模式:postpaid-按量计费;prepaid-包年包月
- BillingMode *string `json:"BillingMode,omitempty" name:"BillingMode"`
-
- // 实例类型:1-Redis老集群版;2-Redis 2.8主从版;3-CKV主从版;4-CKV集群版;5-Redis 2.8单机版;7-Redis 4.0集群版
- Type *int64 `json:"Type,omitempty" name:"Type"`
-
- // 搜索关键词:支持实例Id、实例名称、完整IP
- SearchKeys []*string `json:"SearchKeys,omitempty" name:"SearchKeys" list`
-}
-
-func (r *DescribeInstancesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstancesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeInstancesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 实例数
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 实例详细信息列表
- InstanceSet []*InstanceSet `json:"InstanceSet,omitempty" name:"InstanceSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeInstancesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeInstancesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeProductInfoRequest struct {
- *tchttp.BaseRequest
-}
-
-func (r *DescribeProductInfoRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeProductInfoRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeProductInfoResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 地域售卖信息
- RegionSet []*RegionConf `json:"RegionSet,omitempty" name:"RegionSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeProductInfoResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeProductInfoResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeProjectSecurityGroupRequest struct {
- *tchttp.BaseRequest
-
- // 0:默认项目;-1 所有项目; >0: 特定项目
- ProjectId *int64 `json:"ProjectId,omitempty" name:"ProjectId"`
-
- // 安全组Id
- SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"`
-}
-
-func (r *DescribeProjectSecurityGroupRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeProjectSecurityGroupRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeProjectSecurityGroupResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 项目安全组
- SecurityGroupDetails []*SecurityGroupDetail `json:"SecurityGroupDetails,omitempty" name:"SecurityGroupDetails" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeProjectSecurityGroupResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeProjectSecurityGroupResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeTaskInfoRequest struct {
- *tchttp.BaseRequest
-
- // 任务ID
- TaskId *uint64 `json:"TaskId,omitempty" name:"TaskId"`
-}
-
-func (r *DescribeTaskInfoRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeTaskInfoRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeTaskInfoResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 任务状态preparing:待执行,running:执行中,succeed:成功,failed:失败,error 执行出错
- Status *string `json:"Status,omitempty" name:"Status"`
-
- // 任务开始时间
- StartTime *string `json:"StartTime,omitempty" name:"StartTime"`
-
- // 任务类型
- TaskType *string `json:"TaskType,omitempty" name:"TaskType"`
-
- // 实例的ID
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 任务信息,错误时显示错误信息。执行中与成功则为空
- TaskMessage *string `json:"TaskMessage,omitempty" name:"TaskMessage"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeTaskInfoResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeTaskInfoResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DestroyPostpaidInstanceRequest struct {
- *tchttp.BaseRequest
-
- // 实例Id
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *DestroyPostpaidInstanceRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DestroyPostpaidInstanceRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DestroyPostpaidInstanceResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 任务Id
- TaskId *int64 `json:"TaskId,omitempty" name:"TaskId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DestroyPostpaidInstanceResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DestroyPostpaidInstanceResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DestroyPrepaidInstanceRequest struct {
- *tchttp.BaseRequest
-
- // 实例Id
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *DestroyPrepaidInstanceRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DestroyPrepaidInstanceRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DestroyPrepaidInstanceResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 订单Id
- DealId *string `json:"DealId,omitempty" name:"DealId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DestroyPrepaidInstanceResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DestroyPrepaidInstanceResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DisableReplicaReadonlyRequest struct {
- *tchttp.BaseRequest
-
- // 实例序号ID
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *DisableReplicaReadonlyRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DisableReplicaReadonlyRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DisableReplicaReadonlyResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 失败:ERROR,成功:OK
- Status *string `json:"Status,omitempty" name:"Status"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DisableReplicaReadonlyResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DisableReplicaReadonlyResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type EnableReplicaReadonlyRequest struct {
- *tchttp.BaseRequest
-
- // 实例序号ID
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *EnableReplicaReadonlyRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *EnableReplicaReadonlyRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type EnableReplicaReadonlyResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 错误:ERROR,正确OK。
- Status *string `json:"Status,omitempty" name:"Status"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *EnableReplicaReadonlyResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *EnableReplicaReadonlyResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InstanceClusterNode struct {
-
- // 节点名称
- Name *string `json:"Name,omitempty" name:"Name"`
-
- // 实例运行时节点Id
- RunId *string `json:"RunId,omitempty" name:"RunId"`
-
- // 集群角色:0-master;1-slave
- Role *int64 `json:"Role,omitempty" name:"Role"`
-
- // 节点状态:0-readwrite, 1-read, 2-backup
- Status *int64 `json:"Status,omitempty" name:"Status"`
-
- // 服务状态:0-down;1-on
- Connected *int64 `json:"Connected,omitempty" name:"Connected"`
-
- // 节点创建时间
- CreateTime *string `json:"CreateTime,omitempty" name:"CreateTime"`
-
- // 节点下线时间
- DownTime *string `json:"DownTime,omitempty" name:"DownTime"`
-
- // 节点slot分布
- Slots *string `json:"Slots,omitempty" name:"Slots"`
-
- // 节点key分布
- Keys *int64 `json:"Keys,omitempty" name:"Keys"`
-
- // 节点qps
- Qps *int64 `json:"Qps,omitempty" name:"Qps"`
-
- // 节点qps倾斜度
- QpsSlope *float64 `json:"QpsSlope,omitempty" name:"QpsSlope"`
-
- // 节点存储
- Storage *int64 `json:"Storage,omitempty" name:"Storage"`
-
- // 节点存储倾斜度
- StorageSlope *float64 `json:"StorageSlope,omitempty" name:"StorageSlope"`
-}
-
-type InstanceClusterShard struct {
-
- // 分片节点名称
- ShardName *string `json:"ShardName,omitempty" name:"ShardName"`
-
- // 分片节点Id
- ShardId *string `json:"ShardId,omitempty" name:"ShardId"`
-
- // 角色
- Role *int64 `json:"Role,omitempty" name:"Role"`
-
- // Key数量
- Keys *int64 `json:"Keys,omitempty" name:"Keys"`
-
- // slot信息
- Slots *string `json:"Slots,omitempty" name:"Slots"`
-
- // 使用容量
- Storage *int64 `json:"Storage,omitempty" name:"Storage"`
-
- // 容量倾斜率
- StorageSlope *float64 `json:"StorageSlope,omitempty" name:"StorageSlope"`
-
- // 实例运行时节点Id
- Runid *string `json:"Runid,omitempty" name:"Runid"`
-
- // 服务状态:0-down;1-on
- Connected *int64 `json:"Connected,omitempty" name:"Connected"`
-}
-
-type InstanceEnumParam struct {
-
- // 参数名
- ParamName *string `json:"ParamName,omitempty" name:"ParamName"`
-
- // 参数类型:enum
- ValueType *string `json:"ValueType,omitempty" name:"ValueType"`
-
- // 修改后是否需要重启:true,false
- NeedRestart *string `json:"NeedRestart,omitempty" name:"NeedRestart"`
-
- // 参数默认值
- DefaultValue *string `json:"DefaultValue,omitempty" name:"DefaultValue"`
-
- // 当前运行参数值
- CurrentValue *string `json:"CurrentValue,omitempty" name:"CurrentValue"`
-
- // 参数说明
- Tips *string `json:"Tips,omitempty" name:"Tips"`
-
- // 参数可取值
- EnumValue []*string `json:"EnumValue,omitempty" name:"EnumValue" list`
-}
-
-type InstanceIntegerParam struct {
-
- // 参数名
- ParamName *string `json:"ParamName,omitempty" name:"ParamName"`
-
- // 参数类型:integer
- ValueType *string `json:"ValueType,omitempty" name:"ValueType"`
-
- // 修改后是否需要重启:true,false
- NeedRestart *string `json:"NeedRestart,omitempty" name:"NeedRestart"`
-
- // 参数默认值
- DefaultValue *string `json:"DefaultValue,omitempty" name:"DefaultValue"`
-
- // 当前运行参数值
- CurrentValue *string `json:"CurrentValue,omitempty" name:"CurrentValue"`
-
- // 参数说明
- Tips *string `json:"Tips,omitempty" name:"Tips"`
-
- // 参数最小值
- Min *string `json:"Min,omitempty" name:"Min"`
-
- // 参数最大值
- Max *string `json:"Max,omitempty" name:"Max"`
-}
-
-type InstanceNode struct {
-
- // Id
- Id *int64 `json:"Id,omitempty" name:"Id"`
-
- // 节点详细信息
- InstanceClusterNode []*InstanceClusterNode `json:"InstanceClusterNode,omitempty" name:"InstanceClusterNode" list`
-}
-
-type InstanceParam struct {
-
- // 设置参数的名字
- Key *string `json:"Key,omitempty" name:"Key"`
-
- // 设置参数的值
- Value *string `json:"Value,omitempty" name:"Value"`
-}
-
-type InstanceParamHistory struct {
-
- // 参数名称
- ParamName *string `json:"ParamName,omitempty" name:"ParamName"`
-
- // 修改前值
- PreValue *string `json:"PreValue,omitempty" name:"PreValue"`
-
- // 修改后值
- NewValue *string `json:"NewValue,omitempty" name:"NewValue"`
-
- // 状态:1-参数配置修改中;2-参数配置修改成功;3-参数配置修改失败
- Status *int64 `json:"Status,omitempty" name:"Status"`
-
- // 修改时间
- ModifyTime *string `json:"ModifyTime,omitempty" name:"ModifyTime"`
-}
-
-type InstanceSecurityGroupDetail struct {
-
- // 实例Id
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 安全组信息
- SecurityGroupDetails []*SecurityGroupDetail `json:"SecurityGroupDetails,omitempty" name:"SecurityGroupDetails" list`
-}
-
-type InstanceSet struct {
-
- // 实例名称
- InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"`
-
- // 实例Id
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 用户的Appid
- Appid *int64 `json:"Appid,omitempty" name:"Appid"`
-
- // 项目Id
- ProjectId *int64 `json:"ProjectId,omitempty" name:"ProjectId"`
-
- // 地域id 1--广州 4--上海 5-- 香港 6--多伦多 7--上海金融 8--北京 9-- 新加坡 11--深圳金融 15--美西(硅谷)16--成都 17--德国 18--韩国 19--重庆 21--印度 22--美东(弗吉尼亚)23--泰国 24--俄罗斯 25--日本
- RegionId *int64 `json:"RegionId,omitempty" name:"RegionId"`
-
- // 区域id
- ZoneId *int64 `json:"ZoneId,omitempty" name:"ZoneId"`
-
- // vpc网络id 如:75101
- VpcId *int64 `json:"VpcId,omitempty" name:"VpcId"`
-
- // vpc网络下子网id 如:46315
- SubnetId *int64 `json:"SubnetId,omitempty" name:"SubnetId"`
-
- // 实例当前状态,0:待初始化;1:实例在流程中;2:实例运行中;-2:实例已隔离;-3:实例待删除
- Status *int64 `json:"Status,omitempty" name:"Status"`
-
- // 实例vip
- WanIp *string `json:"WanIp,omitempty" name:"WanIp"`
-
- // 实例端口号
- Port *int64 `json:"Port,omitempty" name:"Port"`
-
- // 实例创建时间
- Createtime *string `json:"Createtime,omitempty" name:"Createtime"`
-
- // 实例容量大小,单位:MB
- Size *float64 `json:"Size,omitempty" name:"Size"`
-
- // 该字段已废弃
- SizeUsed *float64 `json:"SizeUsed,omitempty" name:"SizeUsed"`
-
- // 实例类型,1:Redis2.8集群版;2:Redis2.8主从版;3:CKV主从版(Redis3.2);4:CKV集群版(Redis3.2);5:Redis2.8单机版;7:Redis4.0集群版;
- Type *int64 `json:"Type,omitempty" name:"Type"`
-
- // 实例是否设置自动续费标识,1:设置自动续费;0:未设置自动续费
- AutoRenewFlag *int64 `json:"AutoRenewFlag,omitempty" name:"AutoRenewFlag"`
-
- // 实例到期时间
- DeadlineTime *string `json:"DeadlineTime,omitempty" name:"DeadlineTime"`
-
- // 引擎:社区版Redis、腾讯云CKV
- Engine *string `json:"Engine,omitempty" name:"Engine"`
-
- // 产品类型:Redis2.8集群版、Redis2.8主从版、Redis3.2主从版(CKV主从版)、Redis3.2集群版(CKV集群版)、Redis2.8单机版、Redis4.0集群版
- ProductType *string `json:"ProductType,omitempty" name:"ProductType"`
-
- // vpc网络id 如:vpc-fk33jsf43kgv
- UniqVpcId *string `json:"UniqVpcId,omitempty" name:"UniqVpcId"`
-
- // vpc网络下子网id 如:subnet-fd3j6l35mm0
- UniqSubnetId *string `json:"UniqSubnetId,omitempty" name:"UniqSubnetId"`
-
- // 计费模式:0-按量计费,1-包年包月
- BillingMode *int64 `json:"BillingMode,omitempty" name:"BillingMode"`
-
- // 实例运行状态描述:如”实例运行中“
- InstanceTitle *string `json:"InstanceTitle,omitempty" name:"InstanceTitle"`
-
- // 计划下线时间
- OfflineTime *string `json:"OfflineTime,omitempty" name:"OfflineTime"`
-
- // 流程中的实例,返回子状态
- SubStatus *int64 `json:"SubStatus,omitempty" name:"SubStatus"`
-
- // 反亲和性标签
- Tags []*string `json:"Tags,omitempty" name:"Tags" list`
-
- // 实例节点信息
- InstanceNode []*InstanceNode `json:"InstanceNode,omitempty" name:"InstanceNode" list`
-
- // 分片大小
- RedisShardSize *int64 `json:"RedisShardSize,omitempty" name:"RedisShardSize"`
-
- // 分片数量
- RedisShardNum *int64 `json:"RedisShardNum,omitempty" name:"RedisShardNum"`
-
- // 副本数量
- RedisReplicasNum *int64 `json:"RedisReplicasNum,omitempty" name:"RedisReplicasNum"`
-
- // 计费Id
- PriceId *int64 `json:"PriceId,omitempty" name:"PriceId"`
-
- // 隔离时间
- CloseTime *string `json:"CloseTime,omitempty" name:"CloseTime"`
-
- // 从节点读取权重
- SlaveReadWeight *int64 `json:"SlaveReadWeight,omitempty" name:"SlaveReadWeight"`
-
- // 实例关联的标签信息
- // 注意:此字段可能返回 null,表示取不到有效值。
- InstanceTags []*InstanceTagInfo `json:"InstanceTags,omitempty" name:"InstanceTags" list`
-
- // 项目名称
- // 注意:此字段可能返回 null,表示取不到有效值。
- ProjectName *string `json:"ProjectName,omitempty" name:"ProjectName"`
-}
-
-type InstanceTagInfo struct {
-
- // 标签键
- TagKey *string `json:"TagKey,omitempty" name:"TagKey"`
-
- // 标签值
- TagValue *string `json:"TagValue,omitempty" name:"TagValue"`
-}
-
-type InstanceTextParam struct {
-
- // 参数名
- ParamName *string `json:"ParamName,omitempty" name:"ParamName"`
-
- // 参数类型:text
- ValueType *string `json:"ValueType,omitempty" name:"ValueType"`
-
- // 修改后是否需要重启:true,false
- NeedRestart *string `json:"NeedRestart,omitempty" name:"NeedRestart"`
-
- // 参数默认值
- DefaultValue *string `json:"DefaultValue,omitempty" name:"DefaultValue"`
-
- // 当前运行参数值
- CurrentValue *string `json:"CurrentValue,omitempty" name:"CurrentValue"`
-
- // 参数说明
- Tips *string `json:"Tips,omitempty" name:"Tips"`
-
- // 参数可取值
- TextValue []*string `json:"TextValue,omitempty" name:"TextValue" list`
-}
-
-type ManualBackupInstanceRequest struct {
- *tchttp.BaseRequest
-
- // 待操作的实例ID,可通过 DescribeInstance接口返回值中的 InstanceId 获取。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 备份的备注信息
- Remark *string `json:"Remark,omitempty" name:"Remark"`
-}
-
-func (r *ManualBackupInstanceRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ManualBackupInstanceRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ManualBackupInstanceResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 任务ID
- TaskId *int64 `json:"TaskId,omitempty" name:"TaskId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ManualBackupInstanceResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ManualBackupInstanceResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModfiyInstancePasswordRequest struct {
- *tchttp.BaseRequest
-
- // 实例ID
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 实例旧密码
- OldPassword *string `json:"OldPassword,omitempty" name:"OldPassword"`
-
- // 实例新密码
- Password *string `json:"Password,omitempty" name:"Password"`
-}
-
-func (r *ModfiyInstancePasswordRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModfiyInstancePasswordRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModfiyInstancePasswordResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 任务ID
- TaskId *int64 `json:"TaskId,omitempty" name:"TaskId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModfiyInstancePasswordResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModfiyInstancePasswordResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyAutoBackupConfigRequest struct {
- *tchttp.BaseRequest
-
- // 实例ID
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 日期 Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday
- WeekDays []*string `json:"WeekDays,omitempty" name:"WeekDays" list`
-
- // 时间段 00:00-01:00, 01:00-02:00...... 23:00-00:00
- TimePeriod *string `json:"TimePeriod,omitempty" name:"TimePeriod"`
-
- // 自动备份类型: 1 “定时回档”
- AutoBackupType *int64 `json:"AutoBackupType,omitempty" name:"AutoBackupType"`
-}
-
-func (r *ModifyAutoBackupConfigRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyAutoBackupConfigRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyAutoBackupConfigResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 自动备份类型: 1 “定时回档”
- AutoBackupType *int64 `json:"AutoBackupType,omitempty" name:"AutoBackupType"`
-
- // 日期Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday。
- WeekDays []*string `json:"WeekDays,omitempty" name:"WeekDays" list`
-
- // 时间段 00:00-01:00, 01:00-02:00...... 23:00-00:00
- TimePeriod *string `json:"TimePeriod,omitempty" name:"TimePeriod"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyAutoBackupConfigResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyAutoBackupConfigResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyInstanceParamsRequest struct {
- *tchttp.BaseRequest
-
- // 实例Id
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 实例修改的参数列表
- InstanceParams []*InstanceParam `json:"InstanceParams,omitempty" name:"InstanceParams" list`
-}
-
-func (r *ModifyInstanceParamsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyInstanceParamsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyInstanceParamsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 修改是否成功。
- Changed *bool `json:"Changed,omitempty" name:"Changed"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyInstanceParamsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyInstanceParamsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyInstanceRequest struct {
- *tchttp.BaseRequest
-
- // 修改实例操作,如填写:rename-表示实例重命名;modifyProject-修改实例所属项目;modifyAutoRenew-修改实例续费标记
- Operation *string `json:"Operation,omitempty" name:"Operation"`
-
- // 实例Id
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 实例的新名称
- InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"`
-
- // 项目Id
- ProjectId *int64 `json:"ProjectId,omitempty" name:"ProjectId"`
-
- // 自动续费标识。0 - 默认状态(手动续费);1 - 自动续费;2 - 明确不自动续费
- AutoRenew *int64 `json:"AutoRenew,omitempty" name:"AutoRenew"`
-}
-
-func (r *ModifyInstanceRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyInstanceRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyInstanceResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyInstanceResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyInstanceResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyNetworkConfigRequest struct {
- *tchttp.BaseRequest
-
- // 实例ID
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 操作类型:changeVip——修改实例VIP;changeVpc——修改实例子网;changeBaseToVpc——基础网络转VPC网络
- Operation *string `json:"Operation,omitempty" name:"Operation"`
-
- // VIP地址,changeVip的时候填写,不填则默认分配
- Vip *string `json:"Vip,omitempty" name:"Vip"`
-
- // 私有网络ID,changeVpc、changeBaseToVpc的时候需要提供
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 子网ID,changeVpc、changeBaseToVpc的时候需要提供
- SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"`
-}
-
-func (r *ModifyNetworkConfigRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyNetworkConfigRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyNetworkConfigResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 执行状态:true|false
- Status *bool `json:"Status,omitempty" name:"Status"`
-
- // 子网ID
- SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"`
-
- // 私有网络ID
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // VIP地址
- Vip *string `json:"Vip,omitempty" name:"Vip"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyNetworkConfigResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyNetworkConfigResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ProductConf struct {
-
- // 产品类型,2-Redis主从版,3-CKV主从版,4-CKV集群版,5-Redis单机版,7-Redis集群版
- Type *int64 `json:"Type,omitempty" name:"Type"`
-
- // 产品名称,Redis主从版,CKV主从版,CKV集群版,Redis单机版,Redis集群版
- TypeName *string `json:"TypeName,omitempty" name:"TypeName"`
-
- // 购买时的最小数量
- MinBuyNum *int64 `json:"MinBuyNum,omitempty" name:"MinBuyNum"`
-
- // 购买时的最大数量
- MaxBuyNum *int64 `json:"MaxBuyNum,omitempty" name:"MaxBuyNum"`
-
- // 产品是否售罄
- Saleout *bool `json:"Saleout,omitempty" name:"Saleout"`
-
- // 产品引擎,腾讯云CKV或者社区版Redis
- Engine *string `json:"Engine,omitempty" name:"Engine"`
-
- // 兼容版本,Redis-2.8,Redis-3.2,Redis-4.0
- Version *string `json:"Version,omitempty" name:"Version"`
-
- // 规格总大小,单位G
- TotalSize []*string `json:"TotalSize,omitempty" name:"TotalSize" list`
-
- // 每个分片大小,单位G
- ShardSize []*string `json:"ShardSize,omitempty" name:"ShardSize" list`
-
- // 副本数量
- ReplicaNum []*string `json:"ReplicaNum,omitempty" name:"ReplicaNum" list`
-
- // 分片数量
- ShardNum []*string `json:"ShardNum,omitempty" name:"ShardNum" list`
-
- // 支持的计费模式,1-包年包月,0-按量计费
- PayMode *string `json:"PayMode,omitempty" name:"PayMode"`
-
- // 是否支持副本只读
- EnableRepicaReadOnly *bool `json:"EnableRepicaReadOnly,omitempty" name:"EnableRepicaReadOnly"`
-}
-
-type RedisBackupSet struct {
-
- // 开始备份的时间
- StartTime *string `json:"StartTime,omitempty" name:"StartTime"`
-
- // 备份ID
- BackupId *string `json:"BackupId,omitempty" name:"BackupId"`
-
- // 备份类型。 manualBackupInstance:用户发起的手动备份; systemBackupInstance:凌晨系统发起的备份
- BackupType *string `json:"BackupType,omitempty" name:"BackupType"`
-
- // 备份状态。 1:"备份被其它流程锁定"; 2:"备份正常,没有被任何流程锁定"; -1:"备份已过期"; 3:"备份正在被导出"; 4:"备份导出成功"
- Status *int64 `json:"Status,omitempty" name:"Status"`
-
- // 备份的备注信息
- Remark *string `json:"Remark,omitempty" name:"Remark"`
-
- // 备份是否被锁定,0:未被锁定;1:已被锁定
- Locked *int64 `json:"Locked,omitempty" name:"Locked"`
-}
-
-type RegionConf struct {
-
- // 地域ID
- RegionId *string `json:"RegionId,omitempty" name:"RegionId"`
-
- // 地域名称
- RegionName *string `json:"RegionName,omitempty" name:"RegionName"`
-
- // 地域简称
- RegionShortName *string `json:"RegionShortName,omitempty" name:"RegionShortName"`
-
- // 地域所在大区名称
- Area *string `json:"Area,omitempty" name:"Area"`
-
- // 可用区信息
- ZoneSet []*ZoneCapacityConf `json:"ZoneSet,omitempty" name:"ZoneSet" list`
-}
-
-type RenewInstanceRequest struct {
- *tchttp.BaseRequest
-
- // 购买时长,单位:月
- Period *uint64 `json:"Period,omitempty" name:"Period"`
-
- // 实例ID
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *RenewInstanceRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RenewInstanceRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RenewInstanceResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 交易Id
- DealId *string `json:"DealId,omitempty" name:"DealId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *RenewInstanceResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RenewInstanceResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ResetPasswordRequest struct {
- *tchttp.BaseRequest
-
- // 重置的密码
- Password *string `json:"Password,omitempty" name:"Password"`
-
- // Redis实例ID
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *ResetPasswordRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ResetPasswordRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ResetPasswordResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 任务ID
- TaskId *int64 `json:"TaskId,omitempty" name:"TaskId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ResetPasswordResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ResetPasswordResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RestoreInstanceRequest struct {
- *tchttp.BaseRequest
-
- // 待操作的实例ID,可通过 DescribeRedis 接口返回值中的 redisId 获取。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 实例密码,恢复实例时,需要校验实例密码
- Password *string `json:"Password,omitempty" name:"Password"`
-
- // 备份ID,可通过 GetRedisBackupList 接口返回值中的 backupId 获取
- BackupId *string `json:"BackupId,omitempty" name:"BackupId"`
-}
-
-func (r *RestoreInstanceRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RestoreInstanceRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RestoreInstanceResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 任务ID,可通过 DescribeTaskInfo 接口查询任务执行状态
- TaskId *int64 `json:"TaskId,omitempty" name:"TaskId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *RestoreInstanceResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RestoreInstanceResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type SecurityGroupDetail struct {
-
- // 项目Id
- ProjectId *int64 `json:"ProjectId,omitempty" name:"ProjectId"`
-
- // 创建时间
- CreateTime *string `json:"CreateTime,omitempty" name:"CreateTime"`
-
- // 安全组Id
- SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"`
-
- // 安全组名称
- SecurityGroupName *string `json:"SecurityGroupName,omitempty" name:"SecurityGroupName"`
-
- // 安全组标记
- SecurityGroupRemark *string `json:"SecurityGroupRemark,omitempty" name:"SecurityGroupRemark"`
-
- // 安全组入站规则
- InboundRule []*SecurityGroupsInboundAndOutbound `json:"InboundRule,omitempty" name:"InboundRule" list`
-
- // 安全组出站规则
- OutboundRule []*SecurityGroupsInboundAndOutbound `json:"OutboundRule,omitempty" name:"OutboundRule" list`
-}
-
-type SecurityGroupsInboundAndOutbound struct {
-
- // 执行动作
- Action *string `json:"Action,omitempty" name:"Action"`
-
- // IP地址
- Ip *string `json:"Ip,omitempty" name:"Ip"`
-
- // 端口号
- Port *string `json:"Port,omitempty" name:"Port"`
-
- // 协议类型
- Proto *string `json:"Proto,omitempty" name:"Proto"`
-}
-
-type TradeDealDetail struct {
-
- // 订单号ID,调用云API时使用此ID
- DealId *string `json:"DealId,omitempty" name:"DealId"`
-
- // 长订单ID,反馈订单问题给官方客服使用此ID
- DealName *string `json:"DealName,omitempty" name:"DealName"`
-
- // 可用区id
- ZoneId *int64 `json:"ZoneId,omitempty" name:"ZoneId"`
-
- // 订单关联的实例数
- GoodsNum *int64 `json:"GoodsNum,omitempty" name:"GoodsNum"`
-
- // 创建用户uin
- Creater *string `json:"Creater,omitempty" name:"Creater"`
-
- // 订单创建时间
- CreatTime *string `json:"CreatTime,omitempty" name:"CreatTime"`
-
- // 订单超时时间
- OverdueTime *string `json:"OverdueTime,omitempty" name:"OverdueTime"`
-
- // 订单完成时间
- EndTime *string `json:"EndTime,omitempty" name:"EndTime"`
-
- // 订单状态 1:未支付 2:已支付,未发货 3:发货中 4:发货成功 5:发货失败 6:已退款 7:已关闭订单 8:订单过期 9:订单已失效 10:产品已失效 11:代付拒绝 12:支付中
- Status *int64 `json:"Status,omitempty" name:"Status"`
-
- // 订单状态描述
- Description *string `json:"Description,omitempty" name:"Description"`
-
- // 订单实际总价,单位:分
- Price *int64 `json:"Price,omitempty" name:"Price"`
-
- // 实例ID
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-}
-
-type UpgradeInstanceRequest struct {
- *tchttp.BaseRequest
-
- // 实例Id
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 分片大小 单位 MB
- MemSize *uint64 `json:"MemSize,omitempty" name:"MemSize"`
-
- // 分片数量,Redis2.8主从版、CKV主从版和Redis2.8单机版不需要填写
- RedisShardNum *uint64 `json:"RedisShardNum,omitempty" name:"RedisShardNum"`
-
- // 副本数量,Redis2.8主从版、CKV主从版和Redis2.8单机版不需要填写
- RedisReplicasNum *uint64 `json:"RedisReplicasNum,omitempty" name:"RedisReplicasNum"`
-}
-
-func (r *UpgradeInstanceRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *UpgradeInstanceRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type UpgradeInstanceResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 订单ID
- DealId *string `json:"DealId,omitempty" name:"DealId"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *UpgradeInstanceResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *UpgradeInstanceResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ZoneCapacityConf struct {
-
- // 可用区ID:如ap-guangzhou-3
- ZoneId *string `json:"ZoneId,omitempty" name:"ZoneId"`
-
- // 可用区名称
- ZoneName *string `json:"ZoneName,omitempty" name:"ZoneName"`
-
- // 可用区是否售罄
- IsSaleout *bool `json:"IsSaleout,omitempty" name:"IsSaleout"`
-
- // 是否为默认可用区
- IsDefault *bool `json:"IsDefault,omitempty" name:"IsDefault"`
-
- // 网络类型:basenet -- 基础网络;vpcnet -- VPC网络
- NetWorkType []*string `json:"NetWorkType,omitempty" name:"NetWorkType" list`
-
- // 可用区内产品规格等信息
- ProductSet []*ProductConf `json:"ProductSet,omitempty" name:"ProductSet" list`
-
- // 可用区ID:如100003
- OldZoneId *int64 `json:"OldZoneId,omitempty" name:"OldZoneId"`
-}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312/client.go
deleted file mode 100644
index 7fe9670..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312/client.go
+++ /dev/null
@@ -1,3967 +0,0 @@
-// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package v20170312
-
-import (
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
- tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http"
- "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
-)
-
-const APIVersion = "2017-03-12"
-
-type Client struct {
- common.Client
-}
-
-// Deprecated
-func NewClientWithSecretId(secretId, secretKey, region string) (client *Client, err error) {
- cpf := profile.NewClientProfile()
- client = &Client{}
- client.Init(region).WithSecretId(secretId, secretKey).WithProfile(cpf)
- return
-}
-
-func NewClient(credential *common.Credential, region string, clientProfile *profile.ClientProfile) (client *Client, err error) {
- client = &Client{}
- client.Init(region).
- WithCredential(credential).
- WithProfile(clientProfile)
- return
-}
-
-
-func NewAcceptAttachCcnInstancesRequest() (request *AcceptAttachCcnInstancesRequest) {
- request = &AcceptAttachCcnInstancesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "AcceptAttachCcnInstances")
- return
-}
-
-func NewAcceptAttachCcnInstancesResponse() (response *AcceptAttachCcnInstancesResponse) {
- response = &AcceptAttachCcnInstancesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(AcceptAttachCcnInstances)用于跨账号关联实例时,云联网所有者接受并同意关联操作。
-func (c *Client) AcceptAttachCcnInstances(request *AcceptAttachCcnInstancesRequest) (response *AcceptAttachCcnInstancesResponse, err error) {
- if request == nil {
- request = NewAcceptAttachCcnInstancesRequest()
- }
- response = NewAcceptAttachCcnInstancesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewAddBandwidthPackageResourcesRequest() (request *AddBandwidthPackageResourcesRequest) {
- request = &AddBandwidthPackageResourcesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "AddBandwidthPackageResources")
- return
-}
-
-func NewAddBandwidthPackageResourcesResponse() (response *AddBandwidthPackageResourcesResponse) {
- response = &AddBandwidthPackageResourcesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 接口用于添加带宽包资源,包括[弹性公网IP](https://cloud.tencent.com/document/product/213/1941)和[负载均衡](https://cloud.tencent.com/document/product/214/517)等
-func (c *Client) AddBandwidthPackageResources(request *AddBandwidthPackageResourcesRequest) (response *AddBandwidthPackageResourcesResponse, err error) {
- if request == nil {
- request = NewAddBandwidthPackageResourcesRequest()
- }
- response = NewAddBandwidthPackageResourcesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewAddIp6RulesRequest() (request *AddIp6RulesRequest) {
- request = &AddIp6RulesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "AddIp6Rules")
- return
-}
-
-func NewAddIp6RulesResponse() (response *AddIp6RulesResponse) {
- response = &AddIp6RulesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 1. 该接口用于在转换实例下添加IPV6转换规则。
-// 2. 支持在同一个转换实例下批量添加转换规则,一个账户在一个地域最多50个。
-// 3. 一个完整的转换规则包括vip6:vport6:protocol:vip:vport,其中vip6:vport6:protocol必须是唯一。
-func (c *Client) AddIp6Rules(request *AddIp6RulesRequest) (response *AddIp6RulesResponse, err error) {
- if request == nil {
- request = NewAddIp6RulesRequest()
- }
- response = NewAddIp6RulesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewAllocateAddressesRequest() (request *AllocateAddressesRequest) {
- request = &AllocateAddressesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "AllocateAddresses")
- return
-}
-
-func NewAllocateAddressesResponse() (response *AllocateAddressesResponse) {
- response = &AllocateAddressesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (AllocateAddresses) 用于申请一个或多个[弹性公网IP](https://cloud.tencent.com/document/product/213/1941)(简称 EIP)。
-// * EIP 是专为动态云计算设计的静态 IP 地址。借助 EIP,您可以快速将 EIP 重新映射到您的另一个实例上,从而屏蔽实例故障。
-// * 您的 EIP 与腾讯云账户相关联,而不是与某个实例相关联。在您选择显式释放该地址,或欠费超过七天之前,它会一直与您的腾讯云账户保持关联。
-// * 平台对用户每地域能申请的 EIP 最大配额有所限制,可参见 [EIP 产品简介](https://cloud.tencent.com/document/product/213/5733),上述配额可通过 DescribeAddressQuota 接口获取。
-func (c *Client) AllocateAddresses(request *AllocateAddressesRequest) (response *AllocateAddressesResponse, err error) {
- if request == nil {
- request = NewAllocateAddressesRequest()
- }
- response = NewAllocateAddressesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewAssignIpv6AddressesRequest() (request *AssignIpv6AddressesRequest) {
- request = &AssignIpv6AddressesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "AssignIpv6Addresses")
- return
-}
-
-func NewAssignIpv6AddressesResponse() (response *AssignIpv6AddressesResponse) {
- response = &AssignIpv6AddressesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(AssignIpv6Addresses)用于弹性网卡申请`IPv6`地址。
-// 本接口是异步完成,如需查询异步任务执行结果,请使用本接口返回的`RequestId`轮询`QueryTask`接口。
-// * 一个弹性网卡支持绑定的IP地址是有限制的,更多资源限制信息详见弹性网卡使用限制。
-// * 可以指定`IPv6`地址申请,地址类型不能为主`IP`,`IPv6`地址暂时只支持作为辅助`IP`。
-// * 地址必须要在弹性网卡所在子网内,而且不能被占用。
-// * 在弹性网卡上申请一个到多个辅助`IPv6`地址,接口会在弹性网卡所在子网段内返回指定数量的辅助`IPv6`地址。
-func (c *Client) AssignIpv6Addresses(request *AssignIpv6AddressesRequest) (response *AssignIpv6AddressesResponse, err error) {
- if request == nil {
- request = NewAssignIpv6AddressesRequest()
- }
- response = NewAssignIpv6AddressesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewAssignIpv6CidrBlockRequest() (request *AssignIpv6CidrBlockRequest) {
- request = &AssignIpv6CidrBlockRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "AssignIpv6CidrBlock")
- return
-}
-
-func NewAssignIpv6CidrBlockResponse() (response *AssignIpv6CidrBlockResponse) {
- response = &AssignIpv6CidrBlockResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(AssignIpv6CidrBlock)用于分配IPv6网段。
-// * 使用本接口前,你需要已有VPC实例,如果没有可通过接口CreateVpc创建。
-// * 每个VPC只能申请一个IPv6网段
-func (c *Client) AssignIpv6CidrBlock(request *AssignIpv6CidrBlockRequest) (response *AssignIpv6CidrBlockResponse, err error) {
- if request == nil {
- request = NewAssignIpv6CidrBlockRequest()
- }
- response = NewAssignIpv6CidrBlockResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewAssignIpv6SubnetCidrBlockRequest() (request *AssignIpv6SubnetCidrBlockRequest) {
- request = &AssignIpv6SubnetCidrBlockRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "AssignIpv6SubnetCidrBlock")
- return
-}
-
-func NewAssignIpv6SubnetCidrBlockResponse() (response *AssignIpv6SubnetCidrBlockResponse) {
- response = &AssignIpv6SubnetCidrBlockResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(AssignIpv6SubnetCidrBlock)用于分配IPv6子网段。
-// * 给子网分配 `IPv6` 网段,要求子网所属 `VPC` 已获得 `IPv6` 网段。如果尚未分配,请先通过接口 `AssignIpv6CidrBlock` 给子网所属 `VPC` 分配一个 `IPv6` 网段。否则无法分配 `IPv6` 子网段。
-// * 每个子网只能分配一个IPv6网段。
-func (c *Client) AssignIpv6SubnetCidrBlock(request *AssignIpv6SubnetCidrBlockRequest) (response *AssignIpv6SubnetCidrBlockResponse, err error) {
- if request == nil {
- request = NewAssignIpv6SubnetCidrBlockRequest()
- }
- response = NewAssignIpv6SubnetCidrBlockResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewAssignPrivateIpAddressesRequest() (request *AssignPrivateIpAddressesRequest) {
- request = &AssignPrivateIpAddressesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "AssignPrivateIpAddresses")
- return
-}
-
-func NewAssignPrivateIpAddressesResponse() (response *AssignPrivateIpAddressesResponse) {
- response = &AssignPrivateIpAddressesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(AssignPrivateIpAddresses)用于弹性网卡申请内网 IP。
-// * 一个弹性网卡支持绑定的IP地址是有限制的,更多资源限制信息详见弹性网卡使用限制。
-// * 可以指定内网IP地址申请,内网IP地址类型不能为主IP,主IP已存在,不能修改,内网IP必须要弹性网卡所在子网内,而且不能被占用。
-// * 在弹性网卡上申请一个到多个辅助内网IP,接口会在弹性网卡所在子网网段内返回指定数量的辅助内网IP。
-func (c *Client) AssignPrivateIpAddresses(request *AssignPrivateIpAddressesRequest) (response *AssignPrivateIpAddressesResponse, err error) {
- if request == nil {
- request = NewAssignPrivateIpAddressesRequest()
- }
- response = NewAssignPrivateIpAddressesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewAssociateAddressRequest() (request *AssociateAddressRequest) {
- request = &AssociateAddressRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "AssociateAddress")
- return
-}
-
-func NewAssociateAddressResponse() (response *AssociateAddressResponse) {
- response = &AssociateAddressResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (AssociateAddress) 用于将[弹性公网IP](https://cloud.tencent.com/document/product/213/1941)(简称 EIP)绑定到实例或弹性网卡的指定内网 IP 上。
-// * 将 EIP 绑定到实例(CVM)上,其本质是将 EIP 绑定到实例上主网卡的主内网 IP 上。
-// * 将 EIP 绑定到主网卡的主内网IP上,绑定过程会把其上绑定的普通公网 IP 自动解绑并释放。
-// * 将 EIP 绑定到指定网卡的内网 IP上(非主网卡的主内网IP),则必须先解绑该 EIP,才能再绑定新的。
-// * 将 EIP 绑定到NAT网关,请使用接口[EipBindNatGateway](https://cloud.tencent.com/document/product/215/4093)
-// * EIP 如果欠费或被封堵,则不能被绑定。
-// * 只有状态为 UNBIND 的 EIP 才能够被绑定。
-func (c *Client) AssociateAddress(request *AssociateAddressRequest) (response *AssociateAddressResponse, err error) {
- if request == nil {
- request = NewAssociateAddressRequest()
- }
- response = NewAssociateAddressResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewAttachCcnInstancesRequest() (request *AttachCcnInstancesRequest) {
- request = &AttachCcnInstancesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "AttachCcnInstances")
- return
-}
-
-func NewAttachCcnInstancesResponse() (response *AttachCcnInstancesResponse) {
- response = &AttachCcnInstancesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(AttachCcnInstances)用于将网络实例加载到云联网实例中,网络实例包括VPC和专线网关。
-// 每个云联网能够关联的网络实例个数是有限的,详请参考产品文档。如果需要扩充请联系在线客服。
-func (c *Client) AttachCcnInstances(request *AttachCcnInstancesRequest) (response *AttachCcnInstancesResponse, err error) {
- if request == nil {
- request = NewAttachCcnInstancesRequest()
- }
- response = NewAttachCcnInstancesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewAttachClassicLinkVpcRequest() (request *AttachClassicLinkVpcRequest) {
- request = &AttachClassicLinkVpcRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "AttachClassicLinkVpc")
- return
-}
-
-func NewAttachClassicLinkVpcResponse() (response *AttachClassicLinkVpcResponse) {
- response = &AttachClassicLinkVpcResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(AttachClassicLinkVpc)用于创建私有网络和基础网络设备互通。
-// * 私有网络和基础网络设备必须在同一个地域。
-// * 私有网络和基础网络的区别详见vpc产品文档-私有网络与基础网络。
-func (c *Client) AttachClassicLinkVpc(request *AttachClassicLinkVpcRequest) (response *AttachClassicLinkVpcResponse, err error) {
- if request == nil {
- request = NewAttachClassicLinkVpcRequest()
- }
- response = NewAttachClassicLinkVpcResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewAttachNetworkInterfaceRequest() (request *AttachNetworkInterfaceRequest) {
- request = &AttachNetworkInterfaceRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "AttachNetworkInterface")
- return
-}
-
-func NewAttachNetworkInterfaceResponse() (response *AttachNetworkInterfaceResponse) {
- response = &AttachNetworkInterfaceResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(AttachNetworkInterface)用于弹性网卡绑定云主机。
-// * 一个云主机可以绑定多个弹性网卡,但只能绑定一个主网卡。更多限制信息详见弹性网卡使用限制。
-// * 一个弹性网卡只能同时绑定一个云主机。
-// * 只有运行中或者已关机状态的云主机才能绑定弹性网卡,查看云主机状态详见腾讯云主机信息。
-// * 弹性网卡绑定的云主机必须是私有网络的,而且云主机所在可用区必须和弹性网卡子网的可用区相同。
-func (c *Client) AttachNetworkInterface(request *AttachNetworkInterfaceRequest) (response *AttachNetworkInterfaceResponse, err error) {
- if request == nil {
- request = NewAttachNetworkInterfaceRequest()
- }
- response = NewAttachNetworkInterfaceResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateAddressTemplateRequest() (request *CreateAddressTemplateRequest) {
- request = &CreateAddressTemplateRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "CreateAddressTemplate")
- return
-}
-
-func NewCreateAddressTemplateResponse() (response *CreateAddressTemplateResponse) {
- response = &CreateAddressTemplateResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateAddressTemplate)用于创建IP地址模版
-func (c *Client) CreateAddressTemplate(request *CreateAddressTemplateRequest) (response *CreateAddressTemplateResponse, err error) {
- if request == nil {
- request = NewCreateAddressTemplateRequest()
- }
- response = NewCreateAddressTemplateResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateAddressTemplateGroupRequest() (request *CreateAddressTemplateGroupRequest) {
- request = &CreateAddressTemplateGroupRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "CreateAddressTemplateGroup")
- return
-}
-
-func NewCreateAddressTemplateGroupResponse() (response *CreateAddressTemplateGroupResponse) {
- response = &CreateAddressTemplateGroupResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateAddressTemplateGroup)用于创建IP地址模版集合
-func (c *Client) CreateAddressTemplateGroup(request *CreateAddressTemplateGroupRequest) (response *CreateAddressTemplateGroupResponse, err error) {
- if request == nil {
- request = NewCreateAddressTemplateGroupRequest()
- }
- response = NewCreateAddressTemplateGroupResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateBandwidthPackageRequest() (request *CreateBandwidthPackageRequest) {
- request = &CreateBandwidthPackageRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "CreateBandwidthPackage")
- return
-}
-
-func NewCreateBandwidthPackageResponse() (response *CreateBandwidthPackageResponse) {
- response = &CreateBandwidthPackageResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 接口支持创建[设备带宽包](https://cloud.tencent.com/document/product/684/15246#.E8.AE.BE.E5.A4.87.E5.B8.A6.E5.AE.BD.E5.8C.85)和[ip带宽包](https://cloud.tencent.com/document/product/684/15246#ip-.E5.B8.A6.E5.AE.BD.E5.8C.85)
-func (c *Client) CreateBandwidthPackage(request *CreateBandwidthPackageRequest) (response *CreateBandwidthPackageResponse, err error) {
- if request == nil {
- request = NewCreateBandwidthPackageRequest()
- }
- response = NewCreateBandwidthPackageResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateCcnRequest() (request *CreateCcnRequest) {
- request = &CreateCcnRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "CreateCcn")
- return
-}
-
-func NewCreateCcnResponse() (response *CreateCcnResponse) {
- response = &CreateCcnResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateCcn)用于创建云联网(CCN)。
-// 每个账号能创建的云联网实例个数是有限的,详请参考产品文档。如果需要扩充请联系在线客服。
-func (c *Client) CreateCcn(request *CreateCcnRequest) (response *CreateCcnResponse, err error) {
- if request == nil {
- request = NewCreateCcnRequest()
- }
- response = NewCreateCcnResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateCustomerGatewayRequest() (request *CreateCustomerGatewayRequest) {
- request = &CreateCustomerGatewayRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "CreateCustomerGateway")
- return
-}
-
-func NewCreateCustomerGatewayResponse() (response *CreateCustomerGatewayResponse) {
- response = &CreateCustomerGatewayResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateCustomerGateway)用于创建对端网关。
-func (c *Client) CreateCustomerGateway(request *CreateCustomerGatewayRequest) (response *CreateCustomerGatewayResponse, err error) {
- if request == nil {
- request = NewCreateCustomerGatewayRequest()
- }
- response = NewCreateCustomerGatewayResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateDefaultVpcRequest() (request *CreateDefaultVpcRequest) {
- request = &CreateDefaultVpcRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "CreateDefaultVpc")
- return
-}
-
-func NewCreateDefaultVpcResponse() (response *CreateDefaultVpcResponse) {
- response = &CreateDefaultVpcResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateDefaultVpc)用于创建默认私有网络(VPC)。
-//
-// 默认VPC适用于快速入门和启动公共实例,您可以像使用任何其他VPC一样使用默认VPC。如果你想创建标准VPC,即指定VPC名称、VPC网段、子网网段、子网可用区,请使用常规创建VPC接口(CreateVpc)
-//
-// 正常情况,本接口并不一定生产默认VPC,而是根据用户账号的网络属性(DescribeAccountAttributes)来决定的
-// * 支持基础网络、VPC,返回VpcId为0
-// * 只支持VPC,返回默认VPC信息
-//
-// 你也可以通过 Force 参数,强制返回默认VPC
-func (c *Client) CreateDefaultVpc(request *CreateDefaultVpcRequest) (response *CreateDefaultVpcResponse, err error) {
- if request == nil {
- request = NewCreateDefaultVpcRequest()
- }
- response = NewCreateDefaultVpcResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateDirectConnectGatewayRequest() (request *CreateDirectConnectGatewayRequest) {
- request = &CreateDirectConnectGatewayRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "CreateDirectConnectGateway")
- return
-}
-
-func NewCreateDirectConnectGatewayResponse() (response *CreateDirectConnectGatewayResponse) {
- response = &CreateDirectConnectGatewayResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateDirectConnectGateway)用于创建专线网关。
-func (c *Client) CreateDirectConnectGateway(request *CreateDirectConnectGatewayRequest) (response *CreateDirectConnectGatewayResponse, err error) {
- if request == nil {
- request = NewCreateDirectConnectGatewayRequest()
- }
- response = NewCreateDirectConnectGatewayResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateDirectConnectGatewayCcnRoutesRequest() (request *CreateDirectConnectGatewayCcnRoutesRequest) {
- request = &CreateDirectConnectGatewayCcnRoutesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "CreateDirectConnectGatewayCcnRoutes")
- return
-}
-
-func NewCreateDirectConnectGatewayCcnRoutesResponse() (response *CreateDirectConnectGatewayCcnRoutesResponse) {
- response = &CreateDirectConnectGatewayCcnRoutesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateDirectConnectGatewayCcnRoutes)用于创建专线网关的云联网路由(IDC网段)
-func (c *Client) CreateDirectConnectGatewayCcnRoutes(request *CreateDirectConnectGatewayCcnRoutesRequest) (response *CreateDirectConnectGatewayCcnRoutesResponse, err error) {
- if request == nil {
- request = NewCreateDirectConnectGatewayCcnRoutesRequest()
- }
- response = NewCreateDirectConnectGatewayCcnRoutesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateFlowLogRequest() (request *CreateFlowLogRequest) {
- request = &CreateFlowLogRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "CreateFlowLog")
- return
-}
-
-func NewCreateFlowLogResponse() (response *CreateFlowLogResponse) {
- response = &CreateFlowLogResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateFlowLog)用于创建流日志
-func (c *Client) CreateFlowLog(request *CreateFlowLogRequest) (response *CreateFlowLogResponse, err error) {
- if request == nil {
- request = NewCreateFlowLogRequest()
- }
- response = NewCreateFlowLogResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateHaVipRequest() (request *CreateHaVipRequest) {
- request = &CreateHaVipRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "CreateHaVip")
- return
-}
-
-func NewCreateHaVipResponse() (response *CreateHaVipResponse) {
- response = &CreateHaVipResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateHaVip)用于创建高可用虚拟IP(HAVIP)
-func (c *Client) CreateHaVip(request *CreateHaVipRequest) (response *CreateHaVipResponse, err error) {
- if request == nil {
- request = NewCreateHaVipRequest()
- }
- response = NewCreateHaVipResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateIp6TranslatorsRequest() (request *CreateIp6TranslatorsRequest) {
- request = &CreateIp6TranslatorsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "CreateIp6Translators")
- return
-}
-
-func NewCreateIp6TranslatorsResponse() (response *CreateIp6TranslatorsResponse) {
- response = &CreateIp6TranslatorsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 1. 该接口用于创建IPV6转换IPV4实例,支持批量
-// 2. 同一个账户在在一个地域最多允许创建10个转换实例
-func (c *Client) CreateIp6Translators(request *CreateIp6TranslatorsRequest) (response *CreateIp6TranslatorsResponse, err error) {
- if request == nil {
- request = NewCreateIp6TranslatorsRequest()
- }
- response = NewCreateIp6TranslatorsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateNetworkInterfaceRequest() (request *CreateNetworkInterfaceRequest) {
- request = &CreateNetworkInterfaceRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "CreateNetworkInterface")
- return
-}
-
-func NewCreateNetworkInterfaceResponse() (response *CreateNetworkInterfaceResponse) {
- response = &CreateNetworkInterfaceResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateNetworkInterface)用于创建弹性网卡。
-// * 创建弹性网卡时可以指定内网IP,并且可以指定一个主IP,指定的内网IP必须在弹性网卡所在子网内,而且不能被占用。
-// * 创建弹性网卡时可以指定需要申请的内网IP数量,系统会随机生成内网IP地址。
-// * 一个弹性网卡支持绑定的IP地址是有限制的,更多资源限制信息详见弹性网卡使用限制。
-// * 创建弹性网卡同时可以绑定已有安全组。
-func (c *Client) CreateNetworkInterface(request *CreateNetworkInterfaceRequest) (response *CreateNetworkInterfaceResponse, err error) {
- if request == nil {
- request = NewCreateNetworkInterfaceRequest()
- }
- response = NewCreateNetworkInterfaceResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateRouteTableRequest() (request *CreateRouteTableRequest) {
- request = &CreateRouteTableRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "CreateRouteTable")
- return
-}
-
-func NewCreateRouteTableResponse() (response *CreateRouteTableResponse) {
- response = &CreateRouteTableResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateRouteTable)用于创建路由表。
-// * 创建了VPC后,系统会创建一个默认路由表,所有新建的子网都会关联到默认路由表。默认情况下您可以直接使用默认路由表来管理您的路由策略。当您的路由策略较多时,您可以调用创建路由表接口创建更多路由表管理您的路由策略。
-func (c *Client) CreateRouteTable(request *CreateRouteTableRequest) (response *CreateRouteTableResponse, err error) {
- if request == nil {
- request = NewCreateRouteTableRequest()
- }
- response = NewCreateRouteTableResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateRoutesRequest() (request *CreateRoutesRequest) {
- request = &CreateRoutesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "CreateRoutes")
- return
-}
-
-func NewCreateRoutesResponse() (response *CreateRoutesResponse) {
- response = &CreateRoutesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateRoutes)用于创建路由策略。
-// * 向指定路由表批量新增路由策略。
-func (c *Client) CreateRoutes(request *CreateRoutesRequest) (response *CreateRoutesResponse, err error) {
- if request == nil {
- request = NewCreateRoutesRequest()
- }
- response = NewCreateRoutesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateSecurityGroupRequest() (request *CreateSecurityGroupRequest) {
- request = &CreateSecurityGroupRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "CreateSecurityGroup")
- return
-}
-
-func NewCreateSecurityGroupResponse() (response *CreateSecurityGroupResponse) {
- response = &CreateSecurityGroupResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateSecurityGroup)用于创建新的安全组(SecurityGroup)。
-// * 每个账户下每个地域的每个项目的安全组数量限制。
-// * 新建的安全组的入站和出站规则默认都是全部拒绝,在创建后通常您需要再调用CreateSecurityGroupPolicies将安全组的规则设置为需要的规则。
-func (c *Client) CreateSecurityGroup(request *CreateSecurityGroupRequest) (response *CreateSecurityGroupResponse, err error) {
- if request == nil {
- request = NewCreateSecurityGroupRequest()
- }
- response = NewCreateSecurityGroupResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateSecurityGroupPoliciesRequest() (request *CreateSecurityGroupPoliciesRequest) {
- request = &CreateSecurityGroupPoliciesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "CreateSecurityGroupPolicies")
- return
-}
-
-func NewCreateSecurityGroupPoliciesResponse() (response *CreateSecurityGroupPoliciesResponse) {
- response = &CreateSecurityGroupPoliciesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateSecurityGroupPolicies)用于创建安全组规则(SecurityGroupPolicy)。
-//
-// * Version安全组规则版本号,用户每次更新安全规则版本会自动加1,防止你更新的路由规则已过期,不填不考虑冲突。
-// * Protocol字段支持输入TCP, UDP, ICMP, GRE, ALL。
-// * CidrBlock字段允许输入符合cidr格式标准的任意字符串。(展开)在基础网络中,如果CidrBlock包含您的账户内的云服务器之外的设备在腾讯云的内网IP,并不代表此规则允许您访问这些设备,租户之间网络隔离规则优先于安全组中的内网规则。
-// * SecurityGroupId字段允许输入与待修改的安全组位于相同项目中的安全组ID,包括这个安全组ID本身,代表安全组下所有云服务器的内网IP。使用这个字段时,这条规则用来匹配网络报文的过程中会随着被使用的这个ID所关联的云服务器变化而变化,不需要重新修改。
-// * Port字段允许输入一个单独端口号,或者用减号分隔的两个端口号代表端口范围,例如80或8000-8010。只有当Protocol字段是TCP或UDP时,Port字段才被接受,即Protocol字段不是TCP或UDP时,Protocol和Port排他关系,不允许同时输入,否则会接口报错。
-// * Action字段只允许输入ACCEPT或DROP。
-// * CidrBlock, SecurityGroupId, AddressTemplate三者是排他关系,不允许同时输入,Protocol + Port和ServiceTemplate二者是排他关系,不允许同时输入。
-// * 一次请求中只能创建单个方向的规则, 如果需要指定索引(PolicyIndex)参数, 多条规则的索引必须一致。
-func (c *Client) CreateSecurityGroupPolicies(request *CreateSecurityGroupPoliciesRequest) (response *CreateSecurityGroupPoliciesResponse, err error) {
- if request == nil {
- request = NewCreateSecurityGroupPoliciesRequest()
- }
- response = NewCreateSecurityGroupPoliciesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateServiceTemplateRequest() (request *CreateServiceTemplateRequest) {
- request = &CreateServiceTemplateRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "CreateServiceTemplate")
- return
-}
-
-func NewCreateServiceTemplateResponse() (response *CreateServiceTemplateResponse) {
- response = &CreateServiceTemplateResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateServiceTemplate)用于创建协议端口模板
-func (c *Client) CreateServiceTemplate(request *CreateServiceTemplateRequest) (response *CreateServiceTemplateResponse, err error) {
- if request == nil {
- request = NewCreateServiceTemplateRequest()
- }
- response = NewCreateServiceTemplateResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateServiceTemplateGroupRequest() (request *CreateServiceTemplateGroupRequest) {
- request = &CreateServiceTemplateGroupRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "CreateServiceTemplateGroup")
- return
-}
-
-func NewCreateServiceTemplateGroupResponse() (response *CreateServiceTemplateGroupResponse) {
- response = &CreateServiceTemplateGroupResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateServiceTemplateGroup)用于创建协议端口模板集合
-func (c *Client) CreateServiceTemplateGroup(request *CreateServiceTemplateGroupRequest) (response *CreateServiceTemplateGroupResponse, err error) {
- if request == nil {
- request = NewCreateServiceTemplateGroupRequest()
- }
- response = NewCreateServiceTemplateGroupResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateSubnetRequest() (request *CreateSubnetRequest) {
- request = &CreateSubnetRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "CreateSubnet")
- return
-}
-
-func NewCreateSubnetResponse() (response *CreateSubnetResponse) {
- response = &CreateSubnetResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateSubnet)用于创建子网。
-// * 创建子网前必须创建好 VPC。
-// * 子网创建成功后,子网网段不能修改。子网网段必须在VPC网段内,可以和VPC网段相同(VPC有且只有一个子网时),建议子网网段在VPC网段内,预留网段给其他子网使用。
-// * 你可以创建的最小网段子网掩码为28(有16个IP地址),最大网段子网掩码为16(65,536个IP地址)。
-// * 同一个VPC内,多个子网的网段不能重叠。
-// * 子网创建后会自动关联到默认路由表。
-func (c *Client) CreateSubnet(request *CreateSubnetRequest) (response *CreateSubnetResponse, err error) {
- if request == nil {
- request = NewCreateSubnetRequest()
- }
- response = NewCreateSubnetResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateSubnetsRequest() (request *CreateSubnetsRequest) {
- request = &CreateSubnetsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "CreateSubnets")
- return
-}
-
-func NewCreateSubnetsResponse() (response *CreateSubnetsResponse) {
- response = &CreateSubnetsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateSubnets)用于批量创建子网。
-// * 创建子网前必须创建好 VPC。
-// * 子网创建成功后,子网网段不能修改。子网网段必须在VPC网段内,可以和VPC网段相同(VPC有且只有一个子网时),建议子网网段在VPC网段内,预留网段给其他子网使用。
-// * 你可以创建的最小网段子网掩码为28(有16个IP地址),最大网段子网掩码为16(65,536个IP地址)。
-// * 同一个VPC内,多个子网的网段不能重叠。
-// * 子网创建后会自动关联到默认路由表。
-func (c *Client) CreateSubnets(request *CreateSubnetsRequest) (response *CreateSubnetsResponse, err error) {
- if request == nil {
- request = NewCreateSubnetsRequest()
- }
- response = NewCreateSubnetsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateVpcRequest() (request *CreateVpcRequest) {
- request = &CreateVpcRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "CreateVpc")
- return
-}
-
-func NewCreateVpcResponse() (response *CreateVpcResponse) {
- response = &CreateVpcResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateVpc)用于创建私有网络(VPC)。
-// * 用户可以创建的最小网段子网掩码为28(有16个IP地址),最大网段子网掩码为16(65,536个IP地址),如果规划VPC网段请参见VPC网段规划说明。
-// * 同一个地域能创建的VPC资源个数也是有限制的,详见 VPC使用限制,如果需要扩充请联系在线客服。
-func (c *Client) CreateVpc(request *CreateVpcRequest) (response *CreateVpcResponse, err error) {
- if request == nil {
- request = NewCreateVpcRequest()
- }
- response = NewCreateVpcResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateVpnConnectionRequest() (request *CreateVpnConnectionRequest) {
- request = &CreateVpnConnectionRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "CreateVpnConnection")
- return
-}
-
-func NewCreateVpnConnectionResponse() (response *CreateVpnConnectionResponse) {
- response = &CreateVpnConnectionResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateVpnConnection)用于创建VPN通道。
-func (c *Client) CreateVpnConnection(request *CreateVpnConnectionRequest) (response *CreateVpnConnectionResponse, err error) {
- if request == nil {
- request = NewCreateVpnConnectionRequest()
- }
- response = NewCreateVpnConnectionResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewCreateVpnGatewayRequest() (request *CreateVpnGatewayRequest) {
- request = &CreateVpnGatewayRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "CreateVpnGateway")
- return
-}
-
-func NewCreateVpnGatewayResponse() (response *CreateVpnGatewayResponse) {
- response = &CreateVpnGatewayResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(CreateVpnGateway)用于创建VPN网关。
-func (c *Client) CreateVpnGateway(request *CreateVpnGatewayRequest) (response *CreateVpnGatewayResponse, err error) {
- if request == nil {
- request = NewCreateVpnGatewayRequest()
- }
- response = NewCreateVpnGatewayResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteAddressTemplateRequest() (request *DeleteAddressTemplateRequest) {
- request = &DeleteAddressTemplateRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DeleteAddressTemplate")
- return
-}
-
-func NewDeleteAddressTemplateResponse() (response *DeleteAddressTemplateResponse) {
- response = &DeleteAddressTemplateResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DeleteAddressTemplate)用于删除IP地址模板
-func (c *Client) DeleteAddressTemplate(request *DeleteAddressTemplateRequest) (response *DeleteAddressTemplateResponse, err error) {
- if request == nil {
- request = NewDeleteAddressTemplateRequest()
- }
- response = NewDeleteAddressTemplateResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteAddressTemplateGroupRequest() (request *DeleteAddressTemplateGroupRequest) {
- request = &DeleteAddressTemplateGroupRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DeleteAddressTemplateGroup")
- return
-}
-
-func NewDeleteAddressTemplateGroupResponse() (response *DeleteAddressTemplateGroupResponse) {
- response = &DeleteAddressTemplateGroupResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DeleteAddressTemplateGroup)用于删除IP地址模板集合
-func (c *Client) DeleteAddressTemplateGroup(request *DeleteAddressTemplateGroupRequest) (response *DeleteAddressTemplateGroupResponse, err error) {
- if request == nil {
- request = NewDeleteAddressTemplateGroupRequest()
- }
- response = NewDeleteAddressTemplateGroupResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteBandwidthPackageRequest() (request *DeleteBandwidthPackageRequest) {
- request = &DeleteBandwidthPackageRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DeleteBandwidthPackage")
- return
-}
-
-func NewDeleteBandwidthPackageResponse() (response *DeleteBandwidthPackageResponse) {
- response = &DeleteBandwidthPackageResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 接口支持删除共享带宽包,包括[设备带宽包](https://cloud.tencent.com/document/product/684/15246#.E8.AE.BE.E5.A4.87.E5.B8.A6.E5.AE.BD.E5.8C.85)和[ip带宽包](https://cloud.tencent.com/document/product/684/15246#ip-.E5.B8.A6.E5.AE.BD.E5.8C.85)
-func (c *Client) DeleteBandwidthPackage(request *DeleteBandwidthPackageRequest) (response *DeleteBandwidthPackageResponse, err error) {
- if request == nil {
- request = NewDeleteBandwidthPackageRequest()
- }
- response = NewDeleteBandwidthPackageResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteCcnRequest() (request *DeleteCcnRequest) {
- request = &DeleteCcnRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DeleteCcn")
- return
-}
-
-func NewDeleteCcnResponse() (response *DeleteCcnResponse) {
- response = &DeleteCcnResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DeleteCcn)用于删除云联网。
-// * 删除后,云联网关联的所有实例间路由将被删除,网络将会中断,请务必确认
-// * 删除云联网是不可逆的操作,请谨慎处理。
-func (c *Client) DeleteCcn(request *DeleteCcnRequest) (response *DeleteCcnResponse, err error) {
- if request == nil {
- request = NewDeleteCcnRequest()
- }
- response = NewDeleteCcnResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteCustomerGatewayRequest() (request *DeleteCustomerGatewayRequest) {
- request = &DeleteCustomerGatewayRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DeleteCustomerGateway")
- return
-}
-
-func NewDeleteCustomerGatewayResponse() (response *DeleteCustomerGatewayResponse) {
- response = &DeleteCustomerGatewayResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DeleteCustomerGateway)用于删除对端网关。
-func (c *Client) DeleteCustomerGateway(request *DeleteCustomerGatewayRequest) (response *DeleteCustomerGatewayResponse, err error) {
- if request == nil {
- request = NewDeleteCustomerGatewayRequest()
- }
- response = NewDeleteCustomerGatewayResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteDirectConnectGatewayRequest() (request *DeleteDirectConnectGatewayRequest) {
- request = &DeleteDirectConnectGatewayRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DeleteDirectConnectGateway")
- return
-}
-
-func NewDeleteDirectConnectGatewayResponse() (response *DeleteDirectConnectGatewayResponse) {
- response = &DeleteDirectConnectGatewayResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DeleteDirectConnectGateway)用于删除专线网关。
-// 如果是 NAT 网关,删除专线网关后,NAT 规则以及 ACL 策略都被清理了。
-// 删除专线网关后,系统会删除路由表中跟该专线网关相关的路由策略。
-// 本接口是异步完成,如需查询异步任务执行结果,请使用本接口返回的`RequestId`轮询`QueryTask`接口
-func (c *Client) DeleteDirectConnectGateway(request *DeleteDirectConnectGatewayRequest) (response *DeleteDirectConnectGatewayResponse, err error) {
- if request == nil {
- request = NewDeleteDirectConnectGatewayRequest()
- }
- response = NewDeleteDirectConnectGatewayResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteDirectConnectGatewayCcnRoutesRequest() (request *DeleteDirectConnectGatewayCcnRoutesRequest) {
- request = &DeleteDirectConnectGatewayCcnRoutesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DeleteDirectConnectGatewayCcnRoutes")
- return
-}
-
-func NewDeleteDirectConnectGatewayCcnRoutesResponse() (response *DeleteDirectConnectGatewayCcnRoutesResponse) {
- response = &DeleteDirectConnectGatewayCcnRoutesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DeleteDirectConnectGatewayCcnRoutes)用于删除专线网关的云联网路由(IDC网段)
-func (c *Client) DeleteDirectConnectGatewayCcnRoutes(request *DeleteDirectConnectGatewayCcnRoutesRequest) (response *DeleteDirectConnectGatewayCcnRoutesResponse, err error) {
- if request == nil {
- request = NewDeleteDirectConnectGatewayCcnRoutesRequest()
- }
- response = NewDeleteDirectConnectGatewayCcnRoutesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteFlowLogRequest() (request *DeleteFlowLogRequest) {
- request = &DeleteFlowLogRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DeleteFlowLog")
- return
-}
-
-func NewDeleteFlowLogResponse() (response *DeleteFlowLogResponse) {
- response = &DeleteFlowLogResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DeleteFlowLog)用于删除流日志
-func (c *Client) DeleteFlowLog(request *DeleteFlowLogRequest) (response *DeleteFlowLogResponse, err error) {
- if request == nil {
- request = NewDeleteFlowLogRequest()
- }
- response = NewDeleteFlowLogResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteHaVipRequest() (request *DeleteHaVipRequest) {
- request = &DeleteHaVipRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DeleteHaVip")
- return
-}
-
-func NewDeleteHaVipResponse() (response *DeleteHaVipResponse) {
- response = &DeleteHaVipResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DeleteHaVip)用于删除高可用虚拟IP(HAVIP)
-// 本接口是异步完成,如需查询异步任务执行结果,请使用本接口返回的`RequestId`轮询`QueryTask`接口
-func (c *Client) DeleteHaVip(request *DeleteHaVipRequest) (response *DeleteHaVipResponse, err error) {
- if request == nil {
- request = NewDeleteHaVipRequest()
- }
- response = NewDeleteHaVipResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteIp6TranslatorsRequest() (request *DeleteIp6TranslatorsRequest) {
- request = &DeleteIp6TranslatorsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DeleteIp6Translators")
- return
-}
-
-func NewDeleteIp6TranslatorsResponse() (response *DeleteIp6TranslatorsResponse) {
- response = &DeleteIp6TranslatorsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 1. 该接口用于释放IPV6转换实例,支持批量。
-// 2. 如果IPV6转换实例建立有转换规则,会一并删除。
-func (c *Client) DeleteIp6Translators(request *DeleteIp6TranslatorsRequest) (response *DeleteIp6TranslatorsResponse, err error) {
- if request == nil {
- request = NewDeleteIp6TranslatorsRequest()
- }
- response = NewDeleteIp6TranslatorsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteNetworkInterfaceRequest() (request *DeleteNetworkInterfaceRequest) {
- request = &DeleteNetworkInterfaceRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DeleteNetworkInterface")
- return
-}
-
-func NewDeleteNetworkInterfaceResponse() (response *DeleteNetworkInterfaceResponse) {
- response = &DeleteNetworkInterfaceResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DeleteNetworkInterface)用于删除弹性网卡。
-// * 弹性网卡上绑定了云主机时,不能被删除。
-// * 删除指定弹性网卡,弹性网卡必须先和子机解绑才能删除。删除之后弹性网卡上所有内网IP都将被退还。
-func (c *Client) DeleteNetworkInterface(request *DeleteNetworkInterfaceRequest) (response *DeleteNetworkInterfaceResponse, err error) {
- if request == nil {
- request = NewDeleteNetworkInterfaceRequest()
- }
- response = NewDeleteNetworkInterfaceResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteRouteTableRequest() (request *DeleteRouteTableRequest) {
- request = &DeleteRouteTableRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DeleteRouteTable")
- return
-}
-
-func NewDeleteRouteTableResponse() (response *DeleteRouteTableResponse) {
- response = &DeleteRouteTableResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 删除路由表
-func (c *Client) DeleteRouteTable(request *DeleteRouteTableRequest) (response *DeleteRouteTableResponse, err error) {
- if request == nil {
- request = NewDeleteRouteTableRequest()
- }
- response = NewDeleteRouteTableResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteRoutesRequest() (request *DeleteRoutesRequest) {
- request = &DeleteRoutesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DeleteRoutes")
- return
-}
-
-func NewDeleteRoutesResponse() (response *DeleteRoutesResponse) {
- response = &DeleteRoutesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DeleteRoutes)用于对某个路由表批量删除路由策略(Route)。
-func (c *Client) DeleteRoutes(request *DeleteRoutesRequest) (response *DeleteRoutesResponse, err error) {
- if request == nil {
- request = NewDeleteRoutesRequest()
- }
- response = NewDeleteRoutesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteSecurityGroupRequest() (request *DeleteSecurityGroupRequest) {
- request = &DeleteSecurityGroupRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DeleteSecurityGroup")
- return
-}
-
-func NewDeleteSecurityGroupResponse() (response *DeleteSecurityGroupResponse) {
- response = &DeleteSecurityGroupResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DeleteSecurityGroup)用于删除安全组(SecurityGroup)。
-// * 只有当前账号下的安全组允许被删除。
-// * 安全组实例ID如果在其他安全组的规则中被引用,则无法直接删除。这种情况下,需要先进行规则修改,再删除安全组。
-// * 删除的安全组无法再找回,请谨慎调用。
-func (c *Client) DeleteSecurityGroup(request *DeleteSecurityGroupRequest) (response *DeleteSecurityGroupResponse, err error) {
- if request == nil {
- request = NewDeleteSecurityGroupRequest()
- }
- response = NewDeleteSecurityGroupResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteSecurityGroupPoliciesRequest() (request *DeleteSecurityGroupPoliciesRequest) {
- request = &DeleteSecurityGroupPoliciesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DeleteSecurityGroupPolicies")
- return
-}
-
-func NewDeleteSecurityGroupPoliciesResponse() (response *DeleteSecurityGroupPoliciesResponse) {
- response = &DeleteSecurityGroupPoliciesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DeleteSecurityGroupPolicies)用于用于删除安全组规则(SecurityGroupPolicy)。
-// * SecurityGroupPolicySet.Version 用于指定要操作的安全组的版本。传入 Version 版本号若不等于当前安全组的最新版本,将返回失败;若不传 Version 则直接删除指定PolicyIndex的规则。
-func (c *Client) DeleteSecurityGroupPolicies(request *DeleteSecurityGroupPoliciesRequest) (response *DeleteSecurityGroupPoliciesResponse, err error) {
- if request == nil {
- request = NewDeleteSecurityGroupPoliciesRequest()
- }
- response = NewDeleteSecurityGroupPoliciesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteServiceTemplateRequest() (request *DeleteServiceTemplateRequest) {
- request = &DeleteServiceTemplateRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DeleteServiceTemplate")
- return
-}
-
-func NewDeleteServiceTemplateResponse() (response *DeleteServiceTemplateResponse) {
- response = &DeleteServiceTemplateResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DeleteServiceTemplate)用于删除协议端口模板
-func (c *Client) DeleteServiceTemplate(request *DeleteServiceTemplateRequest) (response *DeleteServiceTemplateResponse, err error) {
- if request == nil {
- request = NewDeleteServiceTemplateRequest()
- }
- response = NewDeleteServiceTemplateResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteServiceTemplateGroupRequest() (request *DeleteServiceTemplateGroupRequest) {
- request = &DeleteServiceTemplateGroupRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DeleteServiceTemplateGroup")
- return
-}
-
-func NewDeleteServiceTemplateGroupResponse() (response *DeleteServiceTemplateGroupResponse) {
- response = &DeleteServiceTemplateGroupResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DeleteServiceTemplateGroup)用于删除协议端口模板集合
-func (c *Client) DeleteServiceTemplateGroup(request *DeleteServiceTemplateGroupRequest) (response *DeleteServiceTemplateGroupResponse, err error) {
- if request == nil {
- request = NewDeleteServiceTemplateGroupRequest()
- }
- response = NewDeleteServiceTemplateGroupResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteSubnetRequest() (request *DeleteSubnetRequest) {
- request = &DeleteSubnetRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DeleteSubnet")
- return
-}
-
-func NewDeleteSubnetResponse() (response *DeleteSubnetResponse) {
- response = &DeleteSubnetResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DeleteSubnet)用于用于删除子网(Subnet)。
-// * 删除子网前,请清理该子网下所有资源,包括云主机、负载均衡、云数据、noSql、弹性网卡等资源。
-func (c *Client) DeleteSubnet(request *DeleteSubnetRequest) (response *DeleteSubnetResponse, err error) {
- if request == nil {
- request = NewDeleteSubnetRequest()
- }
- response = NewDeleteSubnetResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteVpcRequest() (request *DeleteVpcRequest) {
- request = &DeleteVpcRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DeleteVpc")
- return
-}
-
-func NewDeleteVpcResponse() (response *DeleteVpcResponse) {
- response = &DeleteVpcResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DeleteVpc)用于删除私有网络。
-// * 删除前请确保 VPC 内已经没有相关资源,例如云主机、云数据库、NoSQL、VPN网关、专线网关、负载均衡、对等连接、与之互通的基础网络设备等。
-// * 删除私有网络是不可逆的操作,请谨慎处理。
-func (c *Client) DeleteVpc(request *DeleteVpcRequest) (response *DeleteVpcResponse, err error) {
- if request == nil {
- request = NewDeleteVpcRequest()
- }
- response = NewDeleteVpcResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteVpnConnectionRequest() (request *DeleteVpnConnectionRequest) {
- request = &DeleteVpnConnectionRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DeleteVpnConnection")
- return
-}
-
-func NewDeleteVpnConnectionResponse() (response *DeleteVpnConnectionResponse) {
- response = &DeleteVpnConnectionResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DeleteVpnConnection)用于删除VPN通道。
-func (c *Client) DeleteVpnConnection(request *DeleteVpnConnectionRequest) (response *DeleteVpnConnectionResponse, err error) {
- if request == nil {
- request = NewDeleteVpnConnectionRequest()
- }
- response = NewDeleteVpnConnectionResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDeleteVpnGatewayRequest() (request *DeleteVpnGatewayRequest) {
- request = &DeleteVpnGatewayRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DeleteVpnGateway")
- return
-}
-
-func NewDeleteVpnGatewayResponse() (response *DeleteVpnGatewayResponse) {
- response = &DeleteVpnGatewayResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DeleteVpnGateway)用于删除VPN网关。目前只支持删除运行中的按量计费的IPSEC网关实例。
-func (c *Client) DeleteVpnGateway(request *DeleteVpnGatewayRequest) (response *DeleteVpnGatewayResponse, err error) {
- if request == nil {
- request = NewDeleteVpnGatewayRequest()
- }
- response = NewDeleteVpnGatewayResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeAccountAttributesRequest() (request *DescribeAccountAttributesRequest) {
- request = &DescribeAccountAttributesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeAccountAttributes")
- return
-}
-
-func NewDescribeAccountAttributesResponse() (response *DescribeAccountAttributesResponse) {
- response = &DescribeAccountAttributesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeAccountAttributes)用于查询用户账号私有属性。
-func (c *Client) DescribeAccountAttributes(request *DescribeAccountAttributesRequest) (response *DescribeAccountAttributesResponse, err error) {
- if request == nil {
- request = NewDescribeAccountAttributesRequest()
- }
- response = NewDescribeAccountAttributesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeAddressQuotaRequest() (request *DescribeAddressQuotaRequest) {
- request = &DescribeAddressQuotaRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeAddressQuota")
- return
-}
-
-func NewDescribeAddressQuotaResponse() (response *DescribeAddressQuotaResponse) {
- response = &DescribeAddressQuotaResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (DescribeAddressQuota) 用于查询您账户的[弹性公网IP](https://cloud.tencent.com/document/product/213/1941)(简称 EIP)在当前地域的配额信息。配额详情可参见 [EIP 产品简介](https://cloud.tencent.com/document/product/213/5733)。
-func (c *Client) DescribeAddressQuota(request *DescribeAddressQuotaRequest) (response *DescribeAddressQuotaResponse, err error) {
- if request == nil {
- request = NewDescribeAddressQuotaRequest()
- }
- response = NewDescribeAddressQuotaResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeAddressTemplateGroupsRequest() (request *DescribeAddressTemplateGroupsRequest) {
- request = &DescribeAddressTemplateGroupsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeAddressTemplateGroups")
- return
-}
-
-func NewDescribeAddressTemplateGroupsResponse() (response *DescribeAddressTemplateGroupsResponse) {
- response = &DescribeAddressTemplateGroupsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeAddressTemplateGroups)用于查询IP地址模板集合
-func (c *Client) DescribeAddressTemplateGroups(request *DescribeAddressTemplateGroupsRequest) (response *DescribeAddressTemplateGroupsResponse, err error) {
- if request == nil {
- request = NewDescribeAddressTemplateGroupsRequest()
- }
- response = NewDescribeAddressTemplateGroupsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeAddressTemplatesRequest() (request *DescribeAddressTemplatesRequest) {
- request = &DescribeAddressTemplatesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeAddressTemplates")
- return
-}
-
-func NewDescribeAddressTemplatesResponse() (response *DescribeAddressTemplatesResponse) {
- response = &DescribeAddressTemplatesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeAddressTemplates)用于查询IP地址模板
-func (c *Client) DescribeAddressTemplates(request *DescribeAddressTemplatesRequest) (response *DescribeAddressTemplatesResponse, err error) {
- if request == nil {
- request = NewDescribeAddressTemplatesRequest()
- }
- response = NewDescribeAddressTemplatesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeAddressesRequest() (request *DescribeAddressesRequest) {
- request = &DescribeAddressesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeAddresses")
- return
-}
-
-func NewDescribeAddressesResponse() (response *DescribeAddressesResponse) {
- response = &DescribeAddressesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (DescribeAddresses) 用于查询一个或多个[弹性公网IP](https://cloud.tencent.com/document/product/213/1941)(简称 EIP)的详细信息。
-// * 如果参数为空,返回当前用户一定数量(Limit所指定的数量,默认为20)的 EIP。
-func (c *Client) DescribeAddresses(request *DescribeAddressesRequest) (response *DescribeAddressesResponse, err error) {
- if request == nil {
- request = NewDescribeAddressesRequest()
- }
- response = NewDescribeAddressesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeBandwidthPackageQuotaRequest() (request *DescribeBandwidthPackageQuotaRequest) {
- request = &DescribeBandwidthPackageQuotaRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeBandwidthPackageQuota")
- return
-}
-
-func NewDescribeBandwidthPackageQuotaResponse() (response *DescribeBandwidthPackageQuotaResponse) {
- response = &DescribeBandwidthPackageQuotaResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 接口用于查询账户在当前地域的带宽包上限数量以及使用数量
-func (c *Client) DescribeBandwidthPackageQuota(request *DescribeBandwidthPackageQuotaRequest) (response *DescribeBandwidthPackageQuotaResponse, err error) {
- if request == nil {
- request = NewDescribeBandwidthPackageQuotaRequest()
- }
- response = NewDescribeBandwidthPackageQuotaResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeBandwidthPackagesRequest() (request *DescribeBandwidthPackagesRequest) {
- request = &DescribeBandwidthPackagesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeBandwidthPackages")
- return
-}
-
-func NewDescribeBandwidthPackagesResponse() (response *DescribeBandwidthPackagesResponse) {
- response = &DescribeBandwidthPackagesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 接口用于查询带宽包详细信息,包括带宽包唯一标识ID,类型,计费模式,名称,资源信息等
-func (c *Client) DescribeBandwidthPackages(request *DescribeBandwidthPackagesRequest) (response *DescribeBandwidthPackagesResponse, err error) {
- if request == nil {
- request = NewDescribeBandwidthPackagesRequest()
- }
- response = NewDescribeBandwidthPackagesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeCcnAttachedInstancesRequest() (request *DescribeCcnAttachedInstancesRequest) {
- request = &DescribeCcnAttachedInstancesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeCcnAttachedInstances")
- return
-}
-
-func NewDescribeCcnAttachedInstancesResponse() (response *DescribeCcnAttachedInstancesResponse) {
- response = &DescribeCcnAttachedInstancesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeCcnAttachedInstances)用于查询云联网实例下已关联的网络实例。
-func (c *Client) DescribeCcnAttachedInstances(request *DescribeCcnAttachedInstancesRequest) (response *DescribeCcnAttachedInstancesResponse, err error) {
- if request == nil {
- request = NewDescribeCcnAttachedInstancesRequest()
- }
- response = NewDescribeCcnAttachedInstancesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeCcnRegionBandwidthLimitsRequest() (request *DescribeCcnRegionBandwidthLimitsRequest) {
- request = &DescribeCcnRegionBandwidthLimitsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeCcnRegionBandwidthLimits")
- return
-}
-
-func NewDescribeCcnRegionBandwidthLimitsResponse() (response *DescribeCcnRegionBandwidthLimitsResponse) {
- response = &DescribeCcnRegionBandwidthLimitsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeCcnRegionBandwidthLimits)用于查询云联网各地域出带宽上限,该接口只返回已关联网络实例包含的地域
-func (c *Client) DescribeCcnRegionBandwidthLimits(request *DescribeCcnRegionBandwidthLimitsRequest) (response *DescribeCcnRegionBandwidthLimitsResponse, err error) {
- if request == nil {
- request = NewDescribeCcnRegionBandwidthLimitsRequest()
- }
- response = NewDescribeCcnRegionBandwidthLimitsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeCcnRoutesRequest() (request *DescribeCcnRoutesRequest) {
- request = &DescribeCcnRoutesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeCcnRoutes")
- return
-}
-
-func NewDescribeCcnRoutesResponse() (response *DescribeCcnRoutesResponse) {
- response = &DescribeCcnRoutesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeCcnRoutes)用于查询已加入云联网(CCN)的路由
-func (c *Client) DescribeCcnRoutes(request *DescribeCcnRoutesRequest) (response *DescribeCcnRoutesResponse, err error) {
- if request == nil {
- request = NewDescribeCcnRoutesRequest()
- }
- response = NewDescribeCcnRoutesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeCcnsRequest() (request *DescribeCcnsRequest) {
- request = &DescribeCcnsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeCcns")
- return
-}
-
-func NewDescribeCcnsResponse() (response *DescribeCcnsResponse) {
- response = &DescribeCcnsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeCcns)用于查询云联网(CCN)列表。
-func (c *Client) DescribeCcns(request *DescribeCcnsRequest) (response *DescribeCcnsResponse, err error) {
- if request == nil {
- request = NewDescribeCcnsRequest()
- }
- response = NewDescribeCcnsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeClassicLinkInstancesRequest() (request *DescribeClassicLinkInstancesRequest) {
- request = &DescribeClassicLinkInstancesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeClassicLinkInstances")
- return
-}
-
-func NewDescribeClassicLinkInstancesResponse() (response *DescribeClassicLinkInstancesResponse) {
- response = &DescribeClassicLinkInstancesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeClassicLinkInstances)用于查询私有网络和基础网络设备互通列表。
-func (c *Client) DescribeClassicLinkInstances(request *DescribeClassicLinkInstancesRequest) (response *DescribeClassicLinkInstancesResponse, err error) {
- if request == nil {
- request = NewDescribeClassicLinkInstancesRequest()
- }
- response = NewDescribeClassicLinkInstancesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeCustomerGatewayVendorsRequest() (request *DescribeCustomerGatewayVendorsRequest) {
- request = &DescribeCustomerGatewayVendorsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeCustomerGatewayVendors")
- return
-}
-
-func NewDescribeCustomerGatewayVendorsResponse() (response *DescribeCustomerGatewayVendorsResponse) {
- response = &DescribeCustomerGatewayVendorsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeCustomerGatewayVendors)用于查询可支持的对端网关厂商信息。
-func (c *Client) DescribeCustomerGatewayVendors(request *DescribeCustomerGatewayVendorsRequest) (response *DescribeCustomerGatewayVendorsResponse, err error) {
- if request == nil {
- request = NewDescribeCustomerGatewayVendorsRequest()
- }
- response = NewDescribeCustomerGatewayVendorsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeCustomerGatewaysRequest() (request *DescribeCustomerGatewaysRequest) {
- request = &DescribeCustomerGatewaysRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeCustomerGateways")
- return
-}
-
-func NewDescribeCustomerGatewaysResponse() (response *DescribeCustomerGatewaysResponse) {
- response = &DescribeCustomerGatewaysResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeCustomerGateways)用于查询对端网关列表。
-func (c *Client) DescribeCustomerGateways(request *DescribeCustomerGatewaysRequest) (response *DescribeCustomerGatewaysResponse, err error) {
- if request == nil {
- request = NewDescribeCustomerGatewaysRequest()
- }
- response = NewDescribeCustomerGatewaysResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeDirectConnectGatewayCcnRoutesRequest() (request *DescribeDirectConnectGatewayCcnRoutesRequest) {
- request = &DescribeDirectConnectGatewayCcnRoutesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeDirectConnectGatewayCcnRoutes")
- return
-}
-
-func NewDescribeDirectConnectGatewayCcnRoutesResponse() (response *DescribeDirectConnectGatewayCcnRoutesResponse) {
- response = &DescribeDirectConnectGatewayCcnRoutesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeDirectConnectGatewayCcnRoutes)用于查询专线网关的云联网路由(IDC网段)
-func (c *Client) DescribeDirectConnectGatewayCcnRoutes(request *DescribeDirectConnectGatewayCcnRoutesRequest) (response *DescribeDirectConnectGatewayCcnRoutesResponse, err error) {
- if request == nil {
- request = NewDescribeDirectConnectGatewayCcnRoutesRequest()
- }
- response = NewDescribeDirectConnectGatewayCcnRoutesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeDirectConnectGatewaysRequest() (request *DescribeDirectConnectGatewaysRequest) {
- request = &DescribeDirectConnectGatewaysRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeDirectConnectGateways")
- return
-}
-
-func NewDescribeDirectConnectGatewaysResponse() (response *DescribeDirectConnectGatewaysResponse) {
- response = &DescribeDirectConnectGatewaysResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeDirectConnectGateways)用于查询专线网关。
-func (c *Client) DescribeDirectConnectGateways(request *DescribeDirectConnectGatewaysRequest) (response *DescribeDirectConnectGatewaysResponse, err error) {
- if request == nil {
- request = NewDescribeDirectConnectGatewaysRequest()
- }
- response = NewDescribeDirectConnectGatewaysResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeFlowLogRequest() (request *DescribeFlowLogRequest) {
- request = &DescribeFlowLogRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeFlowLog")
- return
-}
-
-func NewDescribeFlowLogResponse() (response *DescribeFlowLogResponse) {
- response = &DescribeFlowLogResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeFlowLog)用于查询流日志实例信息
-func (c *Client) DescribeFlowLog(request *DescribeFlowLogRequest) (response *DescribeFlowLogResponse, err error) {
- if request == nil {
- request = NewDescribeFlowLogRequest()
- }
- response = NewDescribeFlowLogResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeFlowLogsRequest() (request *DescribeFlowLogsRequest) {
- request = &DescribeFlowLogsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeFlowLogs")
- return
-}
-
-func NewDescribeFlowLogsResponse() (response *DescribeFlowLogsResponse) {
- response = &DescribeFlowLogsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeFlowLogs)用于查询获取流日志集合
-func (c *Client) DescribeFlowLogs(request *DescribeFlowLogsRequest) (response *DescribeFlowLogsResponse, err error) {
- if request == nil {
- request = NewDescribeFlowLogsRequest()
- }
- response = NewDescribeFlowLogsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeGatewayFlowMonitorDetailRequest() (request *DescribeGatewayFlowMonitorDetailRequest) {
- request = &DescribeGatewayFlowMonitorDetailRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeGatewayFlowMonitorDetail")
- return
-}
-
-func NewDescribeGatewayFlowMonitorDetailResponse() (response *DescribeGatewayFlowMonitorDetailResponse) {
- response = &DescribeGatewayFlowMonitorDetailResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeGatewayFlowMonitorDetail)用于查询网关流量监控明细。
-// * 只支持单个网关实例查询。即入参 `VpnId` `DirectConnectGatewayId` `PeeringConnectionId` `NatId` 最多只支持传一个,且必须传一个。
-// * 如果网关有流量,但调用本接口没有返回数据,请在控制台对应网关详情页确认是否开启网关流量监控。
-func (c *Client) DescribeGatewayFlowMonitorDetail(request *DescribeGatewayFlowMonitorDetailRequest) (response *DescribeGatewayFlowMonitorDetailResponse, err error) {
- if request == nil {
- request = NewDescribeGatewayFlowMonitorDetailRequest()
- }
- response = NewDescribeGatewayFlowMonitorDetailResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeHaVipsRequest() (request *DescribeHaVipsRequest) {
- request = &DescribeHaVipsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeHaVips")
- return
-}
-
-func NewDescribeHaVipsResponse() (response *DescribeHaVipsResponse) {
- response = &DescribeHaVipsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeHaVips)用于查询高可用虚拟IP(HAVIP)列表。
-func (c *Client) DescribeHaVips(request *DescribeHaVipsRequest) (response *DescribeHaVipsResponse, err error) {
- if request == nil {
- request = NewDescribeHaVipsRequest()
- }
- response = NewDescribeHaVipsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeIp6TranslatorQuotaRequest() (request *DescribeIp6TranslatorQuotaRequest) {
- request = &DescribeIp6TranslatorQuotaRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeIp6TranslatorQuota")
- return
-}
-
-func NewDescribeIp6TranslatorQuotaResponse() (response *DescribeIp6TranslatorQuotaResponse) {
- response = &DescribeIp6TranslatorQuotaResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 查询账户在指定地域IPV6转换实例和规则的配额
-func (c *Client) DescribeIp6TranslatorQuota(request *DescribeIp6TranslatorQuotaRequest) (response *DescribeIp6TranslatorQuotaResponse, err error) {
- if request == nil {
- request = NewDescribeIp6TranslatorQuotaRequest()
- }
- response = NewDescribeIp6TranslatorQuotaResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeIp6TranslatorsRequest() (request *DescribeIp6TranslatorsRequest) {
- request = &DescribeIp6TranslatorsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeIp6Translators")
- return
-}
-
-func NewDescribeIp6TranslatorsResponse() (response *DescribeIp6TranslatorsResponse) {
- response = &DescribeIp6TranslatorsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 1. 该接口用于查询账户下的IPV6转换实例及其绑定的转换规则信息
-// 2. 支持过滤查询
-func (c *Client) DescribeIp6Translators(request *DescribeIp6TranslatorsRequest) (response *DescribeIp6TranslatorsResponse, err error) {
- if request == nil {
- request = NewDescribeIp6TranslatorsRequest()
- }
- response = NewDescribeIp6TranslatorsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeNatGatewaysRequest() (request *DescribeNatGatewaysRequest) {
- request = &DescribeNatGatewaysRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeNatGateways")
- return
-}
-
-func NewDescribeNatGatewaysResponse() (response *DescribeNatGatewaysResponse) {
- response = &DescribeNatGatewaysResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeNatGateways)用于查询 NAT 网关。
-func (c *Client) DescribeNatGateways(request *DescribeNatGatewaysRequest) (response *DescribeNatGatewaysResponse, err error) {
- if request == nil {
- request = NewDescribeNatGatewaysRequest()
- }
- response = NewDescribeNatGatewaysResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeNetworkInterfacesRequest() (request *DescribeNetworkInterfacesRequest) {
- request = &DescribeNetworkInterfacesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeNetworkInterfaces")
- return
-}
-
-func NewDescribeNetworkInterfacesResponse() (response *DescribeNetworkInterfacesResponse) {
- response = &DescribeNetworkInterfacesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeNetworkInterfaces)用于查询弹性网卡列表。
-func (c *Client) DescribeNetworkInterfaces(request *DescribeNetworkInterfacesRequest) (response *DescribeNetworkInterfacesResponse, err error) {
- if request == nil {
- request = NewDescribeNetworkInterfacesRequest()
- }
- response = NewDescribeNetworkInterfacesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeRouteConflictsRequest() (request *DescribeRouteConflictsRequest) {
- request = &DescribeRouteConflictsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeRouteConflicts")
- return
-}
-
-func NewDescribeRouteConflictsResponse() (response *DescribeRouteConflictsResponse) {
- response = &DescribeRouteConflictsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeRouteConflicts)用于查询自定义路由策略与云联网路由策略冲突列表
-func (c *Client) DescribeRouteConflicts(request *DescribeRouteConflictsRequest) (response *DescribeRouteConflictsResponse, err error) {
- if request == nil {
- request = NewDescribeRouteConflictsRequest()
- }
- response = NewDescribeRouteConflictsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeRouteTablesRequest() (request *DescribeRouteTablesRequest) {
- request = &DescribeRouteTablesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeRouteTables")
- return
-}
-
-func NewDescribeRouteTablesResponse() (response *DescribeRouteTablesResponse) {
- response = &DescribeRouteTablesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeRouteTables)用于查询路由表。
-func (c *Client) DescribeRouteTables(request *DescribeRouteTablesRequest) (response *DescribeRouteTablesResponse, err error) {
- if request == nil {
- request = NewDescribeRouteTablesRequest()
- }
- response = NewDescribeRouteTablesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeSecurityGroupAssociationStatisticsRequest() (request *DescribeSecurityGroupAssociationStatisticsRequest) {
- request = &DescribeSecurityGroupAssociationStatisticsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeSecurityGroupAssociationStatistics")
- return
-}
-
-func NewDescribeSecurityGroupAssociationStatisticsResponse() (response *DescribeSecurityGroupAssociationStatisticsResponse) {
- response = &DescribeSecurityGroupAssociationStatisticsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeSecurityGroupAssociationStatistics)用于查询安全组关联的实例统计。
-func (c *Client) DescribeSecurityGroupAssociationStatistics(request *DescribeSecurityGroupAssociationStatisticsRequest) (response *DescribeSecurityGroupAssociationStatisticsResponse, err error) {
- if request == nil {
- request = NewDescribeSecurityGroupAssociationStatisticsRequest()
- }
- response = NewDescribeSecurityGroupAssociationStatisticsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeSecurityGroupPoliciesRequest() (request *DescribeSecurityGroupPoliciesRequest) {
- request = &DescribeSecurityGroupPoliciesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeSecurityGroupPolicies")
- return
-}
-
-func NewDescribeSecurityGroupPoliciesResponse() (response *DescribeSecurityGroupPoliciesResponse) {
- response = &DescribeSecurityGroupPoliciesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeSecurityGroupPolicies)用于查询安全组规则。
-func (c *Client) DescribeSecurityGroupPolicies(request *DescribeSecurityGroupPoliciesRequest) (response *DescribeSecurityGroupPoliciesResponse, err error) {
- if request == nil {
- request = NewDescribeSecurityGroupPoliciesRequest()
- }
- response = NewDescribeSecurityGroupPoliciesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeSecurityGroupsRequest() (request *DescribeSecurityGroupsRequest) {
- request = &DescribeSecurityGroupsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeSecurityGroups")
- return
-}
-
-func NewDescribeSecurityGroupsResponse() (response *DescribeSecurityGroupsResponse) {
- response = &DescribeSecurityGroupsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeSecurityGroups)用于查询安全组。
-func (c *Client) DescribeSecurityGroups(request *DescribeSecurityGroupsRequest) (response *DescribeSecurityGroupsResponse, err error) {
- if request == nil {
- request = NewDescribeSecurityGroupsRequest()
- }
- response = NewDescribeSecurityGroupsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeServiceTemplateGroupsRequest() (request *DescribeServiceTemplateGroupsRequest) {
- request = &DescribeServiceTemplateGroupsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeServiceTemplateGroups")
- return
-}
-
-func NewDescribeServiceTemplateGroupsResponse() (response *DescribeServiceTemplateGroupsResponse) {
- response = &DescribeServiceTemplateGroupsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeServiceTemplateGroups)用于查询协议端口模板集合
-func (c *Client) DescribeServiceTemplateGroups(request *DescribeServiceTemplateGroupsRequest) (response *DescribeServiceTemplateGroupsResponse, err error) {
- if request == nil {
- request = NewDescribeServiceTemplateGroupsRequest()
- }
- response = NewDescribeServiceTemplateGroupsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeServiceTemplatesRequest() (request *DescribeServiceTemplatesRequest) {
- request = &DescribeServiceTemplatesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeServiceTemplates")
- return
-}
-
-func NewDescribeServiceTemplatesResponse() (response *DescribeServiceTemplatesResponse) {
- response = &DescribeServiceTemplatesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeServiceTemplates)用于查询协议端口模板
-func (c *Client) DescribeServiceTemplates(request *DescribeServiceTemplatesRequest) (response *DescribeServiceTemplatesResponse, err error) {
- if request == nil {
- request = NewDescribeServiceTemplatesRequest()
- }
- response = NewDescribeServiceTemplatesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeSubnetsRequest() (request *DescribeSubnetsRequest) {
- request = &DescribeSubnetsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeSubnets")
- return
-}
-
-func NewDescribeSubnetsResponse() (response *DescribeSubnetsResponse) {
- response = &DescribeSubnetsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeSubnets)用于查询子网列表。
-func (c *Client) DescribeSubnets(request *DescribeSubnetsRequest) (response *DescribeSubnetsResponse, err error) {
- if request == nil {
- request = NewDescribeSubnetsRequest()
- }
- response = NewDescribeSubnetsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeVpcIpv6AddressesRequest() (request *DescribeVpcIpv6AddressesRequest) {
- request = &DescribeVpcIpv6AddressesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeVpcIpv6Addresses")
- return
-}
-
-func NewDescribeVpcIpv6AddressesResponse() (response *DescribeVpcIpv6AddressesResponse) {
- response = &DescribeVpcIpv6AddressesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeVpcIpv6Addresses)用于查询 `VPC` `IPv6` 信息。
-// 只能查询已使用的`IPv6`信息,当查询未使用的IP时,本接口不会报错,但不会出现在返回结果里。
-func (c *Client) DescribeVpcIpv6Addresses(request *DescribeVpcIpv6AddressesRequest) (response *DescribeVpcIpv6AddressesResponse, err error) {
- if request == nil {
- request = NewDescribeVpcIpv6AddressesRequest()
- }
- response = NewDescribeVpcIpv6AddressesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeVpcPrivateIpAddressesRequest() (request *DescribeVpcPrivateIpAddressesRequest) {
- request = &DescribeVpcPrivateIpAddressesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeVpcPrivateIpAddresses")
- return
-}
-
-func NewDescribeVpcPrivateIpAddressesResponse() (response *DescribeVpcPrivateIpAddressesResponse) {
- response = &DescribeVpcPrivateIpAddressesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeVpcPrivateIpAddresses)用于查询VPC内网IP信息。
-// 只能查询已使用的IP信息,当查询未使用的IP时,本接口不会报错,但不会出现在返回结果里。
-func (c *Client) DescribeVpcPrivateIpAddresses(request *DescribeVpcPrivateIpAddressesRequest) (response *DescribeVpcPrivateIpAddressesResponse, err error) {
- if request == nil {
- request = NewDescribeVpcPrivateIpAddressesRequest()
- }
- response = NewDescribeVpcPrivateIpAddressesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeVpcsRequest() (request *DescribeVpcsRequest) {
- request = &DescribeVpcsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeVpcs")
- return
-}
-
-func NewDescribeVpcsResponse() (response *DescribeVpcsResponse) {
- response = &DescribeVpcsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeVpcs)用于查询私有网络列表。
-func (c *Client) DescribeVpcs(request *DescribeVpcsRequest) (response *DescribeVpcsResponse, err error) {
- if request == nil {
- request = NewDescribeVpcsRequest()
- }
- response = NewDescribeVpcsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeVpnConnectionsRequest() (request *DescribeVpnConnectionsRequest) {
- request = &DescribeVpnConnectionsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeVpnConnections")
- return
-}
-
-func NewDescribeVpnConnectionsResponse() (response *DescribeVpnConnectionsResponse) {
- response = &DescribeVpnConnectionsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeVpnConnections)查询VPN通道列表。
-func (c *Client) DescribeVpnConnections(request *DescribeVpnConnectionsRequest) (response *DescribeVpnConnectionsResponse, err error) {
- if request == nil {
- request = NewDescribeVpnConnectionsRequest()
- }
- response = NewDescribeVpnConnectionsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDescribeVpnGatewaysRequest() (request *DescribeVpnGatewaysRequest) {
- request = &DescribeVpnGatewaysRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DescribeVpnGateways")
- return
-}
-
-func NewDescribeVpnGatewaysResponse() (response *DescribeVpnGatewaysResponse) {
- response = &DescribeVpnGatewaysResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DescribeVpnGateways)用于查询VPN网关列表。
-func (c *Client) DescribeVpnGateways(request *DescribeVpnGatewaysRequest) (response *DescribeVpnGatewaysResponse, err error) {
- if request == nil {
- request = NewDescribeVpnGatewaysRequest()
- }
- response = NewDescribeVpnGatewaysResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDetachCcnInstancesRequest() (request *DetachCcnInstancesRequest) {
- request = &DetachCcnInstancesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DetachCcnInstances")
- return
-}
-
-func NewDetachCcnInstancesResponse() (response *DetachCcnInstancesResponse) {
- response = &DetachCcnInstancesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DetachCcnInstances)用于从云联网实例中解关联指定的网络实例。
-// 解关联网络实例后,相应的路由策略会一并删除。
-func (c *Client) DetachCcnInstances(request *DetachCcnInstancesRequest) (response *DetachCcnInstancesResponse, err error) {
- if request == nil {
- request = NewDetachCcnInstancesRequest()
- }
- response = NewDetachCcnInstancesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDetachClassicLinkVpcRequest() (request *DetachClassicLinkVpcRequest) {
- request = &DetachClassicLinkVpcRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DetachClassicLinkVpc")
- return
-}
-
-func NewDetachClassicLinkVpcResponse() (response *DetachClassicLinkVpcResponse) {
- response = &DetachClassicLinkVpcResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DetachClassicLinkVpc)用于删除私有网络和基础网络设备互通。
-func (c *Client) DetachClassicLinkVpc(request *DetachClassicLinkVpcRequest) (response *DetachClassicLinkVpcResponse, err error) {
- if request == nil {
- request = NewDetachClassicLinkVpcRequest()
- }
- response = NewDetachClassicLinkVpcResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDetachNetworkInterfaceRequest() (request *DetachNetworkInterfaceRequest) {
- request = &DetachNetworkInterfaceRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DetachNetworkInterface")
- return
-}
-
-func NewDetachNetworkInterfaceResponse() (response *DetachNetworkInterfaceResponse) {
- response = &DetachNetworkInterfaceResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DetachNetworkInterface)用于弹性网卡解绑云主机。
-func (c *Client) DetachNetworkInterface(request *DetachNetworkInterfaceRequest) (response *DetachNetworkInterfaceResponse, err error) {
- if request == nil {
- request = NewDetachNetworkInterfaceRequest()
- }
- response = NewDetachNetworkInterfaceResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDisableCcnRoutesRequest() (request *DisableCcnRoutesRequest) {
- request = &DisableCcnRoutesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DisableCcnRoutes")
- return
-}
-
-func NewDisableCcnRoutesResponse() (response *DisableCcnRoutesResponse) {
- response = &DisableCcnRoutesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DisableCcnRoutes)用于禁用已经启用的云联网(CCN)路由
-func (c *Client) DisableCcnRoutes(request *DisableCcnRoutesRequest) (response *DisableCcnRoutesResponse, err error) {
- if request == nil {
- request = NewDisableCcnRoutesRequest()
- }
- response = NewDisableCcnRoutesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDisableRoutesRequest() (request *DisableRoutesRequest) {
- request = &DisableRoutesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DisableRoutes")
- return
-}
-
-func NewDisableRoutesResponse() (response *DisableRoutesResponse) {
- response = &DisableRoutesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DisableRoutes)用于禁用已启用的子网路由
-func (c *Client) DisableRoutes(request *DisableRoutesRequest) (response *DisableRoutesResponse, err error) {
- if request == nil {
- request = NewDisableRoutesRequest()
- }
- response = NewDisableRoutesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDisassociateAddressRequest() (request *DisassociateAddressRequest) {
- request = &DisassociateAddressRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DisassociateAddress")
- return
-}
-
-func NewDisassociateAddressResponse() (response *DisassociateAddressResponse) {
- response = &DisassociateAddressResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (DisassociateAddress) 用于解绑[弹性公网IP](https://cloud.tencent.com/document/product/213/1941)(简称 EIP)。
-// * 支持CVM实例,弹性网卡上的EIP解绑
-// * 不支持NAT上的EIP解绑。NAT上的EIP解绑请参考[EipUnBindNatGateway](https://cloud.tencent.com/document/product/215/4092)
-// * 只有状态为 BIND 和 BIND_ENI 的 EIP 才能进行解绑定操作。
-// * EIP 如果被封堵,则不能进行解绑定操作。
-func (c *Client) DisassociateAddress(request *DisassociateAddressRequest) (response *DisassociateAddressResponse, err error) {
- if request == nil {
- request = NewDisassociateAddressRequest()
- }
- response = NewDisassociateAddressResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewDownloadCustomerGatewayConfigurationRequest() (request *DownloadCustomerGatewayConfigurationRequest) {
- request = &DownloadCustomerGatewayConfigurationRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "DownloadCustomerGatewayConfiguration")
- return
-}
-
-func NewDownloadCustomerGatewayConfigurationResponse() (response *DownloadCustomerGatewayConfigurationResponse) {
- response = &DownloadCustomerGatewayConfigurationResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(DownloadCustomerGatewayConfiguration)用于下载VPN通道配置。
-func (c *Client) DownloadCustomerGatewayConfiguration(request *DownloadCustomerGatewayConfigurationRequest) (response *DownloadCustomerGatewayConfigurationResponse, err error) {
- if request == nil {
- request = NewDownloadCustomerGatewayConfigurationRequest()
- }
- response = NewDownloadCustomerGatewayConfigurationResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewEnableCcnRoutesRequest() (request *EnableCcnRoutesRequest) {
- request = &EnableCcnRoutesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "EnableCcnRoutes")
- return
-}
-
-func NewEnableCcnRoutesResponse() (response *EnableCcnRoutesResponse) {
- response = &EnableCcnRoutesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(EnableCcnRoutes)用于启用已经加入云联网(CCN)的路由。
-// 本接口会校验启用后,是否与已有路由冲突,如果冲突,则无法启用,失败处理。路由冲突时,需要先禁用与之冲突的路由,才能启用该路由。
-func (c *Client) EnableCcnRoutes(request *EnableCcnRoutesRequest) (response *EnableCcnRoutesResponse, err error) {
- if request == nil {
- request = NewEnableCcnRoutesRequest()
- }
- response = NewEnableCcnRoutesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewEnableRoutesRequest() (request *EnableRoutesRequest) {
- request = &EnableRoutesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "EnableRoutes")
- return
-}
-
-func NewEnableRoutesResponse() (response *EnableRoutesResponse) {
- response = &EnableRoutesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(EnableRoutes)用于启用已禁用的子网路由。
-// 本接口会校验启用后,是否与已有路由冲突,如果冲突,则无法启用,失败处理。路由冲突时,需要先禁用与之冲突的路由,才能启用该路由。
-func (c *Client) EnableRoutes(request *EnableRoutesRequest) (response *EnableRoutesResponse, err error) {
- if request == nil {
- request = NewEnableRoutesRequest()
- }
- response = NewEnableRoutesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewHaVipAssociateAddressIpRequest() (request *HaVipAssociateAddressIpRequest) {
- request = &HaVipAssociateAddressIpRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "HaVipAssociateAddressIp")
- return
-}
-
-func NewHaVipAssociateAddressIpResponse() (response *HaVipAssociateAddressIpResponse) {
- response = &HaVipAssociateAddressIpResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(HaVipAssociateAddressIp)用于高可用虚拟IP(HAVIP)绑定弹性公网IP(EIP)
-// 本接口是异步完成,如需查询异步任务执行结果,请使用本接口返回的`RequestId`轮询`QueryTask`接口
-func (c *Client) HaVipAssociateAddressIp(request *HaVipAssociateAddressIpRequest) (response *HaVipAssociateAddressIpResponse, err error) {
- if request == nil {
- request = NewHaVipAssociateAddressIpRequest()
- }
- response = NewHaVipAssociateAddressIpResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewHaVipDisassociateAddressIpRequest() (request *HaVipDisassociateAddressIpRequest) {
- request = &HaVipDisassociateAddressIpRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "HaVipDisassociateAddressIp")
- return
-}
-
-func NewHaVipDisassociateAddressIpResponse() (response *HaVipDisassociateAddressIpResponse) {
- response = &HaVipDisassociateAddressIpResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(HaVipDisassociateAddressIp)用于将高可用虚拟IP(HAVIP)已绑定的弹性公网IP(EIP)解除绑定
-// 本接口是异步完成,如需查询异步任务执行结果,请使用本接口返回的`RequestId`轮询`QueryTask`接口
-func (c *Client) HaVipDisassociateAddressIp(request *HaVipDisassociateAddressIpRequest) (response *HaVipDisassociateAddressIpResponse, err error) {
- if request == nil {
- request = NewHaVipDisassociateAddressIpRequest()
- }
- response = NewHaVipDisassociateAddressIpResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewInquiryPriceCreateVpnGatewayRequest() (request *InquiryPriceCreateVpnGatewayRequest) {
- request = &InquiryPriceCreateVpnGatewayRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "InquiryPriceCreateVpnGateway")
- return
-}
-
-func NewInquiryPriceCreateVpnGatewayResponse() (response *InquiryPriceCreateVpnGatewayResponse) {
- response = &InquiryPriceCreateVpnGatewayResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(InquiryPriceCreateVpnGateway)用于创建VPN网关询价。
-func (c *Client) InquiryPriceCreateVpnGateway(request *InquiryPriceCreateVpnGatewayRequest) (response *InquiryPriceCreateVpnGatewayResponse, err error) {
- if request == nil {
- request = NewInquiryPriceCreateVpnGatewayRequest()
- }
- response = NewInquiryPriceCreateVpnGatewayResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewInquiryPriceRenewVpnGatewayRequest() (request *InquiryPriceRenewVpnGatewayRequest) {
- request = &InquiryPriceRenewVpnGatewayRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "InquiryPriceRenewVpnGateway")
- return
-}
-
-func NewInquiryPriceRenewVpnGatewayResponse() (response *InquiryPriceRenewVpnGatewayResponse) {
- response = &InquiryPriceRenewVpnGatewayResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(InquiryPriceRenewVpnGateway)用于续费VPN网关询价。目前仅支持IPSEC类型网关的询价。
-func (c *Client) InquiryPriceRenewVpnGateway(request *InquiryPriceRenewVpnGatewayRequest) (response *InquiryPriceRenewVpnGatewayResponse, err error) {
- if request == nil {
- request = NewInquiryPriceRenewVpnGatewayRequest()
- }
- response = NewInquiryPriceRenewVpnGatewayResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewInquiryPriceResetVpnGatewayInternetMaxBandwidthRequest() (request *InquiryPriceResetVpnGatewayInternetMaxBandwidthRequest) {
- request = &InquiryPriceResetVpnGatewayInternetMaxBandwidthRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "InquiryPriceResetVpnGatewayInternetMaxBandwidth")
- return
-}
-
-func NewInquiryPriceResetVpnGatewayInternetMaxBandwidthResponse() (response *InquiryPriceResetVpnGatewayInternetMaxBandwidthResponse) {
- response = &InquiryPriceResetVpnGatewayInternetMaxBandwidthResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(InquiryPriceResetVpnGatewayInternetMaxBandwidth)调整VPN网关带宽上限询价。
-func (c *Client) InquiryPriceResetVpnGatewayInternetMaxBandwidth(request *InquiryPriceResetVpnGatewayInternetMaxBandwidthRequest) (response *InquiryPriceResetVpnGatewayInternetMaxBandwidthResponse, err error) {
- if request == nil {
- request = NewInquiryPriceResetVpnGatewayInternetMaxBandwidthRequest()
- }
- response = NewInquiryPriceResetVpnGatewayInternetMaxBandwidthResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewMigrateNetworkInterfaceRequest() (request *MigrateNetworkInterfaceRequest) {
- request = &MigrateNetworkInterfaceRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "MigrateNetworkInterface")
- return
-}
-
-func NewMigrateNetworkInterfaceResponse() (response *MigrateNetworkInterfaceResponse) {
- response = &MigrateNetworkInterfaceResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(MigrateNetworkInterface)用于弹性网卡迁移。
-func (c *Client) MigrateNetworkInterface(request *MigrateNetworkInterfaceRequest) (response *MigrateNetworkInterfaceResponse, err error) {
- if request == nil {
- request = NewMigrateNetworkInterfaceRequest()
- }
- response = NewMigrateNetworkInterfaceResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewMigratePrivateIpAddressRequest() (request *MigratePrivateIpAddressRequest) {
- request = &MigratePrivateIpAddressRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "MigratePrivateIpAddress")
- return
-}
-
-func NewMigratePrivateIpAddressResponse() (response *MigratePrivateIpAddressResponse) {
- response = &MigratePrivateIpAddressResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(MigratePrivateIpAddress)用于弹性网卡内网IP迁移。
-//
-// * 该接口用于将一个内网IP从一个弹性网卡上迁移到另外一个弹性网卡,主IP地址不支持迁移。
-// * 迁移前后的弹性网卡必须在同一个子网内。
-func (c *Client) MigratePrivateIpAddress(request *MigratePrivateIpAddressRequest) (response *MigratePrivateIpAddressResponse, err error) {
- if request == nil {
- request = NewMigratePrivateIpAddressRequest()
- }
- response = NewMigratePrivateIpAddressResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyAddressAttributeRequest() (request *ModifyAddressAttributeRequest) {
- request = &ModifyAddressAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifyAddressAttribute")
- return
-}
-
-func NewModifyAddressAttributeResponse() (response *ModifyAddressAttributeResponse) {
- response = &ModifyAddressAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (ModifyAddressAttribute) 用于修改[弹性公网IP](https://cloud.tencent.com/document/product/213/1941)(简称 EIP)的名称。
-func (c *Client) ModifyAddressAttribute(request *ModifyAddressAttributeRequest) (response *ModifyAddressAttributeResponse, err error) {
- if request == nil {
- request = NewModifyAddressAttributeRequest()
- }
- response = NewModifyAddressAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyAddressTemplateAttributeRequest() (request *ModifyAddressTemplateAttributeRequest) {
- request = &ModifyAddressTemplateAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifyAddressTemplateAttribute")
- return
-}
-
-func NewModifyAddressTemplateAttributeResponse() (response *ModifyAddressTemplateAttributeResponse) {
- response = &ModifyAddressTemplateAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyAddressTemplateAttribute)用于修改IP地址模板
-func (c *Client) ModifyAddressTemplateAttribute(request *ModifyAddressTemplateAttributeRequest) (response *ModifyAddressTemplateAttributeResponse, err error) {
- if request == nil {
- request = NewModifyAddressTemplateAttributeRequest()
- }
- response = NewModifyAddressTemplateAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyAddressTemplateGroupAttributeRequest() (request *ModifyAddressTemplateGroupAttributeRequest) {
- request = &ModifyAddressTemplateGroupAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifyAddressTemplateGroupAttribute")
- return
-}
-
-func NewModifyAddressTemplateGroupAttributeResponse() (response *ModifyAddressTemplateGroupAttributeResponse) {
- response = &ModifyAddressTemplateGroupAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyAddressTemplateGroupAttribute)用于修改IP地址模板集合
-func (c *Client) ModifyAddressTemplateGroupAttribute(request *ModifyAddressTemplateGroupAttributeRequest) (response *ModifyAddressTemplateGroupAttributeResponse, err error) {
- if request == nil {
- request = NewModifyAddressTemplateGroupAttributeRequest()
- }
- response = NewModifyAddressTemplateGroupAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyAddressesBandwidthRequest() (request *ModifyAddressesBandwidthRequest) {
- request = &ModifyAddressesBandwidthRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifyAddressesBandwidth")
- return
-}
-
-func NewModifyAddressesBandwidthResponse() (response *ModifyAddressesBandwidthResponse) {
- response = &ModifyAddressesBandwidthResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyAddressesBandwidth)用于调整[弹性公网IP](https://cloud.tencent.com/document/product/213/1941)(简称EIP)带宽,包括后付费EIP, 预付费EIP和带宽包EIP
-func (c *Client) ModifyAddressesBandwidth(request *ModifyAddressesBandwidthRequest) (response *ModifyAddressesBandwidthResponse, err error) {
- if request == nil {
- request = NewModifyAddressesBandwidthRequest()
- }
- response = NewModifyAddressesBandwidthResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyBandwidthPackageAttributeRequest() (request *ModifyBandwidthPackageAttributeRequest) {
- request = &ModifyBandwidthPackageAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifyBandwidthPackageAttribute")
- return
-}
-
-func NewModifyBandwidthPackageAttributeResponse() (response *ModifyBandwidthPackageAttributeResponse) {
- response = &ModifyBandwidthPackageAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 接口用于修改带宽包属性,包括带宽包名字等
-func (c *Client) ModifyBandwidthPackageAttribute(request *ModifyBandwidthPackageAttributeRequest) (response *ModifyBandwidthPackageAttributeResponse, err error) {
- if request == nil {
- request = NewModifyBandwidthPackageAttributeRequest()
- }
- response = NewModifyBandwidthPackageAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyCcnAttributeRequest() (request *ModifyCcnAttributeRequest) {
- request = &ModifyCcnAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifyCcnAttribute")
- return
-}
-
-func NewModifyCcnAttributeResponse() (response *ModifyCcnAttributeResponse) {
- response = &ModifyCcnAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyCcnAttribute)用于修改云联网(CCN)的相关属性。
-func (c *Client) ModifyCcnAttribute(request *ModifyCcnAttributeRequest) (response *ModifyCcnAttributeResponse, err error) {
- if request == nil {
- request = NewModifyCcnAttributeRequest()
- }
- response = NewModifyCcnAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyCustomerGatewayAttributeRequest() (request *ModifyCustomerGatewayAttributeRequest) {
- request = &ModifyCustomerGatewayAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifyCustomerGatewayAttribute")
- return
-}
-
-func NewModifyCustomerGatewayAttributeResponse() (response *ModifyCustomerGatewayAttributeResponse) {
- response = &ModifyCustomerGatewayAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyCustomerGatewayAttribute)用于修改对端网关信息。
-func (c *Client) ModifyCustomerGatewayAttribute(request *ModifyCustomerGatewayAttributeRequest) (response *ModifyCustomerGatewayAttributeResponse, err error) {
- if request == nil {
- request = NewModifyCustomerGatewayAttributeRequest()
- }
- response = NewModifyCustomerGatewayAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyDirectConnectGatewayAttributeRequest() (request *ModifyDirectConnectGatewayAttributeRequest) {
- request = &ModifyDirectConnectGatewayAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifyDirectConnectGatewayAttribute")
- return
-}
-
-func NewModifyDirectConnectGatewayAttributeResponse() (response *ModifyDirectConnectGatewayAttributeResponse) {
- response = &ModifyDirectConnectGatewayAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyDirectConnectGatewayAttribute)用于修改专线网关属性
-func (c *Client) ModifyDirectConnectGatewayAttribute(request *ModifyDirectConnectGatewayAttributeRequest) (response *ModifyDirectConnectGatewayAttributeResponse, err error) {
- if request == nil {
- request = NewModifyDirectConnectGatewayAttributeRequest()
- }
- response = NewModifyDirectConnectGatewayAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyFlowLogAttributeRequest() (request *ModifyFlowLogAttributeRequest) {
- request = &ModifyFlowLogAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifyFlowLogAttribute")
- return
-}
-
-func NewModifyFlowLogAttributeResponse() (response *ModifyFlowLogAttributeResponse) {
- response = &ModifyFlowLogAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyFlowLogAttribute)用于修改流日志属性
-func (c *Client) ModifyFlowLogAttribute(request *ModifyFlowLogAttributeRequest) (response *ModifyFlowLogAttributeResponse, err error) {
- if request == nil {
- request = NewModifyFlowLogAttributeRequest()
- }
- response = NewModifyFlowLogAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyHaVipAttributeRequest() (request *ModifyHaVipAttributeRequest) {
- request = &ModifyHaVipAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifyHaVipAttribute")
- return
-}
-
-func NewModifyHaVipAttributeResponse() (response *ModifyHaVipAttributeResponse) {
- response = &ModifyHaVipAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyHaVipAttribute)用于修改高可用虚拟IP(HAVIP)属性
-func (c *Client) ModifyHaVipAttribute(request *ModifyHaVipAttributeRequest) (response *ModifyHaVipAttributeResponse, err error) {
- if request == nil {
- request = NewModifyHaVipAttributeRequest()
- }
- response = NewModifyHaVipAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyIp6RuleRequest() (request *ModifyIp6RuleRequest) {
- request = &ModifyIp6RuleRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifyIp6Rule")
- return
-}
-
-func NewModifyIp6RuleResponse() (response *ModifyIp6RuleResponse) {
- response = &ModifyIp6RuleResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 该接口用于修改IPV6转换规则,当前仅支持修改转换规则名称,IPV4地址和IPV4端口号
-func (c *Client) ModifyIp6Rule(request *ModifyIp6RuleRequest) (response *ModifyIp6RuleResponse, err error) {
- if request == nil {
- request = NewModifyIp6RuleRequest()
- }
- response = NewModifyIp6RuleResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyIp6TranslatorRequest() (request *ModifyIp6TranslatorRequest) {
- request = &ModifyIp6TranslatorRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifyIp6Translator")
- return
-}
-
-func NewModifyIp6TranslatorResponse() (response *ModifyIp6TranslatorResponse) {
- response = &ModifyIp6TranslatorResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 该接口用于修改IP6转换实例属性,当前仅支持修改实例名称。
-func (c *Client) ModifyIp6Translator(request *ModifyIp6TranslatorRequest) (response *ModifyIp6TranslatorResponse, err error) {
- if request == nil {
- request = NewModifyIp6TranslatorRequest()
- }
- response = NewModifyIp6TranslatorResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyIpv6AddressesAttributeRequest() (request *ModifyIpv6AddressesAttributeRequest) {
- request = &ModifyIpv6AddressesAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifyIpv6AddressesAttribute")
- return
-}
-
-func NewModifyIpv6AddressesAttributeResponse() (response *ModifyIpv6AddressesAttributeResponse) {
- response = &ModifyIpv6AddressesAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyIpv6AddressesAttribute)用于修改弹性网卡内网IPv6地址属性。
-func (c *Client) ModifyIpv6AddressesAttribute(request *ModifyIpv6AddressesAttributeRequest) (response *ModifyIpv6AddressesAttributeResponse, err error) {
- if request == nil {
- request = NewModifyIpv6AddressesAttributeRequest()
- }
- response = NewModifyIpv6AddressesAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyNetworkInterfaceAttributeRequest() (request *ModifyNetworkInterfaceAttributeRequest) {
- request = &ModifyNetworkInterfaceAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifyNetworkInterfaceAttribute")
- return
-}
-
-func NewModifyNetworkInterfaceAttributeResponse() (response *ModifyNetworkInterfaceAttributeResponse) {
- response = &ModifyNetworkInterfaceAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyNetworkInterfaceAttribute)用于修改弹性网卡属性。
-func (c *Client) ModifyNetworkInterfaceAttribute(request *ModifyNetworkInterfaceAttributeRequest) (response *ModifyNetworkInterfaceAttributeResponse, err error) {
- if request == nil {
- request = NewModifyNetworkInterfaceAttributeRequest()
- }
- response = NewModifyNetworkInterfaceAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyPrivateIpAddressesAttributeRequest() (request *ModifyPrivateIpAddressesAttributeRequest) {
- request = &ModifyPrivateIpAddressesAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifyPrivateIpAddressesAttribute")
- return
-}
-
-func NewModifyPrivateIpAddressesAttributeResponse() (response *ModifyPrivateIpAddressesAttributeResponse) {
- response = &ModifyPrivateIpAddressesAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyPrivateIpAddressesAttribute)用于修改弹性网卡内网IP属性。
-func (c *Client) ModifyPrivateIpAddressesAttribute(request *ModifyPrivateIpAddressesAttributeRequest) (response *ModifyPrivateIpAddressesAttributeResponse, err error) {
- if request == nil {
- request = NewModifyPrivateIpAddressesAttributeRequest()
- }
- response = NewModifyPrivateIpAddressesAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyRouteTableAttributeRequest() (request *ModifyRouteTableAttributeRequest) {
- request = &ModifyRouteTableAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifyRouteTableAttribute")
- return
-}
-
-func NewModifyRouteTableAttributeResponse() (response *ModifyRouteTableAttributeResponse) {
- response = &ModifyRouteTableAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyRouteTableAttribute)用于修改路由表(RouteTable)属性。
-func (c *Client) ModifyRouteTableAttribute(request *ModifyRouteTableAttributeRequest) (response *ModifyRouteTableAttributeResponse, err error) {
- if request == nil {
- request = NewModifyRouteTableAttributeRequest()
- }
- response = NewModifyRouteTableAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifySecurityGroupAttributeRequest() (request *ModifySecurityGroupAttributeRequest) {
- request = &ModifySecurityGroupAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifySecurityGroupAttribute")
- return
-}
-
-func NewModifySecurityGroupAttributeResponse() (response *ModifySecurityGroupAttributeResponse) {
- response = &ModifySecurityGroupAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifySecurityGroupAttribute)用于修改安全组(SecurityGroupPolicy)属性。
-func (c *Client) ModifySecurityGroupAttribute(request *ModifySecurityGroupAttributeRequest) (response *ModifySecurityGroupAttributeResponse, err error) {
- if request == nil {
- request = NewModifySecurityGroupAttributeRequest()
- }
- response = NewModifySecurityGroupAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifySecurityGroupPoliciesRequest() (request *ModifySecurityGroupPoliciesRequest) {
- request = &ModifySecurityGroupPoliciesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifySecurityGroupPolicies")
- return
-}
-
-func NewModifySecurityGroupPoliciesResponse() (response *ModifySecurityGroupPoliciesResponse) {
- response = &ModifySecurityGroupPoliciesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifySecurityGroupPolicies)用于重置安全组出站和入站规则(SecurityGroupPolicy)。
-//
-// * 接口是先删除当前所有的出入站规则,然后再添加 Egress 和 Ingress 规则,不支持自定义索引 PolicyIndex 。
-// * 如果指定 SecurityGroupPolicySet.Version 为0, 表示清空所有规则,并忽略Egress和Ingress。
-// * Protocol字段支持输入TCP, UDP, ICMP, GRE, ALL。
-// * CidrBlock字段允许输入符合cidr格式标准的任意字符串。(展开)在基础网络中,如果CidrBlock包含您的账户内的云服务器之外的设备在腾讯云的内网IP,并不代表此规则允许您访问这些设备,租户之间网络隔离规则优先于安全组中的内网规则。
-// * SecurityGroupId字段允许输入与待修改的安全组位于相同项目中的安全组ID,包括这个安全组ID本身,代表安全组下所有云服务器的内网IP。使用这个字段时,这条规则用来匹配网络报文的过程中会随着被使用的这个ID所关联的云服务器变化而变化,不需要重新修改。
-// * Port字段允许输入一个单独端口号,或者用减号分隔的两个端口号代表端口范围,例如80或8000-8010。只有当Protocol字段是TCP或UDP时,Port字段才被接受。
-// * Action字段只允许输入ACCEPT或DROP。
-// * CidrBlock, SecurityGroupId, AddressTemplate三者是排他关系,不允许同时输入,Protocol + Port和ServiceTemplate二者是排他关系,不允许同时输入。
-func (c *Client) ModifySecurityGroupPolicies(request *ModifySecurityGroupPoliciesRequest) (response *ModifySecurityGroupPoliciesResponse, err error) {
- if request == nil {
- request = NewModifySecurityGroupPoliciesRequest()
- }
- response = NewModifySecurityGroupPoliciesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyServiceTemplateAttributeRequest() (request *ModifyServiceTemplateAttributeRequest) {
- request = &ModifyServiceTemplateAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifyServiceTemplateAttribute")
- return
-}
-
-func NewModifyServiceTemplateAttributeResponse() (response *ModifyServiceTemplateAttributeResponse) {
- response = &ModifyServiceTemplateAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyServiceTemplateAttribute)用于修改协议端口模板
-func (c *Client) ModifyServiceTemplateAttribute(request *ModifyServiceTemplateAttributeRequest) (response *ModifyServiceTemplateAttributeResponse, err error) {
- if request == nil {
- request = NewModifyServiceTemplateAttributeRequest()
- }
- response = NewModifyServiceTemplateAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyServiceTemplateGroupAttributeRequest() (request *ModifyServiceTemplateGroupAttributeRequest) {
- request = &ModifyServiceTemplateGroupAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifyServiceTemplateGroupAttribute")
- return
-}
-
-func NewModifyServiceTemplateGroupAttributeResponse() (response *ModifyServiceTemplateGroupAttributeResponse) {
- response = &ModifyServiceTemplateGroupAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyServiceTemplateGroupAttribute)用于修改协议端口模板集合。
-func (c *Client) ModifyServiceTemplateGroupAttribute(request *ModifyServiceTemplateGroupAttributeRequest) (response *ModifyServiceTemplateGroupAttributeResponse, err error) {
- if request == nil {
- request = NewModifyServiceTemplateGroupAttributeRequest()
- }
- response = NewModifyServiceTemplateGroupAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifySubnetAttributeRequest() (request *ModifySubnetAttributeRequest) {
- request = &ModifySubnetAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifySubnetAttribute")
- return
-}
-
-func NewModifySubnetAttributeResponse() (response *ModifySubnetAttributeResponse) {
- response = &ModifySubnetAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifySubnetAttribute)用于修改子网属性。
-func (c *Client) ModifySubnetAttribute(request *ModifySubnetAttributeRequest) (response *ModifySubnetAttributeResponse, err error) {
- if request == nil {
- request = NewModifySubnetAttributeRequest()
- }
- response = NewModifySubnetAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyVpcAttributeRequest() (request *ModifyVpcAttributeRequest) {
- request = &ModifyVpcAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifyVpcAttribute")
- return
-}
-
-func NewModifyVpcAttributeResponse() (response *ModifyVpcAttributeResponse) {
- response = &ModifyVpcAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyVpcAttribute)用于修改私有网络(VPC)的相关属性。
-func (c *Client) ModifyVpcAttribute(request *ModifyVpcAttributeRequest) (response *ModifyVpcAttributeResponse, err error) {
- if request == nil {
- request = NewModifyVpcAttributeRequest()
- }
- response = NewModifyVpcAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyVpnConnectionAttributeRequest() (request *ModifyVpnConnectionAttributeRequest) {
- request = &ModifyVpnConnectionAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifyVpnConnectionAttribute")
- return
-}
-
-func NewModifyVpnConnectionAttributeResponse() (response *ModifyVpnConnectionAttributeResponse) {
- response = &ModifyVpnConnectionAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyVpnConnectionAttribute)用于修改VPN通道。
-func (c *Client) ModifyVpnConnectionAttribute(request *ModifyVpnConnectionAttributeRequest) (response *ModifyVpnConnectionAttributeResponse, err error) {
- if request == nil {
- request = NewModifyVpnConnectionAttributeRequest()
- }
- response = NewModifyVpnConnectionAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewModifyVpnGatewayAttributeRequest() (request *ModifyVpnGatewayAttributeRequest) {
- request = &ModifyVpnGatewayAttributeRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ModifyVpnGatewayAttribute")
- return
-}
-
-func NewModifyVpnGatewayAttributeResponse() (response *ModifyVpnGatewayAttributeResponse) {
- response = &ModifyVpnGatewayAttributeResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ModifyVpnGatewayAttribute)用于修改VPN网关属性。
-func (c *Client) ModifyVpnGatewayAttribute(request *ModifyVpnGatewayAttributeRequest) (response *ModifyVpnGatewayAttributeResponse, err error) {
- if request == nil {
- request = NewModifyVpnGatewayAttributeRequest()
- }
- response = NewModifyVpnGatewayAttributeResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewRejectAttachCcnInstancesRequest() (request *RejectAttachCcnInstancesRequest) {
- request = &RejectAttachCcnInstancesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "RejectAttachCcnInstances")
- return
-}
-
-func NewRejectAttachCcnInstancesResponse() (response *RejectAttachCcnInstancesResponse) {
- response = &RejectAttachCcnInstancesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(RejectAttachCcnInstances)用于跨账号关联实例时,云联网所有者拒绝关联操作。
-func (c *Client) RejectAttachCcnInstances(request *RejectAttachCcnInstancesRequest) (response *RejectAttachCcnInstancesResponse, err error) {
- if request == nil {
- request = NewRejectAttachCcnInstancesRequest()
- }
- response = NewRejectAttachCcnInstancesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewReleaseAddressesRequest() (request *ReleaseAddressesRequest) {
- request = &ReleaseAddressesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ReleaseAddresses")
- return
-}
-
-func NewReleaseAddressesResponse() (response *ReleaseAddressesResponse) {
- response = &ReleaseAddressesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (ReleaseAddresses) 用于释放一个或多个[弹性公网IP](https://cloud.tencent.com/document/product/213/1941)(简称 EIP)。
-// * 该操作不可逆,释放后 EIP 关联的 IP 地址将不再属于您的名下。
-// * 只有状态为 UNBIND 的 EIP 才能进行释放操作。
-func (c *Client) ReleaseAddresses(request *ReleaseAddressesRequest) (response *ReleaseAddressesResponse, err error) {
- if request == nil {
- request = NewReleaseAddressesRequest()
- }
- response = NewReleaseAddressesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewRemoveBandwidthPackageResourcesRequest() (request *RemoveBandwidthPackageResourcesRequest) {
- request = &RemoveBandwidthPackageResourcesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "RemoveBandwidthPackageResources")
- return
-}
-
-func NewRemoveBandwidthPackageResourcesResponse() (response *RemoveBandwidthPackageResourcesResponse) {
- response = &RemoveBandwidthPackageResourcesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 接口用于删除带宽包资源,包括[弹性公网IP](https://cloud.tencent.com/document/product/213/1941)和[负载均衡](https://cloud.tencent.com/document/product/214/517)等
-func (c *Client) RemoveBandwidthPackageResources(request *RemoveBandwidthPackageResourcesRequest) (response *RemoveBandwidthPackageResourcesResponse, err error) {
- if request == nil {
- request = NewRemoveBandwidthPackageResourcesRequest()
- }
- response = NewRemoveBandwidthPackageResourcesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewRemoveIp6RulesRequest() (request *RemoveIp6RulesRequest) {
- request = &RemoveIp6RulesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "RemoveIp6Rules")
- return
-}
-
-func NewRemoveIp6RulesResponse() (response *RemoveIp6RulesResponse) {
- response = &RemoveIp6RulesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 1. 该接口用于删除IPV6转换规则
-// 2. 支持批量删除同一个转换实例下的多个转换规则
-func (c *Client) RemoveIp6Rules(request *RemoveIp6RulesRequest) (response *RemoveIp6RulesResponse, err error) {
- if request == nil {
- request = NewRemoveIp6RulesRequest()
- }
- response = NewRemoveIp6RulesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewRenewVpnGatewayRequest() (request *RenewVpnGatewayRequest) {
- request = &RenewVpnGatewayRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "RenewVpnGateway")
- return
-}
-
-func NewRenewVpnGatewayResponse() (response *RenewVpnGatewayResponse) {
- response = &RenewVpnGatewayResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(RenewVpnGateway)用于预付费(包年包月)VPN网关续费。目前只支持IPSEC网关。
-func (c *Client) RenewVpnGateway(request *RenewVpnGatewayRequest) (response *RenewVpnGatewayResponse, err error) {
- if request == nil {
- request = NewRenewVpnGatewayRequest()
- }
- response = NewRenewVpnGatewayResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewReplaceDirectConnectGatewayCcnRoutesRequest() (request *ReplaceDirectConnectGatewayCcnRoutesRequest) {
- request = &ReplaceDirectConnectGatewayCcnRoutesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ReplaceDirectConnectGatewayCcnRoutes")
- return
-}
-
-func NewReplaceDirectConnectGatewayCcnRoutesResponse() (response *ReplaceDirectConnectGatewayCcnRoutesResponse) {
- response = &ReplaceDirectConnectGatewayCcnRoutesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ReplaceDirectConnectGatewayCcnRoutes)根据路由ID(RouteId)修改指定的路由(Route),支持批量修改。
-func (c *Client) ReplaceDirectConnectGatewayCcnRoutes(request *ReplaceDirectConnectGatewayCcnRoutesRequest) (response *ReplaceDirectConnectGatewayCcnRoutesResponse, err error) {
- if request == nil {
- request = NewReplaceDirectConnectGatewayCcnRoutesRequest()
- }
- response = NewReplaceDirectConnectGatewayCcnRoutesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewReplaceRouteTableAssociationRequest() (request *ReplaceRouteTableAssociationRequest) {
- request = &ReplaceRouteTableAssociationRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ReplaceRouteTableAssociation")
- return
-}
-
-func NewReplaceRouteTableAssociationResponse() (response *ReplaceRouteTableAssociationResponse) {
- response = &ReplaceRouteTableAssociationResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ReplaceRouteTableAssociation)用于修改子网(Subnet)关联的路由表(RouteTable)。
-// * 一个子网只能关联一个路由表。
-func (c *Client) ReplaceRouteTableAssociation(request *ReplaceRouteTableAssociationRequest) (response *ReplaceRouteTableAssociationResponse, err error) {
- if request == nil {
- request = NewReplaceRouteTableAssociationRequest()
- }
- response = NewReplaceRouteTableAssociationResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewReplaceRoutesRequest() (request *ReplaceRoutesRequest) {
- request = &ReplaceRoutesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ReplaceRoutes")
- return
-}
-
-func NewReplaceRoutesResponse() (response *ReplaceRoutesResponse) {
- response = &ReplaceRoutesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ReplaceRoutes)根据路由策略ID(RouteId)修改指定的路由策略(Route),支持批量修改。
-func (c *Client) ReplaceRoutes(request *ReplaceRoutesRequest) (response *ReplaceRoutesResponse, err error) {
- if request == nil {
- request = NewReplaceRoutesRequest()
- }
- response = NewReplaceRoutesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewReplaceSecurityGroupPolicyRequest() (request *ReplaceSecurityGroupPolicyRequest) {
- request = &ReplaceSecurityGroupPolicyRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ReplaceSecurityGroupPolicy")
- return
-}
-
-func NewReplaceSecurityGroupPolicyResponse() (response *ReplaceSecurityGroupPolicyResponse) {
- response = &ReplaceSecurityGroupPolicyResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ReplaceSecurityGroupPolicy)用于替换单条安全组规则(SecurityGroupPolicy)。
-// 单个请求中只能替换单个方向的一条规则, 必须要指定索引(PolicyIndex)。
-func (c *Client) ReplaceSecurityGroupPolicy(request *ReplaceSecurityGroupPolicyRequest) (response *ReplaceSecurityGroupPolicyResponse, err error) {
- if request == nil {
- request = NewReplaceSecurityGroupPolicyRequest()
- }
- response = NewReplaceSecurityGroupPolicyResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewResetAttachCcnInstancesRequest() (request *ResetAttachCcnInstancesRequest) {
- request = &ResetAttachCcnInstancesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ResetAttachCcnInstances")
- return
-}
-
-func NewResetAttachCcnInstancesResponse() (response *ResetAttachCcnInstancesResponse) {
- response = &ResetAttachCcnInstancesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ResetAttachCcnInstances)用于跨账号关联实例申请过期时,重新申请关联操作。
-func (c *Client) ResetAttachCcnInstances(request *ResetAttachCcnInstancesRequest) (response *ResetAttachCcnInstancesResponse, err error) {
- if request == nil {
- request = NewResetAttachCcnInstancesRequest()
- }
- response = NewResetAttachCcnInstancesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewResetRoutesRequest() (request *ResetRoutesRequest) {
- request = &ResetRoutesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ResetRoutes")
- return
-}
-
-func NewResetRoutesResponse() (response *ResetRoutesResponse) {
- response = &ResetRoutesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ResetRoutes)用于对某个路由表名称和所有路由策略(Route)进行重新设置。
-// 注意: 调用本接口是先删除当前路由表中所有路由策略, 再保存新提交的路由策略内容, 会引起网络中断。
-func (c *Client) ResetRoutes(request *ResetRoutesRequest) (response *ResetRoutesResponse, err error) {
- if request == nil {
- request = NewResetRoutesRequest()
- }
- response = NewResetRoutesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewResetVpnConnectionRequest() (request *ResetVpnConnectionRequest) {
- request = &ResetVpnConnectionRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ResetVpnConnection")
- return
-}
-
-func NewResetVpnConnectionResponse() (response *ResetVpnConnectionResponse) {
- response = &ResetVpnConnectionResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ResetVpnConnection)用于重置VPN通道。
-func (c *Client) ResetVpnConnection(request *ResetVpnConnectionRequest) (response *ResetVpnConnectionResponse, err error) {
- if request == nil {
- request = NewResetVpnConnectionRequest()
- }
- response = NewResetVpnConnectionResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewResetVpnGatewayInternetMaxBandwidthRequest() (request *ResetVpnGatewayInternetMaxBandwidthRequest) {
- request = &ResetVpnGatewayInternetMaxBandwidthRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "ResetVpnGatewayInternetMaxBandwidth")
- return
-}
-
-func NewResetVpnGatewayInternetMaxBandwidthResponse() (response *ResetVpnGatewayInternetMaxBandwidthResponse) {
- response = &ResetVpnGatewayInternetMaxBandwidthResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(ResetVpnGatewayInternetMaxBandwidth)调整VPN网关带宽上限。目前支持升级配置,如果是包年包月VPN网关需要在有效期内。
-func (c *Client) ResetVpnGatewayInternetMaxBandwidth(request *ResetVpnGatewayInternetMaxBandwidthRequest) (response *ResetVpnGatewayInternetMaxBandwidthResponse, err error) {
- if request == nil {
- request = NewResetVpnGatewayInternetMaxBandwidthRequest()
- }
- response = NewResetVpnGatewayInternetMaxBandwidthResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewSetCcnRegionBandwidthLimitsRequest() (request *SetCcnRegionBandwidthLimitsRequest) {
- request = &SetCcnRegionBandwidthLimitsRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "SetCcnRegionBandwidthLimits")
- return
-}
-
-func NewSetCcnRegionBandwidthLimitsResponse() (response *SetCcnRegionBandwidthLimitsResponse) {
- response = &SetCcnRegionBandwidthLimitsResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(SetCcnRegionBandwidthLimits)用于设置云联网(CCN)各地域出带宽上限,该接口只能设置已关联网络实例包含的地域的出带宽上限
-func (c *Client) SetCcnRegionBandwidthLimits(request *SetCcnRegionBandwidthLimitsRequest) (response *SetCcnRegionBandwidthLimitsResponse, err error) {
- if request == nil {
- request = NewSetCcnRegionBandwidthLimitsRequest()
- }
- response = NewSetCcnRegionBandwidthLimitsResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewTransformAddressRequest() (request *TransformAddressRequest) {
- request = &TransformAddressRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "TransformAddress")
- return
-}
-
-func NewTransformAddressResponse() (response *TransformAddressResponse) {
- response = &TransformAddressResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口 (TransformAddress) 用于将实例的普通公网 IP 转换为[弹性公网IP](https://cloud.tencent.com/document/product/213/1941)(简称 EIP)。
-// * 平台对用户每地域每日解绑 EIP 重新分配普通公网 IP 次数有所限制(可参见 [EIP 产品简介](/document/product/213/1941))。上述配额可通过 [DescribeAddressQuota](https://cloud.tencent.com/document/api/213/1378) 接口获取。
-func (c *Client) TransformAddress(request *TransformAddressRequest) (response *TransformAddressResponse, err error) {
- if request == nil {
- request = NewTransformAddressRequest()
- }
- response = NewTransformAddressResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewUnassignIpv6AddressesRequest() (request *UnassignIpv6AddressesRequest) {
- request = &UnassignIpv6AddressesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "UnassignIpv6Addresses")
- return
-}
-
-func NewUnassignIpv6AddressesResponse() (response *UnassignIpv6AddressesResponse) {
- response = &UnassignIpv6AddressesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(UnassignIpv6Addresses)用于释放弹性网卡`IPv6`地址。
-// 本接口是异步完成,如需查询异步任务执行结果,请使用本接口返回的`RequestId`轮询`QueryTask`接口。
-func (c *Client) UnassignIpv6Addresses(request *UnassignIpv6AddressesRequest) (response *UnassignIpv6AddressesResponse, err error) {
- if request == nil {
- request = NewUnassignIpv6AddressesRequest()
- }
- response = NewUnassignIpv6AddressesResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewUnassignIpv6CidrBlockRequest() (request *UnassignIpv6CidrBlockRequest) {
- request = &UnassignIpv6CidrBlockRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "UnassignIpv6CidrBlock")
- return
-}
-
-func NewUnassignIpv6CidrBlockResponse() (response *UnassignIpv6CidrBlockResponse) {
- response = &UnassignIpv6CidrBlockResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(UnassignIpv6CidrBlock)用于释放IPv6网段。
-// 网段如果还有IP占用且未回收,则网段无法释放。
-func (c *Client) UnassignIpv6CidrBlock(request *UnassignIpv6CidrBlockRequest) (response *UnassignIpv6CidrBlockResponse, err error) {
- if request == nil {
- request = NewUnassignIpv6CidrBlockRequest()
- }
- response = NewUnassignIpv6CidrBlockResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewUnassignIpv6SubnetCidrBlockRequest() (request *UnassignIpv6SubnetCidrBlockRequest) {
- request = &UnassignIpv6SubnetCidrBlockRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "UnassignIpv6SubnetCidrBlock")
- return
-}
-
-func NewUnassignIpv6SubnetCidrBlockResponse() (response *UnassignIpv6SubnetCidrBlockResponse) {
- response = &UnassignIpv6SubnetCidrBlockResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(UnassignIpv6SubnetCidrBlock)用于释放IPv6子网段。
-// 子网段如果还有IP占用且未回收,则子网段无法释放。
-func (c *Client) UnassignIpv6SubnetCidrBlock(request *UnassignIpv6SubnetCidrBlockRequest) (response *UnassignIpv6SubnetCidrBlockResponse, err error) {
- if request == nil {
- request = NewUnassignIpv6SubnetCidrBlockRequest()
- }
- response = NewUnassignIpv6SubnetCidrBlockResponse()
- err = c.Send(request, response)
- return
-}
-
-func NewUnassignPrivateIpAddressesRequest() (request *UnassignPrivateIpAddressesRequest) {
- request = &UnassignPrivateIpAddressesRequest{
- BaseRequest: &tchttp.BaseRequest{},
- }
- request.Init().WithApiInfo("vpc", APIVersion, "UnassignPrivateIpAddresses")
- return
-}
-
-func NewUnassignPrivateIpAddressesResponse() (response *UnassignPrivateIpAddressesResponse) {
- response = &UnassignPrivateIpAddressesResponse{
- BaseResponse: &tchttp.BaseResponse{},
- }
- return
-}
-
-// 本接口(UnassignPrivateIpAddresses)用于弹性网卡退还内网 IP。
-// * 退还弹性网卡上的辅助内网IP,接口自动解关联弹性公网 IP。不能退还弹性网卡的主内网IP。
-func (c *Client) UnassignPrivateIpAddresses(request *UnassignPrivateIpAddressesRequest) (response *UnassignPrivateIpAddressesResponse, err error) {
- if request == nil {
- request = NewUnassignPrivateIpAddressesRequest()
- }
- response = NewUnassignPrivateIpAddressesResponse()
- err = c.Send(request, response)
- return
-}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312/models.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312/models.go
deleted file mode 100644
index 7740d3f..0000000
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312/models.go
+++ /dev/null
@@ -1,7670 +0,0 @@
-// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package v20170312
-
-import (
- "encoding/json"
-
- tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http"
-)
-
-type AcceptAttachCcnInstancesRequest struct {
- *tchttp.BaseRequest
-
- // CCN实例ID。形如:ccn-f49l6u0z。
- CcnId *string `json:"CcnId,omitempty" name:"CcnId"`
-
- // 接受关联实例列表。
- Instances []*CcnInstance `json:"Instances,omitempty" name:"Instances" list`
-}
-
-func (r *AcceptAttachCcnInstancesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AcceptAttachCcnInstancesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AcceptAttachCcnInstancesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *AcceptAttachCcnInstancesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AcceptAttachCcnInstancesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AccountAttribute struct {
-
- // 属性名
- AttributeName *string `json:"AttributeName,omitempty" name:"AttributeName"`
-
- // 属性值
- AttributeValues []*string `json:"AttributeValues,omitempty" name:"AttributeValues" list`
-}
-
-type AddBandwidthPackageResourcesRequest struct {
- *tchttp.BaseRequest
-
- // 资源Id,形如'eip-xxxx', 'lb-xxxx'
- ResourceIds []*string `json:"ResourceIds,omitempty" name:"ResourceIds" list`
-
- // 带宽包唯一标识ID,形如'bwp-xxxx'
- BandwidthPackageId *string `json:"BandwidthPackageId,omitempty" name:"BandwidthPackageId"`
-
- // 带宽包类型,包括'BGP', 'SINGLEISP', 'ANYCAST'
- NetworkType *string `json:"NetworkType,omitempty" name:"NetworkType"`
-
- // 资源类型,包括'Address', 'LoadBalance'
- ResourceType *string `json:"ResourceType,omitempty" name:"ResourceType"`
-}
-
-func (r *AddBandwidthPackageResourcesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AddBandwidthPackageResourcesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AddBandwidthPackageResourcesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *AddBandwidthPackageResourcesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AddBandwidthPackageResourcesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AddIp6RulesRequest struct {
- *tchttp.BaseRequest
-
- // IPV6转换实例唯一ID,形如ip6-xxxxxxxx
- Ip6TranslatorId *string `json:"Ip6TranslatorId,omitempty" name:"Ip6TranslatorId"`
-
- // IPV6转换规则信息
- Ip6RuleInfos []*Ip6RuleInfo `json:"Ip6RuleInfos,omitempty" name:"Ip6RuleInfos" list`
-
- // IPV6转换规则名称
- Ip6RuleName *string `json:"Ip6RuleName,omitempty" name:"Ip6RuleName"`
-}
-
-func (r *AddIp6RulesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AddIp6RulesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AddIp6RulesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // IPV6转换规则唯一ID数组,形如rule6-xxxxxxxx
- Ip6RuleSet []*string `json:"Ip6RuleSet,omitempty" name:"Ip6RuleSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *AddIp6RulesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AddIp6RulesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type Address struct {
-
- // `EIP`的`ID`,是`EIP`的唯一标识。
- AddressId *string `json:"AddressId,omitempty" name:"AddressId"`
-
- // `EIP`名称。
- AddressName *string `json:"AddressName,omitempty" name:"AddressName"`
-
- // `EIP`状态。
- AddressStatus *string `json:"AddressStatus,omitempty" name:"AddressStatus"`
-
- // 外网IP地址
- AddressIp *string `json:"AddressIp,omitempty" name:"AddressIp"`
-
- // 绑定的资源实例`ID`。可能是一个`CVM`,`NAT`。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 创建时间。按照`ISO8601`标准表示,并且使用`UTC`时间。格式为:`YYYY-MM-DDThh:mm:ssZ`。
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-
- // 绑定的弹性网卡ID
- NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"`
-
- // 绑定的资源内网ip
- PrivateAddressIp *string `json:"PrivateAddressIp,omitempty" name:"PrivateAddressIp"`
-
- // 资源隔离状态。true表示eip处于隔离状态,false表示资源处于未隔离状态
- IsArrears *bool `json:"IsArrears,omitempty" name:"IsArrears"`
-
- // 资源封堵状态。true表示eip处于封堵状态,false表示eip处于未封堵状态
- IsBlocked *bool `json:"IsBlocked,omitempty" name:"IsBlocked"`
-
- // eip是否支持直通模式。true表示eip支持直通模式,false表示资源不支持直通模式
- IsEipDirectConnection *bool `json:"IsEipDirectConnection,omitempty" name:"IsEipDirectConnection"`
-
- // eip资源类型,包括"CalcIP","WanIP","EIP","AnycastEIP"。其中"CalcIP"表示设备ip,“WanIP”表示普通公网ip,“EIP”表示弹性公网ip,“AnycastEip”表示加速EIP
- AddressType *string `json:"AddressType,omitempty" name:"AddressType"`
-
- // eip是否在解绑后自动释放。true表示eip将会在解绑后自动释放,false表示eip在解绑后不会自动释放
- CascadeRelease *bool `json:"CascadeRelease,omitempty" name:"CascadeRelease"`
-}
-
-type AddressTemplate struct {
-
- // IP地址模板名称。
- AddressTemplateName *string `json:"AddressTemplateName,omitempty" name:"AddressTemplateName"`
-
- // IP地址模板实例唯一ID。
- AddressTemplateId *string `json:"AddressTemplateId,omitempty" name:"AddressTemplateId"`
-
- // IP地址信息。
- AddressSet []*string `json:"AddressSet,omitempty" name:"AddressSet" list`
-
- // 创建时间。
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-}
-
-type AddressTemplateGroup struct {
-
- // IP地址模板集合名称。
- AddressTemplateGroupName *string `json:"AddressTemplateGroupName,omitempty" name:"AddressTemplateGroupName"`
-
- // IP地址模板集合实例ID,例如:ipmg-dih8xdbq。
- AddressTemplateGroupId *string `json:"AddressTemplateGroupId,omitempty" name:"AddressTemplateGroupId"`
-
- // IP地址模板ID。
- AddressTemplateIdSet []*string `json:"AddressTemplateIdSet,omitempty" name:"AddressTemplateIdSet" list`
-
- // 创建时间。
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-}
-
-type AddressTemplateSpecification struct {
-
- // IP地址ID,例如:ipm-2uw6ujo6。
- AddressId *string `json:"AddressId,omitempty" name:"AddressId"`
-
- // IP地址组ID,例如:ipmg-2uw6ujo6。
- AddressGroupId *string `json:"AddressGroupId,omitempty" name:"AddressGroupId"`
-}
-
-type AllocateAddressesRequest struct {
- *tchttp.BaseRequest
-
- // 申请 EIP 数量,默认值为1。
- AddressCount *int64 `json:"AddressCount,omitempty" name:"AddressCount"`
-}
-
-func (r *AllocateAddressesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AllocateAddressesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AllocateAddressesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 申请到的 EIP 的唯一 ID 列表。
- AddressSet []*string `json:"AddressSet,omitempty" name:"AddressSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *AllocateAddressesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AllocateAddressesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AssignIpv6AddressesRequest struct {
- *tchttp.BaseRequest
-
- // 弹性网卡实例`ID`,形如:`eni-m6dyj72l`。
- NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"`
-
- // 指定的`IPv6`地址列表,单次最多指定10个。与入参`Ipv6AddressCount`合并计算配额。
- Ipv6Addresses []*Ipv6Address `json:"Ipv6Addresses,omitempty" name:"Ipv6Addresses" list`
-
- // 自动分配`IPv6`地址个数,内网IP地址个数总和不能超过配数。与入参`Ipv6Addresses`合并计算配额。
- Ipv6AddressCount *uint64 `json:"Ipv6AddressCount,omitempty" name:"Ipv6AddressCount"`
-}
-
-func (r *AssignIpv6AddressesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AssignIpv6AddressesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AssignIpv6AddressesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 分配给弹性网卡的`IPv6`地址列表。
- Ipv6AddressSet []*Ipv6Address `json:"Ipv6AddressSet,omitempty" name:"Ipv6AddressSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *AssignIpv6AddressesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AssignIpv6AddressesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AssignIpv6CidrBlockRequest struct {
- *tchttp.BaseRequest
-
- // `VPC`实例`ID`,形如:`vpc-f49l6u0z`。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-}
-
-func (r *AssignIpv6CidrBlockRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AssignIpv6CidrBlockRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AssignIpv6CidrBlockResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 分配的 `IPv6` 网段。形如:`3402:4e00:20:1000::/56`
- Ipv6CidrBlock *string `json:"Ipv6CidrBlock,omitempty" name:"Ipv6CidrBlock"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *AssignIpv6CidrBlockResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AssignIpv6CidrBlockResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AssignIpv6SubnetCidrBlockRequest struct {
- *tchttp.BaseRequest
-
- // 子网所在私有网络`ID`。形如:`vpc-f49l6u0z`。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 分配 `IPv6` 子网段列表。
- Ipv6SubnetCidrBlocks []*Ipv6SubnetCidrBlock `json:"Ipv6SubnetCidrBlocks,omitempty" name:"Ipv6SubnetCidrBlocks" list`
-}
-
-func (r *AssignIpv6SubnetCidrBlockRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AssignIpv6SubnetCidrBlockRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AssignIpv6SubnetCidrBlockResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 分配 `IPv6` 子网段列表。
- Ipv6SubnetCidrBlockSet []*Ipv6SubnetCidrBlock `json:"Ipv6SubnetCidrBlockSet,omitempty" name:"Ipv6SubnetCidrBlockSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *AssignIpv6SubnetCidrBlockResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AssignIpv6SubnetCidrBlockResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AssignPrivateIpAddressesRequest struct {
- *tchttp.BaseRequest
-
- // 弹性网卡实例ID,例如:eni-m6dyj72l。
- NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"`
-
- // 指定的内网IP信息,单次最多指定10个。
- PrivateIpAddresses []*PrivateIpAddressSpecification `json:"PrivateIpAddresses,omitempty" name:"PrivateIpAddresses" list`
-
- // 新申请的内网IP地址个数,内网IP地址个数总和不能超过配数。
- SecondaryPrivateIpAddressCount *uint64 `json:"SecondaryPrivateIpAddressCount,omitempty" name:"SecondaryPrivateIpAddressCount"`
-}
-
-func (r *AssignPrivateIpAddressesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AssignPrivateIpAddressesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AssignPrivateIpAddressesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 内网IP详细信息。
- PrivateIpAddressSet []*PrivateIpAddressSpecification `json:"PrivateIpAddressSet,omitempty" name:"PrivateIpAddressSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *AssignPrivateIpAddressesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AssignPrivateIpAddressesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AssociateAddressRequest struct {
- *tchttp.BaseRequest
-
- // 标识 EIP 的唯一 ID。EIP 唯一 ID 形如:`eip-11112222`。
- AddressId *string `json:"AddressId,omitempty" name:"AddressId"`
-
- // 要绑定的实例 ID。实例 ID 形如:`ins-11112222`。可通过登录[控制台](https://console.cloud.tencent.com/cvm)查询,也可通过 [DescribeInstances](https://cloud.tencent.com/document/api/213/15728) 接口返回值中的`InstanceId`获取。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 要绑定的弹性网卡 ID。 弹性网卡 ID 形如:`eni-11112222`。`NetworkInterfaceId` 与 `InstanceId` 不可同时指定。弹性网卡 ID 可通过登录[控制台](https://console.cloud.tencent.com/vpc/eni)查询,也可通过[DescribeNetworkInterfaces](https://cloud.tencent.com/document/api/215/15817)接口返回值中的`networkInterfaceId`获取。
- NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"`
-
- // 要绑定的内网 IP。如果指定了 `NetworkInterfaceId` 则也必须指定 `PrivateIpAddress` ,表示将 EIP 绑定到指定弹性网卡的指定内网 IP 上。同时要确保指定的 `PrivateIpAddress` 是指定的 `NetworkInterfaceId` 上的一个内网 IP。指定弹性网卡的内网 IP 可通过登录[控制台](https://console.cloud.tencent.com/vpc/eni)查询,也可通过[DescribeNetworkInterfaces](https://cloud.tencent.com/document/api/215/15817)接口返回值中的`privateIpAddress`获取。
- PrivateIpAddress *string `json:"PrivateIpAddress,omitempty" name:"PrivateIpAddress"`
-}
-
-func (r *AssociateAddressRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AssociateAddressRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AssociateAddressResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *AssociateAddressResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AssociateAddressResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AttachCcnInstancesRequest struct {
- *tchttp.BaseRequest
-
- // CCN实例ID。形如:ccn-f49l6u0z。
- CcnId *string `json:"CcnId,omitempty" name:"CcnId"`
-
- // 关联网络实例列表
- Instances []*CcnInstance `json:"Instances,omitempty" name:"Instances" list`
-
- // CCN所属UIN(根账号),默认当前账号所属UIN
- CcnUin *string `json:"CcnUin,omitempty" name:"CcnUin"`
-}
-
-func (r *AttachCcnInstancesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AttachCcnInstancesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AttachCcnInstancesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *AttachCcnInstancesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AttachCcnInstancesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AttachClassicLinkVpcRequest struct {
- *tchttp.BaseRequest
-
- // VPC实例ID
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // CVM实例ID
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-}
-
-func (r *AttachClassicLinkVpcRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AttachClassicLinkVpcRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AttachClassicLinkVpcResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *AttachClassicLinkVpcResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AttachClassicLinkVpcResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AttachNetworkInterfaceRequest struct {
- *tchttp.BaseRequest
-
- // 弹性网卡实例ID,例如:eni-m6dyj72l。
- NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"`
-
- // CVM实例ID。形如:ins-r8hr2upy。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *AttachNetworkInterfaceRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AttachNetworkInterfaceRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type AttachNetworkInterfaceResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *AttachNetworkInterfaceResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *AttachNetworkInterfaceResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type BandwidthPackage struct {
-
- // 带宽包唯一标识Id
- BandwidthPackageId *string `json:"BandwidthPackageId,omitempty" name:"BandwidthPackageId"`
-
- // 带宽包类型,包括'BGP','SINGLEISP','ANYCAST'
- NetworkType *string `json:"NetworkType,omitempty" name:"NetworkType"`
-
- // 带宽包计费类型,包括'TOP5_POSTPAID_BY_MONTH'和'PERCENT95_POSTPAID_BY_MONTH'
- ChargeType *string `json:"ChargeType,omitempty" name:"ChargeType"`
-
- // 带宽包名称
- BandwidthPackageName *string `json:"BandwidthPackageName,omitempty" name:"BandwidthPackageName"`
-
- // 带宽包创建时间。按照`ISO8601`标准表示,并且使用`UTC`时间。格式为:`YYYY-MM-DDThh:mm:ssZ`。
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-
- // 带宽包状态,包括'CREATING','CREATED','DELETING','DELETED'
- Status *string `json:"Status,omitempty" name:"Status"`
-
- // 带宽包资源信息
- ResourceSet []*Resource `json:"ResourceSet,omitempty" name:"ResourceSet" list`
-
- // 带宽包限速大小。单位:Mbps,-1表示不限速。
- Bandwidth *int64 `json:"Bandwidth,omitempty" name:"Bandwidth"`
-}
-
-type CCN struct {
-
- // 云联网唯一ID
- CcnId *string `json:"CcnId,omitempty" name:"CcnId"`
-
- // 云联网名称
- CcnName *string `json:"CcnName,omitempty" name:"CcnName"`
-
- // 云联网描述信息
- CcnDescription *string `json:"CcnDescription,omitempty" name:"CcnDescription"`
-
- // 关联实例数量
- InstanceCount *uint64 `json:"InstanceCount,omitempty" name:"InstanceCount"`
-
- // 创建时间
- CreateTime *string `json:"CreateTime,omitempty" name:"CreateTime"`
-
- // 实例状态, 'ISOLATED': 隔离中(欠费停服),'AVAILABLE':运行中。
- State *string `json:"State,omitempty" name:"State"`
-
- // 实例服务质量,’PT’:白金,'AU':金,'AG':银。
- QosLevel *string `json:"QosLevel,omitempty" name:"QosLevel"`
-
- // 付费类型,PREPAID为预付费,POSTPAID为后付费。
- // 注意:此字段可能返回 null,表示取不到有效值。
- InstanceChargeType *string `json:"InstanceChargeType,omitempty" name:"InstanceChargeType"`
-
- // 限速类型,INTER_REGION_LIMIT为地域间限速;OUTER_REGION_LIMIT为地域出口限速。
- // 注意:此字段可能返回 null,表示取不到有效值。
- BandwidthLimitType *string `json:"BandwidthLimitType,omitempty" name:"BandwidthLimitType"`
-}
-
-type CcnAttachedInstance struct {
-
- // 云联网实例ID。
- CcnId *string `json:"CcnId,omitempty" name:"CcnId"`
-
- // 关联实例类型:
- // `VPC`:私有网络
- // `DIRECTCONNECT`:专线网关
- // `BMVPC`:黑石私有网络
- InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"`
-
- // 关联实例ID。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 关联实例名称。
- InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"`
-
- // 关联实例所属大区,例如:ap-guangzhou。
- InstanceRegion *string `json:"InstanceRegion,omitempty" name:"InstanceRegion"`
-
- // 关联实例所属UIN(根账号)。
- InstanceUin *string `json:"InstanceUin,omitempty" name:"InstanceUin"`
-
- // 关联实例CIDR。
- CidrBlock []*string `json:"CidrBlock,omitempty" name:"CidrBlock" list`
-
- // 关联实例状态:
- // `PENDING`:申请中
- // `ACTIVE`:已连接
- // `EXPIRED`:已过期
- // `REJECTED`:已拒绝
- // `DELETED`:已删除
- // `FAILED`:失败的(2小时后将异步强制解关联)
- // `ATTACHING`:关联中
- // `DETACHING`:解关联中
- // `DETACHFAILED`:解关联失败(2小时后将异步强制解关联)
- State *string `json:"State,omitempty" name:"State"`
-
- // 关联时间。
- AttachedTime *string `json:"AttachedTime,omitempty" name:"AttachedTime"`
-
- // 云联网所属UIN(根账号)。
- CcnUin *string `json:"CcnUin,omitempty" name:"CcnUin"`
-}
-
-type CcnInstance struct {
-
- // 关联实例ID。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 关联实例ID所属大区,例如:ap-guangzhou。
- InstanceRegion *string `json:"InstanceRegion,omitempty" name:"InstanceRegion"`
-
- // 关联实例类型,可选值:
- // `VPC`:私有网络
- // `DIRECTCONNECT`:专线网关
- // `BMVPC`:黑石私有网络
- InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"`
-}
-
-type CcnRegionBandwidthLimit struct {
-
- // 地域,例如:ap-guangzhou
- Region *string `json:"Region,omitempty" name:"Region"`
-
- // 出带宽上限,单位:Mbps
- BandwidthLimit *uint64 `json:"BandwidthLimit,omitempty" name:"BandwidthLimit"`
-
- // 是否黑石地域,默认`false`。
- IsBm *bool `json:"IsBm,omitempty" name:"IsBm"`
-
- // 目的地域,例如:ap-shanghai
- // 注意:此字段可能返回 null,表示取不到有效值。
- DstRegion *string `json:"DstRegion,omitempty" name:"DstRegion"`
-
- // 目的地域是否为黑石地域,默认`false`。
- DstIsBm *bool `json:"DstIsBm,omitempty" name:"DstIsBm"`
-}
-
-type CcnRoute struct {
-
- // 路由策略ID
- RouteId *string `json:"RouteId,omitempty" name:"RouteId"`
-
- // 目的端
- DestinationCidrBlock *string `json:"DestinationCidrBlock,omitempty" name:"DestinationCidrBlock"`
-
- // 下一跳类型(关联实例类型),所有类型:VPC、DIRECTCONNECT
- InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"`
-
- // 下一跳(关联实例)
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 下一跳名称(关联实例名称)
- InstanceName *string `json:"InstanceName,omitempty" name:"InstanceName"`
-
- // 下一跳所属地域(关联实例所属地域)
- InstanceRegion *string `json:"InstanceRegion,omitempty" name:"InstanceRegion"`
-
- // 更新时间
- UpdateTime *string `json:"UpdateTime,omitempty" name:"UpdateTime"`
-
- // 路由是否启用
- Enabled *bool `json:"Enabled,omitempty" name:"Enabled"`
-
- // 关联实例所属UIN(根账号)
- InstanceUin *string `json:"InstanceUin,omitempty" name:"InstanceUin"`
-}
-
-type ClassicLinkInstance struct {
-
- // VPC实例ID
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 云服务器实例唯一ID
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-type CreateAddressTemplateGroupRequest struct {
- *tchttp.BaseRequest
-
- // IP地址模版集合名称。
- AddressTemplateGroupName *string `json:"AddressTemplateGroupName,omitempty" name:"AddressTemplateGroupName"`
-
- // IP地址模版实例ID,例如:ipm-mdunqeb6。
- AddressTemplateIds []*string `json:"AddressTemplateIds,omitempty" name:"AddressTemplateIds" list`
-}
-
-func (r *CreateAddressTemplateGroupRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateAddressTemplateGroupRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateAddressTemplateGroupResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // IP地址模板集合对象。
- AddressTemplateGroup *AddressTemplateGroup `json:"AddressTemplateGroup,omitempty" name:"AddressTemplateGroup"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateAddressTemplateGroupResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateAddressTemplateGroupResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateAddressTemplateRequest struct {
- *tchttp.BaseRequest
-
- // IP地址模版名称
- AddressTemplateName *string `json:"AddressTemplateName,omitempty" name:"AddressTemplateName"`
-
- // 地址信息,支持 IP、CIDR、IP 范围。
- Addresses []*string `json:"Addresses,omitempty" name:"Addresses" list`
-}
-
-func (r *CreateAddressTemplateRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateAddressTemplateRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateAddressTemplateResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // IP地址模板对象。
- AddressTemplate *AddressTemplate `json:"AddressTemplate,omitempty" name:"AddressTemplate"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateAddressTemplateResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateAddressTemplateResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateBandwidthPackageRequest struct {
- *tchttp.BaseRequest
-
- // 带宽包类型,包括'BGP','SINGLEISP','ANYCAST'
- NetworkType *string `json:"NetworkType,omitempty" name:"NetworkType"`
-
- // 带宽包计费类型,包括‘TOP5_POSTPAID_BY_MONTH’,‘PERCENT95_POSTPAID_BY_MONTH’
- ChargeType *string `json:"ChargeType,omitempty" name:"ChargeType"`
-
- // 带宽包名字
- BandwidthPackageName *string `json:"BandwidthPackageName,omitempty" name:"BandwidthPackageName"`
-
- // 带宽包数量(非上移账户只能填1)
- BandwidthPackageCount *uint64 `json:"BandwidthPackageCount,omitempty" name:"BandwidthPackageCount"`
-
- // 带宽包限速大小。单位:Mbps,-1表示不限速。
- InternetMaxBandwidth *int64 `json:"InternetMaxBandwidth,omitempty" name:"InternetMaxBandwidth"`
-}
-
-func (r *CreateBandwidthPackageRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateBandwidthPackageRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateBandwidthPackageResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 带宽包Id
- BandwidthPackageId *string `json:"BandwidthPackageId,omitempty" name:"BandwidthPackageId"`
-
- // 带宽包Ids(申请数量大于1时有效)
- BandwidthPackageIds []*string `json:"BandwidthPackageIds,omitempty" name:"BandwidthPackageIds" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateBandwidthPackageResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateBandwidthPackageResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateCcnRequest struct {
- *tchttp.BaseRequest
-
- // CCN名称,最大长度不能超过60个字节。
- CcnName *string `json:"CcnName,omitempty" name:"CcnName"`
-
- // CCN描述信息,最大长度不能超过100个字节。
- CcnDescription *string `json:"CcnDescription,omitempty" name:"CcnDescription"`
-
- // CCN服务质量,'PT':白金,'AU':金,'AG':银,默认为‘AU’。
- QosLevel *string `json:"QosLevel,omitempty" name:"QosLevel"`
-}
-
-func (r *CreateCcnRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateCcnRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateCcnResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 云联网(CCN)对象。
- Ccn *CCN `json:"Ccn,omitempty" name:"Ccn"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateCcnResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateCcnResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateCustomerGatewayRequest struct {
- *tchttp.BaseRequest
-
- // 对端网关名称,可任意命名,但不得超过60个字符。
- CustomerGatewayName *string `json:"CustomerGatewayName,omitempty" name:"CustomerGatewayName"`
-
- // 对端网关公网IP。
- IpAddress *string `json:"IpAddress,omitempty" name:"IpAddress"`
-}
-
-func (r *CreateCustomerGatewayRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateCustomerGatewayRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateCustomerGatewayResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 对端网关对象
- CustomerGateway *CustomerGateway `json:"CustomerGateway,omitempty" name:"CustomerGateway"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateCustomerGatewayResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateCustomerGatewayResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateDefaultVpcRequest struct {
- *tchttp.BaseRequest
-
- // 子网所在的可用区ID,不指定将随机选择可用区
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-
- // 是否强制返回默认VPC
- Force *bool `json:"Force,omitempty" name:"Force"`
-}
-
-func (r *CreateDefaultVpcRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateDefaultVpcRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateDefaultVpcResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 默认VPC和子网ID
- Vpc *DefaultVpcSubnet `json:"Vpc,omitempty" name:"Vpc"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateDefaultVpcResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateDefaultVpcResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateDirectConnectGatewayCcnRoutesRequest struct {
- *tchttp.BaseRequest
-
- // 专线网关ID,形如:dcg-prpqlmg1
- DirectConnectGatewayId *string `json:"DirectConnectGatewayId,omitempty" name:"DirectConnectGatewayId"`
-
- // 需要连通的IDC网段列表
- Routes []*DirectConnectGatewayCcnRoute `json:"Routes,omitempty" name:"Routes" list`
-}
-
-func (r *CreateDirectConnectGatewayCcnRoutesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateDirectConnectGatewayCcnRoutesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateDirectConnectGatewayCcnRoutesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateDirectConnectGatewayCcnRoutesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateDirectConnectGatewayCcnRoutesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateDirectConnectGatewayRequest struct {
- *tchttp.BaseRequest
-
- // 专线网关名称
- DirectConnectGatewayName *string `json:"DirectConnectGatewayName,omitempty" name:"DirectConnectGatewayName"`
-
- // 关联网络类型,可选值:
- // VPC - 私有网络
- // CCN - 云联网
- NetworkType *string `json:"NetworkType,omitempty" name:"NetworkType"`
-
- // NetworkType 为 VPC 时,这里传值为私有网络实例ID
- // NetworkType 为 CCN 时,这里传值为云联网实例ID
- NetworkInstanceId *string `json:"NetworkInstanceId,omitempty" name:"NetworkInstanceId"`
-
- // 网关类型,可选值:
- // NORMAL - (默认)标准型,注:云联网只支持标准型
- // NAT - NAT型NAT类型支持网络地址转换配置,类型确定后不能修改;一个私有网络可以创建一个NAT类型的专线网关和一个非NAT类型的专线网关
- GatewayType *string `json:"GatewayType,omitempty" name:"GatewayType"`
-}
-
-func (r *CreateDirectConnectGatewayRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateDirectConnectGatewayRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateDirectConnectGatewayResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 专线网关对象。
- DirectConnectGateway *DirectConnectGateway `json:"DirectConnectGateway,omitempty" name:"DirectConnectGateway"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateDirectConnectGatewayResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateDirectConnectGatewayResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateFlowLogRequest struct {
- *tchttp.BaseRequest
-
- // 私用网络ID或者统一ID,建议使用统一ID
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 流日志实例名字
- FlowLogName *string `json:"FlowLogName,omitempty" name:"FlowLogName"`
-
- // 流日志所属资源类型,VPC|SUBNET|NETWORKINTERFACE
- ResourceType *string `json:"ResourceType,omitempty" name:"ResourceType"`
-
- // 资源唯一ID
- ResourceId *string `json:"ResourceId,omitempty" name:"ResourceId"`
-
- // 流日志采集类型,ACCEPT|REJECT|ALL
- TrafficType *string `json:"TrafficType,omitempty" name:"TrafficType"`
-
- // 流日志存储ID
- CloudLogId *string `json:"CloudLogId,omitempty" name:"CloudLogId"`
-
- // 流日志实例描述
- FlowLogDescription *string `json:"FlowLogDescription,omitempty" name:"FlowLogDescription"`
-}
-
-func (r *CreateFlowLogRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateFlowLogRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateFlowLogResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 创建的流日志信息
- FlowLog []*FlowLog `json:"FlowLog,omitempty" name:"FlowLog" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateFlowLogResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateFlowLogResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateHaVipRequest struct {
- *tchttp.BaseRequest
-
- // `HAVIP`所在私有网络`ID`。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // `HAVIP`所在子网`ID`。
- SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"`
-
- // `HAVIP`名称。
- HaVipName *string `json:"HaVipName,omitempty" name:"HaVipName"`
-
- // 指定虚拟IP地址,必须在`VPC`网段内且未被占用。不指定则自动分配。
- Vip *string `json:"Vip,omitempty" name:"Vip"`
-}
-
-func (r *CreateHaVipRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateHaVipRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateHaVipResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // `HAVIP`对象。
- HaVip *HaVip `json:"HaVip,omitempty" name:"HaVip"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateHaVipResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateHaVipResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateIp6TranslatorsRequest struct {
- *tchttp.BaseRequest
-
- // 转换实例名称
- Ip6TranslatorName *string `json:"Ip6TranslatorName,omitempty" name:"Ip6TranslatorName"`
-
- // 创建转换实例数量,默认是1个
- Ip6TranslatorCount *int64 `json:"Ip6TranslatorCount,omitempty" name:"Ip6TranslatorCount"`
-
- // 转换实例运营商属性,可取"CMCC","CTCC","CUCC","BGP"
- Ip6InternetServiceProvider *string `json:"Ip6InternetServiceProvider,omitempty" name:"Ip6InternetServiceProvider"`
-}
-
-func (r *CreateIp6TranslatorsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateIp6TranslatorsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateIp6TranslatorsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 转换实例的唯一ID数组,形如"ip6-xxxxxxxx"
- Ip6TranslatorSet []*string `json:"Ip6TranslatorSet,omitempty" name:"Ip6TranslatorSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateIp6TranslatorsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateIp6TranslatorsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateNetworkInterfaceRequest struct {
- *tchttp.BaseRequest
-
- // VPC实例ID。可通过DescribeVpcs接口返回值中的VpcId获取。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 弹性网卡名称,最大长度不能超过60个字节。
- NetworkInterfaceName *string `json:"NetworkInterfaceName,omitempty" name:"NetworkInterfaceName"`
-
- // 弹性网卡所在的子网实例ID,例如:subnet-0ap8nwca。
- SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"`
-
- // 弹性网卡描述,可任意命名,但不得超过60个字符。
- NetworkInterfaceDescription *string `json:"NetworkInterfaceDescription,omitempty" name:"NetworkInterfaceDescription"`
-
- // 新申请的内网IP地址个数,内网IP地址个数总和不能超过配数。
- SecondaryPrivateIpAddressCount *uint64 `json:"SecondaryPrivateIpAddressCount,omitempty" name:"SecondaryPrivateIpAddressCount"`
-
- // 指定绑定的安全组,例如:['sg-1dd51d']。
- SecurityGroupIds []*string `json:"SecurityGroupIds,omitempty" name:"SecurityGroupIds" list`
-
- // 指定的内网IP信息,单次最多指定10个。
- PrivateIpAddresses []*PrivateIpAddressSpecification `json:"PrivateIpAddresses,omitempty" name:"PrivateIpAddresses" list`
-}
-
-func (r *CreateNetworkInterfaceRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateNetworkInterfaceRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateNetworkInterfaceResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 弹性网卡实例。
- NetworkInterface *NetworkInterface `json:"NetworkInterface,omitempty" name:"NetworkInterface"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateNetworkInterfaceResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateNetworkInterfaceResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateRouteTableRequest struct {
- *tchttp.BaseRequest
-
- // 待操作的VPC实例ID。可通过DescribeVpcs接口返回值中的VpcId获取。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 路由表名称,最大长度不能超过60个字节。
- RouteTableName *string `json:"RouteTableName,omitempty" name:"RouteTableName"`
-}
-
-func (r *CreateRouteTableRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateRouteTableRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateRouteTableResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 路由表对象。
- RouteTable *RouteTable `json:"RouteTable,omitempty" name:"RouteTable"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateRouteTableResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateRouteTableResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateRoutesRequest struct {
- *tchttp.BaseRequest
-
- // 路由表实例ID。
- RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"`
-
- // 路由策略对象。
- Routes []*Route `json:"Routes,omitempty" name:"Routes" list`
-}
-
-func (r *CreateRoutesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateRoutesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateRoutesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 新增的实例个数。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 路由表对象。
- RouteTableSet []*RouteTable `json:"RouteTableSet,omitempty" name:"RouteTableSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateRoutesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateRoutesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateSecurityGroupPoliciesRequest struct {
- *tchttp.BaseRequest
-
- // 安全组实例ID,例如sg-33ocnj9n,可通过DescribeSecurityGroups获取。
- SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"`
-
- // 安全组规则集合。
- SecurityGroupPolicySet *SecurityGroupPolicySet `json:"SecurityGroupPolicySet,omitempty" name:"SecurityGroupPolicySet"`
-}
-
-func (r *CreateSecurityGroupPoliciesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateSecurityGroupPoliciesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateSecurityGroupPoliciesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateSecurityGroupPoliciesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateSecurityGroupPoliciesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateSecurityGroupRequest struct {
- *tchttp.BaseRequest
-
- // 安全组名称,可任意命名,但不得超过60个字符。
- GroupName *string `json:"GroupName,omitempty" name:"GroupName"`
-
- // 安全组备注,最多100个字符。
- GroupDescription *string `json:"GroupDescription,omitempty" name:"GroupDescription"`
-
- // 项目id,默认0。可在qcloud控制台项目管理页面查询到。
- ProjectId *string `json:"ProjectId,omitempty" name:"ProjectId"`
-}
-
-func (r *CreateSecurityGroupRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateSecurityGroupRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateSecurityGroupResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 安全组对象。
- SecurityGroup *SecurityGroup `json:"SecurityGroup,omitempty" name:"SecurityGroup"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateSecurityGroupResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateSecurityGroupResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateServiceTemplateGroupRequest struct {
- *tchttp.BaseRequest
-
- // 协议端口模板集合名称
- ServiceTemplateGroupName *string `json:"ServiceTemplateGroupName,omitempty" name:"ServiceTemplateGroupName"`
-
- // 协议端口模板实例ID,例如:ppm-4dw6agho。
- ServiceTemplateIds []*string `json:"ServiceTemplateIds,omitempty" name:"ServiceTemplateIds" list`
-}
-
-func (r *CreateServiceTemplateGroupRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateServiceTemplateGroupRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateServiceTemplateGroupResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 协议端口模板集合对象。
- ServiceTemplateGroup *ServiceTemplateGroup `json:"ServiceTemplateGroup,omitempty" name:"ServiceTemplateGroup"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateServiceTemplateGroupResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateServiceTemplateGroupResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateServiceTemplateRequest struct {
- *tchttp.BaseRequest
-
- // 协议端口模板名称
- ServiceTemplateName *string `json:"ServiceTemplateName,omitempty" name:"ServiceTemplateName"`
-
- // 支持单个端口、多个端口、连续端口及所有端口,协议支持:TCP、UDP、ICMP、GRE 协议。
- Services []*string `json:"Services,omitempty" name:"Services" list`
-}
-
-func (r *CreateServiceTemplateRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateServiceTemplateRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateServiceTemplateResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 协议端口模板对象。
- ServiceTemplate *ServiceTemplate `json:"ServiceTemplate,omitempty" name:"ServiceTemplate"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateServiceTemplateResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateServiceTemplateResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateSubnetRequest struct {
- *tchttp.BaseRequest
-
- // 待操作的VPC实例ID。可通过DescribeVpcs接口返回值中的VpcId获取。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 子网名称,最大长度不能超过60个字节。
- SubnetName *string `json:"SubnetName,omitempty" name:"SubnetName"`
-
- // 子网网段,子网网段必须在VPC网段内,相同VPC内子网网段不能重叠。
- CidrBlock *string `json:"CidrBlock,omitempty" name:"CidrBlock"`
-
- // 子网所在的可用区ID,不同子网选择不同可用区可以做跨可用区灾备。
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-}
-
-func (r *CreateSubnetRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateSubnetRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateSubnetResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 子网对象。
- Subnet *Subnet `json:"Subnet,omitempty" name:"Subnet"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateSubnetResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateSubnetResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateSubnetsRequest struct {
- *tchttp.BaseRequest
-
- // `VPC`实例`ID`。形如:`vpc-6v2ht8q5`
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 子网对象列表。
- Subnets []*SubnetInput `json:"Subnets,omitempty" name:"Subnets" list`
-}
-
-func (r *CreateSubnetsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateSubnetsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateSubnetsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 新创建的子网列表。
- SubnetSet []*Subnet `json:"SubnetSet,omitempty" name:"SubnetSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateSubnetsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateSubnetsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateVpcRequest struct {
- *tchttp.BaseRequest
-
- // vpc名称,最大长度不能超过60个字节。
- VpcName *string `json:"VpcName,omitempty" name:"VpcName"`
-
- // vpc的cidr,只能为10.0.0.0/16,172.16.0.0/12,192.168.0.0/16这三个内网网段内。
- CidrBlock *string `json:"CidrBlock,omitempty" name:"CidrBlock"`
-
- // 是否开启组播。true: 开启, false: 不开启。
- EnableMulticast *string `json:"EnableMulticast,omitempty" name:"EnableMulticast"`
-
- // DNS地址,最多支持4个
- DnsServers []*string `json:"DnsServers,omitempty" name:"DnsServers" list`
-
- // 域名
- DomainName *string `json:"DomainName,omitempty" name:"DomainName"`
-}
-
-func (r *CreateVpcRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateVpcRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateVpcResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // Vpc对象。
- Vpc *Vpc `json:"Vpc,omitempty" name:"Vpc"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateVpcResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateVpcResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateVpnConnectionRequest struct {
- *tchttp.BaseRequest
-
- // VPC实例ID。可通过DescribeVpcs接口返回值中的VpcId获取。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // VPN网关实例ID。
- VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"`
-
- // 对端网关ID,例如:cgw-2wqq41m9,可通过DescribeCustomerGateways接口查询对端网关。
- CustomerGatewayId *string `json:"CustomerGatewayId,omitempty" name:"CustomerGatewayId"`
-
- // 通道名称,可任意命名,但不得超过60个字符。
- VpnConnectionName *string `json:"VpnConnectionName,omitempty" name:"VpnConnectionName"`
-
- // 预共享密钥。
- PreShareKey *string `json:"PreShareKey,omitempty" name:"PreShareKey"`
-
- // SPD策略组,例如:{"10.0.0.5/24":["172.123.10.5/16"]},10.0.0.5/24是vpc内网段172.123.10.5/16是IDC网段。用户指定VPC内哪些网段可以和您IDC中哪些网段通信。
- SecurityPolicyDatabases []*SecurityPolicyDatabase `json:"SecurityPolicyDatabases,omitempty" name:"SecurityPolicyDatabases" list`
-
- // IKE配置(Internet Key Exchange,因特网密钥交换),IKE具有一套自我保护机制,用户配置网络安全协议
- IKEOptionsSpecification *IKEOptionsSpecification `json:"IKEOptionsSpecification,omitempty" name:"IKEOptionsSpecification"`
-
- // IPSec配置,腾讯云提供IPSec安全会话设置
- IPSECOptionsSpecification *IPSECOptionsSpecification `json:"IPSECOptionsSpecification,omitempty" name:"IPSECOptionsSpecification"`
-}
-
-func (r *CreateVpnConnectionRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateVpnConnectionRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateVpnConnectionResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 通道实例对象。
- VpnConnection *VpnConnection `json:"VpnConnection,omitempty" name:"VpnConnection"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateVpnConnectionResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateVpnConnectionResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateVpnGatewayRequest struct {
- *tchttp.BaseRequest
-
- // VPC实例ID。可通过DescribeVpcs接口返回值中的VpcId获取。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // VPN网关名称,最大长度不能超过60个字节。
- VpnGatewayName *string `json:"VpnGatewayName,omitempty" name:"VpnGatewayName"`
-
- // 公网带宽设置。可选带宽规格:5, 10, 20, 50, 100;单位:Mbps
- InternetMaxBandwidthOut *uint64 `json:"InternetMaxBandwidthOut,omitempty" name:"InternetMaxBandwidthOut"`
-
- // VPN网关计费模式,PREPAID:表示预付费,即包年包月,POSTPAID_BY_HOUR:表示后付费,即按量计费。默认:POSTPAID_BY_HOUR,如果指定预付费模式,参数InstanceChargePrepaid必填。
- InstanceChargeType *string `json:"InstanceChargeType,omitempty" name:"InstanceChargeType"`
-
- // 预付费模式,即包年包月相关参数设置。通过该参数可以指定包年包月实例的购买时长、是否设置自动续费等属性。若指定实例的付费模式为预付费则该参数必传。
- InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid,omitempty" name:"InstanceChargePrepaid"`
-
- // 可用区,如:ap-guangzhou-2。
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-}
-
-func (r *CreateVpnGatewayRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateVpnGatewayRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CreateVpnGatewayResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // VPN网关对象
- VpnGateway *VpnGateway `json:"VpnGateway,omitempty" name:"VpnGateway"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *CreateVpnGatewayResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *CreateVpnGatewayResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type CustomerGateway struct {
-
- // 用户网关唯一ID
- CustomerGatewayId *string `json:"CustomerGatewayId,omitempty" name:"CustomerGatewayId"`
-
- // 网关名称
- CustomerGatewayName *string `json:"CustomerGatewayName,omitempty" name:"CustomerGatewayName"`
-
- // 公网地址
- IpAddress *string `json:"IpAddress,omitempty" name:"IpAddress"`
-
- // 创建时间
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-}
-
-type CustomerGatewayVendor struct {
-
- // 平台。
- Platform *string `json:"Platform,omitempty" name:"Platform"`
-
- // 软件版本。
- SoftwareVersion *string `json:"SoftwareVersion,omitempty" name:"SoftwareVersion"`
-
- // 供应商名称。
- VendorName *string `json:"VendorName,omitempty" name:"VendorName"`
-}
-
-type DefaultVpcSubnet struct {
-
- // 默认VpcId
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 默认SubnetId
- SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"`
-}
-
-type DeleteAddressTemplateGroupRequest struct {
- *tchttp.BaseRequest
-
- // IP地址模板集合实例ID,例如:ipmg-90cex8mq。
- AddressTemplateGroupId *string `json:"AddressTemplateGroupId,omitempty" name:"AddressTemplateGroupId"`
-}
-
-func (r *DeleteAddressTemplateGroupRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteAddressTemplateGroupRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteAddressTemplateGroupResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteAddressTemplateGroupResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteAddressTemplateGroupResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteAddressTemplateRequest struct {
- *tchttp.BaseRequest
-
- // IP地址模板实例ID,例如:ipm-09o5m8kc。
- AddressTemplateId *string `json:"AddressTemplateId,omitempty" name:"AddressTemplateId"`
-}
-
-func (r *DeleteAddressTemplateRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteAddressTemplateRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteAddressTemplateResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteAddressTemplateResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteAddressTemplateResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteBandwidthPackageRequest struct {
- *tchttp.BaseRequest
-
- // 待删除带宽包bwpId
- BandwidthPackageId *string `json:"BandwidthPackageId,omitempty" name:"BandwidthPackageId"`
-}
-
-func (r *DeleteBandwidthPackageRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteBandwidthPackageRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteBandwidthPackageResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteBandwidthPackageResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteBandwidthPackageResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteCcnRequest struct {
- *tchttp.BaseRequest
-
- // CCN实例ID。形如:ccn-f49l6u0z。
- CcnId *string `json:"CcnId,omitempty" name:"CcnId"`
-}
-
-func (r *DeleteCcnRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteCcnRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteCcnResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteCcnResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteCcnResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteCustomerGatewayRequest struct {
- *tchttp.BaseRequest
-
- // 对端网关ID,例如:cgw-2wqq41m9,可通过DescribeCustomerGateways接口查询对端网关。
- CustomerGatewayId *string `json:"CustomerGatewayId,omitempty" name:"CustomerGatewayId"`
-}
-
-func (r *DeleteCustomerGatewayRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteCustomerGatewayRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteCustomerGatewayResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteCustomerGatewayResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteCustomerGatewayResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteDirectConnectGatewayCcnRoutesRequest struct {
- *tchttp.BaseRequest
-
- // 专线网关ID,形如:dcg-prpqlmg1
- DirectConnectGatewayId *string `json:"DirectConnectGatewayId,omitempty" name:"DirectConnectGatewayId"`
-
- // 路由ID。形如:ccnr-f49l6u0z。
- RouteIds []*string `json:"RouteIds,omitempty" name:"RouteIds" list`
-}
-
-func (r *DeleteDirectConnectGatewayCcnRoutesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteDirectConnectGatewayCcnRoutesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteDirectConnectGatewayCcnRoutesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteDirectConnectGatewayCcnRoutesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteDirectConnectGatewayCcnRoutesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteDirectConnectGatewayRequest struct {
- *tchttp.BaseRequest
-
- // 专线网关唯一`ID`,形如:`dcg-9o233uri`。
- DirectConnectGatewayId *string `json:"DirectConnectGatewayId,omitempty" name:"DirectConnectGatewayId"`
-}
-
-func (r *DeleteDirectConnectGatewayRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteDirectConnectGatewayRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteDirectConnectGatewayResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteDirectConnectGatewayResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteDirectConnectGatewayResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteFlowLogRequest struct {
- *tchttp.BaseRequest
-
- // 私用网络ID或者统一ID,建议使用统一ID
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 流日志唯一ID
- FlowLogId *string `json:"FlowLogId,omitempty" name:"FlowLogId"`
-}
-
-func (r *DeleteFlowLogRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteFlowLogRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteFlowLogResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteFlowLogResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteFlowLogResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteHaVipRequest struct {
- *tchttp.BaseRequest
-
- // `HAVIP`唯一`ID`,形如:`havip-9o233uri`。
- HaVipId *string `json:"HaVipId,omitempty" name:"HaVipId"`
-}
-
-func (r *DeleteHaVipRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteHaVipRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteHaVipResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteHaVipResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteHaVipResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteIp6TranslatorsRequest struct {
- *tchttp.BaseRequest
-
- // 待释放的IPV6转换实例的唯一ID,形如‘ip6-xxxxxxxx’
- Ip6TranslatorIds []*string `json:"Ip6TranslatorIds,omitempty" name:"Ip6TranslatorIds" list`
-}
-
-func (r *DeleteIp6TranslatorsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteIp6TranslatorsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteIp6TranslatorsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteIp6TranslatorsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteIp6TranslatorsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteNetworkInterfaceRequest struct {
- *tchttp.BaseRequest
-
- // 弹性网卡实例ID,例如:eni-m6dyj72l。
- NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"`
-}
-
-func (r *DeleteNetworkInterfaceRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteNetworkInterfaceRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteNetworkInterfaceResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteNetworkInterfaceResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteNetworkInterfaceResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteRouteTableRequest struct {
- *tchttp.BaseRequest
-
- // 路由表实例ID,例如:rtb-azd4dt1c。
- RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"`
-}
-
-func (r *DeleteRouteTableRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteRouteTableRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteRouteTableResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteRouteTableResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteRouteTableResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteRoutesRequest struct {
- *tchttp.BaseRequest
-
- // 路由表实例ID。
- RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"`
-
- // 路由策略对象。
- Routes []*Route `json:"Routes,omitempty" name:"Routes" list`
-}
-
-func (r *DeleteRoutesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteRoutesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteRoutesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteRoutesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteRoutesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteSecurityGroupPoliciesRequest struct {
- *tchttp.BaseRequest
-
- // 安全组实例ID,例如sg-33ocnj9n,可通过DescribeSecurityGroups获取。
- SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"`
-
- // 安全组规则集合。一个请求中只能删除单个方向的一条或多条规则。支持指定索引(PolicyIndex) 匹配删除和安全组规则匹配删除两种方式,一个请求中只能使用一种匹配方式。
- SecurityGroupPolicySet *SecurityGroupPolicySet `json:"SecurityGroupPolicySet,omitempty" name:"SecurityGroupPolicySet"`
-}
-
-func (r *DeleteSecurityGroupPoliciesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteSecurityGroupPoliciesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteSecurityGroupPoliciesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteSecurityGroupPoliciesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteSecurityGroupPoliciesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteSecurityGroupRequest struct {
- *tchttp.BaseRequest
-
- // 安全组实例ID,例如sg-33ocnj9n,可通过DescribeSecurityGroups获取。
- SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"`
-}
-
-func (r *DeleteSecurityGroupRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteSecurityGroupRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteSecurityGroupResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteSecurityGroupResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteSecurityGroupResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteServiceTemplateGroupRequest struct {
- *tchttp.BaseRequest
-
- // 协议端口模板集合实例ID,例如:ppmg-n17uxvve。
- ServiceTemplateGroupId *string `json:"ServiceTemplateGroupId,omitempty" name:"ServiceTemplateGroupId"`
-}
-
-func (r *DeleteServiceTemplateGroupRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteServiceTemplateGroupRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteServiceTemplateGroupResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteServiceTemplateGroupResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteServiceTemplateGroupResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteServiceTemplateRequest struct {
- *tchttp.BaseRequest
-
- // 协议端口模板实例ID,例如:ppm-e6dy460g。
- ServiceTemplateId *string `json:"ServiceTemplateId,omitempty" name:"ServiceTemplateId"`
-}
-
-func (r *DeleteServiceTemplateRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteServiceTemplateRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteServiceTemplateResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteServiceTemplateResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteServiceTemplateResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteSubnetRequest struct {
- *tchttp.BaseRequest
-
- // 子网实例ID。可通过DescribeSubnets接口返回值中的SubnetId获取。
- SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"`
-}
-
-func (r *DeleteSubnetRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteSubnetRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteSubnetResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteSubnetResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteSubnetResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteVpcRequest struct {
- *tchttp.BaseRequest
-
- // VPC实例ID。可通过DescribeVpcs接口返回值中的VpcId获取。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-}
-
-func (r *DeleteVpcRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteVpcRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteVpcResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteVpcResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteVpcResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteVpnConnectionRequest struct {
- *tchttp.BaseRequest
-
- // VPN网关实例ID。
- VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"`
-
- // VPN通道实例ID。形如:vpnx-f49l6u0z。
- VpnConnectionId *string `json:"VpnConnectionId,omitempty" name:"VpnConnectionId"`
-}
-
-func (r *DeleteVpnConnectionRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteVpnConnectionRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteVpnConnectionResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteVpnConnectionResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteVpnConnectionResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteVpnGatewayRequest struct {
- *tchttp.BaseRequest
-
- // VPN网关实例ID。
- VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"`
-}
-
-func (r *DeleteVpnGatewayRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteVpnGatewayRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DeleteVpnGatewayResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DeleteVpnGatewayResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DeleteVpnGatewayResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeAccountAttributesRequest struct {
- *tchttp.BaseRequest
-}
-
-func (r *DescribeAccountAttributesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeAccountAttributesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeAccountAttributesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 用户账号属性对象
- AccountAttributeSet []*AccountAttribute `json:"AccountAttributeSet,omitempty" name:"AccountAttributeSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeAccountAttributesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeAccountAttributesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeAddressQuotaRequest struct {
- *tchttp.BaseRequest
-}
-
-func (r *DescribeAddressQuotaRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeAddressQuotaRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeAddressQuotaResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 账户 EIP 配额信息。
- QuotaSet []*Quota `json:"QuotaSet,omitempty" name:"QuotaSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeAddressQuotaResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeAddressQuotaResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeAddressTemplateGroupsRequest struct {
- *tchttp.BaseRequest
-
- // 过滤条件。
- // address-template-group-name - String - (过滤条件)IP地址模板集合名称。
- // address-template-group-id - String - (过滤条件)IP地址模板实集合例ID,例如:ipmg-mdunqeb6。
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量,默认为0。
- Offset *string `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量,默认为20,最大值为100。
- Limit *string `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeAddressTemplateGroupsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeAddressTemplateGroupsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeAddressTemplateGroupsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合条件的实例数量。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // IP地址模板。
- AddressTemplateGroupSet []*AddressTemplateGroup `json:"AddressTemplateGroupSet,omitempty" name:"AddressTemplateGroupSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeAddressTemplateGroupsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeAddressTemplateGroupsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeAddressTemplatesRequest struct {
- *tchttp.BaseRequest
-
- // 过滤条件。
- // address-template-name - String - (过滤条件)IP地址模板名称。
- // address-template-id - String - (过滤条件)IP地址模板实例ID,例如:ipm-mdunqeb6。
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量,默认为0。
- Offset *string `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量,默认为20,最大值为100。
- Limit *string `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeAddressTemplatesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeAddressTemplatesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeAddressTemplatesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合条件的实例数量。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // IP地址模版。
- AddressTemplateSet []*AddressTemplate `json:"AddressTemplateSet,omitempty" name:"AddressTemplateSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeAddressTemplatesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeAddressTemplatesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeAddressesRequest struct {
- *tchttp.BaseRequest
-
- // 标识 EIP 的唯一 ID 列表。EIP 唯一 ID 形如:`eip-11112222`。参数不支持同时指定`AddressIds`和`Filters`。
- AddressIds []*string `json:"AddressIds,omitempty" name:"AddressIds" list`
-
- // 每次请求的`Filters`的上限为10,`Filter.Values`的上限为5。参数不支持同时指定`AddressIds`和`Filters`。详细的过滤条件如下:
- // address-id - String - 是否必填:否 - (过滤条件)按照 EIP 的唯一 ID 过滤。EIP 唯一 ID 形如:eip-11112222。
- // address-name - String - 是否必填:否 - (过滤条件)按照 EIP 名称过滤。不支持模糊过滤。
- // address-ip - String - 是否必填:否 - (过滤条件)按照 EIP 的 IP 地址过滤。
- // address-status - String - 是否必填:否 - (过滤条件)按照 EIP 的状态过滤。取值范围:[详见EIP状态列表](https://cloud.tencent.com/document/api/213/9452#eip_state)。
- // instance-id - String - 是否必填:否 - (过滤条件)按照 EIP 绑定的实例 ID 过滤。实例 ID 形如:ins-11112222。
- // private-ip-address - String - 是否必填:否 - (过滤条件)按照 EIP 绑定的内网 IP 过滤。
- // network-interface-id - String - 是否必填:否 - (过滤条件)按照 EIP 绑定的弹性网卡 ID 过滤。弹性网卡 ID 形如:eni-11112222。
- // is-arrears - String - 是否必填:否 - (过滤条件)按照 EIP 是否欠费进行过滤。(TRUE:EIP 处于欠费状态|FALSE:EIP 费用状态正常)
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量,默认为0。关于`Offset`的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/11646)中的相关小节。
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量,默认为20,最大值为100。关于`Limit`的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/11646)中的相关小节。
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeAddressesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeAddressesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeAddressesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合条件的 EIP 数量。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // EIP 详细信息列表。
- AddressSet []*Address `json:"AddressSet,omitempty" name:"AddressSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeAddressesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeAddressesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeBandwidthPackageQuotaRequest struct {
- *tchttp.BaseRequest
-}
-
-func (r *DescribeBandwidthPackageQuotaRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeBandwidthPackageQuotaRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeBandwidthPackageQuotaResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 带宽包配额数据结构
- QuotaSet []*Quota `json:"QuotaSet,omitempty" name:"QuotaSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeBandwidthPackageQuotaResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeBandwidthPackageQuotaResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeBandwidthPackagesRequest struct {
- *tchttp.BaseRequest
-
- // 带宽包Id,支持批量
- BandwidthPackageIds []*string `json:"BandwidthPackageIds,omitempty" name:"BandwidthPackageIds" list`
-
- // 每次请求的`Filters`的上限为10。参数不支持同时指定`BandwidthPackageIds`和`Filters`。详细的过滤条件如下:
- // bandwidth-package_id - String - 是否必填:否 - (过滤条件)按照带宽包的唯一标识ID过滤。
- // bandwidth-package-name - String - 是否必填:否 - (过滤条件)按照 带宽包名称过滤。不支持模糊过滤。
- // network-type - String - 是否必填:否 - (过滤条件)按照带宽包的类型过滤。类型包括'BGP','SINGLEISP'和'ANYCAST'。
- // charge-type - String - 是否必填:否 - (过滤条件)按照带宽包的计费类型过滤。计费类型包括'TOP5_POSTPAID_BY_MONTH'和'PERCENT95_POSTPAID_BY_MONTH'
- // resource.resource-type - String - 是否必填:否 - (过滤条件)按照带宽包资源类型过滤。资源类型包括'Address'和'LoadBalance'
- // resource.resource-id - String - 是否必填:否 - (过滤条件)按照带宽包资源Id过滤。资源Id形如'eip-xxxx','lb-xxxx'
- // resource.address-ip - String - 是否必填:否 - (过滤条件)按照带宽包资源Ip过滤。
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 查询带宽包偏移量
- Offset *uint64 `json:"Offset,omitempty" name:"Offset"`
-
- // 查询带宽包数量限制
- Limit *uint64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeBandwidthPackagesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeBandwidthPackagesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeBandwidthPackagesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合条件的带宽包数量
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 描述带宽包详细信息
- BandwidthPackageSet []*BandwidthPackage `json:"BandwidthPackageSet,omitempty" name:"BandwidthPackageSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeBandwidthPackagesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeBandwidthPackagesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeCcnAttachedInstancesRequest struct {
- *tchttp.BaseRequest
-
- // 偏移量
- Offset *uint64 `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量
- Limit *uint64 `json:"Limit,omitempty" name:"Limit"`
-
- // 过滤条件:
- // ccn-id - String -(过滤条件)CCN实例ID。
- // instance-type - String -(过滤条件)关联实例类型。
- // instance-region - String -(过滤条件)关联实例所属地域。
- // instance-id - String -(过滤条件)关联实例实例ID。
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 云联网实例ID
- CcnId *string `json:"CcnId,omitempty" name:"CcnId"`
-
- // 排序字段。支持:`CcnId` `InstanceType` `InstanceId` `InstanceName` `InstanceRegion` `AttachedTime` `State`。
- OrderField *string `json:"OrderField,omitempty" name:"OrderField"`
-
- // 排序方法。顺序:`ASC`,倒序:`DESC`。
- OrderDirection *string `json:"OrderDirection,omitempty" name:"OrderDirection"`
-}
-
-func (r *DescribeCcnAttachedInstancesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeCcnAttachedInstancesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeCcnAttachedInstancesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合条件的对象数。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 关联实例列表。
- InstanceSet []*CcnAttachedInstance `json:"InstanceSet,omitempty" name:"InstanceSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeCcnAttachedInstancesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeCcnAttachedInstancesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeCcnRegionBandwidthLimitsRequest struct {
- *tchttp.BaseRequest
-
- // CCN实例ID。形如:ccn-f49l6u0z。
- CcnId *string `json:"CcnId,omitempty" name:"CcnId"`
-}
-
-func (r *DescribeCcnRegionBandwidthLimitsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeCcnRegionBandwidthLimitsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeCcnRegionBandwidthLimitsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 云联网(CCN)各地域出带宽上限
- CcnRegionBandwidthLimitSet []*CcnRegionBandwidthLimit `json:"CcnRegionBandwidthLimitSet,omitempty" name:"CcnRegionBandwidthLimitSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeCcnRegionBandwidthLimitsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeCcnRegionBandwidthLimitsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeCcnRoutesRequest struct {
- *tchttp.BaseRequest
-
- // CCN实例ID,形如:ccn-gree226l。
- CcnId *string `json:"CcnId,omitempty" name:"CcnId"`
-
- // CCN路由策略唯一ID。形如:ccnr-f49l6u0z。
- RouteIds []*string `json:"RouteIds,omitempty" name:"RouteIds" list`
-
- // 过滤条件,参数不支持同时指定RouteIds和Filters。
- // route-id - String -(过滤条件)路由策略ID。
- // cidr-block - String -(过滤条件)目的端。
- // instance-type - String -(过滤条件)下一跳类型。
- // instance-region - String -(过滤条件)下一跳所属地域。
- // instance-id - String -(过滤条件)下一跳实例ID。
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量
- Offset *uint64 `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量
- Limit *uint64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeCcnRoutesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeCcnRoutesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeCcnRoutesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合条件的对象数。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // CCN路由策略对象。
- RouteSet []*CcnRoute `json:"RouteSet,omitempty" name:"RouteSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeCcnRoutesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeCcnRoutesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeCcnsRequest struct {
- *tchttp.BaseRequest
-
- // CCN实例ID。形如:ccn-f49l6u0z。每次请求的实例的上限为100。参数不支持同时指定CcnIds和Filters。
- CcnIds []*string `json:"CcnIds,omitempty" name:"CcnIds" list`
-
- // 过滤条件,参数不支持同时指定CcnIds和Filters。
- // ccn-id - String - (过滤条件)CCN唯一ID,形如:vpc-f49l6u0z。
- // ccn-name - String - (过滤条件)CCN名称。
- // ccn-description - String - (过滤条件)CCN描述。
- // state - String - (过滤条件)实例状态, 'ISOLATED': 隔离中(欠费停服),'AVAILABLE':运行中。
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量
- Offset *uint64 `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量
- Limit *uint64 `json:"Limit,omitempty" name:"Limit"`
-
- // 排序字段。支持:`CcnId` `CcnName` `CreateTime` `State` `QosLevel`
- OrderField *string `json:"OrderField,omitempty" name:"OrderField"`
-
- // 排序方法。顺序:`ASC`,倒序:`DESC`。
- OrderDirection *string `json:"OrderDirection,omitempty" name:"OrderDirection"`
-}
-
-func (r *DescribeCcnsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeCcnsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeCcnsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合条件的对象数。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // CCN对象。
- CcnSet []*CCN `json:"CcnSet,omitempty" name:"CcnSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeCcnsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeCcnsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeClassicLinkInstancesRequest struct {
- *tchttp.BaseRequest
-
- // 过滤条件。
- // vpc-id - String - (过滤条件)VPC实例ID。
- // vm-ip - String - (过滤条件)基础网络云主机IP。
- Filters []*FilterObject `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量
- Offset *string `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量
- Limit *string `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeClassicLinkInstancesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeClassicLinkInstancesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeClassicLinkInstancesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合条件的实例数量。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 私有网络和基础网络互通设备。
- ClassicLinkInstanceSet []*ClassicLinkInstance `json:"ClassicLinkInstanceSet,omitempty" name:"ClassicLinkInstanceSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeClassicLinkInstancesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeClassicLinkInstancesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeCustomerGatewayVendorsRequest struct {
- *tchttp.BaseRequest
-}
-
-func (r *DescribeCustomerGatewayVendorsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeCustomerGatewayVendorsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeCustomerGatewayVendorsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 对端网关厂商信息对象。
- CustomerGatewayVendorSet []*CustomerGatewayVendor `json:"CustomerGatewayVendorSet,omitempty" name:"CustomerGatewayVendorSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeCustomerGatewayVendorsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeCustomerGatewayVendorsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeCustomerGatewaysRequest struct {
- *tchttp.BaseRequest
-
- // 对端网关ID,例如:cgw-2wqq41m9。每次请求的实例的上限为100。参数不支持同时指定CustomerGatewayIds和Filters。
- CustomerGatewayIds []*string `json:"CustomerGatewayIds,omitempty" name:"CustomerGatewayIds" list`
-
- // 过滤条件,详见下表:实例过滤条件表。每次请求的Filters的上限为10,Filter.Values的上限为5。参数不支持同时指定CustomerGatewayIds和Filters。
- // customer-gateway-id - String - (过滤条件)用户网关唯一ID形如:`cgw-mgp33pll`。
- // customer-gateway-name - String - (过滤条件)用户网关名称形如:`test-cgw`。
- // ip-address - String - (过滤条件)公网地址形如:`58.211.1.12`。
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量,默认为0。关于Offset的更进一步介绍请参考 API 简介中的相关小节。
- Offset *uint64 `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量,默认为20,最大值为100。
- Limit *uint64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeCustomerGatewaysRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeCustomerGatewaysRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeCustomerGatewaysResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 对端网关对象列表
- CustomerGatewaySet []*CustomerGateway `json:"CustomerGatewaySet,omitempty" name:"CustomerGatewaySet" list`
-
- // 符合条件的实例数量。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeCustomerGatewaysResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeCustomerGatewaysResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDirectConnectGatewayCcnRoutesRequest struct {
- *tchttp.BaseRequest
-
- // 专线网关ID,形如:`dcg-prpqlmg1`。
- DirectConnectGatewayId *string `json:"DirectConnectGatewayId,omitempty" name:"DirectConnectGatewayId"`
-
- // 云联网路由学习类型,可选值:
- // `BGP` - 自动学习。
- // `STATIC` - 静态,即用户配置,默认值。
- CcnRouteType *string `json:"CcnRouteType,omitempty" name:"CcnRouteType"`
-
- // 偏移量。
- Offset *uint64 `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量。
- Limit *uint64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeDirectConnectGatewayCcnRoutesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDirectConnectGatewayCcnRoutesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDirectConnectGatewayCcnRoutesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合条件的对象数。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 云联网路由(IDC网段)列表。
- RouteSet []*DirectConnectGatewayCcnRoute `json:"RouteSet,omitempty" name:"RouteSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeDirectConnectGatewayCcnRoutesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDirectConnectGatewayCcnRoutesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDirectConnectGatewaysRequest struct {
- *tchttp.BaseRequest
-
- // 专线网关唯一`ID`,形如:`dcg-9o233uri`。
- DirectConnectGatewayIds []*string `json:"DirectConnectGatewayIds,omitempty" name:"DirectConnectGatewayIds" list`
-
- // 过滤条件,参数不支持同时指定`DirectConnectGatewayIds`和`Filters`。
- // direct-connect-gateway-id - String - 专线网关唯一`ID`,形如:`dcg-9o233uri`。
- // direct-connect-gateway-name - String - 专线网关名称,默认模糊查询。
- // direct-connect-gateway-ip - String - 专线网关`IP`。
- // gateway-type - String - 网关类型,可选值:`NORMAL`(普通型)、`NAT`(NAT型)。
- // network-type- String - 网络类型,可选值:`VPC`(私有网络类型)、`CCN`(云联网类型)。
- // ccn-id - String - 专线网关所在云联网`ID`。
- // vpc-id - String - 专线网关所在私有网络`ID`。
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量。
- Offset *uint64 `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量。
- Limit *uint64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeDirectConnectGatewaysRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDirectConnectGatewaysRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeDirectConnectGatewaysResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合条件的对象数。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 专线网关对象数组。
- DirectConnectGatewaySet []*DirectConnectGateway `json:"DirectConnectGatewaySet,omitempty" name:"DirectConnectGatewaySet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeDirectConnectGatewaysResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeDirectConnectGatewaysResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeFlowLogRequest struct {
- *tchttp.BaseRequest
-
- // 私用网络ID或者统一ID,建议使用统一ID
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 流日志唯一ID
- FlowLogId *string `json:"FlowLogId,omitempty" name:"FlowLogId"`
-}
-
-func (r *DescribeFlowLogRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeFlowLogRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeFlowLogResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 流日志信息
- FlowLog []*FlowLog `json:"FlowLog,omitempty" name:"FlowLog" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeFlowLogResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeFlowLogResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeFlowLogsRequest struct {
- *tchttp.BaseRequest
-
- // 私用网络ID或者统一ID,建议使用统一ID
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 流日志唯一ID
- FlowLogId *string `json:"FlowLogId,omitempty" name:"FlowLogId"`
-
- // 流日志实例名字
- FlowLogName *string `json:"FlowLogName,omitempty" name:"FlowLogName"`
-
- // 流日志所属资源类型,VPC|SUBNET|NETWORKINTERFACE
- ResourceType *string `json:"ResourceType,omitempty" name:"ResourceType"`
-
- // 资源唯一ID
- ResourceId *string `json:"ResourceId,omitempty" name:"ResourceId"`
-
- // 流日志采集类型,ACCEPT|REJECT|ALL
- TrafficType *string `json:"TrafficType,omitempty" name:"TrafficType"`
-
- // 流日志存储ID
- CloudLogId *string `json:"CloudLogId,omitempty" name:"CloudLogId"`
-
- // 流日志存储ID状态
- CloudLogState *string `json:"CloudLogState,omitempty" name:"CloudLogState"`
-
- // 按某个字段排序,支持字段:flowLogName,createTime,默认按createTime
- OrderField *string `json:"OrderField,omitempty" name:"OrderField"`
-
- // 升序(asc)还是降序(desc),默认:desc
- OrderDirection *string `json:"OrderDirection,omitempty" name:"OrderDirection"`
-
- // 偏移量,默认为0。
- Offset *uint64 `json:"Offset,omitempty" name:"Offset"`
-
- // 每页行数,默认为10
- Limit *uint64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeFlowLogsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeFlowLogsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeFlowLogsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 流日志实例集合
- FlowLog []*FlowLog `json:"FlowLog,omitempty" name:"FlowLog" list`
-
- // 流日志总数目
- TotalNum *uint64 `json:"TotalNum,omitempty" name:"TotalNum"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeFlowLogsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeFlowLogsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeGatewayFlowMonitorDetailRequest struct {
- *tchttp.BaseRequest
-
- // 时间点。表示要查询这分钟内的明细。如:`2019-02-28 18:15:20`,将查询 `18:15` 这一分钟内的明细。
- TimePoint *string `json:"TimePoint,omitempty" name:"TimePoint"`
-
- // VPN网关实例ID,形如:`vpn-ltjahce6`。
- VpnId *string `json:"VpnId,omitempty" name:"VpnId"`
-
- // 专线网关实例ID,形如:`dcg-ltjahce6`。
- DirectConnectGatewayId *string `json:"DirectConnectGatewayId,omitempty" name:"DirectConnectGatewayId"`
-
- // 对等连接实例ID,形如:`pcx-ltjahce6`。
- PeeringConnectionId *string `json:"PeeringConnectionId,omitempty" name:"PeeringConnectionId"`
-
- // NAT网关实例ID,形如:`nat-ltjahce6`。
- NatId *string `json:"NatId,omitempty" name:"NatId"`
-
- // 偏移量。
- Offset *uint64 `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量。
- Limit *uint64 `json:"Limit,omitempty" name:"Limit"`
-
- // 排序字段。支持 `InPkg` `OutPkg` `InTraffic` `OutTraffic`。
- OrderField *string `json:"OrderField,omitempty" name:"OrderField"`
-
- // 排序方法。顺序:`ASC`,倒序:`DESC`。
- OrderDirection *string `json:"OrderDirection,omitempty" name:"OrderDirection"`
-}
-
-func (r *DescribeGatewayFlowMonitorDetailRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeGatewayFlowMonitorDetailRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeGatewayFlowMonitorDetailResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合条件的对象数。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 网关流量监控明细。
- GatewayFlowMonitorDetailSet []*GatewayFlowMonitorDetail `json:"GatewayFlowMonitorDetailSet,omitempty" name:"GatewayFlowMonitorDetailSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeGatewayFlowMonitorDetailResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeGatewayFlowMonitorDetailResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeHaVipsRequest struct {
- *tchttp.BaseRequest
-
- // `HAVIP`唯一`ID`,形如:`havip-9o233uri`。
- HaVipIds []*string `json:"HaVipIds,omitempty" name:"HaVipIds" list`
-
- // 过滤条件,参数不支持同时指定`HaVipIds`和`Filters`。
- // havip-id - String - `HAVIP`唯一`ID`,形如:`havip-9o233uri`。
- // havip-name - String - `HAVIP`名称。
- // vpc-id - String - `HAVIP`所在私有网络`ID`。
- // subnet-id - String - `HAVIP`所在子网`ID`。
- // address-ip - String - `HAVIP`绑定的弹性公网`IP`。
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量
- Offset *uint64 `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量
- Limit *uint64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeHaVipsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeHaVipsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeHaVipsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合条件的对象数。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // `HAVIP`对象数组。
- HaVipSet []*HaVip `json:"HaVipSet,omitempty" name:"HaVipSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeHaVipsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeHaVipsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeIp6TranslatorQuotaRequest struct {
- *tchttp.BaseRequest
-
- // 待查询IPV6转换实例的唯一ID列表,形如ip6-xxxxxxxx
- Ip6TranslatorIds []*string `json:"Ip6TranslatorIds,omitempty" name:"Ip6TranslatorIds" list`
-}
-
-func (r *DescribeIp6TranslatorQuotaRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeIp6TranslatorQuotaRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeIp6TranslatorQuotaResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 账户在指定地域的IPV6转换实例及规则配额信息
- // QUOTAID属性是TOTAL_TRANSLATOR_QUOTA,表示账户在指定地域的IPV6转换实例配额信息;QUOTAID属性是IPV6转转换实例唯一ID(形如ip6-xxxxxxxx),表示账户在该转换实例允许创建的转换规则配额
- QuotaSet []*Quota `json:"QuotaSet,omitempty" name:"QuotaSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeIp6TranslatorQuotaResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeIp6TranslatorQuotaResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeIp6TranslatorsRequest struct {
- *tchttp.BaseRequest
-
- // IPV6转换实例唯一ID数组,形如ip6-xxxxxxxx
- Ip6TranslatorIds []*string `json:"Ip6TranslatorIds,omitempty" name:"Ip6TranslatorIds" list`
-
- // 每次请求的`Filters`的上限为10,`Filter.Values`的上限为5。参数不支持同时指定`Ip6TranslatorIds`和`Filters`。详细的过滤条件如下:
- // ip6-translator-id - String - 是否必填:否 - (过滤条件)按照IPV6转换实例的唯一ID过滤,形如ip6-xxxxxxx。
- // ip6-translator-vip6 - String - 是否必填:否 - (过滤条件)按照IPV6地址过滤。不支持模糊过滤。
- // ip6-translator-name - String - 是否必填:否 - (过滤条件)按照IPV6转换实例名称过滤。不支持模糊过滤。
- // ip6-translator-status - String - 是否必填:否 - (过滤条件)按照IPV6转换实例的状态过滤。状态取值范围为"CREATING","RUNNING","DELETING","MODIFYING"
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量,默认为0。关于`Offset`的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/11646)中的相关小节。
- Offset *int64 `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量,默认为20,最大值为100。关于`Limit`的更进一步介绍请参考 API [简介](https://cloud.tencent.com/document/api/213/11646)中的相关小节。
- Limit *int64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeIp6TranslatorsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeIp6TranslatorsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeIp6TranslatorsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合过滤条件的IPV6转换实例数量。
- TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 符合过滤条件的IPV6转换实例详细信息
- Ip6TranslatorSet []*Ip6Translator `json:"Ip6TranslatorSet,omitempty" name:"Ip6TranslatorSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeIp6TranslatorsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeIp6TranslatorsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeNatGatewaysRequest struct {
- *tchttp.BaseRequest
-
- // NAT网关统一 ID,形如:`nat-123xx454`。
- NatGatewayIds []*string `json:"NatGatewayIds,omitempty" name:"NatGatewayIds" list`
-
- // 过滤条件,参数不支持同时指定NatGatewayIds和Filters。
- // nat-gateway-id - String - (过滤条件)协议端口模板实例ID,形如:`nat-123xx454`。
- // vpc-id - String - (过滤条件)私有网络 唯一ID,形如:`vpc-123xx454`。
- // nat-gateway-name - String - (过滤条件)协议端口模板实例ID,形如:`test_nat`。
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量,默认为0。
- Offset *uint64 `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量,默认为20,最大值为100。
- Limit *uint64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeNatGatewaysRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeNatGatewaysRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeNatGatewaysResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // NAT网关对象数组。
- NatGatewaySet []*NatGateway `json:"NatGatewaySet,omitempty" name:"NatGatewaySet" list`
-
- // 符合条件的NAT网关对象个数。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeNatGatewaysResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeNatGatewaysResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeNetworkInterfacesRequest struct {
- *tchttp.BaseRequest
-
- // 弹性网卡实例ID查询。形如:eni-pxir56ns。每次请求的实例的上限为100。参数不支持同时指定NetworkInterfaceIds和Filters。
- NetworkInterfaceIds []*string `json:"NetworkInterfaceIds,omitempty" name:"NetworkInterfaceIds" list`
-
- // 过滤条件,参数不支持同时指定NetworkInterfaceIds和Filters。
- // vpc-id - String - (过滤条件)VPC实例ID,形如:vpc-f49l6u0z。
- // subnet-id - String - (过滤条件)所属子网实例ID,形如:subnet-f49l6u0z。
- // network-interface-id - String - (过滤条件)弹性网卡实例ID,形如:eni-5k56k7k7。
- // attachment.instance-id - String - (过滤条件)绑定的云服务器实例ID,形如:ins-3nqpdn3i。
- // groups.security-group-id - String - (过滤条件)绑定的安全组实例ID,例如:sg-f9ekbxeq。
- // network-interface-name - String - (过滤条件)网卡实例名称。
- // network-interface-description - String - (过滤条件)网卡实例描述。
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量,默认为0。
- Offset *uint64 `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量,默认为20,最大值为100。
- Limit *uint64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeNetworkInterfacesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeNetworkInterfacesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeNetworkInterfacesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 实例详细信息列表。
- NetworkInterfaceSet []*NetworkInterface `json:"NetworkInterfaceSet,omitempty" name:"NetworkInterfaceSet" list`
-
- // 符合条件的实例数量。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeNetworkInterfacesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeNetworkInterfacesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeRouteConflictsRequest struct {
- *tchttp.BaseRequest
-
- // 路由表实例ID,例如:rtb-azd4dt1c。
- RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"`
-
- // 要检查的与之冲突的目的端列表
- DestinationCidrBlocks []*string `json:"DestinationCidrBlocks,omitempty" name:"DestinationCidrBlocks" list`
-}
-
-func (r *DescribeRouteConflictsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeRouteConflictsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeRouteConflictsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 路由策略冲突列表
- RouteConflictSet []*RouteConflict `json:"RouteConflictSet,omitempty" name:"RouteConflictSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeRouteConflictsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeRouteConflictsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeRouteTablesRequest struct {
- *tchttp.BaseRequest
-
- // 路由表实例ID,例如:rtb-azd4dt1c。
- RouteTableIds []*string `json:"RouteTableIds,omitempty" name:"RouteTableIds" list`
-
- // 过滤条件,参数不支持同时指定RouteTableIds和Filters。
- // route-table-id - String - (过滤条件)路由表实例ID。
- // route-table-name - String - (过滤条件)路由表名称。
- // vpc-id - String - (过滤条件)VPC实例ID,形如:vpc-f49l6u0z。
- // association.main - String - (过滤条件)是否主路由表。
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量。
- Offset *string `json:"Offset,omitempty" name:"Offset"`
-
- // 请求对象个数。
- Limit *string `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeRouteTablesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeRouteTablesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeRouteTablesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合条件的实例数量。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 路由表对象。
- RouteTableSet []*RouteTable `json:"RouteTableSet,omitempty" name:"RouteTableSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeRouteTablesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeRouteTablesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeSecurityGroupAssociationStatisticsRequest struct {
- *tchttp.BaseRequest
-
- // 安全实例ID,例如sg-33ocnj9n,可通过DescribeSecurityGroups获取。
- SecurityGroupIds []*string `json:"SecurityGroupIds,omitempty" name:"SecurityGroupIds" list`
-}
-
-func (r *DescribeSecurityGroupAssociationStatisticsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeSecurityGroupAssociationStatisticsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeSecurityGroupAssociationStatisticsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 安全组关联实例统计。
- SecurityGroupAssociationStatisticsSet []*SecurityGroupAssociationStatistics `json:"SecurityGroupAssociationStatisticsSet,omitempty" name:"SecurityGroupAssociationStatisticsSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeSecurityGroupAssociationStatisticsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeSecurityGroupAssociationStatisticsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeSecurityGroupPoliciesRequest struct {
- *tchttp.BaseRequest
-
- // 安全组实例ID,例如:sg-33ocnj9n,可通过DescribeSecurityGroups获取。
- SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"`
-}
-
-func (r *DescribeSecurityGroupPoliciesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeSecurityGroupPoliciesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeSecurityGroupPoliciesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 安全组规则集合。
- SecurityGroupPolicySet *SecurityGroupPolicySet `json:"SecurityGroupPolicySet,omitempty" name:"SecurityGroupPolicySet"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeSecurityGroupPoliciesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeSecurityGroupPoliciesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeSecurityGroupsRequest struct {
- *tchttp.BaseRequest
-
- // 安全组实例ID,例如:sg-33ocnj9n,可通过DescribeSecurityGroups获取。每次请求的实例的上限为100。参数不支持同时指定SecurityGroupIds和Filters。
- SecurityGroupIds []*string `json:"SecurityGroupIds,omitempty" name:"SecurityGroupIds" list`
-
- // 过滤条件,参数不支持同时指定SecurityGroupIds和Filters。
- // project-id - Integer - (过滤条件)项目id。
- // security-group-name - String - (过滤条件)安全组名称。
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量。
- Offset *string `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量。
- Limit *string `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeSecurityGroupsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeSecurityGroupsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeSecurityGroupsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 安全组对象。
- SecurityGroupSet []*SecurityGroup `json:"SecurityGroupSet,omitempty" name:"SecurityGroupSet" list`
-
- // 符合条件的实例数量。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeSecurityGroupsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeSecurityGroupsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeServiceTemplateGroupsRequest struct {
- *tchttp.BaseRequest
-
- // 过滤条件。
- // service-template-group-name - String - (过滤条件)协议端口模板集合名称。
- // service-template-group-id - String - (过滤条件)协议端口模板集合实例ID,例如:ppmg-e6dy460g。
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量,默认为0。
- Offset *string `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量,默认为20,最大值为100。
- Limit *string `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeServiceTemplateGroupsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeServiceTemplateGroupsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeServiceTemplateGroupsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合条件的实例数量。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 协议端口模板集合。
- ServiceTemplateGroupSet []*ServiceTemplateGroup `json:"ServiceTemplateGroupSet,omitempty" name:"ServiceTemplateGroupSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeServiceTemplateGroupsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeServiceTemplateGroupsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeServiceTemplatesRequest struct {
- *tchttp.BaseRequest
-
- // 过滤条件。
- // service-template-name - String - (过滤条件)协议端口模板名称。
- // service-template-id - String - (过滤条件)协议端口模板实例ID,例如:ppm-e6dy460g。
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量,默认为0。
- Offset *string `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量,默认为20,最大值为100。
- Limit *string `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeServiceTemplatesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeServiceTemplatesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeServiceTemplatesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合条件的实例数量。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 协议端口模板对象。
- ServiceTemplateSet []*ServiceTemplate `json:"ServiceTemplateSet,omitempty" name:"ServiceTemplateSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeServiceTemplatesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeServiceTemplatesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeSubnetsRequest struct {
- *tchttp.BaseRequest
-
- // 子网实例ID查询。形如:subnet-pxir56ns。每次请求的实例的上限为100。参数不支持同时指定SubnetIds和Filters。
- SubnetIds []*string `json:"SubnetIds,omitempty" name:"SubnetIds" list`
-
- // 过滤条件,参数不支持同时指定SubnetIds和Filters。
- // subnet-id - String - (过滤条件)Subnet实例名称。
- // vpc-id - String - (过滤条件)VPC实例ID,形如:vpc-f49l6u0z。
- // cidr-block - String - (过滤条件)子网网段,形如: 192.168.1.0 。
- // is-default - Boolean - (过滤条件)是否是默认子网。
- // is-remote-vpc-snat - Boolean - (过滤条件)是否为VPC SNAT地址池子网。
- // subnet-name - String - (过滤条件)子网名称。
- // zone - String - (过滤条件)可用区。
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量
- Offset *string `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量
- Limit *string `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeSubnetsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeSubnetsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeSubnetsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合条件的实例数量。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 子网对象。
- SubnetSet []*Subnet `json:"SubnetSet,omitempty" name:"SubnetSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeSubnetsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeSubnetsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeVpcIpv6AddressesRequest struct {
- *tchttp.BaseRequest
-
- // `VPC`实例`ID`,形如:`vpc-f49l6u0z`。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // `IP`地址列表,批量查询单次请求最多支持`10`个。
- Ipv6Addresses []*string `json:"Ipv6Addresses,omitempty" name:"Ipv6Addresses" list`
-
- // 偏移量。
- Offset *uint64 `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量。
- Limit *uint64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeVpcIpv6AddressesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeVpcIpv6AddressesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeVpcIpv6AddressesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // `IPv6`地址列表。
- Ipv6AddressSet []*VpcIpv6Address `json:"Ipv6AddressSet,omitempty" name:"Ipv6AddressSet" list`
-
- // `IPv6`地址总数。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeVpcIpv6AddressesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeVpcIpv6AddressesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeVpcPrivateIpAddressesRequest struct {
- *tchttp.BaseRequest
-
- // `VPC`实例`ID`,形如:`vpc-f49l6u0z`。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 内网`IP`地址列表,批量查询单次请求最多支持`10`个。
- PrivateIpAddresses []*string `json:"PrivateIpAddresses,omitempty" name:"PrivateIpAddresses" list`
-}
-
-func (r *DescribeVpcPrivateIpAddressesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeVpcPrivateIpAddressesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeVpcPrivateIpAddressesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 内网`IP`地址信息列表。
- VpcPrivateIpAddressSet []*VpcPrivateIpAddress `json:"VpcPrivateIpAddressSet,omitempty" name:"VpcPrivateIpAddressSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeVpcPrivateIpAddressesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeVpcPrivateIpAddressesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeVpcsRequest struct {
- *tchttp.BaseRequest
-
- // VPC实例ID。形如:vpc-f49l6u0z。每次请求的实例的上限为100。参数不支持同时指定VpcIds和Filters。
- VpcIds []*string `json:"VpcIds,omitempty" name:"VpcIds" list`
-
- // 过滤条件,参数不支持同时指定VpcIds和Filters。
- // vpc-name - String - (过滤条件)VPC实例名称。
- // is-default - String - (过滤条件)是否默认VPC。
- // vpc-id - String - (过滤条件)VPC实例ID形如:vpc-f49l6u0z。
- // cidr-block - String - (过滤条件)vpc的cidr。
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量
- Offset *string `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量
- Limit *string `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeVpcsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeVpcsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeVpcsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合条件的对象数。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // VPC对象。
- VpcSet []*Vpc `json:"VpcSet,omitempty" name:"VpcSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeVpcsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeVpcsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeVpnConnectionsRequest struct {
- *tchttp.BaseRequest
-
- // VPN通道实例ID。形如:vpnx-f49l6u0z。每次请求的实例的上限为100。参数不支持同时指定VpnConnectionIds和Filters。
- VpnConnectionIds []*string `json:"VpnConnectionIds,omitempty" name:"VpnConnectionIds" list`
-
- // 过滤条件,详见下表:实例过滤条件表。每次请求的Filters的上限为10,Filter.Values的上限为5。参数不支持同时指定VpnConnectionIds和Filters。
- // vpc-id - String - VPC实例ID,形如:`vpc-0a36uwkr`。
- // vpn-gateway-id - String - VPN网关实例ID,形如:`vpngw-p4lmqawn`。
- // customer-gateway-id - String - 对端网关实例ID,形如:`cgw-l4rblw63`。
- // vpn-connection-name - String - 通道名称,形如:`test-vpn`。
- // vpn-connection-id - String - 通道实例ID,形如:`vpnx-5p7vkch8"`。
- Filters []*Filter `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量,默认为0。关于Offset的更进一步介绍请参考 API 简介中的相关小节。
- Offset *uint64 `json:"Offset,omitempty" name:"Offset"`
-
- // 返回数量,默认为20,最大值为100。
- Limit *uint64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeVpnConnectionsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeVpnConnectionsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeVpnConnectionsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合条件的实例数量。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // VPN通道实例。
- VpnConnectionSet []*VpnConnection `json:"VpnConnectionSet,omitempty" name:"VpnConnectionSet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeVpnConnectionsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeVpnConnectionsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeVpnGatewaysRequest struct {
- *tchttp.BaseRequest
-
- // VPN网关实例ID。形如:vpngw-f49l6u0z。每次请求的实例的上限为100。参数不支持同时指定VpnGatewayIds和Filters。
- VpnGatewayIds []*string `json:"VpnGatewayIds,omitempty" name:"VpnGatewayIds" list`
-
- // 过滤条件,参数不支持同时指定VpnGatewayIds和Filters。
- // vpc-id - String - (过滤条件)VPC实例ID形如:vpc-f49l6u0z。
- // vpn-gateway-id - String - (过滤条件)VPN实例ID形如:vpngw-5aluhh9t。
- // vpn-gateway-name - String - (过滤条件)VPN实例名称。
- // type - String - (过滤条件)VPN网关类型:'IPSEC', 'SSL'。
- // public-ip-address- String - (过滤条件)公网IP。
- // renew-flag - String - (过滤条件)网关续费类型,手动续费:'NOTIFY_AND_MANUAL_RENEW'、自动续费:'NOTIFY_AND_AUTO_RENEW'。
- // zone - String - (过滤条件)VPN所在可用区,形如:ap-guangzhou-2。
- Filters []*FilterObject `json:"Filters,omitempty" name:"Filters" list`
-
- // 偏移量
- Offset *uint64 `json:"Offset,omitempty" name:"Offset"`
-
- // 请求对象个数
- Limit *uint64 `json:"Limit,omitempty" name:"Limit"`
-}
-
-func (r *DescribeVpnGatewaysRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeVpnGatewaysRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DescribeVpnGatewaysResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 符合条件的实例数量。
- TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"`
-
- // VPN网关实例详细信息列表。
- VpnGatewaySet []*VpnGateway `json:"VpnGatewaySet,omitempty" name:"VpnGatewaySet" list`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DescribeVpnGatewaysResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DescribeVpnGatewaysResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DestinationIpPortTranslationNatRule struct {
-
- // 网络协议,可选值:`TCP`、`UDP`。
- IpProtocol *string `json:"IpProtocol,omitempty" name:"IpProtocol"`
-
- // 弹性IP。
- PublicIpAddress *string `json:"PublicIpAddress,omitempty" name:"PublicIpAddress"`
-
- // 公网端口。
- PublicPort *uint64 `json:"PublicPort,omitempty" name:"PublicPort"`
-
- // 内网地址。
- PrivateIpAddress *string `json:"PrivateIpAddress,omitempty" name:"PrivateIpAddress"`
-
- // 内网端口。
- PrivatePort *uint64 `json:"PrivatePort,omitempty" name:"PrivatePort"`
-
- // NAT网关转发规则描述。
- Description *string `json:"Description,omitempty" name:"Description"`
-}
-
-type DetachCcnInstancesRequest struct {
- *tchttp.BaseRequest
-
- // CCN实例ID。形如:ccn-f49l6u0z。
- CcnId *string `json:"CcnId,omitempty" name:"CcnId"`
-
- // 要解关联网络实例列表
- Instances []*CcnInstance `json:"Instances,omitempty" name:"Instances" list`
-}
-
-func (r *DetachCcnInstancesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DetachCcnInstancesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DetachCcnInstancesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DetachCcnInstancesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DetachCcnInstancesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DetachClassicLinkVpcRequest struct {
- *tchttp.BaseRequest
-
- // VPC实例ID。可通过DescribeVpcs接口返回值中的VpcId获取。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // CVM实例ID查询。形如:ins-r8hr2upy。
- InstanceIds []*string `json:"InstanceIds,omitempty" name:"InstanceIds" list`
-}
-
-func (r *DetachClassicLinkVpcRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DetachClassicLinkVpcRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DetachClassicLinkVpcResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DetachClassicLinkVpcResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DetachClassicLinkVpcResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DetachNetworkInterfaceRequest struct {
- *tchttp.BaseRequest
-
- // 弹性网卡实例ID,例如:eni-m6dyj72l。
- NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"`
-
- // CVM实例ID。形如:ins-r8hr2upy。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *DetachNetworkInterfaceRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DetachNetworkInterfaceRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DetachNetworkInterfaceResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DetachNetworkInterfaceResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DetachNetworkInterfaceResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DirectConnectGateway struct {
-
- // 专线网关`ID`。
- DirectConnectGatewayId *string `json:"DirectConnectGatewayId,omitempty" name:"DirectConnectGatewayId"`
-
- // 专线网关名称。
- DirectConnectGatewayName *string `json:"DirectConnectGatewayName,omitempty" name:"DirectConnectGatewayName"`
-
- // 专线网关关联`VPC`实例`ID`。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 关联网络类型:
- // `VPC` - 私有网络
- // `CCN` - 云联网
- NetworkType *string `json:"NetworkType,omitempty" name:"NetworkType"`
-
- // 关联网络实例`ID`:
- // `NetworkType`为`VPC`时,这里为私有网络实例`ID`
- // `NetworkType`为`CCN`时,这里为云联网实例`ID`
- NetworkInstanceId *string `json:"NetworkInstanceId,omitempty" name:"NetworkInstanceId"`
-
- // 网关类型:
- // NORMAL - 标准型,注:云联网只支持标准型
- // NAT - NAT型
- // NAT类型支持网络地址转换配置,类型确定后不能修改;一个私有网络可以创建一个NAT类型的专线网关和一个非NAT类型的专线网关
- GatewayType *string `json:"GatewayType,omitempty" name:"GatewayType"`
-
- // 创建时间。
- CreateTime *string `json:"CreateTime,omitempty" name:"CreateTime"`
-
- // 专线网关IP。
- DirectConnectGatewayIp *string `json:"DirectConnectGatewayIp,omitempty" name:"DirectConnectGatewayIp"`
-
- // 专线网关关联`CCN`实例`ID`。
- CcnId *string `json:"CcnId,omitempty" name:"CcnId"`
-
- // 云联网路由学习类型:
- // `BGP` - 自动学习。
- // `STATIC` - 静态,即用户配置。
- CcnRouteType *string `json:"CcnRouteType,omitempty" name:"CcnRouteType"`
-
- // 是否启用BGP。
- EnableBGP *bool `json:"EnableBGP,omitempty" name:"EnableBGP"`
-}
-
-type DirectConnectGatewayCcnRoute struct {
-
- // 路由ID。
- RouteId *string `json:"RouteId,omitempty" name:"RouteId"`
-
- // IDC网段。
- DestinationCidrBlock *string `json:"DestinationCidrBlock,omitempty" name:"DestinationCidrBlock"`
-
- // `BGP`的`AS-Path`属性。
- ASPath []*string `json:"ASPath,omitempty" name:"ASPath" list`
-}
-
-type DisableCcnRoutesRequest struct {
- *tchttp.BaseRequest
-
- // CCN实例ID。形如:ccn-f49l6u0z。
- CcnId *string `json:"CcnId,omitempty" name:"CcnId"`
-
- // CCN路由策略唯一ID。形如:ccnr-f49l6u0z。
- RouteIds []*string `json:"RouteIds,omitempty" name:"RouteIds" list`
-}
-
-func (r *DisableCcnRoutesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DisableCcnRoutesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DisableCcnRoutesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DisableCcnRoutesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DisableCcnRoutesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DisableRoutesRequest struct {
- *tchttp.BaseRequest
-
- // 路由表唯一ID。
- RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"`
-
- // 路由策略唯一ID。
- RouteIds []*uint64 `json:"RouteIds,omitempty" name:"RouteIds" list`
-}
-
-func (r *DisableRoutesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DisableRoutesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DisableRoutesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DisableRoutesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DisableRoutesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DisassociateAddressRequest struct {
- *tchttp.BaseRequest
-
- // 标识 EIP 的唯一 ID。EIP 唯一 ID 形如:`eip-11112222`。
- AddressId *string `json:"AddressId,omitempty" name:"AddressId"`
-
- // 表示解绑 EIP 之后是否分配普通公网 IP。取值范围:
TRUE:表示解绑 EIP 之后分配普通公网 IP。
FALSE:表示解绑 EIP 之后不分配普通公网 IP。
默认取值:FALSE。
只有满足以下条件时才能指定该参数:
只有在解绑主网卡的主内网 IP 上的 EIP 时才能指定该参数。
解绑 EIP 后重新分配普通公网 IP 操作一个账号每天最多操作 10 次;详情可通过 [DescribeAddressQuota](https://cloud.tencent.com/document/api/213/1378) 接口获取。
- ReallocateNormalPublicIp *bool `json:"ReallocateNormalPublicIp,omitempty" name:"ReallocateNormalPublicIp"`
-}
-
-func (r *DisassociateAddressRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DisassociateAddressRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DisassociateAddressResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DisassociateAddressResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DisassociateAddressResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DownloadCustomerGatewayConfigurationRequest struct {
- *tchttp.BaseRequest
-
- // VPN网关实例ID。
- VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"`
-
- // VPN通道实例ID。形如:vpnx-f49l6u0z。
- VpnConnectionId *string `json:"VpnConnectionId,omitempty" name:"VpnConnectionId"`
-
- // 对端网关厂商信息对象,可通过DescribeCustomerGatewayVendors获取。
- CustomerGatewayVendor *CustomerGatewayVendor `json:"CustomerGatewayVendor,omitempty" name:"CustomerGatewayVendor"`
-
- // 通道接入设备物理接口名称。
- InterfaceName *string `json:"InterfaceName,omitempty" name:"InterfaceName"`
-}
-
-func (r *DownloadCustomerGatewayConfigurationRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DownloadCustomerGatewayConfigurationRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type DownloadCustomerGatewayConfigurationResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // XML格式配置信息。
- CustomerGatewayConfiguration *string `json:"CustomerGatewayConfiguration,omitempty" name:"CustomerGatewayConfiguration"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *DownloadCustomerGatewayConfigurationResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *DownloadCustomerGatewayConfigurationResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type EnableCcnRoutesRequest struct {
- *tchttp.BaseRequest
-
- // CCN实例ID。形如:ccn-f49l6u0z。
- CcnId *string `json:"CcnId,omitempty" name:"CcnId"`
-
- // CCN路由策略唯一ID。形如:ccnr-f49l6u0z。
- RouteIds []*string `json:"RouteIds,omitempty" name:"RouteIds" list`
-}
-
-func (r *EnableCcnRoutesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *EnableCcnRoutesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type EnableCcnRoutesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *EnableCcnRoutesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *EnableCcnRoutesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type EnableRoutesRequest struct {
- *tchttp.BaseRequest
-
- // 路由表唯一ID。
- RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"`
-
- // 路由策略唯一ID。
- RouteIds []*uint64 `json:"RouteIds,omitempty" name:"RouteIds" list`
-}
-
-func (r *EnableRoutesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *EnableRoutesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type EnableRoutesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *EnableRoutesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *EnableRoutesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type Filter struct {
-
- // 属性名称, 若存在多个Filter时,Filter间的关系为逻辑与(AND)关系。
- Name *string `json:"Name,omitempty" name:"Name"`
-
- // 属性值, 若同一个Filter存在多个Values,同一Filter下Values间的关系为逻辑或(OR)关系。
- Values []*string `json:"Values,omitempty" name:"Values" list`
-}
-
-type FilterObject struct {
-
- // 属性名称, 若存在多个Filter时,Filter间的关系为逻辑与(AND)关系。
- Name *string `json:"Name,omitempty" name:"Name"`
-
- // 属性值, 若同一个Filter存在多个Values,同一Filter下Values间的关系为逻辑或(OR)关系。
- Values []*string `json:"Values,omitempty" name:"Values" list`
-}
-
-type FlowLog struct {
-
- // 私用网络ID或者统一ID,建议使用统一ID
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 流日志唯一ID
- FlowLogId *string `json:"FlowLogId,omitempty" name:"FlowLogId"`
-
- // 流日志实例名字
- FlowLogName *string `json:"FlowLogName,omitempty" name:"FlowLogName"`
-
- // 流日志所属资源类型,VPC|SUBNET|NETWORKINTERFACE
- ResourceType *string `json:"ResourceType,omitempty" name:"ResourceType"`
-
- // 资源唯一ID
- ResourceId *string `json:"ResourceId,omitempty" name:"ResourceId"`
-
- // 流日志采集类型,ACCEPT|REJECT|ALL
- TrafficType *string `json:"TrafficType,omitempty" name:"TrafficType"`
-
- // 流日志存储ID
- CloudLogId *string `json:"CloudLogId,omitempty" name:"CloudLogId"`
-
- // 流日志存储ID状态
- CloudLogState *string `json:"CloudLogState,omitempty" name:"CloudLogState"`
-
- // 流日志描述信息
- FlowLogDescription *string `json:"FlowLogDescription,omitempty" name:"FlowLogDescription"`
-
- // 流日志创建时间
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-}
-
-type GatewayFlowMonitorDetail struct {
-
- // 来源`IP`。
- PrivateIpAddress *string `json:"PrivateIpAddress,omitempty" name:"PrivateIpAddress"`
-
- // 入包量。
- InPkg *uint64 `json:"InPkg,omitempty" name:"InPkg"`
-
- // 出包量。
- OutPkg *uint64 `json:"OutPkg,omitempty" name:"OutPkg"`
-
- // 入带宽,单位:`Byte`。
- InTraffic *uint64 `json:"InTraffic,omitempty" name:"InTraffic"`
-
- // 出带宽,单位:`Byte`。
- OutTraffic *uint64 `json:"OutTraffic,omitempty" name:"OutTraffic"`
-}
-
-type HaVip struct {
-
- // `HAVIP`的`ID`,是`HAVIP`的唯一标识。
- HaVipId *string `json:"HaVipId,omitempty" name:"HaVipId"`
-
- // `HAVIP`名称。
- HaVipName *string `json:"HaVipName,omitempty" name:"HaVipName"`
-
- // 虚拟IP地址。
- Vip *string `json:"Vip,omitempty" name:"Vip"`
-
- // `HAVIP`所在私有网络`ID`。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // `HAVIP`所在子网`ID`。
- SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"`
-
- // `HAVIP`关联弹性网卡`ID`。
- NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"`
-
- // 被绑定的实例`ID`。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 绑定`EIP`。
- AddressIp *string `json:"AddressIp,omitempty" name:"AddressIp"`
-
- // 状态:
- // `AVAILABLE`:运行中
- // `UNBIND`:未绑定
- State *string `json:"State,omitempty" name:"State"`
-
- // 创建时间。
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-}
-
-type HaVipAssociateAddressIpRequest struct {
- *tchttp.BaseRequest
-
- // `HAVIP`唯一`ID`,形如:`havip-9o233uri`。必须是没有绑定`EIP`的`HAVIP`
- HaVipId *string `json:"HaVipId,omitempty" name:"HaVipId"`
-
- // 弹性公网`IP`。必须是没有绑定`HAVIP`的`EIP`
- AddressIp *string `json:"AddressIp,omitempty" name:"AddressIp"`
-}
-
-func (r *HaVipAssociateAddressIpRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *HaVipAssociateAddressIpRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type HaVipAssociateAddressIpResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *HaVipAssociateAddressIpResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *HaVipAssociateAddressIpResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type HaVipDisassociateAddressIpRequest struct {
- *tchttp.BaseRequest
-
- // `HAVIP`唯一`ID`,形如:`havip-9o233uri`。必须是已绑定`EIP`的`HAVIP`。
- HaVipId *string `json:"HaVipId,omitempty" name:"HaVipId"`
-}
-
-func (r *HaVipDisassociateAddressIpRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *HaVipDisassociateAddressIpRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type HaVipDisassociateAddressIpResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *HaVipDisassociateAddressIpResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *HaVipDisassociateAddressIpResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type IKEOptionsSpecification struct {
-
- // 加密算法,可选值:'3DES-CBC', 'AES-CBC-128', 'AES-CBS-192', 'AES-CBC-256', 'DES-CBC',默认为3DES-CBC
- PropoEncryAlgorithm *string `json:"PropoEncryAlgorithm,omitempty" name:"PropoEncryAlgorithm"`
-
- // 认证算法:可选值:'MD5', 'SHA1',默认为MD5
- PropoAuthenAlgorithm *string `json:"PropoAuthenAlgorithm,omitempty" name:"PropoAuthenAlgorithm"`
-
- // 协商模式:可选值:'AGGRESSIVE', 'MAIN',默认为MAIN
- ExchangeMode *string `json:"ExchangeMode,omitempty" name:"ExchangeMode"`
-
- // 本端标识类型:可选值:'ADDRESS', 'FQDN',默认为ADDRESS
- LocalIdentity *string `json:"LocalIdentity,omitempty" name:"LocalIdentity"`
-
- // 对端标识类型:可选值:'ADDRESS', 'FQDN',默认为ADDRESS
- RemoteIdentity *string `json:"RemoteIdentity,omitempty" name:"RemoteIdentity"`
-
- // 本端标识,当LocalIdentity选为ADDRESS时,LocalAddress必填。localAddress默认为vpn网关公网IP
- LocalAddress *string `json:"LocalAddress,omitempty" name:"LocalAddress"`
-
- // 对端标识,当RemoteIdentity选为ADDRESS时,RemoteAddress必填
- RemoteAddress *string `json:"RemoteAddress,omitempty" name:"RemoteAddress"`
-
- // 本端标识,当LocalIdentity选为FQDN时,LocalFqdnName必填
- LocalFqdnName *string `json:"LocalFqdnName,omitempty" name:"LocalFqdnName"`
-
- // 对端标识,当remoteIdentity选为FQDN时,RemoteFqdnName必填
- RemoteFqdnName *string `json:"RemoteFqdnName,omitempty" name:"RemoteFqdnName"`
-
- // DH group,指定IKE交换密钥时使用的DH组,可选值:'GROUP1', 'GROUP2', 'GROUP5', 'GROUP14', 'GROUP24',
- DhGroupName *string `json:"DhGroupName,omitempty" name:"DhGroupName"`
-
- // IKE SA Lifetime,单位:秒,设置IKE SA的生存周期,取值范围:60-604800
- IKESaLifetimeSeconds *uint64 `json:"IKESaLifetimeSeconds,omitempty" name:"IKESaLifetimeSeconds"`
-
- // IKE版本
- IKEVersion *string `json:"IKEVersion,omitempty" name:"IKEVersion"`
-}
-
-type IPSECOptionsSpecification struct {
-
- // 加密算法,可选值:'3DES-CBC', 'AES-CBC-128', 'AES-CBC-192', 'AES-CBC-256', 'DES-CBC', 'NULL', 默认为AES-CBC-128
- EncryptAlgorithm *string `json:"EncryptAlgorithm,omitempty" name:"EncryptAlgorithm"`
-
- // 认证算法:可选值:'MD5', 'SHA1',默认为
- IntegrityAlgorith *string `json:"IntegrityAlgorith,omitempty" name:"IntegrityAlgorith"`
-
- // IPsec SA lifetime(s):单位秒,取值范围:180-604800
- IPSECSaLifetimeSeconds *uint64 `json:"IPSECSaLifetimeSeconds,omitempty" name:"IPSECSaLifetimeSeconds"`
-
- // PFS:可选值:'NULL', 'DH-GROUP1', 'DH-GROUP2', 'DH-GROUP5', 'DH-GROUP14', 'DH-GROUP24',默认为NULL
- PfsDhGroup *string `json:"PfsDhGroup,omitempty" name:"PfsDhGroup"`
-
- // IPsec SA lifetime(KB):单位KB,取值范围:2560-604800
- IPSECSaLifetimeTraffic *uint64 `json:"IPSECSaLifetimeTraffic,omitempty" name:"IPSECSaLifetimeTraffic"`
-}
-
-type InquiryPriceCreateVpnGatewayRequest struct {
- *tchttp.BaseRequest
-
- // 公网带宽设置。可选带宽规格:5, 10, 20, 50, 100;单位:Mbps。
- InternetMaxBandwidthOut *uint64 `json:"InternetMaxBandwidthOut,omitempty" name:"InternetMaxBandwidthOut"`
-
- // VPN网关计费模式,PREPAID:表示预付费,即包年包月,POSTPAID_BY_HOUR:表示后付费,即按量计费。默认:POSTPAID_BY_HOUR,如果指定预付费模式,参数InstanceChargePrepaid必填。
- InstanceChargeType *string `json:"InstanceChargeType,omitempty" name:"InstanceChargeType"`
-
- // 预付费模式,即包年包月相关参数设置。通过该参数可以指定包年包月实例的购买时长、是否设置自动续费等属性。若指定实例的付费模式为预付费则该参数必传。
- InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid,omitempty" name:"InstanceChargePrepaid"`
-}
-
-func (r *InquiryPriceCreateVpnGatewayRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InquiryPriceCreateVpnGatewayRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InquiryPriceCreateVpnGatewayResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 商品价格。
- Price *Price `json:"Price,omitempty" name:"Price"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *InquiryPriceCreateVpnGatewayResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InquiryPriceCreateVpnGatewayResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InquiryPriceRenewVpnGatewayRequest struct {
- *tchttp.BaseRequest
-
- // VPN网关实例ID。
- VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"`
-
- // 预付费模式,即包年包月相关参数设置。通过该参数可以指定包年包月实例的购买时长、是否设置自动续费等属性。若指定实例的付费模式为预付费则该参数必传。
- InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid,omitempty" name:"InstanceChargePrepaid"`
-}
-
-func (r *InquiryPriceRenewVpnGatewayRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InquiryPriceRenewVpnGatewayRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InquiryPriceRenewVpnGatewayResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 商品价格。
- Price *Price `json:"Price,omitempty" name:"Price"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *InquiryPriceRenewVpnGatewayResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InquiryPriceRenewVpnGatewayResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InquiryPriceResetVpnGatewayInternetMaxBandwidthRequest struct {
- *tchttp.BaseRequest
-
- // VPN网关实例ID。
- VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"`
-
- // 公网带宽设置。可选带宽规格:5, 10, 20, 50, 100;单位:Mbps。
- InternetMaxBandwidthOut *uint64 `json:"InternetMaxBandwidthOut,omitempty" name:"InternetMaxBandwidthOut"`
-}
-
-func (r *InquiryPriceResetVpnGatewayInternetMaxBandwidthRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InquiryPriceResetVpnGatewayInternetMaxBandwidthRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InquiryPriceResetVpnGatewayInternetMaxBandwidthResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 商品价格。
- Price *Price `json:"Price,omitempty" name:"Price"`
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *InquiryPriceResetVpnGatewayInternetMaxBandwidthResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *InquiryPriceResetVpnGatewayInternetMaxBandwidthResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type InstanceChargePrepaid struct {
-
- // 购买实例的时长,单位:月。取值范围:1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, 36。
- Period *uint64 `json:"Period,omitempty" name:"Period"`
-
- // 自动续费标识。取值范围: NOTIFY_AND_AUTO_RENEW:通知过期且自动续费, NOTIFY_AND_MANUAL_RENEW:通知过期不自动续费。默认:NOTIFY_AND_MANUAL_RENEW
- RenewFlag *string `json:"RenewFlag,omitempty" name:"RenewFlag"`
-}
-
-type InstanceStatistic struct {
-
- // 实例的类型
- InstanceType *string `json:"InstanceType,omitempty" name:"InstanceType"`
-
- // 实例的个数
- InstanceCount *uint64 `json:"InstanceCount,omitempty" name:"InstanceCount"`
-}
-
-type Ip6Rule struct {
-
- // IPV6转换规则唯一ID,形如rule6-xxxxxxxx
- Ip6RuleId *string `json:"Ip6RuleId,omitempty" name:"Ip6RuleId"`
-
- // IPV6转换规则名称
- Ip6RuleName *string `json:"Ip6RuleName,omitempty" name:"Ip6RuleName"`
-
- // IPV6地址
- Vip6 *string `json:"Vip6,omitempty" name:"Vip6"`
-
- // IPV6端口号
- Vport6 *int64 `json:"Vport6,omitempty" name:"Vport6"`
-
- // 协议类型,支持TCP/UDP
- Protocol *string `json:"Protocol,omitempty" name:"Protocol"`
-
- // IPV4地址
- Vip *string `json:"Vip,omitempty" name:"Vip"`
-
- // IPV4端口号
- Vport *int64 `json:"Vport,omitempty" name:"Vport"`
-
- // 转换规则状态,限于CREATING,RUNNING,DELETING,MODIFYING
- RuleStatus *string `json:"RuleStatus,omitempty" name:"RuleStatus"`
-
- // 转换规则创建时间
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-}
-
-type Ip6RuleInfo struct {
-
- // IPV6端口号,可在0~65535范围取值
- Vport6 *int64 `json:"Vport6,omitempty" name:"Vport6"`
-
- // 协议类型,支持TCP/UDP
- Protocol *string `json:"Protocol,omitempty" name:"Protocol"`
-
- // IPV4地址
- Vip *string `json:"Vip,omitempty" name:"Vip"`
-
- // IPV4端口号,可在0~65535范围取值
- Vport *int64 `json:"Vport,omitempty" name:"Vport"`
-}
-
-type Ip6Translator struct {
-
- // IPV6转换实例唯一ID,形如ip6-xxxxxxxx
- Ip6TranslatorId *string `json:"Ip6TranslatorId,omitempty" name:"Ip6TranslatorId"`
-
- // IPV6转换实例名称
- Ip6TranslatorName *string `json:"Ip6TranslatorName,omitempty" name:"Ip6TranslatorName"`
-
- // IPV6地址
- Vip6 *string `json:"Vip6,omitempty" name:"Vip6"`
-
- // IPV6转换地址所属运营商
- IspName *string `json:"IspName,omitempty" name:"IspName"`
-
- // 转换实例状态,限于CREATING,RUNNING,DELETING,MODIFYING
- TranslatorStatus *string `json:"TranslatorStatus,omitempty" name:"TranslatorStatus"`
-
- // IPV6转换实例创建时间
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-
- // 绑定的IPV6转换规则数量
- Ip6RuleCount *int64 `json:"Ip6RuleCount,omitempty" name:"Ip6RuleCount"`
-
- // IPV6转换规则信息
- IP6RuleSet []*Ip6Rule `json:"IP6RuleSet,omitempty" name:"IP6RuleSet" list`
-}
-
-type Ipv6Address struct {
-
- // `IPv6`地址,形如:`3402:4e00:20:100:0:8cd9:2a67:71f3`
- Address *string `json:"Address,omitempty" name:"Address"`
-
- // 是否是主`IP`。
- Primary *bool `json:"Primary,omitempty" name:"Primary"`
-
- // `EIP`实例`ID`,形如:`eip-hxlqja90`。
- AddressId *string `json:"AddressId,omitempty" name:"AddressId"`
-
- // 描述信息。
- Description *string `json:"Description,omitempty" name:"Description"`
-
- // 公网IP是否被封堵。
- IsWanIpBlocked *bool `json:"IsWanIpBlocked,omitempty" name:"IsWanIpBlocked"`
-
- // `IPv6`地址状态:
- // `PENDING`:生产中
- // `MIGRATING`:迁移中
- // `DELETING`:删除中
- // `AVAILABLE`:可用的
- State *string `json:"State,omitempty" name:"State"`
-}
-
-type Ipv6SubnetCidrBlock struct {
-
- // 子网实例`ID`。形如:`subnet-pxir56ns`。
- SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"`
-
- // `IPv6`子网段。形如:`3402:4e00:20:1001::/64`
- Ipv6CidrBlock *string `json:"Ipv6CidrBlock,omitempty" name:"Ipv6CidrBlock"`
-}
-
-type ItemPrice struct {
-
- // 按量计费后付费单价,单位:元。
- UnitPrice *float64 `json:"UnitPrice,omitempty" name:"UnitPrice"`
-
- // 按量计费后付费计价单元,可取值范围: HOUR:表示计价单元是按每小时来计算。当前涉及该计价单元的场景有:实例按小时后付费(POSTPAID_BY_HOUR)、带宽按小时后付费(BANDWIDTH_POSTPAID_BY_HOUR): GB:表示计价单元是按每GB来计算。当前涉及该计价单元的场景有:流量按小时后付费(TRAFFIC_POSTPAID_BY_HOUR)。
- ChargeUnit *string `json:"ChargeUnit,omitempty" name:"ChargeUnit"`
-
- // 预付费商品的原价,单位:元。
- OriginalPrice *float64 `json:"OriginalPrice,omitempty" name:"OriginalPrice"`
-
- // 预付费商品的折扣价,单位:元。
- DiscountPrice *float64 `json:"DiscountPrice,omitempty" name:"DiscountPrice"`
-}
-
-type MigrateNetworkInterfaceRequest struct {
- *tchttp.BaseRequest
-
- // 弹性网卡实例ID,例如:eni-m6dyj72l。
- NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"`
-
- // 弹性网卡当前绑定的CVM实例ID。形如:ins-r8hr2upy。
- SourceInstanceId *string `json:"SourceInstanceId,omitempty" name:"SourceInstanceId"`
-
- // 待迁移的目的CVM实例ID。
- DestinationInstanceId *string `json:"DestinationInstanceId,omitempty" name:"DestinationInstanceId"`
-}
-
-func (r *MigrateNetworkInterfaceRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *MigrateNetworkInterfaceRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type MigrateNetworkInterfaceResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *MigrateNetworkInterfaceResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *MigrateNetworkInterfaceResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type MigratePrivateIpAddressRequest struct {
- *tchttp.BaseRequest
-
- // 当内网IP绑定的弹性网卡实例ID,例如:eni-m6dyj72l。
- SourceNetworkInterfaceId *string `json:"SourceNetworkInterfaceId,omitempty" name:"SourceNetworkInterfaceId"`
-
- // 待迁移的目的弹性网卡实例ID。
- DestinationNetworkInterfaceId *string `json:"DestinationNetworkInterfaceId,omitempty" name:"DestinationNetworkInterfaceId"`
-
- // 迁移的内网IP地址,例如:10.0.0.6。
- PrivateIpAddress *string `json:"PrivateIpAddress,omitempty" name:"PrivateIpAddress"`
-}
-
-func (r *MigratePrivateIpAddressRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *MigratePrivateIpAddressRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type MigratePrivateIpAddressResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *MigratePrivateIpAddressResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *MigratePrivateIpAddressResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyAddressAttributeRequest struct {
- *tchttp.BaseRequest
-
- // 标识 EIP 的唯一 ID。EIP 唯一 ID 形如:`eip-11112222`。
- AddressId *string `json:"AddressId,omitempty" name:"AddressId"`
-
- // 修改后的 EIP 名称。长度上限为20个字符。
- AddressName *string `json:"AddressName,omitempty" name:"AddressName"`
-}
-
-func (r *ModifyAddressAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyAddressAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyAddressAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyAddressAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyAddressAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyAddressTemplateAttributeRequest struct {
- *tchttp.BaseRequest
-
- // IP地址模板实例ID,例如:ipm-mdunqeb6。
- AddressTemplateId *string `json:"AddressTemplateId,omitempty" name:"AddressTemplateId"`
-
- // IP地址模板名称。
- AddressTemplateName *string `json:"AddressTemplateName,omitempty" name:"AddressTemplateName"`
-
- // 地址信息,支持 IP、CIDR、IP 范围。
- Addresses []*string `json:"Addresses,omitempty" name:"Addresses" list`
-}
-
-func (r *ModifyAddressTemplateAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyAddressTemplateAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyAddressTemplateAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyAddressTemplateAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyAddressTemplateAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyAddressTemplateGroupAttributeRequest struct {
- *tchttp.BaseRequest
-
- // IP地址模板集合实例ID,例如:ipmg-2uw6ujo6。
- AddressTemplateGroupId *string `json:"AddressTemplateGroupId,omitempty" name:"AddressTemplateGroupId"`
-
- // IP地址模板集合名称。
- AddressTemplateGroupName *string `json:"AddressTemplateGroupName,omitempty" name:"AddressTemplateGroupName"`
-
- // IP地址模板实例ID, 例如:ipm-mdunqeb6。
- AddressTemplateIds []*string `json:"AddressTemplateIds,omitempty" name:"AddressTemplateIds" list`
-}
-
-func (r *ModifyAddressTemplateGroupAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyAddressTemplateGroupAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyAddressTemplateGroupAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyAddressTemplateGroupAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyAddressTemplateGroupAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyAddressesBandwidthRequest struct {
- *tchttp.BaseRequest
-
- // EIP唯一标识id,形如'eip-xxxx'
- AddressIds []*string `json:"AddressIds,omitempty" name:"AddressIds" list`
-
- // 调整带宽目标值
- InternetMaxBandwidthOut *int64 `json:"InternetMaxBandwidthOut,omitempty" name:"InternetMaxBandwidthOut"`
-
- // 包月带宽起始时间
- StartTime *string `json:"StartTime,omitempty" name:"StartTime"`
-
- // 包月带宽结束时间
- EndTime *string `json:"EndTime,omitempty" name:"EndTime"`
-}
-
-func (r *ModifyAddressesBandwidthRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyAddressesBandwidthRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyAddressesBandwidthResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyAddressesBandwidthResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyAddressesBandwidthResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyBandwidthPackageAttributeRequest struct {
- *tchttp.BaseRequest
-
- // 带宽包唯一标识ID
- BandwidthPackageId *string `json:"BandwidthPackageId,omitempty" name:"BandwidthPackageId"`
-
- // 带宽包名称
- BandwidthPackageName *string `json:"BandwidthPackageName,omitempty" name:"BandwidthPackageName"`
-}
-
-func (r *ModifyBandwidthPackageAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyBandwidthPackageAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyBandwidthPackageAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyBandwidthPackageAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyBandwidthPackageAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyCcnAttributeRequest struct {
- *tchttp.BaseRequest
-
- // CCN实例ID。形如:ccn-f49l6u0z。
- CcnId *string `json:"CcnId,omitempty" name:"CcnId"`
-
- // CCN名称,最大长度不能超过60个字节。
- CcnName *string `json:"CcnName,omitempty" name:"CcnName"`
-
- // CCN描述信息,最大长度不能超过100个字节。
- CcnDescription *string `json:"CcnDescription,omitempty" name:"CcnDescription"`
-}
-
-func (r *ModifyCcnAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyCcnAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyCcnAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyCcnAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyCcnAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyCustomerGatewayAttributeRequest struct {
- *tchttp.BaseRequest
-
- // 对端网关ID,例如:cgw-2wqq41m9,可通过DescribeCustomerGateways接口查询对端网关。
- CustomerGatewayId *string `json:"CustomerGatewayId,omitempty" name:"CustomerGatewayId"`
-
- // 对端网关名称,可任意命名,但不得超过60个字符。
- CustomerGatewayName *string `json:"CustomerGatewayName,omitempty" name:"CustomerGatewayName"`
-}
-
-func (r *ModifyCustomerGatewayAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyCustomerGatewayAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyCustomerGatewayAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyCustomerGatewayAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyCustomerGatewayAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyDirectConnectGatewayAttributeRequest struct {
- *tchttp.BaseRequest
-
- // 专线网关唯一`ID`,形如:`dcg-9o233uri`。
- DirectConnectGatewayId *string `json:"DirectConnectGatewayId,omitempty" name:"DirectConnectGatewayId"`
-
- // 专线网关名称,可任意命名,但不得超过60个字符。
- DirectConnectGatewayName *string `json:"DirectConnectGatewayName,omitempty" name:"DirectConnectGatewayName"`
-
- // 云联网路由学习类型,可选值:`BGP`(自动学习)、`STATIC`(静态,即用户配置)。只有云联网类型专线网关且开启了BGP功能才支持修改`CcnRouteType`。
- CcnRouteType *string `json:"CcnRouteType,omitempty" name:"CcnRouteType"`
-}
-
-func (r *ModifyDirectConnectGatewayAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyDirectConnectGatewayAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyDirectConnectGatewayAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyDirectConnectGatewayAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyDirectConnectGatewayAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyFlowLogAttributeRequest struct {
- *tchttp.BaseRequest
-
- // 私用网络ID或者统一ID,建议使用统一ID
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 流日志唯一ID
- FlowLogId *string `json:"FlowLogId,omitempty" name:"FlowLogId"`
-
- // 流日志实例名字
- FlowLogName *string `json:"FlowLogName,omitempty" name:"FlowLogName"`
-
- // 流日志实例描述
- FlowLogDescription *string `json:"FlowLogDescription,omitempty" name:"FlowLogDescription"`
-}
-
-func (r *ModifyFlowLogAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyFlowLogAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyFlowLogAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyFlowLogAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyFlowLogAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyHaVipAttributeRequest struct {
- *tchttp.BaseRequest
-
- // `HAVIP`唯一`ID`,形如:`havip-9o233uri`。
- HaVipId *string `json:"HaVipId,omitempty" name:"HaVipId"`
-
- // `HAVIP`名称,可任意命名,但不得超过60个字符。
- HaVipName *string `json:"HaVipName,omitempty" name:"HaVipName"`
-}
-
-func (r *ModifyHaVipAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyHaVipAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyHaVipAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyHaVipAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyHaVipAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyIp6RuleRequest struct {
- *tchttp.BaseRequest
-
- // IPV6转换实例唯一ID,形如ip6-xxxxxxxx
- Ip6TranslatorId *string `json:"Ip6TranslatorId,omitempty" name:"Ip6TranslatorId"`
-
- // IPV6转换规则唯一ID,形如rule6-xxxxxxxx
- Ip6RuleId *string `json:"Ip6RuleId,omitempty" name:"Ip6RuleId"`
-
- // IPV6转换规则修改后的名称
- Ip6RuleName *string `json:"Ip6RuleName,omitempty" name:"Ip6RuleName"`
-
- // IPV6转换规则修改后的IPV4地址
- Vip *string `json:"Vip,omitempty" name:"Vip"`
-
- // IPV6转换规则修改后的IPV4端口号
- Vport *int64 `json:"Vport,omitempty" name:"Vport"`
-}
-
-func (r *ModifyIp6RuleRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyIp6RuleRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyIp6RuleResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyIp6RuleResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyIp6RuleResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyIp6TranslatorRequest struct {
- *tchttp.BaseRequest
-
- // IPV6转换实例唯一ID,形如ip6-xxxxxxxxx
- Ip6TranslatorId *string `json:"Ip6TranslatorId,omitempty" name:"Ip6TranslatorId"`
-
- // IPV6转换实例修改名称
- Ip6TranslatorName *string `json:"Ip6TranslatorName,omitempty" name:"Ip6TranslatorName"`
-}
-
-func (r *ModifyIp6TranslatorRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyIp6TranslatorRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyIp6TranslatorResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyIp6TranslatorResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyIp6TranslatorResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyIpv6AddressesAttributeRequest struct {
- *tchttp.BaseRequest
-
- // 弹性网卡实例`ID`,形如:`eni-m6dyj72l`。
- NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"`
-
- // 指定的内网IPv6`地址信息。
- Ipv6Addresses []*Ipv6Address `json:"Ipv6Addresses,omitempty" name:"Ipv6Addresses" list`
-}
-
-func (r *ModifyIpv6AddressesAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyIpv6AddressesAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyIpv6AddressesAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyIpv6AddressesAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyIpv6AddressesAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyNetworkInterfaceAttributeRequest struct {
- *tchttp.BaseRequest
-
- // 弹性网卡实例ID,例如:eni-pxir56ns。
- NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"`
-
- // 弹性网卡名称,最大长度不能超过60个字节。
- NetworkInterfaceName *string `json:"NetworkInterfaceName,omitempty" name:"NetworkInterfaceName"`
-
- // 弹性网卡描述,可任意命名,但不得超过60个字符。
- NetworkInterfaceDescription *string `json:"NetworkInterfaceDescription,omitempty" name:"NetworkInterfaceDescription"`
-
- // 指定绑定的安全组,例如:['sg-1dd51d']。
- SecurityGroupIds []*string `json:"SecurityGroupIds,omitempty" name:"SecurityGroupIds" list`
-}
-
-func (r *ModifyNetworkInterfaceAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyNetworkInterfaceAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyNetworkInterfaceAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyNetworkInterfaceAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyNetworkInterfaceAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyPrivateIpAddressesAttributeRequest struct {
- *tchttp.BaseRequest
-
- // 弹性网卡实例ID,例如:eni-m6dyj72l。
- NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"`
-
- // 指定的内网IP信息。
- PrivateIpAddresses []*PrivateIpAddressSpecification `json:"PrivateIpAddresses,omitempty" name:"PrivateIpAddresses" list`
-}
-
-func (r *ModifyPrivateIpAddressesAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyPrivateIpAddressesAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyPrivateIpAddressesAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyPrivateIpAddressesAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyPrivateIpAddressesAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyRouteTableAttributeRequest struct {
- *tchttp.BaseRequest
-
- // 路由表实例ID,例如:rtb-azd4dt1c。
- RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"`
-
- // 路由表名称。
- RouteTableName *string `json:"RouteTableName,omitempty" name:"RouteTableName"`
-}
-
-func (r *ModifyRouteTableAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyRouteTableAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyRouteTableAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyRouteTableAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyRouteTableAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifySecurityGroupAttributeRequest struct {
- *tchttp.BaseRequest
-
- // 安全组实例ID,例如sg-33ocnj9n,可通过DescribeSecurityGroups获取。
- SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"`
-
- // 安全组名称,可任意命名,但不得超过60个字符。
- GroupName *string `json:"GroupName,omitempty" name:"GroupName"`
-
- // 安全组备注,最多100个字符。
- GroupDescription *string `json:"GroupDescription,omitempty" name:"GroupDescription"`
-}
-
-func (r *ModifySecurityGroupAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifySecurityGroupAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifySecurityGroupAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifySecurityGroupAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifySecurityGroupAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifySecurityGroupPoliciesRequest struct {
- *tchttp.BaseRequest
-
- // 安全组实例ID,例如sg-33ocnj9n,可通过DescribeSecurityGroups获取。
- SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"`
-
- // 安全组规则集合。 SecurityGroupPolicySet对象必须同时指定新的出(Egress)入(Ingress)站规则。 SecurityGroupPolicy对象不支持自定义索引(PolicyIndex)。
- SecurityGroupPolicySet *SecurityGroupPolicySet `json:"SecurityGroupPolicySet,omitempty" name:"SecurityGroupPolicySet"`
-}
-
-func (r *ModifySecurityGroupPoliciesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifySecurityGroupPoliciesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifySecurityGroupPoliciesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifySecurityGroupPoliciesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifySecurityGroupPoliciesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyServiceTemplateAttributeRequest struct {
- *tchttp.BaseRequest
-
- // 协议端口模板实例ID,例如:ppm-529nwwj8。
- ServiceTemplateId *string `json:"ServiceTemplateId,omitempty" name:"ServiceTemplateId"`
-
- // 协议端口模板名称。
- ServiceTemplateName *string `json:"ServiceTemplateName,omitempty" name:"ServiceTemplateName"`
-
- // 支持单个端口、多个端口、连续端口及所有端口,协议支持:TCP、UDP、ICMP、GRE 协议。
- Services []*string `json:"Services,omitempty" name:"Services" list`
-}
-
-func (r *ModifyServiceTemplateAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyServiceTemplateAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyServiceTemplateAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyServiceTemplateAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyServiceTemplateAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyServiceTemplateGroupAttributeRequest struct {
- *tchttp.BaseRequest
-
- // 协议端口模板集合实例ID,例如:ppmg-ei8hfd9a。
- ServiceTemplateGroupId *string `json:"ServiceTemplateGroupId,omitempty" name:"ServiceTemplateGroupId"`
-
- // 协议端口模板集合名称。
- ServiceTemplateGroupName *string `json:"ServiceTemplateGroupName,omitempty" name:"ServiceTemplateGroupName"`
-
- // 协议端口模板实例ID,例如:ppm-4dw6agho。
- ServiceTemplateIds []*string `json:"ServiceTemplateIds,omitempty" name:"ServiceTemplateIds" list`
-}
-
-func (r *ModifyServiceTemplateGroupAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyServiceTemplateGroupAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyServiceTemplateGroupAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyServiceTemplateGroupAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyServiceTemplateGroupAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifySubnetAttributeRequest struct {
- *tchttp.BaseRequest
-
- // 子网实例ID。形如:subnet-pxir56ns。
- SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"`
-
- // 子网名称,最大长度不能超过60个字节。
- SubnetName *string `json:"SubnetName,omitempty" name:"SubnetName"`
-
- // 子网是否开启广播。
- EnableBroadcast *string `json:"EnableBroadcast,omitempty" name:"EnableBroadcast"`
-}
-
-func (r *ModifySubnetAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifySubnetAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifySubnetAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifySubnetAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifySubnetAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyVpcAttributeRequest struct {
- *tchttp.BaseRequest
-
- // VPC实例ID。形如:vpc-f49l6u0z。每次请求的实例的上限为100。参数不支持同时指定VpcIds和Filters。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 私有网络名称,可任意命名,但不得超过60个字符。
- VpcName *string `json:"VpcName,omitempty" name:"VpcName"`
-
- // 是否开启组播。true: 开启, false: 关闭。
- EnableMulticast *string `json:"EnableMulticast,omitempty" name:"EnableMulticast"`
-
- // DNS地址,最多支持4个,第1个默认为主,其余为备
- DnsServers []*string `json:"DnsServers,omitempty" name:"DnsServers" list`
-
- // 域名
- DomainName *string `json:"DomainName,omitempty" name:"DomainName"`
-}
-
-func (r *ModifyVpcAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyVpcAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyVpcAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyVpcAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyVpcAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyVpnConnectionAttributeRequest struct {
- *tchttp.BaseRequest
-
- // VPN通道实例ID。形如:vpnx-f49l6u0z。
- VpnConnectionId *string `json:"VpnConnectionId,omitempty" name:"VpnConnectionId"`
-
- // VPN通道名称,可任意命名,但不得超过60个字符。
- VpnConnectionName *string `json:"VpnConnectionName,omitempty" name:"VpnConnectionName"`
-
- // 预共享密钥。
- PreShareKey *string `json:"PreShareKey,omitempty" name:"PreShareKey"`
-
- // SPD策略组,例如:{"10.0.0.5/24":["172.123.10.5/16"]},10.0.0.5/24是vpc内网段172.123.10.5/16是IDC网段。用户指定VPC内哪些网段可以和您IDC中哪些网段通信。
- SecurityPolicyDatabases []*SecurityPolicyDatabase `json:"SecurityPolicyDatabases,omitempty" name:"SecurityPolicyDatabases" list`
-
- // IKE配置(Internet Key Exchange,因特网密钥交换),IKE具有一套自我保护机制,用户配置网络安全协议。
- IKEOptionsSpecification *IKEOptionsSpecification `json:"IKEOptionsSpecification,omitempty" name:"IKEOptionsSpecification"`
-
- // IPSec配置,腾讯云提供IPSec安全会话设置。
- IPSECOptionsSpecification *IPSECOptionsSpecification `json:"IPSECOptionsSpecification,omitempty" name:"IPSECOptionsSpecification"`
-}
-
-func (r *ModifyVpnConnectionAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyVpnConnectionAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyVpnConnectionAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyVpnConnectionAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyVpnConnectionAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyVpnGatewayAttributeRequest struct {
- *tchttp.BaseRequest
-
- // VPN网关实例ID。
- VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"`
-
- // VPN网关名称,最大长度不能超过60个字节。
- VpnGatewayName *string `json:"VpnGatewayName,omitempty" name:"VpnGatewayName"`
-
- // VPN网关计费模式,目前只支持预付费(即包年包月)到后付费(即按量计费)的转换。即参数只支持:POSTPAID_BY_HOUR。
- InstanceChargeType *string `json:"InstanceChargeType,omitempty" name:"InstanceChargeType"`
-}
-
-func (r *ModifyVpnGatewayAttributeRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyVpnGatewayAttributeRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ModifyVpnGatewayAttributeResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ModifyVpnGatewayAttributeResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ModifyVpnGatewayAttributeResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type NatGateway struct {
-
- // NAT网关的ID。
- NatGatewayId *string `json:"NatGatewayId,omitempty" name:"NatGatewayId"`
-
- // NAT网关的名称。
- NatGatewayName *string `json:"NatGatewayName,omitempty" name:"NatGatewayName"`
-
- // NAT网关创建的时间。
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-
- // NAT网关的状态。
- // 'PENDING':生产中,'DELETING':删除中,'AVAILABLE':运行中,'UPDATING':升级中,
- // ‘FAILED’:失败。
- State *string `json:"State,omitempty" name:"State"`
-
- // 网关最大外网出带宽(单位:Mbps)。
- InternetMaxBandwidthOut *uint64 `json:"InternetMaxBandwidthOut,omitempty" name:"InternetMaxBandwidthOut"`
-
- // 网关并发连接上限。
- MaxConcurrentConnection *uint64 `json:"MaxConcurrentConnection,omitempty" name:"MaxConcurrentConnection"`
-
- // 绑定NAT网关的公网IP对象数组。
- PublicIpAddressSet []*NatGatewayAddress `json:"PublicIpAddressSet,omitempty" name:"PublicIpAddressSet" list`
-
- // NAT网关网络状态。“AVAILABLE”:运行中, “UNAVAILABLE”:不可用, “INSUFFICIENT”:欠费停服。
- NetworkState *string `json:"NetworkState,omitempty" name:"NetworkState"`
-
- // NAT网关的端口转发规则。
- DestinationIpPortTranslationNatRuleSet []*DestinationIpPortTranslationNatRule `json:"DestinationIpPortTranslationNatRuleSet,omitempty" name:"DestinationIpPortTranslationNatRuleSet" list`
-
- // VPC实例ID。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // NAT网关所在的可用区。
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-}
-
-type NatGatewayAddress struct {
-
- // 弹性公网IP(EIP)的唯一 ID,形如:`eip-11112222`。
- AddressId *string `json:"AddressId,omitempty" name:"AddressId"`
-
- // 外网IP地址,形如:`123.121.34.33`。
- PublicIpAddress *string `json:"PublicIpAddress,omitempty" name:"PublicIpAddress"`
-
- // 资源封堵状态。true表示弹性ip处于封堵状态,false表示弹性ip处于未封堵状态。
- IsBlocked *bool `json:"IsBlocked,omitempty" name:"IsBlocked"`
-}
-
-type NetworkInterface struct {
-
- // 弹性网卡实例ID,例如:eni-f1xjkw1b。
- NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"`
-
- // 弹性网卡名称。
- NetworkInterfaceName *string `json:"NetworkInterfaceName,omitempty" name:"NetworkInterfaceName"`
-
- // 弹性网卡描述。
- NetworkInterfaceDescription *string `json:"NetworkInterfaceDescription,omitempty" name:"NetworkInterfaceDescription"`
-
- // 子网实例ID。
- SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"`
-
- // VPC实例ID。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 绑定的安全组。
- GroupSet []*string `json:"GroupSet,omitempty" name:"GroupSet" list`
-
- // 是否是主网卡。
- Primary *bool `json:"Primary,omitempty" name:"Primary"`
-
- // MAC地址。
- MacAddress *string `json:"MacAddress,omitempty" name:"MacAddress"`
-
- // 弹性网卡状态:
- // `PENDING`:创建中
- // `AVAILABLE`:可用的
- // `ATTACHING`:绑定中
- // `DETACHING`:解绑中
- // `DELETING`:删除中
- State *string `json:"State,omitempty" name:"State"`
-
- // 内网IP信息。
- PrivateIpAddressSet []*PrivateIpAddressSpecification `json:"PrivateIpAddressSet,omitempty" name:"PrivateIpAddressSet" list`
-
- // 绑定的云服务器对象。
- // 注意:此字段可能返回 null,表示取不到有效值。
- Attachment *NetworkInterfaceAttachment `json:"Attachment,omitempty" name:"Attachment"`
-
- // 可用区。
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-
- // 创建时间。
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-
- // `IPv6`地址列表。
- Ipv6AddressSet []*Ipv6Address `json:"Ipv6AddressSet,omitempty" name:"Ipv6AddressSet" list`
-}
-
-type NetworkInterfaceAttachment struct {
-
- // 云主机实例ID。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-
- // 网卡在云主机实例内的序号。
- DeviceIndex *uint64 `json:"DeviceIndex,omitempty" name:"DeviceIndex"`
-
- // 云主机所有者账户信息。
- InstanceAccountId *string `json:"InstanceAccountId,omitempty" name:"InstanceAccountId"`
-
- // 绑定时间。
- AttachTime *string `json:"AttachTime,omitempty" name:"AttachTime"`
-}
-
-type Price struct {
-
- // 实例价格。
- InstancePrice *ItemPrice `json:"InstancePrice,omitempty" name:"InstancePrice"`
-
- // 网络价格。
- BandwidthPrice *ItemPrice `json:"BandwidthPrice,omitempty" name:"BandwidthPrice"`
-}
-
-type PrivateIpAddressSpecification struct {
-
- // 内网IP地址。
- PrivateIpAddress *string `json:"PrivateIpAddress,omitempty" name:"PrivateIpAddress"`
-
- // 是否是主IP。
- Primary *bool `json:"Primary,omitempty" name:"Primary"`
-
- // 公网IP地址。
- PublicIpAddress *string `json:"PublicIpAddress,omitempty" name:"PublicIpAddress"`
-
- // EIP实例ID,例如:eip-11112222。
- AddressId *string `json:"AddressId,omitempty" name:"AddressId"`
-
- // 内网IP描述信息。
- Description *string `json:"Description,omitempty" name:"Description"`
-
- // 公网IP是否被封堵。
- IsWanIpBlocked *bool `json:"IsWanIpBlocked,omitempty" name:"IsWanIpBlocked"`
-
- // IP状态:
- // PENDING:生产中
- // MIGRATING:迁移中
- // DELETING:删除中
- // AVAILABLE:可用的
- State *string `json:"State,omitempty" name:"State"`
-}
-
-type Quota struct {
-
- // 配额名称,取值范围:
`TOTAL_EIP_QUOTA`:用户当前地域下EIP的配额数;
`DAILY_EIP_APPLY`:用户当前地域下今日申购次数;
`DAILY_PUBLIC_IP_ASSIGN`:用户当前地域下,重新分配公网 IP次数。
- QuotaId *string `json:"QuotaId,omitempty" name:"QuotaId"`
-
- // 当前数量
- QuotaCurrent *int64 `json:"QuotaCurrent,omitempty" name:"QuotaCurrent"`
-
- // 配额数量
- QuotaLimit *int64 `json:"QuotaLimit,omitempty" name:"QuotaLimit"`
-}
-
-type RejectAttachCcnInstancesRequest struct {
- *tchttp.BaseRequest
-
- // CCN实例ID。形如:ccn-f49l6u0z。
- CcnId *string `json:"CcnId,omitempty" name:"CcnId"`
-
- // 拒绝关联实例列表。
- Instances []*CcnInstance `json:"Instances,omitempty" name:"Instances" list`
-}
-
-func (r *RejectAttachCcnInstancesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RejectAttachCcnInstancesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RejectAttachCcnInstancesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *RejectAttachCcnInstancesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RejectAttachCcnInstancesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ReleaseAddressesRequest struct {
- *tchttp.BaseRequest
-
- // 标识 EIP 的唯一 ID 列表。EIP 唯一 ID 形如:`eip-11112222`。
- AddressIds []*string `json:"AddressIds,omitempty" name:"AddressIds" list`
-}
-
-func (r *ReleaseAddressesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ReleaseAddressesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ReleaseAddressesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ReleaseAddressesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ReleaseAddressesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RemoveBandwidthPackageResourcesRequest struct {
- *tchttp.BaseRequest
-
- // 带宽包唯一标识ID,形如'bwp-xxxx'
- BandwidthPackageId *string `json:"BandwidthPackageId,omitempty" name:"BandwidthPackageId"`
-
- // 资源类型,包括‘Address’, ‘LoadBalance’
- ResourceType *string `json:"ResourceType,omitempty" name:"ResourceType"`
-
- // 资源Id,形如'eip-xxxx', 'lb-xxxx'
- ResourceIds []*string `json:"ResourceIds,omitempty" name:"ResourceIds" list`
-}
-
-func (r *RemoveBandwidthPackageResourcesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RemoveBandwidthPackageResourcesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RemoveBandwidthPackageResourcesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *RemoveBandwidthPackageResourcesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RemoveBandwidthPackageResourcesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RemoveIp6RulesRequest struct {
- *tchttp.BaseRequest
-
- // IPV6转换规则所属的转换实例唯一ID,形如ip6-xxxxxxxx
- Ip6TranslatorId *string `json:"Ip6TranslatorId,omitempty" name:"Ip6TranslatorId"`
-
- // 待删除IPV6转换规则,形如rule6-xxxxxxxx
- Ip6RuleIds []*string `json:"Ip6RuleIds,omitempty" name:"Ip6RuleIds" list`
-}
-
-func (r *RemoveIp6RulesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RemoveIp6RulesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RemoveIp6RulesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *RemoveIp6RulesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RemoveIp6RulesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RenewVpnGatewayRequest struct {
- *tchttp.BaseRequest
-
- // VPN网关实例ID。
- VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"`
-
- // 预付费计费模式。
- InstanceChargePrepaid *InstanceChargePrepaid `json:"InstanceChargePrepaid,omitempty" name:"InstanceChargePrepaid"`
-}
-
-func (r *RenewVpnGatewayRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RenewVpnGatewayRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type RenewVpnGatewayResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *RenewVpnGatewayResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *RenewVpnGatewayResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ReplaceDirectConnectGatewayCcnRoutesRequest struct {
- *tchttp.BaseRequest
-
- // 专线网关ID,形如:dcg-prpqlmg1
- DirectConnectGatewayId *string `json:"DirectConnectGatewayId,omitempty" name:"DirectConnectGatewayId"`
-
- // 需要连通的IDC网段列表
- Routes []*DirectConnectGatewayCcnRoute `json:"Routes,omitempty" name:"Routes" list`
-}
-
-func (r *ReplaceDirectConnectGatewayCcnRoutesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ReplaceDirectConnectGatewayCcnRoutesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ReplaceDirectConnectGatewayCcnRoutesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ReplaceDirectConnectGatewayCcnRoutesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ReplaceDirectConnectGatewayCcnRoutesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ReplaceRouteTableAssociationRequest struct {
- *tchttp.BaseRequest
-
- // 子网实例ID,例如:subnet-3x5lf5q0。可通过DescribeSubnets接口查询。
- SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"`
-
- // 路由表实例ID,例如:rtb-azd4dt1c。
- RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"`
-}
-
-func (r *ReplaceRouteTableAssociationRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ReplaceRouteTableAssociationRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ReplaceRouteTableAssociationResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ReplaceRouteTableAssociationResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ReplaceRouteTableAssociationResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ReplaceRoutesRequest struct {
- *tchttp.BaseRequest
-
- // 路由表实例ID,例如:rtb-azd4dt1c。
- RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"`
-
- // 路由策略对象。需要指定路由策略ID(RouteId)。
- Routes []*Route `json:"Routes,omitempty" name:"Routes" list`
-}
-
-func (r *ReplaceRoutesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ReplaceRoutesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ReplaceRoutesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ReplaceRoutesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ReplaceRoutesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ReplaceSecurityGroupPolicyRequest struct {
- *tchttp.BaseRequest
-
- // 安全组实例ID,例如sg-33ocnj9n,可通过DescribeSecurityGroups获取。
- SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"`
-
- // 安全组规则集合对象。
- SecurityGroupPolicySet *SecurityGroupPolicySet `json:"SecurityGroupPolicySet,omitempty" name:"SecurityGroupPolicySet"`
-}
-
-func (r *ReplaceSecurityGroupPolicyRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ReplaceSecurityGroupPolicyRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ReplaceSecurityGroupPolicyResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ReplaceSecurityGroupPolicyResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ReplaceSecurityGroupPolicyResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ResetAttachCcnInstancesRequest struct {
- *tchttp.BaseRequest
-
- // CCN实例ID。形如:ccn-f49l6u0z。
- CcnId *string `json:"CcnId,omitempty" name:"CcnId"`
-
- // CCN所属UIN(根账号)。
- CcnUin *string `json:"CcnUin,omitempty" name:"CcnUin"`
-
- // 重新申请关联网络实例列表。
- Instances []*CcnInstance `json:"Instances,omitempty" name:"Instances" list`
-}
-
-func (r *ResetAttachCcnInstancesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ResetAttachCcnInstancesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ResetAttachCcnInstancesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ResetAttachCcnInstancesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ResetAttachCcnInstancesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ResetRoutesRequest struct {
- *tchttp.BaseRequest
-
- // 路由表实例ID,例如:rtb-azd4dt1c。
- RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"`
-
- // 路由表名称,最大长度不能超过60个字节。
- RouteTableName *string `json:"RouteTableName,omitempty" name:"RouteTableName"`
-
- // 路由策略。
- Routes []*Route `json:"Routes,omitempty" name:"Routes" list`
-}
-
-func (r *ResetRoutesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ResetRoutesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ResetRoutesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ResetRoutesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ResetRoutesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ResetVpnConnectionRequest struct {
- *tchttp.BaseRequest
-
- // VPN网关实例ID。
- VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"`
-
- // VPN通道实例ID。形如:vpnx-f49l6u0z。
- VpnConnectionId *string `json:"VpnConnectionId,omitempty" name:"VpnConnectionId"`
-}
-
-func (r *ResetVpnConnectionRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ResetVpnConnectionRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ResetVpnConnectionResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ResetVpnConnectionResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ResetVpnConnectionResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ResetVpnGatewayInternetMaxBandwidthRequest struct {
- *tchttp.BaseRequest
-
- // VPN网关实例ID。
- VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"`
-
- // 公网带宽设置。可选带宽规格:5, 10, 20, 50, 100;单位:Mbps。
- InternetMaxBandwidthOut *uint64 `json:"InternetMaxBandwidthOut,omitempty" name:"InternetMaxBandwidthOut"`
-}
-
-func (r *ResetVpnGatewayInternetMaxBandwidthRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ResetVpnGatewayInternetMaxBandwidthRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type ResetVpnGatewayInternetMaxBandwidthResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *ResetVpnGatewayInternetMaxBandwidthResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *ResetVpnGatewayInternetMaxBandwidthResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type Resource struct {
-
- // 带宽包资源类型,包括'Address'和'LoadBalance'
- ResourceType *string `json:"ResourceType,omitempty" name:"ResourceType"`
-
- // 带宽包资源Id,形如'eip-xxxx', 'lb-xxxx'
- ResourceId *string `json:"ResourceId,omitempty" name:"ResourceId"`
-
- // 带宽包资源Ip
- AddressIp *string `json:"AddressIp,omitempty" name:"AddressIp"`
-}
-
-type Route struct {
-
- // 目的网段,取值不能在私有网络网段内,例如:112.20.51.0/24。
- DestinationCidrBlock *string `json:"DestinationCidrBlock,omitempty" name:"DestinationCidrBlock"`
-
- // 下一跳类型,目前我们支持的类型有:
- // CVM:公网网关类型的云主机;
- // VPN:VPN网关;
- // DIRECTCONNECT:专线网关;
- // PEERCONNECTION:对等连接;
- // SSLVPN:sslvpn网关;
- // NAT:NAT网关;
- // NORMAL_CVM:普通云主机;
- // EIP:云主机的公网IP;
- // CCN:云联网。
- GatewayType *string `json:"GatewayType,omitempty" name:"GatewayType"`
-
- // 下一跳地址,这里只需要指定不同下一跳类型的网关ID,系统会自动匹配到下一跳地址。
- // 特别注意:当 GatewayType 为 EIP 时,GatewayId 固定值 '0'
- GatewayId *string `json:"GatewayId,omitempty" name:"GatewayId"`
-
- // 路由策略ID。
- RouteId *uint64 `json:"RouteId,omitempty" name:"RouteId"`
-
- // 路由策略描述。
- RouteDescription *string `json:"RouteDescription,omitempty" name:"RouteDescription"`
-
- // 是否启用
- Enabled *bool `json:"Enabled,omitempty" name:"Enabled"`
-
- // 路由类型,目前我们支持的类型有:
- // USER:用户路由;
- // NETD:网络探测路由,创建网络探测实例时,系统默认下发,不可编辑与删除;
- // CCN:云联网路由,系统默认下发,不可编辑与删除。
- // 用户只能添加和操作 USER 类型的路由。
- RouteType *string `json:"RouteType,omitempty" name:"RouteType"`
-}
-
-type RouteConflict struct {
-
- // 路由表实例ID,例如:rtb-azd4dt1c。
- RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"`
-
- // 要检查的与之冲突的目的端
- DestinationCidrBlock *string `json:"DestinationCidrBlock,omitempty" name:"DestinationCidrBlock"`
-
- // 冲突的路由策略列表
- ConflictSet []*Route `json:"ConflictSet,omitempty" name:"ConflictSet" list`
-}
-
-type RouteTable struct {
-
- // VPC实例ID。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 路由表实例ID,例如:rtb-azd4dt1c。
- RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"`
-
- // 路由表名称。
- RouteTableName *string `json:"RouteTableName,omitempty" name:"RouteTableName"`
-
- // 路由表关联关系。
- AssociationSet []*RouteTableAssociation `json:"AssociationSet,omitempty" name:"AssociationSet" list`
-
- // 路由表策略集合。
- RouteSet []*Route `json:"RouteSet,omitempty" name:"RouteSet" list`
-
- // 是否默认路由表。
- Main *bool `json:"Main,omitempty" name:"Main"`
-
- // 创建时间。
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-}
-
-type RouteTableAssociation struct {
-
- // 子网实例ID。
- SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"`
-
- // 路由表实例ID。
- RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"`
-}
-
-type SecurityGroup struct {
-
- // 安全组实例ID,例如:sg-ohuuioma。
- SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"`
-
- // 安全组名称,可任意命名,但不得超过60个字符。
- SecurityGroupName *string `json:"SecurityGroupName,omitempty" name:"SecurityGroupName"`
-
- // 安全组备注,最多100个字符。
- SecurityGroupDesc *string `json:"SecurityGroupDesc,omitempty" name:"SecurityGroupDesc"`
-
- // 项目id,默认0。可在qcloud控制台项目管理页面查询到。
- ProjectId *string `json:"ProjectId,omitempty" name:"ProjectId"`
-
- // 是否是默认安全组,默认安全组不支持删除。
- IsDefault *bool `json:"IsDefault,omitempty" name:"IsDefault"`
-
- // 安全组创建时间。
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-}
-
-type SecurityGroupAssociationStatistics struct {
-
- // 安全组实例ID。
- SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"`
-
- // 云主机实例数。
- CVM *uint64 `json:"CVM,omitempty" name:"CVM"`
-
- // 数据库实例数。
- CDB *uint64 `json:"CDB,omitempty" name:"CDB"`
-
- // 弹性网卡实例数。
- ENI *uint64 `json:"ENI,omitempty" name:"ENI"`
-
- // 被安全组引用数。
- SG *uint64 `json:"SG,omitempty" name:"SG"`
-
- // 负载均衡实例数。
- CLB *uint64 `json:"CLB,omitempty" name:"CLB"`
-
- // 全量实例的绑定统计。
- InstanceStatistics []*InstanceStatistic `json:"InstanceStatistics,omitempty" name:"InstanceStatistics" list`
-}
-
-type SecurityGroupPolicy struct {
-
- // 安全组规则索引号。
- PolicyIndex *int64 `json:"PolicyIndex,omitempty" name:"PolicyIndex"`
-
- // 协议, 取值: TCP,UDP, ICMP。
- Protocol *string `json:"Protocol,omitempty" name:"Protocol"`
-
- // 端口(all, 离散port, range)。
- Port *string `json:"Port,omitempty" name:"Port"`
-
- // 协议端口ID或者协议端口组ID。ServiceTemplate和Protocol+Port互斥。
- ServiceTemplate *ServiceTemplateSpecification `json:"ServiceTemplate,omitempty" name:"ServiceTemplate"`
-
- // 网段或IP(互斥)。
- CidrBlock *string `json:"CidrBlock,omitempty" name:"CidrBlock"`
-
- // 安全组实例ID,例如:sg-ohuuioma。
- SecurityGroupId *string `json:"SecurityGroupId,omitempty" name:"SecurityGroupId"`
-
- // IP地址ID或者ID地址组ID。
- AddressTemplate *AddressTemplateSpecification `json:"AddressTemplate,omitempty" name:"AddressTemplate"`
-
- // ACCEPT 或 DROP。
- Action *string `json:"Action,omitempty" name:"Action"`
-
- // 安全组规则描述。
- PolicyDescription *string `json:"PolicyDescription,omitempty" name:"PolicyDescription"`
-}
-
-type SecurityGroupPolicySet struct {
-
- // 安全组规则当前版本。用户每次更新安全规则版本会自动加1,防止更新的路由规则已过期,不填不考虑冲突。
- Version *string `json:"Version,omitempty" name:"Version"`
-
- // 出站规则。
- Egress []*SecurityGroupPolicy `json:"Egress,omitempty" name:"Egress" list`
-
- // 入站规则。
- Ingress []*SecurityGroupPolicy `json:"Ingress,omitempty" name:"Ingress" list`
-}
-
-type SecurityPolicyDatabase struct {
-
- // 本端网段
- LocalCidrBlock *string `json:"LocalCidrBlock,omitempty" name:"LocalCidrBlock"`
-
- // 对端网段
- RemoteCidrBlock []*string `json:"RemoteCidrBlock,omitempty" name:"RemoteCidrBlock" list`
-}
-
-type ServiceTemplate struct {
-
- // 协议端口实例ID,例如:ppm-f5n1f8da。
- ServiceTemplateId *string `json:"ServiceTemplateId,omitempty" name:"ServiceTemplateId"`
-
- // 模板名称。
- ServiceTemplateName *string `json:"ServiceTemplateName,omitempty" name:"ServiceTemplateName"`
-
- // 协议端口信息。
- ServiceSet []*string `json:"ServiceSet,omitempty" name:"ServiceSet" list`
-
- // 创建时间。
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-}
-
-type ServiceTemplateGroup struct {
-
- // 协议端口模板集合实例ID,例如:ppmg-2klmrefu。
- ServiceTemplateGroupId *string `json:"ServiceTemplateGroupId,omitempty" name:"ServiceTemplateGroupId"`
-
- // 协议端口模板集合名称。
- ServiceTemplateGroupName *string `json:"ServiceTemplateGroupName,omitempty" name:"ServiceTemplateGroupName"`
-
- // 协议端口模板实例ID。
- ServiceTemplateIdSet []*string `json:"ServiceTemplateIdSet,omitempty" name:"ServiceTemplateIdSet" list`
-
- // 创建时间。
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-}
-
-type ServiceTemplateSpecification struct {
-
- // 协议端口ID,例如:ppm-f5n1f8da。
- ServiceId *string `json:"ServiceId,omitempty" name:"ServiceId"`
-
- // 协议端口组ID,例如:ppmg-f5n1f8da。
- ServiceGroupId *string `json:"ServiceGroupId,omitempty" name:"ServiceGroupId"`
-}
-
-type SetCcnRegionBandwidthLimitsRequest struct {
- *tchttp.BaseRequest
-
- // CCN实例ID。形如:ccn-f49l6u0z。
- CcnId *string `json:"CcnId,omitempty" name:"CcnId"`
-
- // 云联网(CCN)各地域出带宽上限。
- CcnRegionBandwidthLimits []*CcnRegionBandwidthLimit `json:"CcnRegionBandwidthLimits,omitempty" name:"CcnRegionBandwidthLimits" list`
-}
-
-func (r *SetCcnRegionBandwidthLimitsRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *SetCcnRegionBandwidthLimitsRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type SetCcnRegionBandwidthLimitsResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *SetCcnRegionBandwidthLimitsResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *SetCcnRegionBandwidthLimitsResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type Subnet struct {
-
- // `VPC`实例`ID`。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 子网实例`ID`,例如:subnet-bthucmmy。
- SubnetId *string `json:"SubnetId,omitempty" name:"SubnetId"`
-
- // 子网名称。
- SubnetName *string `json:"SubnetName,omitempty" name:"SubnetName"`
-
- // 子网的 `IPv4` `CIDR`。
- CidrBlock *string `json:"CidrBlock,omitempty" name:"CidrBlock"`
-
- // 是否默认子网。
- IsDefault *bool `json:"IsDefault,omitempty" name:"IsDefault"`
-
- // 是否开启广播。
- EnableBroadcast *bool `json:"EnableBroadcast,omitempty" name:"EnableBroadcast"`
-
- // 可用区。
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-
- // 路由表实例ID,例如:rtb-l2h8d7c2。
- RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"`
-
- // 创建时间。
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-
- // 可用`IP`数。
- AvailableIpAddressCount *uint64 `json:"AvailableIpAddressCount,omitempty" name:"AvailableIpAddressCount"`
-
- // 子网的 `IPv6` `CIDR`。
- Ipv6CidrBlock *string `json:"Ipv6CidrBlock,omitempty" name:"Ipv6CidrBlock"`
-
- // 关联`ACL`ID
- NetworkAclId *string `json:"NetworkAclId,omitempty" name:"NetworkAclId"`
-
- // 是否为 `SNAT` 地址池子网。
- IsRemoteVpcSnat *bool `json:"IsRemoteVpcSnat,omitempty" name:"IsRemoteVpcSnat"`
-}
-
-type SubnetInput struct {
-
- // 子网的`CIDR`。
- CidrBlock *string `json:"CidrBlock,omitempty" name:"CidrBlock"`
-
- // 子网名称。
- SubnetName *string `json:"SubnetName,omitempty" name:"SubnetName"`
-
- // 可用区。形如:`ap-guangzhou-2`。
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-
- // 指定关联路由表,形如:`rtb-3ryrwzuu`。
- RouteTableId *string `json:"RouteTableId,omitempty" name:"RouteTableId"`
-}
-
-type Tag struct {
-
- // 标签键
- // 注意:此字段可能返回 null,表示取不到有效值。
- Key *string `json:"Key,omitempty" name:"Key"`
-
- // 标签值
- // 注意:此字段可能返回 null,表示取不到有效值。
- Value *string `json:"Value,omitempty" name:"Value"`
-}
-
-type TransformAddressRequest struct {
- *tchttp.BaseRequest
-
- // 待操作有普通公网 IP 的实例 ID。实例 ID 形如:`ins-11112222`。可通过登录[控制台](https://console.cloud.tencent.com/cvm)查询,也可通过 [DescribeInstances](https://cloud.tencent.com/document/api/213/9389) 接口返回值中的`InstanceId`获取。
- InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"`
-}
-
-func (r *TransformAddressRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *TransformAddressRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type TransformAddressResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *TransformAddressResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *TransformAddressResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type UnassignIpv6AddressesRequest struct {
- *tchttp.BaseRequest
-
- // 弹性网卡实例`ID`,形如:`eni-m6dyj72l`。
- NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"`
-
- // 指定的`IPv6`地址列表,单次最多指定10个。
- Ipv6Addresses []*Ipv6Address `json:"Ipv6Addresses,omitempty" name:"Ipv6Addresses" list`
-}
-
-func (r *UnassignIpv6AddressesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *UnassignIpv6AddressesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type UnassignIpv6AddressesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *UnassignIpv6AddressesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *UnassignIpv6AddressesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type UnassignIpv6CidrBlockRequest struct {
- *tchttp.BaseRequest
-
- // `VPC`实例`ID`,形如:`vpc-f49l6u0z`。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // `IPv6`网段。形如:`3402:4e00:20:1000::/56`
- Ipv6CidrBlock *string `json:"Ipv6CidrBlock,omitempty" name:"Ipv6CidrBlock"`
-}
-
-func (r *UnassignIpv6CidrBlockRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *UnassignIpv6CidrBlockRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type UnassignIpv6CidrBlockResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *UnassignIpv6CidrBlockResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *UnassignIpv6CidrBlockResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type UnassignIpv6SubnetCidrBlockRequest struct {
- *tchttp.BaseRequest
-
- // 子网所在私有网络`ID`。形如:`vpc-f49l6u0z`。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // `IPv6` 子网段列表。
- Ipv6SubnetCidrBlocks []*Ipv6SubnetCidrBlock `json:"Ipv6SubnetCidrBlocks,omitempty" name:"Ipv6SubnetCidrBlocks" list`
-}
-
-func (r *UnassignIpv6SubnetCidrBlockRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *UnassignIpv6SubnetCidrBlockRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type UnassignIpv6SubnetCidrBlockResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *UnassignIpv6SubnetCidrBlockResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *UnassignIpv6SubnetCidrBlockResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type UnassignPrivateIpAddressesRequest struct {
- *tchttp.BaseRequest
-
- // 弹性网卡实例ID,例如:eni-m6dyj72l。
- NetworkInterfaceId *string `json:"NetworkInterfaceId,omitempty" name:"NetworkInterfaceId"`
-
- // 指定的内网IP信息,单次最多指定10个。
- PrivateIpAddresses []*PrivateIpAddressSpecification `json:"PrivateIpAddresses,omitempty" name:"PrivateIpAddresses" list`
-}
-
-func (r *UnassignPrivateIpAddressesRequest) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *UnassignPrivateIpAddressesRequest) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type UnassignPrivateIpAddressesResponse struct {
- *tchttp.BaseResponse
- Response *struct {
-
- // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
- RequestId *string `json:"RequestId,omitempty" name:"RequestId"`
- } `json:"Response"`
-}
-
-func (r *UnassignPrivateIpAddressesResponse) ToJsonString() string {
- b, _ := json.Marshal(r)
- return string(b)
-}
-
-func (r *UnassignPrivateIpAddressesResponse) FromJsonString(s string) error {
- return json.Unmarshal([]byte(s), &r)
-}
-
-type Vpc struct {
-
- // `VPC`名称。
- VpcName *string `json:"VpcName,omitempty" name:"VpcName"`
-
- // `VPC`实例`ID`,例如:vpc-azd4dt1c。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // `VPC`的`IPv4` `CIDR`。
- CidrBlock *string `json:"CidrBlock,omitempty" name:"CidrBlock"`
-
- // 是否默认`VPC`。
- IsDefault *bool `json:"IsDefault,omitempty" name:"IsDefault"`
-
- // 是否开启组播。
- EnableMulticast *bool `json:"EnableMulticast,omitempty" name:"EnableMulticast"`
-
- // 创建时间。
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-
- // `DNS`列表。
- DnsServerSet []*string `json:"DnsServerSet,omitempty" name:"DnsServerSet" list`
-
- // `DHCP`域名选项值。
- DomainName *string `json:"DomainName,omitempty" name:"DomainName"`
-
- // `DHCP`选项集`ID`。
- DhcpOptionsId *string `json:"DhcpOptionsId,omitempty" name:"DhcpOptionsId"`
-
- // 是否开启`DHCP`。
- EnableDhcp *bool `json:"EnableDhcp,omitempty" name:"EnableDhcp"`
-
- // `VPC`的`IPv6` `CIDR`。
- Ipv6CidrBlock *string `json:"Ipv6CidrBlock,omitempty" name:"Ipv6CidrBlock"`
-
- // 标签键值对
- TagSet []*Tag `json:"TagSet,omitempty" name:"TagSet" list`
-}
-
-type VpcIpv6Address struct {
-
- // `VPC`内`IPv6`地址。
- Ipv6Address *string `json:"Ipv6Address,omitempty" name:"Ipv6Address"`
-
- // 所属子网 `IPv6` `CIDR`。
- CidrBlock *string `json:"CidrBlock,omitempty" name:"CidrBlock"`
-
- // `IPv6`类型。
- Ipv6AddressType *string `json:"Ipv6AddressType,omitempty" name:"Ipv6AddressType"`
-
- // `IPv6`申请时间。
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-}
-
-type VpcPrivateIpAddress struct {
-
- // `VPC`内网`IP`。
- PrivateIpAddress *string `json:"PrivateIpAddress,omitempty" name:"PrivateIpAddress"`
-
- // 所属子网`CIDR`。
- CidrBlock *string `json:"CidrBlock,omitempty" name:"CidrBlock"`
-
- // 内网`IP`类型。
- PrivateIpAddressType *string `json:"PrivateIpAddressType,omitempty" name:"PrivateIpAddressType"`
-
- // `IP`申请时间。
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-}
-
-type VpnConnection struct {
-
- // 通道实例ID。
- VpnConnectionId *string `json:"VpnConnectionId,omitempty" name:"VpnConnectionId"`
-
- // 通道名称。
- VpnConnectionName *string `json:"VpnConnectionName,omitempty" name:"VpnConnectionName"`
-
- // VPC实例ID。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // VPN网关实例ID。
- VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"`
-
- // 对端网关实例ID。
- CustomerGatewayId *string `json:"CustomerGatewayId,omitempty" name:"CustomerGatewayId"`
-
- // 预共享密钥。
- PreShareKey *string `json:"PreShareKey,omitempty" name:"PreShareKey"`
-
- // 通道传输协议。
- VpnProto *string `json:"VpnProto,omitempty" name:"VpnProto"`
-
- // 通道加密协议。
- EncryptProto *string `json:"EncryptProto,omitempty" name:"EncryptProto"`
-
- // 路由类型。
- RouteType *string `json:"RouteType,omitempty" name:"RouteType"`
-
- // 创建时间。
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-
- // 通道的生产状态,PENDING:生产中,AVAILABLE:运行中,DELETING:删除中。
- State *string `json:"State,omitempty" name:"State"`
-
- // 通道连接状态,AVAILABLE:已连接。
- NetStatus *string `json:"NetStatus,omitempty" name:"NetStatus"`
-
- // SPD。
- SecurityPolicyDatabaseSet []*SecurityPolicyDatabase `json:"SecurityPolicyDatabaseSet,omitempty" name:"SecurityPolicyDatabaseSet" list`
-
- // IKE选项。
- IKEOptionsSpecification *IKEOptionsSpecification `json:"IKEOptionsSpecification,omitempty" name:"IKEOptionsSpecification"`
-
- // IPSEC选择。
- IPSECOptionsSpecification *IPSECOptionsSpecification `json:"IPSECOptionsSpecification,omitempty" name:"IPSECOptionsSpecification"`
-}
-
-type VpnGateway struct {
-
- // 网关实例ID。
- VpnGatewayId *string `json:"VpnGatewayId,omitempty" name:"VpnGatewayId"`
-
- // VPC实例ID。
- VpcId *string `json:"VpcId,omitempty" name:"VpcId"`
-
- // 网关实例名称。
- VpnGatewayName *string `json:"VpnGatewayName,omitempty" name:"VpnGatewayName"`
-
- // 网关实例类型:'IPSEC', 'SSL'。
- Type *string `json:"Type,omitempty" name:"Type"`
-
- // 网关实例状态, 'PENDING':生产中,'DELETING':删除中,'AVAILABLE':运行中。
- State *string `json:"State,omitempty" name:"State"`
-
- // 网关公网IP。
- PublicIpAddress *string `json:"PublicIpAddress,omitempty" name:"PublicIpAddress"`
-
- // 网关续费类型:'NOTIFY_AND_MANUAL_RENEW':手动续费,'NOTIFY_AND_AUTO_RENEW':自动续费,'NOT_NOTIFY_AND_NOT_RENEW':到期不续费。
- RenewFlag *string `json:"RenewFlag,omitempty" name:"RenewFlag"`
-
- // 网关付费类型:POSTPAID_BY_HOUR:按小时后付费,PREPAID:包年包月预付费,
- InstanceChargeType *string `json:"InstanceChargeType,omitempty" name:"InstanceChargeType"`
-
- // 网关出带宽。
- InternetMaxBandwidthOut *uint64 `json:"InternetMaxBandwidthOut,omitempty" name:"InternetMaxBandwidthOut"`
-
- // 创建时间。
- CreatedTime *string `json:"CreatedTime,omitempty" name:"CreatedTime"`
-
- // 预付费网关过期时间。
- ExpiredTime *string `json:"ExpiredTime,omitempty" name:"ExpiredTime"`
-
- // 公网IP是否被封堵。
- IsAddressBlocked *bool `json:"IsAddressBlocked,omitempty" name:"IsAddressBlocked"`
-
- // 计费模式变更,PREPAID_TO_POSTPAID:包年包月预付费到期转按小时后付费。
- NewPurchasePlan *string `json:"NewPurchasePlan,omitempty" name:"NewPurchasePlan"`
-
- // 网关计费装,PROTECTIVELY_ISOLATED:被安全隔离的实例,NORMAL:正常。
- RestrictState *string `json:"RestrictState,omitempty" name:"RestrictState"`
-
- // 可用区,如:ap-guangzhou-2
- Zone *string `json:"Zone,omitempty" name:"Zone"`
-}
diff --git a/vendor/github.com/yangwenmai/ratelimit/LICENSE b/vendor/github.com/yangwenmai/ratelimit/LICENSE
deleted file mode 100644
index 9fc664e..0000000
--- a/vendor/github.com/yangwenmai/ratelimit/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2017 maiyang
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/github.com/yangwenmai/ratelimit/simpleratelimit/ratelimit.go b/vendor/github.com/yangwenmai/ratelimit/simpleratelimit/ratelimit.go
deleted file mode 100644
index f214c60..0000000
--- a/vendor/github.com/yangwenmai/ratelimit/simpleratelimit/ratelimit.go
+++ /dev/null
@@ -1,78 +0,0 @@
-package simpleratelimit
-
-import (
- "sync/atomic"
- "time"
-)
-
-// RateLimiter 限速器
-type RateLimiter struct {
- rate uint64
- allowance uint64
- max uint64
- unit uint64
- lastCheck uint64
-}
-
-// New 创建RateLimiter实例
-func New(rate int, per time.Duration) *RateLimiter {
- nano := uint64(per)
- if nano < 1 {
- nano = uint64(time.Second)
- }
- if rate < 1 {
- rate = 1
- }
-
- return &RateLimiter{
- rate: uint64(rate),
- allowance: uint64(rate) * nano,
- max: uint64(rate) * nano,
- unit: nano,
-
- lastCheck: unixNano(),
- }
-}
-
-// Limit 判断是否超过限制
-func (rl *RateLimiter) Limit() bool {
- now := unixNano()
- // 计算上一次调用到现在过了多少纳秒
- passed := now - atomic.SwapUint64(&rl.lastCheck, now)
-
- rate := atomic.LoadUint64(&rl.rate)
- current := atomic.AddUint64(&rl.allowance, passed*rate)
-
- if max := atomic.LoadUint64(&rl.max); current > max {
- atomic.AddUint64(&rl.allowance, max-current)
- current = max
- }
-
- if current < rl.unit {
- return true
- }
-
- // 没有超过限额
- atomic.AddUint64(&rl.allowance, -rl.unit)
- return false
-}
-
-// UpdateRate 更新速率值
-func (rl *RateLimiter) UpdateRate(rate int) {
- atomic.StoreUint64(&rl.rate, uint64(rate))
- atomic.StoreUint64(&rl.max, uint64(rate)*rl.unit)
-}
-
-// Undo 重置上一次调用Limit(),返回没有使用过的限额
-func (rl *RateLimiter) Undo() {
- current := atomic.AddUint64(&rl.allowance, rl.unit)
-
- if max := atomic.LoadUint64(&rl.max); current > max {
- atomic.AddUint64(&rl.allowance, max-current)
- }
-}
-
-// unixNano 当前时间(纳秒)
-func unixNano() uint64 {
- return uint64(time.Now().UnixNano())
-}
diff --git a/vendor/golang.org/x/sys/AUTHORS b/vendor/golang.org/x/sys/AUTHORS
deleted file mode 100644
index 15167cd..0000000
--- a/vendor/golang.org/x/sys/AUTHORS
+++ /dev/null
@@ -1,3 +0,0 @@
-# This source code refers to The Go Authors for copyright purposes.
-# The master list of authors is in the main Go distribution,
-# visible at http://tip.golang.org/AUTHORS.
diff --git a/vendor/golang.org/x/sys/CONTRIBUTORS b/vendor/golang.org/x/sys/CONTRIBUTORS
deleted file mode 100644
index 1c4577e..0000000
--- a/vendor/golang.org/x/sys/CONTRIBUTORS
+++ /dev/null
@@ -1,3 +0,0 @@
-# This source code was written by the Go contributors.
-# The master list of contributors is in the main Go distribution,
-# visible at http://tip.golang.org/CONTRIBUTORS.
diff --git a/vendor/golang.org/x/sys/LICENSE b/vendor/golang.org/x/sys/LICENSE
deleted file mode 100644
index 6a66aea..0000000
--- a/vendor/golang.org/x/sys/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2009 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/golang.org/x/sys/PATENTS b/vendor/golang.org/x/sys/PATENTS
deleted file mode 100644
index 7330990..0000000
--- a/vendor/golang.org/x/sys/PATENTS
+++ /dev/null
@@ -1,22 +0,0 @@
-Additional IP Rights Grant (Patents)
-
-"This implementation" means the copyrightable works distributed by
-Google as part of the Go project.
-
-Google hereby grants to You a perpetual, worldwide, non-exclusive,
-no-charge, royalty-free, irrevocable (except as stated in this section)
-patent license to make, have made, use, offer to sell, sell, import,
-transfer and otherwise run, modify and propagate the contents of this
-implementation of Go, where such license applies only to those patent
-claims, both currently owned or controlled by Google and acquired in
-the future, licensable by Google that are necessarily infringed by this
-implementation of Go. This grant does not include claims that would be
-infringed only as a consequence of further modification of this
-implementation. If you or your agent or exclusive licensee institute or
-order or agree to the institution of patent litigation against any
-entity (including a cross-claim or counterclaim in a lawsuit) alleging
-that this implementation of Go or any code incorporated within this
-implementation of Go constitutes direct or contributory patent
-infringement, or inducement of patent infringement, then any patent
-rights granted to you under this License for this implementation of Go
-shall terminate as of the date such litigation is filed.
diff --git a/vendor/golang.org/x/sys/unix/.gitignore b/vendor/golang.org/x/sys/unix/.gitignore
deleted file mode 100644
index e3e0fc6..0000000
--- a/vendor/golang.org/x/sys/unix/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-_obj/
-unix.test
diff --git a/vendor/golang.org/x/sys/unix/README.md b/vendor/golang.org/x/sys/unix/README.md
deleted file mode 100644
index eb2f78a..0000000
--- a/vendor/golang.org/x/sys/unix/README.md
+++ /dev/null
@@ -1,173 +0,0 @@
-# Building `sys/unix`
-
-The sys/unix package provides access to the raw system call interface of the
-underlying operating system. See: https://godoc.org/golang.org/x/sys/unix
-
-Porting Go to a new architecture/OS combination or adding syscalls, types, or
-constants to an existing architecture/OS pair requires some manual effort;
-however, there are tools that automate much of the process.
-
-## Build Systems
-
-There are currently two ways we generate the necessary files. We are currently
-migrating the build system to use containers so the builds are reproducible.
-This is being done on an OS-by-OS basis. Please update this documentation as
-components of the build system change.
-
-### Old Build System (currently for `GOOS != "linux"`)
-
-The old build system generates the Go files based on the C header files
-present on your system. This means that files
-for a given GOOS/GOARCH pair must be generated on a system with that OS and
-architecture. This also means that the generated code can differ from system
-to system, based on differences in the header files.
-
-To avoid this, if you are using the old build system, only generate the Go
-files on an installation with unmodified header files. It is also important to
-keep track of which version of the OS the files were generated from (ex.
-Darwin 14 vs Darwin 15). This makes it easier to track the progress of changes
-and have each OS upgrade correspond to a single change.
-
-To build the files for your current OS and architecture, make sure GOOS and
-GOARCH are set correctly and run `mkall.sh`. This will generate the files for
-your specific system. Running `mkall.sh -n` shows the commands that will be run.
-
-Requirements: bash, go
-
-### New Build System (currently for `GOOS == "linux"`)
-
-The new build system uses a Docker container to generate the go files directly
-from source checkouts of the kernel and various system libraries. This means
-that on any platform that supports Docker, all the files using the new build
-system can be generated at once, and generated files will not change based on
-what the person running the scripts has installed on their computer.
-
-The OS specific files for the new build system are located in the `${GOOS}`
-directory, and the build is coordinated by the `${GOOS}/mkall.go` program. When
-the kernel or system library updates, modify the Dockerfile at
-`${GOOS}/Dockerfile` to checkout the new release of the source.
-
-To build all the files under the new build system, you must be on an amd64/Linux
-system and have your GOOS and GOARCH set accordingly. Running `mkall.sh` will
-then generate all of the files for all of the GOOS/GOARCH pairs in the new build
-system. Running `mkall.sh -n` shows the commands that will be run.
-
-Requirements: bash, go, docker
-
-## Component files
-
-This section describes the various files used in the code generation process.
-It also contains instructions on how to modify these files to add a new
-architecture/OS or to add additional syscalls, types, or constants. Note that
-if you are using the new build system, the scripts/programs cannot be called normally.
-They must be called from within the docker container.
-
-### asm files
-
-The hand-written assembly file at `asm_${GOOS}_${GOARCH}.s` implements system
-call dispatch. There are three entry points:
-```
- func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
- func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
- func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
-```
-The first and second are the standard ones; they differ only in how many
-arguments can be passed to the kernel. The third is for low-level use by the
-ForkExec wrapper. Unlike the first two, it does not call into the scheduler to
-let it know that a system call is running.
-
-When porting Go to an new architecture/OS, this file must be implemented for
-each GOOS/GOARCH pair.
-
-### mksysnum
-
-Mksysnum is a Go program located at `${GOOS}/mksysnum.go` (or `mksysnum_${GOOS}.go`
-for the old system). This program takes in a list of header files containing the
-syscall number declarations and parses them to produce the corresponding list of
-Go numeric constants. See `zsysnum_${GOOS}_${GOARCH}.go` for the generated
-constants.
-
-Adding new syscall numbers is mostly done by running the build on a sufficiently
-new installation of the target OS (or updating the source checkouts for the
-new build system). However, depending on the OS, you make need to update the
-parsing in mksysnum.
-
-### mksyscall.go
-
-The `syscall.go`, `syscall_${GOOS}.go`, `syscall_${GOOS}_${GOARCH}.go` are
-hand-written Go files which implement system calls (for unix, the specific OS,
-or the specific OS/Architecture pair respectively) that need special handling
-and list `//sys` comments giving prototypes for ones that can be generated.
-
-The mksyscall.go program takes the `//sys` and `//sysnb` comments and converts
-them into syscalls. This requires the name of the prototype in the comment to
-match a syscall number in the `zsysnum_${GOOS}_${GOARCH}.go` file. The function
-prototype can be exported (capitalized) or not.
-
-Adding a new syscall often just requires adding a new `//sys` function prototype
-with the desired arguments and a capitalized name so it is exported. However, if
-you want the interface to the syscall to be different, often one will make an
-unexported `//sys` prototype, an then write a custom wrapper in
-`syscall_${GOOS}.go`.
-
-### types files
-
-For each OS, there is a hand-written Go file at `${GOOS}/types.go` (or
-`types_${GOOS}.go` on the old system). This file includes standard C headers and
-creates Go type aliases to the corresponding C types. The file is then fed
-through godef to get the Go compatible definitions. Finally, the generated code
-is fed though mkpost.go to format the code correctly and remove any hidden or
-private identifiers. This cleaned-up code is written to
-`ztypes_${GOOS}_${GOARCH}.go`.
-
-The hardest part about preparing this file is figuring out which headers to
-include and which symbols need to be `#define`d to get the actual data
-structures that pass through to the kernel system calls. Some C libraries
-preset alternate versions for binary compatibility and translate them on the
-way in and out of system calls, but there is almost always a `#define` that can
-get the real ones.
-See `types_darwin.go` and `linux/types.go` for examples.
-
-To add a new type, add in the necessary include statement at the top of the
-file (if it is not already there) and add in a type alias line. Note that if
-your type is significantly different on different architectures, you may need
-some `#if/#elif` macros in your include statements.
-
-### mkerrors.sh
-
-This script is used to generate the system's various constants. This doesn't
-just include the error numbers and error strings, but also the signal numbers
-an a wide variety of miscellaneous constants. The constants come from the list
-of include files in the `includes_${uname}` variable. A regex then picks out
-the desired `#define` statements, and generates the corresponding Go constants.
-The error numbers and strings are generated from `#include `, and the
-signal numbers and strings are generated from `#include `. All of
-these constants are written to `zerrors_${GOOS}_${GOARCH}.go` via a C program,
-`_errors.c`, which prints out all the constants.
-
-To add a constant, add the header that includes it to the appropriate variable.
-Then, edit the regex (if necessary) to match the desired constant. Avoid making
-the regex too broad to avoid matching unintended constants.
-
-
-## Generated files
-
-### `zerror_${GOOS}_${GOARCH}.go`
-
-A file containing all of the system's generated error numbers, error strings,
-signal numbers, and constants. Generated by `mkerrors.sh` (see above).
-
-### `zsyscall_${GOOS}_${GOARCH}.go`
-
-A file containing all the generated syscalls for a specific GOOS and GOARCH.
-Generated by `mksyscall.go` (see above).
-
-### `zsysnum_${GOOS}_${GOARCH}.go`
-
-A list of numeric constants for all the syscall number of the specific GOOS
-and GOARCH. Generated by mksysnum (see above).
-
-### `ztypes_${GOOS}_${GOARCH}.go`
-
-A file containing Go types for passing into (or returning from) syscalls.
-Generated by godefs and the types file (see above).
diff --git a/vendor/golang.org/x/sys/unix/affinity_linux.go b/vendor/golang.org/x/sys/unix/affinity_linux.go
deleted file mode 100644
index 6e5c81a..0000000
--- a/vendor/golang.org/x/sys/unix/affinity_linux.go
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// CPU affinity functions
-
-package unix
-
-import (
- "math/bits"
- "unsafe"
-)
-
-const cpuSetSize = _CPU_SETSIZE / _NCPUBITS
-
-// CPUSet represents a CPU affinity mask.
-type CPUSet [cpuSetSize]cpuMask
-
-func schedAffinity(trap uintptr, pid int, set *CPUSet) error {
- _, _, e := RawSyscall(trap, uintptr(pid), uintptr(unsafe.Sizeof(*set)), uintptr(unsafe.Pointer(set)))
- if e != 0 {
- return errnoErr(e)
- }
- return nil
-}
-
-// SchedGetaffinity gets the CPU affinity mask of the thread specified by pid.
-// If pid is 0 the calling thread is used.
-func SchedGetaffinity(pid int, set *CPUSet) error {
- return schedAffinity(SYS_SCHED_GETAFFINITY, pid, set)
-}
-
-// SchedSetaffinity sets the CPU affinity mask of the thread specified by pid.
-// If pid is 0 the calling thread is used.
-func SchedSetaffinity(pid int, set *CPUSet) error {
- return schedAffinity(SYS_SCHED_SETAFFINITY, pid, set)
-}
-
-// Zero clears the set s, so that it contains no CPUs.
-func (s *CPUSet) Zero() {
- for i := range s {
- s[i] = 0
- }
-}
-
-func cpuBitsIndex(cpu int) int {
- return cpu / _NCPUBITS
-}
-
-func cpuBitsMask(cpu int) cpuMask {
- return cpuMask(1 << (uint(cpu) % _NCPUBITS))
-}
-
-// Set adds cpu to the set s.
-func (s *CPUSet) Set(cpu int) {
- i := cpuBitsIndex(cpu)
- if i < len(s) {
- s[i] |= cpuBitsMask(cpu)
- }
-}
-
-// Clear removes cpu from the set s.
-func (s *CPUSet) Clear(cpu int) {
- i := cpuBitsIndex(cpu)
- if i < len(s) {
- s[i] &^= cpuBitsMask(cpu)
- }
-}
-
-// IsSet reports whether cpu is in the set s.
-func (s *CPUSet) IsSet(cpu int) bool {
- i := cpuBitsIndex(cpu)
- if i < len(s) {
- return s[i]&cpuBitsMask(cpu) != 0
- }
- return false
-}
-
-// Count returns the number of CPUs in the set s.
-func (s *CPUSet) Count() int {
- c := 0
- for _, b := range s {
- c += bits.OnesCount64(uint64(b))
- }
- return c
-}
diff --git a/vendor/golang.org/x/sys/unix/aliases.go b/vendor/golang.org/x/sys/unix/aliases.go
deleted file mode 100644
index 951fce4..0000000
--- a/vendor/golang.org/x/sys/unix/aliases.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
-// +build go1.9
-
-package unix
-
-import "syscall"
-
-type Signal = syscall.Signal
-type Errno = syscall.Errno
-type SysProcAttr = syscall.SysProcAttr
diff --git a/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s b/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s
deleted file mode 100644
index 06f84b8..0000000
--- a/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for ppc64, AIX are implemented in runtime/syscall_aix.go
-//
-
-TEXT ·syscall6(SB),NOSPLIT,$0-88
- JMP syscall·syscall6(SB)
-
-TEXT ·rawSyscall6(SB),NOSPLIT,$0-88
- JMP syscall·rawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_386.s b/vendor/golang.org/x/sys/unix/asm_darwin_386.s
deleted file mode 100644
index 8a72783..0000000
--- a/vendor/golang.org/x/sys/unix/asm_darwin_386.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for 386, Darwin
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s b/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s
deleted file mode 100644
index 6321421..0000000
--- a/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, Darwin
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_arm.s b/vendor/golang.org/x/sys/unix/asm_darwin_arm.s
deleted file mode 100644
index 333242d..0000000
--- a/vendor/golang.org/x/sys/unix/asm_darwin_arm.s
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-// +build arm,darwin
-
-#include "textflag.h"
-
-//
-// System call support for ARM, Darwin
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- B syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- B syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- B syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s b/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s
deleted file mode 100644
index 97e0174..0000000
--- a/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-// +build arm64,darwin
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, Darwin
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- B syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- B syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- B syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s b/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s
deleted file mode 100644
index 603dd57..0000000
--- a/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, DragonFly
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_freebsd_386.s b/vendor/golang.org/x/sys/unix/asm_freebsd_386.s
deleted file mode 100644
index c9a0a26..0000000
--- a/vendor/golang.org/x/sys/unix/asm_freebsd_386.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for 386, FreeBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s
deleted file mode 100644
index 3517247..0000000
--- a/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, FreeBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s b/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s
deleted file mode 100644
index 9227c87..0000000
--- a/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for ARM, FreeBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- B syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- B syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- B syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s b/vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s
deleted file mode 100644
index d9318cb..0000000
--- a/vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for ARM64, FreeBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_386.s b/vendor/golang.org/x/sys/unix/asm_linux_386.s
deleted file mode 100644
index 448bebb..0000000
--- a/vendor/golang.org/x/sys/unix/asm_linux_386.s
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for 386, Linux
-//
-
-// See ../runtime/sys_linux_386.s for the reason why we always use int 0x80
-// instead of the glibc-specific "CALL 0x10(GS)".
-#define INVOKE_SYSCALL INT $0x80
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- JMP syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-24
- CALL runtime·entersyscall(SB)
- MOVL trap+0(FP), AX // syscall entry
- MOVL a1+4(FP), BX
- MOVL a2+8(FP), CX
- MOVL a3+12(FP), DX
- MOVL $0, SI
- MOVL $0, DI
- INVOKE_SYSCALL
- MOVL AX, r1+16(FP)
- MOVL DX, r2+20(FP)
- CALL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24
- MOVL trap+0(FP), AX // syscall entry
- MOVL a1+4(FP), BX
- MOVL a2+8(FP), CX
- MOVL a3+12(FP), DX
- MOVL $0, SI
- MOVL $0, DI
- INVOKE_SYSCALL
- MOVL AX, r1+16(FP)
- MOVL DX, r2+20(FP)
- RET
-
-TEXT ·socketcall(SB),NOSPLIT,$0-36
- JMP syscall·socketcall(SB)
-
-TEXT ·rawsocketcall(SB),NOSPLIT,$0-36
- JMP syscall·rawsocketcall(SB)
-
-TEXT ·seek(SB),NOSPLIT,$0-28
- JMP syscall·seek(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_amd64.s b/vendor/golang.org/x/sys/unix/asm_linux_amd64.s
deleted file mode 100644
index c6468a9..0000000
--- a/vendor/golang.org/x/sys/unix/asm_linux_amd64.s
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for AMD64, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
- CALL runtime·entersyscall(SB)
- MOVQ a1+8(FP), DI
- MOVQ a2+16(FP), SI
- MOVQ a3+24(FP), DX
- MOVQ $0, R10
- MOVQ $0, R8
- MOVQ $0, R9
- MOVQ trap+0(FP), AX // syscall entry
- SYSCALL
- MOVQ AX, r1+32(FP)
- MOVQ DX, r2+40(FP)
- CALL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
- MOVQ a1+8(FP), DI
- MOVQ a2+16(FP), SI
- MOVQ a3+24(FP), DX
- MOVQ $0, R10
- MOVQ $0, R8
- MOVQ $0, R9
- MOVQ trap+0(FP), AX // syscall entry
- SYSCALL
- MOVQ AX, r1+32(FP)
- MOVQ DX, r2+40(FP)
- RET
-
-TEXT ·gettimeofday(SB),NOSPLIT,$0-16
- JMP syscall·gettimeofday(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_arm.s b/vendor/golang.org/x/sys/unix/asm_linux_arm.s
deleted file mode 100644
index cf0f357..0000000
--- a/vendor/golang.org/x/sys/unix/asm_linux_arm.s
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for arm, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- B syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-24
- BL runtime·entersyscall(SB)
- MOVW trap+0(FP), R7
- MOVW a1+4(FP), R0
- MOVW a2+8(FP), R1
- MOVW a3+12(FP), R2
- MOVW $0, R3
- MOVW $0, R4
- MOVW $0, R5
- SWI $0
- MOVW R0, r1+16(FP)
- MOVW $0, R0
- MOVW R0, r2+20(FP)
- BL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- B syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24
- MOVW trap+0(FP), R7 // syscall entry
- MOVW a1+4(FP), R0
- MOVW a2+8(FP), R1
- MOVW a3+12(FP), R2
- SWI $0
- MOVW R0, r1+16(FP)
- MOVW $0, R0
- MOVW R0, r2+20(FP)
- RET
-
-TEXT ·seek(SB),NOSPLIT,$0-28
- B syscall·seek(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_arm64.s b/vendor/golang.org/x/sys/unix/asm_linux_arm64.s
deleted file mode 100644
index afe6fdf..0000000
--- a/vendor/golang.org/x/sys/unix/asm_linux_arm64.s
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build linux
-// +build arm64
-// +build !gccgo
-
-#include "textflag.h"
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- B syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
- BL runtime·entersyscall(SB)
- MOVD a1+8(FP), R0
- MOVD a2+16(FP), R1
- MOVD a3+24(FP), R2
- MOVD $0, R3
- MOVD $0, R4
- MOVD $0, R5
- MOVD trap+0(FP), R8 // syscall entry
- SVC
- MOVD R0, r1+32(FP) // r1
- MOVD R1, r2+40(FP) // r2
- BL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- B syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
- MOVD a1+8(FP), R0
- MOVD a2+16(FP), R1
- MOVD a3+24(FP), R2
- MOVD $0, R3
- MOVD $0, R4
- MOVD $0, R5
- MOVD trap+0(FP), R8 // syscall entry
- SVC
- MOVD R0, r1+32(FP)
- MOVD R1, r2+40(FP)
- RET
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s b/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s
deleted file mode 100644
index ab9d638..0000000
--- a/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build linux
-// +build mips64 mips64le
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for mips64, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
- JAL runtime·entersyscall(SB)
- MOVV a1+8(FP), R4
- MOVV a2+16(FP), R5
- MOVV a3+24(FP), R6
- MOVV R0, R7
- MOVV R0, R8
- MOVV R0, R9
- MOVV trap+0(FP), R2 // syscall entry
- SYSCALL
- MOVV R2, r1+32(FP)
- MOVV R3, r2+40(FP)
- JAL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
- MOVV a1+8(FP), R4
- MOVV a2+16(FP), R5
- MOVV a3+24(FP), R6
- MOVV R0, R7
- MOVV R0, R8
- MOVV R0, R9
- MOVV trap+0(FP), R2 // syscall entry
- SYSCALL
- MOVV R2, r1+32(FP)
- MOVV R3, r2+40(FP)
- RET
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s b/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s
deleted file mode 100644
index 99e5399..0000000
--- a/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build linux
-// +build mips mipsle
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for mips, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- JMP syscall·Syscall9(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-24
- JAL runtime·entersyscall(SB)
- MOVW a1+4(FP), R4
- MOVW a2+8(FP), R5
- MOVW a3+12(FP), R6
- MOVW R0, R7
- MOVW trap+0(FP), R2 // syscall entry
- SYSCALL
- MOVW R2, r1+16(FP) // r1
- MOVW R3, r2+20(FP) // r2
- JAL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24
- MOVW a1+4(FP), R4
- MOVW a2+8(FP), R5
- MOVW a3+12(FP), R6
- MOVW trap+0(FP), R2 // syscall entry
- SYSCALL
- MOVW R2, r1+16(FP)
- MOVW R3, r2+20(FP)
- RET
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s b/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
deleted file mode 100644
index 88f7125..0000000
--- a/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build linux
-// +build ppc64 ppc64le
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for ppc64, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
- BL runtime·entersyscall(SB)
- MOVD a1+8(FP), R3
- MOVD a2+16(FP), R4
- MOVD a3+24(FP), R5
- MOVD R0, R6
- MOVD R0, R7
- MOVD R0, R8
- MOVD trap+0(FP), R9 // syscall entry
- SYSCALL R9
- MOVD R3, r1+32(FP)
- MOVD R4, r2+40(FP)
- BL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
- MOVD a1+8(FP), R3
- MOVD a2+16(FP), R4
- MOVD a3+24(FP), R5
- MOVD R0, R6
- MOVD R0, R7
- MOVD R0, R8
- MOVD trap+0(FP), R9 // syscall entry
- SYSCALL R9
- MOVD R3, r1+32(FP)
- MOVD R4, r2+40(FP)
- RET
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s b/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s
deleted file mode 100644
index 3cfefed..0000000
--- a/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2019 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build riscv64,!gccgo
-
-#include "textflag.h"
-
-//
-// System calls for linux/riscv64.
-//
-// Where available, just jump to package syscall's implementation of
-// these functions.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
- CALL runtime·entersyscall(SB)
- MOV a1+8(FP), A0
- MOV a2+16(FP), A1
- MOV a3+24(FP), A2
- MOV trap+0(FP), A7 // syscall entry
- ECALL
- MOV A0, r1+32(FP) // r1
- MOV A1, r2+40(FP) // r2
- CALL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
- MOV a1+8(FP), A0
- MOV a2+16(FP), A1
- MOV a3+24(FP), A2
- MOV trap+0(FP), A7 // syscall entry
- ECALL
- MOV A0, r1+32(FP)
- MOV A1, r2+40(FP)
- RET
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_s390x.s b/vendor/golang.org/x/sys/unix/asm_linux_s390x.s
deleted file mode 100644
index a5a863c..0000000
--- a/vendor/golang.org/x/sys/unix/asm_linux_s390x.s
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build s390x
-// +build linux
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for s390x, Linux
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- BR syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- BR syscall·Syscall6(SB)
-
-TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
- BL runtime·entersyscall(SB)
- MOVD a1+8(FP), R2
- MOVD a2+16(FP), R3
- MOVD a3+24(FP), R4
- MOVD $0, R5
- MOVD $0, R6
- MOVD $0, R7
- MOVD trap+0(FP), R1 // syscall entry
- SYSCALL
- MOVD R2, r1+32(FP)
- MOVD R3, r2+40(FP)
- BL runtime·exitsyscall(SB)
- RET
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- BR syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- BR syscall·RawSyscall6(SB)
-
-TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
- MOVD a1+8(FP), R2
- MOVD a2+16(FP), R3
- MOVD a3+24(FP), R4
- MOVD $0, R5
- MOVD $0, R6
- MOVD $0, R7
- MOVD trap+0(FP), R1 // syscall entry
- SYSCALL
- MOVD R2, r1+32(FP)
- MOVD R3, r2+40(FP)
- RET
diff --git a/vendor/golang.org/x/sys/unix/asm_netbsd_386.s b/vendor/golang.org/x/sys/unix/asm_netbsd_386.s
deleted file mode 100644
index 48bdcd7..0000000
--- a/vendor/golang.org/x/sys/unix/asm_netbsd_386.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for 386, NetBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s
deleted file mode 100644
index 2ede05c..0000000
--- a/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, NetBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s b/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s
deleted file mode 100644
index e892857..0000000
--- a/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for ARM, NetBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- B syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- B syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- B syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s b/vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s
deleted file mode 100644
index 6f98ba5..0000000
--- a/vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2019 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for ARM64, NetBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- B syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- B syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- B syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_386.s b/vendor/golang.org/x/sys/unix/asm_openbsd_386.s
deleted file mode 100644
index 00576f3..0000000
--- a/vendor/golang.org/x/sys/unix/asm_openbsd_386.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for 386, OpenBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s
deleted file mode 100644
index 790ef77..0000000
--- a/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for AMD64, OpenBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_arm.s b/vendor/golang.org/x/sys/unix/asm_openbsd_arm.s
deleted file mode 100644
index 469bfa1..0000000
--- a/vendor/golang.org/x/sys/unix/asm_openbsd_arm.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for ARM, OpenBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-28
- B syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-40
- B syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-52
- B syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- B syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- B syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s b/vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s
deleted file mode 100644
index 0cedea3..0000000
--- a/vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2019 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System call support for arm64, OpenBSD
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-56
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-80
- JMP syscall·Syscall6(SB)
-
-TEXT ·Syscall9(SB),NOSPLIT,$0-104
- JMP syscall·Syscall9(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s b/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s
deleted file mode 100644
index ded8260..0000000
--- a/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !gccgo
-
-#include "textflag.h"
-
-//
-// System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go
-//
-
-TEXT ·sysvicall6(SB),NOSPLIT,$0-88
- JMP syscall·sysvicall6(SB)
-
-TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88
- JMP syscall·rawSysvicall6(SB)
diff --git a/vendor/golang.org/x/sys/unix/bluetooth_linux.go b/vendor/golang.org/x/sys/unix/bluetooth_linux.go
deleted file mode 100644
index a178a61..0000000
--- a/vendor/golang.org/x/sys/unix/bluetooth_linux.go
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Bluetooth sockets and messages
-
-package unix
-
-// Bluetooth Protocols
-const (
- BTPROTO_L2CAP = 0
- BTPROTO_HCI = 1
- BTPROTO_SCO = 2
- BTPROTO_RFCOMM = 3
- BTPROTO_BNEP = 4
- BTPROTO_CMTP = 5
- BTPROTO_HIDP = 6
- BTPROTO_AVDTP = 7
-)
-
-const (
- HCI_CHANNEL_RAW = 0
- HCI_CHANNEL_USER = 1
- HCI_CHANNEL_MONITOR = 2
- HCI_CHANNEL_CONTROL = 3
- HCI_CHANNEL_LOGGING = 4
-)
-
-// Socketoption Level
-const (
- SOL_BLUETOOTH = 0x112
- SOL_HCI = 0x0
- SOL_L2CAP = 0x6
- SOL_RFCOMM = 0x12
- SOL_SCO = 0x11
-)
diff --git a/vendor/golang.org/x/sys/unix/cap_freebsd.go b/vendor/golang.org/x/sys/unix/cap_freebsd.go
deleted file mode 100644
index df52048..0000000
--- a/vendor/golang.org/x/sys/unix/cap_freebsd.go
+++ /dev/null
@@ -1,195 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build freebsd
-
-package unix
-
-import (
- "errors"
- "fmt"
-)
-
-// Go implementation of C mostly found in /usr/src/sys/kern/subr_capability.c
-
-const (
- // This is the version of CapRights this package understands. See C implementation for parallels.
- capRightsGoVersion = CAP_RIGHTS_VERSION_00
- capArSizeMin = CAP_RIGHTS_VERSION_00 + 2
- capArSizeMax = capRightsGoVersion + 2
-)
-
-var (
- bit2idx = []int{
- -1, 0, 1, -1, 2, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1,
- 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- }
-)
-
-func capidxbit(right uint64) int {
- return int((right >> 57) & 0x1f)
-}
-
-func rightToIndex(right uint64) (int, error) {
- idx := capidxbit(right)
- if idx < 0 || idx >= len(bit2idx) {
- return -2, fmt.Errorf("index for right 0x%x out of range", right)
- }
- return bit2idx[idx], nil
-}
-
-func caprver(right uint64) int {
- return int(right >> 62)
-}
-
-func capver(rights *CapRights) int {
- return caprver(rights.Rights[0])
-}
-
-func caparsize(rights *CapRights) int {
- return capver(rights) + 2
-}
-
-// CapRightsSet sets the permissions in setrights in rights.
-func CapRightsSet(rights *CapRights, setrights []uint64) error {
- // This is essentially a copy of cap_rights_vset()
- if capver(rights) != CAP_RIGHTS_VERSION_00 {
- return fmt.Errorf("bad rights version %d", capver(rights))
- }
-
- n := caparsize(rights)
- if n < capArSizeMin || n > capArSizeMax {
- return errors.New("bad rights size")
- }
-
- for _, right := range setrights {
- if caprver(right) != CAP_RIGHTS_VERSION_00 {
- return errors.New("bad right version")
- }
- i, err := rightToIndex(right)
- if err != nil {
- return err
- }
- if i >= n {
- return errors.New("index overflow")
- }
- if capidxbit(rights.Rights[i]) != capidxbit(right) {
- return errors.New("index mismatch")
- }
- rights.Rights[i] |= right
- if capidxbit(rights.Rights[i]) != capidxbit(right) {
- return errors.New("index mismatch (after assign)")
- }
- }
-
- return nil
-}
-
-// CapRightsClear clears the permissions in clearrights from rights.
-func CapRightsClear(rights *CapRights, clearrights []uint64) error {
- // This is essentially a copy of cap_rights_vclear()
- if capver(rights) != CAP_RIGHTS_VERSION_00 {
- return fmt.Errorf("bad rights version %d", capver(rights))
- }
-
- n := caparsize(rights)
- if n < capArSizeMin || n > capArSizeMax {
- return errors.New("bad rights size")
- }
-
- for _, right := range clearrights {
- if caprver(right) != CAP_RIGHTS_VERSION_00 {
- return errors.New("bad right version")
- }
- i, err := rightToIndex(right)
- if err != nil {
- return err
- }
- if i >= n {
- return errors.New("index overflow")
- }
- if capidxbit(rights.Rights[i]) != capidxbit(right) {
- return errors.New("index mismatch")
- }
- rights.Rights[i] &= ^(right & 0x01FFFFFFFFFFFFFF)
- if capidxbit(rights.Rights[i]) != capidxbit(right) {
- return errors.New("index mismatch (after assign)")
- }
- }
-
- return nil
-}
-
-// CapRightsIsSet checks whether all the permissions in setrights are present in rights.
-func CapRightsIsSet(rights *CapRights, setrights []uint64) (bool, error) {
- // This is essentially a copy of cap_rights_is_vset()
- if capver(rights) != CAP_RIGHTS_VERSION_00 {
- return false, fmt.Errorf("bad rights version %d", capver(rights))
- }
-
- n := caparsize(rights)
- if n < capArSizeMin || n > capArSizeMax {
- return false, errors.New("bad rights size")
- }
-
- for _, right := range setrights {
- if caprver(right) != CAP_RIGHTS_VERSION_00 {
- return false, errors.New("bad right version")
- }
- i, err := rightToIndex(right)
- if err != nil {
- return false, err
- }
- if i >= n {
- return false, errors.New("index overflow")
- }
- if capidxbit(rights.Rights[i]) != capidxbit(right) {
- return false, errors.New("index mismatch")
- }
- if (rights.Rights[i] & right) != right {
- return false, nil
- }
- }
-
- return true, nil
-}
-
-func capright(idx uint64, bit uint64) uint64 {
- return ((1 << (57 + idx)) | bit)
-}
-
-// CapRightsInit returns a pointer to an initialised CapRights structure filled with rights.
-// See man cap_rights_init(3) and rights(4).
-func CapRightsInit(rights []uint64) (*CapRights, error) {
- var r CapRights
- r.Rights[0] = (capRightsGoVersion << 62) | capright(0, 0)
- r.Rights[1] = capright(1, 0)
-
- err := CapRightsSet(&r, rights)
- if err != nil {
- return nil, err
- }
- return &r, nil
-}
-
-// CapRightsLimit reduces the operations permitted on fd to at most those contained in rights.
-// The capability rights on fd can never be increased by CapRightsLimit.
-// See man cap_rights_limit(2) and rights(4).
-func CapRightsLimit(fd uintptr, rights *CapRights) error {
- return capRightsLimit(int(fd), rights)
-}
-
-// CapRightsGet returns a CapRights structure containing the operations permitted on fd.
-// See man cap_rights_get(3) and rights(4).
-func CapRightsGet(fd uintptr) (*CapRights, error) {
- r, err := CapRightsInit(nil)
- if err != nil {
- return nil, err
- }
- err = capRightsGet(capRightsGoVersion, int(fd), r)
- if err != nil {
- return nil, err
- }
- return r, nil
-}
diff --git a/vendor/golang.org/x/sys/unix/constants.go b/vendor/golang.org/x/sys/unix/constants.go
deleted file mode 100644
index 3a6ac64..0000000
--- a/vendor/golang.org/x/sys/unix/constants.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
-
-package unix
-
-const (
- R_OK = 0x4
- W_OK = 0x2
- X_OK = 0x1
-)
diff --git a/vendor/golang.org/x/sys/unix/dev_aix_ppc.go b/vendor/golang.org/x/sys/unix/dev_aix_ppc.go
deleted file mode 100644
index 5e5fb45..0000000
--- a/vendor/golang.org/x/sys/unix/dev_aix_ppc.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build aix
-// +build ppc
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used by AIX.
-
-package unix
-
-// Major returns the major component of a Linux device number.
-func Major(dev uint64) uint32 {
- return uint32((dev >> 16) & 0xffff)
-}
-
-// Minor returns the minor component of a Linux device number.
-func Minor(dev uint64) uint32 {
- return uint32(dev & 0xffff)
-}
-
-// Mkdev returns a Linux device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
- return uint64(((major) << 16) | (minor))
-}
diff --git a/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go b/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go
deleted file mode 100644
index 8b40124..0000000
--- a/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build aix
-// +build ppc64
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used AIX.
-
-package unix
-
-// Major returns the major component of a Linux device number.
-func Major(dev uint64) uint32 {
- return uint32((dev & 0x3fffffff00000000) >> 32)
-}
-
-// Minor returns the minor component of a Linux device number.
-func Minor(dev uint64) uint32 {
- return uint32((dev & 0x00000000ffffffff) >> 0)
-}
-
-// Mkdev returns a Linux device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
- var DEVNO64 uint64
- DEVNO64 = 0x8000000000000000
- return ((uint64(major) << 32) | (uint64(minor) & 0x00000000FFFFFFFF) | DEVNO64)
-}
diff --git a/vendor/golang.org/x/sys/unix/dev_darwin.go b/vendor/golang.org/x/sys/unix/dev_darwin.go
deleted file mode 100644
index 8d1dc0f..0000000
--- a/vendor/golang.org/x/sys/unix/dev_darwin.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used in Darwin's sys/types.h header.
-
-package unix
-
-// Major returns the major component of a Darwin device number.
-func Major(dev uint64) uint32 {
- return uint32((dev >> 24) & 0xff)
-}
-
-// Minor returns the minor component of a Darwin device number.
-func Minor(dev uint64) uint32 {
- return uint32(dev & 0xffffff)
-}
-
-// Mkdev returns a Darwin device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
- return (uint64(major) << 24) | uint64(minor)
-}
diff --git a/vendor/golang.org/x/sys/unix/dev_dragonfly.go b/vendor/golang.org/x/sys/unix/dev_dragonfly.go
deleted file mode 100644
index 8502f20..0000000
--- a/vendor/golang.org/x/sys/unix/dev_dragonfly.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used in Dragonfly's sys/types.h header.
-//
-// The information below is extracted and adapted from sys/types.h:
-//
-// Minor gives a cookie instead of an index since in order to avoid changing the
-// meanings of bits 0-15 or wasting time and space shifting bits 16-31 for
-// devices that don't use them.
-
-package unix
-
-// Major returns the major component of a DragonFlyBSD device number.
-func Major(dev uint64) uint32 {
- return uint32((dev >> 8) & 0xff)
-}
-
-// Minor returns the minor component of a DragonFlyBSD device number.
-func Minor(dev uint64) uint32 {
- return uint32(dev & 0xffff00ff)
-}
-
-// Mkdev returns a DragonFlyBSD device number generated from the given major and
-// minor components.
-func Mkdev(major, minor uint32) uint64 {
- return (uint64(major) << 8) | uint64(minor)
-}
diff --git a/vendor/golang.org/x/sys/unix/dev_freebsd.go b/vendor/golang.org/x/sys/unix/dev_freebsd.go
deleted file mode 100644
index eba3b4b..0000000
--- a/vendor/golang.org/x/sys/unix/dev_freebsd.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used in FreeBSD's sys/types.h header.
-//
-// The information below is extracted and adapted from sys/types.h:
-//
-// Minor gives a cookie instead of an index since in order to avoid changing the
-// meanings of bits 0-15 or wasting time and space shifting bits 16-31 for
-// devices that don't use them.
-
-package unix
-
-// Major returns the major component of a FreeBSD device number.
-func Major(dev uint64) uint32 {
- return uint32((dev >> 8) & 0xff)
-}
-
-// Minor returns the minor component of a FreeBSD device number.
-func Minor(dev uint64) uint32 {
- return uint32(dev & 0xffff00ff)
-}
-
-// Mkdev returns a FreeBSD device number generated from the given major and
-// minor components.
-func Mkdev(major, minor uint32) uint64 {
- return (uint64(major) << 8) | uint64(minor)
-}
diff --git a/vendor/golang.org/x/sys/unix/dev_linux.go b/vendor/golang.org/x/sys/unix/dev_linux.go
deleted file mode 100644
index d165d6f..0000000
--- a/vendor/golang.org/x/sys/unix/dev_linux.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used by the Linux kernel and glibc.
-//
-// The information below is extracted and adapted from bits/sysmacros.h in the
-// glibc sources:
-//
-// dev_t in glibc is 64-bit, with 32-bit major and minor numbers. glibc's
-// default encoding is MMMM Mmmm mmmM MMmm, where M is a hex digit of the major
-// number and m is a hex digit of the minor number. This is backward compatible
-// with legacy systems where dev_t is 16 bits wide, encoded as MMmm. It is also
-// backward compatible with the Linux kernel, which for some architectures uses
-// 32-bit dev_t, encoded as mmmM MMmm.
-
-package unix
-
-// Major returns the major component of a Linux device number.
-func Major(dev uint64) uint32 {
- major := uint32((dev & 0x00000000000fff00) >> 8)
- major |= uint32((dev & 0xfffff00000000000) >> 32)
- return major
-}
-
-// Minor returns the minor component of a Linux device number.
-func Minor(dev uint64) uint32 {
- minor := uint32((dev & 0x00000000000000ff) >> 0)
- minor |= uint32((dev & 0x00000ffffff00000) >> 12)
- return minor
-}
-
-// Mkdev returns a Linux device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
- dev := (uint64(major) & 0x00000fff) << 8
- dev |= (uint64(major) & 0xfffff000) << 32
- dev |= (uint64(minor) & 0x000000ff) << 0
- dev |= (uint64(minor) & 0xffffff00) << 12
- return dev
-}
diff --git a/vendor/golang.org/x/sys/unix/dev_netbsd.go b/vendor/golang.org/x/sys/unix/dev_netbsd.go
deleted file mode 100644
index b4a203d..0000000
--- a/vendor/golang.org/x/sys/unix/dev_netbsd.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used in NetBSD's sys/types.h header.
-
-package unix
-
-// Major returns the major component of a NetBSD device number.
-func Major(dev uint64) uint32 {
- return uint32((dev & 0x000fff00) >> 8)
-}
-
-// Minor returns the minor component of a NetBSD device number.
-func Minor(dev uint64) uint32 {
- minor := uint32((dev & 0x000000ff) >> 0)
- minor |= uint32((dev & 0xfff00000) >> 12)
- return minor
-}
-
-// Mkdev returns a NetBSD device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
- dev := (uint64(major) << 8) & 0x000fff00
- dev |= (uint64(minor) << 12) & 0xfff00000
- dev |= (uint64(minor) << 0) & 0x000000ff
- return dev
-}
diff --git a/vendor/golang.org/x/sys/unix/dev_openbsd.go b/vendor/golang.org/x/sys/unix/dev_openbsd.go
deleted file mode 100644
index f3430c4..0000000
--- a/vendor/golang.org/x/sys/unix/dev_openbsd.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Functions to access/create device major and minor numbers matching the
-// encoding used in OpenBSD's sys/types.h header.
-
-package unix
-
-// Major returns the major component of an OpenBSD device number.
-func Major(dev uint64) uint32 {
- return uint32((dev & 0x0000ff00) >> 8)
-}
-
-// Minor returns the minor component of an OpenBSD device number.
-func Minor(dev uint64) uint32 {
- minor := uint32((dev & 0x000000ff) >> 0)
- minor |= uint32((dev & 0xffff0000) >> 8)
- return minor
-}
-
-// Mkdev returns an OpenBSD device number generated from the given major and minor
-// components.
-func Mkdev(major, minor uint32) uint64 {
- dev := (uint64(major) << 8) & 0x0000ff00
- dev |= (uint64(minor) << 8) & 0xffff0000
- dev |= (uint64(minor) << 0) & 0x000000ff
- return dev
-}
diff --git a/vendor/golang.org/x/sys/unix/dirent.go b/vendor/golang.org/x/sys/unix/dirent.go
deleted file mode 100644
index 304016b..0000000
--- a/vendor/golang.org/x/sys/unix/dirent.go
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
-
-package unix
-
-import "unsafe"
-
-// readInt returns the size-bytes unsigned integer in native byte order at offset off.
-func readInt(b []byte, off, size uintptr) (u uint64, ok bool) {
- if len(b) < int(off+size) {
- return 0, false
- }
- if isBigEndian {
- return readIntBE(b[off:], size), true
- }
- return readIntLE(b[off:], size), true
-}
-
-func readIntBE(b []byte, size uintptr) uint64 {
- switch size {
- case 1:
- return uint64(b[0])
- case 2:
- _ = b[1] // bounds check hint to compiler; see golang.org/issue/14808
- return uint64(b[1]) | uint64(b[0])<<8
- case 4:
- _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808
- return uint64(b[3]) | uint64(b[2])<<8 | uint64(b[1])<<16 | uint64(b[0])<<24
- case 8:
- _ = b[7] // bounds check hint to compiler; see golang.org/issue/14808
- return uint64(b[7]) | uint64(b[6])<<8 | uint64(b[5])<<16 | uint64(b[4])<<24 |
- uint64(b[3])<<32 | uint64(b[2])<<40 | uint64(b[1])<<48 | uint64(b[0])<<56
- default:
- panic("syscall: readInt with unsupported size")
- }
-}
-
-func readIntLE(b []byte, size uintptr) uint64 {
- switch size {
- case 1:
- return uint64(b[0])
- case 2:
- _ = b[1] // bounds check hint to compiler; see golang.org/issue/14808
- return uint64(b[0]) | uint64(b[1])<<8
- case 4:
- _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808
- return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24
- case 8:
- _ = b[7] // bounds check hint to compiler; see golang.org/issue/14808
- return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 |
- uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
- default:
- panic("syscall: readInt with unsupported size")
- }
-}
-
-// ParseDirent parses up to max directory entries in buf,
-// appending the names to names. It returns the number of
-// bytes consumed from buf, the number of entries added
-// to names, and the new names slice.
-func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) {
- origlen := len(buf)
- count = 0
- for max != 0 && len(buf) > 0 {
- reclen, ok := direntReclen(buf)
- if !ok || reclen > uint64(len(buf)) {
- return origlen, count, names
- }
- rec := buf[:reclen]
- buf = buf[reclen:]
- ino, ok := direntIno(rec)
- if !ok {
- break
- }
- if ino == 0 { // File absent in directory.
- continue
- }
- const namoff = uint64(unsafe.Offsetof(Dirent{}.Name))
- namlen, ok := direntNamlen(rec)
- if !ok || namoff+namlen > uint64(len(rec)) {
- break
- }
- name := rec[namoff : namoff+namlen]
- for i, c := range name {
- if c == 0 {
- name = name[:i]
- break
- }
- }
- // Check for useless names before allocating a string.
- if string(name) == "." || string(name) == ".." {
- continue
- }
- max--
- count++
- names = append(names, string(name))
- }
- return origlen - len(buf), count, names
-}
diff --git a/vendor/golang.org/x/sys/unix/endian_big.go b/vendor/golang.org/x/sys/unix/endian_big.go
deleted file mode 100644
index 5e92690..0000000
--- a/vendor/golang.org/x/sys/unix/endian_big.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-//
-// +build ppc64 s390x mips mips64
-
-package unix
-
-const isBigEndian = true
diff --git a/vendor/golang.org/x/sys/unix/endian_little.go b/vendor/golang.org/x/sys/unix/endian_little.go
deleted file mode 100644
index bcdb5d3..0000000
--- a/vendor/golang.org/x/sys/unix/endian_little.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-//
-// +build 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le riscv64
-
-package unix
-
-const isBigEndian = false
diff --git a/vendor/golang.org/x/sys/unix/env_unix.go b/vendor/golang.org/x/sys/unix/env_unix.go
deleted file mode 100644
index 84178b0..0000000
--- a/vendor/golang.org/x/sys/unix/env_unix.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
-
-// Unix environment variables.
-
-package unix
-
-import "syscall"
-
-func Getenv(key string) (value string, found bool) {
- return syscall.Getenv(key)
-}
-
-func Setenv(key, value string) error {
- return syscall.Setenv(key, value)
-}
-
-func Clearenv() {
- syscall.Clearenv()
-}
-
-func Environ() []string {
- return syscall.Environ()
-}
-
-func Unsetenv(key string) error {
- return syscall.Unsetenv(key)
-}
diff --git a/vendor/golang.org/x/sys/unix/errors_freebsd_386.go b/vendor/golang.org/x/sys/unix/errors_freebsd_386.go
deleted file mode 100644
index c56bc8b..0000000
--- a/vendor/golang.org/x/sys/unix/errors_freebsd_386.go
+++ /dev/null
@@ -1,227 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Constants that were deprecated or moved to enums in the FreeBSD headers. Keep
-// them here for backwards compatibility.
-
-package unix
-
-const (
- IFF_SMART = 0x20
- IFT_1822 = 0x2
- IFT_A12MPPSWITCH = 0x82
- IFT_AAL2 = 0xbb
- IFT_AAL5 = 0x31
- IFT_ADSL = 0x5e
- IFT_AFLANE8023 = 0x3b
- IFT_AFLANE8025 = 0x3c
- IFT_ARAP = 0x58
- IFT_ARCNET = 0x23
- IFT_ARCNETPLUS = 0x24
- IFT_ASYNC = 0x54
- IFT_ATM = 0x25
- IFT_ATMDXI = 0x69
- IFT_ATMFUNI = 0x6a
- IFT_ATMIMA = 0x6b
- IFT_ATMLOGICAL = 0x50
- IFT_ATMRADIO = 0xbd
- IFT_ATMSUBINTERFACE = 0x86
- IFT_ATMVCIENDPT = 0xc2
- IFT_ATMVIRTUAL = 0x95
- IFT_BGPPOLICYACCOUNTING = 0xa2
- IFT_BSC = 0x53
- IFT_CCTEMUL = 0x3d
- IFT_CEPT = 0x13
- IFT_CES = 0x85
- IFT_CHANNEL = 0x46
- IFT_CNR = 0x55
- IFT_COFFEE = 0x84
- IFT_COMPOSITELINK = 0x9b
- IFT_DCN = 0x8d
- IFT_DIGITALPOWERLINE = 0x8a
- IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba
- IFT_DLSW = 0x4a
- IFT_DOCSCABLEDOWNSTREAM = 0x80
- IFT_DOCSCABLEMACLAYER = 0x7f
- IFT_DOCSCABLEUPSTREAM = 0x81
- IFT_DS0 = 0x51
- IFT_DS0BUNDLE = 0x52
- IFT_DS1FDL = 0xaa
- IFT_DS3 = 0x1e
- IFT_DTM = 0x8c
- IFT_DVBASILN = 0xac
- IFT_DVBASIOUT = 0xad
- IFT_DVBRCCDOWNSTREAM = 0x93
- IFT_DVBRCCMACLAYER = 0x92
- IFT_DVBRCCUPSTREAM = 0x94
- IFT_ENC = 0xf4
- IFT_EON = 0x19
- IFT_EPLRS = 0x57
- IFT_ESCON = 0x49
- IFT_ETHER = 0x6
- IFT_FAITH = 0xf2
- IFT_FAST = 0x7d
- IFT_FASTETHER = 0x3e
- IFT_FASTETHERFX = 0x45
- IFT_FDDI = 0xf
- IFT_FIBRECHANNEL = 0x38
- IFT_FRAMERELAYINTERCONNECT = 0x3a
- IFT_FRAMERELAYMPI = 0x5c
- IFT_FRDLCIENDPT = 0xc1
- IFT_FRELAY = 0x20
- IFT_FRELAYDCE = 0x2c
- IFT_FRF16MFRBUNDLE = 0xa3
- IFT_FRFORWARD = 0x9e
- IFT_G703AT2MB = 0x43
- IFT_G703AT64K = 0x42
- IFT_GIF = 0xf0
- IFT_GIGABITETHERNET = 0x75
- IFT_GR303IDT = 0xb2
- IFT_GR303RDT = 0xb1
- IFT_H323GATEKEEPER = 0xa4
- IFT_H323PROXY = 0xa5
- IFT_HDH1822 = 0x3
- IFT_HDLC = 0x76
- IFT_HDSL2 = 0xa8
- IFT_HIPERLAN2 = 0xb7
- IFT_HIPPI = 0x2f
- IFT_HIPPIINTERFACE = 0x39
- IFT_HOSTPAD = 0x5a
- IFT_HSSI = 0x2e
- IFT_HY = 0xe
- IFT_IBM370PARCHAN = 0x48
- IFT_IDSL = 0x9a
- IFT_IEEE80211 = 0x47
- IFT_IEEE80212 = 0x37
- IFT_IEEE8023ADLAG = 0xa1
- IFT_IFGSN = 0x91
- IFT_IMT = 0xbe
- IFT_INTERLEAVE = 0x7c
- IFT_IP = 0x7e
- IFT_IPFORWARD = 0x8e
- IFT_IPOVERATM = 0x72
- IFT_IPOVERCDLC = 0x6d
- IFT_IPOVERCLAW = 0x6e
- IFT_IPSWITCH = 0x4e
- IFT_IPXIP = 0xf9
- IFT_ISDN = 0x3f
- IFT_ISDNBASIC = 0x14
- IFT_ISDNPRIMARY = 0x15
- IFT_ISDNS = 0x4b
- IFT_ISDNU = 0x4c
- IFT_ISO88022LLC = 0x29
- IFT_ISO88023 = 0x7
- IFT_ISO88024 = 0x8
- IFT_ISO88025 = 0x9
- IFT_ISO88025CRFPINT = 0x62
- IFT_ISO88025DTR = 0x56
- IFT_ISO88025FIBER = 0x73
- IFT_ISO88026 = 0xa
- IFT_ISUP = 0xb3
- IFT_L3IPXVLAN = 0x89
- IFT_LAPB = 0x10
- IFT_LAPD = 0x4d
- IFT_LAPF = 0x77
- IFT_LOCALTALK = 0x2a
- IFT_LOOP = 0x18
- IFT_MEDIAMAILOVERIP = 0x8b
- IFT_MFSIGLINK = 0xa7
- IFT_MIOX25 = 0x26
- IFT_MODEM = 0x30
- IFT_MPC = 0x71
- IFT_MPLS = 0xa6
- IFT_MPLSTUNNEL = 0x96
- IFT_MSDSL = 0x8f
- IFT_MVL = 0xbf
- IFT_MYRINET = 0x63
- IFT_NFAS = 0xaf
- IFT_NSIP = 0x1b
- IFT_OPTICALCHANNEL = 0xc3
- IFT_OPTICALTRANSPORT = 0xc4
- IFT_OTHER = 0x1
- IFT_P10 = 0xc
- IFT_P80 = 0xd
- IFT_PARA = 0x22
- IFT_PFLOG = 0xf6
- IFT_PFSYNC = 0xf7
- IFT_PLC = 0xae
- IFT_POS = 0xab
- IFT_PPPMULTILINKBUNDLE = 0x6c
- IFT_PROPBWAP2MP = 0xb8
- IFT_PROPCNLS = 0x59
- IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5
- IFT_PROPDOCSWIRELESSMACLAYER = 0xb4
- IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6
- IFT_PROPMUX = 0x36
- IFT_PROPWIRELESSP2P = 0x9d
- IFT_PTPSERIAL = 0x16
- IFT_PVC = 0xf1
- IFT_QLLC = 0x44
- IFT_RADIOMAC = 0xbc
- IFT_RADSL = 0x5f
- IFT_REACHDSL = 0xc0
- IFT_RFC1483 = 0x9f
- IFT_RS232 = 0x21
- IFT_RSRB = 0x4f
- IFT_SDLC = 0x11
- IFT_SDSL = 0x60
- IFT_SHDSL = 0xa9
- IFT_SIP = 0x1f
- IFT_SLIP = 0x1c
- IFT_SMDSDXI = 0x2b
- IFT_SMDSICIP = 0x34
- IFT_SONET = 0x27
- IFT_SONETOVERHEADCHANNEL = 0xb9
- IFT_SONETPATH = 0x32
- IFT_SONETVT = 0x33
- IFT_SRP = 0x97
- IFT_SS7SIGLINK = 0x9c
- IFT_STACKTOSTACK = 0x6f
- IFT_STARLAN = 0xb
- IFT_STF = 0xd7
- IFT_T1 = 0x12
- IFT_TDLC = 0x74
- IFT_TERMPAD = 0x5b
- IFT_TR008 = 0xb0
- IFT_TRANSPHDLC = 0x7b
- IFT_TUNNEL = 0x83
- IFT_ULTRA = 0x1d
- IFT_USB = 0xa0
- IFT_V11 = 0x40
- IFT_V35 = 0x2d
- IFT_V36 = 0x41
- IFT_V37 = 0x78
- IFT_VDSL = 0x61
- IFT_VIRTUALIPADDRESS = 0x70
- IFT_VOICEEM = 0x64
- IFT_VOICEENCAP = 0x67
- IFT_VOICEFXO = 0x65
- IFT_VOICEFXS = 0x66
- IFT_VOICEOVERATM = 0x98
- IFT_VOICEOVERFRAMERELAY = 0x99
- IFT_VOICEOVERIP = 0x68
- IFT_X213 = 0x5d
- IFT_X25 = 0x5
- IFT_X25DDN = 0x4
- IFT_X25HUNTGROUP = 0x7a
- IFT_X25MLP = 0x79
- IFT_X25PLE = 0x28
- IFT_XETHER = 0x1a
- IPPROTO_MAXID = 0x34
- IPV6_FAITH = 0x1d
- IP_FAITH = 0x16
- MAP_NORESERVE = 0x40
- MAP_RENAME = 0x20
- NET_RT_MAXID = 0x6
- RTF_PRCLONING = 0x10000
- RTM_OLDADD = 0x9
- RTM_OLDDEL = 0xa
- SIOCADDRT = 0x8030720a
- SIOCALIFADDR = 0x8118691b
- SIOCDELRT = 0x8030720b
- SIOCDLIFADDR = 0x8118691d
- SIOCGLIFADDR = 0xc118691c
- SIOCGLIFPHYADDR = 0xc118694b
- SIOCSLIFPHYADDR = 0x8118694a
-)
diff --git a/vendor/golang.org/x/sys/unix/errors_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/errors_freebsd_amd64.go
deleted file mode 100644
index 3e97711..0000000
--- a/vendor/golang.org/x/sys/unix/errors_freebsd_amd64.go
+++ /dev/null
@@ -1,227 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Constants that were deprecated or moved to enums in the FreeBSD headers. Keep
-// them here for backwards compatibility.
-
-package unix
-
-const (
- IFF_SMART = 0x20
- IFT_1822 = 0x2
- IFT_A12MPPSWITCH = 0x82
- IFT_AAL2 = 0xbb
- IFT_AAL5 = 0x31
- IFT_ADSL = 0x5e
- IFT_AFLANE8023 = 0x3b
- IFT_AFLANE8025 = 0x3c
- IFT_ARAP = 0x58
- IFT_ARCNET = 0x23
- IFT_ARCNETPLUS = 0x24
- IFT_ASYNC = 0x54
- IFT_ATM = 0x25
- IFT_ATMDXI = 0x69
- IFT_ATMFUNI = 0x6a
- IFT_ATMIMA = 0x6b
- IFT_ATMLOGICAL = 0x50
- IFT_ATMRADIO = 0xbd
- IFT_ATMSUBINTERFACE = 0x86
- IFT_ATMVCIENDPT = 0xc2
- IFT_ATMVIRTUAL = 0x95
- IFT_BGPPOLICYACCOUNTING = 0xa2
- IFT_BSC = 0x53
- IFT_CCTEMUL = 0x3d
- IFT_CEPT = 0x13
- IFT_CES = 0x85
- IFT_CHANNEL = 0x46
- IFT_CNR = 0x55
- IFT_COFFEE = 0x84
- IFT_COMPOSITELINK = 0x9b
- IFT_DCN = 0x8d
- IFT_DIGITALPOWERLINE = 0x8a
- IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba
- IFT_DLSW = 0x4a
- IFT_DOCSCABLEDOWNSTREAM = 0x80
- IFT_DOCSCABLEMACLAYER = 0x7f
- IFT_DOCSCABLEUPSTREAM = 0x81
- IFT_DS0 = 0x51
- IFT_DS0BUNDLE = 0x52
- IFT_DS1FDL = 0xaa
- IFT_DS3 = 0x1e
- IFT_DTM = 0x8c
- IFT_DVBASILN = 0xac
- IFT_DVBASIOUT = 0xad
- IFT_DVBRCCDOWNSTREAM = 0x93
- IFT_DVBRCCMACLAYER = 0x92
- IFT_DVBRCCUPSTREAM = 0x94
- IFT_ENC = 0xf4
- IFT_EON = 0x19
- IFT_EPLRS = 0x57
- IFT_ESCON = 0x49
- IFT_ETHER = 0x6
- IFT_FAITH = 0xf2
- IFT_FAST = 0x7d
- IFT_FASTETHER = 0x3e
- IFT_FASTETHERFX = 0x45
- IFT_FDDI = 0xf
- IFT_FIBRECHANNEL = 0x38
- IFT_FRAMERELAYINTERCONNECT = 0x3a
- IFT_FRAMERELAYMPI = 0x5c
- IFT_FRDLCIENDPT = 0xc1
- IFT_FRELAY = 0x20
- IFT_FRELAYDCE = 0x2c
- IFT_FRF16MFRBUNDLE = 0xa3
- IFT_FRFORWARD = 0x9e
- IFT_G703AT2MB = 0x43
- IFT_G703AT64K = 0x42
- IFT_GIF = 0xf0
- IFT_GIGABITETHERNET = 0x75
- IFT_GR303IDT = 0xb2
- IFT_GR303RDT = 0xb1
- IFT_H323GATEKEEPER = 0xa4
- IFT_H323PROXY = 0xa5
- IFT_HDH1822 = 0x3
- IFT_HDLC = 0x76
- IFT_HDSL2 = 0xa8
- IFT_HIPERLAN2 = 0xb7
- IFT_HIPPI = 0x2f
- IFT_HIPPIINTERFACE = 0x39
- IFT_HOSTPAD = 0x5a
- IFT_HSSI = 0x2e
- IFT_HY = 0xe
- IFT_IBM370PARCHAN = 0x48
- IFT_IDSL = 0x9a
- IFT_IEEE80211 = 0x47
- IFT_IEEE80212 = 0x37
- IFT_IEEE8023ADLAG = 0xa1
- IFT_IFGSN = 0x91
- IFT_IMT = 0xbe
- IFT_INTERLEAVE = 0x7c
- IFT_IP = 0x7e
- IFT_IPFORWARD = 0x8e
- IFT_IPOVERATM = 0x72
- IFT_IPOVERCDLC = 0x6d
- IFT_IPOVERCLAW = 0x6e
- IFT_IPSWITCH = 0x4e
- IFT_IPXIP = 0xf9
- IFT_ISDN = 0x3f
- IFT_ISDNBASIC = 0x14
- IFT_ISDNPRIMARY = 0x15
- IFT_ISDNS = 0x4b
- IFT_ISDNU = 0x4c
- IFT_ISO88022LLC = 0x29
- IFT_ISO88023 = 0x7
- IFT_ISO88024 = 0x8
- IFT_ISO88025 = 0x9
- IFT_ISO88025CRFPINT = 0x62
- IFT_ISO88025DTR = 0x56
- IFT_ISO88025FIBER = 0x73
- IFT_ISO88026 = 0xa
- IFT_ISUP = 0xb3
- IFT_L3IPXVLAN = 0x89
- IFT_LAPB = 0x10
- IFT_LAPD = 0x4d
- IFT_LAPF = 0x77
- IFT_LOCALTALK = 0x2a
- IFT_LOOP = 0x18
- IFT_MEDIAMAILOVERIP = 0x8b
- IFT_MFSIGLINK = 0xa7
- IFT_MIOX25 = 0x26
- IFT_MODEM = 0x30
- IFT_MPC = 0x71
- IFT_MPLS = 0xa6
- IFT_MPLSTUNNEL = 0x96
- IFT_MSDSL = 0x8f
- IFT_MVL = 0xbf
- IFT_MYRINET = 0x63
- IFT_NFAS = 0xaf
- IFT_NSIP = 0x1b
- IFT_OPTICALCHANNEL = 0xc3
- IFT_OPTICALTRANSPORT = 0xc4
- IFT_OTHER = 0x1
- IFT_P10 = 0xc
- IFT_P80 = 0xd
- IFT_PARA = 0x22
- IFT_PFLOG = 0xf6
- IFT_PFSYNC = 0xf7
- IFT_PLC = 0xae
- IFT_POS = 0xab
- IFT_PPPMULTILINKBUNDLE = 0x6c
- IFT_PROPBWAP2MP = 0xb8
- IFT_PROPCNLS = 0x59
- IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5
- IFT_PROPDOCSWIRELESSMACLAYER = 0xb4
- IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6
- IFT_PROPMUX = 0x36
- IFT_PROPWIRELESSP2P = 0x9d
- IFT_PTPSERIAL = 0x16
- IFT_PVC = 0xf1
- IFT_QLLC = 0x44
- IFT_RADIOMAC = 0xbc
- IFT_RADSL = 0x5f
- IFT_REACHDSL = 0xc0
- IFT_RFC1483 = 0x9f
- IFT_RS232 = 0x21
- IFT_RSRB = 0x4f
- IFT_SDLC = 0x11
- IFT_SDSL = 0x60
- IFT_SHDSL = 0xa9
- IFT_SIP = 0x1f
- IFT_SLIP = 0x1c
- IFT_SMDSDXI = 0x2b
- IFT_SMDSICIP = 0x34
- IFT_SONET = 0x27
- IFT_SONETOVERHEADCHANNEL = 0xb9
- IFT_SONETPATH = 0x32
- IFT_SONETVT = 0x33
- IFT_SRP = 0x97
- IFT_SS7SIGLINK = 0x9c
- IFT_STACKTOSTACK = 0x6f
- IFT_STARLAN = 0xb
- IFT_STF = 0xd7
- IFT_T1 = 0x12
- IFT_TDLC = 0x74
- IFT_TERMPAD = 0x5b
- IFT_TR008 = 0xb0
- IFT_TRANSPHDLC = 0x7b
- IFT_TUNNEL = 0x83
- IFT_ULTRA = 0x1d
- IFT_USB = 0xa0
- IFT_V11 = 0x40
- IFT_V35 = 0x2d
- IFT_V36 = 0x41
- IFT_V37 = 0x78
- IFT_VDSL = 0x61
- IFT_VIRTUALIPADDRESS = 0x70
- IFT_VOICEEM = 0x64
- IFT_VOICEENCAP = 0x67
- IFT_VOICEFXO = 0x65
- IFT_VOICEFXS = 0x66
- IFT_VOICEOVERATM = 0x98
- IFT_VOICEOVERFRAMERELAY = 0x99
- IFT_VOICEOVERIP = 0x68
- IFT_X213 = 0x5d
- IFT_X25 = 0x5
- IFT_X25DDN = 0x4
- IFT_X25HUNTGROUP = 0x7a
- IFT_X25MLP = 0x79
- IFT_X25PLE = 0x28
- IFT_XETHER = 0x1a
- IPPROTO_MAXID = 0x34
- IPV6_FAITH = 0x1d
- IP_FAITH = 0x16
- MAP_NORESERVE = 0x40
- MAP_RENAME = 0x20
- NET_RT_MAXID = 0x6
- RTF_PRCLONING = 0x10000
- RTM_OLDADD = 0x9
- RTM_OLDDEL = 0xa
- SIOCADDRT = 0x8040720a
- SIOCALIFADDR = 0x8118691b
- SIOCDELRT = 0x8040720b
- SIOCDLIFADDR = 0x8118691d
- SIOCGLIFADDR = 0xc118691c
- SIOCGLIFPHYADDR = 0xc118694b
- SIOCSLIFPHYADDR = 0x8118694a
-)
diff --git a/vendor/golang.org/x/sys/unix/errors_freebsd_arm.go b/vendor/golang.org/x/sys/unix/errors_freebsd_arm.go
deleted file mode 100644
index 856dca3..0000000
--- a/vendor/golang.org/x/sys/unix/errors_freebsd_arm.go
+++ /dev/null
@@ -1,226 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package unix
-
-const (
- IFT_1822 = 0x2
- IFT_A12MPPSWITCH = 0x82
- IFT_AAL2 = 0xbb
- IFT_AAL5 = 0x31
- IFT_ADSL = 0x5e
- IFT_AFLANE8023 = 0x3b
- IFT_AFLANE8025 = 0x3c
- IFT_ARAP = 0x58
- IFT_ARCNET = 0x23
- IFT_ARCNETPLUS = 0x24
- IFT_ASYNC = 0x54
- IFT_ATM = 0x25
- IFT_ATMDXI = 0x69
- IFT_ATMFUNI = 0x6a
- IFT_ATMIMA = 0x6b
- IFT_ATMLOGICAL = 0x50
- IFT_ATMRADIO = 0xbd
- IFT_ATMSUBINTERFACE = 0x86
- IFT_ATMVCIENDPT = 0xc2
- IFT_ATMVIRTUAL = 0x95
- IFT_BGPPOLICYACCOUNTING = 0xa2
- IFT_BSC = 0x53
- IFT_CCTEMUL = 0x3d
- IFT_CEPT = 0x13
- IFT_CES = 0x85
- IFT_CHANNEL = 0x46
- IFT_CNR = 0x55
- IFT_COFFEE = 0x84
- IFT_COMPOSITELINK = 0x9b
- IFT_DCN = 0x8d
- IFT_DIGITALPOWERLINE = 0x8a
- IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba
- IFT_DLSW = 0x4a
- IFT_DOCSCABLEDOWNSTREAM = 0x80
- IFT_DOCSCABLEMACLAYER = 0x7f
- IFT_DOCSCABLEUPSTREAM = 0x81
- IFT_DS0 = 0x51
- IFT_DS0BUNDLE = 0x52
- IFT_DS1FDL = 0xaa
- IFT_DS3 = 0x1e
- IFT_DTM = 0x8c
- IFT_DVBASILN = 0xac
- IFT_DVBASIOUT = 0xad
- IFT_DVBRCCDOWNSTREAM = 0x93
- IFT_DVBRCCMACLAYER = 0x92
- IFT_DVBRCCUPSTREAM = 0x94
- IFT_ENC = 0xf4
- IFT_EON = 0x19
- IFT_EPLRS = 0x57
- IFT_ESCON = 0x49
- IFT_ETHER = 0x6
- IFT_FAST = 0x7d
- IFT_FASTETHER = 0x3e
- IFT_FASTETHERFX = 0x45
- IFT_FDDI = 0xf
- IFT_FIBRECHANNEL = 0x38
- IFT_FRAMERELAYINTERCONNECT = 0x3a
- IFT_FRAMERELAYMPI = 0x5c
- IFT_FRDLCIENDPT = 0xc1
- IFT_FRELAY = 0x20
- IFT_FRELAYDCE = 0x2c
- IFT_FRF16MFRBUNDLE = 0xa3
- IFT_FRFORWARD = 0x9e
- IFT_G703AT2MB = 0x43
- IFT_G703AT64K = 0x42
- IFT_GIF = 0xf0
- IFT_GIGABITETHERNET = 0x75
- IFT_GR303IDT = 0xb2
- IFT_GR303RDT = 0xb1
- IFT_H323GATEKEEPER = 0xa4
- IFT_H323PROXY = 0xa5
- IFT_HDH1822 = 0x3
- IFT_HDLC = 0x76
- IFT_HDSL2 = 0xa8
- IFT_HIPERLAN2 = 0xb7
- IFT_HIPPI = 0x2f
- IFT_HIPPIINTERFACE = 0x39
- IFT_HOSTPAD = 0x5a
- IFT_HSSI = 0x2e
- IFT_HY = 0xe
- IFT_IBM370PARCHAN = 0x48
- IFT_IDSL = 0x9a
- IFT_IEEE80211 = 0x47
- IFT_IEEE80212 = 0x37
- IFT_IEEE8023ADLAG = 0xa1
- IFT_IFGSN = 0x91
- IFT_IMT = 0xbe
- IFT_INTERLEAVE = 0x7c
- IFT_IP = 0x7e
- IFT_IPFORWARD = 0x8e
- IFT_IPOVERATM = 0x72
- IFT_IPOVERCDLC = 0x6d
- IFT_IPOVERCLAW = 0x6e
- IFT_IPSWITCH = 0x4e
- IFT_ISDN = 0x3f
- IFT_ISDNBASIC = 0x14
- IFT_ISDNPRIMARY = 0x15
- IFT_ISDNS = 0x4b
- IFT_ISDNU = 0x4c
- IFT_ISO88022LLC = 0x29
- IFT_ISO88023 = 0x7
- IFT_ISO88024 = 0x8
- IFT_ISO88025 = 0x9
- IFT_ISO88025CRFPINT = 0x62
- IFT_ISO88025DTR = 0x56
- IFT_ISO88025FIBER = 0x73
- IFT_ISO88026 = 0xa
- IFT_ISUP = 0xb3
- IFT_L3IPXVLAN = 0x89
- IFT_LAPB = 0x10
- IFT_LAPD = 0x4d
- IFT_LAPF = 0x77
- IFT_LOCALTALK = 0x2a
- IFT_LOOP = 0x18
- IFT_MEDIAMAILOVERIP = 0x8b
- IFT_MFSIGLINK = 0xa7
- IFT_MIOX25 = 0x26
- IFT_MODEM = 0x30
- IFT_MPC = 0x71
- IFT_MPLS = 0xa6
- IFT_MPLSTUNNEL = 0x96
- IFT_MSDSL = 0x8f
- IFT_MVL = 0xbf
- IFT_MYRINET = 0x63
- IFT_NFAS = 0xaf
- IFT_NSIP = 0x1b
- IFT_OPTICALCHANNEL = 0xc3
- IFT_OPTICALTRANSPORT = 0xc4
- IFT_OTHER = 0x1
- IFT_P10 = 0xc
- IFT_P80 = 0xd
- IFT_PARA = 0x22
- IFT_PFLOG = 0xf6
- IFT_PFSYNC = 0xf7
- IFT_PLC = 0xae
- IFT_POS = 0xab
- IFT_PPPMULTILINKBUNDLE = 0x6c
- IFT_PROPBWAP2MP = 0xb8
- IFT_PROPCNLS = 0x59
- IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5
- IFT_PROPDOCSWIRELESSMACLAYER = 0xb4
- IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6
- IFT_PROPMUX = 0x36
- IFT_PROPWIRELESSP2P = 0x9d
- IFT_PTPSERIAL = 0x16
- IFT_PVC = 0xf1
- IFT_QLLC = 0x44
- IFT_RADIOMAC = 0xbc
- IFT_RADSL = 0x5f
- IFT_REACHDSL = 0xc0
- IFT_RFC1483 = 0x9f
- IFT_RS232 = 0x21
- IFT_RSRB = 0x4f
- IFT_SDLC = 0x11
- IFT_SDSL = 0x60
- IFT_SHDSL = 0xa9
- IFT_SIP = 0x1f
- IFT_SLIP = 0x1c
- IFT_SMDSDXI = 0x2b
- IFT_SMDSICIP = 0x34
- IFT_SONET = 0x27
- IFT_SONETOVERHEADCHANNEL = 0xb9
- IFT_SONETPATH = 0x32
- IFT_SONETVT = 0x33
- IFT_SRP = 0x97
- IFT_SS7SIGLINK = 0x9c
- IFT_STACKTOSTACK = 0x6f
- IFT_STARLAN = 0xb
- IFT_STF = 0xd7
- IFT_T1 = 0x12
- IFT_TDLC = 0x74
- IFT_TERMPAD = 0x5b
- IFT_TR008 = 0xb0
- IFT_TRANSPHDLC = 0x7b
- IFT_TUNNEL = 0x83
- IFT_ULTRA = 0x1d
- IFT_USB = 0xa0
- IFT_V11 = 0x40
- IFT_V35 = 0x2d
- IFT_V36 = 0x41
- IFT_V37 = 0x78
- IFT_VDSL = 0x61
- IFT_VIRTUALIPADDRESS = 0x70
- IFT_VOICEEM = 0x64
- IFT_VOICEENCAP = 0x67
- IFT_VOICEFXO = 0x65
- IFT_VOICEFXS = 0x66
- IFT_VOICEOVERATM = 0x98
- IFT_VOICEOVERFRAMERELAY = 0x99
- IFT_VOICEOVERIP = 0x68
- IFT_X213 = 0x5d
- IFT_X25 = 0x5
- IFT_X25DDN = 0x4
- IFT_X25HUNTGROUP = 0x7a
- IFT_X25MLP = 0x79
- IFT_X25PLE = 0x28
- IFT_XETHER = 0x1a
-
- // missing constants on FreeBSD-11.1-RELEASE, copied from old values in ztypes_freebsd_arm.go
- IFF_SMART = 0x20
- IFT_FAITH = 0xf2
- IFT_IPXIP = 0xf9
- IPPROTO_MAXID = 0x34
- IPV6_FAITH = 0x1d
- IP_FAITH = 0x16
- MAP_NORESERVE = 0x40
- MAP_RENAME = 0x20
- NET_RT_MAXID = 0x6
- RTF_PRCLONING = 0x10000
- RTM_OLDADD = 0x9
- RTM_OLDDEL = 0xa
- SIOCADDRT = 0x8030720a
- SIOCALIFADDR = 0x8118691b
- SIOCDELRT = 0x8030720b
- SIOCDLIFADDR = 0x8118691d
- SIOCGLIFADDR = 0xc118691c
- SIOCGLIFPHYADDR = 0xc118694b
- SIOCSLIFPHYADDR = 0x8118694a
-)
diff --git a/vendor/golang.org/x/sys/unix/fcntl.go b/vendor/golang.org/x/sys/unix/fcntl.go
deleted file mode 100644
index 4dc5348..0000000
--- a/vendor/golang.org/x/sys/unix/fcntl.go
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build dragonfly freebsd linux netbsd openbsd
-
-package unix
-
-import "unsafe"
-
-// fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux
-// systems by fcntl_linux_32bit.go to be SYS_FCNTL64.
-var fcntl64Syscall uintptr = SYS_FCNTL
-
-func fcntl(fd int, cmd, arg int) (int, error) {
- valptr, _, errno := Syscall(fcntl64Syscall, uintptr(fd), uintptr(cmd), uintptr(arg))
- var err error
- if errno != 0 {
- err = errno
- }
- return int(valptr), err
-}
-
-// FcntlInt performs a fcntl syscall on fd with the provided command and argument.
-func FcntlInt(fd uintptr, cmd, arg int) (int, error) {
- return fcntl(int(fd), cmd, arg)
-}
-
-// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
-func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
- _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk)))
- if errno == 0 {
- return nil
- }
- return errno
-}
diff --git a/vendor/golang.org/x/sys/unix/fcntl_darwin.go b/vendor/golang.org/x/sys/unix/fcntl_darwin.go
deleted file mode 100644
index 5868a4a..0000000
--- a/vendor/golang.org/x/sys/unix/fcntl_darwin.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2019 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package unix
-
-import "unsafe"
-
-// FcntlInt performs a fcntl syscall on fd with the provided command and argument.
-func FcntlInt(fd uintptr, cmd, arg int) (int, error) {
- return fcntl(int(fd), cmd, arg)
-}
-
-// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
-func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
- _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk))))
- return err
-}
diff --git a/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go b/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go
deleted file mode 100644
index fc0e50e..0000000
--- a/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build linux,386 linux,arm linux,mips linux,mipsle
-
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package unix
-
-func init() {
- // On 32-bit Linux systems, the fcntl syscall that matches Go's
- // Flock_t type is SYS_FCNTL64, not SYS_FCNTL.
- fcntl64Syscall = SYS_FCNTL64
-}
diff --git a/vendor/golang.org/x/sys/unix/fdset.go b/vendor/golang.org/x/sys/unix/fdset.go
deleted file mode 100644
index b27be0a..0000000
--- a/vendor/golang.org/x/sys/unix/fdset.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2019 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
-
-package unix
-
-// Set adds fd to the set fds.
-func (fds *FdSet) Set(fd int) {
- fds.Bits[fd/NFDBITS] |= (1 << (uintptr(fd) % NFDBITS))
-}
-
-// Clear removes fd from the set fds.
-func (fds *FdSet) Clear(fd int) {
- fds.Bits[fd/NFDBITS] &^= (1 << (uintptr(fd) % NFDBITS))
-}
-
-// IsSet returns whether fd is in the set fds.
-func (fds *FdSet) IsSet(fd int) bool {
- return fds.Bits[fd/NFDBITS]&(1<<(uintptr(fd)%NFDBITS)) != 0
-}
-
-// Zero clears the set fds.
-func (fds *FdSet) Zero() {
- for i := range fds.Bits {
- fds.Bits[i] = 0
- }
-}
diff --git a/vendor/golang.org/x/sys/unix/gccgo.go b/vendor/golang.org/x/sys/unix/gccgo.go
deleted file mode 100644
index cd6f5a6..0000000
--- a/vendor/golang.org/x/sys/unix/gccgo.go
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build gccgo
-// +build !aix
-
-package unix
-
-import "syscall"
-
-// We can't use the gc-syntax .s files for gccgo. On the plus side
-// much of the functionality can be written directly in Go.
-
-//extern gccgoRealSyscallNoError
-func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr)
-
-//extern gccgoRealSyscall
-func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr)
-
-func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
- syscall.Entersyscall()
- r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
- syscall.Exitsyscall()
- return r, 0
-}
-
-func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
- syscall.Entersyscall()
- r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
- syscall.Exitsyscall()
- return r, 0, syscall.Errno(errno)
-}
-
-func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
- syscall.Entersyscall()
- r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
- syscall.Exitsyscall()
- return r, 0, syscall.Errno(errno)
-}
-
-func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) {
- syscall.Entersyscall()
- r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9)
- syscall.Exitsyscall()
- return r, 0, syscall.Errno(errno)
-}
-
-func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
- r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
- return r, 0
-}
-
-func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
- r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
- return r, 0, syscall.Errno(errno)
-}
-
-func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
- r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0)
- return r, 0, syscall.Errno(errno)
-}
diff --git a/vendor/golang.org/x/sys/unix/gccgo_c.c b/vendor/golang.org/x/sys/unix/gccgo_c.c
deleted file mode 100644
index c44730c..0000000
--- a/vendor/golang.org/x/sys/unix/gccgo_c.c
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build gccgo
-// +build !aix
-
-#include
-#include
-#include
-
-#define _STRINGIFY2_(x) #x
-#define _STRINGIFY_(x) _STRINGIFY2_(x)
-#define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__)
-
-// Call syscall from C code because the gccgo support for calling from
-// Go to C does not support varargs functions.
-
-struct ret {
- uintptr_t r;
- uintptr_t err;
-};
-
-struct ret
-gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
-{
- struct ret r;
-
- errno = 0;
- r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9);
- r.err = errno;
- return r;
-}
-
-uintptr_t
-gccgoRealSyscallNoError(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
-{
- return syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9);
-}
diff --git a/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go b/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go
deleted file mode 100644
index 251a977..0000000
--- a/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build gccgo,linux,amd64
-
-package unix
-
-import "syscall"
-
-//extern gettimeofday
-func realGettimeofday(*Timeval, *byte) int32
-
-func gettimeofday(tv *Timeval) (err syscall.Errno) {
- r := realGettimeofday(tv, nil)
- if r < 0 {
- return syscall.GetErrno()
- }
- return 0
-}
diff --git a/vendor/golang.org/x/sys/unix/ioctl.go b/vendor/golang.org/x/sys/unix/ioctl.go
deleted file mode 100644
index 3559e5d..0000000
--- a/vendor/golang.org/x/sys/unix/ioctl.go
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
-
-package unix
-
-import (
- "runtime"
- "unsafe"
-)
-
-// ioctl itself should not be exposed directly, but additional get/set
-// functions for specific types are permissible.
-
-// IoctlSetInt performs an ioctl operation which sets an integer value
-// on fd, using the specified request number.
-func IoctlSetInt(fd int, req uint, value int) error {
- return ioctl(fd, req, uintptr(value))
-}
-
-// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
-//
-// To change fd's window size, the req argument should be TIOCSWINSZ.
-func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
- // TODO: if we get the chance, remove the req parameter and
- // hardcode TIOCSWINSZ.
- err := ioctl(fd, req, uintptr(unsafe.Pointer(value)))
- runtime.KeepAlive(value)
- return err
-}
-
-// IoctlSetTermios performs an ioctl on fd with a *Termios.
-//
-// The req value will usually be TCSETA or TIOCSETA.
-func IoctlSetTermios(fd int, req uint, value *Termios) error {
- // TODO: if we get the chance, remove the req parameter.
- err := ioctl(fd, req, uintptr(unsafe.Pointer(value)))
- runtime.KeepAlive(value)
- return err
-}
-
-// IoctlGetInt performs an ioctl operation which gets an integer value
-// from fd, using the specified request number.
-//
-// A few ioctl requests use the return value as an output parameter;
-// for those, IoctlRetInt should be used instead of this function.
-func IoctlGetInt(fd int, req uint) (int, error) {
- var value int
- err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
- return value, err
-}
-
-func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
- var value Winsize
- err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
- return &value, err
-}
-
-func IoctlGetTermios(fd int, req uint) (*Termios, error) {
- var value Termios
- err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
- return &value, err
-}
diff --git a/vendor/golang.org/x/sys/unix/mkall.sh b/vendor/golang.org/x/sys/unix/mkall.sh
deleted file mode 100644
index fa0c69b..0000000
--- a/vendor/golang.org/x/sys/unix/mkall.sh
+++ /dev/null
@@ -1,229 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2009 The Go Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-# This script runs or (given -n) prints suggested commands to generate files for
-# the Architecture/OS specified by the GOARCH and GOOS environment variables.
-# See README.md for more information about how the build system works.
-
-GOOSARCH="${GOOS}_${GOARCH}"
-
-# defaults
-mksyscall="go run mksyscall.go"
-mkerrors="./mkerrors.sh"
-zerrors="zerrors_$GOOSARCH.go"
-mksysctl=""
-zsysctl="zsysctl_$GOOSARCH.go"
-mksysnum=
-mktypes=
-mkasm=
-run="sh"
-cmd=""
-
-case "$1" in
--syscalls)
- for i in zsyscall*go
- do
- # Run the command line that appears in the first line
- # of the generated file to regenerate it.
- sed 1q $i | sed 's;^// ;;' | sh > _$i && gofmt < _$i > $i
- rm _$i
- done
- exit 0
- ;;
--n)
- run="cat"
- cmd="echo"
- shift
-esac
-
-case "$#" in
-0)
- ;;
-*)
- echo 'usage: mkall.sh [-n]' 1>&2
- exit 2
-esac
-
-if [[ "$GOOS" = "linux" ]]; then
- # Use the Docker-based build system
- # Files generated through docker (use $cmd so you can Ctl-C the build or run)
- $cmd docker build --tag generate:$GOOS $GOOS
- $cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")" && /bin/pwd):/build generate:$GOOS
- exit
-fi
-
-GOOSARCH_in=syscall_$GOOSARCH.go
-case "$GOOSARCH" in
-_* | *_ | _)
- echo 'undefined $GOOS_$GOARCH:' "$GOOSARCH" 1>&2
- exit 1
- ;;
-aix_ppc)
- mkerrors="$mkerrors -maix32"
- mksyscall="go run mksyscall_aix_ppc.go -aix"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-aix_ppc64)
- mkerrors="$mkerrors -maix64"
- mksyscall="go run mksyscall_aix_ppc64.go -aix"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-darwin_386)
- mkerrors="$mkerrors -m32"
- mksyscall="go run mksyscall.go -l32"
- mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- mkasm="go run mkasm_darwin.go"
- ;;
-darwin_amd64)
- mkerrors="$mkerrors -m64"
- mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- mkasm="go run mkasm_darwin.go"
- ;;
-darwin_arm)
- mkerrors="$mkerrors"
- mksyscall="go run mksyscall.go -l32"
- mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- mkasm="go run mkasm_darwin.go"
- ;;
-darwin_arm64)
- mkerrors="$mkerrors -m64"
- mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- mkasm="go run mkasm_darwin.go"
- ;;
-dragonfly_amd64)
- mkerrors="$mkerrors -m64"
- mksyscall="go run mksyscall.go -dragonfly"
- mksysnum="go run mksysnum.go 'https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master'"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-freebsd_386)
- mkerrors="$mkerrors -m32"
- mksyscall="go run mksyscall.go -l32"
- mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-freebsd_amd64)
- mkerrors="$mkerrors -m64"
- mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-freebsd_arm)
- mkerrors="$mkerrors"
- mksyscall="go run mksyscall.go -l32 -arm"
- mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'"
- # Let the type of C char be signed for making the bare syscall
- # API consistent across platforms.
- mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
- ;;
-freebsd_arm64)
- mkerrors="$mkerrors -m64"
- mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-netbsd_386)
- mkerrors="$mkerrors -m32"
- mksyscall="go run mksyscall.go -l32 -netbsd"
- mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-netbsd_amd64)
- mkerrors="$mkerrors -m64"
- mksyscall="go run mksyscall.go -netbsd"
- mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-netbsd_arm)
- mkerrors="$mkerrors"
- mksyscall="go run mksyscall.go -l32 -netbsd -arm"
- mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
- # Let the type of C char be signed for making the bare syscall
- # API consistent across platforms.
- mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
- ;;
-netbsd_arm64)
- mkerrors="$mkerrors -m64"
- mksyscall="go run mksyscall.go -netbsd"
- mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-openbsd_386)
- mkerrors="$mkerrors -m32"
- mksyscall="go run mksyscall.go -l32 -openbsd"
- mksysctl="go run mksysctl_openbsd.go"
- mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-openbsd_amd64)
- mkerrors="$mkerrors -m64"
- mksyscall="go run mksyscall.go -openbsd"
- mksysctl="go run mksysctl_openbsd.go"
- mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-openbsd_arm)
- mkerrors="$mkerrors"
- mksyscall="go run mksyscall.go -l32 -openbsd -arm"
- mksysctl="go run mksysctl_openbsd.go"
- mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
- # Let the type of C char be signed for making the bare syscall
- # API consistent across platforms.
- mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
- ;;
-openbsd_arm64)
- mkerrors="$mkerrors -m64"
- mksyscall="go run mksyscall.go -openbsd"
- mksysctl="go run mksysctl_openbsd.go"
- mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
- # Let the type of C char be signed for making the bare syscall
- # API consistent across platforms.
- mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
- ;;
-solaris_amd64)
- mksyscall="go run mksyscall_solaris.go"
- mkerrors="$mkerrors -m64"
- mksysnum=
- mktypes="GOARCH=$GOARCH go tool cgo -godefs"
- ;;
-*)
- echo 'unrecognized $GOOS_$GOARCH: ' "$GOOSARCH" 1>&2
- exit 1
- ;;
-esac
-
-(
- if [ -n "$mkerrors" ]; then echo "$mkerrors |gofmt >$zerrors"; fi
- case "$GOOS" in
- *)
- syscall_goos="syscall_$GOOS.go"
- case "$GOOS" in
- darwin | dragonfly | freebsd | netbsd | openbsd)
- syscall_goos="syscall_bsd.go $syscall_goos"
- ;;
- esac
- if [ -n "$mksyscall" ]; then
- if [ "$GOOSARCH" == "aix_ppc64" ]; then
- # aix/ppc64 script generates files instead of writing to stdin.
- echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in && gofmt -w zsyscall_$GOOSARCH.go && gofmt -w zsyscall_"$GOOSARCH"_gccgo.go && gofmt -w zsyscall_"$GOOSARCH"_gc.go " ;
- elif [ "$GOOS" == "darwin" ]; then
- # pre-1.12, direct syscalls
- echo "$mksyscall -tags $GOOS,$GOARCH,!go1.12 $syscall_goos syscall_darwin_${GOARCH}.1_11.go $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.1_11.go";
- # 1.12 and later, syscalls via libSystem
- echo "$mksyscall -tags $GOOS,$GOARCH,go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go";
- # 1.13 and later, syscalls via libSystem (including syscallPtr)
- echo "$mksyscall -tags $GOOS,$GOARCH,go1.13 syscall_darwin.1_13.go |gofmt >zsyscall_$GOOSARCH.1_13.go";
- else
- echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go";
- fi
- fi
- esac
- if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi
- if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi
- if [ -n "$mktypes" ]; then echo "$mktypes types_$GOOS.go | go run mkpost.go > ztypes_$GOOSARCH.go"; fi
- if [ -n "$mkasm" ]; then echo "$mkasm $GOARCH"; fi
-) | $run
diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh
deleted file mode 100644
index 6ffac92..0000000
--- a/vendor/golang.org/x/sys/unix/mkerrors.sh
+++ /dev/null
@@ -1,692 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2009 The Go Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-# Generate Go code listing errors and other #defined constant
-# values (ENAMETOOLONG etc.), by asking the preprocessor
-# about the definitions.
-
-unset LANG
-export LC_ALL=C
-export LC_CTYPE=C
-
-if test -z "$GOARCH" -o -z "$GOOS"; then
- echo 1>&2 "GOARCH or GOOS not defined in environment"
- exit 1
-fi
-
-# Check that we are using the new build system if we should
-if [[ "$GOOS" = "linux" ]] && [[ "$GOLANG_SYS_BUILD" != "docker" ]]; then
- echo 1>&2 "In the Docker based build system, mkerrors should not be called directly."
- echo 1>&2 "See README.md"
- exit 1
-fi
-
-if [[ "$GOOS" = "aix" ]]; then
- CC=${CC:-gcc}
-else
- CC=${CC:-cc}
-fi
-
-if [[ "$GOOS" = "solaris" ]]; then
- # Assumes GNU versions of utilities in PATH.
- export PATH=/usr/gnu/bin:$PATH
-fi
-
-uname=$(uname)
-
-includes_AIX='
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#define AF_LOCAL AF_UNIX
-'
-
-includes_Darwin='
-#define _DARWIN_C_SOURCE
-#define KERNEL
-#define _DARWIN_USE_64_BIT_INODE
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-'
-
-includes_DragonFly='
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-'
-
-includes_FreeBSD='
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#if __FreeBSD__ >= 10
-#define IFT_CARP 0xf8 // IFT_CARP is deprecated in FreeBSD 10
-#undef SIOCAIFADDR
-#define SIOCAIFADDR _IOW(105, 26, struct oifaliasreq) // ifaliasreq contains if_data
-#undef SIOCSIFPHYADDR
-#define SIOCSIFPHYADDR _IOW(105, 70, struct oifaliasreq) // ifaliasreq contains if_data
-#endif
-'
-
-includes_Linux='
-#define _LARGEFILE_SOURCE
-#define _LARGEFILE64_SOURCE
-#ifndef __LP64__
-#define _FILE_OFFSET_BITS 64
-#endif
-#define _GNU_SOURCE
-
-// is broken on powerpc64, as it fails to include definitions of
-// these structures. We just include them copied from .
-#if defined(__powerpc__)
-struct sgttyb {
- char sg_ispeed;
- char sg_ospeed;
- char sg_erase;
- char sg_kill;
- short sg_flags;
-};
-
-struct tchars {
- char t_intrc;
- char t_quitc;
- char t_startc;
- char t_stopc;
- char t_eofc;
- char t_brkc;
-};
-
-struct ltchars {
- char t_suspc;
- char t_dsuspc;
- char t_rprntc;
- char t_flushc;
- char t_werasc;
- char t_lnextc;
-};
-#endif
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-
-#if defined(__sparc__)
-// On sparc{,64}, the kernel defines struct termios2 itself which clashes with the
-// definition in glibc. As only the error constants are needed here, include the
-// generic termibits.h (which is included by termbits.h on sparc).
-#include
-#else
-#include
-#endif
-
-#ifndef MSG_FASTOPEN
-#define MSG_FASTOPEN 0x20000000
-#endif
-
-#ifndef PTRACE_GETREGS
-#define PTRACE_GETREGS 0xc
-#endif
-
-#ifndef PTRACE_SETREGS
-#define PTRACE_SETREGS 0xd
-#endif
-
-#ifndef SOL_NETLINK
-#define SOL_NETLINK 270
-#endif
-
-#ifdef SOL_BLUETOOTH
-// SPARC includes this in /usr/include/sparc64-linux-gnu/bits/socket.h
-// but it is already in bluetooth_linux.go
-#undef SOL_BLUETOOTH
-#endif
-
-// Certain constants are missing from the fs/crypto UAPI
-#define FS_KEY_DESC_PREFIX "fscrypt:"
-#define FS_KEY_DESC_PREFIX_SIZE 8
-#define FS_MAX_KEY_SIZE 64
-
-// The code generator produces -0x1 for (~0), but an unsigned value is necessary
-// for the tipc_subscr timeout __u32 field.
-#undef TIPC_WAIT_FOREVER
-#define TIPC_WAIT_FOREVER 0xffffffff
-'
-
-includes_NetBSD='
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-// Needed since refers to it...
-#define schedppq 1
-'
-
-includes_OpenBSD='
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-// We keep some constants not supported in OpenBSD 5.5 and beyond for
-// the promise of compatibility.
-#define EMUL_ENABLED 0x1
-#define EMUL_NATIVE 0x2
-#define IPV6_FAITH 0x1d
-#define IPV6_OPTIONS 0x1
-#define IPV6_RTHDR_STRICT 0x1
-#define IPV6_SOCKOPT_RESERVED1 0x3
-#define SIOCGIFGENERIC 0xc020693a
-#define SIOCSIFGENERIC 0x80206939
-#define WALTSIG 0x4
-'
-
-includes_SunOS='
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include