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 |
|
---|
18 | namespace Google\Service\Clouderrorreporting\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Clouderrorreporting\ListEventsResponse;
|
---|
21 | use Google\Service\Clouderrorreporting\ReportErrorEventResponse;
|
---|
22 | use 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->projects_events;
|
---|
30 | * </code>
|
---|
31 | */
|
---|
32 | class 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}` or
|
---|
39 | * `projects/{projectID}/locations/{location}`, where `{projectID}` is the
|
---|
40 | * [Google Cloud Platform project
|
---|
41 | * ID](https://support.google.com/cloud/answer/6158840) and `{location}` is a
|
---|
42 | * Cloud region. Examples: `projects/my-project-123`, `projects/my-
|
---|
43 | * project-123/locations/global`. For a list of supported locations, see
|
---|
44 | * [Supported Regions](https://cloud.google.com/logging/docs/region-support).
|
---|
45 | * `global` is the default when unspecified.
|
---|
46 | * @param array $optParams Optional parameters.
|
---|
47 | *
|
---|
48 | * @opt_param string groupId Required. The group for which events shall be
|
---|
49 | * returned. The `group_id` is a unique identifier for a particular error group.
|
---|
50 | * The identifier is derived from key parts of the error-log content and is
|
---|
51 | * treated as Service Data. For information about how Service Data is handled,
|
---|
52 | * see [Google Cloud Privacy Notice](https://cloud.google.com/terms/cloud-
|
---|
53 | * privacy-notice).
|
---|
54 | * @opt_param int pageSize Optional. The maximum number of results to return per
|
---|
55 | * response.
|
---|
56 | * @opt_param string pageToken Optional. A `next_page_token` provided by a
|
---|
57 | * previous response.
|
---|
58 | * @opt_param string serviceFilter.resourceType Optional. The exact value to
|
---|
59 | * match against [`ServiceContext.resource_type`](/error-
|
---|
60 | * reporting/reference/rest/v1beta1/ServiceContext#FIELDS.resource_type).
|
---|
61 | * @opt_param string serviceFilter.service Optional. The exact value to match
|
---|
62 | * against [`ServiceContext.service`](/error-
|
---|
63 | * reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service).
|
---|
64 | * @opt_param string serviceFilter.version Optional. The exact value to match
|
---|
65 | * against [`ServiceContext.version`](/error-
|
---|
66 | * reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version).
|
---|
67 | * @opt_param string timeRange.period Restricts the query to the specified time
|
---|
68 | * range.
|
---|
69 | * @return ListEventsResponse
|
---|
70 | * @throws \Google\Service\Exception
|
---|
71 | */
|
---|
72 | public function listProjectsEvents($projectName, $optParams = [])
|
---|
73 | {
|
---|
74 | $params = ['projectName' => $projectName];
|
---|
75 | $params = array_merge($params, $optParams);
|
---|
76 | return $this->call('list', [$params], ListEventsResponse::class);
|
---|
77 | }
|
---|
78 | /**
|
---|
79 | * Report an individual error event and record the event to a log. This endpoint
|
---|
80 | * accepts **either** an OAuth token, **or** an [API
|
---|
81 | * key](https://support.google.com/cloud/answer/6158862) for authentication. To
|
---|
82 | * use an API key, append it to the URL as the value of a `key` parameter. For
|
---|
83 | * example: `POST https://clouderrorreporting.googleapis.com/v1beta1/{projectNam
|
---|
84 | * e}/events:report?key=123ABC456` **Note:** [Error Reporting]
|
---|
85 | * (https://cloud.google.com/error-reporting) is a service built on Cloud
|
---|
86 | * Logging and can analyze log entries when all of the following are true: *
|
---|
87 | * Customer-managed encryption keys (CMEK) are disabled on the log bucket. * The
|
---|
88 | * log bucket satisfies one of the following: * The log bucket is stored in the
|
---|
89 | * same project where the logs originated. * The logs were routed to a project,
|
---|
90 | * and then that project stored those logs in a log bucket that it owns.
|
---|
91 | * (events.report)
|
---|
92 | *
|
---|
93 | * @param string $projectName Required. The resource name of the Google Cloud
|
---|
94 | * Platform project. Written as `projects/{projectId}`, where `{projectId}` is
|
---|
95 | * the [Google Cloud Platform project
|
---|
96 | * ID](https://support.google.com/cloud/answer/6158840). Example: //
|
---|
97 | * `projects/my-project-123`.
|
---|
98 | * @param ReportedErrorEvent $postBody
|
---|
99 | * @param array $optParams Optional parameters.
|
---|
100 | * @return ReportErrorEventResponse
|
---|
101 | * @throws \Google\Service\Exception
|
---|
102 | */
|
---|
103 | public function report($projectName, ReportedErrorEvent $postBody, $optParams = [])
|
---|
104 | {
|
---|
105 | $params = ['projectName' => $projectName, 'postBody' => $postBody];
|
---|
106 | $params = array_merge($params, $optParams);
|
---|
107 | return $this->call('report', [$params], ReportErrorEventResponse::class);
|
---|
108 | }
|
---|
109 | }
|
---|
110 |
|
---|
111 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
112 | class_alias(ProjectsEvents::class, 'Google_Service_Clouderrorreporting_Resource_ProjectsEvents');
|
---|