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\PubsubLite\Resource;
19
20use Google\Service\PubsubLite\ListTopicsResponse;
21use Google\Service\PubsubLite\PubsubliteEmpty;
22use Google\Service\PubsubLite\Topic;
23use Google\Service\PubsubLite\TopicPartitions;
24
25/**
26 * The "topics" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $pubsubliteService = new Google\Service\PubsubLite(...);
30 *   $topics = $pubsubliteService->topics;
31 *  </code>
32 */
33class AdminProjectsLocationsTopics extends \Google\Service\Resource
34{
35  /**
36   * Creates a new topic. (topics.create)
37   *
38   * @param string $parent Required. The parent location in which to create the
39   * topic. Structured like `projects/{project_number}/locations/{location}`.
40   * @param Topic $postBody
41   * @param array $optParams Optional parameters.
42   *
43   * @opt_param string topicId Required. The ID to use for the topic, which will
44   * become the final component of the topic's name. This value is structured
45   * like: `my-topic-name`.
46   * @return Topic
47   */
48  public function create($parent, Topic $postBody, $optParams = [])
49  {
50    $params = ['parent' => $parent, 'postBody' => $postBody];
51    $params = array_merge($params, $optParams);
52    return $this->call('create', [$params], Topic::class);
53  }
54  /**
55   * Deletes the specified topic. (topics.delete)
56   *
57   * @param string $name Required. The name of the topic to delete.
58   * @param array $optParams Optional parameters.
59   * @return PubsubliteEmpty
60   */
61  public function delete($name, $optParams = [])
62  {
63    $params = ['name' => $name];
64    $params = array_merge($params, $optParams);
65    return $this->call('delete', [$params], PubsubliteEmpty::class);
66  }
67  /**
68   * Returns the topic configuration. (topics.get)
69   *
70   * @param string $name Required. The name of the topic whose configuration to
71   * return.
72   * @param array $optParams Optional parameters.
73   * @return Topic
74   */
75  public function get($name, $optParams = [])
76  {
77    $params = ['name' => $name];
78    $params = array_merge($params, $optParams);
79    return $this->call('get', [$params], Topic::class);
80  }
81  /**
82   * Returns the partition information for the requested topic.
83   * (topics.getPartitions)
84   *
85   * @param string $name Required. The topic whose partition information to
86   * return.
87   * @param array $optParams Optional parameters.
88   * @return TopicPartitions
89   */
90  public function getPartitions($name, $optParams = [])
91  {
92    $params = ['name' => $name];
93    $params = array_merge($params, $optParams);
94    return $this->call('getPartitions', [$params], TopicPartitions::class);
95  }
96  /**
97   * Returns the list of topics for the given project.
98   * (topics.listAdminProjectsLocationsTopics)
99   *
100   * @param string $parent Required. The parent whose topics are to be listed.
101   * Structured like `projects/{project_number}/locations/{location}`.
102   * @param array $optParams Optional parameters.
103   *
104   * @opt_param int pageSize The maximum number of topics to return. The service
105   * may return fewer than this value. If unset or zero, all topics for the parent
106   * will be returned.
107   * @opt_param string pageToken A page token, received from a previous
108   * `ListTopics` call. Provide this to retrieve the subsequent page. When
109   * paginating, all other parameters provided to `ListTopics` must match the call
110   * that provided the page token.
111   * @return ListTopicsResponse
112   */
113  public function listAdminProjectsLocationsTopics($parent, $optParams = [])
114  {
115    $params = ['parent' => $parent];
116    $params = array_merge($params, $optParams);
117    return $this->call('list', [$params], ListTopicsResponse::class);
118  }
119  /**
120   * Updates properties of the specified topic. (topics.patch)
121   *
122   * @param string $name The name of the topic. Structured like:
123   * projects/{project_number}/locations/{location}/topics/{topic_id}
124   * @param Topic $postBody
125   * @param array $optParams Optional parameters.
126   *
127   * @opt_param string updateMask Required. A mask specifying the topic fields to
128   * change.
129   * @return Topic
130   */
131  public function patch($name, Topic $postBody, $optParams = [])
132  {
133    $params = ['name' => $name, 'postBody' => $postBody];
134    $params = array_merge($params, $optParams);
135    return $this->call('patch', [$params], Topic::class);
136  }
137}
138
139// Adding a class alias for backwards compatibility with the previous class name.
140class_alias(AdminProjectsLocationsTopics::class, 'Google_Service_PubsubLite_Resource_AdminProjectsLocationsTopics');
141