[e3d4e0a] | 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\NetworkSecurity\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\NetworkSecurity\AuthzPolicy;
|
---|
| 21 | use Google\Service\NetworkSecurity\GoogleIamV1Policy;
|
---|
| 22 | use Google\Service\NetworkSecurity\GoogleIamV1SetIamPolicyRequest;
|
---|
| 23 | use Google\Service\NetworkSecurity\GoogleIamV1TestIamPermissionsRequest;
|
---|
| 24 | use Google\Service\NetworkSecurity\GoogleIamV1TestIamPermissionsResponse;
|
---|
| 25 | use Google\Service\NetworkSecurity\ListAuthzPoliciesResponse;
|
---|
| 26 | use Google\Service\NetworkSecurity\Operation;
|
---|
| 27 |
|
---|
| 28 | /**
|
---|
| 29 | * The "authzPolicies" collection of methods.
|
---|
| 30 | * Typical usage is:
|
---|
| 31 | * <code>
|
---|
| 32 | * $networksecurityService = new Google\Service\NetworkSecurity(...);
|
---|
| 33 | * $authzPolicies = $networksecurityService->projects_locations_authzPolicies;
|
---|
| 34 | * </code>
|
---|
| 35 | */
|
---|
| 36 | class ProjectsLocationsAuthzPolicies extends \Google\Service\Resource
|
---|
| 37 | {
|
---|
| 38 | /**
|
---|
| 39 | * Creates a new AuthzPolicy in a given project and location.
|
---|
| 40 | * (authzPolicies.create)
|
---|
| 41 | *
|
---|
| 42 | * @param string $parent Required. The parent resource of the `AuthzPolicy`
|
---|
| 43 | * resource. Must be in the format `projects/{project}/locations/{location}`.
|
---|
| 44 | * @param AuthzPolicy $postBody
|
---|
| 45 | * @param array $optParams Optional parameters.
|
---|
| 46 | *
|
---|
| 47 | * @opt_param string authzPolicyId Required. User-provided ID of the
|
---|
| 48 | * `AuthzPolicy` resource to be created.
|
---|
| 49 | * @opt_param string requestId Optional. An optional request ID to identify
|
---|
| 50 | * requests. Specify a unique request ID so that if you must retry your request,
|
---|
| 51 | * the server can ignore the request if it has already been completed. The
|
---|
| 52 | * server guarantees that for at least 60 minutes since the first request. For
|
---|
| 53 | * example, consider a situation where you make an initial request and the
|
---|
| 54 | * request times out. If you make the request again with the same request ID,
|
---|
| 55 | * the server can check if original operation with the same request ID was
|
---|
| 56 | * received, and if so, ignores the second request. This prevents clients from
|
---|
| 57 | * accidentally creating duplicate commitments. The request ID must be a valid
|
---|
| 58 | * UUID with the exception that zero UUID is not supported
|
---|
| 59 | * (00000000-0000-0000-0000-000000000000).
|
---|
| 60 | * @return Operation
|
---|
| 61 | * @throws \Google\Service\Exception
|
---|
| 62 | */
|
---|
| 63 | public function create($parent, AuthzPolicy $postBody, $optParams = [])
|
---|
| 64 | {
|
---|
| 65 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 66 | $params = array_merge($params, $optParams);
|
---|
| 67 | return $this->call('create', [$params], Operation::class);
|
---|
| 68 | }
|
---|
| 69 | /**
|
---|
| 70 | * Deletes a single AuthzPolicy. (authzPolicies.delete)
|
---|
| 71 | *
|
---|
| 72 | * @param string $name Required. The name of the `AuthzPolicy` resource to
|
---|
| 73 | * delete. Must be in the format
|
---|
| 74 | * `projects/{project}/locations/{location}/authzPolicies/{authz_policy}`.
|
---|
| 75 | * @param array $optParams Optional parameters.
|
---|
| 76 | *
|
---|
| 77 | * @opt_param string requestId Optional. An optional request ID to identify
|
---|
| 78 | * requests. Specify a unique request ID so that if you must retry your request,
|
---|
| 79 | * the server can ignore the request if it has already been completed. The
|
---|
| 80 | * server guarantees that for at least 60 minutes after the first request. For
|
---|
| 81 | * example, consider a situation where you make an initial request and the
|
---|
| 82 | * request times out. If you make the request again with the same request ID,
|
---|
| 83 | * the server can check if original operation with the same request ID was
|
---|
| 84 | * received, and if so, ignores the second request. This prevents clients from
|
---|
| 85 | * accidentally creating duplicate commitments. The request ID must be a valid
|
---|
| 86 | * UUID with the exception that zero UUID is not supported
|
---|
| 87 | * (00000000-0000-0000-0000-000000000000).
|
---|
| 88 | * @return Operation
|
---|
| 89 | * @throws \Google\Service\Exception
|
---|
| 90 | */
|
---|
| 91 | public function delete($name, $optParams = [])
|
---|
| 92 | {
|
---|
| 93 | $params = ['name' => $name];
|
---|
| 94 | $params = array_merge($params, $optParams);
|
---|
| 95 | return $this->call('delete', [$params], Operation::class);
|
---|
| 96 | }
|
---|
| 97 | /**
|
---|
| 98 | * Gets details of a single AuthzPolicy. (authzPolicies.get)
|
---|
| 99 | *
|
---|
| 100 | * @param string $name Required. A name of the `AuthzPolicy` resource to get.
|
---|
| 101 | * Must be in the format
|
---|
| 102 | * `projects/{project}/locations/{location}/authzPolicies/{authz_policy}`.
|
---|
| 103 | * @param array $optParams Optional parameters.
|
---|
| 104 | * @return AuthzPolicy
|
---|
| 105 | * @throws \Google\Service\Exception
|
---|
| 106 | */
|
---|
| 107 | public function get($name, $optParams = [])
|
---|
| 108 | {
|
---|
| 109 | $params = ['name' => $name];
|
---|
| 110 | $params = array_merge($params, $optParams);
|
---|
| 111 | return $this->call('get', [$params], AuthzPolicy::class);
|
---|
| 112 | }
|
---|
| 113 | /**
|
---|
| 114 | * Gets the access control policy for a resource. Returns an empty policy if the
|
---|
| 115 | * resource exists and does not have a policy set. (authzPolicies.getIamPolicy)
|
---|
| 116 | *
|
---|
| 117 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
| 118 | * requested. See [Resource
|
---|
| 119 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
| 120 | * appropriate value for this field.
|
---|
| 121 | * @param array $optParams Optional parameters.
|
---|
| 122 | *
|
---|
| 123 | * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
|
---|
| 124 | * version that will be used to format the policy. Valid values are 0, 1, and 3.
|
---|
| 125 | * Requests specifying an invalid value will be rejected. Requests for policies
|
---|
| 126 | * with any conditional role bindings must specify version 3. Policies with no
|
---|
| 127 | * conditional role bindings may specify any valid value or leave the field
|
---|
| 128 | * unset. The policy in the response might use the policy version that you
|
---|
| 129 | * specified, or it might use a lower policy version. For example, if you
|
---|
| 130 | * specify version 3, but the policy has no conditional role bindings, the
|
---|
| 131 | * response uses version 1. To learn which resources support conditions in their
|
---|
| 132 | * IAM policies, see the [IAM
|
---|
| 133 | * documentation](https://cloud.google.com/iam/help/conditions/resource-
|
---|
| 134 | * policies).
|
---|
| 135 | * @return GoogleIamV1Policy
|
---|
| 136 | * @throws \Google\Service\Exception
|
---|
| 137 | */
|
---|
| 138 | public function getIamPolicy($resource, $optParams = [])
|
---|
| 139 | {
|
---|
| 140 | $params = ['resource' => $resource];
|
---|
| 141 | $params = array_merge($params, $optParams);
|
---|
| 142 | return $this->call('getIamPolicy', [$params], GoogleIamV1Policy::class);
|
---|
| 143 | }
|
---|
| 144 | /**
|
---|
| 145 | * Lists AuthzPolicies in a given project and location.
|
---|
| 146 | * (authzPolicies.listProjectsLocationsAuthzPolicies)
|
---|
| 147 | *
|
---|
| 148 | * @param string $parent Required. The project and location from which the
|
---|
| 149 | * `AuthzPolicy` resources are listed, specified in the following format:
|
---|
| 150 | * `projects/{project}/locations/{location}`.
|
---|
| 151 | * @param array $optParams Optional parameters.
|
---|
| 152 | *
|
---|
| 153 | * @opt_param string filter Optional. Filtering results.
|
---|
| 154 | * @opt_param string orderBy Optional. Hint for how to order the results.
|
---|
| 155 | * @opt_param int pageSize Optional. Requested page size. The server might
|
---|
| 156 | * return fewer items than requested. If unspecified, the server picks an
|
---|
| 157 | * appropriate default.
|
---|
| 158 | * @opt_param string pageToken Optional. A token identifying a page of results
|
---|
| 159 | * that the server returns.
|
---|
| 160 | * @return ListAuthzPoliciesResponse
|
---|
| 161 | * @throws \Google\Service\Exception
|
---|
| 162 | */
|
---|
| 163 | public function listProjectsLocationsAuthzPolicies($parent, $optParams = [])
|
---|
| 164 | {
|
---|
| 165 | $params = ['parent' => $parent];
|
---|
| 166 | $params = array_merge($params, $optParams);
|
---|
| 167 | return $this->call('list', [$params], ListAuthzPoliciesResponse::class);
|
---|
| 168 | }
|
---|
| 169 | /**
|
---|
| 170 | * Updates the parameters of a single AuthzPolicy. (authzPolicies.patch)
|
---|
| 171 | *
|
---|
| 172 | * @param string $name Required. Identifier. Name of the `AuthzPolicy` resource
|
---|
| 173 | * in the following format:
|
---|
| 174 | * `projects/{project}/locations/{location}/authzPolicies/{authz_policy}`.
|
---|
| 175 | * @param AuthzPolicy $postBody
|
---|
| 176 | * @param array $optParams Optional parameters.
|
---|
| 177 | *
|
---|
| 178 | * @opt_param string requestId Optional. An optional request ID to identify
|
---|
| 179 | * requests. Specify a unique request ID so that if you must retry your request,
|
---|
| 180 | * the server can ignore the request if it has already been completed. The
|
---|
| 181 | * server guarantees that for at least 60 minutes since the first request. For
|
---|
| 182 | * example, consider a situation where you make an initial request and the
|
---|
| 183 | * request times out. If you make the request again with the same request ID,
|
---|
| 184 | * the server can check if original operation with the same request ID was
|
---|
| 185 | * received, and if so, ignores the second request. This prevents clients from
|
---|
| 186 | * accidentally creating duplicate commitments. The request ID must be a valid
|
---|
| 187 | * UUID with the exception that zero UUID is not supported
|
---|
| 188 | * (00000000-0000-0000-0000-000000000000).
|
---|
| 189 | * @opt_param string updateMask Required. Used to specify the fields to be
|
---|
| 190 | * overwritten in the `AuthzPolicy` resource by the update. The fields specified
|
---|
| 191 | * in the `update_mask` are relative to the resource, not the full request. A
|
---|
| 192 | * field is overwritten if it is in the mask. If the user does not specify a
|
---|
| 193 | * mask, then all fields are overwritten.
|
---|
| 194 | * @return Operation
|
---|
| 195 | * @throws \Google\Service\Exception
|
---|
| 196 | */
|
---|
| 197 | public function patch($name, AuthzPolicy $postBody, $optParams = [])
|
---|
| 198 | {
|
---|
| 199 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 200 | $params = array_merge($params, $optParams);
|
---|
| 201 | return $this->call('patch', [$params], Operation::class);
|
---|
| 202 | }
|
---|
| 203 | /**
|
---|
| 204 | * Sets the access control policy on the specified resource. Replaces any
|
---|
| 205 | * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
|
---|
| 206 | * `PERMISSION_DENIED` errors. (authzPolicies.setIamPolicy)
|
---|
| 207 | *
|
---|
| 208 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
| 209 | * specified. See [Resource
|
---|
| 210 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
| 211 | * appropriate value for this field.
|
---|
| 212 | * @param GoogleIamV1SetIamPolicyRequest $postBody
|
---|
| 213 | * @param array $optParams Optional parameters.
|
---|
| 214 | * @return GoogleIamV1Policy
|
---|
| 215 | * @throws \Google\Service\Exception
|
---|
| 216 | */
|
---|
| 217 | public function setIamPolicy($resource, GoogleIamV1SetIamPolicyRequest $postBody, $optParams = [])
|
---|
| 218 | {
|
---|
| 219 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
| 220 | $params = array_merge($params, $optParams);
|
---|
| 221 | return $this->call('setIamPolicy', [$params], GoogleIamV1Policy::class);
|
---|
| 222 | }
|
---|
| 223 | /**
|
---|
| 224 | * Returns permissions that a caller has on the specified resource. If the
|
---|
| 225 | * resource does not exist, this will return an empty set of permissions, not a
|
---|
| 226 | * `NOT_FOUND` error. Note: This operation is designed to be used for building
|
---|
| 227 | * permission-aware UIs and command-line tools, not for authorization checking.
|
---|
| 228 | * This operation may "fail open" without warning.
|
---|
| 229 | * (authzPolicies.testIamPermissions)
|
---|
| 230 | *
|
---|
| 231 | * @param string $resource REQUIRED: The resource for which the policy detail is
|
---|
| 232 | * being requested. See [Resource
|
---|
| 233 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
| 234 | * appropriate value for this field.
|
---|
| 235 | * @param GoogleIamV1TestIamPermissionsRequest $postBody
|
---|
| 236 | * @param array $optParams Optional parameters.
|
---|
| 237 | * @return GoogleIamV1TestIamPermissionsResponse
|
---|
| 238 | * @throws \Google\Service\Exception
|
---|
| 239 | */
|
---|
| 240 | public function testIamPermissions($resource, GoogleIamV1TestIamPermissionsRequest $postBody, $optParams = [])
|
---|
| 241 | {
|
---|
| 242 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
| 243 | $params = array_merge($params, $optParams);
|
---|
| 244 | return $this->call('testIamPermissions', [$params], GoogleIamV1TestIamPermissionsResponse::class);
|
---|
| 245 | }
|
---|
| 246 | }
|
---|
| 247 |
|
---|
| 248 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 249 | class_alias(ProjectsLocationsAuthzPolicies::class, 'Google_Service_NetworkSecurity_Resource_ProjectsLocationsAuthzPolicies');
|
---|