Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 

1189 řádky
43 KiB

  1. // Copyright 2019 Google Inc. All rights reserved.
  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 monitoring provides access to the Stackdriver Monitoring API.
  6. //
  7. // This package is DEPRECATED. Use package cloud.google.com/go/monitoring/apiv3 instead.
  8. //
  9. // See https://cloud.google.com/monitoring/api/
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/monitoring/v1"
  14. // ...
  15. // monitoringService, err := monitoring.New(oauthHttpClient)
  16. package monitoring // import "google.golang.org/api/monitoring/v1"
  17. import (
  18. "bytes"
  19. "context"
  20. "encoding/json"
  21. "errors"
  22. "fmt"
  23. "io"
  24. "net/http"
  25. "net/url"
  26. "strconv"
  27. "strings"
  28. gensupport "google.golang.org/api/gensupport"
  29. googleapi "google.golang.org/api/googleapi"
  30. )
  31. // Always reference these packages, just in case the auto-generated code
  32. // below doesn't.
  33. var _ = bytes.NewBuffer
  34. var _ = strconv.Itoa
  35. var _ = fmt.Sprintf
  36. var _ = json.NewDecoder
  37. var _ = io.Copy
  38. var _ = url.Parse
  39. var _ = gensupport.MarshalJSON
  40. var _ = googleapi.Version
  41. var _ = errors.New
  42. var _ = strings.Replace
  43. var _ = context.Canceled
  44. const apiId = "monitoring:v1"
  45. const apiName = "monitoring"
  46. const apiVersion = "v1"
  47. const basePath = "https://monitoring.googleapis.com/"
  48. func New(client *http.Client) (*Service, error) {
  49. if client == nil {
  50. return nil, errors.New("client is nil")
  51. }
  52. s := &Service{client: client, BasePath: basePath}
  53. s.Operations = NewOperationsService(s)
  54. return s, nil
  55. }
  56. type Service struct {
  57. client *http.Client
  58. BasePath string // API endpoint base URL
  59. UserAgent string // optional additional User-Agent fragment
  60. Operations *OperationsService
  61. }
  62. func (s *Service) userAgent() string {
  63. if s.UserAgent == "" {
  64. return googleapi.UserAgent
  65. }
  66. return googleapi.UserAgent + " " + s.UserAgent
  67. }
  68. func NewOperationsService(s *Service) *OperationsService {
  69. rs := &OperationsService{s: s}
  70. return rs
  71. }
  72. type OperationsService struct {
  73. s *Service
  74. }
  75. // CancelOperationRequest: The request message for
  76. // Operations.CancelOperation.
  77. type CancelOperationRequest struct {
  78. }
  79. // DroppedLabels: A set of (label, value) pairs which were dropped
  80. // during aggregation, attached to google.api.Distribution.Exemplars in
  81. // google.api.Distribution values during aggregation.These values are
  82. // used in combination with the label values that remain on the
  83. // aggregated Distribution timeseries to construct the full label set
  84. // for the exemplar values. The resulting full label set may be used to
  85. // identify the specific task/job/instance (for example) which may be
  86. // contributing to a long-tail, while allowing the storage savings of
  87. // only storing aggregated distribution values for a large group.Note
  88. // that there are no guarantees on ordering of the labels from
  89. // exemplar-to-exemplar and from distribution-to-distribution in the
  90. // same stream, and there may be duplicates. It is up to clients to
  91. // resolve any ambiguities.
  92. type DroppedLabels struct {
  93. // Label: Map from label to its value, for all labels dropped in any
  94. // aggregation.
  95. Label map[string]string `json:"label,omitempty"`
  96. // ForceSendFields is a list of field names (e.g. "Label") to
  97. // unconditionally include in API requests. By default, fields with
  98. // empty values are omitted from API requests. However, any non-pointer,
  99. // non-interface field appearing in ForceSendFields will be sent to the
  100. // server regardless of whether the field is empty or not. This may be
  101. // used to include empty fields in Patch requests.
  102. ForceSendFields []string `json:"-"`
  103. // NullFields is a list of field names (e.g. "Label") to include in API
  104. // requests with the JSON null value. By default, fields with empty
  105. // values are omitted from API requests. However, any field with an
  106. // empty value appearing in NullFields will be sent to the server as
  107. // null. It is an error if a field in this list has a non-empty value.
  108. // This may be used to include null fields in Patch requests.
  109. NullFields []string `json:"-"`
  110. }
  111. func (s *DroppedLabels) MarshalJSON() ([]byte, error) {
  112. type NoMethod DroppedLabels
  113. raw := NoMethod(*s)
  114. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  115. }
  116. // Empty: A generic empty message that you can re-use to avoid defining
  117. // duplicated empty messages in your APIs. A typical example is to use
  118. // it as the request or the response type of an API method. For
  119. // instance:
  120. // service Foo {
  121. // rpc Bar(google.protobuf.Empty) returns
  122. // (google.protobuf.Empty);
  123. // }
  124. // The JSON representation for Empty is empty JSON object {}.
  125. type Empty struct {
  126. // ServerResponse contains the HTTP response code and headers from the
  127. // server.
  128. googleapi.ServerResponse `json:"-"`
  129. }
  130. // Field: A single field of a message type.
  131. type Field struct {
  132. // Cardinality: The field cardinality.
  133. //
  134. // Possible values:
  135. // "CARDINALITY_UNKNOWN" - For fields with unknown cardinality.
  136. // "CARDINALITY_OPTIONAL" - For optional fields.
  137. // "CARDINALITY_REQUIRED" - For required fields. Proto2 syntax only.
  138. // "CARDINALITY_REPEATED" - For repeated fields.
  139. Cardinality string `json:"cardinality,omitempty"`
  140. // DefaultValue: The string value of the default value of this field.
  141. // Proto2 syntax only.
  142. DefaultValue string `json:"defaultValue,omitempty"`
  143. // JsonName: The field JSON name.
  144. JsonName string `json:"jsonName,omitempty"`
  145. // Kind: The field type.
  146. //
  147. // Possible values:
  148. // "TYPE_UNKNOWN" - Field type unknown.
  149. // "TYPE_DOUBLE" - Field type double.
  150. // "TYPE_FLOAT" - Field type float.
  151. // "TYPE_INT64" - Field type int64.
  152. // "TYPE_UINT64" - Field type uint64.
  153. // "TYPE_INT32" - Field type int32.
  154. // "TYPE_FIXED64" - Field type fixed64.
  155. // "TYPE_FIXED32" - Field type fixed32.
  156. // "TYPE_BOOL" - Field type bool.
  157. // "TYPE_STRING" - Field type string.
  158. // "TYPE_GROUP" - Field type group. Proto2 syntax only, and
  159. // deprecated.
  160. // "TYPE_MESSAGE" - Field type message.
  161. // "TYPE_BYTES" - Field type bytes.
  162. // "TYPE_UINT32" - Field type uint32.
  163. // "TYPE_ENUM" - Field type enum.
  164. // "TYPE_SFIXED32" - Field type sfixed32.
  165. // "TYPE_SFIXED64" - Field type sfixed64.
  166. // "TYPE_SINT32" - Field type sint32.
  167. // "TYPE_SINT64" - Field type sint64.
  168. Kind string `json:"kind,omitempty"`
  169. // Name: The field name.
  170. Name string `json:"name,omitempty"`
  171. // Number: The field number.
  172. Number int64 `json:"number,omitempty"`
  173. // OneofIndex: The index of the field type in Type.oneofs, for message
  174. // or enumeration types. The first type has index 1; zero means the type
  175. // is not in the list.
  176. OneofIndex int64 `json:"oneofIndex,omitempty"`
  177. // Options: The protocol buffer options.
  178. Options []*Option `json:"options,omitempty"`
  179. // Packed: Whether to use alternative packed wire representation.
  180. Packed bool `json:"packed,omitempty"`
  181. // TypeUrl: The field type URL, without the scheme, for message or
  182. // enumeration types. Example:
  183. // "type.googleapis.com/google.protobuf.Timestamp".
  184. TypeUrl string `json:"typeUrl,omitempty"`
  185. // ForceSendFields is a list of field names (e.g. "Cardinality") to
  186. // unconditionally include in API requests. By default, fields with
  187. // empty values are omitted from API requests. However, any non-pointer,
  188. // non-interface field appearing in ForceSendFields will be sent to the
  189. // server regardless of whether the field is empty or not. This may be
  190. // used to include empty fields in Patch requests.
  191. ForceSendFields []string `json:"-"`
  192. // NullFields is a list of field names (e.g. "Cardinality") to include
  193. // in API requests with the JSON null value. By default, fields with
  194. // empty values are omitted from API requests. However, any field with
  195. // an empty value appearing in NullFields will be sent to the server as
  196. // null. It is an error if a field in this list has a non-empty value.
  197. // This may be used to include null fields in Patch requests.
  198. NullFields []string `json:"-"`
  199. }
  200. func (s *Field) MarshalJSON() ([]byte, error) {
  201. type NoMethod Field
  202. raw := NoMethod(*s)
  203. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  204. }
  205. // ListOperationsResponse: The response message for
  206. // Operations.ListOperations.
  207. type ListOperationsResponse struct {
  208. // NextPageToken: The standard List next-page token.
  209. NextPageToken string `json:"nextPageToken,omitempty"`
  210. // Operations: A list of operations that matches the specified filter in
  211. // the request.
  212. Operations []*Operation `json:"operations,omitempty"`
  213. // ServerResponse contains the HTTP response code and headers from the
  214. // server.
  215. googleapi.ServerResponse `json:"-"`
  216. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  217. // unconditionally include in API requests. By default, fields with
  218. // empty values are omitted from API requests. However, any non-pointer,
  219. // non-interface field appearing in ForceSendFields will be sent to the
  220. // server regardless of whether the field is empty or not. This may be
  221. // used to include empty fields in Patch requests.
  222. ForceSendFields []string `json:"-"`
  223. // NullFields is a list of field names (e.g. "NextPageToken") to include
  224. // in API requests with the JSON null value. By default, fields with
  225. // empty values are omitted from API requests. However, any field with
  226. // an empty value appearing in NullFields will be sent to the server as
  227. // null. It is an error if a field in this list has a non-empty value.
  228. // This may be used to include null fields in Patch requests.
  229. NullFields []string `json:"-"`
  230. }
  231. func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) {
  232. type NoMethod ListOperationsResponse
  233. raw := NoMethod(*s)
  234. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  235. }
  236. // Operation: This resource represents a long-running operation that is
  237. // the result of a network API call.
  238. type Operation struct {
  239. // Done: If the value is false, it means the operation is still in
  240. // progress. If true, the operation is completed, and either error or
  241. // response is available.
  242. Done bool `json:"done,omitempty"`
  243. // Error: The error result of the operation in case of failure or
  244. // cancellation.
  245. Error *Status `json:"error,omitempty"`
  246. // Metadata: Service-specific metadata associated with the operation. It
  247. // typically contains progress information and common metadata such as
  248. // create time. Some services might not provide such metadata. Any
  249. // method that returns a long-running operation should document the
  250. // metadata type, if any.
  251. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  252. // Name: The server-assigned name, which is only unique within the same
  253. // service that originally returns it. If you use the default HTTP
  254. // mapping, the name should have the format of
  255. // operations/some/unique/name.
  256. Name string `json:"name,omitempty"`
  257. // Response: The normal response of the operation in case of success. If
  258. // the original method returns no data on success, such as Delete, the
  259. // response is google.protobuf.Empty. If the original method is standard
  260. // Get/Create/Update, the response should be the resource. For other
  261. // methods, the response should have the type XxxResponse, where Xxx is
  262. // the original method name. For example, if the original method name is
  263. // TakeSnapshot(), the inferred response type is TakeSnapshotResponse.
  264. Response googleapi.RawMessage `json:"response,omitempty"`
  265. // ServerResponse contains the HTTP response code and headers from the
  266. // server.
  267. googleapi.ServerResponse `json:"-"`
  268. // ForceSendFields is a list of field names (e.g. "Done") to
  269. // unconditionally include in API requests. By default, fields with
  270. // empty values are omitted from API requests. However, any non-pointer,
  271. // non-interface field appearing in ForceSendFields will be sent to the
  272. // server regardless of whether the field is empty or not. This may be
  273. // used to include empty fields in Patch requests.
  274. ForceSendFields []string `json:"-"`
  275. // NullFields is a list of field names (e.g. "Done") to include in API
  276. // requests with the JSON null value. By default, fields with empty
  277. // values are omitted from API requests. However, any field with an
  278. // empty value appearing in NullFields will be sent to the server as
  279. // null. It is an error if a field in this list has a non-empty value.
  280. // This may be used to include null fields in Patch requests.
  281. NullFields []string `json:"-"`
  282. }
  283. func (s *Operation) MarshalJSON() ([]byte, error) {
  284. type NoMethod Operation
  285. raw := NoMethod(*s)
  286. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  287. }
  288. // Option: A protocol buffer option, which can be attached to a message,
  289. // field, enumeration, etc.
  290. type Option struct {
  291. // Name: The option's name. For protobuf built-in options (options
  292. // defined in descriptor.proto), this is the short name. For example,
  293. // "map_entry". For custom options, it should be the fully-qualified
  294. // name. For example, "google.api.http".
  295. Name string `json:"name,omitempty"`
  296. // Value: The option's value packed in an Any message. If the value is a
  297. // primitive, the corresponding wrapper type defined in
  298. // google/protobuf/wrappers.proto should be used. If the value is an
  299. // enum, it should be stored as an int32 value using the
  300. // google.protobuf.Int32Value type.
  301. Value googleapi.RawMessage `json:"value,omitempty"`
  302. // ForceSendFields is a list of field names (e.g. "Name") to
  303. // unconditionally include in API requests. By default, fields with
  304. // empty values are omitted from API requests. However, any non-pointer,
  305. // non-interface field appearing in ForceSendFields will be sent to the
  306. // server regardless of whether the field is empty or not. This may be
  307. // used to include empty fields in Patch requests.
  308. ForceSendFields []string `json:"-"`
  309. // NullFields is a list of field names (e.g. "Name") to include in API
  310. // requests with the JSON null value. By default, fields with empty
  311. // values are omitted from API requests. However, any field with an
  312. // empty value appearing in NullFields will be sent to the server as
  313. // null. It is an error if a field in this list has a non-empty value.
  314. // This may be used to include null fields in Patch requests.
  315. NullFields []string `json:"-"`
  316. }
  317. func (s *Option) MarshalJSON() ([]byte, error) {
  318. type NoMethod Option
  319. raw := NoMethod(*s)
  320. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  321. }
  322. // SourceContext: SourceContext represents information about the source
  323. // of a protobuf element, like the file in which it is defined.
  324. type SourceContext struct {
  325. // FileName: The path-qualified name of the .proto file that contained
  326. // the associated protobuf element. For example:
  327. // "google/protobuf/source_context.proto".
  328. FileName string `json:"fileName,omitempty"`
  329. // ForceSendFields is a list of field names (e.g. "FileName") to
  330. // unconditionally include in API requests. By default, fields with
  331. // empty values are omitted from API requests. However, any non-pointer,
  332. // non-interface field appearing in ForceSendFields will be sent to the
  333. // server regardless of whether the field is empty or not. This may be
  334. // used to include empty fields in Patch requests.
  335. ForceSendFields []string `json:"-"`
  336. // NullFields is a list of field names (e.g. "FileName") to include in
  337. // API requests with the JSON null value. By default, fields with empty
  338. // values are omitted from API requests. However, any field with an
  339. // empty value appearing in NullFields will be sent to the server as
  340. // null. It is an error if a field in this list has a non-empty value.
  341. // This may be used to include null fields in Patch requests.
  342. NullFields []string `json:"-"`
  343. }
  344. func (s *SourceContext) MarshalJSON() ([]byte, error) {
  345. type NoMethod SourceContext
  346. raw := NoMethod(*s)
  347. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  348. }
  349. // SpanContext: The context of a span, attached to
  350. // google.api.Distribution.Exemplars in google.api.Distribution values
  351. // during aggregation.It contains the name of a span with format:
  352. // projects/PROJECT_ID/traces/TRACE_ID/spans/SPAN_ID
  353. type SpanContext struct {
  354. // SpanName: The resource name of the span in the following
  355. // format:
  356. // projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID]
  357. // TRACE_
  358. // ID is a unique identifier for a trace within a project; it is a
  359. // 32-character hexadecimal encoding of a 16-byte array.SPAN_ID is a
  360. // unique identifier for a span within a trace; it is a 16-character
  361. // hexadecimal encoding of an 8-byte array.
  362. SpanName string `json:"spanName,omitempty"`
  363. // ForceSendFields is a list of field names (e.g. "SpanName") to
  364. // unconditionally include in API requests. By default, fields with
  365. // empty values are omitted from API requests. However, any non-pointer,
  366. // non-interface field appearing in ForceSendFields will be sent to the
  367. // server regardless of whether the field is empty or not. This may be
  368. // used to include empty fields in Patch requests.
  369. ForceSendFields []string `json:"-"`
  370. // NullFields is a list of field names (e.g. "SpanName") to include in
  371. // API requests with the JSON null value. By default, fields with empty
  372. // values are omitted from API requests. However, any field with an
  373. // empty value appearing in NullFields will be sent to the server as
  374. // null. It is an error if a field in this list has a non-empty value.
  375. // This may be used to include null fields in Patch requests.
  376. NullFields []string `json:"-"`
  377. }
  378. func (s *SpanContext) MarshalJSON() ([]byte, error) {
  379. type NoMethod SpanContext
  380. raw := NoMethod(*s)
  381. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  382. }
  383. // Status: The Status type defines a logical error model that is
  384. // suitable for different programming environments, including REST APIs
  385. // and RPC APIs. It is used by gRPC (https://github.com/grpc). The error
  386. // model is designed to be:
  387. // Simple to use and understand for most users
  388. // Flexible enough to meet unexpected needsOverviewThe Status message
  389. // contains three pieces of data: error code, error message, and error
  390. // details. The error code should be an enum value of google.rpc.Code,
  391. // but it may accept additional error codes if needed. The error message
  392. // should be a developer-facing English message that helps developers
  393. // understand and resolve the error. If a localized user-facing error
  394. // message is needed, put the localized message in the error details or
  395. // localize it in the client. The optional error details may contain
  396. // arbitrary information about the error. There is a predefined set of
  397. // error detail types in the package google.rpc that can be used for
  398. // common error conditions.Language mappingThe Status message is the
  399. // logical representation of the error model, but it is not necessarily
  400. // the actual wire format. When the Status message is exposed in
  401. // different client libraries and different wire protocols, it can be
  402. // mapped differently. For example, it will likely be mapped to some
  403. // exceptions in Java, but more likely mapped to some error codes in
  404. // C.Other usesThe error model and the Status message can be used in a
  405. // variety of environments, either with or without APIs, to provide a
  406. // consistent developer experience across different environments.Example
  407. // uses of this error model include:
  408. // Partial errors. If a service needs to return partial errors to the
  409. // client, it may embed the Status in the normal response to indicate
  410. // the partial errors.
  411. // Workflow errors. A typical workflow has multiple steps. Each step may
  412. // have a Status message for error reporting.
  413. // Batch operations. If a client uses batch request and batch response,
  414. // the Status message should be used directly inside batch response, one
  415. // for each error sub-response.
  416. // Asynchronous operations. If an API call embeds asynchronous operation
  417. // results in its response, the status of those operations should be
  418. // represented directly using the Status message.
  419. // Logging. If some API errors are stored in logs, the message Status
  420. // could be used directly after any stripping needed for
  421. // security/privacy reasons.
  422. type Status struct {
  423. // Code: The status code, which should be an enum value of
  424. // google.rpc.Code.
  425. Code int64 `json:"code,omitempty"`
  426. // Details: A list of messages that carry the error details. There is a
  427. // common set of message types for APIs to use.
  428. Details []googleapi.RawMessage `json:"details,omitempty"`
  429. // Message: A developer-facing error message, which should be in
  430. // English. Any user-facing error message should be localized and sent
  431. // in the google.rpc.Status.details field, or localized by the client.
  432. Message string `json:"message,omitempty"`
  433. // ForceSendFields is a list of field names (e.g. "Code") to
  434. // unconditionally include in API requests. By default, fields with
  435. // empty values are omitted from API requests. However, any non-pointer,
  436. // non-interface field appearing in ForceSendFields will be sent to the
  437. // server regardless of whether the field is empty or not. This may be
  438. // used to include empty fields in Patch requests.
  439. ForceSendFields []string `json:"-"`
  440. // NullFields is a list of field names (e.g. "Code") to include in API
  441. // requests with the JSON null value. By default, fields with empty
  442. // values are omitted from API requests. However, any field with an
  443. // empty value appearing in NullFields will be sent to the server as
  444. // null. It is an error if a field in this list has a non-empty value.
  445. // This may be used to include null fields in Patch requests.
  446. NullFields []string `json:"-"`
  447. }
  448. func (s *Status) MarshalJSON() ([]byte, error) {
  449. type NoMethod Status
  450. raw := NoMethod(*s)
  451. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  452. }
  453. // Type: A protocol buffer message type.
  454. type Type struct {
  455. // Fields: The list of fields.
  456. Fields []*Field `json:"fields,omitempty"`
  457. // Name: The fully qualified message name.
  458. Name string `json:"name,omitempty"`
  459. // Oneofs: The list of types appearing in oneof definitions in this
  460. // type.
  461. Oneofs []string `json:"oneofs,omitempty"`
  462. // Options: The protocol buffer options.
  463. Options []*Option `json:"options,omitempty"`
  464. // SourceContext: The source context.
  465. SourceContext *SourceContext `json:"sourceContext,omitempty"`
  466. // Syntax: The source syntax.
  467. //
  468. // Possible values:
  469. // "SYNTAX_PROTO2" - Syntax proto2.
  470. // "SYNTAX_PROTO3" - Syntax proto3.
  471. Syntax string `json:"syntax,omitempty"`
  472. // ForceSendFields is a list of field names (e.g. "Fields") to
  473. // unconditionally include in API requests. By default, fields with
  474. // empty values are omitted from API requests. However, any non-pointer,
  475. // non-interface field appearing in ForceSendFields will be sent to the
  476. // server regardless of whether the field is empty or not. This may be
  477. // used to include empty fields in Patch requests.
  478. ForceSendFields []string `json:"-"`
  479. // NullFields is a list of field names (e.g. "Fields") to include in API
  480. // requests with the JSON null value. By default, fields with empty
  481. // values are omitted from API requests. However, any field with an
  482. // empty value appearing in NullFields will be sent to the server as
  483. // null. It is an error if a field in this list has a non-empty value.
  484. // This may be used to include null fields in Patch requests.
  485. NullFields []string `json:"-"`
  486. }
  487. func (s *Type) MarshalJSON() ([]byte, error) {
  488. type NoMethod Type
  489. raw := NoMethod(*s)
  490. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  491. }
  492. // method id "monitoring.operations.cancel":
  493. type OperationsCancelCall struct {
  494. s *Service
  495. name string
  496. canceloperationrequest *CancelOperationRequest
  497. urlParams_ gensupport.URLParams
  498. ctx_ context.Context
  499. header_ http.Header
  500. }
  501. // Cancel: Starts asynchronous cancellation on a long-running operation.
  502. // The server makes a best effort to cancel the operation, but success
  503. // is not guaranteed. If the server doesn't support this method, it
  504. // returns google.rpc.Code.UNIMPLEMENTED. Clients can use
  505. // Operations.GetOperation or other methods to check whether the
  506. // cancellation succeeded or whether the operation completed despite
  507. // cancellation. On successful cancellation, the operation is not
  508. // deleted; instead, it becomes an operation with an Operation.error
  509. // value with a google.rpc.Status.code of 1, corresponding to
  510. // Code.CANCELLED.
  511. func (r *OperationsService) Cancel(name string, canceloperationrequest *CancelOperationRequest) *OperationsCancelCall {
  512. c := &OperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  513. c.name = name
  514. c.canceloperationrequest = canceloperationrequest
  515. return c
  516. }
  517. // Fields allows partial responses to be retrieved. See
  518. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  519. // for more information.
  520. func (c *OperationsCancelCall) Fields(s ...googleapi.Field) *OperationsCancelCall {
  521. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  522. return c
  523. }
  524. // Context sets the context to be used in this call's Do method. Any
  525. // pending HTTP request will be aborted if the provided context is
  526. // canceled.
  527. func (c *OperationsCancelCall) Context(ctx context.Context) *OperationsCancelCall {
  528. c.ctx_ = ctx
  529. return c
  530. }
  531. // Header returns an http.Header that can be modified by the caller to
  532. // add HTTP headers to the request.
  533. func (c *OperationsCancelCall) Header() http.Header {
  534. if c.header_ == nil {
  535. c.header_ = make(http.Header)
  536. }
  537. return c.header_
  538. }
  539. func (c *OperationsCancelCall) doRequest(alt string) (*http.Response, error) {
  540. reqHeaders := make(http.Header)
  541. for k, v := range c.header_ {
  542. reqHeaders[k] = v
  543. }
  544. reqHeaders.Set("User-Agent", c.s.userAgent())
  545. var body io.Reader = nil
  546. body, err := googleapi.WithoutDataWrapper.JSONReader(c.canceloperationrequest)
  547. if err != nil {
  548. return nil, err
  549. }
  550. reqHeaders.Set("Content-Type", "application/json")
  551. c.urlParams_.Set("alt", alt)
  552. c.urlParams_.Set("prettyPrint", "false")
  553. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel")
  554. urls += "?" + c.urlParams_.Encode()
  555. req, err := http.NewRequest("POST", urls, body)
  556. if err != nil {
  557. return nil, err
  558. }
  559. req.Header = reqHeaders
  560. googleapi.Expand(req.URL, map[string]string{
  561. "name": c.name,
  562. })
  563. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  564. }
  565. // Do executes the "monitoring.operations.cancel" call.
  566. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  567. // code is an error. Response headers are in either
  568. // *Empty.ServerResponse.Header or (if a response was returned at all)
  569. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  570. // check whether the returned error was because http.StatusNotModified
  571. // was returned.
  572. func (c *OperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  573. gensupport.SetOptions(c.urlParams_, opts...)
  574. res, err := c.doRequest("json")
  575. if res != nil && res.StatusCode == http.StatusNotModified {
  576. if res.Body != nil {
  577. res.Body.Close()
  578. }
  579. return nil, &googleapi.Error{
  580. Code: res.StatusCode,
  581. Header: res.Header,
  582. }
  583. }
  584. if err != nil {
  585. return nil, err
  586. }
  587. defer googleapi.CloseBody(res)
  588. if err := googleapi.CheckResponse(res); err != nil {
  589. return nil, err
  590. }
  591. ret := &Empty{
  592. ServerResponse: googleapi.ServerResponse{
  593. Header: res.Header,
  594. HTTPStatusCode: res.StatusCode,
  595. },
  596. }
  597. target := &ret
  598. if err := gensupport.DecodeResponse(target, res); err != nil {
  599. return nil, err
  600. }
  601. return ret, nil
  602. // {
  603. // "description": "Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to Code.CANCELLED.",
  604. // "flatPath": "v1/operations/{operationsId}:cancel",
  605. // "httpMethod": "POST",
  606. // "id": "monitoring.operations.cancel",
  607. // "parameterOrder": [
  608. // "name"
  609. // ],
  610. // "parameters": {
  611. // "name": {
  612. // "description": "The name of the operation resource to be cancelled.",
  613. // "location": "path",
  614. // "pattern": "^operations/.+$",
  615. // "required": true,
  616. // "type": "string"
  617. // }
  618. // },
  619. // "path": "v1/{+name}:cancel",
  620. // "request": {
  621. // "$ref": "CancelOperationRequest"
  622. // },
  623. // "response": {
  624. // "$ref": "Empty"
  625. // }
  626. // }
  627. }
  628. // method id "monitoring.operations.delete":
  629. type OperationsDeleteCall struct {
  630. s *Service
  631. name string
  632. urlParams_ gensupport.URLParams
  633. ctx_ context.Context
  634. header_ http.Header
  635. }
  636. // Delete: Deletes a long-running operation. This method indicates that
  637. // the client is no longer interested in the operation result. It does
  638. // not cancel the operation. If the server doesn't support this method,
  639. // it returns google.rpc.Code.UNIMPLEMENTED.
  640. func (r *OperationsService) Delete(name string) *OperationsDeleteCall {
  641. c := &OperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  642. c.name = name
  643. return c
  644. }
  645. // Fields allows partial responses to be retrieved. See
  646. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  647. // for more information.
  648. func (c *OperationsDeleteCall) Fields(s ...googleapi.Field) *OperationsDeleteCall {
  649. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  650. return c
  651. }
  652. // Context sets the context to be used in this call's Do method. Any
  653. // pending HTTP request will be aborted if the provided context is
  654. // canceled.
  655. func (c *OperationsDeleteCall) Context(ctx context.Context) *OperationsDeleteCall {
  656. c.ctx_ = ctx
  657. return c
  658. }
  659. // Header returns an http.Header that can be modified by the caller to
  660. // add HTTP headers to the request.
  661. func (c *OperationsDeleteCall) Header() http.Header {
  662. if c.header_ == nil {
  663. c.header_ = make(http.Header)
  664. }
  665. return c.header_
  666. }
  667. func (c *OperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
  668. reqHeaders := make(http.Header)
  669. for k, v := range c.header_ {
  670. reqHeaders[k] = v
  671. }
  672. reqHeaders.Set("User-Agent", c.s.userAgent())
  673. var body io.Reader = nil
  674. c.urlParams_.Set("alt", alt)
  675. c.urlParams_.Set("prettyPrint", "false")
  676. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  677. urls += "?" + c.urlParams_.Encode()
  678. req, err := http.NewRequest("DELETE", urls, body)
  679. if err != nil {
  680. return nil, err
  681. }
  682. req.Header = reqHeaders
  683. googleapi.Expand(req.URL, map[string]string{
  684. "name": c.name,
  685. })
  686. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  687. }
  688. // Do executes the "monitoring.operations.delete" call.
  689. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  690. // code is an error. Response headers are in either
  691. // *Empty.ServerResponse.Header or (if a response was returned at all)
  692. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  693. // check whether the returned error was because http.StatusNotModified
  694. // was returned.
  695. func (c *OperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  696. gensupport.SetOptions(c.urlParams_, opts...)
  697. res, err := c.doRequest("json")
  698. if res != nil && res.StatusCode == http.StatusNotModified {
  699. if res.Body != nil {
  700. res.Body.Close()
  701. }
  702. return nil, &googleapi.Error{
  703. Code: res.StatusCode,
  704. Header: res.Header,
  705. }
  706. }
  707. if err != nil {
  708. return nil, err
  709. }
  710. defer googleapi.CloseBody(res)
  711. if err := googleapi.CheckResponse(res); err != nil {
  712. return nil, err
  713. }
  714. ret := &Empty{
  715. ServerResponse: googleapi.ServerResponse{
  716. Header: res.Header,
  717. HTTPStatusCode: res.StatusCode,
  718. },
  719. }
  720. target := &ret
  721. if err := gensupport.DecodeResponse(target, res); err != nil {
  722. return nil, err
  723. }
  724. return ret, nil
  725. // {
  726. // "description": "Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED.",
  727. // "flatPath": "v1/operations/{operationsId}",
  728. // "httpMethod": "DELETE",
  729. // "id": "monitoring.operations.delete",
  730. // "parameterOrder": [
  731. // "name"
  732. // ],
  733. // "parameters": {
  734. // "name": {
  735. // "description": "The name of the operation resource to be deleted.",
  736. // "location": "path",
  737. // "pattern": "^operations/.+$",
  738. // "required": true,
  739. // "type": "string"
  740. // }
  741. // },
  742. // "path": "v1/{+name}",
  743. // "response": {
  744. // "$ref": "Empty"
  745. // }
  746. // }
  747. }
  748. // method id "monitoring.operations.get":
  749. type OperationsGetCall struct {
  750. s *Service
  751. name string
  752. urlParams_ gensupport.URLParams
  753. ifNoneMatch_ string
  754. ctx_ context.Context
  755. header_ http.Header
  756. }
  757. // Get: Gets the latest state of a long-running operation. Clients can
  758. // use this method to poll the operation result at intervals as
  759. // recommended by the API service.
  760. func (r *OperationsService) Get(name string) *OperationsGetCall {
  761. c := &OperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  762. c.name = name
  763. return c
  764. }
  765. // Fields allows partial responses to be retrieved. See
  766. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  767. // for more information.
  768. func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {
  769. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  770. return c
  771. }
  772. // IfNoneMatch sets the optional parameter which makes the operation
  773. // fail if the object's ETag matches the given value. This is useful for
  774. // getting updates only after the object has changed since the last
  775. // request. Use googleapi.IsNotModified to check whether the response
  776. // error from Do is the result of In-None-Match.
  777. func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall {
  778. c.ifNoneMatch_ = entityTag
  779. return c
  780. }
  781. // Context sets the context to be used in this call's Do method. Any
  782. // pending HTTP request will be aborted if the provided context is
  783. // canceled.
  784. func (c *OperationsGetCall) Context(ctx context.Context) *OperationsGetCall {
  785. c.ctx_ = ctx
  786. return c
  787. }
  788. // Header returns an http.Header that can be modified by the caller to
  789. // add HTTP headers to the request.
  790. func (c *OperationsGetCall) Header() http.Header {
  791. if c.header_ == nil {
  792. c.header_ = make(http.Header)
  793. }
  794. return c.header_
  795. }
  796. func (c *OperationsGetCall) doRequest(alt string) (*http.Response, error) {
  797. reqHeaders := make(http.Header)
  798. for k, v := range c.header_ {
  799. reqHeaders[k] = v
  800. }
  801. reqHeaders.Set("User-Agent", c.s.userAgent())
  802. if c.ifNoneMatch_ != "" {
  803. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  804. }
  805. var body io.Reader = nil
  806. c.urlParams_.Set("alt", alt)
  807. c.urlParams_.Set("prettyPrint", "false")
  808. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  809. urls += "?" + c.urlParams_.Encode()
  810. req, err := http.NewRequest("GET", urls, body)
  811. if err != nil {
  812. return nil, err
  813. }
  814. req.Header = reqHeaders
  815. googleapi.Expand(req.URL, map[string]string{
  816. "name": c.name,
  817. })
  818. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  819. }
  820. // Do executes the "monitoring.operations.get" call.
  821. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  822. // status code is an error. Response headers are in either
  823. // *Operation.ServerResponse.Header or (if a response was returned at
  824. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  825. // to check whether the returned error was because
  826. // http.StatusNotModified was returned.
  827. func (c *OperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  828. gensupport.SetOptions(c.urlParams_, opts...)
  829. res, err := c.doRequest("json")
  830. if res != nil && res.StatusCode == http.StatusNotModified {
  831. if res.Body != nil {
  832. res.Body.Close()
  833. }
  834. return nil, &googleapi.Error{
  835. Code: res.StatusCode,
  836. Header: res.Header,
  837. }
  838. }
  839. if err != nil {
  840. return nil, err
  841. }
  842. defer googleapi.CloseBody(res)
  843. if err := googleapi.CheckResponse(res); err != nil {
  844. return nil, err
  845. }
  846. ret := &Operation{
  847. ServerResponse: googleapi.ServerResponse{
  848. Header: res.Header,
  849. HTTPStatusCode: res.StatusCode,
  850. },
  851. }
  852. target := &ret
  853. if err := gensupport.DecodeResponse(target, res); err != nil {
  854. return nil, err
  855. }
  856. return ret, nil
  857. // {
  858. // "description": "Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.",
  859. // "flatPath": "v1/operations/{operationsId}",
  860. // "httpMethod": "GET",
  861. // "id": "monitoring.operations.get",
  862. // "parameterOrder": [
  863. // "name"
  864. // ],
  865. // "parameters": {
  866. // "name": {
  867. // "description": "The name of the operation resource.",
  868. // "location": "path",
  869. // "pattern": "^operations/.+$",
  870. // "required": true,
  871. // "type": "string"
  872. // }
  873. // },
  874. // "path": "v1/{+name}",
  875. // "response": {
  876. // "$ref": "Operation"
  877. // }
  878. // }
  879. }
  880. // method id "monitoring.operations.list":
  881. type OperationsListCall struct {
  882. s *Service
  883. name string
  884. urlParams_ gensupport.URLParams
  885. ifNoneMatch_ string
  886. ctx_ context.Context
  887. header_ http.Header
  888. }
  889. // List: Lists operations that match the specified filter in the
  890. // request. If the server doesn't support this method, it returns
  891. // UNIMPLEMENTED.NOTE: the name binding allows API services to override
  892. // the binding to use different resource name schemes, such as
  893. // users/*/operations. To override the binding, API services can add a
  894. // binding such as "/v1/{name=users/*}/operations" to their service
  895. // configuration. For backwards compatibility, the default name includes
  896. // the operations collection id, however overriding users must ensure
  897. // the name binding is the parent resource, without the operations
  898. // collection id.
  899. func (r *OperationsService) List(name string) *OperationsListCall {
  900. c := &OperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  901. c.name = name
  902. return c
  903. }
  904. // Filter sets the optional parameter "filter": The standard list
  905. // filter.
  906. func (c *OperationsListCall) Filter(filter string) *OperationsListCall {
  907. c.urlParams_.Set("filter", filter)
  908. return c
  909. }
  910. // PageSize sets the optional parameter "pageSize": The standard list
  911. // page size.
  912. func (c *OperationsListCall) PageSize(pageSize int64) *OperationsListCall {
  913. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  914. return c
  915. }
  916. // PageToken sets the optional parameter "pageToken": The standard list
  917. // page token.
  918. func (c *OperationsListCall) PageToken(pageToken string) *OperationsListCall {
  919. c.urlParams_.Set("pageToken", pageToken)
  920. return c
  921. }
  922. // Fields allows partial responses to be retrieved. See
  923. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  924. // for more information.
  925. func (c *OperationsListCall) Fields(s ...googleapi.Field) *OperationsListCall {
  926. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  927. return c
  928. }
  929. // IfNoneMatch sets the optional parameter which makes the operation
  930. // fail if the object's ETag matches the given value. This is useful for
  931. // getting updates only after the object has changed since the last
  932. // request. Use googleapi.IsNotModified to check whether the response
  933. // error from Do is the result of In-None-Match.
  934. func (c *OperationsListCall) IfNoneMatch(entityTag string) *OperationsListCall {
  935. c.ifNoneMatch_ = entityTag
  936. return c
  937. }
  938. // Context sets the context to be used in this call's Do method. Any
  939. // pending HTTP request will be aborted if the provided context is
  940. // canceled.
  941. func (c *OperationsListCall) Context(ctx context.Context) *OperationsListCall {
  942. c.ctx_ = ctx
  943. return c
  944. }
  945. // Header returns an http.Header that can be modified by the caller to
  946. // add HTTP headers to the request.
  947. func (c *OperationsListCall) Header() http.Header {
  948. if c.header_ == nil {
  949. c.header_ = make(http.Header)
  950. }
  951. return c.header_
  952. }
  953. func (c *OperationsListCall) doRequest(alt string) (*http.Response, error) {
  954. reqHeaders := make(http.Header)
  955. for k, v := range c.header_ {
  956. reqHeaders[k] = v
  957. }
  958. reqHeaders.Set("User-Agent", c.s.userAgent())
  959. if c.ifNoneMatch_ != "" {
  960. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  961. }
  962. var body io.Reader = nil
  963. c.urlParams_.Set("alt", alt)
  964. c.urlParams_.Set("prettyPrint", "false")
  965. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  966. urls += "?" + c.urlParams_.Encode()
  967. req, err := http.NewRequest("GET", urls, body)
  968. if err != nil {
  969. return nil, err
  970. }
  971. req.Header = reqHeaders
  972. googleapi.Expand(req.URL, map[string]string{
  973. "name": c.name,
  974. })
  975. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  976. }
  977. // Do executes the "monitoring.operations.list" call.
  978. // Exactly one of *ListOperationsResponse or error will be non-nil. Any
  979. // non-2xx status code is an error. Response headers are in either
  980. // *ListOperationsResponse.ServerResponse.Header or (if a response was
  981. // returned at all) in error.(*googleapi.Error).Header. Use
  982. // googleapi.IsNotModified to check whether the returned error was
  983. // because http.StatusNotModified was returned.
  984. func (c *OperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
  985. gensupport.SetOptions(c.urlParams_, opts...)
  986. res, err := c.doRequest("json")
  987. if res != nil && res.StatusCode == http.StatusNotModified {
  988. if res.Body != nil {
  989. res.Body.Close()
  990. }
  991. return nil, &googleapi.Error{
  992. Code: res.StatusCode,
  993. Header: res.Header,
  994. }
  995. }
  996. if err != nil {
  997. return nil, err
  998. }
  999. defer googleapi.CloseBody(res)
  1000. if err := googleapi.CheckResponse(res); err != nil {
  1001. return nil, err
  1002. }
  1003. ret := &ListOperationsResponse{
  1004. ServerResponse: googleapi.ServerResponse{
  1005. Header: res.Header,
  1006. HTTPStatusCode: res.StatusCode,
  1007. },
  1008. }
  1009. target := &ret
  1010. if err := gensupport.DecodeResponse(target, res); err != nil {
  1011. return nil, err
  1012. }
  1013. return ret, nil
  1014. // {
  1015. // "description": "Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED.NOTE: the name binding allows API services to override the binding to use different resource name schemes, such as users/*/operations. To override the binding, API services can add a binding such as \"/v1/{name=users/*}/operations\" to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id.",
  1016. // "flatPath": "v1/operations",
  1017. // "httpMethod": "GET",
  1018. // "id": "monitoring.operations.list",
  1019. // "parameterOrder": [
  1020. // "name"
  1021. // ],
  1022. // "parameters": {
  1023. // "filter": {
  1024. // "description": "The standard list filter.",
  1025. // "location": "query",
  1026. // "type": "string"
  1027. // },
  1028. // "name": {
  1029. // "description": "The name of the operation's parent resource.",
  1030. // "location": "path",
  1031. // "pattern": "^operations$",
  1032. // "required": true,
  1033. // "type": "string"
  1034. // },
  1035. // "pageSize": {
  1036. // "description": "The standard list page size.",
  1037. // "format": "int32",
  1038. // "location": "query",
  1039. // "type": "integer"
  1040. // },
  1041. // "pageToken": {
  1042. // "description": "The standard list page token.",
  1043. // "location": "query",
  1044. // "type": "string"
  1045. // }
  1046. // },
  1047. // "path": "v1/{+name}",
  1048. // "response": {
  1049. // "$ref": "ListOperationsResponse"
  1050. // }
  1051. // }
  1052. }
  1053. // Pages invokes f for each page of results.
  1054. // A non-nil error returned from f will halt the iteration.
  1055. // The provided context supersedes any context provided to the Context method.
  1056. func (c *OperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
  1057. c.ctx_ = ctx
  1058. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1059. for {
  1060. x, err := c.Do()
  1061. if err != nil {
  1062. return err
  1063. }
  1064. if err := f(x); err != nil {
  1065. return err
  1066. }
  1067. if x.NextPageToken == "" {
  1068. return nil
  1069. }
  1070. c.PageToken(x.NextPageToken)
  1071. }
  1072. }