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;
19
20use Google\Client;
21
22/**
23 * Service definition for OrgPolicyAPI (v2).
24 *
25 * <p>
26 * The Org Policy API allows users to configure governance rules on their GCP
27 * resources across the Cloud Resource Hierarchy.</p>
28 *
29 * <p>
30 * For more information about this service, see the API
31 * <a href="https://cloud.google.com/orgpolicy/docs/reference/rest/index.html" target="_blank">Documentation</a>
32 * </p>
33 *
34 * @author Google, Inc.
35 */
36class OrgPolicyAPI extends \Google\Service
37{
38  /** See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.. */
39  const CLOUD_PLATFORM =
40      "https://www.googleapis.com/auth/cloud-platform";
41
42  public $folders_constraints;
43  public $folders_policies;
44  public $organizations_constraints;
45  public $organizations_policies;
46  public $projects_constraints;
47  public $projects_policies;
48
49  /**
50   * Constructs the internal representation of the OrgPolicyAPI service.
51   *
52   * @param Client|array $clientOrConfig The client used to deliver requests, or a
53   *                                     config array to pass to a new Client instance.
54   * @param string $rootUrl The root URL used for requests to the service.
55   */
56  public function __construct($clientOrConfig = [], $rootUrl = null)
57  {
58    parent::__construct($clientOrConfig);
59    $this->rootUrl = $rootUrl ?: 'https://orgpolicy.googleapis.com/';
60    $this->servicePath = '';
61    $this->batchPath = 'batch';
62    $this->version = 'v2';
63    $this->serviceName = 'orgpolicy';
64
65    $this->folders_constraints = new OrgPolicyAPI\Resource\FoldersConstraints(
66        $this,
67        $this->serviceName,
68        'constraints',
69        [
70          'methods' => [
71            'list' => [
72              'path' => 'v2/{+parent}/constraints',
73              'httpMethod' => 'GET',
74              'parameters' => [
75                'parent' => [
76                  'location' => 'path',
77                  'type' => 'string',
78                  'required' => true,
79                ],
80                'pageSize' => [
81                  'location' => 'query',
82                  'type' => 'integer',
83                ],
84                'pageToken' => [
85                  'location' => 'query',
86                  'type' => 'string',
87                ],
88              ],
89            ],
90          ]
91        ]
92    );
93    $this->folders_policies = new OrgPolicyAPI\Resource\FoldersPolicies(
94        $this,
95        $this->serviceName,
96        'policies',
97        [
98          'methods' => [
99            'create' => [
100              'path' => 'v2/{+parent}/policies',
101              'httpMethod' => 'POST',
102              'parameters' => [
103                'parent' => [
104                  'location' => 'path',
105                  'type' => 'string',
106                  'required' => true,
107                ],
108              ],
109            ],'delete' => [
110              'path' => 'v2/{+name}',
111              'httpMethod' => 'DELETE',
112              'parameters' => [
113                'name' => [
114                  'location' => 'path',
115                  'type' => 'string',
116                  'required' => true,
117                ],
118              ],
119            ],'get' => [
120              'path' => 'v2/{+name}',
121              'httpMethod' => 'GET',
122              'parameters' => [
123                'name' => [
124                  'location' => 'path',
125                  'type' => 'string',
126                  'required' => true,
127                ],
128              ],
129            ],'getEffectivePolicy' => [
130              'path' => 'v2/{+name}:getEffectivePolicy',
131              'httpMethod' => 'GET',
132              'parameters' => [
133                'name' => [
134                  'location' => 'path',
135                  'type' => 'string',
136                  'required' => true,
137                ],
138              ],
139            ],'list' => [
140              'path' => 'v2/{+parent}/policies',
141              'httpMethod' => 'GET',
142              'parameters' => [
143                'parent' => [
144                  'location' => 'path',
145                  'type' => 'string',
146                  'required' => true,
147                ],
148                'pageSize' => [
149                  'location' => 'query',
150                  'type' => 'integer',
151                ],
152                'pageToken' => [
153                  'location' => 'query',
154                  'type' => 'string',
155                ],
156              ],
157            ],'patch' => [
158              'path' => 'v2/{+name}',
159              'httpMethod' => 'PATCH',
160              'parameters' => [
161                'name' => [
162                  'location' => 'path',
163                  'type' => 'string',
164                  'required' => true,
165                ],
166              ],
167            ],
168          ]
169        ]
170    );
171    $this->organizations_constraints = new OrgPolicyAPI\Resource\OrganizationsConstraints(
172        $this,
173        $this->serviceName,
174        'constraints',
175        [
176          'methods' => [
177            'list' => [
178              'path' => 'v2/{+parent}/constraints',
179              'httpMethod' => 'GET',
180              'parameters' => [
181                'parent' => [
182                  'location' => 'path',
183                  'type' => 'string',
184                  'required' => true,
185                ],
186                'pageSize' => [
187                  'location' => 'query',
188                  'type' => 'integer',
189                ],
190                'pageToken' => [
191                  'location' => 'query',
192                  'type' => 'string',
193                ],
194              ],
195            ],
196          ]
197        ]
198    );
199    $this->organizations_policies = new OrgPolicyAPI\Resource\OrganizationsPolicies(
200        $this,
201        $this->serviceName,
202        'policies',
203        [
204          'methods' => [
205            'create' => [
206              'path' => 'v2/{+parent}/policies',
207              'httpMethod' => 'POST',
208              'parameters' => [
209                'parent' => [
210                  'location' => 'path',
211                  'type' => 'string',
212                  'required' => true,
213                ],
214              ],
215            ],'delete' => [
216              'path' => 'v2/{+name}',
217              'httpMethod' => 'DELETE',
218              'parameters' => [
219                'name' => [
220                  'location' => 'path',
221                  'type' => 'string',
222                  'required' => true,
223                ],
224              ],
225            ],'get' => [
226              'path' => 'v2/{+name}',
227              'httpMethod' => 'GET',
228              'parameters' => [
229                'name' => [
230                  'location' => 'path',
231                  'type' => 'string',
232                  'required' => true,
233                ],
234              ],
235            ],'getEffectivePolicy' => [
236              'path' => 'v2/{+name}:getEffectivePolicy',
237              'httpMethod' => 'GET',
238              'parameters' => [
239                'name' => [
240                  'location' => 'path',
241                  'type' => 'string',
242                  'required' => true,
243                ],
244              ],
245            ],'list' => [
246              'path' => 'v2/{+parent}/policies',
247              'httpMethod' => 'GET',
248              'parameters' => [
249                'parent' => [
250                  'location' => 'path',
251                  'type' => 'string',
252                  'required' => true,
253                ],
254                'pageSize' => [
255                  'location' => 'query',
256                  'type' => 'integer',
257                ],
258                'pageToken' => [
259                  'location' => 'query',
260                  'type' => 'string',
261                ],
262              ],
263            ],'patch' => [
264              'path' => 'v2/{+name}',
265              'httpMethod' => 'PATCH',
266              'parameters' => [
267                'name' => [
268                  'location' => 'path',
269                  'type' => 'string',
270                  'required' => true,
271                ],
272              ],
273            ],
274          ]
275        ]
276    );
277    $this->projects_constraints = new OrgPolicyAPI\Resource\ProjectsConstraints(
278        $this,
279        $this->serviceName,
280        'constraints',
281        [
282          'methods' => [
283            'list' => [
284              'path' => 'v2/{+parent}/constraints',
285              'httpMethod' => 'GET',
286              'parameters' => [
287                'parent' => [
288                  'location' => 'path',
289                  'type' => 'string',
290                  'required' => true,
291                ],
292                'pageSize' => [
293                  'location' => 'query',
294                  'type' => 'integer',
295                ],
296                'pageToken' => [
297                  'location' => 'query',
298                  'type' => 'string',
299                ],
300              ],
301            ],
302          ]
303        ]
304    );
305    $this->projects_policies = new OrgPolicyAPI\Resource\ProjectsPolicies(
306        $this,
307        $this->serviceName,
308        'policies',
309        [
310          'methods' => [
311            'create' => [
312              'path' => 'v2/{+parent}/policies',
313              'httpMethod' => 'POST',
314              'parameters' => [
315                'parent' => [
316                  'location' => 'path',
317                  'type' => 'string',
318                  'required' => true,
319                ],
320              ],
321            ],'delete' => [
322              'path' => 'v2/{+name}',
323              'httpMethod' => 'DELETE',
324              'parameters' => [
325                'name' => [
326                  'location' => 'path',
327                  'type' => 'string',
328                  'required' => true,
329                ],
330              ],
331            ],'get' => [
332              'path' => 'v2/{+name}',
333              'httpMethod' => 'GET',
334              'parameters' => [
335                'name' => [
336                  'location' => 'path',
337                  'type' => 'string',
338                  'required' => true,
339                ],
340              ],
341            ],'getEffectivePolicy' => [
342              'path' => 'v2/{+name}:getEffectivePolicy',
343              'httpMethod' => 'GET',
344              'parameters' => [
345                'name' => [
346                  'location' => 'path',
347                  'type' => 'string',
348                  'required' => true,
349                ],
350              ],
351            ],'list' => [
352              'path' => 'v2/{+parent}/policies',
353              'httpMethod' => 'GET',
354              'parameters' => [
355                'parent' => [
356                  'location' => 'path',
357                  'type' => 'string',
358                  'required' => true,
359                ],
360                'pageSize' => [
361                  'location' => 'query',
362                  'type' => 'integer',
363                ],
364                'pageToken' => [
365                  'location' => 'query',
366                  'type' => 'string',
367                ],
368              ],
369            ],'patch' => [
370              'path' => 'v2/{+name}',
371              'httpMethod' => 'PATCH',
372              'parameters' => [
373                'name' => [
374                  'location' => 'path',
375                  'type' => 'string',
376                  'required' => true,
377                ],
378              ],
379            ],
380          ]
381        ]
382    );
383  }
384}
385
386// Adding a class alias for backwards compatibility with the previous class name.
387class_alias(OrgPolicyAPI::class, 'Google_Service_OrgPolicyAPI');
388