No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

2060 líneas
73 KiB

  1. // Copyright 2019 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 clouderrorreporting provides access to the Stackdriver Error Reporting API.
  6. //
  7. // For product documentation, see: https://cloud.google.com/error-reporting/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/clouderrorreporting/v1beta1"
  14. // ...
  15. // ctx := context.Background()
  16. // clouderrorreportingService, err := clouderrorreporting.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  25. //
  26. // clouderrorreportingService, err := clouderrorreporting.NewService(ctx, option.WithAPIKey("AIza..."))
  27. //
  28. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  29. //
  30. // config := &oauth2.Config{...}
  31. // // ...
  32. // token, err := config.Exchange(ctx, ...)
  33. // clouderrorreportingService, err := clouderrorreporting.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  34. //
  35. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  36. package clouderrorreporting // import "google.golang.org/api/clouderrorreporting/v1beta1"
  37. import (
  38. "bytes"
  39. "context"
  40. "encoding/json"
  41. "errors"
  42. "fmt"
  43. "io"
  44. "net/http"
  45. "net/url"
  46. "strconv"
  47. "strings"
  48. gensupport "google.golang.org/api/gensupport"
  49. googleapi "google.golang.org/api/googleapi"
  50. option "google.golang.org/api/option"
  51. htransport "google.golang.org/api/transport/http"
  52. )
  53. // Always reference these packages, just in case the auto-generated code
  54. // below doesn't.
  55. var _ = bytes.NewBuffer
  56. var _ = strconv.Itoa
  57. var _ = fmt.Sprintf
  58. var _ = json.NewDecoder
  59. var _ = io.Copy
  60. var _ = url.Parse
  61. var _ = gensupport.MarshalJSON
  62. var _ = googleapi.Version
  63. var _ = errors.New
  64. var _ = strings.Replace
  65. var _ = context.Canceled
  66. const apiId = "clouderrorreporting:v1beta1"
  67. const apiName = "clouderrorreporting"
  68. const apiVersion = "v1beta1"
  69. const basePath = "https://clouderrorreporting.googleapis.com/"
  70. // OAuth2 scopes used by this API.
  71. const (
  72. // View and manage your data across Google Cloud Platform services
  73. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  74. )
  75. // NewService creates a new Service.
  76. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  77. scopesOption := option.WithScopes(
  78. "https://www.googleapis.com/auth/cloud-platform",
  79. )
  80. // NOTE: prepend, so we don't override user-specified scopes.
  81. opts = append([]option.ClientOption{scopesOption}, opts...)
  82. client, endpoint, err := htransport.NewClient(ctx, opts...)
  83. if err != nil {
  84. return nil, err
  85. }
  86. s, err := New(client)
  87. if err != nil {
  88. return nil, err
  89. }
  90. if endpoint != "" {
  91. s.BasePath = endpoint
  92. }
  93. return s, nil
  94. }
  95. // New creates a new Service. It uses the provided http.Client for requests.
  96. //
  97. // Deprecated: please use NewService instead.
  98. // To provide a custom HTTP client, use option.WithHTTPClient.
  99. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  100. func New(client *http.Client) (*Service, error) {
  101. if client == nil {
  102. return nil, errors.New("client is nil")
  103. }
  104. s := &Service{client: client, BasePath: basePath}
  105. s.Projects = NewProjectsService(s)
  106. return s, nil
  107. }
  108. type Service struct {
  109. client *http.Client
  110. BasePath string // API endpoint base URL
  111. UserAgent string // optional additional User-Agent fragment
  112. Projects *ProjectsService
  113. }
  114. func (s *Service) userAgent() string {
  115. if s.UserAgent == "" {
  116. return googleapi.UserAgent
  117. }
  118. return googleapi.UserAgent + " " + s.UserAgent
  119. }
  120. func NewProjectsService(s *Service) *ProjectsService {
  121. rs := &ProjectsService{s: s}
  122. rs.Events = NewProjectsEventsService(s)
  123. rs.GroupStats = NewProjectsGroupStatsService(s)
  124. rs.Groups = NewProjectsGroupsService(s)
  125. return rs
  126. }
  127. type ProjectsService struct {
  128. s *Service
  129. Events *ProjectsEventsService
  130. GroupStats *ProjectsGroupStatsService
  131. Groups *ProjectsGroupsService
  132. }
  133. func NewProjectsEventsService(s *Service) *ProjectsEventsService {
  134. rs := &ProjectsEventsService{s: s}
  135. return rs
  136. }
  137. type ProjectsEventsService struct {
  138. s *Service
  139. }
  140. func NewProjectsGroupStatsService(s *Service) *ProjectsGroupStatsService {
  141. rs := &ProjectsGroupStatsService{s: s}
  142. return rs
  143. }
  144. type ProjectsGroupStatsService struct {
  145. s *Service
  146. }
  147. func NewProjectsGroupsService(s *Service) *ProjectsGroupsService {
  148. rs := &ProjectsGroupsService{s: s}
  149. return rs
  150. }
  151. type ProjectsGroupsService struct {
  152. s *Service
  153. }
  154. // DeleteEventsResponse: Response message for deleting error events.
  155. type DeleteEventsResponse struct {
  156. // ServerResponse contains the HTTP response code and headers from the
  157. // server.
  158. googleapi.ServerResponse `json:"-"`
  159. }
  160. // ErrorContext: A description of the context in which an error
  161. // occurred.
  162. // This data should be provided by the application when reporting an
  163. // error,
  164. // unless the
  165. // error report has been generated automatically from Google App Engine
  166. // logs.
  167. type ErrorContext struct {
  168. // HttpRequest: The HTTP request which was processed when the error
  169. // was
  170. // triggered.
  171. HttpRequest *HttpRequestContext `json:"httpRequest,omitempty"`
  172. // ReportLocation: The location in the source code where the decision
  173. // was made to
  174. // report the error, usually the place where it was logged.
  175. // For a logged exception this would be the source line where
  176. // the
  177. // exception is logged, usually close to the place where it was
  178. // caught.
  179. ReportLocation *SourceLocation `json:"reportLocation,omitempty"`
  180. // SourceReferences: Source code that was used to build the executable
  181. // which has
  182. // caused the given error message.
  183. SourceReferences []*SourceReference `json:"sourceReferences,omitempty"`
  184. // User: The user who caused or was affected by the crash.
  185. // This can be a user ID, an email address, or an arbitrary token
  186. // that
  187. // uniquely identifies the user.
  188. // When sending an error report, leave this field empty if the user was
  189. // not
  190. // logged in. In this case the
  191. // Error Reporting system will use other data, such as remote IP
  192. // address, to
  193. // distinguish affected users. See `affected_users_count`
  194. // in
  195. // `ErrorGroupStats`.
  196. User string `json:"user,omitempty"`
  197. // ForceSendFields is a list of field names (e.g. "HttpRequest") to
  198. // unconditionally include in API requests. By default, fields with
  199. // empty values are omitted from API requests. However, any non-pointer,
  200. // non-interface field appearing in ForceSendFields will be sent to the
  201. // server regardless of whether the field is empty or not. This may be
  202. // used to include empty fields in Patch requests.
  203. ForceSendFields []string `json:"-"`
  204. // NullFields is a list of field names (e.g. "HttpRequest") to include
  205. // in API requests with the JSON null value. By default, fields with
  206. // empty values are omitted from API requests. However, any field with
  207. // an empty value appearing in NullFields will be sent to the server as
  208. // null. It is an error if a field in this list has a non-empty value.
  209. // This may be used to include null fields in Patch requests.
  210. NullFields []string `json:"-"`
  211. }
  212. func (s *ErrorContext) MarshalJSON() ([]byte, error) {
  213. type NoMethod ErrorContext
  214. raw := NoMethod(*s)
  215. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  216. }
  217. // ErrorEvent: An error event which is returned by the Error Reporting
  218. // system.
  219. type ErrorEvent struct {
  220. // Context: Data about the context in which the error occurred.
  221. Context *ErrorContext `json:"context,omitempty"`
  222. // EventTime: Time when the event occurred as provided in the error
  223. // report.
  224. // If the report did not contain a timestamp, the time the error was
  225. // received
  226. // by the Error Reporting system is used.
  227. EventTime string `json:"eventTime,omitempty"`
  228. // Message: The stack trace that was reported or logged by the service.
  229. Message string `json:"message,omitempty"`
  230. // ServiceContext: The `ServiceContext` for which this error was
  231. // reported.
  232. ServiceContext *ServiceContext `json:"serviceContext,omitempty"`
  233. // ForceSendFields is a list of field names (e.g. "Context") to
  234. // unconditionally include in API requests. By default, fields with
  235. // empty values are omitted from API requests. However, any non-pointer,
  236. // non-interface field appearing in ForceSendFields will be sent to the
  237. // server regardless of whether the field is empty or not. This may be
  238. // used to include empty fields in Patch requests.
  239. ForceSendFields []string `json:"-"`
  240. // NullFields is a list of field names (e.g. "Context") to include in
  241. // API requests with the JSON null value. By default, fields with empty
  242. // values are omitted from API requests. However, any field with an
  243. // empty value appearing in NullFields will be sent to the server as
  244. // null. It is an error if a field in this list has a non-empty value.
  245. // This may be used to include null fields in Patch requests.
  246. NullFields []string `json:"-"`
  247. }
  248. func (s *ErrorEvent) MarshalJSON() ([]byte, error) {
  249. type NoMethod ErrorEvent
  250. raw := NoMethod(*s)
  251. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  252. }
  253. // ErrorGroup: Description of a group of similar error events.
  254. type ErrorGroup struct {
  255. // GroupId: Group IDs are unique for a given project. If the same kind
  256. // of error
  257. // occurs in different service contexts, it will receive the same group
  258. // ID.
  259. GroupId string `json:"groupId,omitempty"`
  260. // Name: The group resource name.
  261. // Example: <code>projects/my-project-123/groups/my-groupid</code>
  262. Name string `json:"name,omitempty"`
  263. // TrackingIssues: Associated tracking issues.
  264. TrackingIssues []*TrackingIssue `json:"trackingIssues,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. "GroupId") 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. "GroupId") to include in
  276. // API 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 *ErrorGroup) MarshalJSON() ([]byte, error) {
  284. type NoMethod ErrorGroup
  285. raw := NoMethod(*s)
  286. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  287. }
  288. // ErrorGroupStats: Data extracted for a specific group based on certain
  289. // filter criteria,
  290. // such as a given time period and/or service filter.
  291. type ErrorGroupStats struct {
  292. // AffectedServices: Service contexts with a non-zero error count for
  293. // the given filter
  294. // criteria. This list can be truncated if multiple services are
  295. // affected.
  296. // Refer to `num_affected_services` for the total count.
  297. AffectedServices []*ServiceContext `json:"affectedServices,omitempty"`
  298. // AffectedUsersCount: Approximate number of affected users in the given
  299. // group that
  300. // match the filter criteria.
  301. // Users are distinguished by data in the `ErrorContext` of
  302. // the
  303. // individual error events, such as their login name or their remote
  304. // IP address in case of HTTP requests.
  305. // The number of affected users can be zero even if the number of
  306. // errors is non-zero if no data was provided from which the
  307. // affected user could be deduced.
  308. // Users are counted based on data in the request
  309. // context that was provided in the error report. If more users
  310. // are
  311. // implicitly affected, such as due to a crash of the whole
  312. // service,
  313. // this is not reflected here.
  314. AffectedUsersCount int64 `json:"affectedUsersCount,omitempty,string"`
  315. // Count: Approximate total number of events in the given group that
  316. // match
  317. // the filter criteria.
  318. Count int64 `json:"count,omitempty,string"`
  319. // FirstSeenTime: Approximate first occurrence that was ever seen for
  320. // this group
  321. // and which matches the given filter criteria, ignoring the
  322. // time_range that was specified in the request.
  323. FirstSeenTime string `json:"firstSeenTime,omitempty"`
  324. // Group: Group data that is independent of the filter criteria.
  325. Group *ErrorGroup `json:"group,omitempty"`
  326. // LastSeenTime: Approximate last occurrence that was ever seen for this
  327. // group and
  328. // which matches the given filter criteria, ignoring the time_range
  329. // that was specified in the request.
  330. LastSeenTime string `json:"lastSeenTime,omitempty"`
  331. // NumAffectedServices: The total number of services with a non-zero
  332. // error count for the given
  333. // filter criteria.
  334. NumAffectedServices int64 `json:"numAffectedServices,omitempty"`
  335. // Representative: An arbitrary event that is chosen as representative
  336. // for the whole group.
  337. // The representative event is intended to be used as a quick preview
  338. // for
  339. // the whole group. Events in the group are usually sufficiently
  340. // similar
  341. // to each other such that showing an arbitrary representative
  342. // provides
  343. // insight into the characteristics of the group as a whole.
  344. Representative *ErrorEvent `json:"representative,omitempty"`
  345. // TimedCounts: Approximate number of occurrences over time.
  346. // Timed counts returned by ListGroups are guaranteed to be:
  347. //
  348. // - Inside the requested time interval
  349. // - Non-overlapping, and
  350. // - Ordered by ascending time.
  351. TimedCounts []*TimedCount `json:"timedCounts,omitempty"`
  352. // ForceSendFields is a list of field names (e.g. "AffectedServices") to
  353. // unconditionally include in API requests. By default, fields with
  354. // empty values are omitted from API requests. However, any non-pointer,
  355. // non-interface field appearing in ForceSendFields will be sent to the
  356. // server regardless of whether the field is empty or not. This may be
  357. // used to include empty fields in Patch requests.
  358. ForceSendFields []string `json:"-"`
  359. // NullFields is a list of field names (e.g. "AffectedServices") to
  360. // include in API requests with the JSON null value. By default, fields
  361. // with empty values are omitted from API requests. However, any field
  362. // with an empty value appearing in NullFields will be sent to the
  363. // server as null. It is an error if a field in this list has a
  364. // non-empty value. This may be used to include null fields in Patch
  365. // requests.
  366. NullFields []string `json:"-"`
  367. }
  368. func (s *ErrorGroupStats) MarshalJSON() ([]byte, error) {
  369. type NoMethod ErrorGroupStats
  370. raw := NoMethod(*s)
  371. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  372. }
  373. // HttpRequestContext: HTTP request data that is related to a reported
  374. // error.
  375. // This data should be provided by the application when reporting an
  376. // error,
  377. // unless the
  378. // error report has been generated automatically from Google App Engine
  379. // logs.
  380. type HttpRequestContext struct {
  381. // Method: The type of HTTP request, such as `GET`, `POST`, etc.
  382. Method string `json:"method,omitempty"`
  383. // Referrer: The referrer information that is provided with the request.
  384. Referrer string `json:"referrer,omitempty"`
  385. // RemoteIp: The IP address from which the request originated.
  386. // This can be IPv4, IPv6, or a token which is derived from the
  387. // IP address, depending on the data that has been provided
  388. // in the error report.
  389. RemoteIp string `json:"remoteIp,omitempty"`
  390. // ResponseStatusCode: The HTTP response status code for the request.
  391. ResponseStatusCode int64 `json:"responseStatusCode,omitempty"`
  392. // Url: The URL of the request.
  393. Url string `json:"url,omitempty"`
  394. // UserAgent: The user agent information that is provided with the
  395. // request.
  396. UserAgent string `json:"userAgent,omitempty"`
  397. // ForceSendFields is a list of field names (e.g. "Method") to
  398. // unconditionally include in API requests. By default, fields with
  399. // empty values are omitted from API requests. However, any non-pointer,
  400. // non-interface field appearing in ForceSendFields will be sent to the
  401. // server regardless of whether the field is empty or not. This may be
  402. // used to include empty fields in Patch requests.
  403. ForceSendFields []string `json:"-"`
  404. // NullFields is a list of field names (e.g. "Method") to include in API
  405. // requests with the JSON null value. By default, fields with empty
  406. // values are omitted from API requests. However, any field with an
  407. // empty value appearing in NullFields will be sent to the server as
  408. // null. It is an error if a field in this list has a non-empty value.
  409. // This may be used to include null fields in Patch requests.
  410. NullFields []string `json:"-"`
  411. }
  412. func (s *HttpRequestContext) MarshalJSON() ([]byte, error) {
  413. type NoMethod HttpRequestContext
  414. raw := NoMethod(*s)
  415. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  416. }
  417. // ListEventsResponse: Contains a set of requested error events.
  418. type ListEventsResponse struct {
  419. // ErrorEvents: The error events which match the given request.
  420. ErrorEvents []*ErrorEvent `json:"errorEvents,omitempty"`
  421. // NextPageToken: If non-empty, more results are available.
  422. // Pass this token, along with the same query parameters as the
  423. // first
  424. // request, to view the next page of results.
  425. NextPageToken string `json:"nextPageToken,omitempty"`
  426. // TimeRangeBegin: The timestamp specifies the start time to which the
  427. // request was restricted.
  428. TimeRangeBegin string `json:"timeRangeBegin,omitempty"`
  429. // ServerResponse contains the HTTP response code and headers from the
  430. // server.
  431. googleapi.ServerResponse `json:"-"`
  432. // ForceSendFields is a list of field names (e.g. "ErrorEvents") to
  433. // unconditionally include in API requests. By default, fields with
  434. // empty values are omitted from API requests. However, any non-pointer,
  435. // non-interface field appearing in ForceSendFields will be sent to the
  436. // server regardless of whether the field is empty or not. This may be
  437. // used to include empty fields in Patch requests.
  438. ForceSendFields []string `json:"-"`
  439. // NullFields is a list of field names (e.g. "ErrorEvents") to include
  440. // in API requests with the JSON null value. By default, fields with
  441. // empty values are omitted from API requests. However, any field with
  442. // an empty value appearing in NullFields will be sent to the server as
  443. // null. It is an error if a field in this list has a non-empty value.
  444. // This may be used to include null fields in Patch requests.
  445. NullFields []string `json:"-"`
  446. }
  447. func (s *ListEventsResponse) MarshalJSON() ([]byte, error) {
  448. type NoMethod ListEventsResponse
  449. raw := NoMethod(*s)
  450. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  451. }
  452. // ListGroupStatsResponse: Contains a set of requested error group
  453. // stats.
  454. type ListGroupStatsResponse struct {
  455. // ErrorGroupStats: The error group stats which match the given request.
  456. ErrorGroupStats []*ErrorGroupStats `json:"errorGroupStats,omitempty"`
  457. // NextPageToken: If non-empty, more results are available.
  458. // Pass this token, along with the same query parameters as the
  459. // first
  460. // request, to view the next page of results.
  461. NextPageToken string `json:"nextPageToken,omitempty"`
  462. // TimeRangeBegin: The timestamp specifies the start time to which the
  463. // request was restricted.
  464. // The start time is set based on the requested time range. It may be
  465. // adjusted
  466. // to a later time if a project has exceeded the storage quota and older
  467. // data
  468. // has been deleted.
  469. TimeRangeBegin string `json:"timeRangeBegin,omitempty"`
  470. // ServerResponse contains the HTTP response code and headers from the
  471. // server.
  472. googleapi.ServerResponse `json:"-"`
  473. // ForceSendFields is a list of field names (e.g. "ErrorGroupStats") to
  474. // unconditionally include in API requests. By default, fields with
  475. // empty values are omitted from API requests. However, any non-pointer,
  476. // non-interface field appearing in ForceSendFields will be sent to the
  477. // server regardless of whether the field is empty or not. This may be
  478. // used to include empty fields in Patch requests.
  479. ForceSendFields []string `json:"-"`
  480. // NullFields is a list of field names (e.g. "ErrorGroupStats") to
  481. // include in API requests with the JSON null value. By default, fields
  482. // with empty values are omitted from API requests. However, any field
  483. // with an empty value appearing in NullFields will be sent to the
  484. // server as null. It is an error if a field in this list has a
  485. // non-empty value. This may be used to include null fields in Patch
  486. // requests.
  487. NullFields []string `json:"-"`
  488. }
  489. func (s *ListGroupStatsResponse) MarshalJSON() ([]byte, error) {
  490. type NoMethod ListGroupStatsResponse
  491. raw := NoMethod(*s)
  492. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  493. }
  494. // ReportErrorEventResponse: Response for reporting an individual error
  495. // event.
  496. // Data may be added to this message in the future.
  497. type ReportErrorEventResponse struct {
  498. // ServerResponse contains the HTTP response code and headers from the
  499. // server.
  500. googleapi.ServerResponse `json:"-"`
  501. }
  502. // ReportedErrorEvent: An error event which is reported to the Error
  503. // Reporting system.
  504. type ReportedErrorEvent struct {
  505. // Context: [Optional] A description of the context in which the error
  506. // occurred.
  507. Context *ErrorContext `json:"context,omitempty"`
  508. // EventTime: [Optional] Time when the event occurred.
  509. // If not provided, the time when the event was received by the
  510. // Error Reporting system will be used.
  511. EventTime string `json:"eventTime,omitempty"`
  512. // Message: [Required] The error message.
  513. // If no `context.reportLocation` is provided, the message must contain
  514. // a
  515. // header (typically consisting of the exception type name and an
  516. // error
  517. // message) and an exception stack trace in one of the supported
  518. // programming
  519. // languages and formats.
  520. // Supported languages are Java, Python, JavaScript, Ruby, C#, PHP, and
  521. // Go.
  522. // Supported stack trace formats are:
  523. //
  524. // * **Java**: Must be the return value of
  525. // [`Throwable.printStackTrace()`](https://docs.oracle.com/javase/7/docs/
  526. // api/java/lang/Throwable.html#printStackTrace%28%29).
  527. // * **Python**: Must be the return value of
  528. // [`traceback.format_exc()`](https://docs.python.org/2/library/traceback
  529. // .html#traceback.format_exc).
  530. // * **JavaScript**: Must be the value of
  531. // [`error.stack`](https://github.com/v8/v8/wiki/Stack-Trace-API)
  532. // as returned by V8.
  533. // * **Ruby**: Must contain frames returned by
  534. // [`Exception.backtrace`](https://ruby-doc.org/core-2.2.0/Exception.html
  535. // #method-i-backtrace).
  536. // * **C#**: Must be the return value of
  537. // [`Exception.ToString()`](https://msdn.microsoft.com/en-us/library/syst
  538. // em.exception.tostring.aspx).
  539. // * **PHP**: Must start with `PHP (Notice|Parse error|Fatal
  540. // error|Warning)`
  541. // and contain the result of
  542. // [`(string)$exception`](http://php.net/manual/en/exception.tostring.php
  543. // ).
  544. // * **Go**: Must be the return value of
  545. // [`runtime.Stack()`](https://golang.org/pkg/runtime/debug/#Stack).
  546. Message string `json:"message,omitempty"`
  547. // ServiceContext: [Required] The service context in which this error
  548. // has occurred.
  549. ServiceContext *ServiceContext `json:"serviceContext,omitempty"`
  550. // ForceSendFields is a list of field names (e.g. "Context") to
  551. // unconditionally include in API requests. By default, fields with
  552. // empty values are omitted from API requests. However, any non-pointer,
  553. // non-interface field appearing in ForceSendFields will be sent to the
  554. // server regardless of whether the field is empty or not. This may be
  555. // used to include empty fields in Patch requests.
  556. ForceSendFields []string `json:"-"`
  557. // NullFields is a list of field names (e.g. "Context") to include in
  558. // API requests with the JSON null value. By default, fields with empty
  559. // values are omitted from API requests. However, any field with an
  560. // empty value appearing in NullFields will be sent to the server as
  561. // null. It is an error if a field in this list has a non-empty value.
  562. // This may be used to include null fields in Patch requests.
  563. NullFields []string `json:"-"`
  564. }
  565. func (s *ReportedErrorEvent) MarshalJSON() ([]byte, error) {
  566. type NoMethod ReportedErrorEvent
  567. raw := NoMethod(*s)
  568. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  569. }
  570. // ServiceContext: Describes a running service that sends errors.
  571. // Its version changes over time and multiple versions can run in
  572. // parallel.
  573. type ServiceContext struct {
  574. // ResourceType: Type of the MonitoredResource. List of possible
  575. // values:
  576. // https://cloud.google.com/monitoring/api/resources
  577. //
  578. // Value is set automatically for incoming errors and must not be set
  579. // when
  580. // reporting errors.
  581. ResourceType string `json:"resourceType,omitempty"`
  582. // Service: An identifier of the service, such as the name of
  583. // the
  584. // executable, job, or Google App Engine service name. This field is
  585. // expected
  586. // to have a low number of values that are relatively stable over time,
  587. // as
  588. // opposed to `version`, which can be changed whenever new code is
  589. // deployed.
  590. //
  591. // Contains the service name for error reports extracted from Google
  592. // App Engine logs or `default` if the App Engine default service is
  593. // used.
  594. Service string `json:"service,omitempty"`
  595. // Version: Represents the source code version that the developer
  596. // provided,
  597. // which could represent a version label or a Git SHA-1 hash, for
  598. // example.
  599. // For App Engine standard environment, the version is set to the
  600. // version of
  601. // the app.
  602. Version string `json:"version,omitempty"`
  603. // ForceSendFields is a list of field names (e.g. "ResourceType") to
  604. // unconditionally include in API requests. By default, fields with
  605. // empty values are omitted from API requests. However, any non-pointer,
  606. // non-interface field appearing in ForceSendFields will be sent to the
  607. // server regardless of whether the field is empty or not. This may be
  608. // used to include empty fields in Patch requests.
  609. ForceSendFields []string `json:"-"`
  610. // NullFields is a list of field names (e.g. "ResourceType") to include
  611. // in API requests with the JSON null value. By default, fields with
  612. // empty values are omitted from API requests. However, any field with
  613. // an empty value appearing in NullFields will be sent to the server as
  614. // null. It is an error if a field in this list has a non-empty value.
  615. // This may be used to include null fields in Patch requests.
  616. NullFields []string `json:"-"`
  617. }
  618. func (s *ServiceContext) MarshalJSON() ([]byte, error) {
  619. type NoMethod ServiceContext
  620. raw := NoMethod(*s)
  621. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  622. }
  623. // SourceLocation: Indicates a location in the source code of the
  624. // service for which errors are
  625. // reported. `functionName` must be provided by the application when
  626. // reporting
  627. // an error, unless the error report contains a `message` with a
  628. // supported
  629. // exception stack trace. All fields are optional for the later case.
  630. type SourceLocation struct {
  631. // FilePath: The source code filename, which can include a truncated
  632. // relative
  633. // path, or a full path from a production machine.
  634. FilePath string `json:"filePath,omitempty"`
  635. // FunctionName: Human-readable name of a function or method.
  636. // The value can include optional context like the class or package
  637. // name.
  638. // For example, `my.package.MyClass.method` in case of Java.
  639. FunctionName string `json:"functionName,omitempty"`
  640. // LineNumber: 1-based. 0 indicates that the line number is unknown.
  641. LineNumber int64 `json:"lineNumber,omitempty"`
  642. // ForceSendFields is a list of field names (e.g. "FilePath") to
  643. // unconditionally include in API requests. By default, fields with
  644. // empty values are omitted from API requests. However, any non-pointer,
  645. // non-interface field appearing in ForceSendFields will be sent to the
  646. // server regardless of whether the field is empty or not. This may be
  647. // used to include empty fields in Patch requests.
  648. ForceSendFields []string `json:"-"`
  649. // NullFields is a list of field names (e.g. "FilePath") to include in
  650. // API requests with the JSON null value. By default, fields with empty
  651. // values are omitted from API requests. However, any field with an
  652. // empty value appearing in NullFields will be sent to the server as
  653. // null. It is an error if a field in this list has a non-empty value.
  654. // This may be used to include null fields in Patch requests.
  655. NullFields []string `json:"-"`
  656. }
  657. func (s *SourceLocation) MarshalJSON() ([]byte, error) {
  658. type NoMethod SourceLocation
  659. raw := NoMethod(*s)
  660. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  661. }
  662. // SourceReference: A reference to a particular snapshot of the source
  663. // tree used to build and
  664. // deploy an application.
  665. type SourceReference struct {
  666. // Repository: Optional. A URI string identifying the
  667. // repository.
  668. // Example: "https://github.com/GoogleCloudPlatform/kubernetes.git"
  669. Repository string `json:"repository,omitempty"`
  670. // RevisionId: The canonical and persistent identifier of the deployed
  671. // revision.
  672. // Example (git): "0035781c50ec7aa23385dc841529ce8a4b70db1b"
  673. RevisionId string `json:"revisionId,omitempty"`
  674. // ForceSendFields is a list of field names (e.g. "Repository") to
  675. // unconditionally include in API requests. By default, fields with
  676. // empty values are omitted from API requests. However, any non-pointer,
  677. // non-interface field appearing in ForceSendFields will be sent to the
  678. // server regardless of whether the field is empty or not. This may be
  679. // used to include empty fields in Patch requests.
  680. ForceSendFields []string `json:"-"`
  681. // NullFields is a list of field names (e.g. "Repository") to include in
  682. // API requests with the JSON null value. By default, fields with empty
  683. // values are omitted from API requests. However, any field with an
  684. // empty value appearing in NullFields will be sent to the server as
  685. // null. It is an error if a field in this list has a non-empty value.
  686. // This may be used to include null fields in Patch requests.
  687. NullFields []string `json:"-"`
  688. }
  689. func (s *SourceReference) MarshalJSON() ([]byte, error) {
  690. type NoMethod SourceReference
  691. raw := NoMethod(*s)
  692. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  693. }
  694. // TimedCount: The number of errors in a given time period.
  695. // All numbers are approximate since the error events are sampled
  696. // before counting them.
  697. type TimedCount struct {
  698. // Count: Approximate number of occurrences in the given time period.
  699. Count int64 `json:"count,omitempty,string"`
  700. // EndTime: End of the time period to which `count` refers (excluded).
  701. EndTime string `json:"endTime,omitempty"`
  702. // StartTime: Start of the time period to which `count` refers
  703. // (included).
  704. StartTime string `json:"startTime,omitempty"`
  705. // ForceSendFields is a list of field names (e.g. "Count") to
  706. // unconditionally include in API requests. By default, fields with
  707. // empty values are omitted from API requests. However, any non-pointer,
  708. // non-interface field appearing in ForceSendFields will be sent to the
  709. // server regardless of whether the field is empty or not. This may be
  710. // used to include empty fields in Patch requests.
  711. ForceSendFields []string `json:"-"`
  712. // NullFields is a list of field names (e.g. "Count") to include in API
  713. // requests with the JSON null value. By default, fields with empty
  714. // values are omitted from API requests. However, any field with an
  715. // empty value appearing in NullFields will be sent to the server as
  716. // null. It is an error if a field in this list has a non-empty value.
  717. // This may be used to include null fields in Patch requests.
  718. NullFields []string `json:"-"`
  719. }
  720. func (s *TimedCount) MarshalJSON() ([]byte, error) {
  721. type NoMethod TimedCount
  722. raw := NoMethod(*s)
  723. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  724. }
  725. // TrackingIssue: Information related to tracking the progress on
  726. // resolving the error.
  727. type TrackingIssue struct {
  728. // Url: A URL pointing to a related entry in an issue tracking
  729. // system.
  730. // Example: https://github.com/user/project/issues/4
  731. Url string `json:"url,omitempty"`
  732. // ForceSendFields is a list of field names (e.g. "Url") to
  733. // unconditionally include in API requests. By default, fields with
  734. // empty values are omitted from API requests. However, any non-pointer,
  735. // non-interface field appearing in ForceSendFields will be sent to the
  736. // server regardless of whether the field is empty or not. This may be
  737. // used to include empty fields in Patch requests.
  738. ForceSendFields []string `json:"-"`
  739. // NullFields is a list of field names (e.g. "Url") to include in API
  740. // requests with the JSON null value. By default, fields with empty
  741. // values are omitted from API requests. However, any field with an
  742. // empty value appearing in NullFields will be sent to the server as
  743. // null. It is an error if a field in this list has a non-empty value.
  744. // This may be used to include null fields in Patch requests.
  745. NullFields []string `json:"-"`
  746. }
  747. func (s *TrackingIssue) MarshalJSON() ([]byte, error) {
  748. type NoMethod TrackingIssue
  749. raw := NoMethod(*s)
  750. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  751. }
  752. // method id "clouderrorreporting.projects.deleteEvents":
  753. type ProjectsDeleteEventsCall struct {
  754. s *Service
  755. projectName string
  756. urlParams_ gensupport.URLParams
  757. ctx_ context.Context
  758. header_ http.Header
  759. }
  760. // DeleteEvents: Deletes all error events of a given project.
  761. func (r *ProjectsService) DeleteEvents(projectName string) *ProjectsDeleteEventsCall {
  762. c := &ProjectsDeleteEventsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  763. c.projectName = projectName
  764. return c
  765. }
  766. // Fields allows partial responses to be retrieved. See
  767. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  768. // for more information.
  769. func (c *ProjectsDeleteEventsCall) Fields(s ...googleapi.Field) *ProjectsDeleteEventsCall {
  770. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  771. return c
  772. }
  773. // Context sets the context to be used in this call's Do method. Any
  774. // pending HTTP request will be aborted if the provided context is
  775. // canceled.
  776. func (c *ProjectsDeleteEventsCall) Context(ctx context.Context) *ProjectsDeleteEventsCall {
  777. c.ctx_ = ctx
  778. return c
  779. }
  780. // Header returns an http.Header that can be modified by the caller to
  781. // add HTTP headers to the request.
  782. func (c *ProjectsDeleteEventsCall) Header() http.Header {
  783. if c.header_ == nil {
  784. c.header_ = make(http.Header)
  785. }
  786. return c.header_
  787. }
  788. func (c *ProjectsDeleteEventsCall) doRequest(alt string) (*http.Response, error) {
  789. reqHeaders := make(http.Header)
  790. for k, v := range c.header_ {
  791. reqHeaders[k] = v
  792. }
  793. reqHeaders.Set("User-Agent", c.s.userAgent())
  794. var body io.Reader = nil
  795. c.urlParams_.Set("alt", alt)
  796. c.urlParams_.Set("prettyPrint", "false")
  797. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+projectName}/events")
  798. urls += "?" + c.urlParams_.Encode()
  799. req, err := http.NewRequest("DELETE", urls, body)
  800. if err != nil {
  801. return nil, err
  802. }
  803. req.Header = reqHeaders
  804. googleapi.Expand(req.URL, map[string]string{
  805. "projectName": c.projectName,
  806. })
  807. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  808. }
  809. // Do executes the "clouderrorreporting.projects.deleteEvents" call.
  810. // Exactly one of *DeleteEventsResponse or error will be non-nil. Any
  811. // non-2xx status code is an error. Response headers are in either
  812. // *DeleteEventsResponse.ServerResponse.Header or (if a response was
  813. // returned at all) in error.(*googleapi.Error).Header. Use
  814. // googleapi.IsNotModified to check whether the returned error was
  815. // because http.StatusNotModified was returned.
  816. func (c *ProjectsDeleteEventsCall) Do(opts ...googleapi.CallOption) (*DeleteEventsResponse, error) {
  817. gensupport.SetOptions(c.urlParams_, opts...)
  818. res, err := c.doRequest("json")
  819. if res != nil && res.StatusCode == http.StatusNotModified {
  820. if res.Body != nil {
  821. res.Body.Close()
  822. }
  823. return nil, &googleapi.Error{
  824. Code: res.StatusCode,
  825. Header: res.Header,
  826. }
  827. }
  828. if err != nil {
  829. return nil, err
  830. }
  831. defer googleapi.CloseBody(res)
  832. if err := googleapi.CheckResponse(res); err != nil {
  833. return nil, err
  834. }
  835. ret := &DeleteEventsResponse{
  836. ServerResponse: googleapi.ServerResponse{
  837. Header: res.Header,
  838. HTTPStatusCode: res.StatusCode,
  839. },
  840. }
  841. target := &ret
  842. if err := gensupport.DecodeResponse(target, res); err != nil {
  843. return nil, err
  844. }
  845. return ret, nil
  846. // {
  847. // "description": "Deletes all error events of a given project.",
  848. // "flatPath": "v1beta1/projects/{projectsId}/events",
  849. // "httpMethod": "DELETE",
  850. // "id": "clouderrorreporting.projects.deleteEvents",
  851. // "parameterOrder": [
  852. // "projectName"
  853. // ],
  854. // "parameters": {
  855. // "projectName": {
  856. // "description": "[Required] The resource name of the Google Cloud Platform project. Written\nas `projects/` plus the\n[Google Cloud Platform project\nID](https://support.google.com/cloud/answer/6158840).\nExample: `projects/my-project-123`.",
  857. // "location": "path",
  858. // "pattern": "^projects/[^/]+$",
  859. // "required": true,
  860. // "type": "string"
  861. // }
  862. // },
  863. // "path": "v1beta1/{+projectName}/events",
  864. // "response": {
  865. // "$ref": "DeleteEventsResponse"
  866. // },
  867. // "scopes": [
  868. // "https://www.googleapis.com/auth/cloud-platform"
  869. // ]
  870. // }
  871. }
  872. // method id "clouderrorreporting.projects.events.list":
  873. type ProjectsEventsListCall struct {
  874. s *Service
  875. projectName string
  876. urlParams_ gensupport.URLParams
  877. ifNoneMatch_ string
  878. ctx_ context.Context
  879. header_ http.Header
  880. }
  881. // List: Lists the specified events.
  882. func (r *ProjectsEventsService) List(projectName string) *ProjectsEventsListCall {
  883. c := &ProjectsEventsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  884. c.projectName = projectName
  885. return c
  886. }
  887. // GroupId sets the optional parameter "groupId": [Required] The group
  888. // for which events shall be returned.
  889. func (c *ProjectsEventsListCall) GroupId(groupId string) *ProjectsEventsListCall {
  890. c.urlParams_.Set("groupId", groupId)
  891. return c
  892. }
  893. // PageSize sets the optional parameter "pageSize": [Optional] The
  894. // maximum number of results to return per response.
  895. func (c *ProjectsEventsListCall) PageSize(pageSize int64) *ProjectsEventsListCall {
  896. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  897. return c
  898. }
  899. // PageToken sets the optional parameter "pageToken": [Optional] A
  900. // `next_page_token` provided by a previous response.
  901. func (c *ProjectsEventsListCall) PageToken(pageToken string) *ProjectsEventsListCall {
  902. c.urlParams_.Set("pageToken", pageToken)
  903. return c
  904. }
  905. // ServiceFilterResourceType sets the optional parameter
  906. // "serviceFilter.resourceType": [Optional] The exact value to match
  907. // against
  908. // [`ServiceContext.resource_type`](/error-reporting/reference/re
  909. // st/v1beta1/ServiceContext#FIELDS.resource_type).
  910. func (c *ProjectsEventsListCall) ServiceFilterResourceType(serviceFilterResourceType string) *ProjectsEventsListCall {
  911. c.urlParams_.Set("serviceFilter.resourceType", serviceFilterResourceType)
  912. return c
  913. }
  914. // ServiceFilterService sets the optional parameter
  915. // "serviceFilter.service": [Optional] The exact value to match
  916. // against
  917. // [`ServiceContext.service`](/error-reporting/reference/rest/v1b
  918. // eta1/ServiceContext#FIELDS.service).
  919. func (c *ProjectsEventsListCall) ServiceFilterService(serviceFilterService string) *ProjectsEventsListCall {
  920. c.urlParams_.Set("serviceFilter.service", serviceFilterService)
  921. return c
  922. }
  923. // ServiceFilterVersion sets the optional parameter
  924. // "serviceFilter.version": [Optional] The exact value to match
  925. // against
  926. // [`ServiceContext.version`](/error-reporting/reference/rest/v1b
  927. // eta1/ServiceContext#FIELDS.version).
  928. func (c *ProjectsEventsListCall) ServiceFilterVersion(serviceFilterVersion string) *ProjectsEventsListCall {
  929. c.urlParams_.Set("serviceFilter.version", serviceFilterVersion)
  930. return c
  931. }
  932. // TimeRangePeriod sets the optional parameter "timeRange.period":
  933. // Restricts the query to the specified time range.
  934. //
  935. // Possible values:
  936. // "PERIOD_UNSPECIFIED"
  937. // "PERIOD_1_HOUR"
  938. // "PERIOD_6_HOURS"
  939. // "PERIOD_1_DAY"
  940. // "PERIOD_1_WEEK"
  941. // "PERIOD_30_DAYS"
  942. func (c *ProjectsEventsListCall) TimeRangePeriod(timeRangePeriod string) *ProjectsEventsListCall {
  943. c.urlParams_.Set("timeRange.period", timeRangePeriod)
  944. return c
  945. }
  946. // Fields allows partial responses to be retrieved. See
  947. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  948. // for more information.
  949. func (c *ProjectsEventsListCall) Fields(s ...googleapi.Field) *ProjectsEventsListCall {
  950. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  951. return c
  952. }
  953. // IfNoneMatch sets the optional parameter which makes the operation
  954. // fail if the object's ETag matches the given value. This is useful for
  955. // getting updates only after the object has changed since the last
  956. // request. Use googleapi.IsNotModified to check whether the response
  957. // error from Do is the result of In-None-Match.
  958. func (c *ProjectsEventsListCall) IfNoneMatch(entityTag string) *ProjectsEventsListCall {
  959. c.ifNoneMatch_ = entityTag
  960. return c
  961. }
  962. // Context sets the context to be used in this call's Do method. Any
  963. // pending HTTP request will be aborted if the provided context is
  964. // canceled.
  965. func (c *ProjectsEventsListCall) Context(ctx context.Context) *ProjectsEventsListCall {
  966. c.ctx_ = ctx
  967. return c
  968. }
  969. // Header returns an http.Header that can be modified by the caller to
  970. // add HTTP headers to the request.
  971. func (c *ProjectsEventsListCall) Header() http.Header {
  972. if c.header_ == nil {
  973. c.header_ = make(http.Header)
  974. }
  975. return c.header_
  976. }
  977. func (c *ProjectsEventsListCall) doRequest(alt string) (*http.Response, error) {
  978. reqHeaders := make(http.Header)
  979. for k, v := range c.header_ {
  980. reqHeaders[k] = v
  981. }
  982. reqHeaders.Set("User-Agent", c.s.userAgent())
  983. if c.ifNoneMatch_ != "" {
  984. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  985. }
  986. var body io.Reader = nil
  987. c.urlParams_.Set("alt", alt)
  988. c.urlParams_.Set("prettyPrint", "false")
  989. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+projectName}/events")
  990. urls += "?" + c.urlParams_.Encode()
  991. req, err := http.NewRequest("GET", urls, body)
  992. if err != nil {
  993. return nil, err
  994. }
  995. req.Header = reqHeaders
  996. googleapi.Expand(req.URL, map[string]string{
  997. "projectName": c.projectName,
  998. })
  999. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1000. }
  1001. // Do executes the "clouderrorreporting.projects.events.list" call.
  1002. // Exactly one of *ListEventsResponse or error will be non-nil. Any
  1003. // non-2xx status code is an error. Response headers are in either
  1004. // *ListEventsResponse.ServerResponse.Header or (if a response was
  1005. // returned at all) in error.(*googleapi.Error).Header. Use
  1006. // googleapi.IsNotModified to check whether the returned error was
  1007. // because http.StatusNotModified was returned.
  1008. func (c *ProjectsEventsListCall) Do(opts ...googleapi.CallOption) (*ListEventsResponse, error) {
  1009. gensupport.SetOptions(c.urlParams_, opts...)
  1010. res, err := c.doRequest("json")
  1011. if res != nil && res.StatusCode == http.StatusNotModified {
  1012. if res.Body != nil {
  1013. res.Body.Close()
  1014. }
  1015. return nil, &googleapi.Error{
  1016. Code: res.StatusCode,
  1017. Header: res.Header,
  1018. }
  1019. }
  1020. if err != nil {
  1021. return nil, err
  1022. }
  1023. defer googleapi.CloseBody(res)
  1024. if err := googleapi.CheckResponse(res); err != nil {
  1025. return nil, err
  1026. }
  1027. ret := &ListEventsResponse{
  1028. ServerResponse: googleapi.ServerResponse{
  1029. Header: res.Header,
  1030. HTTPStatusCode: res.StatusCode,
  1031. },
  1032. }
  1033. target := &ret
  1034. if err := gensupport.DecodeResponse(target, res); err != nil {
  1035. return nil, err
  1036. }
  1037. return ret, nil
  1038. // {
  1039. // "description": "Lists the specified events.",
  1040. // "flatPath": "v1beta1/projects/{projectsId}/events",
  1041. // "httpMethod": "GET",
  1042. // "id": "clouderrorreporting.projects.events.list",
  1043. // "parameterOrder": [
  1044. // "projectName"
  1045. // ],
  1046. // "parameters": {
  1047. // "groupId": {
  1048. // "description": "[Required] The group for which events shall be returned.",
  1049. // "location": "query",
  1050. // "type": "string"
  1051. // },
  1052. // "pageSize": {
  1053. // "description": "[Optional] The maximum number of results to return per response.",
  1054. // "format": "int32",
  1055. // "location": "query",
  1056. // "type": "integer"
  1057. // },
  1058. // "pageToken": {
  1059. // "description": "[Optional] A `next_page_token` provided by a previous response.",
  1060. // "location": "query",
  1061. // "type": "string"
  1062. // },
  1063. // "projectName": {
  1064. // "description": "[Required] The resource name of the Google Cloud Platform project. Written\nas `projects/` plus the\n[Google Cloud Platform project\nID](https://support.google.com/cloud/answer/6158840).\nExample: `projects/my-project-123`.",
  1065. // "location": "path",
  1066. // "pattern": "^projects/[^/]+$",
  1067. // "required": true,
  1068. // "type": "string"
  1069. // },
  1070. // "serviceFilter.resourceType": {
  1071. // "description": "[Optional] The exact value to match against\n[`ServiceContext.resource_type`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.resource_type).",
  1072. // "location": "query",
  1073. // "type": "string"
  1074. // },
  1075. // "serviceFilter.service": {
  1076. // "description": "[Optional] The exact value to match against\n[`ServiceContext.service`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service).",
  1077. // "location": "query",
  1078. // "type": "string"
  1079. // },
  1080. // "serviceFilter.version": {
  1081. // "description": "[Optional] The exact value to match against\n[`ServiceContext.version`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version).",
  1082. // "location": "query",
  1083. // "type": "string"
  1084. // },
  1085. // "timeRange.period": {
  1086. // "description": "Restricts the query to the specified time range.",
  1087. // "enum": [
  1088. // "PERIOD_UNSPECIFIED",
  1089. // "PERIOD_1_HOUR",
  1090. // "PERIOD_6_HOURS",
  1091. // "PERIOD_1_DAY",
  1092. // "PERIOD_1_WEEK",
  1093. // "PERIOD_30_DAYS"
  1094. // ],
  1095. // "location": "query",
  1096. // "type": "string"
  1097. // }
  1098. // },
  1099. // "path": "v1beta1/{+projectName}/events",
  1100. // "response": {
  1101. // "$ref": "ListEventsResponse"
  1102. // },
  1103. // "scopes": [
  1104. // "https://www.googleapis.com/auth/cloud-platform"
  1105. // ]
  1106. // }
  1107. }
  1108. // Pages invokes f for each page of results.
  1109. // A non-nil error returned from f will halt the iteration.
  1110. // The provided context supersedes any context provided to the Context method.
  1111. func (c *ProjectsEventsListCall) Pages(ctx context.Context, f func(*ListEventsResponse) error) error {
  1112. c.ctx_ = ctx
  1113. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1114. for {
  1115. x, err := c.Do()
  1116. if err != nil {
  1117. return err
  1118. }
  1119. if err := f(x); err != nil {
  1120. return err
  1121. }
  1122. if x.NextPageToken == "" {
  1123. return nil
  1124. }
  1125. c.PageToken(x.NextPageToken)
  1126. }
  1127. }
  1128. // method id "clouderrorreporting.projects.events.report":
  1129. type ProjectsEventsReportCall struct {
  1130. s *Service
  1131. projectName string
  1132. reportederrorevent *ReportedErrorEvent
  1133. urlParams_ gensupport.URLParams
  1134. ctx_ context.Context
  1135. header_ http.Header
  1136. }
  1137. // Report: Report an individual error event.
  1138. //
  1139. // This endpoint accepts **either** an OAuth token,
  1140. // **or** an [API
  1141. // key](https://support.google.com/cloud/answer/6158862)
  1142. // for authentication. To use an API key, append it to the URL as the
  1143. // value of
  1144. // a `key` parameter. For example:
  1145. //
  1146. // `POST
  1147. // https://clouderrorreporting.googleapis.com/v1beta1/projects/example-project/events:report?key=123ABC456`
  1148. func (r *ProjectsEventsService) Report(projectName string, reportederrorevent *ReportedErrorEvent) *ProjectsEventsReportCall {
  1149. c := &ProjectsEventsReportCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1150. c.projectName = projectName
  1151. c.reportederrorevent = reportederrorevent
  1152. return c
  1153. }
  1154. // Fields allows partial responses to be retrieved. See
  1155. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1156. // for more information.
  1157. func (c *ProjectsEventsReportCall) Fields(s ...googleapi.Field) *ProjectsEventsReportCall {
  1158. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1159. return c
  1160. }
  1161. // Context sets the context to be used in this call's Do method. Any
  1162. // pending HTTP request will be aborted if the provided context is
  1163. // canceled.
  1164. func (c *ProjectsEventsReportCall) Context(ctx context.Context) *ProjectsEventsReportCall {
  1165. c.ctx_ = ctx
  1166. return c
  1167. }
  1168. // Header returns an http.Header that can be modified by the caller to
  1169. // add HTTP headers to the request.
  1170. func (c *ProjectsEventsReportCall) Header() http.Header {
  1171. if c.header_ == nil {
  1172. c.header_ = make(http.Header)
  1173. }
  1174. return c.header_
  1175. }
  1176. func (c *ProjectsEventsReportCall) doRequest(alt string) (*http.Response, error) {
  1177. reqHeaders := make(http.Header)
  1178. for k, v := range c.header_ {
  1179. reqHeaders[k] = v
  1180. }
  1181. reqHeaders.Set("User-Agent", c.s.userAgent())
  1182. var body io.Reader = nil
  1183. body, err := googleapi.WithoutDataWrapper.JSONReader(c.reportederrorevent)
  1184. if err != nil {
  1185. return nil, err
  1186. }
  1187. reqHeaders.Set("Content-Type", "application/json")
  1188. c.urlParams_.Set("alt", alt)
  1189. c.urlParams_.Set("prettyPrint", "false")
  1190. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+projectName}/events:report")
  1191. urls += "?" + c.urlParams_.Encode()
  1192. req, err := http.NewRequest("POST", urls, body)
  1193. if err != nil {
  1194. return nil, err
  1195. }
  1196. req.Header = reqHeaders
  1197. googleapi.Expand(req.URL, map[string]string{
  1198. "projectName": c.projectName,
  1199. })
  1200. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1201. }
  1202. // Do executes the "clouderrorreporting.projects.events.report" call.
  1203. // Exactly one of *ReportErrorEventResponse or error will be non-nil.
  1204. // Any non-2xx status code is an error. Response headers are in either
  1205. // *ReportErrorEventResponse.ServerResponse.Header or (if a response was
  1206. // returned at all) in error.(*googleapi.Error).Header. Use
  1207. // googleapi.IsNotModified to check whether the returned error was
  1208. // because http.StatusNotModified was returned.
  1209. func (c *ProjectsEventsReportCall) Do(opts ...googleapi.CallOption) (*ReportErrorEventResponse, error) {
  1210. gensupport.SetOptions(c.urlParams_, opts...)
  1211. res, err := c.doRequest("json")
  1212. if res != nil && res.StatusCode == http.StatusNotModified {
  1213. if res.Body != nil {
  1214. res.Body.Close()
  1215. }
  1216. return nil, &googleapi.Error{
  1217. Code: res.StatusCode,
  1218. Header: res.Header,
  1219. }
  1220. }
  1221. if err != nil {
  1222. return nil, err
  1223. }
  1224. defer googleapi.CloseBody(res)
  1225. if err := googleapi.CheckResponse(res); err != nil {
  1226. return nil, err
  1227. }
  1228. ret := &ReportErrorEventResponse{
  1229. ServerResponse: googleapi.ServerResponse{
  1230. Header: res.Header,
  1231. HTTPStatusCode: res.StatusCode,
  1232. },
  1233. }
  1234. target := &ret
  1235. if err := gensupport.DecodeResponse(target, res); err != nil {
  1236. return nil, err
  1237. }
  1238. return ret, nil
  1239. // {
  1240. // "description": "Report an individual error event.\n\nThis endpoint accepts **either** an OAuth token,\n**or** an [API key](https://support.google.com/cloud/answer/6158862)\nfor authentication. To use an API key, append it to the URL as the value of\na `key` parameter. For example:\n\n`POST https://clouderrorreporting.googleapis.com/v1beta1/projects/example-project/events:report?key=123ABC456`",
  1241. // "flatPath": "v1beta1/projects/{projectsId}/events:report",
  1242. // "httpMethod": "POST",
  1243. // "id": "clouderrorreporting.projects.events.report",
  1244. // "parameterOrder": [
  1245. // "projectName"
  1246. // ],
  1247. // "parameters": {
  1248. // "projectName": {
  1249. // "description": "[Required] The resource name of the Google Cloud Platform project. Written\nas `projects/` plus the\n[Google Cloud Platform project ID](https://support.google.com/cloud/answer/6158840).\nExample: `projects/my-project-123`.",
  1250. // "location": "path",
  1251. // "pattern": "^projects/[^/]+$",
  1252. // "required": true,
  1253. // "type": "string"
  1254. // }
  1255. // },
  1256. // "path": "v1beta1/{+projectName}/events:report",
  1257. // "request": {
  1258. // "$ref": "ReportedErrorEvent"
  1259. // },
  1260. // "response": {
  1261. // "$ref": "ReportErrorEventResponse"
  1262. // },
  1263. // "scopes": [
  1264. // "https://www.googleapis.com/auth/cloud-platform"
  1265. // ]
  1266. // }
  1267. }
  1268. // method id "clouderrorreporting.projects.groupStats.list":
  1269. type ProjectsGroupStatsListCall struct {
  1270. s *Service
  1271. projectName string
  1272. urlParams_ gensupport.URLParams
  1273. ifNoneMatch_ string
  1274. ctx_ context.Context
  1275. header_ http.Header
  1276. }
  1277. // List: Lists the specified groups.
  1278. func (r *ProjectsGroupStatsService) List(projectName string) *ProjectsGroupStatsListCall {
  1279. c := &ProjectsGroupStatsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1280. c.projectName = projectName
  1281. return c
  1282. }
  1283. // Alignment sets the optional parameter "alignment": [Optional] The
  1284. // alignment of the timed counts to be returned.
  1285. // Default is `ALIGNMENT_EQUAL_AT_END`.
  1286. //
  1287. // Possible values:
  1288. // "ERROR_COUNT_ALIGNMENT_UNSPECIFIED"
  1289. // "ALIGNMENT_EQUAL_ROUNDED"
  1290. // "ALIGNMENT_EQUAL_AT_END"
  1291. func (c *ProjectsGroupStatsListCall) Alignment(alignment string) *ProjectsGroupStatsListCall {
  1292. c.urlParams_.Set("alignment", alignment)
  1293. return c
  1294. }
  1295. // AlignmentTime sets the optional parameter "alignmentTime": [Optional]
  1296. // Time where the timed counts shall be aligned if rounded
  1297. // alignment is chosen. Default is 00:00 UTC.
  1298. func (c *ProjectsGroupStatsListCall) AlignmentTime(alignmentTime string) *ProjectsGroupStatsListCall {
  1299. c.urlParams_.Set("alignmentTime", alignmentTime)
  1300. return c
  1301. }
  1302. // GroupId sets the optional parameter "groupId": [Optional] List all
  1303. // <code>ErrorGroupStats</code> with these IDs.
  1304. func (c *ProjectsGroupStatsListCall) GroupId(groupId ...string) *ProjectsGroupStatsListCall {
  1305. c.urlParams_.SetMulti("groupId", append([]string{}, groupId...))
  1306. return c
  1307. }
  1308. // Order sets the optional parameter "order": [Optional] The sort order
  1309. // in which the results are returned.
  1310. // Default is `COUNT_DESC`.
  1311. //
  1312. // Possible values:
  1313. // "GROUP_ORDER_UNSPECIFIED"
  1314. // "COUNT_DESC"
  1315. // "LAST_SEEN_DESC"
  1316. // "CREATED_DESC"
  1317. // "AFFECTED_USERS_DESC"
  1318. func (c *ProjectsGroupStatsListCall) Order(order string) *ProjectsGroupStatsListCall {
  1319. c.urlParams_.Set("order", order)
  1320. return c
  1321. }
  1322. // PageSize sets the optional parameter "pageSize": [Optional] The
  1323. // maximum number of results to return per response.
  1324. // Default is 20.
  1325. func (c *ProjectsGroupStatsListCall) PageSize(pageSize int64) *ProjectsGroupStatsListCall {
  1326. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1327. return c
  1328. }
  1329. // PageToken sets the optional parameter "pageToken": [Optional] A
  1330. // `next_page_token` provided by a previous response. To view
  1331. // additional results, pass this token along with the identical
  1332. // query
  1333. // parameters as the first request.
  1334. func (c *ProjectsGroupStatsListCall) PageToken(pageToken string) *ProjectsGroupStatsListCall {
  1335. c.urlParams_.Set("pageToken", pageToken)
  1336. return c
  1337. }
  1338. // ServiceFilterResourceType sets the optional parameter
  1339. // "serviceFilter.resourceType": [Optional] The exact value to match
  1340. // against
  1341. // [`ServiceContext.resource_type`](/error-reporting/reference/re
  1342. // st/v1beta1/ServiceContext#FIELDS.resource_type).
  1343. func (c *ProjectsGroupStatsListCall) ServiceFilterResourceType(serviceFilterResourceType string) *ProjectsGroupStatsListCall {
  1344. c.urlParams_.Set("serviceFilter.resourceType", serviceFilterResourceType)
  1345. return c
  1346. }
  1347. // ServiceFilterService sets the optional parameter
  1348. // "serviceFilter.service": [Optional] The exact value to match
  1349. // against
  1350. // [`ServiceContext.service`](/error-reporting/reference/rest/v1b
  1351. // eta1/ServiceContext#FIELDS.service).
  1352. func (c *ProjectsGroupStatsListCall) ServiceFilterService(serviceFilterService string) *ProjectsGroupStatsListCall {
  1353. c.urlParams_.Set("serviceFilter.service", serviceFilterService)
  1354. return c
  1355. }
  1356. // ServiceFilterVersion sets the optional parameter
  1357. // "serviceFilter.version": [Optional] The exact value to match
  1358. // against
  1359. // [`ServiceContext.version`](/error-reporting/reference/rest/v1b
  1360. // eta1/ServiceContext#FIELDS.version).
  1361. func (c *ProjectsGroupStatsListCall) ServiceFilterVersion(serviceFilterVersion string) *ProjectsGroupStatsListCall {
  1362. c.urlParams_.Set("serviceFilter.version", serviceFilterVersion)
  1363. return c
  1364. }
  1365. // TimeRangePeriod sets the optional parameter "timeRange.period":
  1366. // Restricts the query to the specified time range.
  1367. //
  1368. // Possible values:
  1369. // "PERIOD_UNSPECIFIED"
  1370. // "PERIOD_1_HOUR"
  1371. // "PERIOD_6_HOURS"
  1372. // "PERIOD_1_DAY"
  1373. // "PERIOD_1_WEEK"
  1374. // "PERIOD_30_DAYS"
  1375. func (c *ProjectsGroupStatsListCall) TimeRangePeriod(timeRangePeriod string) *ProjectsGroupStatsListCall {
  1376. c.urlParams_.Set("timeRange.period", timeRangePeriod)
  1377. return c
  1378. }
  1379. // TimedCountDuration sets the optional parameter "timedCountDuration":
  1380. // [Optional] The preferred duration for a single returned
  1381. // `TimedCount`.
  1382. // If not set, no timed counts are returned.
  1383. func (c *ProjectsGroupStatsListCall) TimedCountDuration(timedCountDuration string) *ProjectsGroupStatsListCall {
  1384. c.urlParams_.Set("timedCountDuration", timedCountDuration)
  1385. return c
  1386. }
  1387. // Fields allows partial responses to be retrieved. See
  1388. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1389. // for more information.
  1390. func (c *ProjectsGroupStatsListCall) Fields(s ...googleapi.Field) *ProjectsGroupStatsListCall {
  1391. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1392. return c
  1393. }
  1394. // IfNoneMatch sets the optional parameter which makes the operation
  1395. // fail if the object's ETag matches the given value. This is useful for
  1396. // getting updates only after the object has changed since the last
  1397. // request. Use googleapi.IsNotModified to check whether the response
  1398. // error from Do is the result of In-None-Match.
  1399. func (c *ProjectsGroupStatsListCall) IfNoneMatch(entityTag string) *ProjectsGroupStatsListCall {
  1400. c.ifNoneMatch_ = entityTag
  1401. return c
  1402. }
  1403. // Context sets the context to be used in this call's Do method. Any
  1404. // pending HTTP request will be aborted if the provided context is
  1405. // canceled.
  1406. func (c *ProjectsGroupStatsListCall) Context(ctx context.Context) *ProjectsGroupStatsListCall {
  1407. c.ctx_ = ctx
  1408. return c
  1409. }
  1410. // Header returns an http.Header that can be modified by the caller to
  1411. // add HTTP headers to the request.
  1412. func (c *ProjectsGroupStatsListCall) Header() http.Header {
  1413. if c.header_ == nil {
  1414. c.header_ = make(http.Header)
  1415. }
  1416. return c.header_
  1417. }
  1418. func (c *ProjectsGroupStatsListCall) doRequest(alt string) (*http.Response, error) {
  1419. reqHeaders := make(http.Header)
  1420. for k, v := range c.header_ {
  1421. reqHeaders[k] = v
  1422. }
  1423. reqHeaders.Set("User-Agent", c.s.userAgent())
  1424. if c.ifNoneMatch_ != "" {
  1425. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1426. }
  1427. var body io.Reader = nil
  1428. c.urlParams_.Set("alt", alt)
  1429. c.urlParams_.Set("prettyPrint", "false")
  1430. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+projectName}/groupStats")
  1431. urls += "?" + c.urlParams_.Encode()
  1432. req, err := http.NewRequest("GET", urls, body)
  1433. if err != nil {
  1434. return nil, err
  1435. }
  1436. req.Header = reqHeaders
  1437. googleapi.Expand(req.URL, map[string]string{
  1438. "projectName": c.projectName,
  1439. })
  1440. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1441. }
  1442. // Do executes the "clouderrorreporting.projects.groupStats.list" call.
  1443. // Exactly one of *ListGroupStatsResponse or error will be non-nil. Any
  1444. // non-2xx status code is an error. Response headers are in either
  1445. // *ListGroupStatsResponse.ServerResponse.Header or (if a response was
  1446. // returned at all) in error.(*googleapi.Error).Header. Use
  1447. // googleapi.IsNotModified to check whether the returned error was
  1448. // because http.StatusNotModified was returned.
  1449. func (c *ProjectsGroupStatsListCall) Do(opts ...googleapi.CallOption) (*ListGroupStatsResponse, error) {
  1450. gensupport.SetOptions(c.urlParams_, opts...)
  1451. res, err := c.doRequest("json")
  1452. if res != nil && res.StatusCode == http.StatusNotModified {
  1453. if res.Body != nil {
  1454. res.Body.Close()
  1455. }
  1456. return nil, &googleapi.Error{
  1457. Code: res.StatusCode,
  1458. Header: res.Header,
  1459. }
  1460. }
  1461. if err != nil {
  1462. return nil, err
  1463. }
  1464. defer googleapi.CloseBody(res)
  1465. if err := googleapi.CheckResponse(res); err != nil {
  1466. return nil, err
  1467. }
  1468. ret := &ListGroupStatsResponse{
  1469. ServerResponse: googleapi.ServerResponse{
  1470. Header: res.Header,
  1471. HTTPStatusCode: res.StatusCode,
  1472. },
  1473. }
  1474. target := &ret
  1475. if err := gensupport.DecodeResponse(target, res); err != nil {
  1476. return nil, err
  1477. }
  1478. return ret, nil
  1479. // {
  1480. // "description": "Lists the specified groups.",
  1481. // "flatPath": "v1beta1/projects/{projectsId}/groupStats",
  1482. // "httpMethod": "GET",
  1483. // "id": "clouderrorreporting.projects.groupStats.list",
  1484. // "parameterOrder": [
  1485. // "projectName"
  1486. // ],
  1487. // "parameters": {
  1488. // "alignment": {
  1489. // "description": "[Optional] The alignment of the timed counts to be returned.\nDefault is `ALIGNMENT_EQUAL_AT_END`.",
  1490. // "enum": [
  1491. // "ERROR_COUNT_ALIGNMENT_UNSPECIFIED",
  1492. // "ALIGNMENT_EQUAL_ROUNDED",
  1493. // "ALIGNMENT_EQUAL_AT_END"
  1494. // ],
  1495. // "location": "query",
  1496. // "type": "string"
  1497. // },
  1498. // "alignmentTime": {
  1499. // "description": "[Optional] Time where the timed counts shall be aligned if rounded\nalignment is chosen. Default is 00:00 UTC.",
  1500. // "format": "google-datetime",
  1501. // "location": "query",
  1502. // "type": "string"
  1503. // },
  1504. // "groupId": {
  1505. // "description": "[Optional] List all \u003ccode\u003eErrorGroupStats\u003c/code\u003e with these IDs.",
  1506. // "location": "query",
  1507. // "repeated": true,
  1508. // "type": "string"
  1509. // },
  1510. // "order": {
  1511. // "description": "[Optional] The sort order in which the results are returned.\nDefault is `COUNT_DESC`.",
  1512. // "enum": [
  1513. // "GROUP_ORDER_UNSPECIFIED",
  1514. // "COUNT_DESC",
  1515. // "LAST_SEEN_DESC",
  1516. // "CREATED_DESC",
  1517. // "AFFECTED_USERS_DESC"
  1518. // ],
  1519. // "location": "query",
  1520. // "type": "string"
  1521. // },
  1522. // "pageSize": {
  1523. // "description": "[Optional] The maximum number of results to return per response.\nDefault is 20.",
  1524. // "format": "int32",
  1525. // "location": "query",
  1526. // "type": "integer"
  1527. // },
  1528. // "pageToken": {
  1529. // "description": "[Optional] A `next_page_token` provided by a previous response. To view\nadditional results, pass this token along with the identical query\nparameters as the first request.",
  1530. // "location": "query",
  1531. // "type": "string"
  1532. // },
  1533. // "projectName": {
  1534. // "description": "[Required] The resource name of the Google Cloud Platform project. Written\nas \u003ccode\u003eprojects/\u003c/code\u003e plus the\n\u003ca href=\"https://support.google.com/cloud/answer/6158840\"\u003eGoogle Cloud\nPlatform project ID\u003c/a\u003e.\n\nExample: \u003ccode\u003eprojects/my-project-123\u003c/code\u003e.",
  1535. // "location": "path",
  1536. // "pattern": "^projects/[^/]+$",
  1537. // "required": true,
  1538. // "type": "string"
  1539. // },
  1540. // "serviceFilter.resourceType": {
  1541. // "description": "[Optional] The exact value to match against\n[`ServiceContext.resource_type`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.resource_type).",
  1542. // "location": "query",
  1543. // "type": "string"
  1544. // },
  1545. // "serviceFilter.service": {
  1546. // "description": "[Optional] The exact value to match against\n[`ServiceContext.service`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service).",
  1547. // "location": "query",
  1548. // "type": "string"
  1549. // },
  1550. // "serviceFilter.version": {
  1551. // "description": "[Optional] The exact value to match against\n[`ServiceContext.version`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version).",
  1552. // "location": "query",
  1553. // "type": "string"
  1554. // },
  1555. // "timeRange.period": {
  1556. // "description": "Restricts the query to the specified time range.",
  1557. // "enum": [
  1558. // "PERIOD_UNSPECIFIED",
  1559. // "PERIOD_1_HOUR",
  1560. // "PERIOD_6_HOURS",
  1561. // "PERIOD_1_DAY",
  1562. // "PERIOD_1_WEEK",
  1563. // "PERIOD_30_DAYS"
  1564. // ],
  1565. // "location": "query",
  1566. // "type": "string"
  1567. // },
  1568. // "timedCountDuration": {
  1569. // "description": "[Optional] The preferred duration for a single returned `TimedCount`.\nIf not set, no timed counts are returned.",
  1570. // "format": "google-duration",
  1571. // "location": "query",
  1572. // "type": "string"
  1573. // }
  1574. // },
  1575. // "path": "v1beta1/{+projectName}/groupStats",
  1576. // "response": {
  1577. // "$ref": "ListGroupStatsResponse"
  1578. // },
  1579. // "scopes": [
  1580. // "https://www.googleapis.com/auth/cloud-platform"
  1581. // ]
  1582. // }
  1583. }
  1584. // Pages invokes f for each page of results.
  1585. // A non-nil error returned from f will halt the iteration.
  1586. // The provided context supersedes any context provided to the Context method.
  1587. func (c *ProjectsGroupStatsListCall) Pages(ctx context.Context, f func(*ListGroupStatsResponse) error) error {
  1588. c.ctx_ = ctx
  1589. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1590. for {
  1591. x, err := c.Do()
  1592. if err != nil {
  1593. return err
  1594. }
  1595. if err := f(x); err != nil {
  1596. return err
  1597. }
  1598. if x.NextPageToken == "" {
  1599. return nil
  1600. }
  1601. c.PageToken(x.NextPageToken)
  1602. }
  1603. }
  1604. // method id "clouderrorreporting.projects.groups.get":
  1605. type ProjectsGroupsGetCall struct {
  1606. s *Service
  1607. groupName string
  1608. urlParams_ gensupport.URLParams
  1609. ifNoneMatch_ string
  1610. ctx_ context.Context
  1611. header_ http.Header
  1612. }
  1613. // Get: Get the specified group.
  1614. func (r *ProjectsGroupsService) Get(groupName string) *ProjectsGroupsGetCall {
  1615. c := &ProjectsGroupsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1616. c.groupName = groupName
  1617. return c
  1618. }
  1619. // Fields allows partial responses to be retrieved. See
  1620. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1621. // for more information.
  1622. func (c *ProjectsGroupsGetCall) Fields(s ...googleapi.Field) *ProjectsGroupsGetCall {
  1623. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1624. return c
  1625. }
  1626. // IfNoneMatch sets the optional parameter which makes the operation
  1627. // fail if the object's ETag matches the given value. This is useful for
  1628. // getting updates only after the object has changed since the last
  1629. // request. Use googleapi.IsNotModified to check whether the response
  1630. // error from Do is the result of In-None-Match.
  1631. func (c *ProjectsGroupsGetCall) IfNoneMatch(entityTag string) *ProjectsGroupsGetCall {
  1632. c.ifNoneMatch_ = entityTag
  1633. return c
  1634. }
  1635. // Context sets the context to be used in this call's Do method. Any
  1636. // pending HTTP request will be aborted if the provided context is
  1637. // canceled.
  1638. func (c *ProjectsGroupsGetCall) Context(ctx context.Context) *ProjectsGroupsGetCall {
  1639. c.ctx_ = ctx
  1640. return c
  1641. }
  1642. // Header returns an http.Header that can be modified by the caller to
  1643. // add HTTP headers to the request.
  1644. func (c *ProjectsGroupsGetCall) Header() http.Header {
  1645. if c.header_ == nil {
  1646. c.header_ = make(http.Header)
  1647. }
  1648. return c.header_
  1649. }
  1650. func (c *ProjectsGroupsGetCall) doRequest(alt string) (*http.Response, error) {
  1651. reqHeaders := make(http.Header)
  1652. for k, v := range c.header_ {
  1653. reqHeaders[k] = v
  1654. }
  1655. reqHeaders.Set("User-Agent", c.s.userAgent())
  1656. if c.ifNoneMatch_ != "" {
  1657. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1658. }
  1659. var body io.Reader = nil
  1660. c.urlParams_.Set("alt", alt)
  1661. c.urlParams_.Set("prettyPrint", "false")
  1662. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+groupName}")
  1663. urls += "?" + c.urlParams_.Encode()
  1664. req, err := http.NewRequest("GET", urls, body)
  1665. if err != nil {
  1666. return nil, err
  1667. }
  1668. req.Header = reqHeaders
  1669. googleapi.Expand(req.URL, map[string]string{
  1670. "groupName": c.groupName,
  1671. })
  1672. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1673. }
  1674. // Do executes the "clouderrorreporting.projects.groups.get" call.
  1675. // Exactly one of *ErrorGroup or error will be non-nil. Any non-2xx
  1676. // status code is an error. Response headers are in either
  1677. // *ErrorGroup.ServerResponse.Header or (if a response was returned at
  1678. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1679. // to check whether the returned error was because
  1680. // http.StatusNotModified was returned.
  1681. func (c *ProjectsGroupsGetCall) Do(opts ...googleapi.CallOption) (*ErrorGroup, error) {
  1682. gensupport.SetOptions(c.urlParams_, opts...)
  1683. res, err := c.doRequest("json")
  1684. if res != nil && res.StatusCode == http.StatusNotModified {
  1685. if res.Body != nil {
  1686. res.Body.Close()
  1687. }
  1688. return nil, &googleapi.Error{
  1689. Code: res.StatusCode,
  1690. Header: res.Header,
  1691. }
  1692. }
  1693. if err != nil {
  1694. return nil, err
  1695. }
  1696. defer googleapi.CloseBody(res)
  1697. if err := googleapi.CheckResponse(res); err != nil {
  1698. return nil, err
  1699. }
  1700. ret := &ErrorGroup{
  1701. ServerResponse: googleapi.ServerResponse{
  1702. Header: res.Header,
  1703. HTTPStatusCode: res.StatusCode,
  1704. },
  1705. }
  1706. target := &ret
  1707. if err := gensupport.DecodeResponse(target, res); err != nil {
  1708. return nil, err
  1709. }
  1710. return ret, nil
  1711. // {
  1712. // "description": "Get the specified group.",
  1713. // "flatPath": "v1beta1/projects/{projectsId}/groups/{groupsId}",
  1714. // "httpMethod": "GET",
  1715. // "id": "clouderrorreporting.projects.groups.get",
  1716. // "parameterOrder": [
  1717. // "groupName"
  1718. // ],
  1719. // "parameters": {
  1720. // "groupName": {
  1721. // "description": "[Required] The group resource name. Written as\n\u003ccode\u003eprojects/\u003cvar\u003eprojectID\u003c/var\u003e/groups/\u003cvar\u003egroup_name\u003c/var\u003e\u003c/code\u003e.\nCall\n\u003ca href=\"/error-reporting/reference/rest/v1beta1/projects.groupStats/list\"\u003e\n\u003ccode\u003egroupStats.list\u003c/code\u003e\u003c/a\u003e to return a list of groups belonging to\nthis project.\n\nExample: \u003ccode\u003eprojects/my-project-123/groups/my-group\u003c/code\u003e",
  1722. // "location": "path",
  1723. // "pattern": "^projects/[^/]+/groups/[^/]+$",
  1724. // "required": true,
  1725. // "type": "string"
  1726. // }
  1727. // },
  1728. // "path": "v1beta1/{+groupName}",
  1729. // "response": {
  1730. // "$ref": "ErrorGroup"
  1731. // },
  1732. // "scopes": [
  1733. // "https://www.googleapis.com/auth/cloud-platform"
  1734. // ]
  1735. // }
  1736. }
  1737. // method id "clouderrorreporting.projects.groups.update":
  1738. type ProjectsGroupsUpdateCall struct {
  1739. s *Service
  1740. name string
  1741. errorgroup *ErrorGroup
  1742. urlParams_ gensupport.URLParams
  1743. ctx_ context.Context
  1744. header_ http.Header
  1745. }
  1746. // Update: Replace the data for the specified group.
  1747. // Fails if the group does not exist.
  1748. func (r *ProjectsGroupsService) Update(name string, errorgroup *ErrorGroup) *ProjectsGroupsUpdateCall {
  1749. c := &ProjectsGroupsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1750. c.name = name
  1751. c.errorgroup = errorgroup
  1752. return c
  1753. }
  1754. // Fields allows partial responses to be retrieved. See
  1755. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1756. // for more information.
  1757. func (c *ProjectsGroupsUpdateCall) Fields(s ...googleapi.Field) *ProjectsGroupsUpdateCall {
  1758. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1759. return c
  1760. }
  1761. // Context sets the context to be used in this call's Do method. Any
  1762. // pending HTTP request will be aborted if the provided context is
  1763. // canceled.
  1764. func (c *ProjectsGroupsUpdateCall) Context(ctx context.Context) *ProjectsGroupsUpdateCall {
  1765. c.ctx_ = ctx
  1766. return c
  1767. }
  1768. // Header returns an http.Header that can be modified by the caller to
  1769. // add HTTP headers to the request.
  1770. func (c *ProjectsGroupsUpdateCall) Header() http.Header {
  1771. if c.header_ == nil {
  1772. c.header_ = make(http.Header)
  1773. }
  1774. return c.header_
  1775. }
  1776. func (c *ProjectsGroupsUpdateCall) doRequest(alt string) (*http.Response, error) {
  1777. reqHeaders := make(http.Header)
  1778. for k, v := range c.header_ {
  1779. reqHeaders[k] = v
  1780. }
  1781. reqHeaders.Set("User-Agent", c.s.userAgent())
  1782. var body io.Reader = nil
  1783. body, err := googleapi.WithoutDataWrapper.JSONReader(c.errorgroup)
  1784. if err != nil {
  1785. return nil, err
  1786. }
  1787. reqHeaders.Set("Content-Type", "application/json")
  1788. c.urlParams_.Set("alt", alt)
  1789. c.urlParams_.Set("prettyPrint", "false")
  1790. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  1791. urls += "?" + c.urlParams_.Encode()
  1792. req, err := http.NewRequest("PUT", urls, body)
  1793. if err != nil {
  1794. return nil, err
  1795. }
  1796. req.Header = reqHeaders
  1797. googleapi.Expand(req.URL, map[string]string{
  1798. "name": c.name,
  1799. })
  1800. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1801. }
  1802. // Do executes the "clouderrorreporting.projects.groups.update" call.
  1803. // Exactly one of *ErrorGroup or error will be non-nil. Any non-2xx
  1804. // status code is an error. Response headers are in either
  1805. // *ErrorGroup.ServerResponse.Header or (if a response was returned at
  1806. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1807. // to check whether the returned error was because
  1808. // http.StatusNotModified was returned.
  1809. func (c *ProjectsGroupsUpdateCall) Do(opts ...googleapi.CallOption) (*ErrorGroup, error) {
  1810. gensupport.SetOptions(c.urlParams_, opts...)
  1811. res, err := c.doRequest("json")
  1812. if res != nil && res.StatusCode == http.StatusNotModified {
  1813. if res.Body != nil {
  1814. res.Body.Close()
  1815. }
  1816. return nil, &googleapi.Error{
  1817. Code: res.StatusCode,
  1818. Header: res.Header,
  1819. }
  1820. }
  1821. if err != nil {
  1822. return nil, err
  1823. }
  1824. defer googleapi.CloseBody(res)
  1825. if err := googleapi.CheckResponse(res); err != nil {
  1826. return nil, err
  1827. }
  1828. ret := &ErrorGroup{
  1829. ServerResponse: googleapi.ServerResponse{
  1830. Header: res.Header,
  1831. HTTPStatusCode: res.StatusCode,
  1832. },
  1833. }
  1834. target := &ret
  1835. if err := gensupport.DecodeResponse(target, res); err != nil {
  1836. return nil, err
  1837. }
  1838. return ret, nil
  1839. // {
  1840. // "description": "Replace the data for the specified group.\nFails if the group does not exist.",
  1841. // "flatPath": "v1beta1/projects/{projectsId}/groups/{groupsId}",
  1842. // "httpMethod": "PUT",
  1843. // "id": "clouderrorreporting.projects.groups.update",
  1844. // "parameterOrder": [
  1845. // "name"
  1846. // ],
  1847. // "parameters": {
  1848. // "name": {
  1849. // "description": "The group resource name.\nExample: \u003ccode\u003eprojects/my-project-123/groups/my-groupid\u003c/code\u003e",
  1850. // "location": "path",
  1851. // "pattern": "^projects/[^/]+/groups/[^/]+$",
  1852. // "required": true,
  1853. // "type": "string"
  1854. // }
  1855. // },
  1856. // "path": "v1beta1/{+name}",
  1857. // "request": {
  1858. // "$ref": "ErrorGroup"
  1859. // },
  1860. // "response": {
  1861. // "$ref": "ErrorGroup"
  1862. // },
  1863. // "scopes": [
  1864. // "https://www.googleapis.com/auth/cloud-platform"
  1865. // ]
  1866. // }
  1867. }