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\AccessPolicy;
|
---|
21 | use Google\Service\AccessContextManager\GetIamPolicyRequest;
|
---|
22 | use Google\Service\AccessContextManager\ListAccessPoliciesResponse;
|
---|
23 | use Google\Service\AccessContextManager\Operation;
|
---|
24 | use Google\Service\AccessContextManager\Policy;
|
---|
25 | use Google\Service\AccessContextManager\SetIamPolicyRequest;
|
---|
26 | use Google\Service\AccessContextManager\TestIamPermissionsRequest;
|
---|
27 | use Google\Service\AccessContextManager\TestIamPermissionsResponse;
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * The "accessPolicies" collection of methods.
|
---|
31 | * Typical usage is:
|
---|
32 | * <code>
|
---|
33 | * $accesscontextmanagerService = new Google\Service\AccessContextManager(...);
|
---|
34 | * $accessPolicies = $accesscontextmanagerService->accessPolicies;
|
---|
35 | * </code>
|
---|
36 | */
|
---|
37 | class AccessPolicies extends \Google\Service\Resource
|
---|
38 | {
|
---|
39 | /**
|
---|
40 | * Creates an access policy. This method fails if the organization already has
|
---|
41 | * an access policy. The long-running operation has a successful status after
|
---|
42 | * the access policy propagates to long-lasting storage. Syntactic and basic
|
---|
43 | * semantic errors are returned in `metadata` as a BadRequest proto.
|
---|
44 | * (accessPolicies.create)
|
---|
45 | *
|
---|
46 | * @param AccessPolicy $postBody
|
---|
47 | * @param array $optParams Optional parameters.
|
---|
48 | * @return Operation
|
---|
49 | * @throws \Google\Service\Exception
|
---|
50 | */
|
---|
51 | public function create(AccessPolicy $postBody, $optParams = [])
|
---|
52 | {
|
---|
53 | $params = ['postBody' => $postBody];
|
---|
54 | $params = array_merge($params, $optParams);
|
---|
55 | return $this->call('create', [$params], Operation::class);
|
---|
56 | }
|
---|
57 | /**
|
---|
58 | * Deletes an access policy based on the resource name. The long-running
|
---|
59 | * operation has a successful status after the access policy is removed from
|
---|
60 | * long-lasting storage. (accessPolicies.delete)
|
---|
61 | *
|
---|
62 | * @param string $name Required. Resource name for the access policy to delete.
|
---|
63 | * Format `accessPolicies/{policy_id}`
|
---|
64 | * @param array $optParams Optional parameters.
|
---|
65 | * @return Operation
|
---|
66 | * @throws \Google\Service\Exception
|
---|
67 | */
|
---|
68 | public function delete($name, $optParams = [])
|
---|
69 | {
|
---|
70 | $params = ['name' => $name];
|
---|
71 | $params = array_merge($params, $optParams);
|
---|
72 | return $this->call('delete', [$params], Operation::class);
|
---|
73 | }
|
---|
74 | /**
|
---|
75 | * Returns an access policy based on the name. (accessPolicies.get)
|
---|
76 | *
|
---|
77 | * @param string $name Required. Resource name for the access policy to get.
|
---|
78 | * Format `accessPolicies/{policy_id}`
|
---|
79 | * @param array $optParams Optional parameters.
|
---|
80 | * @return AccessPolicy
|
---|
81 | * @throws \Google\Service\Exception
|
---|
82 | */
|
---|
83 | public function get($name, $optParams = [])
|
---|
84 | {
|
---|
85 | $params = ['name' => $name];
|
---|
86 | $params = array_merge($params, $optParams);
|
---|
87 | return $this->call('get', [$params], AccessPolicy::class);
|
---|
88 | }
|
---|
89 | /**
|
---|
90 | * Gets the IAM policy for the specified Access Context Manager access policy.
|
---|
91 | * (accessPolicies.getIamPolicy)
|
---|
92 | *
|
---|
93 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
94 | * requested. See [Resource
|
---|
95 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
96 | * appropriate value for this field.
|
---|
97 | * @param GetIamPolicyRequest $postBody
|
---|
98 | * @param array $optParams Optional parameters.
|
---|
99 | * @return Policy
|
---|
100 | * @throws \Google\Service\Exception
|
---|
101 | */
|
---|
102 | public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
|
---|
103 | {
|
---|
104 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
105 | $params = array_merge($params, $optParams);
|
---|
106 | return $this->call('getIamPolicy', [$params], Policy::class);
|
---|
107 | }
|
---|
108 | /**
|
---|
109 | * Lists all access policies in an organization.
|
---|
110 | * (accessPolicies.listAccessPolicies)
|
---|
111 | *
|
---|
112 | * @param array $optParams Optional parameters.
|
---|
113 | *
|
---|
114 | * @opt_param int pageSize Number of AccessPolicy instances to include in the
|
---|
115 | * list. Default 100.
|
---|
116 | * @opt_param string pageToken Next page token for the next batch of
|
---|
117 | * AccessPolicy instances. Defaults to the first page of results.
|
---|
118 | * @opt_param string parent Required. Resource name for the container to list
|
---|
119 | * AccessPolicy instances from. Format: `organizations/{org_id}`
|
---|
120 | * @return ListAccessPoliciesResponse
|
---|
121 | * @throws \Google\Service\Exception
|
---|
122 | */
|
---|
123 | public function listAccessPolicies($optParams = [])
|
---|
124 | {
|
---|
125 | $params = [];
|
---|
126 | $params = array_merge($params, $optParams);
|
---|
127 | return $this->call('list', [$params], ListAccessPoliciesResponse::class);
|
---|
128 | }
|
---|
129 | /**
|
---|
130 | * Updates an access policy. The long-running operation from this RPC has a
|
---|
131 | * successful status after the changes to the access policy propagate to long-
|
---|
132 | * lasting storage. (accessPolicies.patch)
|
---|
133 | *
|
---|
134 | * @param string $name Output only. Identifier. Resource name of the
|
---|
135 | * `AccessPolicy`. Format: `accessPolicies/{access_policy}`
|
---|
136 | * @param AccessPolicy $postBody
|
---|
137 | * @param array $optParams Optional parameters.
|
---|
138 | *
|
---|
139 | * @opt_param string updateMask Required. Mask to control which fields get
|
---|
140 | * updated. Must be non-empty.
|
---|
141 | * @return Operation
|
---|
142 | * @throws \Google\Service\Exception
|
---|
143 | */
|
---|
144 | public function patch($name, AccessPolicy $postBody, $optParams = [])
|
---|
145 | {
|
---|
146 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
147 | $params = array_merge($params, $optParams);
|
---|
148 | return $this->call('patch', [$params], Operation::class);
|
---|
149 | }
|
---|
150 | /**
|
---|
151 | * Sets the IAM policy for the specified Access Context Manager access policy.
|
---|
152 | * This method replaces the existing IAM policy on the access policy. The IAM
|
---|
153 | * policy controls the set of users who can perform specific operations on the
|
---|
154 | * Access Context Manager access policy. (accessPolicies.setIamPolicy)
|
---|
155 | *
|
---|
156 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
157 | * specified. See [Resource
|
---|
158 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
159 | * appropriate value for this field.
|
---|
160 | * @param SetIamPolicyRequest $postBody
|
---|
161 | * @param array $optParams Optional parameters.
|
---|
162 | * @return Policy
|
---|
163 | * @throws \Google\Service\Exception
|
---|
164 | */
|
---|
165 | public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
|
---|
166 | {
|
---|
167 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
168 | $params = array_merge($params, $optParams);
|
---|
169 | return $this->call('setIamPolicy', [$params], Policy::class);
|
---|
170 | }
|
---|
171 | /**
|
---|
172 | * Returns the IAM permissions that the caller has on the specified Access
|
---|
173 | * Context Manager resource. The resource can be an AccessPolicy, AccessLevel,
|
---|
174 | * or ServicePerimeter. This method does not support other resources.
|
---|
175 | * (accessPolicies.testIamPermissions)
|
---|
176 | *
|
---|
177 | * @param string $resource REQUIRED: The resource for which the policy detail is
|
---|
178 | * being requested. See [Resource
|
---|
179 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
180 | * appropriate value for this field.
|
---|
181 | * @param TestIamPermissionsRequest $postBody
|
---|
182 | * @param array $optParams Optional parameters.
|
---|
183 | * @return TestIamPermissionsResponse
|
---|
184 | * @throws \Google\Service\Exception
|
---|
185 | */
|
---|
186 | public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
|
---|
187 | {
|
---|
188 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
189 | $params = array_merge($params, $optParams);
|
---|
190 | return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
|
---|
191 | }
|
---|
192 | }
|
---|
193 |
|
---|
194 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
195 | class_alias(AccessPolicies::class, 'Google_Service_AccessContextManager_Resource_AccessPolicies');
|
---|