[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\ServiceUsage\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\ServiceUsage\BatchEnableServicesRequest;
|
---|
| 21 | use Google\Service\ServiceUsage\BatchGetServicesResponse;
|
---|
| 22 | use Google\Service\ServiceUsage\DisableServiceRequest;
|
---|
| 23 | use Google\Service\ServiceUsage\EnableServiceRequest;
|
---|
| 24 | use Google\Service\ServiceUsage\GoogleApiServiceusageV1Service;
|
---|
| 25 | use Google\Service\ServiceUsage\ListServicesResponse;
|
---|
| 26 | use Google\Service\ServiceUsage\Operation;
|
---|
| 27 |
|
---|
| 28 | /**
|
---|
| 29 | * The "services" collection of methods.
|
---|
| 30 | * Typical usage is:
|
---|
| 31 | * <code>
|
---|
| 32 | * $serviceusageService = new Google\Service\ServiceUsage(...);
|
---|
| 33 | * $services = $serviceusageService->services;
|
---|
| 34 | * </code>
|
---|
| 35 | */
|
---|
| 36 | class Services extends \Google\Service\Resource
|
---|
| 37 | {
|
---|
| 38 | /**
|
---|
| 39 | * Enable multiple services on a project. The operation is atomic: if enabling
|
---|
| 40 | * any service fails, then the entire batch fails, and no state changes occur.
|
---|
| 41 | * To enable a single service, use the `EnableService` method instead.
|
---|
| 42 | * (services.batchEnable)
|
---|
| 43 | *
|
---|
| 44 | * @param string $parent Parent to enable services on. An example name would be:
|
---|
| 45 | * `projects/123` where `123` is the project number. The `BatchEnableServices`
|
---|
| 46 | * method currently only supports projects.
|
---|
| 47 | * @param BatchEnableServicesRequest $postBody
|
---|
| 48 | * @param array $optParams Optional parameters.
|
---|
| 49 | * @return Operation
|
---|
| 50 | * @throws \Google\Service\Exception
|
---|
| 51 | */
|
---|
| 52 | public function batchEnable($parent, BatchEnableServicesRequest $postBody, $optParams = [])
|
---|
| 53 | {
|
---|
| 54 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 55 | $params = array_merge($params, $optParams);
|
---|
| 56 | return $this->call('batchEnable', [$params], Operation::class);
|
---|
| 57 | }
|
---|
| 58 | /**
|
---|
| 59 | * Returns the service configurations and enabled states for a given list of
|
---|
| 60 | * services. (services.batchGet)
|
---|
| 61 | *
|
---|
| 62 | * @param string $parent Parent to retrieve services from. If this is set, the
|
---|
| 63 | * parent of all of the services specified in `names` must match this field. An
|
---|
| 64 | * example name would be: `projects/123` where `123` is the project number. The
|
---|
| 65 | * `BatchGetServices` method currently only supports projects.
|
---|
| 66 | * @param array $optParams Optional parameters.
|
---|
| 67 | *
|
---|
| 68 | * @opt_param string names Names of the services to retrieve. An example name
|
---|
| 69 | * would be: `projects/123/services/serviceusage.googleapis.com` where `123` is
|
---|
| 70 | * the project number. A single request can get a maximum of 30 services at a
|
---|
| 71 | * time.
|
---|
| 72 | * @return BatchGetServicesResponse
|
---|
| 73 | * @throws \Google\Service\Exception
|
---|
| 74 | */
|
---|
| 75 | public function batchGet($parent, $optParams = [])
|
---|
| 76 | {
|
---|
| 77 | $params = ['parent' => $parent];
|
---|
| 78 | $params = array_merge($params, $optParams);
|
---|
| 79 | return $this->call('batchGet', [$params], BatchGetServicesResponse::class);
|
---|
| 80 | }
|
---|
| 81 | /**
|
---|
| 82 | * Disable a service so that it can no longer be used with a project. This
|
---|
| 83 | * prevents unintended usage that may cause unexpected billing charges or
|
---|
| 84 | * security leaks. It is not valid to call the disable method on a service that
|
---|
| 85 | * is not currently enabled. Callers will receive a `FAILED_PRECONDITION` status
|
---|
| 86 | * if the target service is not currently enabled. (services.disable)
|
---|
| 87 | *
|
---|
| 88 | * @param string $name Name of the consumer and service to disable the service
|
---|
| 89 | * on. The enable and disable methods currently only support projects. An
|
---|
| 90 | * example name would be: `projects/123/services/serviceusage.googleapis.com`
|
---|
| 91 | * where `123` is the project number.
|
---|
| 92 | * @param DisableServiceRequest $postBody
|
---|
| 93 | * @param array $optParams Optional parameters.
|
---|
| 94 | * @return Operation
|
---|
| 95 | * @throws \Google\Service\Exception
|
---|
| 96 | */
|
---|
| 97 | public function disable($name, DisableServiceRequest $postBody, $optParams = [])
|
---|
| 98 | {
|
---|
| 99 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 100 | $params = array_merge($params, $optParams);
|
---|
| 101 | return $this->call('disable', [$params], Operation::class);
|
---|
| 102 | }
|
---|
| 103 | /**
|
---|
| 104 | * Enable a service so that it can be used with a project. (services.enable)
|
---|
| 105 | *
|
---|
| 106 | * @param string $name Name of the consumer and service to enable the service
|
---|
| 107 | * on. The `EnableService` and `DisableService` methods currently only support
|
---|
| 108 | * projects. Enabling a service requires that the service is public or is shared
|
---|
| 109 | * with the user enabling the service. An example name would be:
|
---|
| 110 | * `projects/123/services/serviceusage.googleapis.com` where `123` is the
|
---|
| 111 | * project number.
|
---|
| 112 | * @param EnableServiceRequest $postBody
|
---|
| 113 | * @param array $optParams Optional parameters.
|
---|
| 114 | * @return Operation
|
---|
| 115 | * @throws \Google\Service\Exception
|
---|
| 116 | */
|
---|
| 117 | public function enable($name, EnableServiceRequest $postBody, $optParams = [])
|
---|
| 118 | {
|
---|
| 119 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 120 | $params = array_merge($params, $optParams);
|
---|
| 121 | return $this->call('enable', [$params], Operation::class);
|
---|
| 122 | }
|
---|
| 123 | /**
|
---|
| 124 | * Returns the service configuration and enabled state for a given service.
|
---|
| 125 | * (services.get)
|
---|
| 126 | *
|
---|
| 127 | * @param string $name Name of the consumer and service to get the
|
---|
| 128 | * `ConsumerState` for. An example name would be:
|
---|
| 129 | * `projects/123/services/serviceusage.googleapis.com` where `123` is the
|
---|
| 130 | * project number.
|
---|
| 131 | * @param array $optParams Optional parameters.
|
---|
| 132 | * @return GoogleApiServiceusageV1Service
|
---|
| 133 | * @throws \Google\Service\Exception
|
---|
| 134 | */
|
---|
| 135 | public function get($name, $optParams = [])
|
---|
| 136 | {
|
---|
| 137 | $params = ['name' => $name];
|
---|
| 138 | $params = array_merge($params, $optParams);
|
---|
| 139 | return $this->call('get', [$params], GoogleApiServiceusageV1Service::class);
|
---|
| 140 | }
|
---|
| 141 | /**
|
---|
| 142 | * List all services available to the specified project, and the current state
|
---|
| 143 | * of those services with respect to the project. The list includes all public
|
---|
| 144 | * services, all services for which the calling user has the
|
---|
| 145 | * `servicemanagement.services.bind` permission, and all services that have
|
---|
| 146 | * already been enabled on the project. The list can be filtered to only include
|
---|
| 147 | * services in a specific state, for example to only include services enabled on
|
---|
| 148 | * the project. WARNING: If you need to query enabled services frequently or
|
---|
| 149 | * across an organization, you should use [Cloud Asset Inventory
|
---|
| 150 | * API](https://cloud.google.com/asset-inventory/docs/apis), which provides
|
---|
| 151 | * higher throughput and richer filtering capability. (services.listServices)
|
---|
| 152 | *
|
---|
| 153 | * @param string $parent Parent to search for services on. An example name would
|
---|
| 154 | * be: `projects/123` where `123` is the project number.
|
---|
| 155 | * @param array $optParams Optional parameters.
|
---|
| 156 | *
|
---|
| 157 | * @opt_param string filter Only list services that conform to the given filter.
|
---|
| 158 | * The allowed filter strings are `state:ENABLED` and `state:DISABLED`.
|
---|
| 159 | * @opt_param int pageSize Requested size of the next page of data. Requested
|
---|
| 160 | * page size cannot exceed 200. If not set, the default page size is 50.
|
---|
| 161 | * @opt_param string pageToken Token identifying which result to start with,
|
---|
| 162 | * which is returned by a previous list call.
|
---|
| 163 | * @return ListServicesResponse
|
---|
| 164 | * @throws \Google\Service\Exception
|
---|
| 165 | */
|
---|
| 166 | public function listServices($parent, $optParams = [])
|
---|
| 167 | {
|
---|
| 168 | $params = ['parent' => $parent];
|
---|
| 169 | $params = array_merge($params, $optParams);
|
---|
| 170 | return $this->call('list', [$params], ListServicesResponse::class);
|
---|
| 171 | }
|
---|
| 172 | }
|
---|
| 173 |
|
---|
| 174 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 175 | class_alias(Services::class, 'Google_Service_ServiceUsage_Resource_Services');
|
---|