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\CloudMachineLearningEngine\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\CloudMachineLearningEngine\GoogleCloudMlV1ListVersionsResponse;
|
---|
21 | use Google\Service\CloudMachineLearningEngine\GoogleCloudMlV1SetDefaultVersionRequest;
|
---|
22 | use Google\Service\CloudMachineLearningEngine\GoogleCloudMlV1Version;
|
---|
23 | use Google\Service\CloudMachineLearningEngine\GoogleLongrunningOperation;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * The "versions" collection of methods.
|
---|
27 | * Typical usage is:
|
---|
28 | * <code>
|
---|
29 | * $mlService = new Google\Service\CloudMachineLearningEngine(...);
|
---|
30 | * $versions = $mlService->projects_models_versions;
|
---|
31 | * </code>
|
---|
32 | */
|
---|
33 | class ProjectsModelsVersions extends \Google\Service\Resource
|
---|
34 | {
|
---|
35 | /**
|
---|
36 | * Creates a new version of a model from a trained TensorFlow model. If the
|
---|
37 | * version created in the cloud by this call is the first deployed version of
|
---|
38 | * the specified model, it will be made the default version of the model. When
|
---|
39 | * you add a version to a model that already has one or more versions, the
|
---|
40 | * default version does not automatically change. If you want a new version to
|
---|
41 | * be the default, you must call projects.models.versions.setDefault.
|
---|
42 | * (versions.create)
|
---|
43 | *
|
---|
44 | * @param string $parent Required. The name of the model.
|
---|
45 | * @param GoogleCloudMlV1Version $postBody
|
---|
46 | * @param array $optParams Optional parameters.
|
---|
47 | * @return GoogleLongrunningOperation
|
---|
48 | * @throws \Google\Service\Exception
|
---|
49 | */
|
---|
50 | public function create($parent, GoogleCloudMlV1Version $postBody, $optParams = [])
|
---|
51 | {
|
---|
52 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
53 | $params = array_merge($params, $optParams);
|
---|
54 | return $this->call('create', [$params], GoogleLongrunningOperation::class);
|
---|
55 | }
|
---|
56 | /**
|
---|
57 | * Deletes a model version. Each model can have multiple versions deployed and
|
---|
58 | * in use at any given time. Use this method to remove a single version. Note:
|
---|
59 | * You cannot delete the version that is set as the default version of the model
|
---|
60 | * unless it is the only remaining version. (versions.delete)
|
---|
61 | *
|
---|
62 | * @param string $name Required. The name of the version. You can get the names
|
---|
63 | * of all the versions of a model by calling projects.models.versions.list.
|
---|
64 | * @param array $optParams Optional parameters.
|
---|
65 | * @return GoogleLongrunningOperation
|
---|
66 | * @throws \Google\Service\Exception
|
---|
67 | */
|
---|
68 | public function delete($name, $optParams = [])
|
---|
69 | {
|
---|
70 | $params = ['name' => $name];
|
---|
71 | $params = array_merge($params, $optParams);
|
---|
72 | return $this->call('delete', [$params], GoogleLongrunningOperation::class);
|
---|
73 | }
|
---|
74 | /**
|
---|
75 | * Gets information about a model version. Models can have multiple versions.
|
---|
76 | * You can call projects.models.versions.list to get the same information that
|
---|
77 | * this method returns for all of the versions of a model. (versions.get)
|
---|
78 | *
|
---|
79 | * @param string $name Required. The name of the version.
|
---|
80 | * @param array $optParams Optional parameters.
|
---|
81 | * @return GoogleCloudMlV1Version
|
---|
82 | * @throws \Google\Service\Exception
|
---|
83 | */
|
---|
84 | public function get($name, $optParams = [])
|
---|
85 | {
|
---|
86 | $params = ['name' => $name];
|
---|
87 | $params = array_merge($params, $optParams);
|
---|
88 | return $this->call('get', [$params], GoogleCloudMlV1Version::class);
|
---|
89 | }
|
---|
90 | /**
|
---|
91 | * Gets basic information about all the versions of a model. If you expect that
|
---|
92 | * a model has many versions, or if you need to handle only a limited number of
|
---|
93 | * results at a time, you can request that the list be retrieved in batches
|
---|
94 | * (called pages). If there are no versions that match the request parameters,
|
---|
95 | * the list request returns an empty response body: {}.
|
---|
96 | * (versions.listProjectsModelsVersions)
|
---|
97 | *
|
---|
98 | * @param string $parent Required. The name of the model for which to list the
|
---|
99 | * version.
|
---|
100 | * @param array $optParams Optional parameters.
|
---|
101 | *
|
---|
102 | * @opt_param string filter Optional. Specifies the subset of versions to
|
---|
103 | * retrieve.
|
---|
104 | * @opt_param int pageSize Optional. The number of versions to retrieve per
|
---|
105 | * "page" of results. If there are more remaining results than this number, the
|
---|
106 | * response message will contain a valid value in the `next_page_token` field.
|
---|
107 | * The default value is 20, and the maximum page size is 100.
|
---|
108 | * @opt_param string pageToken Optional. A page token to request the next page
|
---|
109 | * of results. You get the token from the `next_page_token` field of the
|
---|
110 | * response from the previous call.
|
---|
111 | * @return GoogleCloudMlV1ListVersionsResponse
|
---|
112 | * @throws \Google\Service\Exception
|
---|
113 | */
|
---|
114 | public function listProjectsModelsVersions($parent, $optParams = [])
|
---|
115 | {
|
---|
116 | $params = ['parent' => $parent];
|
---|
117 | $params = array_merge($params, $optParams);
|
---|
118 | return $this->call('list', [$params], GoogleCloudMlV1ListVersionsResponse::class);
|
---|
119 | }
|
---|
120 | /**
|
---|
121 | * Updates the specified Version resource. Currently the only update-able fields
|
---|
122 | * are `description`, `requestLoggingConfig`, `autoScaling.minNodes`, and
|
---|
123 | * `manualScaling.nodes`. (versions.patch)
|
---|
124 | *
|
---|
125 | * @param string $name Required. The name of the model.
|
---|
126 | * @param GoogleCloudMlV1Version $postBody
|
---|
127 | * @param array $optParams Optional parameters.
|
---|
128 | *
|
---|
129 | * @opt_param string updateMask Required. Specifies the path, relative to
|
---|
130 | * `Version`, of the field to update. Must be present and non-empty. For
|
---|
131 | * example, to change the description of a version to "foo", the `update_mask`
|
---|
132 | * parameter would be specified as `description`, and the `PATCH` request body
|
---|
133 | * would specify the new value, as follows: ``` { "description": "foo" } ```
|
---|
134 | * Currently the only supported update mask fields are `description`,
|
---|
135 | * `requestLoggingConfig`, `autoScaling.minNodes`, and `manualScaling.nodes`.
|
---|
136 | * However, you can only update `manualScaling.nodes` if the version uses a
|
---|
137 | * [Compute Engine (N1) machine type](/ml-engine/docs/machine-types-online-
|
---|
138 | * prediction).
|
---|
139 | * @return GoogleLongrunningOperation
|
---|
140 | * @throws \Google\Service\Exception
|
---|
141 | */
|
---|
142 | public function patch($name, GoogleCloudMlV1Version $postBody, $optParams = [])
|
---|
143 | {
|
---|
144 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
145 | $params = array_merge($params, $optParams);
|
---|
146 | return $this->call('patch', [$params], GoogleLongrunningOperation::class);
|
---|
147 | }
|
---|
148 | /**
|
---|
149 | * Designates a version to be the default for the model. The default version is
|
---|
150 | * used for prediction requests made against the model that don't specify a
|
---|
151 | * version. The first version to be created for a model is automatically set as
|
---|
152 | * the default. You must make any subsequent changes to the default version
|
---|
153 | * setting manually using this method. (versions.setDefault)
|
---|
154 | *
|
---|
155 | * @param string $name Required. The name of the version to make the default for
|
---|
156 | * the model. You can get the names of all the versions of a model by calling
|
---|
157 | * projects.models.versions.list.
|
---|
158 | * @param GoogleCloudMlV1SetDefaultVersionRequest $postBody
|
---|
159 | * @param array $optParams Optional parameters.
|
---|
160 | * @return GoogleCloudMlV1Version
|
---|
161 | * @throws \Google\Service\Exception
|
---|
162 | */
|
---|
163 | public function setDefault($name, GoogleCloudMlV1SetDefaultVersionRequest $postBody, $optParams = [])
|
---|
164 | {
|
---|
165 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
166 | $params = array_merge($params, $optParams);
|
---|
167 | return $this->call('setDefault', [$params], GoogleCloudMlV1Version::class);
|
---|
168 | }
|
---|
169 | }
|
---|
170 |
|
---|
171 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
172 | class_alias(ProjectsModelsVersions::class, 'Google_Service_CloudMachineLearningEngine_Resource_ProjectsModelsVersions');
|
---|