1<?php
2/*
3 * Copyright 2014 Google Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17
18namespace Google\Service\Clouderrorreporting\Resource;
19
20use Google\Service\Clouderrorreporting\ListEventsResponse;
21use Google\Service\Clouderrorreporting\ReportErrorEventResponse;
22use Google\Service\Clouderrorreporting\ReportedErrorEvent;
23
24/**
25 * The "events" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $clouderrorreportingService = new Google\Service\Clouderrorreporting(...);
29 *   $events = $clouderrorreportingService->events;
30 *  </code>
31 */
32class ProjectsEvents extends \Google\Service\Resource
33{
34  /**
35   * Lists the specified events. (events.listProjectsEvents)
36   *
37   * @param string $projectName Required. The resource name of the Google Cloud
38   * Platform project. Written as `projects/{projectID}`, where `{projectID}` is
39   * the [Google Cloud Platform project
40   * ID](https://support.google.com/cloud/answer/6158840). Example: `projects/my-
41   * project-123`.
42   * @param array $optParams Optional parameters.
43   *
44   * @opt_param string groupId Required. The group for which events shall be
45   * returned.
46   * @opt_param int pageSize Optional. The maximum number of results to return per
47   * response.
48   * @opt_param string pageToken Optional. A `next_page_token` provided by a
49   * previous response.
50   * @opt_param string serviceFilter.resourceType Optional. The exact value to
51   * match against [`ServiceContext.resource_type`](/error-
52   * reporting/reference/rest/v1beta1/ServiceContext#FIELDS.resource_type).
53   * @opt_param string serviceFilter.service Optional. The exact value to match
54   * against [`ServiceContext.service`](/error-
55   * reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service).
56   * @opt_param string serviceFilter.version Optional. The exact value to match
57   * against [`ServiceContext.version`](/error-
58   * reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version).
59   * @opt_param string timeRange.period Restricts the query to the specified time
60   * range.
61   * @return ListEventsResponse
62   */
63  public function listProjectsEvents($projectName, $optParams = [])
64  {
65    $params = ['projectName' => $projectName];
66    $params = array_merge($params, $optParams);
67    return $this->call('list', [$params], ListEventsResponse::class);
68  }
69  /**
70   * Report an individual error event and record the event to a log. This endpoint
71   * accepts **either** an OAuth token, **or** an [API
72   * key](https://support.google.com/cloud/answer/6158862) for authentication. To
73   * use an API key, append it to the URL as the value of a `key` parameter. For
74   * example: `POST https://clouderrorreporting.googleapis.com/v1beta1/{projectNam
75   * e}/events:report?key=123ABC456` **Note:** [Error Reporting]
76   * (https://cloud.google.com/error-reporting) is a global service built on Cloud
77   * Logging and doesn't analyze logs stored in regional log buckets or logs
78   * routed to other Google Cloud projects. For more information, see [Using Error
79   * Reporting with regionalized logs] (https://cloud.google.com/error-
80   * reporting/docs/regionalization). (events.report)
81   *
82   * @param string $projectName Required. The resource name of the Google Cloud
83   * Platform project. Written as `projects/{projectId}`, where `{projectId}` is
84   * the [Google Cloud Platform project
85   * ID](https://support.google.com/cloud/answer/6158840). Example: // `projects
86   * /my-project-123`.
87   * @param ReportedErrorEvent $postBody
88   * @param array $optParams Optional parameters.
89   * @return ReportErrorEventResponse
90   */
91  public function report($projectName, ReportedErrorEvent $postBody, $optParams = [])
92  {
93    $params = ['projectName' => $projectName, 'postBody' => $postBody];
94    $params = array_merge($params, $optParams);
95    return $this->call('report', [$params], ReportErrorEventResponse::class);
96  }
97}
98
99// Adding a class alias for backwards compatibility with the previous class name.
100class_alias(ProjectsEvents::class, 'Google_Service_Clouderrorreporting_Resource_ProjectsEvents');
101