1# MIT License
2#
3# Copyright (c) 2023 Looker Data Sciences, Inc.
4#
5# Permission is hereby granted, free of charge, to any person obtaining a copy
6# of this software and associated documentation files (the "Software"), to deal
7# in the Software without restriction, including without limitation the rights
8# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9# copies of the Software, and to permit persons to whom the Software is
10# furnished to do so, subject to the following conditions:
11#
12# The above copyright notice and this permission notice shall be included in all
13# copies or substantial portions of the Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21# SOFTWARE.
22#
23
24# 471 API methods
25
26
27# NOTE: Do not edit this file generated by Looker SDK Codegen for API 4.0
28import datetime
29from typing import Any, MutableMapping, Optional, Sequence, Union, cast
30import warnings
31
32from . import models as mdls
33from looker_sdk.rtl import api_methods
34from looker_sdk.rtl import transport
35
36
37class Looker40SDK(api_methods.APIMethods):
38
39 # region Alert: Alert
40
41 # Follow an alert.
42 #
43 # POST /alerts/{alert_id}/follow -> None
44 def follow_alert(
45 self,
46 # ID of an alert
47 alert_id: str,
48 transport_options: Optional[transport.TransportOptions] = None,
49 ) -> None:
50 """Follow an alert"""
51 alert_id = self.encode_path_param(alert_id)
52 response = cast(
53 None,
54 self.post(
55 path=f"/alerts/{alert_id}/follow",
56 structure=None,
57 transport_options=transport_options,
58 ),
59 )
60 return response
61
62 # Unfollow an alert.
63 #
64 # DELETE /alerts/{alert_id}/follow -> None
65 def unfollow_alert(
66 self,
67 # ID of an alert
68 alert_id: str,
69 transport_options: Optional[transport.TransportOptions] = None,
70 ) -> None:
71 """Unfollow an alert"""
72 alert_id = self.encode_path_param(alert_id)
73 response = cast(
74 None,
75 self.delete(
76 path=f"/alerts/{alert_id}/follow",
77 structure=None,
78 transport_options=transport_options,
79 ),
80 )
81 return response
82
83 # ### Search Alerts
84 #
85 # GET /alerts/search -> Sequence[mdls.Alert]
86 def search_alerts(
87 self,
88 # (Optional) Number of results to return (used with `offset`).
89 limit: Optional[int] = None,
90 # (Optional) Number of results to skip before returning any (used with `limit`).
91 offset: Optional[int] = None,
92 # (Optional) Dimension by which to order the results(`dashboard` | `owner`)
93 group_by: Optional[str] = None,
94 # (Optional) Requested fields.
95 fields: Optional[str] = None,
96 # (Optional) Filter on returning only enabled or disabled alerts.
97 disabled: Optional[bool] = None,
98 # (Optional) Filter on alert frequency, such as: monthly, weekly, daily, hourly, minutes
99 frequency: Optional[str] = None,
100 # (Optional) Filter on whether the alert has met its condition when it last executed
101 condition_met: Optional[bool] = None,
102 # (Optional) Filter on the start range of the last time the alerts were run. Example: 2021-01-01T01:01:01-08:00.
103 last_run_start: Optional[str] = None,
104 # (Optional) Filter on the start range of the last time the alerts were run. Example: 2021-01-01T01:01:01-08:00.
105 last_run_end: Optional[str] = None,
106 # (Admin only) (Optional) Filter for all owners.
107 all_owners: Optional[bool] = None,
108 transport_options: Optional[transport.TransportOptions] = None,
109 ) -> Sequence[mdls.Alert]:
110 """Search Alerts"""
111 response = cast(
112 Sequence[mdls.Alert],
113 self.get(
114 path="/alerts/search",
115 structure=Sequence[mdls.Alert],
116 query_params={
117 "limit": limit,
118 "offset": offset,
119 "group_by": group_by,
120 "fields": fields,
121 "disabled": disabled,
122 "frequency": frequency,
123 "condition_met": condition_met,
124 "last_run_start": last_run_start,
125 "last_run_end": last_run_end,
126 "all_owners": all_owners,
127 },
128 transport_options=transport_options,
129 ),
130 )
131 return response
132
133 # ### Get an alert by a given alert ID
134 #
135 # GET /alerts/{alert_id} -> mdls.Alert
136 def get_alert(
137 self,
138 # ID of an alert
139 alert_id: str,
140 transport_options: Optional[transport.TransportOptions] = None,
141 ) -> mdls.Alert:
142 """Get an alert"""
143 alert_id = self.encode_path_param(alert_id)
144 response = cast(
145 mdls.Alert,
146 self.get(
147 path=f"/alerts/{alert_id}",
148 structure=mdls.Alert,
149 transport_options=transport_options,
150 ),
151 )
152 return response
153
154 # ### Update an alert
155 # # Required fields: `owner_id`, `field`, `destinations`, `comparison_type`, `threshold`, `cron`
156 # #
157 #
158 # PUT /alerts/{alert_id} -> mdls.Alert
159 def update_alert(
160 self,
161 # ID of an alert
162 alert_id: str,
163 body: mdls.WriteAlert,
164 transport_options: Optional[transport.TransportOptions] = None,
165 ) -> mdls.Alert:
166 """Update an alert"""
167 alert_id = self.encode_path_param(alert_id)
168 response = cast(
169 mdls.Alert,
170 self.put(
171 path=f"/alerts/{alert_id}",
172 structure=mdls.Alert,
173 body=body,
174 transport_options=transport_options,
175 ),
176 )
177 return response
178
179 # ### Update select alert fields
180 # # Available fields: `owner_id`, `is_disabled`, `disabled_reason`, `is_public`, `threshold`
181 # #
182 #
183 # PATCH /alerts/{alert_id} -> mdls.Alert
184 def update_alert_field(
185 self,
186 # ID of an alert
187 alert_id: str,
188 body: mdls.AlertPatch,
189 transport_options: Optional[transport.TransportOptions] = None,
190 ) -> mdls.Alert:
191 """Update select fields on an alert"""
192 alert_id = self.encode_path_param(alert_id)
193 response = cast(
194 mdls.Alert,
195 self.patch(
196 path=f"/alerts/{alert_id}",
197 structure=mdls.Alert,
198 body=body,
199 transport_options=transport_options,
200 ),
201 )
202 return response
203
204 # ### Delete an alert by a given alert ID
205 #
206 # DELETE /alerts/{alert_id} -> None
207 def delete_alert(
208 self,
209 # ID of an alert
210 alert_id: str,
211 transport_options: Optional[transport.TransportOptions] = None,
212 ) -> None:
213 """Delete an alert"""
214 alert_id = self.encode_path_param(alert_id)
215 response = cast(
216 None,
217 self.delete(
218 path=f"/alerts/{alert_id}",
219 structure=None,
220 transport_options=transport_options,
221 ),
222 )
223 return response
224
225 # ### Create a new alert and return details of the newly created object
226 #
227 # Required fields: `field`, `destinations`, `comparison_type`, `threshold`, `cron`
228 #
229 # Example Request:
230 # Run alert on dashboard element '103' at 5am every day. Send an email to 'test@test.com' if inventory for Los Angeles (using dashboard filter `Warehouse Name`) is lower than 1,000
231 # ```
232 # {
233 # "cron": "0 5 * * *",
234 # "custom_title": "Alert when LA inventory is low",
235 # "dashboard_element_id": 103,
236 # "applied_dashboard_filters": [
237 # {
238 # "filter_title": "Warehouse Name",
239 # "field_name": "distribution_centers.name",
240 # "filter_value": "Los Angeles CA",
241 # "filter_description": "is Los Angeles CA"
242 # }
243 # ],
244 # "comparison_type": "LESS_THAN",
245 # "destinations": [
246 # {
247 # "destination_type": "EMAIL",
248 # "email_address": "test@test.com"
249 # }
250 # ],
251 # "field": {
252 # "title": "Number on Hand",
253 # "name": "inventory_items.number_on_hand"
254 # },
255 # "is_disabled": false,
256 # "is_public": true,
257 # "threshold": 1000
258 # }
259 # ```
260 #
261 # POST /alerts -> mdls.Alert
262 def create_alert(
263 self,
264 body: mdls.WriteAlert,
265 transport_options: Optional[transport.TransportOptions] = None,
266 ) -> mdls.Alert:
267 """Create an alert"""
268 response = cast(
269 mdls.Alert,
270 self.post(
271 path="/alerts",
272 structure=mdls.Alert,
273 body=body,
274 transport_options=transport_options,
275 ),
276 )
277 return response
278
279 # ### Enqueue an Alert by ID
280 #
281 # POST /alerts/{alert_id}/enqueue -> None
282 def enqueue_alert(
283 self,
284 # ID of an alert
285 alert_id: str,
286 # Whether to enqueue an alert again if its already running.
287 force: Optional[bool] = None,
288 transport_options: Optional[transport.TransportOptions] = None,
289 ) -> None:
290 """Enqueue an alert"""
291 alert_id = self.encode_path_param(alert_id)
292 response = cast(
293 None,
294 self.post(
295 path=f"/alerts/{alert_id}/enqueue",
296 structure=None,
297 query_params={"force": force},
298 transport_options=transport_options,
299 ),
300 )
301 return response
302
303 # # Alert Notifications.
304 # The endpoint returns all the alert notifications received by the user on email in the past 7 days. It also returns whether the notifications have been read by the user.
305 #
306 # GET /alert_notifications -> Sequence[mdls.AlertNotifications]
307 def alert_notifications(
308 self,
309 # (Optional) Number of results to return (used with `offset`).
310 limit: Optional[int] = None,
311 # (Optional) Number of results to skip before returning any (used with `limit`).
312 offset: Optional[int] = None,
313 transport_options: Optional[transport.TransportOptions] = None,
314 ) -> Sequence[mdls.AlertNotifications]:
315 """Alert Notifications"""
316 response = cast(
317 Sequence[mdls.AlertNotifications],
318 self.get(
319 path="/alert_notifications",
320 structure=Sequence[mdls.AlertNotifications],
321 query_params={"limit": limit, "offset": offset},
322 transport_options=transport_options,
323 ),
324 )
325 return response
326
327 # # Reads a Notification
328 # The endpoint marks a given alert notification as read by the user, in case it wasn't already read. The AlertNotification model is updated for this purpose. It returns the notification as a response.
329 #
330 # PATCH /alert_notifications/{alert_notification_id} -> mdls.AlertNotifications
331 def read_alert_notification(
332 self,
333 # ID of a notification
334 alert_notification_id: str,
335 transport_options: Optional[transport.TransportOptions] = None,
336 ) -> mdls.AlertNotifications:
337 """Read a Notification"""
338 alert_notification_id = self.encode_path_param(alert_notification_id)
339 response = cast(
340 mdls.AlertNotifications,
341 self.patch(
342 path=f"/alert_notifications/{alert_notification_id}",
343 structure=mdls.AlertNotifications,
344 transport_options=transport_options,
345 ),
346 )
347 return response
348
349 # endregion
350
351 # region ApiAuth: API Authentication
352
353 # ### Present client credentials to obtain an authorization token
354 #
355 # Looker API implements the OAuth2 [Resource Owner Password Credentials Grant](https://cloud.google.com/looker/docs/r/api/outh2_resource_owner_pc) pattern.
356 # The client credentials required for this login must be obtained by creating an API key on a user account
357 # in the Looker Admin console. The API key consists of a public `client_id` and a private `client_secret`.
358 #
359 # The access token returned by `login` must be used in the HTTP Authorization header of subsequent
360 # API requests, like this:
361 # ```
362 # Authorization: token 4QDkCyCtZzYgj4C2p2cj3csJH7zqS5RzKs2kTnG4
363 # ```
364 # Replace "4QDkCy..." with the `access_token` value returned by `login`.
365 # The word `token` is a string literal and must be included exactly as shown.
366 #
367 # This function can accept `client_id` and `client_secret` parameters as URL query params or as www-form-urlencoded params in the body of the HTTP request. Since there is a small risk that URL parameters may be visible to intermediate nodes on the network route (proxies, routers, etc), passing credentials in the body of the request is considered more secure than URL params.
368 #
369 # Example of passing credentials in the HTTP request body:
370 # ````
371 # POST HTTP /login
372 # Content-Type: application/x-www-form-urlencoded
373 #
374 # client_id=CGc9B7v7J48dQSJvxxx&client_secret=nNVS9cSS3xNpSC9JdsBvvvvv
375 # ````
376 #
377 # ### Best Practice:
378 # Always pass credentials in body params. Pass credentials in URL query params **only** when you cannot pass body params due to application, tool, or other limitations.
379 #
380 # For more information and detailed examples of Looker API authorization, see [How to Authenticate to Looker API](https://github.com/looker/looker-sdk-ruby/blob/master/authentication.md).
381 #
382 # POST /login -> mdls.AccessToken
383 def login(
384 self,
385 # client_id part of API Key.
386 client_id: Optional[str] = None,
387 # client_secret part of API Key.
388 client_secret: Optional[str] = None,
389 transport_options: Optional[transport.TransportOptions] = None,
390 ) -> mdls.AccessToken:
391 """Login"""
392 response = cast(
393 mdls.AccessToken,
394 self.post(
395 path="/login",
396 structure=mdls.AccessToken,
397 query_params={"client_id": client_id, "client_secret": client_secret},
398 transport_options=transport_options,
399 ),
400 )
401 return response
402
403 # ### Create an access token that runs as a given user.
404 #
405 # This can only be called by an authenticated admin user. It allows that admin to generate a new
406 # authentication token for the user with the given user id. That token can then be used for subsequent
407 # API calls - which are then performed *as* that target user.
408 #
409 # The target user does *not* need to have a pre-existing API client_id/client_secret pair. And, no such
410 # credentials are created by this call.
411 #
412 # This allows for building systems where api user authentication for an arbitrary number of users is done
413 # outside of Looker and funneled through a single 'service account' with admin permissions. Note that a
414 # new access token is generated on each call. If target users are going to be making numerous API
415 # calls in a short period then it is wise to cache this authentication token rather than call this before
416 # each of those API calls.
417 #
418 # See 'login' for more detail on the access token and how to use it.
419 #
420 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
421 #
422 # POST /login/{user_id} -> mdls.AccessToken
423 def login_user(
424 self,
425 # Id of user.
426 user_id: str,
427 # When true (default), API calls using the returned access_token are attributed to the admin user who created the access_token. When false, API activity is attributed to the user the access_token runs as. False requires a looker license.
428 associative: Optional[bool] = None,
429 transport_options: Optional[transport.TransportOptions] = None,
430 ) -> mdls.AccessToken:
431 """Login user"""
432 user_id = self.encode_path_param(user_id)
433 warnings.warn(
434 "login_user behavior changed significantly in 21.4.0. See https://git.io/JOtH1"
435 )
436 response = cast(
437 mdls.AccessToken,
438 self.post(
439 path=f"/login/{user_id}",
440 structure=mdls.AccessToken,
441 query_params={"associative": associative},
442 transport_options=transport_options,
443 ),
444 )
445 return response
446
447 # ### Logout of the API and invalidate the current access token.
448 #
449 # DELETE /logout -> str
450 def logout(
451 self,
452 transport_options: Optional[transport.TransportOptions] = None,
453 ) -> str:
454 """Logout"""
455 response = cast(
456 str,
457 self.delete(
458 path="/logout", structure=str, transport_options=transport_options
459 ),
460 )
461 return response
462
463 # endregion
464
465 # region Artifact: Artifact Storage
466
467 # Get the maximum configured size of the entire artifact store, and the currently used storage in bytes.
468 #
469 # **Note**: The artifact storage API can only be used by Looker-built extensions.
470 #
471 # GET /artifact/usage -> mdls.ArtifactUsage
472 def artifact_usage(
473 self,
474 # Comma-delimited names of fields to return in responses. Omit for all fields
475 fields: Optional[str] = None,
476 transport_options: Optional[transport.TransportOptions] = None,
477 ) -> mdls.ArtifactUsage:
478 """Artifact store usage"""
479 response = cast(
480 mdls.ArtifactUsage,
481 self.get(
482 path="/artifact/usage",
483 structure=mdls.ArtifactUsage,
484 query_params={"fields": fields},
485 transport_options=transport_options,
486 ),
487 )
488 return response
489
490 # Get all artifact namespaces and the count of artifacts in each namespace
491 #
492 # **Note**: The artifact storage API can only be used by Looker-built extensions.
493 #
494 # GET /artifact/namespaces -> Sequence[mdls.ArtifactNamespace]
495 def artifact_namespaces(
496 self,
497 # Comma-delimited names of fields to return in responses. Omit for all fields
498 fields: Optional[str] = None,
499 # Number of results to return. (used with offset)
500 limit: Optional[int] = None,
501 # Number of results to skip before returning any. (used with limit)
502 offset: Optional[int] = None,
503 transport_options: Optional[transport.TransportOptions] = None,
504 ) -> Sequence[mdls.ArtifactNamespace]:
505 """Get namespaces and counts"""
506 response = cast(
507 Sequence[mdls.ArtifactNamespace],
508 self.get(
509 path="/artifact/namespaces",
510 structure=Sequence[mdls.ArtifactNamespace],
511 query_params={"fields": fields, "limit": limit, "offset": offset},
512 transport_options=transport_options,
513 ),
514 )
515 return response
516
517 # ### Return the value of an artifact
518 #
519 # The MIME type for the API response is set to the `content_type` of the value
520 #
521 # **Note**: The artifact storage API can only be used by Looker-built extensions.
522 #
523 # GET /artifact/{namespace}/value -> str
524 def artifact_value(
525 self,
526 # Artifact storage namespace
527 namespace: str,
528 # Artifact storage key. Namespace + Key must be unique
529 key: Optional[str] = None,
530 transport_options: Optional[transport.TransportOptions] = None,
531 ) -> str:
532 """Get an artifact value"""
533 namespace = self.encode_path_param(namespace)
534 response = cast(
535 str,
536 self.get(
537 path=f"/artifact/{namespace}/value",
538 structure=str,
539 query_params={"key": key},
540 transport_options=transport_options,
541 ),
542 )
543 return response
544
545 # Remove *all* artifacts from a namespace. Purged artifacts are permanently deleted
546 #
547 # **Note**: The artifact storage API can only be used by Looker-built extensions.
548 #
549 # DELETE /artifact/{namespace}/purge -> None
550 def purge_artifacts(
551 self,
552 # Artifact storage namespace
553 namespace: str,
554 transport_options: Optional[transport.TransportOptions] = None,
555 ) -> None:
556 """Purge artifacts"""
557 namespace = self.encode_path_param(namespace)
558 response = cast(
559 None,
560 self.delete(
561 path=f"/artifact/{namespace}/purge",
562 structure=None,
563 transport_options=transport_options,
564 ),
565 )
566 return response
567
568 # ### Search all key/value pairs in a namespace for matching criteria.
569 #
570 # Returns an array of artifacts matching the specified search criteria.
571 #
572 # Key search patterns use case-insensitive matching and can contain `%` and `_` as SQL LIKE pattern match wildcard expressions.
573 #
574 # The parameters `min_size` and `max_size` can be used individually or together.
575 #
576 # - `min_size` finds artifacts with sizes greater than or equal to its value
577 # - `max_size` finds artifacts with sizes less than or equal to its value
578 # - using both parameters restricts the minimum and maximum size range for artifacts
579 #
580 # **NOTE**: Artifacts are always returned in alphanumeric order by key.
581 #
582 # Get a **single artifact** by namespace and key with [`artifact`](#!/Artifact/artifact)
583 #
584 # **Note**: The artifact storage API can only be used by Looker-built extensions.
585 #
586 # GET /artifact/{namespace}/search -> Sequence[mdls.Artifact]
587 def search_artifacts(
588 self,
589 # Artifact storage namespace
590 namespace: str,
591 # Comma-delimited names of fields to return in responses. Omit for all fields
592 fields: Optional[str] = None,
593 # Key pattern to match
594 key: Optional[str] = None,
595 # Ids of users who created or updated the artifact (comma-delimited list)
596 user_ids: Optional[str] = None,
597 # Minimum storage size of the artifact
598 min_size: Optional[int] = None,
599 # Maximum storage size of the artifact
600 max_size: Optional[int] = None,
601 # Number of results to return. (used with offset)
602 limit: Optional[int] = None,
603 # Number of results to skip before returning any. (used with limit)
604 offset: Optional[int] = None,
605 # Return the full count of results in the X-Total-Count response header. (Slight performance hit.)
606 tally: Optional[bool] = None,
607 transport_options: Optional[transport.TransportOptions] = None,
608 ) -> Sequence[mdls.Artifact]:
609 """Search artifacts"""
610 namespace = self.encode_path_param(namespace)
611 response = cast(
612 Sequence[mdls.Artifact],
613 self.get(
614 path=f"/artifact/{namespace}/search",
615 structure=Sequence[mdls.Artifact],
616 query_params={
617 "fields": fields,
618 "key": key,
619 "user_ids": user_ids,
620 "min_size": min_size,
621 "max_size": max_size,
622 "limit": limit,
623 "offset": offset,
624 "tally": tally,
625 },
626 transport_options=transport_options,
627 ),
628 )
629 return response
630
631 # ### Get one or more artifacts
632 #
633 # Returns an array of artifacts matching the specified key value(s).
634 #
635 # **Note**: The artifact storage API can only be used by Looker-built extensions.
636 #
637 # GET /artifact/{namespace} -> Sequence[mdls.Artifact]
638 def artifact(
639 self,
640 # Artifact storage namespace
641 namespace: str,
642 # Comma-delimited list of keys. Wildcards not allowed.
643 key: str,
644 # Comma-delimited names of fields to return in responses. Omit for all fields
645 fields: Optional[str] = None,
646 # Number of results to return. (used with offset)
647 limit: Optional[int] = None,
648 # Number of results to skip before returning any. (used with limit)
649 offset: Optional[int] = None,
650 # Return the full count of results in the X-Total-Count response header. (Slight performance hit.)
651 tally: Optional[bool] = None,
652 transport_options: Optional[transport.TransportOptions] = None,
653 ) -> Sequence[mdls.Artifact]:
654 """Get one or more artifacts"""
655 namespace = self.encode_path_param(namespace)
656 response = cast(
657 Sequence[mdls.Artifact],
658 self.get(
659 path=f"/artifact/{namespace}",
660 structure=Sequence[mdls.Artifact],
661 query_params={
662 "key": key,
663 "fields": fields,
664 "limit": limit,
665 "offset": offset,
666 "tally": tally,
667 },
668 transport_options=transport_options,
669 ),
670 )
671 return response
672
673 # ### Delete one or more artifacts
674 #
675 # To avoid rate limiting on deletion requests, multiple artifacts can be deleted at the same time by using a comma-delimited list of artifact keys.
676 #
677 # **Note**: The artifact storage API can only be used by Looker-built extensions.
678 #
679 # DELETE /artifact/{namespace} -> None
680 def delete_artifact(
681 self,
682 # Artifact storage namespace
683 namespace: str,
684 # Comma-delimited list of keys. Wildcards not allowed.
685 key: str,
686 transport_options: Optional[transport.TransportOptions] = None,
687 ) -> None:
688 """Delete one or more artifacts"""
689 namespace = self.encode_path_param(namespace)
690 response = cast(
691 None,
692 self.delete(
693 path=f"/artifact/{namespace}",
694 structure=None,
695 query_params={"key": key},
696 transport_options=transport_options,
697 ),
698 )
699 return response
700
701 # ### Create or update one or more artifacts
702 #
703 # Only `key` and `value` are required to _create_ an artifact.
704 # To _update_ an artifact, its current `version` value must be provided.
705 #
706 # In the following example `body` payload, `one` and `two` are existing artifacts, and `three` is new:
707 #
708 # ```json
709 # [
710 # { "key": "one", "value": "[ \"updating\", \"existing\", \"one\" ]", "version": 10, "content_type": "application/json" },
711 # { "key": "two", "value": "updating existing two", "version": 20 },
712 # { "key": "three", "value": "creating new three" },
713 # ]
714 # ```
715 #
716 # Notes for this body:
717 #
718 # - The `value` for `key` **one** is a JSON payload, so a `content_type` override is needed. This override must be done **every** time a JSON value is set.
719 # - The `version` values for **one** and **two** mean they have been saved 10 and 20 times, respectively.
720 # - If `version` is **not** provided for an existing artifact, the entire request will be refused and a `Bad Request` response will be sent.
721 # - If `version` is provided for an artifact, it is only used for helping to prevent inadvertent data overwrites. It cannot be used to **set** the version of an artifact. The Looker server controls `version`.
722 # - We suggest encoding binary values as base64. Because the MIME content type for base64 is detected as plain text, also provide `content_type` to correctly indicate the value's type for retrieval and client-side processing.
723 #
724 # Because artifacts are stored encrypted, the same value can be written multiple times (provided the correct `version` number is used). Looker does not examine any values stored in the artifact store, and only decrypts when sending artifacts back in an API response.
725 #
726 # **Note**: The artifact storage API can only be used by Looker-built extensions.
727 #
728 # PUT /artifacts/{namespace} -> Sequence[mdls.Artifact]
729 def update_artifacts(
730 self,
731 # Artifact storage namespace
732 namespace: str,
733 body: Sequence[mdls.UpdateArtifact],
734 # Comma-delimited names of fields to return in responses. Omit for all fields
735 fields: Optional[str] = None,
736 transport_options: Optional[transport.TransportOptions] = None,
737 ) -> Sequence[mdls.Artifact]:
738 """Create or update artifacts"""
739 namespace = self.encode_path_param(namespace)
740 response = cast(
741 Sequence[mdls.Artifact],
742 self.put(
743 path=f"/artifacts/{namespace}",
744 structure=Sequence[mdls.Artifact],
745 query_params={"fields": fields},
746 body=body,
747 transport_options=transport_options,
748 ),
749 )
750 return response
751
752 # endregion
753
754 # region Auth: Manage User Authentication Configuration
755
756 # ### Create an embed secret using the specified information.
757 #
758 # The value of the `secret` field will be set by Looker and returned.
759 #
760 # **NOTE**: Calls to this endpoint require [Embedding](https://cloud.google.com/looker/docs/r/looker-core-feature-embed) to be enabled. Usage of this endpoint is not authorized for Looker Core Standard and Looker Core Enterprise.
761 #
762 # POST /embed_config/secrets -> mdls.EmbedSecret
763 def create_embed_secret(
764 self,
765 body: Optional[mdls.WriteEmbedSecret] = None,
766 transport_options: Optional[transport.TransportOptions] = None,
767 ) -> mdls.EmbedSecret:
768 """Create Embed Secret"""
769 response = cast(
770 mdls.EmbedSecret,
771 self.post(
772 path="/embed_config/secrets",
773 structure=mdls.EmbedSecret,
774 body=body,
775 transport_options=transport_options,
776 ),
777 )
778 return response
779
780 # ### Delete an embed secret.
781 #
782 # **NOTE**: Calls to this endpoint require [Embedding](https://cloud.google.com/looker/docs/r/looker-core-feature-embed) to be enabled. Usage of this endpoint is not authorized for Looker Core Standard and Looker Core Enterprise.
783 #
784 # DELETE /embed_config/secrets/{embed_secret_id} -> str
785 def delete_embed_secret(
786 self,
787 # Id of Embed Secret
788 embed_secret_id: str,
789 transport_options: Optional[transport.TransportOptions] = None,
790 ) -> str:
791 """Delete Embed Secret"""
792 embed_secret_id = self.encode_path_param(embed_secret_id)
793 response = cast(
794 str,
795 self.delete(
796 path=f"/embed_config/secrets/{embed_secret_id}",
797 structure=str,
798 transport_options=transport_options,
799 ),
800 )
801 return response
802
803 # ### Create Signed Embed URL
804 #
805 # Creates a signed embed URL and cryptographically signs it with an embed secret.
806 # This signed URL can then be used to instantiate a Looker embed session in a PBL web application.
807 # Do not make any modifications to the returned URL - any change may invalidate the signature and
808 # cause the URL to fail to load a Looker embed session.
809 #
810 # A signed embed URL can only be **used once**. After the URL has been used to request a page from the
811 # Looker server, it is invalid. Future requests using the same URL will fail. This is to prevent
812 # 'replay attacks'.
813 #
814 # The `target_url` property must be a complete URL of a Looker UI page - scheme, hostname, path and query params.
815 # To load a dashboard with id 56 and with a filter of `Date=1 years`, the looker URL would look like `https:/myname.looker.com/dashboards/56?Date=1%20years`.
816 # The best way to obtain this `target_url` is to navigate to the desired Looker page in your web browser and use the "Get embed URL" menu option
817 # to copy it to your clipboard and paste it into the `target_url` property as a quoted string value in this API request.
818 #
819 # Permissions for the embed user are defined by the groups in which the embed user is a member (`group_ids` property)
820 # and the lists of models and permissions assigned to the embed user.
821 # At a minimum, you must provide values for either the `group_ids` property, or **both** the models and permissions properties.
822 # These properties are additive; an embed user can be a member of certain groups AND be granted access to models and permissions.
823 #
824 # The embed user's access is the union of permissions granted by the `group_ids`, `models`, and `permissions` properties.
825 #
826 # This function does not strictly require all group_ids, user attribute names, or model names to exist at the moment the
827 # embed url is created. Unknown group_id, user attribute names or model names will be passed through to the output URL.
828 # Because of this, **these parameters are not validated** when the API call is made.
829 #
830 # The [Get Embed Url](https://cloud.google.com/looker/docs/r/get-signed-url) dialog can be used to determine and validate the correct permissions for signing an embed url.
831 # This dialog also provides the SDK syntax for the API call to make. Alternatively, you can copy the signed URL into the Embed URI Validator text box
832 # in `<your looker instance>/admin/embed` to diagnose potential problems.
833 #
834 # The `secret_id` parameter is optional. If specified, its value must be the id of an active secret defined in the Looker instance.
835 # if not specified, the URL will be signed using the most recent active signing secret. If there is no active secret for signing embed urls,
836 # a default secret will be created. This default secret is encrypted using HMAC/SHA-256.
837 #
838 # The `embed_domain` parameter is optional. If specified and valid, the domain will be added to the embed domain allowlist if it is missing.
839 #
840 # #### Security Note
841 # Protect this signed URL as you would an access token or password credentials - do not write
842 # it to disk, do not pass it to a third party, and only pass it through a secure HTTPS
843 # encrypted transport.
844 #
845 #
846 # **NOTE**: Calls to this endpoint require [Embedding](https://cloud.google.com/looker/docs/r/looker-core-feature-embed) to be enabled. Usage of this endpoint is not authorized for Looker Core Standard and Looker Core Enterprise.
847 #
848 # POST /embed/sso_url -> mdls.EmbedUrlResponse
849 def create_sso_embed_url(
850 self,
851 body: mdls.EmbedSsoParams,
852 transport_options: Optional[transport.TransportOptions] = None,
853 ) -> mdls.EmbedUrlResponse:
854 """Create Signed Embed Url"""
855 response = cast(
856 mdls.EmbedUrlResponse,
857 self.post(
858 path="/embed/sso_url",
859 structure=mdls.EmbedUrlResponse,
860 body=body,
861 transport_options=transport_options,
862 ),
863 )
864 return response
865
866 # ### Create an Embed URL
867 #
868 # Creates an embed URL that runs as the Looker user making this API call. ("Embed as me")
869 # This embed URL can then be used to instantiate a Looker embed session in a
870 # "Powered by Looker" (PBL) web application.
871 #
872 # This is similar to Private Embedding (https://cloud.google.com/looker/docs/r/admin/embed/private-embed). Instead of
873 # logging into the Web UI to authenticate, the user has already authenticated against the API to be able to
874 # make this call. However, unlike Private Embed where the user has access to any other part of the Looker UI,
875 # the embed web session created by requesting the EmbedUrlResponse.url in a browser only has access to
876 # content visible under the `/embed` context.
877 #
878 # An embed URL can only be used once, and must be used within 5 minutes of being created. After it
879 # has been used to request a page from the Looker server, the URL is invalid. Future requests using
880 # the same URL will fail. This is to prevent 'replay attacks'.
881 #
882 # The `target_url` property must be a complete URL of a Looker Embedded UI page - scheme, hostname, path starting with "/embed" and query params.
883 # To load a dashboard with id 56 and with a filter of `Date=1 years`, the looker Embed URL would look like `https://myname.looker.com/embed/dashboards/56?Date=1%20years`.
884 # The best way to obtain this target_url is to navigate to the desired Looker page in your web browser,
885 # copy the URL shown in the browser address bar, insert "/embed" after the host/port, and paste it into the `target_url` property as a quoted string value in this API request.
886 #
887 # #### Security Note
888 # Protect this signed URL as you would an access token or password credentials - do not write
889 # it to disk, do not pass it to a third party, and only pass it through a secure HTTPS
890 # encrypted transport.
891 #
892 # POST /embed/token_url/me -> mdls.EmbedUrlResponse
893 def create_embed_url_as_me(
894 self,
895 body: mdls.EmbedParams,
896 transport_options: Optional[transport.TransportOptions] = None,
897 ) -> mdls.EmbedUrlResponse:
898 """Create Embed URL"""
899 response = cast(
900 mdls.EmbedUrlResponse,
901 self.post(
902 path="/embed/token_url/me",
903 structure=mdls.EmbedUrlResponse,
904 body=body,
905 transport_options=transport_options,
906 ),
907 )
908 return response
909
910 # ### Validate a Signed Embed URL
911 #
912 # GET /embed/sso/validate -> mdls.EmbedUrlResponse
913 def validate_embed_url(
914 self,
915 # URL to validate
916 url: Optional[str] = None,
917 transport_options: Optional[transport.TransportOptions] = None,
918 ) -> mdls.EmbedUrlResponse:
919 """Get Embed URL Validation"""
920 response = cast(
921 mdls.EmbedUrlResponse,
922 self.get(
923 path="/embed/sso/validate",
924 structure=mdls.EmbedUrlResponse,
925 query_params={"url": url},
926 transport_options=transport_options,
927 ),
928 )
929 return response
930
931 # ### Acquire a cookieless embed session.
932 #
933 # The acquire session endpoint negates the need for signing the embed url and passing it as a parameter
934 # to the embed login. This endpoint accepts an embed user definition and creates or updates it. This is
935 # similar behavior to the embed SSO login as they both can create and update embed user data.
936 #
937 # The endpoint also accepts an optional `session_reference_token`. If present and the session has not expired
938 # and the credentials match the credentials for the embed session, a new authentication token will be
939 # generated. This allows the embed session to attach a new embedded IFRAME to the embed session. Note that
940 # the session is NOT extended in this scenario. In other words the session_length parameter is ignored.
941 #
942 # **IMPORTANT:** If the `session_reference_token` is provided and the session has NOT expired, the embed user
943 # is NOT updated. This is done for performance reasons and to support the embed SSO usecase where the
944 # first IFRAME created on a page uses a signed url and subsequently created IFRAMEs do not.
945 #
946 # If the `session_reference_token` is provided but the session has expired, the token will be ignored and a
947 # new embed session will be created. Note that the embed user definition will be updated in this scenario.
948 #
949 # If the credentials do not match the credentials associated with an existing session_reference_token, a
950 # 404 will be returned.
951 #
952 # The endpoint returns the following:
953 # - Authentication token - a token that is passed to `/embed/login` endpoint that creates or attaches to the
954 # embed session. This token can be used once and has a lifetime of 30 seconds.
955 # - Session reference token - a token that lives for the length of the session. This token is used to
956 # generate new api and navigation tokens OR create new embed IFRAMEs.
957 # - Api token - lives for 10 minutes. The Looker client will ask for this token once it is loaded into the
958 # iframe.
959 # - Navigation token - lives for 10 minutes. The Looker client will ask for this token once it is loaded into
960 # the iframe.
961 #
962 # **NOTE**: Calls to this endpoint require [Embedding](https://cloud.google.com/looker/docs/r/looker-core-feature-embed) to be enabled. Usage of this endpoint is not authorized for Looker Core Standard and Looker Core Enterprise.
963 #
964 # POST /embed/cookieless_session/acquire -> mdls.EmbedCookielessSessionAcquireResponse
965 def acquire_embed_cookieless_session(
966 self,
967 body: mdls.EmbedCookielessSessionAcquire,
968 transport_options: Optional[transport.TransportOptions] = None,
969 ) -> mdls.EmbedCookielessSessionAcquireResponse:
970 """Create Acquire cookieless embed session"""
971 response = cast(
972 mdls.EmbedCookielessSessionAcquireResponse,
973 self.post(
974 path="/embed/cookieless_session/acquire",
975 structure=mdls.EmbedCookielessSessionAcquireResponse,
976 body=body,
977 transport_options=transport_options,
978 ),
979 )
980 return response
981
982 # ### Delete cookieless embed session
983 #
984 # This will delete the session associated with the given session reference token. Calling this endpoint will result
985 # in the session and session reference data being cleared from the system. This endpoint can be used to log an embed
986 # user out of the Looker instance.
987 #
988 # **NOTE**: Calls to this endpoint require [Embedding](https://cloud.google.com/looker/docs/r/looker-core-feature-embed) to be enabled. Usage of this endpoint is not authorized for Looker Core Standard and Looker Core Enterprise.
989 #
990 # DELETE /embed/cookieless_session/{session_reference_token} -> str
991 def delete_embed_cookieless_session(
992 self,
993 # Embed session reference token
994 session_reference_token: str,
995 transport_options: Optional[transport.TransportOptions] = None,
996 ) -> str:
997 """Delete cookieless embed session"""
998 session_reference_token = self.encode_path_param(session_reference_token)
999 response = cast(
1000 str,
1001 self.delete(
1002 path=f"/embed/cookieless_session/{session_reference_token}",
1003 structure=str,
1004 transport_options=transport_options,
1005 ),
1006 )
1007 return response
1008
1009 # ### Generate api and navigation tokens for a cookieless embed session
1010 #
1011 # The generate tokens endpoint is used to create new tokens of type:
1012 # - Api token.
1013 # - Navigation token.
1014 # The generate tokens endpoint should be called every time the Looker client asks for a token (except for the
1015 # first time when the tokens returned by the acquire_session endpoint should be used).
1016 #
1017 # #### Embed session expiration handling
1018 #
1019 # This endpoint does NOT return an error when the embed session expires. This is to simplify processing
1020 # in the caller as errors can happen for non session expiration reasons. Instead the endpoint returns
1021 # the session time to live in the `session_reference_token_ttl` response property. If this property
1022 # contains a zero, the embed session has expired.
1023 #
1024 # **NOTE**: Calls to this endpoint require [Embedding](https://cloud.google.com/looker/docs/r/looker-core-feature-embed) to be enabled. Usage of this endpoint is not authorized for Looker Core Standard and Looker Core Enterprise.
1025 #
1026 # PUT /embed/cookieless_session/generate_tokens -> mdls.EmbedCookielessSessionGenerateTokensResponse
1027 def generate_tokens_for_cookieless_session(
1028 self,
1029 body: mdls.EmbedCookielessSessionGenerateTokens,
1030 transport_options: Optional[transport.TransportOptions] = None,
1031 ) -> mdls.EmbedCookielessSessionGenerateTokensResponse:
1032 """Generate tokens for cookieless embed session"""
1033 response = cast(
1034 mdls.EmbedCookielessSessionGenerateTokensResponse,
1035 self.put(
1036 path="/embed/cookieless_session/generate_tokens",
1037 structure=mdls.EmbedCookielessSessionGenerateTokensResponse,
1038 body=body,
1039 transport_options=transport_options,
1040 ),
1041 )
1042 return response
1043
1044 # ### Get the LDAP configuration.
1045 #
1046 # Looker can be optionally configured to authenticate users against an Active Directory or other LDAP directory server.
1047 # LDAP setup requires coordination with an administrator of that directory server.
1048 #
1049 # Only Looker administrators can read and update the LDAP configuration.
1050 #
1051 # Configuring LDAP impacts authentication for all users. This configuration should be done carefully.
1052 #
1053 # Looker maintains a single LDAP configuration. It can be read and updated. Updates only succeed if the new state will be valid (in the sense that all required fields are populated); it is up to you to ensure that the configuration is appropriate and correct).
1054 #
1055 # LDAP is enabled or disabled for Looker using the **enabled** field.
1056 #
1057 # Looker will never return an **auth_password** field. That value can be set, but never retrieved.
1058 #
1059 # See the [Looker LDAP docs](https://cloud.google.com/looker/docs/r/api/ldap_setup) for additional information.
1060 #
1061 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1062 #
1063 # GET /ldap_config -> mdls.LDAPConfig
1064 def ldap_config(
1065 self,
1066 transport_options: Optional[transport.TransportOptions] = None,
1067 ) -> mdls.LDAPConfig:
1068 """Get LDAP Configuration"""
1069 response = cast(
1070 mdls.LDAPConfig,
1071 self.get(
1072 path="/ldap_config",
1073 structure=mdls.LDAPConfig,
1074 transport_options=transport_options,
1075 ),
1076 )
1077 return response
1078
1079 # ### Update the LDAP configuration.
1080 #
1081 # Configuring LDAP impacts authentication for all users. This configuration should be done carefully.
1082 #
1083 # Only Looker administrators can read and update the LDAP configuration.
1084 #
1085 # LDAP is enabled or disabled for Looker using the **enabled** field.
1086 #
1087 # It is **highly** recommended that any LDAP setting changes be tested using the APIs below before being set globally.
1088 #
1089 # See the [Looker LDAP docs](https://cloud.google.com/looker/docs/r/api/ldap_setup) for additional information.
1090 #
1091 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1092 #
1093 # PATCH /ldap_config -> mdls.LDAPConfig
1094 def update_ldap_config(
1095 self,
1096 body: mdls.WriteLDAPConfig,
1097 transport_options: Optional[transport.TransportOptions] = None,
1098 ) -> mdls.LDAPConfig:
1099 """Update LDAP Configuration"""
1100 response = cast(
1101 mdls.LDAPConfig,
1102 self.patch(
1103 path="/ldap_config",
1104 structure=mdls.LDAPConfig,
1105 body=body,
1106 transport_options=transport_options,
1107 ),
1108 )
1109 return response
1110
1111 # ### Test the connection settings for an LDAP configuration.
1112 #
1113 # This tests that the connection is possible given a connection_host and connection_port.
1114 #
1115 # **connection_host** and **connection_port** are required. **connection_tls** is optional.
1116 #
1117 # Example:
1118 # ```json
1119 # {
1120 # "connection_host": "ldap.example.com",
1121 # "connection_port": "636",
1122 # "connection_tls": true
1123 # }
1124 # ```
1125 #
1126 # No authentication to the LDAP server is attempted.
1127 #
1128 # The active LDAP settings are not modified.
1129 #
1130 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1131 #
1132 # PUT /ldap_config/test_connection -> mdls.LDAPConfigTestResult
1133 def test_ldap_config_connection(
1134 self,
1135 body: mdls.WriteLDAPConfig,
1136 transport_options: Optional[transport.TransportOptions] = None,
1137 ) -> mdls.LDAPConfigTestResult:
1138 """Test LDAP Connection"""
1139 response = cast(
1140 mdls.LDAPConfigTestResult,
1141 self.put(
1142 path="/ldap_config/test_connection",
1143 structure=mdls.LDAPConfigTestResult,
1144 body=body,
1145 transport_options=transport_options,
1146 ),
1147 )
1148 return response
1149
1150 # ### Test the connection authentication settings for an LDAP configuration.
1151 #
1152 # This tests that the connection is possible and that a 'server' account to be used by Looker can authenticate to the LDAP server given connection and authentication information.
1153 #
1154 # **connection_host**, **connection_port**, and **auth_username**, are required. **connection_tls** and **auth_password** are optional.
1155 #
1156 # Example:
1157 # ```json
1158 # {
1159 # "connection_host": "ldap.example.com",
1160 # "connection_port": "636",
1161 # "connection_tls": true,
1162 # "auth_username": "cn=looker,dc=example,dc=com",
1163 # "auth_password": "secret"
1164 # }
1165 # ```
1166 #
1167 # Looker will never return an **auth_password**. If this request omits the **auth_password** field, then the **auth_password** value from the active config (if present) will be used for the test.
1168 #
1169 # The active LDAP settings are not modified.
1170 #
1171 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1172 #
1173 # PUT /ldap_config/test_auth -> mdls.LDAPConfigTestResult
1174 def test_ldap_config_auth(
1175 self,
1176 body: mdls.WriteLDAPConfig,
1177 transport_options: Optional[transport.TransportOptions] = None,
1178 ) -> mdls.LDAPConfigTestResult:
1179 """Test LDAP Auth"""
1180 response = cast(
1181 mdls.LDAPConfigTestResult,
1182 self.put(
1183 path="/ldap_config/test_auth",
1184 structure=mdls.LDAPConfigTestResult,
1185 body=body,
1186 transport_options=transport_options,
1187 ),
1188 )
1189 return response
1190
1191 # ### Test the user authentication settings for an LDAP configuration without authenticating the user.
1192 #
1193 # This test will let you easily test the mapping for user properties and roles for any user withoutneeding to authenticate as that user.
1194 #
1195 # This test accepts a full LDAP configuration along with a username and attempts to find the full infofor the user from the LDAP server without actually authenticating the user. So, user password is notrequired.The configuration is validated before attempting to contact the server.
1196 #
1197 # **test_ldap_user** is required.
1198 #
1199 # The active LDAP settings are not modified.
1200 #
1201 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1202 #
1203 # PUT /ldap_config/test_user_info -> mdls.LDAPConfigTestResult
1204 def test_ldap_config_user_info(
1205 self,
1206 body: mdls.WriteLDAPConfig,
1207 transport_options: Optional[transport.TransportOptions] = None,
1208 ) -> mdls.LDAPConfigTestResult:
1209 """Test LDAP User Info"""
1210 response = cast(
1211 mdls.LDAPConfigTestResult,
1212 self.put(
1213 path="/ldap_config/test_user_info",
1214 structure=mdls.LDAPConfigTestResult,
1215 body=body,
1216 transport_options=transport_options,
1217 ),
1218 )
1219 return response
1220
1221 # ### Test the user authentication settings for an LDAP configuration.
1222 #
1223 # This test accepts a full LDAP configuration along with a username/password pair and attempts to authenticate the user with the LDAP server. The configuration is validated before attempting the authentication.
1224 #
1225 # Looker will never return an **auth_password**. If this request omits the **auth_password** field, then the **auth_password** value from the active config (if present) will be used for the test.
1226 #
1227 # **test_ldap_user** and **test_ldap_password** are required.
1228 #
1229 # The active LDAP settings are not modified.
1230 #
1231 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1232 #
1233 # PUT /ldap_config/test_user_auth -> mdls.LDAPConfigTestResult
1234 def test_ldap_config_user_auth(
1235 self,
1236 body: mdls.WriteLDAPConfig,
1237 transport_options: Optional[transport.TransportOptions] = None,
1238 ) -> mdls.LDAPConfigTestResult:
1239 """Test LDAP User Auth"""
1240 response = cast(
1241 mdls.LDAPConfigTestResult,
1242 self.put(
1243 path="/ldap_config/test_user_auth",
1244 structure=mdls.LDAPConfigTestResult,
1245 body=body,
1246 transport_options=transport_options,
1247 ),
1248 )
1249 return response
1250
1251 # ### Registers a mobile device.
1252 # # Required fields: [:device_token, :device_type]
1253 #
1254 # POST /mobile/device -> mdls.MobileToken
1255 def register_mobile_device(
1256 self,
1257 body: mdls.WriteMobileToken,
1258 transport_options: Optional[transport.TransportOptions] = None,
1259 ) -> mdls.MobileToken:
1260 """Register Mobile Device"""
1261 response = cast(
1262 mdls.MobileToken,
1263 self.post(
1264 path="/mobile/device",
1265 structure=mdls.MobileToken,
1266 body=body,
1267 transport_options=transport_options,
1268 ),
1269 )
1270 return response
1271
1272 # ### Updates the mobile device registration
1273 #
1274 # PATCH /mobile/device/{device_id} -> mdls.MobileToken
1275 def update_mobile_device_registration(
1276 self,
1277 # Unique id of the device.
1278 device_id: str,
1279 transport_options: Optional[transport.TransportOptions] = None,
1280 ) -> mdls.MobileToken:
1281 """Update Mobile Device Registration"""
1282 device_id = self.encode_path_param(device_id)
1283 response = cast(
1284 mdls.MobileToken,
1285 self.patch(
1286 path=f"/mobile/device/{device_id}",
1287 structure=mdls.MobileToken,
1288 transport_options=transport_options,
1289 ),
1290 )
1291 return response
1292
1293 # ### Deregister a mobile device.
1294 #
1295 # DELETE /mobile/device/{device_id} -> None
1296 def deregister_mobile_device(
1297 self,
1298 # Unique id of the device.
1299 device_id: str,
1300 transport_options: Optional[transport.TransportOptions] = None,
1301 ) -> None:
1302 """Deregister Mobile Device"""
1303 device_id = self.encode_path_param(device_id)
1304 response = cast(
1305 None,
1306 self.delete(
1307 path=f"/mobile/device/{device_id}",
1308 structure=None,
1309 transport_options=transport_options,
1310 ),
1311 )
1312 return response
1313
1314 # ### List All OAuth Client Apps
1315 #
1316 # Lists all applications registered to use OAuth2 login with this Looker instance, including
1317 # enabled and disabled apps.
1318 #
1319 # Results are filtered to include only the apps that the caller (current user)
1320 # has permission to see.
1321 #
1322 # GET /oauth_client_apps -> Sequence[mdls.OauthClientApp]
1323 def all_oauth_client_apps(
1324 self,
1325 # Requested fields.
1326 fields: Optional[str] = None,
1327 transport_options: Optional[transport.TransportOptions] = None,
1328 ) -> Sequence[mdls.OauthClientApp]:
1329 """Get All OAuth Client Apps"""
1330 response = cast(
1331 Sequence[mdls.OauthClientApp],
1332 self.get(
1333 path="/oauth_client_apps",
1334 structure=Sequence[mdls.OauthClientApp],
1335 query_params={"fields": fields},
1336 transport_options=transport_options,
1337 ),
1338 )
1339 return response
1340
1341 # ### Get Oauth Client App
1342 #
1343 # Returns the registered app client with matching client_guid.
1344 #
1345 # GET /oauth_client_apps/{client_guid} -> mdls.OauthClientApp
1346 def oauth_client_app(
1347 self,
1348 # The unique id of this application
1349 client_guid: str,
1350 # Requested fields.
1351 fields: Optional[str] = None,
1352 transport_options: Optional[transport.TransportOptions] = None,
1353 ) -> mdls.OauthClientApp:
1354 """Get OAuth Client App"""
1355 client_guid = self.encode_path_param(client_guid)
1356 response = cast(
1357 mdls.OauthClientApp,
1358 self.get(
1359 path=f"/oauth_client_apps/{client_guid}",
1360 structure=mdls.OauthClientApp,
1361 query_params={"fields": fields},
1362 transport_options=transport_options,
1363 ),
1364 )
1365 return response
1366
1367 # ### Register an OAuth2 Client App
1368 #
1369 # Registers details identifying an external web app or native app as an OAuth2 login client of the Looker instance.
1370 # The app registration must provide a unique client_guid and redirect_uri that the app will present
1371 # in OAuth login requests. If the client_guid and redirect_uri parameters in the login request do not match
1372 # the app details registered with the Looker instance, the request is assumed to be a forgery and is rejected.
1373 #
1374 # POST /oauth_client_apps/{client_guid} -> mdls.OauthClientApp
1375 def register_oauth_client_app(
1376 self,
1377 # The unique id of this application
1378 client_guid: str,
1379 body: mdls.WriteOauthClientApp,
1380 # Requested fields.
1381 fields: Optional[str] = None,
1382 transport_options: Optional[transport.TransportOptions] = None,
1383 ) -> mdls.OauthClientApp:
1384 """Register OAuth App"""
1385 client_guid = self.encode_path_param(client_guid)
1386 response = cast(
1387 mdls.OauthClientApp,
1388 self.post(
1389 path=f"/oauth_client_apps/{client_guid}",
1390 structure=mdls.OauthClientApp,
1391 query_params={"fields": fields},
1392 body=body,
1393 transport_options=transport_options,
1394 ),
1395 )
1396 return response
1397
1398 # ### Update OAuth2 Client App Details
1399 #
1400 # Modifies the details a previously registered OAuth2 login client app.
1401 #
1402 # PATCH /oauth_client_apps/{client_guid} -> mdls.OauthClientApp
1403 def update_oauth_client_app(
1404 self,
1405 # The unique id of this application
1406 client_guid: str,
1407 body: mdls.WriteOauthClientApp,
1408 # Requested fields.
1409 fields: Optional[str] = None,
1410 transport_options: Optional[transport.TransportOptions] = None,
1411 ) -> mdls.OauthClientApp:
1412 """Update OAuth App"""
1413 client_guid = self.encode_path_param(client_guid)
1414 response = cast(
1415 mdls.OauthClientApp,
1416 self.patch(
1417 path=f"/oauth_client_apps/{client_guid}",
1418 structure=mdls.OauthClientApp,
1419 query_params={"fields": fields},
1420 body=body,
1421 transport_options=transport_options,
1422 ),
1423 )
1424 return response
1425
1426 # ### Delete OAuth Client App
1427 #
1428 # Deletes the registration info of the app with the matching client_guid.
1429 # All active sessions and tokens issued for this app will immediately become invalid.
1430 #
1431 # As with most REST DELETE operations, this endpoint does not return an error if the
1432 # indicated resource does not exist.
1433 #
1434 # ### Note: this deletion cannot be undone.
1435 #
1436 # DELETE /oauth_client_apps/{client_guid} -> str
1437 def delete_oauth_client_app(
1438 self,
1439 # The unique id of this application
1440 client_guid: str,
1441 transport_options: Optional[transport.TransportOptions] = None,
1442 ) -> str:
1443 """Delete OAuth Client App"""
1444 client_guid = self.encode_path_param(client_guid)
1445 response = cast(
1446 str,
1447 self.delete(
1448 path=f"/oauth_client_apps/{client_guid}",
1449 structure=str,
1450 transport_options=transport_options,
1451 ),
1452 )
1453 return response
1454
1455 # ### Invalidate All Issued Tokens
1456 #
1457 # Immediately invalidates all auth codes, sessions, access tokens and refresh tokens issued for
1458 # this app for ALL USERS of this app.
1459 #
1460 # DELETE /oauth_client_apps/{client_guid}/tokens -> str
1461 def invalidate_tokens(
1462 self,
1463 # The unique id of the application
1464 client_guid: str,
1465 transport_options: Optional[transport.TransportOptions] = None,
1466 ) -> str:
1467 """Invalidate Tokens"""
1468 client_guid = self.encode_path_param(client_guid)
1469 response = cast(
1470 str,
1471 self.delete(
1472 path=f"/oauth_client_apps/{client_guid}/tokens",
1473 structure=str,
1474 transport_options=transport_options,
1475 ),
1476 )
1477 return response
1478
1479 # ### Activate an app for a user
1480 #
1481 # Activates a user for a given oauth client app. This indicates the user has been informed that
1482 # the app will have access to the user's looker data, and that the user has accepted and allowed
1483 # the app to use their Looker account.
1484 #
1485 # Activating a user for an app that the user is already activated with returns a success response.
1486 #
1487 # POST /oauth_client_apps/{client_guid}/users/{user_id} -> str
1488 def activate_app_user(
1489 self,
1490 # The unique id of this application
1491 client_guid: str,
1492 # The id of the user to enable use of this app
1493 user_id: str,
1494 # Requested fields.
1495 fields: Optional[str] = None,
1496 transport_options: Optional[transport.TransportOptions] = None,
1497 ) -> str:
1498 """Activate OAuth App User"""
1499 client_guid = self.encode_path_param(client_guid)
1500 user_id = self.encode_path_param(user_id)
1501 response = cast(
1502 str,
1503 self.post(
1504 path=f"/oauth_client_apps/{client_guid}/users/{user_id}",
1505 structure=str,
1506 query_params={"fields": fields},
1507 transport_options=transport_options,
1508 ),
1509 )
1510 return response
1511
1512 # ### Deactivate an app for a user
1513 #
1514 # Deactivate a user for a given oauth client app. All tokens issued to the app for
1515 # this user will be invalid immediately. Before the user can use the app with their
1516 # Looker account, the user will have to read and accept an account use disclosure statement for the app.
1517 #
1518 # Admin users can deactivate other users, but non-admin users can only deactivate themselves.
1519 #
1520 # As with most REST DELETE operations, this endpoint does not return an error if the indicated
1521 # resource (app or user) does not exist or has already been deactivated.
1522 #
1523 # DELETE /oauth_client_apps/{client_guid}/users/{user_id} -> str
1524 def deactivate_app_user(
1525 self,
1526 # The unique id of this application
1527 client_guid: str,
1528 # The id of the user to enable use of this app
1529 user_id: str,
1530 # Requested fields.
1531 fields: Optional[str] = None,
1532 transport_options: Optional[transport.TransportOptions] = None,
1533 ) -> str:
1534 """Deactivate OAuth App User"""
1535 client_guid = self.encode_path_param(client_guid)
1536 user_id = self.encode_path_param(user_id)
1537 response = cast(
1538 str,
1539 self.delete(
1540 path=f"/oauth_client_apps/{client_guid}/users/{user_id}",
1541 structure=str,
1542 query_params={"fields": fields},
1543 transport_options=transport_options,
1544 ),
1545 )
1546 return response
1547
1548 # ### Get the OIDC configuration.
1549 #
1550 # Looker can be optionally configured to authenticate users against an OpenID Connect (OIDC)
1551 # authentication server. OIDC setup requires coordination with an administrator of that server.
1552 #
1553 # Only Looker administrators can read and update the OIDC configuration.
1554 #
1555 # Configuring OIDC impacts authentication for all users. This configuration should be done carefully.
1556 #
1557 # Looker maintains a single OIDC configuration. It can be read and updated. Updates only succeed if the new state will be valid (in the sense that all required fields are populated); it is up to you to ensure that the configuration is appropriate and correct).
1558 #
1559 # OIDC is enabled or disabled for Looker using the **enabled** field.
1560 #
1561 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1562 #
1563 # GET /oidc_config -> mdls.OIDCConfig
1564 def oidc_config(
1565 self,
1566 transport_options: Optional[transport.TransportOptions] = None,
1567 ) -> mdls.OIDCConfig:
1568 """Get OIDC Configuration"""
1569 response = cast(
1570 mdls.OIDCConfig,
1571 self.get(
1572 path="/oidc_config",
1573 structure=mdls.OIDCConfig,
1574 transport_options=transport_options,
1575 ),
1576 )
1577 return response
1578
1579 # ### Update the OIDC configuration.
1580 #
1581 # Configuring OIDC impacts authentication for all users. This configuration should be done carefully.
1582 #
1583 # Only Looker administrators can read and update the OIDC configuration.
1584 #
1585 # OIDC is enabled or disabled for Looker using the **enabled** field.
1586 #
1587 # It is **highly** recommended that any OIDC setting changes be tested using the APIs below before being set globally.
1588 #
1589 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1590 #
1591 # PATCH /oidc_config -> mdls.OIDCConfig
1592 def update_oidc_config(
1593 self,
1594 body: mdls.WriteOIDCConfig,
1595 transport_options: Optional[transport.TransportOptions] = None,
1596 ) -> mdls.OIDCConfig:
1597 """Update OIDC Configuration"""
1598 response = cast(
1599 mdls.OIDCConfig,
1600 self.patch(
1601 path="/oidc_config",
1602 structure=mdls.OIDCConfig,
1603 body=body,
1604 transport_options=transport_options,
1605 ),
1606 )
1607 return response
1608
1609 # ### Get a OIDC test configuration by test_slug.
1610 #
1611 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1612 #
1613 # GET /oidc_test_configs/{test_slug} -> mdls.OIDCConfig
1614 def oidc_test_config(
1615 self,
1616 # Slug of test config
1617 test_slug: str,
1618 transport_options: Optional[transport.TransportOptions] = None,
1619 ) -> mdls.OIDCConfig:
1620 """Get OIDC Test Configuration"""
1621 test_slug = self.encode_path_param(test_slug)
1622 response = cast(
1623 mdls.OIDCConfig,
1624 self.get(
1625 path=f"/oidc_test_configs/{test_slug}",
1626 structure=mdls.OIDCConfig,
1627 transport_options=transport_options,
1628 ),
1629 )
1630 return response
1631
1632 # ### Delete a OIDC test configuration.
1633 #
1634 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1635 #
1636 # DELETE /oidc_test_configs/{test_slug} -> str
1637 def delete_oidc_test_config(
1638 self,
1639 # Slug of test config
1640 test_slug: str,
1641 transport_options: Optional[transport.TransportOptions] = None,
1642 ) -> str:
1643 """Delete OIDC Test Configuration"""
1644 test_slug = self.encode_path_param(test_slug)
1645 response = cast(
1646 str,
1647 self.delete(
1648 path=f"/oidc_test_configs/{test_slug}",
1649 structure=str,
1650 transport_options=transport_options,
1651 ),
1652 )
1653 return response
1654
1655 # ### Create a OIDC test configuration.
1656 #
1657 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1658 #
1659 # POST /oidc_test_configs -> mdls.OIDCConfig
1660 def create_oidc_test_config(
1661 self,
1662 body: mdls.WriteOIDCConfig,
1663 transport_options: Optional[transport.TransportOptions] = None,
1664 ) -> mdls.OIDCConfig:
1665 """Create OIDC Test Configuration"""
1666 response = cast(
1667 mdls.OIDCConfig,
1668 self.post(
1669 path="/oidc_test_configs",
1670 structure=mdls.OIDCConfig,
1671 body=body,
1672 transport_options=transport_options,
1673 ),
1674 )
1675 return response
1676
1677 # ### Get password config.
1678 #
1679 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1680 #
1681 # GET /password_config -> mdls.PasswordConfig
1682 def password_config(
1683 self,
1684 transport_options: Optional[transport.TransportOptions] = None,
1685 ) -> mdls.PasswordConfig:
1686 """Get Password Config"""
1687 response = cast(
1688 mdls.PasswordConfig,
1689 self.get(
1690 path="/password_config",
1691 structure=mdls.PasswordConfig,
1692 transport_options=transport_options,
1693 ),
1694 )
1695 return response
1696
1697 # ### Update password config.
1698 #
1699 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1700 #
1701 # PATCH /password_config -> mdls.PasswordConfig
1702 def update_password_config(
1703 self,
1704 body: mdls.WritePasswordConfig,
1705 transport_options: Optional[transport.TransportOptions] = None,
1706 ) -> mdls.PasswordConfig:
1707 """Update Password Config"""
1708 response = cast(
1709 mdls.PasswordConfig,
1710 self.patch(
1711 path="/password_config",
1712 structure=mdls.PasswordConfig,
1713 body=body,
1714 transport_options=transport_options,
1715 ),
1716 )
1717 return response
1718
1719 # ### Force all credentials_email users to reset their login passwords upon their next login.
1720 #
1721 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1722 #
1723 # PUT /password_config/force_password_reset_at_next_login_for_all_users -> str
1724 def force_password_reset_at_next_login_for_all_users(
1725 self,
1726 transport_options: Optional[transport.TransportOptions] = None,
1727 ) -> str:
1728 """Force password reset"""
1729 response = cast(
1730 str,
1731 self.put(
1732 path="/password_config/force_password_reset_at_next_login_for_all_users",
1733 structure=str,
1734 transport_options=transport_options,
1735 ),
1736 )
1737 return response
1738
1739 # ### Get the SAML configuration.
1740 #
1741 # Looker can be optionally configured to authenticate users against a SAML authentication server.
1742 # SAML setup requires coordination with an administrator of that server.
1743 #
1744 # Only Looker administrators can read and update the SAML configuration.
1745 #
1746 # Configuring SAML impacts authentication for all users. This configuration should be done carefully.
1747 #
1748 # Looker maintains a single SAML configuration. It can be read and updated. Updates only succeed if the new state will be valid (in the sense that all required fields are populated); it is up to you to ensure that the configuration is appropriate and correct).
1749 #
1750 # SAML is enabled or disabled for Looker using the **enabled** field.
1751 #
1752 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1753 #
1754 # GET /saml_config -> mdls.SamlConfig
1755 def saml_config(
1756 self,
1757 transport_options: Optional[transport.TransportOptions] = None,
1758 ) -> mdls.SamlConfig:
1759 """Get SAML Configuration"""
1760 response = cast(
1761 mdls.SamlConfig,
1762 self.get(
1763 path="/saml_config",
1764 structure=mdls.SamlConfig,
1765 transport_options=transport_options,
1766 ),
1767 )
1768 return response
1769
1770 # ### Update the SAML configuration.
1771 #
1772 # Configuring SAML impacts authentication for all users. This configuration should be done carefully.
1773 #
1774 # Only Looker administrators can read and update the SAML configuration.
1775 #
1776 # SAML is enabled or disabled for Looker using the **enabled** field.
1777 #
1778 # It is **highly** recommended that any SAML setting changes be tested using the APIs below before being set globally.
1779 #
1780 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1781 #
1782 # PATCH /saml_config -> mdls.SamlConfig
1783 def update_saml_config(
1784 self,
1785 body: mdls.WriteSamlConfig,
1786 transport_options: Optional[transport.TransportOptions] = None,
1787 ) -> mdls.SamlConfig:
1788 """Update SAML Configuration"""
1789 response = cast(
1790 mdls.SamlConfig,
1791 self.patch(
1792 path="/saml_config",
1793 structure=mdls.SamlConfig,
1794 body=body,
1795 transport_options=transport_options,
1796 ),
1797 )
1798 return response
1799
1800 # ### Get a SAML test configuration by test_slug.
1801 #
1802 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1803 #
1804 # GET /saml_test_configs/{test_slug} -> mdls.SamlConfig
1805 def saml_test_config(
1806 self,
1807 # Slug of test config
1808 test_slug: str,
1809 transport_options: Optional[transport.TransportOptions] = None,
1810 ) -> mdls.SamlConfig:
1811 """Get SAML Test Configuration"""
1812 test_slug = self.encode_path_param(test_slug)
1813 response = cast(
1814 mdls.SamlConfig,
1815 self.get(
1816 path=f"/saml_test_configs/{test_slug}",
1817 structure=mdls.SamlConfig,
1818 transport_options=transport_options,
1819 ),
1820 )
1821 return response
1822
1823 # ### Delete a SAML test configuration.
1824 #
1825 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1826 #
1827 # DELETE /saml_test_configs/{test_slug} -> str
1828 def delete_saml_test_config(
1829 self,
1830 # Slug of test config
1831 test_slug: str,
1832 transport_options: Optional[transport.TransportOptions] = None,
1833 ) -> str:
1834 """Delete SAML Test Configuration"""
1835 test_slug = self.encode_path_param(test_slug)
1836 response = cast(
1837 str,
1838 self.delete(
1839 path=f"/saml_test_configs/{test_slug}",
1840 structure=str,
1841 transport_options=transport_options,
1842 ),
1843 )
1844 return response
1845
1846 # ### Create a SAML test configuration.
1847 #
1848 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1849 #
1850 # POST /saml_test_configs -> mdls.SamlConfig
1851 def create_saml_test_config(
1852 self,
1853 body: mdls.WriteSamlConfig,
1854 transport_options: Optional[transport.TransportOptions] = None,
1855 ) -> mdls.SamlConfig:
1856 """Create SAML Test Configuration"""
1857 response = cast(
1858 mdls.SamlConfig,
1859 self.post(
1860 path="/saml_test_configs",
1861 structure=mdls.SamlConfig,
1862 body=body,
1863 transport_options=transport_options,
1864 ),
1865 )
1866 return response
1867
1868 # ### Parse the given xml as a SAML IdP metadata document and return the result.
1869 #
1870 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1871 #
1872 # POST /parse_saml_idp_metadata -> mdls.SamlMetadataParseResult
1873 def parse_saml_idp_metadata(
1874 self,
1875 body: str,
1876 transport_options: Optional[transport.TransportOptions] = None,
1877 ) -> mdls.SamlMetadataParseResult:
1878 """Parse SAML IdP XML"""
1879 response = cast(
1880 mdls.SamlMetadataParseResult,
1881 self.post(
1882 path="/parse_saml_idp_metadata",
1883 structure=mdls.SamlMetadataParseResult,
1884 body=body,
1885 transport_options=transport_options,
1886 ),
1887 )
1888 return response
1889
1890 # ### Fetch the given url and parse it as a SAML IdP metadata document and return the result.
1891 # Note that this requires that the url be public or at least at a location where the Looker instance
1892 # can fetch it without requiring any special authentication.
1893 #
1894 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1895 #
1896 # POST /fetch_and_parse_saml_idp_metadata -> mdls.SamlMetadataParseResult
1897 def fetch_and_parse_saml_idp_metadata(
1898 self,
1899 body: str,
1900 transport_options: Optional[transport.TransportOptions] = None,
1901 ) -> mdls.SamlMetadataParseResult:
1902 """Parse SAML IdP Url"""
1903 response = cast(
1904 mdls.SamlMetadataParseResult,
1905 self.post(
1906 path="/fetch_and_parse_saml_idp_metadata",
1907 structure=mdls.SamlMetadataParseResult,
1908 body=body,
1909 transport_options=transport_options,
1910 ),
1911 )
1912 return response
1913
1914 # ### Get session config.
1915 #
1916 # GET /session_config -> mdls.SessionConfig
1917 def session_config(
1918 self,
1919 transport_options: Optional[transport.TransportOptions] = None,
1920 ) -> mdls.SessionConfig:
1921 """Get Session Config"""
1922 response = cast(
1923 mdls.SessionConfig,
1924 self.get(
1925 path="/session_config",
1926 structure=mdls.SessionConfig,
1927 transport_options=transport_options,
1928 ),
1929 )
1930 return response
1931
1932 # ### Update session config.
1933 #
1934 # PATCH /session_config -> mdls.SessionConfig
1935 def update_session_config(
1936 self,
1937 body: mdls.WriteSessionConfig,
1938 transport_options: Optional[transport.TransportOptions] = None,
1939 ) -> mdls.SessionConfig:
1940 """Update Session Config"""
1941 response = cast(
1942 mdls.SessionConfig,
1943 self.patch(
1944 path="/session_config",
1945 structure=mdls.SessionConfig,
1946 body=body,
1947 transport_options=transport_options,
1948 ),
1949 )
1950 return response
1951
1952 # ### Get Support Access Allowlist Users
1953 #
1954 # Returns the users that have been added to the Support Access Allowlist
1955 #
1956 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1957 #
1958 # GET /support_access/allowlist -> Sequence[mdls.SupportAccessAllowlistEntry]
1959 def get_support_access_allowlist_entries(
1960 self,
1961 # Requested fields.
1962 fields: Optional[str] = None,
1963 transport_options: Optional[transport.TransportOptions] = None,
1964 ) -> Sequence[mdls.SupportAccessAllowlistEntry]:
1965 """Get Support Access Allowlist Users"""
1966 response = cast(
1967 Sequence[mdls.SupportAccessAllowlistEntry],
1968 self.get(
1969 path="/support_access/allowlist",
1970 structure=Sequence[mdls.SupportAccessAllowlistEntry],
1971 query_params={"fields": fields},
1972 transport_options=transport_options,
1973 ),
1974 )
1975 return response
1976
1977 # ### Add Support Access Allowlist Users
1978 #
1979 # Adds a list of emails to the Allowlist, using the provided reason
1980 #
1981 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1982 #
1983 # POST /support_access/allowlist -> Sequence[mdls.SupportAccessAllowlistEntry]
1984 def add_support_access_allowlist_entries(
1985 self,
1986 body: mdls.SupportAccessAddEntries,
1987 transport_options: Optional[transport.TransportOptions] = None,
1988 ) -> Sequence[mdls.SupportAccessAllowlistEntry]:
1989 """Add Support Access Allowlist Users"""
1990 response = cast(
1991 Sequence[mdls.SupportAccessAllowlistEntry],
1992 self.post(
1993 path="/support_access/allowlist",
1994 structure=Sequence[mdls.SupportAccessAllowlistEntry],
1995 body=body,
1996 transport_options=transport_options,
1997 ),
1998 )
1999 return response
2000
2001 # ### Delete Support Access Allowlist User
2002 #
2003 # Deletes the specified Allowlist Entry Id
2004 #
2005 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
2006 #
2007 # DELETE /support_access/allowlist/{entry_id} -> str
2008 def delete_support_access_allowlist_entry(
2009 self,
2010 # Id of Allowlist Entry
2011 entry_id: str,
2012 transport_options: Optional[transport.TransportOptions] = None,
2013 ) -> str:
2014 """Delete Support Access Allowlist Entry"""
2015 entry_id = self.encode_path_param(entry_id)
2016 response = cast(
2017 str,
2018 self.delete(
2019 path=f"/support_access/allowlist/{entry_id}",
2020 structure=str,
2021 transport_options=transport_options,
2022 ),
2023 )
2024 return response
2025
2026 # ### Enable Support Access
2027 #
2028 # Enables Support Access for the provided duration
2029 #
2030 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
2031 #
2032 # PUT /support_access/enable -> mdls.SupportAccessStatus
2033 def enable_support_access(
2034 self,
2035 body: mdls.SupportAccessEnable,
2036 transport_options: Optional[transport.TransportOptions] = None,
2037 ) -> mdls.SupportAccessStatus:
2038 """Enable Support Access"""
2039 response = cast(
2040 mdls.SupportAccessStatus,
2041 self.put(
2042 path="/support_access/enable",
2043 structure=mdls.SupportAccessStatus,
2044 body=body,
2045 transport_options=transport_options,
2046 ),
2047 )
2048 return response
2049
2050 # ### Disable Support Access
2051 #
2052 # Disables Support Access immediately
2053 #
2054 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
2055 #
2056 # PUT /support_access/disable -> mdls.SupportAccessStatus
2057 def disable_support_access(
2058 self,
2059 transport_options: Optional[transport.TransportOptions] = None,
2060 ) -> mdls.SupportAccessStatus:
2061 """Disable Support Access"""
2062 response = cast(
2063 mdls.SupportAccessStatus,
2064 self.put(
2065 path="/support_access/disable",
2066 structure=mdls.SupportAccessStatus,
2067 transport_options=transport_options,
2068 ),
2069 )
2070 return response
2071
2072 # ### Support Access Status
2073 #
2074 # Returns the current Support Access Status
2075 #
2076 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
2077 #
2078 # GET /support_access/status -> mdls.SupportAccessStatus
2079 def support_access_status(
2080 self,
2081 transport_options: Optional[transport.TransportOptions] = None,
2082 ) -> mdls.SupportAccessStatus:
2083 """Support Access Status"""
2084 response = cast(
2085 mdls.SupportAccessStatus,
2086 self.get(
2087 path="/support_access/status",
2088 structure=mdls.SupportAccessStatus,
2089 transport_options=transport_options,
2090 ),
2091 )
2092 return response
2093
2094 # ### Get currently locked-out users.
2095 #
2096 # GET /user_login_lockouts -> Sequence[mdls.UserLoginLockout]
2097 def all_user_login_lockouts(
2098 self,
2099 # Include only these fields in the response
2100 fields: Optional[str] = None,
2101 transport_options: Optional[transport.TransportOptions] = None,
2102 ) -> Sequence[mdls.UserLoginLockout]:
2103 """Get All User Login Lockouts"""
2104 response = cast(
2105 Sequence[mdls.UserLoginLockout],
2106 self.get(
2107 path="/user_login_lockouts",
2108 structure=Sequence[mdls.UserLoginLockout],
2109 query_params={"fields": fields},
2110 transport_options=transport_options,
2111 ),
2112 )
2113 return response
2114
2115 # ### Search currently locked-out users.
2116 #
2117 # GET /user_login_lockouts/search -> Sequence[mdls.UserLoginLockout]
2118 def search_user_login_lockouts(
2119 self,
2120 # Include only these fields in the response
2121 fields: Optional[str] = None,
2122 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
2123 page: Optional[int] = None,
2124 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
2125 per_page: Optional[int] = None,
2126 # Number of results to return. (used with offset and takes priority over page and per_page)
2127 limit: Optional[int] = None,
2128 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
2129 offset: Optional[int] = None,
2130 # Fields to sort by.
2131 sorts: Optional[str] = None,
2132 # Auth type user is locked out for (email, ldap, totp, api)
2133 auth_type: Optional[str] = None,
2134 # Match name
2135 full_name: Optional[str] = None,
2136 # Match email
2137 email: Optional[str] = None,
2138 # Match remote LDAP ID
2139 remote_id: Optional[str] = None,
2140 # Combine given search criteria in a boolean OR expression
2141 filter_or: Optional[bool] = None,
2142 transport_options: Optional[transport.TransportOptions] = None,
2143 ) -> Sequence[mdls.UserLoginLockout]:
2144 """Search User Login Lockouts"""
2145 response = cast(
2146 Sequence[mdls.UserLoginLockout],
2147 self.get(
2148 path="/user_login_lockouts/search",
2149 structure=Sequence[mdls.UserLoginLockout],
2150 query_params={
2151 "fields": fields,
2152 "page": page,
2153 "per_page": per_page,
2154 "limit": limit,
2155 "offset": offset,
2156 "sorts": sorts,
2157 "auth_type": auth_type,
2158 "full_name": full_name,
2159 "email": email,
2160 "remote_id": remote_id,
2161 "filter_or": filter_or,
2162 },
2163 transport_options=transport_options,
2164 ),
2165 )
2166 return response
2167
2168 # ### Removes login lockout for the associated user.
2169 #
2170 # DELETE /user_login_lockout/{key} -> str
2171 def delete_user_login_lockout(
2172 self,
2173 # The key associated with the locked user
2174 key: str,
2175 transport_options: Optional[transport.TransportOptions] = None,
2176 ) -> str:
2177 """Delete User Login Lockout"""
2178 key = self.encode_path_param(key)
2179 response = cast(
2180 str,
2181 self.delete(
2182 path=f"/user_login_lockout/{key}",
2183 structure=str,
2184 transport_options=transport_options,
2185 ),
2186 )
2187 return response
2188
2189 # endregion
2190
2191 # region Board: Manage Boards
2192
2193 # ### Get information about all boards.
2194 #
2195 # GET /boards -> Sequence[mdls.Board]
2196 def all_boards(
2197 self,
2198 # Requested fields.
2199 fields: Optional[str] = None,
2200 transport_options: Optional[transport.TransportOptions] = None,
2201 ) -> Sequence[mdls.Board]:
2202 """Get All Boards"""
2203 response = cast(
2204 Sequence[mdls.Board],
2205 self.get(
2206 path="/boards",
2207 structure=Sequence[mdls.Board],
2208 query_params={"fields": fields},
2209 transport_options=transport_options,
2210 ),
2211 )
2212 return response
2213
2214 # ### Create a new board.
2215 #
2216 # POST /boards -> mdls.Board
2217 def create_board(
2218 self,
2219 body: mdls.WriteBoard,
2220 # Requested fields.
2221 fields: Optional[str] = None,
2222 transport_options: Optional[transport.TransportOptions] = None,
2223 ) -> mdls.Board:
2224 """Create Board"""
2225 response = cast(
2226 mdls.Board,
2227 self.post(
2228 path="/boards",
2229 structure=mdls.Board,
2230 query_params={"fields": fields},
2231 body=body,
2232 transport_options=transport_options,
2233 ),
2234 )
2235 return response
2236
2237 # ### Search Boards
2238 #
2239 # If multiple search params are given and `filter_or` is FALSE or not specified,
2240 # search params are combined in a logical AND operation.
2241 # Only rows that match *all* search param criteria will be returned.
2242 #
2243 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
2244 # Results will include rows that match **any** of the search criteria.
2245 #
2246 # String search params use case-insensitive matching.
2247 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
2248 # example="dan%" will match "danger" and "Danzig" but not "David"
2249 # example="D_m%" will match "Damage" and "dump"
2250 #
2251 # Integer search params can accept a single value or a comma separated list of values. The multiple
2252 # values will be combined under a logical OR operation - results will match at least one of
2253 # the given values.
2254 #
2255 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
2256 # or exclude (respectively) rows where the column is null.
2257 #
2258 # Boolean search params accept only "true" and "false" as values.
2259 #
2260 # GET /boards/search -> Sequence[mdls.Board]
2261 def search_boards(
2262 self,
2263 # Matches board title.
2264 title: Optional[str] = None,
2265 # Matches the timestamp for when the board was created.
2266 created_at: Optional[str] = None,
2267 # The first name of the user who created this board.
2268 first_name: Optional[str] = None,
2269 # The last name of the user who created this board.
2270 last_name: Optional[str] = None,
2271 # Requested fields.
2272 fields: Optional[str] = None,
2273 # Return favorited boards when true.
2274 favorited: Optional[bool] = None,
2275 # Filter on boards created by a particular user.
2276 creator_id: Optional[str] = None,
2277 # The fields to sort the results by
2278 sorts: Optional[str] = None,
2279 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
2280 page: Optional[int] = None,
2281 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
2282 per_page: Optional[int] = None,
2283 # Number of results to return. (used with offset and takes priority over page and per_page)
2284 offset: Optional[int] = None,
2285 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
2286 limit: Optional[int] = None,
2287 # Combine given search criteria in a boolean OR expression
2288 filter_or: Optional[bool] = None,
2289 # Filter results based on permission, either show (default) or update
2290 permission: Optional[str] = None,
2291 transport_options: Optional[transport.TransportOptions] = None,
2292 ) -> Sequence[mdls.Board]:
2293 """Search Boards"""
2294 response = cast(
2295 Sequence[mdls.Board],
2296 self.get(
2297 path="/boards/search",
2298 structure=Sequence[mdls.Board],
2299 query_params={
2300 "title": title,
2301 "created_at": created_at,
2302 "first_name": first_name,
2303 "last_name": last_name,
2304 "fields": fields,
2305 "favorited": favorited,
2306 "creator_id": creator_id,
2307 "sorts": sorts,
2308 "page": page,
2309 "per_page": per_page,
2310 "offset": offset,
2311 "limit": limit,
2312 "filter_or": filter_or,
2313 "permission": permission,
2314 },
2315 transport_options=transport_options,
2316 ),
2317 )
2318 return response
2319
2320 # ### Get information about a board.
2321 #
2322 # GET /boards/{board_id} -> mdls.Board
2323 def board(
2324 self,
2325 # Id of board
2326 board_id: str,
2327 # Requested fields.
2328 fields: Optional[str] = None,
2329 transport_options: Optional[transport.TransportOptions] = None,
2330 ) -> mdls.Board:
2331 """Get Board"""
2332 board_id = self.encode_path_param(board_id)
2333 response = cast(
2334 mdls.Board,
2335 self.get(
2336 path=f"/boards/{board_id}",
2337 structure=mdls.Board,
2338 query_params={"fields": fields},
2339 transport_options=transport_options,
2340 ),
2341 )
2342 return response
2343
2344 # ### Update a board definition.
2345 #
2346 # PATCH /boards/{board_id} -> mdls.Board
2347 def update_board(
2348 self,
2349 # Id of board
2350 board_id: str,
2351 body: mdls.WriteBoard,
2352 # Requested fields.
2353 fields: Optional[str] = None,
2354 transport_options: Optional[transport.TransportOptions] = None,
2355 ) -> mdls.Board:
2356 """Update Board"""
2357 board_id = self.encode_path_param(board_id)
2358 response = cast(
2359 mdls.Board,
2360 self.patch(
2361 path=f"/boards/{board_id}",
2362 structure=mdls.Board,
2363 query_params={"fields": fields},
2364 body=body,
2365 transport_options=transport_options,
2366 ),
2367 )
2368 return response
2369
2370 # ### Delete a board.
2371 #
2372 # DELETE /boards/{board_id} -> str
2373 def delete_board(
2374 self,
2375 # Id of board
2376 board_id: str,
2377 transport_options: Optional[transport.TransportOptions] = None,
2378 ) -> str:
2379 """Delete Board"""
2380 board_id = self.encode_path_param(board_id)
2381 response = cast(
2382 str,
2383 self.delete(
2384 path=f"/boards/{board_id}",
2385 structure=str,
2386 transport_options=transport_options,
2387 ),
2388 )
2389 return response
2390
2391 # ### Get information about all board items.
2392 #
2393 # GET /board_items -> Sequence[mdls.BoardItem]
2394 def all_board_items(
2395 self,
2396 # Requested fields.
2397 fields: Optional[str] = None,
2398 # Fields to sort by.
2399 sorts: Optional[str] = None,
2400 # Filter to a specific board section
2401 board_section_id: Optional[str] = None,
2402 transport_options: Optional[transport.TransportOptions] = None,
2403 ) -> Sequence[mdls.BoardItem]:
2404 """Get All Board Items"""
2405 response = cast(
2406 Sequence[mdls.BoardItem],
2407 self.get(
2408 path="/board_items",
2409 structure=Sequence[mdls.BoardItem],
2410 query_params={
2411 "fields": fields,
2412 "sorts": sorts,
2413 "board_section_id": board_section_id,
2414 },
2415 transport_options=transport_options,
2416 ),
2417 )
2418 return response
2419
2420 # ### Create a new board item.
2421 #
2422 # POST /board_items -> mdls.BoardItem
2423 def create_board_item(
2424 self,
2425 body: mdls.WriteBoardItem,
2426 # Requested fields.
2427 fields: Optional[str] = None,
2428 transport_options: Optional[transport.TransportOptions] = None,
2429 ) -> mdls.BoardItem:
2430 """Create Board Item"""
2431 response = cast(
2432 mdls.BoardItem,
2433 self.post(
2434 path="/board_items",
2435 structure=mdls.BoardItem,
2436 query_params={"fields": fields},
2437 body=body,
2438 transport_options=transport_options,
2439 ),
2440 )
2441 return response
2442
2443 # ### Get information about a board item.
2444 #
2445 # GET /board_items/{board_item_id} -> mdls.BoardItem
2446 def board_item(
2447 self,
2448 # Id of board item
2449 board_item_id: str,
2450 # Requested fields.
2451 fields: Optional[str] = None,
2452 transport_options: Optional[transport.TransportOptions] = None,
2453 ) -> mdls.BoardItem:
2454 """Get Board Item"""
2455 board_item_id = self.encode_path_param(board_item_id)
2456 response = cast(
2457 mdls.BoardItem,
2458 self.get(
2459 path=f"/board_items/{board_item_id}",
2460 structure=mdls.BoardItem,
2461 query_params={"fields": fields},
2462 transport_options=transport_options,
2463 ),
2464 )
2465 return response
2466
2467 # ### Update a board item definition.
2468 #
2469 # PATCH /board_items/{board_item_id} -> mdls.BoardItem
2470 def update_board_item(
2471 self,
2472 # Id of board item
2473 board_item_id: str,
2474 body: mdls.WriteBoardItem,
2475 # Requested fields.
2476 fields: Optional[str] = None,
2477 transport_options: Optional[transport.TransportOptions] = None,
2478 ) -> mdls.BoardItem:
2479 """Update Board Item"""
2480 board_item_id = self.encode_path_param(board_item_id)
2481 response = cast(
2482 mdls.BoardItem,
2483 self.patch(
2484 path=f"/board_items/{board_item_id}",
2485 structure=mdls.BoardItem,
2486 query_params={"fields": fields},
2487 body=body,
2488 transport_options=transport_options,
2489 ),
2490 )
2491 return response
2492
2493 # ### Delete a board item.
2494 #
2495 # DELETE /board_items/{board_item_id} -> str
2496 def delete_board_item(
2497 self,
2498 # Id of board item
2499 board_item_id: str,
2500 transport_options: Optional[transport.TransportOptions] = None,
2501 ) -> str:
2502 """Delete Board Item"""
2503 board_item_id = self.encode_path_param(board_item_id)
2504 response = cast(
2505 str,
2506 self.delete(
2507 path=f"/board_items/{board_item_id}",
2508 structure=str,
2509 transport_options=transport_options,
2510 ),
2511 )
2512 return response
2513
2514 # ### Get information about all board sections.
2515 #
2516 # GET /board_sections -> Sequence[mdls.BoardSection]
2517 def all_board_sections(
2518 self,
2519 # Requested fields.
2520 fields: Optional[str] = None,
2521 # Fields to sort by.
2522 sorts: Optional[str] = None,
2523 transport_options: Optional[transport.TransportOptions] = None,
2524 ) -> Sequence[mdls.BoardSection]:
2525 """Get All Board sections"""
2526 response = cast(
2527 Sequence[mdls.BoardSection],
2528 self.get(
2529 path="/board_sections",
2530 structure=Sequence[mdls.BoardSection],
2531 query_params={"fields": fields, "sorts": sorts},
2532 transport_options=transport_options,
2533 ),
2534 )
2535 return response
2536
2537 # ### Create a new board section.
2538 #
2539 # POST /board_sections -> mdls.BoardSection
2540 def create_board_section(
2541 self,
2542 body: mdls.WriteBoardSection,
2543 # Requested fields.
2544 fields: Optional[str] = None,
2545 transport_options: Optional[transport.TransportOptions] = None,
2546 ) -> mdls.BoardSection:
2547 """Create Board section"""
2548 response = cast(
2549 mdls.BoardSection,
2550 self.post(
2551 path="/board_sections",
2552 structure=mdls.BoardSection,
2553 query_params={"fields": fields},
2554 body=body,
2555 transport_options=transport_options,
2556 ),
2557 )
2558 return response
2559
2560 # ### Get information about a board section.
2561 #
2562 # GET /board_sections/{board_section_id} -> mdls.BoardSection
2563 def board_section(
2564 self,
2565 # Id of board section
2566 board_section_id: str,
2567 # Requested fields.
2568 fields: Optional[str] = None,
2569 transport_options: Optional[transport.TransportOptions] = None,
2570 ) -> mdls.BoardSection:
2571 """Get Board section"""
2572 board_section_id = self.encode_path_param(board_section_id)
2573 response = cast(
2574 mdls.BoardSection,
2575 self.get(
2576 path=f"/board_sections/{board_section_id}",
2577 structure=mdls.BoardSection,
2578 query_params={"fields": fields},
2579 transport_options=transport_options,
2580 ),
2581 )
2582 return response
2583
2584 # ### Update a board section definition.
2585 #
2586 # PATCH /board_sections/{board_section_id} -> mdls.BoardSection
2587 def update_board_section(
2588 self,
2589 # Id of board section
2590 board_section_id: str,
2591 body: mdls.WriteBoardSection,
2592 # Requested fields.
2593 fields: Optional[str] = None,
2594 transport_options: Optional[transport.TransportOptions] = None,
2595 ) -> mdls.BoardSection:
2596 """Update Board section"""
2597 board_section_id = self.encode_path_param(board_section_id)
2598 response = cast(
2599 mdls.BoardSection,
2600 self.patch(
2601 path=f"/board_sections/{board_section_id}",
2602 structure=mdls.BoardSection,
2603 query_params={"fields": fields},
2604 body=body,
2605 transport_options=transport_options,
2606 ),
2607 )
2608 return response
2609
2610 # ### Delete a board section.
2611 #
2612 # DELETE /board_sections/{board_section_id} -> str
2613 def delete_board_section(
2614 self,
2615 # Id of board section
2616 board_section_id: str,
2617 transport_options: Optional[transport.TransportOptions] = None,
2618 ) -> str:
2619 """Delete Board section"""
2620 board_section_id = self.encode_path_param(board_section_id)
2621 response = cast(
2622 str,
2623 self.delete(
2624 path=f"/board_sections/{board_section_id}",
2625 structure=str,
2626 transport_options=transport_options,
2627 ),
2628 )
2629 return response
2630
2631 # endregion
2632
2633 # region ColorCollection: Manage Color Collections
2634
2635 # ### Get an array of all existing Color Collections
2636 # Get a **single** color collection by id with [ColorCollection](#!/ColorCollection/color_collection)
2637 #
2638 # Get all **standard** color collections with [ColorCollection](#!/ColorCollection/color_collections_standard)
2639 #
2640 # Get all **custom** color collections with [ColorCollection](#!/ColorCollection/color_collections_custom)
2641 #
2642 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2643 #
2644 # GET /color_collections -> Sequence[mdls.ColorCollection]
2645 def all_color_collections(
2646 self,
2647 # Requested fields.
2648 fields: Optional[str] = None,
2649 transport_options: Optional[transport.TransportOptions] = None,
2650 ) -> Sequence[mdls.ColorCollection]:
2651 """Get all Color Collections"""
2652 response = cast(
2653 Sequence[mdls.ColorCollection],
2654 self.get(
2655 path="/color_collections",
2656 structure=Sequence[mdls.ColorCollection],
2657 query_params={"fields": fields},
2658 transport_options=transport_options,
2659 ),
2660 )
2661 return response
2662
2663 # ### Create a custom color collection with the specified information
2664 #
2665 # Creates a new custom color collection object, returning the details, including the created id.
2666 #
2667 # **Update** an existing color collection with [Update Color Collection](#!/ColorCollection/update_color_collection)
2668 #
2669 # **Permanently delete** an existing custom color collection with [Delete Color Collection](#!/ColorCollection/delete_color_collection)
2670 #
2671 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2672 #
2673 # POST /color_collections -> mdls.ColorCollection
2674 def create_color_collection(
2675 self,
2676 body: mdls.WriteColorCollection,
2677 transport_options: Optional[transport.TransportOptions] = None,
2678 ) -> mdls.ColorCollection:
2679 """Create ColorCollection"""
2680 response = cast(
2681 mdls.ColorCollection,
2682 self.post(
2683 path="/color_collections",
2684 structure=mdls.ColorCollection,
2685 body=body,
2686 transport_options=transport_options,
2687 ),
2688 )
2689 return response
2690
2691 # ### Get an array of all existing **Custom** Color Collections
2692 # Get a **single** color collection by id with [ColorCollection](#!/ColorCollection/color_collection)
2693 #
2694 # Get all **standard** color collections with [ColorCollection](#!/ColorCollection/color_collections_standard)
2695 #
2696 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2697 #
2698 # GET /color_collections/custom -> Sequence[mdls.ColorCollection]
2699 def color_collections_custom(
2700 self,
2701 # Requested fields.
2702 fields: Optional[str] = None,
2703 transport_options: Optional[transport.TransportOptions] = None,
2704 ) -> Sequence[mdls.ColorCollection]:
2705 """Get all Custom Color Collections"""
2706 response = cast(
2707 Sequence[mdls.ColorCollection],
2708 self.get(
2709 path="/color_collections/custom",
2710 structure=Sequence[mdls.ColorCollection],
2711 query_params={"fields": fields},
2712 transport_options=transport_options,
2713 ),
2714 )
2715 return response
2716
2717 # ### Get an array of all existing **Standard** Color Collections
2718 # Get a **single** color collection by id with [ColorCollection](#!/ColorCollection/color_collection)
2719 #
2720 # Get all **custom** color collections with [ColorCollection](#!/ColorCollection/color_collections_custom)
2721 #
2722 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2723 #
2724 # GET /color_collections/standard -> Sequence[mdls.ColorCollection]
2725 def color_collections_standard(
2726 self,
2727 # Requested fields.
2728 fields: Optional[str] = None,
2729 transport_options: Optional[transport.TransportOptions] = None,
2730 ) -> Sequence[mdls.ColorCollection]:
2731 """Get all Standard Color Collections"""
2732 response = cast(
2733 Sequence[mdls.ColorCollection],
2734 self.get(
2735 path="/color_collections/standard",
2736 structure=Sequence[mdls.ColorCollection],
2737 query_params={"fields": fields},
2738 transport_options=transport_options,
2739 ),
2740 )
2741 return response
2742
2743 # ### Get the default color collection
2744 #
2745 # Use this to retrieve the default Color Collection.
2746 #
2747 # Set the default color collection with [ColorCollection](#!/ColorCollection/set_default_color_collection)
2748 #
2749 # GET /color_collections/default -> mdls.ColorCollection
2750 def default_color_collection(
2751 self,
2752 transport_options: Optional[transport.TransportOptions] = None,
2753 ) -> mdls.ColorCollection:
2754 """Get Default Color Collection"""
2755 response = cast(
2756 mdls.ColorCollection,
2757 self.get(
2758 path="/color_collections/default",
2759 structure=mdls.ColorCollection,
2760 transport_options=transport_options,
2761 ),
2762 )
2763 return response
2764
2765 # ### Set the global default Color Collection by ID
2766 #
2767 # Returns the new specified default Color Collection object.
2768 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2769 #
2770 # PUT /color_collections/default -> mdls.ColorCollection
2771 def set_default_color_collection(
2772 self,
2773 # ID of color collection to set as default
2774 collection_id: str,
2775 transport_options: Optional[transport.TransportOptions] = None,
2776 ) -> mdls.ColorCollection:
2777 """Set Default Color Collection"""
2778 response = cast(
2779 mdls.ColorCollection,
2780 self.put(
2781 path="/color_collections/default",
2782 structure=mdls.ColorCollection,
2783 query_params={"collection_id": collection_id},
2784 transport_options=transport_options,
2785 ),
2786 )
2787 return response
2788
2789 # ### Get a Color Collection by ID
2790 #
2791 # Use this to retrieve a specific Color Collection.
2792 # Get a **single** color collection by id with [ColorCollection](#!/ColorCollection/color_collection)
2793 #
2794 # Get all **standard** color collections with [ColorCollection](#!/ColorCollection/color_collections_standard)
2795 #
2796 # Get all **custom** color collections with [ColorCollection](#!/ColorCollection/color_collections_custom)
2797 #
2798 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2799 #
2800 # GET /color_collections/{collection_id} -> mdls.ColorCollection
2801 def color_collection(
2802 self,
2803 # Id of Color Collection
2804 collection_id: str,
2805 # Requested fields.
2806 fields: Optional[str] = None,
2807 transport_options: Optional[transport.TransportOptions] = None,
2808 ) -> mdls.ColorCollection:
2809 """Get Color Collection by ID"""
2810 collection_id = self.encode_path_param(collection_id)
2811 response = cast(
2812 mdls.ColorCollection,
2813 self.get(
2814 path=f"/color_collections/{collection_id}",
2815 structure=mdls.ColorCollection,
2816 query_params={"fields": fields},
2817 transport_options=transport_options,
2818 ),
2819 )
2820 return response
2821
2822 # ### Update a custom color collection by id.
2823 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2824 #
2825 # PATCH /color_collections/{collection_id} -> mdls.ColorCollection
2826 def update_color_collection(
2827 self,
2828 # Id of Custom Color Collection
2829 collection_id: str,
2830 body: mdls.WriteColorCollection,
2831 transport_options: Optional[transport.TransportOptions] = None,
2832 ) -> mdls.ColorCollection:
2833 """Update Custom Color collection"""
2834 collection_id = self.encode_path_param(collection_id)
2835 response = cast(
2836 mdls.ColorCollection,
2837 self.patch(
2838 path=f"/color_collections/{collection_id}",
2839 structure=mdls.ColorCollection,
2840 body=body,
2841 transport_options=transport_options,
2842 ),
2843 )
2844 return response
2845
2846 # ### Delete a custom color collection by id
2847 #
2848 # This operation permanently deletes the identified **Custom** color collection.
2849 #
2850 # **Standard** color collections cannot be deleted
2851 #
2852 # Because multiple color collections can have the same label, they must be deleted by ID, not name.
2853 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2854 #
2855 # DELETE /color_collections/{collection_id} -> str
2856 def delete_color_collection(
2857 self,
2858 # Id of Color Collection
2859 collection_id: str,
2860 transport_options: Optional[transport.TransportOptions] = None,
2861 ) -> str:
2862 """Delete ColorCollection"""
2863 collection_id = self.encode_path_param(collection_id)
2864 response = cast(
2865 str,
2866 self.delete(
2867 path=f"/color_collections/{collection_id}",
2868 structure=str,
2869 transport_options=transport_options,
2870 ),
2871 )
2872 return response
2873
2874 # endregion
2875
2876 # region Config: Manage General Configuration
2877
2878 # Get the current Cloud Storage Configuration.
2879 #
2880 # GET /cloud_storage -> mdls.BackupConfiguration
2881 def cloud_storage_configuration(
2882 self,
2883 transport_options: Optional[transport.TransportOptions] = None,
2884 ) -> mdls.BackupConfiguration:
2885 """Get Cloud Storage"""
2886 response = cast(
2887 mdls.BackupConfiguration,
2888 self.get(
2889 path="/cloud_storage",
2890 structure=mdls.BackupConfiguration,
2891 transport_options=transport_options,
2892 ),
2893 )
2894 return response
2895
2896 # Update the current Cloud Storage Configuration.
2897 #
2898 # PATCH /cloud_storage -> mdls.BackupConfiguration
2899 def update_cloud_storage_configuration(
2900 self,
2901 body: mdls.WriteBackupConfiguration,
2902 transport_options: Optional[transport.TransportOptions] = None,
2903 ) -> mdls.BackupConfiguration:
2904 """Update Cloud Storage"""
2905 response = cast(
2906 mdls.BackupConfiguration,
2907 self.patch(
2908 path="/cloud_storage",
2909 structure=mdls.BackupConfiguration,
2910 body=body,
2911 transport_options=transport_options,
2912 ),
2913 )
2914 return response
2915
2916 # ### Get the current status and content of custom welcome emails
2917 #
2918 # GET /custom_welcome_email -> mdls.CustomWelcomeEmail
2919 def custom_welcome_email(
2920 self,
2921 transport_options: Optional[transport.TransportOptions] = None,
2922 ) -> mdls.CustomWelcomeEmail:
2923 """Get Custom Welcome Email"""
2924 response = cast(
2925 mdls.CustomWelcomeEmail,
2926 self.get(
2927 path="/custom_welcome_email",
2928 structure=mdls.CustomWelcomeEmail,
2929 transport_options=transport_options,
2930 ),
2931 )
2932 return response
2933
2934 # Update custom welcome email setting and values. Optionally send a test email with the new content to the currently logged in user.
2935 #
2936 # PATCH /custom_welcome_email -> mdls.CustomWelcomeEmail
2937 def update_custom_welcome_email(
2938 self,
2939 body: mdls.CustomWelcomeEmail,
2940 # If true a test email with the content from the request will be sent to the current user after saving
2941 send_test_welcome_email: Optional[bool] = None,
2942 transport_options: Optional[transport.TransportOptions] = None,
2943 ) -> mdls.CustomWelcomeEmail:
2944 """Update Custom Welcome Email Content"""
2945 response = cast(
2946 mdls.CustomWelcomeEmail,
2947 self.patch(
2948 path="/custom_welcome_email",
2949 structure=mdls.CustomWelcomeEmail,
2950 query_params={"send_test_welcome_email": send_test_welcome_email},
2951 body=body,
2952 transport_options=transport_options,
2953 ),
2954 )
2955 return response
2956
2957 # Requests to this endpoint will send a welcome email with the custom content provided in the body to the currently logged in user.
2958 #
2959 # PUT /custom_welcome_email_test -> mdls.WelcomeEmailTest
2960 def update_custom_welcome_email_test(
2961 self,
2962 body: mdls.WelcomeEmailTest,
2963 transport_options: Optional[transport.TransportOptions] = None,
2964 ) -> mdls.WelcomeEmailTest:
2965 """Send a test welcome email to the currently logged in user with the supplied content"""
2966 response = cast(
2967 mdls.WelcomeEmailTest,
2968 self.put(
2969 path="/custom_welcome_email_test",
2970 structure=mdls.WelcomeEmailTest,
2971 body=body,
2972 transport_options=transport_options,
2973 ),
2974 )
2975 return response
2976
2977 # ### Retrieve the value for whether or not digest emails is enabled
2978 #
2979 # GET /digest_emails_enabled -> mdls.DigestEmails
2980 def digest_emails_enabled(
2981 self,
2982 transport_options: Optional[transport.TransportOptions] = None,
2983 ) -> mdls.DigestEmails:
2984 """Get Digest_emails"""
2985 response = cast(
2986 mdls.DigestEmails,
2987 self.get(
2988 path="/digest_emails_enabled",
2989 structure=mdls.DigestEmails,
2990 transport_options=transport_options,
2991 ),
2992 )
2993 return response
2994
2995 # ### Update the setting for enabling/disabling digest emails
2996 #
2997 # PATCH /digest_emails_enabled -> mdls.DigestEmails
2998 def update_digest_emails_enabled(
2999 self,
3000 body: mdls.DigestEmails,
3001 transport_options: Optional[transport.TransportOptions] = None,
3002 ) -> mdls.DigestEmails:
3003 """Update Digest_emails"""
3004 response = cast(
3005 mdls.DigestEmails,
3006 self.patch(
3007 path="/digest_emails_enabled",
3008 structure=mdls.DigestEmails,
3009 body=body,
3010 transport_options=transport_options,
3011 ),
3012 )
3013 return response
3014
3015 # ### Trigger the generation of digest email records and send them to Looker's internal system. This does not send
3016 # any actual emails, it generates records containing content which may be of interest for users who have become inactive.
3017 # Emails will be sent at a later time from Looker's internal system if the Digest Emails feature is enabled in settings.
3018 #
3019 # POST /digest_email_send -> mdls.DigestEmailSend
3020 def create_digest_email_send(
3021 self,
3022 transport_options: Optional[transport.TransportOptions] = None,
3023 ) -> mdls.DigestEmailSend:
3024 """Deliver digest email contents"""
3025 response = cast(
3026 mdls.DigestEmailSend,
3027 self.post(
3028 path="/digest_email_send",
3029 structure=mdls.DigestEmailSend,
3030 transport_options=transport_options,
3031 ),
3032 )
3033 return response
3034
3035 # ### Get Egress IP Addresses
3036 #
3037 # Returns the list of public egress IP Addresses for a hosted customer's instance
3038 #
3039 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
3040 #
3041 # GET /public_egress_ip_addresses -> mdls.EgressIpAddresses
3042 def public_egress_ip_addresses(
3043 self,
3044 transport_options: Optional[transport.TransportOptions] = None,
3045 ) -> mdls.EgressIpAddresses:
3046 """Public Egress IP Addresses"""
3047 response = cast(
3048 mdls.EgressIpAddresses,
3049 self.get(
3050 path="/public_egress_ip_addresses",
3051 structure=mdls.EgressIpAddresses,
3052 transport_options=transport_options,
3053 ),
3054 )
3055 return response
3056
3057 # ### Set the menu item name and content for internal help resources
3058 #
3059 # GET /internal_help_resources_content -> mdls.InternalHelpResourcesContent
3060 def internal_help_resources_content(
3061 self,
3062 transport_options: Optional[transport.TransportOptions] = None,
3063 ) -> mdls.InternalHelpResourcesContent:
3064 """Get Internal Help Resources Content"""
3065 response = cast(
3066 mdls.InternalHelpResourcesContent,
3067 self.get(
3068 path="/internal_help_resources_content",
3069 structure=mdls.InternalHelpResourcesContent,
3070 transport_options=transport_options,
3071 ),
3072 )
3073 return response
3074
3075 # Update internal help resources content
3076 #
3077 # PATCH /internal_help_resources_content -> mdls.InternalHelpResourcesContent
3078 def update_internal_help_resources_content(
3079 self,
3080 body: mdls.WriteInternalHelpResourcesContent,
3081 transport_options: Optional[transport.TransportOptions] = None,
3082 ) -> mdls.InternalHelpResourcesContent:
3083 """Update internal help resources content"""
3084 response = cast(
3085 mdls.InternalHelpResourcesContent,
3086 self.patch(
3087 path="/internal_help_resources_content",
3088 structure=mdls.InternalHelpResourcesContent,
3089 body=body,
3090 transport_options=transport_options,
3091 ),
3092 )
3093 return response
3094
3095 # ### Get and set the options for internal help resources
3096 #
3097 # GET /internal_help_resources_enabled -> mdls.InternalHelpResources
3098 def internal_help_resources(
3099 self,
3100 transport_options: Optional[transport.TransportOptions] = None,
3101 ) -> mdls.InternalHelpResources:
3102 """Get Internal Help Resources"""
3103 response = cast(
3104 mdls.InternalHelpResources,
3105 self.get(
3106 path="/internal_help_resources_enabled",
3107 structure=mdls.InternalHelpResources,
3108 transport_options=transport_options,
3109 ),
3110 )
3111 return response
3112
3113 # Update internal help resources settings
3114 #
3115 # PATCH /internal_help_resources -> mdls.InternalHelpResources
3116 def update_internal_help_resources(
3117 self,
3118 body: mdls.WriteInternalHelpResources,
3119 transport_options: Optional[transport.TransportOptions] = None,
3120 ) -> mdls.InternalHelpResources:
3121 """Update internal help resources configuration"""
3122 response = cast(
3123 mdls.InternalHelpResources,
3124 self.patch(
3125 path="/internal_help_resources",
3126 structure=mdls.InternalHelpResources,
3127 body=body,
3128 transport_options=transport_options,
3129 ),
3130 )
3131 return response
3132
3133 # ### Get all legacy features.
3134 #
3135 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
3136 #
3137 # GET /legacy_features -> Sequence[mdls.LegacyFeature]
3138 def all_legacy_features(
3139 self,
3140 transport_options: Optional[transport.TransportOptions] = None,
3141 ) -> Sequence[mdls.LegacyFeature]:
3142 """Get All Legacy Features"""
3143 response = cast(
3144 Sequence[mdls.LegacyFeature],
3145 self.get(
3146 path="/legacy_features",
3147 structure=Sequence[mdls.LegacyFeature],
3148 transport_options=transport_options,
3149 ),
3150 )
3151 return response
3152
3153 # ### Get information about the legacy feature with a specific id.
3154 #
3155 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
3156 #
3157 # GET /legacy_features/{legacy_feature_id} -> mdls.LegacyFeature
3158 def legacy_feature(
3159 self,
3160 # id of legacy feature
3161 legacy_feature_id: str,
3162 transport_options: Optional[transport.TransportOptions] = None,
3163 ) -> mdls.LegacyFeature:
3164 """Get Legacy Feature"""
3165 legacy_feature_id = self.encode_path_param(legacy_feature_id)
3166 response = cast(
3167 mdls.LegacyFeature,
3168 self.get(
3169 path=f"/legacy_features/{legacy_feature_id}",
3170 structure=mdls.LegacyFeature,
3171 transport_options=transport_options,
3172 ),
3173 )
3174 return response
3175
3176 # ### Update information about the legacy feature with a specific id.
3177 #
3178 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
3179 #
3180 # PATCH /legacy_features/{legacy_feature_id} -> mdls.LegacyFeature
3181 def update_legacy_feature(
3182 self,
3183 # id of legacy feature
3184 legacy_feature_id: str,
3185 body: mdls.WriteLegacyFeature,
3186 transport_options: Optional[transport.TransportOptions] = None,
3187 ) -> mdls.LegacyFeature:
3188 """Update Legacy Feature"""
3189 legacy_feature_id = self.encode_path_param(legacy_feature_id)
3190 response = cast(
3191 mdls.LegacyFeature,
3192 self.patch(
3193 path=f"/legacy_features/{legacy_feature_id}",
3194 structure=mdls.LegacyFeature,
3195 body=body,
3196 transport_options=transport_options,
3197 ),
3198 )
3199 return response
3200
3201 # ### Get a list of locales that Looker supports.
3202 #
3203 # GET /locales -> Sequence[mdls.Locale]
3204 def all_locales(
3205 self,
3206 transport_options: Optional[transport.TransportOptions] = None,
3207 ) -> Sequence[mdls.Locale]:
3208 """Get All Locales"""
3209 response = cast(
3210 Sequence[mdls.Locale],
3211 self.get(
3212 path="/locales",
3213 structure=Sequence[mdls.Locale],
3214 transport_options=transport_options,
3215 ),
3216 )
3217 return response
3218
3219 # ### Get all mobile settings.
3220 #
3221 # GET /mobile/settings -> mdls.MobileSettings
3222 def mobile_settings(
3223 self,
3224 transport_options: Optional[transport.TransportOptions] = None,
3225 ) -> mdls.MobileSettings:
3226 """Get Mobile_Settings"""
3227 response = cast(
3228 mdls.MobileSettings,
3229 self.get(
3230 path="/mobile/settings",
3231 structure=mdls.MobileSettings,
3232 transport_options=transport_options,
3233 ),
3234 )
3235 return response
3236
3237 # ### Get Looker Settings
3238 #
3239 # Available settings are:
3240 # - allow_user_timezones
3241 # - custom_welcome_email
3242 # - data_connector_default_enabled
3243 # - dashboard_auto_refresh_restriction
3244 # - dashboard_auto_refresh_minimum_interval
3245 # - extension_framework_enabled
3246 # - extension_load_url_enabled
3247 # - instance_config
3248 # - managed_certificate_uri
3249 # - marketplace_auto_install_enabled
3250 # - marketplace_automation
3251 # - marketplace_terms_accepted
3252 # - marketplace_enabled
3253 # - marketplace_site
3254 # - onboarding_enabled
3255 # - privatelabel_configuration
3256 # - timezone
3257 # - host_url
3258 # - email_domain_allowlist
3259 # - embed_cookieless_v2
3260 # - embed_enabled
3261 # - embed_config
3262 #
3263 # GET /setting -> mdls.Setting
3264 def get_setting(
3265 self,
3266 # Requested fields
3267 fields: Optional[str] = None,
3268 transport_options: Optional[transport.TransportOptions] = None,
3269 ) -> mdls.Setting:
3270 """Get Setting"""
3271 response = cast(
3272 mdls.Setting,
3273 self.get(
3274 path="/setting",
3275 structure=mdls.Setting,
3276 query_params={"fields": fields},
3277 transport_options=transport_options,
3278 ),
3279 )
3280 return response
3281
3282 # ### Configure Looker Settings
3283 #
3284 # Available settings are:
3285 # - allow_user_timezones
3286 # - custom_welcome_email
3287 # - data_connector_default_enabled
3288 # - dashboard_auto_refresh_restriction
3289 # - dashboard_auto_refresh_minimum_interval
3290 # - extension_framework_enabled
3291 # - extension_load_url_enabled
3292 # - instance_config
3293 # - managed_certificate_uri
3294 # - marketplace_auto_install_enabled
3295 # - marketplace_automation
3296 # - marketplace_terms_accepted
3297 # - marketplace_enabled
3298 # - marketplace_site
3299 # - onboarding_enabled
3300 # - privatelabel_configuration
3301 # - timezone
3302 # - host_url
3303 # - email_domain_allowlist
3304 # - embed_cookieless_v2
3305 # - embed_enabled
3306 # - embed_config
3307 #
3308 # See the `Setting` type for more information on the specific values that can be configured.
3309 #
3310 # If a setting update is rejected, the API error payload should provide information on the cause of the rejection.
3311 #
3312 # PATCH /setting -> mdls.Setting
3313 def set_setting(
3314 self,
3315 body: mdls.WriteSetting,
3316 # Requested fields
3317 fields: Optional[str] = None,
3318 transport_options: Optional[transport.TransportOptions] = None,
3319 ) -> mdls.Setting:
3320 """Set Setting"""
3321 response = cast(
3322 mdls.Setting,
3323 self.patch(
3324 path="/setting",
3325 structure=mdls.Setting,
3326 query_params={"fields": fields},
3327 body=body,
3328 transport_options=transport_options,
3329 ),
3330 )
3331 return response
3332
3333 # ### Configure SMTP Settings
3334 # This API allows users to configure the SMTP settings on the Looker instance.
3335 # Only admin users are authorised to call this API.
3336 #
3337 # POST /smtp_settings -> None
3338 def set_smtp_settings(
3339 self,
3340 body: mdls.SmtpSettings,
3341 transport_options: Optional[transport.TransportOptions] = None,
3342 ) -> None:
3343 """Set SMTP Setting"""
3344 response = cast(
3345 None,
3346 self.post(
3347 path="/smtp_settings",
3348 structure=None,
3349 body=body,
3350 transport_options=transport_options,
3351 ),
3352 )
3353 return response
3354
3355 # ### Get current SMTP status.
3356 #
3357 # GET /smtp_status -> mdls.SmtpStatus
3358 def smtp_status(
3359 self,
3360 # Include only these fields in the response
3361 fields: Optional[str] = None,
3362 transport_options: Optional[transport.TransportOptions] = None,
3363 ) -> mdls.SmtpStatus:
3364 """Get SMTP Status"""
3365 response = cast(
3366 mdls.SmtpStatus,
3367 self.get(
3368 path="/smtp_status",
3369 structure=mdls.SmtpStatus,
3370 query_params={"fields": fields},
3371 transport_options=transport_options,
3372 ),
3373 )
3374 return response
3375
3376 # ### Get a list of timezones that Looker supports (e.g. useful for scheduling tasks).
3377 #
3378 # GET /timezones -> Sequence[mdls.Timezone]
3379 def all_timezones(
3380 self,
3381 transport_options: Optional[transport.TransportOptions] = None,
3382 ) -> Sequence[mdls.Timezone]:
3383 """Get All Timezones"""
3384 response = cast(
3385 Sequence[mdls.Timezone],
3386 self.get(
3387 path="/timezones",
3388 structure=Sequence[mdls.Timezone],
3389 transport_options=transport_options,
3390 ),
3391 )
3392 return response
3393
3394 # ### Get information about all API versions supported by this Looker instance.
3395 #
3396 # GET /versions -> mdls.ApiVersion
3397 def versions(
3398 self,
3399 # Requested fields.
3400 fields: Optional[str] = None,
3401 transport_options: Optional[transport.TransportOptions] = None,
3402 ) -> mdls.ApiVersion:
3403 """Get ApiVersion"""
3404 response = cast(
3405 mdls.ApiVersion,
3406 self.get(
3407 path="/versions",
3408 structure=mdls.ApiVersion,
3409 query_params={"fields": fields},
3410 transport_options=transport_options,
3411 ),
3412 )
3413 return response
3414
3415 # ### Get an API specification for this Looker instance.
3416 #
3417 # The specification is returned as a JSON document in Swagger 2.x format
3418 #
3419 # GET /api_spec/{api_version}/{specification} -> Any
3420 def api_spec(
3421 self,
3422 # API version
3423 api_version: str,
3424 # Specification name. Typically, this is "swagger.json"
3425 specification: str,
3426 transport_options: Optional[transport.TransportOptions] = None,
3427 ) -> Any:
3428 """Get an API specification"""
3429 api_version = self.encode_path_param(api_version)
3430 specification = self.encode_path_param(specification)
3431 response = cast(
3432 Any,
3433 self.get(
3434 path=f"/api_spec/{api_version}/{specification}",
3435 structure=Any,
3436 transport_options=transport_options,
3437 ),
3438 )
3439 return response
3440
3441 # ### This feature is enabled only by special license.
3442 #
3443 # This endpoint provides the private label configuration, which includes hiding documentation links, custom favicon uploading, etc.
3444 #
3445 # This endpoint is deprecated. [Get Setting](#!/Config/get_setting) should be used to retrieve private label settings instead
3446 #
3447 # GET /whitelabel_configuration -> mdls.WhitelabelConfiguration
3448 def whitelabel_configuration(
3449 self,
3450 # Requested fields.
3451 fields: Optional[str] = None,
3452 transport_options: Optional[transport.TransportOptions] = None,
3453 ) -> mdls.WhitelabelConfiguration:
3454 """Get Private label configuration"""
3455 response = cast(
3456 mdls.WhitelabelConfiguration,
3457 self.get(
3458 path="/whitelabel_configuration",
3459 structure=mdls.WhitelabelConfiguration,
3460 query_params={"fields": fields},
3461 transport_options=transport_options,
3462 ),
3463 )
3464 return response
3465
3466 # ### Update the private label configuration
3467 #
3468 # This endpoint is deprecated. [Set Setting](#!/Config/set_setting) should be used to update private label settings instead
3469 #
3470 # PUT /whitelabel_configuration -> mdls.WhitelabelConfiguration
3471 def update_whitelabel_configuration(
3472 self,
3473 body: mdls.WriteWhitelabelConfiguration,
3474 transport_options: Optional[transport.TransportOptions] = None,
3475 ) -> mdls.WhitelabelConfiguration:
3476 """Update Private label configuration"""
3477 response = cast(
3478 mdls.WhitelabelConfiguration,
3479 self.put(
3480 path="/whitelabel_configuration",
3481 structure=mdls.WhitelabelConfiguration,
3482 body=body,
3483 transport_options=transport_options,
3484 ),
3485 )
3486 return response
3487
3488 # endregion
3489
3490 # region Connection: Manage Database Connections
3491
3492 # ### Get information about all connections.
3493 #
3494 # GET /connections -> Sequence[mdls.DBConnection]
3495 def all_connections(
3496 self,
3497 # Requested fields.
3498 fields: Optional[str] = None,
3499 transport_options: Optional[transport.TransportOptions] = None,
3500 ) -> Sequence[mdls.DBConnection]:
3501 """Get All Connections"""
3502 response = cast(
3503 Sequence[mdls.DBConnection],
3504 self.get(
3505 path="/connections",
3506 structure=Sequence[mdls.DBConnection],
3507 query_params={"fields": fields},
3508 transport_options=transport_options,
3509 ),
3510 )
3511 return response
3512
3513 # ### Create a connection using the specified configuration.
3514 #
3515 # POST /connections -> mdls.DBConnection
3516 def create_connection(
3517 self,
3518 body: mdls.WriteDBConnection,
3519 transport_options: Optional[transport.TransportOptions] = None,
3520 ) -> mdls.DBConnection:
3521 """Create Connection"""
3522 response = cast(
3523 mdls.DBConnection,
3524 self.post(
3525 path="/connections",
3526 structure=mdls.DBConnection,
3527 body=body,
3528 transport_options=transport_options,
3529 ),
3530 )
3531 return response
3532
3533 # ### Get information about a connection.
3534 #
3535 # GET /connections/{connection_name} -> mdls.DBConnection
3536 def connection(
3537 self,
3538 # Name of connection
3539 connection_name: str,
3540 # Requested fields.
3541 fields: Optional[str] = None,
3542 transport_options: Optional[transport.TransportOptions] = None,
3543 ) -> mdls.DBConnection:
3544 """Get Connection"""
3545 connection_name = self.encode_path_param(connection_name)
3546 response = cast(
3547 mdls.DBConnection,
3548 self.get(
3549 path=f"/connections/{connection_name}",
3550 structure=mdls.DBConnection,
3551 query_params={"fields": fields},
3552 transport_options=transport_options,
3553 ),
3554 )
3555 return response
3556
3557 # ### Update a connection using the specified configuration.
3558 #
3559 # PATCH /connections/{connection_name} -> mdls.DBConnection
3560 def update_connection(
3561 self,
3562 # Name of connection
3563 connection_name: str,
3564 body: mdls.WriteDBConnection,
3565 transport_options: Optional[transport.TransportOptions] = None,
3566 ) -> mdls.DBConnection:
3567 """Update Connection"""
3568 connection_name = self.encode_path_param(connection_name)
3569 response = cast(
3570 mdls.DBConnection,
3571 self.patch(
3572 path=f"/connections/{connection_name}",
3573 structure=mdls.DBConnection,
3574 body=body,
3575 transport_options=transport_options,
3576 ),
3577 )
3578 return response
3579
3580 # ### Delete a connection.
3581 #
3582 # DELETE /connections/{connection_name} -> str
3583 def delete_connection(
3584 self,
3585 # Name of connection
3586 connection_name: str,
3587 transport_options: Optional[transport.TransportOptions] = None,
3588 ) -> str:
3589 """Delete Connection"""
3590 connection_name = self.encode_path_param(connection_name)
3591 response = cast(
3592 str,
3593 self.delete(
3594 path=f"/connections/{connection_name}",
3595 structure=str,
3596 transport_options=transport_options,
3597 ),
3598 )
3599 return response
3600
3601 # ### Delete a connection override.
3602 #
3603 # DELETE /connections/{connection_name}/connection_override/{override_context} -> str
3604 def delete_connection_override(
3605 self,
3606 # Name of connection
3607 connection_name: str,
3608 # Context of connection override
3609 override_context: str,
3610 transport_options: Optional[transport.TransportOptions] = None,
3611 ) -> str:
3612 """Delete Connection Override"""
3613 connection_name = self.encode_path_param(connection_name)
3614 override_context = self.encode_path_param(override_context)
3615 response = cast(
3616 str,
3617 self.delete(
3618 path=f"/connections/{connection_name}/connection_override/{override_context}",
3619 structure=str,
3620 transport_options=transport_options,
3621 ),
3622 )
3623 return response
3624
3625 # ### Test an existing connection.
3626 #
3627 # Note that a connection's 'dialect' property has a 'connection_tests' property that lists the
3628 # specific types of tests that the connection supports.
3629 #
3630 # This API is rate limited.
3631 #
3632 # Unsupported tests in the request will be ignored.
3633 #
3634 # PUT /connections/{connection_name}/test -> Sequence[mdls.DBConnectionTestResult]
3635 def test_connection(
3636 self,
3637 # Name of connection
3638 connection_name: str,
3639 # Array of names of tests to run
3640 tests: Optional[mdls.DelimSequence[str]] = None,
3641 transport_options: Optional[transport.TransportOptions] = None,
3642 ) -> Sequence[mdls.DBConnectionTestResult]:
3643 """Test Connection"""
3644 connection_name = self.encode_path_param(connection_name)
3645 response = cast(
3646 Sequence[mdls.DBConnectionTestResult],
3647 self.put(
3648 path=f"/connections/{connection_name}/test",
3649 structure=Sequence[mdls.DBConnectionTestResult],
3650 query_params={"tests": tests},
3651 transport_options=transport_options,
3652 ),
3653 )
3654 return response
3655
3656 # ### Test a connection configuration.
3657 #
3658 # Note that a connection's 'dialect' property has a 'connection_tests' property that lists the
3659 # specific types of tests that the connection supports.
3660 #
3661 # This API is rate limited.
3662 #
3663 # Unsupported tests in the request will be ignored.
3664 #
3665 # PUT /connections/test -> Sequence[mdls.DBConnectionTestResult]
3666 def test_connection_config(
3667 self,
3668 body: mdls.WriteDBConnection,
3669 # Array of names of tests to run
3670 tests: Optional[mdls.DelimSequence[str]] = None,
3671 transport_options: Optional[transport.TransportOptions] = None,
3672 ) -> Sequence[mdls.DBConnectionTestResult]:
3673 """Test Connection Configuration"""
3674 response = cast(
3675 Sequence[mdls.DBConnectionTestResult],
3676 self.put(
3677 path="/connections/test",
3678 structure=Sequence[mdls.DBConnectionTestResult],
3679 query_params={"tests": tests},
3680 body=body,
3681 transport_options=transport_options,
3682 ),
3683 )
3684 return response
3685
3686 # ### Get information about all dialects.
3687 #
3688 # GET /dialect_info -> Sequence[mdls.DialectInfo]
3689 def all_dialect_infos(
3690 self,
3691 # Requested fields.
3692 fields: Optional[str] = None,
3693 transport_options: Optional[transport.TransportOptions] = None,
3694 ) -> Sequence[mdls.DialectInfo]:
3695 """Get All Dialect Infos"""
3696 response = cast(
3697 Sequence[mdls.DialectInfo],
3698 self.get(
3699 path="/dialect_info",
3700 structure=Sequence[mdls.DialectInfo],
3701 query_params={"fields": fields},
3702 transport_options=transport_options,
3703 ),
3704 )
3705 return response
3706
3707 # ### Get all External OAuth Applications.
3708 #
3709 # This is an OAuth Application which Looker uses to access external systems.
3710 #
3711 # GET /external_oauth_applications -> Sequence[mdls.ExternalOauthApplication]
3712 def all_external_oauth_applications(
3713 self,
3714 # Application name
3715 name: Optional[str] = None,
3716 # Application Client ID
3717 client_id: Optional[str] = None,
3718 transport_options: Optional[transport.TransportOptions] = None,
3719 ) -> Sequence[mdls.ExternalOauthApplication]:
3720 """Get All External OAuth Applications"""
3721 response = cast(
3722 Sequence[mdls.ExternalOauthApplication],
3723 self.get(
3724 path="/external_oauth_applications",
3725 structure=Sequence[mdls.ExternalOauthApplication],
3726 query_params={"name": name, "client_id": client_id},
3727 transport_options=transport_options,
3728 ),
3729 )
3730 return response
3731
3732 # ### Create an OAuth Application using the specified configuration.
3733 #
3734 # This is an OAuth Application which Looker uses to access external systems.
3735 #
3736 # POST /external_oauth_applications -> mdls.ExternalOauthApplication
3737 def create_external_oauth_application(
3738 self,
3739 body: mdls.WriteExternalOauthApplication,
3740 transport_options: Optional[transport.TransportOptions] = None,
3741 ) -> mdls.ExternalOauthApplication:
3742 """Create External OAuth Application"""
3743 response = cast(
3744 mdls.ExternalOauthApplication,
3745 self.post(
3746 path="/external_oauth_applications",
3747 structure=mdls.ExternalOauthApplication,
3748 body=body,
3749 transport_options=transport_options,
3750 ),
3751 )
3752 return response
3753
3754 # ### Update an OAuth Application's client secret.
3755 #
3756 # This is an OAuth Application which Looker uses to access external systems.
3757 #
3758 # PATCH /external_oauth_applications/{client_id} -> mdls.ExternalOauthApplication
3759 def update_external_oauth_application(
3760 self,
3761 # The client ID of the OAuth App to update
3762 client_id: str,
3763 body: mdls.WriteExternalOauthApplication,
3764 transport_options: Optional[transport.TransportOptions] = None,
3765 ) -> mdls.ExternalOauthApplication:
3766 """Update External OAuth Application"""
3767 client_id = self.encode_path_param(client_id)
3768 response = cast(
3769 mdls.ExternalOauthApplication,
3770 self.patch(
3771 path=f"/external_oauth_applications/{client_id}",
3772 structure=mdls.ExternalOauthApplication,
3773 body=body,
3774 transport_options=transport_options,
3775 ),
3776 )
3777 return response
3778
3779 # ### Create OAuth User state.
3780 #
3781 # POST /external_oauth_applications/user_state -> mdls.CreateOAuthApplicationUserStateResponse
3782 def create_oauth_application_user_state(
3783 self,
3784 body: mdls.CreateOAuthApplicationUserStateRequest,
3785 transport_options: Optional[transport.TransportOptions] = None,
3786 ) -> mdls.CreateOAuthApplicationUserStateResponse:
3787 """Create Create OAuth user state."""
3788 response = cast(
3789 mdls.CreateOAuthApplicationUserStateResponse,
3790 self.post(
3791 path="/external_oauth_applications/user_state",
3792 structure=mdls.CreateOAuthApplicationUserStateResponse,
3793 body=body,
3794 transport_options=transport_options,
3795 ),
3796 )
3797 return response
3798
3799 # ### Get information about all SSH Servers.
3800 #
3801 # GET /ssh_servers -> Sequence[mdls.SshServer]
3802 def all_ssh_servers(
3803 self,
3804 # Requested fields.
3805 fields: Optional[str] = None,
3806 transport_options: Optional[transport.TransportOptions] = None,
3807 ) -> Sequence[mdls.SshServer]:
3808 """Get All SSH Servers"""
3809 response = cast(
3810 Sequence[mdls.SshServer],
3811 self.get(
3812 path="/ssh_servers",
3813 structure=Sequence[mdls.SshServer],
3814 query_params={"fields": fields},
3815 transport_options=transport_options,
3816 ),
3817 )
3818 return response
3819
3820 # ### Create an SSH Server.
3821 #
3822 # POST /ssh_servers -> mdls.SshServer
3823 def create_ssh_server(
3824 self,
3825 body: mdls.WriteSshServer,
3826 transport_options: Optional[transport.TransportOptions] = None,
3827 ) -> mdls.SshServer:
3828 """Create SSH Server"""
3829 response = cast(
3830 mdls.SshServer,
3831 self.post(
3832 path="/ssh_servers",
3833 structure=mdls.SshServer,
3834 body=body,
3835 transport_options=transport_options,
3836 ),
3837 )
3838 return response
3839
3840 # ### Get information about an SSH Server.
3841 #
3842 # GET /ssh_server/{ssh_server_id} -> mdls.SshServer
3843 def ssh_server(
3844 self,
3845 # Id of SSH Server
3846 ssh_server_id: str,
3847 transport_options: Optional[transport.TransportOptions] = None,
3848 ) -> mdls.SshServer:
3849 """Get SSH Server"""
3850 ssh_server_id = self.encode_path_param(ssh_server_id)
3851 response = cast(
3852 mdls.SshServer,
3853 self.get(
3854 path=f"/ssh_server/{ssh_server_id}",
3855 structure=mdls.SshServer,
3856 transport_options=transport_options,
3857 ),
3858 )
3859 return response
3860
3861 # ### Update an SSH Server.
3862 #
3863 # PATCH /ssh_server/{ssh_server_id} -> mdls.SshServer
3864 def update_ssh_server(
3865 self,
3866 # Id of SSH Server
3867 ssh_server_id: str,
3868 body: mdls.WriteSshServer,
3869 transport_options: Optional[transport.TransportOptions] = None,
3870 ) -> mdls.SshServer:
3871 """Update SSH Server"""
3872 ssh_server_id = self.encode_path_param(ssh_server_id)
3873 response = cast(
3874 mdls.SshServer,
3875 self.patch(
3876 path=f"/ssh_server/{ssh_server_id}",
3877 structure=mdls.SshServer,
3878 body=body,
3879 transport_options=transport_options,
3880 ),
3881 )
3882 return response
3883
3884 # ### Delete an SSH Server.
3885 #
3886 # DELETE /ssh_server/{ssh_server_id} -> str
3887 def delete_ssh_server(
3888 self,
3889 # Id of SSH Server
3890 ssh_server_id: str,
3891 transport_options: Optional[transport.TransportOptions] = None,
3892 ) -> str:
3893 """Delete SSH Server"""
3894 ssh_server_id = self.encode_path_param(ssh_server_id)
3895 response = cast(
3896 str,
3897 self.delete(
3898 path=f"/ssh_server/{ssh_server_id}",
3899 structure=str,
3900 transport_options=transport_options,
3901 ),
3902 )
3903 return response
3904
3905 # ### Test the SSH Server
3906 #
3907 # GET /ssh_server/{ssh_server_id}/test -> mdls.SshServer
3908 def test_ssh_server(
3909 self,
3910 # Id of SSH Server
3911 ssh_server_id: str,
3912 transport_options: Optional[transport.TransportOptions] = None,
3913 ) -> mdls.SshServer:
3914 """Test SSH Server"""
3915 ssh_server_id = self.encode_path_param(ssh_server_id)
3916 response = cast(
3917 mdls.SshServer,
3918 self.get(
3919 path=f"/ssh_server/{ssh_server_id}/test",
3920 structure=mdls.SshServer,
3921 transport_options=transport_options,
3922 ),
3923 )
3924 return response
3925
3926 # ### Get information about all SSH Tunnels.
3927 #
3928 # GET /ssh_tunnels -> Sequence[mdls.SshTunnel]
3929 def all_ssh_tunnels(
3930 self,
3931 # Requested fields.
3932 fields: Optional[str] = None,
3933 transport_options: Optional[transport.TransportOptions] = None,
3934 ) -> Sequence[mdls.SshTunnel]:
3935 """Get All SSH Tunnels"""
3936 response = cast(
3937 Sequence[mdls.SshTunnel],
3938 self.get(
3939 path="/ssh_tunnels",
3940 structure=Sequence[mdls.SshTunnel],
3941 query_params={"fields": fields},
3942 transport_options=transport_options,
3943 ),
3944 )
3945 return response
3946
3947 # ### Create an SSH Tunnel
3948 #
3949 # POST /ssh_tunnels -> mdls.SshTunnel
3950 def create_ssh_tunnel(
3951 self,
3952 body: mdls.WriteSshTunnel,
3953 transport_options: Optional[transport.TransportOptions] = None,
3954 ) -> mdls.SshTunnel:
3955 """Create SSH Tunnel"""
3956 response = cast(
3957 mdls.SshTunnel,
3958 self.post(
3959 path="/ssh_tunnels",
3960 structure=mdls.SshTunnel,
3961 body=body,
3962 transport_options=transport_options,
3963 ),
3964 )
3965 return response
3966
3967 # ### Get information about an SSH Tunnel.
3968 #
3969 # GET /ssh_tunnel/{ssh_tunnel_id} -> mdls.SshTunnel
3970 def ssh_tunnel(
3971 self,
3972 # Id of SSH Tunnel
3973 ssh_tunnel_id: str,
3974 transport_options: Optional[transport.TransportOptions] = None,
3975 ) -> mdls.SshTunnel:
3976 """Get SSH Tunnel"""
3977 ssh_tunnel_id = self.encode_path_param(ssh_tunnel_id)
3978 response = cast(
3979 mdls.SshTunnel,
3980 self.get(
3981 path=f"/ssh_tunnel/{ssh_tunnel_id}",
3982 structure=mdls.SshTunnel,
3983 transport_options=transport_options,
3984 ),
3985 )
3986 return response
3987
3988 # ### Update an SSH Tunnel
3989 #
3990 # PATCH /ssh_tunnel/{ssh_tunnel_id} -> mdls.SshTunnel
3991 def update_ssh_tunnel(
3992 self,
3993 # Id of SSH Tunnel
3994 ssh_tunnel_id: str,
3995 body: mdls.WriteSshTunnel,
3996 transport_options: Optional[transport.TransportOptions] = None,
3997 ) -> mdls.SshTunnel:
3998 """Update SSH Tunnel"""
3999 ssh_tunnel_id = self.encode_path_param(ssh_tunnel_id)
4000 response = cast(
4001 mdls.SshTunnel,
4002 self.patch(
4003 path=f"/ssh_tunnel/{ssh_tunnel_id}",
4004 structure=mdls.SshTunnel,
4005 body=body,
4006 transport_options=transport_options,
4007 ),
4008 )
4009 return response
4010
4011 # ### Delete an SSH Tunnel
4012 #
4013 # DELETE /ssh_tunnel/{ssh_tunnel_id} -> str
4014 def delete_ssh_tunnel(
4015 self,
4016 # Id of SSH Tunnel
4017 ssh_tunnel_id: str,
4018 transport_options: Optional[transport.TransportOptions] = None,
4019 ) -> str:
4020 """Delete SSH Tunnel"""
4021 ssh_tunnel_id = self.encode_path_param(ssh_tunnel_id)
4022 response = cast(
4023 str,
4024 self.delete(
4025 path=f"/ssh_tunnel/{ssh_tunnel_id}",
4026 structure=str,
4027 transport_options=transport_options,
4028 ),
4029 )
4030 return response
4031
4032 # ### Test the SSH Tunnel
4033 #
4034 # GET /ssh_tunnel/{ssh_tunnel_id}/test -> mdls.SshTunnel
4035 def test_ssh_tunnel(
4036 self,
4037 # Id of SSH Tunnel
4038 ssh_tunnel_id: str,
4039 transport_options: Optional[transport.TransportOptions] = None,
4040 ) -> mdls.SshTunnel:
4041 """Test SSH Tunnel"""
4042 ssh_tunnel_id = self.encode_path_param(ssh_tunnel_id)
4043 response = cast(
4044 mdls.SshTunnel,
4045 self.get(
4046 path=f"/ssh_tunnel/{ssh_tunnel_id}/test",
4047 structure=mdls.SshTunnel,
4048 transport_options=transport_options,
4049 ),
4050 )
4051 return response
4052
4053 # ### Get the SSH public key
4054 #
4055 # Get the public key created for this instance to identify itself to a remote SSH server.
4056 #
4057 # GET /ssh_public_key -> mdls.SshPublicKey
4058 def ssh_public_key(
4059 self,
4060 transport_options: Optional[transport.TransportOptions] = None,
4061 ) -> mdls.SshPublicKey:
4062 """Get SSH Public Key"""
4063 response = cast(
4064 mdls.SshPublicKey,
4065 self.get(
4066 path="/ssh_public_key",
4067 structure=mdls.SshPublicKey,
4068 transport_options=transport_options,
4069 ),
4070 )
4071 return response
4072
4073 # endregion
4074
4075 # region Content: Manage Content
4076
4077 # ### Search Favorite Content
4078 #
4079 # If multiple search params are given and `filter_or` is FALSE or not specified,
4080 # search params are combined in a logical AND operation.
4081 # Only rows that match *all* search param criteria will be returned.
4082 #
4083 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
4084 # Results will include rows that match **any** of the search criteria.
4085 #
4086 # String search params use case-insensitive matching.
4087 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
4088 # example="dan%" will match "danger" and "Danzig" but not "David"
4089 # example="D_m%" will match "Damage" and "dump"
4090 #
4091 # Integer search params can accept a single value or a comma separated list of values. The multiple
4092 # values will be combined under a logical OR operation - results will match at least one of
4093 # the given values.
4094 #
4095 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
4096 # or exclude (respectively) rows where the column is null.
4097 #
4098 # Boolean search params accept only "true" and "false" as values.
4099 #
4100 # GET /content_favorite/search -> Sequence[mdls.ContentFavorite]
4101 def search_content_favorites(
4102 self,
4103 # Match content favorite id(s)
4104 id: Optional[str] = None,
4105 # Match user id(s).To create a list of multiple ids, use commas as separators
4106 user_id: Optional[str] = None,
4107 # Match content metadata id(s).To create a list of multiple ids, use commas as separators
4108 content_metadata_id: Optional[str] = None,
4109 # Match dashboard id(s).To create a list of multiple ids, use commas as separators
4110 dashboard_id: Optional[str] = None,
4111 # Match look id(s).To create a list of multiple ids, use commas as separators
4112 look_id: Optional[str] = None,
4113 # Match board id(s).To create a list of multiple ids, use commas as separators
4114 board_id: Optional[str] = None,
4115 # Number of results to return. (used with offset)
4116 limit: Optional[int] = None,
4117 # Number of results to skip before returning any. (used with limit)
4118 offset: Optional[int] = None,
4119 # Fields to sort by.
4120 sorts: Optional[str] = None,
4121 # Requested fields.
4122 fields: Optional[str] = None,
4123 # Combine given search criteria in a boolean OR expression
4124 filter_or: Optional[bool] = None,
4125 transport_options: Optional[transport.TransportOptions] = None,
4126 ) -> Sequence[mdls.ContentFavorite]:
4127 """Search Favorite Contents"""
4128 response = cast(
4129 Sequence[mdls.ContentFavorite],
4130 self.get(
4131 path="/content_favorite/search",
4132 structure=Sequence[mdls.ContentFavorite],
4133 query_params={
4134 "id": id,
4135 "user_id": user_id,
4136 "content_metadata_id": content_metadata_id,
4137 "dashboard_id": dashboard_id,
4138 "look_id": look_id,
4139 "board_id": board_id,
4140 "limit": limit,
4141 "offset": offset,
4142 "sorts": sorts,
4143 "fields": fields,
4144 "filter_or": filter_or,
4145 },
4146 transport_options=transport_options,
4147 ),
4148 )
4149 return response
4150
4151 # ### Get favorite content by its id
4152 #
4153 # GET /content_favorite/{content_favorite_id} -> mdls.ContentFavorite
4154 def content_favorite(
4155 self,
4156 # Id of favorite content
4157 content_favorite_id: str,
4158 # Requested fields.
4159 fields: Optional[str] = None,
4160 transport_options: Optional[transport.TransportOptions] = None,
4161 ) -> mdls.ContentFavorite:
4162 """Get Favorite Content"""
4163 content_favorite_id = self.encode_path_param(content_favorite_id)
4164 response = cast(
4165 mdls.ContentFavorite,
4166 self.get(
4167 path=f"/content_favorite/{content_favorite_id}",
4168 structure=mdls.ContentFavorite,
4169 query_params={"fields": fields},
4170 transport_options=transport_options,
4171 ),
4172 )
4173 return response
4174
4175 # ### Delete favorite content
4176 #
4177 # DELETE /content_favorite/{content_favorite_id} -> str
4178 def delete_content_favorite(
4179 self,
4180 # Id of favorite content
4181 content_favorite_id: str,
4182 transport_options: Optional[transport.TransportOptions] = None,
4183 ) -> str:
4184 """Delete Favorite Content"""
4185 content_favorite_id = self.encode_path_param(content_favorite_id)
4186 response = cast(
4187 str,
4188 self.delete(
4189 path=f"/content_favorite/{content_favorite_id}",
4190 structure=str,
4191 transport_options=transport_options,
4192 ),
4193 )
4194 return response
4195
4196 # ### Create favorite content
4197 #
4198 # POST /content_favorite -> mdls.ContentFavorite
4199 def create_content_favorite(
4200 self,
4201 body: mdls.WriteContentFavorite,
4202 transport_options: Optional[transport.TransportOptions] = None,
4203 ) -> mdls.ContentFavorite:
4204 """Create Favorite Content"""
4205 response = cast(
4206 mdls.ContentFavorite,
4207 self.post(
4208 path="/content_favorite",
4209 structure=mdls.ContentFavorite,
4210 body=body,
4211 transport_options=transport_options,
4212 ),
4213 )
4214 return response
4215
4216 # ### Get information about all content metadata in a space.
4217 #
4218 # GET /content_metadata -> Sequence[mdls.ContentMeta]
4219 def all_content_metadatas(
4220 self,
4221 # Parent space of content.
4222 parent_id: str,
4223 # Requested fields.
4224 fields: Optional[str] = None,
4225 transport_options: Optional[transport.TransportOptions] = None,
4226 ) -> Sequence[mdls.ContentMeta]:
4227 """Get All Content Metadatas"""
4228 response = cast(
4229 Sequence[mdls.ContentMeta],
4230 self.get(
4231 path="/content_metadata",
4232 structure=Sequence[mdls.ContentMeta],
4233 query_params={"parent_id": parent_id, "fields": fields},
4234 transport_options=transport_options,
4235 ),
4236 )
4237 return response
4238
4239 # ### Get information about an individual content metadata record.
4240 #
4241 # GET /content_metadata/{content_metadata_id} -> mdls.ContentMeta
4242 def content_metadata(
4243 self,
4244 # Id of content metadata
4245 content_metadata_id: str,
4246 # Requested fields.
4247 fields: Optional[str] = None,
4248 transport_options: Optional[transport.TransportOptions] = None,
4249 ) -> mdls.ContentMeta:
4250 """Get Content Metadata"""
4251 content_metadata_id = self.encode_path_param(content_metadata_id)
4252 response = cast(
4253 mdls.ContentMeta,
4254 self.get(
4255 path=f"/content_metadata/{content_metadata_id}",
4256 structure=mdls.ContentMeta,
4257 query_params={"fields": fields},
4258 transport_options=transport_options,
4259 ),
4260 )
4261 return response
4262
4263 # ### Move a piece of content.
4264 #
4265 # PATCH /content_metadata/{content_metadata_id} -> mdls.ContentMeta
4266 def update_content_metadata(
4267 self,
4268 # Id of content metadata
4269 content_metadata_id: str,
4270 body: mdls.WriteContentMeta,
4271 transport_options: Optional[transport.TransportOptions] = None,
4272 ) -> mdls.ContentMeta:
4273 """Update Content Metadata"""
4274 content_metadata_id = self.encode_path_param(content_metadata_id)
4275 response = cast(
4276 mdls.ContentMeta,
4277 self.patch(
4278 path=f"/content_metadata/{content_metadata_id}",
4279 structure=mdls.ContentMeta,
4280 body=body,
4281 transport_options=transport_options,
4282 ),
4283 )
4284 return response
4285
4286 # ### All content metadata access records for a content metadata item.
4287 #
4288 # GET /content_metadata_access -> Sequence[mdls.ContentMetaGroupUser]
4289 def all_content_metadata_accesses(
4290 self,
4291 # Id of content metadata
4292 content_metadata_id: str,
4293 # Requested fields.
4294 fields: Optional[str] = None,
4295 transport_options: Optional[transport.TransportOptions] = None,
4296 ) -> Sequence[mdls.ContentMetaGroupUser]:
4297 """Get All Content Metadata Accesses"""
4298 response = cast(
4299 Sequence[mdls.ContentMetaGroupUser],
4300 self.get(
4301 path="/content_metadata_access",
4302 structure=Sequence[mdls.ContentMetaGroupUser],
4303 query_params={
4304 "content_metadata_id": content_metadata_id,
4305 "fields": fields,
4306 },
4307 transport_options=transport_options,
4308 ),
4309 )
4310 return response
4311
4312 # ### Create content metadata access.
4313 #
4314 # POST /content_metadata_access -> mdls.ContentMetaGroupUser
4315 def create_content_metadata_access(
4316 self,
4317 # WARNING: no writeable properties found for POST, PUT, or PATCH
4318 body: mdls.ContentMetaGroupUser,
4319 # Optionally sends notification email when granting access to a board.
4320 send_boards_notification_email: Optional[bool] = None,
4321 transport_options: Optional[transport.TransportOptions] = None,
4322 ) -> mdls.ContentMetaGroupUser:
4323 """Create Content Metadata Access"""
4324 response = cast(
4325 mdls.ContentMetaGroupUser,
4326 self.post(
4327 path="/content_metadata_access",
4328 structure=mdls.ContentMetaGroupUser,
4329 query_params={
4330 "send_boards_notification_email": send_boards_notification_email
4331 },
4332 body=body,
4333 transport_options=transport_options,
4334 ),
4335 )
4336 return response
4337
4338 # ### Update type of access for content metadata.
4339 #
4340 # PUT /content_metadata_access/{content_metadata_access_id} -> mdls.ContentMetaGroupUser
4341 def update_content_metadata_access(
4342 self,
4343 # Id of content metadata access
4344 content_metadata_access_id: str,
4345 # WARNING: no writeable properties found for POST, PUT, or PATCH
4346 body: mdls.ContentMetaGroupUser,
4347 transport_options: Optional[transport.TransportOptions] = None,
4348 ) -> mdls.ContentMetaGroupUser:
4349 """Update Content Metadata Access"""
4350 content_metadata_access_id = self.encode_path_param(content_metadata_access_id)
4351 response = cast(
4352 mdls.ContentMetaGroupUser,
4353 self.put(
4354 path=f"/content_metadata_access/{content_metadata_access_id}",
4355 structure=mdls.ContentMetaGroupUser,
4356 body=body,
4357 transport_options=transport_options,
4358 ),
4359 )
4360 return response
4361
4362 # ### Remove content metadata access.
4363 #
4364 # DELETE /content_metadata_access/{content_metadata_access_id} -> str
4365 def delete_content_metadata_access(
4366 self,
4367 # Id of content metadata access
4368 content_metadata_access_id: str,
4369 transport_options: Optional[transport.TransportOptions] = None,
4370 ) -> str:
4371 """Delete Content Metadata Access"""
4372 content_metadata_access_id = self.encode_path_param(content_metadata_access_id)
4373 response = cast(
4374 str,
4375 self.delete(
4376 path=f"/content_metadata_access/{content_metadata_access_id}",
4377 structure=str,
4378 transport_options=transport_options,
4379 ),
4380 )
4381 return response
4382
4383 # ### Search across looks, dashboards, and lookml dashboards. The terms field will be matched against the
4384 # title and description of the content and the closest results are returned. Content that has been frequently
4385 # viewed and those pieces of content stored in public folders will be ranked more highly in the results.
4386 #
4387 # This endpoint does not return a full description of these content types. For more specific information
4388 # about each type please refer to the individual content specific API endpoints.
4389 #
4390 # Get the **full details** of a specific dashboard (or lookml dashboard) by id with [dashboard()](#!/Dashboard/dashboard)
4391 # Get the **full details** of a specific look by id with [look()](#!/Look/look)
4392 #
4393 # GET /content/{terms} -> Sequence[mdls.ContentSearch]
4394 def search_content(
4395 self,
4396 # Search terms
4397 terms: str,
4398 # Requested fields.
4399 fields: Optional[str] = None,
4400 # Content types requested (dashboard, look, lookml_dashboard).
4401 types: Optional[str] = None,
4402 # Number of results to return. (used with offset and takes priority over page and per_page)
4403 limit: Optional[int] = None,
4404 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
4405 offset: Optional[int] = None,
4406 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
4407 page: Optional[int] = None,
4408 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
4409 per_page: Optional[int] = None,
4410 transport_options: Optional[transport.TransportOptions] = None,
4411 ) -> Sequence[mdls.ContentSearch]:
4412 """Search Content"""
4413 terms = self.encode_path_param(terms)
4414 response = cast(
4415 Sequence[mdls.ContentSearch],
4416 self.get(
4417 path=f"/content/{terms}",
4418 structure=Sequence[mdls.ContentSearch],
4419 query_params={
4420 "fields": fields,
4421 "types": types,
4422 "limit": limit,
4423 "offset": offset,
4424 "page": page,
4425 "per_page": per_page,
4426 },
4427 transport_options=transport_options,
4428 ),
4429 )
4430 return response
4431
4432 # ### Get Content Summary
4433 #
4434 # Retrieves a collection of content items related to user activity and engagement, such as recently viewed content,
4435 # favorites and scheduled items.
4436 #
4437 # GET /content_summary -> Sequence[mdls.ContentSummary]
4438 def content_summary(
4439 self,
4440 # Comma-delimited names of fields to return in responses. Omit for all fields
4441 fields: Optional[str] = None,
4442 # Number of results to return. (used with offset)
4443 limit: Optional[int] = None,
4444 # Number of results to skip before returning any. (used with limit)
4445 offset: Optional[int] = None,
4446 # Match group id
4447 target_group_id: Optional[str] = None,
4448 # Match user id
4449 target_user_id: Optional[str] = None,
4450 # Content type to match, options are: look, dashboard. Can be provided as a comma delimited list.
4451 target_content_type: Optional[str] = None,
4452 # Fields to sort by
4453 sorts: Optional[str] = None,
4454 transport_options: Optional[transport.TransportOptions] = None,
4455 ) -> Sequence[mdls.ContentSummary]:
4456 """Search Content Summaries"""
4457 response = cast(
4458 Sequence[mdls.ContentSummary],
4459 self.get(
4460 path="/content_summary",
4461 structure=Sequence[mdls.ContentSummary],
4462 query_params={
4463 "fields": fields,
4464 "limit": limit,
4465 "offset": offset,
4466 "target_group_id": target_group_id,
4467 "target_user_id": target_user_id,
4468 "target_content_type": target_content_type,
4469 "sorts": sorts,
4470 },
4471 transport_options=transport_options,
4472 ),
4473 )
4474 return response
4475
4476 # ### Get an image representing the contents of a dashboard or look.
4477 #
4478 # The returned thumbnail is an abstract representation of the contents of a dashboard or look and does not
4479 # reflect the actual data displayed in the respective visualizations.
4480 #
4481 # GET /content_thumbnail/{type}/{resource_id} -> Union[str, bytes]
4482 def content_thumbnail(
4483 self,
4484 # Either dashboard or look
4485 type: str,
4486 # ID of the dashboard or look to render
4487 resource_id: str,
4488 # Whether or not to refresh the rendered image with the latest content
4489 reload: Optional[str] = None,
4490 # Light or dark background. Default is "light"
4491 theme: Optional[str] = None,
4492 # A value of png produces a thumbnail in PNG format instead of SVG (default)
4493 format: Optional[str] = None,
4494 # The width of the image if format is supplied
4495 width: Optional[int] = None,
4496 # The height of the image if format is supplied
4497 height: Optional[int] = None,
4498 transport_options: Optional[transport.TransportOptions] = None,
4499 ) -> Union[str, bytes]:
4500 """Get Content Thumbnail"""
4501 type = self.encode_path_param(type)
4502 resource_id = self.encode_path_param(resource_id)
4503 response = cast(
4504 Union[str, bytes],
4505 self.get(
4506 path=f"/content_thumbnail/{type}/{resource_id}",
4507 structure=Union[str, bytes], # type: ignore
4508 query_params={
4509 "reload": reload,
4510 "theme": theme,
4511 "format": format,
4512 "width": width,
4513 "height": height,
4514 },
4515 transport_options=transport_options,
4516 ),
4517 )
4518 return response
4519
4520 # ### Validate All Content
4521 #
4522 # Performs validation of all looks and dashboards
4523 # Returns a list of errors found as well as metadata about the content validation run.
4524 #
4525 # GET /content_validation -> mdls.ContentValidation
4526 def content_validation(
4527 self,
4528 # Requested fields.
4529 fields: Optional[str] = None,
4530 # Optional list of project names to filter by
4531 project_names: Optional[mdls.DelimSequence[str]] = None,
4532 # Optional list of space ids to filter by
4533 space_ids: Optional[mdls.DelimSequence[str]] = None,
4534 transport_options: Optional[transport.TransportOptions] = None,
4535 ) -> mdls.ContentValidation:
4536 """Validate Content"""
4537 response = cast(
4538 mdls.ContentValidation,
4539 self.get(
4540 path="/content_validation",
4541 structure=mdls.ContentValidation,
4542 query_params={
4543 "fields": fields,
4544 "project_names": project_names,
4545 "space_ids": space_ids,
4546 },
4547 transport_options=transport_options,
4548 ),
4549 )
4550 return response
4551
4552 # ### Search Content Views
4553 #
4554 # If multiple search params are given and `filter_or` is FALSE or not specified,
4555 # search params are combined in a logical AND operation.
4556 # Only rows that match *all* search param criteria will be returned.
4557 #
4558 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
4559 # Results will include rows that match **any** of the search criteria.
4560 #
4561 # String search params use case-insensitive matching.
4562 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
4563 # example="dan%" will match "danger" and "Danzig" but not "David"
4564 # example="D_m%" will match "Damage" and "dump"
4565 #
4566 # Integer search params can accept a single value or a comma separated list of values. The multiple
4567 # values will be combined under a logical OR operation - results will match at least one of
4568 # the given values.
4569 #
4570 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
4571 # or exclude (respectively) rows where the column is null.
4572 #
4573 # Boolean search params accept only "true" and "false" as values.
4574 #
4575 # GET /content_view/search -> Sequence[mdls.ContentView]
4576 def search_content_views(
4577 self,
4578 # Match view count
4579 view_count: Optional[str] = None,
4580 # Match Group Id
4581 group_id: Optional[str] = None,
4582 # Match look_id
4583 look_id: Optional[str] = None,
4584 # Match dashboard_id
4585 dashboard_id: Optional[str] = None,
4586 # Match content metadata id
4587 content_metadata_id: Optional[str] = None,
4588 # Match start of week date (format is "YYYY-MM-DD")
4589 start_of_week_date: Optional[str] = None,
4590 # True if only all time view records should be returned
4591 all_time: Optional[bool] = None,
4592 # Match user id
4593 user_id: Optional[str] = None,
4594 # Requested fields
4595 fields: Optional[str] = None,
4596 # Number of results to return. Use with `offset` to manage pagination of results
4597 limit: Optional[int] = None,
4598 # Number of results to skip before returning data
4599 offset: Optional[int] = None,
4600 # Fields to sort by
4601 sorts: Optional[str] = None,
4602 # Combine given search criteria in a boolean OR expression
4603 filter_or: Optional[bool] = None,
4604 transport_options: Optional[transport.TransportOptions] = None,
4605 ) -> Sequence[mdls.ContentView]:
4606 """Search Content Views"""
4607 response = cast(
4608 Sequence[mdls.ContentView],
4609 self.get(
4610 path="/content_view/search",
4611 structure=Sequence[mdls.ContentView],
4612 query_params={
4613 "view_count": view_count,
4614 "group_id": group_id,
4615 "look_id": look_id,
4616 "dashboard_id": dashboard_id,
4617 "content_metadata_id": content_metadata_id,
4618 "start_of_week_date": start_of_week_date,
4619 "all_time": all_time,
4620 "user_id": user_id,
4621 "fields": fields,
4622 "limit": limit,
4623 "offset": offset,
4624 "sorts": sorts,
4625 "filter_or": filter_or,
4626 },
4627 transport_options=transport_options,
4628 ),
4629 )
4630 return response
4631
4632 # ### Get a vector image representing the contents of a dashboard or look.
4633 #
4634 # # DEPRECATED: Use [content_thumbnail()](#!/Content/content_thumbnail)
4635 #
4636 # The returned thumbnail is an abstract representation of the contents of a dashboard or look and does not
4637 # reflect the actual data displayed in the respective visualizations.
4638 #
4639 # GET /vector_thumbnail/{type}/{resource_id} -> str
4640 def vector_thumbnail(
4641 self,
4642 # Either dashboard or look
4643 type: str,
4644 # ID of the dashboard or look to render
4645 resource_id: str,
4646 # Whether or not to refresh the rendered image with the latest content
4647 reload: Optional[str] = None,
4648 transport_options: Optional[transport.TransportOptions] = None,
4649 ) -> str:
4650 """Get Vector Thumbnail"""
4651 type = self.encode_path_param(type)
4652 resource_id = self.encode_path_param(resource_id)
4653 response = cast(
4654 str,
4655 self.get(
4656 path=f"/vector_thumbnail/{type}/{resource_id}",
4657 structure=str,
4658 query_params={"reload": reload},
4659 transport_options=transport_options,
4660 ),
4661 )
4662 return response
4663
4664 # endregion
4665
4666 # region Dashboard: Manage Dashboards
4667
4668 # ### Get information about all active dashboards.
4669 #
4670 # Returns an array of **abbreviated dashboard objects**. Dashboards marked as deleted are excluded from this list.
4671 #
4672 # Get the **full details** of a specific dashboard by id with [dashboard()](#!/Dashboard/dashboard)
4673 #
4674 # Find **deleted dashboards** with [search_dashboards()](#!/Dashboard/search_dashboards)
4675 #
4676 # GET /dashboards -> Sequence[mdls.DashboardBase]
4677 def all_dashboards(
4678 self,
4679 # Requested fields.
4680 fields: Optional[str] = None,
4681 transport_options: Optional[transport.TransportOptions] = None,
4682 ) -> Sequence[mdls.DashboardBase]:
4683 """Get All Dashboards"""
4684 response = cast(
4685 Sequence[mdls.DashboardBase],
4686 self.get(
4687 path="/dashboards",
4688 structure=Sequence[mdls.DashboardBase],
4689 query_params={"fields": fields},
4690 transport_options=transport_options,
4691 ),
4692 )
4693 return response
4694
4695 # ### Create a new dashboard
4696 #
4697 # Creates a new dashboard object and returns the details of the newly created dashboard.
4698 #
4699 # `Title` and `space_id` are required fields.
4700 # `Space_id` must contain the id of an existing space.
4701 # A dashboard's `title` must be unique within the space in which it resides.
4702 #
4703 # If you receive a 422 error response when creating a dashboard, be sure to look at the
4704 # response body for information about exactly which fields are missing or contain invalid data.
4705 #
4706 # You can **update** an existing dashboard with [update_dashboard()](#!/Dashboard/update_dashboard)
4707 #
4708 # You can **permanently delete** an existing dashboard with [delete_dashboard()](#!/Dashboard/delete_dashboard)
4709 #
4710 # POST /dashboards -> mdls.Dashboard
4711 def create_dashboard(
4712 self,
4713 body: mdls.WriteDashboard,
4714 transport_options: Optional[transport.TransportOptions] = None,
4715 ) -> mdls.Dashboard:
4716 """Create Dashboard"""
4717 response = cast(
4718 mdls.Dashboard,
4719 self.post(
4720 path="/dashboards",
4721 structure=mdls.Dashboard,
4722 body=body,
4723 transport_options=transport_options,
4724 ),
4725 )
4726 return response
4727
4728 # ### Search Dashboards
4729 #
4730 # Returns an array of **user-defined dashboard** objects that match the specified search criteria.
4731 # Note, [search_dashboards()](#!/Dashboard/search_dashboards) does not return LookML dashboard objects.
4732 #
4733 # If multiple search params are given and `filter_or` is FALSE or not specified,
4734 # search params are combined in a logical AND operation.
4735 # Only rows that match *all* search param criteria will be returned.
4736 #
4737 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
4738 # Results will include rows that match **any** of the search criteria.
4739 #
4740 # String search params use case-insensitive matching.
4741 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
4742 # example="dan%" will match "danger" and "Danzig" but not "David"
4743 # example="D_m%" will match "Damage" and "dump"
4744 #
4745 # Integer search params can accept a single value or a comma separated list of values. The multiple
4746 # values will be combined under a logical OR operation - results will match at least one of
4747 # the given values.
4748 #
4749 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
4750 # or exclude (respectively) rows where the column is null.
4751 #
4752 # Boolean search params accept only "true" and "false" as values.
4753 #
4754 #
4755 # The parameters `limit`, and `offset` are recommended for fetching results in page-size chunks.
4756 #
4757 # Get a **single dashboard** by id with [dashboard()](#!/Dashboard/dashboard)
4758 #
4759 # GET /dashboards/search -> Sequence[mdls.Dashboard]
4760 def search_dashboards(
4761 self,
4762 # Match dashboard id.
4763 id: Optional[str] = None,
4764 # Match dashboard slug.
4765 slug: Optional[str] = None,
4766 # Match Dashboard title.
4767 title: Optional[str] = None,
4768 # Match Dashboard description.
4769 description: Optional[str] = None,
4770 # Filter on a content favorite id.
4771 content_favorite_id: Optional[str] = None,
4772 # Filter on a particular folder.
4773 folder_id: Optional[str] = None,
4774 # Filter on dashboards deleted status.
4775 deleted: Optional[str] = None,
4776 # Filter on dashboards created by a particular user.
4777 user_id: Optional[str] = None,
4778 # Filter on a particular value of view_count
4779 view_count: Optional[str] = None,
4780 # Filter on a content favorite id.
4781 content_metadata_id: Optional[str] = None,
4782 # Exclude items that exist only in personal spaces other than the users
4783 curate: Optional[bool] = None,
4784 # Select dashboards based on when they were last viewed
4785 last_viewed_at: Optional[str] = None,
4786 # Requested fields.
4787 fields: Optional[str] = None,
4788 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
4789 page: Optional[int] = None,
4790 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
4791 per_page: Optional[int] = None,
4792 # Number of results to return. (used with offset and takes priority over page and per_page)
4793 limit: Optional[int] = None,
4794 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
4795 offset: Optional[int] = None,
4796 # One or more fields to sort by. Sortable fields: [:title, :user_id, :id, :created_at, :space_id, :folder_id, :description, :view_count, :favorite_count, :slug, :content_favorite_id, :content_metadata_id, :deleted, :deleted_at, :last_viewed_at, :last_accessed_at]
4797 sorts: Optional[str] = None,
4798 # Combine given search criteria in a boolean OR expression
4799 filter_or: Optional[bool] = None,
4800 # Filter out the dashboards owned by the user passed at the :user_id params
4801 not_owned_by: Optional[bool] = None,
4802 transport_options: Optional[transport.TransportOptions] = None,
4803 ) -> Sequence[mdls.Dashboard]:
4804 """Search Dashboards"""
4805 response = cast(
4806 Sequence[mdls.Dashboard],
4807 self.get(
4808 path="/dashboards/search",
4809 structure=Sequence[mdls.Dashboard],
4810 query_params={
4811 "id": id,
4812 "slug": slug,
4813 "title": title,
4814 "description": description,
4815 "content_favorite_id": content_favorite_id,
4816 "folder_id": folder_id,
4817 "deleted": deleted,
4818 "user_id": user_id,
4819 "view_count": view_count,
4820 "content_metadata_id": content_metadata_id,
4821 "curate": curate,
4822 "last_viewed_at": last_viewed_at,
4823 "fields": fields,
4824 "page": page,
4825 "per_page": per_page,
4826 "limit": limit,
4827 "offset": offset,
4828 "sorts": sorts,
4829 "filter_or": filter_or,
4830 "not_owned_by": not_owned_by,
4831 },
4832 transport_options=transport_options,
4833 ),
4834 )
4835 return response
4836
4837 # ### Import a LookML dashboard to a space as a UDD
4838 # Creates a UDD (a dashboard which exists in the Looker database rather than as a LookML file) from the LookML dashboard
4839 # and places it in the space specified. The created UDD will have a lookml_link_id which links to the original LookML dashboard.
4840 #
4841 # To give the imported dashboard specify a (e.g. title: "my title") in the body of your request, otherwise the imported
4842 # dashboard will have the same title as the original LookML dashboard.
4843 #
4844 # For this operation to succeed the user must have permission to see the LookML dashboard in question, and have permission to
4845 # create content in the space the dashboard is being imported to.
4846 #
4847 # **Sync** a linked UDD with [sync_lookml_dashboard()](#!/Dashboard/sync_lookml_dashboard)
4848 # **Unlink** a linked UDD by setting lookml_link_id to null with [update_dashboard()](#!/Dashboard/update_dashboard)
4849 #
4850 # POST /dashboards/{lookml_dashboard_id}/import/{space_id} -> mdls.Dashboard
4851 def import_lookml_dashboard(
4852 self,
4853 # Id of LookML dashboard
4854 lookml_dashboard_id: str,
4855 # Id of space to import the dashboard to
4856 space_id: str,
4857 body: Optional[mdls.WriteDashboard] = None,
4858 # If true, and this dashboard is localized, export it with the raw keys, not localized.
4859 raw_locale: Optional[bool] = None,
4860 transport_options: Optional[transport.TransportOptions] = None,
4861 ) -> mdls.Dashboard:
4862 """Import LookML Dashboard"""
4863 lookml_dashboard_id = self.encode_path_param(lookml_dashboard_id)
4864 space_id = self.encode_path_param(space_id)
4865 response = cast(
4866 mdls.Dashboard,
4867 self.post(
4868 path=f"/dashboards/{lookml_dashboard_id}/import/{space_id}",
4869 structure=mdls.Dashboard,
4870 query_params={"raw_locale": raw_locale},
4871 body=body,
4872 transport_options=transport_options,
4873 ),
4874 )
4875 return response
4876
4877 # ### Update all linked dashboards to match the specified LookML dashboard.
4878 #
4879 # Any UDD (a dashboard which exists in the Looker database rather than as a LookML file) which has a `lookml_link_id`
4880 # property value referring to a LookML dashboard's id (model::dashboardname) will be updated so that it matches the current state of the LookML dashboard.
4881 #
4882 # If the dashboard_ids parameter is specified, only the dashboards with the specified ids will be updated.
4883 #
4884 # For this operation to succeed the user must have permission to view the LookML dashboard, and only linked dashboards
4885 # that the user has permission to update will be synced.
4886 #
4887 # To **link** or **unlink** a UDD set the `lookml_link_id` property with [update_dashboard()](#!/Dashboard/update_dashboard)
4888 #
4889 # PATCH /dashboards/{lookml_dashboard_id}/sync -> Sequence[int]
4890 def sync_lookml_dashboard(
4891 self,
4892 # Id of LookML dashboard, in the form 'model::dashboardname'
4893 lookml_dashboard_id: str,
4894 # If true, and this dashboard is localized, export it with the raw keys, not localized.
4895 raw_locale: Optional[bool] = None,
4896 # An array of UDD dashboard IDs to sync. If not specified, all UDD dashboards will be synced.
4897 dashboard_ids: Optional[mdls.DelimSequence[str]] = None,
4898 transport_options: Optional[transport.TransportOptions] = None,
4899 ) -> Sequence[int]:
4900 """Sync LookML Dashboard"""
4901 lookml_dashboard_id = self.encode_path_param(lookml_dashboard_id)
4902 response = cast(
4903 Sequence[int],
4904 self.patch(
4905 path=f"/dashboards/{lookml_dashboard_id}/sync",
4906 structure=Sequence[int],
4907 query_params={"raw_locale": raw_locale, "dashboard_ids": dashboard_ids},
4908 transport_options=transport_options,
4909 ),
4910 )
4911 return response
4912
4913 # ### Get information about a dashboard
4914 #
4915 # Returns the full details of the identified dashboard object
4916 #
4917 # Get a **summary list** of all active dashboards with [all_dashboards()](#!/Dashboard/all_dashboards)
4918 #
4919 # You can **Search** for dashboards with [search_dashboards()](#!/Dashboard/search_dashboards)
4920 #
4921 # GET /dashboards/{dashboard_id} -> mdls.Dashboard
4922 def dashboard(
4923 self,
4924 # Id of dashboard
4925 dashboard_id: str,
4926 # Requested fields.
4927 fields: Optional[str] = None,
4928 transport_options: Optional[transport.TransportOptions] = None,
4929 ) -> mdls.Dashboard:
4930 """Get Dashboard"""
4931 dashboard_id = self.encode_path_param(dashboard_id)
4932 response = cast(
4933 mdls.Dashboard,
4934 self.get(
4935 path=f"/dashboards/{dashboard_id}",
4936 structure=mdls.Dashboard,
4937 query_params={"fields": fields},
4938 transport_options=transport_options,
4939 ),
4940 )
4941 return response
4942
4943 # ### Update a dashboard
4944 #
4945 # You can use this function to change the string and integer properties of
4946 # a dashboard. Nested objects such as filters, dashboard elements, or dashboard layout components
4947 # cannot be modified by this function - use the update functions for the respective
4948 # nested object types (like [update_dashboard_filter()](#!/Dashboard/update_dashboard_filter) to change a filter)
4949 # to modify nested objects referenced by a dashboard.
4950 #
4951 # If you receive a 422 error response when updating a dashboard, be sure to look at the
4952 # response body for information about exactly which fields are missing or contain invalid data.
4953 #
4954 # PATCH /dashboards/{dashboard_id} -> mdls.Dashboard
4955 def update_dashboard(
4956 self,
4957 # Id of dashboard
4958 dashboard_id: str,
4959 body: mdls.WriteDashboard,
4960 transport_options: Optional[transport.TransportOptions] = None,
4961 ) -> mdls.Dashboard:
4962 """Update Dashboard"""
4963 dashboard_id = self.encode_path_param(dashboard_id)
4964 response = cast(
4965 mdls.Dashboard,
4966 self.patch(
4967 path=f"/dashboards/{dashboard_id}",
4968 structure=mdls.Dashboard,
4969 body=body,
4970 transport_options=transport_options,
4971 ),
4972 )
4973 return response
4974
4975 # ### Delete the dashboard with the specified id
4976 #
4977 # Permanently **deletes** a dashboard. (The dashboard cannot be recovered after this operation.)
4978 #
4979 # "Soft" delete or hide a dashboard by setting its `deleted` status to `True` with [update_dashboard()](#!/Dashboard/update_dashboard).
4980 #
4981 # Note: When a dashboard is deleted in the UI, it is soft deleted. Use this API call to permanently remove it, if desired.
4982 #
4983 # DELETE /dashboards/{dashboard_id} -> str
4984 def delete_dashboard(
4985 self,
4986 # Id of dashboard
4987 dashboard_id: str,
4988 transport_options: Optional[transport.TransportOptions] = None,
4989 ) -> str:
4990 """Delete Dashboard"""
4991 dashboard_id = self.encode_path_param(dashboard_id)
4992 response = cast(
4993 str,
4994 self.delete(
4995 path=f"/dashboards/{dashboard_id}",
4996 structure=str,
4997 transport_options=transport_options,
4998 ),
4999 )
5000 return response
5001
5002 # ### Get Aggregate Table LookML for Each Query on a Dashboard
5003 #
5004 # Returns a JSON object that contains the dashboard id and Aggregate Table lookml
5005 #
5006 # GET /dashboards/aggregate_table_lookml/{dashboard_id} -> mdls.DashboardAggregateTableLookml
5007 def dashboard_aggregate_table_lookml(
5008 self,
5009 # Id of dashboard
5010 dashboard_id: str,
5011 transport_options: Optional[transport.TransportOptions] = None,
5012 ) -> mdls.DashboardAggregateTableLookml:
5013 """Get Aggregate Table LookML for a dashboard"""
5014 dashboard_id = self.encode_path_param(dashboard_id)
5015 response = cast(
5016 mdls.DashboardAggregateTableLookml,
5017 self.get(
5018 path=f"/dashboards/aggregate_table_lookml/{dashboard_id}",
5019 structure=mdls.DashboardAggregateTableLookml,
5020 transport_options=transport_options,
5021 ),
5022 )
5023 return response
5024
5025 # ### Get lookml of a UDD
5026 #
5027 # Returns a JSON object that contains the dashboard id and the full lookml
5028 #
5029 # GET /dashboards/lookml/{dashboard_id} -> mdls.DashboardLookml
5030 def dashboard_lookml(
5031 self,
5032 # Id of dashboard
5033 dashboard_id: str,
5034 transport_options: Optional[transport.TransportOptions] = None,
5035 ) -> mdls.DashboardLookml:
5036 """Get lookml of a UDD"""
5037 dashboard_id = self.encode_path_param(dashboard_id)
5038 response = cast(
5039 mdls.DashboardLookml,
5040 self.get(
5041 path=f"/dashboards/lookml/{dashboard_id}",
5042 structure=mdls.DashboardLookml,
5043 transport_options=transport_options,
5044 ),
5045 )
5046 return response
5047
5048 # ### Move an existing dashboard
5049 #
5050 # Moves a dashboard to a specified folder, and returns the moved dashboard.
5051 #
5052 # `dashboard_id` and `folder_id` are required.
5053 # `dashboard_id` and `folder_id` must already exist, and `folder_id` must be different from the current `folder_id` of the dashboard.
5054 #
5055 # PATCH /dashboards/{dashboard_id}/move -> mdls.Dashboard
5056 def move_dashboard(
5057 self,
5058 # Dashboard id to move.
5059 dashboard_id: str,
5060 # Folder id to move to.
5061 folder_id: str,
5062 transport_options: Optional[transport.TransportOptions] = None,
5063 ) -> mdls.Dashboard:
5064 """Move Dashboard"""
5065 dashboard_id = self.encode_path_param(dashboard_id)
5066 response = cast(
5067 mdls.Dashboard,
5068 self.patch(
5069 path=f"/dashboards/{dashboard_id}/move",
5070 structure=mdls.Dashboard,
5071 query_params={"folder_id": folder_id},
5072 transport_options=transport_options,
5073 ),
5074 )
5075 return response
5076
5077 # ### Creates a dashboard object based on LookML Dashboard YAML, and returns the details of the newly created dashboard.
5078 #
5079 # If a dashboard exists with the YAML-defined "preferred_slug", the new dashboard will overwrite it. Otherwise, a new
5080 # dashboard will be created. Note that when a dashboard is overwritten, alerts will not be maintained.
5081 #
5082 # If a folder_id is specified: new dashboards will be placed in that folder, and overwritten dashboards will be moved to it
5083 # If the folder_id isn't specified: new dashboards will be placed in the caller's personal folder, and overwritten dashboards
5084 # will remain where they were
5085 #
5086 # LookML must contain valid LookML YAML code. It's recommended to use the LookML format returned
5087 # from [dashboard_lookml()](#!/Dashboard/dashboard_lookml) as the input LookML (newlines replaced with
5088 # ).
5089 #
5090 # Note that the created dashboard is not linked to any LookML Dashboard,
5091 # i.e. [sync_lookml_dashboard()](#!/Dashboard/sync_lookml_dashboard) will not update dashboards created by this method.
5092 #
5093 # POST /dashboards/lookml -> mdls.Dashboard
5094 def import_dashboard_from_lookml(
5095 self,
5096 body: mdls.WriteDashboardLookml,
5097 transport_options: Optional[transport.TransportOptions] = None,
5098 ) -> mdls.Dashboard:
5099 """Import Dashboard from LookML"""
5100 response = cast(
5101 mdls.Dashboard,
5102 self.post(
5103 path="/dashboards/lookml",
5104 structure=mdls.Dashboard,
5105 body=body,
5106 transport_options=transport_options,
5107 ),
5108 )
5109 return response
5110
5111 # # DEPRECATED: Use [import_dashboard_from_lookml()](#!/Dashboard/import_dashboard_from_lookml)
5112 #
5113 # POST /dashboards/from_lookml -> mdls.Dashboard
5114 def create_dashboard_from_lookml(
5115 self,
5116 body: mdls.WriteDashboardLookml,
5117 transport_options: Optional[transport.TransportOptions] = None,
5118 ) -> mdls.Dashboard:
5119 """Create Dashboard from LookML"""
5120 response = cast(
5121 mdls.Dashboard,
5122 self.post(
5123 path="/dashboards/from_lookml",
5124 structure=mdls.Dashboard,
5125 body=body,
5126 transport_options=transport_options,
5127 ),
5128 )
5129 return response
5130
5131 # ### Copy an existing dashboard
5132 #
5133 # Creates a copy of an existing dashboard, in a specified folder, and returns the copied dashboard.
5134 #
5135 # `dashboard_id` is required, `dashboard_id` and `folder_id` must already exist if specified.
5136 # `folder_id` will default to the existing folder.
5137 #
5138 # If a dashboard with the same title already exists in the target folder, the copy will have '(copy)'
5139 # or '(copy <# of copies>)' appended.
5140 #
5141 # POST /dashboards/{dashboard_id}/copy -> mdls.Dashboard
5142 def copy_dashboard(
5143 self,
5144 # Dashboard id to copy.
5145 dashboard_id: str,
5146 # Folder id to copy to.
5147 folder_id: Optional[str] = None,
5148 transport_options: Optional[transport.TransportOptions] = None,
5149 ) -> mdls.Dashboard:
5150 """Copy Dashboard"""
5151 dashboard_id = self.encode_path_param(dashboard_id)
5152 response = cast(
5153 mdls.Dashboard,
5154 self.post(
5155 path=f"/dashboards/{dashboard_id}/copy",
5156 structure=mdls.Dashboard,
5157 query_params={"folder_id": folder_id},
5158 transport_options=transport_options,
5159 ),
5160 )
5161 return response
5162
5163 # ### Search Dashboard Elements
5164 #
5165 # Returns an **array of DashboardElement objects** that match the specified search criteria.
5166 #
5167 # If multiple search params are given and `filter_or` is FALSE or not specified,
5168 # search params are combined in a logical AND operation.
5169 # Only rows that match *all* search param criteria will be returned.
5170 #
5171 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
5172 # Results will include rows that match **any** of the search criteria.
5173 #
5174 # String search params use case-insensitive matching.
5175 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
5176 # example="dan%" will match "danger" and "Danzig" but not "David"
5177 # example="D_m%" will match "Damage" and "dump"
5178 #
5179 # Integer search params can accept a single value or a comma separated list of values. The multiple
5180 # values will be combined under a logical OR operation - results will match at least one of
5181 # the given values.
5182 #
5183 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
5184 # or exclude (respectively) rows where the column is null.
5185 #
5186 # Boolean search params accept only "true" and "false" as values.
5187 #
5188 # GET /dashboard_elements/search -> Sequence[mdls.DashboardElement]
5189 def search_dashboard_elements(
5190 self,
5191 # Select elements that refer to a given dashboard id
5192 dashboard_id: Optional[str] = None,
5193 # Select elements that refer to a given look id
5194 look_id: Optional[str] = None,
5195 # Match the title of element
5196 title: Optional[str] = None,
5197 # Select soft-deleted dashboard elements
5198 deleted: Optional[bool] = None,
5199 # Requested fields.
5200 fields: Optional[str] = None,
5201 # Combine given search criteria in a boolean OR expression
5202 filter_or: Optional[bool] = None,
5203 # Fields to sort by. Sortable fields: [:look_id, :dashboard_id, :deleted, :title]
5204 sorts: Optional[str] = None,
5205 transport_options: Optional[transport.TransportOptions] = None,
5206 ) -> Sequence[mdls.DashboardElement]:
5207 """Search Dashboard Elements"""
5208 response = cast(
5209 Sequence[mdls.DashboardElement],
5210 self.get(
5211 path="/dashboard_elements/search",
5212 structure=Sequence[mdls.DashboardElement],
5213 query_params={
5214 "dashboard_id": dashboard_id,
5215 "look_id": look_id,
5216 "title": title,
5217 "deleted": deleted,
5218 "fields": fields,
5219 "filter_or": filter_or,
5220 "sorts": sorts,
5221 },
5222 transport_options=transport_options,
5223 ),
5224 )
5225 return response
5226
5227 # ### Get information about the dashboard element with a specific id.
5228 #
5229 # GET /dashboard_elements/{dashboard_element_id} -> mdls.DashboardElement
5230 def dashboard_element(
5231 self,
5232 # Id of dashboard element
5233 dashboard_element_id: str,
5234 # Requested fields.
5235 fields: Optional[str] = None,
5236 transport_options: Optional[transport.TransportOptions] = None,
5237 ) -> mdls.DashboardElement:
5238 """Get DashboardElement"""
5239 dashboard_element_id = self.encode_path_param(dashboard_element_id)
5240 response = cast(
5241 mdls.DashboardElement,
5242 self.get(
5243 path=f"/dashboard_elements/{dashboard_element_id}",
5244 structure=mdls.DashboardElement,
5245 query_params={"fields": fields},
5246 transport_options=transport_options,
5247 ),
5248 )
5249 return response
5250
5251 # ### Update the dashboard element with a specific id.
5252 #
5253 # PATCH /dashboard_elements/{dashboard_element_id} -> mdls.DashboardElement
5254 def update_dashboard_element(
5255 self,
5256 # Id of dashboard element
5257 dashboard_element_id: str,
5258 body: mdls.WriteDashboardElement,
5259 # Requested fields.
5260 fields: Optional[str] = None,
5261 transport_options: Optional[transport.TransportOptions] = None,
5262 ) -> mdls.DashboardElement:
5263 """Update DashboardElement"""
5264 dashboard_element_id = self.encode_path_param(dashboard_element_id)
5265 response = cast(
5266 mdls.DashboardElement,
5267 self.patch(
5268 path=f"/dashboard_elements/{dashboard_element_id}",
5269 structure=mdls.DashboardElement,
5270 query_params={"fields": fields},
5271 body=body,
5272 transport_options=transport_options,
5273 ),
5274 )
5275 return response
5276
5277 # ### Delete a dashboard element with a specific id.
5278 #
5279 # DELETE /dashboard_elements/{dashboard_element_id} -> str
5280 def delete_dashboard_element(
5281 self,
5282 # Id of dashboard element
5283 dashboard_element_id: str,
5284 transport_options: Optional[transport.TransportOptions] = None,
5285 ) -> str:
5286 """Delete DashboardElement"""
5287 dashboard_element_id = self.encode_path_param(dashboard_element_id)
5288 response = cast(
5289 str,
5290 self.delete(
5291 path=f"/dashboard_elements/{dashboard_element_id}",
5292 structure=str,
5293 transport_options=transport_options,
5294 ),
5295 )
5296 return response
5297
5298 # ### Get information about all the dashboard elements on a dashboard with a specific id.
5299 #
5300 # GET /dashboards/{dashboard_id}/dashboard_elements -> Sequence[mdls.DashboardElement]
5301 def dashboard_dashboard_elements(
5302 self,
5303 # Id of dashboard
5304 dashboard_id: str,
5305 # Requested fields.
5306 fields: Optional[str] = None,
5307 transport_options: Optional[transport.TransportOptions] = None,
5308 ) -> Sequence[mdls.DashboardElement]:
5309 """Get All DashboardElements"""
5310 dashboard_id = self.encode_path_param(dashboard_id)
5311 response = cast(
5312 Sequence[mdls.DashboardElement],
5313 self.get(
5314 path=f"/dashboards/{dashboard_id}/dashboard_elements",
5315 structure=Sequence[mdls.DashboardElement],
5316 query_params={"fields": fields},
5317 transport_options=transport_options,
5318 ),
5319 )
5320 return response
5321
5322 # ### Create a dashboard element on the dashboard with a specific id.
5323 #
5324 # POST /dashboard_elements -> mdls.DashboardElement
5325 def create_dashboard_element(
5326 self,
5327 body: mdls.WriteDashboardElement,
5328 # Requested fields.
5329 fields: Optional[str] = None,
5330 # Apply relevant filters on dashboard to this tile
5331 apply_filters: Optional[bool] = None,
5332 transport_options: Optional[transport.TransportOptions] = None,
5333 ) -> mdls.DashboardElement:
5334 """Create DashboardElement"""
5335 response = cast(
5336 mdls.DashboardElement,
5337 self.post(
5338 path="/dashboard_elements",
5339 structure=mdls.DashboardElement,
5340 query_params={"fields": fields, "apply_filters": apply_filters},
5341 body=body,
5342 transport_options=transport_options,
5343 ),
5344 )
5345 return response
5346
5347 # ### Get information about the dashboard filters with a specific id.
5348 #
5349 # GET /dashboard_filters/{dashboard_filter_id} -> mdls.DashboardFilter
5350 def dashboard_filter(
5351 self,
5352 # Id of dashboard filters
5353 dashboard_filter_id: str,
5354 # Requested fields.
5355 fields: Optional[str] = None,
5356 transport_options: Optional[transport.TransportOptions] = None,
5357 ) -> mdls.DashboardFilter:
5358 """Get Dashboard Filter"""
5359 dashboard_filter_id = self.encode_path_param(dashboard_filter_id)
5360 response = cast(
5361 mdls.DashboardFilter,
5362 self.get(
5363 path=f"/dashboard_filters/{dashboard_filter_id}",
5364 structure=mdls.DashboardFilter,
5365 query_params={"fields": fields},
5366 transport_options=transport_options,
5367 ),
5368 )
5369 return response
5370
5371 # ### Update the dashboard filter with a specific id.
5372 #
5373 # PATCH /dashboard_filters/{dashboard_filter_id} -> mdls.DashboardFilter
5374 def update_dashboard_filter(
5375 self,
5376 # Id of dashboard filter
5377 dashboard_filter_id: str,
5378 body: mdls.WriteDashboardFilter,
5379 # Requested fields.
5380 fields: Optional[str] = None,
5381 transport_options: Optional[transport.TransportOptions] = None,
5382 ) -> mdls.DashboardFilter:
5383 """Update Dashboard Filter"""
5384 dashboard_filter_id = self.encode_path_param(dashboard_filter_id)
5385 response = cast(
5386 mdls.DashboardFilter,
5387 self.patch(
5388 path=f"/dashboard_filters/{dashboard_filter_id}",
5389 structure=mdls.DashboardFilter,
5390 query_params={"fields": fields},
5391 body=body,
5392 transport_options=transport_options,
5393 ),
5394 )
5395 return response
5396
5397 # ### Delete a dashboard filter with a specific id.
5398 #
5399 # DELETE /dashboard_filters/{dashboard_filter_id} -> str
5400 def delete_dashboard_filter(
5401 self,
5402 # Id of dashboard filter
5403 dashboard_filter_id: str,
5404 transport_options: Optional[transport.TransportOptions] = None,
5405 ) -> str:
5406 """Delete Dashboard Filter"""
5407 dashboard_filter_id = self.encode_path_param(dashboard_filter_id)
5408 response = cast(
5409 str,
5410 self.delete(
5411 path=f"/dashboard_filters/{dashboard_filter_id}",
5412 structure=str,
5413 transport_options=transport_options,
5414 ),
5415 )
5416 return response
5417
5418 # ### Get information about all the dashboard filters on a dashboard with a specific id.
5419 #
5420 # GET /dashboards/{dashboard_id}/dashboard_filters -> Sequence[mdls.DashboardFilter]
5421 def dashboard_dashboard_filters(
5422 self,
5423 # Id of dashboard
5424 dashboard_id: str,
5425 # Requested fields.
5426 fields: Optional[str] = None,
5427 transport_options: Optional[transport.TransportOptions] = None,
5428 ) -> Sequence[mdls.DashboardFilter]:
5429 """Get All Dashboard Filters"""
5430 dashboard_id = self.encode_path_param(dashboard_id)
5431 response = cast(
5432 Sequence[mdls.DashboardFilter],
5433 self.get(
5434 path=f"/dashboards/{dashboard_id}/dashboard_filters",
5435 structure=Sequence[mdls.DashboardFilter],
5436 query_params={"fields": fields},
5437 transport_options=transport_options,
5438 ),
5439 )
5440 return response
5441
5442 # ### Create a dashboard filter on the dashboard with a specific id.
5443 #
5444 # POST /dashboard_filters -> mdls.DashboardFilter
5445 def create_dashboard_filter(
5446 self,
5447 body: mdls.WriteCreateDashboardFilter,
5448 # Requested fields
5449 fields: Optional[str] = None,
5450 transport_options: Optional[transport.TransportOptions] = None,
5451 ) -> mdls.DashboardFilter:
5452 """Create Dashboard Filter"""
5453 response = cast(
5454 mdls.DashboardFilter,
5455 self.post(
5456 path="/dashboard_filters",
5457 structure=mdls.DashboardFilter,
5458 query_params={"fields": fields},
5459 body=body,
5460 transport_options=transport_options,
5461 ),
5462 )
5463 return response
5464
5465 # ### Get information about the dashboard elements with a specific id.
5466 #
5467 # GET /dashboard_layout_components/{dashboard_layout_component_id} -> mdls.DashboardLayoutComponent
5468 def dashboard_layout_component(
5469 self,
5470 # Id of dashboard layout component
5471 dashboard_layout_component_id: str,
5472 # Requested fields.
5473 fields: Optional[str] = None,
5474 transport_options: Optional[transport.TransportOptions] = None,
5475 ) -> mdls.DashboardLayoutComponent:
5476 """Get DashboardLayoutComponent"""
5477 dashboard_layout_component_id = self.encode_path_param(
5478 dashboard_layout_component_id
5479 )
5480 response = cast(
5481 mdls.DashboardLayoutComponent,
5482 self.get(
5483 path=f"/dashboard_layout_components/{dashboard_layout_component_id}",
5484 structure=mdls.DashboardLayoutComponent,
5485 query_params={"fields": fields},
5486 transport_options=transport_options,
5487 ),
5488 )
5489 return response
5490
5491 # ### Update the dashboard element with a specific id.
5492 #
5493 # PATCH /dashboard_layout_components/{dashboard_layout_component_id} -> mdls.DashboardLayoutComponent
5494 def update_dashboard_layout_component(
5495 self,
5496 # Id of dashboard layout component
5497 dashboard_layout_component_id: str,
5498 body: mdls.WriteDashboardLayoutComponent,
5499 # Requested fields.
5500 fields: Optional[str] = None,
5501 transport_options: Optional[transport.TransportOptions] = None,
5502 ) -> mdls.DashboardLayoutComponent:
5503 """Update DashboardLayoutComponent"""
5504 dashboard_layout_component_id = self.encode_path_param(
5505 dashboard_layout_component_id
5506 )
5507 response = cast(
5508 mdls.DashboardLayoutComponent,
5509 self.patch(
5510 path=f"/dashboard_layout_components/{dashboard_layout_component_id}",
5511 structure=mdls.DashboardLayoutComponent,
5512 query_params={"fields": fields},
5513 body=body,
5514 transport_options=transport_options,
5515 ),
5516 )
5517 return response
5518
5519 # ### Get information about all the dashboard layout components for a dashboard layout with a specific id.
5520 #
5521 # GET /dashboard_layouts/{dashboard_layout_id}/dashboard_layout_components -> Sequence[mdls.DashboardLayoutComponent]
5522 def dashboard_layout_dashboard_layout_components(
5523 self,
5524 # Id of dashboard layout component
5525 dashboard_layout_id: str,
5526 # Requested fields.
5527 fields: Optional[str] = None,
5528 transport_options: Optional[transport.TransportOptions] = None,
5529 ) -> Sequence[mdls.DashboardLayoutComponent]:
5530 """Get All DashboardLayoutComponents"""
5531 dashboard_layout_id = self.encode_path_param(dashboard_layout_id)
5532 response = cast(
5533 Sequence[mdls.DashboardLayoutComponent],
5534 self.get(
5535 path=f"/dashboard_layouts/{dashboard_layout_id}/dashboard_layout_components",
5536 structure=Sequence[mdls.DashboardLayoutComponent],
5537 query_params={"fields": fields},
5538 transport_options=transport_options,
5539 ),
5540 )
5541 return response
5542
5543 # ### Get information about the dashboard layouts with a specific id.
5544 #
5545 # GET /dashboard_layouts/{dashboard_layout_id} -> mdls.DashboardLayout
5546 def dashboard_layout(
5547 self,
5548 # Id of dashboard layouts
5549 dashboard_layout_id: str,
5550 # Requested fields.
5551 fields: Optional[str] = None,
5552 transport_options: Optional[transport.TransportOptions] = None,
5553 ) -> mdls.DashboardLayout:
5554 """Get DashboardLayout"""
5555 dashboard_layout_id = self.encode_path_param(dashboard_layout_id)
5556 response = cast(
5557 mdls.DashboardLayout,
5558 self.get(
5559 path=f"/dashboard_layouts/{dashboard_layout_id}",
5560 structure=mdls.DashboardLayout,
5561 query_params={"fields": fields},
5562 transport_options=transport_options,
5563 ),
5564 )
5565 return response
5566
5567 # ### Update the dashboard layout with a specific id.
5568 #
5569 # PATCH /dashboard_layouts/{dashboard_layout_id} -> mdls.DashboardLayout
5570 def update_dashboard_layout(
5571 self,
5572 # Id of dashboard layout
5573 dashboard_layout_id: str,
5574 body: mdls.WriteDashboardLayout,
5575 # Requested fields.
5576 fields: Optional[str] = None,
5577 transport_options: Optional[transport.TransportOptions] = None,
5578 ) -> mdls.DashboardLayout:
5579 """Update DashboardLayout"""
5580 dashboard_layout_id = self.encode_path_param(dashboard_layout_id)
5581 response = cast(
5582 mdls.DashboardLayout,
5583 self.patch(
5584 path=f"/dashboard_layouts/{dashboard_layout_id}",
5585 structure=mdls.DashboardLayout,
5586 query_params={"fields": fields},
5587 body=body,
5588 transport_options=transport_options,
5589 ),
5590 )
5591 return response
5592
5593 # ### Delete a dashboard layout with a specific id.
5594 #
5595 # DELETE /dashboard_layouts/{dashboard_layout_id} -> str
5596 def delete_dashboard_layout(
5597 self,
5598 # Id of dashboard layout
5599 dashboard_layout_id: str,
5600 transport_options: Optional[transport.TransportOptions] = None,
5601 ) -> str:
5602 """Delete DashboardLayout"""
5603 dashboard_layout_id = self.encode_path_param(dashboard_layout_id)
5604 response = cast(
5605 str,
5606 self.delete(
5607 path=f"/dashboard_layouts/{dashboard_layout_id}",
5608 structure=str,
5609 transport_options=transport_options,
5610 ),
5611 )
5612 return response
5613
5614 # ### Get information about all the dashboard elements on a dashboard with a specific id.
5615 #
5616 # GET /dashboards/{dashboard_id}/dashboard_layouts -> Sequence[mdls.DashboardLayout]
5617 def dashboard_dashboard_layouts(
5618 self,
5619 # Id of dashboard
5620 dashboard_id: str,
5621 # Requested fields.
5622 fields: Optional[str] = None,
5623 transport_options: Optional[transport.TransportOptions] = None,
5624 ) -> Sequence[mdls.DashboardLayout]:
5625 """Get All DashboardLayouts"""
5626 dashboard_id = self.encode_path_param(dashboard_id)
5627 response = cast(
5628 Sequence[mdls.DashboardLayout],
5629 self.get(
5630 path=f"/dashboards/{dashboard_id}/dashboard_layouts",
5631 structure=Sequence[mdls.DashboardLayout],
5632 query_params={"fields": fields},
5633 transport_options=transport_options,
5634 ),
5635 )
5636 return response
5637
5638 # ### Create a dashboard layout on the dashboard with a specific id.
5639 #
5640 # POST /dashboard_layouts -> mdls.DashboardLayout
5641 def create_dashboard_layout(
5642 self,
5643 body: mdls.WriteDashboardLayout,
5644 # Requested fields.
5645 fields: Optional[str] = None,
5646 transport_options: Optional[transport.TransportOptions] = None,
5647 ) -> mdls.DashboardLayout:
5648 """Create DashboardLayout"""
5649 response = cast(
5650 mdls.DashboardLayout,
5651 self.post(
5652 path="/dashboard_layouts",
5653 structure=mdls.DashboardLayout,
5654 query_params={"fields": fields},
5655 body=body,
5656 transport_options=transport_options,
5657 ),
5658 )
5659 return response
5660
5661 # endregion
5662
5663 # region DataAction: Run Data Actions
5664
5665 # Perform a data action. The data action object can be obtained from query results, and used to perform an arbitrary action.
5666 #
5667 # POST /data_actions -> mdls.DataActionResponse
5668 def perform_data_action(
5669 self,
5670 body: mdls.DataActionRequest,
5671 transport_options: Optional[transport.TransportOptions] = None,
5672 ) -> mdls.DataActionResponse:
5673 """Send a Data Action"""
5674 response = cast(
5675 mdls.DataActionResponse,
5676 self.post(
5677 path="/data_actions",
5678 structure=mdls.DataActionResponse,
5679 body=body,
5680 transport_options=transport_options,
5681 ),
5682 )
5683 return response
5684
5685 # For some data actions, the remote server may supply a form requesting further user input. This endpoint takes a data action, asks the remote server to generate a form for it, and returns that form to you for presentation to the user.
5686 #
5687 # POST /data_actions/form -> mdls.DataActionForm
5688 def fetch_remote_data_action_form(
5689 self,
5690 body: MutableMapping[str, Any],
5691 transport_options: Optional[transport.TransportOptions] = None,
5692 ) -> mdls.DataActionForm:
5693 """Fetch Remote Data Action Form"""
5694 response = cast(
5695 mdls.DataActionForm,
5696 self.post(
5697 path="/data_actions/form",
5698 structure=mdls.DataActionForm,
5699 body=body,
5700 transport_options=transport_options,
5701 ),
5702 )
5703 return response
5704
5705 # endregion
5706
5707 # region Datagroup: Manage Datagroups
5708
5709 # ### Get information about all datagroups.
5710 #
5711 # GET /datagroups -> Sequence[mdls.Datagroup]
5712 def all_datagroups(
5713 self,
5714 transport_options: Optional[transport.TransportOptions] = None,
5715 ) -> Sequence[mdls.Datagroup]:
5716 """Get All Datagroups"""
5717 response = cast(
5718 Sequence[mdls.Datagroup],
5719 self.get(
5720 path="/datagroups",
5721 structure=Sequence[mdls.Datagroup],
5722 transport_options=transport_options,
5723 ),
5724 )
5725 return response
5726
5727 # ### Get information about a datagroup.
5728 #
5729 # GET /datagroups/{datagroup_id} -> mdls.Datagroup
5730 def datagroup(
5731 self,
5732 # ID of datagroup.
5733 datagroup_id: str,
5734 transport_options: Optional[transport.TransportOptions] = None,
5735 ) -> mdls.Datagroup:
5736 """Get Datagroup"""
5737 datagroup_id = self.encode_path_param(datagroup_id)
5738 response = cast(
5739 mdls.Datagroup,
5740 self.get(
5741 path=f"/datagroups/{datagroup_id}",
5742 structure=mdls.Datagroup,
5743 transport_options=transport_options,
5744 ),
5745 )
5746 return response
5747
5748 # ### Update a datagroup using the specified params.
5749 #
5750 # PATCH /datagroups/{datagroup_id} -> mdls.Datagroup
5751 def update_datagroup(
5752 self,
5753 # ID of datagroup.
5754 datagroup_id: str,
5755 body: mdls.WriteDatagroup,
5756 transport_options: Optional[transport.TransportOptions] = None,
5757 ) -> mdls.Datagroup:
5758 """Update Datagroup"""
5759 datagroup_id = self.encode_path_param(datagroup_id)
5760 response = cast(
5761 mdls.Datagroup,
5762 self.patch(
5763 path=f"/datagroups/{datagroup_id}",
5764 structure=mdls.Datagroup,
5765 body=body,
5766 transport_options=transport_options,
5767 ),
5768 )
5769 return response
5770
5771 # endregion
5772
5773 # region DerivedTable: View Derived Table graphs
5774
5775 # ### Discover information about derived tables
5776 #
5777 # GET /derived_table/graph/model/{model} -> mdls.DependencyGraph
5778 def graph_derived_tables_for_model(
5779 self,
5780 # The name of the Lookml model.
5781 model: str,
5782 # The format of the graph. Valid values are [dot]. Default is `dot`
5783 format: Optional[str] = None,
5784 # Color denoting the build status of the graph. Grey = not built, green = built, yellow = building, red = error.
5785 color: Optional[str] = None,
5786 transport_options: Optional[transport.TransportOptions] = None,
5787 ) -> mdls.DependencyGraph:
5788 """Get Derived Table graph for model"""
5789 model = self.encode_path_param(model)
5790 response = cast(
5791 mdls.DependencyGraph,
5792 self.get(
5793 path=f"/derived_table/graph/model/{model}",
5794 structure=mdls.DependencyGraph,
5795 query_params={"format": format, "color": color},
5796 transport_options=transport_options,
5797 ),
5798 )
5799 return response
5800
5801 # ### Get the subgraph representing this derived table and its dependencies.
5802 #
5803 # GET /derived_table/graph/view/{view} -> mdls.DependencyGraph
5804 def graph_derived_tables_for_view(
5805 self,
5806 # The derived table's view name.
5807 view: str,
5808 # The models where this derived table is defined.
5809 models: Optional[str] = None,
5810 # The model directory to look in, either `dev` or `production`.
5811 workspace: Optional[str] = None,
5812 transport_options: Optional[transport.TransportOptions] = None,
5813 ) -> mdls.DependencyGraph:
5814 """Get subgraph of derived table and dependencies"""
5815 view = self.encode_path_param(view)
5816 response = cast(
5817 mdls.DependencyGraph,
5818 self.get(
5819 path=f"/derived_table/graph/view/{view}",
5820 structure=mdls.DependencyGraph,
5821 query_params={"models": models, "workspace": workspace},
5822 transport_options=transport_options,
5823 ),
5824 )
5825 return response
5826
5827 # Enqueue materialization for a PDT with the given model name and view name
5828 #
5829 # GET /derived_table/{model_name}/{view_name}/start -> mdls.MaterializePDT
5830 def start_pdt_build(
5831 self,
5832 # The model of the PDT to start building.
5833 model_name: str,
5834 # The view name of the PDT to start building.
5835 view_name: str,
5836 # Force rebuild of required dependent PDTs, even if they are already materialized.
5837 force_rebuild: Optional[str] = None,
5838 # Force involved incremental PDTs to fully re-materialize.
5839 force_full_incremental: Optional[str] = None,
5840 # Workspace in which to materialize selected PDT ('dev' or default 'production').
5841 workspace: Optional[str] = None,
5842 # The source of this request.
5843 source: Optional[str] = None,
5844 transport_options: Optional[transport.TransportOptions] = None,
5845 ) -> mdls.MaterializePDT:
5846 """Start a PDT materialization"""
5847 model_name = self.encode_path_param(model_name)
5848 view_name = self.encode_path_param(view_name)
5849 response = cast(
5850 mdls.MaterializePDT,
5851 self.get(
5852 path=f"/derived_table/{model_name}/{view_name}/start",
5853 structure=mdls.MaterializePDT,
5854 query_params={
5855 "force_rebuild": force_rebuild,
5856 "force_full_incremental": force_full_incremental,
5857 "workspace": workspace,
5858 "source": source,
5859 },
5860 transport_options=transport_options,
5861 ),
5862 )
5863 return response
5864
5865 # Check status of PDT materialization
5866 #
5867 # GET /derived_table/{materialization_id}/status -> mdls.MaterializePDT
5868 def check_pdt_build(
5869 self,
5870 # The materialization id to check status for.
5871 materialization_id: str,
5872 transport_options: Optional[transport.TransportOptions] = None,
5873 ) -> mdls.MaterializePDT:
5874 """Check status of a PDT materialization"""
5875 materialization_id = self.encode_path_param(materialization_id)
5876 response = cast(
5877 mdls.MaterializePDT,
5878 self.get(
5879 path=f"/derived_table/{materialization_id}/status",
5880 structure=mdls.MaterializePDT,
5881 transport_options=transport_options,
5882 ),
5883 )
5884 return response
5885
5886 # Stop a PDT materialization
5887 #
5888 # GET /derived_table/{materialization_id}/stop -> mdls.MaterializePDT
5889 def stop_pdt_build(
5890 self,
5891 # The materialization id to stop.
5892 materialization_id: str,
5893 # The source of this request.
5894 source: Optional[str] = None,
5895 transport_options: Optional[transport.TransportOptions] = None,
5896 ) -> mdls.MaterializePDT:
5897 """Stop a PDT materialization"""
5898 materialization_id = self.encode_path_param(materialization_id)
5899 response = cast(
5900 mdls.MaterializePDT,
5901 self.get(
5902 path=f"/derived_table/{materialization_id}/stop",
5903 structure=mdls.MaterializePDT,
5904 query_params={"source": source},
5905 transport_options=transport_options,
5906 ),
5907 )
5908 return response
5909
5910 # endregion
5911
5912 # region Folder: Manage Folders
5913
5914 # Search for folders by creator id, parent id, name, etc
5915 #
5916 # GET /folders/search -> Sequence[mdls.Folder]
5917 def search_folders(
5918 self,
5919 # Requested fields.
5920 fields: Optional[str] = None,
5921 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
5922 page: Optional[int] = None,
5923 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
5924 per_page: Optional[int] = None,
5925 # Number of results to return. (used with offset and takes priority over page and per_page)
5926 limit: Optional[int] = None,
5927 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
5928 offset: Optional[int] = None,
5929 # Fields to sort by.
5930 sorts: Optional[str] = None,
5931 # Match Space title.
5932 name: Optional[str] = None,
5933 # Match Space id
5934 id: Optional[str] = None,
5935 # Filter on a children of a particular folder.
5936 parent_id: Optional[str] = None,
5937 # Filter on folder created by a particular user.
5938 creator_id: Optional[str] = None,
5939 # Combine given search criteria in a boolean OR expression
5940 filter_or: Optional[bool] = None,
5941 # Match is shared root
5942 is_shared_root: Optional[bool] = None,
5943 # Match is users root
5944 is_users_root: Optional[bool] = None,
5945 transport_options: Optional[transport.TransportOptions] = None,
5946 ) -> Sequence[mdls.Folder]:
5947 """Search Folders"""
5948 response = cast(
5949 Sequence[mdls.Folder],
5950 self.get(
5951 path="/folders/search",
5952 structure=Sequence[mdls.Folder],
5953 query_params={
5954 "fields": fields,
5955 "page": page,
5956 "per_page": per_page,
5957 "limit": limit,
5958 "offset": offset,
5959 "sorts": sorts,
5960 "name": name,
5961 "id": id,
5962 "parent_id": parent_id,
5963 "creator_id": creator_id,
5964 "filter_or": filter_or,
5965 "is_shared_root": is_shared_root,
5966 "is_users_root": is_users_root,
5967 },
5968 transport_options=transport_options,
5969 ),
5970 )
5971 return response
5972
5973 # ### Get information about the folder with a specific id.
5974 #
5975 # GET /folders/{folder_id} -> mdls.Folder
5976 def folder(
5977 self,
5978 # Id of folder
5979 folder_id: str,
5980 # Requested fields.
5981 fields: Optional[str] = None,
5982 transport_options: Optional[transport.TransportOptions] = None,
5983 ) -> mdls.Folder:
5984 """Get Folder"""
5985 folder_id = self.encode_path_param(folder_id)
5986 response = cast(
5987 mdls.Folder,
5988 self.get(
5989 path=f"/folders/{folder_id}",
5990 structure=mdls.Folder,
5991 query_params={"fields": fields},
5992 transport_options=transport_options,
5993 ),
5994 )
5995 return response
5996
5997 # ### Update the folder with a specific id.
5998 #
5999 # PATCH /folders/{folder_id} -> mdls.Folder
6000 def update_folder(
6001 self,
6002 # Id of folder
6003 folder_id: str,
6004 body: mdls.UpdateFolder,
6005 transport_options: Optional[transport.TransportOptions] = None,
6006 ) -> mdls.Folder:
6007 """Update Folder"""
6008 folder_id = self.encode_path_param(folder_id)
6009 response = cast(
6010 mdls.Folder,
6011 self.patch(
6012 path=f"/folders/{folder_id}",
6013 structure=mdls.Folder,
6014 body=body,
6015 transport_options=transport_options,
6016 ),
6017 )
6018 return response
6019
6020 # ### Delete the folder with a specific id including any children folders.
6021 # **DANGER** this will delete all looks and dashboards in the folder.
6022 #
6023 # DELETE /folders/{folder_id} -> str
6024 def delete_folder(
6025 self,
6026 # Id of folder
6027 folder_id: str,
6028 transport_options: Optional[transport.TransportOptions] = None,
6029 ) -> str:
6030 """Delete Folder"""
6031 folder_id = self.encode_path_param(folder_id)
6032 response = cast(
6033 str,
6034 self.delete(
6035 path=f"/folders/{folder_id}",
6036 structure=str,
6037 transport_options=transport_options,
6038 ),
6039 )
6040 return response
6041
6042 # ### Get information about all folders.
6043 #
6044 # All personal folders will be returned.
6045 #
6046 # GET /folders -> Sequence[mdls.FolderBase]
6047 def all_folders(
6048 self,
6049 # Requested fields.
6050 fields: Optional[str] = None,
6051 transport_options: Optional[transport.TransportOptions] = None,
6052 ) -> Sequence[mdls.FolderBase]:
6053 """Get All Folders"""
6054 response = cast(
6055 Sequence[mdls.FolderBase],
6056 self.get(
6057 path="/folders",
6058 structure=Sequence[mdls.FolderBase],
6059 query_params={"fields": fields},
6060 transport_options=transport_options,
6061 ),
6062 )
6063 return response
6064
6065 # ### Create a folder with specified information.
6066 #
6067 # Caller must have permission to edit the parent folder and to create folders, otherwise the request
6068 # returns 404 Not Found.
6069 #
6070 # POST /folders -> mdls.Folder
6071 def create_folder(
6072 self,
6073 body: mdls.CreateFolder,
6074 transport_options: Optional[transport.TransportOptions] = None,
6075 ) -> mdls.Folder:
6076 """Create Folder"""
6077 response = cast(
6078 mdls.Folder,
6079 self.post(
6080 path="/folders",
6081 structure=mdls.Folder,
6082 body=body,
6083 transport_options=transport_options,
6084 ),
6085 )
6086 return response
6087
6088 # ### Get the children of a folder.
6089 #
6090 # GET /folders/{folder_id}/children -> Sequence[mdls.Folder]
6091 def folder_children(
6092 self,
6093 # Id of folder
6094 folder_id: str,
6095 # Requested fields.
6096 fields: Optional[str] = None,
6097 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
6098 page: Optional[int] = None,
6099 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
6100 per_page: Optional[int] = None,
6101 # Number of results to return. (used with offset and takes priority over page and per_page)
6102 limit: Optional[int] = None,
6103 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
6104 offset: Optional[int] = None,
6105 # Fields to sort by.
6106 sorts: Optional[str] = None,
6107 transport_options: Optional[transport.TransportOptions] = None,
6108 ) -> Sequence[mdls.Folder]:
6109 """Get Folder Children"""
6110 folder_id = self.encode_path_param(folder_id)
6111 response = cast(
6112 Sequence[mdls.Folder],
6113 self.get(
6114 path=f"/folders/{folder_id}/children",
6115 structure=Sequence[mdls.Folder],
6116 query_params={
6117 "fields": fields,
6118 "page": page,
6119 "per_page": per_page,
6120 "limit": limit,
6121 "offset": offset,
6122 "sorts": sorts,
6123 },
6124 transport_options=transport_options,
6125 ),
6126 )
6127 return response
6128
6129 # ### Search the children of a folder
6130 #
6131 # GET /folders/{folder_id}/children/search -> Sequence[mdls.Folder]
6132 def folder_children_search(
6133 self,
6134 # Id of folder
6135 folder_id: str,
6136 # Requested fields.
6137 fields: Optional[str] = None,
6138 # Fields to sort by.
6139 sorts: Optional[str] = None,
6140 # Match folder name.
6141 name: Optional[str] = None,
6142 transport_options: Optional[transport.TransportOptions] = None,
6143 ) -> Sequence[mdls.Folder]:
6144 """Search Folder Children"""
6145 folder_id = self.encode_path_param(folder_id)
6146 response = cast(
6147 Sequence[mdls.Folder],
6148 self.get(
6149 path=f"/folders/{folder_id}/children/search",
6150 structure=Sequence[mdls.Folder],
6151 query_params={"fields": fields, "sorts": sorts, "name": name},
6152 transport_options=transport_options,
6153 ),
6154 )
6155 return response
6156
6157 # ### Get the parent of a folder
6158 #
6159 # GET /folders/{folder_id}/parent -> mdls.Folder
6160 def folder_parent(
6161 self,
6162 # Id of folder
6163 folder_id: str,
6164 # Requested fields.
6165 fields: Optional[str] = None,
6166 transport_options: Optional[transport.TransportOptions] = None,
6167 ) -> mdls.Folder:
6168 """Get Folder Parent"""
6169 folder_id = self.encode_path_param(folder_id)
6170 response = cast(
6171 mdls.Folder,
6172 self.get(
6173 path=f"/folders/{folder_id}/parent",
6174 structure=mdls.Folder,
6175 query_params={"fields": fields},
6176 transport_options=transport_options,
6177 ),
6178 )
6179 return response
6180
6181 # ### Get the ancestors of a folder
6182 #
6183 # GET /folders/{folder_id}/ancestors -> Sequence[mdls.Folder]
6184 def folder_ancestors(
6185 self,
6186 # Id of folder
6187 folder_id: str,
6188 # Requested fields.
6189 fields: Optional[str] = None,
6190 transport_options: Optional[transport.TransportOptions] = None,
6191 ) -> Sequence[mdls.Folder]:
6192 """Get Folder Ancestors"""
6193 folder_id = self.encode_path_param(folder_id)
6194 response = cast(
6195 Sequence[mdls.Folder],
6196 self.get(
6197 path=f"/folders/{folder_id}/ancestors",
6198 structure=Sequence[mdls.Folder],
6199 query_params={"fields": fields},
6200 transport_options=transport_options,
6201 ),
6202 )
6203 return response
6204
6205 # ### Get all looks in a folder.
6206 # In API 4.0+, all looks in a folder will be returned, excluding looks in the trash.
6207 #
6208 # GET /folders/{folder_id}/looks -> Sequence[mdls.LookWithQuery]
6209 def folder_looks(
6210 self,
6211 # Id of folder
6212 folder_id: str,
6213 # Requested fields.
6214 fields: Optional[str] = None,
6215 transport_options: Optional[transport.TransportOptions] = None,
6216 ) -> Sequence[mdls.LookWithQuery]:
6217 """Get Folder Looks"""
6218 folder_id = self.encode_path_param(folder_id)
6219 response = cast(
6220 Sequence[mdls.LookWithQuery],
6221 self.get(
6222 path=f"/folders/{folder_id}/looks",
6223 structure=Sequence[mdls.LookWithQuery],
6224 query_params={"fields": fields},
6225 transport_options=transport_options,
6226 ),
6227 )
6228 return response
6229
6230 # ### Get the dashboards in a folder
6231 #
6232 # GET /folders/{folder_id}/dashboards -> Sequence[mdls.Dashboard]
6233 def folder_dashboards(
6234 self,
6235 # Id of folder
6236 folder_id: str,
6237 # Requested fields.
6238 fields: Optional[str] = None,
6239 transport_options: Optional[transport.TransportOptions] = None,
6240 ) -> Sequence[mdls.Dashboard]:
6241 """Get Folder Dashboards"""
6242 folder_id = self.encode_path_param(folder_id)
6243 response = cast(
6244 Sequence[mdls.Dashboard],
6245 self.get(
6246 path=f"/folders/{folder_id}/dashboards",
6247 structure=Sequence[mdls.Dashboard],
6248 query_params={"fields": fields},
6249 transport_options=transport_options,
6250 ),
6251 )
6252 return response
6253
6254 # endregion
6255
6256 # region Group: Manage Groups
6257
6258 # ### Get information about all groups.
6259 #
6260 # GET /groups -> Sequence[mdls.Group]
6261 def all_groups(
6262 self,
6263 # Requested fields.
6264 fields: Optional[str] = None,
6265 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
6266 page: Optional[int] = None,
6267 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
6268 per_page: Optional[int] = None,
6269 # Number of results to return. (used with offset and takes priority over page and per_page)
6270 limit: Optional[int] = None,
6271 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
6272 offset: Optional[int] = None,
6273 # Fields to sort by.
6274 sorts: Optional[str] = None,
6275 # Optional of ids to get specific groups.
6276 ids: Optional[mdls.DelimSequence[str]] = None,
6277 # Id of content metadata to which groups must have access.
6278 content_metadata_id: Optional[str] = None,
6279 # Select only groups that either can/cannot be given access to content.
6280 can_add_to_content_metadata: Optional[bool] = None,
6281 transport_options: Optional[transport.TransportOptions] = None,
6282 ) -> Sequence[mdls.Group]:
6283 """Get All Groups"""
6284 response = cast(
6285 Sequence[mdls.Group],
6286 self.get(
6287 path="/groups",
6288 structure=Sequence[mdls.Group],
6289 query_params={
6290 "fields": fields,
6291 "page": page,
6292 "per_page": per_page,
6293 "limit": limit,
6294 "offset": offset,
6295 "sorts": sorts,
6296 "ids": ids,
6297 "content_metadata_id": content_metadata_id,
6298 "can_add_to_content_metadata": can_add_to_content_metadata,
6299 },
6300 transport_options=transport_options,
6301 ),
6302 )
6303 return response
6304
6305 # ### Creates a new group (admin only).
6306 #
6307 # POST /groups -> mdls.Group
6308 def create_group(
6309 self,
6310 body: mdls.WriteGroup,
6311 # Requested fields.
6312 fields: Optional[str] = None,
6313 transport_options: Optional[transport.TransportOptions] = None,
6314 ) -> mdls.Group:
6315 """Create Group"""
6316 response = cast(
6317 mdls.Group,
6318 self.post(
6319 path="/groups",
6320 structure=mdls.Group,
6321 query_params={"fields": fields},
6322 body=body,
6323 transport_options=transport_options,
6324 ),
6325 )
6326 return response
6327
6328 # ### Search groups
6329 #
6330 # Returns all group records that match the given search criteria.
6331 #
6332 # If multiple search params are given and `filter_or` is FALSE or not specified,
6333 # search params are combined in a logical AND operation.
6334 # Only rows that match *all* search param criteria will be returned.
6335 #
6336 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
6337 # Results will include rows that match **any** of the search criteria.
6338 #
6339 # String search params use case-insensitive matching.
6340 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
6341 # example="dan%" will match "danger" and "Danzig" but not "David"
6342 # example="D_m%" will match "Damage" and "dump"
6343 #
6344 # Integer search params can accept a single value or a comma separated list of values. The multiple
6345 # values will be combined under a logical OR operation - results will match at least one of
6346 # the given values.
6347 #
6348 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
6349 # or exclude (respectively) rows where the column is null.
6350 #
6351 # Boolean search params accept only "true" and "false" as values.
6352 #
6353 # GET /groups/search -> Sequence[mdls.Group]
6354 def search_groups(
6355 self,
6356 # Requested fields.
6357 fields: Optional[str] = None,
6358 # Number of results to return (used with `offset`).
6359 limit: Optional[int] = None,
6360 # Number of results to skip before returning any (used with `limit`).
6361 offset: Optional[int] = None,
6362 # Fields to sort by.
6363 sorts: Optional[str] = None,
6364 # Combine given search criteria in a boolean OR expression
6365 filter_or: Optional[bool] = None,
6366 # Match group id.
6367 id: Optional[str] = None,
6368 # Match group name.
6369 name: Optional[str] = None,
6370 # Match group external_group_id.
6371 external_group_id: Optional[str] = None,
6372 # Match group externally_managed.
6373 externally_managed: Optional[bool] = None,
6374 # Match group externally_orphaned.
6375 externally_orphaned: Optional[bool] = None,
6376 transport_options: Optional[transport.TransportOptions] = None,
6377 ) -> Sequence[mdls.Group]:
6378 """Search Groups"""
6379 response = cast(
6380 Sequence[mdls.Group],
6381 self.get(
6382 path="/groups/search",
6383 structure=Sequence[mdls.Group],
6384 query_params={
6385 "fields": fields,
6386 "limit": limit,
6387 "offset": offset,
6388 "sorts": sorts,
6389 "filter_or": filter_or,
6390 "id": id,
6391 "name": name,
6392 "external_group_id": external_group_id,
6393 "externally_managed": externally_managed,
6394 "externally_orphaned": externally_orphaned,
6395 },
6396 transport_options=transport_options,
6397 ),
6398 )
6399 return response
6400
6401 # ### Search groups include roles
6402 #
6403 # Returns all group records that match the given search criteria, and attaches any associated roles.
6404 #
6405 # If multiple search params are given and `filter_or` is FALSE or not specified,
6406 # search params are combined in a logical AND operation.
6407 # Only rows that match *all* search param criteria will be returned.
6408 #
6409 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
6410 # Results will include rows that match **any** of the search criteria.
6411 #
6412 # String search params use case-insensitive matching.
6413 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
6414 # example="dan%" will match "danger" and "Danzig" but not "David"
6415 # example="D_m%" will match "Damage" and "dump"
6416 #
6417 # Integer search params can accept a single value or a comma separated list of values. The multiple
6418 # values will be combined under a logical OR operation - results will match at least one of
6419 # the given values.
6420 #
6421 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
6422 # or exclude (respectively) rows where the column is null.
6423 #
6424 # Boolean search params accept only "true" and "false" as values.
6425 #
6426 # GET /groups/search/with_roles -> Sequence[mdls.GroupSearch]
6427 def search_groups_with_roles(
6428 self,
6429 # Requested fields.
6430 fields: Optional[str] = None,
6431 # Number of results to return (used with `offset`).
6432 limit: Optional[int] = None,
6433 # Number of results to skip before returning any (used with `limit`).
6434 offset: Optional[int] = None,
6435 # Fields to sort by.
6436 sorts: Optional[str] = None,
6437 # Combine given search criteria in a boolean OR expression
6438 filter_or: Optional[bool] = None,
6439 # Match group id.
6440 id: Optional[str] = None,
6441 # Match group name.
6442 name: Optional[str] = None,
6443 # Match group external_group_id.
6444 external_group_id: Optional[str] = None,
6445 # Match group externally_managed.
6446 externally_managed: Optional[bool] = None,
6447 # Match group externally_orphaned.
6448 externally_orphaned: Optional[bool] = None,
6449 transport_options: Optional[transport.TransportOptions] = None,
6450 ) -> Sequence[mdls.GroupSearch]:
6451 """Search Groups with Roles"""
6452 response = cast(
6453 Sequence[mdls.GroupSearch],
6454 self.get(
6455 path="/groups/search/with_roles",
6456 structure=Sequence[mdls.GroupSearch],
6457 query_params={
6458 "fields": fields,
6459 "limit": limit,
6460 "offset": offset,
6461 "sorts": sorts,
6462 "filter_or": filter_or,
6463 "id": id,
6464 "name": name,
6465 "external_group_id": external_group_id,
6466 "externally_managed": externally_managed,
6467 "externally_orphaned": externally_orphaned,
6468 },
6469 transport_options=transport_options,
6470 ),
6471 )
6472 return response
6473
6474 # ### Search groups include hierarchy
6475 #
6476 # Returns all group records that match the given search criteria, and attaches
6477 # associated role_ids and parent group_ids.
6478 #
6479 # If multiple search params are given and `filter_or` is FALSE or not specified,
6480 # search params are combined in a logical AND operation.
6481 # Only rows that match *all* search param criteria will be returned.
6482 #
6483 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
6484 # Results will include rows that match **any** of the search criteria.
6485 #
6486 # String search params use case-insensitive matching.
6487 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
6488 # example="dan%" will match "danger" and "Danzig" but not "David"
6489 # example="D_m%" will match "Damage" and "dump"
6490 #
6491 # Integer search params can accept a single value or a comma separated list of values. The multiple
6492 # values will be combined under a logical OR operation - results will match at least one of
6493 # the given values.
6494 #
6495 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
6496 # or exclude (respectively) rows where the column is null.
6497 #
6498 # Boolean search params accept only "true" and "false" as values.
6499 #
6500 # GET /groups/search/with_hierarchy -> Sequence[mdls.GroupHierarchy]
6501 def search_groups_with_hierarchy(
6502 self,
6503 # Requested fields.
6504 fields: Optional[str] = None,
6505 # Number of results to return (used with `offset`).
6506 limit: Optional[int] = None,
6507 # Number of results to skip before returning any (used with `limit`).
6508 offset: Optional[int] = None,
6509 # Fields to sort by.
6510 sorts: Optional[str] = None,
6511 # Combine given search criteria in a boolean OR expression
6512 filter_or: Optional[bool] = None,
6513 # Match group id.
6514 id: Optional[str] = None,
6515 # Match group name.
6516 name: Optional[str] = None,
6517 # Match group external_group_id.
6518 external_group_id: Optional[str] = None,
6519 # Match group externally_managed.
6520 externally_managed: Optional[bool] = None,
6521 # Match group externally_orphaned.
6522 externally_orphaned: Optional[bool] = None,
6523 transport_options: Optional[transport.TransportOptions] = None,
6524 ) -> Sequence[mdls.GroupHierarchy]:
6525 """Search Groups with Hierarchy"""
6526 response = cast(
6527 Sequence[mdls.GroupHierarchy],
6528 self.get(
6529 path="/groups/search/with_hierarchy",
6530 structure=Sequence[mdls.GroupHierarchy],
6531 query_params={
6532 "fields": fields,
6533 "limit": limit,
6534 "offset": offset,
6535 "sorts": sorts,
6536 "filter_or": filter_or,
6537 "id": id,
6538 "name": name,
6539 "external_group_id": external_group_id,
6540 "externally_managed": externally_managed,
6541 "externally_orphaned": externally_orphaned,
6542 },
6543 transport_options=transport_options,
6544 ),
6545 )
6546 return response
6547
6548 # ### Get information about a group.
6549 #
6550 # GET /groups/{group_id} -> mdls.Group
6551 def group(
6552 self,
6553 # Id of group
6554 group_id: str,
6555 # Requested fields.
6556 fields: Optional[str] = None,
6557 transport_options: Optional[transport.TransportOptions] = None,
6558 ) -> mdls.Group:
6559 """Get Group"""
6560 group_id = self.encode_path_param(group_id)
6561 response = cast(
6562 mdls.Group,
6563 self.get(
6564 path=f"/groups/{group_id}",
6565 structure=mdls.Group,
6566 query_params={"fields": fields},
6567 transport_options=transport_options,
6568 ),
6569 )
6570 return response
6571
6572 # ### Updates the a group (admin only).
6573 #
6574 # PATCH /groups/{group_id} -> mdls.Group
6575 def update_group(
6576 self,
6577 # Id of group
6578 group_id: str,
6579 body: mdls.WriteGroup,
6580 # Requested fields.
6581 fields: Optional[str] = None,
6582 transport_options: Optional[transport.TransportOptions] = None,
6583 ) -> mdls.Group:
6584 """Update Group"""
6585 group_id = self.encode_path_param(group_id)
6586 response = cast(
6587 mdls.Group,
6588 self.patch(
6589 path=f"/groups/{group_id}",
6590 structure=mdls.Group,
6591 query_params={"fields": fields},
6592 body=body,
6593 transport_options=transport_options,
6594 ),
6595 )
6596 return response
6597
6598 # ### Deletes a group (admin only).
6599 #
6600 # DELETE /groups/{group_id} -> str
6601 def delete_group(
6602 self,
6603 # Id of group
6604 group_id: str,
6605 transport_options: Optional[transport.TransportOptions] = None,
6606 ) -> str:
6607 """Delete Group"""
6608 group_id = self.encode_path_param(group_id)
6609 response = cast(
6610 str,
6611 self.delete(
6612 path=f"/groups/{group_id}",
6613 structure=str,
6614 transport_options=transport_options,
6615 ),
6616 )
6617 return response
6618
6619 # ### Get information about all the groups in a group
6620 #
6621 # GET /groups/{group_id}/groups -> Sequence[mdls.Group]
6622 def all_group_groups(
6623 self,
6624 # Id of group
6625 group_id: str,
6626 # Requested fields.
6627 fields: Optional[str] = None,
6628 transport_options: Optional[transport.TransportOptions] = None,
6629 ) -> Sequence[mdls.Group]:
6630 """Get All Groups in Group"""
6631 group_id = self.encode_path_param(group_id)
6632 response = cast(
6633 Sequence[mdls.Group],
6634 self.get(
6635 path=f"/groups/{group_id}/groups",
6636 structure=Sequence[mdls.Group],
6637 query_params={"fields": fields},
6638 transport_options=transport_options,
6639 ),
6640 )
6641 return response
6642
6643 # ### Adds a new group to a group.
6644 #
6645 # POST /groups/{group_id}/groups -> mdls.Group
6646 def add_group_group(
6647 self,
6648 # Id of group
6649 group_id: str,
6650 # WARNING: no writeable properties found for POST, PUT, or PATCH
6651 body: mdls.GroupIdForGroupInclusion,
6652 transport_options: Optional[transport.TransportOptions] = None,
6653 ) -> mdls.Group:
6654 """Add a Group to Group"""
6655 group_id = self.encode_path_param(group_id)
6656 response = cast(
6657 mdls.Group,
6658 self.post(
6659 path=f"/groups/{group_id}/groups",
6660 structure=mdls.Group,
6661 body=body,
6662 transport_options=transport_options,
6663 ),
6664 )
6665 return response
6666
6667 # ### Get information about all the users directly included in a group.
6668 #
6669 # GET /groups/{group_id}/users -> Sequence[mdls.User]
6670 def all_group_users(
6671 self,
6672 # Id of group
6673 group_id: str,
6674 # Requested fields.
6675 fields: Optional[str] = None,
6676 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
6677 page: Optional[int] = None,
6678 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
6679 per_page: Optional[int] = None,
6680 # Number of results to return. (used with offset and takes priority over page and per_page)
6681 limit: Optional[int] = None,
6682 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
6683 offset: Optional[int] = None,
6684 # Fields to sort by.
6685 sorts: Optional[str] = None,
6686 transport_options: Optional[transport.TransportOptions] = None,
6687 ) -> Sequence[mdls.User]:
6688 """Get All Users in Group"""
6689 group_id = self.encode_path_param(group_id)
6690 response = cast(
6691 Sequence[mdls.User],
6692 self.get(
6693 path=f"/groups/{group_id}/users",
6694 structure=Sequence[mdls.User],
6695 query_params={
6696 "fields": fields,
6697 "page": page,
6698 "per_page": per_page,
6699 "limit": limit,
6700 "offset": offset,
6701 "sorts": sorts,
6702 },
6703 transport_options=transport_options,
6704 ),
6705 )
6706 return response
6707
6708 # ### Adds a new user to a group.
6709 #
6710 # POST /groups/{group_id}/users -> mdls.User
6711 def add_group_user(
6712 self,
6713 # Id of group
6714 group_id: str,
6715 # WARNING: no writeable properties found for POST, PUT, or PATCH
6716 body: mdls.GroupIdForGroupUserInclusion,
6717 transport_options: Optional[transport.TransportOptions] = None,
6718 ) -> mdls.User:
6719 """Add a User to Group"""
6720 group_id = self.encode_path_param(group_id)
6721 response = cast(
6722 mdls.User,
6723 self.post(
6724 path=f"/groups/{group_id}/users",
6725 structure=mdls.User,
6726 body=body,
6727 transport_options=transport_options,
6728 ),
6729 )
6730 return response
6731
6732 # ### Removes a user from a group.
6733 #
6734 # DELETE /groups/{group_id}/users/{user_id} -> None
6735 def delete_group_user(
6736 self,
6737 # Id of group
6738 group_id: str,
6739 # Id of user to remove from group
6740 user_id: str,
6741 transport_options: Optional[transport.TransportOptions] = None,
6742 ) -> None:
6743 """Remove a User from Group"""
6744 group_id = self.encode_path_param(group_id)
6745 user_id = self.encode_path_param(user_id)
6746 response = cast(
6747 None,
6748 self.delete(
6749 path=f"/groups/{group_id}/users/{user_id}",
6750 structure=None,
6751 transport_options=transport_options,
6752 ),
6753 )
6754 return response
6755
6756 # ### Removes a group from a group.
6757 #
6758 # DELETE /groups/{group_id}/groups/{deleting_group_id} -> None
6759 def delete_group_from_group(
6760 self,
6761 # Id of group
6762 group_id: str,
6763 # Id of group to delete
6764 deleting_group_id: str,
6765 transport_options: Optional[transport.TransportOptions] = None,
6766 ) -> None:
6767 """Deletes a Group from Group"""
6768 group_id = self.encode_path_param(group_id)
6769 deleting_group_id = self.encode_path_param(deleting_group_id)
6770 response = cast(
6771 None,
6772 self.delete(
6773 path=f"/groups/{group_id}/groups/{deleting_group_id}",
6774 structure=None,
6775 transport_options=transport_options,
6776 ),
6777 )
6778 return response
6779
6780 # ### Set the value of a user attribute for a group.
6781 #
6782 # For information about how user attribute values are calculated, see [Set User Attribute Group Values](#!/UserAttribute/set_user_attribute_group_values).
6783 #
6784 # PATCH /groups/{group_id}/attribute_values/{user_attribute_id} -> mdls.UserAttributeGroupValue
6785 def update_user_attribute_group_value(
6786 self,
6787 # Id of group
6788 group_id: str,
6789 # Id of user attribute
6790 user_attribute_id: str,
6791 # WARNING: no writeable properties found for POST, PUT, or PATCH
6792 body: mdls.UserAttributeGroupValue,
6793 transport_options: Optional[transport.TransportOptions] = None,
6794 ) -> mdls.UserAttributeGroupValue:
6795 """Set User Attribute Group Value"""
6796 group_id = self.encode_path_param(group_id)
6797 user_attribute_id = self.encode_path_param(user_attribute_id)
6798 response = cast(
6799 mdls.UserAttributeGroupValue,
6800 self.patch(
6801 path=f"/groups/{group_id}/attribute_values/{user_attribute_id}",
6802 structure=mdls.UserAttributeGroupValue,
6803 body=body,
6804 transport_options=transport_options,
6805 ),
6806 )
6807 return response
6808
6809 # ### Remove a user attribute value from a group.
6810 #
6811 # DELETE /groups/{group_id}/attribute_values/{user_attribute_id} -> None
6812 def delete_user_attribute_group_value(
6813 self,
6814 # Id of group
6815 group_id: str,
6816 # Id of user attribute
6817 user_attribute_id: str,
6818 transport_options: Optional[transport.TransportOptions] = None,
6819 ) -> None:
6820 """Delete User Attribute Group Value"""
6821 group_id = self.encode_path_param(group_id)
6822 user_attribute_id = self.encode_path_param(user_attribute_id)
6823 response = cast(
6824 None,
6825 self.delete(
6826 path=f"/groups/{group_id}/attribute_values/{user_attribute_id}",
6827 structure=None,
6828 transport_options=transport_options,
6829 ),
6830 )
6831 return response
6832
6833 # endregion
6834
6835 # region Homepage: Manage Homepage
6836
6837 # ### Get information about the primary homepage's sections.
6838 #
6839 # GET /primary_homepage_sections -> Sequence[mdls.HomepageSection]
6840 def all_primary_homepage_sections(
6841 self,
6842 # Requested fields.
6843 fields: Optional[str] = None,
6844 transport_options: Optional[transport.TransportOptions] = None,
6845 ) -> Sequence[mdls.HomepageSection]:
6846 """Get All Primary homepage sections"""
6847 response = cast(
6848 Sequence[mdls.HomepageSection],
6849 self.get(
6850 path="/primary_homepage_sections",
6851 structure=Sequence[mdls.HomepageSection],
6852 query_params={"fields": fields},
6853 transport_options=transport_options,
6854 ),
6855 )
6856 return response
6857
6858 # endregion
6859
6860 # region Integration: Manage Integrations
6861
6862 # ### Get information about all Integration Hubs.
6863 #
6864 # GET /integration_hubs -> Sequence[mdls.IntegrationHub]
6865 def all_integration_hubs(
6866 self,
6867 # Requested fields.
6868 fields: Optional[str] = None,
6869 transport_options: Optional[transport.TransportOptions] = None,
6870 ) -> Sequence[mdls.IntegrationHub]:
6871 """Get All Integration Hubs"""
6872 response = cast(
6873 Sequence[mdls.IntegrationHub],
6874 self.get(
6875 path="/integration_hubs",
6876 structure=Sequence[mdls.IntegrationHub],
6877 query_params={"fields": fields},
6878 transport_options=transport_options,
6879 ),
6880 )
6881 return response
6882
6883 # ### Create a new Integration Hub.
6884 #
6885 # This API is rate limited to prevent it from being used for SSRF attacks
6886 #
6887 # POST /integration_hubs -> mdls.IntegrationHub
6888 def create_integration_hub(
6889 self,
6890 body: mdls.WriteIntegrationHub,
6891 # Requested fields.
6892 fields: Optional[str] = None,
6893 transport_options: Optional[transport.TransportOptions] = None,
6894 ) -> mdls.IntegrationHub:
6895 """Create Integration Hub"""
6896 response = cast(
6897 mdls.IntegrationHub,
6898 self.post(
6899 path="/integration_hubs",
6900 structure=mdls.IntegrationHub,
6901 query_params={"fields": fields},
6902 body=body,
6903 transport_options=transport_options,
6904 ),
6905 )
6906 return response
6907
6908 # ### Get information about a Integration Hub.
6909 #
6910 # GET /integration_hubs/{integration_hub_id} -> mdls.IntegrationHub
6911 def integration_hub(
6912 self,
6913 # Id of integration_hub
6914 integration_hub_id: str,
6915 # Requested fields.
6916 fields: Optional[str] = None,
6917 transport_options: Optional[transport.TransportOptions] = None,
6918 ) -> mdls.IntegrationHub:
6919 """Get Integration Hub"""
6920 integration_hub_id = self.encode_path_param(integration_hub_id)
6921 response = cast(
6922 mdls.IntegrationHub,
6923 self.get(
6924 path=f"/integration_hubs/{integration_hub_id}",
6925 structure=mdls.IntegrationHub,
6926 query_params={"fields": fields},
6927 transport_options=transport_options,
6928 ),
6929 )
6930 return response
6931
6932 # ### Update a Integration Hub definition.
6933 #
6934 # This API is rate limited to prevent it from being used for SSRF attacks
6935 #
6936 # PATCH /integration_hubs/{integration_hub_id} -> mdls.IntegrationHub
6937 def update_integration_hub(
6938 self,
6939 # Id of integration_hub
6940 integration_hub_id: str,
6941 body: mdls.WriteIntegrationHub,
6942 # Requested fields.
6943 fields: Optional[str] = None,
6944 transport_options: Optional[transport.TransportOptions] = None,
6945 ) -> mdls.IntegrationHub:
6946 """Update Integration Hub"""
6947 integration_hub_id = self.encode_path_param(integration_hub_id)
6948 response = cast(
6949 mdls.IntegrationHub,
6950 self.patch(
6951 path=f"/integration_hubs/{integration_hub_id}",
6952 structure=mdls.IntegrationHub,
6953 query_params={"fields": fields},
6954 body=body,
6955 transport_options=transport_options,
6956 ),
6957 )
6958 return response
6959
6960 # ### Delete a Integration Hub.
6961 #
6962 # DELETE /integration_hubs/{integration_hub_id} -> str
6963 def delete_integration_hub(
6964 self,
6965 # Id of integration_hub
6966 integration_hub_id: str,
6967 transport_options: Optional[transport.TransportOptions] = None,
6968 ) -> str:
6969 """Delete Integration Hub"""
6970 integration_hub_id = self.encode_path_param(integration_hub_id)
6971 response = cast(
6972 str,
6973 self.delete(
6974 path=f"/integration_hubs/{integration_hub_id}",
6975 structure=str,
6976 transport_options=transport_options,
6977 ),
6978 )
6979 return response
6980
6981 # Accepts the legal agreement for a given integration hub. This only works for integration hubs that have legal_agreement_required set to true and legal_agreement_signed set to false.
6982 #
6983 # POST /integration_hubs/{integration_hub_id}/accept_legal_agreement -> mdls.IntegrationHub
6984 def accept_integration_hub_legal_agreement(
6985 self,
6986 # Id of integration_hub
6987 integration_hub_id: str,
6988 transport_options: Optional[transport.TransportOptions] = None,
6989 ) -> mdls.IntegrationHub:
6990 """Accept Integration Hub Legal Agreement"""
6991 integration_hub_id = self.encode_path_param(integration_hub_id)
6992 response = cast(
6993 mdls.IntegrationHub,
6994 self.post(
6995 path=f"/integration_hubs/{integration_hub_id}/accept_legal_agreement",
6996 structure=mdls.IntegrationHub,
6997 transport_options=transport_options,
6998 ),
6999 )
7000 return response
7001
7002 # ### Get information about all Integrations.
7003 #
7004 # GET /integrations -> Sequence[mdls.Integration]
7005 def all_integrations(
7006 self,
7007 # Requested fields.
7008 fields: Optional[str] = None,
7009 # Filter to a specific provider
7010 integration_hub_id: Optional[str] = None,
7011 transport_options: Optional[transport.TransportOptions] = None,
7012 ) -> Sequence[mdls.Integration]:
7013 """Get All Integrations"""
7014 response = cast(
7015 Sequence[mdls.Integration],
7016 self.get(
7017 path="/integrations",
7018 structure=Sequence[mdls.Integration],
7019 query_params={
7020 "fields": fields,
7021 "integration_hub_id": integration_hub_id,
7022 },
7023 transport_options=transport_options,
7024 ),
7025 )
7026 return response
7027
7028 # ### Get information about a Integration.
7029 #
7030 # GET /integrations/{integration_id} -> mdls.Integration
7031 def integration(
7032 self,
7033 # Id of integration
7034 integration_id: str,
7035 # Requested fields.
7036 fields: Optional[str] = None,
7037 transport_options: Optional[transport.TransportOptions] = None,
7038 ) -> mdls.Integration:
7039 """Get Integration"""
7040 integration_id = self.encode_path_param(integration_id)
7041 response = cast(
7042 mdls.Integration,
7043 self.get(
7044 path=f"/integrations/{integration_id}",
7045 structure=mdls.Integration,
7046 query_params={"fields": fields},
7047 transport_options=transport_options,
7048 ),
7049 )
7050 return response
7051
7052 # ### Update parameters on a Integration.
7053 #
7054 # PATCH /integrations/{integration_id} -> mdls.Integration
7055 def update_integration(
7056 self,
7057 # Id of integration
7058 integration_id: str,
7059 body: mdls.WriteIntegration,
7060 # Requested fields.
7061 fields: Optional[str] = None,
7062 transport_options: Optional[transport.TransportOptions] = None,
7063 ) -> mdls.Integration:
7064 """Update Integration"""
7065 integration_id = self.encode_path_param(integration_id)
7066 response = cast(
7067 mdls.Integration,
7068 self.patch(
7069 path=f"/integrations/{integration_id}",
7070 structure=mdls.Integration,
7071 query_params={"fields": fields},
7072 body=body,
7073 transport_options=transport_options,
7074 ),
7075 )
7076 return response
7077
7078 # Returns the Integration form for presentation to the user.
7079 #
7080 # POST /integrations/{integration_id}/form -> mdls.DataActionForm
7081 def fetch_integration_form(
7082 self,
7083 # Id of integration
7084 integration_id: str,
7085 body: Optional[MutableMapping[str, Any]] = None,
7086 transport_options: Optional[transport.TransportOptions] = None,
7087 ) -> mdls.DataActionForm:
7088 """Fetch Remote Integration Form"""
7089 integration_id = self.encode_path_param(integration_id)
7090 response = cast(
7091 mdls.DataActionForm,
7092 self.post(
7093 path=f"/integrations/{integration_id}/form",
7094 structure=mdls.DataActionForm,
7095 body=body,
7096 transport_options=transport_options,
7097 ),
7098 )
7099 return response
7100
7101 # Tests the integration to make sure all the settings are working.
7102 #
7103 # POST /integrations/{integration_id}/test -> mdls.IntegrationTestResult
7104 def test_integration(
7105 self,
7106 # Id of integration
7107 integration_id: str,
7108 transport_options: Optional[transport.TransportOptions] = None,
7109 ) -> mdls.IntegrationTestResult:
7110 """Test integration"""
7111 integration_id = self.encode_path_param(integration_id)
7112 response = cast(
7113 mdls.IntegrationTestResult,
7114 self.post(
7115 path=f"/integrations/{integration_id}/test",
7116 structure=mdls.IntegrationTestResult,
7117 transport_options=transport_options,
7118 ),
7119 )
7120 return response
7121
7122 # endregion
7123
7124 # region Look: Run and Manage Looks
7125
7126 # ### Get information about all active Looks
7127 #
7128 # Returns an array of **abbreviated Look objects** describing all the looks that the caller has access to. Soft-deleted Looks are **not** included.
7129 #
7130 # Get the **full details** of a specific look by id with [look(id)](#!/Look/look)
7131 #
7132 # Find **soft-deleted looks** with [search_looks()](#!/Look/search_looks)
7133 #
7134 # GET /looks -> Sequence[mdls.Look]
7135 def all_looks(
7136 self,
7137 # Requested fields.
7138 fields: Optional[str] = None,
7139 transport_options: Optional[transport.TransportOptions] = None,
7140 ) -> Sequence[mdls.Look]:
7141 """Get All Looks"""
7142 response = cast(
7143 Sequence[mdls.Look],
7144 self.get(
7145 path="/looks",
7146 structure=Sequence[mdls.Look],
7147 query_params={"fields": fields},
7148 transport_options=transport_options,
7149 ),
7150 )
7151 return response
7152
7153 # ### Create a Look
7154 #
7155 # To create a look to display query data, first create the query with [create_query()](#!/Query/create_query)
7156 # then assign the query's id to the `query_id` property in the call to `create_look()`.
7157 #
7158 # To place the look into a particular space, assign the space's id to the `space_id` property
7159 # in the call to `create_look()`.
7160 #
7161 # POST /looks -> mdls.LookWithQuery
7162 def create_look(
7163 self,
7164 body: mdls.WriteLookWithQuery,
7165 # Requested fields.
7166 fields: Optional[str] = None,
7167 transport_options: Optional[transport.TransportOptions] = None,
7168 ) -> mdls.LookWithQuery:
7169 """Create Look"""
7170 response = cast(
7171 mdls.LookWithQuery,
7172 self.post(
7173 path="/looks",
7174 structure=mdls.LookWithQuery,
7175 query_params={"fields": fields},
7176 body=body,
7177 transport_options=transport_options,
7178 ),
7179 )
7180 return response
7181
7182 # ### Search Looks
7183 #
7184 # Returns an **array of Look objects** that match the specified search criteria.
7185 #
7186 # If multiple search params are given and `filter_or` is FALSE or not specified,
7187 # search params are combined in a logical AND operation.
7188 # Only rows that match *all* search param criteria will be returned.
7189 #
7190 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
7191 # Results will include rows that match **any** of the search criteria.
7192 #
7193 # String search params use case-insensitive matching.
7194 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
7195 # example="dan%" will match "danger" and "Danzig" but not "David"
7196 # example="D_m%" will match "Damage" and "dump"
7197 #
7198 # Integer search params can accept a single value or a comma separated list of values. The multiple
7199 # values will be combined under a logical OR operation - results will match at least one of
7200 # the given values.
7201 #
7202 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
7203 # or exclude (respectively) rows where the column is null.
7204 #
7205 # Boolean search params accept only "true" and "false" as values.
7206 #
7207 #
7208 # Get a **single look** by id with [look(id)](#!/Look/look)
7209 #
7210 # GET /looks/search -> Sequence[mdls.Look]
7211 def search_looks(
7212 self,
7213 # Match look id.
7214 id: Optional[str] = None,
7215 # Match Look title.
7216 title: Optional[str] = None,
7217 # Match Look description.
7218 description: Optional[str] = None,
7219 # Select looks with a particular content favorite id
7220 content_favorite_id: Optional[str] = None,
7221 # Select looks in a particular folder.
7222 folder_id: Optional[str] = None,
7223 # Select looks created by a particular user.
7224 user_id: Optional[str] = None,
7225 # Select looks with particular view_count value
7226 view_count: Optional[str] = None,
7227 # Select soft-deleted looks
7228 deleted: Optional[bool] = None,
7229 # Select looks that reference a particular query by query_id
7230 query_id: Optional[str] = None,
7231 # Exclude items that exist only in personal spaces other than the users
7232 curate: Optional[bool] = None,
7233 # Select looks based on when they were last viewed
7234 last_viewed_at: Optional[str] = None,
7235 # Requested fields.
7236 fields: Optional[str] = None,
7237 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
7238 page: Optional[int] = None,
7239 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
7240 per_page: Optional[int] = None,
7241 # Number of results to return. (used with offset and takes priority over page and per_page)
7242 limit: Optional[int] = None,
7243 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
7244 offset: Optional[int] = None,
7245 # One or more fields to sort results by. Sortable fields: [:title, :user_id, :id, :created_at, :space_id, :folder_id, :description, :updated_at, :last_updater_id, :view_count, :favorite_count, :content_favorite_id, :deleted, :deleted_at, :last_viewed_at, :last_accessed_at, :query_id]
7246 sorts: Optional[str] = None,
7247 # Combine given search criteria in a boolean OR expression
7248 filter_or: Optional[bool] = None,
7249 transport_options: Optional[transport.TransportOptions] = None,
7250 ) -> Sequence[mdls.Look]:
7251 """Search Looks"""
7252 response = cast(
7253 Sequence[mdls.Look],
7254 self.get(
7255 path="/looks/search",
7256 structure=Sequence[mdls.Look],
7257 query_params={
7258 "id": id,
7259 "title": title,
7260 "description": description,
7261 "content_favorite_id": content_favorite_id,
7262 "folder_id": folder_id,
7263 "user_id": user_id,
7264 "view_count": view_count,
7265 "deleted": deleted,
7266 "query_id": query_id,
7267 "curate": curate,
7268 "last_viewed_at": last_viewed_at,
7269 "fields": fields,
7270 "page": page,
7271 "per_page": per_page,
7272 "limit": limit,
7273 "offset": offset,
7274 "sorts": sorts,
7275 "filter_or": filter_or,
7276 },
7277 transport_options=transport_options,
7278 ),
7279 )
7280 return response
7281
7282 # ### Get a Look.
7283 #
7284 # Returns detailed information about a Look and its associated Query.
7285 #
7286 # GET /looks/{look_id} -> mdls.LookWithQuery
7287 def look(
7288 self,
7289 # Id of look
7290 look_id: str,
7291 # Requested fields.
7292 fields: Optional[str] = None,
7293 transport_options: Optional[transport.TransportOptions] = None,
7294 ) -> mdls.LookWithQuery:
7295 """Get Look"""
7296 look_id = self.encode_path_param(look_id)
7297 response = cast(
7298 mdls.LookWithQuery,
7299 self.get(
7300 path=f"/looks/{look_id}",
7301 structure=mdls.LookWithQuery,
7302 query_params={"fields": fields},
7303 transport_options=transport_options,
7304 ),
7305 )
7306 return response
7307
7308 # ### Modify a Look
7309 #
7310 # Use this function to modify parts of a look. Property values given in a call to `update_look` are
7311 # applied to the existing look, so there's no need to include properties whose values are not changing.
7312 # It's best to specify only the properties you want to change and leave everything else out
7313 # of your `update_look` call. **Look properties marked 'read-only' will be ignored.**
7314 #
7315 # When a user deletes a look in the Looker UI, the look data remains in the database but is
7316 # marked with a deleted flag ("soft-deleted"). Soft-deleted looks can be undeleted (by an admin)
7317 # if the delete was in error.
7318 #
7319 # To soft-delete a look via the API, use [update_look()](#!/Look/update_look) to change the look's `deleted` property to `true`.
7320 # You can undelete a look by calling `update_look` to change the look's `deleted` property to `false`.
7321 #
7322 # Soft-deleted looks are excluded from the results of [all_looks()](#!/Look/all_looks) and [search_looks()](#!/Look/search_looks), so they
7323 # essentially disappear from view even though they still reside in the db.
7324 # You can pass `deleted: true` as a parameter to [search_looks()](#!/Look/search_looks) to list soft-deleted looks.
7325 #
7326 # NOTE: [delete_look()](#!/Look/delete_look) performs a "hard delete" - the look data is removed from the Looker
7327 # database and destroyed. There is no "undo" for `delete_look()`.
7328 #
7329 # PATCH /looks/{look_id} -> mdls.LookWithQuery
7330 def update_look(
7331 self,
7332 # Id of look
7333 look_id: str,
7334 body: mdls.WriteLookWithQuery,
7335 # Requested fields.
7336 fields: Optional[str] = None,
7337 transport_options: Optional[transport.TransportOptions] = None,
7338 ) -> mdls.LookWithQuery:
7339 """Update Look"""
7340 look_id = self.encode_path_param(look_id)
7341 response = cast(
7342 mdls.LookWithQuery,
7343 self.patch(
7344 path=f"/looks/{look_id}",
7345 structure=mdls.LookWithQuery,
7346 query_params={"fields": fields},
7347 body=body,
7348 transport_options=transport_options,
7349 ),
7350 )
7351 return response
7352
7353 # ### Permanently Delete a Look
7354 #
7355 # This operation **permanently** removes a look from the Looker database.
7356 #
7357 # NOTE: There is no "undo" for this kind of delete.
7358 #
7359 # For information about soft-delete (which can be undone) see [update_look()](#!/Look/update_look).
7360 #
7361 # DELETE /looks/{look_id} -> str
7362 def delete_look(
7363 self,
7364 # Id of look
7365 look_id: str,
7366 transport_options: Optional[transport.TransportOptions] = None,
7367 ) -> str:
7368 """Delete Look"""
7369 look_id = self.encode_path_param(look_id)
7370 response = cast(
7371 str,
7372 self.delete(
7373 path=f"/looks/{look_id}",
7374 structure=str,
7375 transport_options=transport_options,
7376 ),
7377 )
7378 return response
7379
7380 # ### Run a Look
7381 #
7382 # Runs a given look's query and returns the results in the requested format.
7383 #
7384 # Supported formats:
7385 #
7386 # | result_format | Description
7387 # | :-----------: | :--- |
7388 # | json | Plain json
7389 # | json_bi | (*RECOMMENDED*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query. See JsonBi type for schema
7390 # | json_detail | (*LEGACY*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
7391 # | csv | Comma separated values with a header
7392 # | txt | Tab separated values with a header
7393 # | html | Simple html
7394 # | md | Simple markdown
7395 # | xlsx | MS Excel spreadsheet
7396 # | sql | Returns the generated SQL rather than running the query
7397 # | png | A PNG image of the visualization of the query
7398 # | jpg | A JPG image of the visualization of the query
7399 #
7400 # GET /looks/{look_id}/run/{result_format} -> Union[str, bytes]
7401 def run_look(
7402 self,
7403 # Id of look
7404 look_id: str,
7405 # Format of result
7406 result_format: str,
7407 # Row limit (may override the limit in the saved query).
7408 limit: Optional[int] = None,
7409 # Apply model-specified formatting to each result.
7410 apply_formatting: Optional[bool] = None,
7411 # Apply visualization options to results.
7412 apply_vis: Optional[bool] = None,
7413 # Get results from cache if available.
7414 cache: Optional[bool] = None,
7415 # Render width for image formats.
7416 image_width: Optional[int] = None,
7417 # Render height for image formats.
7418 image_height: Optional[int] = None,
7419 # Generate drill links (only applicable to 'json_detail' format.
7420 generate_drill_links: Optional[bool] = None,
7421 # Force use of production models even if the user is in development mode. Note that this flag being false does not guarantee development models will be used.
7422 force_production: Optional[bool] = None,
7423 # Retrieve any results from cache even if the results have expired.
7424 cache_only: Optional[bool] = None,
7425 # Prefix to use for drill links (url encoded).
7426 path_prefix: Optional[str] = None,
7427 # Rebuild PDTS used in query.
7428 rebuild_pdts: Optional[bool] = None,
7429 # Perform table calculations on query results
7430 server_table_calcs: Optional[bool] = None,
7431 transport_options: Optional[transport.TransportOptions] = None,
7432 ) -> Union[str, bytes]:
7433 """Run Look"""
7434 look_id = self.encode_path_param(look_id)
7435 result_format = self.encode_path_param(result_format)
7436 response = cast(
7437 Union[str, bytes],
7438 self.get(
7439 path=f"/looks/{look_id}/run/{result_format}",
7440 structure=Union[str, bytes], # type: ignore
7441 query_params={
7442 "limit": limit,
7443 "apply_formatting": apply_formatting,
7444 "apply_vis": apply_vis,
7445 "cache": cache,
7446 "image_width": image_width,
7447 "image_height": image_height,
7448 "generate_drill_links": generate_drill_links,
7449 "force_production": force_production,
7450 "cache_only": cache_only,
7451 "path_prefix": path_prefix,
7452 "rebuild_pdts": rebuild_pdts,
7453 "server_table_calcs": server_table_calcs,
7454 },
7455 transport_options=transport_options,
7456 ),
7457 )
7458 return response
7459
7460 # ### Copy an existing look
7461 #
7462 # Creates a copy of an existing look, in a specified folder, and returns the copied look.
7463 #
7464 # `look_id` and `folder_id` are required.
7465 #
7466 # `look_id` and `folder_id` must already exist, and `folder_id` must be different from the current `folder_id` of the dashboard.
7467 #
7468 # POST /looks/{look_id}/copy -> mdls.LookWithQuery
7469 def copy_look(
7470 self,
7471 # Look id to copy.
7472 look_id: str,
7473 # Folder id to copy to.
7474 folder_id: Optional[str] = None,
7475 transport_options: Optional[transport.TransportOptions] = None,
7476 ) -> mdls.LookWithQuery:
7477 """Copy Look"""
7478 look_id = self.encode_path_param(look_id)
7479 response = cast(
7480 mdls.LookWithQuery,
7481 self.post(
7482 path=f"/looks/{look_id}/copy",
7483 structure=mdls.LookWithQuery,
7484 query_params={"folder_id": folder_id},
7485 transport_options=transport_options,
7486 ),
7487 )
7488 return response
7489
7490 # ### Move an existing look
7491 #
7492 # Moves a look to a specified folder, and returns the moved look.
7493 #
7494 # `look_id` and `folder_id` are required.
7495 # `look_id` and `folder_id` must already exist, and `folder_id` must be different from the current `folder_id` of the dashboard.
7496 #
7497 # PATCH /looks/{look_id}/move -> mdls.LookWithQuery
7498 def move_look(
7499 self,
7500 # Look id to move.
7501 look_id: str,
7502 # Folder id to move to.
7503 folder_id: str,
7504 transport_options: Optional[transport.TransportOptions] = None,
7505 ) -> mdls.LookWithQuery:
7506 """Move Look"""
7507 look_id = self.encode_path_param(look_id)
7508 response = cast(
7509 mdls.LookWithQuery,
7510 self.patch(
7511 path=f"/looks/{look_id}/move",
7512 structure=mdls.LookWithQuery,
7513 query_params={"folder_id": folder_id},
7514 transport_options=transport_options,
7515 ),
7516 )
7517 return response
7518
7519 # endregion
7520
7521 # region LookmlModel: Manage LookML Models
7522
7523 # ### Get information about all lookml models.
7524 #
7525 # GET /lookml_models -> Sequence[mdls.LookmlModel]
7526 def all_lookml_models(
7527 self,
7528 # Requested fields.
7529 fields: Optional[str] = None,
7530 # Number of results to return. (can be used with offset)
7531 limit: Optional[int] = None,
7532 # Number of results to skip before returning any. (Defaults to 0 if not set when limit is used)
7533 offset: Optional[int] = None,
7534 # Whether or not to exclude models with no explores from the response (Defaults to false)
7535 exclude_empty: Optional[bool] = None,
7536 # Whether or not to exclude hidden explores from the response (Defaults to false)
7537 exclude_hidden: Optional[bool] = None,
7538 # Whether or not to include built-in models such as System Activity (Defaults to false)
7539 include_internal: Optional[bool] = None,
7540 transport_options: Optional[transport.TransportOptions] = None,
7541 ) -> Sequence[mdls.LookmlModel]:
7542 """Get All LookML Models"""
7543 response = cast(
7544 Sequence[mdls.LookmlModel],
7545 self.get(
7546 path="/lookml_models",
7547 structure=Sequence[mdls.LookmlModel],
7548 query_params={
7549 "fields": fields,
7550 "limit": limit,
7551 "offset": offset,
7552 "exclude_empty": exclude_empty,
7553 "exclude_hidden": exclude_hidden,
7554 "include_internal": include_internal,
7555 },
7556 transport_options=transport_options,
7557 ),
7558 )
7559 return response
7560
7561 # ### Create a lookml model using the specified configuration.
7562 #
7563 # POST /lookml_models -> mdls.LookmlModel
7564 def create_lookml_model(
7565 self,
7566 body: mdls.WriteLookmlModel,
7567 transport_options: Optional[transport.TransportOptions] = None,
7568 ) -> mdls.LookmlModel:
7569 """Create LookML Model"""
7570 response = cast(
7571 mdls.LookmlModel,
7572 self.post(
7573 path="/lookml_models",
7574 structure=mdls.LookmlModel,
7575 body=body,
7576 transport_options=transport_options,
7577 ),
7578 )
7579 return response
7580
7581 # ### Get information about a lookml model.
7582 #
7583 # GET /lookml_models/{lookml_model_name} -> mdls.LookmlModel
7584 def lookml_model(
7585 self,
7586 # Name of lookml model.
7587 lookml_model_name: str,
7588 # Requested fields.
7589 fields: Optional[str] = None,
7590 transport_options: Optional[transport.TransportOptions] = None,
7591 ) -> mdls.LookmlModel:
7592 """Get LookML Model"""
7593 lookml_model_name = self.encode_path_param(lookml_model_name)
7594 response = cast(
7595 mdls.LookmlModel,
7596 self.get(
7597 path=f"/lookml_models/{lookml_model_name}",
7598 structure=mdls.LookmlModel,
7599 query_params={"fields": fields},
7600 transport_options=transport_options,
7601 ),
7602 )
7603 return response
7604
7605 # ### Update a lookml model using the specified configuration.
7606 #
7607 # PATCH /lookml_models/{lookml_model_name} -> mdls.LookmlModel
7608 def update_lookml_model(
7609 self,
7610 # Name of lookml model.
7611 lookml_model_name: str,
7612 body: mdls.WriteLookmlModel,
7613 transport_options: Optional[transport.TransportOptions] = None,
7614 ) -> mdls.LookmlModel:
7615 """Update LookML Model"""
7616 lookml_model_name = self.encode_path_param(lookml_model_name)
7617 response = cast(
7618 mdls.LookmlModel,
7619 self.patch(
7620 path=f"/lookml_models/{lookml_model_name}",
7621 structure=mdls.LookmlModel,
7622 body=body,
7623 transport_options=transport_options,
7624 ),
7625 )
7626 return response
7627
7628 # ### Delete a lookml model.
7629 #
7630 # DELETE /lookml_models/{lookml_model_name} -> str
7631 def delete_lookml_model(
7632 self,
7633 # Name of lookml model.
7634 lookml_model_name: str,
7635 transport_options: Optional[transport.TransportOptions] = None,
7636 ) -> str:
7637 """Delete LookML Model"""
7638 lookml_model_name = self.encode_path_param(lookml_model_name)
7639 response = cast(
7640 str,
7641 self.delete(
7642 path=f"/lookml_models/{lookml_model_name}",
7643 structure=str,
7644 transport_options=transport_options,
7645 ),
7646 )
7647 return response
7648
7649 # ### Get information about a lookml model explore.
7650 #
7651 # GET /lookml_models/{lookml_model_name}/explores/{explore_name} -> mdls.LookmlModelExplore
7652 def lookml_model_explore(
7653 self,
7654 # Name of lookml model.
7655 lookml_model_name: str,
7656 # Name of explore.
7657 explore_name: str,
7658 # Requested fields.
7659 fields: Optional[str] = None,
7660 # Whether response should include drill field metadata.
7661 add_drills_metadata: Optional[bool] = None,
7662 transport_options: Optional[transport.TransportOptions] = None,
7663 ) -> mdls.LookmlModelExplore:
7664 """Get LookML Model Explore"""
7665 lookml_model_name = self.encode_path_param(lookml_model_name)
7666 explore_name = self.encode_path_param(explore_name)
7667 response = cast(
7668 mdls.LookmlModelExplore,
7669 self.get(
7670 path=f"/lookml_models/{lookml_model_name}/explores/{explore_name}",
7671 structure=mdls.LookmlModelExplore,
7672 query_params={
7673 "fields": fields,
7674 "add_drills_metadata": add_drills_metadata,
7675 },
7676 transport_options=transport_options,
7677 ),
7678 )
7679 return response
7680
7681 # endregion
7682
7683 # region Metadata: Connection Metadata Features
7684
7685 # ### Field name suggestions for a model and view
7686 #
7687 # `filters` is a string hash of values, with the key as the field name and the string value as the filter expression:
7688 #
7689 # ```ruby
7690 # {'users.age': '>=60'}
7691 # ```
7692 #
7693 # or
7694 #
7695 # ```ruby
7696 # {'users.age': '<30'}
7697 # ```
7698 #
7699 # or
7700 #
7701 # ```ruby
7702 # {'users.age': '=50'}
7703 # ```
7704 #
7705 # GET /models/{model_name}/views/{view_name}/fields/{field_name}/suggestions -> mdls.ModelFieldSuggestions
7706 def model_fieldname_suggestions(
7707 self,
7708 # Name of model
7709 model_name: str,
7710 # Name of view
7711 view_name: str,
7712 # Name of field to use for suggestions
7713 field_name: str,
7714 # Search term pattern (evaluated as as `%term%`)
7715 term: Optional[str] = None,
7716 # Suggestion filters with field name keys and comparison expressions
7717 filters: Optional[str] = None,
7718 transport_options: Optional[transport.TransportOptions] = None,
7719 ) -> mdls.ModelFieldSuggestions:
7720 """Model field name suggestions"""
7721 model_name = self.encode_path_param(model_name)
7722 view_name = self.encode_path_param(view_name)
7723 field_name = self.encode_path_param(field_name)
7724 response = cast(
7725 mdls.ModelFieldSuggestions,
7726 self.get(
7727 path=f"/models/{model_name}/views/{view_name}/fields/{field_name}/suggestions",
7728 structure=mdls.ModelFieldSuggestions,
7729 query_params={"term": term, "filters": filters},
7730 transport_options=transport_options,
7731 ),
7732 )
7733 return response
7734
7735 # ### Get a single model
7736 #
7737 # GET /models/{model_name} -> mdls.Model
7738 def get_model(
7739 self,
7740 # Name of model
7741 model_name: str,
7742 transport_options: Optional[transport.TransportOptions] = None,
7743 ) -> mdls.Model:
7744 """Get a single model"""
7745 model_name = self.encode_path_param(model_name)
7746 response = cast(
7747 mdls.Model,
7748 self.get(
7749 path=f"/models/{model_name}",
7750 structure=mdls.Model,
7751 transport_options=transport_options,
7752 ),
7753 )
7754 return response
7755
7756 # ### List databases available to this connection
7757 #
7758 # Certain dialects can support multiple databases per single connection.
7759 # If this connection supports multiple databases, the database names will be returned in an array.
7760 #
7761 # Connections using dialects that do not support multiple databases will return an empty array.
7762 #
7763 # **Note**: [Connection Features](#!/Metadata/connection_features) can be used to determine if a connection supports
7764 # multiple databases.
7765 #
7766 # GET /connections/{connection_name}/databases -> Sequence[str]
7767 def connection_databases(
7768 self,
7769 # Name of connection
7770 connection_name: str,
7771 transport_options: Optional[transport.TransportOptions] = None,
7772 ) -> Sequence[str]:
7773 """List accessible databases to this connection"""
7774 connection_name = self.encode_path_param(connection_name)
7775 response = cast(
7776 Sequence[str],
7777 self.get(
7778 path=f"/connections/{connection_name}/databases",
7779 structure=Sequence[str],
7780 transport_options=transport_options,
7781 ),
7782 )
7783 return response
7784
7785 # ### Retrieve metadata features for this connection
7786 #
7787 # Returns a list of feature names with `true` (available) or `false` (not available)
7788 #
7789 # GET /connections/{connection_name}/features -> mdls.ConnectionFeatures
7790 def connection_features(
7791 self,
7792 # Name of connection
7793 connection_name: str,
7794 # Requested fields.
7795 fields: Optional[str] = None,
7796 transport_options: Optional[transport.TransportOptions] = None,
7797 ) -> mdls.ConnectionFeatures:
7798 """Metadata features supported by this connection"""
7799 connection_name = self.encode_path_param(connection_name)
7800 response = cast(
7801 mdls.ConnectionFeatures,
7802 self.get(
7803 path=f"/connections/{connection_name}/features",
7804 structure=mdls.ConnectionFeatures,
7805 query_params={"fields": fields},
7806 transport_options=transport_options,
7807 ),
7808 )
7809 return response
7810
7811 # ### Get the list of schemas and tables for a connection
7812 #
7813 # GET /connections/{connection_name}/schemas -> Sequence[mdls.Schema]
7814 def connection_schemas(
7815 self,
7816 # Name of connection
7817 connection_name: str,
7818 # For dialects that support multiple databases, optionally identify which to use
7819 database: Optional[str] = None,
7820 # True to use fetch from cache, false to load fresh
7821 cache: Optional[bool] = None,
7822 # Requested fields.
7823 fields: Optional[str] = None,
7824 transport_options: Optional[transport.TransportOptions] = None,
7825 ) -> Sequence[mdls.Schema]:
7826 """Get schemas for a connection"""
7827 connection_name = self.encode_path_param(connection_name)
7828 response = cast(
7829 Sequence[mdls.Schema],
7830 self.get(
7831 path=f"/connections/{connection_name}/schemas",
7832 structure=Sequence[mdls.Schema],
7833 query_params={"database": database, "cache": cache, "fields": fields},
7834 transport_options=transport_options,
7835 ),
7836 )
7837 return response
7838
7839 # ### Get the list of tables for a schema
7840 #
7841 # For dialects that support multiple databases, optionally identify which to use. If not provided, the default
7842 # database for the connection will be used.
7843 #
7844 # For dialects that do **not** support multiple databases, **do not use** the database parameter
7845 #
7846 # GET /connections/{connection_name}/tables -> Sequence[mdls.SchemaTables]
7847 def connection_tables(
7848 self,
7849 # Name of connection
7850 connection_name: str,
7851 # Optional. Name of database to use for the query, only if applicable
7852 database: Optional[str] = None,
7853 # Optional. Return only tables for this schema
7854 schema_name: Optional[str] = None,
7855 # True to fetch from cache, false to load fresh
7856 cache: Optional[bool] = None,
7857 # Requested fields.
7858 fields: Optional[str] = None,
7859 # Optional. Return tables with names that contain this value
7860 table_filter: Optional[str] = None,
7861 # Optional. Return tables up to the table_limit
7862 table_limit: Optional[int] = None,
7863 transport_options: Optional[transport.TransportOptions] = None,
7864 ) -> Sequence[mdls.SchemaTables]:
7865 """Get tables for a connection"""
7866 connection_name = self.encode_path_param(connection_name)
7867 response = cast(
7868 Sequence[mdls.SchemaTables],
7869 self.get(
7870 path=f"/connections/{connection_name}/tables",
7871 structure=Sequence[mdls.SchemaTables],
7872 query_params={
7873 "database": database,
7874 "schema_name": schema_name,
7875 "cache": cache,
7876 "fields": fields,
7877 "table_filter": table_filter,
7878 "table_limit": table_limit,
7879 },
7880 transport_options=transport_options,
7881 ),
7882 )
7883 return response
7884
7885 # ### Get the columns (and therefore also the tables) in a specific schema
7886 #
7887 # GET /connections/{connection_name}/columns -> Sequence[mdls.SchemaColumns]
7888 def connection_columns(
7889 self,
7890 # Name of connection
7891 connection_name: str,
7892 # For dialects that support multiple databases, optionally identify which to use
7893 database: Optional[str] = None,
7894 # Name of schema to use.
7895 schema_name: Optional[str] = None,
7896 # True to fetch from cache, false to load fresh
7897 cache: Optional[bool] = None,
7898 # limits the tables per schema returned
7899 table_limit: Optional[int] = None,
7900 # only fetch columns for a given (comma-separated) list of tables
7901 table_names: Optional[str] = None,
7902 # Requested fields.
7903 fields: Optional[str] = None,
7904 transport_options: Optional[transport.TransportOptions] = None,
7905 ) -> Sequence[mdls.SchemaColumns]:
7906 """Get columns for a connection"""
7907 connection_name = self.encode_path_param(connection_name)
7908 response = cast(
7909 Sequence[mdls.SchemaColumns],
7910 self.get(
7911 path=f"/connections/{connection_name}/columns",
7912 structure=Sequence[mdls.SchemaColumns],
7913 query_params={
7914 "database": database,
7915 "schema_name": schema_name,
7916 "cache": cache,
7917 "table_limit": table_limit,
7918 "table_names": table_names,
7919 "fields": fields,
7920 },
7921 transport_options=transport_options,
7922 ),
7923 )
7924 return response
7925
7926 # ### Search a connection for columns matching the specified name
7927 #
7928 # **Note**: `column_name` must be a valid column name. It is not a search pattern.
7929 #
7930 # GET /connections/{connection_name}/search_columns -> Sequence[mdls.ColumnSearch]
7931 def connection_search_columns(
7932 self,
7933 # Name of connection
7934 connection_name: str,
7935 # Column name to find
7936 column_name: Optional[str] = None,
7937 # Requested fields.
7938 fields: Optional[str] = None,
7939 transport_options: Optional[transport.TransportOptions] = None,
7940 ) -> Sequence[mdls.ColumnSearch]:
7941 """Search a connection for columns"""
7942 connection_name = self.encode_path_param(connection_name)
7943 response = cast(
7944 Sequence[mdls.ColumnSearch],
7945 self.get(
7946 path=f"/connections/{connection_name}/search_columns",
7947 structure=Sequence[mdls.ColumnSearch],
7948 query_params={"column_name": column_name, "fields": fields},
7949 transport_options=transport_options,
7950 ),
7951 )
7952 return response
7953
7954 # ### Connection cost estimating
7955 #
7956 # Assign a `sql` statement to the body of the request. e.g., for Ruby, `{sql: 'select * from users'}`
7957 #
7958 # **Note**: If the connection's dialect has no support for cost estimates, an error will be returned
7959 #
7960 # POST /connections/{connection_name}/cost_estimate -> mdls.CostEstimate
7961 def connection_cost_estimate(
7962 self,
7963 # Name of connection
7964 connection_name: str,
7965 # WARNING: no writeable properties found for POST, PUT, or PATCH
7966 body: mdls.CreateCostEstimate,
7967 # Requested fields.
7968 fields: Optional[str] = None,
7969 transport_options: Optional[transport.TransportOptions] = None,
7970 ) -> mdls.CostEstimate:
7971 """Estimate costs for a connection"""
7972 connection_name = self.encode_path_param(connection_name)
7973 response = cast(
7974 mdls.CostEstimate,
7975 self.post(
7976 path=f"/connections/{connection_name}/cost_estimate",
7977 structure=mdls.CostEstimate,
7978 query_params={"fields": fields},
7979 body=body,
7980 transport_options=transport_options,
7981 ),
7982 )
7983 return response
7984
7985 # endregion
7986
7987 # region Project: Manage Projects
7988
7989 # ### Generate Lockfile for All LookML Dependencies
7990 #
7991 # Git must have been configured, must be in dev mode and deploy permission required
7992 #
7993 # Install_all is a two step process
7994 # 1. For each remote_dependency in a project the dependency manager will resolve any ambiguous ref.
7995 # 2. The project will then write out a lockfile including each remote_dependency with its resolved ref.
7996 #
7997 # POST /projects/{project_id}/manifest/lock_all -> str
7998 def lock_all(
7999 self,
8000 # Id of project
8001 project_id: str,
8002 # Requested fields
8003 fields: Optional[str] = None,
8004 transport_options: Optional[transport.TransportOptions] = None,
8005 ) -> str:
8006 """Lock All"""
8007 project_id = self.encode_path_param(project_id)
8008 response = cast(
8009 str,
8010 self.post(
8011 path=f"/projects/{project_id}/manifest/lock_all",
8012 structure=str,
8013 query_params={"fields": fields},
8014 transport_options=transport_options,
8015 ),
8016 )
8017 return response
8018
8019 # ### Get All Git Branches
8020 #
8021 # Returns a list of git branches in the project repository
8022 #
8023 # GET /projects/{project_id}/git_branches -> Sequence[mdls.GitBranch]
8024 def all_git_branches(
8025 self,
8026 # Project Id
8027 project_id: str,
8028 transport_options: Optional[transport.TransportOptions] = None,
8029 ) -> Sequence[mdls.GitBranch]:
8030 """Get All Git Branches"""
8031 project_id = self.encode_path_param(project_id)
8032 response = cast(
8033 Sequence[mdls.GitBranch],
8034 self.get(
8035 path=f"/projects/{project_id}/git_branches",
8036 structure=Sequence[mdls.GitBranch],
8037 transport_options=transport_options,
8038 ),
8039 )
8040 return response
8041
8042 # ### Get the Current Git Branch
8043 #
8044 # Returns the git branch currently checked out in the given project repository
8045 #
8046 # GET /projects/{project_id}/git_branch -> mdls.GitBranch
8047 def git_branch(
8048 self,
8049 # Project Id
8050 project_id: str,
8051 transport_options: Optional[transport.TransportOptions] = None,
8052 ) -> mdls.GitBranch:
8053 """Get Active Git Branch"""
8054 project_id = self.encode_path_param(project_id)
8055 response = cast(
8056 mdls.GitBranch,
8057 self.get(
8058 path=f"/projects/{project_id}/git_branch",
8059 structure=mdls.GitBranch,
8060 transport_options=transport_options,
8061 ),
8062 )
8063 return response
8064
8065 # ### Checkout and/or reset --hard an existing Git Branch
8066 #
8067 # Only allowed in development mode
8068 # - Call `update_session` to select the 'dev' workspace.
8069 #
8070 # Checkout an existing branch if name field is different from the name of the currently checked out branch.
8071 #
8072 # Optionally specify a branch name, tag name or commit SHA to which the branch should be reset.
8073 # **DANGER** hard reset will be force pushed to the remote. Unsaved changes and commits may be permanently lost.
8074 #
8075 # PUT /projects/{project_id}/git_branch -> mdls.GitBranch
8076 def update_git_branch(
8077 self,
8078 # Project Id
8079 project_id: str,
8080 body: mdls.WriteGitBranch,
8081 transport_options: Optional[transport.TransportOptions] = None,
8082 ) -> mdls.GitBranch:
8083 """Update Project Git Branch"""
8084 project_id = self.encode_path_param(project_id)
8085 response = cast(
8086 mdls.GitBranch,
8087 self.put(
8088 path=f"/projects/{project_id}/git_branch",
8089 structure=mdls.GitBranch,
8090 body=body,
8091 transport_options=transport_options,
8092 ),
8093 )
8094 return response
8095
8096 # ### Create and Checkout a Git Branch
8097 #
8098 # Creates and checks out a new branch in the given project repository
8099 # Only allowed in development mode
8100 # - Call `update_session` to select the 'dev' workspace.
8101 #
8102 # Optionally specify a branch name, tag name or commit SHA as the start point in the ref field.
8103 # If no ref is specified, HEAD of the current branch will be used as the start point for the new branch.
8104 #
8105 # POST /projects/{project_id}/git_branch -> mdls.GitBranch
8106 def create_git_branch(
8107 self,
8108 # Project Id
8109 project_id: str,
8110 body: mdls.WriteGitBranch,
8111 transport_options: Optional[transport.TransportOptions] = None,
8112 ) -> mdls.GitBranch:
8113 """Checkout New Git Branch"""
8114 project_id = self.encode_path_param(project_id)
8115 response = cast(
8116 mdls.GitBranch,
8117 self.post(
8118 path=f"/projects/{project_id}/git_branch",
8119 structure=mdls.GitBranch,
8120 body=body,
8121 transport_options=transport_options,
8122 ),
8123 )
8124 return response
8125
8126 # ### Get the specified Git Branch
8127 #
8128 # Returns the git branch specified in branch_name path param if it exists in the given project repository
8129 #
8130 # GET /projects/{project_id}/git_branch/{branch_name} -> mdls.GitBranch
8131 def find_git_branch(
8132 self,
8133 # Project Id
8134 project_id: str,
8135 # Branch Name
8136 branch_name: str,
8137 transport_options: Optional[transport.TransportOptions] = None,
8138 ) -> mdls.GitBranch:
8139 """Find a Git Branch"""
8140 project_id = self.encode_path_param(project_id)
8141 branch_name = self.encode_path_param(branch_name)
8142 response = cast(
8143 mdls.GitBranch,
8144 self.get(
8145 path=f"/projects/{project_id}/git_branch/{branch_name}",
8146 structure=mdls.GitBranch,
8147 transport_options=transport_options,
8148 ),
8149 )
8150 return response
8151
8152 # ### Delete the specified Git Branch
8153 #
8154 # Delete git branch specified in branch_name path param from local and remote of specified project repository
8155 #
8156 # DELETE /projects/{project_id}/git_branch/{branch_name} -> str
8157 def delete_git_branch(
8158 self,
8159 # Project Id
8160 project_id: str,
8161 # Branch Name
8162 branch_name: str,
8163 transport_options: Optional[transport.TransportOptions] = None,
8164 ) -> str:
8165 """Delete a Git Branch"""
8166 project_id = self.encode_path_param(project_id)
8167 branch_name = self.encode_path_param(branch_name)
8168 response = cast(
8169 str,
8170 self.delete(
8171 path=f"/projects/{project_id}/git_branch/{branch_name}",
8172 structure=str,
8173 transport_options=transport_options,
8174 ),
8175 )
8176 return response
8177
8178 # ### Deploy a Remote Branch or Ref to Production
8179 #
8180 # Git must have been configured and deploy permission required.
8181 #
8182 # Deploy is a one/two step process
8183 # 1. If this is the first deploy of this project, create the production project with git repository.
8184 # 2. Pull the branch or ref into the production project.
8185 #
8186 # Can only specify either a branch or a ref.
8187 #
8188 # POST /projects/{project_id}/deploy_ref_to_production -> str
8189 def deploy_ref_to_production(
8190 self,
8191 # Id of project
8192 project_id: str,
8193 # Branch to deploy to production
8194 branch: Optional[str] = None,
8195 # Ref to deploy to production
8196 ref: Optional[str] = None,
8197 transport_options: Optional[transport.TransportOptions] = None,
8198 ) -> str:
8199 """Deploy Remote Branch or Ref to Production"""
8200 project_id = self.encode_path_param(project_id)
8201 response = cast(
8202 str,
8203 self.post(
8204 path=f"/projects/{project_id}/deploy_ref_to_production",
8205 structure=str,
8206 query_params={"branch": branch, "ref": ref},
8207 transport_options=transport_options,
8208 ),
8209 )
8210 return response
8211
8212 # ### Deploy LookML from this Development Mode Project to Production
8213 #
8214 # Git must have been configured, must be in dev mode and deploy permission required
8215 #
8216 # Deploy is a two / three step process:
8217 #
8218 # 1. Push commits in current branch of dev mode project to the production branch (origin/master).
8219 # Note a. This step is skipped in read-only projects.
8220 # Note b. If this step is unsuccessful for any reason (e.g. rejected non-fastforward because production branch has
8221 # commits not in current branch), subsequent steps will be skipped.
8222 # 2. If this is the first deploy of this project, create the production project with git repository.
8223 # 3. Pull the production branch into the production project.
8224 #
8225 # POST /projects/{project_id}/deploy_to_production -> str
8226 def deploy_to_production(
8227 self,
8228 # Id of project
8229 project_id: str,
8230 transport_options: Optional[transport.TransportOptions] = None,
8231 ) -> str:
8232 """Deploy To Production"""
8233 project_id = self.encode_path_param(project_id)
8234 response = cast(
8235 str,
8236 self.post(
8237 path=f"/projects/{project_id}/deploy_to_production",
8238 structure=str,
8239 transport_options=transport_options,
8240 ),
8241 )
8242 return response
8243
8244 # ### Reset a project to the revision of the project that is in production.
8245 #
8246 # **DANGER** this will delete any changes that have not been pushed to a remote repository.
8247 #
8248 # POST /projects/{project_id}/reset_to_production -> str
8249 def reset_project_to_production(
8250 self,
8251 # Id of project
8252 project_id: str,
8253 transport_options: Optional[transport.TransportOptions] = None,
8254 ) -> str:
8255 """Reset To Production"""
8256 project_id = self.encode_path_param(project_id)
8257 response = cast(
8258 str,
8259 self.post(
8260 path=f"/projects/{project_id}/reset_to_production",
8261 structure=str,
8262 transport_options=transport_options,
8263 ),
8264 )
8265 return response
8266
8267 # ### Reset a project development branch to the revision of the project that is on the remote.
8268 #
8269 # **DANGER** this will delete any changes that have not been pushed to a remote repository.
8270 #
8271 # POST /projects/{project_id}/reset_to_remote -> str
8272 def reset_project_to_remote(
8273 self,
8274 # Id of project
8275 project_id: str,
8276 transport_options: Optional[transport.TransportOptions] = None,
8277 ) -> str:
8278 """Reset To Remote"""
8279 project_id = self.encode_path_param(project_id)
8280 response = cast(
8281 str,
8282 self.post(
8283 path=f"/projects/{project_id}/reset_to_remote",
8284 structure=str,
8285 transport_options=transport_options,
8286 ),
8287 )
8288 return response
8289
8290 # ### Get All Projects
8291 #
8292 # Returns all projects visible to the current user
8293 #
8294 # GET /projects -> Sequence[mdls.Project]
8295 def all_projects(
8296 self,
8297 # Requested fields
8298 fields: Optional[str] = None,
8299 transport_options: Optional[transport.TransportOptions] = None,
8300 ) -> Sequence[mdls.Project]:
8301 """Get All Projects"""
8302 response = cast(
8303 Sequence[mdls.Project],
8304 self.get(
8305 path="/projects",
8306 structure=Sequence[mdls.Project],
8307 query_params={"fields": fields},
8308 transport_options=transport_options,
8309 ),
8310 )
8311 return response
8312
8313 # ### Create A Project
8314 #
8315 # dev mode required.
8316 # - Call `update_session` to select the 'dev' workspace.
8317 #
8318 # `name` is required.
8319 # `git_remote_url` is not allowed. To configure Git for the newly created project, follow the instructions in `update_project`.
8320 #
8321 # POST /projects -> mdls.Project
8322 def create_project(
8323 self,
8324 body: mdls.WriteProject,
8325 transport_options: Optional[transport.TransportOptions] = None,
8326 ) -> mdls.Project:
8327 """Create Project"""
8328 response = cast(
8329 mdls.Project,
8330 self.post(
8331 path="/projects",
8332 structure=mdls.Project,
8333 body=body,
8334 transport_options=transport_options,
8335 ),
8336 )
8337 return response
8338
8339 # ### Get A Project
8340 #
8341 # Returns the project with the given project id
8342 #
8343 # GET /projects/{project_id} -> mdls.Project
8344 def project(
8345 self,
8346 # Project Id
8347 project_id: str,
8348 # Requested fields
8349 fields: Optional[str] = None,
8350 transport_options: Optional[transport.TransportOptions] = None,
8351 ) -> mdls.Project:
8352 """Get Project"""
8353 project_id = self.encode_path_param(project_id)
8354 response = cast(
8355 mdls.Project,
8356 self.get(
8357 path=f"/projects/{project_id}",
8358 structure=mdls.Project,
8359 query_params={"fields": fields},
8360 transport_options=transport_options,
8361 ),
8362 )
8363 return response
8364
8365 # ### Update Project Configuration
8366 #
8367 # Apply changes to a project's configuration.
8368 #
8369 #
8370 # #### Configuring Git for a Project
8371 #
8372 # To set up a Looker project with a remote git repository, follow these steps:
8373 #
8374 # 1. Call `update_session` to select the 'dev' workspace.
8375 # 1. Call `create_git_deploy_key` to create a new deploy key for the project
8376 # 1. Copy the deploy key text into the remote git repository's ssh key configuration
8377 # 1. Call `update_project` to set project's `git_remote_url` ()and `git_service_name`, if necessary).
8378 #
8379 # When you modify a project's `git_remote_url`, Looker connects to the remote repository to fetch
8380 # metadata. The remote git repository MUST be configured with the Looker-generated deploy
8381 # key for this project prior to setting the project's `git_remote_url`.
8382 #
8383 # To set up a Looker project with a git repository residing on the Looker server (a 'bare' git repo):
8384 #
8385 # 1. Call `update_session` to select the 'dev' workspace.
8386 # 1. Call `update_project` setting `git_remote_url` to null and `git_service_name` to "bare".
8387 #
8388 # PATCH /projects/{project_id} -> mdls.Project
8389 def update_project(
8390 self,
8391 # Project Id
8392 project_id: str,
8393 body: mdls.WriteProject,
8394 # Requested fields
8395 fields: Optional[str] = None,
8396 transport_options: Optional[transport.TransportOptions] = None,
8397 ) -> mdls.Project:
8398 """Update Project"""
8399 project_id = self.encode_path_param(project_id)
8400 response = cast(
8401 mdls.Project,
8402 self.patch(
8403 path=f"/projects/{project_id}",
8404 structure=mdls.Project,
8405 query_params={"fields": fields},
8406 body=body,
8407 transport_options=transport_options,
8408 ),
8409 )
8410 return response
8411
8412 # ### Get A Projects Manifest object
8413 #
8414 # Returns the project with the given project id
8415 #
8416 # GET /projects/{project_id}/manifest -> mdls.Manifest
8417 def manifest(
8418 self,
8419 # Project Id
8420 project_id: str,
8421 transport_options: Optional[transport.TransportOptions] = None,
8422 ) -> mdls.Manifest:
8423 """Get Manifest"""
8424 project_id = self.encode_path_param(project_id)
8425 response = cast(
8426 mdls.Manifest,
8427 self.get(
8428 path=f"/projects/{project_id}/manifest",
8429 structure=mdls.Manifest,
8430 transport_options=transport_options,
8431 ),
8432 )
8433 return response
8434
8435 # ### Git Deploy Key
8436 #
8437 # Returns the ssh public key previously created for a project's git repository.
8438 #
8439 # GET /projects/{project_id}/git/deploy_key -> str
8440 def git_deploy_key(
8441 self,
8442 # Project Id
8443 project_id: str,
8444 transport_options: Optional[transport.TransportOptions] = None,
8445 ) -> str:
8446 """Git Deploy Key"""
8447 project_id = self.encode_path_param(project_id)
8448 response = cast(
8449 str,
8450 self.get(
8451 path=f"/projects/{project_id}/git/deploy_key",
8452 structure=str,
8453 transport_options=transport_options,
8454 ),
8455 )
8456 return response
8457
8458 # ### Create Git Deploy Key
8459 #
8460 # Create a public/private key pair for authenticating ssh git requests from Looker to a remote git repository
8461 # for a particular Looker project.
8462 #
8463 # Returns the public key of the generated ssh key pair.
8464 #
8465 # Copy this public key to your remote git repository's ssh keys configuration so that the remote git service can
8466 # validate and accept git requests from the Looker server.
8467 #
8468 # POST /projects/{project_id}/git/deploy_key -> str
8469 def create_git_deploy_key(
8470 self,
8471 # Project Id
8472 project_id: str,
8473 transport_options: Optional[transport.TransportOptions] = None,
8474 ) -> str:
8475 """Create Deploy Key"""
8476 project_id = self.encode_path_param(project_id)
8477 response = cast(
8478 str,
8479 self.post(
8480 path=f"/projects/{project_id}/git/deploy_key",
8481 structure=str,
8482 transport_options=transport_options,
8483 ),
8484 )
8485 return response
8486
8487 # ### Get Cached Project Validation Results
8488 #
8489 # Returns the cached results of a previous project validation calculation, if any.
8490 # Returns http status 204 No Content if no validation results exist.
8491 #
8492 # Validating the content of all the files in a project can be computationally intensive
8493 # for large projects. Use this API to simply fetch the results of the most recent
8494 # project validation rather than revalidating the entire project from scratch.
8495 #
8496 # A value of `"stale": true` in the response indicates that the project has changed since
8497 # the cached validation results were computed. The cached validation results may no longer
8498 # reflect the current state of the project.
8499 #
8500 # GET /projects/{project_id}/validate -> mdls.ProjectValidationCache
8501 def project_validation_results(
8502 self,
8503 # Project Id
8504 project_id: str,
8505 # Requested fields
8506 fields: Optional[str] = None,
8507 transport_options: Optional[transport.TransportOptions] = None,
8508 ) -> mdls.ProjectValidationCache:
8509 """Cached Project Validation Results"""
8510 project_id = self.encode_path_param(project_id)
8511 response = cast(
8512 mdls.ProjectValidationCache,
8513 self.get(
8514 path=f"/projects/{project_id}/validate",
8515 structure=mdls.ProjectValidationCache,
8516 query_params={"fields": fields},
8517 transport_options=transport_options,
8518 ),
8519 )
8520 return response
8521
8522 # ### Validate Project
8523 #
8524 # Performs lint validation of all lookml files in the project.
8525 # Returns a list of errors found, if any.
8526 #
8527 # Validating the content of all the files in a project can be computationally intensive
8528 # for large projects. For best performance, call `validate_project(project_id)` only
8529 # when you really want to recompute project validation. To quickly display the results of
8530 # the most recent project validation (without recomputing), use `project_validation_results(project_id)`
8531 #
8532 # POST /projects/{project_id}/validate -> mdls.ProjectValidation
8533 def validate_project(
8534 self,
8535 # Project Id
8536 project_id: str,
8537 # Requested fields
8538 fields: Optional[str] = None,
8539 transport_options: Optional[transport.TransportOptions] = None,
8540 ) -> mdls.ProjectValidation:
8541 """Validate Project"""
8542 project_id = self.encode_path_param(project_id)
8543 response = cast(
8544 mdls.ProjectValidation,
8545 self.post(
8546 path=f"/projects/{project_id}/validate",
8547 structure=mdls.ProjectValidation,
8548 query_params={"fields": fields},
8549 transport_options=transport_options,
8550 ),
8551 )
8552 return response
8553
8554 # ### Get Project Workspace
8555 #
8556 # Returns information about the state of the project files in the currently selected workspace
8557 #
8558 # GET /projects/{project_id}/current_workspace -> mdls.ProjectWorkspace
8559 def project_workspace(
8560 self,
8561 # Project Id
8562 project_id: str,
8563 # Requested fields
8564 fields: Optional[str] = None,
8565 transport_options: Optional[transport.TransportOptions] = None,
8566 ) -> mdls.ProjectWorkspace:
8567 """Get Project Workspace"""
8568 project_id = self.encode_path_param(project_id)
8569 response = cast(
8570 mdls.ProjectWorkspace,
8571 self.get(
8572 path=f"/projects/{project_id}/current_workspace",
8573 structure=mdls.ProjectWorkspace,
8574 query_params={"fields": fields},
8575 transport_options=transport_options,
8576 ),
8577 )
8578 return response
8579
8580 # ### Get All Project Files
8581 #
8582 # Returns a list of the files in the project
8583 #
8584 # GET /projects/{project_id}/files -> Sequence[mdls.ProjectFile]
8585 def all_project_files(
8586 self,
8587 # Project Id
8588 project_id: str,
8589 # Requested fields
8590 fields: Optional[str] = None,
8591 transport_options: Optional[transport.TransportOptions] = None,
8592 ) -> Sequence[mdls.ProjectFile]:
8593 """Get All Project Files"""
8594 project_id = self.encode_path_param(project_id)
8595 response = cast(
8596 Sequence[mdls.ProjectFile],
8597 self.get(
8598 path=f"/projects/{project_id}/files",
8599 structure=Sequence[mdls.ProjectFile],
8600 query_params={"fields": fields},
8601 transport_options=transport_options,
8602 ),
8603 )
8604 return response
8605
8606 # ### Get Project File Info
8607 #
8608 # Returns information about a file in the project
8609 #
8610 # GET /projects/{project_id}/files/file -> mdls.ProjectFile
8611 def project_file(
8612 self,
8613 # Project Id
8614 project_id: str,
8615 # File Id
8616 file_id: str,
8617 # Requested fields
8618 fields: Optional[str] = None,
8619 transport_options: Optional[transport.TransportOptions] = None,
8620 ) -> mdls.ProjectFile:
8621 """Get Project File"""
8622 project_id = self.encode_path_param(project_id)
8623 response = cast(
8624 mdls.ProjectFile,
8625 self.get(
8626 path=f"/projects/{project_id}/files/file",
8627 structure=mdls.ProjectFile,
8628 query_params={"file_id": file_id, "fields": fields},
8629 transport_options=transport_options,
8630 ),
8631 )
8632 return response
8633
8634 # ### Get All Git Connection Tests
8635 #
8636 # dev mode required.
8637 # - Call `update_session` to select the 'dev' workspace.
8638 #
8639 # Returns a list of tests which can be run against a project's (or the dependency project for the provided remote_url) git connection. Call [Run Git Connection Test](#!/Project/run_git_connection_test) to execute each test in sequence.
8640 #
8641 # Tests are ordered by increasing specificity. Tests should be run in the order returned because later tests require functionality tested by tests earlier in the test list.
8642 #
8643 # For example, a late-stage test for write access is meaningless if connecting to the git server (an early test) is failing.
8644 #
8645 # GET /projects/{project_id}/git_connection_tests -> Sequence[mdls.GitConnectionTest]
8646 def all_git_connection_tests(
8647 self,
8648 # Project Id
8649 project_id: str,
8650 # (Optional: leave blank for root project) The remote url for remote dependency to test.
8651 remote_url: Optional[str] = None,
8652 transport_options: Optional[transport.TransportOptions] = None,
8653 ) -> Sequence[mdls.GitConnectionTest]:
8654 """Get All Git Connection Tests"""
8655 project_id = self.encode_path_param(project_id)
8656 response = cast(
8657 Sequence[mdls.GitConnectionTest],
8658 self.get(
8659 path=f"/projects/{project_id}/git_connection_tests",
8660 structure=Sequence[mdls.GitConnectionTest],
8661 query_params={"remote_url": remote_url},
8662 transport_options=transport_options,
8663 ),
8664 )
8665 return response
8666
8667 # ### Run a git connection test
8668 #
8669 # Run the named test on the git service used by this project (or the dependency project for the provided remote_url) and return the result. This
8670 # is intended to help debug git connections when things do not work properly, to give
8671 # more helpful information about why a git url is not working with Looker.
8672 #
8673 # Tests should be run in the order they are returned by [Get All Git Connection Tests](#!/Project/all_git_connection_tests).
8674 #
8675 # GET /projects/{project_id}/git_connection_tests/{test_id} -> mdls.GitConnectionTestResult
8676 def run_git_connection_test(
8677 self,
8678 # Project Id
8679 project_id: str,
8680 # Test Id
8681 test_id: str,
8682 # (Optional: leave blank for root project) The remote url for remote dependency to test.
8683 remote_url: Optional[str] = None,
8684 # (Optional: leave blank for dev credentials) Whether to use git production credentials.
8685 use_production: Optional[str] = None,
8686 transport_options: Optional[transport.TransportOptions] = None,
8687 ) -> mdls.GitConnectionTestResult:
8688 """Run Git Connection Test"""
8689 project_id = self.encode_path_param(project_id)
8690 test_id = self.encode_path_param(test_id)
8691 response = cast(
8692 mdls.GitConnectionTestResult,
8693 self.get(
8694 path=f"/projects/{project_id}/git_connection_tests/{test_id}",
8695 structure=mdls.GitConnectionTestResult,
8696 query_params={
8697 "remote_url": remote_url,
8698 "use_production": use_production,
8699 },
8700 transport_options=transport_options,
8701 ),
8702 )
8703 return response
8704
8705 # ### Get All LookML Tests
8706 #
8707 # Returns a list of tests which can be run to validate a project's LookML code and/or the underlying data,
8708 # optionally filtered by the file id.
8709 # Call [Run LookML Test](#!/Project/run_lookml_test) to execute tests.
8710 #
8711 # GET /projects/{project_id}/lookml_tests -> Sequence[mdls.LookmlTest]
8712 def all_lookml_tests(
8713 self,
8714 # Project Id
8715 project_id: str,
8716 # File Id
8717 file_id: Optional[str] = None,
8718 transport_options: Optional[transport.TransportOptions] = None,
8719 ) -> Sequence[mdls.LookmlTest]:
8720 """Get All LookML Tests"""
8721 project_id = self.encode_path_param(project_id)
8722 response = cast(
8723 Sequence[mdls.LookmlTest],
8724 self.get(
8725 path=f"/projects/{project_id}/lookml_tests",
8726 structure=Sequence[mdls.LookmlTest],
8727 query_params={"file_id": file_id},
8728 transport_options=transport_options,
8729 ),
8730 )
8731 return response
8732
8733 # ### Run LookML Tests
8734 #
8735 # Runs all tests in the project, optionally filtered by file, test, and/or model.
8736 #
8737 # GET /projects/{project_id}/lookml_tests/run -> Sequence[mdls.LookmlTestResult]
8738 def run_lookml_test(
8739 self,
8740 # Project Id
8741 project_id: str,
8742 # File Name
8743 file_id: Optional[str] = None,
8744 # Test Name
8745 test: Optional[str] = None,
8746 # Model Name
8747 model: Optional[str] = None,
8748 transport_options: Optional[transport.TransportOptions] = None,
8749 ) -> Sequence[mdls.LookmlTestResult]:
8750 """Run LookML Test"""
8751 project_id = self.encode_path_param(project_id)
8752 response = cast(
8753 Sequence[mdls.LookmlTestResult],
8754 self.get(
8755 path=f"/projects/{project_id}/lookml_tests/run",
8756 structure=Sequence[mdls.LookmlTestResult],
8757 query_params={"file_id": file_id, "test": test, "model": model},
8758 transport_options=transport_options,
8759 ),
8760 )
8761 return response
8762
8763 # ### Creates a tag for the most recent commit, or a specific ref is a SHA is provided
8764 #
8765 # POST /projects/{project_id}/tag -> mdls.Project
8766 def tag_ref(
8767 self,
8768 # Project Id
8769 project_id: str,
8770 body: mdls.WriteProject,
8771 # (Optional): Commit Sha to Tag
8772 commit_sha: Optional[str] = None,
8773 # Tag Name
8774 tag_name: Optional[str] = None,
8775 # (Optional): Tag Message
8776 tag_message: Optional[str] = None,
8777 transport_options: Optional[transport.TransportOptions] = None,
8778 ) -> mdls.Project:
8779 """Tag Ref"""
8780 project_id = self.encode_path_param(project_id)
8781 response = cast(
8782 mdls.Project,
8783 self.post(
8784 path=f"/projects/{project_id}/tag",
8785 structure=mdls.Project,
8786 query_params={
8787 "commit_sha": commit_sha,
8788 "tag_name": tag_name,
8789 "tag_message": tag_message,
8790 },
8791 body=body,
8792 transport_options=transport_options,
8793 ),
8794 )
8795 return response
8796
8797 # ### Fetches a CI Run.
8798 #
8799 # GET /projects/{project_id}/ci/runs/{run_id} -> mdls.ProjectCIRun
8800 def get_ci_run(
8801 self,
8802 # Project Id
8803 project_id: str,
8804 # Run Id
8805 run_id: str,
8806 # Requested fields
8807 fields: Optional[str] = None,
8808 transport_options: Optional[transport.TransportOptions] = None,
8809 ) -> mdls.ProjectCIRun:
8810 """Fetch Continuous Integration run"""
8811 project_id = self.encode_path_param(project_id)
8812 run_id = self.encode_path_param(run_id)
8813 response = cast(
8814 mdls.ProjectCIRun,
8815 self.get(
8816 path=f"/projects/{project_id}/ci/runs/{run_id}",
8817 structure=mdls.ProjectCIRun,
8818 query_params={"fields": fields},
8819 transport_options=transport_options,
8820 ),
8821 )
8822 return response
8823
8824 # ### Creates a CI Run.
8825 #
8826 # POST /projects/{project_id}/ci/run -> mdls.CreateCIRunResponse
8827 def create_ci_run(
8828 self,
8829 # Project Id
8830 project_id: str,
8831 body: mdls.CreateCIRunRequest,
8832 # Requested fields
8833 fields: Optional[str] = None,
8834 transport_options: Optional[transport.TransportOptions] = None,
8835 ) -> mdls.CreateCIRunResponse:
8836 """Create a Continuous Integration run"""
8837 project_id = self.encode_path_param(project_id)
8838 response = cast(
8839 mdls.CreateCIRunResponse,
8840 self.post(
8841 path=f"/projects/{project_id}/ci/run",
8842 structure=mdls.CreateCIRunResponse,
8843 query_params={"fields": fields},
8844 body=body,
8845 transport_options=transport_options,
8846 ),
8847 )
8848 return response
8849
8850 # ### Configure Repository Credential for a remote dependency
8851 #
8852 # Admin required.
8853 #
8854 # `root_project_id` is required.
8855 # `credential_id` is required.
8856 #
8857 # PUT /projects/{root_project_id}/credential/{credential_id} -> mdls.RepositoryCredential
8858 def update_repository_credential(
8859 self,
8860 # Root Project Id
8861 root_project_id: str,
8862 # Credential Id
8863 credential_id: str,
8864 body: mdls.WriteRepositoryCredential,
8865 transport_options: Optional[transport.TransportOptions] = None,
8866 ) -> mdls.RepositoryCredential:
8867 """Create Repository Credential"""
8868 root_project_id = self.encode_path_param(root_project_id)
8869 credential_id = self.encode_path_param(credential_id)
8870 response = cast(
8871 mdls.RepositoryCredential,
8872 self.put(
8873 path=f"/projects/{root_project_id}/credential/{credential_id}",
8874 structure=mdls.RepositoryCredential,
8875 body=body,
8876 transport_options=transport_options,
8877 ),
8878 )
8879 return response
8880
8881 # ### Repository Credential for a remote dependency
8882 #
8883 # Admin required.
8884 #
8885 # `root_project_id` is required.
8886 # `credential_id` is required.
8887 #
8888 # DELETE /projects/{root_project_id}/credential/{credential_id} -> str
8889 def delete_repository_credential(
8890 self,
8891 # Root Project Id
8892 root_project_id: str,
8893 # Credential Id
8894 credential_id: str,
8895 transport_options: Optional[transport.TransportOptions] = None,
8896 ) -> str:
8897 """Delete Repository Credential"""
8898 root_project_id = self.encode_path_param(root_project_id)
8899 credential_id = self.encode_path_param(credential_id)
8900 response = cast(
8901 str,
8902 self.delete(
8903 path=f"/projects/{root_project_id}/credential/{credential_id}",
8904 structure=str,
8905 transport_options=transport_options,
8906 ),
8907 )
8908 return response
8909
8910 # ### Get all Repository Credentials for a project
8911 #
8912 # `root_project_id` is required.
8913 #
8914 # GET /projects/{root_project_id}/credentials -> Sequence[mdls.RepositoryCredential]
8915 def get_all_repository_credentials(
8916 self,
8917 # Root Project Id
8918 root_project_id: str,
8919 transport_options: Optional[transport.TransportOptions] = None,
8920 ) -> Sequence[mdls.RepositoryCredential]:
8921 """Get All Repository Credentials"""
8922 root_project_id = self.encode_path_param(root_project_id)
8923 response = cast(
8924 Sequence[mdls.RepositoryCredential],
8925 self.get(
8926 path=f"/projects/{root_project_id}/credentials",
8927 structure=Sequence[mdls.RepositoryCredential],
8928 transport_options=transport_options,
8929 ),
8930 )
8931 return response
8932
8933 # endregion
8934
8935 # region Query: Run and Manage Queries
8936
8937 # ### Create an async query task
8938 #
8939 # Creates a query task (job) to run a previously created query asynchronously. Returns a Query Task ID.
8940 #
8941 # Use [query_task(query_task_id)](#!/Query/query_task) to check the execution status of the query task.
8942 # After the query task status reaches "Complete", use [query_task_results(query_task_id)](#!/Query/query_task_results) to fetch the results of the query.
8943 #
8944 # POST /query_tasks -> mdls.QueryTask
8945 def create_query_task(
8946 self,
8947 body: mdls.WriteCreateQueryTask,
8948 # Row limit (may override the limit in the saved query).
8949 limit: Optional[int] = None,
8950 # Apply model-specified formatting to each result.
8951 apply_formatting: Optional[bool] = None,
8952 # Apply visualization options to results.
8953 apply_vis: Optional[bool] = None,
8954 # Get results from cache if available.
8955 cache: Optional[bool] = None,
8956 # Generate drill links (only applicable to 'json_detail' format.
8957 generate_drill_links: Optional[bool] = None,
8958 # Force use of production models even if the user is in development mode. Note that this flag being false does not guarantee development models will be used.
8959 force_production: Optional[bool] = None,
8960 # Retrieve any results from cache even if the results have expired.
8961 cache_only: Optional[bool] = None,
8962 # Prefix to use for drill links (url encoded).
8963 path_prefix: Optional[str] = None,
8964 # Rebuild PDTS used in query.
8965 rebuild_pdts: Optional[bool] = None,
8966 # Perform table calculations on query results
8967 server_table_calcs: Optional[bool] = None,
8968 # Requested fields
8969 fields: Optional[str] = None,
8970 transport_options: Optional[transport.TransportOptions] = None,
8971 ) -> mdls.QueryTask:
8972 """Run Query Async"""
8973 response = cast(
8974 mdls.QueryTask,
8975 self.post(
8976 path="/query_tasks",
8977 structure=mdls.QueryTask,
8978 query_params={
8979 "limit": limit,
8980 "apply_formatting": apply_formatting,
8981 "apply_vis": apply_vis,
8982 "cache": cache,
8983 "generate_drill_links": generate_drill_links,
8984 "force_production": force_production,
8985 "cache_only": cache_only,
8986 "path_prefix": path_prefix,
8987 "rebuild_pdts": rebuild_pdts,
8988 "server_table_calcs": server_table_calcs,
8989 "fields": fields,
8990 },
8991 body=body,
8992 transport_options=transport_options,
8993 ),
8994 )
8995 return response
8996
8997 # ### Fetch results of multiple async queries
8998 #
8999 # Returns the results of multiple async queries in one request.
9000 #
9001 # For Query Tasks that are not completed, the response will include the execution status of the Query Task but will not include query results.
9002 # Query Tasks whose results have expired will have a status of 'expired'.
9003 # If the user making the API request does not have sufficient privileges to view a Query Task result, the result will have a status of 'missing'
9004 #
9005 # GET /query_tasks/multi_results -> MutableMapping[str, Any]
9006 def query_task_multi_results(
9007 self,
9008 # List of Query Task IDs
9009 query_task_ids: mdls.DelimSequence[str],
9010 transport_options: Optional[transport.TransportOptions] = None,
9011 ) -> MutableMapping[str, Any]:
9012 """Get Multiple Async Query Results"""
9013 response = cast(
9014 MutableMapping[str, Any],
9015 self.get(
9016 path="/query_tasks/multi_results",
9017 structure=MutableMapping[str, Any],
9018 query_params={"query_task_ids": query_task_ids},
9019 transport_options=transport_options,
9020 ),
9021 )
9022 return response
9023
9024 # ### Get Query Task details
9025 #
9026 # Use this function to check the status of an async query task. After the status
9027 # reaches "Complete", you can call [query_task_results(query_task_id)](#!/Query/query_task_results) to
9028 # retrieve the results of the query.
9029 #
9030 # Use [create_query_task()](#!/Query/create_query_task) to create an async query task.
9031 #
9032 # GET /query_tasks/{query_task_id} -> mdls.QueryTask
9033 def query_task(
9034 self,
9035 # ID of the Query Task
9036 query_task_id: str,
9037 # Requested fields.
9038 fields: Optional[str] = None,
9039 transport_options: Optional[transport.TransportOptions] = None,
9040 ) -> mdls.QueryTask:
9041 """Get Async Query Info"""
9042 query_task_id = self.encode_path_param(query_task_id)
9043 response = cast(
9044 mdls.QueryTask,
9045 self.get(
9046 path=f"/query_tasks/{query_task_id}",
9047 structure=mdls.QueryTask,
9048 query_params={"fields": fields},
9049 transport_options=transport_options,
9050 ),
9051 )
9052 return response
9053
9054 # ### Get Async Query Results
9055 #
9056 # Returns the results of an async query task if the query has completed.
9057 #
9058 # If the query task is still running or waiting to run, this function returns 202 Accepted.
9059 #
9060 # If the query task ID is invalid or the cached results of the query task have expired, this function returns 404 Not Found.
9061 #
9062 # Use [query_task(query_task_id)](#!/Query/query_task) to check the execution status of the query task
9063 # Call query_task_results only after the query task status reaches "Complete".
9064 #
9065 # You can also use [query_task_multi_results()](#!/Query/query_task_multi_results) retrieve the
9066 # results of multiple async query tasks at the same time.
9067 #
9068 # #### SQL Error Handling:
9069 # If the query fails due to a SQL db error, how this is communicated depends on the result_format you requested in `create_query_task()`.
9070 #
9071 # For `json_detail` result_format: `query_task_results()` will respond with HTTP status '200 OK' and db SQL error info
9072 # will be in the `errors` property of the response object. The 'data' property will be empty.
9073 #
9074 # For all other result formats: `query_task_results()` will respond with HTTP status `400 Bad Request` and some db SQL error info
9075 # will be in the message of the 400 error response, but not as detailed as expressed in `json_detail.errors`.
9076 # These data formats can only carry row data, and error info is not row data.
9077 #
9078 # GET /query_tasks/{query_task_id}/results -> str
9079 def query_task_results(
9080 self,
9081 # ID of the Query Task
9082 query_task_id: str,
9083 transport_options: Optional[transport.TransportOptions] = None,
9084 ) -> str:
9085 """Get Async Query Results"""
9086 query_task_id = self.encode_path_param(query_task_id)
9087 response = cast(
9088 str,
9089 self.get(
9090 path=f"/query_tasks/{query_task_id}/results",
9091 structure=str,
9092 transport_options=transport_options,
9093 ),
9094 )
9095 return response
9096
9097 # ### Get a previously created query by id.
9098 #
9099 # A Looker query object includes the various parameters that define a database query that has been run or
9100 # could be run in the future. These parameters include: model, view, fields, filters, pivots, etc.
9101 # Query *results* are not part of the query object.
9102 #
9103 # Query objects are unique and immutable. Query objects are created automatically in Looker as users explore data.
9104 # Looker does not delete them; they become part of the query history. When asked to create a query for
9105 # any given set of parameters, Looker will first try to find an existing query object with matching
9106 # parameters and will only create a new object when an appropriate object can not be found.
9107 #
9108 # This 'get' method is used to get the details about a query for a given id. See the other methods here
9109 # to 'create' and 'run' queries.
9110 #
9111 # Note that some fields like 'filter_config' and 'vis_config' etc are specific to how the Looker UI
9112 # builds queries and visualizations and are not generally useful for API use. They are not required when
9113 # creating new queries and can usually just be ignored.
9114 #
9115 # GET /queries/{query_id} -> mdls.Query
9116 def query(
9117 self,
9118 # Id of query
9119 query_id: str,
9120 # Requested fields.
9121 fields: Optional[str] = None,
9122 transport_options: Optional[transport.TransportOptions] = None,
9123 ) -> mdls.Query:
9124 """Get Query"""
9125 query_id = self.encode_path_param(query_id)
9126 response = cast(
9127 mdls.Query,
9128 self.get(
9129 path=f"/queries/{query_id}",
9130 structure=mdls.Query,
9131 query_params={"fields": fields},
9132 transport_options=transport_options,
9133 ),
9134 )
9135 return response
9136
9137 # ### Get the query for a given query slug.
9138 #
9139 # This returns the query for the 'slug' in a query share URL.
9140 #
9141 # The 'slug' is a randomly chosen short string that is used as an alternative to the query's id value
9142 # for use in URLs etc. This method exists as a convenience to help you use the API to 'find' queries that
9143 # have been created using the Looker UI.
9144 #
9145 # You can use the Looker explore page to build a query and then choose the 'Share' option to
9146 # show the share url for the query. Share urls generally look something like 'https://looker.yourcompany/x/vwGSbfc'.
9147 # The trailing 'vwGSbfc' is the share slug. You can pass that string to this api method to get details about the query.
9148 # Those details include the 'id' that you can use to run the query. Or, you can copy the query body
9149 # (perhaps with your own modification) and use that as the basis to make/run new queries.
9150 #
9151 # This will also work with slugs from Looker explore urls like
9152 # 'https://looker.yourcompany/explore/ecommerce/orders?qid=aogBgL6o3cKK1jN3RoZl5s'. In this case
9153 # 'aogBgL6o3cKK1jN3RoZl5s' is the slug.
9154 #
9155 # GET /queries/slug/{slug} -> mdls.Query
9156 def query_for_slug(
9157 self,
9158 # Slug of query
9159 slug: str,
9160 # Requested fields.
9161 fields: Optional[str] = None,
9162 transport_options: Optional[transport.TransportOptions] = None,
9163 ) -> mdls.Query:
9164 """Get Query for Slug"""
9165 slug = self.encode_path_param(slug)
9166 response = cast(
9167 mdls.Query,
9168 self.get(
9169 path=f"/queries/slug/{slug}",
9170 structure=mdls.Query,
9171 query_params={"fields": fields},
9172 transport_options=transport_options,
9173 ),
9174 )
9175 return response
9176
9177 # ### Create a query.
9178 #
9179 # This allows you to create a new query that you can later run. Looker queries are immutable once created
9180 # and are not deleted. If you create a query that is exactly like an existing query then the existing query
9181 # will be returned and no new query will be created. Whether a new query is created or not, you can use
9182 # the 'id' in the returned query with the 'run' method.
9183 #
9184 # The query parameters are passed as json in the body of the request.
9185 #
9186 # POST /queries -> mdls.Query
9187 def create_query(
9188 self,
9189 body: mdls.WriteQuery,
9190 # Requested fields.
9191 fields: Optional[str] = None,
9192 transport_options: Optional[transport.TransportOptions] = None,
9193 ) -> mdls.Query:
9194 """Create Query"""
9195 response = cast(
9196 mdls.Query,
9197 self.post(
9198 path="/queries",
9199 structure=mdls.Query,
9200 query_params={"fields": fields},
9201 body=body,
9202 transport_options=transport_options,
9203 ),
9204 )
9205 return response
9206
9207 # ### Run a saved query.
9208 #
9209 # This runs a previously saved query. You can use this on a query that was generated in the Looker UI
9210 # or one that you have explicitly created using the API. You can also use a query 'id' from a saved 'Look'.
9211 #
9212 # The 'result_format' parameter specifies the desired structure and format of the response.
9213 #
9214 # Supported formats:
9215 #
9216 # | result_format | Description
9217 # | :-----------: | :--- |
9218 # | json | Plain json
9219 # | json_bi | (*RECOMMENDED*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query. See JsonBi type for schema
9220 # | json_detail | (*LEGACY*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
9221 # | csv | Comma separated values with a header
9222 # | txt | Tab separated values with a header
9223 # | html | Simple html
9224 # | md | Simple markdown
9225 # | xlsx | MS Excel spreadsheet
9226 # | sql | Returns the generated SQL rather than running the query
9227 # | png | A PNG image of the visualization of the query
9228 # | jpg | A JPG image of the visualization of the query
9229 #
9230 # GET /queries/{query_id}/run/{result_format} -> Union[str, bytes]
9231 def run_query(
9232 self,
9233 # Id of query
9234 query_id: str,
9235 # Format of result
9236 result_format: str,
9237 # Row limit (may override the limit in the saved query).
9238 limit: Optional[int] = None,
9239 # Apply model-specified formatting to each result.
9240 apply_formatting: Optional[bool] = None,
9241 # Apply visualization options to results.
9242 apply_vis: Optional[bool] = None,
9243 # Get results from cache if available.
9244 cache: Optional[bool] = None,
9245 # Render width for image formats.
9246 image_width: Optional[int] = None,
9247 # Render height for image formats.
9248 image_height: Optional[int] = None,
9249 # Generate drill links (only applicable to 'json_detail' format.
9250 generate_drill_links: Optional[bool] = None,
9251 # Force use of production models even if the user is in development mode. Note that this flag being false does not guarantee development models will be used.
9252 force_production: Optional[bool] = None,
9253 # Retrieve any results from cache even if the results have expired.
9254 cache_only: Optional[bool] = None,
9255 # Prefix to use for drill links (url encoded).
9256 path_prefix: Optional[str] = None,
9257 # Rebuild PDTS used in query.
9258 rebuild_pdts: Optional[bool] = None,
9259 # Perform table calculations on query results
9260 server_table_calcs: Optional[bool] = None,
9261 # Specifies the source of this call.
9262 source: Optional[str] = None,
9263 # Return a specialized OAuth error response if a database OAuth error occurs.
9264 enable_oauth_error_response: Optional[bool] = None,
9265 transport_options: Optional[transport.TransportOptions] = None,
9266 ) -> Union[str, bytes]:
9267 """Run Query"""
9268 query_id = self.encode_path_param(query_id)
9269 result_format = self.encode_path_param(result_format)
9270 response = cast(
9271 Union[str, bytes],
9272 self.get(
9273 path=f"/queries/{query_id}/run/{result_format}",
9274 structure=Union[str, bytes], # type: ignore
9275 query_params={
9276 "limit": limit,
9277 "apply_formatting": apply_formatting,
9278 "apply_vis": apply_vis,
9279 "cache": cache,
9280 "image_width": image_width,
9281 "image_height": image_height,
9282 "generate_drill_links": generate_drill_links,
9283 "force_production": force_production,
9284 "cache_only": cache_only,
9285 "path_prefix": path_prefix,
9286 "rebuild_pdts": rebuild_pdts,
9287 "server_table_calcs": server_table_calcs,
9288 "source": source,
9289 "enable_oauth_error_response": enable_oauth_error_response,
9290 },
9291 transport_options=transport_options,
9292 ),
9293 )
9294 return response
9295
9296 # ### Run the query that is specified inline in the posted body.
9297 #
9298 # This allows running a query as defined in json in the posted body. This combines
9299 # the two actions of posting & running a query into one step.
9300 #
9301 # Here is an example body in json:
9302 # ```
9303 # {
9304 # "model":"thelook",
9305 # "view":"inventory_items",
9306 # "fields":["category.name","inventory_items.days_in_inventory_tier","products.count"],
9307 # "filters":{"category.name":"socks"},
9308 # "sorts":["products.count desc 0"],
9309 # "limit":"500",
9310 # "query_timezone":"America/Los_Angeles"
9311 # }
9312 # ```
9313 #
9314 # When using the Ruby SDK this would be passed as a Ruby hash like:
9315 # ```
9316 # {
9317 # :model=>"thelook",
9318 # :view=>"inventory_items",
9319 # :fields=>
9320 # ["category.name",
9321 # "inventory_items.days_in_inventory_tier",
9322 # "products.count"],
9323 # :filters=>{:"category.name"=>"socks"},
9324 # :sorts=>["products.count desc 0"],
9325 # :limit=>"500",
9326 # :query_timezone=>"America/Los_Angeles",
9327 # }
9328 # ```
9329 #
9330 # This will return the result of running the query in the format specified by the 'result_format' parameter.
9331 #
9332 # Supported formats:
9333 #
9334 # | result_format | Description
9335 # | :-----------: | :--- |
9336 # | json | Plain json
9337 # | json_bi | (*RECOMMENDED*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query. See JsonBi type for schema
9338 # | json_detail | (*LEGACY*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
9339 # | csv | Comma separated values with a header
9340 # | txt | Tab separated values with a header
9341 # | html | Simple html
9342 # | md | Simple markdown
9343 # | xlsx | MS Excel spreadsheet
9344 # | sql | Returns the generated SQL rather than running the query
9345 # | png | A PNG image of the visualization of the query
9346 # | jpg | A JPG image of the visualization of the query
9347 #
9348 # POST /queries/run/{result_format} -> Union[str, bytes]
9349 def run_inline_query(
9350 self,
9351 # Format of result
9352 result_format: str,
9353 body: mdls.WriteQuery,
9354 # Row limit (may override the limit in the saved query).
9355 limit: Optional[int] = None,
9356 # Apply model-specified formatting to each result.
9357 apply_formatting: Optional[bool] = None,
9358 # Apply visualization options to results.
9359 apply_vis: Optional[bool] = None,
9360 # Get results from cache if available.
9361 cache: Optional[bool] = None,
9362 # Render width for image formats.
9363 image_width: Optional[int] = None,
9364 # Render height for image formats.
9365 image_height: Optional[int] = None,
9366 # Generate drill links (only applicable to 'json_detail' format.
9367 generate_drill_links: Optional[bool] = None,
9368 # Force use of production models even if the user is in development mode. Note that this flag being false does not guarantee development models will be used.
9369 force_production: Optional[bool] = None,
9370 # Retrieve any results from cache even if the results have expired.
9371 cache_only: Optional[bool] = None,
9372 # Prefix to use for drill links (url encoded).
9373 path_prefix: Optional[str] = None,
9374 # Rebuild PDTS used in query.
9375 rebuild_pdts: Optional[bool] = None,
9376 # Perform table calculations on query results
9377 server_table_calcs: Optional[bool] = None,
9378 # Return a specialized OAuth error response if a database OAuth error occurs.
9379 enable_oauth_error_response: Optional[bool] = None,
9380 transport_options: Optional[transport.TransportOptions] = None,
9381 ) -> Union[str, bytes]:
9382 """Run Inline Query"""
9383 result_format = self.encode_path_param(result_format)
9384 response = cast(
9385 Union[str, bytes],
9386 self.post(
9387 path=f"/queries/run/{result_format}",
9388 structure=Union[str, bytes], # type: ignore
9389 query_params={
9390 "limit": limit,
9391 "apply_formatting": apply_formatting,
9392 "apply_vis": apply_vis,
9393 "cache": cache,
9394 "image_width": image_width,
9395 "image_height": image_height,
9396 "generate_drill_links": generate_drill_links,
9397 "force_production": force_production,
9398 "cache_only": cache_only,
9399 "path_prefix": path_prefix,
9400 "rebuild_pdts": rebuild_pdts,
9401 "server_table_calcs": server_table_calcs,
9402 "enable_oauth_error_response": enable_oauth_error_response,
9403 },
9404 body=body,
9405 transport_options=transport_options,
9406 ),
9407 )
9408 return response
9409
9410 # ### Run an URL encoded query.
9411 #
9412 # This requires the caller to encode the specifiers for the query into the URL query part using
9413 # Looker-specific syntax as explained below.
9414 #
9415 # Generally, you would want to use one of the methods that takes the parameters as json in the POST body
9416 # for creating and/or running queries. This method exists for cases where one really needs to encode the
9417 # parameters into the URL of a single 'GET' request. This matches the way that the Looker UI formats
9418 # 'explore' URLs etc.
9419 #
9420 # The parameters here are very similar to the json body formatting except that the filter syntax is
9421 # tricky. Unfortunately, this format makes this method not currently callable via the 'Try it out!' button
9422 # in this documentation page. But, this is callable when creating URLs manually or when using the Looker SDK.
9423 #
9424 # Here is an example inline query URL:
9425 #
9426 # ```
9427 # https://looker.mycompany.com:19999/api/4.0/queries/models/thelook/views/inventory_items/run/json?fields=category.name,inventory_items.days_in_inventory_tier,products.count&f[category.name]=socks&sorts=products.count+desc+0&limit=500&query_timezone=America/Los_Angeles
9428 # ```
9429 #
9430 # When invoking this endpoint with the Ruby SDK, pass the query parameter parts as a hash. The hash to match the above would look like:
9431 #
9432 # ```ruby
9433 # query_params =
9434 # {
9435 # fields: "category.name,inventory_items.days_in_inventory_tier,products.count",
9436 # :"f[category.name]" => "socks",
9437 # sorts: "products.count desc 0",
9438 # limit: "500",
9439 # query_timezone: "America/Los_Angeles"
9440 # }
9441 # response = ruby_sdk.run_url_encoded_query('thelook','inventory_items','json', query_params)
9442 #
9443 # ```
9444 #
9445 # Again, it is generally easier to use the variant of this method that passes the full query in the POST body.
9446 # This method is available for cases where other alternatives won't fit the need.
9447 #
9448 # Supported formats:
9449 #
9450 # | result_format | Description
9451 # | :-----------: | :--- |
9452 # | json | Plain json
9453 # | json_bi | (*RECOMMENDED*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query. See JsonBi type for schema
9454 # | json_detail | (*LEGACY*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
9455 # | csv | Comma separated values with a header
9456 # | txt | Tab separated values with a header
9457 # | html | Simple html
9458 # | md | Simple markdown
9459 # | xlsx | MS Excel spreadsheet
9460 # | sql | Returns the generated SQL rather than running the query
9461 # | png | A PNG image of the visualization of the query
9462 # | jpg | A JPG image of the visualization of the query
9463 #
9464 # GET /queries/models/{model_name}/views/{view_name}/run/{result_format} -> Union[str, bytes]
9465 def run_url_encoded_query(
9466 self,
9467 # Model name
9468 model_name: str,
9469 # View name
9470 view_name: str,
9471 # Format of result
9472 result_format: str,
9473 transport_options: Optional[transport.TransportOptions] = None,
9474 ) -> Union[str, bytes]:
9475 """Run Url Encoded Query"""
9476 model_name = self.encode_path_param(model_name)
9477 view_name = self.encode_path_param(view_name)
9478 result_format = self.encode_path_param(result_format)
9479 response = cast(
9480 Union[str, bytes],
9481 self.get(
9482 path=f"/queries/models/{model_name}/views/{view_name}/run/{result_format}",
9483 structure=Union[str, bytes], # type: ignore
9484 transport_options=transport_options,
9485 ),
9486 )
9487 return response
9488
9489 # ### Get Merge Query
9490 #
9491 # Returns a merge query object given its id.
9492 #
9493 # GET /merge_queries/{merge_query_id} -> mdls.MergeQuery
9494 def merge_query(
9495 self,
9496 # Merge Query Id
9497 merge_query_id: str,
9498 # Requested fields
9499 fields: Optional[str] = None,
9500 transport_options: Optional[transport.TransportOptions] = None,
9501 ) -> mdls.MergeQuery:
9502 """Get Merge Query"""
9503 merge_query_id = self.encode_path_param(merge_query_id)
9504 response = cast(
9505 mdls.MergeQuery,
9506 self.get(
9507 path=f"/merge_queries/{merge_query_id}",
9508 structure=mdls.MergeQuery,
9509 query_params={"fields": fields},
9510 transport_options=transport_options,
9511 ),
9512 )
9513 return response
9514
9515 # ### Create Merge Query
9516 #
9517 # Creates a new merge query object.
9518 #
9519 # A merge query takes the results of one or more queries and combines (merges) the results
9520 # according to field mapping definitions. The result is similar to a SQL left outer join.
9521 #
9522 # A merge query can merge results of queries from different SQL databases.
9523 #
9524 # The order that queries are defined in the source_queries array property is significant. The
9525 # first query in the array defines the primary key into which the results of subsequent
9526 # queries will be merged.
9527 #
9528 # Like model/view query objects, merge queries are immutable and have structural identity - if
9529 # you make a request to create a new merge query that is identical to an existing merge query,
9530 # the existing merge query will be returned instead of creating a duplicate. Conversely, any
9531 # change to the contents of a merge query will produce a new object with a new id.
9532 #
9533 # POST /merge_queries -> mdls.MergeQuery
9534 def create_merge_query(
9535 self,
9536 body: Optional[mdls.WriteMergeQuery] = None,
9537 # Requested fields
9538 fields: Optional[str] = None,
9539 transport_options: Optional[transport.TransportOptions] = None,
9540 ) -> mdls.MergeQuery:
9541 """Create Merge Query"""
9542 response = cast(
9543 mdls.MergeQuery,
9544 self.post(
9545 path="/merge_queries",
9546 structure=mdls.MergeQuery,
9547 query_params={"fields": fields},
9548 body=body,
9549 transport_options=transport_options,
9550 ),
9551 )
9552 return response
9553
9554 # Get information about all running queries.
9555 #
9556 # GET /running_queries -> Sequence[mdls.RunningQueries]
9557 def all_running_queries(
9558 self,
9559 transport_options: Optional[transport.TransportOptions] = None,
9560 ) -> Sequence[mdls.RunningQueries]:
9561 """Get All Running Queries"""
9562 response = cast(
9563 Sequence[mdls.RunningQueries],
9564 self.get(
9565 path="/running_queries",
9566 structure=Sequence[mdls.RunningQueries],
9567 transport_options=transport_options,
9568 ),
9569 )
9570 return response
9571
9572 # Kill a query with a specific query_task_id.
9573 #
9574 # DELETE /running_queries/{query_task_id} -> str
9575 def kill_query(
9576 self,
9577 # Query task id.
9578 query_task_id: str,
9579 transport_options: Optional[transport.TransportOptions] = None,
9580 ) -> str:
9581 """Kill Running Query"""
9582 query_task_id = self.encode_path_param(query_task_id)
9583 response = cast(
9584 str,
9585 self.delete(
9586 path=f"/running_queries/{query_task_id}",
9587 structure=str,
9588 transport_options=transport_options,
9589 ),
9590 )
9591 return response
9592
9593 # ### Create a SQL Runner Query
9594 #
9595 # Either the `connection_name` or `model_name` parameter MUST be provided.
9596 #
9597 # POST /sql_queries -> mdls.SqlQuery
9598 def create_sql_query(
9599 self,
9600 body: mdls.SqlQueryCreate,
9601 transport_options: Optional[transport.TransportOptions] = None,
9602 ) -> mdls.SqlQuery:
9603 """Create SQL Runner Query"""
9604 response = cast(
9605 mdls.SqlQuery,
9606 self.post(
9607 path="/sql_queries",
9608 structure=mdls.SqlQuery,
9609 body=body,
9610 transport_options=transport_options,
9611 ),
9612 )
9613 return response
9614
9615 # Get a SQL Runner query.
9616 #
9617 # GET /sql_queries/{slug} -> mdls.SqlQuery
9618 def sql_query(
9619 self,
9620 # slug of query
9621 slug: str,
9622 transport_options: Optional[transport.TransportOptions] = None,
9623 ) -> mdls.SqlQuery:
9624 """Get SQL Runner Query"""
9625 slug = self.encode_path_param(slug)
9626 response = cast(
9627 mdls.SqlQuery,
9628 self.get(
9629 path=f"/sql_queries/{slug}",
9630 structure=mdls.SqlQuery,
9631 transport_options=transport_options,
9632 ),
9633 )
9634 return response
9635
9636 # Execute a SQL Runner query in a given result_format.
9637 #
9638 # POST /sql_queries/{slug}/run/{result_format} -> str
9639 def run_sql_query(
9640 self,
9641 # slug of query
9642 slug: str,
9643 # Format of result, options are: ["inline_json", "json", "json_detail", "json_fe", "json_bi", "csv", "html", "md", "txt", "xlsx", "gsxml", "sql", "odc", "json_label"]
9644 result_format: str,
9645 # Defaults to false. If set to true, the HTTP response will have content-disposition and other headers set to make the HTTP response behave as a downloadable attachment instead of as inline content.
9646 download: Optional[str] = None,
9647 transport_options: Optional[transport.TransportOptions] = None,
9648 ) -> str:
9649 """Run SQL Runner Query"""
9650 slug = self.encode_path_param(slug)
9651 result_format = self.encode_path_param(result_format)
9652 response = cast(
9653 str,
9654 self.post(
9655 path=f"/sql_queries/{slug}/run/{result_format}",
9656 structure=str,
9657 query_params={"download": download},
9658 transport_options=transport_options,
9659 ),
9660 )
9661 return response
9662
9663 # endregion
9664
9665 # region RenderTask: Manage Render Tasks
9666
9667 # ### Create a new task to render a look to an image.
9668 #
9669 # Returns a render task object.
9670 # To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
9671 # Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
9672 #
9673 # POST /render_tasks/looks/{look_id}/{result_format} -> mdls.RenderTask
9674 def create_look_render_task(
9675 self,
9676 # Id of look to render
9677 look_id: str,
9678 # Output type: png, or jpg
9679 result_format: str,
9680 # Output width in pixels
9681 width: int,
9682 # Output height in pixels
9683 height: int,
9684 # Requested fields.
9685 fields: Optional[str] = None,
9686 transport_options: Optional[transport.TransportOptions] = None,
9687 ) -> mdls.RenderTask:
9688 """Create Look Render Task"""
9689 look_id = self.encode_path_param(look_id)
9690 result_format = self.encode_path_param(result_format)
9691 response = cast(
9692 mdls.RenderTask,
9693 self.post(
9694 path=f"/render_tasks/looks/{look_id}/{result_format}",
9695 structure=mdls.RenderTask,
9696 query_params={"width": width, "height": height, "fields": fields},
9697 transport_options=transport_options,
9698 ),
9699 )
9700 return response
9701
9702 # ### Create a new task to render an existing query to an image.
9703 #
9704 # Returns a render task object.
9705 # To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
9706 # Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
9707 #
9708 # POST /render_tasks/queries/{query_id}/{result_format} -> mdls.RenderTask
9709 def create_query_render_task(
9710 self,
9711 # Id of the query to render
9712 query_id: str,
9713 # Output type: png or jpg
9714 result_format: str,
9715 # Output width in pixels
9716 width: int,
9717 # Output height in pixels
9718 height: int,
9719 # Requested fields.
9720 fields: Optional[str] = None,
9721 transport_options: Optional[transport.TransportOptions] = None,
9722 ) -> mdls.RenderTask:
9723 """Create Query Render Task"""
9724 query_id = self.encode_path_param(query_id)
9725 result_format = self.encode_path_param(result_format)
9726 response = cast(
9727 mdls.RenderTask,
9728 self.post(
9729 path=f"/render_tasks/queries/{query_id}/{result_format}",
9730 structure=mdls.RenderTask,
9731 query_params={"width": width, "height": height, "fields": fields},
9732 transport_options=transport_options,
9733 ),
9734 )
9735 return response
9736
9737 # ### Create a new task to render a dashboard to a document or image.
9738 #
9739 # Returns a render task object.
9740 # To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
9741 # Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
9742 #
9743 # POST /render_tasks/dashboards/{dashboard_id}/{result_format} -> mdls.RenderTask
9744 def create_dashboard_render_task(
9745 self,
9746 # Id of dashboard to render. The ID can be a LookML dashboard also.
9747 dashboard_id: str,
9748 # Output type: pdf, png, or jpg
9749 result_format: str,
9750 body: mdls.CreateDashboardRenderTask,
9751 # Output width in pixels
9752 width: int,
9753 # Output height in pixels
9754 height: int,
9755 # Requested fields.
9756 fields: Optional[str] = None,
9757 # Paper size for pdf. Value can be one of: ["letter","legal","tabloid","a0","a1","a2","a3","a4","a5"]
9758 pdf_paper_size: Optional[str] = None,
9759 # Whether to render pdf in landscape paper orientation
9760 pdf_landscape: Optional[bool] = None,
9761 # Whether or not to expand table vis to full length
9762 long_tables: Optional[bool] = None,
9763 # Theme to apply. Will render embedded version of dashboard if valid
9764 theme: Optional[str] = None,
9765 transport_options: Optional[transport.TransportOptions] = None,
9766 ) -> mdls.RenderTask:
9767 """Create Dashboard Render Task"""
9768 dashboard_id = self.encode_path_param(dashboard_id)
9769 result_format = self.encode_path_param(result_format)
9770 response = cast(
9771 mdls.RenderTask,
9772 self.post(
9773 path=f"/render_tasks/dashboards/{dashboard_id}/{result_format}",
9774 structure=mdls.RenderTask,
9775 query_params={
9776 "width": width,
9777 "height": height,
9778 "fields": fields,
9779 "pdf_paper_size": pdf_paper_size,
9780 "pdf_landscape": pdf_landscape,
9781 "long_tables": long_tables,
9782 "theme": theme,
9783 },
9784 body=body,
9785 transport_options=transport_options,
9786 ),
9787 )
9788 return response
9789
9790 # ### Get information about a render task.
9791 #
9792 # Returns a render task object.
9793 # To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
9794 # Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
9795 #
9796 # GET /render_tasks/{render_task_id} -> mdls.RenderTask
9797 def render_task(
9798 self,
9799 # Id of render task
9800 render_task_id: str,
9801 # Requested fields.
9802 fields: Optional[str] = None,
9803 transport_options: Optional[transport.TransportOptions] = None,
9804 ) -> mdls.RenderTask:
9805 """Get Render Task"""
9806 render_task_id = self.encode_path_param(render_task_id)
9807 response = cast(
9808 mdls.RenderTask,
9809 self.get(
9810 path=f"/render_tasks/{render_task_id}",
9811 structure=mdls.RenderTask,
9812 query_params={"fields": fields},
9813 transport_options=transport_options,
9814 ),
9815 )
9816 return response
9817
9818 # ### Get the document or image produced by a completed render task.
9819 #
9820 # Note that the PDF or image result will be a binary blob in the HTTP response, as indicated by the
9821 # Content-Type in the response headers. This may require specialized (or at least different) handling than text
9822 # responses such as JSON. You may need to tell your HTTP client that the response is binary so that it does not
9823 # attempt to parse the binary data as text.
9824 #
9825 # If the render task exists but has not finished rendering the results, the response HTTP status will be
9826 # **202 Accepted**, the response body will be empty, and the response will have a Retry-After header indicating
9827 # that the caller should repeat the request at a later time.
9828 #
9829 # Returns 404 if the render task cannot be found, if the cached result has expired, or if the caller
9830 # does not have permission to view the results.
9831 #
9832 # For detailed information about the status of the render task, use [Render Task](#!/RenderTask/render_task).
9833 # Polling loops waiting for completion of a render task would be better served by polling **render_task(id)** until
9834 # the task status reaches completion (or error) instead of polling **render_task_results(id)** alone.
9835 #
9836 # GET /render_tasks/{render_task_id}/results -> bytes
9837 def render_task_results(
9838 self,
9839 # Id of render task
9840 render_task_id: str,
9841 transport_options: Optional[transport.TransportOptions] = None,
9842 ) -> bytes:
9843 """Render Task Results"""
9844 render_task_id = self.encode_path_param(render_task_id)
9845 response = cast(
9846 bytes,
9847 self.get(
9848 path=f"/render_tasks/{render_task_id}/results",
9849 structure=bytes,
9850 transport_options=transport_options,
9851 ),
9852 )
9853 return response
9854
9855 # ### Create a new task to render a dashboard element to an image.
9856 #
9857 # Returns a render task object.
9858 # To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
9859 # Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
9860 #
9861 # POST /render_tasks/dashboard_elements/{dashboard_element_id}/{result_format} -> mdls.RenderTask
9862 def create_dashboard_element_render_task(
9863 self,
9864 # Id of dashboard element to render: UDD dashboard element would be numeric and LookML dashboard element would be model_name::dashboard_title::lookml_link_id
9865 dashboard_element_id: str,
9866 # Output type: png or jpg
9867 result_format: str,
9868 # Output width in pixels
9869 width: int,
9870 # Output height in pixels
9871 height: int,
9872 # Requested fields.
9873 fields: Optional[str] = None,
9874 transport_options: Optional[transport.TransportOptions] = None,
9875 ) -> mdls.RenderTask:
9876 """Create Dashboard Element Render Task"""
9877 dashboard_element_id = self.encode_path_param(dashboard_element_id)
9878 result_format = self.encode_path_param(result_format)
9879 response = cast(
9880 mdls.RenderTask,
9881 self.post(
9882 path=f"/render_tasks/dashboard_elements/{dashboard_element_id}/{result_format}",
9883 structure=mdls.RenderTask,
9884 query_params={"width": width, "height": height, "fields": fields},
9885 transport_options=transport_options,
9886 ),
9887 )
9888 return response
9889
9890 # endregion
9891
9892 # region Report: Report
9893
9894 # ### Search Reports
9895 #
9896 # Returns an **array of Report objects** that match the specified search criteria.
9897 #
9898 # If multiple search params are given and `filter_or` is FALSE or not specified,
9899 # search params are combined in a logical AND operation.
9900 # Only rows that match *all* search param criteria will be returned.
9901 #
9902 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
9903 # Results will include rows that match **any** of the search criteria.
9904 #
9905 # String search params use case-insensitive matching.
9906 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
9907 # example="dan%" will match "danger" and "Danzig" but not "David"
9908 # example="D_m%" will match "Damage" and "dump"
9909 #
9910 # Integer search params can accept a single value or a comma separated list of values. The multiple
9911 # values will be combined under a logical OR operation - results will match at least one of
9912 # the given values.
9913 #
9914 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
9915 # or exclude (respectively) rows where the column is null.
9916 #
9917 # Boolean search params accept only "true" and "false" as values.
9918 #
9919 # GET /reports/search -> Sequence[mdls.Report]
9920 def search_reports(
9921 self,
9922 # Select reports in a particular folder.
9923 folder_id: Optional[str] = None,
9924 # Select favorite reports.
9925 favorite: Optional[bool] = None,
9926 # Select reports viewed recently.
9927 recent: Optional[bool] = None,
9928 # Match report id.
9929 id: Optional[str] = None,
9930 # Match report title.
9931 title: Optional[str] = None,
9932 # One or more fields to sort results by.
9933 sorts: Optional[str] = None,
9934 # Number of results to return.(used with next_page_token)
9935 limit: Optional[int] = None,
9936 # Comma delimited list of field names. If provided, only the fields specified will be included in the response.
9937 fields: Optional[str] = None,
9938 # Contains a token that can be used to return up to Number of results to return.(used with next_page_token) additional results. A next_page_token will not be returned if there are no additional results to display.
9939 next_page_token: Optional[str] = None,
9940 transport_options: Optional[transport.TransportOptions] = None,
9941 ) -> Sequence[mdls.Report]:
9942 """Search Reports"""
9943 response = cast(
9944 Sequence[mdls.Report],
9945 self.get(
9946 path="/reports/search",
9947 structure=Sequence[mdls.Report],
9948 query_params={
9949 "folder_id": folder_id,
9950 "favorite": favorite,
9951 "recent": recent,
9952 "id": id,
9953 "title": title,
9954 "sorts": sorts,
9955 "limit": limit,
9956 "fields": fields,
9957 "next_page_token": next_page_token,
9958 },
9959 transport_options=transport_options,
9960 ),
9961 )
9962 return response
9963
9964 # endregion
9965
9966 # region Role: Manage Roles
9967
9968 # ### Search model sets
9969 # Returns all model set records that match the given search criteria.
9970 # If multiple search params are given and `filter_or` is FALSE or not specified,
9971 # search params are combined in a logical AND operation.
9972 # Only rows that match *all* search param criteria will be returned.
9973 #
9974 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
9975 # Results will include rows that match **any** of the search criteria.
9976 #
9977 # String search params use case-insensitive matching.
9978 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
9979 # example="dan%" will match "danger" and "Danzig" but not "David"
9980 # example="D_m%" will match "Damage" and "dump"
9981 #
9982 # Integer search params can accept a single value or a comma separated list of values. The multiple
9983 # values will be combined under a logical OR operation - results will match at least one of
9984 # the given values.
9985 #
9986 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
9987 # or exclude (respectively) rows where the column is null.
9988 #
9989 # Boolean search params accept only "true" and "false" as values.
9990 #
9991 # GET /model_sets/search -> Sequence[mdls.ModelSet]
9992 def search_model_sets(
9993 self,
9994 # Requested fields.
9995 fields: Optional[str] = None,
9996 # Number of results to return (used with `offset`).
9997 limit: Optional[int] = None,
9998 # Number of results to skip before returning any (used with `limit`).
9999 offset: Optional[int] = None,
10000 # Fields to sort by.
10001 sorts: Optional[str] = None,
10002 # Match model set id.
10003 id: Optional[str] = None,
10004 # Match model set name.
10005 name: Optional[str] = None,
10006 # Match model sets by all_access status.
10007 all_access: Optional[bool] = None,
10008 # Match model sets by built_in status.
10009 built_in: Optional[bool] = None,
10010 # Combine given search criteria in a boolean OR expression.
10011 filter_or: Optional[bool] = None,
10012 transport_options: Optional[transport.TransportOptions] = None,
10013 ) -> Sequence[mdls.ModelSet]:
10014 """Search Model Sets"""
10015 response = cast(
10016 Sequence[mdls.ModelSet],
10017 self.get(
10018 path="/model_sets/search",
10019 structure=Sequence[mdls.ModelSet],
10020 query_params={
10021 "fields": fields,
10022 "limit": limit,
10023 "offset": offset,
10024 "sorts": sorts,
10025 "id": id,
10026 "name": name,
10027 "all_access": all_access,
10028 "built_in": built_in,
10029 "filter_or": filter_or,
10030 },
10031 transport_options=transport_options,
10032 ),
10033 )
10034 return response
10035
10036 # ### Get information about the model set with a specific id.
10037 #
10038 # GET /model_sets/{model_set_id} -> mdls.ModelSet
10039 def model_set(
10040 self,
10041 # Id of model set
10042 model_set_id: str,
10043 # Requested fields.
10044 fields: Optional[str] = None,
10045 transport_options: Optional[transport.TransportOptions] = None,
10046 ) -> mdls.ModelSet:
10047 """Get Model Set"""
10048 model_set_id = self.encode_path_param(model_set_id)
10049 response = cast(
10050 mdls.ModelSet,
10051 self.get(
10052 path=f"/model_sets/{model_set_id}",
10053 structure=mdls.ModelSet,
10054 query_params={"fields": fields},
10055 transport_options=transport_options,
10056 ),
10057 )
10058 return response
10059
10060 # ### Update information about the model set with a specific id.
10061 #
10062 # PATCH /model_sets/{model_set_id} -> mdls.ModelSet
10063 def update_model_set(
10064 self,
10065 # id of model set
10066 model_set_id: str,
10067 body: mdls.WriteModelSet,
10068 transport_options: Optional[transport.TransportOptions] = None,
10069 ) -> mdls.ModelSet:
10070 """Update Model Set"""
10071 model_set_id = self.encode_path_param(model_set_id)
10072 response = cast(
10073 mdls.ModelSet,
10074 self.patch(
10075 path=f"/model_sets/{model_set_id}",
10076 structure=mdls.ModelSet,
10077 body=body,
10078 transport_options=transport_options,
10079 ),
10080 )
10081 return response
10082
10083 # ### Delete the model set with a specific id.
10084 #
10085 # DELETE /model_sets/{model_set_id} -> str
10086 def delete_model_set(
10087 self,
10088 # id of model set
10089 model_set_id: str,
10090 transport_options: Optional[transport.TransportOptions] = None,
10091 ) -> str:
10092 """Delete Model Set"""
10093 model_set_id = self.encode_path_param(model_set_id)
10094 response = cast(
10095 str,
10096 self.delete(
10097 path=f"/model_sets/{model_set_id}",
10098 structure=str,
10099 transport_options=transport_options,
10100 ),
10101 )
10102 return response
10103
10104 # ### Get information about all model sets.
10105 #
10106 # GET /model_sets -> Sequence[mdls.ModelSet]
10107 def all_model_sets(
10108 self,
10109 # Requested fields.
10110 fields: Optional[str] = None,
10111 transport_options: Optional[transport.TransportOptions] = None,
10112 ) -> Sequence[mdls.ModelSet]:
10113 """Get All Model Sets"""
10114 response = cast(
10115 Sequence[mdls.ModelSet],
10116 self.get(
10117 path="/model_sets",
10118 structure=Sequence[mdls.ModelSet],
10119 query_params={"fields": fields},
10120 transport_options=transport_options,
10121 ),
10122 )
10123 return response
10124
10125 # ### Create a model set with the specified information. Model sets are used by Roles.
10126 #
10127 # POST /model_sets -> mdls.ModelSet
10128 def create_model_set(
10129 self,
10130 body: mdls.WriteModelSet,
10131 transport_options: Optional[transport.TransportOptions] = None,
10132 ) -> mdls.ModelSet:
10133 """Create Model Set"""
10134 response = cast(
10135 mdls.ModelSet,
10136 self.post(
10137 path="/model_sets",
10138 structure=mdls.ModelSet,
10139 body=body,
10140 transport_options=transport_options,
10141 ),
10142 )
10143 return response
10144
10145 # ### Get all supported permissions.
10146 #
10147 # GET /permissions -> Sequence[mdls.Permission]
10148 def all_permissions(
10149 self,
10150 transport_options: Optional[transport.TransportOptions] = None,
10151 ) -> Sequence[mdls.Permission]:
10152 """Get All Permissions"""
10153 response = cast(
10154 Sequence[mdls.Permission],
10155 self.get(
10156 path="/permissions",
10157 structure=Sequence[mdls.Permission],
10158 transport_options=transport_options,
10159 ),
10160 )
10161 return response
10162
10163 # ### Search permission sets
10164 # Returns all permission set records that match the given search criteria.
10165 # If multiple search params are given and `filter_or` is FALSE or not specified,
10166 # search params are combined in a logical AND operation.
10167 # Only rows that match *all* search param criteria will be returned.
10168 #
10169 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
10170 # Results will include rows that match **any** of the search criteria.
10171 #
10172 # String search params use case-insensitive matching.
10173 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
10174 # example="dan%" will match "danger" and "Danzig" but not "David"
10175 # example="D_m%" will match "Damage" and "dump"
10176 #
10177 # Integer search params can accept a single value or a comma separated list of values. The multiple
10178 # values will be combined under a logical OR operation - results will match at least one of
10179 # the given values.
10180 #
10181 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
10182 # or exclude (respectively) rows where the column is null.
10183 #
10184 # Boolean search params accept only "true" and "false" as values.
10185 #
10186 # GET /permission_sets/search -> Sequence[mdls.PermissionSet]
10187 def search_permission_sets(
10188 self,
10189 # Requested fields.
10190 fields: Optional[str] = None,
10191 # Number of results to return (used with `offset`).
10192 limit: Optional[int] = None,
10193 # Number of results to skip before returning any (used with `limit`).
10194 offset: Optional[int] = None,
10195 # Fields to sort by.
10196 sorts: Optional[str] = None,
10197 # Match permission set id.
10198 id: Optional[str] = None,
10199 # Match permission set name.
10200 name: Optional[str] = None,
10201 # Match permission sets by all_access status.
10202 all_access: Optional[bool] = None,
10203 # Match permission sets by built_in status.
10204 built_in: Optional[bool] = None,
10205 # Combine given search criteria in a boolean OR expression.
10206 filter_or: Optional[bool] = None,
10207 transport_options: Optional[transport.TransportOptions] = None,
10208 ) -> Sequence[mdls.PermissionSet]:
10209 """Search Permission Sets"""
10210 response = cast(
10211 Sequence[mdls.PermissionSet],
10212 self.get(
10213 path="/permission_sets/search",
10214 structure=Sequence[mdls.PermissionSet],
10215 query_params={
10216 "fields": fields,
10217 "limit": limit,
10218 "offset": offset,
10219 "sorts": sorts,
10220 "id": id,
10221 "name": name,
10222 "all_access": all_access,
10223 "built_in": built_in,
10224 "filter_or": filter_or,
10225 },
10226 transport_options=transport_options,
10227 ),
10228 )
10229 return response
10230
10231 # ### Get information about the permission set with a specific id.
10232 #
10233 # GET /permission_sets/{permission_set_id} -> mdls.PermissionSet
10234 def permission_set(
10235 self,
10236 # Id of permission set
10237 permission_set_id: str,
10238 # Requested fields.
10239 fields: Optional[str] = None,
10240 transport_options: Optional[transport.TransportOptions] = None,
10241 ) -> mdls.PermissionSet:
10242 """Get Permission Set"""
10243 permission_set_id = self.encode_path_param(permission_set_id)
10244 response = cast(
10245 mdls.PermissionSet,
10246 self.get(
10247 path=f"/permission_sets/{permission_set_id}",
10248 structure=mdls.PermissionSet,
10249 query_params={"fields": fields},
10250 transport_options=transport_options,
10251 ),
10252 )
10253 return response
10254
10255 # ### Update information about the permission set with a specific id.
10256 # Providing save_content permission alone will also provide you the abilities of save_looks and save_dashboards.
10257 #
10258 # PATCH /permission_sets/{permission_set_id} -> mdls.PermissionSet
10259 def update_permission_set(
10260 self,
10261 # Id of permission set
10262 permission_set_id: str,
10263 body: mdls.WritePermissionSet,
10264 transport_options: Optional[transport.TransportOptions] = None,
10265 ) -> mdls.PermissionSet:
10266 """Update Permission Set"""
10267 permission_set_id = self.encode_path_param(permission_set_id)
10268 response = cast(
10269 mdls.PermissionSet,
10270 self.patch(
10271 path=f"/permission_sets/{permission_set_id}",
10272 structure=mdls.PermissionSet,
10273 body=body,
10274 transport_options=transport_options,
10275 ),
10276 )
10277 return response
10278
10279 # ### Delete the permission set with a specific id.
10280 #
10281 # DELETE /permission_sets/{permission_set_id} -> str
10282 def delete_permission_set(
10283 self,
10284 # Id of permission set
10285 permission_set_id: str,
10286 transport_options: Optional[transport.TransportOptions] = None,
10287 ) -> str:
10288 """Delete Permission Set"""
10289 permission_set_id = self.encode_path_param(permission_set_id)
10290 response = cast(
10291 str,
10292 self.delete(
10293 path=f"/permission_sets/{permission_set_id}",
10294 structure=str,
10295 transport_options=transport_options,
10296 ),
10297 )
10298 return response
10299
10300 # ### Get information about all permission sets.
10301 #
10302 # GET /permission_sets -> Sequence[mdls.PermissionSet]
10303 def all_permission_sets(
10304 self,
10305 # Requested fields.
10306 fields: Optional[str] = None,
10307 transport_options: Optional[transport.TransportOptions] = None,
10308 ) -> Sequence[mdls.PermissionSet]:
10309 """Get All Permission Sets"""
10310 response = cast(
10311 Sequence[mdls.PermissionSet],
10312 self.get(
10313 path="/permission_sets",
10314 structure=Sequence[mdls.PermissionSet],
10315 query_params={"fields": fields},
10316 transport_options=transport_options,
10317 ),
10318 )
10319 return response
10320
10321 # ### Create a permission set with the specified information. Permission sets are used by Roles.
10322 # Providing save_content permission alone will also provide you the abilities of save_looks and save_dashboards.
10323 #
10324 # POST /permission_sets -> mdls.PermissionSet
10325 def create_permission_set(
10326 self,
10327 body: mdls.WritePermissionSet,
10328 transport_options: Optional[transport.TransportOptions] = None,
10329 ) -> mdls.PermissionSet:
10330 """Create Permission Set"""
10331 response = cast(
10332 mdls.PermissionSet,
10333 self.post(
10334 path="/permission_sets",
10335 structure=mdls.PermissionSet,
10336 body=body,
10337 transport_options=transport_options,
10338 ),
10339 )
10340 return response
10341
10342 # ### Get information about all roles.
10343 #
10344 # GET /roles -> Sequence[mdls.Role]
10345 def all_roles(
10346 self,
10347 # Requested fields.
10348 fields: Optional[str] = None,
10349 # Optional list of ids to get specific roles.
10350 ids: Optional[mdls.DelimSequence[str]] = None,
10351 transport_options: Optional[transport.TransportOptions] = None,
10352 ) -> Sequence[mdls.Role]:
10353 """Get All Roles"""
10354 response = cast(
10355 Sequence[mdls.Role],
10356 self.get(
10357 path="/roles",
10358 structure=Sequence[mdls.Role],
10359 query_params={"fields": fields, "ids": ids},
10360 transport_options=transport_options,
10361 ),
10362 )
10363 return response
10364
10365 # ### Create a role with the specified information.
10366 #
10367 # POST /roles -> mdls.Role
10368 def create_role(
10369 self,
10370 body: mdls.WriteRole,
10371 transport_options: Optional[transport.TransportOptions] = None,
10372 ) -> mdls.Role:
10373 """Create Role"""
10374 response = cast(
10375 mdls.Role,
10376 self.post(
10377 path="/roles",
10378 structure=mdls.Role,
10379 body=body,
10380 transport_options=transport_options,
10381 ),
10382 )
10383 return response
10384
10385 # ### Search roles
10386 #
10387 # Returns all role records that match the given search criteria.
10388 #
10389 # If multiple search params are given and `filter_or` is FALSE or not specified,
10390 # search params are combined in a logical AND operation.
10391 # Only rows that match *all* search param criteria will be returned.
10392 #
10393 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
10394 # Results will include rows that match **any** of the search criteria.
10395 #
10396 # String search params use case-insensitive matching.
10397 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
10398 # example="dan%" will match "danger" and "Danzig" but not "David"
10399 # example="D_m%" will match "Damage" and "dump"
10400 #
10401 # Integer search params can accept a single value or a comma separated list of values. The multiple
10402 # values will be combined under a logical OR operation - results will match at least one of
10403 # the given values.
10404 #
10405 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
10406 # or exclude (respectively) rows where the column is null.
10407 #
10408 # Boolean search params accept only "true" and "false" as values.
10409 #
10410 # GET /roles/search -> Sequence[mdls.Role]
10411 def search_roles(
10412 self,
10413 # Requested fields.
10414 fields: Optional[str] = None,
10415 # Number of results to return (used with `offset`).
10416 limit: Optional[int] = None,
10417 # Number of results to skip before returning any (used with `limit`).
10418 offset: Optional[int] = None,
10419 # Fields to sort by.
10420 sorts: Optional[str] = None,
10421 # Match role id.
10422 id: Optional[str] = None,
10423 # Match role name.
10424 name: Optional[str] = None,
10425 # Match roles by built_in status.
10426 built_in: Optional[bool] = None,
10427 # Combine given search criteria in a boolean OR expression.
10428 filter_or: Optional[bool] = None,
10429 # Search for Looker support roles.
10430 is_support_role: Optional[bool] = None,
10431 transport_options: Optional[transport.TransportOptions] = None,
10432 ) -> Sequence[mdls.Role]:
10433 """Search Roles"""
10434 response = cast(
10435 Sequence[mdls.Role],
10436 self.get(
10437 path="/roles/search",
10438 structure=Sequence[mdls.Role],
10439 query_params={
10440 "fields": fields,
10441 "limit": limit,
10442 "offset": offset,
10443 "sorts": sorts,
10444 "id": id,
10445 "name": name,
10446 "built_in": built_in,
10447 "filter_or": filter_or,
10448 "is_support_role": is_support_role,
10449 },
10450 transport_options=transport_options,
10451 ),
10452 )
10453 return response
10454
10455 # ### Search roles include user count
10456 #
10457 # Returns all role records that match the given search criteria, and attaches
10458 # associated user counts.
10459 #
10460 # If multiple search params are given and `filter_or` is FALSE or not specified,
10461 # search params are combined in a logical AND operation.
10462 # Only rows that match *all* search param criteria will be returned.
10463 #
10464 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
10465 # Results will include rows that match **any** of the search criteria.
10466 #
10467 # String search params use case-insensitive matching.
10468 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
10469 # example="dan%" will match "danger" and "Danzig" but not "David"
10470 # example="D_m%" will match "Damage" and "dump"
10471 #
10472 # Integer search params can accept a single value or a comma separated list of values. The multiple
10473 # values will be combined under a logical OR operation - results will match at least one of
10474 # the given values.
10475 #
10476 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
10477 # or exclude (respectively) rows where the column is null.
10478 #
10479 # Boolean search params accept only "true" and "false" as values.
10480 #
10481 # GET /roles/search/with_user_count -> Sequence[mdls.RoleSearch]
10482 def search_roles_with_user_count(
10483 self,
10484 # Requested fields.
10485 fields: Optional[str] = None,
10486 # Number of results to return (used with `offset`).
10487 limit: Optional[int] = None,
10488 # Number of results to skip before returning any (used with `limit`).
10489 offset: Optional[int] = None,
10490 # Fields to sort by.
10491 sorts: Optional[str] = None,
10492 # Match role id.
10493 id: Optional[str] = None,
10494 # Match role name.
10495 name: Optional[str] = None,
10496 # Match roles by built_in status.
10497 built_in: Optional[bool] = None,
10498 # Combine given search criteria in a boolean OR expression.
10499 filter_or: Optional[bool] = None,
10500 transport_options: Optional[transport.TransportOptions] = None,
10501 ) -> Sequence[mdls.RoleSearch]:
10502 """Search Roles with User Count"""
10503 response = cast(
10504 Sequence[mdls.RoleSearch],
10505 self.get(
10506 path="/roles/search/with_user_count",
10507 structure=Sequence[mdls.RoleSearch],
10508 query_params={
10509 "fields": fields,
10510 "limit": limit,
10511 "offset": offset,
10512 "sorts": sorts,
10513 "id": id,
10514 "name": name,
10515 "built_in": built_in,
10516 "filter_or": filter_or,
10517 },
10518 transport_options=transport_options,
10519 ),
10520 )
10521 return response
10522
10523 # ### Get information about the role with a specific id.
10524 #
10525 # GET /roles/{role_id} -> mdls.Role
10526 def role(
10527 self,
10528 # id of role
10529 role_id: str,
10530 transport_options: Optional[transport.TransportOptions] = None,
10531 ) -> mdls.Role:
10532 """Get Role"""
10533 role_id = self.encode_path_param(role_id)
10534 response = cast(
10535 mdls.Role,
10536 self.get(
10537 path=f"/roles/{role_id}",
10538 structure=mdls.Role,
10539 transport_options=transport_options,
10540 ),
10541 )
10542 return response
10543
10544 # ### Update information about the role with a specific id.
10545 #
10546 # PATCH /roles/{role_id} -> mdls.Role
10547 def update_role(
10548 self,
10549 # id of role
10550 role_id: str,
10551 body: mdls.WriteRole,
10552 transport_options: Optional[transport.TransportOptions] = None,
10553 ) -> mdls.Role:
10554 """Update Role"""
10555 role_id = self.encode_path_param(role_id)
10556 response = cast(
10557 mdls.Role,
10558 self.patch(
10559 path=f"/roles/{role_id}",
10560 structure=mdls.Role,
10561 body=body,
10562 transport_options=transport_options,
10563 ),
10564 )
10565 return response
10566
10567 # ### Delete the role with a specific id.
10568 #
10569 # DELETE /roles/{role_id} -> str
10570 def delete_role(
10571 self,
10572 # id of role
10573 role_id: str,
10574 transport_options: Optional[transport.TransportOptions] = None,
10575 ) -> str:
10576 """Delete Role"""
10577 role_id = self.encode_path_param(role_id)
10578 response = cast(
10579 str,
10580 self.delete(
10581 path=f"/roles/{role_id}",
10582 structure=str,
10583 transport_options=transport_options,
10584 ),
10585 )
10586 return response
10587
10588 # ### Get information about all the groups with the role that has a specific id.
10589 #
10590 # GET /roles/{role_id}/groups -> Sequence[mdls.Group]
10591 def role_groups(
10592 self,
10593 # id of role
10594 role_id: str,
10595 # Requested fields.
10596 fields: Optional[str] = None,
10597 transport_options: Optional[transport.TransportOptions] = None,
10598 ) -> Sequence[mdls.Group]:
10599 """Get Role Groups"""
10600 role_id = self.encode_path_param(role_id)
10601 response = cast(
10602 Sequence[mdls.Group],
10603 self.get(
10604 path=f"/roles/{role_id}/groups",
10605 structure=Sequence[mdls.Group],
10606 query_params={"fields": fields},
10607 transport_options=transport_options,
10608 ),
10609 )
10610 return response
10611
10612 # ### Set all groups for a role, removing all existing group associations from that role.
10613 #
10614 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
10615 #
10616 # PUT /roles/{role_id}/groups -> Sequence[mdls.Group]
10617 def set_role_groups(
10618 self,
10619 # id of role
10620 role_id: str,
10621 body: Sequence[str],
10622 transport_options: Optional[transport.TransportOptions] = None,
10623 ) -> Sequence[mdls.Group]:
10624 """Update Role Groups"""
10625 role_id = self.encode_path_param(role_id)
10626 response = cast(
10627 Sequence[mdls.Group],
10628 self.put(
10629 path=f"/roles/{role_id}/groups",
10630 structure=Sequence[mdls.Group],
10631 body=body,
10632 transport_options=transport_options,
10633 ),
10634 )
10635 return response
10636
10637 # ### Get information about all the users with the role that has a specific id.
10638 #
10639 # GET /roles/{role_id}/users -> Sequence[mdls.User]
10640 def role_users(
10641 self,
10642 # id of role
10643 role_id: str,
10644 # Requested fields.
10645 fields: Optional[str] = None,
10646 # Get only users associated directly with the role: exclude those only associated through groups.
10647 direct_association_only: Optional[bool] = None,
10648 transport_options: Optional[transport.TransportOptions] = None,
10649 ) -> Sequence[mdls.User]:
10650 """Get Role Users"""
10651 role_id = self.encode_path_param(role_id)
10652 response = cast(
10653 Sequence[mdls.User],
10654 self.get(
10655 path=f"/roles/{role_id}/users",
10656 structure=Sequence[mdls.User],
10657 query_params={
10658 "fields": fields,
10659 "direct_association_only": direct_association_only,
10660 },
10661 transport_options=transport_options,
10662 ),
10663 )
10664 return response
10665
10666 # ### Set all the users of the role with a specific id.
10667 #
10668 # PUT /roles/{role_id}/users -> Sequence[mdls.User]
10669 def set_role_users(
10670 self,
10671 # id of role
10672 role_id: str,
10673 body: Sequence[str],
10674 transport_options: Optional[transport.TransportOptions] = None,
10675 ) -> Sequence[mdls.User]:
10676 """Update Role Users"""
10677 role_id = self.encode_path_param(role_id)
10678 response = cast(
10679 Sequence[mdls.User],
10680 self.put(
10681 path=f"/roles/{role_id}/users",
10682 structure=Sequence[mdls.User],
10683 body=body,
10684 transport_options=transport_options,
10685 ),
10686 )
10687 return response
10688
10689 # endregion
10690
10691 # region ScheduledPlan: Manage Scheduled Plans
10692
10693 # ### Get Scheduled Plans for a Space
10694 #
10695 # Returns scheduled plans owned by the caller for a given space id.
10696 #
10697 # GET /scheduled_plans/space/{space_id} -> Sequence[mdls.ScheduledPlan]
10698 def scheduled_plans_for_space(
10699 self,
10700 # Space Id
10701 space_id: str,
10702 # Requested fields.
10703 fields: Optional[str] = None,
10704 transport_options: Optional[transport.TransportOptions] = None,
10705 ) -> Sequence[mdls.ScheduledPlan]:
10706 """Scheduled Plans for Space"""
10707 space_id = self.encode_path_param(space_id)
10708 response = cast(
10709 Sequence[mdls.ScheduledPlan],
10710 self.get(
10711 path=f"/scheduled_plans/space/{space_id}",
10712 structure=Sequence[mdls.ScheduledPlan],
10713 query_params={"fields": fields},
10714 transport_options=transport_options,
10715 ),
10716 )
10717 return response
10718
10719 # ### Get Information About a Scheduled Plan
10720 #
10721 # Admins can fetch information about other users' Scheduled Plans.
10722 #
10723 # GET /scheduled_plans/{scheduled_plan_id} -> mdls.ScheduledPlan
10724 def scheduled_plan(
10725 self,
10726 # Scheduled Plan Id
10727 scheduled_plan_id: str,
10728 # Requested fields.
10729 fields: Optional[str] = None,
10730 transport_options: Optional[transport.TransportOptions] = None,
10731 ) -> mdls.ScheduledPlan:
10732 """Get Scheduled Plan"""
10733 scheduled_plan_id = self.encode_path_param(scheduled_plan_id)
10734 response = cast(
10735 mdls.ScheduledPlan,
10736 self.get(
10737 path=f"/scheduled_plans/{scheduled_plan_id}",
10738 structure=mdls.ScheduledPlan,
10739 query_params={"fields": fields},
10740 transport_options=transport_options,
10741 ),
10742 )
10743 return response
10744
10745 # ### Update a Scheduled Plan
10746 #
10747 # Admins can update other users' Scheduled Plans.
10748 #
10749 # Note: Any scheduled plan destinations specified in an update will **replace** all scheduled plan destinations
10750 # currently defined for the scheduled plan.
10751 #
10752 # For Example: If a scheduled plan has destinations A, B, and C, and you call update on this scheduled plan
10753 # specifying only B in the destinations, then destinations A and C will be deleted by the update.
10754 #
10755 # Updating a scheduled plan to assign null or an empty array to the scheduled_plan_destinations property is an error, as a scheduled plan must always have at least one destination.
10756 #
10757 # If you omit the scheduled_plan_destinations property from the object passed to update, then the destinations
10758 # defined on the original scheduled plan will remain unchanged.
10759 #
10760 # #### Email Permissions:
10761 #
10762 # For details about permissions required to schedule delivery to email and the safeguards
10763 # Looker offers to protect against sending to unauthorized email destinations, see [Email Domain Allow List for Scheduled Looks](https://cloud.google.com/looker/docs/r/api/embed-permissions).
10764 #
10765 #
10766 # #### Scheduled Plan Destination Formats
10767 #
10768 # Scheduled plan destinations must specify the data format to produce and send to the destination.
10769 #
10770 # Formats:
10771 #
10772 # | format | Description
10773 # | :-----------: | :--- |
10774 # | json | A JSON object containing a `data` property which contains an array of JSON objects, one per row. No metadata.
10775 # | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
10776 # | inline_json | Same as the JSON format, except that the `data` property is a string containing JSON-escaped row data. Additional properties describe the data operation. This format is primarily used to send data to web hooks so that the web hook doesn't have to re-encode the JSON row data in order to pass it on to its ultimate destination.
10777 # | csv | Comma separated values with a header
10778 # | txt | Tab separated values with a header
10779 # | html | Simple html
10780 # | xlsx | MS Excel spreadsheet
10781 # | wysiwyg_pdf | Dashboard rendered in a tiled layout to produce a PDF document
10782 # | assembled_pdf | Dashboard rendered in a single column layout to produce a PDF document
10783 # | wysiwyg_png | Dashboard rendered in a tiled layout to produce a PNG image
10784 # ||
10785 #
10786 # Valid formats vary by destination type and source object. `wysiwyg_pdf` is only valid for dashboards, for example.
10787 #
10788 # PATCH /scheduled_plans/{scheduled_plan_id} -> mdls.ScheduledPlan
10789 def update_scheduled_plan(
10790 self,
10791 # Scheduled Plan Id
10792 scheduled_plan_id: str,
10793 body: mdls.WriteScheduledPlan,
10794 transport_options: Optional[transport.TransportOptions] = None,
10795 ) -> mdls.ScheduledPlan:
10796 """Update Scheduled Plan"""
10797 scheduled_plan_id = self.encode_path_param(scheduled_plan_id)
10798 response = cast(
10799 mdls.ScheduledPlan,
10800 self.patch(
10801 path=f"/scheduled_plans/{scheduled_plan_id}",
10802 structure=mdls.ScheduledPlan,
10803 body=body,
10804 transport_options=transport_options,
10805 ),
10806 )
10807 return response
10808
10809 # ### Delete a Scheduled Plan
10810 #
10811 # Normal users can only delete their own scheduled plans.
10812 # Admins can delete other users' scheduled plans.
10813 # This delete cannot be undone.
10814 #
10815 # DELETE /scheduled_plans/{scheduled_plan_id} -> str
10816 def delete_scheduled_plan(
10817 self,
10818 # Scheduled Plan Id
10819 scheduled_plan_id: str,
10820 transport_options: Optional[transport.TransportOptions] = None,
10821 ) -> str:
10822 """Delete Scheduled Plan"""
10823 scheduled_plan_id = self.encode_path_param(scheduled_plan_id)
10824 response = cast(
10825 str,
10826 self.delete(
10827 path=f"/scheduled_plans/{scheduled_plan_id}",
10828 structure=str,
10829 transport_options=transport_options,
10830 ),
10831 )
10832 return response
10833
10834 # ### List All Scheduled Plans
10835 #
10836 # Returns all scheduled plans which belong to the caller or given user.
10837 #
10838 # If no user_id is provided, this function returns the scheduled plans owned by the caller.
10839 #
10840 #
10841 # To list all schedules for all users, pass `all_users=true`.
10842 #
10843 #
10844 # The caller must have `see_schedules` permission to see other users' scheduled plans.
10845 #
10846 # GET /scheduled_plans -> Sequence[mdls.ScheduledPlan]
10847 def all_scheduled_plans(
10848 self,
10849 # Return scheduled plans belonging to this user_id. If not provided, returns scheduled plans owned by the caller.
10850 user_id: Optional[str] = None,
10851 # Comma delimited list of field names. If provided, only the fields specified will be included in the response
10852 fields: Optional[str] = None,
10853 # Return scheduled plans belonging to all users (caller needs see_schedules permission)
10854 all_users: Optional[bool] = None,
10855 transport_options: Optional[transport.TransportOptions] = None,
10856 ) -> Sequence[mdls.ScheduledPlan]:
10857 """Get All Scheduled Plans"""
10858 response = cast(
10859 Sequence[mdls.ScheduledPlan],
10860 self.get(
10861 path="/scheduled_plans",
10862 structure=Sequence[mdls.ScheduledPlan],
10863 query_params={
10864 "user_id": user_id,
10865 "fields": fields,
10866 "all_users": all_users,
10867 },
10868 transport_options=transport_options,
10869 ),
10870 )
10871 return response
10872
10873 # ### Create a Scheduled Plan
10874 #
10875 # Create a scheduled plan to render a Look or Dashboard on a recurring schedule.
10876 #
10877 # To create a scheduled plan, you MUST provide values for the following fields:
10878 # `name`
10879 # and
10880 # `look_id`, `dashboard_id`, `lookml_dashboard_id`, or `query_id`
10881 # and
10882 # `cron_tab` or `datagroup`
10883 # and
10884 # at least one scheduled_plan_destination
10885 #
10886 # A scheduled plan MUST have at least one scheduled_plan_destination defined.
10887 #
10888 # When `look_id` is set, `require_no_results`, `require_results`, and `require_change` are all required.
10889 #
10890 # If `create_scheduled_plan` fails with a 422 error, be sure to look at the error messages in the response which will explain exactly what fields are missing or values that are incompatible.
10891 #
10892 # The queries that provide the data for the look or dashboard are run in the context of user account that owns the scheduled plan.
10893 #
10894 # When `run_as_recipient` is `false` or not specified, the queries that provide the data for the
10895 # look or dashboard are run in the context of user account that owns the scheduled plan.
10896 #
10897 # When `run_as_recipient` is `true` and all the email recipients are Looker user accounts, the
10898 # queries are run in the context of each recipient, so different recipients may see different
10899 # data from the same scheduled render of a look or dashboard. For more details, see [Run As Recipient](https://cloud.google.com/looker/docs/r/admin/run-as-recipient).
10900 #
10901 # Admins can create and modify scheduled plans on behalf of other users by specifying a user id.
10902 # Non-admin users may not create or modify scheduled plans by or for other users.
10903 #
10904 # #### Email Permissions:
10905 #
10906 # For details about permissions required to schedule delivery to email and the safeguards
10907 # Looker offers to protect against sending to unauthorized email destinations, see [Email Domain Allow List for Scheduled Looks](https://cloud.google.com/looker/docs/r/api/embed-permissions).
10908 #
10909 #
10910 # #### Scheduled Plan Destination Formats
10911 #
10912 # Scheduled plan destinations must specify the data format to produce and send to the destination.
10913 #
10914 # Formats:
10915 #
10916 # | format | Description
10917 # | :-----------: | :--- |
10918 # | json | A JSON object containing a `data` property which contains an array of JSON objects, one per row. No metadata.
10919 # | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
10920 # | inline_json | Same as the JSON format, except that the `data` property is a string containing JSON-escaped row data. Additional properties describe the data operation. This format is primarily used to send data to web hooks so that the web hook doesn't have to re-encode the JSON row data in order to pass it on to its ultimate destination.
10921 # | csv | Comma separated values with a header
10922 # | txt | Tab separated values with a header
10923 # | html | Simple html
10924 # | xlsx | MS Excel spreadsheet
10925 # | wysiwyg_pdf | Dashboard rendered in a tiled layout to produce a PDF document
10926 # | assembled_pdf | Dashboard rendered in a single column layout to produce a PDF document
10927 # | wysiwyg_png | Dashboard rendered in a tiled layout to produce a PNG image
10928 # ||
10929 #
10930 # Valid formats vary by destination type and source object. `wysiwyg_pdf` is only valid for dashboards, for example.
10931 #
10932 # POST /scheduled_plans -> mdls.ScheduledPlan
10933 def create_scheduled_plan(
10934 self,
10935 body: mdls.WriteScheduledPlan,
10936 transport_options: Optional[transport.TransportOptions] = None,
10937 ) -> mdls.ScheduledPlan:
10938 """Create Scheduled Plan"""
10939 response = cast(
10940 mdls.ScheduledPlan,
10941 self.post(
10942 path="/scheduled_plans",
10943 structure=mdls.ScheduledPlan,
10944 body=body,
10945 transport_options=transport_options,
10946 ),
10947 )
10948 return response
10949
10950 # ### Run a Scheduled Plan Immediately
10951 #
10952 # Create a scheduled plan that runs only once, and immediately.
10953 #
10954 # This can be useful for testing a Scheduled Plan before committing to a production schedule.
10955 #
10956 # Admins can create scheduled plans on behalf of other users by specifying a user id.
10957 #
10958 # This API is rate limited to prevent it from being used for relay spam or DoS attacks
10959 #
10960 # #### Email Permissions:
10961 #
10962 # For details about permissions required to schedule delivery to email and the safeguards
10963 # Looker offers to protect against sending to unauthorized email destinations, see [Email Domain Allow List for Scheduled Looks](https://cloud.google.com/looker/docs/r/api/embed-permissions).
10964 #
10965 #
10966 # #### Scheduled Plan Destination Formats
10967 #
10968 # Scheduled plan destinations must specify the data format to produce and send to the destination.
10969 #
10970 # Formats:
10971 #
10972 # | format | Description
10973 # | :-----------: | :--- |
10974 # | json | A JSON object containing a `data` property which contains an array of JSON objects, one per row. No metadata.
10975 # | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
10976 # | inline_json | Same as the JSON format, except that the `data` property is a string containing JSON-escaped row data. Additional properties describe the data operation. This format is primarily used to send data to web hooks so that the web hook doesn't have to re-encode the JSON row data in order to pass it on to its ultimate destination.
10977 # | csv | Comma separated values with a header
10978 # | txt | Tab separated values with a header
10979 # | html | Simple html
10980 # | xlsx | MS Excel spreadsheet
10981 # | wysiwyg_pdf | Dashboard rendered in a tiled layout to produce a PDF document
10982 # | assembled_pdf | Dashboard rendered in a single column layout to produce a PDF document
10983 # | wysiwyg_png | Dashboard rendered in a tiled layout to produce a PNG image
10984 # ||
10985 #
10986 # Valid formats vary by destination type and source object. `wysiwyg_pdf` is only valid for dashboards, for example.
10987 #
10988 # POST /scheduled_plans/run_once -> mdls.ScheduledPlan
10989 def scheduled_plan_run_once(
10990 self,
10991 body: mdls.WriteScheduledPlan,
10992 transport_options: Optional[transport.TransportOptions] = None,
10993 ) -> mdls.ScheduledPlan:
10994 """Run Scheduled Plan Once"""
10995 response = cast(
10996 mdls.ScheduledPlan,
10997 self.post(
10998 path="/scheduled_plans/run_once",
10999 structure=mdls.ScheduledPlan,
11000 body=body,
11001 transport_options=transport_options,
11002 ),
11003 )
11004 return response
11005
11006 # ### Search Scheduled Plans
11007 #
11008 # Returns all scheduled plans which matches the given search criteria.
11009 #
11010 # If no user_id is provided, this function returns the scheduled plans owned by the caller.
11011 #
11012 #
11013 # To list all schedules for all users, pass `all_users=true`.
11014 #
11015 #
11016 # The caller must have `see_schedules` permission to see other users' scheduled plans.
11017 #
11018 # GET /scheduled_plans/search -> Sequence[mdls.ScheduledPlan]
11019 def search_scheduled_plans(
11020 self,
11021 # Return scheduled plans belonging to this user_id. If not provided, returns scheduled plans owned by the caller.
11022 user_id: Optional[str] = None,
11023 # Comma delimited list of field names. If provided, only the fields specified will be included in the response
11024 fields: Optional[str] = None,
11025 # Return scheduled plans belonging to all users (caller needs see_schedules permission)
11026 all_users: Optional[bool] = None,
11027 # Number of results to return. (used with offset and takes priority over page and per_page)
11028 limit: Optional[int] = None,
11029 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
11030 offset: Optional[int] = None,
11031 # Fields to sort by.
11032 sorts: Optional[str] = None,
11033 # Match Scheduled plan's name.
11034 name: Optional[str] = None,
11035 # Returns scheduled plans belonging to user with this first name.
11036 user_first_name: Optional[str] = None,
11037 # Returns scheduled plans belonging to user with this last name.
11038 user_last_name: Optional[str] = None,
11039 # Returns scheduled plans created on this Dashboard.
11040 dashboard_id: Optional[str] = None,
11041 # Returns scheduled plans created on this Look.
11042 look_id: Optional[str] = None,
11043 # Returns scheduled plans created on this LookML Dashboard.
11044 lookml_dashboard_id: Optional[str] = None,
11045 # Match recipient address.
11046 recipient: Optional[str] = None,
11047 # Match scheduled plan's destination type.
11048 destination_type: Optional[str] = None,
11049 # Match scheduled plan's delivery format.
11050 delivery_format: Optional[str] = None,
11051 # Combine given search criteria in a boolean OR expression
11052 filter_or: Optional[bool] = None,
11053 transport_options: Optional[transport.TransportOptions] = None,
11054 ) -> Sequence[mdls.ScheduledPlan]:
11055 """Search Scheduled Plans"""
11056 response = cast(
11057 Sequence[mdls.ScheduledPlan],
11058 self.get(
11059 path="/scheduled_plans/search",
11060 structure=Sequence[mdls.ScheduledPlan],
11061 query_params={
11062 "user_id": user_id,
11063 "fields": fields,
11064 "all_users": all_users,
11065 "limit": limit,
11066 "offset": offset,
11067 "sorts": sorts,
11068 "name": name,
11069 "user_first_name": user_first_name,
11070 "user_last_name": user_last_name,
11071 "dashboard_id": dashboard_id,
11072 "look_id": look_id,
11073 "lookml_dashboard_id": lookml_dashboard_id,
11074 "recipient": recipient,
11075 "destination_type": destination_type,
11076 "delivery_format": delivery_format,
11077 "filter_or": filter_or,
11078 },
11079 transport_options=transport_options,
11080 ),
11081 )
11082 return response
11083
11084 # ### Get Scheduled Plans for a Look
11085 #
11086 # Returns all scheduled plans for a look which belong to the caller or given user.
11087 #
11088 # If no user_id is provided, this function returns the scheduled plans owned by the caller.
11089 #
11090 #
11091 # To list all schedules for all users, pass `all_users=true`.
11092 #
11093 #
11094 # The caller must have `see_schedules` permission to see other users' scheduled plans.
11095 #
11096 # GET /scheduled_plans/look/{look_id} -> Sequence[mdls.ScheduledPlan]
11097 def scheduled_plans_for_look(
11098 self,
11099 # Look Id
11100 look_id: str,
11101 # User Id (default is requesting user if not specified)
11102 user_id: Optional[str] = None,
11103 # Requested fields.
11104 fields: Optional[str] = None,
11105 # Return scheduled plans belonging to all users for the look
11106 all_users: Optional[bool] = None,
11107 transport_options: Optional[transport.TransportOptions] = None,
11108 ) -> Sequence[mdls.ScheduledPlan]:
11109 """Scheduled Plans for Look"""
11110 look_id = self.encode_path_param(look_id)
11111 response = cast(
11112 Sequence[mdls.ScheduledPlan],
11113 self.get(
11114 path=f"/scheduled_plans/look/{look_id}",
11115 structure=Sequence[mdls.ScheduledPlan],
11116 query_params={
11117 "user_id": user_id,
11118 "fields": fields,
11119 "all_users": all_users,
11120 },
11121 transport_options=transport_options,
11122 ),
11123 )
11124 return response
11125
11126 # ### Get Scheduled Plans for a Dashboard
11127 #
11128 # Returns all scheduled plans for a dashboard which belong to the caller or given user.
11129 #
11130 # If no user_id is provided, this function returns the scheduled plans owned by the caller.
11131 #
11132 #
11133 # To list all schedules for all users, pass `all_users=true`.
11134 #
11135 #
11136 # The caller must have `see_schedules` permission to see other users' scheduled plans.
11137 #
11138 # GET /scheduled_plans/dashboard/{dashboard_id} -> Sequence[mdls.ScheduledPlan]
11139 def scheduled_plans_for_dashboard(
11140 self,
11141 # Dashboard Id
11142 dashboard_id: str,
11143 # User Id (default is requesting user if not specified)
11144 user_id: Optional[str] = None,
11145 # Return scheduled plans belonging to all users for the dashboard
11146 all_users: Optional[bool] = None,
11147 # Requested fields.
11148 fields: Optional[str] = None,
11149 transport_options: Optional[transport.TransportOptions] = None,
11150 ) -> Sequence[mdls.ScheduledPlan]:
11151 """Scheduled Plans for Dashboard"""
11152 dashboard_id = self.encode_path_param(dashboard_id)
11153 response = cast(
11154 Sequence[mdls.ScheduledPlan],
11155 self.get(
11156 path=f"/scheduled_plans/dashboard/{dashboard_id}",
11157 structure=Sequence[mdls.ScheduledPlan],
11158 query_params={
11159 "user_id": user_id,
11160 "all_users": all_users,
11161 "fields": fields,
11162 },
11163 transport_options=transport_options,
11164 ),
11165 )
11166 return response
11167
11168 # ### Get Scheduled Plans for a LookML Dashboard
11169 #
11170 # Returns all scheduled plans for a LookML Dashboard which belong to the caller or given user.
11171 #
11172 # If no user_id is provided, this function returns the scheduled plans owned by the caller.
11173 #
11174 #
11175 # To list all schedules for all users, pass `all_users=true`.
11176 #
11177 #
11178 # The caller must have `see_schedules` permission to see other users' scheduled plans.
11179 #
11180 # GET /scheduled_plans/lookml_dashboard/{lookml_dashboard_id} -> Sequence[mdls.ScheduledPlan]
11181 def scheduled_plans_for_lookml_dashboard(
11182 self,
11183 # LookML Dashboard Id
11184 lookml_dashboard_id: str,
11185 # User Id (default is requesting user if not specified)
11186 user_id: Optional[str] = None,
11187 # Requested fields.
11188 fields: Optional[str] = None,
11189 # Return scheduled plans belonging to all users for the dashboard
11190 all_users: Optional[bool] = None,
11191 transport_options: Optional[transport.TransportOptions] = None,
11192 ) -> Sequence[mdls.ScheduledPlan]:
11193 """Scheduled Plans for LookML Dashboard"""
11194 lookml_dashboard_id = self.encode_path_param(lookml_dashboard_id)
11195 response = cast(
11196 Sequence[mdls.ScheduledPlan],
11197 self.get(
11198 path=f"/scheduled_plans/lookml_dashboard/{lookml_dashboard_id}",
11199 structure=Sequence[mdls.ScheduledPlan],
11200 query_params={
11201 "user_id": user_id,
11202 "fields": fields,
11203 "all_users": all_users,
11204 },
11205 transport_options=transport_options,
11206 ),
11207 )
11208 return response
11209
11210 # ### Run a Scheduled Plan By Id Immediately
11211 # This function creates a run-once schedule plan based on an existing scheduled plan,
11212 # applies modifications (if any) to the new scheduled plan, and runs the new schedule plan immediately.
11213 # This can be useful for testing modifications to an existing scheduled plan before committing to a production schedule.
11214 #
11215 # This function internally performs the following operations:
11216 #
11217 # 1. Copies the properties of the existing scheduled plan into a new scheduled plan
11218 # 2. Copies any properties passed in the JSON body of this request into the new scheduled plan (replacing the original values)
11219 # 3. Creates the new scheduled plan
11220 # 4. Runs the new scheduled plan
11221 #
11222 # The original scheduled plan is not modified by this operation.
11223 # Admins can create, modify, and run scheduled plans on behalf of other users by specifying a user id.
11224 # Non-admins can only create, modify, and run their own scheduled plans.
11225 #
11226 # #### Email Permissions:
11227 #
11228 # For details about permissions required to schedule delivery to email and the safeguards
11229 # Looker offers to protect against sending to unauthorized email destinations, see [Email Domain Allow List for Scheduled Looks](https://cloud.google.com/looker/docs/r/api/embed-permissions).
11230 #
11231 #
11232 # #### Scheduled Plan Destination Formats
11233 #
11234 # Scheduled plan destinations must specify the data format to produce and send to the destination.
11235 #
11236 # Formats:
11237 #
11238 # | format | Description
11239 # | :-----------: | :--- |
11240 # | json | A JSON object containing a `data` property which contains an array of JSON objects, one per row. No metadata.
11241 # | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
11242 # | inline_json | Same as the JSON format, except that the `data` property is a string containing JSON-escaped row data. Additional properties describe the data operation. This format is primarily used to send data to web hooks so that the web hook doesn't have to re-encode the JSON row data in order to pass it on to its ultimate destination.
11243 # | csv | Comma separated values with a header
11244 # | txt | Tab separated values with a header
11245 # | html | Simple html
11246 # | xlsx | MS Excel spreadsheet
11247 # | wysiwyg_pdf | Dashboard rendered in a tiled layout to produce a PDF document
11248 # | assembled_pdf | Dashboard rendered in a single column layout to produce a PDF document
11249 # | wysiwyg_png | Dashboard rendered in a tiled layout to produce a PNG image
11250 # ||
11251 #
11252 # Valid formats vary by destination type and source object. `wysiwyg_pdf` is only valid for dashboards, for example.
11253 #
11254 #
11255 #
11256 # This API is rate limited to prevent it from being used for relay spam or DoS attacks
11257 #
11258 # POST /scheduled_plans/{scheduled_plan_id}/run_once -> mdls.ScheduledPlan
11259 def scheduled_plan_run_once_by_id(
11260 self,
11261 # Id of schedule plan to copy and run
11262 scheduled_plan_id: str,
11263 body: Optional[mdls.WriteScheduledPlan] = None,
11264 transport_options: Optional[transport.TransportOptions] = None,
11265 ) -> mdls.ScheduledPlan:
11266 """Run Scheduled Plan Once by Id"""
11267 scheduled_plan_id = self.encode_path_param(scheduled_plan_id)
11268 response = cast(
11269 mdls.ScheduledPlan,
11270 self.post(
11271 path=f"/scheduled_plans/{scheduled_plan_id}/run_once",
11272 structure=mdls.ScheduledPlan,
11273 body=body,
11274 transport_options=transport_options,
11275 ),
11276 )
11277 return response
11278
11279 # endregion
11280
11281 # region Session: Session Information
11282
11283 # ### Get API Session
11284 #
11285 # Returns information about the current API session, such as which workspace is selected for the session.
11286 #
11287 # GET /session -> mdls.ApiSession
11288 def session(
11289 self,
11290 transport_options: Optional[transport.TransportOptions] = None,
11291 ) -> mdls.ApiSession:
11292 """Get Auth"""
11293 response = cast(
11294 mdls.ApiSession,
11295 self.get(
11296 path="/session",
11297 structure=mdls.ApiSession,
11298 transport_options=transport_options,
11299 ),
11300 )
11301 return response
11302
11303 # ### Update API Session
11304 #
11305 # #### API Session Workspace
11306 #
11307 # You can use this endpoint to change the active workspace for the current API session.
11308 #
11309 # Only one workspace can be active in a session. The active workspace can be changed
11310 # any number of times in a session.
11311 #
11312 # The default workspace for API sessions is the "production" workspace.
11313 #
11314 # All Looker APIs that use projects or lookml models (such as running queries) will
11315 # use the version of project and model files defined by this workspace for the lifetime of the
11316 # current API session or until the session workspace is changed again.
11317 #
11318 # An API session has the same lifetime as the access_token used to authenticate API requests. Each successful
11319 # API login generates a new access_token and a new API session.
11320 #
11321 # If your Looker API client application needs to work in a dev workspace across multiple
11322 # API sessions, be sure to select the dev workspace after each login.
11323 #
11324 # PATCH /session -> mdls.ApiSession
11325 def update_session(
11326 self,
11327 body: mdls.WriteApiSession,
11328 transport_options: Optional[transport.TransportOptions] = None,
11329 ) -> mdls.ApiSession:
11330 """Update Auth"""
11331 response = cast(
11332 mdls.ApiSession,
11333 self.patch(
11334 path="/session",
11335 structure=mdls.ApiSession,
11336 body=body,
11337 transport_options=transport_options,
11338 ),
11339 )
11340 return response
11341
11342 # endregion
11343
11344 # region SqlInterfaceQuery: Run and Manage SQL Interface Queries
11345
11346 # ### Handles Avatica RPC metadata requests for SQL Interface queries
11347 #
11348 # GET /sql_interface_queries/metadata -> mdls.SqlInterfaceQueryMetadata
11349 def sql_interface_metadata(
11350 self,
11351 # Avatica RPC request
11352 avatica_request: Optional[str] = None,
11353 transport_options: Optional[transport.TransportOptions] = None,
11354 ) -> mdls.SqlInterfaceQueryMetadata:
11355 """Get SQL Interface Query Metadata"""
11356 response = cast(
11357 mdls.SqlInterfaceQueryMetadata,
11358 self.get(
11359 path="/sql_interface_queries/metadata",
11360 structure=mdls.SqlInterfaceQueryMetadata,
11361 query_params={"avatica_request": avatica_request},
11362 transport_options=transport_options,
11363 ),
11364 )
11365 return response
11366
11367 # ### Run a saved SQL interface query.
11368 #
11369 # This runs a previously created SQL interface query.
11370 #
11371 # The 'result_format' parameter specifies the desired structure and format of the response.
11372 #
11373 # Supported formats:
11374 #
11375 # | result_format | Description
11376 # | :-----------: | :--- |
11377 # | json_bi | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
11378 #
11379 # GET /sql_interface_queries/{query_id}/run/{result_format} -> mdls.JsonBi
11380 def run_sql_interface_query(
11381 self,
11382 # Integer id of query
11383 query_id: int,
11384 # Format of result, options are: ["json_bi"]
11385 result_format: str,
11386 transport_options: Optional[transport.TransportOptions] = None,
11387 ) -> mdls.JsonBi:
11388 """Run SQL Interface Query"""
11389 result_format = self.encode_path_param(result_format)
11390 response = cast(
11391 mdls.JsonBi,
11392 self.get(
11393 path=f"/sql_interface_queries/{query_id}/run/{result_format}",
11394 structure=mdls.JsonBi,
11395 transport_options=transport_options,
11396 ),
11397 )
11398 return response
11399
11400 # ### Create a SQL interface query.
11401 #
11402 # This allows you to create a new SQL interface query that you can later run. Looker queries are immutable once created
11403 # and are not deleted. If you create a query that is exactly like an existing query then the existing query
11404 # will be returned and no new query will be created. Whether a new query is created or not, you can use
11405 # the 'id' in the returned query with the 'run' method.
11406 #
11407 # The query parameters are passed as json in the body of the request.
11408 #
11409 # POST /sql_interface_queries -> mdls.SqlInterfaceQuery
11410 def create_sql_interface_query(
11411 self,
11412 body: mdls.WriteSqlInterfaceQueryCreate,
11413 transport_options: Optional[transport.TransportOptions] = None,
11414 ) -> mdls.SqlInterfaceQuery:
11415 """Create SQL Interface Query"""
11416 response = cast(
11417 mdls.SqlInterfaceQuery,
11418 self.post(
11419 path="/sql_interface_queries",
11420 structure=mdls.SqlInterfaceQuery,
11421 body=body,
11422 transport_options=transport_options,
11423 ),
11424 )
11425 return response
11426
11427 # endregion
11428
11429 # region Theme: Manage Themes
11430
11431 # ### Get an array of all existing themes
11432 #
11433 # Get a **single theme** by id with [Theme](#!/Theme/theme)
11434 #
11435 # This method returns an array of all existing themes. The active time for the theme is not considered.
11436 #
11437 # **Note**: Custom themes needs to be enabled by Looker. Unless custom themes are enabled, only the automatically generated default theme can be used. Please contact your Account Manager or https://console.cloud.google.com/support/cases/ to update your license for this feature.
11438 #
11439 # GET /themes -> Sequence[mdls.Theme]
11440 def all_themes(
11441 self,
11442 # Requested fields.
11443 fields: Optional[str] = None,
11444 transport_options: Optional[transport.TransportOptions] = None,
11445 ) -> Sequence[mdls.Theme]:
11446 """Get All Themes"""
11447 response = cast(
11448 Sequence[mdls.Theme],
11449 self.get(
11450 path="/themes",
11451 structure=Sequence[mdls.Theme],
11452 query_params={"fields": fields},
11453 transport_options=transport_options,
11454 ),
11455 )
11456 return response
11457
11458 # ### Create a theme
11459 #
11460 # Creates a new theme object, returning the theme details, including the created id.
11461 #
11462 # If `settings` are not specified, the default theme settings will be copied into the new theme.
11463 #
11464 # The theme `name` can only contain alphanumeric characters or underscores. Theme names should not contain any confidential information, such as customer names.
11465 #
11466 # **Update** an existing theme with [Update Theme](#!/Theme/update_theme)
11467 #
11468 # **Permanently delete** an existing theme with [Delete Theme](#!/Theme/delete_theme)
11469 #
11470 # For more information, see [Creating and Applying Themes](https://cloud.google.com/looker/docs/r/admin/themes).
11471 #
11472 # **Note**: Custom themes needs to be enabled by Looker. Unless custom themes are enabled, only the automatically generated default theme can be used. Please contact your Account Manager or https://console.cloud.google.com/support/cases/ to update your license for this feature.
11473 #
11474 # POST /themes -> mdls.Theme
11475 def create_theme(
11476 self,
11477 body: mdls.WriteTheme,
11478 transport_options: Optional[transport.TransportOptions] = None,
11479 ) -> mdls.Theme:
11480 """Create Theme"""
11481 response = cast(
11482 mdls.Theme,
11483 self.post(
11484 path="/themes",
11485 structure=mdls.Theme,
11486 body=body,
11487 transport_options=transport_options,
11488 ),
11489 )
11490 return response
11491
11492 # ### Search all themes for matching criteria.
11493 #
11494 # Returns an **array of theme objects** that match the specified search criteria.
11495 #
11496 # | Search Parameters | Description
11497 # | :-------------------: | :------ |
11498 # | `begin_at` only | Find themes active at or after `begin_at`
11499 # | `end_at` only | Find themes active at or before `end_at`
11500 # | both set | Find themes with an active inclusive period between `begin_at` and `end_at`
11501 #
11502 # Note: Range matching requires boolean AND logic.
11503 # When using `begin_at` and `end_at` together, do not use `filter_or`=TRUE
11504 #
11505 # If multiple search params are given and `filter_or` is FALSE or not specified,
11506 # search params are combined in a logical AND operation.
11507 # Only rows that match *all* search param criteria will be returned.
11508 #
11509 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
11510 # Results will include rows that match **any** of the search criteria.
11511 #
11512 # String search params use case-insensitive matching.
11513 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
11514 # example="dan%" will match "danger" and "Danzig" but not "David"
11515 # example="D_m%" will match "Damage" and "dump"
11516 #
11517 # Integer search params can accept a single value or a comma separated list of values. The multiple
11518 # values will be combined under a logical OR operation - results will match at least one of
11519 # the given values.
11520 #
11521 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
11522 # or exclude (respectively) rows where the column is null.
11523 #
11524 # Boolean search params accept only "true" and "false" as values.
11525 #
11526 #
11527 # Get a **single theme** by id with [Theme](#!/Theme/theme)
11528 #
11529 # **Note**: Custom themes needs to be enabled by Looker. Unless custom themes are enabled, only the automatically generated default theme can be used. Please contact your Account Manager or https://console.cloud.google.com/support/cases/ to update your license for this feature.
11530 #
11531 # GET /themes/search -> Sequence[mdls.Theme]
11532 def search_themes(
11533 self,
11534 # Match theme id.
11535 id: Optional[str] = None,
11536 # Match theme name.
11537 name: Optional[str] = None,
11538 # Timestamp for activation.
11539 begin_at: Optional[datetime.datetime] = None,
11540 # Timestamp for expiration.
11541 end_at: Optional[datetime.datetime] = None,
11542 # Number of results to return (used with `offset`).
11543 limit: Optional[int] = None,
11544 # Number of results to skip before returning any (used with `limit`).
11545 offset: Optional[int] = None,
11546 # Fields to sort by.
11547 sorts: Optional[str] = None,
11548 # Requested fields.
11549 fields: Optional[str] = None,
11550 # Combine given search criteria in a boolean OR expression
11551 filter_or: Optional[bool] = None,
11552 transport_options: Optional[transport.TransportOptions] = None,
11553 ) -> Sequence[mdls.Theme]:
11554 """Search Themes"""
11555 response = cast(
11556 Sequence[mdls.Theme],
11557 self.get(
11558 path="/themes/search",
11559 structure=Sequence[mdls.Theme],
11560 query_params={
11561 "id": id,
11562 "name": name,
11563 "begin_at": begin_at,
11564 "end_at": end_at,
11565 "limit": limit,
11566 "offset": offset,
11567 "sorts": sorts,
11568 "fields": fields,
11569 "filter_or": filter_or,
11570 },
11571 transport_options=transport_options,
11572 ),
11573 )
11574 return response
11575
11576 # ### Get the default theme
11577 #
11578 # Returns the active theme object set as the default.
11579 #
11580 # The **default** theme name can be set in the UI on the Admin|Theme UI page
11581 #
11582 # The optional `ts` parameter can specify a different timestamp than "now." If specified, it returns the default theme at the time indicated.
11583 #
11584 # GET /themes/default -> mdls.Theme
11585 def default_theme(
11586 self,
11587 # Timestamp representing the target datetime for the active period. Defaults to 'now'
11588 ts: Optional[datetime.datetime] = None,
11589 transport_options: Optional[transport.TransportOptions] = None,
11590 ) -> mdls.Theme:
11591 """Get Default Theme"""
11592 response = cast(
11593 mdls.Theme,
11594 self.get(
11595 path="/themes/default",
11596 structure=mdls.Theme,
11597 query_params={"ts": ts},
11598 transport_options=transport_options,
11599 ),
11600 )
11601 return response
11602
11603 # ### Set the global default theme by theme name
11604 #
11605 # Only Admin users can call this function.
11606 #
11607 # Only an active theme with no expiration (`end_at` not set) can be assigned as the default theme. As long as a theme has an active record with no expiration, it can be set as the default.
11608 #
11609 # [Create Theme](#!/Theme/create) has detailed information on rules for default and active themes
11610 #
11611 # Returns the new specified default theme object.
11612 #
11613 # **Note**: Custom themes needs to be enabled by Looker. Unless custom themes are enabled, only the automatically generated default theme can be used. Please contact your Account Manager or https://console.cloud.google.com/support/cases/ to update your license for this feature.
11614 #
11615 # PUT /themes/default -> mdls.Theme
11616 def set_default_theme(
11617 self,
11618 # Name of theme to set as default
11619 name: str,
11620 transport_options: Optional[transport.TransportOptions] = None,
11621 ) -> mdls.Theme:
11622 """Set Default Theme"""
11623 response = cast(
11624 mdls.Theme,
11625 self.put(
11626 path="/themes/default",
11627 structure=mdls.Theme,
11628 query_params={"name": name},
11629 transport_options=transport_options,
11630 ),
11631 )
11632 return response
11633
11634 # ### Get active themes
11635 #
11636 # Returns an array of active themes.
11637 #
11638 # If the `name` parameter is specified, it will return an array with one theme if it's active and found.
11639 #
11640 # The optional `ts` parameter can specify a different timestamp than "now."
11641 #
11642 # **Note**: Custom themes needs to be enabled by Looker. Unless custom themes are enabled, only the automatically generated default theme can be used. Please contact your Account Manager or https://console.cloud.google.com/support/cases/ to update your license for this feature.
11643 #
11644 # GET /themes/active -> Sequence[mdls.Theme]
11645 def active_themes(
11646 self,
11647 # Name of theme
11648 name: Optional[str] = None,
11649 # Timestamp representing the target datetime for the active period. Defaults to 'now'
11650 ts: Optional[datetime.datetime] = None,
11651 # Requested fields.
11652 fields: Optional[str] = None,
11653 transport_options: Optional[transport.TransportOptions] = None,
11654 ) -> Sequence[mdls.Theme]:
11655 """Get Active Themes"""
11656 response = cast(
11657 Sequence[mdls.Theme],
11658 self.get(
11659 path="/themes/active",
11660 structure=Sequence[mdls.Theme],
11661 query_params={"name": name, "ts": ts, "fields": fields},
11662 transport_options=transport_options,
11663 ),
11664 )
11665 return response
11666
11667 # ### Get the named theme if it's active. Otherwise, return the default theme
11668 #
11669 # The optional `ts` parameter can specify a different timestamp than "now."
11670 # Note: API users with `show` ability can call this function
11671 #
11672 # **Note**: Custom themes needs to be enabled by Looker. Unless custom themes are enabled, only the automatically generated default theme can be used. Please contact your Account Manager or https://console.cloud.google.com/support/cases/ to update your license for this feature.
11673 #
11674 # GET /themes/theme_or_default -> mdls.Theme
11675 def theme_or_default(
11676 self,
11677 # Name of theme
11678 name: str,
11679 # Timestamp representing the target datetime for the active period. Defaults to 'now'
11680 ts: Optional[datetime.datetime] = None,
11681 transport_options: Optional[transport.TransportOptions] = None,
11682 ) -> mdls.Theme:
11683 """Get Theme or Default"""
11684 response = cast(
11685 mdls.Theme,
11686 self.get(
11687 path="/themes/theme_or_default",
11688 structure=mdls.Theme,
11689 query_params={"name": name, "ts": ts},
11690 transport_options=transport_options,
11691 ),
11692 )
11693 return response
11694
11695 # ### Validate a theme with the specified information
11696 #
11697 # Validates all values set for the theme, returning any errors encountered, or 200 OK if valid
11698 #
11699 # See [Create Theme](#!/Theme/create_theme) for constraints
11700 #
11701 # **Note**: Custom themes needs to be enabled by Looker. Unless custom themes are enabled, only the automatically generated default theme can be used. Please contact your Account Manager or https://console.cloud.google.com/support/cases/ to update your license for this feature.
11702 #
11703 # POST /themes/validate -> mdls.ValidationError
11704 def validate_theme(
11705 self,
11706 body: mdls.WriteTheme,
11707 transport_options: Optional[transport.TransportOptions] = None,
11708 ) -> mdls.ValidationError:
11709 """Validate Theme"""
11710 response = cast(
11711 mdls.ValidationError,
11712 self.post(
11713 path="/themes/validate",
11714 structure=mdls.ValidationError,
11715 body=body,
11716 transport_options=transport_options,
11717 ),
11718 )
11719 return response
11720
11721 # ### Get a theme by ID
11722 #
11723 # Use this to retrieve a specific theme, whether or not it's currently active.
11724 #
11725 # **Note**: Custom themes needs to be enabled by Looker. Unless custom themes are enabled, only the automatically generated default theme can be used. Please contact your Account Manager or https://console.cloud.google.com/support/cases/ to update your license for this feature.
11726 #
11727 # GET /themes/{theme_id} -> mdls.Theme
11728 def theme(
11729 self,
11730 # Id of theme
11731 theme_id: str,
11732 # Requested fields.
11733 fields: Optional[str] = None,
11734 transport_options: Optional[transport.TransportOptions] = None,
11735 ) -> mdls.Theme:
11736 """Get Theme"""
11737 theme_id = self.encode_path_param(theme_id)
11738 response = cast(
11739 mdls.Theme,
11740 self.get(
11741 path=f"/themes/{theme_id}",
11742 structure=mdls.Theme,
11743 query_params={"fields": fields},
11744 transport_options=transport_options,
11745 ),
11746 )
11747 return response
11748
11749 # ### Update the theme by id.
11750 #
11751 # **Note**: Custom themes needs to be enabled by Looker. Unless custom themes are enabled, only the automatically generated default theme can be used. Please contact your Account Manager or https://console.cloud.google.com/support/cases/ to update your license for this feature.
11752 #
11753 # PATCH /themes/{theme_id} -> mdls.Theme
11754 def update_theme(
11755 self,
11756 # Id of theme
11757 theme_id: str,
11758 body: mdls.WriteTheme,
11759 transport_options: Optional[transport.TransportOptions] = None,
11760 ) -> mdls.Theme:
11761 """Update Theme"""
11762 theme_id = self.encode_path_param(theme_id)
11763 response = cast(
11764 mdls.Theme,
11765 self.patch(
11766 path=f"/themes/{theme_id}",
11767 structure=mdls.Theme,
11768 body=body,
11769 transport_options=transport_options,
11770 ),
11771 )
11772 return response
11773
11774 # ### Delete a specific theme by id
11775 #
11776 # This operation permanently deletes the identified theme from the database.
11777 #
11778 # Because multiple themes can have the same name (with different activation time spans) themes can only be deleted by ID.
11779 #
11780 # All IDs associated with a theme name can be retrieved by searching for the theme name with [Theme Search](#!/Theme/search).
11781 #
11782 # **Note**: Custom themes needs to be enabled by Looker. Unless custom themes are enabled, only the automatically generated default theme can be used. Please contact your Account Manager or https://console.cloud.google.com/support/cases/ to update your license for this feature.
11783 #
11784 # DELETE /themes/{theme_id} -> str
11785 def delete_theme(
11786 self,
11787 # Id of theme
11788 theme_id: str,
11789 transport_options: Optional[transport.TransportOptions] = None,
11790 ) -> str:
11791 """Delete Theme"""
11792 theme_id = self.encode_path_param(theme_id)
11793 response = cast(
11794 str,
11795 self.delete(
11796 path=f"/themes/{theme_id}",
11797 structure=str,
11798 transport_options=transport_options,
11799 ),
11800 )
11801 return response
11802
11803 # endregion
11804
11805 # region User: Manage Users
11806
11807 # ### Search email credentials
11808 #
11809 # Returns all credentials_email records that match the given search criteria.
11810 #
11811 # If multiple search params are given and `filter_or` is FALSE or not specified,
11812 # search params are combined in a logical AND operation.
11813 # Only rows that match *all* search param criteria will be returned.
11814 #
11815 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
11816 # Results will include rows that match **any** of the search criteria.
11817 #
11818 # String search params use case-insensitive matching.
11819 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
11820 # example="dan%" will match "danger" and "Danzig" but not "David"
11821 # example="D_m%" will match "Damage" and "dump"
11822 #
11823 # Integer search params can accept a single value or a comma separated list of values. The multiple
11824 # values will be combined under a logical OR operation - results will match at least one of
11825 # the given values.
11826 #
11827 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
11828 # or exclude (respectively) rows where the column is null.
11829 #
11830 # Boolean search params accept only "true" and "false" as values.
11831 #
11832 #
11833 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
11834 #
11835 # GET /credentials_email/search -> Sequence[mdls.CredentialsEmailSearch]
11836 def search_credentials_email(
11837 self,
11838 # Requested fields.
11839 fields: Optional[str] = None,
11840 # Number of results to return (used with `offset`).
11841 limit: Optional[int] = None,
11842 # Number of results to skip before returning any (used with `limit`).
11843 offset: Optional[int] = None,
11844 # Fields to sort by.
11845 sorts: Optional[str] = None,
11846 # Match credentials_email id.
11847 id: Optional[str] = None,
11848 # Match credentials_email email.
11849 email: Optional[str] = None,
11850 # Find credentials_email that match given emails.
11851 emails: Optional[str] = None,
11852 # Combine given search criteria in a boolean OR expression.
11853 filter_or: Optional[bool] = None,
11854 transport_options: Optional[transport.TransportOptions] = None,
11855 ) -> Sequence[mdls.CredentialsEmailSearch]:
11856 """Search CredentialsEmail"""
11857 response = cast(
11858 Sequence[mdls.CredentialsEmailSearch],
11859 self.get(
11860 path="/credentials_email/search",
11861 structure=Sequence[mdls.CredentialsEmailSearch],
11862 query_params={
11863 "fields": fields,
11864 "limit": limit,
11865 "offset": offset,
11866 "sorts": sorts,
11867 "id": id,
11868 "email": email,
11869 "emails": emails,
11870 "filter_or": filter_or,
11871 },
11872 transport_options=transport_options,
11873 ),
11874 )
11875 return response
11876
11877 # ### Get information about the current user; i.e. the user account currently calling the API.
11878 #
11879 # GET /user -> mdls.User
11880 def me(
11881 self,
11882 # Requested fields.
11883 fields: Optional[str] = None,
11884 transport_options: Optional[transport.TransportOptions] = None,
11885 ) -> mdls.User:
11886 """Get Current User"""
11887 response = cast(
11888 mdls.User,
11889 self.get(
11890 path="/user",
11891 structure=mdls.User,
11892 query_params={"fields": fields},
11893 transport_options=transport_options,
11894 ),
11895 )
11896 return response
11897
11898 # ### Get information about all users.
11899 #
11900 # GET /users -> Sequence[mdls.User]
11901 def all_users(
11902 self,
11903 # Requested fields.
11904 fields: Optional[str] = None,
11905 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
11906 page: Optional[int] = None,
11907 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
11908 per_page: Optional[int] = None,
11909 # Number of results to return. (used with offset and takes priority over page and per_page)
11910 limit: Optional[int] = None,
11911 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
11912 offset: Optional[int] = None,
11913 # Fields to sort by.
11914 sorts: Optional[str] = None,
11915 # Optional list of ids to get specific users.
11916 ids: Optional[mdls.DelimSequence[str]] = None,
11917 transport_options: Optional[transport.TransportOptions] = None,
11918 ) -> Sequence[mdls.User]:
11919 """Get All Users"""
11920 response = cast(
11921 Sequence[mdls.User],
11922 self.get(
11923 path="/users",
11924 structure=Sequence[mdls.User],
11925 query_params={
11926 "fields": fields,
11927 "page": page,
11928 "per_page": per_page,
11929 "limit": limit,
11930 "offset": offset,
11931 "sorts": sorts,
11932 "ids": ids,
11933 },
11934 transport_options=transport_options,
11935 ),
11936 )
11937 return response
11938
11939 # ### Create a user with the specified information.
11940 #
11941 # POST /users -> mdls.User
11942 def create_user(
11943 self,
11944 body: Optional[mdls.WriteUser] = None,
11945 # Requested fields.
11946 fields: Optional[str] = None,
11947 transport_options: Optional[transport.TransportOptions] = None,
11948 ) -> mdls.User:
11949 """Create User"""
11950 response = cast(
11951 mdls.User,
11952 self.post(
11953 path="/users",
11954 structure=mdls.User,
11955 query_params={"fields": fields},
11956 body=body,
11957 transport_options=transport_options,
11958 ),
11959 )
11960 return response
11961
11962 # ### Search users
11963 #
11964 # Returns all<sup>*</sup> user records that match the given search criteria.
11965 #
11966 # If multiple search params are given and `filter_or` is FALSE or not specified,
11967 # search params are combined in a logical AND operation.
11968 # Only rows that match *all* search param criteria will be returned.
11969 #
11970 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
11971 # Results will include rows that match **any** of the search criteria.
11972 #
11973 # String search params use case-insensitive matching.
11974 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
11975 # example="dan%" will match "danger" and "Danzig" but not "David"
11976 # example="D_m%" will match "Damage" and "dump"
11977 #
11978 # Integer search params can accept a single value or a comma separated list of values. The multiple
11979 # values will be combined under a logical OR operation - results will match at least one of
11980 # the given values.
11981 #
11982 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
11983 # or exclude (respectively) rows where the column is null.
11984 #
11985 # Boolean search params accept only "true" and "false" as values.
11986 #
11987 #
11988 # (<sup>*</sup>) Results are always filtered to the level of information the caller is permitted to view.
11989 # Looker admins can see all user details; normal users in an open system can see
11990 # names of other users but no details; normal users in a closed system can only see
11991 # names of other users who are members of the same group as the user.
11992 #
11993 # GET /users/search -> Sequence[mdls.User]
11994 def search_users(
11995 self,
11996 # Include only these fields in the response
11997 fields: Optional[str] = None,
11998 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
11999 page: Optional[int] = None,
12000 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
12001 per_page: Optional[int] = None,
12002 # Number of results to return. (used with offset and takes priority over page and per_page)
12003 limit: Optional[int] = None,
12004 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
12005 offset: Optional[int] = None,
12006 # Fields to sort by.
12007 sorts: Optional[str] = None,
12008 # Match User Id.
12009 id: Optional[str] = None,
12010 # Match First name.
12011 first_name: Optional[str] = None,
12012 # Match Last name.
12013 last_name: Optional[str] = None,
12014 # Search for user accounts associated with Looker employees
12015 verified_looker_employee: Optional[bool] = None,
12016 # Search for only embed users
12017 embed_user: Optional[bool] = None,
12018 # Search for the user with this email address
12019 email: Optional[str] = None,
12020 # Search for disabled user accounts
12021 is_disabled: Optional[bool] = None,
12022 # Combine given search criteria in a boolean OR expression
12023 filter_or: Optional[bool] = None,
12024 # Search for users who have access to this content_metadata item
12025 content_metadata_id: Optional[str] = None,
12026 # Search for users who are direct members of this group
12027 group_id: Optional[str] = None,
12028 transport_options: Optional[transport.TransportOptions] = None,
12029 ) -> Sequence[mdls.User]:
12030 """Search Users"""
12031 response = cast(
12032 Sequence[mdls.User],
12033 self.get(
12034 path="/users/search",
12035 structure=Sequence[mdls.User],
12036 query_params={
12037 "fields": fields,
12038 "page": page,
12039 "per_page": per_page,
12040 "limit": limit,
12041 "offset": offset,
12042 "sorts": sorts,
12043 "id": id,
12044 "first_name": first_name,
12045 "last_name": last_name,
12046 "verified_looker_employee": verified_looker_employee,
12047 "embed_user": embed_user,
12048 "email": email,
12049 "is_disabled": is_disabled,
12050 "filter_or": filter_or,
12051 "content_metadata_id": content_metadata_id,
12052 "group_id": group_id,
12053 },
12054 transport_options=transport_options,
12055 ),
12056 )
12057 return response
12058
12059 # ### Search for user accounts by name
12060 #
12061 # Returns all user accounts where `first_name` OR `last_name` OR `email` field values match a pattern.
12062 # The pattern can contain `%` and `_` wildcards as in SQL LIKE expressions.
12063 #
12064 # Any additional search params will be combined into a logical AND expression.
12065 #
12066 # GET /users/search/names/{pattern} -> Sequence[mdls.User]
12067 def search_users_names(
12068 self,
12069 # Pattern to match
12070 pattern: str,
12071 # Include only these fields in the response
12072 fields: Optional[str] = None,
12073 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
12074 page: Optional[int] = None,
12075 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
12076 per_page: Optional[int] = None,
12077 # Number of results to return. (used with offset and takes priority over page and per_page)
12078 limit: Optional[int] = None,
12079 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
12080 offset: Optional[int] = None,
12081 # Fields to sort by
12082 sorts: Optional[str] = None,
12083 # Match User Id
12084 id: Optional[str] = None,
12085 # Match First name
12086 first_name: Optional[str] = None,
12087 # Match Last name
12088 last_name: Optional[str] = None,
12089 # Match Verified Looker employee
12090 verified_looker_employee: Optional[bool] = None,
12091 # Match Email Address
12092 email: Optional[str] = None,
12093 # Include or exclude disabled accounts in the results
12094 is_disabled: Optional[bool] = None,
12095 transport_options: Optional[transport.TransportOptions] = None,
12096 ) -> Sequence[mdls.User]:
12097 """Search User Names"""
12098 pattern = self.encode_path_param(pattern)
12099 response = cast(
12100 Sequence[mdls.User],
12101 self.get(
12102 path=f"/users/search/names/{pattern}",
12103 structure=Sequence[mdls.User],
12104 query_params={
12105 "fields": fields,
12106 "page": page,
12107 "per_page": per_page,
12108 "limit": limit,
12109 "offset": offset,
12110 "sorts": sorts,
12111 "id": id,
12112 "first_name": first_name,
12113 "last_name": last_name,
12114 "verified_looker_employee": verified_looker_employee,
12115 "email": email,
12116 "is_disabled": is_disabled,
12117 },
12118 transport_options=transport_options,
12119 ),
12120 )
12121 return response
12122
12123 # ### Get information about the user with a specific id.
12124 #
12125 # If the caller is an admin or the caller is the user being specified, then full user information will
12126 # be returned. Otherwise, a minimal 'public' variant of the user information will be returned. This contains
12127 # The user name and avatar url, but no sensitive information.
12128 #
12129 # GET /users/{user_id} -> mdls.User
12130 def user(
12131 self,
12132 # Id of user
12133 user_id: str,
12134 # Requested fields.
12135 fields: Optional[str] = None,
12136 transport_options: Optional[transport.TransportOptions] = None,
12137 ) -> mdls.User:
12138 """Get User by Id"""
12139 user_id = self.encode_path_param(user_id)
12140 response = cast(
12141 mdls.User,
12142 self.get(
12143 path=f"/users/{user_id}",
12144 structure=mdls.User,
12145 query_params={"fields": fields},
12146 transport_options=transport_options,
12147 ),
12148 )
12149 return response
12150
12151 # ### Update information about the user with a specific id.
12152 #
12153 # PATCH /users/{user_id} -> mdls.User
12154 def update_user(
12155 self,
12156 # Id of user
12157 user_id: str,
12158 body: mdls.WriteUser,
12159 # Requested fields.
12160 fields: Optional[str] = None,
12161 transport_options: Optional[transport.TransportOptions] = None,
12162 ) -> mdls.User:
12163 """Update User"""
12164 user_id = self.encode_path_param(user_id)
12165 response = cast(
12166 mdls.User,
12167 self.patch(
12168 path=f"/users/{user_id}",
12169 structure=mdls.User,
12170 query_params={"fields": fields},
12171 body=body,
12172 transport_options=transport_options,
12173 ),
12174 )
12175 return response
12176
12177 # ### Delete the user with a specific id.
12178 #
12179 # **DANGER** this will delete the user and all looks and other information owned by the user.
12180 #
12181 # DELETE /users/{user_id} -> str
12182 def delete_user(
12183 self,
12184 # Id of user
12185 user_id: str,
12186 transport_options: Optional[transport.TransportOptions] = None,
12187 ) -> str:
12188 """Delete User"""
12189 user_id = self.encode_path_param(user_id)
12190 response = cast(
12191 str,
12192 self.delete(
12193 path=f"/users/{user_id}",
12194 structure=str,
12195 transport_options=transport_options,
12196 ),
12197 )
12198 return response
12199
12200 # ### Get information about the user with a credential of given type with specific id.
12201 #
12202 # This is used to do things like find users by their embed external_user_id. Or, find the user with
12203 # a given api3 client_id, etc. The 'credential_type' matches the 'type' name of the various credential
12204 # types. It must be one of the values listed in the table below. The 'credential_id' is your unique Id
12205 # for the user and is specific to each type of credential.
12206 #
12207 # An example using the Ruby sdk might look like:
12208 #
12209 # `sdk.user_for_credential('embed', 'customer-4959425')`
12210 #
12211 # This table shows the supported 'Credential Type' strings. The right column is for reference; it shows
12212 # which field in the given credential type is actually searched when finding a user with the supplied
12213 # 'credential_id'.
12214 #
12215 # | Credential Types | Id Field Matched |
12216 # | ---------------- | ---------------- |
12217 # | email | email |
12218 # | google | google_user_id |
12219 # | saml | saml_user_id |
12220 # | oidc | oidc_user_id |
12221 # | ldap | ldap_id |
12222 # | api | token |
12223 # | api3 | client_id |
12224 # | embed | external_user_id |
12225 # | looker_openid | email |
12226 #
12227 # **NOTE**: The 'api' credential type was only used with the legacy Looker query API and is no longer supported. The credential type for API you are currently looking at is 'api3'.
12228 #
12229 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12230 #
12231 # GET /users/credential/{credential_type}/{credential_id} -> mdls.User
12232 def user_for_credential(
12233 self,
12234 # Type name of credential
12235 credential_type: str,
12236 # Id of credential
12237 credential_id: str,
12238 # Requested fields.
12239 fields: Optional[str] = None,
12240 transport_options: Optional[transport.TransportOptions] = None,
12241 ) -> mdls.User:
12242 """Get User by Credential Id"""
12243 credential_type = self.encode_path_param(credential_type)
12244 credential_id = self.encode_path_param(credential_id)
12245 response = cast(
12246 mdls.User,
12247 self.get(
12248 path=f"/users/credential/{credential_type}/{credential_id}",
12249 structure=mdls.User,
12250 query_params={"fields": fields},
12251 transport_options=transport_options,
12252 ),
12253 )
12254 return response
12255
12256 # ### Email/password login information for the specified user.
12257 #
12258 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12259 #
12260 # GET /users/{user_id}/credentials_email -> mdls.CredentialsEmail
12261 def user_credentials_email(
12262 self,
12263 # Id of user
12264 user_id: str,
12265 # Requested fields.
12266 fields: Optional[str] = None,
12267 transport_options: Optional[transport.TransportOptions] = None,
12268 ) -> mdls.CredentialsEmail:
12269 """Get Email/Password Credential"""
12270 user_id = self.encode_path_param(user_id)
12271 response = cast(
12272 mdls.CredentialsEmail,
12273 self.get(
12274 path=f"/users/{user_id}/credentials_email",
12275 structure=mdls.CredentialsEmail,
12276 query_params={"fields": fields},
12277 transport_options=transport_options,
12278 ),
12279 )
12280 return response
12281
12282 # ### Email/password login information for the specified user.
12283 #
12284 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12285 #
12286 # POST /users/{user_id}/credentials_email -> mdls.CredentialsEmail
12287 def create_user_credentials_email(
12288 self,
12289 # Id of user
12290 user_id: str,
12291 body: mdls.WriteCredentialsEmail,
12292 # Requested fields.
12293 fields: Optional[str] = None,
12294 transport_options: Optional[transport.TransportOptions] = None,
12295 ) -> mdls.CredentialsEmail:
12296 """Create Email/Password Credential"""
12297 user_id = self.encode_path_param(user_id)
12298 response = cast(
12299 mdls.CredentialsEmail,
12300 self.post(
12301 path=f"/users/{user_id}/credentials_email",
12302 structure=mdls.CredentialsEmail,
12303 query_params={"fields": fields},
12304 body=body,
12305 transport_options=transport_options,
12306 ),
12307 )
12308 return response
12309
12310 # ### Email/password login information for the specified user.
12311 #
12312 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12313 #
12314 # PATCH /users/{user_id}/credentials_email -> mdls.CredentialsEmail
12315 def update_user_credentials_email(
12316 self,
12317 # Id of user
12318 user_id: str,
12319 body: mdls.WriteCredentialsEmail,
12320 # Requested fields.
12321 fields: Optional[str] = None,
12322 transport_options: Optional[transport.TransportOptions] = None,
12323 ) -> mdls.CredentialsEmail:
12324 """Update Email/Password Credential"""
12325 user_id = self.encode_path_param(user_id)
12326 response = cast(
12327 mdls.CredentialsEmail,
12328 self.patch(
12329 path=f"/users/{user_id}/credentials_email",
12330 structure=mdls.CredentialsEmail,
12331 query_params={"fields": fields},
12332 body=body,
12333 transport_options=transport_options,
12334 ),
12335 )
12336 return response
12337
12338 # ### Email/password login information for the specified user.
12339 #
12340 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12341 #
12342 # DELETE /users/{user_id}/credentials_email -> str
12343 def delete_user_credentials_email(
12344 self,
12345 # Id of user
12346 user_id: str,
12347 transport_options: Optional[transport.TransportOptions] = None,
12348 ) -> str:
12349 """Delete Email/Password Credential"""
12350 user_id = self.encode_path_param(user_id)
12351 response = cast(
12352 str,
12353 self.delete(
12354 path=f"/users/{user_id}/credentials_email",
12355 structure=str,
12356 transport_options=transport_options,
12357 ),
12358 )
12359 return response
12360
12361 # ### Two-factor login information for the specified user.
12362 #
12363 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12364 #
12365 # GET /users/{user_id}/credentials_totp -> mdls.CredentialsTotp
12366 def user_credentials_totp(
12367 self,
12368 # Id of user
12369 user_id: str,
12370 # Requested fields.
12371 fields: Optional[str] = None,
12372 transport_options: Optional[transport.TransportOptions] = None,
12373 ) -> mdls.CredentialsTotp:
12374 """Get Two-Factor Credential"""
12375 user_id = self.encode_path_param(user_id)
12376 response = cast(
12377 mdls.CredentialsTotp,
12378 self.get(
12379 path=f"/users/{user_id}/credentials_totp",
12380 structure=mdls.CredentialsTotp,
12381 query_params={"fields": fields},
12382 transport_options=transport_options,
12383 ),
12384 )
12385 return response
12386
12387 # ### Two-factor login information for the specified user.
12388 #
12389 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12390 #
12391 # POST /users/{user_id}/credentials_totp -> mdls.CredentialsTotp
12392 def create_user_credentials_totp(
12393 self,
12394 # Id of user
12395 user_id: str,
12396 # WARNING: no writeable properties found for POST, PUT, or PATCH
12397 body: Optional[mdls.CredentialsTotp] = None,
12398 # Requested fields.
12399 fields: Optional[str] = None,
12400 transport_options: Optional[transport.TransportOptions] = None,
12401 ) -> mdls.CredentialsTotp:
12402 """Create Two-Factor Credential"""
12403 user_id = self.encode_path_param(user_id)
12404 response = cast(
12405 mdls.CredentialsTotp,
12406 self.post(
12407 path=f"/users/{user_id}/credentials_totp",
12408 structure=mdls.CredentialsTotp,
12409 query_params={"fields": fields},
12410 body=body,
12411 transport_options=transport_options,
12412 ),
12413 )
12414 return response
12415
12416 # ### Two-factor login information for the specified user.
12417 #
12418 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12419 #
12420 # DELETE /users/{user_id}/credentials_totp -> str
12421 def delete_user_credentials_totp(
12422 self,
12423 # Id of user
12424 user_id: str,
12425 transport_options: Optional[transport.TransportOptions] = None,
12426 ) -> str:
12427 """Delete Two-Factor Credential"""
12428 user_id = self.encode_path_param(user_id)
12429 response = cast(
12430 str,
12431 self.delete(
12432 path=f"/users/{user_id}/credentials_totp",
12433 structure=str,
12434 transport_options=transport_options,
12435 ),
12436 )
12437 return response
12438
12439 # ### LDAP login information for the specified user.
12440 #
12441 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12442 #
12443 # GET /users/{user_id}/credentials_ldap -> mdls.CredentialsLDAP
12444 def user_credentials_ldap(
12445 self,
12446 # Id of user
12447 user_id: str,
12448 # Requested fields.
12449 fields: Optional[str] = None,
12450 transport_options: Optional[transport.TransportOptions] = None,
12451 ) -> mdls.CredentialsLDAP:
12452 """Get LDAP Credential"""
12453 user_id = self.encode_path_param(user_id)
12454 response = cast(
12455 mdls.CredentialsLDAP,
12456 self.get(
12457 path=f"/users/{user_id}/credentials_ldap",
12458 structure=mdls.CredentialsLDAP,
12459 query_params={"fields": fields},
12460 transport_options=transport_options,
12461 ),
12462 )
12463 return response
12464
12465 # ### LDAP login information for the specified user.
12466 #
12467 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12468 #
12469 # DELETE /users/{user_id}/credentials_ldap -> str
12470 def delete_user_credentials_ldap(
12471 self,
12472 # Id of user
12473 user_id: str,
12474 transport_options: Optional[transport.TransportOptions] = None,
12475 ) -> str:
12476 """Delete LDAP Credential"""
12477 user_id = self.encode_path_param(user_id)
12478 response = cast(
12479 str,
12480 self.delete(
12481 path=f"/users/{user_id}/credentials_ldap",
12482 structure=str,
12483 transport_options=transport_options,
12484 ),
12485 )
12486 return response
12487
12488 # ### Google authentication login information for the specified user.
12489 #
12490 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12491 #
12492 # GET /users/{user_id}/credentials_google -> mdls.CredentialsGoogle
12493 def user_credentials_google(
12494 self,
12495 # Id of user
12496 user_id: str,
12497 # Requested fields.
12498 fields: Optional[str] = None,
12499 transport_options: Optional[transport.TransportOptions] = None,
12500 ) -> mdls.CredentialsGoogle:
12501 """Get Google Auth Credential"""
12502 user_id = self.encode_path_param(user_id)
12503 response = cast(
12504 mdls.CredentialsGoogle,
12505 self.get(
12506 path=f"/users/{user_id}/credentials_google",
12507 structure=mdls.CredentialsGoogle,
12508 query_params={"fields": fields},
12509 transport_options=transport_options,
12510 ),
12511 )
12512 return response
12513
12514 # ### Google authentication login information for the specified user.
12515 #
12516 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12517 #
12518 # DELETE /users/{user_id}/credentials_google -> str
12519 def delete_user_credentials_google(
12520 self,
12521 # Id of user
12522 user_id: str,
12523 transport_options: Optional[transport.TransportOptions] = None,
12524 ) -> str:
12525 """Delete Google Auth Credential"""
12526 user_id = self.encode_path_param(user_id)
12527 response = cast(
12528 str,
12529 self.delete(
12530 path=f"/users/{user_id}/credentials_google",
12531 structure=str,
12532 transport_options=transport_options,
12533 ),
12534 )
12535 return response
12536
12537 # ### Saml authentication login information for the specified user.
12538 #
12539 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12540 #
12541 # GET /users/{user_id}/credentials_saml -> mdls.CredentialsSaml
12542 def user_credentials_saml(
12543 self,
12544 # Id of user
12545 user_id: str,
12546 # Requested fields.
12547 fields: Optional[str] = None,
12548 transport_options: Optional[transport.TransportOptions] = None,
12549 ) -> mdls.CredentialsSaml:
12550 """Get Saml Auth Credential"""
12551 user_id = self.encode_path_param(user_id)
12552 response = cast(
12553 mdls.CredentialsSaml,
12554 self.get(
12555 path=f"/users/{user_id}/credentials_saml",
12556 structure=mdls.CredentialsSaml,
12557 query_params={"fields": fields},
12558 transport_options=transport_options,
12559 ),
12560 )
12561 return response
12562
12563 # ### Saml authentication login information for the specified user.
12564 #
12565 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12566 #
12567 # DELETE /users/{user_id}/credentials_saml -> str
12568 def delete_user_credentials_saml(
12569 self,
12570 # Id of user
12571 user_id: str,
12572 transport_options: Optional[transport.TransportOptions] = None,
12573 ) -> str:
12574 """Delete Saml Auth Credential"""
12575 user_id = self.encode_path_param(user_id)
12576 response = cast(
12577 str,
12578 self.delete(
12579 path=f"/users/{user_id}/credentials_saml",
12580 structure=str,
12581 transport_options=transport_options,
12582 ),
12583 )
12584 return response
12585
12586 # ### OpenID Connect (OIDC) authentication login information for the specified user.
12587 #
12588 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12589 #
12590 # GET /users/{user_id}/credentials_oidc -> mdls.CredentialsOIDC
12591 def user_credentials_oidc(
12592 self,
12593 # Id of user
12594 user_id: str,
12595 # Requested fields.
12596 fields: Optional[str] = None,
12597 transport_options: Optional[transport.TransportOptions] = None,
12598 ) -> mdls.CredentialsOIDC:
12599 """Get OIDC Auth Credential"""
12600 user_id = self.encode_path_param(user_id)
12601 response = cast(
12602 mdls.CredentialsOIDC,
12603 self.get(
12604 path=f"/users/{user_id}/credentials_oidc",
12605 structure=mdls.CredentialsOIDC,
12606 query_params={"fields": fields},
12607 transport_options=transport_options,
12608 ),
12609 )
12610 return response
12611
12612 # ### OpenID Connect (OIDC) authentication login information for the specified user.
12613 #
12614 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12615 #
12616 # DELETE /users/{user_id}/credentials_oidc -> str
12617 def delete_user_credentials_oidc(
12618 self,
12619 # Id of user
12620 user_id: str,
12621 transport_options: Optional[transport.TransportOptions] = None,
12622 ) -> str:
12623 """Delete OIDC Auth Credential"""
12624 user_id = self.encode_path_param(user_id)
12625 response = cast(
12626 str,
12627 self.delete(
12628 path=f"/users/{user_id}/credentials_oidc",
12629 structure=str,
12630 transport_options=transport_options,
12631 ),
12632 )
12633 return response
12634
12635 # ### API login information for the specified user. This is for the newer API keys that can be added for any user.
12636 #
12637 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12638 #
12639 # GET /users/{user_id}/credentials_api3/{credentials_api3_id} -> mdls.CredentialsApi3
12640 def user_credentials_api3(
12641 self,
12642 # Id of user
12643 user_id: str,
12644 # Id of API Credential
12645 credentials_api3_id: str,
12646 # Requested fields.
12647 fields: Optional[str] = None,
12648 transport_options: Optional[transport.TransportOptions] = None,
12649 ) -> mdls.CredentialsApi3:
12650 """Get API Credential"""
12651 user_id = self.encode_path_param(user_id)
12652 credentials_api3_id = self.encode_path_param(credentials_api3_id)
12653 response = cast(
12654 mdls.CredentialsApi3,
12655 self.get(
12656 path=f"/users/{user_id}/credentials_api3/{credentials_api3_id}",
12657 structure=mdls.CredentialsApi3,
12658 query_params={"fields": fields},
12659 transport_options=transport_options,
12660 ),
12661 )
12662 return response
12663
12664 # ### API login information for the specified user. This is for the newer API keys that can be added for any user.
12665 #
12666 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12667 #
12668 # DELETE /users/{user_id}/credentials_api3/{credentials_api3_id} -> str
12669 def delete_user_credentials_api3(
12670 self,
12671 # Id of user
12672 user_id: str,
12673 # Id of API Credential
12674 credentials_api3_id: str,
12675 transport_options: Optional[transport.TransportOptions] = None,
12676 ) -> str:
12677 """Delete API Credential"""
12678 user_id = self.encode_path_param(user_id)
12679 credentials_api3_id = self.encode_path_param(credentials_api3_id)
12680 response = cast(
12681 str,
12682 self.delete(
12683 path=f"/users/{user_id}/credentials_api3/{credentials_api3_id}",
12684 structure=str,
12685 transport_options=transport_options,
12686 ),
12687 )
12688 return response
12689
12690 # ### API login information for the specified user. This is for the newer API keys that can be added for any user.
12691 #
12692 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12693 #
12694 # GET /users/{user_id}/credentials_api3 -> Sequence[mdls.CredentialsApi3]
12695 def all_user_credentials_api3s(
12696 self,
12697 # Id of user
12698 user_id: str,
12699 # Requested fields.
12700 fields: Optional[str] = None,
12701 transport_options: Optional[transport.TransportOptions] = None,
12702 ) -> Sequence[mdls.CredentialsApi3]:
12703 """Get All API Credentials"""
12704 user_id = self.encode_path_param(user_id)
12705 response = cast(
12706 Sequence[mdls.CredentialsApi3],
12707 self.get(
12708 path=f"/users/{user_id}/credentials_api3",
12709 structure=Sequence[mdls.CredentialsApi3],
12710 query_params={"fields": fields},
12711 transport_options=transport_options,
12712 ),
12713 )
12714 return response
12715
12716 # ### API login information for the specified user. This is for the newer API keys that can be added for any user.
12717 #
12718 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12719 #
12720 # POST /users/{user_id}/credentials_api3 -> mdls.CreateCredentialsApi3
12721 def create_user_credentials_api3(
12722 self,
12723 # Id of user
12724 user_id: str,
12725 # Requested fields.
12726 fields: Optional[str] = None,
12727 transport_options: Optional[transport.TransportOptions] = None,
12728 ) -> mdls.CreateCredentialsApi3:
12729 """Create API Credential"""
12730 user_id = self.encode_path_param(user_id)
12731 response = cast(
12732 mdls.CreateCredentialsApi3,
12733 self.post(
12734 path=f"/users/{user_id}/credentials_api3",
12735 structure=mdls.CreateCredentialsApi3,
12736 query_params={"fields": fields},
12737 transport_options=transport_options,
12738 ),
12739 )
12740 return response
12741
12742 # ### Embed login information for the specified user.
12743 #
12744 # **NOTE**: Calls to this endpoint require [Embedding](https://cloud.google.com/looker/docs/r/looker-core-feature-embed) to be enabled. Usage of this endpoint is not authorized for Looker Core Standard and Looker Core Enterprise.
12745 #
12746 # GET /users/{user_id}/credentials_embed/{credentials_embed_id} -> mdls.CredentialsEmbed
12747 def user_credentials_embed(
12748 self,
12749 # Id of user
12750 user_id: str,
12751 # Id of Embedding Credential
12752 credentials_embed_id: str,
12753 # Requested fields.
12754 fields: Optional[str] = None,
12755 transport_options: Optional[transport.TransportOptions] = None,
12756 ) -> mdls.CredentialsEmbed:
12757 """Get Embedding Credential"""
12758 user_id = self.encode_path_param(user_id)
12759 credentials_embed_id = self.encode_path_param(credentials_embed_id)
12760 response = cast(
12761 mdls.CredentialsEmbed,
12762 self.get(
12763 path=f"/users/{user_id}/credentials_embed/{credentials_embed_id}",
12764 structure=mdls.CredentialsEmbed,
12765 query_params={"fields": fields},
12766 transport_options=transport_options,
12767 ),
12768 )
12769 return response
12770
12771 # ### Embed login information for the specified user.
12772 #
12773 # **NOTE**: Calls to this endpoint require [Embedding](https://cloud.google.com/looker/docs/r/looker-core-feature-embed) to be enabled. Usage of this endpoint is not authorized for Looker Core Standard and Looker Core Enterprise.
12774 #
12775 # DELETE /users/{user_id}/credentials_embed/{credentials_embed_id} -> str
12776 def delete_user_credentials_embed(
12777 self,
12778 # Id of user
12779 user_id: str,
12780 # Id of Embedding Credential
12781 credentials_embed_id: str,
12782 transport_options: Optional[transport.TransportOptions] = None,
12783 ) -> str:
12784 """Delete Embedding Credential"""
12785 user_id = self.encode_path_param(user_id)
12786 credentials_embed_id = self.encode_path_param(credentials_embed_id)
12787 response = cast(
12788 str,
12789 self.delete(
12790 path=f"/users/{user_id}/credentials_embed/{credentials_embed_id}",
12791 structure=str,
12792 transport_options=transport_options,
12793 ),
12794 )
12795 return response
12796
12797 # ### Embed login information for the specified user.
12798 #
12799 # **NOTE**: Calls to this endpoint require [Embedding](https://cloud.google.com/looker/docs/r/looker-core-feature-embed) to be enabled. Usage of this endpoint is not authorized for Looker Core Standard and Looker Core Enterprise.
12800 #
12801 # GET /users/{user_id}/credentials_embed -> Sequence[mdls.CredentialsEmbed]
12802 def all_user_credentials_embeds(
12803 self,
12804 # Id of user
12805 user_id: str,
12806 # Requested fields.
12807 fields: Optional[str] = None,
12808 transport_options: Optional[transport.TransportOptions] = None,
12809 ) -> Sequence[mdls.CredentialsEmbed]:
12810 """Get All Embedding Credentials"""
12811 user_id = self.encode_path_param(user_id)
12812 response = cast(
12813 Sequence[mdls.CredentialsEmbed],
12814 self.get(
12815 path=f"/users/{user_id}/credentials_embed",
12816 structure=Sequence[mdls.CredentialsEmbed],
12817 query_params={"fields": fields},
12818 transport_options=transport_options,
12819 ),
12820 )
12821 return response
12822
12823 # ### Looker Openid login information for the specified user. Used by Looker Analysts.
12824 #
12825 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12826 #
12827 # GET /users/{user_id}/credentials_looker_openid -> mdls.CredentialsLookerOpenid
12828 def user_credentials_looker_openid(
12829 self,
12830 # Id of user
12831 user_id: str,
12832 # Requested fields.
12833 fields: Optional[str] = None,
12834 transport_options: Optional[transport.TransportOptions] = None,
12835 ) -> mdls.CredentialsLookerOpenid:
12836 """Get Looker OpenId Credential"""
12837 user_id = self.encode_path_param(user_id)
12838 response = cast(
12839 mdls.CredentialsLookerOpenid,
12840 self.get(
12841 path=f"/users/{user_id}/credentials_looker_openid",
12842 structure=mdls.CredentialsLookerOpenid,
12843 query_params={"fields": fields},
12844 transport_options=transport_options,
12845 ),
12846 )
12847 return response
12848
12849 # ### Looker Openid login information for the specified user. Used by Looker Analysts.
12850 #
12851 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12852 #
12853 # DELETE /users/{user_id}/credentials_looker_openid -> str
12854 def delete_user_credentials_looker_openid(
12855 self,
12856 # Id of user
12857 user_id: str,
12858 transport_options: Optional[transport.TransportOptions] = None,
12859 ) -> str:
12860 """Delete Looker OpenId Credential"""
12861 user_id = self.encode_path_param(user_id)
12862 response = cast(
12863 str,
12864 self.delete(
12865 path=f"/users/{user_id}/credentials_looker_openid",
12866 structure=str,
12867 transport_options=transport_options,
12868 ),
12869 )
12870 return response
12871
12872 # ### Web login session for the specified user.
12873 #
12874 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12875 #
12876 # GET /users/{user_id}/sessions/{session_id} -> mdls.Session
12877 def user_session(
12878 self,
12879 # Id of user
12880 user_id: str,
12881 # Id of Web Login Session
12882 session_id: str,
12883 # Requested fields.
12884 fields: Optional[str] = None,
12885 transport_options: Optional[transport.TransportOptions] = None,
12886 ) -> mdls.Session:
12887 """Get Web Login Session"""
12888 user_id = self.encode_path_param(user_id)
12889 session_id = self.encode_path_param(session_id)
12890 response = cast(
12891 mdls.Session,
12892 self.get(
12893 path=f"/users/{user_id}/sessions/{session_id}",
12894 structure=mdls.Session,
12895 query_params={"fields": fields},
12896 transport_options=transport_options,
12897 ),
12898 )
12899 return response
12900
12901 # ### Web login session for the specified user.
12902 #
12903 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12904 #
12905 # DELETE /users/{user_id}/sessions/{session_id} -> str
12906 def delete_user_session(
12907 self,
12908 # Id of user
12909 user_id: str,
12910 # Id of Web Login Session
12911 session_id: str,
12912 transport_options: Optional[transport.TransportOptions] = None,
12913 ) -> str:
12914 """Delete Web Login Session"""
12915 user_id = self.encode_path_param(user_id)
12916 session_id = self.encode_path_param(session_id)
12917 response = cast(
12918 str,
12919 self.delete(
12920 path=f"/users/{user_id}/sessions/{session_id}",
12921 structure=str,
12922 transport_options=transport_options,
12923 ),
12924 )
12925 return response
12926
12927 # ### Web login session for the specified user.
12928 #
12929 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12930 #
12931 # GET /users/{user_id}/sessions -> Sequence[mdls.Session]
12932 def all_user_sessions(
12933 self,
12934 # Id of user
12935 user_id: str,
12936 # Requested fields.
12937 fields: Optional[str] = None,
12938 transport_options: Optional[transport.TransportOptions] = None,
12939 ) -> Sequence[mdls.Session]:
12940 """Get All Web Login Sessions"""
12941 user_id = self.encode_path_param(user_id)
12942 response = cast(
12943 Sequence[mdls.Session],
12944 self.get(
12945 path=f"/users/{user_id}/sessions",
12946 structure=Sequence[mdls.Session],
12947 query_params={"fields": fields},
12948 transport_options=transport_options,
12949 ),
12950 )
12951 return response
12952
12953 # ### Create a password reset token.
12954 # This will create a cryptographically secure random password reset token for the user.
12955 # If the user already has a password reset token then this invalidates the old token and creates a new one.
12956 # The token is expressed as the 'password_reset_url' of the user's email/password credential object.
12957 # This takes an optional 'expires' param to indicate if the new token should be an expiring token.
12958 # Tokens that expire are typically used for self-service password resets for existing users.
12959 # Invitation emails for new users typically are not set to expire.
12960 # The expire period is always 60 minutes when expires is enabled.
12961 # This method can be called with an empty body.
12962 #
12963 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12964 #
12965 # POST /users/{user_id}/credentials_email/password_reset -> mdls.CredentialsEmail
12966 def create_user_credentials_email_password_reset(
12967 self,
12968 # Id of user
12969 user_id: str,
12970 # Expiring token.
12971 expires: Optional[bool] = None,
12972 # Requested fields.
12973 fields: Optional[str] = None,
12974 transport_options: Optional[transport.TransportOptions] = None,
12975 ) -> mdls.CredentialsEmail:
12976 """Create Password Reset Token"""
12977 user_id = self.encode_path_param(user_id)
12978 response = cast(
12979 mdls.CredentialsEmail,
12980 self.post(
12981 path=f"/users/{user_id}/credentials_email/password_reset",
12982 structure=mdls.CredentialsEmail,
12983 query_params={"expires": expires, "fields": fields},
12984 transport_options=transport_options,
12985 ),
12986 )
12987 return response
12988
12989 # ### Get information about roles of a given user
12990 #
12991 # GET /users/{user_id}/roles -> Sequence[mdls.Role]
12992 def user_roles(
12993 self,
12994 # Id of user
12995 user_id: str,
12996 # Requested fields.
12997 fields: Optional[str] = None,
12998 # Get only roles associated directly with the user: exclude those only associated through groups.
12999 direct_association_only: Optional[bool] = None,
13000 transport_options: Optional[transport.TransportOptions] = None,
13001 ) -> Sequence[mdls.Role]:
13002 """Get User Roles"""
13003 user_id = self.encode_path_param(user_id)
13004 response = cast(
13005 Sequence[mdls.Role],
13006 self.get(
13007 path=f"/users/{user_id}/roles",
13008 structure=Sequence[mdls.Role],
13009 query_params={
13010 "fields": fields,
13011 "direct_association_only": direct_association_only,
13012 },
13013 transport_options=transport_options,
13014 ),
13015 )
13016 return response
13017
13018 # ### Set roles of the user with a specific id.
13019 #
13020 # PUT /users/{user_id}/roles -> Sequence[mdls.Role]
13021 def set_user_roles(
13022 self,
13023 # Id of user
13024 user_id: str,
13025 body: Sequence[str],
13026 # Requested fields.
13027 fields: Optional[str] = None,
13028 transport_options: Optional[transport.TransportOptions] = None,
13029 ) -> Sequence[mdls.Role]:
13030 """Set User Roles"""
13031 user_id = self.encode_path_param(user_id)
13032 response = cast(
13033 Sequence[mdls.Role],
13034 self.put(
13035 path=f"/users/{user_id}/roles",
13036 structure=Sequence[mdls.Role],
13037 query_params={"fields": fields},
13038 body=body,
13039 transport_options=transport_options,
13040 ),
13041 )
13042 return response
13043
13044 # ### Get user attribute values for a given user.
13045 #
13046 # Returns the values of specified user attributes (or all user attributes) for a certain user.
13047 #
13048 # A value for each user attribute is searched for in the following locations, in this order:
13049 #
13050 # 1. in the user's account information
13051 # 1. in groups that the user is a member of
13052 # 1. the default value of the user attribute
13053 #
13054 # If more than one group has a value defined for a user attribute, the group with the lowest rank wins.
13055 #
13056 # The response will only include user attributes for which values were found. Use `include_unset=true` to include
13057 # empty records for user attributes with no value.
13058 #
13059 # The value of all hidden user attributes will be blank.
13060 #
13061 # GET /users/{user_id}/attribute_values -> Sequence[mdls.UserAttributeWithValue]
13062 def user_attribute_user_values(
13063 self,
13064 # Id of user
13065 user_id: str,
13066 # Requested fields.
13067 fields: Optional[str] = None,
13068 # Specific user attributes to request. Omit or leave blank to request all user attributes.
13069 user_attribute_ids: Optional[mdls.DelimSequence[str]] = None,
13070 # If true, returns all values in the search path instead of just the first value found. Useful for debugging group precedence.
13071 all_values: Optional[bool] = None,
13072 # If true, returns an empty record for each requested attribute that has no user, group, or default value.
13073 include_unset: Optional[bool] = None,
13074 transport_options: Optional[transport.TransportOptions] = None,
13075 ) -> Sequence[mdls.UserAttributeWithValue]:
13076 """Get User Attribute Values"""
13077 user_id = self.encode_path_param(user_id)
13078 response = cast(
13079 Sequence[mdls.UserAttributeWithValue],
13080 self.get(
13081 path=f"/users/{user_id}/attribute_values",
13082 structure=Sequence[mdls.UserAttributeWithValue],
13083 query_params={
13084 "fields": fields,
13085 "user_attribute_ids": user_attribute_ids,
13086 "all_values": all_values,
13087 "include_unset": include_unset,
13088 },
13089 transport_options=transport_options,
13090 ),
13091 )
13092 return response
13093
13094 # ### Store a custom value for a user attribute in a user's account settings.
13095 #
13096 # Per-user user attribute values take precedence over group or default values.
13097 #
13098 # PATCH /users/{user_id}/attribute_values/{user_attribute_id} -> mdls.UserAttributeWithValue
13099 def set_user_attribute_user_value(
13100 self,
13101 # Id of user
13102 user_id: str,
13103 # Id of user attribute
13104 user_attribute_id: str,
13105 body: mdls.WriteUserAttributeWithValue,
13106 transport_options: Optional[transport.TransportOptions] = None,
13107 ) -> mdls.UserAttributeWithValue:
13108 """Set User Attribute User Value"""
13109 user_id = self.encode_path_param(user_id)
13110 user_attribute_id = self.encode_path_param(user_attribute_id)
13111 response = cast(
13112 mdls.UserAttributeWithValue,
13113 self.patch(
13114 path=f"/users/{user_id}/attribute_values/{user_attribute_id}",
13115 structure=mdls.UserAttributeWithValue,
13116 body=body,
13117 transport_options=transport_options,
13118 ),
13119 )
13120 return response
13121
13122 # ### Delete a user attribute value from a user's account settings.
13123 #
13124 # After the user attribute value is deleted from the user's account settings, subsequent requests
13125 # for the user attribute value for this user will draw from the user's groups or the default
13126 # value of the user attribute. See [Get User Attribute Values](#!/User/user_attribute_user_values) for more
13127 # information about how user attribute values are resolved.
13128 #
13129 # DELETE /users/{user_id}/attribute_values/{user_attribute_id} -> None
13130 def delete_user_attribute_user_value(
13131 self,
13132 # Id of user
13133 user_id: str,
13134 # Id of user attribute
13135 user_attribute_id: str,
13136 transport_options: Optional[transport.TransportOptions] = None,
13137 ) -> None:
13138 """Delete User Attribute User Value"""
13139 user_id = self.encode_path_param(user_id)
13140 user_attribute_id = self.encode_path_param(user_attribute_id)
13141 response = cast(
13142 None,
13143 self.delete(
13144 path=f"/users/{user_id}/attribute_values/{user_attribute_id}",
13145 structure=None,
13146 transport_options=transport_options,
13147 ),
13148 )
13149 return response
13150
13151 # ### Send a password reset token.
13152 # This will send a password reset email to the user. If a password reset token does not already exist
13153 # for this user, it will create one and then send it.
13154 # If the user has not yet set up their account, it will send a setup email to the user.
13155 # The URL sent in the email is expressed as the 'password_reset_url' of the user's email/password credential object.
13156 # Password reset URLs will expire in 60 minutes.
13157 # This method can be called with an empty body.
13158 #
13159 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
13160 #
13161 # POST /users/{user_id}/credentials_email/send_password_reset -> mdls.CredentialsEmail
13162 def send_user_credentials_email_password_reset(
13163 self,
13164 # Id of user
13165 user_id: str,
13166 # Requested fields.
13167 fields: Optional[str] = None,
13168 transport_options: Optional[transport.TransportOptions] = None,
13169 ) -> mdls.CredentialsEmail:
13170 """Send Password Reset Token"""
13171 user_id = self.encode_path_param(user_id)
13172 response = cast(
13173 mdls.CredentialsEmail,
13174 self.post(
13175 path=f"/users/{user_id}/credentials_email/send_password_reset",
13176 structure=mdls.CredentialsEmail,
13177 query_params={"fields": fields},
13178 transport_options=transport_options,
13179 ),
13180 )
13181 return response
13182
13183 # ### Change a disabled user's email addresses
13184 #
13185 # Allows the admin to change the email addresses for all the user's
13186 # associated credentials. Will overwrite all associated email addresses with
13187 # the value supplied in the 'email' body param.
13188 # The user's 'is_disabled' status must be true.
13189 # If the user has a credential email, they will receive a verification email and the user will be disabled until they verify the email
13190 #
13191 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
13192 #
13193 # POST /users/{user_id}/update_emails -> mdls.User
13194 def wipeout_user_emails(
13195 self,
13196 # Id of user
13197 user_id: str,
13198 body: mdls.UserEmailOnly,
13199 # Requested fields.
13200 fields: Optional[str] = None,
13201 transport_options: Optional[transport.TransportOptions] = None,
13202 ) -> mdls.User:
13203 """Wipeout User Emails"""
13204 user_id = self.encode_path_param(user_id)
13205 response = cast(
13206 mdls.User,
13207 self.post(
13208 path=f"/users/{user_id}/update_emails",
13209 structure=mdls.User,
13210 query_params={"fields": fields},
13211 body=body,
13212 transport_options=transport_options,
13213 ),
13214 )
13215 return response
13216
13217 # Create an embed user from an external user ID
13218 #
13219 # **NOTE**: Calls to this endpoint require [Embedding](https://cloud.google.com/looker/docs/r/looker-core-feature-embed) to be enabled. Usage of this endpoint is not authorized for Looker Core Standard and Looker Core Enterprise.
13220 #
13221 # POST /users/embed_user -> mdls.UserPublic
13222 def create_embed_user(
13223 self,
13224 body: mdls.CreateEmbedUserRequest,
13225 transport_options: Optional[transport.TransportOptions] = None,
13226 ) -> mdls.UserPublic:
13227 """Create an embed user from an external user ID"""
13228 response = cast(
13229 mdls.UserPublic,
13230 self.post(
13231 path="/users/embed_user",
13232 structure=mdls.UserPublic,
13233 body=body,
13234 transport_options=transport_options,
13235 ),
13236 )
13237 return response
13238
13239 # endregion
13240
13241 # region UserAttribute: Manage User Attributes
13242
13243 # ### Get information about all user attributes.
13244 #
13245 # GET /user_attributes -> Sequence[mdls.UserAttribute]
13246 def all_user_attributes(
13247 self,
13248 # Requested fields.
13249 fields: Optional[str] = None,
13250 # Fields to order the results by. Sortable fields include: name, label
13251 sorts: Optional[str] = None,
13252 transport_options: Optional[transport.TransportOptions] = None,
13253 ) -> Sequence[mdls.UserAttribute]:
13254 """Get All User Attributes"""
13255 response = cast(
13256 Sequence[mdls.UserAttribute],
13257 self.get(
13258 path="/user_attributes",
13259 structure=Sequence[mdls.UserAttribute],
13260 query_params={"fields": fields, "sorts": sorts},
13261 transport_options=transport_options,
13262 ),
13263 )
13264 return response
13265
13266 # ### Create a new user attribute
13267 #
13268 # Permission information for a user attribute is conveyed through the `can` and `user_can_edit` fields.
13269 # The `user_can_edit` field indicates whether an attribute is user-editable _anywhere_ in the application.
13270 # The `can` field gives more granular access information, with the `set_value` child field indicating whether
13271 # an attribute's value can be set by [Setting the User Attribute User Value](#!/User/set_user_attribute_user_value).
13272 #
13273 # Note: `name` and `label` fields must be unique across all user attributes in the Looker instance.
13274 # Attempting to create a new user attribute with a name or label that duplicates an existing
13275 # user attribute will fail with a 422 error.
13276 #
13277 # POST /user_attributes -> mdls.UserAttribute
13278 def create_user_attribute(
13279 self,
13280 body: mdls.WriteUserAttribute,
13281 # Requested fields.
13282 fields: Optional[str] = None,
13283 transport_options: Optional[transport.TransportOptions] = None,
13284 ) -> mdls.UserAttribute:
13285 """Create User Attribute"""
13286 response = cast(
13287 mdls.UserAttribute,
13288 self.post(
13289 path="/user_attributes",
13290 structure=mdls.UserAttribute,
13291 query_params={"fields": fields},
13292 body=body,
13293 transport_options=transport_options,
13294 ),
13295 )
13296 return response
13297
13298 # ### Get information about a user attribute.
13299 #
13300 # GET /user_attributes/{user_attribute_id} -> mdls.UserAttribute
13301 def user_attribute(
13302 self,
13303 # Id of user attribute
13304 user_attribute_id: str,
13305 # Requested fields.
13306 fields: Optional[str] = None,
13307 transport_options: Optional[transport.TransportOptions] = None,
13308 ) -> mdls.UserAttribute:
13309 """Get User Attribute"""
13310 user_attribute_id = self.encode_path_param(user_attribute_id)
13311 response = cast(
13312 mdls.UserAttribute,
13313 self.get(
13314 path=f"/user_attributes/{user_attribute_id}",
13315 structure=mdls.UserAttribute,
13316 query_params={"fields": fields},
13317 transport_options=transport_options,
13318 ),
13319 )
13320 return response
13321
13322 # ### Update a user attribute definition.
13323 #
13324 # PATCH /user_attributes/{user_attribute_id} -> mdls.UserAttribute
13325 def update_user_attribute(
13326 self,
13327 # Id of user attribute
13328 user_attribute_id: str,
13329 body: mdls.WriteUserAttribute,
13330 # Requested fields.
13331 fields: Optional[str] = None,
13332 transport_options: Optional[transport.TransportOptions] = None,
13333 ) -> mdls.UserAttribute:
13334 """Update User Attribute"""
13335 user_attribute_id = self.encode_path_param(user_attribute_id)
13336 response = cast(
13337 mdls.UserAttribute,
13338 self.patch(
13339 path=f"/user_attributes/{user_attribute_id}",
13340 structure=mdls.UserAttribute,
13341 query_params={"fields": fields},
13342 body=body,
13343 transport_options=transport_options,
13344 ),
13345 )
13346 return response
13347
13348 # ### Delete a user attribute (admin only).
13349 #
13350 # DELETE /user_attributes/{user_attribute_id} -> str
13351 def delete_user_attribute(
13352 self,
13353 # Id of user attribute
13354 user_attribute_id: str,
13355 transport_options: Optional[transport.TransportOptions] = None,
13356 ) -> str:
13357 """Delete User Attribute"""
13358 user_attribute_id = self.encode_path_param(user_attribute_id)
13359 response = cast(
13360 str,
13361 self.delete(
13362 path=f"/user_attributes/{user_attribute_id}",
13363 structure=str,
13364 transport_options=transport_options,
13365 ),
13366 )
13367 return response
13368
13369 # ### Returns all values of a user attribute defined by user groups, in precedence order.
13370 #
13371 # A user may be a member of multiple groups which define different values for a given user attribute.
13372 # The order of group-values in the response determines precedence for selecting which group-value applies
13373 # to a given user. For more information, see [Set User Attribute Group Values](#!/UserAttribute/set_user_attribute_group_values).
13374 #
13375 # Results will only include groups that the caller's user account has permission to see.
13376 #
13377 # GET /user_attributes/{user_attribute_id}/group_values -> Sequence[mdls.UserAttributeGroupValue]
13378 def all_user_attribute_group_values(
13379 self,
13380 # Id of user attribute
13381 user_attribute_id: str,
13382 # Requested fields.
13383 fields: Optional[str] = None,
13384 transport_options: Optional[transport.TransportOptions] = None,
13385 ) -> Sequence[mdls.UserAttributeGroupValue]:
13386 """Get User Attribute Group Values"""
13387 user_attribute_id = self.encode_path_param(user_attribute_id)
13388 response = cast(
13389 Sequence[mdls.UserAttributeGroupValue],
13390 self.get(
13391 path=f"/user_attributes/{user_attribute_id}/group_values",
13392 structure=Sequence[mdls.UserAttributeGroupValue],
13393 query_params={"fields": fields},
13394 transport_options=transport_options,
13395 ),
13396 )
13397 return response
13398
13399 # ### Define values for a user attribute across a set of groups, in priority order.
13400 #
13401 # This function defines all values for a user attribute defined by user groups. This is a global setting, potentially affecting
13402 # all users in the system. This function replaces any existing group value definitions for the indicated user attribute.
13403 #
13404 # The value of a user attribute for a given user is determined by searching the following locations, in this order:
13405 #
13406 # 1. the user's account settings
13407 # 2. the groups that the user is a member of
13408 # 3. the default value of the user attribute, if any
13409 #
13410 # The user may be a member of multiple groups which define different values for that user attribute. The order of items in the group_values parameter
13411 # determines which group takes priority for that user. Lowest array index wins.
13412 #
13413 # An alternate method to indicate the selection precedence of group-values is to assign numbers to the 'rank' property of each
13414 # group-value object in the array. Lowest 'rank' value wins. If you use this technique, you must assign a
13415 # rank value to every group-value object in the array.
13416 #
13417 # To set a user attribute value for a single user, see [Set User Attribute User Value](#!/User/set_user_attribute_user_value).
13418 # To set a user attribute value for all members of a group, see [Set User Attribute Group Value](#!/Group/update_user_attribute_group_value).
13419 #
13420 # POST /user_attributes/{user_attribute_id}/group_values -> Sequence[mdls.UserAttributeGroupValue]
13421 def set_user_attribute_group_values(
13422 self,
13423 # Id of user attribute
13424 user_attribute_id: str,
13425 body: Sequence[mdls.UserAttributeGroupValue],
13426 transport_options: Optional[transport.TransportOptions] = None,
13427 ) -> Sequence[mdls.UserAttributeGroupValue]:
13428 """Set User Attribute Group Values"""
13429 user_attribute_id = self.encode_path_param(user_attribute_id)
13430 response = cast(
13431 Sequence[mdls.UserAttributeGroupValue],
13432 self.post(
13433 path=f"/user_attributes/{user_attribute_id}/group_values",
13434 structure=Sequence[mdls.UserAttributeGroupValue],
13435 body=body,
13436 transport_options=transport_options,
13437 ),
13438 )
13439 return response
13440
13441 # endregion
13442
13443 # region Workspace: Manage Workspaces
13444
13445 # ### Get All Workspaces
13446 #
13447 # Returns all workspaces available to the calling user.
13448 #
13449 # GET /workspaces -> Sequence[mdls.Workspace]
13450 def all_workspaces(
13451 self,
13452 transport_options: Optional[transport.TransportOptions] = None,
13453 ) -> Sequence[mdls.Workspace]:
13454 """Get All Workspaces"""
13455 response = cast(
13456 Sequence[mdls.Workspace],
13457 self.get(
13458 path="/workspaces",
13459 structure=Sequence[mdls.Workspace],
13460 transport_options=transport_options,
13461 ),
13462 )
13463 return response
13464
13465 # ### Get A Workspace
13466 #
13467 # Returns information about a workspace such as the git status and selected branches
13468 # of all projects available to the caller's user account.
13469 #
13470 # A workspace defines which versions of project files will be used to evaluate expressions
13471 # and operations that use model definitions - operations such as running queries or rendering dashboards.
13472 # Each project has its own git repository, and each project in a workspace may be configured to reference
13473 # particular branch or revision within their respective repositories.
13474 #
13475 # There are two predefined workspaces available: "production" and "dev".
13476 #
13477 # The production workspace is shared across all Looker users. Models in the production workspace are read-only.
13478 # Changing files in production is accomplished by modifying files in a git branch and using Pull Requests
13479 # to merge the changes from the dev branch into the production branch, and then telling
13480 # Looker to sync with production.
13481 #
13482 # The dev workspace is local to each Looker user. Changes made to project/model files in the dev workspace only affect
13483 # that user, and only when the dev workspace is selected as the active workspace for the API session.
13484 # (See set_session_workspace()).
13485 #
13486 # The dev workspace is NOT unique to an API session. Two applications accessing the Looker API using
13487 # the same user account will see the same files in the dev workspace. To avoid collisions between
13488 # API clients it's best to have each client login with API credentials for a different user account.
13489 #
13490 # Changes made to files in a dev workspace are persistent across API sessions. It's a good
13491 # idea to commit any changes you've made to the git repository, but not strictly required. Your modified files
13492 # reside in a special user-specific directory on the Looker server and will still be there when you login in again
13493 # later and use update_session(workspace_id: "dev") to select the dev workspace for the new API session.
13494 #
13495 # GET /workspaces/{workspace_id} -> mdls.Workspace
13496 def workspace(
13497 self,
13498 # Id of the workspace
13499 workspace_id: str,
13500 transport_options: Optional[transport.TransportOptions] = None,
13501 ) -> mdls.Workspace:
13502 """Get Workspace"""
13503 workspace_id = self.encode_path_param(workspace_id)
13504 response = cast(
13505 mdls.Workspace,
13506 self.get(
13507 path=f"/workspaces/{workspace_id}",
13508 structure=mdls.Workspace,
13509 transport_options=transport_options,
13510 ),
13511 )
13512 return response
13513
13514 # endregion
13515
13516
13517LookerSDK = Looker40SDK