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\ServiceManagement\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\ServiceManagement\GenerateConfigReportRequest;
|
---|
21 | use Google\Service\ServiceManagement\GenerateConfigReportResponse;
|
---|
22 | use Google\Service\ServiceManagement\GetIamPolicyRequest;
|
---|
23 | use Google\Service\ServiceManagement\ListServicesResponse;
|
---|
24 | use Google\Service\ServiceManagement\ManagedService;
|
---|
25 | use Google\Service\ServiceManagement\Operation;
|
---|
26 | use Google\Service\ServiceManagement\Policy;
|
---|
27 | use Google\Service\ServiceManagement\Service;
|
---|
28 | use Google\Service\ServiceManagement\SetIamPolicyRequest;
|
---|
29 | use Google\Service\ServiceManagement\TestIamPermissionsRequest;
|
---|
30 | use Google\Service\ServiceManagement\TestIamPermissionsResponse;
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * The "services" collection of methods.
|
---|
34 | * Typical usage is:
|
---|
35 | * <code>
|
---|
36 | * $servicemanagementService = new Google\Service\ServiceManagement(...);
|
---|
37 | * $services = $servicemanagementService->services;
|
---|
38 | * </code>
|
---|
39 | */
|
---|
40 | class Services extends \Google\Service\Resource
|
---|
41 | {
|
---|
42 | /**
|
---|
43 | * Creates a new managed service. A managed service is immutable, and is subject
|
---|
44 | * to mandatory 30-day data retention. You cannot move a service or recreate it
|
---|
45 | * within 30 days after deletion. One producer project can own no more than 500
|
---|
46 | * services. For security and reliability purposes, a production service should
|
---|
47 | * be hosted in a dedicated producer project. Operation (services.create)
|
---|
48 | *
|
---|
49 | * @param ManagedService $postBody
|
---|
50 | * @param array $optParams Optional parameters.
|
---|
51 | * @return Operation
|
---|
52 | * @throws \Google\Service\Exception
|
---|
53 | */
|
---|
54 | public function create(ManagedService $postBody, $optParams = [])
|
---|
55 | {
|
---|
56 | $params = ['postBody' => $postBody];
|
---|
57 | $params = array_merge($params, $optParams);
|
---|
58 | return $this->call('create', [$params], Operation::class);
|
---|
59 | }
|
---|
60 | /**
|
---|
61 | * Deletes a managed service. This method will change the service to the `Soft-
|
---|
62 | * Delete` state for 30 days. Within this period, service producers may call
|
---|
63 | * UndeleteService to restore the service. After 30 days, the service will be
|
---|
64 | * permanently deleted. Operation (services.delete)
|
---|
65 | *
|
---|
66 | * @param string $serviceName Required. The name of the service. See the
|
---|
67 | * [overview](https://cloud.google.com/service-management/overview) for naming
|
---|
68 | * requirements. For example: `example.googleapis.com`.
|
---|
69 | * @param array $optParams Optional parameters.
|
---|
70 | * @return Operation
|
---|
71 | * @throws \Google\Service\Exception
|
---|
72 | */
|
---|
73 | public function delete($serviceName, $optParams = [])
|
---|
74 | {
|
---|
75 | $params = ['serviceName' => $serviceName];
|
---|
76 | $params = array_merge($params, $optParams);
|
---|
77 | return $this->call('delete', [$params], Operation::class);
|
---|
78 | }
|
---|
79 | /**
|
---|
80 | * Generates and returns a report (errors, warnings and changes from existing
|
---|
81 | * configurations) associated with GenerateConfigReportRequest.new_value If
|
---|
82 | * GenerateConfigReportRequest.old_value is specified,
|
---|
83 | * GenerateConfigReportRequest will contain a single ChangeReport based on the
|
---|
84 | * comparison between GenerateConfigReportRequest.new_value and
|
---|
85 | * GenerateConfigReportRequest.old_value. If
|
---|
86 | * GenerateConfigReportRequest.old_value is not specified, this method will
|
---|
87 | * compare GenerateConfigReportRequest.new_value with the last pushed service
|
---|
88 | * configuration. (services.generateConfigReport)
|
---|
89 | *
|
---|
90 | * @param GenerateConfigReportRequest $postBody
|
---|
91 | * @param array $optParams Optional parameters.
|
---|
92 | * @return GenerateConfigReportResponse
|
---|
93 | * @throws \Google\Service\Exception
|
---|
94 | */
|
---|
95 | public function generateConfigReport(GenerateConfigReportRequest $postBody, $optParams = [])
|
---|
96 | {
|
---|
97 | $params = ['postBody' => $postBody];
|
---|
98 | $params = array_merge($params, $optParams);
|
---|
99 | return $this->call('generateConfigReport', [$params], GenerateConfigReportResponse::class);
|
---|
100 | }
|
---|
101 | /**
|
---|
102 | * Gets a managed service. Authentication is required unless the service is
|
---|
103 | * public. (services.get)
|
---|
104 | *
|
---|
105 | * @param string $serviceName Required. The name of the service. See the
|
---|
106 | * `ServiceManager` overview for naming requirements. For example:
|
---|
107 | * `example.googleapis.com`.
|
---|
108 | * @param array $optParams Optional parameters.
|
---|
109 | * @return ManagedService
|
---|
110 | * @throws \Google\Service\Exception
|
---|
111 | */
|
---|
112 | public function get($serviceName, $optParams = [])
|
---|
113 | {
|
---|
114 | $params = ['serviceName' => $serviceName];
|
---|
115 | $params = array_merge($params, $optParams);
|
---|
116 | return $this->call('get', [$params], ManagedService::class);
|
---|
117 | }
|
---|
118 | /**
|
---|
119 | * Gets a service configuration (version) for a managed service.
|
---|
120 | * (services.getConfig)
|
---|
121 | *
|
---|
122 | * @param string $serviceName Required. The name of the service. See the
|
---|
123 | * [overview](https://cloud.google.com/service-management/overview) for naming
|
---|
124 | * requirements. For example: `example.googleapis.com`.
|
---|
125 | * @param array $optParams Optional parameters.
|
---|
126 | *
|
---|
127 | * @opt_param string configId Required. The id of the service configuration
|
---|
128 | * resource. This field must be specified for the server to return all fields,
|
---|
129 | * including `SourceInfo`.
|
---|
130 | * @opt_param string view Specifies which parts of the Service Config should be
|
---|
131 | * returned in the response.
|
---|
132 | * @return Service
|
---|
133 | * @throws \Google\Service\Exception
|
---|
134 | */
|
---|
135 | public function getConfig($serviceName, $optParams = [])
|
---|
136 | {
|
---|
137 | $params = ['serviceName' => $serviceName];
|
---|
138 | $params = array_merge($params, $optParams);
|
---|
139 | return $this->call('getConfig', [$params], Service::class);
|
---|
140 | }
|
---|
141 | /**
|
---|
142 | * Gets the access control policy for a resource. Returns an empty policy if the
|
---|
143 | * resource exists and does not have a policy set. (services.getIamPolicy)
|
---|
144 | *
|
---|
145 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
146 | * requested. See [Resource
|
---|
147 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
148 | * appropriate value for this field.
|
---|
149 | * @param GetIamPolicyRequest $postBody
|
---|
150 | * @param array $optParams Optional parameters.
|
---|
151 | * @return Policy
|
---|
152 | * @throws \Google\Service\Exception
|
---|
153 | */
|
---|
154 | public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
|
---|
155 | {
|
---|
156 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
157 | $params = array_merge($params, $optParams);
|
---|
158 | return $this->call('getIamPolicy', [$params], Policy::class);
|
---|
159 | }
|
---|
160 | /**
|
---|
161 | * Lists managed services. Returns all public services. For authenticated users,
|
---|
162 | * also returns all services the calling user has
|
---|
163 | * "servicemanagement.services.get" permission for. (services.listServices)
|
---|
164 | *
|
---|
165 | * @param array $optParams Optional parameters.
|
---|
166 | *
|
---|
167 | * @opt_param string consumerId Include services consumed by the specified
|
---|
168 | * consumer. The Google Service Management implementation accepts the following
|
---|
169 | * forms: - project:
|
---|
170 | * @opt_param int pageSize The max number of items to include in the response
|
---|
171 | * list. Page size is 50 if not specified. Maximum value is 500.
|
---|
172 | * @opt_param string pageToken Token identifying which result to start with;
|
---|
173 | * returned by a previous list call.
|
---|
174 | * @opt_param string producerProjectId Include services produced by the
|
---|
175 | * specified project.
|
---|
176 | * @return ListServicesResponse
|
---|
177 | * @throws \Google\Service\Exception
|
---|
178 | */
|
---|
179 | public function listServices($optParams = [])
|
---|
180 | {
|
---|
181 | $params = [];
|
---|
182 | $params = array_merge($params, $optParams);
|
---|
183 | return $this->call('list', [$params], ListServicesResponse::class);
|
---|
184 | }
|
---|
185 | /**
|
---|
186 | * Sets the access control policy on the specified resource. Replaces any
|
---|
187 | * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
|
---|
188 | * `PERMISSION_DENIED` errors. (services.setIamPolicy)
|
---|
189 | *
|
---|
190 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
191 | * specified. See [Resource
|
---|
192 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
193 | * appropriate value for this field.
|
---|
194 | * @param SetIamPolicyRequest $postBody
|
---|
195 | * @param array $optParams Optional parameters.
|
---|
196 | * @return Policy
|
---|
197 | * @throws \Google\Service\Exception
|
---|
198 | */
|
---|
199 | public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
|
---|
200 | {
|
---|
201 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
202 | $params = array_merge($params, $optParams);
|
---|
203 | return $this->call('setIamPolicy', [$params], Policy::class);
|
---|
204 | }
|
---|
205 | /**
|
---|
206 | * Returns permissions that a caller has on the specified resource. If the
|
---|
207 | * resource does not exist, this will return an empty set of permissions, not a
|
---|
208 | * `NOT_FOUND` error. Note: This operation is designed to be used for building
|
---|
209 | * permission-aware UIs and command-line tools, not for authorization checking.
|
---|
210 | * This operation may "fail open" without warning. (services.testIamPermissions)
|
---|
211 | *
|
---|
212 | * @param string $resource REQUIRED: The resource for which the policy detail is
|
---|
213 | * being requested. See [Resource
|
---|
214 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
215 | * appropriate value for this field.
|
---|
216 | * @param TestIamPermissionsRequest $postBody
|
---|
217 | * @param array $optParams Optional parameters.
|
---|
218 | * @return TestIamPermissionsResponse
|
---|
219 | * @throws \Google\Service\Exception
|
---|
220 | */
|
---|
221 | public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
|
---|
222 | {
|
---|
223 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
224 | $params = array_merge($params, $optParams);
|
---|
225 | return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
|
---|
226 | }
|
---|
227 | /**
|
---|
228 | * Revives a previously deleted managed service. The method restores the service
|
---|
229 | * using the configuration at the time the service was deleted. The target
|
---|
230 | * service must exist and must have been deleted within the last 30 days.
|
---|
231 | * Operation (services.undelete)
|
---|
232 | *
|
---|
233 | * @param string $serviceName Required. The name of the service. See the
|
---|
234 | * [overview](https://cloud.google.com/service-management/overview) for naming
|
---|
235 | * requirements. For example: `example.googleapis.com`.
|
---|
236 | * @param array $optParams Optional parameters.
|
---|
237 | * @return Operation
|
---|
238 | * @throws \Google\Service\Exception
|
---|
239 | */
|
---|
240 | public function undelete($serviceName, $optParams = [])
|
---|
241 | {
|
---|
242 | $params = ['serviceName' => $serviceName];
|
---|
243 | $params = array_merge($params, $optParams);
|
---|
244 | return $this->call('undelete', [$params], Operation::class);
|
---|
245 | }
|
---|
246 | }
|
---|
247 |
|
---|
248 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
249 | class_alias(Services::class, 'Google_Service_ServiceManagement_Resource_Services');
|
---|