Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

268 rindas
8.0 KiB

  1. // Copyright YEAR Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package additionalprops provides access to the Example API.
  6. //
  7. // Creating a client
  8. //
  9. // Usage example:
  10. //
  11. // import "google.golang.org/api/additionalprops/v1"
  12. // ...
  13. // ctx := context.Background()
  14. // additionalpropsService, err := additionalprops.NewService(ctx)
  15. //
  16. // In this example, Google Application Default Credentials are used for authentication.
  17. //
  18. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  19. //
  20. // Other authentication options
  21. //
  22. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  23. //
  24. // additionalpropsService, err := additionalprops.NewService(ctx, option.WithAPIKey("AIza..."))
  25. //
  26. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  27. //
  28. // config := &oauth2.Config{...}
  29. // // ...
  30. // token, err := config.Exchange(ctx, ...)
  31. // additionalpropsService, err := additionalprops.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  32. //
  33. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  34. package additionalprops // import "google.golang.org/api/additionalprops/v1"
  35. import (
  36. "bytes"
  37. "context"
  38. "encoding/json"
  39. "errors"
  40. "fmt"
  41. "io"
  42. "net/http"
  43. "net/url"
  44. "strconv"
  45. "strings"
  46. gensupport "google.golang.org/api/gensupport"
  47. googleapi "google.golang.org/api/googleapi"
  48. option "google.golang.org/api/option"
  49. htransport "google.golang.org/api/transport/http"
  50. )
  51. // Always reference these packages, just in case the auto-generated code
  52. // below doesn't.
  53. var _ = bytes.NewBuffer
  54. var _ = strconv.Itoa
  55. var _ = fmt.Sprintf
  56. var _ = json.NewDecoder
  57. var _ = io.Copy
  58. var _ = url.Parse
  59. var _ = gensupport.MarshalJSON
  60. var _ = googleapi.Version
  61. var _ = errors.New
  62. var _ = strings.Replace
  63. var _ = context.Canceled
  64. const apiId = "additionalprops:v1"
  65. const apiName = "additionalprops"
  66. const apiVersion = "v1"
  67. const basePath = "https://www.googleapis.com/discovery/v1/apis"
  68. // NewService creates a new Service.
  69. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  70. client, endpoint, err := htransport.NewClient(ctx, opts...)
  71. if err != nil {
  72. return nil, err
  73. }
  74. s, err := New(client)
  75. if err != nil {
  76. return nil, err
  77. }
  78. if endpoint != "" {
  79. s.BasePath = endpoint
  80. }
  81. return s, nil
  82. }
  83. // New creates a new Service. It uses the provided http.Client for requests.
  84. //
  85. // Deprecated: please use NewService instead.
  86. // To provide a custom HTTP client, use option.WithHTTPClient.
  87. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  88. func New(client *http.Client) (*Service, error) {
  89. if client == nil {
  90. return nil, errors.New("client is nil")
  91. }
  92. s := &Service{client: client, BasePath: basePath}
  93. s.Atlas = NewAtlasService(s)
  94. return s, nil
  95. }
  96. type Service struct {
  97. client *http.Client
  98. BasePath string // API endpoint base URL
  99. UserAgent string // optional additional User-Agent fragment
  100. Atlas *AtlasService
  101. }
  102. func (s *Service) userAgent() string {
  103. if s.UserAgent == "" {
  104. return googleapi.UserAgent
  105. }
  106. return googleapi.UserAgent + " " + s.UserAgent
  107. }
  108. func NewAtlasService(s *Service) *AtlasService {
  109. rs := &AtlasService{s: s}
  110. return rs
  111. }
  112. type AtlasService struct {
  113. s *Service
  114. }
  115. // TimeseriesDescriptor: The descriptions of a time series.
  116. type TimeseriesDescriptor struct {
  117. // Labels: The set of key-value pairs that describe this time series,
  118. // including target-specific labels and metric-specific labels.
  119. Labels map[string]string `json:"labels,omitempty"`
  120. // Metric: The name of the metric.
  121. Metric string `json:"metric,omitempty"`
  122. // Project: The project ID to which this time series belongs.
  123. Project string `json:"project,omitempty"`
  124. // Tags: A map of additional information.
  125. Tags map[string][]string `json:"tags,omitempty"`
  126. // ForceSendFields is a list of field names (e.g. "Labels") to
  127. // unconditionally include in API requests. By default, fields with
  128. // empty values are omitted from API requests. However, any non-pointer,
  129. // non-interface field appearing in ForceSendFields will be sent to the
  130. // server regardless of whether the field is empty or not. This may be
  131. // used to include empty fields in Patch requests.
  132. ForceSendFields []string `json:"-"`
  133. // NullFields is a list of field names (e.g. "Labels") to include in API
  134. // requests with the JSON null value. By default, fields with empty
  135. // values are omitted from API requests. However, any field with an
  136. // empty value appearing in NullFields will be sent to the server as
  137. // null. It is an error if a field in this list has a non-empty value.
  138. // This may be used to include null fields in Patch requests.
  139. NullFields []string `json:"-"`
  140. }
  141. func (s *TimeseriesDescriptor) MarshalJSON() ([]byte, error) {
  142. type NoMethod TimeseriesDescriptor
  143. raw := NoMethod(*s)
  144. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  145. }
  146. // method id "mapofstrings.getMap":
  147. type AtlasGetMapCall struct {
  148. s *Service
  149. urlParams_ gensupport.URLParams
  150. ifNoneMatch_ string
  151. ctx_ context.Context
  152. header_ http.Header
  153. }
  154. // GetMap: Get a map.
  155. func (r *AtlasService) GetMap() *AtlasGetMapCall {
  156. c := &AtlasGetMapCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  157. return c
  158. }
  159. // Fields allows partial responses to be retrieved. See
  160. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  161. // for more information.
  162. func (c *AtlasGetMapCall) Fields(s ...googleapi.Field) *AtlasGetMapCall {
  163. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  164. return c
  165. }
  166. // IfNoneMatch sets the optional parameter which makes the operation
  167. // fail if the object's ETag matches the given value. This is useful for
  168. // getting updates only after the object has changed since the last
  169. // request. Use googleapi.IsNotModified to check whether the response
  170. // error from Do is the result of In-None-Match.
  171. func (c *AtlasGetMapCall) IfNoneMatch(entityTag string) *AtlasGetMapCall {
  172. c.ifNoneMatch_ = entityTag
  173. return c
  174. }
  175. // Context sets the context to be used in this call's Do method. Any
  176. // pending HTTP request will be aborted if the provided context is
  177. // canceled.
  178. func (c *AtlasGetMapCall) Context(ctx context.Context) *AtlasGetMapCall {
  179. c.ctx_ = ctx
  180. return c
  181. }
  182. // Header returns an http.Header that can be modified by the caller to
  183. // add HTTP headers to the request.
  184. func (c *AtlasGetMapCall) Header() http.Header {
  185. if c.header_ == nil {
  186. c.header_ = make(http.Header)
  187. }
  188. return c.header_
  189. }
  190. func (c *AtlasGetMapCall) doRequest(alt string) (*http.Response, error) {
  191. reqHeaders := make(http.Header)
  192. for k, v := range c.header_ {
  193. reqHeaders[k] = v
  194. }
  195. reqHeaders.Set("User-Agent", c.s.userAgent())
  196. if c.ifNoneMatch_ != "" {
  197. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  198. }
  199. var body io.Reader = nil
  200. c.urlParams_.Set("alt", alt)
  201. c.urlParams_.Set("prettyPrint", "false")
  202. urls := googleapi.ResolveRelative(c.s.BasePath, "map")
  203. urls += "?" + c.urlParams_.Encode()
  204. req, err := http.NewRequest("GET", urls, body)
  205. if err != nil {
  206. return nil, err
  207. }
  208. req.Header = reqHeaders
  209. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  210. }
  211. // Do executes the "mapofstrings.getMap" call.
  212. func (c *AtlasGetMapCall) Do(opts ...googleapi.CallOption) (map[string]string, error) {
  213. gensupport.SetOptions(c.urlParams_, opts...)
  214. res, err := c.doRequest("json")
  215. if err != nil {
  216. return nil, err
  217. }
  218. defer googleapi.CloseBody(res)
  219. if err := googleapi.CheckResponse(res); err != nil {
  220. return nil, err
  221. }
  222. var ret map[string]string
  223. target := &ret
  224. if err := gensupport.DecodeResponse(target, res); err != nil {
  225. return nil, err
  226. }
  227. return ret, nil
  228. // {
  229. // "description": "Get a map.",
  230. // "httpMethod": "GET",
  231. // "id": "mapofstrings.getMap",
  232. // "path": "map",
  233. // "response": {
  234. // "$ref": "GetMapResponse"
  235. // }
  236. // }
  237. }