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