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\AccessContextManager\Resource;
19
20use Google\Service\AccessContextManager\AccessLevel;
21use Google\Service\AccessContextManager\ListAccessLevelsResponse;
22use Google\Service\AccessContextManager\Operation;
23use Google\Service\AccessContextManager\ReplaceAccessLevelsRequest;
24use Google\Service\AccessContextManager\TestIamPermissionsRequest;
25use Google\Service\AccessContextManager\TestIamPermissionsResponse;
26
27/**
28 * The "accessLevels" collection of methods.
29 * Typical usage is:
30 *  <code>
31 *   $accesscontextmanagerService = new Google\Service\AccessContextManager(...);
32 *   $accessLevels = $accesscontextmanagerService->accessLevels;
33 *  </code>
34 */
35class AccessPoliciesAccessLevels extends \Google\Service\Resource
36{
37  /**
38   * Creates an access level. The long-running operation from this RPC has a
39   * successful status after the access level propagates to long-lasting storage.
40   * If access levels contain errors, an error response is returned for the first
41   * error encountered. (accessLevels.create)
42   *
43   * @param string $parent Required. Resource name for the access policy which
44   * owns this Access Level. Format: `accessPolicies/{policy_id}`
45   * @param AccessLevel $postBody
46   * @param array $optParams Optional parameters.
47   * @return Operation
48   */
49  public function create($parent, AccessLevel $postBody, $optParams = [])
50  {
51    $params = ['parent' => $parent, 'postBody' => $postBody];
52    $params = array_merge($params, $optParams);
53    return $this->call('create', [$params], Operation::class);
54  }
55  /**
56   * Deletes an access level based on the resource name. The long-running
57   * operation from this RPC has a successful status after the access level has
58   * been removed from long-lasting storage. (accessLevels.delete)
59   *
60   * @param string $name Required. Resource name for the Access Level. Format:
61   * `accessPolicies/{policy_id}/accessLevels/{access_level_id}`
62   * @param array $optParams Optional parameters.
63   * @return Operation
64   */
65  public function delete($name, $optParams = [])
66  {
67    $params = ['name' => $name];
68    $params = array_merge($params, $optParams);
69    return $this->call('delete', [$params], Operation::class);
70  }
71  /**
72   * Gets an access level based on the resource name. (accessLevels.get)
73   *
74   * @param string $name Required. Resource name for the Access Level. Format:
75   * `accessPolicies/{policy_id}/accessLevels/{access_level_id}`
76   * @param array $optParams Optional parameters.
77   *
78   * @opt_param string accessLevelFormat Whether to return `BasicLevels` in the
79   * Cloud Common Expression Language rather than as `BasicLevels`. Defaults to
80   * AS_DEFINED, where Access Levels are returned as `BasicLevels` or
81   * `CustomLevels` based on how they were created. If set to CEL, all Access
82   * Levels are returned as `CustomLevels`. In the CEL case, `BasicLevels` are
83   * translated to equivalent `CustomLevels`.
84   * @return AccessLevel
85   */
86  public function get($name, $optParams = [])
87  {
88    $params = ['name' => $name];
89    $params = array_merge($params, $optParams);
90    return $this->call('get', [$params], AccessLevel::class);
91  }
92  /**
93   * Lists all access levels for an access policy.
94   * (accessLevels.listAccessPoliciesAccessLevels)
95   *
96   * @param string $parent Required. Resource name for the access policy to list
97   * Access Levels from. Format: `accessPolicies/{policy_id}`
98   * @param array $optParams Optional parameters.
99   *
100   * @opt_param string accessLevelFormat Whether to return `BasicLevels` in the
101   * Cloud Common Expression language, as `CustomLevels`, rather than as
102   * `BasicLevels`. Defaults to returning `AccessLevels` in the format they were
103   * defined.
104   * @opt_param int pageSize Number of Access Levels to include in the list.
105   * Default 100.
106   * @opt_param string pageToken Next page token for the next batch of Access
107   * Level instances. Defaults to the first page of results.
108   * @return ListAccessLevelsResponse
109   */
110  public function listAccessPoliciesAccessLevels($parent, $optParams = [])
111  {
112    $params = ['parent' => $parent];
113    $params = array_merge($params, $optParams);
114    return $this->call('list', [$params], ListAccessLevelsResponse::class);
115  }
116  /**
117   * Updates an access level. The long-running operation from this RPC has a
118   * successful status after the changes to the access level propagate to long-
119   * lasting storage. If access levels contain errors, an error response is
120   * returned for the first error encountered. (accessLevels.patch)
121   *
122   * @param string $name Required. Resource name for the Access Level. The
123   * `short_name` component must begin with a letter and only include alphanumeric
124   * and '_'. Format:
125   * `accessPolicies/{access_policy}/accessLevels/{access_level}`. The maximum
126   * length of the `access_level` component is 50 characters.
127   * @param AccessLevel $postBody
128   * @param array $optParams Optional parameters.
129   *
130   * @opt_param string updateMask Required. Mask to control which fields get
131   * updated. Must be non-empty.
132   * @return Operation
133   */
134  public function patch($name, AccessLevel $postBody, $optParams = [])
135  {
136    $params = ['name' => $name, 'postBody' => $postBody];
137    $params = array_merge($params, $optParams);
138    return $this->call('patch', [$params], Operation::class);
139  }
140  /**
141   * Replaces all existing access levels in an access policy with the access
142   * levels provided. This is done atomically. The long-running operation from
143   * this RPC has a successful status after all replacements propagate to long-
144   * lasting storage. If the replacement contains errors, an error response is
145   * returned for the first error encountered. Upon error, the replacement is
146   * cancelled, and existing access levels are not affected. The
147   * Operation.response field contains ReplaceAccessLevelsResponse. Removing
148   * access levels contained in existing service perimeters result in an error.
149   * (accessLevels.replaceAll)
150   *
151   * @param string $parent Required. Resource name for the access policy which
152   * owns these Access Levels. Format: `accessPolicies/{policy_id}`
153   * @param ReplaceAccessLevelsRequest $postBody
154   * @param array $optParams Optional parameters.
155   * @return Operation
156   */
157  public function replaceAll($parent, ReplaceAccessLevelsRequest $postBody, $optParams = [])
158  {
159    $params = ['parent' => $parent, 'postBody' => $postBody];
160    $params = array_merge($params, $optParams);
161    return $this->call('replaceAll', [$params], Operation::class);
162  }
163  /**
164   * Returns the IAM permissions that the caller has on the specified Access
165   * Context Manager resource. The resource can be an AccessPolicy, AccessLevel,
166   * or ServicePerimeter. This method does not support other resources.
167   * (accessLevels.testIamPermissions)
168   *
169   * @param string $resource REQUIRED: The resource for which the policy detail is
170   * being requested. See the operation documentation for the appropriate value
171   * for this field.
172   * @param TestIamPermissionsRequest $postBody
173   * @param array $optParams Optional parameters.
174   * @return TestIamPermissionsResponse
175   */
176  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
177  {
178    $params = ['resource' => $resource, 'postBody' => $postBody];
179    $params = array_merge($params, $optParams);
180    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
181  }
182}
183
184// Adding a class alias for backwards compatibility with the previous class name.
185class_alias(AccessPoliciesAccessLevels::class, 'Google_Service_AccessContextManager_Resource_AccessPoliciesAccessLevels');
186