Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

115 wiersze
3.1 KiB

  1. // Package x provides access to the X.
  2. //
  3. // See https://cloud.google.com/appengine/docs/admin-api/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/x/v1"
  8. // ...
  9. // xService, err := x.New(oauthHttpClient)
  10. package x // import "google.golang.org/api/x/v1"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "X:v1"
  41. const apiName = "X"
  42. const apiVersion = "v1"
  43. const basePath = "https://appengine.googleapis.com/"
  44. func New(client *http.Client) (*Service, error) {
  45. if client == nil {
  46. return nil, errors.New("client is nil")
  47. }
  48. s := &Service{client: client, BasePath: basePath}
  49. return s, nil
  50. }
  51. type Service struct {
  52. client *http.Client
  53. BasePath string // API endpoint base URL
  54. UserAgent string // optional additional User-Agent fragment
  55. }
  56. func (s *Service) userAgent() string {
  57. if s.UserAgent == "" {
  58. return googleapi.UserAgent
  59. }
  60. return googleapi.UserAgent + " " + s.UserAgent
  61. }
  62. // Utilization: CPU utilization policy.
  63. type Utilization struct {
  64. Average float64 `json:"average,omitempty"`
  65. Count int64 `json:"count,omitempty"`
  66. Target float64 `json:"target,omitempty"`
  67. // ForceSendFields is a list of field names (e.g. "Average") to
  68. // unconditionally include in API requests. By default, fields with
  69. // empty values are omitted from API requests. However, any non-pointer,
  70. // non-interface field appearing in ForceSendFields will be sent to the
  71. // server regardless of whether the field is empty or not. This may be
  72. // used to include empty fields in Patch requests.
  73. ForceSendFields []string `json:"-"`
  74. // NullFields is a list of field names (e.g. "Average") to include in
  75. // API requests with the JSON null value. By default, fields with empty
  76. // values are omitted from API requests. However, any field with an
  77. // empty value appearing in NullFields will be sent to the server as
  78. // null. It is an error if a field in this list has a non-empty value.
  79. // This may be used to include null fields in Patch requests.
  80. NullFields []string `json:"-"`
  81. }
  82. func (s *Utilization) MarshalJSON() ([]byte, error) {
  83. type NoMethod Utilization
  84. raw := NoMethod(*s)
  85. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  86. }
  87. func (s *Utilization) UnmarshalJSON(data []byte) error {
  88. type NoMethod Utilization
  89. var s1 struct {
  90. Average gensupport.JSONFloat64 `json:"average"`
  91. Target gensupport.JSONFloat64 `json:"target"`
  92. *NoMethod
  93. }
  94. s1.NoMethod = (*NoMethod)(s)
  95. if err := json.Unmarshal(data, &s1); err != nil {
  96. return err
  97. }
  98. s.Average = float64(s1.Average)
  99. s.Target = float64(s1.Target)
  100. return nil
  101. }