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\CloudIAP\Resource;
19
20use Google\Service\CloudIAP\GetIamPolicyRequest;
21use Google\Service\CloudIAP\IapSettings;
22use Google\Service\CloudIAP\Policy;
23use Google\Service\CloudIAP\SetIamPolicyRequest;
24use Google\Service\CloudIAP\TestIamPermissionsRequest;
25use Google\Service\CloudIAP\TestIamPermissionsResponse;
26
27/**
28 * The "v1" collection of methods.
29 * Typical usage is:
30 *  <code>
31 *   $iapService = new Google\Service\CloudIAP(...);
32 *   $v1 = $iapService->v1;
33 *  </code>
34 */
35class V1 extends \Google\Service\Resource
36{
37  /**
38   * Gets the access control policy for an Identity-Aware Proxy protected
39   * resource. More information about managing access via IAP can be found at:
40   * https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api
41   * (v1.getIamPolicy)
42   *
43   * @param string $resource REQUIRED: The resource for which the policy is being
44   * requested. See the operation documentation for the appropriate value for this
45   * field.
46   * @param GetIamPolicyRequest $postBody
47   * @param array $optParams Optional parameters.
48   * @return Policy
49   */
50  public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
51  {
52    $params = ['resource' => $resource, 'postBody' => $postBody];
53    $params = array_merge($params, $optParams);
54    return $this->call('getIamPolicy', [$params], Policy::class);
55  }
56  /**
57   * Gets the IAP settings on a particular IAP protected resource.
58   * (v1.getIapSettings)
59   *
60   * @param string $name Required. The resource name for which to retrieve the
61   * settings. Authorization: Requires the `getSettings` permission for the
62   * associated resource.
63   * @param array $optParams Optional parameters.
64   * @return IapSettings
65   */
66  public function getIapSettings($name, $optParams = [])
67  {
68    $params = ['name' => $name];
69    $params = array_merge($params, $optParams);
70    return $this->call('getIapSettings', [$params], IapSettings::class);
71  }
72  /**
73   * Sets the access control policy for an Identity-Aware Proxy protected
74   * resource. Replaces any existing policy. More information about managing
75   * access via IAP can be found at: https://cloud.google.com/iap/docs/managing-
76   * access#managing_access_via_the_api (v1.setIamPolicy)
77   *
78   * @param string $resource REQUIRED: The resource for which the policy is being
79   * specified. See the operation documentation for the appropriate value for this
80   * field.
81   * @param SetIamPolicyRequest $postBody
82   * @param array $optParams Optional parameters.
83   * @return Policy
84   */
85  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
86  {
87    $params = ['resource' => $resource, 'postBody' => $postBody];
88    $params = array_merge($params, $optParams);
89    return $this->call('setIamPolicy', [$params], Policy::class);
90  }
91  /**
92   * Returns permissions that a caller has on the Identity-Aware Proxy protected
93   * resource. More information about managing access via IAP can be found at:
94   * https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api
95   * (v1.testIamPermissions)
96   *
97   * @param string $resource REQUIRED: The resource for which the policy detail is
98   * being requested. See the operation documentation for the appropriate value
99   * for this field.
100   * @param TestIamPermissionsRequest $postBody
101   * @param array $optParams Optional parameters.
102   * @return TestIamPermissionsResponse
103   */
104  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
105  {
106    $params = ['resource' => $resource, 'postBody' => $postBody];
107    $params = array_merge($params, $optParams);
108    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
109  }
110  /**
111   * Updates the IAP settings on a particular IAP protected resource. It replaces
112   * all fields unless the `update_mask` is set. (v1.updateIapSettings)
113   *
114   * @param string $name Required. The resource name of the IAP protected
115   * resource.
116   * @param IapSettings $postBody
117   * @param array $optParams Optional parameters.
118   *
119   * @opt_param string updateMask The field mask specifying which IAP settings
120   * should be updated. If omitted, the all of the settings are updated. See
121   * https://developers.google.com/protocol-
122   * buffers/docs/reference/google.protobuf#fieldmask
123   * @return IapSettings
124   */
125  public function updateIapSettings($name, IapSettings $postBody, $optParams = [])
126  {
127    $params = ['name' => $name, 'postBody' => $postBody];
128    $params = array_merge($params, $optParams);
129    return $this->call('updateIapSettings', [$params], IapSettings::class);
130  }
131}
132
133// Adding a class alias for backwards compatibility with the previous class name.
134class_alias(V1::class, 'Google_Service_CloudIAP_Resource_V1');
135