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\Storage\Resource;
19
20use Google\Service\Storage\ObjectAccessControl;
21use Google\Service\Storage\ObjectAccessControls as ObjectAccessControlsModel;
22
23/**
24 * The "defaultObjectAccessControls" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $storageService = new Google\Service\Storage(...);
28 *   $defaultObjectAccessControls = $storageService->defaultObjectAccessControls;
29 *  </code>
30 */
31class DefaultObjectAccessControls extends \Google\Service\Resource
32{
33  /**
34   * Permanently deletes the default object ACL entry for the specified entity on
35   * the specified bucket. (defaultObjectAccessControls.delete)
36   *
37   * @param string $bucket Name of a bucket.
38   * @param string $entity The entity holding the permission. Can be user-userId,
39   * user-emailAddress, group-groupId, group-emailAddress, allUsers, or
40   * allAuthenticatedUsers.
41   * @param array $optParams Optional parameters.
42   *
43   * @opt_param string userProject The project to be billed for this request.
44   * Required for Requester Pays buckets.
45   */
46  public function delete($bucket, $entity, $optParams = [])
47  {
48    $params = ['bucket' => $bucket, 'entity' => $entity];
49    $params = array_merge($params, $optParams);
50    return $this->call('delete', [$params]);
51  }
52  /**
53   * Returns the default object ACL entry for the specified entity on the
54   * specified bucket. (defaultObjectAccessControls.get)
55   *
56   * @param string $bucket Name of a bucket.
57   * @param string $entity The entity holding the permission. Can be user-userId,
58   * user-emailAddress, group-groupId, group-emailAddress, allUsers, or
59   * allAuthenticatedUsers.
60   * @param array $optParams Optional parameters.
61   *
62   * @opt_param string userProject The project to be billed for this request.
63   * Required for Requester Pays buckets.
64   * @return ObjectAccessControl
65   */
66  public function get($bucket, $entity, $optParams = [])
67  {
68    $params = ['bucket' => $bucket, 'entity' => $entity];
69    $params = array_merge($params, $optParams);
70    return $this->call('get', [$params], ObjectAccessControl::class);
71  }
72  /**
73   * Creates a new default object ACL entry on the specified bucket.
74   * (defaultObjectAccessControls.insert)
75   *
76   * @param string $bucket Name of a bucket.
77   * @param ObjectAccessControl $postBody
78   * @param array $optParams Optional parameters.
79   *
80   * @opt_param string userProject The project to be billed for this request.
81   * Required for Requester Pays buckets.
82   * @return ObjectAccessControl
83   */
84  public function insert($bucket, ObjectAccessControl $postBody, $optParams = [])
85  {
86    $params = ['bucket' => $bucket, 'postBody' => $postBody];
87    $params = array_merge($params, $optParams);
88    return $this->call('insert', [$params], ObjectAccessControl::class);
89  }
90  /**
91   * Retrieves default object ACL entries on the specified bucket.
92   * (defaultObjectAccessControls.listDefaultObjectAccessControls)
93   *
94   * @param string $bucket Name of a bucket.
95   * @param array $optParams Optional parameters.
96   *
97   * @opt_param string ifMetagenerationMatch If present, only return default ACL
98   * listing if the bucket's current metageneration matches this value.
99   * @opt_param string ifMetagenerationNotMatch If present, only return default
100   * ACL listing if the bucket's current metageneration does not match the given
101   * value.
102   * @opt_param string userProject The project to be billed for this request.
103   * Required for Requester Pays buckets.
104   * @return ObjectAccessControls
105   */
106  public function listDefaultObjectAccessControls($bucket, $optParams = [])
107  {
108    $params = ['bucket' => $bucket];
109    $params = array_merge($params, $optParams);
110    return $this->call('list', [$params], ObjectAccessControlsModel::class);
111  }
112  /**
113   * Patches a default object ACL entry on the specified bucket.
114   * (defaultObjectAccessControls.patch)
115   *
116   * @param string $bucket Name of a bucket.
117   * @param string $entity The entity holding the permission. Can be user-userId,
118   * user-emailAddress, group-groupId, group-emailAddress, allUsers, or
119   * allAuthenticatedUsers.
120   * @param ObjectAccessControl $postBody
121   * @param array $optParams Optional parameters.
122   *
123   * @opt_param string userProject The project to be billed for this request.
124   * Required for Requester Pays buckets.
125   * @return ObjectAccessControl
126   */
127  public function patch($bucket, $entity, ObjectAccessControl $postBody, $optParams = [])
128  {
129    $params = ['bucket' => $bucket, 'entity' => $entity, 'postBody' => $postBody];
130    $params = array_merge($params, $optParams);
131    return $this->call('patch', [$params], ObjectAccessControl::class);
132  }
133  /**
134   * Updates a default object ACL entry on the specified bucket.
135   * (defaultObjectAccessControls.update)
136   *
137   * @param string $bucket Name of a bucket.
138   * @param string $entity The entity holding the permission. Can be user-userId,
139   * user-emailAddress, group-groupId, group-emailAddress, allUsers, or
140   * allAuthenticatedUsers.
141   * @param ObjectAccessControl $postBody
142   * @param array $optParams Optional parameters.
143   *
144   * @opt_param string userProject The project to be billed for this request.
145   * Required for Requester Pays buckets.
146   * @return ObjectAccessControl
147   */
148  public function update($bucket, $entity, ObjectAccessControl $postBody, $optParams = [])
149  {
150    $params = ['bucket' => $bucket, 'entity' => $entity, 'postBody' => $postBody];
151    $params = array_merge($params, $optParams);
152    return $this->call('update', [$params], ObjectAccessControl::class);
153  }
154}
155
156// Adding a class alias for backwards compatibility with the previous class name.
157class_alias(DefaultObjectAccessControls::class, 'Google_Service_Storage_Resource_DefaultObjectAccessControls');
158