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\CommitServicePerimetersRequest;
21use Google\Service\AccessContextManager\ListServicePerimetersResponse;
22use Google\Service\AccessContextManager\Operation;
23use Google\Service\AccessContextManager\ReplaceServicePerimetersRequest;
24use Google\Service\AccessContextManager\ServicePerimeter;
25use Google\Service\AccessContextManager\TestIamPermissionsRequest;
26use Google\Service\AccessContextManager\TestIamPermissionsResponse;
27
28/**
29 * The "servicePerimeters" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $accesscontextmanagerService = new Google\Service\AccessContextManager(...);
33 *   $servicePerimeters = $accesscontextmanagerService->servicePerimeters;
34 *  </code>
35 */
36class AccessPoliciesServicePerimeters extends \Google\Service\Resource
37{
38  /**
39   * Commits the dry-run specification for all the service perimeters in an access
40   * policy. A commit operation on a service perimeter involves copying its `spec`
41   * field to the `status` field of the service perimeter. Only service perimeters
42   * with `use_explicit_dry_run_spec` field set to true are affected by a commit
43   * operation. The long-running operation from this RPC has a successful status
44   * after the dry-run specifications for all the service perimeters have been
45   * committed. If a commit fails, it causes the long-running operation to return
46   * an error response and the entire commit operation is cancelled. When
47   * successful, the Operation.response field contains
48   * CommitServicePerimetersResponse. The `dry_run` and the `spec` fields are
49   * cleared after a successful commit operation. (servicePerimeters.commit)
50   *
51   * @param string $parent Required. Resource name for the parent Access Policy
52   * which owns all Service Perimeters in scope for the commit operation. Format:
53   * `accessPolicies/{policy_id}`
54   * @param CommitServicePerimetersRequest $postBody
55   * @param array $optParams Optional parameters.
56   * @return Operation
57   */
58  public function commit($parent, CommitServicePerimetersRequest $postBody, $optParams = [])
59  {
60    $params = ['parent' => $parent, 'postBody' => $postBody];
61    $params = array_merge($params, $optParams);
62    return $this->call('commit', [$params], Operation::class);
63  }
64  /**
65   * Creates a service perimeter. The long-running operation from this RPC has a
66   * successful status after the service perimeter propagates to long-lasting
67   * storage. If a service perimeter contains errors, an error response is
68   * returned for the first error encountered. (servicePerimeters.create)
69   *
70   * @param string $parent Required. Resource name for the access policy which
71   * owns this Service Perimeter. Format: `accessPolicies/{policy_id}`
72   * @param ServicePerimeter $postBody
73   * @param array $optParams Optional parameters.
74   * @return Operation
75   */
76  public function create($parent, ServicePerimeter $postBody, $optParams = [])
77  {
78    $params = ['parent' => $parent, 'postBody' => $postBody];
79    $params = array_merge($params, $optParams);
80    return $this->call('create', [$params], Operation::class);
81  }
82  /**
83   * Deletes a service perimeter based on the resource name. The long-running
84   * operation from this RPC has a successful status after the service perimeter
85   * is removed from long-lasting storage. (servicePerimeters.delete)
86   *
87   * @param string $name Required. Resource name for the Service Perimeter.
88   * Format: `accessPolicies/{policy_id}/servicePerimeters/{service_perimeter_id}`
89   * @param array $optParams Optional parameters.
90   * @return Operation
91   */
92  public function delete($name, $optParams = [])
93  {
94    $params = ['name' => $name];
95    $params = array_merge($params, $optParams);
96    return $this->call('delete', [$params], Operation::class);
97  }
98  /**
99   * Gets a service perimeter based on the resource name. (servicePerimeters.get)
100   *
101   * @param string $name Required. Resource name for the Service Perimeter.
102   * Format:
103   * `accessPolicies/{policy_id}/servicePerimeters/{service_perimeters_id}`
104   * @param array $optParams Optional parameters.
105   * @return ServicePerimeter
106   */
107  public function get($name, $optParams = [])
108  {
109    $params = ['name' => $name];
110    $params = array_merge($params, $optParams);
111    return $this->call('get', [$params], ServicePerimeter::class);
112  }
113  /**
114   * Lists all service perimeters for an access policy.
115   * (servicePerimeters.listAccessPoliciesServicePerimeters)
116   *
117   * @param string $parent Required. Resource name for the access policy to list
118   * Service Perimeters from. Format: `accessPolicies/{policy_id}`
119   * @param array $optParams Optional parameters.
120   *
121   * @opt_param int pageSize Number of Service Perimeters to include in the list.
122   * Default 100.
123   * @opt_param string pageToken Next page token for the next batch of Service
124   * Perimeter instances. Defaults to the first page of results.
125   * @return ListServicePerimetersResponse
126   */
127  public function listAccessPoliciesServicePerimeters($parent, $optParams = [])
128  {
129    $params = ['parent' => $parent];
130    $params = array_merge($params, $optParams);
131    return $this->call('list', [$params], ListServicePerimetersResponse::class);
132  }
133  /**
134   * Updates a service perimeter. The long-running operation from this RPC has a
135   * successful status after the service perimeter propagates to long-lasting
136   * storage. If a service perimeter contains errors, an error response is
137   * returned for the first error encountered. (servicePerimeters.patch)
138   *
139   * @param string $name Required. Resource name for the ServicePerimeter. The
140   * `short_name` component must begin with a letter and only include alphanumeric
141   * and '_'. Format:
142   * `accessPolicies/{access_policy}/servicePerimeters/{service_perimeter}`
143   * @param ServicePerimeter $postBody
144   * @param array $optParams Optional parameters.
145   *
146   * @opt_param string updateMask Required. Mask to control which fields get
147   * updated. Must be non-empty.
148   * @return Operation
149   */
150  public function patch($name, ServicePerimeter $postBody, $optParams = [])
151  {
152    $params = ['name' => $name, 'postBody' => $postBody];
153    $params = array_merge($params, $optParams);
154    return $this->call('patch', [$params], Operation::class);
155  }
156  /**
157   * Replace all existing service perimeters in an access policy with the service
158   * perimeters provided. This is done atomically. The long-running operation from
159   * this RPC has a successful status after all replacements propagate to long-
160   * lasting storage. Replacements containing errors result in an error response
161   * for the first error encountered. Upon an error, replacement are cancelled and
162   * existing service perimeters are not affected. The Operation.response field
163   * contains ReplaceServicePerimetersResponse. (servicePerimeters.replaceAll)
164   *
165   * @param string $parent Required. Resource name for the access policy which
166   * owns these Service Perimeters. Format: `accessPolicies/{policy_id}`
167   * @param ReplaceServicePerimetersRequest $postBody
168   * @param array $optParams Optional parameters.
169   * @return Operation
170   */
171  public function replaceAll($parent, ReplaceServicePerimetersRequest $postBody, $optParams = [])
172  {
173    $params = ['parent' => $parent, 'postBody' => $postBody];
174    $params = array_merge($params, $optParams);
175    return $this->call('replaceAll', [$params], Operation::class);
176  }
177  /**
178   * Returns the IAM permissions that the caller has on the specified Access
179   * Context Manager resource. The resource can be an AccessPolicy, AccessLevel,
180   * or ServicePerimeter. This method does not support other resources.
181   * (servicePerimeters.testIamPermissions)
182   *
183   * @param string $resource REQUIRED: The resource for which the policy detail is
184   * being requested. See the operation documentation for the appropriate value
185   * for this field.
186   * @param TestIamPermissionsRequest $postBody
187   * @param array $optParams Optional parameters.
188   * @return TestIamPermissionsResponse
189   */
190  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
191  {
192    $params = ['resource' => $resource, 'postBody' => $postBody];
193    $params = array_merge($params, $optParams);
194    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
195  }
196}
197
198// Adding a class alias for backwards compatibility with the previous class name.
199class_alias(AccessPoliciesServicePerimeters::class, 'Google_Service_AccessContextManager_Resource_AccessPoliciesServicePerimeters');
200