[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\AccessApproval\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\AccessApproval\ApprovalRequest;
|
---|
| 21 | use Google\Service\AccessApproval\ApproveApprovalRequestMessage;
|
---|
| 22 | use Google\Service\AccessApproval\DismissApprovalRequestMessage;
|
---|
| 23 | use Google\Service\AccessApproval\InvalidateApprovalRequestMessage;
|
---|
| 24 | use Google\Service\AccessApproval\ListApprovalRequestsResponse;
|
---|
| 25 |
|
---|
| 26 | /**
|
---|
| 27 | * The "approvalRequests" collection of methods.
|
---|
| 28 | * Typical usage is:
|
---|
| 29 | * <code>
|
---|
| 30 | * $accessapprovalService = new Google\Service\AccessApproval(...);
|
---|
| 31 | * $approvalRequests = $accessapprovalService->folders_approvalRequests;
|
---|
| 32 | * </code>
|
---|
| 33 | */
|
---|
| 34 | class FoldersApprovalRequests extends \Google\Service\Resource
|
---|
| 35 | {
|
---|
| 36 | /**
|
---|
| 37 | * Approves a request and returns the updated ApprovalRequest. Returns NOT_FOUND
|
---|
| 38 | * if the request does not exist. Returns FAILED_PRECONDITION if the request
|
---|
| 39 | * exists but is not in a pending state. (approvalRequests.approve)
|
---|
| 40 | *
|
---|
| 41 | * @param string $name Name of the approval request to approve.
|
---|
| 42 | * @param ApproveApprovalRequestMessage $postBody
|
---|
| 43 | * @param array $optParams Optional parameters.
|
---|
| 44 | * @return ApprovalRequest
|
---|
| 45 | * @throws \Google\Service\Exception
|
---|
| 46 | */
|
---|
| 47 | public function approve($name, ApproveApprovalRequestMessage $postBody, $optParams = [])
|
---|
| 48 | {
|
---|
| 49 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 50 | $params = array_merge($params, $optParams);
|
---|
| 51 | return $this->call('approve', [$params], ApprovalRequest::class);
|
---|
| 52 | }
|
---|
| 53 | /**
|
---|
| 54 | * Dismisses a request. Returns the updated ApprovalRequest. NOTE: This does not
|
---|
| 55 | * deny access to the resource if another request has been made and approved. It
|
---|
| 56 | * is equivalent in effect to ignoring the request altogether. Returns NOT_FOUND
|
---|
| 57 | * if the request does not exist. Returns FAILED_PRECONDITION if the request
|
---|
| 58 | * exists but is not in a pending state. (approvalRequests.dismiss)
|
---|
| 59 | *
|
---|
| 60 | * @param string $name Name of the ApprovalRequest to dismiss.
|
---|
| 61 | * @param DismissApprovalRequestMessage $postBody
|
---|
| 62 | * @param array $optParams Optional parameters.
|
---|
| 63 | * @return ApprovalRequest
|
---|
| 64 | * @throws \Google\Service\Exception
|
---|
| 65 | */
|
---|
| 66 | public function dismiss($name, DismissApprovalRequestMessage $postBody, $optParams = [])
|
---|
| 67 | {
|
---|
| 68 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 69 | $params = array_merge($params, $optParams);
|
---|
| 70 | return $this->call('dismiss', [$params], ApprovalRequest::class);
|
---|
| 71 | }
|
---|
| 72 | /**
|
---|
| 73 | * Gets an approval request. Returns NOT_FOUND if the request does not exist.
|
---|
| 74 | * (approvalRequests.get)
|
---|
| 75 | *
|
---|
| 76 | * @param string $name The name of the approval request to retrieve. Format:
|
---|
| 77 | * "{projects|folders|organizations}/{id}/approvalRequests/{approval_request}"
|
---|
| 78 | * @param array $optParams Optional parameters.
|
---|
| 79 | * @return ApprovalRequest
|
---|
| 80 | * @throws \Google\Service\Exception
|
---|
| 81 | */
|
---|
| 82 | public function get($name, $optParams = [])
|
---|
| 83 | {
|
---|
| 84 | $params = ['name' => $name];
|
---|
| 85 | $params = array_merge($params, $optParams);
|
---|
| 86 | return $this->call('get', [$params], ApprovalRequest::class);
|
---|
| 87 | }
|
---|
| 88 | /**
|
---|
| 89 | * Invalidates an existing ApprovalRequest. Returns the updated ApprovalRequest.
|
---|
| 90 | * NOTE: This does not deny access to the resource if another request has been
|
---|
| 91 | * made and approved. It only invalidates a single approval. Returns
|
---|
| 92 | * FAILED_PRECONDITION if the request exists but is not in an approved state.
|
---|
| 93 | * (approvalRequests.invalidate)
|
---|
| 94 | *
|
---|
| 95 | * @param string $name Name of the ApprovalRequest to invalidate.
|
---|
| 96 | * @param InvalidateApprovalRequestMessage $postBody
|
---|
| 97 | * @param array $optParams Optional parameters.
|
---|
| 98 | * @return ApprovalRequest
|
---|
| 99 | * @throws \Google\Service\Exception
|
---|
| 100 | */
|
---|
| 101 | public function invalidate($name, InvalidateApprovalRequestMessage $postBody, $optParams = [])
|
---|
| 102 | {
|
---|
| 103 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 104 | $params = array_merge($params, $optParams);
|
---|
| 105 | return $this->call('invalidate', [$params], ApprovalRequest::class);
|
---|
| 106 | }
|
---|
| 107 | /**
|
---|
| 108 | * Lists approval requests associated with a project, folder, or organization.
|
---|
| 109 | * Approval requests can be filtered by state (pending, active, dismissed). The
|
---|
| 110 | * order is reverse chronological.
|
---|
| 111 | * (approvalRequests.listFoldersApprovalRequests)
|
---|
| 112 | *
|
---|
| 113 | * @param string $parent The parent resource. This may be "projects/{project}",
|
---|
| 114 | * "folders/{folder}", or "organizations/{organization}".
|
---|
| 115 | * @param array $optParams Optional parameters.
|
---|
| 116 | *
|
---|
| 117 | * @opt_param string filter A filter on the type of approval requests to
|
---|
| 118 | * retrieve. Must be one of the following values: * [not set]: Requests that are
|
---|
| 119 | * pending or have active approvals. * ALL: All requests. * PENDING: Only
|
---|
| 120 | * pending requests. * ACTIVE: Only active (i.e. currently approved) requests. *
|
---|
| 121 | * DISMISSED: Only requests that have been dismissed, or requests that are not
|
---|
| 122 | * approved and past expiration. * EXPIRED: Only requests that have been
|
---|
| 123 | * approved, and the approval has expired. * HISTORY: Active, dismissed and
|
---|
| 124 | * expired requests.
|
---|
| 125 | * @opt_param int pageSize Requested page size.
|
---|
| 126 | * @opt_param string pageToken A token identifying the page of results to
|
---|
| 127 | * return.
|
---|
| 128 | * @return ListApprovalRequestsResponse
|
---|
| 129 | * @throws \Google\Service\Exception
|
---|
| 130 | */
|
---|
| 131 | public function listFoldersApprovalRequests($parent, $optParams = [])
|
---|
| 132 | {
|
---|
| 133 | $params = ['parent' => $parent];
|
---|
| 134 | $params = array_merge($params, $optParams);
|
---|
| 135 | return $this->call('list', [$params], ListApprovalRequestsResponse::class);
|
---|
| 136 | }
|
---|
| 137 | }
|
---|
| 138 |
|
---|
| 139 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 140 | class_alias(FoldersApprovalRequests::class, 'Google_Service_AccessApproval_Resource_FoldersApprovalRequests');
|
---|