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\GoogleCloudMlV1ListModelsResponse;
|
---|
21 | use Google\Service\CloudMachineLearningEngine\GoogleCloudMlV1Model;
|
---|
22 | use Google\Service\CloudMachineLearningEngine\GoogleIamV1Policy;
|
---|
23 | use Google\Service\CloudMachineLearningEngine\GoogleIamV1SetIamPolicyRequest;
|
---|
24 | use Google\Service\CloudMachineLearningEngine\GoogleIamV1TestIamPermissionsRequest;
|
---|
25 | use Google\Service\CloudMachineLearningEngine\GoogleIamV1TestIamPermissionsResponse;
|
---|
26 | use Google\Service\CloudMachineLearningEngine\GoogleLongrunningOperation;
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * The "models" collection of methods.
|
---|
30 | * Typical usage is:
|
---|
31 | * <code>
|
---|
32 | * $mlService = new Google\Service\CloudMachineLearningEngine(...);
|
---|
33 | * $models = $mlService->projects_models;
|
---|
34 | * </code>
|
---|
35 | */
|
---|
36 | class ProjectsModels extends \Google\Service\Resource
|
---|
37 | {
|
---|
38 | /**
|
---|
39 | * Creates a model which will later contain one or more versions. You must add
|
---|
40 | * at least one version before you can request predictions from the model. Add
|
---|
41 | * versions by calling projects.models.versions.create. (models.create)
|
---|
42 | *
|
---|
43 | * @param string $parent Required. The project name.
|
---|
44 | * @param GoogleCloudMlV1Model $postBody
|
---|
45 | * @param array $optParams Optional parameters.
|
---|
46 | * @return GoogleCloudMlV1Model
|
---|
47 | * @throws \Google\Service\Exception
|
---|
48 | */
|
---|
49 | public function create($parent, GoogleCloudMlV1Model $postBody, $optParams = [])
|
---|
50 | {
|
---|
51 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
52 | $params = array_merge($params, $optParams);
|
---|
53 | return $this->call('create', [$params], GoogleCloudMlV1Model::class);
|
---|
54 | }
|
---|
55 | /**
|
---|
56 | * Deletes a model. You can only delete a model if there are no versions in it.
|
---|
57 | * You can delete versions by calling projects.models.versions.delete.
|
---|
58 | * (models.delete)
|
---|
59 | *
|
---|
60 | * @param string $name Required. The name of the model.
|
---|
61 | * @param array $optParams Optional parameters.
|
---|
62 | * @return GoogleLongrunningOperation
|
---|
63 | * @throws \Google\Service\Exception
|
---|
64 | */
|
---|
65 | public function delete($name, $optParams = [])
|
---|
66 | {
|
---|
67 | $params = ['name' => $name];
|
---|
68 | $params = array_merge($params, $optParams);
|
---|
69 | return $this->call('delete', [$params], GoogleLongrunningOperation::class);
|
---|
70 | }
|
---|
71 | /**
|
---|
72 | * Gets information about a model, including its name, the description (if set),
|
---|
73 | * and the default version (if at least one version of the model has been
|
---|
74 | * deployed). (models.get)
|
---|
75 | *
|
---|
76 | * @param string $name Required. The name of the model.
|
---|
77 | * @param array $optParams Optional parameters.
|
---|
78 | * @return GoogleCloudMlV1Model
|
---|
79 | * @throws \Google\Service\Exception
|
---|
80 | */
|
---|
81 | public function get($name, $optParams = [])
|
---|
82 | {
|
---|
83 | $params = ['name' => $name];
|
---|
84 | $params = array_merge($params, $optParams);
|
---|
85 | return $this->call('get', [$params], GoogleCloudMlV1Model::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. (models.getIamPolicy)
|
---|
90 | *
|
---|
91 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
92 | * requested. See [Resource
|
---|
93 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
94 | * appropriate value for this field.
|
---|
95 | * @param array $optParams Optional parameters.
|
---|
96 | *
|
---|
97 | * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
|
---|
98 | * version that will be used to format the policy. Valid values are 0, 1, and 3.
|
---|
99 | * Requests specifying an invalid value will be rejected. Requests for policies
|
---|
100 | * with any conditional role bindings must specify version 3. Policies with no
|
---|
101 | * conditional role bindings may specify any valid value or leave the field
|
---|
102 | * unset. The policy in the response might use the policy version that you
|
---|
103 | * specified, or it might use a lower policy version. For example, if you
|
---|
104 | * specify version 3, but the policy has no conditional role bindings, the
|
---|
105 | * response uses version 1. To learn which resources support conditions in their
|
---|
106 | * IAM policies, see the [IAM
|
---|
107 | * documentation](https://cloud.google.com/iam/help/conditions/resource-
|
---|
108 | * policies).
|
---|
109 | * @return GoogleIamV1Policy
|
---|
110 | * @throws \Google\Service\Exception
|
---|
111 | */
|
---|
112 | public function getIamPolicy($resource, $optParams = [])
|
---|
113 | {
|
---|
114 | $params = ['resource' => $resource];
|
---|
115 | $params = array_merge($params, $optParams);
|
---|
116 | return $this->call('getIamPolicy', [$params], GoogleIamV1Policy::class);
|
---|
117 | }
|
---|
118 | /**
|
---|
119 | * Lists the models in a project. Each project can contain multiple models, and
|
---|
120 | * each model can have multiple versions. If there are no models that match the
|
---|
121 | * request parameters, the list request returns an empty response body: {}.
|
---|
122 | * (models.listProjectsModels)
|
---|
123 | *
|
---|
124 | * @param string $parent Required. The name of the project whose models are to
|
---|
125 | * be listed.
|
---|
126 | * @param array $optParams Optional parameters.
|
---|
127 | *
|
---|
128 | * @opt_param string filter Optional. Specifies the subset of models to
|
---|
129 | * retrieve.
|
---|
130 | * @opt_param int pageSize Optional. The number of models to retrieve per "page"
|
---|
131 | * of results. If there are more remaining results than this number, the
|
---|
132 | * response message will contain a valid value in the `next_page_token` field.
|
---|
133 | * The default value is 20, and the maximum page size is 100.
|
---|
134 | * @opt_param string pageToken Optional. A page token to request the next page
|
---|
135 | * of results. You get the token from the `next_page_token` field of the
|
---|
136 | * response from the previous call.
|
---|
137 | * @return GoogleCloudMlV1ListModelsResponse
|
---|
138 | * @throws \Google\Service\Exception
|
---|
139 | */
|
---|
140 | public function listProjectsModels($parent, $optParams = [])
|
---|
141 | {
|
---|
142 | $params = ['parent' => $parent];
|
---|
143 | $params = array_merge($params, $optParams);
|
---|
144 | return $this->call('list', [$params], GoogleCloudMlV1ListModelsResponse::class);
|
---|
145 | }
|
---|
146 | /**
|
---|
147 | * Updates a specific model resource. Currently the only supported fields to
|
---|
148 | * update are `description` and `default_version.name`. (models.patch)
|
---|
149 | *
|
---|
150 | * @param string $name Required. The project name.
|
---|
151 | * @param GoogleCloudMlV1Model $postBody
|
---|
152 | * @param array $optParams Optional parameters.
|
---|
153 | *
|
---|
154 | * @opt_param string updateMask Required. Specifies the path, relative to
|
---|
155 | * `Model`, of the field to update. For example, to change the description of a
|
---|
156 | * model to "foo" and set its default version to "version_1", the `update_mask`
|
---|
157 | * parameter would be specified as `description`, `default_version.name`, and
|
---|
158 | * the `PATCH` request body would specify the new value, as follows: {
|
---|
159 | * "description": "foo", "defaultVersion": { "name":"version_1" } } Currently
|
---|
160 | * the supported update masks are `description` and `default_version.name`.
|
---|
161 | * @return GoogleLongrunningOperation
|
---|
162 | * @throws \Google\Service\Exception
|
---|
163 | */
|
---|
164 | public function patch($name, GoogleCloudMlV1Model $postBody, $optParams = [])
|
---|
165 | {
|
---|
166 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
167 | $params = array_merge($params, $optParams);
|
---|
168 | return $this->call('patch', [$params], GoogleLongrunningOperation::class);
|
---|
169 | }
|
---|
170 | /**
|
---|
171 | * Sets the access control policy on the specified resource. Replaces any
|
---|
172 | * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
|
---|
173 | * `PERMISSION_DENIED` errors. (models.setIamPolicy)
|
---|
174 | *
|
---|
175 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
176 | * specified. See [Resource
|
---|
177 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
178 | * appropriate value for this field.
|
---|
179 | * @param GoogleIamV1SetIamPolicyRequest $postBody
|
---|
180 | * @param array $optParams Optional parameters.
|
---|
181 | * @return GoogleIamV1Policy
|
---|
182 | * @throws \Google\Service\Exception
|
---|
183 | */
|
---|
184 | public function setIamPolicy($resource, GoogleIamV1SetIamPolicyRequest $postBody, $optParams = [])
|
---|
185 | {
|
---|
186 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
187 | $params = array_merge($params, $optParams);
|
---|
188 | return $this->call('setIamPolicy', [$params], GoogleIamV1Policy::class);
|
---|
189 | }
|
---|
190 | /**
|
---|
191 | * Returns permissions that a caller has on the specified resource. If the
|
---|
192 | * resource does not exist, this will return an empty set of permissions, not a
|
---|
193 | * `NOT_FOUND` error. Note: This operation is designed to be used for building
|
---|
194 | * permission-aware UIs and command-line tools, not for authorization checking.
|
---|
195 | * This operation may "fail open" without warning. (models.testIamPermissions)
|
---|
196 | *
|
---|
197 | * @param string $resource REQUIRED: The resource for which the policy detail is
|
---|
198 | * being requested. See [Resource
|
---|
199 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
200 | * appropriate value for this field.
|
---|
201 | * @param GoogleIamV1TestIamPermissionsRequest $postBody
|
---|
202 | * @param array $optParams Optional parameters.
|
---|
203 | * @return GoogleIamV1TestIamPermissionsResponse
|
---|
204 | * @throws \Google\Service\Exception
|
---|
205 | */
|
---|
206 | public function testIamPermissions($resource, GoogleIamV1TestIamPermissionsRequest $postBody, $optParams = [])
|
---|
207 | {
|
---|
208 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
209 | $params = array_merge($params, $optParams);
|
---|
210 | return $this->call('testIamPermissions', [$params], GoogleIamV1TestIamPermissionsResponse::class);
|
---|
211 | }
|
---|
212 | }
|
---|
213 |
|
---|
214 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
215 | class_alias(ProjectsModels::class, 'Google_Service_CloudMachineLearningEngine_Resource_ProjectsModels');
|
---|