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\ListBucketsResponse;
21use Google\Service\Logging\LogBucket;
22use Google\Service\Logging\LoggingEmpty;
23use Google\Service\Logging\UndeleteBucketRequest;
24
25/**
26 * The "buckets" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $loggingService = new Google\Service\Logging(...);
30 *   $buckets = $loggingService->buckets;
31 *  </code>
32 */
33class LocationsBuckets extends \Google\Service\Resource
34{
35  /**
36   * Creates a log bucket that can be used to store log entries. After a bucket
37   * has been created, the bucket's location cannot be changed. (buckets.create)
38   *
39   * @param string $parent Required. The resource in which to create the log
40   * bucket: "projects/[PROJECT_ID]/locations/[LOCATION_ID]" For example:"projects
41   * /my-project/locations/global"
42   * @param LogBucket $postBody
43   * @param array $optParams Optional parameters.
44   *
45   * @opt_param string bucketId Required. A client-assigned identifier such as
46   * "my-bucket". Identifiers are limited to 100 characters and can include only
47   * letters, digits, underscores, hyphens, and periods.
48   * @return LogBucket
49   */
50  public function create($parent, LogBucket $postBody, $optParams = [])
51  {
52    $params = ['parent' => $parent, 'postBody' => $postBody];
53    $params = array_merge($params, $optParams);
54    return $this->call('create', [$params], LogBucket::class);
55  }
56  /**
57   * Deletes a log bucket.Changes the bucket's lifecycle_state to the
58   * DELETE_REQUESTED state. After 7 days, the bucket will be purged and all log
59   * entries in the bucket will be permanently deleted. (buckets.delete)
60   *
61   * @param string $name Required. The full resource name of the bucket to delete.
62   * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
63   * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
64   * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET
65   * _ID]" "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" For
66   * example:"projects/my-project/locations/global/buckets/my-bucket"
67   * @param array $optParams Optional parameters.
68   * @return LoggingEmpty
69   */
70  public function delete($name, $optParams = [])
71  {
72    $params = ['name' => $name];
73    $params = array_merge($params, $optParams);
74    return $this->call('delete', [$params], LoggingEmpty::class);
75  }
76  /**
77   * Gets a log bucket. (buckets.get)
78   *
79   * @param string $name Required. The resource name of the bucket:
80   * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
81   * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
82   * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET
83   * _ID]" "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" For
84   * example:"projects/my-project/locations/global/buckets/my-bucket"
85   * @param array $optParams Optional parameters.
86   * @return LogBucket
87   */
88  public function get($name, $optParams = [])
89  {
90    $params = ['name' => $name];
91    $params = array_merge($params, $optParams);
92    return $this->call('get', [$params], LogBucket::class);
93  }
94  /**
95   * Lists log buckets. (buckets.listLocationsBuckets)
96   *
97   * @param string $parent Required. The parent resource whose buckets are to be
98   * listed: "projects/[PROJECT_ID]/locations/[LOCATION_ID]"
99   * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]"
100   * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]"
101   * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" Note: The locations portion of
102   * the resource must be specified, but supplying the character - in place of
103   * LOCATION_ID will return all buckets.
104   * @param array $optParams Optional parameters.
105   *
106   * @opt_param int pageSize Optional. The maximum number of results to return
107   * from this request. Non-positive values are ignored. The presence of
108   * nextPageToken in the response indicates that more results might be available.
109   * @opt_param string pageToken Optional. If present, then retrieve the next
110   * batch of results from the preceding call to this method. pageToken must be
111   * the value of nextPageToken from the previous response. The values of other
112   * method parameters should be identical to those in the previous call.
113   * @return ListBucketsResponse
114   */
115  public function listLocationsBuckets($parent, $optParams = [])
116  {
117    $params = ['parent' => $parent];
118    $params = array_merge($params, $optParams);
119    return $this->call('list', [$params], ListBucketsResponse::class);
120  }
121  /**
122   * Updates a log bucket. This method replaces the following fields in the
123   * existing bucket with values from the new bucket: retention_periodIf the
124   * retention period is decreased and the bucket is locked, FAILED_PRECONDITION
125   * will be returned.If the bucket has a lifecycle_state of DELETE_REQUESTED,
126   * then FAILED_PRECONDITION will be returned.After a bucket has been created,
127   * the bucket's location cannot be changed. (buckets.patch)
128   *
129   * @param string $name Required. The full resource name of the bucket to update.
130   * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
131   * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
132   * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET
133   * _ID]" "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" For
134   * example:"projects/my-project/locations/global/buckets/my-bucket"
135   * @param LogBucket $postBody
136   * @param array $optParams Optional parameters.
137   *
138   * @opt_param string updateMask Required. Field mask that specifies the fields
139   * in bucket that need an update. A bucket field will be overwritten if, and
140   * only if, it is in the update mask. name and output only fields cannot be
141   * updated.For a detailed FieldMask definition, see:
142   * https://developers.google.com/protocol-
143   * buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskFor example:
144   * updateMask=retention_days
145   * @return LogBucket
146   */
147  public function patch($name, LogBucket $postBody, $optParams = [])
148  {
149    $params = ['name' => $name, 'postBody' => $postBody];
150    $params = array_merge($params, $optParams);
151    return $this->call('patch', [$params], LogBucket::class);
152  }
153  /**
154   * Undeletes a log bucket. A bucket that has been deleted can be undeleted
155   * within the grace period of 7 days. (buckets.undelete)
156   *
157   * @param string $name Required. The full resource name of the bucket to
158   * undelete. "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
159   * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
160   * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET
161   * _ID]" "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" For
162   * example:"projects/my-project/locations/global/buckets/my-bucket"
163   * @param UndeleteBucketRequest $postBody
164   * @param array $optParams Optional parameters.
165   * @return LoggingEmpty
166   */
167  public function undelete($name, UndeleteBucketRequest $postBody, $optParams = [])
168  {
169    $params = ['name' => $name, 'postBody' => $postBody];
170    $params = array_merge($params, $optParams);
171    return $this->call('undelete', [$params], LoggingEmpty::class);
172  }
173}
174
175// Adding a class alias for backwards compatibility with the previous class name.
176class_alias(LocationsBuckets::class, 'Google_Service_Logging_Resource_LocationsBuckets');
177