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\AccessContextManager\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\AccessContextManager\AccessLevel;
|
---|
21 | use Google\Service\AccessContextManager\ListAccessLevelsResponse;
|
---|
22 | use Google\Service\AccessContextManager\Operation;
|
---|
23 | use Google\Service\AccessContextManager\ReplaceAccessLevelsRequest;
|
---|
24 | use Google\Service\AccessContextManager\TestIamPermissionsRequest;
|
---|
25 | use Google\Service\AccessContextManager\TestIamPermissionsResponse;
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * The "accessLevels" collection of methods.
|
---|
29 | * Typical usage is:
|
---|
30 | * <code>
|
---|
31 | * $accesscontextmanagerService = new Google\Service\AccessContextManager(...);
|
---|
32 | * $accessLevels = $accesscontextmanagerService->accessPolicies_accessLevels;
|
---|
33 | * </code>
|
---|
34 | */
|
---|
35 | class AccessPoliciesAccessLevels extends \Google\Service\Resource
|
---|
36 | {
|
---|
37 | /**
|
---|
38 | * Creates an access level. The long-running operation from this RPC has a
|
---|
39 | * successful status after the access level propagates to long-lasting storage.
|
---|
40 | * If access levels contain errors, an error response is returned for the first
|
---|
41 | * error encountered. (accessLevels.create)
|
---|
42 | *
|
---|
43 | * @param string $parent Required. Resource name for the access policy which
|
---|
44 | * owns this Access Level. Format: `accessPolicies/{policy_id}`
|
---|
45 | * @param AccessLevel $postBody
|
---|
46 | * @param array $optParams Optional parameters.
|
---|
47 | * @return Operation
|
---|
48 | * @throws \Google\Service\Exception
|
---|
49 | */
|
---|
50 | public function create($parent, AccessLevel $postBody, $optParams = [])
|
---|
51 | {
|
---|
52 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
53 | $params = array_merge($params, $optParams);
|
---|
54 | return $this->call('create', [$params], Operation::class);
|
---|
55 | }
|
---|
56 | /**
|
---|
57 | * Deletes an access level based on the resource name. The long-running
|
---|
58 | * operation from this RPC has a successful status after the access level has
|
---|
59 | * been removed from long-lasting storage. (accessLevels.delete)
|
---|
60 | *
|
---|
61 | * @param string $name Required. Resource name for the Access Level. Format:
|
---|
62 | * `accessPolicies/{policy_id}/accessLevels/{access_level_id}`
|
---|
63 | * @param array $optParams Optional parameters.
|
---|
64 | * @return Operation
|
---|
65 | * @throws \Google\Service\Exception
|
---|
66 | */
|
---|
67 | public function delete($name, $optParams = [])
|
---|
68 | {
|
---|
69 | $params = ['name' => $name];
|
---|
70 | $params = array_merge($params, $optParams);
|
---|
71 | return $this->call('delete', [$params], Operation::class);
|
---|
72 | }
|
---|
73 | /**
|
---|
74 | * Gets an access level based on the resource name. (accessLevels.get)
|
---|
75 | *
|
---|
76 | * @param string $name Required. Resource name for the Access Level. Format:
|
---|
77 | * `accessPolicies/{policy_id}/accessLevels/{access_level_id}`
|
---|
78 | * @param array $optParams Optional parameters.
|
---|
79 | *
|
---|
80 | * @opt_param string accessLevelFormat Whether to return `BasicLevels` in the
|
---|
81 | * Cloud Common Expression Language rather than as `BasicLevels`. Defaults to
|
---|
82 | * AS_DEFINED, where Access Levels are returned as `BasicLevels` or
|
---|
83 | * `CustomLevels` based on how they were created. If set to CEL, all Access
|
---|
84 | * Levels are returned as `CustomLevels`. In the CEL case, `BasicLevels` are
|
---|
85 | * translated to equivalent `CustomLevels`.
|
---|
86 | * @return AccessLevel
|
---|
87 | * @throws \Google\Service\Exception
|
---|
88 | */
|
---|
89 | public function get($name, $optParams = [])
|
---|
90 | {
|
---|
91 | $params = ['name' => $name];
|
---|
92 | $params = array_merge($params, $optParams);
|
---|
93 | return $this->call('get', [$params], AccessLevel::class);
|
---|
94 | }
|
---|
95 | /**
|
---|
96 | * Lists all access levels for an access policy.
|
---|
97 | * (accessLevels.listAccessPoliciesAccessLevels)
|
---|
98 | *
|
---|
99 | * @param string $parent Required. Resource name for the access policy to list
|
---|
100 | * Access Levels from. Format: `accessPolicies/{policy_id}`
|
---|
101 | * @param array $optParams Optional parameters.
|
---|
102 | *
|
---|
103 | * @opt_param string accessLevelFormat Whether to return `BasicLevels` in the
|
---|
104 | * Cloud Common Expression language, as `CustomLevels`, rather than as
|
---|
105 | * `BasicLevels`. Defaults to returning `AccessLevels` in the format they were
|
---|
106 | * defined.
|
---|
107 | * @opt_param int pageSize Number of Access Levels to include in the list.
|
---|
108 | * Default 100.
|
---|
109 | * @opt_param string pageToken Next page token for the next batch of Access
|
---|
110 | * Level instances. Defaults to the first page of results.
|
---|
111 | * @return ListAccessLevelsResponse
|
---|
112 | * @throws \Google\Service\Exception
|
---|
113 | */
|
---|
114 | public function listAccessPoliciesAccessLevels($parent, $optParams = [])
|
---|
115 | {
|
---|
116 | $params = ['parent' => $parent];
|
---|
117 | $params = array_merge($params, $optParams);
|
---|
118 | return $this->call('list', [$params], ListAccessLevelsResponse::class);
|
---|
119 | }
|
---|
120 | /**
|
---|
121 | * Updates an access level. The long-running operation from this RPC has a
|
---|
122 | * successful status after the changes to the access level propagate to long-
|
---|
123 | * lasting storage. If access levels contain errors, an error response is
|
---|
124 | * returned for the first error encountered. (accessLevels.patch)
|
---|
125 | *
|
---|
126 | * @param string $name Identifier. Resource name for the `AccessLevel`. Format:
|
---|
127 | * `accessPolicies/{access_policy}/accessLevels/{access_level}`. The
|
---|
128 | * `access_level` component must begin with a letter, followed by alphanumeric
|
---|
129 | * characters or `_`. Its maximum length is 50 characters. After you create an
|
---|
130 | * `AccessLevel`, you cannot change its `name`.
|
---|
131 | * @param AccessLevel $postBody
|
---|
132 | * @param array $optParams Optional parameters.
|
---|
133 | *
|
---|
134 | * @opt_param string updateMask Required. Mask to control which fields get
|
---|
135 | * updated. Must be non-empty.
|
---|
136 | * @return Operation
|
---|
137 | * @throws \Google\Service\Exception
|
---|
138 | */
|
---|
139 | public function patch($name, AccessLevel $postBody, $optParams = [])
|
---|
140 | {
|
---|
141 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
142 | $params = array_merge($params, $optParams);
|
---|
143 | return $this->call('patch', [$params], Operation::class);
|
---|
144 | }
|
---|
145 | /**
|
---|
146 | * Replaces all existing access levels in an access policy with the access
|
---|
147 | * levels provided. This is done atomically. The long-running operation from
|
---|
148 | * this RPC has a successful status after all replacements propagate to long-
|
---|
149 | * lasting storage. If the replacement contains errors, an error response is
|
---|
150 | * returned for the first error encountered. Upon error, the replacement is
|
---|
151 | * cancelled, and existing access levels are not affected. The
|
---|
152 | * Operation.response field contains ReplaceAccessLevelsResponse. Removing
|
---|
153 | * access levels contained in existing service perimeters result in an error.
|
---|
154 | * (accessLevels.replaceAll)
|
---|
155 | *
|
---|
156 | * @param string $parent Required. Resource name for the access policy which
|
---|
157 | * owns these Access Levels. Format: `accessPolicies/{policy_id}`
|
---|
158 | * @param ReplaceAccessLevelsRequest $postBody
|
---|
159 | * @param array $optParams Optional parameters.
|
---|
160 | * @return Operation
|
---|
161 | * @throws \Google\Service\Exception
|
---|
162 | */
|
---|
163 | public function replaceAll($parent, ReplaceAccessLevelsRequest $postBody, $optParams = [])
|
---|
164 | {
|
---|
165 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
166 | $params = array_merge($params, $optParams);
|
---|
167 | return $this->call('replaceAll', [$params], Operation::class);
|
---|
168 | }
|
---|
169 | /**
|
---|
170 | * Returns the IAM permissions that the caller has on the specified Access
|
---|
171 | * Context Manager resource. The resource can be an AccessPolicy, AccessLevel,
|
---|
172 | * or ServicePerimeter. This method does not support other resources.
|
---|
173 | * (accessLevels.testIamPermissions)
|
---|
174 | *
|
---|
175 | * @param string $resource REQUIRED: The resource for which the policy detail is
|
---|
176 | * being requested. See [Resource
|
---|
177 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
178 | * appropriate value for this field.
|
---|
179 | * @param TestIamPermissionsRequest $postBody
|
---|
180 | * @param array $optParams Optional parameters.
|
---|
181 | * @return TestIamPermissionsResponse
|
---|
182 | * @throws \Google\Service\Exception
|
---|
183 | */
|
---|
184 | public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
|
---|
185 | {
|
---|
186 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
187 | $params = array_merge($params, $optParams);
|
---|
188 | return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
|
---|
189 | }
|
---|
190 | }
|
---|
191 |
|
---|
192 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
193 | class_alias(AccessPoliciesAccessLevels::class, 'Google_Service_AccessContextManager_Resource_AccessPoliciesAccessLevels');
|
---|