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\ServiceManagement\Resource;
19
20use Google\Service\ServiceManagement\GetIamPolicyRequest;
21use Google\Service\ServiceManagement\Policy;
22use Google\Service\ServiceManagement\SetIamPolicyRequest;
23use Google\Service\ServiceManagement\TestIamPermissionsRequest;
24use Google\Service\ServiceManagement\TestIamPermissionsResponse;
25
26/**
27 * The "consumers" collection of methods.
28 * Typical usage is:
29 *  <code>
30 *   $servicemanagementService = new Google\Service\ServiceManagement(...);
31 *   $consumers = $servicemanagementService->consumers;
32 *  </code>
33 */
34class ServicesConsumers extends \Google\Service\Resource
35{
36  /**
37   * Gets the access control policy for a resource. Returns an empty policy if the
38   * resource exists and does not have a policy set. (consumers.getIamPolicy)
39   *
40   * @param string $resource REQUIRED: The resource for which the policy is being
41   * requested. See the operation documentation for the appropriate value for this
42   * field.
43   * @param GetIamPolicyRequest $postBody
44   * @param array $optParams Optional parameters.
45   * @return Policy
46   */
47  public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
48  {
49    $params = ['resource' => $resource, 'postBody' => $postBody];
50    $params = array_merge($params, $optParams);
51    return $this->call('getIamPolicy', [$params], Policy::class);
52  }
53  /**
54   * Sets the access control policy on the specified resource. Replaces any
55   * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
56   * `PERMISSION_DENIED` errors. (consumers.setIamPolicy)
57   *
58   * @param string $resource REQUIRED: The resource for which the policy is being
59   * specified. See the operation documentation for the appropriate value for this
60   * field.
61   * @param SetIamPolicyRequest $postBody
62   * @param array $optParams Optional parameters.
63   * @return Policy
64   */
65  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
66  {
67    $params = ['resource' => $resource, 'postBody' => $postBody];
68    $params = array_merge($params, $optParams);
69    return $this->call('setIamPolicy', [$params], Policy::class);
70  }
71  /**
72   * Returns permissions that a caller has on the specified resource. If the
73   * resource does not exist, this will return an empty set of permissions, not a
74   * `NOT_FOUND` error. Note: This operation is designed to be used for building
75   * permission-aware UIs and command-line tools, not for authorization checking.
76   * This operation may "fail open" without warning.
77   * (consumers.testIamPermissions)
78   *
79   * @param string $resource REQUIRED: The resource for which the policy detail is
80   * being requested. See the operation documentation for the appropriate value
81   * for this field.
82   * @param TestIamPermissionsRequest $postBody
83   * @param array $optParams Optional parameters.
84   * @return TestIamPermissionsResponse
85   */
86  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
87  {
88    $params = ['resource' => $resource, 'postBody' => $postBody];
89    $params = array_merge($params, $optParams);
90    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
91  }
92}
93
94// Adding a class alias for backwards compatibility with the previous class name.
95class_alias(ServicesConsumers::class, 'Google_Service_ServiceManagement_Resource_ServicesConsumers');
96