[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\ServiceConsumerManagement\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\ServiceConsumerManagement\AddTenantProjectRequest;
|
---|
| 21 | use Google\Service\ServiceConsumerManagement\ApplyTenantProjectConfigRequest;
|
---|
| 22 | use Google\Service\ServiceConsumerManagement\AttachTenantProjectRequest;
|
---|
| 23 | use Google\Service\ServiceConsumerManagement\CreateTenancyUnitRequest;
|
---|
| 24 | use Google\Service\ServiceConsumerManagement\DeleteTenantProjectRequest;
|
---|
| 25 | use Google\Service\ServiceConsumerManagement\ListTenancyUnitsResponse;
|
---|
| 26 | use Google\Service\ServiceConsumerManagement\Operation;
|
---|
| 27 | use Google\Service\ServiceConsumerManagement\RemoveTenantProjectRequest;
|
---|
| 28 | use Google\Service\ServiceConsumerManagement\TenancyUnit;
|
---|
| 29 | use Google\Service\ServiceConsumerManagement\UndeleteTenantProjectRequest;
|
---|
| 30 |
|
---|
| 31 | /**
|
---|
| 32 | * The "tenancyUnits" collection of methods.
|
---|
| 33 | * Typical usage is:
|
---|
| 34 | * <code>
|
---|
| 35 | * $serviceconsumermanagementService = new Google\Service\ServiceConsumerManagement(...);
|
---|
| 36 | * $tenancyUnits = $serviceconsumermanagementService->services_tenancyUnits;
|
---|
| 37 | * </code>
|
---|
| 38 | */
|
---|
| 39 | class ServicesTenancyUnits extends \Google\Service\Resource
|
---|
| 40 | {
|
---|
| 41 | /**
|
---|
| 42 | * Add a new tenant project to the tenancy unit. There can be a maximum of 1024
|
---|
| 43 | * tenant projects in a tenancy unit. If there are previously failed
|
---|
| 44 | * `AddTenantProject` calls, you might need to call `RemoveTenantProject` first
|
---|
| 45 | * to resolve them before you can make another call to `AddTenantProject` with
|
---|
| 46 | * the same tag. Operation. (tenancyUnits.addProject)
|
---|
| 47 | *
|
---|
| 48 | * @param string $parent Required. Name of the tenancy unit. Such as
|
---|
| 49 | * 'services/service.googleapis.com/projects/12345/tenancyUnits/abcd'.
|
---|
| 50 | * @param AddTenantProjectRequest $postBody
|
---|
| 51 | * @param array $optParams Optional parameters.
|
---|
| 52 | * @return Operation
|
---|
| 53 | * @throws \Google\Service\Exception
|
---|
| 54 | */
|
---|
| 55 | public function addProject($parent, AddTenantProjectRequest $postBody, $optParams = [])
|
---|
| 56 | {
|
---|
| 57 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 58 | $params = array_merge($params, $optParams);
|
---|
| 59 | return $this->call('addProject', [$params], Operation::class);
|
---|
| 60 | }
|
---|
| 61 | /**
|
---|
| 62 | * Apply a configuration to an existing tenant project. This project must exist
|
---|
| 63 | * in an active state and have the original owner account. The caller must have
|
---|
| 64 | * permission to add a project to the given tenancy unit. The configuration is
|
---|
| 65 | * applied, but any existing settings on the project aren't modified. Specified
|
---|
| 66 | * policy bindings are applied. Existing bindings aren't modified. Specified
|
---|
| 67 | * services are activated. No service is deactivated. If specified, new billing
|
---|
| 68 | * configuration is applied. Omit a billing configuration to keep the existing
|
---|
| 69 | * one. A service account in the project is created if previously non existed.
|
---|
| 70 | * Specified labels will be appended to tenant project, note that the value of
|
---|
| 71 | * existing label key will be updated if the same label key is requested. The
|
---|
| 72 | * specified folder is ignored, as moving a tenant project to a different folder
|
---|
| 73 | * isn't supported. The operation fails if any of the steps fail, but no
|
---|
| 74 | * rollback of already applied configuration changes is attempted. Operation.
|
---|
| 75 | * (tenancyUnits.applyProjectConfig)
|
---|
| 76 | *
|
---|
| 77 | * @param string $name Required. Name of the tenancy unit. Such as
|
---|
| 78 | * 'services/service.googleapis.com/projects/12345/tenancyUnits/abcd'.
|
---|
| 79 | * @param ApplyTenantProjectConfigRequest $postBody
|
---|
| 80 | * @param array $optParams Optional parameters.
|
---|
| 81 | * @return Operation
|
---|
| 82 | * @throws \Google\Service\Exception
|
---|
| 83 | */
|
---|
| 84 | public function applyProjectConfig($name, ApplyTenantProjectConfigRequest $postBody, $optParams = [])
|
---|
| 85 | {
|
---|
| 86 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 87 | $params = array_merge($params, $optParams);
|
---|
| 88 | return $this->call('applyProjectConfig', [$params], Operation::class);
|
---|
| 89 | }
|
---|
| 90 | /**
|
---|
| 91 | * Attach an existing project to the tenancy unit as a new tenant resource. The
|
---|
| 92 | * project could either be the tenant project reserved by calling
|
---|
| 93 | * `AddTenantProject` under a tenancy unit of a service producer's project of a
|
---|
| 94 | * managed service, or from a separate project. The caller is checked against a
|
---|
| 95 | * set of permissions as if calling `AddTenantProject` on the same service
|
---|
| 96 | * consumer. To trigger the attachment, the targeted tenant project must be in a
|
---|
| 97 | * folder. Make sure the ServiceConsumerManagement service account is the owner
|
---|
| 98 | * of that project. These two requirements are already met if the project is
|
---|
| 99 | * reserved by calling `AddTenantProject`. Operation.
|
---|
| 100 | * (tenancyUnits.attachProject)
|
---|
| 101 | *
|
---|
| 102 | * @param string $name Required. Name of the tenancy unit that the project will
|
---|
| 103 | * be attached to. Such as
|
---|
| 104 | * 'services/service.googleapis.com/projects/12345/tenancyUnits/abcd'.
|
---|
| 105 | * @param AttachTenantProjectRequest $postBody
|
---|
| 106 | * @param array $optParams Optional parameters.
|
---|
| 107 | * @return Operation
|
---|
| 108 | * @throws \Google\Service\Exception
|
---|
| 109 | */
|
---|
| 110 | public function attachProject($name, AttachTenantProjectRequest $postBody, $optParams = [])
|
---|
| 111 | {
|
---|
| 112 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 113 | $params = array_merge($params, $optParams);
|
---|
| 114 | return $this->call('attachProject', [$params], Operation::class);
|
---|
| 115 | }
|
---|
| 116 | /**
|
---|
| 117 | * Creates a tenancy unit with no tenant resources. If tenancy unit already
|
---|
| 118 | * exists, it will be returned, however, in this case, returned TenancyUnit does
|
---|
| 119 | * not have tenant_resources field set and ListTenancyUnits has to be used to
|
---|
| 120 | * get a complete TenancyUnit with all fields populated. (tenancyUnits.create)
|
---|
| 121 | *
|
---|
| 122 | * @param string $parent Required. services/{service}/{collection id}/{resource
|
---|
| 123 | * id} {collection id} is the cloud resource collection type representing the
|
---|
| 124 | * service consumer, for example 'projects', or 'organizations'. {resource id}
|
---|
| 125 | * is the consumer numeric id, such as project number: '123456'. {service} the
|
---|
| 126 | * name of a managed service, such as 'service.googleapis.com'. Enables service
|
---|
| 127 | * binding using the new tenancy unit.
|
---|
| 128 | * @param CreateTenancyUnitRequest $postBody
|
---|
| 129 | * @param array $optParams Optional parameters.
|
---|
| 130 | * @return TenancyUnit
|
---|
| 131 | * @throws \Google\Service\Exception
|
---|
| 132 | */
|
---|
| 133 | public function create($parent, CreateTenancyUnitRequest $postBody, $optParams = [])
|
---|
| 134 | {
|
---|
| 135 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 136 | $params = array_merge($params, $optParams);
|
---|
| 137 | return $this->call('create', [$params], TenancyUnit::class);
|
---|
| 138 | }
|
---|
| 139 | /**
|
---|
| 140 | * Delete a tenancy unit. Before you delete the tenancy unit, there should be no
|
---|
| 141 | * tenant resources in it that aren't in a DELETED state. Operation.
|
---|
| 142 | * (tenancyUnits.delete)
|
---|
| 143 | *
|
---|
| 144 | * @param string $name Required. Name of the tenancy unit to be deleted.
|
---|
| 145 | * @param array $optParams Optional parameters.
|
---|
| 146 | * @return Operation
|
---|
| 147 | * @throws \Google\Service\Exception
|
---|
| 148 | */
|
---|
| 149 | public function delete($name, $optParams = [])
|
---|
| 150 | {
|
---|
| 151 | $params = ['name' => $name];
|
---|
| 152 | $params = array_merge($params, $optParams);
|
---|
| 153 | return $this->call('delete', [$params], Operation::class);
|
---|
| 154 | }
|
---|
| 155 | /**
|
---|
| 156 | * Deletes the specified project resource identified by a tenant resource tag.
|
---|
| 157 | * The mothod removes a project lien with a 'TenantManager' origin if that was
|
---|
| 158 | * added. It will then attempt to delete the project. If that operation fails,
|
---|
| 159 | * this method also fails. After the project has been deleted, the tenant
|
---|
| 160 | * resource state is set to DELETED. To permanently remove resource metadata,
|
---|
| 161 | * call the `RemoveTenantProject` method. New resources with the same tag can't
|
---|
| 162 | * be added if there are existing resources in a DELETED state. Operation.
|
---|
| 163 | * (tenancyUnits.deleteProject)
|
---|
| 164 | *
|
---|
| 165 | * @param string $name Required. Name of the tenancy unit. Such as
|
---|
| 166 | * 'services/service.googleapis.com/projects/12345/tenancyUnits/abcd'.
|
---|
| 167 | * @param DeleteTenantProjectRequest $postBody
|
---|
| 168 | * @param array $optParams Optional parameters.
|
---|
| 169 | * @return Operation
|
---|
| 170 | * @throws \Google\Service\Exception
|
---|
| 171 | */
|
---|
| 172 | public function deleteProject($name, DeleteTenantProjectRequest $postBody, $optParams = [])
|
---|
| 173 | {
|
---|
| 174 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 175 | $params = array_merge($params, $optParams);
|
---|
| 176 | return $this->call('deleteProject', [$params], Operation::class);
|
---|
| 177 | }
|
---|
| 178 | /**
|
---|
| 179 | * Find the tenancy unit for a managed service and service consumer. This method
|
---|
| 180 | * shouldn't be used in a service producer's runtime path, for example to find
|
---|
| 181 | * the tenant project number when creating VMs. Service producers must persist
|
---|
| 182 | * the tenant project's information after the project is created.
|
---|
| 183 | * (tenancyUnits.listServicesTenancyUnits)
|
---|
| 184 | *
|
---|
| 185 | * @param string $parent Required. Managed service and service consumer.
|
---|
| 186 | * Required. services/{service}/{collection id}/{resource id} {collection id} is
|
---|
| 187 | * the cloud resource collection type representing the service consumer, for
|
---|
| 188 | * example 'projects', or 'organizations'. {resource id} is the consumer numeric
|
---|
| 189 | * id, such as project number: '123456'. {service} the name of a service, such
|
---|
| 190 | * as 'service.googleapis.com'.
|
---|
| 191 | * @param array $optParams Optional parameters.
|
---|
| 192 | *
|
---|
| 193 | * @opt_param string filter Optional. Filter expression over tenancy resources
|
---|
| 194 | * field. Optional.
|
---|
| 195 | * @opt_param int pageSize Optional. The maximum number of results returned by
|
---|
| 196 | * this request.
|
---|
| 197 | * @opt_param string pageToken Optional. The continuation token, which is used
|
---|
| 198 | * to page through large result sets. To get the next page of results, set this
|
---|
| 199 | * parameter to the value of `nextPageToken` from the previous response.
|
---|
| 200 | * @return ListTenancyUnitsResponse
|
---|
| 201 | * @throws \Google\Service\Exception
|
---|
| 202 | */
|
---|
| 203 | public function listServicesTenancyUnits($parent, $optParams = [])
|
---|
| 204 | {
|
---|
| 205 | $params = ['parent' => $parent];
|
---|
| 206 | $params = array_merge($params, $optParams);
|
---|
| 207 | return $this->call('list', [$params], ListTenancyUnitsResponse::class);
|
---|
| 208 | }
|
---|
| 209 | /**
|
---|
| 210 | * Removes the specified project resource identified by a tenant resource tag.
|
---|
| 211 | * The method removes the project lien with 'TenantManager' origin if that was
|
---|
| 212 | * added. It then attempts to delete the project. If that operation fails, this
|
---|
| 213 | * method also fails. Calls to remove already removed or non-existent tenant
|
---|
| 214 | * project succeed. After the project has been deleted, or if was already in a
|
---|
| 215 | * DELETED state, resource metadata is permanently removed from the tenancy
|
---|
| 216 | * unit. Operation. (tenancyUnits.removeProject)
|
---|
| 217 | *
|
---|
| 218 | * @param string $name Required. Name of the tenancy unit. Such as
|
---|
| 219 | * 'services/service.googleapis.com/projects/12345/tenancyUnits/abcd'.
|
---|
| 220 | * @param RemoveTenantProjectRequest $postBody
|
---|
| 221 | * @param array $optParams Optional parameters.
|
---|
| 222 | * @return Operation
|
---|
| 223 | * @throws \Google\Service\Exception
|
---|
| 224 | */
|
---|
| 225 | public function removeProject($name, RemoveTenantProjectRequest $postBody, $optParams = [])
|
---|
| 226 | {
|
---|
| 227 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 228 | $params = array_merge($params, $optParams);
|
---|
| 229 | return $this->call('removeProject', [$params], Operation::class);
|
---|
| 230 | }
|
---|
| 231 | /**
|
---|
| 232 | * Attempts to undelete a previously deleted tenant project. The project must be
|
---|
| 233 | * in a DELETED state. There are no guarantees that an undeleted project will be
|
---|
| 234 | * in a fully restored and functional state. Call the `ApplyTenantProjectConfig`
|
---|
| 235 | * method to update its configuration and then validate all managed service
|
---|
| 236 | * resources. Operation. (tenancyUnits.undeleteProject)
|
---|
| 237 | *
|
---|
| 238 | * @param string $name Required. Name of the tenancy unit. Such as
|
---|
| 239 | * 'services/service.googleapis.com/projects/12345/tenancyUnits/abcd'.
|
---|
| 240 | * @param UndeleteTenantProjectRequest $postBody
|
---|
| 241 | * @param array $optParams Optional parameters.
|
---|
| 242 | * @return Operation
|
---|
| 243 | * @throws \Google\Service\Exception
|
---|
| 244 | */
|
---|
| 245 | public function undeleteProject($name, UndeleteTenantProjectRequest $postBody, $optParams = [])
|
---|
| 246 | {
|
---|
| 247 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 248 | $params = array_merge($params, $optParams);
|
---|
| 249 | return $this->call('undeleteProject', [$params], Operation::class);
|
---|
| 250 | }
|
---|
| 251 | }
|
---|
| 252 |
|
---|
| 253 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 254 | class_alias(ServicesTenancyUnits::class, 'Google_Service_ServiceConsumerManagement_Resource_ServicesTenancyUnits');
|
---|