[e3d4e0a] | 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\ListSubscriptionsResponse;
|
---|
| 21 | use Google\Service\PubsubLite\Operation;
|
---|
| 22 | use Google\Service\PubsubLite\PubsubliteEmpty;
|
---|
| 23 | use Google\Service\PubsubLite\SeekSubscriptionRequest;
|
---|
| 24 | use Google\Service\PubsubLite\Subscription;
|
---|
| 25 |
|
---|
| 26 | /**
|
---|
| 27 | * The "subscriptions" collection of methods.
|
---|
| 28 | * Typical usage is:
|
---|
| 29 | * <code>
|
---|
| 30 | * $pubsubliteService = new Google\Service\PubsubLite(...);
|
---|
| 31 | * $subscriptions = $pubsubliteService->admin_projects_locations_subscriptions;
|
---|
| 32 | * </code>
|
---|
| 33 | */
|
---|
| 34 | class AdminProjectsLocationsSubscriptions extends \Google\Service\Resource
|
---|
| 35 | {
|
---|
| 36 | /**
|
---|
| 37 | * Creates a new subscription. (subscriptions.create)
|
---|
| 38 | *
|
---|
| 39 | * @param string $parent Required. The parent location in which to create the
|
---|
| 40 | * subscription. Structured like
|
---|
| 41 | * `projects/{project_number}/locations/{location}`.
|
---|
| 42 | * @param Subscription $postBody
|
---|
| 43 | * @param array $optParams Optional parameters.
|
---|
| 44 | *
|
---|
| 45 | * @opt_param bool skipBacklog If true, the newly created subscription will only
|
---|
| 46 | * receive messages published after the subscription was created. Otherwise, the
|
---|
| 47 | * entire message backlog will be received on the subscription. Defaults to
|
---|
| 48 | * false.
|
---|
| 49 | * @opt_param string subscriptionId Required. The ID to use for the
|
---|
| 50 | * subscription, which will become the final component of the subscription's
|
---|
| 51 | * name. This value is structured like: `my-sub-name`.
|
---|
| 52 | * @return Subscription
|
---|
| 53 | * @throws \Google\Service\Exception
|
---|
| 54 | */
|
---|
| 55 | public function create($parent, Subscription $postBody, $optParams = [])
|
---|
| 56 | {
|
---|
| 57 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 58 | $params = array_merge($params, $optParams);
|
---|
| 59 | return $this->call('create', [$params], Subscription::class);
|
---|
| 60 | }
|
---|
| 61 | /**
|
---|
| 62 | * Deletes the specified subscription. (subscriptions.delete)
|
---|
| 63 | *
|
---|
| 64 | * @param string $name Required. The name of the subscription to delete.
|
---|
| 65 | * @param array $optParams Optional parameters.
|
---|
| 66 | * @return PubsubliteEmpty
|
---|
| 67 | * @throws \Google\Service\Exception
|
---|
| 68 | */
|
---|
| 69 | public function delete($name, $optParams = [])
|
---|
| 70 | {
|
---|
| 71 | $params = ['name' => $name];
|
---|
| 72 | $params = array_merge($params, $optParams);
|
---|
| 73 | return $this->call('delete', [$params], PubsubliteEmpty::class);
|
---|
| 74 | }
|
---|
| 75 | /**
|
---|
| 76 | * Returns the subscription configuration. (subscriptions.get)
|
---|
| 77 | *
|
---|
| 78 | * @param string $name Required. The name of the subscription whose
|
---|
| 79 | * configuration to return.
|
---|
| 80 | * @param array $optParams Optional parameters.
|
---|
| 81 | * @return Subscription
|
---|
| 82 | * @throws \Google\Service\Exception
|
---|
| 83 | */
|
---|
| 84 | public function get($name, $optParams = [])
|
---|
| 85 | {
|
---|
| 86 | $params = ['name' => $name];
|
---|
| 87 | $params = array_merge($params, $optParams);
|
---|
| 88 | return $this->call('get', [$params], Subscription::class);
|
---|
| 89 | }
|
---|
| 90 | /**
|
---|
| 91 | * Returns the list of subscriptions for the given project.
|
---|
| 92 | * (subscriptions.listAdminProjectsLocationsSubscriptions)
|
---|
| 93 | *
|
---|
| 94 | * @param string $parent Required. The parent whose subscriptions are to be
|
---|
| 95 | * listed. Structured like `projects/{project_number}/locations/{location}`.
|
---|
| 96 | * @param array $optParams Optional parameters.
|
---|
| 97 | *
|
---|
| 98 | * @opt_param int pageSize The maximum number of subscriptions to return. The
|
---|
| 99 | * service may return fewer than this value. If unset or zero, all subscriptions
|
---|
| 100 | * for the parent will be returned.
|
---|
| 101 | * @opt_param string pageToken A page token, received from a previous
|
---|
| 102 | * `ListSubscriptions` call. Provide this to retrieve the subsequent page. When
|
---|
| 103 | * paginating, all other parameters provided to `ListSubscriptions` must match
|
---|
| 104 | * the call that provided the page token.
|
---|
| 105 | * @return ListSubscriptionsResponse
|
---|
| 106 | * @throws \Google\Service\Exception
|
---|
| 107 | */
|
---|
| 108 | public function listAdminProjectsLocationsSubscriptions($parent, $optParams = [])
|
---|
| 109 | {
|
---|
| 110 | $params = ['parent' => $parent];
|
---|
| 111 | $params = array_merge($params, $optParams);
|
---|
| 112 | return $this->call('list', [$params], ListSubscriptionsResponse::class);
|
---|
| 113 | }
|
---|
| 114 | /**
|
---|
| 115 | * Updates properties of the specified subscription. (subscriptions.patch)
|
---|
| 116 | *
|
---|
| 117 | * @param string $name The name of the subscription. Structured like: projects/{
|
---|
| 118 | * project_number}/locations/{location}/subscriptions/{subscription_id}
|
---|
| 119 | * @param Subscription $postBody
|
---|
| 120 | * @param array $optParams Optional parameters.
|
---|
| 121 | *
|
---|
| 122 | * @opt_param string updateMask Required. A mask specifying the subscription
|
---|
| 123 | * fields to change.
|
---|
| 124 | * @return Subscription
|
---|
| 125 | * @throws \Google\Service\Exception
|
---|
| 126 | */
|
---|
| 127 | public function patch($name, Subscription $postBody, $optParams = [])
|
---|
| 128 | {
|
---|
| 129 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 130 | $params = array_merge($params, $optParams);
|
---|
| 131 | return $this->call('patch', [$params], Subscription::class);
|
---|
| 132 | }
|
---|
| 133 | /**
|
---|
| 134 | * Performs an out-of-band seek for a subscription to a specified target, which
|
---|
| 135 | * may be timestamps or named positions within the message backlog. Seek
|
---|
| 136 | * translates these targets to cursors for each partition and orchestrates
|
---|
| 137 | * subscribers to start consuming messages from these seek cursors. If an
|
---|
| 138 | * operation is returned, the seek has been registered and subscribers will
|
---|
| 139 | * eventually receive messages from the seek cursors (i.e. eventual
|
---|
| 140 | * consistency), as long as they are using a minimum supported client library
|
---|
| 141 | * version and not a system that tracks cursors independently of Pub/Sub Lite
|
---|
| 142 | * (e.g. Apache Beam, Dataflow, Spark). The seek operation will fail for
|
---|
| 143 | * unsupported clients. If clients would like to know when subscribers react to
|
---|
| 144 | * the seek (or not), they can poll the operation. The seek operation will
|
---|
| 145 | * succeed and complete once subscribers are ready to receive messages from the
|
---|
| 146 | * seek cursors for all partitions of the topic. This means that the seek
|
---|
| 147 | * operation will not complete until all subscribers come online. If the
|
---|
| 148 | * previous seek operation has not yet completed, it will be aborted and the new
|
---|
| 149 | * invocation of seek will supersede it. (subscriptions.seek)
|
---|
| 150 | *
|
---|
| 151 | * @param string $name Required. The name of the subscription to seek.
|
---|
| 152 | * @param SeekSubscriptionRequest $postBody
|
---|
| 153 | * @param array $optParams Optional parameters.
|
---|
| 154 | * @return Operation
|
---|
| 155 | * @throws \Google\Service\Exception
|
---|
| 156 | */
|
---|
| 157 | public function seek($name, SeekSubscriptionRequest $postBody, $optParams = [])
|
---|
| 158 | {
|
---|
| 159 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 160 | $params = array_merge($params, $optParams);
|
---|
| 161 | return $this->call('seek', [$params], Operation::class);
|
---|
| 162 | }
|
---|
| 163 | }
|
---|
| 164 |
|
---|
| 165 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 166 | class_alias(AdminProjectsLocationsSubscriptions::class, 'Google_Service_PubsubLite_Resource_AdminProjectsLocationsSubscriptions');
|
---|