You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

214 lines
6.1 KiB

  1. // Package additionalprops provides access to the Example API.
  2. //
  3. // Usage example:
  4. //
  5. // import "google.golang.org/api/additionalprops/v1"
  6. // ...
  7. // additionalpropsService, err := additionalprops.New(oauthHttpClient)
  8. package additionalprops // import "google.golang.org/api/additionalprops/v1"
  9. import (
  10. "bytes"
  11. "encoding/json"
  12. "errors"
  13. "fmt"
  14. context "golang.org/x/net/context"
  15. ctxhttp "golang.org/x/net/context/ctxhttp"
  16. gensupport "google.golang.org/api/gensupport"
  17. googleapi "google.golang.org/api/googleapi"
  18. "io"
  19. "net/http"
  20. "net/url"
  21. "strconv"
  22. "strings"
  23. )
  24. // Always reference these packages, just in case the auto-generated code
  25. // below doesn't.
  26. var _ = bytes.NewBuffer
  27. var _ = strconv.Itoa
  28. var _ = fmt.Sprintf
  29. var _ = json.NewDecoder
  30. var _ = io.Copy
  31. var _ = url.Parse
  32. var _ = gensupport.MarshalJSON
  33. var _ = googleapi.Version
  34. var _ = errors.New
  35. var _ = strings.Replace
  36. var _ = context.Canceled
  37. var _ = ctxhttp.Do
  38. const apiId = "additionalprops:v1"
  39. const apiName = "additionalprops"
  40. const apiVersion = "v1"
  41. const basePath = "https://www.googleapis.com/discovery/v1/apis"
  42. func New(client *http.Client) (*Service, error) {
  43. if client == nil {
  44. return nil, errors.New("client is nil")
  45. }
  46. s := &Service{client: client, BasePath: basePath}
  47. s.Atlas = NewAtlasService(s)
  48. return s, nil
  49. }
  50. type Service struct {
  51. client *http.Client
  52. BasePath string // API endpoint base URL
  53. UserAgent string // optional additional User-Agent fragment
  54. Atlas *AtlasService
  55. }
  56. func (s *Service) userAgent() string {
  57. if s.UserAgent == "" {
  58. return googleapi.UserAgent
  59. }
  60. return googleapi.UserAgent + " " + s.UserAgent
  61. }
  62. func NewAtlasService(s *Service) *AtlasService {
  63. rs := &AtlasService{s: s}
  64. return rs
  65. }
  66. type AtlasService struct {
  67. s *Service
  68. }
  69. // TimeseriesDescriptor: The descriptions of a time series.
  70. type TimeseriesDescriptor struct {
  71. // Labels: The set of key-value pairs that describe this time series,
  72. // including target-specific labels and metric-specific labels.
  73. Labels map[string]string `json:"labels,omitempty"`
  74. // Metric: The name of the metric.
  75. Metric string `json:"metric,omitempty"`
  76. // Project: The project ID to which this time series belongs.
  77. Project string `json:"project,omitempty"`
  78. // Tags: A map of additional information.
  79. Tags map[string][]string `json:"tags,omitempty"`
  80. // ForceSendFields is a list of field names (e.g. "Labels") to
  81. // unconditionally include in API requests. By default, fields with
  82. // empty values are omitted from API requests. However, any non-pointer,
  83. // non-interface field appearing in ForceSendFields will be sent to the
  84. // server regardless of whether the field is empty or not. This may be
  85. // used to include empty fields in Patch requests.
  86. ForceSendFields []string `json:"-"`
  87. // NullFields is a list of field names (e.g. "Labels") to include in API
  88. // requests with the JSON null value. By default, fields with empty
  89. // values are omitted from API requests. However, any field with an
  90. // empty value appearing in NullFields will be sent to the server as
  91. // null. It is an error if a field in this list has a non-empty value.
  92. // This may be used to include null fields in Patch requests.
  93. NullFields []string `json:"-"`
  94. }
  95. func (s *TimeseriesDescriptor) MarshalJSON() ([]byte, error) {
  96. type NoMethod TimeseriesDescriptor
  97. raw := NoMethod(*s)
  98. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  99. }
  100. // method id "mapofstrings.getMap":
  101. type AtlasGetMapCall struct {
  102. s *Service
  103. urlParams_ gensupport.URLParams
  104. ifNoneMatch_ string
  105. ctx_ context.Context
  106. header_ http.Header
  107. }
  108. // GetMap: Get a map.
  109. func (r *AtlasService) GetMap() *AtlasGetMapCall {
  110. c := &AtlasGetMapCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  111. return c
  112. }
  113. // Fields allows partial responses to be retrieved. See
  114. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  115. // for more information.
  116. func (c *AtlasGetMapCall) Fields(s ...googleapi.Field) *AtlasGetMapCall {
  117. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  118. return c
  119. }
  120. // IfNoneMatch sets the optional parameter which makes the operation
  121. // fail if the object's ETag matches the given value. This is useful for
  122. // getting updates only after the object has changed since the last
  123. // request. Use googleapi.IsNotModified to check whether the response
  124. // error from Do is the result of In-None-Match.
  125. func (c *AtlasGetMapCall) IfNoneMatch(entityTag string) *AtlasGetMapCall {
  126. c.ifNoneMatch_ = entityTag
  127. return c
  128. }
  129. // Context sets the context to be used in this call's Do method. Any
  130. // pending HTTP request will be aborted if the provided context is
  131. // canceled.
  132. func (c *AtlasGetMapCall) Context(ctx context.Context) *AtlasGetMapCall {
  133. c.ctx_ = ctx
  134. return c
  135. }
  136. // Header returns an http.Header that can be modified by the caller to
  137. // add HTTP headers to the request.
  138. func (c *AtlasGetMapCall) Header() http.Header {
  139. if c.header_ == nil {
  140. c.header_ = make(http.Header)
  141. }
  142. return c.header_
  143. }
  144. func (c *AtlasGetMapCall) doRequest(alt string) (*http.Response, error) {
  145. reqHeaders := make(http.Header)
  146. for k, v := range c.header_ {
  147. reqHeaders[k] = v
  148. }
  149. reqHeaders.Set("User-Agent", c.s.userAgent())
  150. if c.ifNoneMatch_ != "" {
  151. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  152. }
  153. var body io.Reader = nil
  154. c.urlParams_.Set("alt", alt)
  155. urls := googleapi.ResolveRelative(c.s.BasePath, "map")
  156. urls += "?" + c.urlParams_.Encode()
  157. req, _ := http.NewRequest("GET", urls, body)
  158. req.Header = reqHeaders
  159. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  160. }
  161. // Do executes the "mapofstrings.getMap" call.
  162. func (c *AtlasGetMapCall) Do(opts ...googleapi.CallOption) (map[string]string, error) {
  163. gensupport.SetOptions(c.urlParams_, opts...)
  164. res, err := c.doRequest("json")
  165. if err != nil {
  166. return nil, err
  167. }
  168. defer googleapi.CloseBody(res)
  169. if err := googleapi.CheckResponse(res); err != nil {
  170. return nil, err
  171. }
  172. var ret map[string]string
  173. target := &ret
  174. if err := gensupport.DecodeResponse(target, res); err != nil {
  175. return nil, err
  176. }
  177. return ret, nil
  178. // {
  179. // "description": "Get a map.",
  180. // "httpMethod": "GET",
  181. // "id": "mapofstrings.getMap",
  182. // "path": "map",
  183. // "response": {
  184. // "$ref": "GetMapResponse"
  185. // }
  186. // }
  187. }