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.
 
 
 

217 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. type Property struct {
  70. }
  71. // TimeseriesDescriptor: The descriptions of a time series.
  72. type TimeseriesDescriptor struct {
  73. // Labels: The set of key-value pairs that describe this time series,
  74. // including target-specific labels and metric-specific labels.
  75. Labels map[string]string `json:"labels,omitempty"`
  76. // Metric: The name of the metric.
  77. Metric string `json:"metric,omitempty"`
  78. // Project: The project ID to which this time series belongs.
  79. Project string `json:"project,omitempty"`
  80. // Tags: A map of additional information.
  81. Tags map[string][]Property `json:"tags,omitempty"`
  82. // ForceSendFields is a list of field names (e.g. "Labels") to
  83. // unconditionally include in API requests. By default, fields with
  84. // empty values are omitted from API requests. However, any non-pointer,
  85. // non-interface field appearing in ForceSendFields will be sent to the
  86. // server regardless of whether the field is empty or not. This may be
  87. // used to include empty fields in Patch requests.
  88. ForceSendFields []string `json:"-"`
  89. // NullFields is a list of field names (e.g. "Labels") to include in API
  90. // requests with the JSON null value. By default, fields with empty
  91. // values are omitted from API requests. However, any field with an
  92. // empty value appearing in NullFields will be sent to the server as
  93. // null. It is an error if a field in this list has a non-empty value.
  94. // This may be used to include null fields in Patch requests.
  95. NullFields []string `json:"-"`
  96. }
  97. func (s *TimeseriesDescriptor) MarshalJSON() ([]byte, error) {
  98. type NoMethod TimeseriesDescriptor
  99. raw := NoMethod(*s)
  100. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  101. }
  102. // method id "mapofstrings.getMap":
  103. type AtlasGetMapCall struct {
  104. s *Service
  105. urlParams_ gensupport.URLParams
  106. ifNoneMatch_ string
  107. ctx_ context.Context
  108. header_ http.Header
  109. }
  110. // GetMap: Get a map.
  111. func (r *AtlasService) GetMap() *AtlasGetMapCall {
  112. c := &AtlasGetMapCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  113. return c
  114. }
  115. // Fields allows partial responses to be retrieved. See
  116. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  117. // for more information.
  118. func (c *AtlasGetMapCall) Fields(s ...googleapi.Field) *AtlasGetMapCall {
  119. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  120. return c
  121. }
  122. // IfNoneMatch sets the optional parameter which makes the operation
  123. // fail if the object's ETag matches the given value. This is useful for
  124. // getting updates only after the object has changed since the last
  125. // request. Use googleapi.IsNotModified to check whether the response
  126. // error from Do is the result of In-None-Match.
  127. func (c *AtlasGetMapCall) IfNoneMatch(entityTag string) *AtlasGetMapCall {
  128. c.ifNoneMatch_ = entityTag
  129. return c
  130. }
  131. // Context sets the context to be used in this call's Do method. Any
  132. // pending HTTP request will be aborted if the provided context is
  133. // canceled.
  134. func (c *AtlasGetMapCall) Context(ctx context.Context) *AtlasGetMapCall {
  135. c.ctx_ = ctx
  136. return c
  137. }
  138. // Header returns an http.Header that can be modified by the caller to
  139. // add HTTP headers to the request.
  140. func (c *AtlasGetMapCall) Header() http.Header {
  141. if c.header_ == nil {
  142. c.header_ = make(http.Header)
  143. }
  144. return c.header_
  145. }
  146. func (c *AtlasGetMapCall) doRequest(alt string) (*http.Response, error) {
  147. reqHeaders := make(http.Header)
  148. for k, v := range c.header_ {
  149. reqHeaders[k] = v
  150. }
  151. reqHeaders.Set("User-Agent", c.s.userAgent())
  152. if c.ifNoneMatch_ != "" {
  153. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  154. }
  155. var body io.Reader = nil
  156. c.urlParams_.Set("alt", alt)
  157. urls := googleapi.ResolveRelative(c.s.BasePath, "map")
  158. urls += "?" + c.urlParams_.Encode()
  159. req, _ := http.NewRequest("GET", urls, body)
  160. req.Header = reqHeaders
  161. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  162. }
  163. // Do executes the "mapofstrings.getMap" call.
  164. func (c *AtlasGetMapCall) Do(opts ...googleapi.CallOption) (map[string]string, error) {
  165. gensupport.SetOptions(c.urlParams_, opts...)
  166. res, err := c.doRequest("json")
  167. if err != nil {
  168. return nil, err
  169. }
  170. defer googleapi.CloseBody(res)
  171. if err := googleapi.CheckResponse(res); err != nil {
  172. return nil, err
  173. }
  174. var ret map[string]string
  175. target := &ret
  176. if err := gensupport.DecodeResponse(target, res); err != nil {
  177. return nil, err
  178. }
  179. return ret, nil
  180. // {
  181. // "description": "Get a map.",
  182. // "httpMethod": "GET",
  183. // "id": "mapofstrings.getMap",
  184. // "path": "map",
  185. // "response": {
  186. // "$ref": "GetMapResponse"
  187. // }
  188. // }
  189. }