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 BillingAccountsLocationsBuckets 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   * Lists log buckets. (buckets.listBillingAccountsLocationsBuckets)
78   *
79   * @param string $parent Required. The parent resource whose buckets are to be
80   * listed: "projects/[PROJECT_ID]/locations/[LOCATION_ID]"
81   * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]"
82   * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]"
83   * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" Note: The locations portion of
84   * the resource must be specified, but supplying the character - in place of
85   * LOCATION_ID will return all buckets.
86   * @param array $optParams Optional parameters.
87   *
88   * @opt_param int pageSize Optional. The maximum number of results to return
89   * from this request. Non-positive values are ignored. The presence of
90   * nextPageToken in the response indicates that more results might be available.
91   * @opt_param string pageToken Optional. If present, then retrieve the next
92   * batch of results from the preceding call to this method. pageToken must be
93   * the value of nextPageToken from the previous response. The values of other
94   * method parameters should be identical to those in the previous call.
95   * @return ListBucketsResponse
96   */
97  public function listBillingAccountsLocationsBuckets($parent, $optParams = [])
98  {
99    $params = ['parent' => $parent];
100    $params = array_merge($params, $optParams);
101    return $this->call('list', [$params], ListBucketsResponse::class);
102  }
103  /**
104   * Updates a log bucket. This method replaces the following fields in the
105   * existing bucket with values from the new bucket: retention_periodIf the
106   * retention period is decreased and the bucket is locked, FAILED_PRECONDITION
107   * will be returned.If the bucket has a lifecycle_state of DELETE_REQUESTED,
108   * then FAILED_PRECONDITION will be returned.After a bucket has been created,
109   * the bucket's location cannot be changed. (buckets.patch)
110   *
111   * @param string $name Required. The full resource name of the bucket to update.
112   * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
113   * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
114   * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET
115   * _ID]" "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" For
116   * example:"projects/my-project/locations/global/buckets/my-bucket"
117   * @param LogBucket $postBody
118   * @param array $optParams Optional parameters.
119   *
120   * @opt_param string updateMask Required. Field mask that specifies the fields
121   * in bucket that need an update. A bucket field will be overwritten if, and
122   * only if, it is in the update mask. name and output only fields cannot be
123   * updated.For a detailed FieldMask definition, see:
124   * https://developers.google.com/protocol-
125   * buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskFor example:
126   * updateMask=retention_days
127   * @return LogBucket
128   */
129  public function patch($name, LogBucket $postBody, $optParams = [])
130  {
131    $params = ['name' => $name, 'postBody' => $postBody];
132    $params = array_merge($params, $optParams);
133    return $this->call('patch', [$params], LogBucket::class);
134  }
135  /**
136   * Undeletes a log bucket. A bucket that has been deleted can be undeleted
137   * within the grace period of 7 days. (buckets.undelete)
138   *
139   * @param string $name Required. The full resource name of the bucket to
140   * undelete. "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
141   * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
142   * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET
143   * _ID]" "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" For
144   * example:"projects/my-project/locations/global/buckets/my-bucket"
145   * @param UndeleteBucketRequest $postBody
146   * @param array $optParams Optional parameters.
147   * @return LoggingEmpty
148   */
149  public function undelete($name, UndeleteBucketRequest $postBody, $optParams = [])
150  {
151    $params = ['name' => $name, 'postBody' => $postBody];
152    $params = array_merge($params, $optParams);
153    return $this->call('undelete', [$params], LoggingEmpty::class);
154  }
155}
156
157// Adding a class alias for backwards compatibility with the previous class name.
158class_alias(BillingAccountsLocationsBuckets::class, 'Google_Service_Logging_Resource_BillingAccountsLocationsBuckets');
159