blob: d7d8c6679d8324281874b407dd08a72a5f41d7e5 [file] [log] [blame]
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -04001<html><body>
2<style>
3
4body, h1, h2, h3, div, span, p, pre, a {
5 margin: 0;
6 padding: 0;
7 border: 0;
8 font-weight: inherit;
9 font-style: inherit;
10 font-size: 100%;
11 font-family: inherit;
12 vertical-align: baseline;
13}
14
15body {
16 font-size: 13px;
17 padding: 1em;
18}
19
20h1 {
21 font-size: 26px;
22 margin-bottom: 1em;
23}
24
25h2 {
26 font-size: 24px;
27 margin-bottom: 1em;
28}
29
30h3 {
31 font-size: 20px;
32 margin-bottom: 1em;
33 margin-top: 1em;
34}
35
36pre, code {
37 line-height: 1.5;
38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42 margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46 font-family: Arial, sans serif;
47}
48
49h1, h2, h3 {
50 border-bottom: solid #CCC 1px;
51}
52
53.toc_element {
54 margin-top: 0.5em;
55}
56
57.firstline {
58 margin-left: 2 em;
59}
60
61.method {
62 margin-top: 1em;
63 border: solid 1px #CCC;
64 padding: 1em;
65 background: #EEE;
66}
67
68.details {
69 font-weight: bold;
70 font-size: 14px;
71}
72
73</style>
74
Dan O'Mearadd494642020-05-01 07:42:23 -070075<h1><a href="ml_v1.html">AI Platform Training & Prediction API</a> . <a href="ml_v1.projects.html">projects</a> . <a href="ml_v1.projects.models.html">models</a></h1>
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -040076<h2>Instance Methods</h2>
77<p class="toc_element">
78 <code><a href="ml_v1.projects.models.versions.html">versions()</a></code>
79</p>
80<p class="firstline">Returns the versions Resource.</p>
81
82<p class="toc_element">
Dan O'Mearadd494642020-05-01 07:42:23 -070083 <code><a href="#create">create(parent, body=None, x__xgafv=None)</a></code></p>
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -040084<p class="firstline">Creates a model which will later contain one or more versions.</p>
85<p class="toc_element">
Thomas Coffee2f245372017-03-27 10:39:26 -070086 <code><a href="#delete">delete(name, x__xgafv=None)</a></code></p>
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -040087<p class="firstline">Deletes a model.</p>
88<p class="toc_element">
Thomas Coffee2f245372017-03-27 10:39:26 -070089 <code><a href="#get">get(name, x__xgafv=None)</a></code></p>
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -040090<p class="firstline">Gets information about a model, including its name, the description (if</p>
91<p class="toc_element">
Dan O'Mearadd494642020-05-01 07:42:23 -070092 <code><a href="#getIamPolicy">getIamPolicy(resource, options_requestedPolicyVersion=None, x__xgafv=None)</a></code></p>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070093<p class="firstline">Gets the access control policy for a resource.</p>
94<p class="toc_element">
Dan O'Mearadd494642020-05-01 07:42:23 -070095 <code><a href="#list">list(parent, pageSize=None, pageToken=None, x__xgafv=None, filter=None)</a></code></p>
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -040096<p class="firstline">Lists the models in a project.</p>
97<p class="toc_element">
98 <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p>
99<p class="firstline">Retrieves the next page of results.</p>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700100<p class="toc_element">
Dan O'Mearadd494642020-05-01 07:42:23 -0700101 <code><a href="#patch">patch(name, body=None, updateMask=None, x__xgafv=None)</a></code></p>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700102<p class="firstline">Updates a specific model resource.</p>
103<p class="toc_element">
Dan O'Mearadd494642020-05-01 07:42:23 -0700104 <code><a href="#setIamPolicy">setIamPolicy(resource, body=None, x__xgafv=None)</a></code></p>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700105<p class="firstline">Sets the access control policy on the specified resource. Replaces any</p>
106<p class="toc_element">
Dan O'Mearadd494642020-05-01 07:42:23 -0700107 <code><a href="#testIamPermissions">testIamPermissions(resource, body=None, x__xgafv=None)</a></code></p>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700108<p class="firstline">Returns permissions that a caller has on the specified resource.</p>
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400109<h3>Method Details</h3>
110<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700111 <code class="details" id="create">create(parent, body=None, x__xgafv=None)</code>
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400112 <pre>Creates a model which will later contain one or more versions.
113
114You must add at least one version before you can request predictions from
115the model. Add versions by calling
Dan O'Mearadd494642020-05-01 07:42:23 -0700116projects.models.versions.create.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400117
118Args:
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700119 parent: string, Required. The project name. (required)
Dan O'Mearadd494642020-05-01 07:42:23 -0700120 body: object, The request body.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400121 The object takes the form of:
122
123{ # Represents a machine learning solution.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700124 #
125 # A model can have multiple versions, each of which is a deployed, trained
126 # model ready to receive prediction requests. The model itself is just a
127 # container.
Dan O'Mearadd494642020-05-01 07:42:23 -0700128 "name": "A String", # Required. The name specified for the model when it was created.
129 #
130 # The model name must be unique within the project it is created in.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700131 "onlinePredictionConsoleLogging": True or False, # Optional. If true, online prediction nodes send `stderr` and `stdout`
132 # streams to Stackdriver Logging. These can be more verbose than the standard
133 # access logs (see `onlinePredictionLogging`) and can incur higher cost.
134 # However, they are helpful for debugging. Note that
135 # [Stackdriver logs may incur a cost](/stackdriver/pricing), especially if
136 # your project receives prediction requests at a high QPS. Estimate your
137 # costs before enabling this option.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400138 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700139 # Default is false.
140 "labels": { # Optional. One or more labels that you can add, to organize your models.
141 # Each label is a key-value pair, where both the key and the value are
142 # arbitrary strings that you supply.
143 # For more information, see the documentation on
Dan O'Mearadd494642020-05-01 07:42:23 -0700144 # &lt;a href="/ml-engine/docs/tensorflow/resource-labels"&gt;using labels&lt;/a&gt;.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700145 "a_key": "A String",
146 },
147 "regions": [ # Optional. The list of regions where the model is going to be deployed.
Dan O'Mearadd494642020-05-01 07:42:23 -0700148 # Only one region per model is supported.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700149 # Defaults to 'us-central1' if nothing is set.
Dan O'Mearadd494642020-05-01 07:42:23 -0700150 # See the &lt;a href="/ml-engine/docs/tensorflow/regions"&gt;available regions&lt;/a&gt;
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700151 # for AI Platform services.
152 # Note:
153 # * No matter where a model is deployed, it can always be accessed by
154 # users from anywhere, both for online and batch prediction.
155 # * The region for a batch prediction job is set by the region field when
156 # submitting the batch prediction job and does not take its value from
157 # this field.
158 "A String",
159 ],
160 "etag": "A String", # `etag` is used for optimistic concurrency control as a way to help
161 # prevent simultaneous updates of a model from overwriting each other.
162 # It is strongly suggested that systems make use of the `etag` in the
163 # read-modify-write cycle to perform model updates in order to avoid race
164 # conditions: An `etag` is returned in the response to `GetModel`, and
165 # systems are expected to put that etag in the request to `UpdateModel` to
166 # ensure that their change will be applied to the model as intended.
167 "defaultVersion": { # Represents a version of the model. # Output only. The default version of the model. This version will be used to
168 # handle prediction requests that do not specify a version.
169 #
170 # You can change the default version by calling
Dan O'Mearadd494642020-05-01 07:42:23 -0700171 # projects.models.versions.setDefault.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700172 #
173 # Each version is a trained model deployed in the cloud, ready to handle
174 # prediction requests. A model can have multiple versions. You can get
175 # information about all of the versions of a given model by calling
Dan O'Mearadd494642020-05-01 07:42:23 -0700176 # projects.models.versions.list.
177 "acceleratorConfig": { # Represents a hardware accelerator request config. # Optional. Accelerator config for using GPUs for online prediction (beta).
178 # Only specify this field if you have specified a Compute Engine (N1) machine
179 # type in the `machineType` field. Learn more about [using GPUs for online
180 # prediction](/ml-engine/docs/machine-types-online-prediction#gpus).
181 # Note that the AcceleratorConfig can be used in both Jobs and Versions.
182 # Learn more about [accelerators for training](/ml-engine/docs/using-gpus) and
183 # [accelerators for online
184 # prediction](/ml-engine/docs/machine-types-online-prediction#gpus).
185 "count": "A String", # The number of accelerators to attach to each machine running the job.
186 "type": "A String", # The type of accelerator to use.
187 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700188 "labels": { # Optional. One or more labels that you can add, to organize your model
189 # versions. Each label is a key-value pair, where both the key and the value
190 # are arbitrary strings that you supply.
191 # For more information, see the documentation on
Dan O'Mearadd494642020-05-01 07:42:23 -0700192 # &lt;a href="/ml-engine/docs/tensorflow/resource-labels"&gt;using labels&lt;/a&gt;.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700193 "a_key": "A String",
194 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700195 "predictionClass": "A String", # Optional. The fully qualified name
Dan O'Mearadd494642020-05-01 07:42:23 -0700196 # (&lt;var&gt;module_name&lt;/var&gt;.&lt;var&gt;class_name&lt;/var&gt;) of a class that implements
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700197 # the Predictor interface described in this reference field. The module
198 # containing this class should be included in a package provided to the
199 # [`packageUris` field](#Version.FIELDS.package_uris).
200 #
201 # Specify this field if and only if you are deploying a [custom prediction
202 # routine (beta)](/ml-engine/docs/tensorflow/custom-prediction-routines).
203 # If you specify this field, you must set
Dan O'Mearadd494642020-05-01 07:42:23 -0700204 # [`runtimeVersion`](#Version.FIELDS.runtime_version) to 1.4 or greater and
205 # you must set `machineType` to a [legacy (MLS1)
206 # machine type](/ml-engine/docs/machine-types-online-prediction).
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700207 #
208 # The following code sample provides the Predictor interface:
209 #
Dan O'Mearadd494642020-05-01 07:42:23 -0700210 # &lt;pre style="max-width: 626px;"&gt;
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700211 # class Predictor(object):
212 # """Interface for constructing custom predictors."""
213 #
214 # def predict(self, instances, **kwargs):
215 # """Performs custom prediction.
216 #
217 # Instances are the decoded values from the request. They have already
218 # been deserialized from JSON.
219 #
220 # Args:
221 # instances: A list of prediction input instances.
222 # **kwargs: A dictionary of keyword args provided as additional
223 # fields on the predict request body.
224 #
225 # Returns:
226 # A list of outputs containing the prediction results. This list must
227 # be JSON serializable.
228 # """
229 # raise NotImplementedError()
230 #
231 # @classmethod
232 # def from_path(cls, model_dir):
233 # """Creates an instance of Predictor using the given path.
234 #
235 # Loading of the predictor should be done in this method.
236 #
237 # Args:
238 # model_dir: The local directory that contains the exported model
239 # file along with any additional files uploaded when creating the
240 # version resource.
241 #
242 # Returns:
243 # An instance implementing this Predictor class.
244 # """
245 # raise NotImplementedError()
Dan O'Mearadd494642020-05-01 07:42:23 -0700246 # &lt;/pre&gt;
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700247 #
248 # Learn more about [the Predictor interface and custom prediction
249 # routines](/ml-engine/docs/tensorflow/custom-prediction-routines).
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700250 "serviceAccount": "A String", # Optional. Specifies the service account for resource access control.
251 "state": "A String", # Output only. The state of a version.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700252 "packageUris": [ # Optional. Cloud Storage paths (`gs://…`) of packages for [custom
253 # prediction routines](/ml-engine/docs/tensorflow/custom-prediction-routines)
254 # or [scikit-learn pipelines with custom
255 # code](/ml-engine/docs/scikit/exporting-for-prediction#custom-pipeline-code).
256 #
257 # For a custom prediction routine, one of these packages must contain your
258 # Predictor class (see
259 # [`predictionClass`](#Version.FIELDS.prediction_class)). Additionally,
260 # include any dependencies used by your Predictor or scikit-learn pipeline
261 # uses that are not already included in your selected [runtime
262 # version](/ml-engine/docs/tensorflow/runtime-version-list).
263 #
264 # If you specify this field, you must also set
265 # [`runtimeVersion`](#Version.FIELDS.runtime_version) to 1.4 or greater.
266 "A String",
267 ],
268 "etag": "A String", # `etag` is used for optimistic concurrency control as a way to help
269 # prevent simultaneous updates of a model from overwriting each other.
270 # It is strongly suggested that systems make use of the `etag` in the
271 # read-modify-write cycle to perform model updates in order to avoid race
272 # conditions: An `etag` is returned in the response to `GetVersion`, and
273 # systems are expected to put that etag in the request to `UpdateVersion` to
274 # ensure that their change will be applied to the model as intended.
275 "lastUseTime": "A String", # Output only. The time the version was last used for prediction.
276 "deploymentUri": "A String", # Required. The Cloud Storage location of the trained model used to
277 # create the version. See the
278 # [guide to model
279 # deployment](/ml-engine/docs/tensorflow/deploying-models) for more
280 # information.
281 #
282 # When passing Version to
Dan O'Mearadd494642020-05-01 07:42:23 -0700283 # projects.models.versions.create
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700284 # the model service uses the specified location as the source of the model.
285 # Once deployed, the model version is hosted by the prediction service, so
286 # this location is useful only as a historical record.
287 # The total number of model files can't exceed 1000.
Dan O'Mearadd494642020-05-01 07:42:23 -0700288 "explanationConfig": { # Message holding configuration options for explaining model predictions. # Optional. Configures explainability features on the model's version.
289 # Some explanation features require additional metadata to be loaded
290 # as part of the model payload.
291 # There are two feature attribution methods supported for TensorFlow models:
292 # integrated gradients and sampled Shapley.
293 # [Learn more about feature
294 # attributions.](/ml-engine/docs/ai-explanations/overview)
295 "xraiAttribution": { # Attributes credit by computing the XRAI taking advantage # Attributes credit by computing the XRAI taking advantage
296 # of the model's fully differentiable structure. Refer to this paper for
297 # more details: https://arxiv.org/abs/1906.02825
298 # Currently only implemented for models with natural image inputs.
299 # of the model's fully differentiable structure. Refer to this paper for
300 # more details: https://arxiv.org/abs/1906.02825
301 # Currently only implemented for models with natural image inputs.
302 "numIntegralSteps": 42, # Number of steps for approximating the path integral.
303 # A good value to start is 50 and gradually increase until the
304 # sum to diff property is met within the desired error range.
305 },
306 "sampledShapleyAttribution": { # An attribution method that approximates Shapley values for features that # An attribution method that approximates Shapley values for features that
307 # contribute to the label being predicted. A sampling strategy is used to
308 # approximate the value rather than considering all subsets of features.
309 # contribute to the label being predicted. A sampling strategy is used to
310 # approximate the value rather than considering all subsets of features.
311 "numPaths": 42, # The number of feature permutations to consider when approximating the
312 # Shapley values.
313 },
314 "integratedGradientsAttribution": { # Attributes credit by computing the Aumann-Shapley value taking advantage # Attributes credit by computing the Aumann-Shapley value taking advantage
315 # of the model's fully differentiable structure. Refer to this paper for
316 # more details: http://proceedings.mlr.press/v70/sundararajan17a.html
317 # of the model's fully differentiable structure. Refer to this paper for
318 # more details: http://proceedings.mlr.press/v70/sundararajan17a.html
319 "numIntegralSteps": 42, # Number of steps for approximating the path integral.
320 # A good value to start is 50 and gradually increase until the
321 # sum to diff property is met within the desired error range.
322 },
323 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700324 "isDefault": True or False, # Output only. If true, this version will be used to handle prediction
325 # requests that do not specify a version.
326 #
327 # You can change the default version by calling
Dan O'Mearadd494642020-05-01 07:42:23 -0700328 # projects.methods.versions.setDefault.
329 "machineType": "A String", # Optional. The type of machine on which to serve the model. Currently only
330 # applies to online prediction service. If this field is not specified, it
331 # defaults to `mls1-c1-m2`.
332 #
333 # Online prediction supports the following machine types:
334 #
335 # * `mls1-c1-m2`
336 # * `mls1-c4-m2`
337 # * `n1-standard-2`
338 # * `n1-standard-4`
339 # * `n1-standard-8`
340 # * `n1-standard-16`
341 # * `n1-standard-32`
342 # * `n1-highmem-2`
343 # * `n1-highmem-4`
344 # * `n1-highmem-8`
345 # * `n1-highmem-16`
346 # * `n1-highmem-32`
347 # * `n1-highcpu-2`
348 # * `n1-highcpu-4`
349 # * `n1-highcpu-8`
350 # * `n1-highcpu-16`
351 # * `n1-highcpu-32`
352 #
353 # `mls1-c1-m2` is generally available. All other machine types are available
354 # in beta. Learn more about the [differences between machine
355 # types](/ml-engine/docs/machine-types-online-prediction).
356 "description": "A String", # Optional. The description specified for the version when it was created.
357 "runtimeVersion": "A String", # Required. The AI Platform runtime version to use for this deployment.
358 #
359 # For more information, see the
360 # [runtime version list](/ml-engine/docs/runtime-version-list) and
361 # [how to manage runtime versions](/ml-engine/docs/versioning).
362 "manualScaling": { # Options for manually scaling a model. # Manually select the number of nodes to use for serving the
363 # model. You should generally use `auto_scaling` with an appropriate
364 # `min_nodes` instead, but this option is available if you want more
365 # predictable billing. Beware that latency and error rates will increase
366 # if the traffic exceeds that capability of the system to serve it based
367 # on the selected number of nodes.
368 "nodes": 42, # The number of nodes to allocate for this model. These nodes are always up,
369 # starting from the time the model is deployed, so the cost of operating
370 # this model will be proportional to `nodes` * number of hours since
371 # last billing cycle plus the cost for each prediction performed.
372 },
373 "errorMessage": "A String", # Output only. The details of a failure or a cancellation.
374 "framework": "A String", # Optional. The machine learning framework AI Platform uses to train
375 # this version of the model. Valid values are `TENSORFLOW`, `SCIKIT_LEARN`,
376 # `XGBOOST`. If you do not specify a framework, AI Platform
377 # will analyze files in the deployment_uri to determine a framework. If you
378 # choose `SCIKIT_LEARN` or `XGBOOST`, you must also set the runtime version
379 # of the model to 1.4 or greater.
380 #
381 # Do **not** specify a framework if you're deploying a [custom
382 # prediction routine](/ml-engine/docs/tensorflow/custom-prediction-routines).
383 #
384 # If you specify a [Compute Engine (N1) machine
385 # type](/ml-engine/docs/machine-types-online-prediction) in the
386 # `machineType` field, you must specify `TENSORFLOW`
387 # for the framework.
388 "createTime": "A String", # Output only. The time the version was created.
389 "name": "A String", # Required. The name specified for the version when it was created.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700390 #
391 # The version name must be unique within the model it is created in.
Dan O'Mearadd494642020-05-01 07:42:23 -0700392 "autoScaling": { # Options for automatically scaling a model. # Automatically scale the number of nodes used to serve the model in
393 # response to increases and decreases in traffic. Care should be
394 # taken to ramp up traffic according to the model's ability to scale
395 # or you will start seeing increases in latency and 429 response codes.
396 #
397 # Note that you cannot use AutoScaling if your version uses
398 # [GPUs](#Version.FIELDS.accelerator_config). Instead, you must use specify
399 # `manual_scaling`.
400 "minNodes": 42, # Optional. The minimum number of nodes to allocate for this model. These
401 # nodes are always up, starting from the time the model is deployed.
402 # Therefore, the cost of operating this model will be at least
403 # `rate` * `min_nodes` * number of hours since last billing cycle,
404 # where `rate` is the cost per node-hour as documented in the
405 # [pricing guide](/ml-engine/docs/pricing),
406 # even if no predictions are performed. There is additional cost for each
407 # prediction performed.
408 #
409 # Unlike manual scaling, if the load gets too heavy for the nodes
410 # that are up, the service will automatically add nodes to handle the
411 # increased load as well as scale back as traffic drops, always maintaining
412 # at least `min_nodes`. You will be charged for the time in which additional
413 # nodes are used.
414 #
415 # If `min_nodes` is not specified and AutoScaling is used with a [legacy
416 # (MLS1) machine type](/ml-engine/docs/machine-types-online-prediction),
417 # `min_nodes` defaults to 0, in which case, when traffic to a model stops
418 # (and after a cool-down period), nodes will be shut down and no charges will
419 # be incurred until traffic to the model resumes.
420 #
421 # If `min_nodes` is not specified and AutoScaling is used with a [Compute
422 # Engine (N1) machine type](/ml-engine/docs/machine-types-online-prediction),
423 # `min_nodes` defaults to 1. `min_nodes` must be at least 1 for use with a
424 # Compute Engine machine type.
425 #
426 # Note that you cannot use AutoScaling if your version uses
427 # [GPUs](#Version.FIELDS.accelerator_config). Instead, you must use
428 # ManualScaling.
429 #
430 # You can set `min_nodes` when creating the model version, and you can also
431 # update `min_nodes` for an existing version:
432 # &lt;pre&gt;
433 # update_body.json:
434 # {
435 # 'autoScaling': {
436 # 'minNodes': 5
437 # }
438 # }
439 # &lt;/pre&gt;
440 # HTTP request:
441 # &lt;pre style="max-width: 626px;"&gt;
442 # PATCH
443 # https://ml.googleapis.com/v1/{name=projects/*/models/*/versions/*}?update_mask=autoScaling.minNodes
444 # -d @./update_body.json
445 # &lt;/pre&gt;
446 },
447 "pythonVersion": "A String", # Required. The version of Python used in prediction.
448 #
449 # The following Python versions are available:
450 #
451 # * Python '3.7' is available when `runtime_version` is set to '1.15' or
452 # later.
453 # * Python '3.5' is available when `runtime_version` is set to a version
454 # from '1.4' to '1.14'.
455 # * Python '2.7' is available when `runtime_version` is set to '1.15' or
456 # earlier.
457 #
458 # Read more about the Python versions available for [each runtime
459 # version](/ml-engine/docs/runtime-version-list).
460 "requestLoggingConfig": { # Configuration for logging request-response pairs to a BigQuery table. # Optional. *Only* specify this field in a
461 # projects.models.versions.patch
462 # request. Specifying it in a
463 # projects.models.versions.create
464 # request has no effect.
465 #
466 # Configures the request-response pair logging on predictions from this
467 # Version.
468 # Online prediction requests to a model version and the responses to these
469 # requests are converted to raw strings and saved to the specified BigQuery
470 # table. Logging is constrained by [BigQuery quotas and
471 # limits](/bigquery/quotas). If your project exceeds BigQuery quotas or limits,
472 # AI Platform Prediction does not log request-response pairs, but it continues
473 # to serve predictions.
474 #
475 # If you are using [continuous
476 # evaluation](/ml-engine/docs/continuous-evaluation/), you do not need to
477 # specify this configuration manually. Setting up continuous evaluation
478 # automatically enables logging of request-response pairs.
479 "samplingPercentage": 3.14, # Percentage of requests to be logged, expressed as a fraction from 0 to 1.
480 # For example, if you want to log 10% of requests, enter `0.1`. The sampling
481 # window is the lifetime of the model version. Defaults to 0.
482 "bigqueryTableName": "A String", # Required. Fully qualified BigQuery table name in the following format:
483 # "&lt;var&gt;project_id&lt;/var&gt;.&lt;var&gt;dataset_name&lt;/var&gt;.&lt;var&gt;table_name&lt;/var&gt;"
484 #
485 # The specified table must already exist, and the "Cloud ML Service Agent"
486 # for your project must have permission to write to it. The table must have
487 # the following [schema](/bigquery/docs/schemas):
488 #
489 # &lt;table&gt;
490 # &lt;tr&gt;&lt;th&gt;Field name&lt;/th&gt;&lt;th style="display: table-cell"&gt;Type&lt;/th&gt;
491 # &lt;th style="display: table-cell"&gt;Mode&lt;/th&gt;&lt;/tr&gt;
492 # &lt;tr&gt;&lt;td&gt;model&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;REQUIRED&lt;/td&gt;&lt;/tr&gt;
493 # &lt;tr&gt;&lt;td&gt;model_version&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;REQUIRED&lt;/td&gt;&lt;/tr&gt;
494 # &lt;tr&gt;&lt;td&gt;time&lt;/td&gt;&lt;td&gt;TIMESTAMP&lt;/td&gt;&lt;td&gt;REQUIRED&lt;/td&gt;&lt;/tr&gt;
495 # &lt;tr&gt;&lt;td&gt;raw_data&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;REQUIRED&lt;/td&gt;&lt;/tr&gt;
496 # &lt;tr&gt;&lt;td&gt;raw_prediction&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;NULLABLE&lt;/td&gt;&lt;/tr&gt;
497 # &lt;tr&gt;&lt;td&gt;groundtruth&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;NULLABLE&lt;/td&gt;&lt;/tr&gt;
498 # &lt;/table&gt;
499 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700500 },
501 "onlinePredictionLogging": True or False, # Optional. If true, online prediction access logs are sent to StackDriver
502 # Logging. These logs are like standard server access logs, containing
503 # information like timestamp and latency for each request. Note that
504 # [Stackdriver logs may incur a cost](/stackdriver/pricing), especially if
505 # your project receives prediction requests at a high queries per second rate
506 # (QPS). Estimate your costs before enabling this option.
507 #
508 # Default is false.
Dan O'Mearadd494642020-05-01 07:42:23 -0700509 "description": "A String", # Optional. The description specified for the model when it was created.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700510}
511
512 x__xgafv: string, V1 error format.
513 Allowed values
514 1 - v1 error format
515 2 - v2 error format
516
517Returns:
518 An object of the form:
519
520 { # Represents a machine learning solution.
521 #
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400522 # A model can have multiple versions, each of which is a deployed, trained
523 # model ready to receive prediction requests. The model itself is just a
524 # container.
Dan O'Mearadd494642020-05-01 07:42:23 -0700525 "name": "A String", # Required. The name specified for the model when it was created.
526 #
527 # The model name must be unique within the project it is created in.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700528 "onlinePredictionConsoleLogging": True or False, # Optional. If true, online prediction nodes send `stderr` and `stdout`
529 # streams to Stackdriver Logging. These can be more verbose than the standard
530 # access logs (see `onlinePredictionLogging`) and can incur higher cost.
531 # However, they are helpful for debugging. Note that
532 # [Stackdriver logs may incur a cost](/stackdriver/pricing), especially if
533 # your project receives prediction requests at a high QPS. Estimate your
534 # costs before enabling this option.
535 #
536 # Default is false.
537 "labels": { # Optional. One or more labels that you can add, to organize your models.
538 # Each label is a key-value pair, where both the key and the value are
539 # arbitrary strings that you supply.
540 # For more information, see the documentation on
Dan O'Mearadd494642020-05-01 07:42:23 -0700541 # &lt;a href="/ml-engine/docs/tensorflow/resource-labels"&gt;using labels&lt;/a&gt;.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700542 "a_key": "A String",
543 },
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400544 "regions": [ # Optional. The list of regions where the model is going to be deployed.
Dan O'Mearadd494642020-05-01 07:42:23 -0700545 # Only one region per model is supported.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400546 # Defaults to 'us-central1' if nothing is set.
Dan O'Mearadd494642020-05-01 07:42:23 -0700547 # See the &lt;a href="/ml-engine/docs/tensorflow/regions"&gt;available regions&lt;/a&gt;
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700548 # for AI Platform services.
Sai Cheemalapatie833b792017-03-24 15:06:46 -0700549 # Note:
550 # * No matter where a model is deployed, it can always be accessed by
551 # users from anywhere, both for online and batch prediction.
552 # * The region for a batch prediction job is set by the region field when
553 # submitting the batch prediction job and does not take its value from
554 # this field.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400555 "A String",
556 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700557 "etag": "A String", # `etag` is used for optimistic concurrency control as a way to help
558 # prevent simultaneous updates of a model from overwriting each other.
559 # It is strongly suggested that systems make use of the `etag` in the
560 # read-modify-write cycle to perform model updates in order to avoid race
561 # conditions: An `etag` is returned in the response to `GetModel`, and
562 # systems are expected to put that etag in the request to `UpdateModel` to
563 # ensure that their change will be applied to the model as intended.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400564 "defaultVersion": { # Represents a version of the model. # Output only. The default version of the model. This version will be used to
565 # handle prediction requests that do not specify a version.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700566 #
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400567 # You can change the default version by calling
Dan O'Mearadd494642020-05-01 07:42:23 -0700568 # projects.models.versions.setDefault.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400569 #
570 # Each version is a trained model deployed in the cloud, ready to handle
571 # prediction requests. A model can have multiple versions. You can get
572 # information about all of the versions of a given model by calling
Dan O'Mearadd494642020-05-01 07:42:23 -0700573 # projects.models.versions.list.
574 "acceleratorConfig": { # Represents a hardware accelerator request config. # Optional. Accelerator config for using GPUs for online prediction (beta).
575 # Only specify this field if you have specified a Compute Engine (N1) machine
576 # type in the `machineType` field. Learn more about [using GPUs for online
577 # prediction](/ml-engine/docs/machine-types-online-prediction#gpus).
578 # Note that the AcceleratorConfig can be used in both Jobs and Versions.
579 # Learn more about [accelerators for training](/ml-engine/docs/using-gpus) and
580 # [accelerators for online
581 # prediction](/ml-engine/docs/machine-types-online-prediction#gpus).
582 "count": "A String", # The number of accelerators to attach to each machine running the job.
583 "type": "A String", # The type of accelerator to use.
584 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700585 "labels": { # Optional. One or more labels that you can add, to organize your model
586 # versions. Each label is a key-value pair, where both the key and the value
587 # are arbitrary strings that you supply.
588 # For more information, see the documentation on
Dan O'Mearadd494642020-05-01 07:42:23 -0700589 # &lt;a href="/ml-engine/docs/tensorflow/resource-labels"&gt;using labels&lt;/a&gt;.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700590 "a_key": "A String",
591 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700592 "predictionClass": "A String", # Optional. The fully qualified name
Dan O'Mearadd494642020-05-01 07:42:23 -0700593 # (&lt;var&gt;module_name&lt;/var&gt;.&lt;var&gt;class_name&lt;/var&gt;) of a class that implements
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700594 # the Predictor interface described in this reference field. The module
595 # containing this class should be included in a package provided to the
596 # [`packageUris` field](#Version.FIELDS.package_uris).
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400597 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700598 # Specify this field if and only if you are deploying a [custom prediction
599 # routine (beta)](/ml-engine/docs/tensorflow/custom-prediction-routines).
600 # If you specify this field, you must set
Dan O'Mearadd494642020-05-01 07:42:23 -0700601 # [`runtimeVersion`](#Version.FIELDS.runtime_version) to 1.4 or greater and
602 # you must set `machineType` to a [legacy (MLS1)
603 # machine type](/ml-engine/docs/machine-types-online-prediction).
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700604 #
605 # The following code sample provides the Predictor interface:
606 #
Dan O'Mearadd494642020-05-01 07:42:23 -0700607 # &lt;pre style="max-width: 626px;"&gt;
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700608 # class Predictor(object):
609 # """Interface for constructing custom predictors."""
610 #
611 # def predict(self, instances, **kwargs):
612 # """Performs custom prediction.
613 #
614 # Instances are the decoded values from the request. They have already
615 # been deserialized from JSON.
616 #
617 # Args:
618 # instances: A list of prediction input instances.
619 # **kwargs: A dictionary of keyword args provided as additional
620 # fields on the predict request body.
621 #
622 # Returns:
623 # A list of outputs containing the prediction results. This list must
624 # be JSON serializable.
625 # """
626 # raise NotImplementedError()
627 #
628 # @classmethod
629 # def from_path(cls, model_dir):
630 # """Creates an instance of Predictor using the given path.
631 #
632 # Loading of the predictor should be done in this method.
633 #
634 # Args:
635 # model_dir: The local directory that contains the exported model
636 # file along with any additional files uploaded when creating the
637 # version resource.
638 #
639 # Returns:
640 # An instance implementing this Predictor class.
641 # """
642 # raise NotImplementedError()
Dan O'Mearadd494642020-05-01 07:42:23 -0700643 # &lt;/pre&gt;
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700644 #
645 # Learn more about [the Predictor interface and custom prediction
646 # routines](/ml-engine/docs/tensorflow/custom-prediction-routines).
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700647 "serviceAccount": "A String", # Optional. Specifies the service account for resource access control.
648 "state": "A String", # Output only. The state of a version.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700649 "packageUris": [ # Optional. Cloud Storage paths (`gs://…`) of packages for [custom
650 # prediction routines](/ml-engine/docs/tensorflow/custom-prediction-routines)
651 # or [scikit-learn pipelines with custom
652 # code](/ml-engine/docs/scikit/exporting-for-prediction#custom-pipeline-code).
653 #
654 # For a custom prediction routine, one of these packages must contain your
655 # Predictor class (see
656 # [`predictionClass`](#Version.FIELDS.prediction_class)). Additionally,
657 # include any dependencies used by your Predictor or scikit-learn pipeline
658 # uses that are not already included in your selected [runtime
659 # version](/ml-engine/docs/tensorflow/runtime-version-list).
660 #
661 # If you specify this field, you must also set
662 # [`runtimeVersion`](#Version.FIELDS.runtime_version) to 1.4 or greater.
663 "A String",
664 ],
665 "etag": "A String", # `etag` is used for optimistic concurrency control as a way to help
666 # prevent simultaneous updates of a model from overwriting each other.
667 # It is strongly suggested that systems make use of the `etag` in the
668 # read-modify-write cycle to perform model updates in order to avoid race
669 # conditions: An `etag` is returned in the response to `GetVersion`, and
670 # systems are expected to put that etag in the request to `UpdateVersion` to
671 # ensure that their change will be applied to the model as intended.
672 "lastUseTime": "A String", # Output only. The time the version was last used for prediction.
673 "deploymentUri": "A String", # Required. The Cloud Storage location of the trained model used to
674 # create the version. See the
675 # [guide to model
676 # deployment](/ml-engine/docs/tensorflow/deploying-models) for more
677 # information.
678 #
679 # When passing Version to
Dan O'Mearadd494642020-05-01 07:42:23 -0700680 # projects.models.versions.create
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700681 # the model service uses the specified location as the source of the model.
682 # Once deployed, the model version is hosted by the prediction service, so
683 # this location is useful only as a historical record.
684 # The total number of model files can't exceed 1000.
Dan O'Mearadd494642020-05-01 07:42:23 -0700685 "explanationConfig": { # Message holding configuration options for explaining model predictions. # Optional. Configures explainability features on the model's version.
686 # Some explanation features require additional metadata to be loaded
687 # as part of the model payload.
688 # There are two feature attribution methods supported for TensorFlow models:
689 # integrated gradients and sampled Shapley.
690 # [Learn more about feature
691 # attributions.](/ml-engine/docs/ai-explanations/overview)
692 "xraiAttribution": { # Attributes credit by computing the XRAI taking advantage # Attributes credit by computing the XRAI taking advantage
693 # of the model's fully differentiable structure. Refer to this paper for
694 # more details: https://arxiv.org/abs/1906.02825
695 # Currently only implemented for models with natural image inputs.
696 # of the model's fully differentiable structure. Refer to this paper for
697 # more details: https://arxiv.org/abs/1906.02825
698 # Currently only implemented for models with natural image inputs.
699 "numIntegralSteps": 42, # Number of steps for approximating the path integral.
700 # A good value to start is 50 and gradually increase until the
701 # sum to diff property is met within the desired error range.
702 },
703 "sampledShapleyAttribution": { # An attribution method that approximates Shapley values for features that # An attribution method that approximates Shapley values for features that
704 # contribute to the label being predicted. A sampling strategy is used to
705 # approximate the value rather than considering all subsets of features.
706 # contribute to the label being predicted. A sampling strategy is used to
707 # approximate the value rather than considering all subsets of features.
708 "numPaths": 42, # The number of feature permutations to consider when approximating the
709 # Shapley values.
710 },
711 "integratedGradientsAttribution": { # Attributes credit by computing the Aumann-Shapley value taking advantage # Attributes credit by computing the Aumann-Shapley value taking advantage
712 # of the model's fully differentiable structure. Refer to this paper for
713 # more details: http://proceedings.mlr.press/v70/sundararajan17a.html
714 # of the model's fully differentiable structure. Refer to this paper for
715 # more details: http://proceedings.mlr.press/v70/sundararajan17a.html
716 "numIntegralSteps": 42, # Number of steps for approximating the path integral.
717 # A good value to start is 50 and gradually increase until the
718 # sum to diff property is met within the desired error range.
719 },
720 },
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400721 "isDefault": True or False, # Output only. If true, this version will be used to handle prediction
722 # requests that do not specify a version.
723 #
724 # You can change the default version by calling
Dan O'Mearadd494642020-05-01 07:42:23 -0700725 # projects.methods.versions.setDefault.
726 "machineType": "A String", # Optional. The type of machine on which to serve the model. Currently only
727 # applies to online prediction service. If this field is not specified, it
728 # defaults to `mls1-c1-m2`.
729 #
730 # Online prediction supports the following machine types:
731 #
732 # * `mls1-c1-m2`
733 # * `mls1-c4-m2`
734 # * `n1-standard-2`
735 # * `n1-standard-4`
736 # * `n1-standard-8`
737 # * `n1-standard-16`
738 # * `n1-standard-32`
739 # * `n1-highmem-2`
740 # * `n1-highmem-4`
741 # * `n1-highmem-8`
742 # * `n1-highmem-16`
743 # * `n1-highmem-32`
744 # * `n1-highcpu-2`
745 # * `n1-highcpu-4`
746 # * `n1-highcpu-8`
747 # * `n1-highcpu-16`
748 # * `n1-highcpu-32`
749 #
750 # `mls1-c1-m2` is generally available. All other machine types are available
751 # in beta. Learn more about the [differences between machine
752 # types](/ml-engine/docs/machine-types-online-prediction).
753 "description": "A String", # Optional. The description specified for the version when it was created.
754 "runtimeVersion": "A String", # Required. The AI Platform runtime version to use for this deployment.
755 #
756 # For more information, see the
757 # [runtime version list](/ml-engine/docs/runtime-version-list) and
758 # [how to manage runtime versions](/ml-engine/docs/versioning).
759 "manualScaling": { # Options for manually scaling a model. # Manually select the number of nodes to use for serving the
760 # model. You should generally use `auto_scaling` with an appropriate
761 # `min_nodes` instead, but this option is available if you want more
762 # predictable billing. Beware that latency and error rates will increase
763 # if the traffic exceeds that capability of the system to serve it based
764 # on the selected number of nodes.
765 "nodes": 42, # The number of nodes to allocate for this model. These nodes are always up,
766 # starting from the time the model is deployed, so the cost of operating
767 # this model will be proportional to `nodes` * number of hours since
768 # last billing cycle plus the cost for each prediction performed.
769 },
770 "errorMessage": "A String", # Output only. The details of a failure or a cancellation.
771 "framework": "A String", # Optional. The machine learning framework AI Platform uses to train
772 # this version of the model. Valid values are `TENSORFLOW`, `SCIKIT_LEARN`,
773 # `XGBOOST`. If you do not specify a framework, AI Platform
774 # will analyze files in the deployment_uri to determine a framework. If you
775 # choose `SCIKIT_LEARN` or `XGBOOST`, you must also set the runtime version
776 # of the model to 1.4 or greater.
777 #
778 # Do **not** specify a framework if you're deploying a [custom
779 # prediction routine](/ml-engine/docs/tensorflow/custom-prediction-routines).
780 #
781 # If you specify a [Compute Engine (N1) machine
782 # type](/ml-engine/docs/machine-types-online-prediction) in the
783 # `machineType` field, you must specify `TENSORFLOW`
784 # for the framework.
785 "createTime": "A String", # Output only. The time the version was created.
786 "name": "A String", # Required. The name specified for the version when it was created.
Thomas Coffee2f245372017-03-27 10:39:26 -0700787 #
788 # The version name must be unique within the model it is created in.
Dan O'Mearadd494642020-05-01 07:42:23 -0700789 "autoScaling": { # Options for automatically scaling a model. # Automatically scale the number of nodes used to serve the model in
790 # response to increases and decreases in traffic. Care should be
791 # taken to ramp up traffic according to the model's ability to scale
792 # or you will start seeing increases in latency and 429 response codes.
793 #
794 # Note that you cannot use AutoScaling if your version uses
795 # [GPUs](#Version.FIELDS.accelerator_config). Instead, you must use specify
796 # `manual_scaling`.
797 "minNodes": 42, # Optional. The minimum number of nodes to allocate for this model. These
798 # nodes are always up, starting from the time the model is deployed.
799 # Therefore, the cost of operating this model will be at least
800 # `rate` * `min_nodes` * number of hours since last billing cycle,
801 # where `rate` is the cost per node-hour as documented in the
802 # [pricing guide](/ml-engine/docs/pricing),
803 # even if no predictions are performed. There is additional cost for each
804 # prediction performed.
805 #
806 # Unlike manual scaling, if the load gets too heavy for the nodes
807 # that are up, the service will automatically add nodes to handle the
808 # increased load as well as scale back as traffic drops, always maintaining
809 # at least `min_nodes`. You will be charged for the time in which additional
810 # nodes are used.
811 #
812 # If `min_nodes` is not specified and AutoScaling is used with a [legacy
813 # (MLS1) machine type](/ml-engine/docs/machine-types-online-prediction),
814 # `min_nodes` defaults to 0, in which case, when traffic to a model stops
815 # (and after a cool-down period), nodes will be shut down and no charges will
816 # be incurred until traffic to the model resumes.
817 #
818 # If `min_nodes` is not specified and AutoScaling is used with a [Compute
819 # Engine (N1) machine type](/ml-engine/docs/machine-types-online-prediction),
820 # `min_nodes` defaults to 1. `min_nodes` must be at least 1 for use with a
821 # Compute Engine machine type.
822 #
823 # Note that you cannot use AutoScaling if your version uses
824 # [GPUs](#Version.FIELDS.accelerator_config). Instead, you must use
825 # ManualScaling.
826 #
827 # You can set `min_nodes` when creating the model version, and you can also
828 # update `min_nodes` for an existing version:
829 # &lt;pre&gt;
830 # update_body.json:
831 # {
832 # 'autoScaling': {
833 # 'minNodes': 5
834 # }
835 # }
836 # &lt;/pre&gt;
837 # HTTP request:
838 # &lt;pre style="max-width: 626px;"&gt;
839 # PATCH
840 # https://ml.googleapis.com/v1/{name=projects/*/models/*/versions/*}?update_mask=autoScaling.minNodes
841 # -d @./update_body.json
842 # &lt;/pre&gt;
843 },
844 "pythonVersion": "A String", # Required. The version of Python used in prediction.
845 #
846 # The following Python versions are available:
847 #
848 # * Python '3.7' is available when `runtime_version` is set to '1.15' or
849 # later.
850 # * Python '3.5' is available when `runtime_version` is set to a version
851 # from '1.4' to '1.14'.
852 # * Python '2.7' is available when `runtime_version` is set to '1.15' or
853 # earlier.
854 #
855 # Read more about the Python versions available for [each runtime
856 # version](/ml-engine/docs/runtime-version-list).
857 "requestLoggingConfig": { # Configuration for logging request-response pairs to a BigQuery table. # Optional. *Only* specify this field in a
858 # projects.models.versions.patch
859 # request. Specifying it in a
860 # projects.models.versions.create
861 # request has no effect.
862 #
863 # Configures the request-response pair logging on predictions from this
864 # Version.
865 # Online prediction requests to a model version and the responses to these
866 # requests are converted to raw strings and saved to the specified BigQuery
867 # table. Logging is constrained by [BigQuery quotas and
868 # limits](/bigquery/quotas). If your project exceeds BigQuery quotas or limits,
869 # AI Platform Prediction does not log request-response pairs, but it continues
870 # to serve predictions.
871 #
872 # If you are using [continuous
873 # evaluation](/ml-engine/docs/continuous-evaluation/), you do not need to
874 # specify this configuration manually. Setting up continuous evaluation
875 # automatically enables logging of request-response pairs.
876 "samplingPercentage": 3.14, # Percentage of requests to be logged, expressed as a fraction from 0 to 1.
877 # For example, if you want to log 10% of requests, enter `0.1`. The sampling
878 # window is the lifetime of the model version. Defaults to 0.
879 "bigqueryTableName": "A String", # Required. Fully qualified BigQuery table name in the following format:
880 # "&lt;var&gt;project_id&lt;/var&gt;.&lt;var&gt;dataset_name&lt;/var&gt;.&lt;var&gt;table_name&lt;/var&gt;"
881 #
882 # The specified table must already exist, and the "Cloud ML Service Agent"
883 # for your project must have permission to write to it. The table must have
884 # the following [schema](/bigquery/docs/schemas):
885 #
886 # &lt;table&gt;
887 # &lt;tr&gt;&lt;th&gt;Field name&lt;/th&gt;&lt;th style="display: table-cell"&gt;Type&lt;/th&gt;
888 # &lt;th style="display: table-cell"&gt;Mode&lt;/th&gt;&lt;/tr&gt;
889 # &lt;tr&gt;&lt;td&gt;model&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;REQUIRED&lt;/td&gt;&lt;/tr&gt;
890 # &lt;tr&gt;&lt;td&gt;model_version&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;REQUIRED&lt;/td&gt;&lt;/tr&gt;
891 # &lt;tr&gt;&lt;td&gt;time&lt;/td&gt;&lt;td&gt;TIMESTAMP&lt;/td&gt;&lt;td&gt;REQUIRED&lt;/td&gt;&lt;/tr&gt;
892 # &lt;tr&gt;&lt;td&gt;raw_data&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;REQUIRED&lt;/td&gt;&lt;/tr&gt;
893 # &lt;tr&gt;&lt;td&gt;raw_prediction&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;NULLABLE&lt;/td&gt;&lt;/tr&gt;
894 # &lt;tr&gt;&lt;td&gt;groundtruth&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;NULLABLE&lt;/td&gt;&lt;/tr&gt;
895 # &lt;/table&gt;
896 },
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400897 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700898 "onlinePredictionLogging": True or False, # Optional. If true, online prediction access logs are sent to StackDriver
899 # Logging. These logs are like standard server access logs, containing
900 # information like timestamp and latency for each request. Note that
901 # [Stackdriver logs may incur a cost](/stackdriver/pricing), especially if
902 # your project receives prediction requests at a high queries per second rate
903 # (QPS). Estimate your costs before enabling this option.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400904 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700905 # Default is false.
Dan O'Mearadd494642020-05-01 07:42:23 -0700906 "description": "A String", # Optional. The description specified for the model when it was created.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700907 }</pre>
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400908</div>
909
910<div class="method">
Thomas Coffee2f245372017-03-27 10:39:26 -0700911 <code class="details" id="delete">delete(name, x__xgafv=None)</code>
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400912 <pre>Deletes a model.
913
914You can only delete a model if there are no versions in it. You can delete
915versions by calling
Dan O'Mearadd494642020-05-01 07:42:23 -0700916projects.models.versions.delete.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400917
918Args:
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700919 name: string, Required. The name of the model. (required)
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400920 x__xgafv: string, V1 error format.
921 Allowed values
922 1 - v1 error format
923 2 - v2 error format
924
925Returns:
926 An object of the form:
927
928 { # This resource represents a long-running operation that is the result of a
929 # network API call.
Thomas Coffee2f245372017-03-27 10:39:26 -0700930 "metadata": { # Service-specific metadata associated with the operation. It typically
931 # contains progress information and common metadata such as create time.
932 # Some services might not provide such metadata. Any method that returns a
933 # long-running operation should document the metadata type, if any.
934 "a_key": "", # Properties of the object. Contains field @type with type URL.
935 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700936 "error": { # The `Status` type defines a logical error model that is suitable for # The error result of the operation in case of failure or cancellation.
937 # different programming environments, including REST APIs and RPC APIs. It is
938 # used by [gRPC](https://github.com/grpc). Each `Status` message contains
939 # three pieces of data: error code, error message, and error details.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400940 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700941 # You can find out more about this error model and how to work with it in the
942 # [API Design Guide](https://cloud.google.com/apis/design/errors).
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400943 "message": "A String", # A developer-facing error message, which should be in English. Any
944 # user-facing error message should be localized and sent in the
945 # google.rpc.Status.details field, or localized by the client.
946 "code": 42, # The status code, which should be an enum value of google.rpc.Code.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700947 "details": [ # A list of messages that carry the error details. There is a common set of
948 # message types for APIs to use.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400949 {
950 "a_key": "", # Properties of the object. Contains field @type with type URL.
951 },
952 ],
953 },
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400954 "done": True or False, # If the value is `false`, it means the operation is still in progress.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700955 # If `true`, the operation is completed, and either `error` or `response` is
Sai Cheemalapati4ba8c232017-06-06 18:46:08 -0400956 # available.
957 "response": { # The normal response of the operation in case of success. If the original
958 # method returns no data on success, such as `Delete`, the response is
959 # `google.protobuf.Empty`. If the original method is standard
960 # `Get`/`Create`/`Update`, the response should be the resource. For other
961 # methods, the response should have the type `XxxResponse`, where `Xxx`
962 # is the original method name. For example, if the original method name
963 # is `TakeSnapshot()`, the inferred response type is
964 # `TakeSnapshotResponse`.
965 "a_key": "", # Properties of the object. Contains field @type with type URL.
966 },
967 "name": "A String", # The server-assigned name, which is only unique within the same service that
968 # originally returns it. If you use the default HTTP mapping, the
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700969 # `name` should be a resource name ending with `operations/{unique_id}`.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400970 }</pre>
971</div>
972
973<div class="method">
Thomas Coffee2f245372017-03-27 10:39:26 -0700974 <code class="details" id="get">get(name, x__xgafv=None)</code>
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400975 <pre>Gets information about a model, including its name, the description (if
976set), and the default version (if at least one version of the model has
977been deployed).
978
979Args:
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700980 name: string, Required. The name of the model. (required)
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -0400981 x__xgafv: string, V1 error format.
982 Allowed values
983 1 - v1 error format
984 2 - v2 error format
985
986Returns:
987 An object of the form:
988
989 { # Represents a machine learning solution.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700990 #
991 # A model can have multiple versions, each of which is a deployed, trained
992 # model ready to receive prediction requests. The model itself is just a
993 # container.
Dan O'Mearadd494642020-05-01 07:42:23 -0700994 "name": "A String", # Required. The name specified for the model when it was created.
995 #
996 # The model name must be unique within the project it is created in.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700997 "onlinePredictionConsoleLogging": True or False, # Optional. If true, online prediction nodes send `stderr` and `stdout`
998 # streams to Stackdriver Logging. These can be more verbose than the standard
999 # access logs (see `onlinePredictionLogging`) and can incur higher cost.
1000 # However, they are helpful for debugging. Note that
1001 # [Stackdriver logs may incur a cost](/stackdriver/pricing), especially if
1002 # your project receives prediction requests at a high QPS. Estimate your
1003 # costs before enabling this option.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -04001004 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001005 # Default is false.
1006 "labels": { # Optional. One or more labels that you can add, to organize your models.
1007 # Each label is a key-value pair, where both the key and the value are
1008 # arbitrary strings that you supply.
1009 # For more information, see the documentation on
Dan O'Mearadd494642020-05-01 07:42:23 -07001010 # &lt;a href="/ml-engine/docs/tensorflow/resource-labels"&gt;using labels&lt;/a&gt;.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001011 "a_key": "A String",
1012 },
1013 "regions": [ # Optional. The list of regions where the model is going to be deployed.
Dan O'Mearadd494642020-05-01 07:42:23 -07001014 # Only one region per model is supported.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001015 # Defaults to 'us-central1' if nothing is set.
Dan O'Mearadd494642020-05-01 07:42:23 -07001016 # See the &lt;a href="/ml-engine/docs/tensorflow/regions"&gt;available regions&lt;/a&gt;
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001017 # for AI Platform services.
1018 # Note:
1019 # * No matter where a model is deployed, it can always be accessed by
1020 # users from anywhere, both for online and batch prediction.
1021 # * The region for a batch prediction job is set by the region field when
1022 # submitting the batch prediction job and does not take its value from
1023 # this field.
1024 "A String",
1025 ],
1026 "etag": "A String", # `etag` is used for optimistic concurrency control as a way to help
1027 # prevent simultaneous updates of a model from overwriting each other.
1028 # It is strongly suggested that systems make use of the `etag` in the
1029 # read-modify-write cycle to perform model updates in order to avoid race
1030 # conditions: An `etag` is returned in the response to `GetModel`, and
1031 # systems are expected to put that etag in the request to `UpdateModel` to
1032 # ensure that their change will be applied to the model as intended.
1033 "defaultVersion": { # Represents a version of the model. # Output only. The default version of the model. This version will be used to
1034 # handle prediction requests that do not specify a version.
1035 #
1036 # You can change the default version by calling
Dan O'Mearadd494642020-05-01 07:42:23 -07001037 # projects.models.versions.setDefault.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001038 #
1039 # Each version is a trained model deployed in the cloud, ready to handle
1040 # prediction requests. A model can have multiple versions. You can get
1041 # information about all of the versions of a given model by calling
Dan O'Mearadd494642020-05-01 07:42:23 -07001042 # projects.models.versions.list.
1043 "acceleratorConfig": { # Represents a hardware accelerator request config. # Optional. Accelerator config for using GPUs for online prediction (beta).
1044 # Only specify this field if you have specified a Compute Engine (N1) machine
1045 # type in the `machineType` field. Learn more about [using GPUs for online
1046 # prediction](/ml-engine/docs/machine-types-online-prediction#gpus).
1047 # Note that the AcceleratorConfig can be used in both Jobs and Versions.
1048 # Learn more about [accelerators for training](/ml-engine/docs/using-gpus) and
1049 # [accelerators for online
1050 # prediction](/ml-engine/docs/machine-types-online-prediction#gpus).
1051 "count": "A String", # The number of accelerators to attach to each machine running the job.
1052 "type": "A String", # The type of accelerator to use.
1053 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001054 "labels": { # Optional. One or more labels that you can add, to organize your model
1055 # versions. Each label is a key-value pair, where both the key and the value
1056 # are arbitrary strings that you supply.
1057 # For more information, see the documentation on
Dan O'Mearadd494642020-05-01 07:42:23 -07001058 # &lt;a href="/ml-engine/docs/tensorflow/resource-labels"&gt;using labels&lt;/a&gt;.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001059 "a_key": "A String",
1060 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001061 "predictionClass": "A String", # Optional. The fully qualified name
Dan O'Mearadd494642020-05-01 07:42:23 -07001062 # (&lt;var&gt;module_name&lt;/var&gt;.&lt;var&gt;class_name&lt;/var&gt;) of a class that implements
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001063 # the Predictor interface described in this reference field. The module
1064 # containing this class should be included in a package provided to the
1065 # [`packageUris` field](#Version.FIELDS.package_uris).
1066 #
1067 # Specify this field if and only if you are deploying a [custom prediction
1068 # routine (beta)](/ml-engine/docs/tensorflow/custom-prediction-routines).
1069 # If you specify this field, you must set
Dan O'Mearadd494642020-05-01 07:42:23 -07001070 # [`runtimeVersion`](#Version.FIELDS.runtime_version) to 1.4 or greater and
1071 # you must set `machineType` to a [legacy (MLS1)
1072 # machine type](/ml-engine/docs/machine-types-online-prediction).
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001073 #
1074 # The following code sample provides the Predictor interface:
1075 #
Dan O'Mearadd494642020-05-01 07:42:23 -07001076 # &lt;pre style="max-width: 626px;"&gt;
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001077 # class Predictor(object):
1078 # """Interface for constructing custom predictors."""
1079 #
1080 # def predict(self, instances, **kwargs):
1081 # """Performs custom prediction.
1082 #
1083 # Instances are the decoded values from the request. They have already
1084 # been deserialized from JSON.
1085 #
1086 # Args:
1087 # instances: A list of prediction input instances.
1088 # **kwargs: A dictionary of keyword args provided as additional
1089 # fields on the predict request body.
1090 #
1091 # Returns:
1092 # A list of outputs containing the prediction results. This list must
1093 # be JSON serializable.
1094 # """
1095 # raise NotImplementedError()
1096 #
1097 # @classmethod
1098 # def from_path(cls, model_dir):
1099 # """Creates an instance of Predictor using the given path.
1100 #
1101 # Loading of the predictor should be done in this method.
1102 #
1103 # Args:
1104 # model_dir: The local directory that contains the exported model
1105 # file along with any additional files uploaded when creating the
1106 # version resource.
1107 #
1108 # Returns:
1109 # An instance implementing this Predictor class.
1110 # """
1111 # raise NotImplementedError()
Dan O'Mearadd494642020-05-01 07:42:23 -07001112 # &lt;/pre&gt;
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001113 #
1114 # Learn more about [the Predictor interface and custom prediction
1115 # routines](/ml-engine/docs/tensorflow/custom-prediction-routines).
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001116 "serviceAccount": "A String", # Optional. Specifies the service account for resource access control.
1117 "state": "A String", # Output only. The state of a version.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001118 "packageUris": [ # Optional. Cloud Storage paths (`gs://…`) of packages for [custom
1119 # prediction routines](/ml-engine/docs/tensorflow/custom-prediction-routines)
1120 # or [scikit-learn pipelines with custom
1121 # code](/ml-engine/docs/scikit/exporting-for-prediction#custom-pipeline-code).
1122 #
1123 # For a custom prediction routine, one of these packages must contain your
1124 # Predictor class (see
1125 # [`predictionClass`](#Version.FIELDS.prediction_class)). Additionally,
1126 # include any dependencies used by your Predictor or scikit-learn pipeline
1127 # uses that are not already included in your selected [runtime
1128 # version](/ml-engine/docs/tensorflow/runtime-version-list).
1129 #
1130 # If you specify this field, you must also set
1131 # [`runtimeVersion`](#Version.FIELDS.runtime_version) to 1.4 or greater.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -04001132 "A String",
1133 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001134 "etag": "A String", # `etag` is used for optimistic concurrency control as a way to help
1135 # prevent simultaneous updates of a model from overwriting each other.
1136 # It is strongly suggested that systems make use of the `etag` in the
1137 # read-modify-write cycle to perform model updates in order to avoid race
1138 # conditions: An `etag` is returned in the response to `GetVersion`, and
1139 # systems are expected to put that etag in the request to `UpdateVersion` to
1140 # ensure that their change will be applied to the model as intended.
1141 "lastUseTime": "A String", # Output only. The time the version was last used for prediction.
1142 "deploymentUri": "A String", # Required. The Cloud Storage location of the trained model used to
1143 # create the version. See the
1144 # [guide to model
1145 # deployment](/ml-engine/docs/tensorflow/deploying-models) for more
1146 # information.
1147 #
1148 # When passing Version to
Dan O'Mearadd494642020-05-01 07:42:23 -07001149 # projects.models.versions.create
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001150 # the model service uses the specified location as the source of the model.
1151 # Once deployed, the model version is hosted by the prediction service, so
1152 # this location is useful only as a historical record.
1153 # The total number of model files can't exceed 1000.
Dan O'Mearadd494642020-05-01 07:42:23 -07001154 "explanationConfig": { # Message holding configuration options for explaining model predictions. # Optional. Configures explainability features on the model's version.
1155 # Some explanation features require additional metadata to be loaded
1156 # as part of the model payload.
1157 # There are two feature attribution methods supported for TensorFlow models:
1158 # integrated gradients and sampled Shapley.
1159 # [Learn more about feature
1160 # attributions.](/ml-engine/docs/ai-explanations/overview)
1161 "xraiAttribution": { # Attributes credit by computing the XRAI taking advantage # Attributes credit by computing the XRAI taking advantage
1162 # of the model's fully differentiable structure. Refer to this paper for
1163 # more details: https://arxiv.org/abs/1906.02825
1164 # Currently only implemented for models with natural image inputs.
1165 # of the model's fully differentiable structure. Refer to this paper for
1166 # more details: https://arxiv.org/abs/1906.02825
1167 # Currently only implemented for models with natural image inputs.
1168 "numIntegralSteps": 42, # Number of steps for approximating the path integral.
1169 # A good value to start is 50 and gradually increase until the
1170 # sum to diff property is met within the desired error range.
1171 },
1172 "sampledShapleyAttribution": { # An attribution method that approximates Shapley values for features that # An attribution method that approximates Shapley values for features that
1173 # contribute to the label being predicted. A sampling strategy is used to
1174 # approximate the value rather than considering all subsets of features.
1175 # contribute to the label being predicted. A sampling strategy is used to
1176 # approximate the value rather than considering all subsets of features.
1177 "numPaths": 42, # The number of feature permutations to consider when approximating the
1178 # Shapley values.
1179 },
1180 "integratedGradientsAttribution": { # Attributes credit by computing the Aumann-Shapley value taking advantage # Attributes credit by computing the Aumann-Shapley value taking advantage
1181 # of the model's fully differentiable structure. Refer to this paper for
1182 # more details: http://proceedings.mlr.press/v70/sundararajan17a.html
1183 # of the model's fully differentiable structure. Refer to this paper for
1184 # more details: http://proceedings.mlr.press/v70/sundararajan17a.html
1185 "numIntegralSteps": 42, # Number of steps for approximating the path integral.
1186 # A good value to start is 50 and gradually increase until the
1187 # sum to diff property is met within the desired error range.
1188 },
1189 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001190 "isDefault": True or False, # Output only. If true, this version will be used to handle prediction
1191 # requests that do not specify a version.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -04001192 #
1193 # You can change the default version by calling
Dan O'Mearadd494642020-05-01 07:42:23 -07001194 # projects.methods.versions.setDefault.
1195 "machineType": "A String", # Optional. The type of machine on which to serve the model. Currently only
1196 # applies to online prediction service. If this field is not specified, it
1197 # defaults to `mls1-c1-m2`.
1198 #
1199 # Online prediction supports the following machine types:
1200 #
1201 # * `mls1-c1-m2`
1202 # * `mls1-c4-m2`
1203 # * `n1-standard-2`
1204 # * `n1-standard-4`
1205 # * `n1-standard-8`
1206 # * `n1-standard-16`
1207 # * `n1-standard-32`
1208 # * `n1-highmem-2`
1209 # * `n1-highmem-4`
1210 # * `n1-highmem-8`
1211 # * `n1-highmem-16`
1212 # * `n1-highmem-32`
1213 # * `n1-highcpu-2`
1214 # * `n1-highcpu-4`
1215 # * `n1-highcpu-8`
1216 # * `n1-highcpu-16`
1217 # * `n1-highcpu-32`
1218 #
1219 # `mls1-c1-m2` is generally available. All other machine types are available
1220 # in beta. Learn more about the [differences between machine
1221 # types](/ml-engine/docs/machine-types-online-prediction).
1222 "description": "A String", # Optional. The description specified for the version when it was created.
1223 "runtimeVersion": "A String", # Required. The AI Platform runtime version to use for this deployment.
1224 #
1225 # For more information, see the
1226 # [runtime version list](/ml-engine/docs/runtime-version-list) and
1227 # [how to manage runtime versions](/ml-engine/docs/versioning).
1228 "manualScaling": { # Options for manually scaling a model. # Manually select the number of nodes to use for serving the
1229 # model. You should generally use `auto_scaling` with an appropriate
1230 # `min_nodes` instead, but this option is available if you want more
1231 # predictable billing. Beware that latency and error rates will increase
1232 # if the traffic exceeds that capability of the system to serve it based
1233 # on the selected number of nodes.
1234 "nodes": 42, # The number of nodes to allocate for this model. These nodes are always up,
1235 # starting from the time the model is deployed, so the cost of operating
1236 # this model will be proportional to `nodes` * number of hours since
1237 # last billing cycle plus the cost for each prediction performed.
1238 },
1239 "errorMessage": "A String", # Output only. The details of a failure or a cancellation.
1240 "framework": "A String", # Optional. The machine learning framework AI Platform uses to train
1241 # this version of the model. Valid values are `TENSORFLOW`, `SCIKIT_LEARN`,
1242 # `XGBOOST`. If you do not specify a framework, AI Platform
1243 # will analyze files in the deployment_uri to determine a framework. If you
1244 # choose `SCIKIT_LEARN` or `XGBOOST`, you must also set the runtime version
1245 # of the model to 1.4 or greater.
1246 #
1247 # Do **not** specify a framework if you're deploying a [custom
1248 # prediction routine](/ml-engine/docs/tensorflow/custom-prediction-routines).
1249 #
1250 # If you specify a [Compute Engine (N1) machine
1251 # type](/ml-engine/docs/machine-types-online-prediction) in the
1252 # `machineType` field, you must specify `TENSORFLOW`
1253 # for the framework.
1254 "createTime": "A String", # Output only. The time the version was created.
1255 "name": "A String", # Required. The name specified for the version when it was created.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -04001256 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001257 # The version name must be unique within the model it is created in.
Dan O'Mearadd494642020-05-01 07:42:23 -07001258 "autoScaling": { # Options for automatically scaling a model. # Automatically scale the number of nodes used to serve the model in
1259 # response to increases and decreases in traffic. Care should be
1260 # taken to ramp up traffic according to the model's ability to scale
1261 # or you will start seeing increases in latency and 429 response codes.
1262 #
1263 # Note that you cannot use AutoScaling if your version uses
1264 # [GPUs](#Version.FIELDS.accelerator_config). Instead, you must use specify
1265 # `manual_scaling`.
1266 "minNodes": 42, # Optional. The minimum number of nodes to allocate for this model. These
1267 # nodes are always up, starting from the time the model is deployed.
1268 # Therefore, the cost of operating this model will be at least
1269 # `rate` * `min_nodes` * number of hours since last billing cycle,
1270 # where `rate` is the cost per node-hour as documented in the
1271 # [pricing guide](/ml-engine/docs/pricing),
1272 # even if no predictions are performed. There is additional cost for each
1273 # prediction performed.
1274 #
1275 # Unlike manual scaling, if the load gets too heavy for the nodes
1276 # that are up, the service will automatically add nodes to handle the
1277 # increased load as well as scale back as traffic drops, always maintaining
1278 # at least `min_nodes`. You will be charged for the time in which additional
1279 # nodes are used.
1280 #
1281 # If `min_nodes` is not specified and AutoScaling is used with a [legacy
1282 # (MLS1) machine type](/ml-engine/docs/machine-types-online-prediction),
1283 # `min_nodes` defaults to 0, in which case, when traffic to a model stops
1284 # (and after a cool-down period), nodes will be shut down and no charges will
1285 # be incurred until traffic to the model resumes.
1286 #
1287 # If `min_nodes` is not specified and AutoScaling is used with a [Compute
1288 # Engine (N1) machine type](/ml-engine/docs/machine-types-online-prediction),
1289 # `min_nodes` defaults to 1. `min_nodes` must be at least 1 for use with a
1290 # Compute Engine machine type.
1291 #
1292 # Note that you cannot use AutoScaling if your version uses
1293 # [GPUs](#Version.FIELDS.accelerator_config). Instead, you must use
1294 # ManualScaling.
1295 #
1296 # You can set `min_nodes` when creating the model version, and you can also
1297 # update `min_nodes` for an existing version:
1298 # &lt;pre&gt;
1299 # update_body.json:
1300 # {
1301 # 'autoScaling': {
1302 # 'minNodes': 5
1303 # }
1304 # }
1305 # &lt;/pre&gt;
1306 # HTTP request:
1307 # &lt;pre style="max-width: 626px;"&gt;
1308 # PATCH
1309 # https://ml.googleapis.com/v1/{name=projects/*/models/*/versions/*}?update_mask=autoScaling.minNodes
1310 # -d @./update_body.json
1311 # &lt;/pre&gt;
1312 },
1313 "pythonVersion": "A String", # Required. The version of Python used in prediction.
1314 #
1315 # The following Python versions are available:
1316 #
1317 # * Python '3.7' is available when `runtime_version` is set to '1.15' or
1318 # later.
1319 # * Python '3.5' is available when `runtime_version` is set to a version
1320 # from '1.4' to '1.14'.
1321 # * Python '2.7' is available when `runtime_version` is set to '1.15' or
1322 # earlier.
1323 #
1324 # Read more about the Python versions available for [each runtime
1325 # version](/ml-engine/docs/runtime-version-list).
1326 "requestLoggingConfig": { # Configuration for logging request-response pairs to a BigQuery table. # Optional. *Only* specify this field in a
1327 # projects.models.versions.patch
1328 # request. Specifying it in a
1329 # projects.models.versions.create
1330 # request has no effect.
1331 #
1332 # Configures the request-response pair logging on predictions from this
1333 # Version.
1334 # Online prediction requests to a model version and the responses to these
1335 # requests are converted to raw strings and saved to the specified BigQuery
1336 # table. Logging is constrained by [BigQuery quotas and
1337 # limits](/bigquery/quotas). If your project exceeds BigQuery quotas or limits,
1338 # AI Platform Prediction does not log request-response pairs, but it continues
1339 # to serve predictions.
1340 #
1341 # If you are using [continuous
1342 # evaluation](/ml-engine/docs/continuous-evaluation/), you do not need to
1343 # specify this configuration manually. Setting up continuous evaluation
1344 # automatically enables logging of request-response pairs.
1345 "samplingPercentage": 3.14, # Percentage of requests to be logged, expressed as a fraction from 0 to 1.
1346 # For example, if you want to log 10% of requests, enter `0.1`. The sampling
1347 # window is the lifetime of the model version. Defaults to 0.
1348 "bigqueryTableName": "A String", # Required. Fully qualified BigQuery table name in the following format:
1349 # "&lt;var&gt;project_id&lt;/var&gt;.&lt;var&gt;dataset_name&lt;/var&gt;.&lt;var&gt;table_name&lt;/var&gt;"
1350 #
1351 # The specified table must already exist, and the "Cloud ML Service Agent"
1352 # for your project must have permission to write to it. The table must have
1353 # the following [schema](/bigquery/docs/schemas):
1354 #
1355 # &lt;table&gt;
1356 # &lt;tr&gt;&lt;th&gt;Field name&lt;/th&gt;&lt;th style="display: table-cell"&gt;Type&lt;/th&gt;
1357 # &lt;th style="display: table-cell"&gt;Mode&lt;/th&gt;&lt;/tr&gt;
1358 # &lt;tr&gt;&lt;td&gt;model&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;REQUIRED&lt;/td&gt;&lt;/tr&gt;
1359 # &lt;tr&gt;&lt;td&gt;model_version&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;REQUIRED&lt;/td&gt;&lt;/tr&gt;
1360 # &lt;tr&gt;&lt;td&gt;time&lt;/td&gt;&lt;td&gt;TIMESTAMP&lt;/td&gt;&lt;td&gt;REQUIRED&lt;/td&gt;&lt;/tr&gt;
1361 # &lt;tr&gt;&lt;td&gt;raw_data&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;REQUIRED&lt;/td&gt;&lt;/tr&gt;
1362 # &lt;tr&gt;&lt;td&gt;raw_prediction&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;NULLABLE&lt;/td&gt;&lt;/tr&gt;
1363 # &lt;tr&gt;&lt;td&gt;groundtruth&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;NULLABLE&lt;/td&gt;&lt;/tr&gt;
1364 # &lt;/table&gt;
1365 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001366 },
1367 "onlinePredictionLogging": True or False, # Optional. If true, online prediction access logs are sent to StackDriver
1368 # Logging. These logs are like standard server access logs, containing
1369 # information like timestamp and latency for each request. Note that
1370 # [Stackdriver logs may incur a cost](/stackdriver/pricing), especially if
1371 # your project receives prediction requests at a high queries per second rate
1372 # (QPS). Estimate your costs before enabling this option.
1373 #
1374 # Default is false.
Dan O'Mearadd494642020-05-01 07:42:23 -07001375 "description": "A String", # Optional. The description specified for the model when it was created.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001376 }</pre>
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -04001377</div>
1378
1379<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -07001380 <code class="details" id="getIamPolicy">getIamPolicy(resource, options_requestedPolicyVersion=None, x__xgafv=None)</code>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001381 <pre>Gets the access control policy for a resource.
1382Returns an empty policy if the resource exists and does not have a policy
1383set.
1384
1385Args:
1386 resource: string, REQUIRED: The resource for which the policy is being requested.
1387See the operation documentation for the appropriate value for this field. (required)
Dan O'Mearadd494642020-05-01 07:42:23 -07001388 options_requestedPolicyVersion: integer, Optional. The policy format version to be returned.
1389
1390Valid values are 0, 1, and 3. Requests specifying an invalid value will be
1391rejected.
1392
1393Requests for policies with any conditional bindings must specify version 3.
1394Policies without any conditional bindings may specify any valid value or
1395leave the field unset.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001396 x__xgafv: string, V1 error format.
1397 Allowed values
1398 1 - v1 error format
1399 2 - v2 error format
1400
1401Returns:
1402 An object of the form:
1403
Dan O'Mearadd494642020-05-01 07:42:23 -07001404 { # An Identity and Access Management (IAM) policy, which specifies access
1405 # controls for Google Cloud resources.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001406 #
1407 #
Dan O'Mearadd494642020-05-01 07:42:23 -07001408 # A `Policy` is a collection of `bindings`. A `binding` binds one or more
1409 # `members` to a single `role`. Members can be user accounts, service accounts,
1410 # Google groups, and domains (such as G Suite). A `role` is a named list of
1411 # permissions; each `role` can be an IAM predefined role or a user-created
1412 # custom role.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001413 #
Dan O'Mearadd494642020-05-01 07:42:23 -07001414 # Optionally, a `binding` can specify a `condition`, which is a logical
1415 # expression that allows access to a resource only if the expression evaluates
1416 # to `true`. A condition can add constraints based on attributes of the
1417 # request, the resource, or both.
1418 #
1419 # **JSON example:**
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001420 #
1421 # {
1422 # "bindings": [
1423 # {
Dan O'Mearadd494642020-05-01 07:42:23 -07001424 # "role": "roles/resourcemanager.organizationAdmin",
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001425 # "members": [
1426 # "user:mike@example.com",
1427 # "group:admins@example.com",
1428 # "domain:google.com",
Dan O'Mearadd494642020-05-01 07:42:23 -07001429 # "serviceAccount:my-project-id@appspot.gserviceaccount.com"
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001430 # ]
1431 # },
1432 # {
Dan O'Mearadd494642020-05-01 07:42:23 -07001433 # "role": "roles/resourcemanager.organizationViewer",
1434 # "members": ["user:eve@example.com"],
1435 # "condition": {
1436 # "title": "expirable access",
1437 # "description": "Does not grant access after Sep 2020",
1438 # "expression": "request.time &lt; timestamp('2020-10-01T00:00:00.000Z')",
1439 # }
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001440 # }
Dan O'Mearadd494642020-05-01 07:42:23 -07001441 # ],
1442 # "etag": "BwWWja0YfJA=",
1443 # "version": 3
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001444 # }
1445 #
Dan O'Mearadd494642020-05-01 07:42:23 -07001446 # **YAML example:**
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001447 #
1448 # bindings:
1449 # - members:
1450 # - user:mike@example.com
1451 # - group:admins@example.com
1452 # - domain:google.com
Dan O'Mearadd494642020-05-01 07:42:23 -07001453 # - serviceAccount:my-project-id@appspot.gserviceaccount.com
1454 # role: roles/resourcemanager.organizationAdmin
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001455 # - members:
Dan O'Mearadd494642020-05-01 07:42:23 -07001456 # - user:eve@example.com
1457 # role: roles/resourcemanager.organizationViewer
1458 # condition:
1459 # title: expirable access
1460 # description: Does not grant access after Sep 2020
1461 # expression: request.time &lt; timestamp('2020-10-01T00:00:00.000Z')
1462 # - etag: BwWWja0YfJA=
1463 # - version: 3
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001464 #
1465 # For a description of IAM and its features, see the
Dan O'Mearadd494642020-05-01 07:42:23 -07001466 # [IAM documentation](https://cloud.google.com/iam/docs/).
1467 "bindings": [ # Associates a list of `members` to a `role`. Optionally, may specify a
1468 # `condition` that determines how and when the `bindings` are applied. Each
1469 # of the `bindings` must contain at least one member.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001470 { # Associates `members` with a `role`.
1471 "role": "A String", # Role that is assigned to `members`.
1472 # For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
1473 "members": [ # Specifies the identities requesting access for a Cloud Platform resource.
1474 # `members` can have the following values:
1475 #
1476 # * `allUsers`: A special identifier that represents anyone who is
1477 # on the internet; with or without a Google account.
1478 #
1479 # * `allAuthenticatedUsers`: A special identifier that represents anyone
1480 # who is authenticated with a Google account or a service account.
1481 #
1482 # * `user:{emailid}`: An email address that represents a specific Google
Dan O'Mearadd494642020-05-01 07:42:23 -07001483 # account. For example, `alice@example.com` .
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001484 #
1485 #
1486 # * `serviceAccount:{emailid}`: An email address that represents a service
1487 # account. For example, `my-other-app@appspot.gserviceaccount.com`.
1488 #
1489 # * `group:{emailid}`: An email address that represents a Google group.
1490 # For example, `admins@example.com`.
1491 #
Dan O'Mearadd494642020-05-01 07:42:23 -07001492 # * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique
1493 # identifier) representing a user that has been recently deleted. For
1494 # example, `alice@example.com?uid=123456789012345678901`. If the user is
1495 # recovered, this value reverts to `user:{emailid}` and the recovered user
1496 # retains the role in the binding.
1497 #
1498 # * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus
1499 # unique identifier) representing a service account that has been recently
1500 # deleted. For example,
1501 # `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`.
1502 # If the service account is undeleted, this value reverts to
1503 # `serviceAccount:{emailid}` and the undeleted service account retains the
1504 # role in the binding.
1505 #
1506 # * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique
1507 # identifier) representing a Google group that has been recently
1508 # deleted. For example, `admins@example.com?uid=123456789012345678901`. If
1509 # the group is recovered, this value reverts to `group:{emailid}` and the
1510 # recovered group retains the role in the binding.
1511 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001512 #
1513 # * `domain:{domain}`: The G Suite domain (primary) that represents all the
1514 # users of that domain. For example, `google.com` or `example.com`.
1515 #
1516 "A String",
1517 ],
Dan O'Mearadd494642020-05-01 07:42:23 -07001518 "condition": { # Represents a textual expression in the Common Expression Language (CEL) # The condition that is associated with this binding.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001519 # NOTE: An unsatisfied condition will not allow user access via current
1520 # binding. Different bindings, including their conditions, are examined
1521 # independently.
Dan O'Mearadd494642020-05-01 07:42:23 -07001522 # syntax. CEL is a C-like expression language. The syntax and semantics of CEL
1523 # are documented at https://github.com/google/cel-spec.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001524 #
Dan O'Mearadd494642020-05-01 07:42:23 -07001525 # Example (Comparison):
1526 #
1527 # title: "Summary size limit"
1528 # description: "Determines if a summary is less than 100 chars"
1529 # expression: "document.summary.size() &lt; 100"
1530 #
1531 # Example (Equality):
1532 #
1533 # title: "Requestor is owner"
1534 # description: "Determines if requestor is the document owner"
1535 # expression: "document.owner == request.auth.claims.email"
1536 #
1537 # Example (Logic):
1538 #
1539 # title: "Public documents"
1540 # description: "Determine whether the document should be publicly visible"
1541 # expression: "document.type != 'private' &amp;&amp; document.type != 'internal'"
1542 #
1543 # Example (Data Manipulation):
1544 #
1545 # title: "Notification string"
1546 # description: "Create a notification string with a timestamp."
1547 # expression: "'New message received at ' + string(document.create_time)"
1548 #
1549 # The exact variables and functions that may be referenced within an expression
1550 # are determined by the service that evaluates it. See the service
1551 # documentation for additional information.
1552 "description": "A String", # Optional. Description of the expression. This is a longer text which
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001553 # describes the expression, e.g. when hovered over it in a UI.
Dan O'Mearadd494642020-05-01 07:42:23 -07001554 "expression": "A String", # Textual representation of an expression in Common Expression Language
1555 # syntax.
1556 "location": "A String", # Optional. String indicating the location of the expression for error
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001557 # reporting, e.g. a file name and a position in the file.
Dan O'Mearadd494642020-05-01 07:42:23 -07001558 "title": "A String", # Optional. Title for the expression, i.e. a short string describing
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001559 # its purpose. This can be used e.g. in UIs which allow to enter the
1560 # expression.
1561 },
1562 },
1563 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001564 "auditConfigs": [ # Specifies cloud audit logging configuration for this policy.
1565 { # Specifies the audit configuration for a service.
1566 # The configuration determines which permission types are logged, and what
1567 # identities, if any, are exempted from logging.
1568 # An AuditConfig must have one or more AuditLogConfigs.
1569 #
1570 # If there are AuditConfigs for both `allServices` and a specific service,
1571 # the union of the two AuditConfigs is used for that service: the log_types
1572 # specified in each AuditConfig are enabled, and the exempted_members in each
1573 # AuditLogConfig are exempted.
1574 #
1575 # Example Policy with multiple AuditConfigs:
1576 #
1577 # {
1578 # "audit_configs": [
1579 # {
1580 # "service": "allServices"
1581 # "audit_log_configs": [
1582 # {
1583 # "log_type": "DATA_READ",
1584 # "exempted_members": [
Dan O'Mearadd494642020-05-01 07:42:23 -07001585 # "user:jose@example.com"
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001586 # ]
1587 # },
1588 # {
1589 # "log_type": "DATA_WRITE",
1590 # },
1591 # {
1592 # "log_type": "ADMIN_READ",
1593 # }
1594 # ]
1595 # },
1596 # {
Dan O'Mearadd494642020-05-01 07:42:23 -07001597 # "service": "sampleservice.googleapis.com"
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001598 # "audit_log_configs": [
1599 # {
1600 # "log_type": "DATA_READ",
1601 # },
1602 # {
1603 # "log_type": "DATA_WRITE",
1604 # "exempted_members": [
Dan O'Mearadd494642020-05-01 07:42:23 -07001605 # "user:aliya@example.com"
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001606 # ]
1607 # }
1608 # ]
1609 # }
1610 # ]
1611 # }
1612 #
Dan O'Mearadd494642020-05-01 07:42:23 -07001613 # For sampleservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ
1614 # logging. It also exempts jose@example.com from DATA_READ logging, and
1615 # aliya@example.com from DATA_WRITE logging.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001616 "auditLogConfigs": [ # The configuration for logging of each type of permission.
1617 { # Provides the configuration for logging a type of permissions.
1618 # Example:
1619 #
1620 # {
1621 # "audit_log_configs": [
1622 # {
1623 # "log_type": "DATA_READ",
1624 # "exempted_members": [
Dan O'Mearadd494642020-05-01 07:42:23 -07001625 # "user:jose@example.com"
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001626 # ]
1627 # },
1628 # {
1629 # "log_type": "DATA_WRITE",
1630 # }
1631 # ]
1632 # }
1633 #
1634 # This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting
Dan O'Mearadd494642020-05-01 07:42:23 -07001635 # jose@example.com from DATA_READ logging.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001636 "exemptedMembers": [ # Specifies the identities that do not cause logging for this type of
1637 # permission.
1638 # Follows the same format of Binding.members.
1639 "A String",
1640 ],
1641 "logType": "A String", # The log type that this config enables.
1642 },
1643 ],
1644 "service": "A String", # Specifies a service that will be enabled for audit logging.
1645 # For example, `storage.googleapis.com`, `cloudsql.googleapis.com`.
1646 # `allServices` is a special value that covers all services.
1647 },
1648 ],
Dan O'Mearadd494642020-05-01 07:42:23 -07001649 "etag": "A String", # `etag` is used for optimistic concurrency control as a way to help
1650 # prevent simultaneous updates of a policy from overwriting each other.
1651 # It is strongly suggested that systems make use of the `etag` in the
1652 # read-modify-write cycle to perform policy updates in order to avoid race
1653 # conditions: An `etag` is returned in the response to `getIamPolicy`, and
1654 # systems are expected to put that etag in the request to `setIamPolicy` to
1655 # ensure that their change will be applied to the same version of the policy.
1656 #
1657 # **Important:** If you use IAM Conditions, you must include the `etag` field
1658 # whenever you call `setIamPolicy`. If you omit this field, then IAM allows
1659 # you to overwrite a version `3` policy with a version `1` policy, and all of
1660 # the conditions in the version `3` policy are lost.
1661 "version": 42, # Specifies the format of the policy.
1662 #
1663 # Valid values are `0`, `1`, and `3`. Requests that specify an invalid value
1664 # are rejected.
1665 #
1666 # Any operation that affects conditional role bindings must specify version
1667 # `3`. This requirement applies to the following operations:
1668 #
1669 # * Getting a policy that includes a conditional role binding
1670 # * Adding a conditional role binding to a policy
1671 # * Changing a conditional role binding in a policy
1672 # * Removing any role binding, with or without a condition, from a policy
1673 # that includes conditions
1674 #
1675 # **Important:** If you use IAM Conditions, you must include the `etag` field
1676 # whenever you call `setIamPolicy`. If you omit this field, then IAM allows
1677 # you to overwrite a version `3` policy with a version `1` policy, and all of
1678 # the conditions in the version `3` policy are lost.
1679 #
1680 # If a policy does not include any conditions, operations on that policy may
1681 # specify any valid version or leave the field unset.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001682 }</pre>
1683</div>
1684
1685<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -07001686 <code class="details" id="list">list(parent, pageSize=None, pageToken=None, x__xgafv=None, filter=None)</code>
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -04001687 <pre>Lists the models in a project.
1688
1689Each project can contain multiple models, and each model can have multiple
1690versions.
1691
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001692If there are no models that match the request parameters, the list request
1693returns an empty response body: {}.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -04001694
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001695Args:
1696 parent: string, Required. The name of the project whose models are to be listed. (required)
Dan O'Mearadd494642020-05-01 07:42:23 -07001697 pageSize: integer, Optional. The number of models to retrieve per "page" of results. If there
1698are more remaining results than this number, the response message will
1699contain a valid value in the `next_page_token` field.
1700
1701The default value is 20, and the maximum page size is 100.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -04001702 pageToken: string, Optional. A page token to request the next page of results.
1703
1704You get the token from the `next_page_token` field of the response from
1705the previous call.
1706 x__xgafv: string, V1 error format.
1707 Allowed values
1708 1 - v1 error format
1709 2 - v2 error format
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001710 filter: string, Optional. Specifies the subset of models to retrieve.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -04001711
1712Returns:
1713 An object of the form:
1714
1715 { # Response message for the ListModels method.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001716 "nextPageToken": "A String", # Optional. Pass this token as the `page_token` field of the request for a
1717 # subsequent call.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -04001718 "models": [ # The list of models.
1719 { # Represents a machine learning solution.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001720 #
1721 # A model can have multiple versions, each of which is a deployed, trained
1722 # model ready to receive prediction requests. The model itself is just a
1723 # container.
Dan O'Mearadd494642020-05-01 07:42:23 -07001724 "name": "A String", # Required. The name specified for the model when it was created.
1725 #
1726 # The model name must be unique within the project it is created in.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001727 "onlinePredictionConsoleLogging": True or False, # Optional. If true, online prediction nodes send `stderr` and `stdout`
1728 # streams to Stackdriver Logging. These can be more verbose than the standard
1729 # access logs (see `onlinePredictionLogging`) and can incur higher cost.
1730 # However, they are helpful for debugging. Note that
1731 # [Stackdriver logs may incur a cost](/stackdriver/pricing), especially if
1732 # your project receives prediction requests at a high QPS. Estimate your
1733 # costs before enabling this option.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -04001734 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001735 # Default is false.
1736 "labels": { # Optional. One or more labels that you can add, to organize your models.
1737 # Each label is a key-value pair, where both the key and the value are
1738 # arbitrary strings that you supply.
1739 # For more information, see the documentation on
Dan O'Mearadd494642020-05-01 07:42:23 -07001740 # &lt;a href="/ml-engine/docs/tensorflow/resource-labels"&gt;using labels&lt;/a&gt;.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001741 "a_key": "A String",
1742 },
1743 "regions": [ # Optional. The list of regions where the model is going to be deployed.
Dan O'Mearadd494642020-05-01 07:42:23 -07001744 # Only one region per model is supported.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001745 # Defaults to 'us-central1' if nothing is set.
Dan O'Mearadd494642020-05-01 07:42:23 -07001746 # See the &lt;a href="/ml-engine/docs/tensorflow/regions"&gt;available regions&lt;/a&gt;
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001747 # for AI Platform services.
1748 # Note:
1749 # * No matter where a model is deployed, it can always be accessed by
1750 # users from anywhere, both for online and batch prediction.
1751 # * The region for a batch prediction job is set by the region field when
1752 # submitting the batch prediction job and does not take its value from
1753 # this field.
1754 "A String",
1755 ],
1756 "etag": "A String", # `etag` is used for optimistic concurrency control as a way to help
1757 # prevent simultaneous updates of a model from overwriting each other.
1758 # It is strongly suggested that systems make use of the `etag` in the
1759 # read-modify-write cycle to perform model updates in order to avoid race
1760 # conditions: An `etag` is returned in the response to `GetModel`, and
1761 # systems are expected to put that etag in the request to `UpdateModel` to
1762 # ensure that their change will be applied to the model as intended.
1763 "defaultVersion": { # Represents a version of the model. # Output only. The default version of the model. This version will be used to
1764 # handle prediction requests that do not specify a version.
1765 #
1766 # You can change the default version by calling
Dan O'Mearadd494642020-05-01 07:42:23 -07001767 # projects.models.versions.setDefault.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001768 #
1769 # Each version is a trained model deployed in the cloud, ready to handle
1770 # prediction requests. A model can have multiple versions. You can get
1771 # information about all of the versions of a given model by calling
Dan O'Mearadd494642020-05-01 07:42:23 -07001772 # projects.models.versions.list.
1773 "acceleratorConfig": { # Represents a hardware accelerator request config. # Optional. Accelerator config for using GPUs for online prediction (beta).
1774 # Only specify this field if you have specified a Compute Engine (N1) machine
1775 # type in the `machineType` field. Learn more about [using GPUs for online
1776 # prediction](/ml-engine/docs/machine-types-online-prediction#gpus).
1777 # Note that the AcceleratorConfig can be used in both Jobs and Versions.
1778 # Learn more about [accelerators for training](/ml-engine/docs/using-gpus) and
1779 # [accelerators for online
1780 # prediction](/ml-engine/docs/machine-types-online-prediction#gpus).
1781 "count": "A String", # The number of accelerators to attach to each machine running the job.
1782 "type": "A String", # The type of accelerator to use.
1783 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001784 "labels": { # Optional. One or more labels that you can add, to organize your model
1785 # versions. Each label is a key-value pair, where both the key and the value
1786 # are arbitrary strings that you supply.
1787 # For more information, see the documentation on
Dan O'Mearadd494642020-05-01 07:42:23 -07001788 # &lt;a href="/ml-engine/docs/tensorflow/resource-labels"&gt;using labels&lt;/a&gt;.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001789 "a_key": "A String",
1790 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001791 "predictionClass": "A String", # Optional. The fully qualified name
Dan O'Mearadd494642020-05-01 07:42:23 -07001792 # (&lt;var&gt;module_name&lt;/var&gt;.&lt;var&gt;class_name&lt;/var&gt;) of a class that implements
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001793 # the Predictor interface described in this reference field. The module
1794 # containing this class should be included in a package provided to the
1795 # [`packageUris` field](#Version.FIELDS.package_uris).
1796 #
1797 # Specify this field if and only if you are deploying a [custom prediction
1798 # routine (beta)](/ml-engine/docs/tensorflow/custom-prediction-routines).
1799 # If you specify this field, you must set
Dan O'Mearadd494642020-05-01 07:42:23 -07001800 # [`runtimeVersion`](#Version.FIELDS.runtime_version) to 1.4 or greater and
1801 # you must set `machineType` to a [legacy (MLS1)
1802 # machine type](/ml-engine/docs/machine-types-online-prediction).
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001803 #
1804 # The following code sample provides the Predictor interface:
1805 #
Dan O'Mearadd494642020-05-01 07:42:23 -07001806 # &lt;pre style="max-width: 626px;"&gt;
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001807 # class Predictor(object):
1808 # """Interface for constructing custom predictors."""
1809 #
1810 # def predict(self, instances, **kwargs):
1811 # """Performs custom prediction.
1812 #
1813 # Instances are the decoded values from the request. They have already
1814 # been deserialized from JSON.
1815 #
1816 # Args:
1817 # instances: A list of prediction input instances.
1818 # **kwargs: A dictionary of keyword args provided as additional
1819 # fields on the predict request body.
1820 #
1821 # Returns:
1822 # A list of outputs containing the prediction results. This list must
1823 # be JSON serializable.
1824 # """
1825 # raise NotImplementedError()
1826 #
1827 # @classmethod
1828 # def from_path(cls, model_dir):
1829 # """Creates an instance of Predictor using the given path.
1830 #
1831 # Loading of the predictor should be done in this method.
1832 #
1833 # Args:
1834 # model_dir: The local directory that contains the exported model
1835 # file along with any additional files uploaded when creating the
1836 # version resource.
1837 #
1838 # Returns:
1839 # An instance implementing this Predictor class.
1840 # """
1841 # raise NotImplementedError()
Dan O'Mearadd494642020-05-01 07:42:23 -07001842 # &lt;/pre&gt;
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001843 #
1844 # Learn more about [the Predictor interface and custom prediction
1845 # routines](/ml-engine/docs/tensorflow/custom-prediction-routines).
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001846 "serviceAccount": "A String", # Optional. Specifies the service account for resource access control.
1847 "state": "A String", # Output only. The state of a version.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001848 "packageUris": [ # Optional. Cloud Storage paths (`gs://…`) of packages for [custom
1849 # prediction routines](/ml-engine/docs/tensorflow/custom-prediction-routines)
1850 # or [scikit-learn pipelines with custom
1851 # code](/ml-engine/docs/scikit/exporting-for-prediction#custom-pipeline-code).
1852 #
1853 # For a custom prediction routine, one of these packages must contain your
1854 # Predictor class (see
1855 # [`predictionClass`](#Version.FIELDS.prediction_class)). Additionally,
1856 # include any dependencies used by your Predictor or scikit-learn pipeline
1857 # uses that are not already included in your selected [runtime
1858 # version](/ml-engine/docs/tensorflow/runtime-version-list).
1859 #
1860 # If you specify this field, you must also set
1861 # [`runtimeVersion`](#Version.FIELDS.runtime_version) to 1.4 or greater.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -04001862 "A String",
1863 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001864 "etag": "A String", # `etag` is used for optimistic concurrency control as a way to help
1865 # prevent simultaneous updates of a model from overwriting each other.
1866 # It is strongly suggested that systems make use of the `etag` in the
1867 # read-modify-write cycle to perform model updates in order to avoid race
1868 # conditions: An `etag` is returned in the response to `GetVersion`, and
1869 # systems are expected to put that etag in the request to `UpdateVersion` to
1870 # ensure that their change will be applied to the model as intended.
1871 "lastUseTime": "A String", # Output only. The time the version was last used for prediction.
1872 "deploymentUri": "A String", # Required. The Cloud Storage location of the trained model used to
1873 # create the version. See the
1874 # [guide to model
1875 # deployment](/ml-engine/docs/tensorflow/deploying-models) for more
1876 # information.
1877 #
1878 # When passing Version to
Dan O'Mearadd494642020-05-01 07:42:23 -07001879 # projects.models.versions.create
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001880 # the model service uses the specified location as the source of the model.
1881 # Once deployed, the model version is hosted by the prediction service, so
1882 # this location is useful only as a historical record.
1883 # The total number of model files can't exceed 1000.
Dan O'Mearadd494642020-05-01 07:42:23 -07001884 "explanationConfig": { # Message holding configuration options for explaining model predictions. # Optional. Configures explainability features on the model's version.
1885 # Some explanation features require additional metadata to be loaded
1886 # as part of the model payload.
1887 # There are two feature attribution methods supported for TensorFlow models:
1888 # integrated gradients and sampled Shapley.
1889 # [Learn more about feature
1890 # attributions.](/ml-engine/docs/ai-explanations/overview)
1891 "xraiAttribution": { # Attributes credit by computing the XRAI taking advantage # Attributes credit by computing the XRAI taking advantage
1892 # of the model's fully differentiable structure. Refer to this paper for
1893 # more details: https://arxiv.org/abs/1906.02825
1894 # Currently only implemented for models with natural image inputs.
1895 # of the model's fully differentiable structure. Refer to this paper for
1896 # more details: https://arxiv.org/abs/1906.02825
1897 # Currently only implemented for models with natural image inputs.
1898 "numIntegralSteps": 42, # Number of steps for approximating the path integral.
1899 # A good value to start is 50 and gradually increase until the
1900 # sum to diff property is met within the desired error range.
1901 },
1902 "sampledShapleyAttribution": { # An attribution method that approximates Shapley values for features that # An attribution method that approximates Shapley values for features that
1903 # contribute to the label being predicted. A sampling strategy is used to
1904 # approximate the value rather than considering all subsets of features.
1905 # contribute to the label being predicted. A sampling strategy is used to
1906 # approximate the value rather than considering all subsets of features.
1907 "numPaths": 42, # The number of feature permutations to consider when approximating the
1908 # Shapley values.
1909 },
1910 "integratedGradientsAttribution": { # Attributes credit by computing the Aumann-Shapley value taking advantage # Attributes credit by computing the Aumann-Shapley value taking advantage
1911 # of the model's fully differentiable structure. Refer to this paper for
1912 # more details: http://proceedings.mlr.press/v70/sundararajan17a.html
1913 # of the model's fully differentiable structure. Refer to this paper for
1914 # more details: http://proceedings.mlr.press/v70/sundararajan17a.html
1915 "numIntegralSteps": 42, # Number of steps for approximating the path integral.
1916 # A good value to start is 50 and gradually increase until the
1917 # sum to diff property is met within the desired error range.
1918 },
1919 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001920 "isDefault": True or False, # Output only. If true, this version will be used to handle prediction
1921 # requests that do not specify a version.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -04001922 #
1923 # You can change the default version by calling
Dan O'Mearadd494642020-05-01 07:42:23 -07001924 # projects.methods.versions.setDefault.
1925 "machineType": "A String", # Optional. The type of machine on which to serve the model. Currently only
1926 # applies to online prediction service. If this field is not specified, it
1927 # defaults to `mls1-c1-m2`.
1928 #
1929 # Online prediction supports the following machine types:
1930 #
1931 # * `mls1-c1-m2`
1932 # * `mls1-c4-m2`
1933 # * `n1-standard-2`
1934 # * `n1-standard-4`
1935 # * `n1-standard-8`
1936 # * `n1-standard-16`
1937 # * `n1-standard-32`
1938 # * `n1-highmem-2`
1939 # * `n1-highmem-4`
1940 # * `n1-highmem-8`
1941 # * `n1-highmem-16`
1942 # * `n1-highmem-32`
1943 # * `n1-highcpu-2`
1944 # * `n1-highcpu-4`
1945 # * `n1-highcpu-8`
1946 # * `n1-highcpu-16`
1947 # * `n1-highcpu-32`
1948 #
1949 # `mls1-c1-m2` is generally available. All other machine types are available
1950 # in beta. Learn more about the [differences between machine
1951 # types](/ml-engine/docs/machine-types-online-prediction).
1952 "description": "A String", # Optional. The description specified for the version when it was created.
1953 "runtimeVersion": "A String", # Required. The AI Platform runtime version to use for this deployment.
1954 #
1955 # For more information, see the
1956 # [runtime version list](/ml-engine/docs/runtime-version-list) and
1957 # [how to manage runtime versions](/ml-engine/docs/versioning).
1958 "manualScaling": { # Options for manually scaling a model. # Manually select the number of nodes to use for serving the
1959 # model. You should generally use `auto_scaling` with an appropriate
1960 # `min_nodes` instead, but this option is available if you want more
1961 # predictable billing. Beware that latency and error rates will increase
1962 # if the traffic exceeds that capability of the system to serve it based
1963 # on the selected number of nodes.
1964 "nodes": 42, # The number of nodes to allocate for this model. These nodes are always up,
1965 # starting from the time the model is deployed, so the cost of operating
1966 # this model will be proportional to `nodes` * number of hours since
1967 # last billing cycle plus the cost for each prediction performed.
1968 },
1969 "errorMessage": "A String", # Output only. The details of a failure or a cancellation.
1970 "framework": "A String", # Optional. The machine learning framework AI Platform uses to train
1971 # this version of the model. Valid values are `TENSORFLOW`, `SCIKIT_LEARN`,
1972 # `XGBOOST`. If you do not specify a framework, AI Platform
1973 # will analyze files in the deployment_uri to determine a framework. If you
1974 # choose `SCIKIT_LEARN` or `XGBOOST`, you must also set the runtime version
1975 # of the model to 1.4 or greater.
1976 #
1977 # Do **not** specify a framework if you're deploying a [custom
1978 # prediction routine](/ml-engine/docs/tensorflow/custom-prediction-routines).
1979 #
1980 # If you specify a [Compute Engine (N1) machine
1981 # type](/ml-engine/docs/machine-types-online-prediction) in the
1982 # `machineType` field, you must specify `TENSORFLOW`
1983 # for the framework.
1984 "createTime": "A String", # Output only. The time the version was created.
1985 "name": "A String", # Required. The name specified for the version when it was created.
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -04001986 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001987 # The version name must be unique within the model it is created in.
Dan O'Mearadd494642020-05-01 07:42:23 -07001988 "autoScaling": { # Options for automatically scaling a model. # Automatically scale the number of nodes used to serve the model in
1989 # response to increases and decreases in traffic. Care should be
1990 # taken to ramp up traffic according to the model's ability to scale
1991 # or you will start seeing increases in latency and 429 response codes.
1992 #
1993 # Note that you cannot use AutoScaling if your version uses
1994 # [GPUs](#Version.FIELDS.accelerator_config). Instead, you must use specify
1995 # `manual_scaling`.
1996 "minNodes": 42, # Optional. The minimum number of nodes to allocate for this model. These
1997 # nodes are always up, starting from the time the model is deployed.
1998 # Therefore, the cost of operating this model will be at least
1999 # `rate` * `min_nodes` * number of hours since last billing cycle,
2000 # where `rate` is the cost per node-hour as documented in the
2001 # [pricing guide](/ml-engine/docs/pricing),
2002 # even if no predictions are performed. There is additional cost for each
2003 # prediction performed.
2004 #
2005 # Unlike manual scaling, if the load gets too heavy for the nodes
2006 # that are up, the service will automatically add nodes to handle the
2007 # increased load as well as scale back as traffic drops, always maintaining
2008 # at least `min_nodes`. You will be charged for the time in which additional
2009 # nodes are used.
2010 #
2011 # If `min_nodes` is not specified and AutoScaling is used with a [legacy
2012 # (MLS1) machine type](/ml-engine/docs/machine-types-online-prediction),
2013 # `min_nodes` defaults to 0, in which case, when traffic to a model stops
2014 # (and after a cool-down period), nodes will be shut down and no charges will
2015 # be incurred until traffic to the model resumes.
2016 #
2017 # If `min_nodes` is not specified and AutoScaling is used with a [Compute
2018 # Engine (N1) machine type](/ml-engine/docs/machine-types-online-prediction),
2019 # `min_nodes` defaults to 1. `min_nodes` must be at least 1 for use with a
2020 # Compute Engine machine type.
2021 #
2022 # Note that you cannot use AutoScaling if your version uses
2023 # [GPUs](#Version.FIELDS.accelerator_config). Instead, you must use
2024 # ManualScaling.
2025 #
2026 # You can set `min_nodes` when creating the model version, and you can also
2027 # update `min_nodes` for an existing version:
2028 # &lt;pre&gt;
2029 # update_body.json:
2030 # {
2031 # 'autoScaling': {
2032 # 'minNodes': 5
2033 # }
2034 # }
2035 # &lt;/pre&gt;
2036 # HTTP request:
2037 # &lt;pre style="max-width: 626px;"&gt;
2038 # PATCH
2039 # https://ml.googleapis.com/v1/{name=projects/*/models/*/versions/*}?update_mask=autoScaling.minNodes
2040 # -d @./update_body.json
2041 # &lt;/pre&gt;
2042 },
2043 "pythonVersion": "A String", # Required. The version of Python used in prediction.
2044 #
2045 # The following Python versions are available:
2046 #
2047 # * Python '3.7' is available when `runtime_version` is set to '1.15' or
2048 # later.
2049 # * Python '3.5' is available when `runtime_version` is set to a version
2050 # from '1.4' to '1.14'.
2051 # * Python '2.7' is available when `runtime_version` is set to '1.15' or
2052 # earlier.
2053 #
2054 # Read more about the Python versions available for [each runtime
2055 # version](/ml-engine/docs/runtime-version-list).
2056 "requestLoggingConfig": { # Configuration for logging request-response pairs to a BigQuery table. # Optional. *Only* specify this field in a
2057 # projects.models.versions.patch
2058 # request. Specifying it in a
2059 # projects.models.versions.create
2060 # request has no effect.
2061 #
2062 # Configures the request-response pair logging on predictions from this
2063 # Version.
2064 # Online prediction requests to a model version and the responses to these
2065 # requests are converted to raw strings and saved to the specified BigQuery
2066 # table. Logging is constrained by [BigQuery quotas and
2067 # limits](/bigquery/quotas). If your project exceeds BigQuery quotas or limits,
2068 # AI Platform Prediction does not log request-response pairs, but it continues
2069 # to serve predictions.
2070 #
2071 # If you are using [continuous
2072 # evaluation](/ml-engine/docs/continuous-evaluation/), you do not need to
2073 # specify this configuration manually. Setting up continuous evaluation
2074 # automatically enables logging of request-response pairs.
2075 "samplingPercentage": 3.14, # Percentage of requests to be logged, expressed as a fraction from 0 to 1.
2076 # For example, if you want to log 10% of requests, enter `0.1`. The sampling
2077 # window is the lifetime of the model version. Defaults to 0.
2078 "bigqueryTableName": "A String", # Required. Fully qualified BigQuery table name in the following format:
2079 # "&lt;var&gt;project_id&lt;/var&gt;.&lt;var&gt;dataset_name&lt;/var&gt;.&lt;var&gt;table_name&lt;/var&gt;"
2080 #
2081 # The specified table must already exist, and the "Cloud ML Service Agent"
2082 # for your project must have permission to write to it. The table must have
2083 # the following [schema](/bigquery/docs/schemas):
2084 #
2085 # &lt;table&gt;
2086 # &lt;tr&gt;&lt;th&gt;Field name&lt;/th&gt;&lt;th style="display: table-cell"&gt;Type&lt;/th&gt;
2087 # &lt;th style="display: table-cell"&gt;Mode&lt;/th&gt;&lt;/tr&gt;
2088 # &lt;tr&gt;&lt;td&gt;model&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;REQUIRED&lt;/td&gt;&lt;/tr&gt;
2089 # &lt;tr&gt;&lt;td&gt;model_version&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;REQUIRED&lt;/td&gt;&lt;/tr&gt;
2090 # &lt;tr&gt;&lt;td&gt;time&lt;/td&gt;&lt;td&gt;TIMESTAMP&lt;/td&gt;&lt;td&gt;REQUIRED&lt;/td&gt;&lt;/tr&gt;
2091 # &lt;tr&gt;&lt;td&gt;raw_data&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;REQUIRED&lt;/td&gt;&lt;/tr&gt;
2092 # &lt;tr&gt;&lt;td&gt;raw_prediction&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;NULLABLE&lt;/td&gt;&lt;/tr&gt;
2093 # &lt;tr&gt;&lt;td&gt;groundtruth&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;NULLABLE&lt;/td&gt;&lt;/tr&gt;
2094 # &lt;/table&gt;
2095 },
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -04002096 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002097 "onlinePredictionLogging": True or False, # Optional. If true, online prediction access logs are sent to StackDriver
2098 # Logging. These logs are like standard server access logs, containing
2099 # information like timestamp and latency for each request. Note that
2100 # [Stackdriver logs may incur a cost](/stackdriver/pricing), especially if
2101 # your project receives prediction requests at a high queries per second rate
2102 # (QPS). Estimate your costs before enabling this option.
2103 #
2104 # Default is false.
Dan O'Mearadd494642020-05-01 07:42:23 -07002105 "description": "A String", # Optional. The description specified for the model when it was created.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002106 },
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -04002107 ],
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -04002108 }</pre>
2109</div>
2110
2111<div class="method">
2112 <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
2113 <pre>Retrieves the next page of results.
2114
2115Args:
2116 previous_request: The request for the previous page. (required)
2117 previous_response: The response from the request for the previous page. (required)
2118
2119Returns:
2120 A request object that you can call 'execute()' on to request the next
2121 page. Returns None if there are no more items in the collection.
2122 </pre>
2123</div>
2124
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002125<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -07002126 <code class="details" id="patch">patch(name, body=None, updateMask=None, x__xgafv=None)</code>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002127 <pre>Updates a specific model resource.
2128
2129Currently the only supported fields to update are `description` and
2130`default_version.name`.
2131
2132Args:
2133 name: string, Required. The project name. (required)
Dan O'Mearadd494642020-05-01 07:42:23 -07002134 body: object, The request body.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002135 The object takes the form of:
2136
2137{ # Represents a machine learning solution.
2138 #
2139 # A model can have multiple versions, each of which is a deployed, trained
2140 # model ready to receive prediction requests. The model itself is just a
2141 # container.
Dan O'Mearadd494642020-05-01 07:42:23 -07002142 "name": "A String", # Required. The name specified for the model when it was created.
2143 #
2144 # The model name must be unique within the project it is created in.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002145 "onlinePredictionConsoleLogging": True or False, # Optional. If true, online prediction nodes send `stderr` and `stdout`
2146 # streams to Stackdriver Logging. These can be more verbose than the standard
2147 # access logs (see `onlinePredictionLogging`) and can incur higher cost.
2148 # However, they are helpful for debugging. Note that
2149 # [Stackdriver logs may incur a cost](/stackdriver/pricing), especially if
2150 # your project receives prediction requests at a high QPS. Estimate your
2151 # costs before enabling this option.
2152 #
2153 # Default is false.
2154 "labels": { # Optional. One or more labels that you can add, to organize your models.
2155 # Each label is a key-value pair, where both the key and the value are
2156 # arbitrary strings that you supply.
2157 # For more information, see the documentation on
Dan O'Mearadd494642020-05-01 07:42:23 -07002158 # &lt;a href="/ml-engine/docs/tensorflow/resource-labels"&gt;using labels&lt;/a&gt;.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002159 "a_key": "A String",
2160 },
2161 "regions": [ # Optional. The list of regions where the model is going to be deployed.
Dan O'Mearadd494642020-05-01 07:42:23 -07002162 # Only one region per model is supported.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002163 # Defaults to 'us-central1' if nothing is set.
Dan O'Mearadd494642020-05-01 07:42:23 -07002164 # See the &lt;a href="/ml-engine/docs/tensorflow/regions"&gt;available regions&lt;/a&gt;
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002165 # for AI Platform services.
2166 # Note:
2167 # * No matter where a model is deployed, it can always be accessed by
2168 # users from anywhere, both for online and batch prediction.
2169 # * The region for a batch prediction job is set by the region field when
2170 # submitting the batch prediction job and does not take its value from
2171 # this field.
2172 "A String",
2173 ],
2174 "etag": "A String", # `etag` is used for optimistic concurrency control as a way to help
2175 # prevent simultaneous updates of a model from overwriting each other.
2176 # It is strongly suggested that systems make use of the `etag` in the
2177 # read-modify-write cycle to perform model updates in order to avoid race
2178 # conditions: An `etag` is returned in the response to `GetModel`, and
2179 # systems are expected to put that etag in the request to `UpdateModel` to
2180 # ensure that their change will be applied to the model as intended.
2181 "defaultVersion": { # Represents a version of the model. # Output only. The default version of the model. This version will be used to
2182 # handle prediction requests that do not specify a version.
2183 #
2184 # You can change the default version by calling
Dan O'Mearadd494642020-05-01 07:42:23 -07002185 # projects.models.versions.setDefault.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002186 #
2187 # Each version is a trained model deployed in the cloud, ready to handle
2188 # prediction requests. A model can have multiple versions. You can get
2189 # information about all of the versions of a given model by calling
Dan O'Mearadd494642020-05-01 07:42:23 -07002190 # projects.models.versions.list.
2191 "acceleratorConfig": { # Represents a hardware accelerator request config. # Optional. Accelerator config for using GPUs for online prediction (beta).
2192 # Only specify this field if you have specified a Compute Engine (N1) machine
2193 # type in the `machineType` field. Learn more about [using GPUs for online
2194 # prediction](/ml-engine/docs/machine-types-online-prediction#gpus).
2195 # Note that the AcceleratorConfig can be used in both Jobs and Versions.
2196 # Learn more about [accelerators for training](/ml-engine/docs/using-gpus) and
2197 # [accelerators for online
2198 # prediction](/ml-engine/docs/machine-types-online-prediction#gpus).
2199 "count": "A String", # The number of accelerators to attach to each machine running the job.
2200 "type": "A String", # The type of accelerator to use.
2201 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002202 "labels": { # Optional. One or more labels that you can add, to organize your model
2203 # versions. Each label is a key-value pair, where both the key and the value
2204 # are arbitrary strings that you supply.
2205 # For more information, see the documentation on
Dan O'Mearadd494642020-05-01 07:42:23 -07002206 # &lt;a href="/ml-engine/docs/tensorflow/resource-labels"&gt;using labels&lt;/a&gt;.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002207 "a_key": "A String",
2208 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002209 "predictionClass": "A String", # Optional. The fully qualified name
Dan O'Mearadd494642020-05-01 07:42:23 -07002210 # (&lt;var&gt;module_name&lt;/var&gt;.&lt;var&gt;class_name&lt;/var&gt;) of a class that implements
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002211 # the Predictor interface described in this reference field. The module
2212 # containing this class should be included in a package provided to the
2213 # [`packageUris` field](#Version.FIELDS.package_uris).
2214 #
2215 # Specify this field if and only if you are deploying a [custom prediction
2216 # routine (beta)](/ml-engine/docs/tensorflow/custom-prediction-routines).
2217 # If you specify this field, you must set
Dan O'Mearadd494642020-05-01 07:42:23 -07002218 # [`runtimeVersion`](#Version.FIELDS.runtime_version) to 1.4 or greater and
2219 # you must set `machineType` to a [legacy (MLS1)
2220 # machine type](/ml-engine/docs/machine-types-online-prediction).
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002221 #
2222 # The following code sample provides the Predictor interface:
2223 #
Dan O'Mearadd494642020-05-01 07:42:23 -07002224 # &lt;pre style="max-width: 626px;"&gt;
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002225 # class Predictor(object):
2226 # """Interface for constructing custom predictors."""
2227 #
2228 # def predict(self, instances, **kwargs):
2229 # """Performs custom prediction.
2230 #
2231 # Instances are the decoded values from the request. They have already
2232 # been deserialized from JSON.
2233 #
2234 # Args:
2235 # instances: A list of prediction input instances.
2236 # **kwargs: A dictionary of keyword args provided as additional
2237 # fields on the predict request body.
2238 #
2239 # Returns:
2240 # A list of outputs containing the prediction results. This list must
2241 # be JSON serializable.
2242 # """
2243 # raise NotImplementedError()
2244 #
2245 # @classmethod
2246 # def from_path(cls, model_dir):
2247 # """Creates an instance of Predictor using the given path.
2248 #
2249 # Loading of the predictor should be done in this method.
2250 #
2251 # Args:
2252 # model_dir: The local directory that contains the exported model
2253 # file along with any additional files uploaded when creating the
2254 # version resource.
2255 #
2256 # Returns:
2257 # An instance implementing this Predictor class.
2258 # """
2259 # raise NotImplementedError()
Dan O'Mearadd494642020-05-01 07:42:23 -07002260 # &lt;/pre&gt;
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002261 #
2262 # Learn more about [the Predictor interface and custom prediction
2263 # routines](/ml-engine/docs/tensorflow/custom-prediction-routines).
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002264 "serviceAccount": "A String", # Optional. Specifies the service account for resource access control.
2265 "state": "A String", # Output only. The state of a version.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002266 "packageUris": [ # Optional. Cloud Storage paths (`gs://…`) of packages for [custom
2267 # prediction routines](/ml-engine/docs/tensorflow/custom-prediction-routines)
2268 # or [scikit-learn pipelines with custom
2269 # code](/ml-engine/docs/scikit/exporting-for-prediction#custom-pipeline-code).
2270 #
2271 # For a custom prediction routine, one of these packages must contain your
2272 # Predictor class (see
2273 # [`predictionClass`](#Version.FIELDS.prediction_class)). Additionally,
2274 # include any dependencies used by your Predictor or scikit-learn pipeline
2275 # uses that are not already included in your selected [runtime
2276 # version](/ml-engine/docs/tensorflow/runtime-version-list).
2277 #
2278 # If you specify this field, you must also set
2279 # [`runtimeVersion`](#Version.FIELDS.runtime_version) to 1.4 or greater.
2280 "A String",
2281 ],
2282 "etag": "A String", # `etag` is used for optimistic concurrency control as a way to help
2283 # prevent simultaneous updates of a model from overwriting each other.
2284 # It is strongly suggested that systems make use of the `etag` in the
2285 # read-modify-write cycle to perform model updates in order to avoid race
2286 # conditions: An `etag` is returned in the response to `GetVersion`, and
2287 # systems are expected to put that etag in the request to `UpdateVersion` to
2288 # ensure that their change will be applied to the model as intended.
2289 "lastUseTime": "A String", # Output only. The time the version was last used for prediction.
2290 "deploymentUri": "A String", # Required. The Cloud Storage location of the trained model used to
2291 # create the version. See the
2292 # [guide to model
2293 # deployment](/ml-engine/docs/tensorflow/deploying-models) for more
2294 # information.
2295 #
2296 # When passing Version to
Dan O'Mearadd494642020-05-01 07:42:23 -07002297 # projects.models.versions.create
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002298 # the model service uses the specified location as the source of the model.
2299 # Once deployed, the model version is hosted by the prediction service, so
2300 # this location is useful only as a historical record.
2301 # The total number of model files can't exceed 1000.
Dan O'Mearadd494642020-05-01 07:42:23 -07002302 "explanationConfig": { # Message holding configuration options for explaining model predictions. # Optional. Configures explainability features on the model's version.
2303 # Some explanation features require additional metadata to be loaded
2304 # as part of the model payload.
2305 # There are two feature attribution methods supported for TensorFlow models:
2306 # integrated gradients and sampled Shapley.
2307 # [Learn more about feature
2308 # attributions.](/ml-engine/docs/ai-explanations/overview)
2309 "xraiAttribution": { # Attributes credit by computing the XRAI taking advantage # Attributes credit by computing the XRAI taking advantage
2310 # of the model's fully differentiable structure. Refer to this paper for
2311 # more details: https://arxiv.org/abs/1906.02825
2312 # Currently only implemented for models with natural image inputs.
2313 # of the model's fully differentiable structure. Refer to this paper for
2314 # more details: https://arxiv.org/abs/1906.02825
2315 # Currently only implemented for models with natural image inputs.
2316 "numIntegralSteps": 42, # Number of steps for approximating the path integral.
2317 # A good value to start is 50 and gradually increase until the
2318 # sum to diff property is met within the desired error range.
2319 },
2320 "sampledShapleyAttribution": { # An attribution method that approximates Shapley values for features that # An attribution method that approximates Shapley values for features that
2321 # contribute to the label being predicted. A sampling strategy is used to
2322 # approximate the value rather than considering all subsets of features.
2323 # contribute to the label being predicted. A sampling strategy is used to
2324 # approximate the value rather than considering all subsets of features.
2325 "numPaths": 42, # The number of feature permutations to consider when approximating the
2326 # Shapley values.
2327 },
2328 "integratedGradientsAttribution": { # Attributes credit by computing the Aumann-Shapley value taking advantage # Attributes credit by computing the Aumann-Shapley value taking advantage
2329 # of the model's fully differentiable structure. Refer to this paper for
2330 # more details: http://proceedings.mlr.press/v70/sundararajan17a.html
2331 # of the model's fully differentiable structure. Refer to this paper for
2332 # more details: http://proceedings.mlr.press/v70/sundararajan17a.html
2333 "numIntegralSteps": 42, # Number of steps for approximating the path integral.
2334 # A good value to start is 50 and gradually increase until the
2335 # sum to diff property is met within the desired error range.
2336 },
2337 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002338 "isDefault": True or False, # Output only. If true, this version will be used to handle prediction
2339 # requests that do not specify a version.
2340 #
2341 # You can change the default version by calling
Dan O'Mearadd494642020-05-01 07:42:23 -07002342 # projects.methods.versions.setDefault.
2343 "machineType": "A String", # Optional. The type of machine on which to serve the model. Currently only
2344 # applies to online prediction service. If this field is not specified, it
2345 # defaults to `mls1-c1-m2`.
2346 #
2347 # Online prediction supports the following machine types:
2348 #
2349 # * `mls1-c1-m2`
2350 # * `mls1-c4-m2`
2351 # * `n1-standard-2`
2352 # * `n1-standard-4`
2353 # * `n1-standard-8`
2354 # * `n1-standard-16`
2355 # * `n1-standard-32`
2356 # * `n1-highmem-2`
2357 # * `n1-highmem-4`
2358 # * `n1-highmem-8`
2359 # * `n1-highmem-16`
2360 # * `n1-highmem-32`
2361 # * `n1-highcpu-2`
2362 # * `n1-highcpu-4`
2363 # * `n1-highcpu-8`
2364 # * `n1-highcpu-16`
2365 # * `n1-highcpu-32`
2366 #
2367 # `mls1-c1-m2` is generally available. All other machine types are available
2368 # in beta. Learn more about the [differences between machine
2369 # types](/ml-engine/docs/machine-types-online-prediction).
2370 "description": "A String", # Optional. The description specified for the version when it was created.
2371 "runtimeVersion": "A String", # Required. The AI Platform runtime version to use for this deployment.
2372 #
2373 # For more information, see the
2374 # [runtime version list](/ml-engine/docs/runtime-version-list) and
2375 # [how to manage runtime versions](/ml-engine/docs/versioning).
2376 "manualScaling": { # Options for manually scaling a model. # Manually select the number of nodes to use for serving the
2377 # model. You should generally use `auto_scaling` with an appropriate
2378 # `min_nodes` instead, but this option is available if you want more
2379 # predictable billing. Beware that latency and error rates will increase
2380 # if the traffic exceeds that capability of the system to serve it based
2381 # on the selected number of nodes.
2382 "nodes": 42, # The number of nodes to allocate for this model. These nodes are always up,
2383 # starting from the time the model is deployed, so the cost of operating
2384 # this model will be proportional to `nodes` * number of hours since
2385 # last billing cycle plus the cost for each prediction performed.
2386 },
2387 "errorMessage": "A String", # Output only. The details of a failure or a cancellation.
2388 "framework": "A String", # Optional. The machine learning framework AI Platform uses to train
2389 # this version of the model. Valid values are `TENSORFLOW`, `SCIKIT_LEARN`,
2390 # `XGBOOST`. If you do not specify a framework, AI Platform
2391 # will analyze files in the deployment_uri to determine a framework. If you
2392 # choose `SCIKIT_LEARN` or `XGBOOST`, you must also set the runtime version
2393 # of the model to 1.4 or greater.
2394 #
2395 # Do **not** specify a framework if you're deploying a [custom
2396 # prediction routine](/ml-engine/docs/tensorflow/custom-prediction-routines).
2397 #
2398 # If you specify a [Compute Engine (N1) machine
2399 # type](/ml-engine/docs/machine-types-online-prediction) in the
2400 # `machineType` field, you must specify `TENSORFLOW`
2401 # for the framework.
2402 "createTime": "A String", # Output only. The time the version was created.
2403 "name": "A String", # Required. The name specified for the version when it was created.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002404 #
2405 # The version name must be unique within the model it is created in.
Dan O'Mearadd494642020-05-01 07:42:23 -07002406 "autoScaling": { # Options for automatically scaling a model. # Automatically scale the number of nodes used to serve the model in
2407 # response to increases and decreases in traffic. Care should be
2408 # taken to ramp up traffic according to the model's ability to scale
2409 # or you will start seeing increases in latency and 429 response codes.
2410 #
2411 # Note that you cannot use AutoScaling if your version uses
2412 # [GPUs](#Version.FIELDS.accelerator_config). Instead, you must use specify
2413 # `manual_scaling`.
2414 "minNodes": 42, # Optional. The minimum number of nodes to allocate for this model. These
2415 # nodes are always up, starting from the time the model is deployed.
2416 # Therefore, the cost of operating this model will be at least
2417 # `rate` * `min_nodes` * number of hours since last billing cycle,
2418 # where `rate` is the cost per node-hour as documented in the
2419 # [pricing guide](/ml-engine/docs/pricing),
2420 # even if no predictions are performed. There is additional cost for each
2421 # prediction performed.
2422 #
2423 # Unlike manual scaling, if the load gets too heavy for the nodes
2424 # that are up, the service will automatically add nodes to handle the
2425 # increased load as well as scale back as traffic drops, always maintaining
2426 # at least `min_nodes`. You will be charged for the time in which additional
2427 # nodes are used.
2428 #
2429 # If `min_nodes` is not specified and AutoScaling is used with a [legacy
2430 # (MLS1) machine type](/ml-engine/docs/machine-types-online-prediction),
2431 # `min_nodes` defaults to 0, in which case, when traffic to a model stops
2432 # (and after a cool-down period), nodes will be shut down and no charges will
2433 # be incurred until traffic to the model resumes.
2434 #
2435 # If `min_nodes` is not specified and AutoScaling is used with a [Compute
2436 # Engine (N1) machine type](/ml-engine/docs/machine-types-online-prediction),
2437 # `min_nodes` defaults to 1. `min_nodes` must be at least 1 for use with a
2438 # Compute Engine machine type.
2439 #
2440 # Note that you cannot use AutoScaling if your version uses
2441 # [GPUs](#Version.FIELDS.accelerator_config). Instead, you must use
2442 # ManualScaling.
2443 #
2444 # You can set `min_nodes` when creating the model version, and you can also
2445 # update `min_nodes` for an existing version:
2446 # &lt;pre&gt;
2447 # update_body.json:
2448 # {
2449 # 'autoScaling': {
2450 # 'minNodes': 5
2451 # }
2452 # }
2453 # &lt;/pre&gt;
2454 # HTTP request:
2455 # &lt;pre style="max-width: 626px;"&gt;
2456 # PATCH
2457 # https://ml.googleapis.com/v1/{name=projects/*/models/*/versions/*}?update_mask=autoScaling.minNodes
2458 # -d @./update_body.json
2459 # &lt;/pre&gt;
2460 },
2461 "pythonVersion": "A String", # Required. The version of Python used in prediction.
2462 #
2463 # The following Python versions are available:
2464 #
2465 # * Python '3.7' is available when `runtime_version` is set to '1.15' or
2466 # later.
2467 # * Python '3.5' is available when `runtime_version` is set to a version
2468 # from '1.4' to '1.14'.
2469 # * Python '2.7' is available when `runtime_version` is set to '1.15' or
2470 # earlier.
2471 #
2472 # Read more about the Python versions available for [each runtime
2473 # version](/ml-engine/docs/runtime-version-list).
2474 "requestLoggingConfig": { # Configuration for logging request-response pairs to a BigQuery table. # Optional. *Only* specify this field in a
2475 # projects.models.versions.patch
2476 # request. Specifying it in a
2477 # projects.models.versions.create
2478 # request has no effect.
2479 #
2480 # Configures the request-response pair logging on predictions from this
2481 # Version.
2482 # Online prediction requests to a model version and the responses to these
2483 # requests are converted to raw strings and saved to the specified BigQuery
2484 # table. Logging is constrained by [BigQuery quotas and
2485 # limits](/bigquery/quotas). If your project exceeds BigQuery quotas or limits,
2486 # AI Platform Prediction does not log request-response pairs, but it continues
2487 # to serve predictions.
2488 #
2489 # If you are using [continuous
2490 # evaluation](/ml-engine/docs/continuous-evaluation/), you do not need to
2491 # specify this configuration manually. Setting up continuous evaluation
2492 # automatically enables logging of request-response pairs.
2493 "samplingPercentage": 3.14, # Percentage of requests to be logged, expressed as a fraction from 0 to 1.
2494 # For example, if you want to log 10% of requests, enter `0.1`. The sampling
2495 # window is the lifetime of the model version. Defaults to 0.
2496 "bigqueryTableName": "A String", # Required. Fully qualified BigQuery table name in the following format:
2497 # "&lt;var&gt;project_id&lt;/var&gt;.&lt;var&gt;dataset_name&lt;/var&gt;.&lt;var&gt;table_name&lt;/var&gt;"
2498 #
2499 # The specified table must already exist, and the "Cloud ML Service Agent"
2500 # for your project must have permission to write to it. The table must have
2501 # the following [schema](/bigquery/docs/schemas):
2502 #
2503 # &lt;table&gt;
2504 # &lt;tr&gt;&lt;th&gt;Field name&lt;/th&gt;&lt;th style="display: table-cell"&gt;Type&lt;/th&gt;
2505 # &lt;th style="display: table-cell"&gt;Mode&lt;/th&gt;&lt;/tr&gt;
2506 # &lt;tr&gt;&lt;td&gt;model&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;REQUIRED&lt;/td&gt;&lt;/tr&gt;
2507 # &lt;tr&gt;&lt;td&gt;model_version&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;REQUIRED&lt;/td&gt;&lt;/tr&gt;
2508 # &lt;tr&gt;&lt;td&gt;time&lt;/td&gt;&lt;td&gt;TIMESTAMP&lt;/td&gt;&lt;td&gt;REQUIRED&lt;/td&gt;&lt;/tr&gt;
2509 # &lt;tr&gt;&lt;td&gt;raw_data&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;REQUIRED&lt;/td&gt;&lt;/tr&gt;
2510 # &lt;tr&gt;&lt;td&gt;raw_prediction&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;NULLABLE&lt;/td&gt;&lt;/tr&gt;
2511 # &lt;tr&gt;&lt;td&gt;groundtruth&lt;/td&gt;&lt;td&gt;STRING&lt;/td&gt;&lt;td&gt;NULLABLE&lt;/td&gt;&lt;/tr&gt;
2512 # &lt;/table&gt;
2513 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002514 },
2515 "onlinePredictionLogging": True or False, # Optional. If true, online prediction access logs are sent to StackDriver
2516 # Logging. These logs are like standard server access logs, containing
2517 # information like timestamp and latency for each request. Note that
2518 # [Stackdriver logs may incur a cost](/stackdriver/pricing), especially if
2519 # your project receives prediction requests at a high queries per second rate
2520 # (QPS). Estimate your costs before enabling this option.
2521 #
2522 # Default is false.
Dan O'Mearadd494642020-05-01 07:42:23 -07002523 "description": "A String", # Optional. The description specified for the model when it was created.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002524}
2525
2526 updateMask: string, Required. Specifies the path, relative to `Model`, of the field to update.
2527
2528For example, to change the description of a model to "foo" and set its
2529default version to "version_1", the `update_mask` parameter would be
2530specified as `description`, `default_version.name`, and the `PATCH`
2531request body would specify the new value, as follows:
2532 {
2533 "description": "foo",
2534 "defaultVersion": {
2535 "name":"version_1"
2536 }
2537 }
2538
2539Currently the supported update masks are `description` and
2540`default_version.name`.
2541 x__xgafv: string, V1 error format.
2542 Allowed values
2543 1 - v1 error format
2544 2 - v2 error format
2545
2546Returns:
2547 An object of the form:
2548
2549 { # This resource represents a long-running operation that is the result of a
2550 # network API call.
2551 "metadata": { # Service-specific metadata associated with the operation. It typically
2552 # contains progress information and common metadata such as create time.
2553 # Some services might not provide such metadata. Any method that returns a
2554 # long-running operation should document the metadata type, if any.
2555 "a_key": "", # Properties of the object. Contains field @type with type URL.
2556 },
2557 "error": { # The `Status` type defines a logical error model that is suitable for # The error result of the operation in case of failure or cancellation.
2558 # different programming environments, including REST APIs and RPC APIs. It is
2559 # used by [gRPC](https://github.com/grpc). Each `Status` message contains
2560 # three pieces of data: error code, error message, and error details.
2561 #
2562 # You can find out more about this error model and how to work with it in the
2563 # [API Design Guide](https://cloud.google.com/apis/design/errors).
2564 "message": "A String", # A developer-facing error message, which should be in English. Any
2565 # user-facing error message should be localized and sent in the
2566 # google.rpc.Status.details field, or localized by the client.
2567 "code": 42, # The status code, which should be an enum value of google.rpc.Code.
2568 "details": [ # A list of messages that carry the error details. There is a common set of
2569 # message types for APIs to use.
2570 {
2571 "a_key": "", # Properties of the object. Contains field @type with type URL.
2572 },
2573 ],
2574 },
2575 "done": True or False, # If the value is `false`, it means the operation is still in progress.
2576 # If `true`, the operation is completed, and either `error` or `response` is
2577 # available.
2578 "response": { # The normal response of the operation in case of success. If the original
2579 # method returns no data on success, such as `Delete`, the response is
2580 # `google.protobuf.Empty`. If the original method is standard
2581 # `Get`/`Create`/`Update`, the response should be the resource. For other
2582 # methods, the response should have the type `XxxResponse`, where `Xxx`
2583 # is the original method name. For example, if the original method name
2584 # is `TakeSnapshot()`, the inferred response type is
2585 # `TakeSnapshotResponse`.
2586 "a_key": "", # Properties of the object. Contains field @type with type URL.
2587 },
2588 "name": "A String", # The server-assigned name, which is only unique within the same service that
2589 # originally returns it. If you use the default HTTP mapping, the
2590 # `name` should be a resource name ending with `operations/{unique_id}`.
2591 }</pre>
2592</div>
2593
2594<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -07002595 <code class="details" id="setIamPolicy">setIamPolicy(resource, body=None, x__xgafv=None)</code>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002596 <pre>Sets the access control policy on the specified resource. Replaces any
2597existing policy.
2598
Dan O'Mearadd494642020-05-01 07:42:23 -07002599Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
2600
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002601Args:
2602 resource: string, REQUIRED: The resource for which the policy is being specified.
2603See the operation documentation for the appropriate value for this field. (required)
Dan O'Mearadd494642020-05-01 07:42:23 -07002604 body: object, The request body.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002605 The object takes the form of:
2606
2607{ # Request message for `SetIamPolicy` method.
Dan O'Mearadd494642020-05-01 07:42:23 -07002608 "policy": { # An Identity and Access Management (IAM) policy, which specifies access # REQUIRED: The complete policy to be applied to the `resource`. The size of
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002609 # the policy is limited to a few 10s of KB. An empty policy is a
2610 # valid policy but certain Cloud Platform services (such as Projects)
2611 # might reject them.
Dan O'Mearadd494642020-05-01 07:42:23 -07002612 # controls for Google Cloud resources.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002613 #
2614 #
Dan O'Mearadd494642020-05-01 07:42:23 -07002615 # A `Policy` is a collection of `bindings`. A `binding` binds one or more
2616 # `members` to a single `role`. Members can be user accounts, service accounts,
2617 # Google groups, and domains (such as G Suite). A `role` is a named list of
2618 # permissions; each `role` can be an IAM predefined role or a user-created
2619 # custom role.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002620 #
Dan O'Mearadd494642020-05-01 07:42:23 -07002621 # Optionally, a `binding` can specify a `condition`, which is a logical
2622 # expression that allows access to a resource only if the expression evaluates
2623 # to `true`. A condition can add constraints based on attributes of the
2624 # request, the resource, or both.
2625 #
2626 # **JSON example:**
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002627 #
2628 # {
2629 # "bindings": [
2630 # {
Dan O'Mearadd494642020-05-01 07:42:23 -07002631 # "role": "roles/resourcemanager.organizationAdmin",
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002632 # "members": [
2633 # "user:mike@example.com",
2634 # "group:admins@example.com",
2635 # "domain:google.com",
Dan O'Mearadd494642020-05-01 07:42:23 -07002636 # "serviceAccount:my-project-id@appspot.gserviceaccount.com"
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002637 # ]
2638 # },
2639 # {
Dan O'Mearadd494642020-05-01 07:42:23 -07002640 # "role": "roles/resourcemanager.organizationViewer",
2641 # "members": ["user:eve@example.com"],
2642 # "condition": {
2643 # "title": "expirable access",
2644 # "description": "Does not grant access after Sep 2020",
2645 # "expression": "request.time &lt; timestamp('2020-10-01T00:00:00.000Z')",
2646 # }
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002647 # }
Dan O'Mearadd494642020-05-01 07:42:23 -07002648 # ],
2649 # "etag": "BwWWja0YfJA=",
2650 # "version": 3
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002651 # }
2652 #
Dan O'Mearadd494642020-05-01 07:42:23 -07002653 # **YAML example:**
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002654 #
2655 # bindings:
2656 # - members:
2657 # - user:mike@example.com
2658 # - group:admins@example.com
2659 # - domain:google.com
Dan O'Mearadd494642020-05-01 07:42:23 -07002660 # - serviceAccount:my-project-id@appspot.gserviceaccount.com
2661 # role: roles/resourcemanager.organizationAdmin
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002662 # - members:
Dan O'Mearadd494642020-05-01 07:42:23 -07002663 # - user:eve@example.com
2664 # role: roles/resourcemanager.organizationViewer
2665 # condition:
2666 # title: expirable access
2667 # description: Does not grant access after Sep 2020
2668 # expression: request.time &lt; timestamp('2020-10-01T00:00:00.000Z')
2669 # - etag: BwWWja0YfJA=
2670 # - version: 3
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002671 #
2672 # For a description of IAM and its features, see the
Dan O'Mearadd494642020-05-01 07:42:23 -07002673 # [IAM documentation](https://cloud.google.com/iam/docs/).
2674 "bindings": [ # Associates a list of `members` to a `role`. Optionally, may specify a
2675 # `condition` that determines how and when the `bindings` are applied. Each
2676 # of the `bindings` must contain at least one member.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002677 { # Associates `members` with a `role`.
2678 "role": "A String", # Role that is assigned to `members`.
2679 # For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
2680 "members": [ # Specifies the identities requesting access for a Cloud Platform resource.
2681 # `members` can have the following values:
2682 #
2683 # * `allUsers`: A special identifier that represents anyone who is
2684 # on the internet; with or without a Google account.
2685 #
2686 # * `allAuthenticatedUsers`: A special identifier that represents anyone
2687 # who is authenticated with a Google account or a service account.
2688 #
2689 # * `user:{emailid}`: An email address that represents a specific Google
Dan O'Mearadd494642020-05-01 07:42:23 -07002690 # account. For example, `alice@example.com` .
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002691 #
2692 #
2693 # * `serviceAccount:{emailid}`: An email address that represents a service
2694 # account. For example, `my-other-app@appspot.gserviceaccount.com`.
2695 #
2696 # * `group:{emailid}`: An email address that represents a Google group.
2697 # For example, `admins@example.com`.
2698 #
Dan O'Mearadd494642020-05-01 07:42:23 -07002699 # * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique
2700 # identifier) representing a user that has been recently deleted. For
2701 # example, `alice@example.com?uid=123456789012345678901`. If the user is
2702 # recovered, this value reverts to `user:{emailid}` and the recovered user
2703 # retains the role in the binding.
2704 #
2705 # * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus
2706 # unique identifier) representing a service account that has been recently
2707 # deleted. For example,
2708 # `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`.
2709 # If the service account is undeleted, this value reverts to
2710 # `serviceAccount:{emailid}` and the undeleted service account retains the
2711 # role in the binding.
2712 #
2713 # * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique
2714 # identifier) representing a Google group that has been recently
2715 # deleted. For example, `admins@example.com?uid=123456789012345678901`. If
2716 # the group is recovered, this value reverts to `group:{emailid}` and the
2717 # recovered group retains the role in the binding.
2718 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002719 #
2720 # * `domain:{domain}`: The G Suite domain (primary) that represents all the
2721 # users of that domain. For example, `google.com` or `example.com`.
2722 #
2723 "A String",
2724 ],
Dan O'Mearadd494642020-05-01 07:42:23 -07002725 "condition": { # Represents a textual expression in the Common Expression Language (CEL) # The condition that is associated with this binding.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002726 # NOTE: An unsatisfied condition will not allow user access via current
2727 # binding. Different bindings, including their conditions, are examined
2728 # independently.
Dan O'Mearadd494642020-05-01 07:42:23 -07002729 # syntax. CEL is a C-like expression language. The syntax and semantics of CEL
2730 # are documented at https://github.com/google/cel-spec.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002731 #
Dan O'Mearadd494642020-05-01 07:42:23 -07002732 # Example (Comparison):
2733 #
2734 # title: "Summary size limit"
2735 # description: "Determines if a summary is less than 100 chars"
2736 # expression: "document.summary.size() &lt; 100"
2737 #
2738 # Example (Equality):
2739 #
2740 # title: "Requestor is owner"
2741 # description: "Determines if requestor is the document owner"
2742 # expression: "document.owner == request.auth.claims.email"
2743 #
2744 # Example (Logic):
2745 #
2746 # title: "Public documents"
2747 # description: "Determine whether the document should be publicly visible"
2748 # expression: "document.type != 'private' &amp;&amp; document.type != 'internal'"
2749 #
2750 # Example (Data Manipulation):
2751 #
2752 # title: "Notification string"
2753 # description: "Create a notification string with a timestamp."
2754 # expression: "'New message received at ' + string(document.create_time)"
2755 #
2756 # The exact variables and functions that may be referenced within an expression
2757 # are determined by the service that evaluates it. See the service
2758 # documentation for additional information.
2759 "description": "A String", # Optional. Description of the expression. This is a longer text which
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002760 # describes the expression, e.g. when hovered over it in a UI.
Dan O'Mearadd494642020-05-01 07:42:23 -07002761 "expression": "A String", # Textual representation of an expression in Common Expression Language
2762 # syntax.
2763 "location": "A String", # Optional. String indicating the location of the expression for error
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002764 # reporting, e.g. a file name and a position in the file.
Dan O'Mearadd494642020-05-01 07:42:23 -07002765 "title": "A String", # Optional. Title for the expression, i.e. a short string describing
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002766 # its purpose. This can be used e.g. in UIs which allow to enter the
2767 # expression.
2768 },
2769 },
2770 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002771 "auditConfigs": [ # Specifies cloud audit logging configuration for this policy.
2772 { # Specifies the audit configuration for a service.
2773 # The configuration determines which permission types are logged, and what
2774 # identities, if any, are exempted from logging.
2775 # An AuditConfig must have one or more AuditLogConfigs.
2776 #
2777 # If there are AuditConfigs for both `allServices` and a specific service,
2778 # the union of the two AuditConfigs is used for that service: the log_types
2779 # specified in each AuditConfig are enabled, and the exempted_members in each
2780 # AuditLogConfig are exempted.
2781 #
2782 # Example Policy with multiple AuditConfigs:
2783 #
2784 # {
2785 # "audit_configs": [
2786 # {
2787 # "service": "allServices"
2788 # "audit_log_configs": [
2789 # {
2790 # "log_type": "DATA_READ",
2791 # "exempted_members": [
Dan O'Mearadd494642020-05-01 07:42:23 -07002792 # "user:jose@example.com"
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002793 # ]
2794 # },
2795 # {
2796 # "log_type": "DATA_WRITE",
2797 # },
2798 # {
2799 # "log_type": "ADMIN_READ",
2800 # }
2801 # ]
2802 # },
2803 # {
Dan O'Mearadd494642020-05-01 07:42:23 -07002804 # "service": "sampleservice.googleapis.com"
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002805 # "audit_log_configs": [
2806 # {
2807 # "log_type": "DATA_READ",
2808 # },
2809 # {
2810 # "log_type": "DATA_WRITE",
2811 # "exempted_members": [
Dan O'Mearadd494642020-05-01 07:42:23 -07002812 # "user:aliya@example.com"
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002813 # ]
2814 # }
2815 # ]
2816 # }
2817 # ]
2818 # }
2819 #
Dan O'Mearadd494642020-05-01 07:42:23 -07002820 # For sampleservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ
2821 # logging. It also exempts jose@example.com from DATA_READ logging, and
2822 # aliya@example.com from DATA_WRITE logging.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002823 "auditLogConfigs": [ # The configuration for logging of each type of permission.
2824 { # Provides the configuration for logging a type of permissions.
2825 # Example:
2826 #
2827 # {
2828 # "audit_log_configs": [
2829 # {
2830 # "log_type": "DATA_READ",
2831 # "exempted_members": [
Dan O'Mearadd494642020-05-01 07:42:23 -07002832 # "user:jose@example.com"
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002833 # ]
2834 # },
2835 # {
2836 # "log_type": "DATA_WRITE",
2837 # }
2838 # ]
2839 # }
2840 #
2841 # This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting
Dan O'Mearadd494642020-05-01 07:42:23 -07002842 # jose@example.com from DATA_READ logging.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002843 "exemptedMembers": [ # Specifies the identities that do not cause logging for this type of
2844 # permission.
2845 # Follows the same format of Binding.members.
2846 "A String",
2847 ],
2848 "logType": "A String", # The log type that this config enables.
2849 },
2850 ],
2851 "service": "A String", # Specifies a service that will be enabled for audit logging.
2852 # For example, `storage.googleapis.com`, `cloudsql.googleapis.com`.
2853 # `allServices` is a special value that covers all services.
2854 },
2855 ],
Dan O'Mearadd494642020-05-01 07:42:23 -07002856 "etag": "A String", # `etag` is used for optimistic concurrency control as a way to help
2857 # prevent simultaneous updates of a policy from overwriting each other.
2858 # It is strongly suggested that systems make use of the `etag` in the
2859 # read-modify-write cycle to perform policy updates in order to avoid race
2860 # conditions: An `etag` is returned in the response to `getIamPolicy`, and
2861 # systems are expected to put that etag in the request to `setIamPolicy` to
2862 # ensure that their change will be applied to the same version of the policy.
2863 #
2864 # **Important:** If you use IAM Conditions, you must include the `etag` field
2865 # whenever you call `setIamPolicy`. If you omit this field, then IAM allows
2866 # you to overwrite a version `3` policy with a version `1` policy, and all of
2867 # the conditions in the version `3` policy are lost.
2868 "version": 42, # Specifies the format of the policy.
2869 #
2870 # Valid values are `0`, `1`, and `3`. Requests that specify an invalid value
2871 # are rejected.
2872 #
2873 # Any operation that affects conditional role bindings must specify version
2874 # `3`. This requirement applies to the following operations:
2875 #
2876 # * Getting a policy that includes a conditional role binding
2877 # * Adding a conditional role binding to a policy
2878 # * Changing a conditional role binding in a policy
2879 # * Removing any role binding, with or without a condition, from a policy
2880 # that includes conditions
2881 #
2882 # **Important:** If you use IAM Conditions, you must include the `etag` field
2883 # whenever you call `setIamPolicy`. If you omit this field, then IAM allows
2884 # you to overwrite a version `3` policy with a version `1` policy, and all of
2885 # the conditions in the version `3` policy are lost.
2886 #
2887 # If a policy does not include any conditions, operations on that policy may
2888 # specify any valid version or leave the field unset.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002889 },
2890 "updateMask": "A String", # OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
2891 # the fields in the mask will be modified. If no mask is provided, the
2892 # following default mask is used:
2893 # paths: "bindings, etag"
2894 # This field is only used by Cloud IAM.
2895 }
2896
2897 x__xgafv: string, V1 error format.
2898 Allowed values
2899 1 - v1 error format
2900 2 - v2 error format
2901
2902Returns:
2903 An object of the form:
2904
Dan O'Mearadd494642020-05-01 07:42:23 -07002905 { # An Identity and Access Management (IAM) policy, which specifies access
2906 # controls for Google Cloud resources.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002907 #
2908 #
Dan O'Mearadd494642020-05-01 07:42:23 -07002909 # A `Policy` is a collection of `bindings`. A `binding` binds one or more
2910 # `members` to a single `role`. Members can be user accounts, service accounts,
2911 # Google groups, and domains (such as G Suite). A `role` is a named list of
2912 # permissions; each `role` can be an IAM predefined role or a user-created
2913 # custom role.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002914 #
Dan O'Mearadd494642020-05-01 07:42:23 -07002915 # Optionally, a `binding` can specify a `condition`, which is a logical
2916 # expression that allows access to a resource only if the expression evaluates
2917 # to `true`. A condition can add constraints based on attributes of the
2918 # request, the resource, or both.
2919 #
2920 # **JSON example:**
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002921 #
2922 # {
2923 # "bindings": [
2924 # {
Dan O'Mearadd494642020-05-01 07:42:23 -07002925 # "role": "roles/resourcemanager.organizationAdmin",
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002926 # "members": [
2927 # "user:mike@example.com",
2928 # "group:admins@example.com",
2929 # "domain:google.com",
Dan O'Mearadd494642020-05-01 07:42:23 -07002930 # "serviceAccount:my-project-id@appspot.gserviceaccount.com"
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002931 # ]
2932 # },
2933 # {
Dan O'Mearadd494642020-05-01 07:42:23 -07002934 # "role": "roles/resourcemanager.organizationViewer",
2935 # "members": ["user:eve@example.com"],
2936 # "condition": {
2937 # "title": "expirable access",
2938 # "description": "Does not grant access after Sep 2020",
2939 # "expression": "request.time &lt; timestamp('2020-10-01T00:00:00.000Z')",
2940 # }
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002941 # }
Dan O'Mearadd494642020-05-01 07:42:23 -07002942 # ],
2943 # "etag": "BwWWja0YfJA=",
2944 # "version": 3
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002945 # }
2946 #
Dan O'Mearadd494642020-05-01 07:42:23 -07002947 # **YAML example:**
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002948 #
2949 # bindings:
2950 # - members:
2951 # - user:mike@example.com
2952 # - group:admins@example.com
2953 # - domain:google.com
Dan O'Mearadd494642020-05-01 07:42:23 -07002954 # - serviceAccount:my-project-id@appspot.gserviceaccount.com
2955 # role: roles/resourcemanager.organizationAdmin
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002956 # - members:
Dan O'Mearadd494642020-05-01 07:42:23 -07002957 # - user:eve@example.com
2958 # role: roles/resourcemanager.organizationViewer
2959 # condition:
2960 # title: expirable access
2961 # description: Does not grant access after Sep 2020
2962 # expression: request.time &lt; timestamp('2020-10-01T00:00:00.000Z')
2963 # - etag: BwWWja0YfJA=
2964 # - version: 3
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002965 #
2966 # For a description of IAM and its features, see the
Dan O'Mearadd494642020-05-01 07:42:23 -07002967 # [IAM documentation](https://cloud.google.com/iam/docs/).
2968 "bindings": [ # Associates a list of `members` to a `role`. Optionally, may specify a
2969 # `condition` that determines how and when the `bindings` are applied. Each
2970 # of the `bindings` must contain at least one member.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002971 { # Associates `members` with a `role`.
2972 "role": "A String", # Role that is assigned to `members`.
2973 # For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
2974 "members": [ # Specifies the identities requesting access for a Cloud Platform resource.
2975 # `members` can have the following values:
2976 #
2977 # * `allUsers`: A special identifier that represents anyone who is
2978 # on the internet; with or without a Google account.
2979 #
2980 # * `allAuthenticatedUsers`: A special identifier that represents anyone
2981 # who is authenticated with a Google account or a service account.
2982 #
2983 # * `user:{emailid}`: An email address that represents a specific Google
Dan O'Mearadd494642020-05-01 07:42:23 -07002984 # account. For example, `alice@example.com` .
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002985 #
2986 #
2987 # * `serviceAccount:{emailid}`: An email address that represents a service
2988 # account. For example, `my-other-app@appspot.gserviceaccount.com`.
2989 #
2990 # * `group:{emailid}`: An email address that represents a Google group.
2991 # For example, `admins@example.com`.
2992 #
Dan O'Mearadd494642020-05-01 07:42:23 -07002993 # * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique
2994 # identifier) representing a user that has been recently deleted. For
2995 # example, `alice@example.com?uid=123456789012345678901`. If the user is
2996 # recovered, this value reverts to `user:{emailid}` and the recovered user
2997 # retains the role in the binding.
2998 #
2999 # * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus
3000 # unique identifier) representing a service account that has been recently
3001 # deleted. For example,
3002 # `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`.
3003 # If the service account is undeleted, this value reverts to
3004 # `serviceAccount:{emailid}` and the undeleted service account retains the
3005 # role in the binding.
3006 #
3007 # * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique
3008 # identifier) representing a Google group that has been recently
3009 # deleted. For example, `admins@example.com?uid=123456789012345678901`. If
3010 # the group is recovered, this value reverts to `group:{emailid}` and the
3011 # recovered group retains the role in the binding.
3012 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07003013 #
3014 # * `domain:{domain}`: The G Suite domain (primary) that represents all the
3015 # users of that domain. For example, `google.com` or `example.com`.
3016 #
3017 "A String",
3018 ],
Dan O'Mearadd494642020-05-01 07:42:23 -07003019 "condition": { # Represents a textual expression in the Common Expression Language (CEL) # The condition that is associated with this binding.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07003020 # NOTE: An unsatisfied condition will not allow user access via current
3021 # binding. Different bindings, including their conditions, are examined
3022 # independently.
Dan O'Mearadd494642020-05-01 07:42:23 -07003023 # syntax. CEL is a C-like expression language. The syntax and semantics of CEL
3024 # are documented at https://github.com/google/cel-spec.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07003025 #
Dan O'Mearadd494642020-05-01 07:42:23 -07003026 # Example (Comparison):
3027 #
3028 # title: "Summary size limit"
3029 # description: "Determines if a summary is less than 100 chars"
3030 # expression: "document.summary.size() &lt; 100"
3031 #
3032 # Example (Equality):
3033 #
3034 # title: "Requestor is owner"
3035 # description: "Determines if requestor is the document owner"
3036 # expression: "document.owner == request.auth.claims.email"
3037 #
3038 # Example (Logic):
3039 #
3040 # title: "Public documents"
3041 # description: "Determine whether the document should be publicly visible"
3042 # expression: "document.type != 'private' &amp;&amp; document.type != 'internal'"
3043 #
3044 # Example (Data Manipulation):
3045 #
3046 # title: "Notification string"
3047 # description: "Create a notification string with a timestamp."
3048 # expression: "'New message received at ' + string(document.create_time)"
3049 #
3050 # The exact variables and functions that may be referenced within an expression
3051 # are determined by the service that evaluates it. See the service
3052 # documentation for additional information.
3053 "description": "A String", # Optional. Description of the expression. This is a longer text which
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07003054 # describes the expression, e.g. when hovered over it in a UI.
Dan O'Mearadd494642020-05-01 07:42:23 -07003055 "expression": "A String", # Textual representation of an expression in Common Expression Language
3056 # syntax.
3057 "location": "A String", # Optional. String indicating the location of the expression for error
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07003058 # reporting, e.g. a file name and a position in the file.
Dan O'Mearadd494642020-05-01 07:42:23 -07003059 "title": "A String", # Optional. Title for the expression, i.e. a short string describing
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07003060 # its purpose. This can be used e.g. in UIs which allow to enter the
3061 # expression.
3062 },
3063 },
3064 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07003065 "auditConfigs": [ # Specifies cloud audit logging configuration for this policy.
3066 { # Specifies the audit configuration for a service.
3067 # The configuration determines which permission types are logged, and what
3068 # identities, if any, are exempted from logging.
3069 # An AuditConfig must have one or more AuditLogConfigs.
3070 #
3071 # If there are AuditConfigs for both `allServices` and a specific service,
3072 # the union of the two AuditConfigs is used for that service: the log_types
3073 # specified in each AuditConfig are enabled, and the exempted_members in each
3074 # AuditLogConfig are exempted.
3075 #
3076 # Example Policy with multiple AuditConfigs:
3077 #
3078 # {
3079 # "audit_configs": [
3080 # {
3081 # "service": "allServices"
3082 # "audit_log_configs": [
3083 # {
3084 # "log_type": "DATA_READ",
3085 # "exempted_members": [
Dan O'Mearadd494642020-05-01 07:42:23 -07003086 # "user:jose@example.com"
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07003087 # ]
3088 # },
3089 # {
3090 # "log_type": "DATA_WRITE",
3091 # },
3092 # {
3093 # "log_type": "ADMIN_READ",
3094 # }
3095 # ]
3096 # },
3097 # {
Dan O'Mearadd494642020-05-01 07:42:23 -07003098 # "service": "sampleservice.googleapis.com"
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07003099 # "audit_log_configs": [
3100 # {
3101 # "log_type": "DATA_READ",
3102 # },
3103 # {
3104 # "log_type": "DATA_WRITE",
3105 # "exempted_members": [
Dan O'Mearadd494642020-05-01 07:42:23 -07003106 # "user:aliya@example.com"
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07003107 # ]
3108 # }
3109 # ]
3110 # }
3111 # ]
3112 # }
3113 #
Dan O'Mearadd494642020-05-01 07:42:23 -07003114 # For sampleservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ
3115 # logging. It also exempts jose@example.com from DATA_READ logging, and
3116 # aliya@example.com from DATA_WRITE logging.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07003117 "auditLogConfigs": [ # The configuration for logging of each type of permission.
3118 { # Provides the configuration for logging a type of permissions.
3119 # Example:
3120 #
3121 # {
3122 # "audit_log_configs": [
3123 # {
3124 # "log_type": "DATA_READ",
3125 # "exempted_members": [
Dan O'Mearadd494642020-05-01 07:42:23 -07003126 # "user:jose@example.com"
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07003127 # ]
3128 # },
3129 # {
3130 # "log_type": "DATA_WRITE",
3131 # }
3132 # ]
3133 # }
3134 #
3135 # This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting
Dan O'Mearadd494642020-05-01 07:42:23 -07003136 # jose@example.com from DATA_READ logging.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07003137 "exemptedMembers": [ # Specifies the identities that do not cause logging for this type of
3138 # permission.
3139 # Follows the same format of Binding.members.
3140 "A String",
3141 ],
3142 "logType": "A String", # The log type that this config enables.
3143 },
3144 ],
3145 "service": "A String", # Specifies a service that will be enabled for audit logging.
3146 # For example, `storage.googleapis.com`, `cloudsql.googleapis.com`.
3147 # `allServices` is a special value that covers all services.
3148 },
3149 ],
Dan O'Mearadd494642020-05-01 07:42:23 -07003150 "etag": "A String", # `etag` is used for optimistic concurrency control as a way to help
3151 # prevent simultaneous updates of a policy from overwriting each other.
3152 # It is strongly suggested that systems make use of the `etag` in the
3153 # read-modify-write cycle to perform policy updates in order to avoid race
3154 # conditions: An `etag` is returned in the response to `getIamPolicy`, and
3155 # systems are expected to put that etag in the request to `setIamPolicy` to
3156 # ensure that their change will be applied to the same version of the policy.
3157 #
3158 # **Important:** If you use IAM Conditions, you must include the `etag` field
3159 # whenever you call `setIamPolicy`. If you omit this field, then IAM allows
3160 # you to overwrite a version `3` policy with a version `1` policy, and all of
3161 # the conditions in the version `3` policy are lost.
3162 "version": 42, # Specifies the format of the policy.
3163 #
3164 # Valid values are `0`, `1`, and `3`. Requests that specify an invalid value
3165 # are rejected.
3166 #
3167 # Any operation that affects conditional role bindings must specify version
3168 # `3`. This requirement applies to the following operations:
3169 #
3170 # * Getting a policy that includes a conditional role binding
3171 # * Adding a conditional role binding to a policy
3172 # * Changing a conditional role binding in a policy
3173 # * Removing any role binding, with or without a condition, from a policy
3174 # that includes conditions
3175 #
3176 # **Important:** If you use IAM Conditions, you must include the `etag` field
3177 # whenever you call `setIamPolicy`. If you omit this field, then IAM allows
3178 # you to overwrite a version `3` policy with a version `1` policy, and all of
3179 # the conditions in the version `3` policy are lost.
3180 #
3181 # If a policy does not include any conditions, operations on that policy may
3182 # specify any valid version or leave the field unset.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07003183 }</pre>
3184</div>
3185
3186<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -07003187 <code class="details" id="testIamPermissions">testIamPermissions(resource, body=None, x__xgafv=None)</code>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07003188 <pre>Returns permissions that a caller has on the specified resource.
3189If the resource does not exist, this will return an empty set of
3190permissions, not a NOT_FOUND error.
3191
3192Note: This operation is designed to be used for building permission-aware
3193UIs and command-line tools, not for authorization checking. This operation
3194may "fail open" without warning.
3195
3196Args:
3197 resource: string, REQUIRED: The resource for which the policy detail is being requested.
3198See the operation documentation for the appropriate value for this field. (required)
Dan O'Mearadd494642020-05-01 07:42:23 -07003199 body: object, The request body.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07003200 The object takes the form of:
3201
3202{ # Request message for `TestIamPermissions` method.
3203 "permissions": [ # The set of permissions to check for the `resource`. Permissions with
3204 # wildcards (such as '*' or 'storage.*') are not allowed. For more
3205 # information see
3206 # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
3207 "A String",
3208 ],
3209 }
3210
3211 x__xgafv: string, V1 error format.
3212 Allowed values
3213 1 - v1 error format
3214 2 - v2 error format
3215
3216Returns:
3217 An object of the form:
3218
3219 { # Response message for `TestIamPermissions` method.
3220 "permissions": [ # A subset of `TestPermissionsRequest.permissions` that the caller is
3221 # allowed.
3222 "A String",
3223 ],
3224 }</pre>
3225</div>
3226
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -04003227</body></html>