[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\Monitoring\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Monitoring\GetNotificationChannelVerificationCodeRequest;
|
---|
| 21 | use Google\Service\Monitoring\GetNotificationChannelVerificationCodeResponse;
|
---|
| 22 | use Google\Service\Monitoring\ListNotificationChannelsResponse;
|
---|
| 23 | use Google\Service\Monitoring\MonitoringEmpty;
|
---|
| 24 | use Google\Service\Monitoring\NotificationChannel;
|
---|
| 25 | use Google\Service\Monitoring\SendNotificationChannelVerificationCodeRequest;
|
---|
| 26 | use Google\Service\Monitoring\VerifyNotificationChannelRequest;
|
---|
| 27 |
|
---|
| 28 | /**
|
---|
| 29 | * The "notificationChannels" collection of methods.
|
---|
| 30 | * Typical usage is:
|
---|
| 31 | * <code>
|
---|
| 32 | * $monitoringService = new Google\Service\Monitoring(...);
|
---|
| 33 | * $notificationChannels = $monitoringService->projects_notificationChannels;
|
---|
| 34 | * </code>
|
---|
| 35 | */
|
---|
| 36 | class ProjectsNotificationChannels extends \Google\Service\Resource
|
---|
| 37 | {
|
---|
| 38 | /**
|
---|
| 39 | * Creates a new notification channel, representing a single notification
|
---|
| 40 | * endpoint such as an email address, SMS number, or PagerDuty service.Design
|
---|
| 41 | * your application to single-thread API calls that modify the state of
|
---|
| 42 | * notification channels in a single project. This includes calls to
|
---|
| 43 | * CreateNotificationChannel, DeleteNotificationChannel and
|
---|
| 44 | * UpdateNotificationChannel. (notificationChannels.create)
|
---|
| 45 | *
|
---|
| 46 | * @param string $name Required. The project
|
---|
| 47 | * (https://cloud.google.com/monitoring/api/v3#project_name) on which to execute
|
---|
| 48 | * the request. The format is: projects/[PROJECT_ID_OR_NUMBER] This names the
|
---|
| 49 | * container into which the channel will be written, this does not name the
|
---|
| 50 | * newly created channel. The resulting channel's name will have a normalized
|
---|
| 51 | * version of this field as a prefix, but will add
|
---|
| 52 | * /notificationChannels/[CHANNEL_ID] to identify the channel.
|
---|
| 53 | * @param NotificationChannel $postBody
|
---|
| 54 | * @param array $optParams Optional parameters.
|
---|
| 55 | * @return NotificationChannel
|
---|
| 56 | * @throws \Google\Service\Exception
|
---|
| 57 | */
|
---|
| 58 | public function create($name, NotificationChannel $postBody, $optParams = [])
|
---|
| 59 | {
|
---|
| 60 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 61 | $params = array_merge($params, $optParams);
|
---|
| 62 | return $this->call('create', [$params], NotificationChannel::class);
|
---|
| 63 | }
|
---|
| 64 | /**
|
---|
| 65 | * Deletes a notification channel.Design your application to single-thread API
|
---|
| 66 | * calls that modify the state of notification channels in a single project.
|
---|
| 67 | * This includes calls to CreateNotificationChannel, DeleteNotificationChannel
|
---|
| 68 | * and UpdateNotificationChannel. (notificationChannels.delete)
|
---|
| 69 | *
|
---|
| 70 | * @param string $name Required. The channel for which to execute the request.
|
---|
| 71 | * The format is:
|
---|
| 72 | * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
|
---|
| 73 | * @param array $optParams Optional parameters.
|
---|
| 74 | *
|
---|
| 75 | * @opt_param bool force If true, the notification channel will be deleted
|
---|
| 76 | * regardless of its use in alert policies (the policies will be updated to
|
---|
| 77 | * remove the channel). If false, this operation will fail if the notification
|
---|
| 78 | * channel is referenced by existing alerting policies.
|
---|
| 79 | * @return MonitoringEmpty
|
---|
| 80 | * @throws \Google\Service\Exception
|
---|
| 81 | */
|
---|
| 82 | public function delete($name, $optParams = [])
|
---|
| 83 | {
|
---|
| 84 | $params = ['name' => $name];
|
---|
| 85 | $params = array_merge($params, $optParams);
|
---|
| 86 | return $this->call('delete', [$params], MonitoringEmpty::class);
|
---|
| 87 | }
|
---|
| 88 | /**
|
---|
| 89 | * Gets a single notification channel. The channel includes the relevant
|
---|
| 90 | * configuration details with which the channel was created. However, the
|
---|
| 91 | * response may truncate or omit passwords, API keys, or other private key
|
---|
| 92 | * matter and thus the response may not be 100% identical to the information
|
---|
| 93 | * that was supplied in the call to the create method.
|
---|
| 94 | * (notificationChannels.get)
|
---|
| 95 | *
|
---|
| 96 | * @param string $name Required. The channel for which to execute the request.
|
---|
| 97 | * The format is:
|
---|
| 98 | * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID]
|
---|
| 99 | * @param array $optParams Optional parameters.
|
---|
| 100 | * @return NotificationChannel
|
---|
| 101 | * @throws \Google\Service\Exception
|
---|
| 102 | */
|
---|
| 103 | public function get($name, $optParams = [])
|
---|
| 104 | {
|
---|
| 105 | $params = ['name' => $name];
|
---|
| 106 | $params = array_merge($params, $optParams);
|
---|
| 107 | return $this->call('get', [$params], NotificationChannel::class);
|
---|
| 108 | }
|
---|
| 109 | /**
|
---|
| 110 | * Requests a verification code for an already verified channel that can then be
|
---|
| 111 | * used in a call to VerifyNotificationChannel() on a different channel with an
|
---|
| 112 | * equivalent identity in the same or in a different project. This makes it
|
---|
| 113 | * possible to copy a channel between projects without requiring manual
|
---|
| 114 | * reverification of the channel. If the channel is not in the verified state,
|
---|
| 115 | * this method will fail (in other words, this may only be used if the
|
---|
| 116 | * SendNotificationChannelVerificationCode and VerifyNotificationChannel paths
|
---|
| 117 | * have already been used to put the given channel into the verified
|
---|
| 118 | * state).There is no guarantee that the verification codes returned by this
|
---|
| 119 | * method will be of a similar structure or form as the ones that are delivered
|
---|
| 120 | * to the channel via SendNotificationChannelVerificationCode; while
|
---|
| 121 | * VerifyNotificationChannel() will recognize both the codes delivered via
|
---|
| 122 | * SendNotificationChannelVerificationCode() and returned from
|
---|
| 123 | * GetNotificationChannelVerificationCode(), it is typically the case that the
|
---|
| 124 | * verification codes delivered via SendNotificationChannelVerificationCode()
|
---|
| 125 | * will be shorter and also have a shorter expiration (e.g. codes such as
|
---|
| 126 | * "G-123456") whereas GetVerificationCode() will typically return a much
|
---|
| 127 | * longer, websafe base 64 encoded string that has a longer expiration time.
|
---|
| 128 | * (notificationChannels.getVerificationCode)
|
---|
| 129 | *
|
---|
| 130 | * @param string $name Required. The notification channel for which a
|
---|
| 131 | * verification code is to be generated and retrieved. This must name a channel
|
---|
| 132 | * that is already verified; if the specified channel is not verified, the
|
---|
| 133 | * request will fail.
|
---|
| 134 | * @param GetNotificationChannelVerificationCodeRequest $postBody
|
---|
| 135 | * @param array $optParams Optional parameters.
|
---|
| 136 | * @return GetNotificationChannelVerificationCodeResponse
|
---|
| 137 | * @throws \Google\Service\Exception
|
---|
| 138 | */
|
---|
| 139 | public function getVerificationCode($name, GetNotificationChannelVerificationCodeRequest $postBody, $optParams = [])
|
---|
| 140 | {
|
---|
| 141 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 142 | $params = array_merge($params, $optParams);
|
---|
| 143 | return $this->call('getVerificationCode', [$params], GetNotificationChannelVerificationCodeResponse::class);
|
---|
| 144 | }
|
---|
| 145 | /**
|
---|
| 146 | * Lists the notification channels that have been created for the project. To
|
---|
| 147 | * list the types of notification channels that are supported, use the
|
---|
| 148 | * ListNotificationChannelDescriptors method.
|
---|
| 149 | * (notificationChannels.listProjectsNotificationChannels)
|
---|
| 150 | *
|
---|
| 151 | * @param string $name Required. The project
|
---|
| 152 | * (https://cloud.google.com/monitoring/api/v3#project_name) on which to execute
|
---|
| 153 | * the request. The format is: projects/[PROJECT_ID_OR_NUMBER] This names the
|
---|
| 154 | * container in which to look for the notification channels; it does not name a
|
---|
| 155 | * specific channel. To query a specific channel by REST resource name, use the
|
---|
| 156 | * GetNotificationChannel operation.
|
---|
| 157 | * @param array $optParams Optional parameters.
|
---|
| 158 | *
|
---|
| 159 | * @opt_param string filter Optional. If provided, this field specifies the
|
---|
| 160 | * criteria that must be met by notification channels to be included in the
|
---|
| 161 | * response.For more details, see sorting and filtering
|
---|
| 162 | * (https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
|
---|
| 163 | * @opt_param string orderBy Optional. A comma-separated list of fields by which
|
---|
| 164 | * to sort the result. Supports the same set of fields as in filter. Entries can
|
---|
| 165 | * be prefixed with a minus sign to sort in descending rather than ascending
|
---|
| 166 | * order.For more details, see sorting and filtering
|
---|
| 167 | * (https://cloud.google.com/monitoring/api/v3/sorting-and-filtering).
|
---|
| 168 | * @opt_param int pageSize Optional. The maximum number of results to return in
|
---|
| 169 | * a single response. If not set to a positive number, a reasonable value will
|
---|
| 170 | * be chosen by the service.
|
---|
| 171 | * @opt_param string pageToken Optional. If non-empty, page_token must contain a
|
---|
| 172 | * value returned as the next_page_token in a previous response to request the
|
---|
| 173 | * next set of results.
|
---|
| 174 | * @return ListNotificationChannelsResponse
|
---|
| 175 | * @throws \Google\Service\Exception
|
---|
| 176 | */
|
---|
| 177 | public function listProjectsNotificationChannels($name, $optParams = [])
|
---|
| 178 | {
|
---|
| 179 | $params = ['name' => $name];
|
---|
| 180 | $params = array_merge($params, $optParams);
|
---|
| 181 | return $this->call('list', [$params], ListNotificationChannelsResponse::class);
|
---|
| 182 | }
|
---|
| 183 | /**
|
---|
| 184 | * Updates a notification channel. Fields not specified in the field mask remain
|
---|
| 185 | * unchanged.Design your application to single-thread API calls that modify the
|
---|
| 186 | * state of notification channels in a single project. This includes calls to
|
---|
| 187 | * CreateNotificationChannel, DeleteNotificationChannel and
|
---|
| 188 | * UpdateNotificationChannel. (notificationChannels.patch)
|
---|
| 189 | *
|
---|
| 190 | * @param string $name Identifier. The full REST resource name for this channel.
|
---|
| 191 | * The format is:
|
---|
| 192 | * projects/[PROJECT_ID_OR_NUMBER]/notificationChannels/[CHANNEL_ID] The
|
---|
| 193 | * [CHANNEL_ID] is automatically assigned by the server on creation.
|
---|
| 194 | * @param NotificationChannel $postBody
|
---|
| 195 | * @param array $optParams Optional parameters.
|
---|
| 196 | *
|
---|
| 197 | * @opt_param string updateMask Optional. The fields to update.
|
---|
| 198 | * @return NotificationChannel
|
---|
| 199 | * @throws \Google\Service\Exception
|
---|
| 200 | */
|
---|
| 201 | public function patch($name, NotificationChannel $postBody, $optParams = [])
|
---|
| 202 | {
|
---|
| 203 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 204 | $params = array_merge($params, $optParams);
|
---|
| 205 | return $this->call('patch', [$params], NotificationChannel::class);
|
---|
| 206 | }
|
---|
| 207 | /**
|
---|
| 208 | * Causes a verification code to be delivered to the channel. The code can then
|
---|
| 209 | * be supplied in VerifyNotificationChannel to verify the channel.
|
---|
| 210 | * (notificationChannels.sendVerificationCode)
|
---|
| 211 | *
|
---|
| 212 | * @param string $name Required. The notification channel to which to send a
|
---|
| 213 | * verification code.
|
---|
| 214 | * @param SendNotificationChannelVerificationCodeRequest $postBody
|
---|
| 215 | * @param array $optParams Optional parameters.
|
---|
| 216 | * @return MonitoringEmpty
|
---|
| 217 | * @throws \Google\Service\Exception
|
---|
| 218 | */
|
---|
| 219 | public function sendVerificationCode($name, SendNotificationChannelVerificationCodeRequest $postBody, $optParams = [])
|
---|
| 220 | {
|
---|
| 221 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 222 | $params = array_merge($params, $optParams);
|
---|
| 223 | return $this->call('sendVerificationCode', [$params], MonitoringEmpty::class);
|
---|
| 224 | }
|
---|
| 225 | /**
|
---|
| 226 | * Verifies a NotificationChannel by proving receipt of the code delivered to
|
---|
| 227 | * the channel as a result of calling SendNotificationChannelVerificationCode.
|
---|
| 228 | * (notificationChannels.verify)
|
---|
| 229 | *
|
---|
| 230 | * @param string $name Required. The notification channel to verify.
|
---|
| 231 | * @param VerifyNotificationChannelRequest $postBody
|
---|
| 232 | * @param array $optParams Optional parameters.
|
---|
| 233 | * @return NotificationChannel
|
---|
| 234 | * @throws \Google\Service\Exception
|
---|
| 235 | */
|
---|
| 236 | public function verify($name, VerifyNotificationChannelRequest $postBody, $optParams = [])
|
---|
| 237 | {
|
---|
| 238 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 239 | $params = array_merge($params, $optParams);
|
---|
| 240 | return $this->call('verify', [$params], NotificationChannel::class);
|
---|
| 241 | }
|
---|
| 242 | }
|
---|
| 243 |
|
---|
| 244 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 245 | class_alias(ProjectsNotificationChannels::class, 'Google_Service_Monitoring_Resource_ProjectsNotificationChannels');
|
---|