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 |
|
---|
18 | namespace Google\Service\ApigeeRegistry\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\ApigeeRegistry\ApiSpec;
|
---|
21 | use Google\Service\ApigeeRegistry\ApigeeregistryEmpty;
|
---|
22 | use Google\Service\ApigeeRegistry\HttpBody;
|
---|
23 | use Google\Service\ApigeeRegistry\ListApiSpecRevisionsResponse;
|
---|
24 | use Google\Service\ApigeeRegistry\ListApiSpecsResponse;
|
---|
25 | use Google\Service\ApigeeRegistry\Policy;
|
---|
26 | use Google\Service\ApigeeRegistry\RollbackApiSpecRequest;
|
---|
27 | use Google\Service\ApigeeRegistry\SetIamPolicyRequest;
|
---|
28 | use Google\Service\ApigeeRegistry\TagApiSpecRevisionRequest;
|
---|
29 | use Google\Service\ApigeeRegistry\TestIamPermissionsRequest;
|
---|
30 | use Google\Service\ApigeeRegistry\TestIamPermissionsResponse;
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * The "specs" collection of methods.
|
---|
34 | * Typical usage is:
|
---|
35 | * <code>
|
---|
36 | * $apigeeregistryService = new Google\Service\ApigeeRegistry(...);
|
---|
37 | * $specs = $apigeeregistryService->projects_locations_apis_versions_specs;
|
---|
38 | * </code>
|
---|
39 | */
|
---|
40 | class ProjectsLocationsApisVersionsSpecs extends \Google\Service\Resource
|
---|
41 | {
|
---|
42 | /**
|
---|
43 | * Creates a specified spec. (specs.create)
|
---|
44 | *
|
---|
45 | * @param string $parent Required. The parent, which owns this collection of
|
---|
46 | * specs. Format: `projects/locations/apis/versions`
|
---|
47 | * @param ApiSpec $postBody
|
---|
48 | * @param array $optParams Optional parameters.
|
---|
49 | *
|
---|
50 | * @opt_param string apiSpecId Required. The ID to use for the spec, which will
|
---|
51 | * become the final component of the spec's resource name. This value should be
|
---|
52 | * 4-63 characters, and valid characters are /a-z-/. Following AIP-162, IDs must
|
---|
53 | * not have the form of a UUID.
|
---|
54 | * @return ApiSpec
|
---|
55 | * @throws \Google\Service\Exception
|
---|
56 | */
|
---|
57 | public function create($parent, ApiSpec $postBody, $optParams = [])
|
---|
58 | {
|
---|
59 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
60 | $params = array_merge($params, $optParams);
|
---|
61 | return $this->call('create', [$params], ApiSpec::class);
|
---|
62 | }
|
---|
63 | /**
|
---|
64 | * Removes a specified spec, all revisions, and all child resources (e.g.,
|
---|
65 | * artifacts). (specs.delete)
|
---|
66 | *
|
---|
67 | * @param string $name Required. The name of the spec to delete. Format:
|
---|
68 | * `projects/locations/apis/versions/specs`
|
---|
69 | * @param array $optParams Optional parameters.
|
---|
70 | *
|
---|
71 | * @opt_param bool force If set to true, any child resources will also be
|
---|
72 | * deleted. (Otherwise, the request will only work if there are no child
|
---|
73 | * resources.)
|
---|
74 | * @return ApigeeregistryEmpty
|
---|
75 | * @throws \Google\Service\Exception
|
---|
76 | */
|
---|
77 | public function delete($name, $optParams = [])
|
---|
78 | {
|
---|
79 | $params = ['name' => $name];
|
---|
80 | $params = array_merge($params, $optParams);
|
---|
81 | return $this->call('delete', [$params], ApigeeregistryEmpty::class);
|
---|
82 | }
|
---|
83 | /**
|
---|
84 | * Deletes a revision of a spec. (specs.deleteRevision)
|
---|
85 | *
|
---|
86 | * @param string $name Required. The name of the spec revision to be deleted,
|
---|
87 | * with a revision ID explicitly included. Example: `projects/sample/locations/g
|
---|
88 | * lobal/apis/petstore/versions/1.0.0/specs/openapi.yaml@c7cfa2a8`
|
---|
89 | * @param array $optParams Optional parameters.
|
---|
90 | * @return ApiSpec
|
---|
91 | * @throws \Google\Service\Exception
|
---|
92 | */
|
---|
93 | public function deleteRevision($name, $optParams = [])
|
---|
94 | {
|
---|
95 | $params = ['name' => $name];
|
---|
96 | $params = array_merge($params, $optParams);
|
---|
97 | return $this->call('deleteRevision', [$params], ApiSpec::class);
|
---|
98 | }
|
---|
99 | /**
|
---|
100 | * Returns a specified spec. (specs.get)
|
---|
101 | *
|
---|
102 | * @param string $name Required. The name of the spec to retrieve. Format:
|
---|
103 | * `projects/locations/apis/versions/specs`
|
---|
104 | * @param array $optParams Optional parameters.
|
---|
105 | * @return ApiSpec
|
---|
106 | * @throws \Google\Service\Exception
|
---|
107 | */
|
---|
108 | public function get($name, $optParams = [])
|
---|
109 | {
|
---|
110 | $params = ['name' => $name];
|
---|
111 | $params = array_merge($params, $optParams);
|
---|
112 | return $this->call('get', [$params], ApiSpec::class);
|
---|
113 | }
|
---|
114 | /**
|
---|
115 | * Returns the contents of a specified spec. If specs are stored with GZip
|
---|
116 | * compression, the default behavior is to return the spec uncompressed (the
|
---|
117 | * mime_type response field indicates the exact format returned).
|
---|
118 | * (specs.getContents)
|
---|
119 | *
|
---|
120 | * @param string $name Required. The name of the spec whose contents should be
|
---|
121 | * retrieved. Format: `projects/locations/apis/versions/specs`
|
---|
122 | * @param array $optParams Optional parameters.
|
---|
123 | * @return HttpBody
|
---|
124 | * @throws \Google\Service\Exception
|
---|
125 | */
|
---|
126 | public function getContents($name, $optParams = [])
|
---|
127 | {
|
---|
128 | $params = ['name' => $name];
|
---|
129 | $params = array_merge($params, $optParams);
|
---|
130 | return $this->call('getContents', [$params], HttpBody::class);
|
---|
131 | }
|
---|
132 | /**
|
---|
133 | * Gets the access control policy for a resource. Returns an empty policy if the
|
---|
134 | * resource exists and does not have a policy set. (specs.getIamPolicy)
|
---|
135 | *
|
---|
136 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
137 | * requested. See [Resource
|
---|
138 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
139 | * appropriate value for this field.
|
---|
140 | * @param array $optParams Optional parameters.
|
---|
141 | *
|
---|
142 | * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
|
---|
143 | * version that will be used to format the policy. Valid values are 0, 1, and 3.
|
---|
144 | * Requests specifying an invalid value will be rejected. Requests for policies
|
---|
145 | * with any conditional role bindings must specify version 3. Policies with no
|
---|
146 | * conditional role bindings may specify any valid value or leave the field
|
---|
147 | * unset. The policy in the response might use the policy version that you
|
---|
148 | * specified, or it might use a lower policy version. For example, if you
|
---|
149 | * specify version 3, but the policy has no conditional role bindings, the
|
---|
150 | * response uses version 1. To learn which resources support conditions in their
|
---|
151 | * IAM policies, see the [IAM
|
---|
152 | * documentation](https://cloud.google.com/iam/help/conditions/resource-
|
---|
153 | * policies).
|
---|
154 | * @return Policy
|
---|
155 | * @throws \Google\Service\Exception
|
---|
156 | */
|
---|
157 | public function getIamPolicy($resource, $optParams = [])
|
---|
158 | {
|
---|
159 | $params = ['resource' => $resource];
|
---|
160 | $params = array_merge($params, $optParams);
|
---|
161 | return $this->call('getIamPolicy', [$params], Policy::class);
|
---|
162 | }
|
---|
163 | /**
|
---|
164 | * Returns matching specs. (specs.listProjectsLocationsApisVersionsSpecs)
|
---|
165 | *
|
---|
166 | * @param string $parent Required. The parent, which owns this collection of
|
---|
167 | * specs. Format: `projects/locations/apis/versions`
|
---|
168 | * @param array $optParams Optional parameters.
|
---|
169 | *
|
---|
170 | * @opt_param string filter An expression that can be used to filter the list.
|
---|
171 | * Filters use the Common Expression Language and can refer to all message
|
---|
172 | * fields except contents.
|
---|
173 | * @opt_param string orderBy A comma-separated list of fields, e.g. "foo,bar"
|
---|
174 | * Fields can be sorted in descending order using the "desc" identifier, e.g.
|
---|
175 | * "foo desc,bar"
|
---|
176 | * @opt_param int pageSize The maximum number of specs to return. The service
|
---|
177 | * may return fewer than this value. If unspecified, at most 50 values will be
|
---|
178 | * returned. The maximum is 1000; values above 1000 will be coerced to 1000.
|
---|
179 | * @opt_param string pageToken A page token, received from a previous
|
---|
180 | * `ListApiSpecs` call. Provide this to retrieve the subsequent page. When
|
---|
181 | * paginating, all other parameters provided to `ListApiSpecs` must match the
|
---|
182 | * call that provided the page token.
|
---|
183 | * @return ListApiSpecsResponse
|
---|
184 | * @throws \Google\Service\Exception
|
---|
185 | */
|
---|
186 | public function listProjectsLocationsApisVersionsSpecs($parent, $optParams = [])
|
---|
187 | {
|
---|
188 | $params = ['parent' => $parent];
|
---|
189 | $params = array_merge($params, $optParams);
|
---|
190 | return $this->call('list', [$params], ListApiSpecsResponse::class);
|
---|
191 | }
|
---|
192 | /**
|
---|
193 | * Lists all revisions of a spec. Revisions are returned in descending order of
|
---|
194 | * revision creation time. (specs.listRevisions)
|
---|
195 | *
|
---|
196 | * @param string $name Required. The name of the spec to list revisions for.
|
---|
197 | * @param array $optParams Optional parameters.
|
---|
198 | *
|
---|
199 | * @opt_param string filter An expression that can be used to filter the list.
|
---|
200 | * Filters use the Common Expression Language and can refer to all message
|
---|
201 | * fields.
|
---|
202 | * @opt_param int pageSize The maximum number of revisions to return per page.
|
---|
203 | * @opt_param string pageToken The page token, received from a previous
|
---|
204 | * ListApiSpecRevisions call. Provide this to retrieve the subsequent page.
|
---|
205 | * @return ListApiSpecRevisionsResponse
|
---|
206 | * @throws \Google\Service\Exception
|
---|
207 | */
|
---|
208 | public function listRevisions($name, $optParams = [])
|
---|
209 | {
|
---|
210 | $params = ['name' => $name];
|
---|
211 | $params = array_merge($params, $optParams);
|
---|
212 | return $this->call('listRevisions', [$params], ListApiSpecRevisionsResponse::class);
|
---|
213 | }
|
---|
214 | /**
|
---|
215 | * Used to modify a specified spec. (specs.patch)
|
---|
216 | *
|
---|
217 | * @param string $name Resource name.
|
---|
218 | * @param ApiSpec $postBody
|
---|
219 | * @param array $optParams Optional parameters.
|
---|
220 | *
|
---|
221 | * @opt_param bool allowMissing If set to true, and the spec is not found, a new
|
---|
222 | * spec will be created. In this situation, `update_mask` is ignored.
|
---|
223 | * @opt_param string updateMask The list of fields to be updated. If omitted,
|
---|
224 | * all fields are updated that are set in the request message (fields set to
|
---|
225 | * default values are ignored). If an asterisk "*" is specified, all fields are
|
---|
226 | * updated, including fields that are unspecified/default in the request.
|
---|
227 | * @return ApiSpec
|
---|
228 | * @throws \Google\Service\Exception
|
---|
229 | */
|
---|
230 | public function patch($name, ApiSpec $postBody, $optParams = [])
|
---|
231 | {
|
---|
232 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
233 | $params = array_merge($params, $optParams);
|
---|
234 | return $this->call('patch', [$params], ApiSpec::class);
|
---|
235 | }
|
---|
236 | /**
|
---|
237 | * Sets the current revision to a specified prior revision. Note that this
|
---|
238 | * creates a new revision with a new revision ID. (specs.rollback)
|
---|
239 | *
|
---|
240 | * @param string $name Required. The spec being rolled back.
|
---|
241 | * @param RollbackApiSpecRequest $postBody
|
---|
242 | * @param array $optParams Optional parameters.
|
---|
243 | * @return ApiSpec
|
---|
244 | * @throws \Google\Service\Exception
|
---|
245 | */
|
---|
246 | public function rollback($name, RollbackApiSpecRequest $postBody, $optParams = [])
|
---|
247 | {
|
---|
248 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
249 | $params = array_merge($params, $optParams);
|
---|
250 | return $this->call('rollback', [$params], ApiSpec::class);
|
---|
251 | }
|
---|
252 | /**
|
---|
253 | * Sets the access control policy on the specified resource. Replaces any
|
---|
254 | * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
|
---|
255 | * `PERMISSION_DENIED` errors. (specs.setIamPolicy)
|
---|
256 | *
|
---|
257 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
258 | * specified. See [Resource
|
---|
259 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
260 | * appropriate value for this field.
|
---|
261 | * @param SetIamPolicyRequest $postBody
|
---|
262 | * @param array $optParams Optional parameters.
|
---|
263 | * @return Policy
|
---|
264 | * @throws \Google\Service\Exception
|
---|
265 | */
|
---|
266 | public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
|
---|
267 | {
|
---|
268 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
269 | $params = array_merge($params, $optParams);
|
---|
270 | return $this->call('setIamPolicy', [$params], Policy::class);
|
---|
271 | }
|
---|
272 | /**
|
---|
273 | * Adds a tag to a specified revision of a spec. (specs.tagRevision)
|
---|
274 | *
|
---|
275 | * @param string $name Required. The name of the spec to be tagged, including
|
---|
276 | * the revision ID is optional. If a revision is not specified, it will tag the
|
---|
277 | * latest revision.
|
---|
278 | * @param TagApiSpecRevisionRequest $postBody
|
---|
279 | * @param array $optParams Optional parameters.
|
---|
280 | * @return ApiSpec
|
---|
281 | * @throws \Google\Service\Exception
|
---|
282 | */
|
---|
283 | public function tagRevision($name, TagApiSpecRevisionRequest $postBody, $optParams = [])
|
---|
284 | {
|
---|
285 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
286 | $params = array_merge($params, $optParams);
|
---|
287 | return $this->call('tagRevision', [$params], ApiSpec::class);
|
---|
288 | }
|
---|
289 | /**
|
---|
290 | * Returns permissions that a caller has on the specified resource. If the
|
---|
291 | * resource does not exist, this will return an empty set of permissions, not a
|
---|
292 | * `NOT_FOUND` error. Note: This operation is designed to be used for building
|
---|
293 | * permission-aware UIs and command-line tools, not for authorization checking.
|
---|
294 | * This operation may "fail open" without warning. (specs.testIamPermissions)
|
---|
295 | *
|
---|
296 | * @param string $resource REQUIRED: The resource for which the policy detail is
|
---|
297 | * being requested. See [Resource
|
---|
298 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
299 | * appropriate value for this field.
|
---|
300 | * @param TestIamPermissionsRequest $postBody
|
---|
301 | * @param array $optParams Optional parameters.
|
---|
302 | * @return TestIamPermissionsResponse
|
---|
303 | * @throws \Google\Service\Exception
|
---|
304 | */
|
---|
305 | public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
|
---|
306 | {
|
---|
307 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
308 | $params = array_merge($params, $optParams);
|
---|
309 | return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
|
---|
310 | }
|
---|
311 | }
|
---|
312 |
|
---|
313 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
314 | class_alias(ProjectsLocationsApisVersionsSpecs::class, 'Google_Service_ApigeeRegistry_Resource_ProjectsLocationsApisVersionsSpecs');
|
---|