Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

1982 linhas
71 KiB

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