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