[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\OrgPolicyAPI\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\OrgPolicyAPI\GoogleCloudOrgpolicyV2ListPoliciesResponse;
|
---|
| 21 | use Google\Service\OrgPolicyAPI\GoogleCloudOrgpolicyV2Policy;
|
---|
| 22 | use Google\Service\OrgPolicyAPI\GoogleProtobufEmpty;
|
---|
| 23 |
|
---|
| 24 | /**
|
---|
| 25 | * The "policies" collection of methods.
|
---|
| 26 | * Typical usage is:
|
---|
| 27 | * <code>
|
---|
| 28 | * $orgpolicyService = new Google\Service\OrgPolicyAPI(...);
|
---|
| 29 | * $policies = $orgpolicyService->organizations_policies;
|
---|
| 30 | * </code>
|
---|
| 31 | */
|
---|
| 32 | class OrganizationsPolicies extends \Google\Service\Resource
|
---|
| 33 | {
|
---|
| 34 | /**
|
---|
| 35 | * Creates a policy. Returns a `google.rpc.Status` with
|
---|
| 36 | * `google.rpc.Code.NOT_FOUND` if the constraint does not exist. Returns a
|
---|
| 37 | * `google.rpc.Status` with `google.rpc.Code.ALREADY_EXISTS` if the policy
|
---|
| 38 | * already exists on the given Google Cloud resource. (policies.create)
|
---|
| 39 | *
|
---|
| 40 | * @param string $parent Required. The Google Cloud resource that will parent
|
---|
| 41 | * the new policy. Must be in one of the following forms: *
|
---|
| 42 | * `projects/{project_number}` * `projects/{project_id}` * `folders/{folder_id}`
|
---|
| 43 | * * `organizations/{organization_id}`
|
---|
| 44 | * @param GoogleCloudOrgpolicyV2Policy $postBody
|
---|
| 45 | * @param array $optParams Optional parameters.
|
---|
| 46 | * @return GoogleCloudOrgpolicyV2Policy
|
---|
| 47 | * @throws \Google\Service\Exception
|
---|
| 48 | */
|
---|
| 49 | public function create($parent, GoogleCloudOrgpolicyV2Policy $postBody, $optParams = [])
|
---|
| 50 | {
|
---|
| 51 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 52 | $params = array_merge($params, $optParams);
|
---|
| 53 | return $this->call('create', [$params], GoogleCloudOrgpolicyV2Policy::class);
|
---|
| 54 | }
|
---|
| 55 | /**
|
---|
| 56 | * Deletes a policy. Returns a `google.rpc.Status` with
|
---|
| 57 | * `google.rpc.Code.NOT_FOUND` if the constraint or organization policy does not
|
---|
| 58 | * exist. (policies.delete)
|
---|
| 59 | *
|
---|
| 60 | * @param string $name Required. Name of the policy to delete. See the policy
|
---|
| 61 | * entry for naming rules.
|
---|
| 62 | * @param array $optParams Optional parameters.
|
---|
| 63 | *
|
---|
| 64 | * @opt_param string etag Optional. The current etag of policy. If an etag is
|
---|
| 65 | * provided and does not match the current etag of the policy, deletion will be
|
---|
| 66 | * blocked and an ABORTED error will be returned.
|
---|
| 67 | * @return GoogleProtobufEmpty
|
---|
| 68 | * @throws \Google\Service\Exception
|
---|
| 69 | */
|
---|
| 70 | public function delete($name, $optParams = [])
|
---|
| 71 | {
|
---|
| 72 | $params = ['name' => $name];
|
---|
| 73 | $params = array_merge($params, $optParams);
|
---|
| 74 | return $this->call('delete', [$params], GoogleProtobufEmpty::class);
|
---|
| 75 | }
|
---|
| 76 | /**
|
---|
| 77 | * Gets a policy on a resource. If no policy is set on the resource, `NOT_FOUND`
|
---|
| 78 | * is returned. The `etag` value can be used with `UpdatePolicy()` to update a
|
---|
| 79 | * policy during read-modify-write. (policies.get)
|
---|
| 80 | *
|
---|
| 81 | * @param string $name Required. Resource name of the policy. See Policy for
|
---|
| 82 | * naming requirements.
|
---|
| 83 | * @param array $optParams Optional parameters.
|
---|
| 84 | * @return GoogleCloudOrgpolicyV2Policy
|
---|
| 85 | * @throws \Google\Service\Exception
|
---|
| 86 | */
|
---|
| 87 | public function get($name, $optParams = [])
|
---|
| 88 | {
|
---|
| 89 | $params = ['name' => $name];
|
---|
| 90 | $params = array_merge($params, $optParams);
|
---|
| 91 | return $this->call('get', [$params], GoogleCloudOrgpolicyV2Policy::class);
|
---|
| 92 | }
|
---|
| 93 | /**
|
---|
| 94 | * Gets the effective policy on a resource. This is the result of merging
|
---|
| 95 | * policies in the resource hierarchy and evaluating conditions. The returned
|
---|
| 96 | * policy will not have an `etag` or `condition` set because it is an evaluated
|
---|
| 97 | * policy across multiple resources. Subtrees of Resource Manager resource
|
---|
| 98 | * hierarchy with 'under:' prefix will not be expanded.
|
---|
| 99 | * (policies.getEffectivePolicy)
|
---|
| 100 | *
|
---|
| 101 | * @param string $name Required. The effective policy to compute. See Policy for
|
---|
| 102 | * naming requirements.
|
---|
| 103 | * @param array $optParams Optional parameters.
|
---|
| 104 | * @return GoogleCloudOrgpolicyV2Policy
|
---|
| 105 | * @throws \Google\Service\Exception
|
---|
| 106 | */
|
---|
| 107 | public function getEffectivePolicy($name, $optParams = [])
|
---|
| 108 | {
|
---|
| 109 | $params = ['name' => $name];
|
---|
| 110 | $params = array_merge($params, $optParams);
|
---|
| 111 | return $this->call('getEffectivePolicy', [$params], GoogleCloudOrgpolicyV2Policy::class);
|
---|
| 112 | }
|
---|
| 113 | /**
|
---|
| 114 | * Retrieves all of the policies that exist on a particular resource.
|
---|
| 115 | * (policies.listOrganizationsPolicies)
|
---|
| 116 | *
|
---|
| 117 | * @param string $parent Required. The target Google Cloud resource that parents
|
---|
| 118 | * the set of constraints and policies that will be returned from this call.
|
---|
| 119 | * Must be in one of the following forms: * `projects/{project_number}` *
|
---|
| 120 | * `projects/{project_id}` * `folders/{folder_id}` *
|
---|
| 121 | * `organizations/{organization_id}`
|
---|
| 122 | * @param array $optParams Optional parameters.
|
---|
| 123 | *
|
---|
| 124 | * @opt_param int pageSize Size of the pages to be returned. This is currently
|
---|
| 125 | * unsupported and will be ignored. The server may at any point start using this
|
---|
| 126 | * field to limit page size.
|
---|
| 127 | * @opt_param string pageToken Page token used to retrieve the next page. This
|
---|
| 128 | * is currently unsupported and will be ignored. The server may at any point
|
---|
| 129 | * start using this field.
|
---|
| 130 | * @return GoogleCloudOrgpolicyV2ListPoliciesResponse
|
---|
| 131 | * @throws \Google\Service\Exception
|
---|
| 132 | */
|
---|
| 133 | public function listOrganizationsPolicies($parent, $optParams = [])
|
---|
| 134 | {
|
---|
| 135 | $params = ['parent' => $parent];
|
---|
| 136 | $params = array_merge($params, $optParams);
|
---|
| 137 | return $this->call('list', [$params], GoogleCloudOrgpolicyV2ListPoliciesResponse::class);
|
---|
| 138 | }
|
---|
| 139 | /**
|
---|
| 140 | * Updates a policy. Returns a `google.rpc.Status` with
|
---|
| 141 | * `google.rpc.Code.NOT_FOUND` if the constraint or the policy do not exist.
|
---|
| 142 | * Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED` if the etag
|
---|
| 143 | * supplied in the request does not match the persisted etag of the policy Note:
|
---|
| 144 | * the supplied policy will perform a full overwrite of all fields.
|
---|
| 145 | * (policies.patch)
|
---|
| 146 | *
|
---|
| 147 | * @param string $name Immutable. The resource name of the policy. Must be one
|
---|
| 148 | * of the following forms, where `constraint_name` is the name of the constraint
|
---|
| 149 | * which this policy configures: *
|
---|
| 150 | * `projects/{project_number}/policies/{constraint_name}` *
|
---|
| 151 | * `folders/{folder_id}/policies/{constraint_name}` *
|
---|
| 152 | * `organizations/{organization_id}/policies/{constraint_name}` For example,
|
---|
| 153 | * `projects/123/policies/compute.disableSerialPortAccess`. Note:
|
---|
| 154 | * `projects/{project_id}/policies/{constraint_name}` is also an acceptable name
|
---|
| 155 | * for API requests, but responses will return the name using the equivalent
|
---|
| 156 | * project number.
|
---|
| 157 | * @param GoogleCloudOrgpolicyV2Policy $postBody
|
---|
| 158 | * @param array $optParams Optional parameters.
|
---|
| 159 | *
|
---|
| 160 | * @opt_param string updateMask Field mask used to specify the fields to be
|
---|
| 161 | * overwritten in the policy by the set. The fields specified in the update_mask
|
---|
| 162 | * are relative to the policy, not the full request.
|
---|
| 163 | * @return GoogleCloudOrgpolicyV2Policy
|
---|
| 164 | * @throws \Google\Service\Exception
|
---|
| 165 | */
|
---|
| 166 | public function patch($name, GoogleCloudOrgpolicyV2Policy $postBody, $optParams = [])
|
---|
| 167 | {
|
---|
| 168 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 169 | $params = array_merge($params, $optParams);
|
---|
| 170 | return $this->call('patch', [$params], GoogleCloudOrgpolicyV2Policy::class);
|
---|
| 171 | }
|
---|
| 172 | }
|
---|
| 173 |
|
---|
| 174 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 175 | class_alias(OrganizationsPolicies::class, 'Google_Service_OrgPolicyAPI_Resource_OrganizationsPolicies');
|
---|