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\Logging\Resource;
19
20use Google\Service\Logging\ListViewsResponse;
21use Google\Service\Logging\LogView;
22use Google\Service\Logging\LoggingEmpty;
23
24/**
25 * The "views" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $loggingService = new Google\Service\Logging(...);
29 *   $views = $loggingService->views;
30 *  </code>
31 */
32class FoldersLocationsBucketsViews extends \Google\Service\Resource
33{
34  /**
35   * Creates a view over log entries in a log bucket. A bucket may contain a
36   * maximum of 30 views. (views.create)
37   *
38   * @param string $parent Required. The bucket in which to create the view
39   * `"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"` For
40   * example:"projects/my-project/locations/global/buckets/my-bucket"
41   * @param LogView $postBody
42   * @param array $optParams Optional parameters.
43   *
44   * @opt_param string viewId Required. The id to use for this view.
45   * @return LogView
46   */
47  public function create($parent, LogView $postBody, $optParams = [])
48  {
49    $params = ['parent' => $parent, 'postBody' => $postBody];
50    $params = array_merge($params, $optParams);
51    return $this->call('create', [$params], LogView::class);
52  }
53  /**
54   * Deletes a view on a log bucket. If an UNAVAILABLE error is returned, this
55   * indicates that system is not in a state where it can delete the view. If this
56   * occurs, please try again in a few minutes. (views.delete)
57   *
58   * @param string $name Required. The full resource name of the view to delete: "
59   * projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW
60   * _ID]" For example:"projects/my-project/locations/global/buckets/my-
61   * bucket/views/my-view"
62   * @param array $optParams Optional parameters.
63   * @return LoggingEmpty
64   */
65  public function delete($name, $optParams = [])
66  {
67    $params = ['name' => $name];
68    $params = array_merge($params, $optParams);
69    return $this->call('delete', [$params], LoggingEmpty::class);
70  }
71  /**
72   * Gets a view on a log bucket.. (views.get)
73   *
74   * @param string $name Required. The resource name of the policy: "projects/[PRO
75   * JECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" For
76   * example:"projects/my-project/locations/global/buckets/my-bucket/views/my-
77   * view"
78   * @param array $optParams Optional parameters.
79   * @return LogView
80   */
81  public function get($name, $optParams = [])
82  {
83    $params = ['name' => $name];
84    $params = array_merge($params, $optParams);
85    return $this->call('get', [$params], LogView::class);
86  }
87  /**
88   * Lists views on a log bucket. (views.listFoldersLocationsBucketsViews)
89   *
90   * @param string $parent Required. The bucket whose views are to be listed:
91   * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
92   * @param array $optParams Optional parameters.
93   *
94   * @opt_param int pageSize Optional. The maximum number of results to return
95   * from this request.Non-positive values are ignored. The presence of
96   * nextPageToken in the response indicates that more results might be available.
97   * @opt_param string pageToken Optional. If present, then retrieve the next
98   * batch of results from the preceding call to this method. pageToken must be
99   * the value of nextPageToken from the previous response. The values of other
100   * method parameters should be identical to those in the previous call.
101   * @return ListViewsResponse
102   */
103  public function listFoldersLocationsBucketsViews($parent, $optParams = [])
104  {
105    $params = ['parent' => $parent];
106    $params = array_merge($params, $optParams);
107    return $this->call('list', [$params], ListViewsResponse::class);
108  }
109  /**
110   * Updates a view on a log bucket. This method replaces the following fields in
111   * the existing view with values from the new view: filter. If an UNAVAILABLE
112   * error is returned, this indicates that system is not in a state where it can
113   * update the view. If this occurs, please try again in a few minutes.
114   * (views.patch)
115   *
116   * @param string $name Required. The full resource name of the view to update "p
117   * rojects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_
118   * ID]" For example:"projects/my-project/locations/global/buckets/my-
119   * bucket/views/my-view"
120   * @param LogView $postBody
121   * @param array $optParams Optional parameters.
122   *
123   * @opt_param string updateMask Optional. Field mask that specifies the fields
124   * in view that need an update. A field will be overwritten if, and only if, it
125   * is in the update mask. name and output only fields cannot be updated.For a
126   * detailed FieldMask definition, see https://developers.google.com/protocol-
127   * buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskFor example:
128   * updateMask=filter
129   * @return LogView
130   */
131  public function patch($name, LogView $postBody, $optParams = [])
132  {
133    $params = ['name' => $name, 'postBody' => $postBody];
134    $params = array_merge($params, $optParams);
135    return $this->call('patch', [$params], LogView::class);
136  }
137}
138
139// Adding a class alias for backwards compatibility with the previous class name.
140class_alias(FoldersLocationsBucketsViews::class, 'Google_Service_Logging_Resource_FoldersLocationsBucketsViews');
141