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\Apigateway\Resource;
19
20use Google\Service\Apigateway\ApigatewayApi;
21use Google\Service\Apigateway\ApigatewayListApisResponse;
22use Google\Service\Apigateway\ApigatewayOperation;
23use Google\Service\Apigateway\ApigatewayPolicy;
24use Google\Service\Apigateway\ApigatewaySetIamPolicyRequest;
25use Google\Service\Apigateway\ApigatewayTestIamPermissionsRequest;
26use Google\Service\Apigateway\ApigatewayTestIamPermissionsResponse;
27
28/**
29 * The "apis" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $apigatewayService = new Google\Service\Apigateway(...);
33 *   $apis = $apigatewayService->apis;
34 *  </code>
35 */
36class ProjectsLocationsApis extends \Google\Service\Resource
37{
38  /**
39   * Creates a new Api in a given project and location. (apis.create)
40   *
41   * @param string $parent Required. Parent resource of the API, of the form:
42   * `projects/locations/global`
43   * @param ApigatewayApi $postBody
44   * @param array $optParams Optional parameters.
45   *
46   * @opt_param string apiId Required. Identifier to assign to the API. Must be
47   * unique within scope of the parent resource.
48   * @return ApigatewayOperation
49   */
50  public function create($parent, ApigatewayApi $postBody, $optParams = [])
51  {
52    $params = ['parent' => $parent, 'postBody' => $postBody];
53    $params = array_merge($params, $optParams);
54    return $this->call('create', [$params], ApigatewayOperation::class);
55  }
56  /**
57   * Deletes a single Api. (apis.delete)
58   *
59   * @param string $name Required. Resource name of the form:
60   * `projects/locations/global/apis`
61   * @param array $optParams Optional parameters.
62   * @return ApigatewayOperation
63   */
64  public function delete($name, $optParams = [])
65  {
66    $params = ['name' => $name];
67    $params = array_merge($params, $optParams);
68    return $this->call('delete', [$params], ApigatewayOperation::class);
69  }
70  /**
71   * Gets details of a single Api. (apis.get)
72   *
73   * @param string $name Required. Resource name of the form:
74   * `projects/locations/global/apis`
75   * @param array $optParams Optional parameters.
76   * @return ApigatewayApi
77   */
78  public function get($name, $optParams = [])
79  {
80    $params = ['name' => $name];
81    $params = array_merge($params, $optParams);
82    return $this->call('get', [$params], ApigatewayApi::class);
83  }
84  /**
85   * Gets the access control policy for a resource. Returns an empty policy if the
86   * resource exists and does not have a policy set. (apis.getIamPolicy)
87   *
88   * @param string $resource REQUIRED: The resource for which the policy is being
89   * requested. See the operation documentation for the appropriate value for this
90   * field.
91   * @param array $optParams Optional parameters.
92   *
93   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
94   * version that will be used to format the policy. Valid values are 0, 1, and 3.
95   * Requests specifying an invalid value will be rejected. Requests for policies
96   * with any conditional role bindings must specify version 3. Policies with no
97   * conditional role bindings may specify any valid value or leave the field
98   * unset. The policy in the response might use the policy version that you
99   * specified, or it might use a lower policy version. For example, if you
100   * specify version 3, but the policy has no conditional role bindings, the
101   * response uses version 1. To learn which resources support conditions in their
102   * IAM policies, see the [IAM
103   * documentation](https://cloud.google.com/iam/help/conditions/resource-
104   * policies).
105   * @return ApigatewayPolicy
106   */
107  public function getIamPolicy($resource, $optParams = [])
108  {
109    $params = ['resource' => $resource];
110    $params = array_merge($params, $optParams);
111    return $this->call('getIamPolicy', [$params], ApigatewayPolicy::class);
112  }
113  /**
114   * Lists Apis in a given project and location. (apis.listProjectsLocationsApis)
115   *
116   * @param string $parent Required. Parent resource of the API, of the form:
117   * `projects/locations/global`
118   * @param array $optParams Optional parameters.
119   *
120   * @opt_param string filter Filter.
121   * @opt_param string orderBy Order by parameters.
122   * @opt_param int pageSize Page size.
123   * @opt_param string pageToken Page token.
124   * @return ApigatewayListApisResponse
125   */
126  public function listProjectsLocationsApis($parent, $optParams = [])
127  {
128    $params = ['parent' => $parent];
129    $params = array_merge($params, $optParams);
130    return $this->call('list', [$params], ApigatewayListApisResponse::class);
131  }
132  /**
133   * Updates the parameters of a single Api. (apis.patch)
134   *
135   * @param string $name Output only. Resource name of the API. Format:
136   * projects/{project}/locations/global/apis/{api}
137   * @param ApigatewayApi $postBody
138   * @param array $optParams Optional parameters.
139   *
140   * @opt_param string updateMask Field mask is used to specify the fields to be
141   * overwritten in the Api resource by the update. The fields specified in the
142   * update_mask are relative to the resource, not the full request. A field will
143   * be overwritten if it is in the mask. If the user does not provide a mask then
144   * all fields will be overwritten.
145   * @return ApigatewayOperation
146   */
147  public function patch($name, ApigatewayApi $postBody, $optParams = [])
148  {
149    $params = ['name' => $name, 'postBody' => $postBody];
150    $params = array_merge($params, $optParams);
151    return $this->call('patch', [$params], ApigatewayOperation::class);
152  }
153  /**
154   * Sets the access control policy on the specified resource. Replaces any
155   * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
156   * `PERMISSION_DENIED` errors. (apis.setIamPolicy)
157   *
158   * @param string $resource REQUIRED: The resource for which the policy is being
159   * specified. See the operation documentation for the appropriate value for this
160   * field.
161   * @param ApigatewaySetIamPolicyRequest $postBody
162   * @param array $optParams Optional parameters.
163   * @return ApigatewayPolicy
164   */
165  public function setIamPolicy($resource, ApigatewaySetIamPolicyRequest $postBody, $optParams = [])
166  {
167    $params = ['resource' => $resource, 'postBody' => $postBody];
168    $params = array_merge($params, $optParams);
169    return $this->call('setIamPolicy', [$params], ApigatewayPolicy::class);
170  }
171  /**
172   * Returns permissions that a caller has on the specified resource. If the
173   * resource does not exist, this will return an empty set of permissions, not a
174   * `NOT_FOUND` error. Note: This operation is designed to be used for building
175   * permission-aware UIs and command-line tools, not for authorization checking.
176   * This operation may "fail open" without warning. (apis.testIamPermissions)
177   *
178   * @param string $resource REQUIRED: The resource for which the policy detail is
179   * being requested. See the operation documentation for the appropriate value
180   * for this field.
181   * @param ApigatewayTestIamPermissionsRequest $postBody
182   * @param array $optParams Optional parameters.
183   * @return ApigatewayTestIamPermissionsResponse
184   */
185  public function testIamPermissions($resource, ApigatewayTestIamPermissionsRequest $postBody, $optParams = [])
186  {
187    $params = ['resource' => $resource, 'postBody' => $postBody];
188    $params = array_merge($params, $optParams);
189    return $this->call('testIamPermissions', [$params], ApigatewayTestIamPermissionsResponse::class);
190  }
191}
192
193// Adding a class alias for backwards compatibility with the previous class name.
194class_alias(ProjectsLocationsApis::class, 'Google_Service_Apigateway_Resource_ProjectsLocationsApis');
195