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 Pubsub (v1).
24 *
25 * <p>
26 * Provides reliable, many-to-many, asynchronous messaging between applications.</p>
27 *
28 * <p>
29 * For more information about this service, see the API
30 * <a href="https://cloud.google.com/pubsub/docs" target="_blank">Documentation</a>
31 * </p>
32 *
33 * @author Google, Inc.
34 */
35class Pubsub extends \Google\Service
36{
37  /** See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.. */
38  const CLOUD_PLATFORM =
39      "https://www.googleapis.com/auth/cloud-platform";
40  /** View and manage Pub/Sub topics and subscriptions. */
41  const PUBSUB =
42      "https://www.googleapis.com/auth/pubsub";
43
44  public $projects_schemas;
45  public $projects_snapshots;
46  public $projects_subscriptions;
47  public $projects_topics;
48  public $projects_topics_snapshots;
49  public $projects_topics_subscriptions;
50
51  /**
52   * Constructs the internal representation of the Pubsub service.
53   *
54   * @param Client|array $clientOrConfig The client used to deliver requests, or a
55   *                                     config array to pass to a new Client instance.
56   * @param string $rootUrl The root URL used for requests to the service.
57   */
58  public function __construct($clientOrConfig = [], $rootUrl = null)
59  {
60    parent::__construct($clientOrConfig);
61    $this->rootUrl = $rootUrl ?: 'https://pubsub.googleapis.com/';
62    $this->servicePath = '';
63    $this->batchPath = 'batch';
64    $this->version = 'v1';
65    $this->serviceName = 'pubsub';
66
67    $this->projects_schemas = new Pubsub\Resource\ProjectsSchemas(
68        $this,
69        $this->serviceName,
70        'schemas',
71        [
72          'methods' => [
73            'create' => [
74              'path' => 'v1/{+parent}/schemas',
75              'httpMethod' => 'POST',
76              'parameters' => [
77                'parent' => [
78                  'location' => 'path',
79                  'type' => 'string',
80                  'required' => true,
81                ],
82                'schemaId' => [
83                  'location' => 'query',
84                  'type' => 'string',
85                ],
86              ],
87            ],'delete' => [
88              'path' => 'v1/{+name}',
89              'httpMethod' => 'DELETE',
90              'parameters' => [
91                'name' => [
92                  'location' => 'path',
93                  'type' => 'string',
94                  'required' => true,
95                ],
96              ],
97            ],'get' => [
98              'path' => 'v1/{+name}',
99              'httpMethod' => 'GET',
100              'parameters' => [
101                'name' => [
102                  'location' => 'path',
103                  'type' => 'string',
104                  'required' => true,
105                ],
106                'view' => [
107                  'location' => 'query',
108                  'type' => 'string',
109                ],
110              ],
111            ],'getIamPolicy' => [
112              'path' => 'v1/{+resource}:getIamPolicy',
113              'httpMethod' => 'GET',
114              'parameters' => [
115                'resource' => [
116                  'location' => 'path',
117                  'type' => 'string',
118                  'required' => true,
119                ],
120                'options.requestedPolicyVersion' => [
121                  'location' => 'query',
122                  'type' => 'integer',
123                ],
124              ],
125            ],'list' => [
126              'path' => 'v1/{+parent}/schemas',
127              'httpMethod' => 'GET',
128              'parameters' => [
129                'parent' => [
130                  'location' => 'path',
131                  'type' => 'string',
132                  'required' => true,
133                ],
134                'pageSize' => [
135                  'location' => 'query',
136                  'type' => 'integer',
137                ],
138                'pageToken' => [
139                  'location' => 'query',
140                  'type' => 'string',
141                ],
142                'view' => [
143                  'location' => 'query',
144                  'type' => 'string',
145                ],
146              ],
147            ],'setIamPolicy' => [
148              'path' => 'v1/{+resource}:setIamPolicy',
149              'httpMethod' => 'POST',
150              'parameters' => [
151                'resource' => [
152                  'location' => 'path',
153                  'type' => 'string',
154                  'required' => true,
155                ],
156              ],
157            ],'testIamPermissions' => [
158              'path' => 'v1/{+resource}:testIamPermissions',
159              'httpMethod' => 'POST',
160              'parameters' => [
161                'resource' => [
162                  'location' => 'path',
163                  'type' => 'string',
164                  'required' => true,
165                ],
166              ],
167            ],'validate' => [
168              'path' => 'v1/{+parent}/schemas:validate',
169              'httpMethod' => 'POST',
170              'parameters' => [
171                'parent' => [
172                  'location' => 'path',
173                  'type' => 'string',
174                  'required' => true,
175                ],
176              ],
177            ],'validateMessage' => [
178              'path' => 'v1/{+parent}/schemas:validateMessage',
179              'httpMethod' => 'POST',
180              'parameters' => [
181                'parent' => [
182                  'location' => 'path',
183                  'type' => 'string',
184                  'required' => true,
185                ],
186              ],
187            ],
188          ]
189        ]
190    );
191    $this->projects_snapshots = new Pubsub\Resource\ProjectsSnapshots(
192        $this,
193        $this->serviceName,
194        'snapshots',
195        [
196          'methods' => [
197            'create' => [
198              'path' => 'v1/{+name}',
199              'httpMethod' => 'PUT',
200              'parameters' => [
201                'name' => [
202                  'location' => 'path',
203                  'type' => 'string',
204                  'required' => true,
205                ],
206              ],
207            ],'delete' => [
208              'path' => 'v1/{+snapshot}',
209              'httpMethod' => 'DELETE',
210              'parameters' => [
211                'snapshot' => [
212                  'location' => 'path',
213                  'type' => 'string',
214                  'required' => true,
215                ],
216              ],
217            ],'get' => [
218              'path' => 'v1/{+snapshot}',
219              'httpMethod' => 'GET',
220              'parameters' => [
221                'snapshot' => [
222                  'location' => 'path',
223                  'type' => 'string',
224                  'required' => true,
225                ],
226              ],
227            ],'getIamPolicy' => [
228              'path' => 'v1/{+resource}:getIamPolicy',
229              'httpMethod' => 'GET',
230              'parameters' => [
231                'resource' => [
232                  'location' => 'path',
233                  'type' => 'string',
234                  'required' => true,
235                ],
236                'options.requestedPolicyVersion' => [
237                  'location' => 'query',
238                  'type' => 'integer',
239                ],
240              ],
241            ],'list' => [
242              'path' => 'v1/{+project}/snapshots',
243              'httpMethod' => 'GET',
244              'parameters' => [
245                'project' => [
246                  'location' => 'path',
247                  'type' => 'string',
248                  'required' => true,
249                ],
250                'pageSize' => [
251                  'location' => 'query',
252                  'type' => 'integer',
253                ],
254                'pageToken' => [
255                  'location' => 'query',
256                  'type' => 'string',
257                ],
258              ],
259            ],'patch' => [
260              'path' => 'v1/{+name}',
261              'httpMethod' => 'PATCH',
262              'parameters' => [
263                'name' => [
264                  'location' => 'path',
265                  'type' => 'string',
266                  'required' => true,
267                ],
268              ],
269            ],'setIamPolicy' => [
270              'path' => 'v1/{+resource}:setIamPolicy',
271              'httpMethod' => 'POST',
272              'parameters' => [
273                'resource' => [
274                  'location' => 'path',
275                  'type' => 'string',
276                  'required' => true,
277                ],
278              ],
279            ],'testIamPermissions' => [
280              'path' => 'v1/{+resource}:testIamPermissions',
281              'httpMethod' => 'POST',
282              'parameters' => [
283                'resource' => [
284                  'location' => 'path',
285                  'type' => 'string',
286                  'required' => true,
287                ],
288              ],
289            ],
290          ]
291        ]
292    );
293    $this->projects_subscriptions = new Pubsub\Resource\ProjectsSubscriptions(
294        $this,
295        $this->serviceName,
296        'subscriptions',
297        [
298          'methods' => [
299            'acknowledge' => [
300              'path' => 'v1/{+subscription}:acknowledge',
301              'httpMethod' => 'POST',
302              'parameters' => [
303                'subscription' => [
304                  'location' => 'path',
305                  'type' => 'string',
306                  'required' => true,
307                ],
308              ],
309            ],'create' => [
310              'path' => 'v1/{+name}',
311              'httpMethod' => 'PUT',
312              'parameters' => [
313                'name' => [
314                  'location' => 'path',
315                  'type' => 'string',
316                  'required' => true,
317                ],
318              ],
319            ],'delete' => [
320              'path' => 'v1/{+subscription}',
321              'httpMethod' => 'DELETE',
322              'parameters' => [
323                'subscription' => [
324                  'location' => 'path',
325                  'type' => 'string',
326                  'required' => true,
327                ],
328              ],
329            ],'detach' => [
330              'path' => 'v1/{+subscription}:detach',
331              'httpMethod' => 'POST',
332              'parameters' => [
333                'subscription' => [
334                  'location' => 'path',
335                  'type' => 'string',
336                  'required' => true,
337                ],
338              ],
339            ],'get' => [
340              'path' => 'v1/{+subscription}',
341              'httpMethod' => 'GET',
342              'parameters' => [
343                'subscription' => [
344                  'location' => 'path',
345                  'type' => 'string',
346                  'required' => true,
347                ],
348              ],
349            ],'getIamPolicy' => [
350              'path' => 'v1/{+resource}:getIamPolicy',
351              'httpMethod' => 'GET',
352              'parameters' => [
353                'resource' => [
354                  'location' => 'path',
355                  'type' => 'string',
356                  'required' => true,
357                ],
358                'options.requestedPolicyVersion' => [
359                  'location' => 'query',
360                  'type' => 'integer',
361                ],
362              ],
363            ],'list' => [
364              'path' => 'v1/{+project}/subscriptions',
365              'httpMethod' => 'GET',
366              'parameters' => [
367                'project' => [
368                  'location' => 'path',
369                  'type' => 'string',
370                  'required' => true,
371                ],
372                'pageSize' => [
373                  'location' => 'query',
374                  'type' => 'integer',
375                ],
376                'pageToken' => [
377                  'location' => 'query',
378                  'type' => 'string',
379                ],
380              ],
381            ],'modifyAckDeadline' => [
382              'path' => 'v1/{+subscription}:modifyAckDeadline',
383              'httpMethod' => 'POST',
384              'parameters' => [
385                'subscription' => [
386                  'location' => 'path',
387                  'type' => 'string',
388                  'required' => true,
389                ],
390              ],
391            ],'modifyPushConfig' => [
392              'path' => 'v1/{+subscription}:modifyPushConfig',
393              'httpMethod' => 'POST',
394              'parameters' => [
395                'subscription' => [
396                  'location' => 'path',
397                  'type' => 'string',
398                  'required' => true,
399                ],
400              ],
401            ],'patch' => [
402              'path' => 'v1/{+name}',
403              'httpMethod' => 'PATCH',
404              'parameters' => [
405                'name' => [
406                  'location' => 'path',
407                  'type' => 'string',
408                  'required' => true,
409                ],
410              ],
411            ],'pull' => [
412              'path' => 'v1/{+subscription}:pull',
413              'httpMethod' => 'POST',
414              'parameters' => [
415                'subscription' => [
416                  'location' => 'path',
417                  'type' => 'string',
418                  'required' => true,
419                ],
420              ],
421            ],'seek' => [
422              'path' => 'v1/{+subscription}:seek',
423              'httpMethod' => 'POST',
424              'parameters' => [
425                'subscription' => [
426                  'location' => 'path',
427                  'type' => 'string',
428                  'required' => true,
429                ],
430              ],
431            ],'setIamPolicy' => [
432              'path' => 'v1/{+resource}:setIamPolicy',
433              'httpMethod' => 'POST',
434              'parameters' => [
435                'resource' => [
436                  'location' => 'path',
437                  'type' => 'string',
438                  'required' => true,
439                ],
440              ],
441            ],'testIamPermissions' => [
442              'path' => 'v1/{+resource}:testIamPermissions',
443              'httpMethod' => 'POST',
444              'parameters' => [
445                'resource' => [
446                  'location' => 'path',
447                  'type' => 'string',
448                  'required' => true,
449                ],
450              ],
451            ],
452          ]
453        ]
454    );
455    $this->projects_topics = new Pubsub\Resource\ProjectsTopics(
456        $this,
457        $this->serviceName,
458        'topics',
459        [
460          'methods' => [
461            'create' => [
462              'path' => 'v1/{+name}',
463              'httpMethod' => 'PUT',
464              'parameters' => [
465                'name' => [
466                  'location' => 'path',
467                  'type' => 'string',
468                  'required' => true,
469                ],
470              ],
471            ],'delete' => [
472              'path' => 'v1/{+topic}',
473              'httpMethod' => 'DELETE',
474              'parameters' => [
475                'topic' => [
476                  'location' => 'path',
477                  'type' => 'string',
478                  'required' => true,
479                ],
480              ],
481            ],'get' => [
482              'path' => 'v1/{+topic}',
483              'httpMethod' => 'GET',
484              'parameters' => [
485                'topic' => [
486                  'location' => 'path',
487                  'type' => 'string',
488                  'required' => true,
489                ],
490              ],
491            ],'getIamPolicy' => [
492              'path' => 'v1/{+resource}:getIamPolicy',
493              'httpMethod' => 'GET',
494              'parameters' => [
495                'resource' => [
496                  'location' => 'path',
497                  'type' => 'string',
498                  'required' => true,
499                ],
500                'options.requestedPolicyVersion' => [
501                  'location' => 'query',
502                  'type' => 'integer',
503                ],
504              ],
505            ],'list' => [
506              'path' => 'v1/{+project}/topics',
507              'httpMethod' => 'GET',
508              'parameters' => [
509                'project' => [
510                  'location' => 'path',
511                  'type' => 'string',
512                  'required' => true,
513                ],
514                'pageSize' => [
515                  'location' => 'query',
516                  'type' => 'integer',
517                ],
518                'pageToken' => [
519                  'location' => 'query',
520                  'type' => 'string',
521                ],
522              ],
523            ],'patch' => [
524              'path' => 'v1/{+name}',
525              'httpMethod' => 'PATCH',
526              'parameters' => [
527                'name' => [
528                  'location' => 'path',
529                  'type' => 'string',
530                  'required' => true,
531                ],
532              ],
533            ],'publish' => [
534              'path' => 'v1/{+topic}:publish',
535              'httpMethod' => 'POST',
536              'parameters' => [
537                'topic' => [
538                  'location' => 'path',
539                  'type' => 'string',
540                  'required' => true,
541                ],
542              ],
543            ],'setIamPolicy' => [
544              'path' => 'v1/{+resource}:setIamPolicy',
545              'httpMethod' => 'POST',
546              'parameters' => [
547                'resource' => [
548                  'location' => 'path',
549                  'type' => 'string',
550                  'required' => true,
551                ],
552              ],
553            ],'testIamPermissions' => [
554              'path' => 'v1/{+resource}:testIamPermissions',
555              'httpMethod' => 'POST',
556              'parameters' => [
557                'resource' => [
558                  'location' => 'path',
559                  'type' => 'string',
560                  'required' => true,
561                ],
562              ],
563            ],
564          ]
565        ]
566    );
567    $this->projects_topics_snapshots = new Pubsub\Resource\ProjectsTopicsSnapshots(
568        $this,
569        $this->serviceName,
570        'snapshots',
571        [
572          'methods' => [
573            'list' => [
574              'path' => 'v1/{+topic}/snapshots',
575              'httpMethod' => 'GET',
576              'parameters' => [
577                'topic' => [
578                  'location' => 'path',
579                  'type' => 'string',
580                  'required' => true,
581                ],
582                'pageSize' => [
583                  'location' => 'query',
584                  'type' => 'integer',
585                ],
586                'pageToken' => [
587                  'location' => 'query',
588                  'type' => 'string',
589                ],
590              ],
591            ],
592          ]
593        ]
594    );
595    $this->projects_topics_subscriptions = new Pubsub\Resource\ProjectsTopicsSubscriptions(
596        $this,
597        $this->serviceName,
598        'subscriptions',
599        [
600          'methods' => [
601            'list' => [
602              'path' => 'v1/{+topic}/subscriptions',
603              'httpMethod' => 'GET',
604              'parameters' => [
605                'topic' => [
606                  'location' => 'path',
607                  'type' => 'string',
608                  'required' => true,
609                ],
610                'pageSize' => [
611                  'location' => 'query',
612                  'type' => 'integer',
613                ],
614                'pageToken' => [
615                  'location' => 'query',
616                  'type' => 'string',
617                ],
618              ],
619            ],
620          ]
621        ]
622    );
623  }
624}
625
626// Adding a class alias for backwards compatibility with the previous class name.
627class_alias(Pubsub::class, 'Google_Service_Pubsub');
628