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 CloudKMS (v1).
24 *
25 * <p>
26 * Manages keys and performs cryptographic operations in a central cloud
27 * service, for direct use by other cloud resources and applications.</p>
28 *
29 * <p>
30 * For more information about this service, see the API
31 * <a href="https://cloud.google.com/kms/" target="_blank">Documentation</a>
32 * </p>
33 *
34 * @author Google, Inc.
35 */
36class CloudKMS 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  /** View and manage your keys and secrets stored in Cloud Key Management Service. */
42  const CLOUDKMS =
43      "https://www.googleapis.com/auth/cloudkms";
44
45  public $projects_locations;
46  public $projects_locations_ekmConnections;
47  public $projects_locations_keyRings;
48  public $projects_locations_keyRings_cryptoKeys;
49  public $projects_locations_keyRings_cryptoKeys_cryptoKeyVersions;
50  public $projects_locations_keyRings_importJobs;
51
52  /**
53   * Constructs the internal representation of the CloudKMS service.
54   *
55   * @param Client|array $clientOrConfig The client used to deliver requests, or a
56   *                                     config array to pass to a new Client instance.
57   * @param string $rootUrl The root URL used for requests to the service.
58   */
59  public function __construct($clientOrConfig = [], $rootUrl = null)
60  {
61    parent::__construct($clientOrConfig);
62    $this->rootUrl = $rootUrl ?: 'https://cloudkms.googleapis.com/';
63    $this->servicePath = '';
64    $this->batchPath = 'batch';
65    $this->version = 'v1';
66    $this->serviceName = 'cloudkms';
67
68    $this->projects_locations = new CloudKMS\Resource\ProjectsLocations(
69        $this,
70        $this->serviceName,
71        'locations',
72        [
73          'methods' => [
74            'generateRandomBytes' => [
75              'path' => 'v1/{+location}:generateRandomBytes',
76              'httpMethod' => 'POST',
77              'parameters' => [
78                'location' => [
79                  'location' => 'path',
80                  'type' => 'string',
81                  'required' => true,
82                ],
83              ],
84            ],'get' => [
85              'path' => 'v1/{+name}',
86              'httpMethod' => 'GET',
87              'parameters' => [
88                'name' => [
89                  'location' => 'path',
90                  'type' => 'string',
91                  'required' => true,
92                ],
93              ],
94            ],'list' => [
95              'path' => 'v1/{+name}/locations',
96              'httpMethod' => 'GET',
97              'parameters' => [
98                'name' => [
99                  'location' => 'path',
100                  'type' => 'string',
101                  'required' => true,
102                ],
103                'filter' => [
104                  'location' => 'query',
105                  'type' => 'string',
106                ],
107                'pageSize' => [
108                  'location' => 'query',
109                  'type' => 'integer',
110                ],
111                'pageToken' => [
112                  'location' => 'query',
113                  'type' => 'string',
114                ],
115              ],
116            ],
117          ]
118        ]
119    );
120    $this->projects_locations_ekmConnections = new CloudKMS\Resource\ProjectsLocationsEkmConnections(
121        $this,
122        $this->serviceName,
123        'ekmConnections',
124        [
125          'methods' => [
126            'create' => [
127              'path' => 'v1/{+parent}/ekmConnections',
128              'httpMethod' => 'POST',
129              'parameters' => [
130                'parent' => [
131                  'location' => 'path',
132                  'type' => 'string',
133                  'required' => true,
134                ],
135                'ekmConnectionId' => [
136                  'location' => 'query',
137                  'type' => 'string',
138                ],
139              ],
140            ],'get' => [
141              'path' => 'v1/{+name}',
142              'httpMethod' => 'GET',
143              'parameters' => [
144                'name' => [
145                  'location' => 'path',
146                  'type' => 'string',
147                  'required' => true,
148                ],
149              ],
150            ],'getIamPolicy' => [
151              'path' => 'v1/{+resource}:getIamPolicy',
152              'httpMethod' => 'GET',
153              'parameters' => [
154                'resource' => [
155                  'location' => 'path',
156                  'type' => 'string',
157                  'required' => true,
158                ],
159                'options.requestedPolicyVersion' => [
160                  'location' => 'query',
161                  'type' => 'integer',
162                ],
163              ],
164            ],'list' => [
165              'path' => 'v1/{+parent}/ekmConnections',
166              'httpMethod' => 'GET',
167              'parameters' => [
168                'parent' => [
169                  'location' => 'path',
170                  'type' => 'string',
171                  'required' => true,
172                ],
173                'filter' => [
174                  'location' => 'query',
175                  'type' => 'string',
176                ],
177                'orderBy' => [
178                  'location' => 'query',
179                  'type' => 'string',
180                ],
181                'pageSize' => [
182                  'location' => 'query',
183                  'type' => 'integer',
184                ],
185                'pageToken' => [
186                  'location' => 'query',
187                  'type' => 'string',
188                ],
189              ],
190            ],'patch' => [
191              'path' => 'v1/{+name}',
192              'httpMethod' => 'PATCH',
193              'parameters' => [
194                'name' => [
195                  'location' => 'path',
196                  'type' => 'string',
197                  'required' => true,
198                ],
199                'updateMask' => [
200                  'location' => 'query',
201                  'type' => 'string',
202                ],
203              ],
204            ],'setIamPolicy' => [
205              'path' => 'v1/{+resource}:setIamPolicy',
206              'httpMethod' => 'POST',
207              'parameters' => [
208                'resource' => [
209                  'location' => 'path',
210                  'type' => 'string',
211                  'required' => true,
212                ],
213              ],
214            ],'testIamPermissions' => [
215              'path' => 'v1/{+resource}:testIamPermissions',
216              'httpMethod' => 'POST',
217              'parameters' => [
218                'resource' => [
219                  'location' => 'path',
220                  'type' => 'string',
221                  'required' => true,
222                ],
223              ],
224            ],
225          ]
226        ]
227    );
228    $this->projects_locations_keyRings = new CloudKMS\Resource\ProjectsLocationsKeyRings(
229        $this,
230        $this->serviceName,
231        'keyRings',
232        [
233          'methods' => [
234            'create' => [
235              'path' => 'v1/{+parent}/keyRings',
236              'httpMethod' => 'POST',
237              'parameters' => [
238                'parent' => [
239                  'location' => 'path',
240                  'type' => 'string',
241                  'required' => true,
242                ],
243                'keyRingId' => [
244                  'location' => 'query',
245                  'type' => 'string',
246                ],
247              ],
248            ],'get' => [
249              'path' => 'v1/{+name}',
250              'httpMethod' => 'GET',
251              'parameters' => [
252                'name' => [
253                  'location' => 'path',
254                  'type' => 'string',
255                  'required' => true,
256                ],
257              ],
258            ],'getIamPolicy' => [
259              'path' => 'v1/{+resource}:getIamPolicy',
260              'httpMethod' => 'GET',
261              'parameters' => [
262                'resource' => [
263                  'location' => 'path',
264                  'type' => 'string',
265                  'required' => true,
266                ],
267                'options.requestedPolicyVersion' => [
268                  'location' => 'query',
269                  'type' => 'integer',
270                ],
271              ],
272            ],'list' => [
273              'path' => 'v1/{+parent}/keyRings',
274              'httpMethod' => 'GET',
275              'parameters' => [
276                'parent' => [
277                  'location' => 'path',
278                  'type' => 'string',
279                  'required' => true,
280                ],
281                'filter' => [
282                  'location' => 'query',
283                  'type' => 'string',
284                ],
285                'orderBy' => [
286                  'location' => 'query',
287                  'type' => 'string',
288                ],
289                'pageSize' => [
290                  'location' => 'query',
291                  'type' => 'integer',
292                ],
293                'pageToken' => [
294                  'location' => 'query',
295                  'type' => 'string',
296                ],
297              ],
298            ],'setIamPolicy' => [
299              'path' => 'v1/{+resource}:setIamPolicy',
300              'httpMethod' => 'POST',
301              'parameters' => [
302                'resource' => [
303                  'location' => 'path',
304                  'type' => 'string',
305                  'required' => true,
306                ],
307              ],
308            ],'testIamPermissions' => [
309              'path' => 'v1/{+resource}:testIamPermissions',
310              'httpMethod' => 'POST',
311              'parameters' => [
312                'resource' => [
313                  'location' => 'path',
314                  'type' => 'string',
315                  'required' => true,
316                ],
317              ],
318            ],
319          ]
320        ]
321    );
322    $this->projects_locations_keyRings_cryptoKeys = new CloudKMS\Resource\ProjectsLocationsKeyRingsCryptoKeys(
323        $this,
324        $this->serviceName,
325        'cryptoKeys',
326        [
327          'methods' => [
328            'create' => [
329              'path' => 'v1/{+parent}/cryptoKeys',
330              'httpMethod' => 'POST',
331              'parameters' => [
332                'parent' => [
333                  'location' => 'path',
334                  'type' => 'string',
335                  'required' => true,
336                ],
337                'cryptoKeyId' => [
338                  'location' => 'query',
339                  'type' => 'string',
340                ],
341                'skipInitialVersionCreation' => [
342                  'location' => 'query',
343                  'type' => 'boolean',
344                ],
345              ],
346            ],'decrypt' => [
347              'path' => 'v1/{+name}:decrypt',
348              'httpMethod' => 'POST',
349              'parameters' => [
350                'name' => [
351                  'location' => 'path',
352                  'type' => 'string',
353                  'required' => true,
354                ],
355              ],
356            ],'encrypt' => [
357              'path' => 'v1/{+name}:encrypt',
358              'httpMethod' => 'POST',
359              'parameters' => [
360                'name' => [
361                  'location' => 'path',
362                  'type' => 'string',
363                  'required' => true,
364                ],
365              ],
366            ],'get' => [
367              'path' => 'v1/{+name}',
368              'httpMethod' => 'GET',
369              'parameters' => [
370                'name' => [
371                  'location' => 'path',
372                  'type' => 'string',
373                  'required' => true,
374                ],
375              ],
376            ],'getIamPolicy' => [
377              'path' => 'v1/{+resource}:getIamPolicy',
378              'httpMethod' => 'GET',
379              'parameters' => [
380                'resource' => [
381                  'location' => 'path',
382                  'type' => 'string',
383                  'required' => true,
384                ],
385                'options.requestedPolicyVersion' => [
386                  'location' => 'query',
387                  'type' => 'integer',
388                ],
389              ],
390            ],'list' => [
391              'path' => 'v1/{+parent}/cryptoKeys',
392              'httpMethod' => 'GET',
393              'parameters' => [
394                'parent' => [
395                  'location' => 'path',
396                  'type' => 'string',
397                  'required' => true,
398                ],
399                'filter' => [
400                  'location' => 'query',
401                  'type' => 'string',
402                ],
403                'orderBy' => [
404                  'location' => 'query',
405                  'type' => 'string',
406                ],
407                'pageSize' => [
408                  'location' => 'query',
409                  'type' => 'integer',
410                ],
411                'pageToken' => [
412                  'location' => 'query',
413                  'type' => 'string',
414                ],
415                'versionView' => [
416                  'location' => 'query',
417                  'type' => 'string',
418                ],
419              ],
420            ],'patch' => [
421              'path' => 'v1/{+name}',
422              'httpMethod' => 'PATCH',
423              'parameters' => [
424                'name' => [
425                  'location' => 'path',
426                  'type' => 'string',
427                  'required' => true,
428                ],
429                'updateMask' => [
430                  'location' => 'query',
431                  'type' => 'string',
432                ],
433              ],
434            ],'setIamPolicy' => [
435              'path' => 'v1/{+resource}:setIamPolicy',
436              'httpMethod' => 'POST',
437              'parameters' => [
438                'resource' => [
439                  'location' => 'path',
440                  'type' => 'string',
441                  'required' => true,
442                ],
443              ],
444            ],'testIamPermissions' => [
445              'path' => 'v1/{+resource}:testIamPermissions',
446              'httpMethod' => 'POST',
447              'parameters' => [
448                'resource' => [
449                  'location' => 'path',
450                  'type' => 'string',
451                  'required' => true,
452                ],
453              ],
454            ],'updatePrimaryVersion' => [
455              'path' => 'v1/{+name}:updatePrimaryVersion',
456              'httpMethod' => 'POST',
457              'parameters' => [
458                'name' => [
459                  'location' => 'path',
460                  'type' => 'string',
461                  'required' => true,
462                ],
463              ],
464            ],
465          ]
466        ]
467    );
468    $this->projects_locations_keyRings_cryptoKeys_cryptoKeyVersions = new CloudKMS\Resource\ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersions(
469        $this,
470        $this->serviceName,
471        'cryptoKeyVersions',
472        [
473          'methods' => [
474            'asymmetricDecrypt' => [
475              'path' => 'v1/{+name}:asymmetricDecrypt',
476              'httpMethod' => 'POST',
477              'parameters' => [
478                'name' => [
479                  'location' => 'path',
480                  'type' => 'string',
481                  'required' => true,
482                ],
483              ],
484            ],'asymmetricSign' => [
485              'path' => 'v1/{+name}:asymmetricSign',
486              'httpMethod' => 'POST',
487              'parameters' => [
488                'name' => [
489                  'location' => 'path',
490                  'type' => 'string',
491                  'required' => true,
492                ],
493              ],
494            ],'create' => [
495              'path' => 'v1/{+parent}/cryptoKeyVersions',
496              'httpMethod' => 'POST',
497              'parameters' => [
498                'parent' => [
499                  'location' => 'path',
500                  'type' => 'string',
501                  'required' => true,
502                ],
503              ],
504            ],'destroy' => [
505              'path' => 'v1/{+name}:destroy',
506              'httpMethod' => 'POST',
507              'parameters' => [
508                'name' => [
509                  'location' => 'path',
510                  'type' => 'string',
511                  'required' => true,
512                ],
513              ],
514            ],'get' => [
515              'path' => 'v1/{+name}',
516              'httpMethod' => 'GET',
517              'parameters' => [
518                'name' => [
519                  'location' => 'path',
520                  'type' => 'string',
521                  'required' => true,
522                ],
523              ],
524            ],'getPublicKey' => [
525              'path' => 'v1/{+name}/publicKey',
526              'httpMethod' => 'GET',
527              'parameters' => [
528                'name' => [
529                  'location' => 'path',
530                  'type' => 'string',
531                  'required' => true,
532                ],
533              ],
534            ],'import' => [
535              'path' => 'v1/{+parent}/cryptoKeyVersions:import',
536              'httpMethod' => 'POST',
537              'parameters' => [
538                'parent' => [
539                  'location' => 'path',
540                  'type' => 'string',
541                  'required' => true,
542                ],
543              ],
544            ],'list' => [
545              'path' => 'v1/{+parent}/cryptoKeyVersions',
546              'httpMethod' => 'GET',
547              'parameters' => [
548                'parent' => [
549                  'location' => 'path',
550                  'type' => 'string',
551                  'required' => true,
552                ],
553                'filter' => [
554                  'location' => 'query',
555                  'type' => 'string',
556                ],
557                'orderBy' => [
558                  'location' => 'query',
559                  'type' => 'string',
560                ],
561                'pageSize' => [
562                  'location' => 'query',
563                  'type' => 'integer',
564                ],
565                'pageToken' => [
566                  'location' => 'query',
567                  'type' => 'string',
568                ],
569                'view' => [
570                  'location' => 'query',
571                  'type' => 'string',
572                ],
573              ],
574            ],'macSign' => [
575              'path' => 'v1/{+name}:macSign',
576              'httpMethod' => 'POST',
577              'parameters' => [
578                'name' => [
579                  'location' => 'path',
580                  'type' => 'string',
581                  'required' => true,
582                ],
583              ],
584            ],'macVerify' => [
585              'path' => 'v1/{+name}:macVerify',
586              'httpMethod' => 'POST',
587              'parameters' => [
588                'name' => [
589                  'location' => 'path',
590                  'type' => 'string',
591                  'required' => true,
592                ],
593              ],
594            ],'patch' => [
595              'path' => 'v1/{+name}',
596              'httpMethod' => 'PATCH',
597              'parameters' => [
598                'name' => [
599                  'location' => 'path',
600                  'type' => 'string',
601                  'required' => true,
602                ],
603                'updateMask' => [
604                  'location' => 'query',
605                  'type' => 'string',
606                ],
607              ],
608            ],'restore' => [
609              'path' => 'v1/{+name}:restore',
610              'httpMethod' => 'POST',
611              'parameters' => [
612                'name' => [
613                  'location' => 'path',
614                  'type' => 'string',
615                  'required' => true,
616                ],
617              ],
618            ],
619          ]
620        ]
621    );
622    $this->projects_locations_keyRings_importJobs = new CloudKMS\Resource\ProjectsLocationsKeyRingsImportJobs(
623        $this,
624        $this->serviceName,
625        'importJobs',
626        [
627          'methods' => [
628            'create' => [
629              'path' => 'v1/{+parent}/importJobs',
630              'httpMethod' => 'POST',
631              'parameters' => [
632                'parent' => [
633                  'location' => 'path',
634                  'type' => 'string',
635                  'required' => true,
636                ],
637                'importJobId' => [
638                  'location' => 'query',
639                  'type' => 'string',
640                ],
641              ],
642            ],'get' => [
643              'path' => 'v1/{+name}',
644              'httpMethod' => 'GET',
645              'parameters' => [
646                'name' => [
647                  'location' => 'path',
648                  'type' => 'string',
649                  'required' => true,
650                ],
651              ],
652            ],'getIamPolicy' => [
653              'path' => 'v1/{+resource}:getIamPolicy',
654              'httpMethod' => 'GET',
655              'parameters' => [
656                'resource' => [
657                  'location' => 'path',
658                  'type' => 'string',
659                  'required' => true,
660                ],
661                'options.requestedPolicyVersion' => [
662                  'location' => 'query',
663                  'type' => 'integer',
664                ],
665              ],
666            ],'list' => [
667              'path' => 'v1/{+parent}/importJobs',
668              'httpMethod' => 'GET',
669              'parameters' => [
670                'parent' => [
671                  'location' => 'path',
672                  'type' => 'string',
673                  'required' => true,
674                ],
675                'filter' => [
676                  'location' => 'query',
677                  'type' => 'string',
678                ],
679                'orderBy' => [
680                  'location' => 'query',
681                  'type' => 'string',
682                ],
683                'pageSize' => [
684                  'location' => 'query',
685                  'type' => 'integer',
686                ],
687                'pageToken' => [
688                  'location' => 'query',
689                  'type' => 'string',
690                ],
691              ],
692            ],'setIamPolicy' => [
693              'path' => 'v1/{+resource}:setIamPolicy',
694              'httpMethod' => 'POST',
695              'parameters' => [
696                'resource' => [
697                  'location' => 'path',
698                  'type' => 'string',
699                  'required' => true,
700                ],
701              ],
702            ],'testIamPermissions' => [
703              'path' => 'v1/{+resource}:testIamPermissions',
704              'httpMethod' => 'POST',
705              'parameters' => [
706                'resource' => [
707                  'location' => 'path',
708                  'type' => 'string',
709                  'required' => true,
710                ],
711              ],
712            ],
713          ]
714        ]
715    );
716  }
717}
718
719// Adding a class alias for backwards compatibility with the previous class name.
720class_alias(CloudKMS::class, 'Google_Service_CloudKMS');
721