[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\GoogleCloudOrgpolicyV2CustomConstraint;
|
---|
| 21 | use Google\Service\OrgPolicyAPI\GoogleCloudOrgpolicyV2ListCustomConstraintsResponse;
|
---|
| 22 | use Google\Service\OrgPolicyAPI\GoogleProtobufEmpty;
|
---|
| 23 |
|
---|
| 24 | /**
|
---|
| 25 | * The "customConstraints" collection of methods.
|
---|
| 26 | * Typical usage is:
|
---|
| 27 | * <code>
|
---|
| 28 | * $orgpolicyService = new Google\Service\OrgPolicyAPI(...);
|
---|
| 29 | * $customConstraints = $orgpolicyService->organizations_customConstraints;
|
---|
| 30 | * </code>
|
---|
| 31 | */
|
---|
| 32 | class OrganizationsCustomConstraints extends \Google\Service\Resource
|
---|
| 33 | {
|
---|
| 34 | /**
|
---|
| 35 | * Creates a custom constraint. Returns a `google.rpc.Status` with
|
---|
| 36 | * `google.rpc.Code.NOT_FOUND` if the organization does not exist. Returns a
|
---|
| 37 | * `google.rpc.Status` with `google.rpc.Code.ALREADY_EXISTS` if the constraint
|
---|
| 38 | * already exists on the given organization. (customConstraints.create)
|
---|
| 39 | *
|
---|
| 40 | * @param string $parent Required. Must be in the following form: *
|
---|
| 41 | * `organizations/{organization_id}`
|
---|
| 42 | * @param GoogleCloudOrgpolicyV2CustomConstraint $postBody
|
---|
| 43 | * @param array $optParams Optional parameters.
|
---|
| 44 | * @return GoogleCloudOrgpolicyV2CustomConstraint
|
---|
| 45 | * @throws \Google\Service\Exception
|
---|
| 46 | */
|
---|
| 47 | public function create($parent, GoogleCloudOrgpolicyV2CustomConstraint $postBody, $optParams = [])
|
---|
| 48 | {
|
---|
| 49 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 50 | $params = array_merge($params, $optParams);
|
---|
| 51 | return $this->call('create', [$params], GoogleCloudOrgpolicyV2CustomConstraint::class);
|
---|
| 52 | }
|
---|
| 53 | /**
|
---|
| 54 | * Deletes a custom constraint. Returns a `google.rpc.Status` with
|
---|
| 55 | * `google.rpc.Code.NOT_FOUND` if the constraint does not exist.
|
---|
| 56 | * (customConstraints.delete)
|
---|
| 57 | *
|
---|
| 58 | * @param string $name Required. Name of the custom constraint to delete. See
|
---|
| 59 | * the custom constraint entry for naming rules.
|
---|
| 60 | * @param array $optParams Optional parameters.
|
---|
| 61 | * @return GoogleProtobufEmpty
|
---|
| 62 | * @throws \Google\Service\Exception
|
---|
| 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 custom constraint. Returns a `google.rpc.Status` with
|
---|
| 72 | * `google.rpc.Code.NOT_FOUND` if the custom constraint does not exist.
|
---|
| 73 | * (customConstraints.get)
|
---|
| 74 | *
|
---|
| 75 | * @param string $name Required. Resource name of the custom constraint. See the
|
---|
| 76 | * custom constraint entry for naming requirements.
|
---|
| 77 | * @param array $optParams Optional parameters.
|
---|
| 78 | * @return GoogleCloudOrgpolicyV2CustomConstraint
|
---|
| 79 | * @throws \Google\Service\Exception
|
---|
| 80 | */
|
---|
| 81 | public function get($name, $optParams = [])
|
---|
| 82 | {
|
---|
| 83 | $params = ['name' => $name];
|
---|
| 84 | $params = array_merge($params, $optParams);
|
---|
| 85 | return $this->call('get', [$params], GoogleCloudOrgpolicyV2CustomConstraint::class);
|
---|
| 86 | }
|
---|
| 87 | /**
|
---|
| 88 | * Retrieves all of the custom constraints that exist on a particular
|
---|
| 89 | * organization resource. (customConstraints.listOrganizationsCustomConstraints)
|
---|
| 90 | *
|
---|
| 91 | * @param string $parent Required. The target Google Cloud resource that parents
|
---|
| 92 | * the set of custom constraints that will be returned from this call. Must be
|
---|
| 93 | * in one of the following forms: * `organizations/{organization_id}`
|
---|
| 94 | * @param array $optParams Optional parameters.
|
---|
| 95 | *
|
---|
| 96 | * @opt_param int pageSize Size of the pages to be returned. This is currently
|
---|
| 97 | * unsupported and will be ignored. The server may at any point start using this
|
---|
| 98 | * field to limit page size.
|
---|
| 99 | * @opt_param string pageToken Page token used to retrieve the next page. This
|
---|
| 100 | * is currently unsupported and will be ignored. The server may at any point
|
---|
| 101 | * start using this field.
|
---|
| 102 | * @return GoogleCloudOrgpolicyV2ListCustomConstraintsResponse
|
---|
| 103 | * @throws \Google\Service\Exception
|
---|
| 104 | */
|
---|
| 105 | public function listOrganizationsCustomConstraints($parent, $optParams = [])
|
---|
| 106 | {
|
---|
| 107 | $params = ['parent' => $parent];
|
---|
| 108 | $params = array_merge($params, $optParams);
|
---|
| 109 | return $this->call('list', [$params], GoogleCloudOrgpolicyV2ListCustomConstraintsResponse::class);
|
---|
| 110 | }
|
---|
| 111 | /**
|
---|
| 112 | * Updates a custom constraint. Returns a `google.rpc.Status` with
|
---|
| 113 | * `google.rpc.Code.NOT_FOUND` if the constraint does not exist. Note: the
|
---|
| 114 | * supplied policy will perform a full overwrite of all fields.
|
---|
| 115 | * (customConstraints.patch)
|
---|
| 116 | *
|
---|
| 117 | * @param string $name Immutable. Name of the constraint. This is unique within
|
---|
| 118 | * the organization. Format of the name should be *
|
---|
| 119 | * `organizations/{organization_id}/customConstraints/{custom_constraint_id}`
|
---|
| 120 | * Example: `organizations/123/customConstraints/custom.createOnlyE2TypeVms` The
|
---|
| 121 | * max length is 70 characters and the minimum length is 1. Note that the prefix
|
---|
| 122 | * `organizations/{organization_id}/customConstraints/` is not counted.
|
---|
| 123 | * @param GoogleCloudOrgpolicyV2CustomConstraint $postBody
|
---|
| 124 | * @param array $optParams Optional parameters.
|
---|
| 125 | * @return GoogleCloudOrgpolicyV2CustomConstraint
|
---|
| 126 | * @throws \Google\Service\Exception
|
---|
| 127 | */
|
---|
| 128 | public function patch($name, GoogleCloudOrgpolicyV2CustomConstraint $postBody, $optParams = [])
|
---|
| 129 | {
|
---|
| 130 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 131 | $params = array_merge($params, $optParams);
|
---|
| 132 | return $this->call('patch', [$params], GoogleCloudOrgpolicyV2CustomConstraint::class);
|
---|
| 133 | }
|
---|
| 134 | }
|
---|
| 135 |
|
---|
| 136 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 137 | class_alias(OrganizationsCustomConstraints::class, 'Google_Service_OrgPolicyAPI_Resource_OrganizationsCustomConstraints');
|
---|