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\Aiplatform\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1CopyModelRequest;
|
---|
21 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1ExportModelRequest;
|
---|
22 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1ListModelVersionsResponse;
|
---|
23 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1ListModelsResponse;
|
---|
24 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1MergeVersionAliasesRequest;
|
---|
25 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1Model;
|
---|
26 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1UpdateExplanationDatasetRequest;
|
---|
27 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1UploadModelRequest;
|
---|
28 | use Google\Service\Aiplatform\GoogleIamV1Policy;
|
---|
29 | use Google\Service\Aiplatform\GoogleIamV1SetIamPolicyRequest;
|
---|
30 | use Google\Service\Aiplatform\GoogleIamV1TestIamPermissionsResponse;
|
---|
31 | use Google\Service\Aiplatform\GoogleLongrunningOperation;
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * The "models" collection of methods.
|
---|
35 | * Typical usage is:
|
---|
36 | * <code>
|
---|
37 | * $aiplatformService = new Google\Service\Aiplatform(...);
|
---|
38 | * $models = $aiplatformService->projects_locations_models;
|
---|
39 | * </code>
|
---|
40 | */
|
---|
41 | class ProjectsLocationsModels extends \Google\Service\Resource
|
---|
42 | {
|
---|
43 | /**
|
---|
44 | * Copies an already existing Vertex AI Model into the specified Location. The
|
---|
45 | * source Model must exist in the same Project. When copying custom Models, the
|
---|
46 | * users themselves are responsible for Model.metadata content to be region-
|
---|
47 | * agnostic, as well as making sure that any resources (e.g. files) it depends
|
---|
48 | * on remain accessible. (models.copy)
|
---|
49 | *
|
---|
50 | * @param string $parent Required. The resource name of the Location into which
|
---|
51 | * to copy the Model. Format: `projects/{project}/locations/{location}`
|
---|
52 | * @param GoogleCloudAiplatformV1CopyModelRequest $postBody
|
---|
53 | * @param array $optParams Optional parameters.
|
---|
54 | * @return GoogleLongrunningOperation
|
---|
55 | * @throws \Google\Service\Exception
|
---|
56 | */
|
---|
57 | public function copy($parent, GoogleCloudAiplatformV1CopyModelRequest $postBody, $optParams = [])
|
---|
58 | {
|
---|
59 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
60 | $params = array_merge($params, $optParams);
|
---|
61 | return $this->call('copy', [$params], GoogleLongrunningOperation::class);
|
---|
62 | }
|
---|
63 | /**
|
---|
64 | * Deletes a Model. A model cannot be deleted if any Endpoint resource has a
|
---|
65 | * DeployedModel based on the model in its deployed_models field.
|
---|
66 | * (models.delete)
|
---|
67 | *
|
---|
68 | * @param string $name Required. The name of the Model resource to be deleted.
|
---|
69 | * Format: `projects/{project}/locations/{location}/models/{model}`
|
---|
70 | * @param array $optParams Optional parameters.
|
---|
71 | * @return GoogleLongrunningOperation
|
---|
72 | * @throws \Google\Service\Exception
|
---|
73 | */
|
---|
74 | public function delete($name, $optParams = [])
|
---|
75 | {
|
---|
76 | $params = ['name' => $name];
|
---|
77 | $params = array_merge($params, $optParams);
|
---|
78 | return $this->call('delete', [$params], GoogleLongrunningOperation::class);
|
---|
79 | }
|
---|
80 | /**
|
---|
81 | * Deletes a Model version. Model version can only be deleted if there are no
|
---|
82 | * DeployedModels created from it. Deleting the only version in the Model is not
|
---|
83 | * allowed. Use DeleteModel for deleting the Model instead.
|
---|
84 | * (models.deleteVersion)
|
---|
85 | *
|
---|
86 | * @param string $name Required. The name of the model version to be deleted,
|
---|
87 | * with a version ID explicitly included. Example:
|
---|
88 | * `projects/{project}/locations/{location}/models/{model}@1234`
|
---|
89 | * @param array $optParams Optional parameters.
|
---|
90 | * @return GoogleLongrunningOperation
|
---|
91 | * @throws \Google\Service\Exception
|
---|
92 | */
|
---|
93 | public function deleteVersion($name, $optParams = [])
|
---|
94 | {
|
---|
95 | $params = ['name' => $name];
|
---|
96 | $params = array_merge($params, $optParams);
|
---|
97 | return $this->call('deleteVersion', [$params], GoogleLongrunningOperation::class);
|
---|
98 | }
|
---|
99 | /**
|
---|
100 | * Exports a trained, exportable Model to a location specified by the user. A
|
---|
101 | * Model is considered to be exportable if it has at least one supported export
|
---|
102 | * format. (models.export)
|
---|
103 | *
|
---|
104 | * @param string $name Required. The resource name of the Model to export. The
|
---|
105 | * resource name may contain version id or version alias to specify the version,
|
---|
106 | * if no version is specified, the default version will be exported.
|
---|
107 | * @param GoogleCloudAiplatformV1ExportModelRequest $postBody
|
---|
108 | * @param array $optParams Optional parameters.
|
---|
109 | * @return GoogleLongrunningOperation
|
---|
110 | * @throws \Google\Service\Exception
|
---|
111 | */
|
---|
112 | public function export($name, GoogleCloudAiplatformV1ExportModelRequest $postBody, $optParams = [])
|
---|
113 | {
|
---|
114 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
115 | $params = array_merge($params, $optParams);
|
---|
116 | return $this->call('export', [$params], GoogleLongrunningOperation::class);
|
---|
117 | }
|
---|
118 | /**
|
---|
119 | * Gets a Model. (models.get)
|
---|
120 | *
|
---|
121 | * @param string $name Required. The name of the Model resource. Format:
|
---|
122 | * `projects/{project}/locations/{location}/models/{model}` In order to retrieve
|
---|
123 | * a specific version of the model, also provide the version ID or version
|
---|
124 | * alias. Example: `projects/{project}/locations/{location}/models/{model}@2` or
|
---|
125 | * `projects/{project}/locations/{location}/models/{model}@golden` If no version
|
---|
126 | * ID or alias is specified, the "default" version will be returned. The
|
---|
127 | * "default" version alias is created for the first version of the model, and
|
---|
128 | * can be moved to other versions later on. There will be exactly one default
|
---|
129 | * version.
|
---|
130 | * @param array $optParams Optional parameters.
|
---|
131 | * @return GoogleCloudAiplatformV1Model
|
---|
132 | * @throws \Google\Service\Exception
|
---|
133 | */
|
---|
134 | public function get($name, $optParams = [])
|
---|
135 | {
|
---|
136 | $params = ['name' => $name];
|
---|
137 | $params = array_merge($params, $optParams);
|
---|
138 | return $this->call('get', [$params], GoogleCloudAiplatformV1Model::class);
|
---|
139 | }
|
---|
140 | /**
|
---|
141 | * Gets the access control policy for a resource. Returns an empty policy if the
|
---|
142 | * resource exists and does not have a policy set. (models.getIamPolicy)
|
---|
143 | *
|
---|
144 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
145 | * requested. See [Resource
|
---|
146 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
147 | * appropriate value for this field.
|
---|
148 | * @param array $optParams Optional parameters.
|
---|
149 | *
|
---|
150 | * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
|
---|
151 | * version that will be used to format the policy. Valid values are 0, 1, and 3.
|
---|
152 | * Requests specifying an invalid value will be rejected. Requests for policies
|
---|
153 | * with any conditional role bindings must specify version 3. Policies with no
|
---|
154 | * conditional role bindings may specify any valid value or leave the field
|
---|
155 | * unset. The policy in the response might use the policy version that you
|
---|
156 | * specified, or it might use a lower policy version. For example, if you
|
---|
157 | * specify version 3, but the policy has no conditional role bindings, the
|
---|
158 | * response uses version 1. To learn which resources support conditions in their
|
---|
159 | * IAM policies, see the [IAM
|
---|
160 | * documentation](https://cloud.google.com/iam/help/conditions/resource-
|
---|
161 | * policies).
|
---|
162 | * @return GoogleIamV1Policy
|
---|
163 | * @throws \Google\Service\Exception
|
---|
164 | */
|
---|
165 | public function getIamPolicy($resource, $optParams = [])
|
---|
166 | {
|
---|
167 | $params = ['resource' => $resource];
|
---|
168 | $params = array_merge($params, $optParams);
|
---|
169 | return $this->call('getIamPolicy', [$params], GoogleIamV1Policy::class);
|
---|
170 | }
|
---|
171 | /**
|
---|
172 | * Lists Models in a Location. (models.listProjectsLocationsModels)
|
---|
173 | *
|
---|
174 | * @param string $parent Required. The resource name of the Location to list the
|
---|
175 | * Models from. Format: `projects/{project}/locations/{location}`
|
---|
176 | * @param array $optParams Optional parameters.
|
---|
177 | *
|
---|
178 | * @opt_param string filter An expression for filtering the results of the
|
---|
179 | * request. For field names both snake_case and camelCase are supported. *
|
---|
180 | * `model` supports = and !=. `model` represents the Model ID, i.e. the last
|
---|
181 | * segment of the Model's resource name. * `display_name` supports = and != *
|
---|
182 | * `labels` supports general map functions that is: * `labels.key=value` -
|
---|
183 | * key:value equality * `labels.key:* or labels:key - key existence * A key
|
---|
184 | * including a space must be quoted. `labels."a key"`. * `base_model_name` only
|
---|
185 | * supports = Some examples: * `model=1234` * `displayName="myDisplayName"` *
|
---|
186 | * `labels.myKey="myValue"` * `baseModelName="text-bison"`
|
---|
187 | * @opt_param string orderBy A comma-separated list of fields to order by,
|
---|
188 | * sorted in ascending order. Use "desc" after a field name for descending.
|
---|
189 | * Supported fields: * `display_name` * `create_time` * `update_time` Example:
|
---|
190 | * `display_name, create_time desc`.
|
---|
191 | * @opt_param int pageSize The standard list page size.
|
---|
192 | * @opt_param string pageToken The standard list page token. Typically obtained
|
---|
193 | * via ListModelsResponse.next_page_token of the previous
|
---|
194 | * ModelService.ListModels call.
|
---|
195 | * @opt_param string readMask Mask specifying which fields to read.
|
---|
196 | * @return GoogleCloudAiplatformV1ListModelsResponse
|
---|
197 | * @throws \Google\Service\Exception
|
---|
198 | */
|
---|
199 | public function listProjectsLocationsModels($parent, $optParams = [])
|
---|
200 | {
|
---|
201 | $params = ['parent' => $parent];
|
---|
202 | $params = array_merge($params, $optParams);
|
---|
203 | return $this->call('list', [$params], GoogleCloudAiplatformV1ListModelsResponse::class);
|
---|
204 | }
|
---|
205 | /**
|
---|
206 | * Lists versions of the specified model. (models.listVersions)
|
---|
207 | *
|
---|
208 | * @param string $name Required. The name of the model to list versions for.
|
---|
209 | * @param array $optParams Optional parameters.
|
---|
210 | *
|
---|
211 | * @opt_param string filter An expression for filtering the results of the
|
---|
212 | * request. For field names both snake_case and camelCase are supported. *
|
---|
213 | * `labels` supports general map functions that is: * `labels.key=value` -
|
---|
214 | * key:value equality * `labels.key:* or labels:key - key existence * A key
|
---|
215 | * including a space must be quoted. `labels."a key"`. Some examples: *
|
---|
216 | * `labels.myKey="myValue"`
|
---|
217 | * @opt_param string orderBy A comma-separated list of fields to order by,
|
---|
218 | * sorted in ascending order. Use "desc" after a field name for descending.
|
---|
219 | * Supported fields: * `create_time` * `update_time` Example: `update_time asc,
|
---|
220 | * create_time desc`.
|
---|
221 | * @opt_param int pageSize The standard list page size.
|
---|
222 | * @opt_param string pageToken The standard list page token. Typically obtained
|
---|
223 | * via next_page_token of the previous ListModelVersions call.
|
---|
224 | * @opt_param string readMask Mask specifying which fields to read.
|
---|
225 | * @return GoogleCloudAiplatformV1ListModelVersionsResponse
|
---|
226 | * @throws \Google\Service\Exception
|
---|
227 | */
|
---|
228 | public function listVersions($name, $optParams = [])
|
---|
229 | {
|
---|
230 | $params = ['name' => $name];
|
---|
231 | $params = array_merge($params, $optParams);
|
---|
232 | return $this->call('listVersions', [$params], GoogleCloudAiplatformV1ListModelVersionsResponse::class);
|
---|
233 | }
|
---|
234 | /**
|
---|
235 | * Merges a set of aliases for a Model version. (models.mergeVersionAliases)
|
---|
236 | *
|
---|
237 | * @param string $name Required. The name of the model version to merge aliases,
|
---|
238 | * with a version ID explicitly included. Example:
|
---|
239 | * `projects/{project}/locations/{location}/models/{model}@1234`
|
---|
240 | * @param GoogleCloudAiplatformV1MergeVersionAliasesRequest $postBody
|
---|
241 | * @param array $optParams Optional parameters.
|
---|
242 | * @return GoogleCloudAiplatformV1Model
|
---|
243 | * @throws \Google\Service\Exception
|
---|
244 | */
|
---|
245 | public function mergeVersionAliases($name, GoogleCloudAiplatformV1MergeVersionAliasesRequest $postBody, $optParams = [])
|
---|
246 | {
|
---|
247 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
248 | $params = array_merge($params, $optParams);
|
---|
249 | return $this->call('mergeVersionAliases', [$params], GoogleCloudAiplatformV1Model::class);
|
---|
250 | }
|
---|
251 | /**
|
---|
252 | * Updates a Model. (models.patch)
|
---|
253 | *
|
---|
254 | * @param string $name The resource name of the Model.
|
---|
255 | * @param GoogleCloudAiplatformV1Model $postBody
|
---|
256 | * @param array $optParams Optional parameters.
|
---|
257 | *
|
---|
258 | * @opt_param string updateMask Required. The update mask applies to the
|
---|
259 | * resource. For the `FieldMask` definition, see google.protobuf.FieldMask.
|
---|
260 | * @return GoogleCloudAiplatformV1Model
|
---|
261 | * @throws \Google\Service\Exception
|
---|
262 | */
|
---|
263 | public function patch($name, GoogleCloudAiplatformV1Model $postBody, $optParams = [])
|
---|
264 | {
|
---|
265 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
266 | $params = array_merge($params, $optParams);
|
---|
267 | return $this->call('patch', [$params], GoogleCloudAiplatformV1Model::class);
|
---|
268 | }
|
---|
269 | /**
|
---|
270 | * Sets the access control policy on the specified resource. Replaces any
|
---|
271 | * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
|
---|
272 | * `PERMISSION_DENIED` errors. (models.setIamPolicy)
|
---|
273 | *
|
---|
274 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
275 | * specified. See [Resource
|
---|
276 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
277 | * appropriate value for this field.
|
---|
278 | * @param GoogleIamV1SetIamPolicyRequest $postBody
|
---|
279 | * @param array $optParams Optional parameters.
|
---|
280 | * @return GoogleIamV1Policy
|
---|
281 | * @throws \Google\Service\Exception
|
---|
282 | */
|
---|
283 | public function setIamPolicy($resource, GoogleIamV1SetIamPolicyRequest $postBody, $optParams = [])
|
---|
284 | {
|
---|
285 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
286 | $params = array_merge($params, $optParams);
|
---|
287 | return $this->call('setIamPolicy', [$params], GoogleIamV1Policy::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. (models.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 array $optParams Optional parameters.
|
---|
301 | *
|
---|
302 | * @opt_param string permissions The set of permissions to check for the
|
---|
303 | * `resource`. Permissions with wildcards (such as `*` or `storage.*`) are not
|
---|
304 | * allowed. For more information see [IAM
|
---|
305 | * Overview](https://cloud.google.com/iam/docs/overview#permissions).
|
---|
306 | * @return GoogleIamV1TestIamPermissionsResponse
|
---|
307 | * @throws \Google\Service\Exception
|
---|
308 | */
|
---|
309 | public function testIamPermissions($resource, $optParams = [])
|
---|
310 | {
|
---|
311 | $params = ['resource' => $resource];
|
---|
312 | $params = array_merge($params, $optParams);
|
---|
313 | return $this->call('testIamPermissions', [$params], GoogleIamV1TestIamPermissionsResponse::class);
|
---|
314 | }
|
---|
315 | /**
|
---|
316 | * Incrementally update the dataset used for an examples model.
|
---|
317 | * (models.updateExplanationDataset)
|
---|
318 | *
|
---|
319 | * @param string $model Required. The resource name of the Model to update.
|
---|
320 | * Format: `projects/{project}/locations/{location}/models/{model}`
|
---|
321 | * @param GoogleCloudAiplatformV1UpdateExplanationDatasetRequest $postBody
|
---|
322 | * @param array $optParams Optional parameters.
|
---|
323 | * @return GoogleLongrunningOperation
|
---|
324 | * @throws \Google\Service\Exception
|
---|
325 | */
|
---|
326 | public function updateExplanationDataset($model, GoogleCloudAiplatformV1UpdateExplanationDatasetRequest $postBody, $optParams = [])
|
---|
327 | {
|
---|
328 | $params = ['model' => $model, 'postBody' => $postBody];
|
---|
329 | $params = array_merge($params, $optParams);
|
---|
330 | return $this->call('updateExplanationDataset', [$params], GoogleLongrunningOperation::class);
|
---|
331 | }
|
---|
332 | /**
|
---|
333 | * Uploads a Model artifact into Vertex AI. (models.upload)
|
---|
334 | *
|
---|
335 | * @param string $parent Required. The resource name of the Location into which
|
---|
336 | * to upload the Model. Format: `projects/{project}/locations/{location}`
|
---|
337 | * @param GoogleCloudAiplatformV1UploadModelRequest $postBody
|
---|
338 | * @param array $optParams Optional parameters.
|
---|
339 | * @return GoogleLongrunningOperation
|
---|
340 | * @throws \Google\Service\Exception
|
---|
341 | */
|
---|
342 | public function upload($parent, GoogleCloudAiplatformV1UploadModelRequest $postBody, $optParams = [])
|
---|
343 | {
|
---|
344 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
345 | $params = array_merge($params, $optParams);
|
---|
346 | return $this->call('upload', [$params], GoogleLongrunningOperation::class);
|
---|
347 | }
|
---|
348 | }
|
---|
349 |
|
---|
350 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
351 | class_alias(ProjectsLocationsModels::class, 'Google_Service_Aiplatform_Resource_ProjectsLocationsModels');
|
---|