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