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# 483 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://docs.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 # In [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview) this call will be denied unless all of the following criteria are met:
421 # 1. The calling user is an [API-only Service Account](https://docs.cloud.google.com/looker/docs/looker-core-user-management#creating_an_api-only_service_account) with the Admin role
422 # 2. The target user is an [Embed User type](https://docs.cloud.google.com/looker/docs/r/single-sign-on-embedding)
423 # Regular user types can not be impersonated in [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview). If your application needs to call the API for these users, use OAuth authentication instead.
424 #
425 # POST /login/{user_id} -> mdls.AccessToken
426 def login_user(
427 self,
428 # Id of user.
429 user_id: str,
430 # 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.
431 associative: Optional[bool] = None,
432 transport_options: Optional[transport.TransportOptions] = None,
433 ) -> mdls.AccessToken:
434 """Login user"""
435 user_id = self.encode_path_param(user_id)
436 warnings.warn(
437 "login_user behavior changed significantly in 21.4.0. See https://git.io/JOtH1"
438 )
439 response = cast(
440 mdls.AccessToken,
441 self.post(
442 path=f"/login/{user_id}",
443 structure=mdls.AccessToken,
444 query_params={"associative": associative},
445 transport_options=transport_options,
446 ),
447 )
448 return response
449
450 # ### Logout of the API and invalidate the current access token.
451 #
452 # DELETE /logout -> str
453 def logout(
454 self,
455 transport_options: Optional[transport.TransportOptions] = None,
456 ) -> str:
457 """Logout"""
458 response = cast(
459 str,
460 self.delete(
461 path="/logout", structure=str, transport_options=transport_options
462 ),
463 )
464 return response
465
466 # endregion
467
468 # region Artifact: Artifact Storage
469
470 # Get the maximum configured size of the entire artifact store, and the currently used storage in bytes.
471 #
472 # **Note**: The artifact storage API can only be used by Looker-built extensions.
473 #
474 # GET /artifact/usage -> mdls.ArtifactUsage
475 def artifact_usage(
476 self,
477 # Comma-delimited names of fields to return in responses. Omit for all fields
478 fields: Optional[str] = None,
479 transport_options: Optional[transport.TransportOptions] = None,
480 ) -> mdls.ArtifactUsage:
481 """Artifact store usage"""
482 response = cast(
483 mdls.ArtifactUsage,
484 self.get(
485 path="/artifact/usage",
486 structure=mdls.ArtifactUsage,
487 query_params={"fields": fields},
488 transport_options=transport_options,
489 ),
490 )
491 return response
492
493 # Get all artifact namespaces and the count of artifacts in each namespace
494 #
495 # **Note**: The artifact storage API can only be used by Looker-built extensions.
496 #
497 # GET /artifact/namespaces -> Sequence[mdls.ArtifactNamespace]
498 def artifact_namespaces(
499 self,
500 # Comma-delimited names of fields to return in responses. Omit for all fields
501 fields: Optional[str] = None,
502 # Number of results to return. (used with offset)
503 limit: Optional[int] = None,
504 # Number of results to skip before returning any. (used with limit)
505 offset: Optional[int] = None,
506 transport_options: Optional[transport.TransportOptions] = None,
507 ) -> Sequence[mdls.ArtifactNamespace]:
508 """Get namespaces and counts"""
509 response = cast(
510 Sequence[mdls.ArtifactNamespace],
511 self.get(
512 path="/artifact/namespaces",
513 structure=Sequence[mdls.ArtifactNamespace],
514 query_params={"fields": fields, "limit": limit, "offset": offset},
515 transport_options=transport_options,
516 ),
517 )
518 return response
519
520 # ### Return the value of an artifact
521 #
522 # The MIME type for the API response is set to the `content_type` of the value
523 #
524 # **Note**: The artifact storage API can only be used by Looker-built extensions.
525 #
526 # GET /artifact/{namespace}/value -> str
527 def artifact_value(
528 self,
529 # Artifact storage namespace
530 namespace: str,
531 # Artifact storage key. Namespace + Key must be unique
532 key: Optional[str] = None,
533 transport_options: Optional[transport.TransportOptions] = None,
534 ) -> str:
535 """Get an artifact value"""
536 namespace = self.encode_path_param(namespace)
537 response = cast(
538 str,
539 self.get(
540 path=f"/artifact/{namespace}/value",
541 structure=str,
542 query_params={"key": key},
543 transport_options=transport_options,
544 ),
545 )
546 return response
547
548 # Remove *all* artifacts from a namespace. Purged artifacts are permanently deleted
549 #
550 # **Note**: The artifact storage API can only be used by Looker-built extensions.
551 #
552 # DELETE /artifact/{namespace}/purge -> None
553 def purge_artifacts(
554 self,
555 # Artifact storage namespace
556 namespace: str,
557 transport_options: Optional[transport.TransportOptions] = None,
558 ) -> None:
559 """Purge artifacts"""
560 namespace = self.encode_path_param(namespace)
561 response = cast(
562 None,
563 self.delete(
564 path=f"/artifact/{namespace}/purge",
565 structure=None,
566 transport_options=transport_options,
567 ),
568 )
569 return response
570
571 # ### Search all key/value pairs in a namespace for matching criteria.
572 #
573 # Returns an array of artifacts matching the specified search criteria.
574 #
575 # Key search patterns use case-insensitive matching and can contain `%` and `_` as SQL LIKE pattern match wildcard expressions.
576 #
577 # The parameters `min_size` and `max_size` can be used individually or together.
578 #
579 # - `min_size` finds artifacts with sizes greater than or equal to its value
580 # - `max_size` finds artifacts with sizes less than or equal to its value
581 # - using both parameters restricts the minimum and maximum size range for artifacts
582 #
583 # **NOTE**: Artifacts are always returned in alphanumeric order by key.
584 #
585 # Get a **single artifact** by namespace and key with [`artifact`](#!/Artifact/artifact)
586 #
587 # **Note**: The artifact storage API can only be used by Looker-built extensions.
588 #
589 # GET /artifact/{namespace}/search -> Sequence[mdls.Artifact]
590 def search_artifacts(
591 self,
592 # Artifact storage namespace
593 namespace: str,
594 # Comma-delimited names of fields to return in responses. Omit for all fields
595 fields: Optional[str] = None,
596 # Key pattern to match
597 key: Optional[str] = None,
598 # Ids of users who created or updated the artifact (comma-delimited list)
599 user_ids: Optional[str] = None,
600 # Minimum storage size of the artifact
601 min_size: Optional[int] = None,
602 # Maximum storage size of the artifact
603 max_size: Optional[int] = None,
604 # Number of results to return. (used with offset)
605 limit: Optional[int] = None,
606 # Number of results to skip before returning any. (used with limit)
607 offset: Optional[int] = None,
608 # Return the full count of results in the X-Total-Count response header. (Slight performance hit.)
609 tally: Optional[bool] = None,
610 transport_options: Optional[transport.TransportOptions] = None,
611 ) -> Sequence[mdls.Artifact]:
612 """Search artifacts"""
613 namespace = self.encode_path_param(namespace)
614 response = cast(
615 Sequence[mdls.Artifact],
616 self.get(
617 path=f"/artifact/{namespace}/search",
618 structure=Sequence[mdls.Artifact],
619 query_params={
620 "fields": fields,
621 "key": key,
622 "user_ids": user_ids,
623 "min_size": min_size,
624 "max_size": max_size,
625 "limit": limit,
626 "offset": offset,
627 "tally": tally,
628 },
629 transport_options=transport_options,
630 ),
631 )
632 return response
633
634 # ### Get one or more artifacts
635 #
636 # Returns an array of artifacts matching the specified key value(s).
637 #
638 # **Note**: The artifact storage API can only be used by Looker-built extensions.
639 #
640 # GET /artifact/{namespace} -> Sequence[mdls.Artifact]
641 def artifact(
642 self,
643 # Artifact storage namespace
644 namespace: str,
645 # Comma-delimited list of keys. Wildcards not allowed.
646 key: str,
647 # Comma-delimited names of fields to return in responses. Omit for all fields
648 fields: Optional[str] = None,
649 # Number of results to return. (used with offset)
650 limit: Optional[int] = None,
651 # Number of results to skip before returning any. (used with limit)
652 offset: Optional[int] = None,
653 # Return the full count of results in the X-Total-Count response header. (Slight performance hit.)
654 tally: Optional[bool] = None,
655 transport_options: Optional[transport.TransportOptions] = None,
656 ) -> Sequence[mdls.Artifact]:
657 """Get one or more artifacts"""
658 namespace = self.encode_path_param(namespace)
659 response = cast(
660 Sequence[mdls.Artifact],
661 self.get(
662 path=f"/artifact/{namespace}",
663 structure=Sequence[mdls.Artifact],
664 query_params={
665 "key": key,
666 "fields": fields,
667 "limit": limit,
668 "offset": offset,
669 "tally": tally,
670 },
671 transport_options=transport_options,
672 ),
673 )
674 return response
675
676 # ### Delete one or more artifacts
677 #
678 # 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.
679 #
680 # **Note**: The artifact storage API can only be used by Looker-built extensions.
681 #
682 # DELETE /artifact/{namespace} -> None
683 def delete_artifact(
684 self,
685 # Artifact storage namespace
686 namespace: str,
687 # Comma-delimited list of keys. Wildcards not allowed.
688 key: str,
689 transport_options: Optional[transport.TransportOptions] = None,
690 ) -> None:
691 """Delete one or more artifacts"""
692 namespace = self.encode_path_param(namespace)
693 response = cast(
694 None,
695 self.delete(
696 path=f"/artifact/{namespace}",
697 structure=None,
698 query_params={"key": key},
699 transport_options=transport_options,
700 ),
701 )
702 return response
703
704 # ### Create or update one or more artifacts
705 #
706 # Only `key` and `value` are required to _create_ an artifact.
707 # To _update_ an artifact, its current `version` value must be provided.
708 #
709 # In the following example `body` payload, `one` and `two` are existing artifacts, and `three` is new:
710 #
711 # ```json
712 # [
713 # { "key": "one", "value": "[ \"updating\", \"existing\", \"one\" ]", "version": 10, "content_type": "application/json" },
714 # { "key": "two", "value": "updating existing two", "version": 20 },
715 # { "key": "three", "value": "creating new three" },
716 # ]
717 # ```
718 #
719 # Notes for this body:
720 #
721 # - 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.
722 # - The `version` values for **one** and **two** mean they have been saved 10 and 20 times, respectively.
723 # - If `version` is **not** provided for an existing artifact, the entire request will be refused and a `Bad Request` response will be sent.
724 # - 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`.
725 # - 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.
726 #
727 # 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.
728 #
729 # **Note**: The artifact storage API can only be used by Looker-built extensions.
730 #
731 # PUT /artifacts/{namespace} -> Sequence[mdls.Artifact]
732 def update_artifacts(
733 self,
734 # Artifact storage namespace
735 namespace: str,
736 body: Sequence[mdls.UpdateArtifact],
737 # Comma-delimited names of fields to return in responses. Omit for all fields
738 fields: Optional[str] = None,
739 transport_options: Optional[transport.TransportOptions] = None,
740 ) -> Sequence[mdls.Artifact]:
741 """Create or update artifacts"""
742 namespace = self.encode_path_param(namespace)
743 response = cast(
744 Sequence[mdls.Artifact],
745 self.put(
746 path=f"/artifacts/{namespace}",
747 structure=Sequence[mdls.Artifact],
748 query_params={"fields": fields},
749 body=body,
750 transport_options=transport_options,
751 ),
752 )
753 return response
754
755 # endregion
756
757 # region Auth: Manage User Authentication Configuration
758
759 # ### Create an embed secret using the specified information.
760 #
761 # The value of the `secret` field will be set by Looker and returned.
762 #
763 # **NOTE**: Calls to this endpoint require [Embedding](https://docs.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.
764 #
765 # POST /embed_config/secrets -> mdls.EmbedSecret
766 def create_embed_secret(
767 self,
768 body: Optional[mdls.WriteEmbedSecret] = None,
769 transport_options: Optional[transport.TransportOptions] = None,
770 ) -> mdls.EmbedSecret:
771 """Create Embed Secret"""
772 response = cast(
773 mdls.EmbedSecret,
774 self.post(
775 path="/embed_config/secrets",
776 structure=mdls.EmbedSecret,
777 body=body,
778 transport_options=transport_options,
779 ),
780 )
781 return response
782
783 # ### Delete an embed secret.
784 #
785 # **NOTE**: Calls to this endpoint require [Embedding](https://docs.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.
786 #
787 # DELETE /embed_config/secrets/{embed_secret_id} -> str
788 def delete_embed_secret(
789 self,
790 # Id of Embed Secret
791 embed_secret_id: str,
792 transport_options: Optional[transport.TransportOptions] = None,
793 ) -> str:
794 """Delete Embed Secret"""
795 embed_secret_id = self.encode_path_param(embed_secret_id)
796 response = cast(
797 str,
798 self.delete(
799 path=f"/embed_config/secrets/{embed_secret_id}",
800 structure=str,
801 transport_options=transport_options,
802 ),
803 )
804 return response
805
806 # ### Create Signed Embed URL
807 #
808 # Creates a signed embed URL and cryptographically signs it with an embed secret.
809 # This signed URL can then be used to instantiate a Looker embed session in a PBL web application.
810 # Do not make any modifications to the returned URL - any change may invalidate the signature and
811 # cause the URL to fail to load a Looker embed session.
812 #
813 # A signed embed URL can only be **used once**. After the URL has been used to request a page from the
814 # Looker server, it is invalid. Future requests using the same URL will fail. This is to prevent
815 # 'replay attacks'.
816 #
817 # The `target_url` property must be a complete URL of a Looker UI page - scheme, hostname, path and query params.
818 # 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`.
819 # 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
820 # to copy it to your clipboard and paste it into the `target_url` property as a quoted string value in this API request.
821 #
822 # Permissions for the embed user are defined by the groups in which the embed user is a member (`group_ids` property)
823 # and the lists of models and permissions assigned to the embed user.
824 # At a minimum, you must provide values for either the `group_ids` property, or **both** the models and permissions properties.
825 # These properties are additive; an embed user can be a member of certain groups AND be granted access to models and permissions.
826 #
827 # The embed user's access is the union of permissions granted by the `group_ids`, `models`, and `permissions` properties.
828 #
829 # This function does not strictly require all group_ids, user attribute names, or model names to exist at the moment the
830 # embed url is created. Unknown group_id, user attribute names or model names will be passed through to the output URL.
831 # Because of this, **these parameters are not validated** when the API call is made.
832 #
833 # The [Get Embed Url](https://docs.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.
834 # 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
835 # in `<your looker instance>/admin/embed` to diagnose potential problems.
836 #
837 # The `secret_id` parameter is optional. If specified, its value must be the id of an active secret defined in the Looker instance.
838 # 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,
839 # a default secret will be created. This default secret is encrypted using HMAC/SHA-256.
840 #
841 # The `embed_domain` parameter is optional. If specified and valid, the domain will be added to the embed domain allowlist if it is missing.
842 #
843 # #### Security Note
844 # Protect this signed URL as you would an access token or password credentials - do not write
845 # it to disk, do not pass it to a third party, and only pass it through a secure HTTPS
846 # encrypted transport.
847 #
848 #
849 # **NOTE**: Calls to this endpoint require [Embedding](https://docs.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.
850 #
851 # POST /embed/sso_url -> mdls.EmbedUrlResponse
852 def create_sso_embed_url(
853 self,
854 body: mdls.EmbedSsoParams,
855 transport_options: Optional[transport.TransportOptions] = None,
856 ) -> mdls.EmbedUrlResponse:
857 """Create Signed Embed Url"""
858 response = cast(
859 mdls.EmbedUrlResponse,
860 self.post(
861 path="/embed/sso_url",
862 structure=mdls.EmbedUrlResponse,
863 body=body,
864 transport_options=transport_options,
865 ),
866 )
867 return response
868
869 # ### Create an Embed URL
870 #
871 # Creates an embed URL that runs as the Looker user making this API call. ("Embed as me")
872 # This embed URL can then be used to instantiate a Looker embed session in a
873 # "Powered by Looker" (PBL) web application.
874 #
875 # This is similar to Private Embedding (https://docs.cloud.google.com/looker/docs/r/admin/embed/private-embed). Instead of
876 # logging into the Web UI to authenticate, the user has already authenticated against the API to be able to
877 # make this call. However, unlike Private Embed where the user has access to any other part of the Looker UI,
878 # the embed web session created by requesting the EmbedUrlResponse.url in a browser only has access to
879 # content visible under the `/embed` context.
880 #
881 # An embed URL can only be used once, and must be used within 5 minutes of being created. After it
882 # has been used to request a page from the Looker server, the URL is invalid. Future requests using
883 # the same URL will fail. This is to prevent 'replay attacks'.
884 #
885 # The `target_url` property must be a complete URL of a Looker Embedded UI page - scheme, hostname, path starting with "/embed" and query params.
886 # 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`.
887 # The best way to obtain this target_url is to navigate to the desired Looker page in your web browser,
888 # 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.
889 #
890 # #### Security Note
891 # Protect this signed URL as you would an access token or password credentials - do not write
892 # it to disk, do not pass it to a third party, and only pass it through a secure HTTPS
893 # encrypted transport.
894 #
895 # POST /embed/token_url/me -> mdls.EmbedUrlResponse
896 def create_embed_url_as_me(
897 self,
898 body: mdls.EmbedParams,
899 transport_options: Optional[transport.TransportOptions] = None,
900 ) -> mdls.EmbedUrlResponse:
901 """Create Embed URL"""
902 response = cast(
903 mdls.EmbedUrlResponse,
904 self.post(
905 path="/embed/token_url/me",
906 structure=mdls.EmbedUrlResponse,
907 body=body,
908 transport_options=transport_options,
909 ),
910 )
911 return response
912
913 # ### Validate a Signed Embed URL
914 #
915 # GET /embed/sso/validate -> mdls.EmbedUrlResponse
916 def validate_embed_url(
917 self,
918 # URL to validate
919 url: Optional[str] = None,
920 transport_options: Optional[transport.TransportOptions] = None,
921 ) -> mdls.EmbedUrlResponse:
922 """Get Embed URL Validation"""
923 response = cast(
924 mdls.EmbedUrlResponse,
925 self.get(
926 path="/embed/sso/validate",
927 structure=mdls.EmbedUrlResponse,
928 query_params={"url": url},
929 transport_options=transport_options,
930 ),
931 )
932 return response
933
934 # ### Acquire a cookieless embed session.
935 #
936 # The acquire session endpoint negates the need for signing the embed url and passing it as a parameter
937 # to the embed login. This endpoint accepts an embed user definition and creates or updates it. This is
938 # similar behavior to the embed SSO login as they both can create and update embed user data.
939 #
940 # The endpoint also accepts an optional `session_reference_token`. If present and the session has not expired
941 # and the credentials match the credentials for the embed session, a new authentication token will be
942 # generated. This allows the embed session to attach a new embedded IFRAME to the embed session. Note that
943 # the session is NOT extended in this scenario. In other words the session_length parameter is ignored.
944 #
945 # **IMPORTANT:** If the `session_reference_token` is provided and the session has NOT expired, the embed user
946 # is NOT updated. This is done for performance reasons and to support the embed SSO usecase where the
947 # first IFRAME created on a page uses a signed url and subsequently created IFRAMEs do not.
948 #
949 # If the `session_reference_token` is provided but the session has expired, the token will be ignored and a
950 # new embed session will be created. Note that the embed user definition will be updated in this scenario.
951 #
952 # If the credentials do not match the credentials associated with an existing session_reference_token, a
953 # 404 will be returned.
954 #
955 # The endpoint returns the following:
956 # - Authentication token - a token that is passed to `/embed/login` endpoint that creates or attaches to the
957 # embed session. This token can be used once and has a lifetime of 30 seconds.
958 # - Session reference token - a token that lives for the length of the session. This token is used to
959 # generate new api and navigation tokens OR create new embed IFRAMEs.
960 # - Api token - lives for 10 minutes. The Looker client will ask for this token once it is loaded into the
961 # iframe.
962 # - Navigation token - lives for 10 minutes. The Looker client will ask for this token once it is loaded into
963 # the iframe.
964 #
965 # **NOTE**: Calls to this endpoint require [Embedding](https://docs.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.
966 #
967 # POST /embed/cookieless_session/acquire -> mdls.EmbedCookielessSessionAcquireResponse
968 def acquire_embed_cookieless_session(
969 self,
970 body: mdls.EmbedCookielessSessionAcquire,
971 transport_options: Optional[transport.TransportOptions] = None,
972 ) -> mdls.EmbedCookielessSessionAcquireResponse:
973 """Create Acquire cookieless embed session"""
974 response = cast(
975 mdls.EmbedCookielessSessionAcquireResponse,
976 self.post(
977 path="/embed/cookieless_session/acquire",
978 structure=mdls.EmbedCookielessSessionAcquireResponse,
979 body=body,
980 transport_options=transport_options,
981 ),
982 )
983 return response
984
985 # ### Delete cookieless embed session
986 #
987 # This will delete the session associated with the given session reference token. Calling this endpoint will result
988 # in the session and session reference data being cleared from the system. This endpoint can be used to log an embed
989 # user out of the Looker instance.
990 #
991 # **NOTE**: Calls to this endpoint require [Embedding](https://docs.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.
992 #
993 # DELETE /embed/cookieless_session/{session_reference_token} -> str
994 def delete_embed_cookieless_session(
995 self,
996 # Embed session reference token
997 session_reference_token: str,
998 transport_options: Optional[transport.TransportOptions] = None,
999 ) -> str:
1000 """Delete cookieless embed session"""
1001 session_reference_token = self.encode_path_param(session_reference_token)
1002 response = cast(
1003 str,
1004 self.delete(
1005 path=f"/embed/cookieless_session/{session_reference_token}",
1006 structure=str,
1007 transport_options=transport_options,
1008 ),
1009 )
1010 return response
1011
1012 # ### Generate api and navigation tokens for a cookieless embed session
1013 #
1014 # The generate tokens endpoint is used to create new tokens of type:
1015 # - Api token.
1016 # - Navigation token.
1017 # The generate tokens endpoint should be called every time the Looker client asks for a token (except for the
1018 # first time when the tokens returned by the acquire_session endpoint should be used).
1019 #
1020 # #### Embed session expiration handling
1021 #
1022 # This endpoint does NOT return an error when the embed session expires. This is to simplify processing
1023 # in the caller as errors can happen for non session expiration reasons. Instead the endpoint returns
1024 # the session time to live in the `session_reference_token_ttl` response property. If this property
1025 # contains a zero, the embed session has expired.
1026 #
1027 # **NOTE**: Calls to this endpoint require [Embedding](https://docs.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.
1028 #
1029 # PUT /embed/cookieless_session/generate_tokens -> mdls.EmbedCookielessSessionGenerateTokensResponse
1030 def generate_tokens_for_cookieless_session(
1031 self,
1032 body: mdls.EmbedCookielessSessionGenerateTokens,
1033 transport_options: Optional[transport.TransportOptions] = None,
1034 ) -> mdls.EmbedCookielessSessionGenerateTokensResponse:
1035 """Generate tokens for cookieless embed session"""
1036 response = cast(
1037 mdls.EmbedCookielessSessionGenerateTokensResponse,
1038 self.put(
1039 path="/embed/cookieless_session/generate_tokens",
1040 structure=mdls.EmbedCookielessSessionGenerateTokensResponse,
1041 body=body,
1042 transport_options=transport_options,
1043 ),
1044 )
1045 return response
1046
1047 # ### Get the LDAP configuration.
1048 #
1049 # Looker can be optionally configured to authenticate users against an Active Directory or other LDAP directory server.
1050 # LDAP setup requires coordination with an administrator of that directory server.
1051 #
1052 # Only Looker administrators can read and update the LDAP configuration.
1053 #
1054 # Configuring LDAP impacts authentication for all users. This configuration should be done carefully.
1055 #
1056 # 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).
1057 #
1058 # LDAP is enabled or disabled for Looker using the **enabled** field.
1059 #
1060 # Looker will never return an **auth_password** field. That value can be set, but never retrieved.
1061 #
1062 # See the [Looker LDAP docs](https://docs.cloud.google.com/looker/docs/r/api/ldap_setup) for additional information.
1063 #
1064 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
1065 #
1066 # GET /ldap_config -> mdls.LDAPConfig
1067 def ldap_config(
1068 self,
1069 transport_options: Optional[transport.TransportOptions] = None,
1070 ) -> mdls.LDAPConfig:
1071 """Get LDAP Configuration"""
1072 response = cast(
1073 mdls.LDAPConfig,
1074 self.get(
1075 path="/ldap_config",
1076 structure=mdls.LDAPConfig,
1077 transport_options=transport_options,
1078 ),
1079 )
1080 return response
1081
1082 # ### Update the LDAP configuration.
1083 #
1084 # Configuring LDAP impacts authentication for all users. This configuration should be done carefully.
1085 #
1086 # Only Looker administrators can read and update the LDAP configuration.
1087 #
1088 # LDAP is enabled or disabled for Looker using the **enabled** field.
1089 #
1090 # It is **highly** recommended that any LDAP setting changes be tested using the APIs below before being set globally.
1091 #
1092 # See the [Looker LDAP docs](https://docs.cloud.google.com/looker/docs/r/api/ldap_setup) for additional information.
1093 #
1094 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
1095 #
1096 # PATCH /ldap_config -> mdls.LDAPConfig
1097 def update_ldap_config(
1098 self,
1099 body: mdls.WriteLDAPConfig,
1100 transport_options: Optional[transport.TransportOptions] = None,
1101 ) -> mdls.LDAPConfig:
1102 """Update LDAP Configuration"""
1103 response = cast(
1104 mdls.LDAPConfig,
1105 self.patch(
1106 path="/ldap_config",
1107 structure=mdls.LDAPConfig,
1108 body=body,
1109 transport_options=transport_options,
1110 ),
1111 )
1112 return response
1113
1114 # ### Test the connection settings for an LDAP configuration.
1115 #
1116 # This tests that the connection is possible given a connection_host and connection_port.
1117 #
1118 # **connection_host** and **connection_port** are required. **connection_tls** is optional.
1119 #
1120 # Example:
1121 # ```json
1122 # {
1123 # "connection_host": "ldap.example.com",
1124 # "connection_port": "636",
1125 # "connection_tls": true
1126 # }
1127 # ```
1128 #
1129 # No authentication to the LDAP server is attempted.
1130 #
1131 # The active LDAP settings are not modified.
1132 #
1133 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
1134 #
1135 # PUT /ldap_config/test_connection -> mdls.LDAPConfigTestResult
1136 def test_ldap_config_connection(
1137 self,
1138 body: mdls.WriteLDAPConfig,
1139 transport_options: Optional[transport.TransportOptions] = None,
1140 ) -> mdls.LDAPConfigTestResult:
1141 """Test LDAP Connection"""
1142 response = cast(
1143 mdls.LDAPConfigTestResult,
1144 self.put(
1145 path="/ldap_config/test_connection",
1146 structure=mdls.LDAPConfigTestResult,
1147 body=body,
1148 transport_options=transport_options,
1149 ),
1150 )
1151 return response
1152
1153 # ### Test the connection authentication settings for an LDAP configuration.
1154 #
1155 # 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.
1156 #
1157 # **connection_host**, **connection_port**, and **auth_username**, are required. **connection_tls** and **auth_password** are optional.
1158 #
1159 # Example:
1160 # ```json
1161 # {
1162 # "connection_host": "ldap.example.com",
1163 # "connection_port": "636",
1164 # "connection_tls": true,
1165 # "auth_username": "cn=looker,dc=example,dc=com",
1166 # "auth_password": "secret"
1167 # }
1168 # ```
1169 #
1170 # 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.
1171 #
1172 # The active LDAP settings are not modified.
1173 #
1174 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
1175 #
1176 # PUT /ldap_config/test_auth -> mdls.LDAPConfigTestResult
1177 def test_ldap_config_auth(
1178 self,
1179 body: mdls.WriteLDAPConfig,
1180 transport_options: Optional[transport.TransportOptions] = None,
1181 ) -> mdls.LDAPConfigTestResult:
1182 """Test LDAP Auth"""
1183 response = cast(
1184 mdls.LDAPConfigTestResult,
1185 self.put(
1186 path="/ldap_config/test_auth",
1187 structure=mdls.LDAPConfigTestResult,
1188 body=body,
1189 transport_options=transport_options,
1190 ),
1191 )
1192 return response
1193
1194 # ### Test the user authentication settings for an LDAP configuration without authenticating the user.
1195 #
1196 # This test will let you easily test the mapping for user properties and roles for any user withoutneeding to authenticate as that user.
1197 #
1198 # 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.
1199 #
1200 # **test_ldap_user** is required.
1201 #
1202 # The active LDAP settings are not modified.
1203 #
1204 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
1205 #
1206 # PUT /ldap_config/test_user_info -> mdls.LDAPConfigTestResult
1207 def test_ldap_config_user_info(
1208 self,
1209 body: mdls.WriteLDAPConfig,
1210 transport_options: Optional[transport.TransportOptions] = None,
1211 ) -> mdls.LDAPConfigTestResult:
1212 """Test LDAP User Info"""
1213 response = cast(
1214 mdls.LDAPConfigTestResult,
1215 self.put(
1216 path="/ldap_config/test_user_info",
1217 structure=mdls.LDAPConfigTestResult,
1218 body=body,
1219 transport_options=transport_options,
1220 ),
1221 )
1222 return response
1223
1224 # ### Test the user authentication settings for an LDAP configuration.
1225 #
1226 # 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.
1227 #
1228 # 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.
1229 #
1230 # **test_ldap_user** and **test_ldap_password** are required.
1231 #
1232 # The active LDAP settings are not modified.
1233 #
1234 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
1235 #
1236 # PUT /ldap_config/test_user_auth -> mdls.LDAPConfigTestResult
1237 def test_ldap_config_user_auth(
1238 self,
1239 body: mdls.WriteLDAPConfig,
1240 transport_options: Optional[transport.TransportOptions] = None,
1241 ) -> mdls.LDAPConfigTestResult:
1242 """Test LDAP User Auth"""
1243 response = cast(
1244 mdls.LDAPConfigTestResult,
1245 self.put(
1246 path="/ldap_config/test_user_auth",
1247 structure=mdls.LDAPConfigTestResult,
1248 body=body,
1249 transport_options=transport_options,
1250 ),
1251 )
1252 return response
1253
1254 # ### Registers a mobile device.
1255 # # Required fields: [:device_token, :device_type]
1256 #
1257 # POST /mobile/device -> mdls.MobileToken
1258 def register_mobile_device(
1259 self,
1260 body: mdls.WriteMobileToken,
1261 transport_options: Optional[transport.TransportOptions] = None,
1262 ) -> mdls.MobileToken:
1263 """Register Mobile Device"""
1264 response = cast(
1265 mdls.MobileToken,
1266 self.post(
1267 path="/mobile/device",
1268 structure=mdls.MobileToken,
1269 body=body,
1270 transport_options=transport_options,
1271 ),
1272 )
1273 return response
1274
1275 # ### Updates the mobile device registration
1276 #
1277 # PATCH /mobile/device/{device_id} -> mdls.MobileToken
1278 def update_mobile_device_registration(
1279 self,
1280 # Unique id of the device.
1281 device_id: str,
1282 transport_options: Optional[transport.TransportOptions] = None,
1283 ) -> mdls.MobileToken:
1284 """Update Mobile Device Registration"""
1285 device_id = self.encode_path_param(device_id)
1286 response = cast(
1287 mdls.MobileToken,
1288 self.patch(
1289 path=f"/mobile/device/{device_id}",
1290 structure=mdls.MobileToken,
1291 transport_options=transport_options,
1292 ),
1293 )
1294 return response
1295
1296 # ### Deregister a mobile device.
1297 #
1298 # DELETE /mobile/device/{device_id} -> None
1299 def deregister_mobile_device(
1300 self,
1301 # Unique id of the device.
1302 device_id: str,
1303 transport_options: Optional[transport.TransportOptions] = None,
1304 ) -> None:
1305 """Deregister Mobile Device"""
1306 device_id = self.encode_path_param(device_id)
1307 response = cast(
1308 None,
1309 self.delete(
1310 path=f"/mobile/device/{device_id}",
1311 structure=None,
1312 transport_options=transport_options,
1313 ),
1314 )
1315 return response
1316
1317 # ### List All OAuth Client Apps
1318 #
1319 # Lists all applications registered to use OAuth2 login with this Looker instance, including
1320 # enabled and disabled apps.
1321 #
1322 # Results are filtered to include only the apps that the caller (current user)
1323 # has permission to see.
1324 #
1325 # GET /oauth_client_apps -> Sequence[mdls.OauthClientApp]
1326 def all_oauth_client_apps(
1327 self,
1328 # Requested fields.
1329 fields: Optional[str] = None,
1330 transport_options: Optional[transport.TransportOptions] = None,
1331 ) -> Sequence[mdls.OauthClientApp]:
1332 """Get All OAuth Client Apps"""
1333 response = cast(
1334 Sequence[mdls.OauthClientApp],
1335 self.get(
1336 path="/oauth_client_apps",
1337 structure=Sequence[mdls.OauthClientApp],
1338 query_params={"fields": fields},
1339 transport_options=transport_options,
1340 ),
1341 )
1342 return response
1343
1344 # ### Get Oauth Client App
1345 #
1346 # Returns the registered app client with matching client_guid.
1347 #
1348 # GET /oauth_client_apps/{client_guid} -> mdls.OauthClientApp
1349 def oauth_client_app(
1350 self,
1351 # The unique id of this application
1352 client_guid: str,
1353 # Requested fields.
1354 fields: Optional[str] = None,
1355 transport_options: Optional[transport.TransportOptions] = None,
1356 ) -> mdls.OauthClientApp:
1357 """Get OAuth Client App"""
1358 client_guid = self.encode_path_param(client_guid)
1359 response = cast(
1360 mdls.OauthClientApp,
1361 self.get(
1362 path=f"/oauth_client_apps/{client_guid}",
1363 structure=mdls.OauthClientApp,
1364 query_params={"fields": fields},
1365 transport_options=transport_options,
1366 ),
1367 )
1368 return response
1369
1370 # ### Register an OAuth2 Client App
1371 #
1372 # Registers details identifying an external web app or native app as an OAuth2 login client of the Looker instance.
1373 # The app registration must provide a unique client_guid and redirect_uri that the app will present
1374 # in OAuth login requests. If the client_guid and redirect_uri parameters in the login request do not match
1375 # the app details registered with the Looker instance, the request is assumed to be a forgery and is rejected.
1376 #
1377 # POST /oauth_client_apps/{client_guid} -> mdls.OauthClientApp
1378 def register_oauth_client_app(
1379 self,
1380 # The unique id of this application
1381 client_guid: str,
1382 body: mdls.WriteOauthClientApp,
1383 # Requested fields.
1384 fields: Optional[str] = None,
1385 transport_options: Optional[transport.TransportOptions] = None,
1386 ) -> mdls.OauthClientApp:
1387 """Register OAuth App"""
1388 client_guid = self.encode_path_param(client_guid)
1389 response = cast(
1390 mdls.OauthClientApp,
1391 self.post(
1392 path=f"/oauth_client_apps/{client_guid}",
1393 structure=mdls.OauthClientApp,
1394 query_params={"fields": fields},
1395 body=body,
1396 transport_options=transport_options,
1397 ),
1398 )
1399 return response
1400
1401 # ### Update OAuth2 Client App Details
1402 #
1403 # Modifies the details a previously registered OAuth2 login client app.
1404 #
1405 # PATCH /oauth_client_apps/{client_guid} -> mdls.OauthClientApp
1406 def update_oauth_client_app(
1407 self,
1408 # The unique id of this application
1409 client_guid: str,
1410 body: mdls.WriteOauthClientApp,
1411 # Requested fields.
1412 fields: Optional[str] = None,
1413 transport_options: Optional[transport.TransportOptions] = None,
1414 ) -> mdls.OauthClientApp:
1415 """Update OAuth App"""
1416 client_guid = self.encode_path_param(client_guid)
1417 response = cast(
1418 mdls.OauthClientApp,
1419 self.patch(
1420 path=f"/oauth_client_apps/{client_guid}",
1421 structure=mdls.OauthClientApp,
1422 query_params={"fields": fields},
1423 body=body,
1424 transport_options=transport_options,
1425 ),
1426 )
1427 return response
1428
1429 # ### Delete OAuth Client App
1430 #
1431 # Deletes the registration info of the app with the matching client_guid.
1432 # All active sessions and tokens issued for this app will immediately become invalid.
1433 #
1434 # As with most REST DELETE operations, this endpoint does not return an error if the
1435 # indicated resource does not exist.
1436 #
1437 # ### Note: this deletion cannot be undone.
1438 #
1439 # DELETE /oauth_client_apps/{client_guid} -> str
1440 def delete_oauth_client_app(
1441 self,
1442 # The unique id of this application
1443 client_guid: str,
1444 transport_options: Optional[transport.TransportOptions] = None,
1445 ) -> str:
1446 """Delete OAuth Client App"""
1447 client_guid = self.encode_path_param(client_guid)
1448 response = cast(
1449 str,
1450 self.delete(
1451 path=f"/oauth_client_apps/{client_guid}",
1452 structure=str,
1453 transport_options=transport_options,
1454 ),
1455 )
1456 return response
1457
1458 # ### Invalidate All Issued Tokens
1459 #
1460 # Immediately invalidates all auth codes, sessions, access tokens and refresh tokens issued for
1461 # this app for ALL USERS of this app.
1462 #
1463 # DELETE /oauth_client_apps/{client_guid}/tokens -> str
1464 def invalidate_tokens(
1465 self,
1466 # The unique id of the application
1467 client_guid: str,
1468 transport_options: Optional[transport.TransportOptions] = None,
1469 ) -> str:
1470 """Invalidate Tokens"""
1471 client_guid = self.encode_path_param(client_guid)
1472 response = cast(
1473 str,
1474 self.delete(
1475 path=f"/oauth_client_apps/{client_guid}/tokens",
1476 structure=str,
1477 transport_options=transport_options,
1478 ),
1479 )
1480 return response
1481
1482 # ### Activate an app for a user
1483 #
1484 # Activates a user for a given oauth client app. This indicates the user has been informed that
1485 # the app will have access to the user's looker data, and that the user has accepted and allowed
1486 # the app to use their Looker account.
1487 #
1488 # Activating a user for an app that the user is already activated with returns a success response.
1489 #
1490 # POST /oauth_client_apps/{client_guid}/users/{user_id} -> str
1491 def activate_app_user(
1492 self,
1493 # The unique id of this application
1494 client_guid: str,
1495 # The id of the user to enable use of this app
1496 user_id: str,
1497 # Requested fields.
1498 fields: Optional[str] = None,
1499 transport_options: Optional[transport.TransportOptions] = None,
1500 ) -> str:
1501 """Activate OAuth App User"""
1502 client_guid = self.encode_path_param(client_guid)
1503 user_id = self.encode_path_param(user_id)
1504 response = cast(
1505 str,
1506 self.post(
1507 path=f"/oauth_client_apps/{client_guid}/users/{user_id}",
1508 structure=str,
1509 query_params={"fields": fields},
1510 transport_options=transport_options,
1511 ),
1512 )
1513 return response
1514
1515 # ### Deactivate an app for a user
1516 #
1517 # Deactivate a user for a given oauth client app. All tokens issued to the app for
1518 # this user will be invalid immediately. Before the user can use the app with their
1519 # Looker account, the user will have to read and accept an account use disclosure statement for the app.
1520 #
1521 # Admin users can deactivate other users, but non-admin users can only deactivate themselves.
1522 #
1523 # As with most REST DELETE operations, this endpoint does not return an error if the indicated
1524 # resource (app or user) does not exist or has already been deactivated.
1525 #
1526 # DELETE /oauth_client_apps/{client_guid}/users/{user_id} -> str
1527 def deactivate_app_user(
1528 self,
1529 # The unique id of this application
1530 client_guid: str,
1531 # The id of the user to enable use of this app
1532 user_id: str,
1533 # Requested fields.
1534 fields: Optional[str] = None,
1535 transport_options: Optional[transport.TransportOptions] = None,
1536 ) -> str:
1537 """Deactivate OAuth App User"""
1538 client_guid = self.encode_path_param(client_guid)
1539 user_id = self.encode_path_param(user_id)
1540 response = cast(
1541 str,
1542 self.delete(
1543 path=f"/oauth_client_apps/{client_guid}/users/{user_id}",
1544 structure=str,
1545 query_params={"fields": fields},
1546 transport_options=transport_options,
1547 ),
1548 )
1549 return response
1550
1551 # ### Get the OIDC configuration.
1552 #
1553 # Looker can be optionally configured to authenticate users against an OpenID Connect (OIDC)
1554 # authentication server. OIDC setup requires coordination with an administrator of that server.
1555 #
1556 # Only Looker administrators can read and update the OIDC configuration.
1557 #
1558 # Configuring OIDC impacts authentication for all users. This configuration should be done carefully.
1559 #
1560 # 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).
1561 #
1562 # OIDC is enabled or disabled for Looker using the **enabled** field.
1563 #
1564 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
1565 #
1566 # GET /oidc_config -> mdls.OIDCConfig
1567 def oidc_config(
1568 self,
1569 transport_options: Optional[transport.TransportOptions] = None,
1570 ) -> mdls.OIDCConfig:
1571 """Get OIDC Configuration"""
1572 response = cast(
1573 mdls.OIDCConfig,
1574 self.get(
1575 path="/oidc_config",
1576 structure=mdls.OIDCConfig,
1577 transport_options=transport_options,
1578 ),
1579 )
1580 return response
1581
1582 # ### Update the OIDC configuration.
1583 #
1584 # Configuring OIDC impacts authentication for all users. This configuration should be done carefully.
1585 #
1586 # Only Looker administrators can read and update the OIDC configuration.
1587 #
1588 # OIDC is enabled or disabled for Looker using the **enabled** field.
1589 #
1590 # It is **highly** recommended that any OIDC setting changes be tested using the APIs below before being set globally.
1591 #
1592 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
1593 #
1594 # PATCH /oidc_config -> mdls.OIDCConfig
1595 def update_oidc_config(
1596 self,
1597 body: mdls.WriteOIDCConfig,
1598 transport_options: Optional[transport.TransportOptions] = None,
1599 ) -> mdls.OIDCConfig:
1600 """Update OIDC Configuration"""
1601 response = cast(
1602 mdls.OIDCConfig,
1603 self.patch(
1604 path="/oidc_config",
1605 structure=mdls.OIDCConfig,
1606 body=body,
1607 transport_options=transport_options,
1608 ),
1609 )
1610 return response
1611
1612 # ### Get a OIDC test configuration by test_slug.
1613 #
1614 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
1615 #
1616 # GET /oidc_test_configs/{test_slug} -> mdls.OIDCConfig
1617 def oidc_test_config(
1618 self,
1619 # Slug of test config
1620 test_slug: str,
1621 transport_options: Optional[transport.TransportOptions] = None,
1622 ) -> mdls.OIDCConfig:
1623 """Get OIDC Test Configuration"""
1624 test_slug = self.encode_path_param(test_slug)
1625 response = cast(
1626 mdls.OIDCConfig,
1627 self.get(
1628 path=f"/oidc_test_configs/{test_slug}",
1629 structure=mdls.OIDCConfig,
1630 transport_options=transport_options,
1631 ),
1632 )
1633 return response
1634
1635 # ### Delete a OIDC test configuration.
1636 #
1637 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
1638 #
1639 # DELETE /oidc_test_configs/{test_slug} -> str
1640 def delete_oidc_test_config(
1641 self,
1642 # Slug of test config
1643 test_slug: str,
1644 transport_options: Optional[transport.TransportOptions] = None,
1645 ) -> str:
1646 """Delete OIDC Test Configuration"""
1647 test_slug = self.encode_path_param(test_slug)
1648 response = cast(
1649 str,
1650 self.delete(
1651 path=f"/oidc_test_configs/{test_slug}",
1652 structure=str,
1653 transport_options=transport_options,
1654 ),
1655 )
1656 return response
1657
1658 # ### Create a OIDC test configuration.
1659 #
1660 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
1661 #
1662 # POST /oidc_test_configs -> mdls.OIDCConfig
1663 def create_oidc_test_config(
1664 self,
1665 body: mdls.WriteOIDCConfig,
1666 transport_options: Optional[transport.TransportOptions] = None,
1667 ) -> mdls.OIDCConfig:
1668 """Create OIDC Test Configuration"""
1669 response = cast(
1670 mdls.OIDCConfig,
1671 self.post(
1672 path="/oidc_test_configs",
1673 structure=mdls.OIDCConfig,
1674 body=body,
1675 transport_options=transport_options,
1676 ),
1677 )
1678 return response
1679
1680 # ### Get password config.
1681 #
1682 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
1683 #
1684 # GET /password_config -> mdls.PasswordConfig
1685 def password_config(
1686 self,
1687 transport_options: Optional[transport.TransportOptions] = None,
1688 ) -> mdls.PasswordConfig:
1689 """Get Password Config"""
1690 response = cast(
1691 mdls.PasswordConfig,
1692 self.get(
1693 path="/password_config",
1694 structure=mdls.PasswordConfig,
1695 transport_options=transport_options,
1696 ),
1697 )
1698 return response
1699
1700 # ### Update password config.
1701 #
1702 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
1703 #
1704 # PATCH /password_config -> mdls.PasswordConfig
1705 def update_password_config(
1706 self,
1707 body: mdls.WritePasswordConfig,
1708 transport_options: Optional[transport.TransportOptions] = None,
1709 ) -> mdls.PasswordConfig:
1710 """Update Password Config"""
1711 response = cast(
1712 mdls.PasswordConfig,
1713 self.patch(
1714 path="/password_config",
1715 structure=mdls.PasswordConfig,
1716 body=body,
1717 transport_options=transport_options,
1718 ),
1719 )
1720 return response
1721
1722 # ### Force all credentials_email users to reset their login passwords upon their next login.
1723 #
1724 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
1725 #
1726 # PUT /password_config/force_password_reset_at_next_login_for_all_users -> str
1727 def force_password_reset_at_next_login_for_all_users(
1728 self,
1729 transport_options: Optional[transport.TransportOptions] = None,
1730 ) -> str:
1731 """Force password reset"""
1732 response = cast(
1733 str,
1734 self.put(
1735 path="/password_config/force_password_reset_at_next_login_for_all_users",
1736 structure=str,
1737 transport_options=transport_options,
1738 ),
1739 )
1740 return response
1741
1742 # ### Get the SAML configuration.
1743 #
1744 # Looker can be optionally configured to authenticate users against a SAML authentication server.
1745 # SAML setup requires coordination with an administrator of that server.
1746 #
1747 # Only Looker administrators can read and update the SAML configuration.
1748 #
1749 # Configuring SAML impacts authentication for all users. This configuration should be done carefully.
1750 #
1751 # 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).
1752 #
1753 # SAML is enabled or disabled for Looker using the **enabled** field.
1754 #
1755 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
1756 #
1757 # GET /saml_config -> mdls.SamlConfig
1758 def saml_config(
1759 self,
1760 transport_options: Optional[transport.TransportOptions] = None,
1761 ) -> mdls.SamlConfig:
1762 """Get SAML Configuration"""
1763 response = cast(
1764 mdls.SamlConfig,
1765 self.get(
1766 path="/saml_config",
1767 structure=mdls.SamlConfig,
1768 transport_options=transport_options,
1769 ),
1770 )
1771 return response
1772
1773 # ### Update the SAML configuration.
1774 #
1775 # Configuring SAML impacts authentication for all users. This configuration should be done carefully.
1776 #
1777 # Only Looker administrators can read and update the SAML configuration.
1778 #
1779 # SAML is enabled or disabled for Looker using the **enabled** field.
1780 #
1781 # It is **highly** recommended that any SAML setting changes be tested using the APIs below before being set globally.
1782 #
1783 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
1784 #
1785 # PATCH /saml_config -> mdls.SamlConfig
1786 def update_saml_config(
1787 self,
1788 body: mdls.WriteSamlConfig,
1789 transport_options: Optional[transport.TransportOptions] = None,
1790 ) -> mdls.SamlConfig:
1791 """Update SAML Configuration"""
1792 response = cast(
1793 mdls.SamlConfig,
1794 self.patch(
1795 path="/saml_config",
1796 structure=mdls.SamlConfig,
1797 body=body,
1798 transport_options=transport_options,
1799 ),
1800 )
1801 return response
1802
1803 # ### Get a SAML test configuration by test_slug.
1804 #
1805 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
1806 #
1807 # GET /saml_test_configs/{test_slug} -> mdls.SamlConfig
1808 def saml_test_config(
1809 self,
1810 # Slug of test config
1811 test_slug: str,
1812 transport_options: Optional[transport.TransportOptions] = None,
1813 ) -> mdls.SamlConfig:
1814 """Get SAML Test Configuration"""
1815 test_slug = self.encode_path_param(test_slug)
1816 response = cast(
1817 mdls.SamlConfig,
1818 self.get(
1819 path=f"/saml_test_configs/{test_slug}",
1820 structure=mdls.SamlConfig,
1821 transport_options=transport_options,
1822 ),
1823 )
1824 return response
1825
1826 # ### Delete a SAML test configuration.
1827 #
1828 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
1829 #
1830 # DELETE /saml_test_configs/{test_slug} -> str
1831 def delete_saml_test_config(
1832 self,
1833 # Slug of test config
1834 test_slug: str,
1835 transport_options: Optional[transport.TransportOptions] = None,
1836 ) -> str:
1837 """Delete SAML Test Configuration"""
1838 test_slug = self.encode_path_param(test_slug)
1839 response = cast(
1840 str,
1841 self.delete(
1842 path=f"/saml_test_configs/{test_slug}",
1843 structure=str,
1844 transport_options=transport_options,
1845 ),
1846 )
1847 return response
1848
1849 # ### Create a SAML test configuration.
1850 #
1851 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
1852 #
1853 # POST /saml_test_configs -> mdls.SamlConfig
1854 def create_saml_test_config(
1855 self,
1856 body: mdls.WriteSamlConfig,
1857 transport_options: Optional[transport.TransportOptions] = None,
1858 ) -> mdls.SamlConfig:
1859 """Create SAML Test Configuration"""
1860 response = cast(
1861 mdls.SamlConfig,
1862 self.post(
1863 path="/saml_test_configs",
1864 structure=mdls.SamlConfig,
1865 body=body,
1866 transport_options=transport_options,
1867 ),
1868 )
1869 return response
1870
1871 # ### Parse the given xml as a SAML IdP metadata document and return the result.
1872 #
1873 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
1874 #
1875 # POST /parse_saml_idp_metadata -> mdls.SamlMetadataParseResult
1876 def parse_saml_idp_metadata(
1877 self,
1878 body: str,
1879 transport_options: Optional[transport.TransportOptions] = None,
1880 ) -> mdls.SamlMetadataParseResult:
1881 """Parse SAML IdP XML"""
1882 response = cast(
1883 mdls.SamlMetadataParseResult,
1884 self.post(
1885 path="/parse_saml_idp_metadata",
1886 structure=mdls.SamlMetadataParseResult,
1887 body=body,
1888 transport_options=transport_options,
1889 ),
1890 )
1891 return response
1892
1893 # ### Fetch the given url and parse it as a SAML IdP metadata document and return the result.
1894 # Note that this requires that the url be public or at least at a location where the Looker instance
1895 # can fetch it without requiring any special authentication.
1896 #
1897 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
1898 #
1899 # POST /fetch_and_parse_saml_idp_metadata -> mdls.SamlMetadataParseResult
1900 def fetch_and_parse_saml_idp_metadata(
1901 self,
1902 body: str,
1903 transport_options: Optional[transport.TransportOptions] = None,
1904 ) -> mdls.SamlMetadataParseResult:
1905 """Parse SAML IdP Url"""
1906 response = cast(
1907 mdls.SamlMetadataParseResult,
1908 self.post(
1909 path="/fetch_and_parse_saml_idp_metadata",
1910 structure=mdls.SamlMetadataParseResult,
1911 body=body,
1912 transport_options=transport_options,
1913 ),
1914 )
1915 return response
1916
1917 # ### Get session config.
1918 #
1919 # GET /session_config -> mdls.SessionConfig
1920 def session_config(
1921 self,
1922 transport_options: Optional[transport.TransportOptions] = None,
1923 ) -> mdls.SessionConfig:
1924 """Get Session Config"""
1925 response = cast(
1926 mdls.SessionConfig,
1927 self.get(
1928 path="/session_config",
1929 structure=mdls.SessionConfig,
1930 transport_options=transport_options,
1931 ),
1932 )
1933 return response
1934
1935 # ### Update session config.
1936 #
1937 # PATCH /session_config -> mdls.SessionConfig
1938 def update_session_config(
1939 self,
1940 body: mdls.WriteSessionConfig,
1941 transport_options: Optional[transport.TransportOptions] = None,
1942 ) -> mdls.SessionConfig:
1943 """Update Session Config"""
1944 response = cast(
1945 mdls.SessionConfig,
1946 self.patch(
1947 path="/session_config",
1948 structure=mdls.SessionConfig,
1949 body=body,
1950 transport_options=transport_options,
1951 ),
1952 )
1953 return response
1954
1955 # ### Get Support Access Allowlist Users
1956 #
1957 # Returns the users that have been added to the Support Access Allowlist
1958 #
1959 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
1960 #
1961 # GET /support_access/allowlist -> Sequence[mdls.SupportAccessAllowlistEntry]
1962 def get_support_access_allowlist_entries(
1963 self,
1964 # Requested fields.
1965 fields: Optional[str] = None,
1966 transport_options: Optional[transport.TransportOptions] = None,
1967 ) -> Sequence[mdls.SupportAccessAllowlistEntry]:
1968 """Get Support Access Allowlist Users"""
1969 response = cast(
1970 Sequence[mdls.SupportAccessAllowlistEntry],
1971 self.get(
1972 path="/support_access/allowlist",
1973 structure=Sequence[mdls.SupportAccessAllowlistEntry],
1974 query_params={"fields": fields},
1975 transport_options=transport_options,
1976 ),
1977 )
1978 return response
1979
1980 # ### Add Support Access Allowlist Users
1981 #
1982 # Adds a list of emails to the Allowlist, using the provided reason
1983 #
1984 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
1985 #
1986 # POST /support_access/allowlist -> Sequence[mdls.SupportAccessAllowlistEntry]
1987 def add_support_access_allowlist_entries(
1988 self,
1989 body: mdls.SupportAccessAddEntries,
1990 transport_options: Optional[transport.TransportOptions] = None,
1991 ) -> Sequence[mdls.SupportAccessAllowlistEntry]:
1992 """Add Support Access Allowlist Users"""
1993 response = cast(
1994 Sequence[mdls.SupportAccessAllowlistEntry],
1995 self.post(
1996 path="/support_access/allowlist",
1997 structure=Sequence[mdls.SupportAccessAllowlistEntry],
1998 body=body,
1999 transport_options=transport_options,
2000 ),
2001 )
2002 return response
2003
2004 # ### Delete Support Access Allowlist User
2005 #
2006 # Deletes the specified Allowlist Entry Id
2007 #
2008 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
2009 #
2010 # DELETE /support_access/allowlist/{entry_id} -> str
2011 def delete_support_access_allowlist_entry(
2012 self,
2013 # Id of Allowlist Entry
2014 entry_id: str,
2015 transport_options: Optional[transport.TransportOptions] = None,
2016 ) -> str:
2017 """Delete Support Access Allowlist Entry"""
2018 entry_id = self.encode_path_param(entry_id)
2019 response = cast(
2020 str,
2021 self.delete(
2022 path=f"/support_access/allowlist/{entry_id}",
2023 structure=str,
2024 transport_options=transport_options,
2025 ),
2026 )
2027 return response
2028
2029 # ### Enable Support Access
2030 #
2031 # Enables Support Access for the provided duration
2032 #
2033 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
2034 #
2035 # PUT /support_access/enable -> mdls.SupportAccessStatus
2036 def enable_support_access(
2037 self,
2038 body: mdls.SupportAccessEnable,
2039 transport_options: Optional[transport.TransportOptions] = None,
2040 ) -> mdls.SupportAccessStatus:
2041 """Enable Support Access"""
2042 response = cast(
2043 mdls.SupportAccessStatus,
2044 self.put(
2045 path="/support_access/enable",
2046 structure=mdls.SupportAccessStatus,
2047 body=body,
2048 transport_options=transport_options,
2049 ),
2050 )
2051 return response
2052
2053 # ### Disable Support Access
2054 #
2055 # Disables Support Access immediately
2056 #
2057 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
2058 #
2059 # PUT /support_access/disable -> mdls.SupportAccessStatus
2060 def disable_support_access(
2061 self,
2062 transport_options: Optional[transport.TransportOptions] = None,
2063 ) -> mdls.SupportAccessStatus:
2064 """Disable Support Access"""
2065 response = cast(
2066 mdls.SupportAccessStatus,
2067 self.put(
2068 path="/support_access/disable",
2069 structure=mdls.SupportAccessStatus,
2070 transport_options=transport_options,
2071 ),
2072 )
2073 return response
2074
2075 # ### Support Access Status
2076 #
2077 # Returns the current Support Access Status
2078 #
2079 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
2080 #
2081 # GET /support_access/status -> mdls.SupportAccessStatus
2082 def support_access_status(
2083 self,
2084 transport_options: Optional[transport.TransportOptions] = None,
2085 ) -> mdls.SupportAccessStatus:
2086 """Support Access Status"""
2087 response = cast(
2088 mdls.SupportAccessStatus,
2089 self.get(
2090 path="/support_access/status",
2091 structure=mdls.SupportAccessStatus,
2092 transport_options=transport_options,
2093 ),
2094 )
2095 return response
2096
2097 # ### Get currently locked-out users.
2098 #
2099 # GET /user_login_lockouts -> Sequence[mdls.UserLoginLockout]
2100 def all_user_login_lockouts(
2101 self,
2102 # Include only these fields in the response
2103 fields: Optional[str] = None,
2104 transport_options: Optional[transport.TransportOptions] = None,
2105 ) -> Sequence[mdls.UserLoginLockout]:
2106 """Get All User Login Lockouts"""
2107 response = cast(
2108 Sequence[mdls.UserLoginLockout],
2109 self.get(
2110 path="/user_login_lockouts",
2111 structure=Sequence[mdls.UserLoginLockout],
2112 query_params={"fields": fields},
2113 transport_options=transport_options,
2114 ),
2115 )
2116 return response
2117
2118 # ### Search currently locked-out users.
2119 #
2120 # GET /user_login_lockouts/search -> Sequence[mdls.UserLoginLockout]
2121 def search_user_login_lockouts(
2122 self,
2123 # Include only these fields in the response
2124 fields: Optional[str] = None,
2125 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
2126 page: Optional[int] = None,
2127 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
2128 per_page: Optional[int] = None,
2129 # Number of results to return. (used with offset and takes priority over page and per_page)
2130 limit: Optional[int] = None,
2131 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
2132 offset: Optional[int] = None,
2133 # Fields to sort by.
2134 sorts: Optional[str] = None,
2135 # Auth type user is locked out for (email, ldap, totp, api)
2136 auth_type: Optional[str] = None,
2137 # Match name
2138 full_name: Optional[str] = None,
2139 # Match email
2140 email: Optional[str] = None,
2141 # Match remote LDAP ID
2142 remote_id: Optional[str] = None,
2143 # Combine given search criteria in a boolean OR expression
2144 filter_or: Optional[bool] = None,
2145 transport_options: Optional[transport.TransportOptions] = None,
2146 ) -> Sequence[mdls.UserLoginLockout]:
2147 """Search User Login Lockouts"""
2148 response = cast(
2149 Sequence[mdls.UserLoginLockout],
2150 self.get(
2151 path="/user_login_lockouts/search",
2152 structure=Sequence[mdls.UserLoginLockout],
2153 query_params={
2154 "fields": fields,
2155 "page": page,
2156 "per_page": per_page,
2157 "limit": limit,
2158 "offset": offset,
2159 "sorts": sorts,
2160 "auth_type": auth_type,
2161 "full_name": full_name,
2162 "email": email,
2163 "remote_id": remote_id,
2164 "filter_or": filter_or,
2165 },
2166 transport_options=transport_options,
2167 ),
2168 )
2169 return response
2170
2171 # ### Removes login lockout for the associated user.
2172 #
2173 # DELETE /user_login_lockout/{key} -> str
2174 def delete_user_login_lockout(
2175 self,
2176 # The key associated with the locked user
2177 key: str,
2178 transport_options: Optional[transport.TransportOptions] = None,
2179 ) -> str:
2180 """Delete User Login Lockout"""
2181 key = self.encode_path_param(key)
2182 response = cast(
2183 str,
2184 self.delete(
2185 path=f"/user_login_lockout/{key}",
2186 structure=str,
2187 transport_options=transport_options,
2188 ),
2189 )
2190 return response
2191
2192 # endregion
2193
2194 # region Board: Manage Boards
2195
2196 # ### Get information about all boards.
2197 #
2198 # GET /boards -> Sequence[mdls.Board]
2199 def all_boards(
2200 self,
2201 # Requested fields.
2202 fields: Optional[str] = None,
2203 transport_options: Optional[transport.TransportOptions] = None,
2204 ) -> Sequence[mdls.Board]:
2205 """Get All Boards"""
2206 response = cast(
2207 Sequence[mdls.Board],
2208 self.get(
2209 path="/boards",
2210 structure=Sequence[mdls.Board],
2211 query_params={"fields": fields},
2212 transport_options=transport_options,
2213 ),
2214 )
2215 return response
2216
2217 # ### Create a new board.
2218 #
2219 # POST /boards -> mdls.Board
2220 def create_board(
2221 self,
2222 body: mdls.WriteBoard,
2223 # Requested fields.
2224 fields: Optional[str] = None,
2225 transport_options: Optional[transport.TransportOptions] = None,
2226 ) -> mdls.Board:
2227 """Create Board"""
2228 response = cast(
2229 mdls.Board,
2230 self.post(
2231 path="/boards",
2232 structure=mdls.Board,
2233 query_params={"fields": fields},
2234 body=body,
2235 transport_options=transport_options,
2236 ),
2237 )
2238 return response
2239
2240 # ### Search Boards
2241 #
2242 # If multiple search params are given and `filter_or` is FALSE or not specified,
2243 # search params are combined in a logical AND operation.
2244 # Only rows that match *all* search param criteria will be returned.
2245 #
2246 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
2247 # Results will include rows that match **any** of the search criteria.
2248 #
2249 # String search params use case-insensitive matching.
2250 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
2251 # example="dan%" will match "danger" and "Danzig" but not "David"
2252 # example="D_m%" will match "Damage" and "dump"
2253 #
2254 # Integer search params can accept a single value or a comma separated list of values. The multiple
2255 # values will be combined under a logical OR operation - results will match at least one of
2256 # the given values.
2257 #
2258 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
2259 # or exclude (respectively) rows where the column is null.
2260 #
2261 # Boolean search params accept only "true" and "false" as values.
2262 #
2263 # GET /boards/search -> Sequence[mdls.Board]
2264 def search_boards(
2265 self,
2266 # Matches board title.
2267 title: Optional[str] = None,
2268 # Matches the timestamp for when the board was created.
2269 created_at: Optional[str] = None,
2270 # The first name of the user who created this board.
2271 first_name: Optional[str] = None,
2272 # The last name of the user who created this board.
2273 last_name: Optional[str] = None,
2274 # Requested fields.
2275 fields: Optional[str] = None,
2276 # Return favorited boards when true.
2277 favorited: Optional[bool] = None,
2278 # Filter on boards created by a particular user.
2279 creator_id: Optional[str] = None,
2280 # The fields to sort the results by
2281 sorts: Optional[str] = None,
2282 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
2283 page: Optional[int] = None,
2284 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
2285 per_page: Optional[int] = None,
2286 # Number of results to return. (used with offset and takes priority over page and per_page)
2287 offset: Optional[int] = None,
2288 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
2289 limit: Optional[int] = None,
2290 # Combine given search criteria in a boolean OR expression
2291 filter_or: Optional[bool] = None,
2292 # Filter results based on permission, either show (default) or update
2293 permission: Optional[str] = None,
2294 transport_options: Optional[transport.TransportOptions] = None,
2295 ) -> Sequence[mdls.Board]:
2296 """Search Boards"""
2297 response = cast(
2298 Sequence[mdls.Board],
2299 self.get(
2300 path="/boards/search",
2301 structure=Sequence[mdls.Board],
2302 query_params={
2303 "title": title,
2304 "created_at": created_at,
2305 "first_name": first_name,
2306 "last_name": last_name,
2307 "fields": fields,
2308 "favorited": favorited,
2309 "creator_id": creator_id,
2310 "sorts": sorts,
2311 "page": page,
2312 "per_page": per_page,
2313 "offset": offset,
2314 "limit": limit,
2315 "filter_or": filter_or,
2316 "permission": permission,
2317 },
2318 transport_options=transport_options,
2319 ),
2320 )
2321 return response
2322
2323 # ### Get information about a board.
2324 #
2325 # GET /boards/{board_id} -> mdls.Board
2326 def board(
2327 self,
2328 # Id of board
2329 board_id: str,
2330 # Requested fields.
2331 fields: Optional[str] = None,
2332 transport_options: Optional[transport.TransportOptions] = None,
2333 ) -> mdls.Board:
2334 """Get Board"""
2335 board_id = self.encode_path_param(board_id)
2336 response = cast(
2337 mdls.Board,
2338 self.get(
2339 path=f"/boards/{board_id}",
2340 structure=mdls.Board,
2341 query_params={"fields": fields},
2342 transport_options=transport_options,
2343 ),
2344 )
2345 return response
2346
2347 # ### Update a board definition.
2348 #
2349 # PATCH /boards/{board_id} -> mdls.Board
2350 def update_board(
2351 self,
2352 # Id of board
2353 board_id: str,
2354 body: mdls.WriteBoard,
2355 # Requested fields.
2356 fields: Optional[str] = None,
2357 transport_options: Optional[transport.TransportOptions] = None,
2358 ) -> mdls.Board:
2359 """Update Board"""
2360 board_id = self.encode_path_param(board_id)
2361 response = cast(
2362 mdls.Board,
2363 self.patch(
2364 path=f"/boards/{board_id}",
2365 structure=mdls.Board,
2366 query_params={"fields": fields},
2367 body=body,
2368 transport_options=transport_options,
2369 ),
2370 )
2371 return response
2372
2373 # ### Delete a board.
2374 #
2375 # DELETE /boards/{board_id} -> str
2376 def delete_board(
2377 self,
2378 # Id of board
2379 board_id: str,
2380 transport_options: Optional[transport.TransportOptions] = None,
2381 ) -> str:
2382 """Delete Board"""
2383 board_id = self.encode_path_param(board_id)
2384 response = cast(
2385 str,
2386 self.delete(
2387 path=f"/boards/{board_id}",
2388 structure=str,
2389 transport_options=transport_options,
2390 ),
2391 )
2392 return response
2393
2394 # ### Get information about all board items.
2395 #
2396 # GET /board_items -> Sequence[mdls.BoardItem]
2397 def all_board_items(
2398 self,
2399 # Requested fields.
2400 fields: Optional[str] = None,
2401 # Fields to sort by.
2402 sorts: Optional[str] = None,
2403 # Filter to a specific board section
2404 board_section_id: Optional[str] = None,
2405 transport_options: Optional[transport.TransportOptions] = None,
2406 ) -> Sequence[mdls.BoardItem]:
2407 """Get All Board Items"""
2408 response = cast(
2409 Sequence[mdls.BoardItem],
2410 self.get(
2411 path="/board_items",
2412 structure=Sequence[mdls.BoardItem],
2413 query_params={
2414 "fields": fields,
2415 "sorts": sorts,
2416 "board_section_id": board_section_id,
2417 },
2418 transport_options=transport_options,
2419 ),
2420 )
2421 return response
2422
2423 # ### Create a new board item.
2424 #
2425 # POST /board_items -> mdls.BoardItem
2426 def create_board_item(
2427 self,
2428 body: mdls.WriteBoardItem,
2429 # Requested fields.
2430 fields: Optional[str] = None,
2431 transport_options: Optional[transport.TransportOptions] = None,
2432 ) -> mdls.BoardItem:
2433 """Create Board Item"""
2434 response = cast(
2435 mdls.BoardItem,
2436 self.post(
2437 path="/board_items",
2438 structure=mdls.BoardItem,
2439 query_params={"fields": fields},
2440 body=body,
2441 transport_options=transport_options,
2442 ),
2443 )
2444 return response
2445
2446 # ### Get information about a board item.
2447 #
2448 # GET /board_items/{board_item_id} -> mdls.BoardItem
2449 def board_item(
2450 self,
2451 # Id of board item
2452 board_item_id: str,
2453 # Requested fields.
2454 fields: Optional[str] = None,
2455 transport_options: Optional[transport.TransportOptions] = None,
2456 ) -> mdls.BoardItem:
2457 """Get Board Item"""
2458 board_item_id = self.encode_path_param(board_item_id)
2459 response = cast(
2460 mdls.BoardItem,
2461 self.get(
2462 path=f"/board_items/{board_item_id}",
2463 structure=mdls.BoardItem,
2464 query_params={"fields": fields},
2465 transport_options=transport_options,
2466 ),
2467 )
2468 return response
2469
2470 # ### Update a board item definition.
2471 #
2472 # PATCH /board_items/{board_item_id} -> mdls.BoardItem
2473 def update_board_item(
2474 self,
2475 # Id of board item
2476 board_item_id: str,
2477 body: mdls.WriteBoardItem,
2478 # Requested fields.
2479 fields: Optional[str] = None,
2480 transport_options: Optional[transport.TransportOptions] = None,
2481 ) -> mdls.BoardItem:
2482 """Update Board Item"""
2483 board_item_id = self.encode_path_param(board_item_id)
2484 response = cast(
2485 mdls.BoardItem,
2486 self.patch(
2487 path=f"/board_items/{board_item_id}",
2488 structure=mdls.BoardItem,
2489 query_params={"fields": fields},
2490 body=body,
2491 transport_options=transport_options,
2492 ),
2493 )
2494 return response
2495
2496 # ### Delete a board item.
2497 #
2498 # DELETE /board_items/{board_item_id} -> str
2499 def delete_board_item(
2500 self,
2501 # Id of board item
2502 board_item_id: str,
2503 transport_options: Optional[transport.TransportOptions] = None,
2504 ) -> str:
2505 """Delete Board Item"""
2506 board_item_id = self.encode_path_param(board_item_id)
2507 response = cast(
2508 str,
2509 self.delete(
2510 path=f"/board_items/{board_item_id}",
2511 structure=str,
2512 transport_options=transport_options,
2513 ),
2514 )
2515 return response
2516
2517 # ### Get information about all board sections.
2518 #
2519 # GET /board_sections -> Sequence[mdls.BoardSection]
2520 def all_board_sections(
2521 self,
2522 # Requested fields.
2523 fields: Optional[str] = None,
2524 # Fields to sort by.
2525 sorts: Optional[str] = None,
2526 transport_options: Optional[transport.TransportOptions] = None,
2527 ) -> Sequence[mdls.BoardSection]:
2528 """Get All Board sections"""
2529 response = cast(
2530 Sequence[mdls.BoardSection],
2531 self.get(
2532 path="/board_sections",
2533 structure=Sequence[mdls.BoardSection],
2534 query_params={"fields": fields, "sorts": sorts},
2535 transport_options=transport_options,
2536 ),
2537 )
2538 return response
2539
2540 # ### Create a new board section.
2541 #
2542 # POST /board_sections -> mdls.BoardSection
2543 def create_board_section(
2544 self,
2545 body: mdls.WriteBoardSection,
2546 # Requested fields.
2547 fields: Optional[str] = None,
2548 transport_options: Optional[transport.TransportOptions] = None,
2549 ) -> mdls.BoardSection:
2550 """Create Board section"""
2551 response = cast(
2552 mdls.BoardSection,
2553 self.post(
2554 path="/board_sections",
2555 structure=mdls.BoardSection,
2556 query_params={"fields": fields},
2557 body=body,
2558 transport_options=transport_options,
2559 ),
2560 )
2561 return response
2562
2563 # ### Get information about a board section.
2564 #
2565 # GET /board_sections/{board_section_id} -> mdls.BoardSection
2566 def board_section(
2567 self,
2568 # Id of board section
2569 board_section_id: str,
2570 # Requested fields.
2571 fields: Optional[str] = None,
2572 transport_options: Optional[transport.TransportOptions] = None,
2573 ) -> mdls.BoardSection:
2574 """Get Board section"""
2575 board_section_id = self.encode_path_param(board_section_id)
2576 response = cast(
2577 mdls.BoardSection,
2578 self.get(
2579 path=f"/board_sections/{board_section_id}",
2580 structure=mdls.BoardSection,
2581 query_params={"fields": fields},
2582 transport_options=transport_options,
2583 ),
2584 )
2585 return response
2586
2587 # ### Update a board section definition.
2588 #
2589 # PATCH /board_sections/{board_section_id} -> mdls.BoardSection
2590 def update_board_section(
2591 self,
2592 # Id of board section
2593 board_section_id: str,
2594 body: mdls.WriteBoardSection,
2595 # Requested fields.
2596 fields: Optional[str] = None,
2597 transport_options: Optional[transport.TransportOptions] = None,
2598 ) -> mdls.BoardSection:
2599 """Update Board section"""
2600 board_section_id = self.encode_path_param(board_section_id)
2601 response = cast(
2602 mdls.BoardSection,
2603 self.patch(
2604 path=f"/board_sections/{board_section_id}",
2605 structure=mdls.BoardSection,
2606 query_params={"fields": fields},
2607 body=body,
2608 transport_options=transport_options,
2609 ),
2610 )
2611 return response
2612
2613 # ### Delete a board section.
2614 #
2615 # DELETE /board_sections/{board_section_id} -> str
2616 def delete_board_section(
2617 self,
2618 # Id of board section
2619 board_section_id: str,
2620 transport_options: Optional[transport.TransportOptions] = None,
2621 ) -> str:
2622 """Delete Board section"""
2623 board_section_id = self.encode_path_param(board_section_id)
2624 response = cast(
2625 str,
2626 self.delete(
2627 path=f"/board_sections/{board_section_id}",
2628 structure=str,
2629 transport_options=transport_options,
2630 ),
2631 )
2632 return response
2633
2634 # endregion
2635
2636 # region ColorCollection: Manage Color Collections
2637
2638 # ### Get an array of all existing Color Collections
2639 # Get a **single** color collection by id with [ColorCollection](#!/ColorCollection/color_collection)
2640 #
2641 # Get all **standard** color collections with [ColorCollection](#!/ColorCollection/color_collections_standard)
2642 #
2643 # Get all **custom** color collections with [ColorCollection](#!/ColorCollection/color_collections_custom)
2644 #
2645 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2646 #
2647 # GET /color_collections -> Sequence[mdls.ColorCollection]
2648 def all_color_collections(
2649 self,
2650 # Requested fields.
2651 fields: Optional[str] = None,
2652 transport_options: Optional[transport.TransportOptions] = None,
2653 ) -> Sequence[mdls.ColorCollection]:
2654 """Get all Color Collections"""
2655 response = cast(
2656 Sequence[mdls.ColorCollection],
2657 self.get(
2658 path="/color_collections",
2659 structure=Sequence[mdls.ColorCollection],
2660 query_params={"fields": fields},
2661 transport_options=transport_options,
2662 ),
2663 )
2664 return response
2665
2666 # ### Create a custom color collection with the specified information
2667 #
2668 # Creates a new custom color collection object, returning the details, including the created id.
2669 #
2670 # **Update** an existing color collection with [Update Color Collection](#!/ColorCollection/update_color_collection)
2671 #
2672 # **Permanently delete** an existing custom color collection with [Delete Color Collection](#!/ColorCollection/delete_color_collection)
2673 #
2674 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2675 #
2676 # POST /color_collections -> mdls.ColorCollection
2677 def create_color_collection(
2678 self,
2679 body: mdls.WriteColorCollection,
2680 transport_options: Optional[transport.TransportOptions] = None,
2681 ) -> mdls.ColorCollection:
2682 """Create ColorCollection"""
2683 response = cast(
2684 mdls.ColorCollection,
2685 self.post(
2686 path="/color_collections",
2687 structure=mdls.ColorCollection,
2688 body=body,
2689 transport_options=transport_options,
2690 ),
2691 )
2692 return response
2693
2694 # ### Get an array of all existing **Custom** Color Collections
2695 # Get a **single** color collection by id with [ColorCollection](#!/ColorCollection/color_collection)
2696 #
2697 # Get all **standard** color collections with [ColorCollection](#!/ColorCollection/color_collections_standard)
2698 #
2699 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2700 #
2701 # GET /color_collections/custom -> Sequence[mdls.ColorCollection]
2702 def color_collections_custom(
2703 self,
2704 # Requested fields.
2705 fields: Optional[str] = None,
2706 transport_options: Optional[transport.TransportOptions] = None,
2707 ) -> Sequence[mdls.ColorCollection]:
2708 """Get all Custom Color Collections"""
2709 response = cast(
2710 Sequence[mdls.ColorCollection],
2711 self.get(
2712 path="/color_collections/custom",
2713 structure=Sequence[mdls.ColorCollection],
2714 query_params={"fields": fields},
2715 transport_options=transport_options,
2716 ),
2717 )
2718 return response
2719
2720 # ### Get an array of all existing **Standard** Color Collections
2721 # Get a **single** color collection by id with [ColorCollection](#!/ColorCollection/color_collection)
2722 #
2723 # Get all **custom** color collections with [ColorCollection](#!/ColorCollection/color_collections_custom)
2724 #
2725 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2726 #
2727 # GET /color_collections/standard -> Sequence[mdls.ColorCollection]
2728 def color_collections_standard(
2729 self,
2730 # Requested fields.
2731 fields: Optional[str] = None,
2732 transport_options: Optional[transport.TransportOptions] = None,
2733 ) -> Sequence[mdls.ColorCollection]:
2734 """Get all Standard Color Collections"""
2735 response = cast(
2736 Sequence[mdls.ColorCollection],
2737 self.get(
2738 path="/color_collections/standard",
2739 structure=Sequence[mdls.ColorCollection],
2740 query_params={"fields": fields},
2741 transport_options=transport_options,
2742 ),
2743 )
2744 return response
2745
2746 # ### Get the default color collection
2747 #
2748 # Use this to retrieve the default Color Collection.
2749 #
2750 # Set the default color collection with [ColorCollection](#!/ColorCollection/set_default_color_collection)
2751 #
2752 # GET /color_collections/default -> mdls.ColorCollection
2753 def default_color_collection(
2754 self,
2755 transport_options: Optional[transport.TransportOptions] = None,
2756 ) -> mdls.ColorCollection:
2757 """Get Default Color Collection"""
2758 response = cast(
2759 mdls.ColorCollection,
2760 self.get(
2761 path="/color_collections/default",
2762 structure=mdls.ColorCollection,
2763 transport_options=transport_options,
2764 ),
2765 )
2766 return response
2767
2768 # ### Set the global default Color Collection by ID
2769 #
2770 # Returns the new specified default Color Collection object.
2771 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2772 #
2773 # PUT /color_collections/default -> mdls.ColorCollection
2774 def set_default_color_collection(
2775 self,
2776 # ID of color collection to set as default
2777 collection_id: str,
2778 transport_options: Optional[transport.TransportOptions] = None,
2779 ) -> mdls.ColorCollection:
2780 """Set Default Color Collection"""
2781 response = cast(
2782 mdls.ColorCollection,
2783 self.put(
2784 path="/color_collections/default",
2785 structure=mdls.ColorCollection,
2786 query_params={"collection_id": collection_id},
2787 transport_options=transport_options,
2788 ),
2789 )
2790 return response
2791
2792 # ### Get a Color Collection by ID
2793 #
2794 # Use this to retrieve a specific Color Collection.
2795 # Get a **single** color collection by id with [ColorCollection](#!/ColorCollection/color_collection)
2796 #
2797 # Get all **standard** color collections with [ColorCollection](#!/ColorCollection/color_collections_standard)
2798 #
2799 # Get all **custom** color collections with [ColorCollection](#!/ColorCollection/color_collections_custom)
2800 #
2801 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2802 #
2803 # GET /color_collections/{collection_id} -> mdls.ColorCollection
2804 def color_collection(
2805 self,
2806 # Id of Color Collection
2807 collection_id: str,
2808 # Requested fields.
2809 fields: Optional[str] = None,
2810 transport_options: Optional[transport.TransportOptions] = None,
2811 ) -> mdls.ColorCollection:
2812 """Get Color Collection by ID"""
2813 collection_id = self.encode_path_param(collection_id)
2814 response = cast(
2815 mdls.ColorCollection,
2816 self.get(
2817 path=f"/color_collections/{collection_id}",
2818 structure=mdls.ColorCollection,
2819 query_params={"fields": fields},
2820 transport_options=transport_options,
2821 ),
2822 )
2823 return response
2824
2825 # ### Update a custom color collection by id.
2826 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2827 #
2828 # PATCH /color_collections/{collection_id} -> mdls.ColorCollection
2829 def update_color_collection(
2830 self,
2831 # Id of Custom Color Collection
2832 collection_id: str,
2833 body: mdls.WriteColorCollection,
2834 transport_options: Optional[transport.TransportOptions] = None,
2835 ) -> mdls.ColorCollection:
2836 """Update Custom Color collection"""
2837 collection_id = self.encode_path_param(collection_id)
2838 response = cast(
2839 mdls.ColorCollection,
2840 self.patch(
2841 path=f"/color_collections/{collection_id}",
2842 structure=mdls.ColorCollection,
2843 body=body,
2844 transport_options=transport_options,
2845 ),
2846 )
2847 return response
2848
2849 # ### Delete a custom color collection by id
2850 #
2851 # This operation permanently deletes the identified **Custom** color collection.
2852 #
2853 # **Standard** color collections cannot be deleted
2854 #
2855 # Because multiple color collections can have the same label, they must be deleted by ID, not name.
2856 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2857 #
2858 # DELETE /color_collections/{collection_id} -> str
2859 def delete_color_collection(
2860 self,
2861 # Id of Color Collection
2862 collection_id: str,
2863 transport_options: Optional[transport.TransportOptions] = None,
2864 ) -> str:
2865 """Delete ColorCollection"""
2866 collection_id = self.encode_path_param(collection_id)
2867 response = cast(
2868 str,
2869 self.delete(
2870 path=f"/color_collections/{collection_id}",
2871 structure=str,
2872 transport_options=transport_options,
2873 ),
2874 )
2875 return response
2876
2877 # endregion
2878
2879 # region Config: Manage General Configuration
2880
2881 # Get the current Cloud Storage Configuration.
2882 #
2883 # GET /cloud_storage -> mdls.BackupConfiguration
2884 def cloud_storage_configuration(
2885 self,
2886 transport_options: Optional[transport.TransportOptions] = None,
2887 ) -> mdls.BackupConfiguration:
2888 """Get Cloud Storage"""
2889 response = cast(
2890 mdls.BackupConfiguration,
2891 self.get(
2892 path="/cloud_storage",
2893 structure=mdls.BackupConfiguration,
2894 transport_options=transport_options,
2895 ),
2896 )
2897 return response
2898
2899 # Update the current Cloud Storage Configuration.
2900 #
2901 # PATCH /cloud_storage -> mdls.BackupConfiguration
2902 def update_cloud_storage_configuration(
2903 self,
2904 body: mdls.WriteBackupConfiguration,
2905 transport_options: Optional[transport.TransportOptions] = None,
2906 ) -> mdls.BackupConfiguration:
2907 """Update Cloud Storage"""
2908 response = cast(
2909 mdls.BackupConfiguration,
2910 self.patch(
2911 path="/cloud_storage",
2912 structure=mdls.BackupConfiguration,
2913 body=body,
2914 transport_options=transport_options,
2915 ),
2916 )
2917 return response
2918
2919 # ### Get the current status and content of custom welcome emails
2920 #
2921 # GET /custom_welcome_email -> mdls.CustomWelcomeEmail
2922 def custom_welcome_email(
2923 self,
2924 transport_options: Optional[transport.TransportOptions] = None,
2925 ) -> mdls.CustomWelcomeEmail:
2926 """Get Custom Welcome Email"""
2927 response = cast(
2928 mdls.CustomWelcomeEmail,
2929 self.get(
2930 path="/custom_welcome_email",
2931 structure=mdls.CustomWelcomeEmail,
2932 transport_options=transport_options,
2933 ),
2934 )
2935 return response
2936
2937 # Update custom welcome email setting and values. Optionally send a test email with the new content to the currently logged in user.
2938 #
2939 # PATCH /custom_welcome_email -> mdls.CustomWelcomeEmail
2940 def update_custom_welcome_email(
2941 self,
2942 body: mdls.CustomWelcomeEmail,
2943 # If true a test email with the content from the request will be sent to the current user after saving
2944 send_test_welcome_email: Optional[bool] = None,
2945 transport_options: Optional[transport.TransportOptions] = None,
2946 ) -> mdls.CustomWelcomeEmail:
2947 """Update Custom Welcome Email Content"""
2948 response = cast(
2949 mdls.CustomWelcomeEmail,
2950 self.patch(
2951 path="/custom_welcome_email",
2952 structure=mdls.CustomWelcomeEmail,
2953 query_params={"send_test_welcome_email": send_test_welcome_email},
2954 body=body,
2955 transport_options=transport_options,
2956 ),
2957 )
2958 return response
2959
2960 # Requests to this endpoint will send a welcome email with the custom content provided in the body to the currently logged in user.
2961 #
2962 # PUT /custom_welcome_email_test -> mdls.WelcomeEmailTest
2963 def update_custom_welcome_email_test(
2964 self,
2965 body: mdls.WelcomeEmailTest,
2966 transport_options: Optional[transport.TransportOptions] = None,
2967 ) -> mdls.WelcomeEmailTest:
2968 """Send a test welcome email to the currently logged in user with the supplied content"""
2969 response = cast(
2970 mdls.WelcomeEmailTest,
2971 self.put(
2972 path="/custom_welcome_email_test",
2973 structure=mdls.WelcomeEmailTest,
2974 body=body,
2975 transport_options=transport_options,
2976 ),
2977 )
2978 return response
2979
2980 # ### Retrieve the value for whether or not digest emails is enabled
2981 #
2982 # GET /digest_emails_enabled -> mdls.DigestEmails
2983 def digest_emails_enabled(
2984 self,
2985 transport_options: Optional[transport.TransportOptions] = None,
2986 ) -> mdls.DigestEmails:
2987 """Get Digest_emails"""
2988 response = cast(
2989 mdls.DigestEmails,
2990 self.get(
2991 path="/digest_emails_enabled",
2992 structure=mdls.DigestEmails,
2993 transport_options=transport_options,
2994 ),
2995 )
2996 return response
2997
2998 # ### Update the setting for enabling/disabling digest emails
2999 #
3000 # PATCH /digest_emails_enabled -> mdls.DigestEmails
3001 def update_digest_emails_enabled(
3002 self,
3003 body: mdls.DigestEmails,
3004 transport_options: Optional[transport.TransportOptions] = None,
3005 ) -> mdls.DigestEmails:
3006 """Update Digest_emails"""
3007 response = cast(
3008 mdls.DigestEmails,
3009 self.patch(
3010 path="/digest_emails_enabled",
3011 structure=mdls.DigestEmails,
3012 body=body,
3013 transport_options=transport_options,
3014 ),
3015 )
3016 return response
3017
3018 # ### Trigger the generation of digest email records and send them to Looker's internal system. This does not send
3019 # any actual emails, it generates records containing content which may be of interest for users who have become inactive.
3020 # Emails will be sent at a later time from Looker's internal system if the Digest Emails feature is enabled in settings.
3021 #
3022 # POST /digest_email_send -> mdls.DigestEmailSend
3023 def create_digest_email_send(
3024 self,
3025 transport_options: Optional[transport.TransportOptions] = None,
3026 ) -> mdls.DigestEmailSend:
3027 """Deliver digest email contents"""
3028 response = cast(
3029 mdls.DigestEmailSend,
3030 self.post(
3031 path="/digest_email_send",
3032 structure=mdls.DigestEmailSend,
3033 transport_options=transport_options,
3034 ),
3035 )
3036 return response
3037
3038 # ### Get Egress IP Addresses
3039 #
3040 # Returns the list of public egress IP Addresses for a hosted customer's instance
3041 #
3042 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
3043 #
3044 # GET /public_egress_ip_addresses -> mdls.EgressIpAddresses
3045 def public_egress_ip_addresses(
3046 self,
3047 transport_options: Optional[transport.TransportOptions] = None,
3048 ) -> mdls.EgressIpAddresses:
3049 """Public Egress IP Addresses"""
3050 response = cast(
3051 mdls.EgressIpAddresses,
3052 self.get(
3053 path="/public_egress_ip_addresses",
3054 structure=mdls.EgressIpAddresses,
3055 transport_options=transport_options,
3056 ),
3057 )
3058 return response
3059
3060 # ### Set the menu item name and content for internal help resources
3061 #
3062 # GET /internal_help_resources_content -> mdls.InternalHelpResourcesContent
3063 def internal_help_resources_content(
3064 self,
3065 transport_options: Optional[transport.TransportOptions] = None,
3066 ) -> mdls.InternalHelpResourcesContent:
3067 """Get Internal Help Resources Content"""
3068 response = cast(
3069 mdls.InternalHelpResourcesContent,
3070 self.get(
3071 path="/internal_help_resources_content",
3072 structure=mdls.InternalHelpResourcesContent,
3073 transport_options=transport_options,
3074 ),
3075 )
3076 return response
3077
3078 # Update internal help resources content
3079 #
3080 # PATCH /internal_help_resources_content -> mdls.InternalHelpResourcesContent
3081 def update_internal_help_resources_content(
3082 self,
3083 body: mdls.WriteInternalHelpResourcesContent,
3084 transport_options: Optional[transport.TransportOptions] = None,
3085 ) -> mdls.InternalHelpResourcesContent:
3086 """Update internal help resources content"""
3087 response = cast(
3088 mdls.InternalHelpResourcesContent,
3089 self.patch(
3090 path="/internal_help_resources_content",
3091 structure=mdls.InternalHelpResourcesContent,
3092 body=body,
3093 transport_options=transport_options,
3094 ),
3095 )
3096 return response
3097
3098 # ### Get and set the options for internal help resources
3099 #
3100 # GET /internal_help_resources_enabled -> mdls.InternalHelpResources
3101 def internal_help_resources(
3102 self,
3103 transport_options: Optional[transport.TransportOptions] = None,
3104 ) -> mdls.InternalHelpResources:
3105 """Get Internal Help Resources"""
3106 response = cast(
3107 mdls.InternalHelpResources,
3108 self.get(
3109 path="/internal_help_resources_enabled",
3110 structure=mdls.InternalHelpResources,
3111 transport_options=transport_options,
3112 ),
3113 )
3114 return response
3115
3116 # Update internal help resources settings
3117 #
3118 # PATCH /internal_help_resources -> mdls.InternalHelpResources
3119 def update_internal_help_resources(
3120 self,
3121 body: mdls.WriteInternalHelpResources,
3122 transport_options: Optional[transport.TransportOptions] = None,
3123 ) -> mdls.InternalHelpResources:
3124 """Update internal help resources configuration"""
3125 response = cast(
3126 mdls.InternalHelpResources,
3127 self.patch(
3128 path="/internal_help_resources",
3129 structure=mdls.InternalHelpResources,
3130 body=body,
3131 transport_options=transport_options,
3132 ),
3133 )
3134 return response
3135
3136 # ### Get all legacy features.
3137 #
3138 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
3139 #
3140 # GET /legacy_features -> Sequence[mdls.LegacyFeature]
3141 def all_legacy_features(
3142 self,
3143 transport_options: Optional[transport.TransportOptions] = None,
3144 ) -> Sequence[mdls.LegacyFeature]:
3145 """Get All Legacy Features"""
3146 response = cast(
3147 Sequence[mdls.LegacyFeature],
3148 self.get(
3149 path="/legacy_features",
3150 structure=Sequence[mdls.LegacyFeature],
3151 transport_options=transport_options,
3152 ),
3153 )
3154 return response
3155
3156 # ### Get information about the legacy feature with a specific id.
3157 #
3158 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
3159 #
3160 # GET /legacy_features/{legacy_feature_id} -> mdls.LegacyFeature
3161 def legacy_feature(
3162 self,
3163 # id of legacy feature
3164 legacy_feature_id: str,
3165 transport_options: Optional[transport.TransportOptions] = None,
3166 ) -> mdls.LegacyFeature:
3167 """Get Legacy Feature"""
3168 legacy_feature_id = self.encode_path_param(legacy_feature_id)
3169 response = cast(
3170 mdls.LegacyFeature,
3171 self.get(
3172 path=f"/legacy_features/{legacy_feature_id}",
3173 structure=mdls.LegacyFeature,
3174 transport_options=transport_options,
3175 ),
3176 )
3177 return response
3178
3179 # ### Update information about the legacy feature with a specific id.
3180 #
3181 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
3182 #
3183 # PATCH /legacy_features/{legacy_feature_id} -> mdls.LegacyFeature
3184 def update_legacy_feature(
3185 self,
3186 # id of legacy feature
3187 legacy_feature_id: str,
3188 body: mdls.WriteLegacyFeature,
3189 transport_options: Optional[transport.TransportOptions] = None,
3190 ) -> mdls.LegacyFeature:
3191 """Update Legacy Feature"""
3192 legacy_feature_id = self.encode_path_param(legacy_feature_id)
3193 response = cast(
3194 mdls.LegacyFeature,
3195 self.patch(
3196 path=f"/legacy_features/{legacy_feature_id}",
3197 structure=mdls.LegacyFeature,
3198 body=body,
3199 transport_options=transport_options,
3200 ),
3201 )
3202 return response
3203
3204 # ### Get a list of locales that Looker supports.
3205 #
3206 # GET /locales -> Sequence[mdls.Locale]
3207 def all_locales(
3208 self,
3209 transport_options: Optional[transport.TransportOptions] = None,
3210 ) -> Sequence[mdls.Locale]:
3211 """Get All Locales"""
3212 response = cast(
3213 Sequence[mdls.Locale],
3214 self.get(
3215 path="/locales",
3216 structure=Sequence[mdls.Locale],
3217 transport_options=transport_options,
3218 ),
3219 )
3220 return response
3221
3222 # ### Get all mobile settings.
3223 #
3224 # GET /mobile/settings -> mdls.MobileSettings
3225 def mobile_settings(
3226 self,
3227 transport_options: Optional[transport.TransportOptions] = None,
3228 ) -> mdls.MobileSettings:
3229 """Get Mobile_Settings"""
3230 response = cast(
3231 mdls.MobileSettings,
3232 self.get(
3233 path="/mobile/settings",
3234 structure=mdls.MobileSettings,
3235 transport_options=transport_options,
3236 ),
3237 )
3238 return response
3239
3240 # ### Get Looker Settings
3241 #
3242 # Available settings are:
3243 # - allow_user_timezones
3244 # - custom_welcome_email
3245 # - data_connector_default_enabled
3246 # - dashboard_auto_refresh_restriction
3247 # - dashboard_auto_refresh_minimum_interval
3248 # - extension_framework_enabled
3249 # - extension_load_url_enabled
3250 # - instance_config
3251 # - managed_certificate_uri
3252 # - marketplace_auto_install_enabled
3253 # - marketplace_automation
3254 # - marketplace_terms_accepted
3255 # - marketplace_enabled
3256 # - marketplace_site
3257 # - onboarding_enabled
3258 # - privatelabel_configuration
3259 # - timezone
3260 # - host_url
3261 # - email_domain_allowlist
3262 # - embed_cookieless_v2
3263 # - embed_enabled
3264 # - embed_config
3265 #
3266 # GET /setting -> mdls.Setting
3267 def get_setting(
3268 self,
3269 # Requested fields
3270 fields: Optional[str] = None,
3271 transport_options: Optional[transport.TransportOptions] = None,
3272 ) -> mdls.Setting:
3273 """Get Setting"""
3274 response = cast(
3275 mdls.Setting,
3276 self.get(
3277 path="/setting",
3278 structure=mdls.Setting,
3279 query_params={"fields": fields},
3280 transport_options=transport_options,
3281 ),
3282 )
3283 return response
3284
3285 # ### Configure Looker Settings
3286 #
3287 # Available settings are:
3288 # - allow_user_timezones
3289 # - custom_welcome_email
3290 # - data_connector_default_enabled
3291 # - dashboard_auto_refresh_restriction
3292 # - dashboard_auto_refresh_minimum_interval
3293 # - extension_framework_enabled
3294 # - extension_load_url_enabled
3295 # - instance_config
3296 # - managed_certificate_uri
3297 # - marketplace_auto_install_enabled
3298 # - marketplace_automation
3299 # - marketplace_terms_accepted
3300 # - marketplace_enabled
3301 # - marketplace_site
3302 # - onboarding_enabled
3303 # - privatelabel_configuration
3304 # - timezone
3305 # - host_url
3306 # - email_domain_allowlist
3307 # - embed_cookieless_v2
3308 # - embed_enabled
3309 # - embed_config
3310 #
3311 # See the `Setting` type for more information on the specific values that can be configured.
3312 #
3313 # If a setting update is rejected, the API error payload should provide information on the cause of the rejection.
3314 #
3315 # PATCH /setting -> mdls.Setting
3316 def set_setting(
3317 self,
3318 body: mdls.WriteSetting,
3319 # Requested fields
3320 fields: Optional[str] = None,
3321 transport_options: Optional[transport.TransportOptions] = None,
3322 ) -> mdls.Setting:
3323 """Set Setting"""
3324 response = cast(
3325 mdls.Setting,
3326 self.patch(
3327 path="/setting",
3328 structure=mdls.Setting,
3329 query_params={"fields": fields},
3330 body=body,
3331 transport_options=transport_options,
3332 ),
3333 )
3334 return response
3335
3336 # ### Configure SMTP Settings
3337 # This API allows users to configure the SMTP settings on the Looker instance.
3338 # Only admin users are authorised to call this API.
3339 #
3340 # POST /smtp_settings -> None
3341 def set_smtp_settings(
3342 self,
3343 body: mdls.SmtpSettings,
3344 transport_options: Optional[transport.TransportOptions] = None,
3345 ) -> None:
3346 """Set SMTP Setting"""
3347 response = cast(
3348 None,
3349 self.post(
3350 path="/smtp_settings",
3351 structure=None,
3352 body=body,
3353 transport_options=transport_options,
3354 ),
3355 )
3356 return response
3357
3358 # ### Get current SMTP status.
3359 #
3360 # GET /smtp_status -> mdls.SmtpStatus
3361 def smtp_status(
3362 self,
3363 # Include only these fields in the response
3364 fields: Optional[str] = None,
3365 transport_options: Optional[transport.TransportOptions] = None,
3366 ) -> mdls.SmtpStatus:
3367 """Get SMTP Status"""
3368 response = cast(
3369 mdls.SmtpStatus,
3370 self.get(
3371 path="/smtp_status",
3372 structure=mdls.SmtpStatus,
3373 query_params={"fields": fields},
3374 transport_options=transport_options,
3375 ),
3376 )
3377 return response
3378
3379 # ### Get a list of timezones that Looker supports (e.g. useful for scheduling tasks).
3380 #
3381 # GET /timezones -> Sequence[mdls.Timezone]
3382 def all_timezones(
3383 self,
3384 transport_options: Optional[transport.TransportOptions] = None,
3385 ) -> Sequence[mdls.Timezone]:
3386 """Get All Timezones"""
3387 response = cast(
3388 Sequence[mdls.Timezone],
3389 self.get(
3390 path="/timezones",
3391 structure=Sequence[mdls.Timezone],
3392 transport_options=transport_options,
3393 ),
3394 )
3395 return response
3396
3397 # ### Get information about all API versions supported by this Looker instance.
3398 #
3399 # GET /versions -> mdls.ApiVersion
3400 def versions(
3401 self,
3402 # Requested fields.
3403 fields: Optional[str] = None,
3404 transport_options: Optional[transport.TransportOptions] = None,
3405 ) -> mdls.ApiVersion:
3406 """Get ApiVersion"""
3407 response = cast(
3408 mdls.ApiVersion,
3409 self.get(
3410 path="/versions",
3411 structure=mdls.ApiVersion,
3412 query_params={"fields": fields},
3413 transport_options=transport_options,
3414 ),
3415 )
3416 return response
3417
3418 # ### Get an API specification for this Looker instance.
3419 #
3420 # The specification is returned as a JSON document in Swagger 2.x format
3421 #
3422 # GET /api_spec/{api_version}/{specification} -> Any
3423 def api_spec(
3424 self,
3425 # API version
3426 api_version: str,
3427 # Specification name. Typically, this is "swagger.json"
3428 specification: str,
3429 transport_options: Optional[transport.TransportOptions] = None,
3430 ) -> Any:
3431 """Get an API specification"""
3432 api_version = self.encode_path_param(api_version)
3433 specification = self.encode_path_param(specification)
3434 response = cast(
3435 Any,
3436 self.get(
3437 path=f"/api_spec/{api_version}/{specification}",
3438 structure=Any,
3439 transport_options=transport_options,
3440 ),
3441 )
3442 return response
3443
3444 # ### This feature is enabled only by special license.
3445 #
3446 # This endpoint provides the private label configuration, which includes hiding documentation links, custom favicon uploading, etc.
3447 #
3448 # This endpoint is deprecated. [Get Setting](#!/Config/get_setting) should be used to retrieve private label settings instead
3449 #
3450 # GET /whitelabel_configuration -> mdls.WhitelabelConfiguration
3451 def whitelabel_configuration(
3452 self,
3453 # Requested fields.
3454 fields: Optional[str] = None,
3455 transport_options: Optional[transport.TransportOptions] = None,
3456 ) -> mdls.WhitelabelConfiguration:
3457 """Get Private label configuration"""
3458 response = cast(
3459 mdls.WhitelabelConfiguration,
3460 self.get(
3461 path="/whitelabel_configuration",
3462 structure=mdls.WhitelabelConfiguration,
3463 query_params={"fields": fields},
3464 transport_options=transport_options,
3465 ),
3466 )
3467 return response
3468
3469 # ### Update the private label configuration
3470 #
3471 # This endpoint is deprecated. [Set Setting](#!/Config/set_setting) should be used to update private label settings instead
3472 #
3473 # PUT /whitelabel_configuration -> mdls.WhitelabelConfiguration
3474 def update_whitelabel_configuration(
3475 self,
3476 body: mdls.WriteWhitelabelConfiguration,
3477 transport_options: Optional[transport.TransportOptions] = None,
3478 ) -> mdls.WhitelabelConfiguration:
3479 """Update Private label configuration"""
3480 response = cast(
3481 mdls.WhitelabelConfiguration,
3482 self.put(
3483 path="/whitelabel_configuration",
3484 structure=mdls.WhitelabelConfiguration,
3485 body=body,
3486 transport_options=transport_options,
3487 ),
3488 )
3489 return response
3490
3491 # endregion
3492
3493 # region Connection: Manage Database Connections
3494
3495 # ### Get information about all connections.
3496 #
3497 # GET /connections -> Sequence[mdls.DBConnection]
3498 def all_connections(
3499 self,
3500 # Requested fields.
3501 fields: Optional[str] = None,
3502 transport_options: Optional[transport.TransportOptions] = None,
3503 ) -> Sequence[mdls.DBConnection]:
3504 """Get All Connections"""
3505 response = cast(
3506 Sequence[mdls.DBConnection],
3507 self.get(
3508 path="/connections",
3509 structure=Sequence[mdls.DBConnection],
3510 query_params={"fields": fields},
3511 transport_options=transport_options,
3512 ),
3513 )
3514 return response
3515
3516 # ### Create a connection using the specified configuration.
3517 #
3518 # POST /connections -> mdls.DBConnection
3519 def create_connection(
3520 self,
3521 body: mdls.WriteDBConnection,
3522 transport_options: Optional[transport.TransportOptions] = None,
3523 ) -> mdls.DBConnection:
3524 """Create Connection"""
3525 response = cast(
3526 mdls.DBConnection,
3527 self.post(
3528 path="/connections",
3529 structure=mdls.DBConnection,
3530 body=body,
3531 transport_options=transport_options,
3532 ),
3533 )
3534 return response
3535
3536 # ### Get information about a connection.
3537 #
3538 # GET /connections/{connection_name} -> mdls.DBConnection
3539 def connection(
3540 self,
3541 # Name of connection
3542 connection_name: str,
3543 # Requested fields.
3544 fields: Optional[str] = None,
3545 transport_options: Optional[transport.TransportOptions] = None,
3546 ) -> mdls.DBConnection:
3547 """Get Connection"""
3548 connection_name = self.encode_path_param(connection_name)
3549 response = cast(
3550 mdls.DBConnection,
3551 self.get(
3552 path=f"/connections/{connection_name}",
3553 structure=mdls.DBConnection,
3554 query_params={"fields": fields},
3555 transport_options=transport_options,
3556 ),
3557 )
3558 return response
3559
3560 # ### Update a connection using the specified configuration.
3561 #
3562 # PATCH /connections/{connection_name} -> mdls.DBConnection
3563 def update_connection(
3564 self,
3565 # Name of connection
3566 connection_name: str,
3567 body: mdls.WriteDBConnection,
3568 transport_options: Optional[transport.TransportOptions] = None,
3569 ) -> mdls.DBConnection:
3570 """Update Connection"""
3571 connection_name = self.encode_path_param(connection_name)
3572 response = cast(
3573 mdls.DBConnection,
3574 self.patch(
3575 path=f"/connections/{connection_name}",
3576 structure=mdls.DBConnection,
3577 body=body,
3578 transport_options=transport_options,
3579 ),
3580 )
3581 return response
3582
3583 # ### Delete a connection.
3584 #
3585 # DELETE /connections/{connection_name} -> str
3586 def delete_connection(
3587 self,
3588 # Name of connection
3589 connection_name: str,
3590 transport_options: Optional[transport.TransportOptions] = None,
3591 ) -> str:
3592 """Delete Connection"""
3593 connection_name = self.encode_path_param(connection_name)
3594 response = cast(
3595 str,
3596 self.delete(
3597 path=f"/connections/{connection_name}",
3598 structure=str,
3599 transport_options=transport_options,
3600 ),
3601 )
3602 return response
3603
3604 # ### Delete a connection override.
3605 #
3606 # DELETE /connections/{connection_name}/connection_override/{override_context} -> str
3607 def delete_connection_override(
3608 self,
3609 # Name of connection
3610 connection_name: str,
3611 # Context of connection override
3612 override_context: str,
3613 transport_options: Optional[transport.TransportOptions] = None,
3614 ) -> str:
3615 """Delete Connection Override"""
3616 connection_name = self.encode_path_param(connection_name)
3617 override_context = self.encode_path_param(override_context)
3618 response = cast(
3619 str,
3620 self.delete(
3621 path=f"/connections/{connection_name}/connection_override/{override_context}",
3622 structure=str,
3623 transport_options=transport_options,
3624 ),
3625 )
3626 return response
3627
3628 # ### Test an existing connection.
3629 #
3630 # Note that a connection's 'dialect' property has a 'connection_tests' property that lists the
3631 # specific types of tests that the connection supports.
3632 #
3633 # This API is rate limited.
3634 #
3635 # Unsupported tests in the request will be ignored.
3636 #
3637 # PUT /connections/{connection_name}/test -> Sequence[mdls.DBConnectionTestResult]
3638 def test_connection(
3639 self,
3640 # Name of connection
3641 connection_name: str,
3642 # Array of names of tests to run
3643 tests: Optional[mdls.DelimSequence[str]] = None,
3644 transport_options: Optional[transport.TransportOptions] = None,
3645 ) -> Sequence[mdls.DBConnectionTestResult]:
3646 """Test Connection"""
3647 connection_name = self.encode_path_param(connection_name)
3648 response = cast(
3649 Sequence[mdls.DBConnectionTestResult],
3650 self.put(
3651 path=f"/connections/{connection_name}/test",
3652 structure=Sequence[mdls.DBConnectionTestResult],
3653 query_params={"tests": tests},
3654 transport_options=transport_options,
3655 ),
3656 )
3657 return response
3658
3659 # ### Test a connection configuration.
3660 #
3661 # Note that a connection's 'dialect' property has a 'connection_tests' property that lists the
3662 # specific types of tests that the connection supports.
3663 #
3664 # This API is rate limited.
3665 #
3666 # Unsupported tests in the request will be ignored.
3667 #
3668 # PUT /connections/test -> Sequence[mdls.DBConnectionTestResult]
3669 def test_connection_config(
3670 self,
3671 body: mdls.WriteDBConnection,
3672 # Array of names of tests to run
3673 tests: Optional[mdls.DelimSequence[str]] = None,
3674 transport_options: Optional[transport.TransportOptions] = None,
3675 ) -> Sequence[mdls.DBConnectionTestResult]:
3676 """Test Connection Configuration"""
3677 response = cast(
3678 Sequence[mdls.DBConnectionTestResult],
3679 self.put(
3680 path="/connections/test",
3681 structure=Sequence[mdls.DBConnectionTestResult],
3682 query_params={"tests": tests},
3683 body=body,
3684 transport_options=transport_options,
3685 ),
3686 )
3687 return response
3688
3689 # ### Get information about all dialects.
3690 #
3691 # GET /dialect_info -> Sequence[mdls.DialectInfo]
3692 def all_dialect_infos(
3693 self,
3694 # Requested fields.
3695 fields: Optional[str] = None,
3696 transport_options: Optional[transport.TransportOptions] = None,
3697 ) -> Sequence[mdls.DialectInfo]:
3698 """Get All Dialect Infos"""
3699 response = cast(
3700 Sequence[mdls.DialectInfo],
3701 self.get(
3702 path="/dialect_info",
3703 structure=Sequence[mdls.DialectInfo],
3704 query_params={"fields": fields},
3705 transport_options=transport_options,
3706 ),
3707 )
3708 return response
3709
3710 # ### Get all External OAuth Applications.
3711 #
3712 # This is an OAuth Application which Looker uses to access external systems.
3713 #
3714 # GET /external_oauth_applications -> Sequence[mdls.ExternalOauthApplication]
3715 def all_external_oauth_applications(
3716 self,
3717 # Application name
3718 name: Optional[str] = None,
3719 # Application Client ID
3720 client_id: Optional[str] = None,
3721 transport_options: Optional[transport.TransportOptions] = None,
3722 ) -> Sequence[mdls.ExternalOauthApplication]:
3723 """Get All External OAuth Applications"""
3724 response = cast(
3725 Sequence[mdls.ExternalOauthApplication],
3726 self.get(
3727 path="/external_oauth_applications",
3728 structure=Sequence[mdls.ExternalOauthApplication],
3729 query_params={"name": name, "client_id": client_id},
3730 transport_options=transport_options,
3731 ),
3732 )
3733 return response
3734
3735 # ### Create an OAuth Application using the specified configuration.
3736 #
3737 # This is an OAuth Application which Looker uses to access external systems.
3738 #
3739 # POST /external_oauth_applications -> mdls.ExternalOauthApplication
3740 def create_external_oauth_application(
3741 self,
3742 body: mdls.WriteExternalOauthApplication,
3743 transport_options: Optional[transport.TransportOptions] = None,
3744 ) -> mdls.ExternalOauthApplication:
3745 """Create External OAuth Application"""
3746 response = cast(
3747 mdls.ExternalOauthApplication,
3748 self.post(
3749 path="/external_oauth_applications",
3750 structure=mdls.ExternalOauthApplication,
3751 body=body,
3752 transport_options=transport_options,
3753 ),
3754 )
3755 return response
3756
3757 # ### Update an OAuth Application's client secret.
3758 #
3759 # This is an OAuth Application which Looker uses to access external systems.
3760 #
3761 # PATCH /external_oauth_applications/{client_id} -> mdls.ExternalOauthApplication
3762 def update_external_oauth_application(
3763 self,
3764 # The client ID of the OAuth App to update
3765 client_id: str,
3766 body: mdls.WriteExternalOauthApplication,
3767 transport_options: Optional[transport.TransportOptions] = None,
3768 ) -> mdls.ExternalOauthApplication:
3769 """Update External OAuth Application"""
3770 client_id = self.encode_path_param(client_id)
3771 response = cast(
3772 mdls.ExternalOauthApplication,
3773 self.patch(
3774 path=f"/external_oauth_applications/{client_id}",
3775 structure=mdls.ExternalOauthApplication,
3776 body=body,
3777 transport_options=transport_options,
3778 ),
3779 )
3780 return response
3781
3782 # ### Delete an OAuth Application.
3783 #
3784 # This is an OAuth Application which Looker uses to access external systems.
3785 #
3786 # DELETE /external_oauth_applications/{client_id} -> str
3787 def delete_external_oauth_application(
3788 self,
3789 # The client ID of the OAuth App to delete
3790 client_id: str,
3791 transport_options: Optional[transport.TransportOptions] = None,
3792 ) -> str:
3793 """Delete External OAuth Application"""
3794 client_id = self.encode_path_param(client_id)
3795 response = cast(
3796 str,
3797 self.delete(
3798 path=f"/external_oauth_applications/{client_id}",
3799 structure=str,
3800 transport_options=transport_options,
3801 ),
3802 )
3803 return response
3804
3805 # ### Create OAuth User state.
3806 #
3807 # POST /external_oauth_applications/user_state -> mdls.CreateOAuthApplicationUserStateResponse
3808 def create_oauth_application_user_state(
3809 self,
3810 body: mdls.CreateOAuthApplicationUserStateRequest,
3811 transport_options: Optional[transport.TransportOptions] = None,
3812 ) -> mdls.CreateOAuthApplicationUserStateResponse:
3813 """Create Create OAuth user state."""
3814 response = cast(
3815 mdls.CreateOAuthApplicationUserStateResponse,
3816 self.post(
3817 path="/external_oauth_applications/user_state",
3818 structure=mdls.CreateOAuthApplicationUserStateResponse,
3819 body=body,
3820 transport_options=transport_options,
3821 ),
3822 )
3823 return response
3824
3825 # ### Get information about all SSH Servers.
3826 #
3827 # GET /ssh_servers -> Sequence[mdls.SshServer]
3828 def all_ssh_servers(
3829 self,
3830 # Requested fields.
3831 fields: Optional[str] = None,
3832 transport_options: Optional[transport.TransportOptions] = None,
3833 ) -> Sequence[mdls.SshServer]:
3834 """Get All SSH Servers"""
3835 response = cast(
3836 Sequence[mdls.SshServer],
3837 self.get(
3838 path="/ssh_servers",
3839 structure=Sequence[mdls.SshServer],
3840 query_params={"fields": fields},
3841 transport_options=transport_options,
3842 ),
3843 )
3844 return response
3845
3846 # ### Create an SSH Server.
3847 #
3848 # POST /ssh_servers -> mdls.SshServer
3849 def create_ssh_server(
3850 self,
3851 body: mdls.WriteSshServer,
3852 transport_options: Optional[transport.TransportOptions] = None,
3853 ) -> mdls.SshServer:
3854 """Create SSH Server"""
3855 response = cast(
3856 mdls.SshServer,
3857 self.post(
3858 path="/ssh_servers",
3859 structure=mdls.SshServer,
3860 body=body,
3861 transport_options=transport_options,
3862 ),
3863 )
3864 return response
3865
3866 # ### Get information about an SSH Server.
3867 #
3868 # GET /ssh_server/{ssh_server_id} -> mdls.SshServer
3869 def ssh_server(
3870 self,
3871 # Id of SSH Server
3872 ssh_server_id: str,
3873 transport_options: Optional[transport.TransportOptions] = None,
3874 ) -> mdls.SshServer:
3875 """Get SSH Server"""
3876 ssh_server_id = self.encode_path_param(ssh_server_id)
3877 response = cast(
3878 mdls.SshServer,
3879 self.get(
3880 path=f"/ssh_server/{ssh_server_id}",
3881 structure=mdls.SshServer,
3882 transport_options=transport_options,
3883 ),
3884 )
3885 return response
3886
3887 # ### Update an SSH Server.
3888 #
3889 # PATCH /ssh_server/{ssh_server_id} -> mdls.SshServer
3890 def update_ssh_server(
3891 self,
3892 # Id of SSH Server
3893 ssh_server_id: str,
3894 body: mdls.WriteSshServer,
3895 transport_options: Optional[transport.TransportOptions] = None,
3896 ) -> mdls.SshServer:
3897 """Update SSH Server"""
3898 ssh_server_id = self.encode_path_param(ssh_server_id)
3899 response = cast(
3900 mdls.SshServer,
3901 self.patch(
3902 path=f"/ssh_server/{ssh_server_id}",
3903 structure=mdls.SshServer,
3904 body=body,
3905 transport_options=transport_options,
3906 ),
3907 )
3908 return response
3909
3910 # ### Delete an SSH Server.
3911 #
3912 # DELETE /ssh_server/{ssh_server_id} -> str
3913 def delete_ssh_server(
3914 self,
3915 # Id of SSH Server
3916 ssh_server_id: str,
3917 transport_options: Optional[transport.TransportOptions] = None,
3918 ) -> str:
3919 """Delete SSH Server"""
3920 ssh_server_id = self.encode_path_param(ssh_server_id)
3921 response = cast(
3922 str,
3923 self.delete(
3924 path=f"/ssh_server/{ssh_server_id}",
3925 structure=str,
3926 transport_options=transport_options,
3927 ),
3928 )
3929 return response
3930
3931 # ### Test the SSH Server
3932 #
3933 # GET /ssh_server/{ssh_server_id}/test -> mdls.SshServer
3934 def test_ssh_server(
3935 self,
3936 # Id of SSH Server
3937 ssh_server_id: str,
3938 transport_options: Optional[transport.TransportOptions] = None,
3939 ) -> mdls.SshServer:
3940 """Test SSH Server"""
3941 ssh_server_id = self.encode_path_param(ssh_server_id)
3942 response = cast(
3943 mdls.SshServer,
3944 self.get(
3945 path=f"/ssh_server/{ssh_server_id}/test",
3946 structure=mdls.SshServer,
3947 transport_options=transport_options,
3948 ),
3949 )
3950 return response
3951
3952 # ### Get information about all SSH Tunnels.
3953 #
3954 # GET /ssh_tunnels -> Sequence[mdls.SshTunnel]
3955 def all_ssh_tunnels(
3956 self,
3957 # Requested fields.
3958 fields: Optional[str] = None,
3959 transport_options: Optional[transport.TransportOptions] = None,
3960 ) -> Sequence[mdls.SshTunnel]:
3961 """Get All SSH Tunnels"""
3962 response = cast(
3963 Sequence[mdls.SshTunnel],
3964 self.get(
3965 path="/ssh_tunnels",
3966 structure=Sequence[mdls.SshTunnel],
3967 query_params={"fields": fields},
3968 transport_options=transport_options,
3969 ),
3970 )
3971 return response
3972
3973 # ### Create an SSH Tunnel
3974 #
3975 # POST /ssh_tunnels -> mdls.SshTunnel
3976 def create_ssh_tunnel(
3977 self,
3978 body: mdls.WriteSshTunnel,
3979 transport_options: Optional[transport.TransportOptions] = None,
3980 ) -> mdls.SshTunnel:
3981 """Create SSH Tunnel"""
3982 response = cast(
3983 mdls.SshTunnel,
3984 self.post(
3985 path="/ssh_tunnels",
3986 structure=mdls.SshTunnel,
3987 body=body,
3988 transport_options=transport_options,
3989 ),
3990 )
3991 return response
3992
3993 # ### Get information about an SSH Tunnel.
3994 #
3995 # GET /ssh_tunnel/{ssh_tunnel_id} -> mdls.SshTunnel
3996 def ssh_tunnel(
3997 self,
3998 # Id of SSH Tunnel
3999 ssh_tunnel_id: str,
4000 transport_options: Optional[transport.TransportOptions] = None,
4001 ) -> mdls.SshTunnel:
4002 """Get SSH Tunnel"""
4003 ssh_tunnel_id = self.encode_path_param(ssh_tunnel_id)
4004 response = cast(
4005 mdls.SshTunnel,
4006 self.get(
4007 path=f"/ssh_tunnel/{ssh_tunnel_id}",
4008 structure=mdls.SshTunnel,
4009 transport_options=transport_options,
4010 ),
4011 )
4012 return response
4013
4014 # ### Update an SSH Tunnel
4015 #
4016 # PATCH /ssh_tunnel/{ssh_tunnel_id} -> mdls.SshTunnel
4017 def update_ssh_tunnel(
4018 self,
4019 # Id of SSH Tunnel
4020 ssh_tunnel_id: str,
4021 body: mdls.WriteSshTunnel,
4022 transport_options: Optional[transport.TransportOptions] = None,
4023 ) -> mdls.SshTunnel:
4024 """Update SSH Tunnel"""
4025 ssh_tunnel_id = self.encode_path_param(ssh_tunnel_id)
4026 response = cast(
4027 mdls.SshTunnel,
4028 self.patch(
4029 path=f"/ssh_tunnel/{ssh_tunnel_id}",
4030 structure=mdls.SshTunnel,
4031 body=body,
4032 transport_options=transport_options,
4033 ),
4034 )
4035 return response
4036
4037 # ### Delete an SSH Tunnel
4038 #
4039 # DELETE /ssh_tunnel/{ssh_tunnel_id} -> str
4040 def delete_ssh_tunnel(
4041 self,
4042 # Id of SSH Tunnel
4043 ssh_tunnel_id: str,
4044 transport_options: Optional[transport.TransportOptions] = None,
4045 ) -> str:
4046 """Delete SSH Tunnel"""
4047 ssh_tunnel_id = self.encode_path_param(ssh_tunnel_id)
4048 response = cast(
4049 str,
4050 self.delete(
4051 path=f"/ssh_tunnel/{ssh_tunnel_id}",
4052 structure=str,
4053 transport_options=transport_options,
4054 ),
4055 )
4056 return response
4057
4058 # ### Test the SSH Tunnel
4059 #
4060 # GET /ssh_tunnel/{ssh_tunnel_id}/test -> mdls.SshTunnel
4061 def test_ssh_tunnel(
4062 self,
4063 # Id of SSH Tunnel
4064 ssh_tunnel_id: str,
4065 transport_options: Optional[transport.TransportOptions] = None,
4066 ) -> mdls.SshTunnel:
4067 """Test SSH Tunnel"""
4068 ssh_tunnel_id = self.encode_path_param(ssh_tunnel_id)
4069 response = cast(
4070 mdls.SshTunnel,
4071 self.get(
4072 path=f"/ssh_tunnel/{ssh_tunnel_id}/test",
4073 structure=mdls.SshTunnel,
4074 transport_options=transport_options,
4075 ),
4076 )
4077 return response
4078
4079 # ### Get the SSH public key
4080 #
4081 # Get the public key created for this instance to identify itself to a remote SSH server.
4082 #
4083 # GET /ssh_public_key -> mdls.SshPublicKey
4084 def ssh_public_key(
4085 self,
4086 transport_options: Optional[transport.TransportOptions] = None,
4087 ) -> mdls.SshPublicKey:
4088 """Get SSH Public Key"""
4089 response = cast(
4090 mdls.SshPublicKey,
4091 self.get(
4092 path="/ssh_public_key",
4093 structure=mdls.SshPublicKey,
4094 transport_options=transport_options,
4095 ),
4096 )
4097 return response
4098
4099 # endregion
4100
4101 # region Content: Manage Content
4102
4103 # ### Search Favorite Content
4104 #
4105 # If multiple search params are given and `filter_or` is FALSE or not specified,
4106 # search params are combined in a logical AND operation.
4107 # Only rows that match *all* search param criteria will be returned.
4108 #
4109 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
4110 # Results will include rows that match **any** of the search criteria.
4111 #
4112 # String search params use case-insensitive matching.
4113 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
4114 # example="dan%" will match "danger" and "Danzig" but not "David"
4115 # example="D_m%" will match "Damage" and "dump"
4116 #
4117 # Integer search params can accept a single value or a comma separated list of values. The multiple
4118 # values will be combined under a logical OR operation - results will match at least one of
4119 # the given values.
4120 #
4121 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
4122 # or exclude (respectively) rows where the column is null.
4123 #
4124 # Boolean search params accept only "true" and "false" as values.
4125 #
4126 # GET /content_favorite/search -> Sequence[mdls.ContentFavorite]
4127 def search_content_favorites(
4128 self,
4129 # Match content favorite id(s)
4130 id: Optional[str] = None,
4131 # Match user id(s). To create a list of multiple ids, use commas as separators
4132 user_id: Optional[str] = None,
4133 # Match content metadata id(s). To create a list of multiple ids, use commas as separators
4134 content_metadata_id: Optional[str] = None,
4135 # Match dashboard id(s). To create a list of multiple ids, use commas as separators
4136 dashboard_id: Optional[str] = None,
4137 # Match look id(s). To create a list of multiple ids, use commas as separators
4138 look_id: Optional[str] = None,
4139 # Match board id(s). To create a list of multiple ids, use commas as separators
4140 board_id: Optional[str] = None,
4141 # Match lookml dashboard id(s). To create a list of multiple ids, use commas as separators
4142 lookml_dashboard_id: Optional[str] = None,
4143 # If true, and board_id is provided, returns the content favorites for all items on the board. If false, returns the content favorite for the board itself.
4144 include_board_items: Optional[bool] = None,
4145 # Number of results to return. (used with offset)
4146 limit: Optional[int] = None,
4147 # Number of results to skip before returning any. (used with limit)
4148 offset: Optional[int] = None,
4149 # Fields to sort by.
4150 sorts: Optional[str] = None,
4151 # Requested fields.
4152 fields: Optional[str] = None,
4153 # Combine given search criteria in a boolean OR expression
4154 filter_or: Optional[bool] = None,
4155 transport_options: Optional[transport.TransportOptions] = None,
4156 ) -> Sequence[mdls.ContentFavorite]:
4157 """Search Favorite Contents"""
4158 response = cast(
4159 Sequence[mdls.ContentFavorite],
4160 self.get(
4161 path="/content_favorite/search",
4162 structure=Sequence[mdls.ContentFavorite],
4163 query_params={
4164 "id": id,
4165 "user_id": user_id,
4166 "content_metadata_id": content_metadata_id,
4167 "dashboard_id": dashboard_id,
4168 "look_id": look_id,
4169 "board_id": board_id,
4170 "lookml_dashboard_id": lookml_dashboard_id,
4171 "include_board_items": include_board_items,
4172 "limit": limit,
4173 "offset": offset,
4174 "sorts": sorts,
4175 "fields": fields,
4176 "filter_or": filter_or,
4177 },
4178 transport_options=transport_options,
4179 ),
4180 )
4181 return response
4182
4183 # ### Get favorite content by its id
4184 #
4185 # GET /content_favorite/{content_favorite_id} -> mdls.ContentFavorite
4186 def content_favorite(
4187 self,
4188 # Id of favorite content
4189 content_favorite_id: str,
4190 # Requested fields.
4191 fields: Optional[str] = None,
4192 transport_options: Optional[transport.TransportOptions] = None,
4193 ) -> mdls.ContentFavorite:
4194 """Get Favorite Content"""
4195 content_favorite_id = self.encode_path_param(content_favorite_id)
4196 response = cast(
4197 mdls.ContentFavorite,
4198 self.get(
4199 path=f"/content_favorite/{content_favorite_id}",
4200 structure=mdls.ContentFavorite,
4201 query_params={"fields": fields},
4202 transport_options=transport_options,
4203 ),
4204 )
4205 return response
4206
4207 # ### Delete favorite content
4208 #
4209 # DELETE /content_favorite/{content_favorite_id} -> str
4210 def delete_content_favorite(
4211 self,
4212 # Id of favorite content
4213 content_favorite_id: str,
4214 transport_options: Optional[transport.TransportOptions] = None,
4215 ) -> str:
4216 """Delete Favorite Content"""
4217 content_favorite_id = self.encode_path_param(content_favorite_id)
4218 response = cast(
4219 str,
4220 self.delete(
4221 path=f"/content_favorite/{content_favorite_id}",
4222 structure=str,
4223 transport_options=transport_options,
4224 ),
4225 )
4226 return response
4227
4228 # ### Create favorite content
4229 #
4230 # POST /content_favorite -> mdls.ContentFavorite
4231 def create_content_favorite(
4232 self,
4233 body: mdls.WriteContentFavorite,
4234 transport_options: Optional[transport.TransportOptions] = None,
4235 ) -> mdls.ContentFavorite:
4236 """Create Favorite Content"""
4237 response = cast(
4238 mdls.ContentFavorite,
4239 self.post(
4240 path="/content_favorite",
4241 structure=mdls.ContentFavorite,
4242 body=body,
4243 transport_options=transport_options,
4244 ),
4245 )
4246 return response
4247
4248 # ### Get information about all content metadata in a space.
4249 #
4250 # GET /content_metadata -> Sequence[mdls.ContentMeta]
4251 def all_content_metadatas(
4252 self,
4253 # Parent space of content.
4254 parent_id: str,
4255 # Requested fields.
4256 fields: Optional[str] = None,
4257 transport_options: Optional[transport.TransportOptions] = None,
4258 ) -> Sequence[mdls.ContentMeta]:
4259 """Get All Content Metadatas"""
4260 response = cast(
4261 Sequence[mdls.ContentMeta],
4262 self.get(
4263 path="/content_metadata",
4264 structure=Sequence[mdls.ContentMeta],
4265 query_params={"parent_id": parent_id, "fields": fields},
4266 transport_options=transport_options,
4267 ),
4268 )
4269 return response
4270
4271 # ### Get information about an individual content metadata record.
4272 #
4273 # GET /content_metadata/{content_metadata_id} -> mdls.ContentMeta
4274 def content_metadata(
4275 self,
4276 # Id of content metadata
4277 content_metadata_id: str,
4278 # Requested fields.
4279 fields: Optional[str] = None,
4280 transport_options: Optional[transport.TransportOptions] = None,
4281 ) -> mdls.ContentMeta:
4282 """Get Content Metadata"""
4283 content_metadata_id = self.encode_path_param(content_metadata_id)
4284 response = cast(
4285 mdls.ContentMeta,
4286 self.get(
4287 path=f"/content_metadata/{content_metadata_id}",
4288 structure=mdls.ContentMeta,
4289 query_params={"fields": fields},
4290 transport_options=transport_options,
4291 ),
4292 )
4293 return response
4294
4295 # ### Move a piece of content.
4296 #
4297 # PATCH /content_metadata/{content_metadata_id} -> mdls.ContentMeta
4298 def update_content_metadata(
4299 self,
4300 # Id of content metadata
4301 content_metadata_id: str,
4302 body: mdls.WriteContentMeta,
4303 transport_options: Optional[transport.TransportOptions] = None,
4304 ) -> mdls.ContentMeta:
4305 """Update Content Metadata"""
4306 content_metadata_id = self.encode_path_param(content_metadata_id)
4307 response = cast(
4308 mdls.ContentMeta,
4309 self.patch(
4310 path=f"/content_metadata/{content_metadata_id}",
4311 structure=mdls.ContentMeta,
4312 body=body,
4313 transport_options=transport_options,
4314 ),
4315 )
4316 return response
4317
4318 # ### All content metadata access records for a content metadata item.
4319 #
4320 # GET /content_metadata_access -> Sequence[mdls.ContentMetaGroupUser]
4321 def all_content_metadata_accesses(
4322 self,
4323 # Id of content metadata
4324 content_metadata_id: str,
4325 # Requested fields.
4326 fields: Optional[str] = None,
4327 transport_options: Optional[transport.TransportOptions] = None,
4328 ) -> Sequence[mdls.ContentMetaGroupUser]:
4329 """Get All Content Metadata Accesses"""
4330 response = cast(
4331 Sequence[mdls.ContentMetaGroupUser],
4332 self.get(
4333 path="/content_metadata_access",
4334 structure=Sequence[mdls.ContentMetaGroupUser],
4335 query_params={
4336 "content_metadata_id": content_metadata_id,
4337 "fields": fields,
4338 },
4339 transport_options=transport_options,
4340 ),
4341 )
4342 return response
4343
4344 # ### Create content metadata access.
4345 #
4346 # POST /content_metadata_access -> mdls.ContentMetaGroupUser
4347 def create_content_metadata_access(
4348 self,
4349 # WARNING: no writeable properties found for POST, PUT, or PATCH
4350 body: mdls.ContentMetaGroupUser,
4351 # Optionally sends notification email when granting access to a board.
4352 send_boards_notification_email: Optional[bool] = None,
4353 transport_options: Optional[transport.TransportOptions] = None,
4354 ) -> mdls.ContentMetaGroupUser:
4355 """Create Content Metadata Access"""
4356 response = cast(
4357 mdls.ContentMetaGroupUser,
4358 self.post(
4359 path="/content_metadata_access",
4360 structure=mdls.ContentMetaGroupUser,
4361 query_params={
4362 "send_boards_notification_email": send_boards_notification_email
4363 },
4364 body=body,
4365 transport_options=transport_options,
4366 ),
4367 )
4368 return response
4369
4370 # ### Update type of access for content metadata.
4371 #
4372 # PUT /content_metadata_access/{content_metadata_access_id} -> mdls.ContentMetaGroupUser
4373 def update_content_metadata_access(
4374 self,
4375 # Id of content metadata access
4376 content_metadata_access_id: str,
4377 # WARNING: no writeable properties found for POST, PUT, or PATCH
4378 body: mdls.ContentMetaGroupUser,
4379 transport_options: Optional[transport.TransportOptions] = None,
4380 ) -> mdls.ContentMetaGroupUser:
4381 """Update Content Metadata Access"""
4382 content_metadata_access_id = self.encode_path_param(content_metadata_access_id)
4383 response = cast(
4384 mdls.ContentMetaGroupUser,
4385 self.put(
4386 path=f"/content_metadata_access/{content_metadata_access_id}",
4387 structure=mdls.ContentMetaGroupUser,
4388 body=body,
4389 transport_options=transport_options,
4390 ),
4391 )
4392 return response
4393
4394 # ### Remove content metadata access.
4395 #
4396 # DELETE /content_metadata_access/{content_metadata_access_id} -> str
4397 def delete_content_metadata_access(
4398 self,
4399 # Id of content metadata access
4400 content_metadata_access_id: str,
4401 transport_options: Optional[transport.TransportOptions] = None,
4402 ) -> str:
4403 """Delete Content Metadata Access"""
4404 content_metadata_access_id = self.encode_path_param(content_metadata_access_id)
4405 response = cast(
4406 str,
4407 self.delete(
4408 path=f"/content_metadata_access/{content_metadata_access_id}",
4409 structure=str,
4410 transport_options=transport_options,
4411 ),
4412 )
4413 return response
4414
4415 # ### Search across looks, dashboards, and lookml dashboards. The terms field will be matched against the
4416 # title and description of the content and the closest results are returned. Content that has been frequently
4417 # viewed and those pieces of content stored in public folders will be ranked more highly in the results.
4418 #
4419 # This endpoint does not return a full description of these content types. For more specific information
4420 # about each type please refer to the individual content specific API endpoints.
4421 #
4422 # Get the **full details** of a specific dashboard (or lookml dashboard) by id with [dashboard()](#!/Dashboard/dashboard)
4423 # Get the **full details** of a specific look by id with [look()](#!/Look/look)
4424 #
4425 # GET /content/{terms} -> Sequence[mdls.ContentSearch]
4426 def search_content(
4427 self,
4428 # Search terms
4429 terms: str,
4430 # Requested fields.
4431 fields: Optional[str] = None,
4432 # Content types requested (dashboard, look, lookml_dashboard).
4433 types: Optional[str] = None,
4434 # Number of results to return. (used with offset and takes priority over page and per_page)
4435 limit: Optional[int] = None,
4436 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
4437 offset: Optional[int] = None,
4438 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
4439 page: Optional[int] = None,
4440 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
4441 per_page: Optional[int] = None,
4442 transport_options: Optional[transport.TransportOptions] = None,
4443 ) -> Sequence[mdls.ContentSearch]:
4444 """Search Content"""
4445 terms = self.encode_path_param(terms)
4446 response = cast(
4447 Sequence[mdls.ContentSearch],
4448 self.get(
4449 path=f"/content/{terms}",
4450 structure=Sequence[mdls.ContentSearch],
4451 query_params={
4452 "fields": fields,
4453 "types": types,
4454 "limit": limit,
4455 "offset": offset,
4456 "page": page,
4457 "per_page": per_page,
4458 },
4459 transport_options=transport_options,
4460 ),
4461 )
4462 return response
4463
4464 # ### Get Content Summary
4465 #
4466 # Retrieves a collection of content items related to user activity and engagement, such as recently viewed content,
4467 # favorites and scheduled items.
4468 #
4469 # GET /content_summary -> Sequence[mdls.ContentSummary]
4470 def content_summary(
4471 self,
4472 # Comma-delimited names of fields to return in responses. Omit for all fields
4473 fields: Optional[str] = None,
4474 # Number of results to return. (used with offset)
4475 limit: Optional[int] = None,
4476 # Number of results to skip before returning any. (used with limit)
4477 offset: Optional[int] = None,
4478 # Match group id
4479 target_group_id: Optional[str] = None,
4480 # Match user id
4481 target_user_id: Optional[str] = None,
4482 # Content type to match, options are: look, dashboard. Can be provided as a comma delimited list.
4483 target_content_type: Optional[str] = None,
4484 # Fields to sort by
4485 sorts: Optional[str] = None,
4486 transport_options: Optional[transport.TransportOptions] = None,
4487 ) -> Sequence[mdls.ContentSummary]:
4488 """Search Content Summaries"""
4489 response = cast(
4490 Sequence[mdls.ContentSummary],
4491 self.get(
4492 path="/content_summary",
4493 structure=Sequence[mdls.ContentSummary],
4494 query_params={
4495 "fields": fields,
4496 "limit": limit,
4497 "offset": offset,
4498 "target_group_id": target_group_id,
4499 "target_user_id": target_user_id,
4500 "target_content_type": target_content_type,
4501 "sorts": sorts,
4502 },
4503 transport_options=transport_options,
4504 ),
4505 )
4506 return response
4507
4508 # ### Get an image representing the contents of a dashboard or look.
4509 #
4510 # The returned thumbnail is an abstract representation of the contents of a dashboard or look and does not
4511 # reflect the actual data displayed in the respective visualizations.
4512 #
4513 # GET /content_thumbnail/{type}/{resource_id} -> Union[str, bytes]
4514 def content_thumbnail(
4515 self,
4516 # Either dashboard or look
4517 type: str,
4518 # ID of the dashboard or look to render
4519 resource_id: str,
4520 # Whether or not to refresh the rendered image with the latest content
4521 reload: Optional[str] = None,
4522 # Light or dark background. Default is "light"
4523 theme: Optional[str] = None,
4524 # A value of png produces a thumbnail in PNG format instead of SVG (default)
4525 format: Optional[str] = None,
4526 # The width of the image if format is supplied
4527 width: Optional[int] = None,
4528 # The height of the image if format is supplied
4529 height: Optional[int] = None,
4530 transport_options: Optional[transport.TransportOptions] = None,
4531 ) -> Union[str, bytes]:
4532 """Get Content Thumbnail"""
4533 type = self.encode_path_param(type)
4534 resource_id = self.encode_path_param(resource_id)
4535 response = cast(
4536 Union[str, bytes],
4537 self.get(
4538 path=f"/content_thumbnail/{type}/{resource_id}",
4539 structure=Union[str, bytes], # type: ignore
4540 query_params={
4541 "reload": reload,
4542 "theme": theme,
4543 "format": format,
4544 "width": width,
4545 "height": height,
4546 },
4547 transport_options=transport_options,
4548 ),
4549 )
4550 return response
4551
4552 # ### Validate All Content
4553 #
4554 # Performs validation of all looks and dashboards
4555 # Returns a list of errors found as well as metadata about the content validation run.
4556 #
4557 # GET /content_validation -> mdls.ContentValidation
4558 def content_validation(
4559 self,
4560 # Requested fields.
4561 fields: Optional[str] = None,
4562 # Optional list of project names to filter by
4563 project_names: Optional[mdls.DelimSequence[str]] = None,
4564 # Optional list of space ids to filter by
4565 space_ids: Optional[mdls.DelimSequence[str]] = None,
4566 transport_options: Optional[transport.TransportOptions] = None,
4567 ) -> mdls.ContentValidation:
4568 """Validate Content"""
4569 response = cast(
4570 mdls.ContentValidation,
4571 self.get(
4572 path="/content_validation",
4573 structure=mdls.ContentValidation,
4574 query_params={
4575 "fields": fields,
4576 "project_names": project_names,
4577 "space_ids": space_ids,
4578 },
4579 transport_options=transport_options,
4580 ),
4581 )
4582 return response
4583
4584 # ### Search Content Views
4585 #
4586 # If multiple search params are given and `filter_or` is FALSE or not specified,
4587 # search params are combined in a logical AND operation.
4588 # Only rows that match *all* search param criteria will be returned.
4589 #
4590 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
4591 # Results will include rows that match **any** of the search criteria.
4592 #
4593 # String search params use case-insensitive matching.
4594 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
4595 # example="dan%" will match "danger" and "Danzig" but not "David"
4596 # example="D_m%" will match "Damage" and "dump"
4597 #
4598 # Integer search params can accept a single value or a comma separated list of values. The multiple
4599 # values will be combined under a logical OR operation - results will match at least one of
4600 # the given values.
4601 #
4602 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
4603 # or exclude (respectively) rows where the column is null.
4604 #
4605 # Boolean search params accept only "true" and "false" as values.
4606 #
4607 # GET /content_view/search -> Sequence[mdls.ContentView]
4608 def search_content_views(
4609 self,
4610 # Match view count
4611 view_count: Optional[str] = None,
4612 # Match Group Id
4613 group_id: Optional[str] = None,
4614 # Match look_id
4615 look_id: Optional[str] = None,
4616 # Match dashboard_id
4617 dashboard_id: Optional[str] = None,
4618 # Match content metadata id
4619 content_metadata_id: Optional[str] = None,
4620 # Match start of week date (format is "YYYY-MM-DD")
4621 start_of_week_date: Optional[str] = None,
4622 # True if only all time view records should be returned
4623 all_time: Optional[bool] = None,
4624 # Match user id
4625 user_id: Optional[str] = None,
4626 # Requested fields
4627 fields: Optional[str] = None,
4628 # Number of results to return. Use with `offset` to manage pagination of results
4629 limit: Optional[int] = None,
4630 # Number of results to skip before returning data
4631 offset: Optional[int] = None,
4632 # Fields to sort by
4633 sorts: Optional[str] = None,
4634 # Combine given search criteria in a boolean OR expression
4635 filter_or: Optional[bool] = None,
4636 transport_options: Optional[transport.TransportOptions] = None,
4637 ) -> Sequence[mdls.ContentView]:
4638 """Search Content Views"""
4639 response = cast(
4640 Sequence[mdls.ContentView],
4641 self.get(
4642 path="/content_view/search",
4643 structure=Sequence[mdls.ContentView],
4644 query_params={
4645 "view_count": view_count,
4646 "group_id": group_id,
4647 "look_id": look_id,
4648 "dashboard_id": dashboard_id,
4649 "content_metadata_id": content_metadata_id,
4650 "start_of_week_date": start_of_week_date,
4651 "all_time": all_time,
4652 "user_id": user_id,
4653 "fields": fields,
4654 "limit": limit,
4655 "offset": offset,
4656 "sorts": sorts,
4657 "filter_or": filter_or,
4658 },
4659 transport_options=transport_options,
4660 ),
4661 )
4662 return response
4663
4664 # ### Get a vector image representing the contents of a dashboard or look.
4665 #
4666 # # DEPRECATED: Use [content_thumbnail()](#!/Content/content_thumbnail)
4667 #
4668 # The returned thumbnail is an abstract representation of the contents of a dashboard or look and does not
4669 # reflect the actual data displayed in the respective visualizations.
4670 #
4671 # GET /vector_thumbnail/{type}/{resource_id} -> str
4672 def vector_thumbnail(
4673 self,
4674 # Either dashboard or look
4675 type: str,
4676 # ID of the dashboard or look to render
4677 resource_id: str,
4678 # Whether or not to refresh the rendered image with the latest content
4679 reload: Optional[str] = None,
4680 transport_options: Optional[transport.TransportOptions] = None,
4681 ) -> str:
4682 """Get Vector Thumbnail"""
4683 type = self.encode_path_param(type)
4684 resource_id = self.encode_path_param(resource_id)
4685 response = cast(
4686 str,
4687 self.get(
4688 path=f"/vector_thumbnail/{type}/{resource_id}",
4689 structure=str,
4690 query_params={"reload": reload},
4691 transport_options=transport_options,
4692 ),
4693 )
4694 return response
4695
4696 # endregion
4697
4698 # region Dashboard: Manage Dashboards
4699
4700 # ### Get information about all active dashboards.
4701 #
4702 # Returns an array of **abbreviated dashboard objects**. Dashboards marked as deleted are excluded from this list.
4703 #
4704 # Get the **full details** of a specific dashboard by id with [dashboard()](#!/Dashboard/dashboard)
4705 #
4706 # Find **deleted dashboards** with [search_dashboards()](#!/Dashboard/search_dashboards)
4707 #
4708 # GET /dashboards -> Sequence[mdls.DashboardBase]
4709 def all_dashboards(
4710 self,
4711 # Requested fields.
4712 fields: Optional[str] = None,
4713 transport_options: Optional[transport.TransportOptions] = None,
4714 ) -> Sequence[mdls.DashboardBase]:
4715 """Get All Dashboards"""
4716 response = cast(
4717 Sequence[mdls.DashboardBase],
4718 self.get(
4719 path="/dashboards",
4720 structure=Sequence[mdls.DashboardBase],
4721 query_params={"fields": fields},
4722 transport_options=transport_options,
4723 ),
4724 )
4725 return response
4726
4727 # ### Create a new dashboard
4728 #
4729 # Creates a new dashboard object and returns the details of the newly created dashboard.
4730 #
4731 # `Title` and `space_id` are required fields.
4732 # `Space_id` must contain the id of an existing space.
4733 # A dashboard's `title` must be unique within the space in which it resides.
4734 #
4735 # If you receive a 422 error response when creating a dashboard, be sure to look at the
4736 # response body for information about exactly which fields are missing or contain invalid data.
4737 #
4738 # You can **update** an existing dashboard with [update_dashboard()](#!/Dashboard/update_dashboard)
4739 #
4740 # You can **permanently delete** an existing dashboard with [delete_dashboard()](#!/Dashboard/delete_dashboard)
4741 #
4742 # POST /dashboards -> mdls.Dashboard
4743 def create_dashboard(
4744 self,
4745 body: mdls.WriteDashboard,
4746 transport_options: Optional[transport.TransportOptions] = None,
4747 ) -> mdls.Dashboard:
4748 """Create Dashboard"""
4749 response = cast(
4750 mdls.Dashboard,
4751 self.post(
4752 path="/dashboards",
4753 structure=mdls.Dashboard,
4754 body=body,
4755 transport_options=transport_options,
4756 ),
4757 )
4758 return response
4759
4760 # ### Search Dashboards
4761 #
4762 # Returns an array of **user-defined dashboard** objects that match the specified search criteria.
4763 # Note, [search_dashboards()](#!/Dashboard/search_dashboards) does not return LookML dashboard objects.
4764 #
4765 # If multiple search params are given and `filter_or` is FALSE or not specified,
4766 # search params are combined in a logical AND operation.
4767 # Only rows that match *all* search param criteria will be returned.
4768 #
4769 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
4770 # Results will include rows that match **any** of the search criteria.
4771 #
4772 # String search params use case-insensitive matching.
4773 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
4774 # example="dan%" will match "danger" and "Danzig" but not "David"
4775 # example="D_m%" will match "Damage" and "dump"
4776 #
4777 # Integer search params can accept a single value or a comma separated list of values. The multiple
4778 # values will be combined under a logical OR operation - results will match at least one of
4779 # the given values.
4780 #
4781 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
4782 # or exclude (respectively) rows where the column is null.
4783 #
4784 # Boolean search params accept only "true" and "false" as values.
4785 #
4786 #
4787 # The parameters `limit`, and `offset` are recommended for fetching results in page-size chunks.
4788 #
4789 # Get a **single dashboard** by id with [dashboard()](#!/Dashboard/dashboard)
4790 #
4791 # GET /dashboards/search -> Sequence[mdls.Dashboard]
4792 def search_dashboards(
4793 self,
4794 # Match dashboard id.
4795 id: Optional[str] = None,
4796 # Match dashboard slug.
4797 slug: Optional[str] = None,
4798 # Match Dashboard title.
4799 title: Optional[str] = None,
4800 # Match Dashboard description.
4801 description: Optional[str] = None,
4802 # Filter on a content favorite id.
4803 content_favorite_id: Optional[str] = None,
4804 # Filter on a particular folder.
4805 folder_id: Optional[str] = None,
4806 # Filter on dashboards deleted status.
4807 deleted: Optional[str] = None,
4808 # Filter on dashboards created by a particular user.
4809 user_id: Optional[str] = None,
4810 # Filter on a particular value of view_count
4811 view_count: Optional[str] = None,
4812 # Filter on a content favorite id.
4813 content_metadata_id: Optional[str] = None,
4814 # Exclude items that exist only in personal spaces other than the users
4815 curate: Optional[bool] = None,
4816 # Select dashboards based on when they were last viewed
4817 last_viewed_at: Optional[str] = None,
4818 # Requested fields.
4819 fields: Optional[str] = None,
4820 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
4821 page: Optional[int] = None,
4822 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
4823 per_page: Optional[int] = None,
4824 # Number of results to return. (used with offset and takes priority over page and per_page)
4825 limit: Optional[int] = None,
4826 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
4827 offset: Optional[int] = None,
4828 # 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, :certification_status]
4829 sorts: Optional[str] = None,
4830 # Combine given search criteria in a boolean OR expression
4831 filter_or: Optional[bool] = None,
4832 # Filter out the dashboards owned by the user passed at the :user_id params
4833 not_owned_by: Optional[bool] = None,
4834 transport_options: Optional[transport.TransportOptions] = None,
4835 ) -> Sequence[mdls.Dashboard]:
4836 """Search Dashboards"""
4837 response = cast(
4838 Sequence[mdls.Dashboard],
4839 self.get(
4840 path="/dashboards/search",
4841 structure=Sequence[mdls.Dashboard],
4842 query_params={
4843 "id": id,
4844 "slug": slug,
4845 "title": title,
4846 "description": description,
4847 "content_favorite_id": content_favorite_id,
4848 "folder_id": folder_id,
4849 "deleted": deleted,
4850 "user_id": user_id,
4851 "view_count": view_count,
4852 "content_metadata_id": content_metadata_id,
4853 "curate": curate,
4854 "last_viewed_at": last_viewed_at,
4855 "fields": fields,
4856 "page": page,
4857 "per_page": per_page,
4858 "limit": limit,
4859 "offset": offset,
4860 "sorts": sorts,
4861 "filter_or": filter_or,
4862 "not_owned_by": not_owned_by,
4863 },
4864 transport_options=transport_options,
4865 ),
4866 )
4867 return response
4868
4869 # ### Import a LookML dashboard to a space as a UDD
4870 # Creates a UDD (a dashboard which exists in the Looker database rather than as a LookML file) from the LookML dashboard
4871 # and places it in the space specified. The created UDD will have a lookml_link_id which links to the original LookML dashboard.
4872 #
4873 # To give the imported dashboard specify a (e.g. title: "my title") in the body of your request, otherwise the imported
4874 # dashboard will have the same title as the original LookML dashboard.
4875 #
4876 # For this operation to succeed the user must have permission to see the LookML dashboard in question, and have permission to
4877 # create content in the space the dashboard is being imported to.
4878 #
4879 # **Sync** a linked UDD with [sync_lookml_dashboard()](#!/Dashboard/sync_lookml_dashboard)
4880 # **Unlink** a linked UDD by setting lookml_link_id to null with [update_dashboard()](#!/Dashboard/update_dashboard)
4881 #
4882 # POST /dashboards/{lookml_dashboard_id}/import/{space_id} -> mdls.Dashboard
4883 def import_lookml_dashboard(
4884 self,
4885 # Id of LookML dashboard
4886 lookml_dashboard_id: str,
4887 # Id of space to import the dashboard to
4888 space_id: str,
4889 body: Optional[mdls.WriteDashboard] = None,
4890 # If true, and this dashboard is localized, export it with the raw keys, not localized.
4891 raw_locale: Optional[bool] = None,
4892 transport_options: Optional[transport.TransportOptions] = None,
4893 ) -> mdls.Dashboard:
4894 """Import LookML Dashboard"""
4895 lookml_dashboard_id = self.encode_path_param(lookml_dashboard_id)
4896 space_id = self.encode_path_param(space_id)
4897 response = cast(
4898 mdls.Dashboard,
4899 self.post(
4900 path=f"/dashboards/{lookml_dashboard_id}/import/{space_id}",
4901 structure=mdls.Dashboard,
4902 query_params={"raw_locale": raw_locale},
4903 body=body,
4904 transport_options=transport_options,
4905 ),
4906 )
4907 return response
4908
4909 # ### Update all linked dashboards to match the specified LookML dashboard.
4910 #
4911 # Any UDD (a dashboard which exists in the Looker database rather than as a LookML file) which has a `lookml_link_id`
4912 # 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.
4913 #
4914 # If the dashboard_ids parameter is specified, only the dashboards with the specified ids will be updated.
4915 #
4916 # For this operation to succeed the user must have permission to view the LookML dashboard, and only linked dashboards
4917 # that the user has permission to update will be synced.
4918 #
4919 # To **link** or **unlink** a UDD set the `lookml_link_id` property with [update_dashboard()](#!/Dashboard/update_dashboard)
4920 #
4921 # PATCH /dashboards/{lookml_dashboard_id}/sync -> Sequence[int]
4922 def sync_lookml_dashboard(
4923 self,
4924 # Id of LookML dashboard, in the form 'model::dashboardname'
4925 lookml_dashboard_id: str,
4926 # If true, and this dashboard is localized, export it with the raw keys, not localized.
4927 raw_locale: Optional[bool] = None,
4928 # An array of UDD dashboard IDs to sync. If not specified, all UDD dashboards will be synced.
4929 dashboard_ids: Optional[mdls.DelimSequence[str]] = None,
4930 transport_options: Optional[transport.TransportOptions] = None,
4931 ) -> Sequence[int]:
4932 """Sync LookML Dashboard"""
4933 lookml_dashboard_id = self.encode_path_param(lookml_dashboard_id)
4934 response = cast(
4935 Sequence[int],
4936 self.patch(
4937 path=f"/dashboards/{lookml_dashboard_id}/sync",
4938 structure=Sequence[int],
4939 query_params={"raw_locale": raw_locale, "dashboard_ids": dashboard_ids},
4940 transport_options=transport_options,
4941 ),
4942 )
4943 return response
4944
4945 # ### Get information about a dashboard
4946 #
4947 # Returns the full details of the identified dashboard object
4948 #
4949 # Get a **summary list** of all active dashboards with [all_dashboards()](#!/Dashboard/all_dashboards)
4950 #
4951 # You can **Search** for dashboards with [search_dashboards()](#!/Dashboard/search_dashboards)
4952 #
4953 # GET /dashboards/{dashboard_id} -> mdls.Dashboard
4954 def dashboard(
4955 self,
4956 # Id of dashboard
4957 dashboard_id: str,
4958 # Requested fields.
4959 fields: Optional[str] = None,
4960 transport_options: Optional[transport.TransportOptions] = None,
4961 ) -> mdls.Dashboard:
4962 """Get Dashboard"""
4963 dashboard_id = self.encode_path_param(dashboard_id)
4964 response = cast(
4965 mdls.Dashboard,
4966 self.get(
4967 path=f"/dashboards/{dashboard_id}",
4968 structure=mdls.Dashboard,
4969 query_params={"fields": fields},
4970 transport_options=transport_options,
4971 ),
4972 )
4973 return response
4974
4975 # ### Update a dashboard
4976 #
4977 # You can use this function to change the string and integer properties of
4978 # a dashboard. Nested objects such as filters, dashboard elements, or dashboard layout components
4979 # cannot be modified by this function - use the update functions for the respective
4980 # nested object types (like [update_dashboard_filter()](#!/Dashboard/update_dashboard_filter) to change a filter)
4981 # to modify nested objects referenced by a dashboard.
4982 #
4983 # If you receive a 422 error response when updating a dashboard, be sure to look at the
4984 # response body for information about exactly which fields are missing or contain invalid data.
4985 #
4986 # PATCH /dashboards/{dashboard_id} -> mdls.Dashboard
4987 def update_dashboard(
4988 self,
4989 # Id of dashboard
4990 dashboard_id: str,
4991 body: mdls.WriteDashboard,
4992 transport_options: Optional[transport.TransportOptions] = None,
4993 ) -> mdls.Dashboard:
4994 """Update Dashboard"""
4995 dashboard_id = self.encode_path_param(dashboard_id)
4996 response = cast(
4997 mdls.Dashboard,
4998 self.patch(
4999 path=f"/dashboards/{dashboard_id}",
5000 structure=mdls.Dashboard,
5001 body=body,
5002 transport_options=transport_options,
5003 ),
5004 )
5005 return response
5006
5007 # ### Delete the dashboard with the specified id
5008 #
5009 # Permanently **deletes** a dashboard. (The dashboard cannot be recovered after this operation.)
5010 #
5011 # "Soft" delete or hide a dashboard by setting its `deleted` status to `True` with [update_dashboard()](#!/Dashboard/update_dashboard).
5012 #
5013 # Note: When a dashboard is deleted in the UI, it is soft deleted. Use this API call to permanently remove it, if desired.
5014 #
5015 # DELETE /dashboards/{dashboard_id} -> str
5016 def delete_dashboard(
5017 self,
5018 # Id of dashboard
5019 dashboard_id: str,
5020 transport_options: Optional[transport.TransportOptions] = None,
5021 ) -> str:
5022 """Delete Dashboard"""
5023 dashboard_id = self.encode_path_param(dashboard_id)
5024 response = cast(
5025 str,
5026 self.delete(
5027 path=f"/dashboards/{dashboard_id}",
5028 structure=str,
5029 transport_options=transport_options,
5030 ),
5031 )
5032 return response
5033
5034 # ### Get Aggregate Table LookML for Each Query on a Dashboard
5035 #
5036 # Returns a JSON object that contains the dashboard id and Aggregate Table lookml
5037 #
5038 # GET /dashboards/aggregate_table_lookml/{dashboard_id} -> mdls.DashboardAggregateTableLookml
5039 def dashboard_aggregate_table_lookml(
5040 self,
5041 # Id of dashboard
5042 dashboard_id: str,
5043 transport_options: Optional[transport.TransportOptions] = None,
5044 ) -> mdls.DashboardAggregateTableLookml:
5045 """Get Aggregate Table LookML for a dashboard"""
5046 dashboard_id = self.encode_path_param(dashboard_id)
5047 response = cast(
5048 mdls.DashboardAggregateTableLookml,
5049 self.get(
5050 path=f"/dashboards/aggregate_table_lookml/{dashboard_id}",
5051 structure=mdls.DashboardAggregateTableLookml,
5052 transport_options=transport_options,
5053 ),
5054 )
5055 return response
5056
5057 # ### Search LookML Dashboards
5058 #
5059 # Returns an array of **LookML Dashboard** objects that match the specified search criteria.
5060 # Note, this only returns LookML Dashboards in production.
5061 #
5062 # If multiple search params are given and `filter_or` is FALSE or not specified,
5063 # search params are combined in a logical AND operation.
5064 # Only rows that match *all* search param criteria will be returned.
5065 #
5066 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
5067 # Results will include rows that match **any** of the search criteria.
5068 #
5069 # String search params use case-insensitive matching.
5070 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
5071 # example="dan%" will match "danger" and "Danzig" but not "David"
5072 # example="D_m%" will match "Damage" and "dump"
5073 #
5074 # Integer search params can accept a single value or a comma separated list of values. The multiple
5075 # values will be combined under a logical OR operation - results will match at least one of
5076 # the given values.
5077 #
5078 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
5079 # or exclude (respectively) rows where the column is null.
5080 #
5081 # Boolean search params accept only "true" and "false" as values.
5082 #
5083 #
5084 # The parameters `limit`, and `offset` are recommended for fetching results in page-size chunks.
5085 #
5086 # Get a **single LookML dashboard** by id with [dashboard_lookml()](#!/Dashboard/dashboard_lookml)
5087 #
5088 # GET /dashboards/lookml/search -> mdls.DashboardLookml
5089 def search_lookml_dashboards(
5090 self,
5091 # Filter on a particular folder.
5092 folder_id: Optional[str] = None,
5093 # Match LookML Dashboard title.
5094 title: Optional[str] = None,
5095 # Filter on a content favorite id.
5096 content_favorite_id: Optional[str] = None,
5097 # Requested fields.
5098 fields: Optional[str] = None,
5099 # Number of results to return. (used with offset and takes priority over page and per_page)
5100 limit: Optional[int] = None,
5101 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
5102 offset: Optional[int] = None,
5103 # One or more fields to sort by. Sortable fields: [:title, :id, :folder_id, :content_favorite_id, :content_metadata_id, :certification_status]
5104 sorts: Optional[str] = None,
5105 transport_options: Optional[transport.TransportOptions] = None,
5106 ) -> mdls.DashboardLookml:
5107 """Search LookML Dashboards"""
5108 response = cast(
5109 mdls.DashboardLookml,
5110 self.get(
5111 path="/dashboards/lookml/search",
5112 structure=mdls.DashboardLookml,
5113 query_params={
5114 "folder_id": folder_id,
5115 "title": title,
5116 "content_favorite_id": content_favorite_id,
5117 "fields": fields,
5118 "limit": limit,
5119 "offset": offset,
5120 "sorts": sorts,
5121 },
5122 transport_options=transport_options,
5123 ),
5124 )
5125 return response
5126
5127 # ### Get lookml of a UDD
5128 #
5129 # Returns a JSON object that contains the dashboard id and the full lookml
5130 #
5131 # GET /dashboards/lookml/{dashboard_id} -> mdls.DashboardLookml
5132 def dashboard_lookml(
5133 self,
5134 # Id of dashboard
5135 dashboard_id: str,
5136 transport_options: Optional[transport.TransportOptions] = None,
5137 ) -> mdls.DashboardLookml:
5138 """Get lookml of a UDD"""
5139 dashboard_id = self.encode_path_param(dashboard_id)
5140 response = cast(
5141 mdls.DashboardLookml,
5142 self.get(
5143 path=f"/dashboards/lookml/{dashboard_id}",
5144 structure=mdls.DashboardLookml,
5145 transport_options=transport_options,
5146 ),
5147 )
5148 return response
5149
5150 # ### Move an existing dashboard
5151 #
5152 # Moves a dashboard to a specified folder, and returns the moved dashboard.
5153 #
5154 # `dashboard_id` and `folder_id` are required.
5155 # `dashboard_id` and `folder_id` must already exist, and `folder_id` must be different from the current `folder_id` of the dashboard.
5156 #
5157 # PATCH /dashboards/{dashboard_id}/move -> mdls.Dashboard
5158 def move_dashboard(
5159 self,
5160 # Dashboard id to move.
5161 dashboard_id: str,
5162 # Folder id to move to.
5163 folder_id: str,
5164 transport_options: Optional[transport.TransportOptions] = None,
5165 ) -> mdls.Dashboard:
5166 """Move Dashboard"""
5167 dashboard_id = self.encode_path_param(dashboard_id)
5168 response = cast(
5169 mdls.Dashboard,
5170 self.patch(
5171 path=f"/dashboards/{dashboard_id}/move",
5172 structure=mdls.Dashboard,
5173 query_params={"folder_id": folder_id},
5174 transport_options=transport_options,
5175 ),
5176 )
5177 return response
5178
5179 # ### Creates a dashboard object based on LookML Dashboard YAML, and returns the details of the newly created dashboard.
5180 #
5181 # If a dashboard exists with the YAML-defined "preferred_slug", the new dashboard will overwrite it. Otherwise, a new
5182 # dashboard will be created. Note that when a dashboard is overwritten, alerts will not be maintained.
5183 #
5184 # If a folder_id is specified: new dashboards will be placed in that folder, and overwritten dashboards will be moved to it
5185 # If the folder_id isn't specified: new dashboards will be placed in the caller's personal folder, and overwritten dashboards
5186 # will remain where they were
5187 #
5188 # LookML must contain valid LookML YAML code. It's recommended to use the LookML format returned
5189 # from [dashboard_lookml()](#!/Dashboard/dashboard_lookml) as the input LookML (newlines replaced with
5190 # ).
5191 #
5192 # Note that the created dashboard is not linked to any LookML Dashboard,
5193 # i.e. [sync_lookml_dashboard()](#!/Dashboard/sync_lookml_dashboard) will not update dashboards created by this method.
5194 #
5195 # POST /dashboards/lookml -> mdls.Dashboard
5196 def import_dashboard_from_lookml(
5197 self,
5198 body: mdls.WriteDashboardLookml,
5199 transport_options: Optional[transport.TransportOptions] = None,
5200 ) -> mdls.Dashboard:
5201 """Import Dashboard from LookML"""
5202 response = cast(
5203 mdls.Dashboard,
5204 self.post(
5205 path="/dashboards/lookml",
5206 structure=mdls.Dashboard,
5207 body=body,
5208 transport_options=transport_options,
5209 ),
5210 )
5211 return response
5212
5213 # # DEPRECATED: Use [import_dashboard_from_lookml()](#!/Dashboard/import_dashboard_from_lookml)
5214 #
5215 # POST /dashboards/from_lookml -> mdls.Dashboard
5216 def create_dashboard_from_lookml(
5217 self,
5218 body: mdls.WriteDashboardLookml,
5219 transport_options: Optional[transport.TransportOptions] = None,
5220 ) -> mdls.Dashboard:
5221 """Create Dashboard from LookML"""
5222 response = cast(
5223 mdls.Dashboard,
5224 self.post(
5225 path="/dashboards/from_lookml",
5226 structure=mdls.Dashboard,
5227 body=body,
5228 transport_options=transport_options,
5229 ),
5230 )
5231 return response
5232
5233 # ### Copy an existing dashboard
5234 #
5235 # Creates a copy of an existing dashboard, in a specified folder, and returns the copied dashboard.
5236 #
5237 # `dashboard_id` is required, `dashboard_id` and `folder_id` must already exist if specified.
5238 # `folder_id` will default to the existing folder.
5239 #
5240 # If a dashboard with the same title already exists in the target folder, the copy will have '(copy)'
5241 # or '(copy <# of copies>)' appended.
5242 #
5243 # POST /dashboards/{dashboard_id}/copy -> mdls.Dashboard
5244 def copy_dashboard(
5245 self,
5246 # Dashboard id to copy.
5247 dashboard_id: str,
5248 # Folder id to copy to.
5249 folder_id: Optional[str] = None,
5250 transport_options: Optional[transport.TransportOptions] = None,
5251 ) -> mdls.Dashboard:
5252 """Copy Dashboard"""
5253 dashboard_id = self.encode_path_param(dashboard_id)
5254 response = cast(
5255 mdls.Dashboard,
5256 self.post(
5257 path=f"/dashboards/{dashboard_id}/copy",
5258 structure=mdls.Dashboard,
5259 query_params={"folder_id": folder_id},
5260 transport_options=transport_options,
5261 ),
5262 )
5263 return response
5264
5265 # ### Update dashboard certification
5266 #
5267 # PATCH /dashboards/{dashboard_id}/certification -> mdls.Dashboard
5268 def update_dashboard_certification(
5269 self,
5270 # Dashboard id to update certification.
5271 dashboard_id: str,
5272 body: mdls.WriteCertification,
5273 transport_options: Optional[transport.TransportOptions] = None,
5274 ) -> mdls.Dashboard:
5275 """Update Dashboard Certification"""
5276 dashboard_id = self.encode_path_param(dashboard_id)
5277 response = cast(
5278 mdls.Dashboard,
5279 self.patch(
5280 path=f"/dashboards/{dashboard_id}/certification",
5281 structure=mdls.Dashboard,
5282 body=body,
5283 transport_options=transport_options,
5284 ),
5285 )
5286 return response
5287
5288 # ### Update LookML dashboard certification
5289 #
5290 # PATCH /dashboards/lookml/{dashboard_id}/certification -> mdls.Dashboard
5291 def update_lookml_certification(
5292 self,
5293 # LookML Dashboard id to update certification.
5294 dashboard_id: str,
5295 body: mdls.WriteCertification,
5296 transport_options: Optional[transport.TransportOptions] = None,
5297 ) -> mdls.Dashboard:
5298 """Update LookML Dashboard Certification"""
5299 dashboard_id = self.encode_path_param(dashboard_id)
5300 response = cast(
5301 mdls.Dashboard,
5302 self.patch(
5303 path=f"/dashboards/lookml/{dashboard_id}/certification",
5304 structure=mdls.Dashboard,
5305 body=body,
5306 transport_options=transport_options,
5307 ),
5308 )
5309 return response
5310
5311 # ### Search Dashboard Elements
5312 #
5313 # Returns an **array of DashboardElement objects** that match the specified search criteria.
5314 #
5315 # If multiple search params are given and `filter_or` is FALSE or not specified,
5316 # search params are combined in a logical AND operation.
5317 # Only rows that match *all* search param criteria will be returned.
5318 #
5319 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
5320 # Results will include rows that match **any** of the search criteria.
5321 #
5322 # String search params use case-insensitive matching.
5323 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
5324 # example="dan%" will match "danger" and "Danzig" but not "David"
5325 # example="D_m%" will match "Damage" and "dump"
5326 #
5327 # Integer search params can accept a single value or a comma separated list of values. The multiple
5328 # values will be combined under a logical OR operation - results will match at least one of
5329 # the given values.
5330 #
5331 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
5332 # or exclude (respectively) rows where the column is null.
5333 #
5334 # Boolean search params accept only "true" and "false" as values.
5335 #
5336 # GET /dashboard_elements/search -> Sequence[mdls.DashboardElement]
5337 def search_dashboard_elements(
5338 self,
5339 # Select elements that refer to a given dashboard id
5340 dashboard_id: Optional[str] = None,
5341 # Select elements that refer to a given look id
5342 look_id: Optional[str] = None,
5343 # Match the title of element
5344 title: Optional[str] = None,
5345 # Select soft-deleted dashboard elements
5346 deleted: Optional[bool] = None,
5347 # Requested fields.
5348 fields: Optional[str] = None,
5349 # Combine given search criteria in a boolean OR expression
5350 filter_or: Optional[bool] = None,
5351 # Fields to sort by. Sortable fields: [:look_id, :dashboard_id, :deleted, :title]
5352 sorts: Optional[str] = None,
5353 transport_options: Optional[transport.TransportOptions] = None,
5354 ) -> Sequence[mdls.DashboardElement]:
5355 """Search Dashboard Elements"""
5356 response = cast(
5357 Sequence[mdls.DashboardElement],
5358 self.get(
5359 path="/dashboard_elements/search",
5360 structure=Sequence[mdls.DashboardElement],
5361 query_params={
5362 "dashboard_id": dashboard_id,
5363 "look_id": look_id,
5364 "title": title,
5365 "deleted": deleted,
5366 "fields": fields,
5367 "filter_or": filter_or,
5368 "sorts": sorts,
5369 },
5370 transport_options=transport_options,
5371 ),
5372 )
5373 return response
5374
5375 # ### Get information about the dashboard element with a specific id.
5376 #
5377 # GET /dashboard_elements/{dashboard_element_id} -> mdls.DashboardElement
5378 def dashboard_element(
5379 self,
5380 # Id of dashboard element
5381 dashboard_element_id: str,
5382 # Requested fields.
5383 fields: Optional[str] = None,
5384 transport_options: Optional[transport.TransportOptions] = None,
5385 ) -> mdls.DashboardElement:
5386 """Get DashboardElement"""
5387 dashboard_element_id = self.encode_path_param(dashboard_element_id)
5388 response = cast(
5389 mdls.DashboardElement,
5390 self.get(
5391 path=f"/dashboard_elements/{dashboard_element_id}",
5392 structure=mdls.DashboardElement,
5393 query_params={"fields": fields},
5394 transport_options=transport_options,
5395 ),
5396 )
5397 return response
5398
5399 # ### Update the dashboard element with a specific id.
5400 #
5401 # PATCH /dashboard_elements/{dashboard_element_id} -> mdls.DashboardElement
5402 def update_dashboard_element(
5403 self,
5404 # Id of dashboard element
5405 dashboard_element_id: str,
5406 body: mdls.WriteDashboardElement,
5407 # Requested fields.
5408 fields: Optional[str] = None,
5409 transport_options: Optional[transport.TransportOptions] = None,
5410 ) -> mdls.DashboardElement:
5411 """Update DashboardElement"""
5412 dashboard_element_id = self.encode_path_param(dashboard_element_id)
5413 response = cast(
5414 mdls.DashboardElement,
5415 self.patch(
5416 path=f"/dashboard_elements/{dashboard_element_id}",
5417 structure=mdls.DashboardElement,
5418 query_params={"fields": fields},
5419 body=body,
5420 transport_options=transport_options,
5421 ),
5422 )
5423 return response
5424
5425 # ### Delete a dashboard element with a specific id.
5426 #
5427 # DELETE /dashboard_elements/{dashboard_element_id} -> str
5428 def delete_dashboard_element(
5429 self,
5430 # Id of dashboard element
5431 dashboard_element_id: str,
5432 transport_options: Optional[transport.TransportOptions] = None,
5433 ) -> str:
5434 """Delete DashboardElement"""
5435 dashboard_element_id = self.encode_path_param(dashboard_element_id)
5436 response = cast(
5437 str,
5438 self.delete(
5439 path=f"/dashboard_elements/{dashboard_element_id}",
5440 structure=str,
5441 transport_options=transport_options,
5442 ),
5443 )
5444 return response
5445
5446 # ### Get information about all the dashboard elements on a dashboard with a specific id.
5447 #
5448 # GET /dashboards/{dashboard_id}/dashboard_elements -> Sequence[mdls.DashboardElement]
5449 def dashboard_dashboard_elements(
5450 self,
5451 # Id of dashboard
5452 dashboard_id: str,
5453 # Requested fields.
5454 fields: Optional[str] = None,
5455 transport_options: Optional[transport.TransportOptions] = None,
5456 ) -> Sequence[mdls.DashboardElement]:
5457 """Get All DashboardElements"""
5458 dashboard_id = self.encode_path_param(dashboard_id)
5459 response = cast(
5460 Sequence[mdls.DashboardElement],
5461 self.get(
5462 path=f"/dashboards/{dashboard_id}/dashboard_elements",
5463 structure=Sequence[mdls.DashboardElement],
5464 query_params={"fields": fields},
5465 transport_options=transport_options,
5466 ),
5467 )
5468 return response
5469
5470 # ### Create a dashboard element on the dashboard with a specific id.
5471 #
5472 # POST /dashboard_elements -> mdls.DashboardElement
5473 def create_dashboard_element(
5474 self,
5475 body: mdls.WriteDashboardElement,
5476 # Requested fields.
5477 fields: Optional[str] = None,
5478 # Apply relevant filters on dashboard to this tile
5479 apply_filters: Optional[bool] = None,
5480 transport_options: Optional[transport.TransportOptions] = None,
5481 ) -> mdls.DashboardElement:
5482 """Create DashboardElement"""
5483 response = cast(
5484 mdls.DashboardElement,
5485 self.post(
5486 path="/dashboard_elements",
5487 structure=mdls.DashboardElement,
5488 query_params={"fields": fields, "apply_filters": apply_filters},
5489 body=body,
5490 transport_options=transport_options,
5491 ),
5492 )
5493 return response
5494
5495 # ### Get information about the dashboard filters with a specific id.
5496 #
5497 # GET /dashboard_filters/{dashboard_filter_id} -> mdls.DashboardFilter
5498 def dashboard_filter(
5499 self,
5500 # Id of dashboard filters
5501 dashboard_filter_id: str,
5502 # Requested fields.
5503 fields: Optional[str] = None,
5504 transport_options: Optional[transport.TransportOptions] = None,
5505 ) -> mdls.DashboardFilter:
5506 """Get Dashboard Filter"""
5507 dashboard_filter_id = self.encode_path_param(dashboard_filter_id)
5508 response = cast(
5509 mdls.DashboardFilter,
5510 self.get(
5511 path=f"/dashboard_filters/{dashboard_filter_id}",
5512 structure=mdls.DashboardFilter,
5513 query_params={"fields": fields},
5514 transport_options=transport_options,
5515 ),
5516 )
5517 return response
5518
5519 # ### Update the dashboard filter with a specific id.
5520 #
5521 # PATCH /dashboard_filters/{dashboard_filter_id} -> mdls.DashboardFilter
5522 def update_dashboard_filter(
5523 self,
5524 # Id of dashboard filter
5525 dashboard_filter_id: str,
5526 body: mdls.WriteDashboardFilter,
5527 # Requested fields.
5528 fields: Optional[str] = None,
5529 transport_options: Optional[transport.TransportOptions] = None,
5530 ) -> mdls.DashboardFilter:
5531 """Update Dashboard Filter"""
5532 dashboard_filter_id = self.encode_path_param(dashboard_filter_id)
5533 response = cast(
5534 mdls.DashboardFilter,
5535 self.patch(
5536 path=f"/dashboard_filters/{dashboard_filter_id}",
5537 structure=mdls.DashboardFilter,
5538 query_params={"fields": fields},
5539 body=body,
5540 transport_options=transport_options,
5541 ),
5542 )
5543 return response
5544
5545 # ### Delete a dashboard filter with a specific id.
5546 #
5547 # DELETE /dashboard_filters/{dashboard_filter_id} -> str
5548 def delete_dashboard_filter(
5549 self,
5550 # Id of dashboard filter
5551 dashboard_filter_id: str,
5552 transport_options: Optional[transport.TransportOptions] = None,
5553 ) -> str:
5554 """Delete Dashboard Filter"""
5555 dashboard_filter_id = self.encode_path_param(dashboard_filter_id)
5556 response = cast(
5557 str,
5558 self.delete(
5559 path=f"/dashboard_filters/{dashboard_filter_id}",
5560 structure=str,
5561 transport_options=transport_options,
5562 ),
5563 )
5564 return response
5565
5566 # ### Get information about all the dashboard filters on a dashboard with a specific id.
5567 #
5568 # GET /dashboards/{dashboard_id}/dashboard_filters -> Sequence[mdls.DashboardFilter]
5569 def dashboard_dashboard_filters(
5570 self,
5571 # Id of dashboard
5572 dashboard_id: str,
5573 # Requested fields.
5574 fields: Optional[str] = None,
5575 transport_options: Optional[transport.TransportOptions] = None,
5576 ) -> Sequence[mdls.DashboardFilter]:
5577 """Get All Dashboard Filters"""
5578 dashboard_id = self.encode_path_param(dashboard_id)
5579 response = cast(
5580 Sequence[mdls.DashboardFilter],
5581 self.get(
5582 path=f"/dashboards/{dashboard_id}/dashboard_filters",
5583 structure=Sequence[mdls.DashboardFilter],
5584 query_params={"fields": fields},
5585 transport_options=transport_options,
5586 ),
5587 )
5588 return response
5589
5590 # ### Create a dashboard filter on the dashboard with a specific id.
5591 #
5592 # POST /dashboard_filters -> mdls.DashboardFilter
5593 def create_dashboard_filter(
5594 self,
5595 body: mdls.WriteCreateDashboardFilter,
5596 # Requested fields
5597 fields: Optional[str] = None,
5598 transport_options: Optional[transport.TransportOptions] = None,
5599 ) -> mdls.DashboardFilter:
5600 """Create Dashboard Filter"""
5601 response = cast(
5602 mdls.DashboardFilter,
5603 self.post(
5604 path="/dashboard_filters",
5605 structure=mdls.DashboardFilter,
5606 query_params={"fields": fields},
5607 body=body,
5608 transport_options=transport_options,
5609 ),
5610 )
5611 return response
5612
5613 # ### Get information about the dashboard elements with a specific id.
5614 #
5615 # GET /dashboard_layout_components/{dashboard_layout_component_id} -> mdls.DashboardLayoutComponent
5616 def dashboard_layout_component(
5617 self,
5618 # Id of dashboard layout component
5619 dashboard_layout_component_id: str,
5620 # Requested fields.
5621 fields: Optional[str] = None,
5622 transport_options: Optional[transport.TransportOptions] = None,
5623 ) -> mdls.DashboardLayoutComponent:
5624 """Get DashboardLayoutComponent"""
5625 dashboard_layout_component_id = self.encode_path_param(
5626 dashboard_layout_component_id
5627 )
5628 response = cast(
5629 mdls.DashboardLayoutComponent,
5630 self.get(
5631 path=f"/dashboard_layout_components/{dashboard_layout_component_id}",
5632 structure=mdls.DashboardLayoutComponent,
5633 query_params={"fields": fields},
5634 transport_options=transport_options,
5635 ),
5636 )
5637 return response
5638
5639 # ### Update the dashboard element with a specific id.
5640 #
5641 # PATCH /dashboard_layout_components/{dashboard_layout_component_id} -> mdls.DashboardLayoutComponent
5642 def update_dashboard_layout_component(
5643 self,
5644 # Id of dashboard layout component
5645 dashboard_layout_component_id: str,
5646 body: mdls.WriteDashboardLayoutComponent,
5647 # Requested fields.
5648 fields: Optional[str] = None,
5649 transport_options: Optional[transport.TransportOptions] = None,
5650 ) -> mdls.DashboardLayoutComponent:
5651 """Update DashboardLayoutComponent"""
5652 dashboard_layout_component_id = self.encode_path_param(
5653 dashboard_layout_component_id
5654 )
5655 response = cast(
5656 mdls.DashboardLayoutComponent,
5657 self.patch(
5658 path=f"/dashboard_layout_components/{dashboard_layout_component_id}",
5659 structure=mdls.DashboardLayoutComponent,
5660 query_params={"fields": fields},
5661 body=body,
5662 transport_options=transport_options,
5663 ),
5664 )
5665 return response
5666
5667 # ### Get information about all the dashboard layout components for a dashboard layout with a specific id.
5668 #
5669 # GET /dashboard_layouts/{dashboard_layout_id}/dashboard_layout_components -> Sequence[mdls.DashboardLayoutComponent]
5670 def dashboard_layout_dashboard_layout_components(
5671 self,
5672 # Id of dashboard layout component
5673 dashboard_layout_id: str,
5674 # Requested fields.
5675 fields: Optional[str] = None,
5676 transport_options: Optional[transport.TransportOptions] = None,
5677 ) -> Sequence[mdls.DashboardLayoutComponent]:
5678 """Get All DashboardLayoutComponents"""
5679 dashboard_layout_id = self.encode_path_param(dashboard_layout_id)
5680 response = cast(
5681 Sequence[mdls.DashboardLayoutComponent],
5682 self.get(
5683 path=f"/dashboard_layouts/{dashboard_layout_id}/dashboard_layout_components",
5684 structure=Sequence[mdls.DashboardLayoutComponent],
5685 query_params={"fields": fields},
5686 transport_options=transport_options,
5687 ),
5688 )
5689 return response
5690
5691 # ### Get information about the dashboard layouts with a specific id.
5692 #
5693 # GET /dashboard_layouts/{dashboard_layout_id} -> mdls.DashboardLayout
5694 def dashboard_layout(
5695 self,
5696 # Id of dashboard layouts
5697 dashboard_layout_id: str,
5698 # Requested fields.
5699 fields: Optional[str] = None,
5700 transport_options: Optional[transport.TransportOptions] = None,
5701 ) -> mdls.DashboardLayout:
5702 """Get DashboardLayout"""
5703 dashboard_layout_id = self.encode_path_param(dashboard_layout_id)
5704 response = cast(
5705 mdls.DashboardLayout,
5706 self.get(
5707 path=f"/dashboard_layouts/{dashboard_layout_id}",
5708 structure=mdls.DashboardLayout,
5709 query_params={"fields": fields},
5710 transport_options=transport_options,
5711 ),
5712 )
5713 return response
5714
5715 # ### Update the dashboard layout with a specific id.
5716 #
5717 # PATCH /dashboard_layouts/{dashboard_layout_id} -> mdls.DashboardLayout
5718 def update_dashboard_layout(
5719 self,
5720 # Id of dashboard layout
5721 dashboard_layout_id: str,
5722 body: mdls.WriteDashboardLayout,
5723 # Requested fields.
5724 fields: Optional[str] = None,
5725 transport_options: Optional[transport.TransportOptions] = None,
5726 ) -> mdls.DashboardLayout:
5727 """Update DashboardLayout"""
5728 dashboard_layout_id = self.encode_path_param(dashboard_layout_id)
5729 response = cast(
5730 mdls.DashboardLayout,
5731 self.patch(
5732 path=f"/dashboard_layouts/{dashboard_layout_id}",
5733 structure=mdls.DashboardLayout,
5734 query_params={"fields": fields},
5735 body=body,
5736 transport_options=transport_options,
5737 ),
5738 )
5739 return response
5740
5741 # ### Delete a dashboard layout with a specific id.
5742 #
5743 # DELETE /dashboard_layouts/{dashboard_layout_id} -> str
5744 def delete_dashboard_layout(
5745 self,
5746 # Id of dashboard layout
5747 dashboard_layout_id: str,
5748 transport_options: Optional[transport.TransportOptions] = None,
5749 ) -> str:
5750 """Delete DashboardLayout"""
5751 dashboard_layout_id = self.encode_path_param(dashboard_layout_id)
5752 response = cast(
5753 str,
5754 self.delete(
5755 path=f"/dashboard_layouts/{dashboard_layout_id}",
5756 structure=str,
5757 transport_options=transport_options,
5758 ),
5759 )
5760 return response
5761
5762 # ### Get information about all the dashboard elements on a dashboard with a specific id.
5763 #
5764 # GET /dashboards/{dashboard_id}/dashboard_layouts -> Sequence[mdls.DashboardLayout]
5765 def dashboard_dashboard_layouts(
5766 self,
5767 # Id of dashboard
5768 dashboard_id: str,
5769 # Requested fields.
5770 fields: Optional[str] = None,
5771 transport_options: Optional[transport.TransportOptions] = None,
5772 ) -> Sequence[mdls.DashboardLayout]:
5773 """Get All DashboardLayouts"""
5774 dashboard_id = self.encode_path_param(dashboard_id)
5775 response = cast(
5776 Sequence[mdls.DashboardLayout],
5777 self.get(
5778 path=f"/dashboards/{dashboard_id}/dashboard_layouts",
5779 structure=Sequence[mdls.DashboardLayout],
5780 query_params={"fields": fields},
5781 transport_options=transport_options,
5782 ),
5783 )
5784 return response
5785
5786 # ### Create a dashboard layout on the dashboard with a specific id.
5787 #
5788 # POST /dashboard_layouts -> mdls.DashboardLayout
5789 def create_dashboard_layout(
5790 self,
5791 body: mdls.WriteDashboardLayout,
5792 # Requested fields.
5793 fields: Optional[str] = None,
5794 transport_options: Optional[transport.TransportOptions] = None,
5795 ) -> mdls.DashboardLayout:
5796 """Create DashboardLayout"""
5797 response = cast(
5798 mdls.DashboardLayout,
5799 self.post(
5800 path="/dashboard_layouts",
5801 structure=mdls.DashboardLayout,
5802 query_params={"fields": fields},
5803 body=body,
5804 transport_options=transport_options,
5805 ),
5806 )
5807 return response
5808
5809 # endregion
5810
5811 # region DataAction: Run Data Actions
5812
5813 # Perform a data action. The data action object can be obtained from query results, and used to perform an arbitrary action.
5814 #
5815 # POST /data_actions -> mdls.DataActionResponse
5816 def perform_data_action(
5817 self,
5818 body: mdls.DataActionRequest,
5819 transport_options: Optional[transport.TransportOptions] = None,
5820 ) -> mdls.DataActionResponse:
5821 """Send a Data Action"""
5822 response = cast(
5823 mdls.DataActionResponse,
5824 self.post(
5825 path="/data_actions",
5826 structure=mdls.DataActionResponse,
5827 body=body,
5828 transport_options=transport_options,
5829 ),
5830 )
5831 return response
5832
5833 # 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.
5834 #
5835 # POST /data_actions/form -> mdls.DataActionForm
5836 def fetch_remote_data_action_form(
5837 self,
5838 body: MutableMapping[str, Any],
5839 transport_options: Optional[transport.TransportOptions] = None,
5840 ) -> mdls.DataActionForm:
5841 """Fetch Remote Data Action Form"""
5842 response = cast(
5843 mdls.DataActionForm,
5844 self.post(
5845 path="/data_actions/form",
5846 structure=mdls.DataActionForm,
5847 body=body,
5848 transport_options=transport_options,
5849 ),
5850 )
5851 return response
5852
5853 # endregion
5854
5855 # region Datagroup: Manage Datagroups
5856
5857 # ### Get information about all datagroups.
5858 #
5859 # GET /datagroups -> Sequence[mdls.Datagroup]
5860 def all_datagroups(
5861 self,
5862 transport_options: Optional[transport.TransportOptions] = None,
5863 ) -> Sequence[mdls.Datagroup]:
5864 """Get All Datagroups"""
5865 response = cast(
5866 Sequence[mdls.Datagroup],
5867 self.get(
5868 path="/datagroups",
5869 structure=Sequence[mdls.Datagroup],
5870 transport_options=transport_options,
5871 ),
5872 )
5873 return response
5874
5875 # ### Get information about a datagroup.
5876 #
5877 # GET /datagroups/{datagroup_id} -> mdls.Datagroup
5878 def datagroup(
5879 self,
5880 # ID of datagroup.
5881 datagroup_id: str,
5882 transport_options: Optional[transport.TransportOptions] = None,
5883 ) -> mdls.Datagroup:
5884 """Get Datagroup"""
5885 datagroup_id = self.encode_path_param(datagroup_id)
5886 response = cast(
5887 mdls.Datagroup,
5888 self.get(
5889 path=f"/datagroups/{datagroup_id}",
5890 structure=mdls.Datagroup,
5891 transport_options=transport_options,
5892 ),
5893 )
5894 return response
5895
5896 # ### Update a datagroup using the specified params.
5897 #
5898 # PATCH /datagroups/{datagroup_id} -> mdls.Datagroup
5899 def update_datagroup(
5900 self,
5901 # ID of datagroup.
5902 datagroup_id: str,
5903 body: mdls.WriteDatagroup,
5904 transport_options: Optional[transport.TransportOptions] = None,
5905 ) -> mdls.Datagroup:
5906 """Update Datagroup"""
5907 datagroup_id = self.encode_path_param(datagroup_id)
5908 response = cast(
5909 mdls.Datagroup,
5910 self.patch(
5911 path=f"/datagroups/{datagroup_id}",
5912 structure=mdls.Datagroup,
5913 body=body,
5914 transport_options=transport_options,
5915 ),
5916 )
5917 return response
5918
5919 # endregion
5920
5921 # region DerivedTable: View Derived Table graphs
5922
5923 # ### Discover information about derived tables
5924 #
5925 # GET /derived_table/graph/model/{model} -> mdls.DependencyGraph
5926 def graph_derived_tables_for_model(
5927 self,
5928 # The name of the Lookml model.
5929 model: str,
5930 # The format of the graph. Valid values are [dot]. Default is `dot`
5931 format: Optional[str] = None,
5932 # Color denoting the build status of the graph. Grey = not built, green = built, yellow = building, red = error.
5933 color: Optional[str] = None,
5934 transport_options: Optional[transport.TransportOptions] = None,
5935 ) -> mdls.DependencyGraph:
5936 """Get Derived Table graph for model"""
5937 model = self.encode_path_param(model)
5938 response = cast(
5939 mdls.DependencyGraph,
5940 self.get(
5941 path=f"/derived_table/graph/model/{model}",
5942 structure=mdls.DependencyGraph,
5943 query_params={"format": format, "color": color},
5944 transport_options=transport_options,
5945 ),
5946 )
5947 return response
5948
5949 # ### Get the subgraph representing this derived table and its dependencies.
5950 #
5951 # GET /derived_table/graph/view/{view} -> mdls.DependencyGraph
5952 def graph_derived_tables_for_view(
5953 self,
5954 # The derived table's view name.
5955 view: str,
5956 # The models where this derived table is defined.
5957 models: Optional[str] = None,
5958 # The model directory to look in, either `dev` or `production`.
5959 workspace: Optional[str] = None,
5960 transport_options: Optional[transport.TransportOptions] = None,
5961 ) -> mdls.DependencyGraph:
5962 """Get subgraph of derived table and dependencies"""
5963 view = self.encode_path_param(view)
5964 response = cast(
5965 mdls.DependencyGraph,
5966 self.get(
5967 path=f"/derived_table/graph/view/{view}",
5968 structure=mdls.DependencyGraph,
5969 query_params={"models": models, "workspace": workspace},
5970 transport_options=transport_options,
5971 ),
5972 )
5973 return response
5974
5975 # Enqueue materialization for a PDT with the given model name and view name
5976 #
5977 # GET /derived_table/{model_name}/{view_name}/start -> mdls.MaterializePDT
5978 def start_pdt_build(
5979 self,
5980 # The model of the PDT to start building.
5981 model_name: str,
5982 # The view name of the PDT to start building.
5983 view_name: str,
5984 # Force rebuild of required dependent PDTs, even if they are already materialized.
5985 force_rebuild: Optional[str] = None,
5986 # Force involved incremental PDTs to fully re-materialize.
5987 force_full_incremental: Optional[str] = None,
5988 # Workspace in which to materialize selected PDT ('dev' or default 'production').
5989 workspace: Optional[str] = None,
5990 # The source of this request.
5991 source: Optional[str] = None,
5992 transport_options: Optional[transport.TransportOptions] = None,
5993 ) -> mdls.MaterializePDT:
5994 """Start a PDT materialization"""
5995 model_name = self.encode_path_param(model_name)
5996 view_name = self.encode_path_param(view_name)
5997 response = cast(
5998 mdls.MaterializePDT,
5999 self.get(
6000 path=f"/derived_table/{model_name}/{view_name}/start",
6001 structure=mdls.MaterializePDT,
6002 query_params={
6003 "force_rebuild": force_rebuild,
6004 "force_full_incremental": force_full_incremental,
6005 "workspace": workspace,
6006 "source": source,
6007 },
6008 transport_options=transport_options,
6009 ),
6010 )
6011 return response
6012
6013 # Check status of PDT materialization
6014 #
6015 # GET /derived_table/{materialization_id}/status -> mdls.MaterializePDT
6016 def check_pdt_build(
6017 self,
6018 # The materialization id to check status for.
6019 materialization_id: str,
6020 transport_options: Optional[transport.TransportOptions] = None,
6021 ) -> mdls.MaterializePDT:
6022 """Check status of a PDT materialization"""
6023 materialization_id = self.encode_path_param(materialization_id)
6024 response = cast(
6025 mdls.MaterializePDT,
6026 self.get(
6027 path=f"/derived_table/{materialization_id}/status",
6028 structure=mdls.MaterializePDT,
6029 transport_options=transport_options,
6030 ),
6031 )
6032 return response
6033
6034 # Stop a PDT materialization
6035 #
6036 # GET /derived_table/{materialization_id}/stop -> mdls.MaterializePDT
6037 def stop_pdt_build(
6038 self,
6039 # The materialization id to stop.
6040 materialization_id: str,
6041 # The source of this request.
6042 source: Optional[str] = None,
6043 transport_options: Optional[transport.TransportOptions] = None,
6044 ) -> mdls.MaterializePDT:
6045 """Stop a PDT materialization"""
6046 materialization_id = self.encode_path_param(materialization_id)
6047 response = cast(
6048 mdls.MaterializePDT,
6049 self.get(
6050 path=f"/derived_table/{materialization_id}/stop",
6051 structure=mdls.MaterializePDT,
6052 query_params={"source": source},
6053 transport_options=transport_options,
6054 ),
6055 )
6056 return response
6057
6058 # endregion
6059
6060 # region Folder: Manage Folders
6061
6062 # Search for folders by creator id, parent id, name, etc
6063 #
6064 # GET /folders/search -> Sequence[mdls.Folder]
6065 def search_folders(
6066 self,
6067 # Requested fields.
6068 fields: Optional[str] = None,
6069 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
6070 page: Optional[int] = None,
6071 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
6072 per_page: Optional[int] = None,
6073 # Number of results to return. (used with offset and takes priority over page and per_page)
6074 limit: Optional[int] = None,
6075 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
6076 offset: Optional[int] = None,
6077 # Fields to sort by.
6078 sorts: Optional[str] = None,
6079 # Match Space title.
6080 name: Optional[str] = None,
6081 # Match Space id
6082 id: Optional[str] = None,
6083 # Filter on a children of a particular folder.
6084 parent_id: Optional[str] = None,
6085 # Filter on folder created by a particular user.
6086 creator_id: Optional[str] = None,
6087 # Combine given search criteria in a boolean OR expression
6088 filter_or: Optional[bool] = None,
6089 # Match is shared root
6090 is_shared_root: Optional[bool] = None,
6091 # Match is users root
6092 is_users_root: Optional[bool] = None,
6093 transport_options: Optional[transport.TransportOptions] = None,
6094 ) -> Sequence[mdls.Folder]:
6095 """Search Folders"""
6096 response = cast(
6097 Sequence[mdls.Folder],
6098 self.get(
6099 path="/folders/search",
6100 structure=Sequence[mdls.Folder],
6101 query_params={
6102 "fields": fields,
6103 "page": page,
6104 "per_page": per_page,
6105 "limit": limit,
6106 "offset": offset,
6107 "sorts": sorts,
6108 "name": name,
6109 "id": id,
6110 "parent_id": parent_id,
6111 "creator_id": creator_id,
6112 "filter_or": filter_or,
6113 "is_shared_root": is_shared_root,
6114 "is_users_root": is_users_root,
6115 },
6116 transport_options=transport_options,
6117 ),
6118 )
6119 return response
6120
6121 # ### Get information about the folder with a specific id.
6122 #
6123 # GET /folders/{folder_id} -> mdls.Folder
6124 def folder(
6125 self,
6126 # Id of folder
6127 folder_id: str,
6128 # Requested fields.
6129 fields: Optional[str] = None,
6130 transport_options: Optional[transport.TransportOptions] = None,
6131 ) -> mdls.Folder:
6132 """Get Folder"""
6133 folder_id = self.encode_path_param(folder_id)
6134 response = cast(
6135 mdls.Folder,
6136 self.get(
6137 path=f"/folders/{folder_id}",
6138 structure=mdls.Folder,
6139 query_params={"fields": fields},
6140 transport_options=transport_options,
6141 ),
6142 )
6143 return response
6144
6145 # ### Update the folder with a specific id.
6146 #
6147 # PATCH /folders/{folder_id} -> mdls.Folder
6148 def update_folder(
6149 self,
6150 # Id of folder
6151 folder_id: str,
6152 body: mdls.UpdateFolder,
6153 transport_options: Optional[transport.TransportOptions] = None,
6154 ) -> mdls.Folder:
6155 """Update Folder"""
6156 folder_id = self.encode_path_param(folder_id)
6157 response = cast(
6158 mdls.Folder,
6159 self.patch(
6160 path=f"/folders/{folder_id}",
6161 structure=mdls.Folder,
6162 body=body,
6163 transport_options=transport_options,
6164 ),
6165 )
6166 return response
6167
6168 # ### Delete the folder with a specific id including any children folders.
6169 # **DANGER** this will delete all looks and dashboards in the folder.
6170 #
6171 # DELETE /folders/{folder_id} -> str
6172 def delete_folder(
6173 self,
6174 # Id of folder
6175 folder_id: str,
6176 transport_options: Optional[transport.TransportOptions] = None,
6177 ) -> str:
6178 """Delete Folder"""
6179 folder_id = self.encode_path_param(folder_id)
6180 response = cast(
6181 str,
6182 self.delete(
6183 path=f"/folders/{folder_id}",
6184 structure=str,
6185 transport_options=transport_options,
6186 ),
6187 )
6188 return response
6189
6190 # ### Get information about all folders.
6191 #
6192 # All personal folders will be returned.
6193 #
6194 # GET /folders -> Sequence[mdls.FolderBase]
6195 def all_folders(
6196 self,
6197 # Requested fields.
6198 fields: Optional[str] = None,
6199 transport_options: Optional[transport.TransportOptions] = None,
6200 ) -> Sequence[mdls.FolderBase]:
6201 """Get All Folders"""
6202 response = cast(
6203 Sequence[mdls.FolderBase],
6204 self.get(
6205 path="/folders",
6206 structure=Sequence[mdls.FolderBase],
6207 query_params={"fields": fields},
6208 transport_options=transport_options,
6209 ),
6210 )
6211 return response
6212
6213 # ### Create a folder with specified information.
6214 #
6215 # Caller must have permission to edit the parent folder and to create folders, otherwise the request
6216 # returns 404 Not Found.
6217 #
6218 # POST /folders -> mdls.Folder
6219 def create_folder(
6220 self,
6221 body: mdls.CreateFolder,
6222 transport_options: Optional[transport.TransportOptions] = None,
6223 ) -> mdls.Folder:
6224 """Create Folder"""
6225 response = cast(
6226 mdls.Folder,
6227 self.post(
6228 path="/folders",
6229 structure=mdls.Folder,
6230 body=body,
6231 transport_options=transport_options,
6232 ),
6233 )
6234 return response
6235
6236 # ### Get the children of a folder.
6237 #
6238 # GET /folders/{folder_id}/children -> Sequence[mdls.Folder]
6239 def folder_children(
6240 self,
6241 # Id of folder
6242 folder_id: str,
6243 # Requested fields.
6244 fields: Optional[str] = None,
6245 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
6246 page: Optional[int] = None,
6247 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
6248 per_page: Optional[int] = None,
6249 # Number of results to return. (used with offset and takes priority over page and per_page)
6250 limit: Optional[int] = None,
6251 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
6252 offset: Optional[int] = None,
6253 # Fields to sort by.
6254 sorts: Optional[str] = None,
6255 transport_options: Optional[transport.TransportOptions] = None,
6256 ) -> Sequence[mdls.Folder]:
6257 """Get Folder Children"""
6258 folder_id = self.encode_path_param(folder_id)
6259 response = cast(
6260 Sequence[mdls.Folder],
6261 self.get(
6262 path=f"/folders/{folder_id}/children",
6263 structure=Sequence[mdls.Folder],
6264 query_params={
6265 "fields": fields,
6266 "page": page,
6267 "per_page": per_page,
6268 "limit": limit,
6269 "offset": offset,
6270 "sorts": sorts,
6271 },
6272 transport_options=transport_options,
6273 ),
6274 )
6275 return response
6276
6277 # ### Search the children of a folder
6278 #
6279 # GET /folders/{folder_id}/children/search -> Sequence[mdls.Folder]
6280 def folder_children_search(
6281 self,
6282 # Id of folder
6283 folder_id: str,
6284 # Requested fields.
6285 fields: Optional[str] = None,
6286 # Fields to sort by.
6287 sorts: Optional[str] = None,
6288 # Match folder name.
6289 name: Optional[str] = None,
6290 transport_options: Optional[transport.TransportOptions] = None,
6291 ) -> Sequence[mdls.Folder]:
6292 """Search Folder Children"""
6293 folder_id = self.encode_path_param(folder_id)
6294 response = cast(
6295 Sequence[mdls.Folder],
6296 self.get(
6297 path=f"/folders/{folder_id}/children/search",
6298 structure=Sequence[mdls.Folder],
6299 query_params={"fields": fields, "sorts": sorts, "name": name},
6300 transport_options=transport_options,
6301 ),
6302 )
6303 return response
6304
6305 # ### Get the parent of a folder
6306 #
6307 # GET /folders/{folder_id}/parent -> mdls.Folder
6308 def folder_parent(
6309 self,
6310 # Id of folder
6311 folder_id: str,
6312 # Requested fields.
6313 fields: Optional[str] = None,
6314 transport_options: Optional[transport.TransportOptions] = None,
6315 ) -> mdls.Folder:
6316 """Get Folder Parent"""
6317 folder_id = self.encode_path_param(folder_id)
6318 response = cast(
6319 mdls.Folder,
6320 self.get(
6321 path=f"/folders/{folder_id}/parent",
6322 structure=mdls.Folder,
6323 query_params={"fields": fields},
6324 transport_options=transport_options,
6325 ),
6326 )
6327 return response
6328
6329 # ### Get the ancestors of a folder
6330 #
6331 # GET /folders/{folder_id}/ancestors -> Sequence[mdls.Folder]
6332 def folder_ancestors(
6333 self,
6334 # Id of folder
6335 folder_id: str,
6336 # Requested fields.
6337 fields: Optional[str] = None,
6338 transport_options: Optional[transport.TransportOptions] = None,
6339 ) -> Sequence[mdls.Folder]:
6340 """Get Folder Ancestors"""
6341 folder_id = self.encode_path_param(folder_id)
6342 response = cast(
6343 Sequence[mdls.Folder],
6344 self.get(
6345 path=f"/folders/{folder_id}/ancestors",
6346 structure=Sequence[mdls.Folder],
6347 query_params={"fields": fields},
6348 transport_options=transport_options,
6349 ),
6350 )
6351 return response
6352
6353 # ### Get all looks in a folder.
6354 # In API 4.0+, all looks in a folder will be returned, excluding looks in the trash.
6355 #
6356 # GET /folders/{folder_id}/looks -> Sequence[mdls.LookWithQuery]
6357 def folder_looks(
6358 self,
6359 # Id of folder
6360 folder_id: str,
6361 # Requested fields.
6362 fields: Optional[str] = None,
6363 transport_options: Optional[transport.TransportOptions] = None,
6364 ) -> Sequence[mdls.LookWithQuery]:
6365 """Get Folder Looks"""
6366 folder_id = self.encode_path_param(folder_id)
6367 response = cast(
6368 Sequence[mdls.LookWithQuery],
6369 self.get(
6370 path=f"/folders/{folder_id}/looks",
6371 structure=Sequence[mdls.LookWithQuery],
6372 query_params={"fields": fields},
6373 transport_options=transport_options,
6374 ),
6375 )
6376 return response
6377
6378 # ### Get the dashboards in a folder
6379 #
6380 # GET /folders/{folder_id}/dashboards -> Sequence[mdls.Dashboard]
6381 def folder_dashboards(
6382 self,
6383 # Id of folder
6384 folder_id: str,
6385 # Requested fields.
6386 fields: Optional[str] = None,
6387 transport_options: Optional[transport.TransportOptions] = None,
6388 ) -> Sequence[mdls.Dashboard]:
6389 """Get Folder Dashboards"""
6390 folder_id = self.encode_path_param(folder_id)
6391 response = cast(
6392 Sequence[mdls.Dashboard],
6393 self.get(
6394 path=f"/folders/{folder_id}/dashboards",
6395 structure=Sequence[mdls.Dashboard],
6396 query_params={"fields": fields},
6397 transport_options=transport_options,
6398 ),
6399 )
6400 return response
6401
6402 # endregion
6403
6404 # region Group: Manage Groups
6405
6406 # ### Get information about all groups.
6407 #
6408 # GET /groups -> Sequence[mdls.Group]
6409 def all_groups(
6410 self,
6411 # Requested fields.
6412 fields: Optional[str] = None,
6413 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
6414 page: Optional[int] = None,
6415 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
6416 per_page: Optional[int] = None,
6417 # Number of results to return. (used with offset and takes priority over page and per_page)
6418 limit: Optional[int] = None,
6419 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
6420 offset: Optional[int] = None,
6421 # Fields to sort by.
6422 sorts: Optional[str] = None,
6423 # Optional of ids to get specific groups.
6424 ids: Optional[mdls.DelimSequence[str]] = None,
6425 # Id of content metadata to which groups must have access.
6426 content_metadata_id: Optional[str] = None,
6427 # Select only groups that either can/cannot be given access to content.
6428 can_add_to_content_metadata: Optional[bool] = None,
6429 transport_options: Optional[transport.TransportOptions] = None,
6430 ) -> Sequence[mdls.Group]:
6431 """Get All Groups"""
6432 response = cast(
6433 Sequence[mdls.Group],
6434 self.get(
6435 path="/groups",
6436 structure=Sequence[mdls.Group],
6437 query_params={
6438 "fields": fields,
6439 "page": page,
6440 "per_page": per_page,
6441 "limit": limit,
6442 "offset": offset,
6443 "sorts": sorts,
6444 "ids": ids,
6445 "content_metadata_id": content_metadata_id,
6446 "can_add_to_content_metadata": can_add_to_content_metadata,
6447 },
6448 transport_options=transport_options,
6449 ),
6450 )
6451 return response
6452
6453 # ### Creates a new group (admin only).
6454 #
6455 # POST /groups -> mdls.Group
6456 def create_group(
6457 self,
6458 body: mdls.WriteGroup,
6459 # Requested fields.
6460 fields: Optional[str] = None,
6461 transport_options: Optional[transport.TransportOptions] = None,
6462 ) -> mdls.Group:
6463 """Create Group"""
6464 response = cast(
6465 mdls.Group,
6466 self.post(
6467 path="/groups",
6468 structure=mdls.Group,
6469 query_params={"fields": fields},
6470 body=body,
6471 transport_options=transport_options,
6472 ),
6473 )
6474 return response
6475
6476 # ### Search groups
6477 #
6478 # Returns all group records that match the given search criteria.
6479 #
6480 # If multiple search params are given and `filter_or` is FALSE or not specified,
6481 # search params are combined in a logical AND operation.
6482 # Only rows that match *all* search param criteria will be returned.
6483 #
6484 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
6485 # Results will include rows that match **any** of the search criteria.
6486 #
6487 # String search params use case-insensitive matching.
6488 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
6489 # example="dan%" will match "danger" and "Danzig" but not "David"
6490 # example="D_m%" will match "Damage" and "dump"
6491 #
6492 # Integer search params can accept a single value or a comma separated list of values. The multiple
6493 # values will be combined under a logical OR operation - results will match at least one of
6494 # the given values.
6495 #
6496 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
6497 # or exclude (respectively) rows where the column is null.
6498 #
6499 # Boolean search params accept only "true" and "false" as values.
6500 #
6501 # GET /groups/search -> Sequence[mdls.Group]
6502 def search_groups(
6503 self,
6504 # Requested fields.
6505 fields: Optional[str] = None,
6506 # Number of results to return (used with `offset`).
6507 limit: Optional[int] = None,
6508 # Number of results to skip before returning any (used with `limit`).
6509 offset: Optional[int] = None,
6510 # Fields to sort by.
6511 sorts: Optional[str] = None,
6512 # Combine given search criteria in a boolean OR expression
6513 filter_or: Optional[bool] = None,
6514 # Match group id.
6515 id: Optional[str] = None,
6516 # Match group name.
6517 name: Optional[str] = None,
6518 # Match group external_group_id.
6519 external_group_id: Optional[str] = None,
6520 # Match group externally_managed.
6521 externally_managed: Optional[bool] = None,
6522 # Match group externally_orphaned.
6523 externally_orphaned: Optional[bool] = None,
6524 transport_options: Optional[transport.TransportOptions] = None,
6525 ) -> Sequence[mdls.Group]:
6526 """Search Groups"""
6527 response = cast(
6528 Sequence[mdls.Group],
6529 self.get(
6530 path="/groups/search",
6531 structure=Sequence[mdls.Group],
6532 query_params={
6533 "fields": fields,
6534 "limit": limit,
6535 "offset": offset,
6536 "sorts": sorts,
6537 "filter_or": filter_or,
6538 "id": id,
6539 "name": name,
6540 "external_group_id": external_group_id,
6541 "externally_managed": externally_managed,
6542 "externally_orphaned": externally_orphaned,
6543 },
6544 transport_options=transport_options,
6545 ),
6546 )
6547 return response
6548
6549 # ### Search groups include roles
6550 #
6551 # Returns all group records that match the given search criteria, and attaches any associated roles.
6552 #
6553 # If multiple search params are given and `filter_or` is FALSE or not specified,
6554 # search params are combined in a logical AND operation.
6555 # Only rows that match *all* search param criteria will be returned.
6556 #
6557 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
6558 # Results will include rows that match **any** of the search criteria.
6559 #
6560 # String search params use case-insensitive matching.
6561 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
6562 # example="dan%" will match "danger" and "Danzig" but not "David"
6563 # example="D_m%" will match "Damage" and "dump"
6564 #
6565 # Integer search params can accept a single value or a comma separated list of values. The multiple
6566 # values will be combined under a logical OR operation - results will match at least one of
6567 # the given values.
6568 #
6569 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
6570 # or exclude (respectively) rows where the column is null.
6571 #
6572 # Boolean search params accept only "true" and "false" as values.
6573 #
6574 # GET /groups/search/with_roles -> Sequence[mdls.GroupSearch]
6575 def search_groups_with_roles(
6576 self,
6577 # Requested fields.
6578 fields: Optional[str] = None,
6579 # Number of results to return (used with `offset`).
6580 limit: Optional[int] = None,
6581 # Number of results to skip before returning any (used with `limit`).
6582 offset: Optional[int] = None,
6583 # Fields to sort by.
6584 sorts: Optional[str] = None,
6585 # Combine given search criteria in a boolean OR expression
6586 filter_or: Optional[bool] = None,
6587 # Match group id.
6588 id: Optional[str] = None,
6589 # Match group name.
6590 name: Optional[str] = None,
6591 # Match group external_group_id.
6592 external_group_id: Optional[str] = None,
6593 # Match group externally_managed.
6594 externally_managed: Optional[bool] = None,
6595 # Match group externally_orphaned.
6596 externally_orphaned: Optional[bool] = None,
6597 transport_options: Optional[transport.TransportOptions] = None,
6598 ) -> Sequence[mdls.GroupSearch]:
6599 """Search Groups with Roles"""
6600 response = cast(
6601 Sequence[mdls.GroupSearch],
6602 self.get(
6603 path="/groups/search/with_roles",
6604 structure=Sequence[mdls.GroupSearch],
6605 query_params={
6606 "fields": fields,
6607 "limit": limit,
6608 "offset": offset,
6609 "sorts": sorts,
6610 "filter_or": filter_or,
6611 "id": id,
6612 "name": name,
6613 "external_group_id": external_group_id,
6614 "externally_managed": externally_managed,
6615 "externally_orphaned": externally_orphaned,
6616 },
6617 transport_options=transport_options,
6618 ),
6619 )
6620 return response
6621
6622 # ### Search groups include hierarchy
6623 #
6624 # Returns all group records that match the given search criteria, and attaches
6625 # associated role_ids and parent group_ids.
6626 #
6627 # If multiple search params are given and `filter_or` is FALSE or not specified,
6628 # search params are combined in a logical AND operation.
6629 # Only rows that match *all* search param criteria will be returned.
6630 #
6631 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
6632 # Results will include rows that match **any** of the search criteria.
6633 #
6634 # String search params use case-insensitive matching.
6635 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
6636 # example="dan%" will match "danger" and "Danzig" but not "David"
6637 # example="D_m%" will match "Damage" and "dump"
6638 #
6639 # Integer search params can accept a single value or a comma separated list of values. The multiple
6640 # values will be combined under a logical OR operation - results will match at least one of
6641 # the given values.
6642 #
6643 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
6644 # or exclude (respectively) rows where the column is null.
6645 #
6646 # Boolean search params accept only "true" and "false" as values.
6647 #
6648 # GET /groups/search/with_hierarchy -> Sequence[mdls.GroupHierarchy]
6649 def search_groups_with_hierarchy(
6650 self,
6651 # Requested fields.
6652 fields: Optional[str] = None,
6653 # Number of results to return (used with `offset`).
6654 limit: Optional[int] = None,
6655 # Number of results to skip before returning any (used with `limit`).
6656 offset: Optional[int] = None,
6657 # Fields to sort by.
6658 sorts: Optional[str] = None,
6659 # Combine given search criteria in a boolean OR expression
6660 filter_or: Optional[bool] = None,
6661 # Match group id.
6662 id: Optional[str] = None,
6663 # Match group name.
6664 name: Optional[str] = None,
6665 # Match group external_group_id.
6666 external_group_id: Optional[str] = None,
6667 # Match group externally_managed.
6668 externally_managed: Optional[bool] = None,
6669 # Match group externally_orphaned.
6670 externally_orphaned: Optional[bool] = None,
6671 transport_options: Optional[transport.TransportOptions] = None,
6672 ) -> Sequence[mdls.GroupHierarchy]:
6673 """Search Groups with Hierarchy"""
6674 response = cast(
6675 Sequence[mdls.GroupHierarchy],
6676 self.get(
6677 path="/groups/search/with_hierarchy",
6678 structure=Sequence[mdls.GroupHierarchy],
6679 query_params={
6680 "fields": fields,
6681 "limit": limit,
6682 "offset": offset,
6683 "sorts": sorts,
6684 "filter_or": filter_or,
6685 "id": id,
6686 "name": name,
6687 "external_group_id": external_group_id,
6688 "externally_managed": externally_managed,
6689 "externally_orphaned": externally_orphaned,
6690 },
6691 transport_options=transport_options,
6692 ),
6693 )
6694 return response
6695
6696 # ### Get information about a group.
6697 #
6698 # GET /groups/{group_id} -> mdls.Group
6699 def group(
6700 self,
6701 # Id of group
6702 group_id: str,
6703 # Requested fields.
6704 fields: Optional[str] = None,
6705 transport_options: Optional[transport.TransportOptions] = None,
6706 ) -> mdls.Group:
6707 """Get Group"""
6708 group_id = self.encode_path_param(group_id)
6709 response = cast(
6710 mdls.Group,
6711 self.get(
6712 path=f"/groups/{group_id}",
6713 structure=mdls.Group,
6714 query_params={"fields": fields},
6715 transport_options=transport_options,
6716 ),
6717 )
6718 return response
6719
6720 # ### Updates the a group (admin only).
6721 #
6722 # PATCH /groups/{group_id} -> mdls.Group
6723 def update_group(
6724 self,
6725 # Id of group
6726 group_id: str,
6727 body: mdls.WriteGroup,
6728 # Requested fields.
6729 fields: Optional[str] = None,
6730 transport_options: Optional[transport.TransportOptions] = None,
6731 ) -> mdls.Group:
6732 """Update Group"""
6733 group_id = self.encode_path_param(group_id)
6734 response = cast(
6735 mdls.Group,
6736 self.patch(
6737 path=f"/groups/{group_id}",
6738 structure=mdls.Group,
6739 query_params={"fields": fields},
6740 body=body,
6741 transport_options=transport_options,
6742 ),
6743 )
6744 return response
6745
6746 # ### Deletes a group (admin only).
6747 #
6748 # DELETE /groups/{group_id} -> str
6749 def delete_group(
6750 self,
6751 # Id of group
6752 group_id: str,
6753 transport_options: Optional[transport.TransportOptions] = None,
6754 ) -> str:
6755 """Delete Group"""
6756 group_id = self.encode_path_param(group_id)
6757 response = cast(
6758 str,
6759 self.delete(
6760 path=f"/groups/{group_id}",
6761 structure=str,
6762 transport_options=transport_options,
6763 ),
6764 )
6765 return response
6766
6767 # ### Get information about all the groups in a group
6768 #
6769 # GET /groups/{group_id}/groups -> Sequence[mdls.Group]
6770 def all_group_groups(
6771 self,
6772 # Id of group
6773 group_id: str,
6774 # Requested fields.
6775 fields: Optional[str] = None,
6776 transport_options: Optional[transport.TransportOptions] = None,
6777 ) -> Sequence[mdls.Group]:
6778 """Get All Groups in Group"""
6779 group_id = self.encode_path_param(group_id)
6780 response = cast(
6781 Sequence[mdls.Group],
6782 self.get(
6783 path=f"/groups/{group_id}/groups",
6784 structure=Sequence[mdls.Group],
6785 query_params={"fields": fields},
6786 transport_options=transport_options,
6787 ),
6788 )
6789 return response
6790
6791 # ### Adds a new group to a group.
6792 #
6793 # POST /groups/{group_id}/groups -> mdls.Group
6794 def add_group_group(
6795 self,
6796 # Id of group
6797 group_id: str,
6798 # WARNING: no writeable properties found for POST, PUT, or PATCH
6799 body: mdls.GroupIdForGroupInclusion,
6800 transport_options: Optional[transport.TransportOptions] = None,
6801 ) -> mdls.Group:
6802 """Add a Group to Group"""
6803 group_id = self.encode_path_param(group_id)
6804 response = cast(
6805 mdls.Group,
6806 self.post(
6807 path=f"/groups/{group_id}/groups",
6808 structure=mdls.Group,
6809 body=body,
6810 transport_options=transport_options,
6811 ),
6812 )
6813 return response
6814
6815 # ### Get information about all the users directly included in a group.
6816 #
6817 # GET /groups/{group_id}/users -> Sequence[mdls.User]
6818 def all_group_users(
6819 self,
6820 # Id of group
6821 group_id: str,
6822 # Requested fields.
6823 fields: Optional[str] = None,
6824 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
6825 page: Optional[int] = None,
6826 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
6827 per_page: Optional[int] = None,
6828 # Number of results to return. (used with offset and takes priority over page and per_page)
6829 limit: Optional[int] = None,
6830 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
6831 offset: Optional[int] = None,
6832 # Fields to sort by.
6833 sorts: Optional[str] = None,
6834 transport_options: Optional[transport.TransportOptions] = None,
6835 ) -> Sequence[mdls.User]:
6836 """Get All Users in Group"""
6837 group_id = self.encode_path_param(group_id)
6838 response = cast(
6839 Sequence[mdls.User],
6840 self.get(
6841 path=f"/groups/{group_id}/users",
6842 structure=Sequence[mdls.User],
6843 query_params={
6844 "fields": fields,
6845 "page": page,
6846 "per_page": per_page,
6847 "limit": limit,
6848 "offset": offset,
6849 "sorts": sorts,
6850 },
6851 transport_options=transport_options,
6852 ),
6853 )
6854 return response
6855
6856 # ### Adds a new user to a group.
6857 #
6858 # POST /groups/{group_id}/users -> mdls.User
6859 def add_group_user(
6860 self,
6861 # Id of group
6862 group_id: str,
6863 # WARNING: no writeable properties found for POST, PUT, or PATCH
6864 body: mdls.GroupIdForGroupUserInclusion,
6865 transport_options: Optional[transport.TransportOptions] = None,
6866 ) -> mdls.User:
6867 """Add a User to Group"""
6868 group_id = self.encode_path_param(group_id)
6869 response = cast(
6870 mdls.User,
6871 self.post(
6872 path=f"/groups/{group_id}/users",
6873 structure=mdls.User,
6874 body=body,
6875 transport_options=transport_options,
6876 ),
6877 )
6878 return response
6879
6880 # ### Removes a user from a group.
6881 #
6882 # DELETE /groups/{group_id}/users/{user_id} -> None
6883 def delete_group_user(
6884 self,
6885 # Id of group
6886 group_id: str,
6887 # Id of user to remove from group
6888 user_id: str,
6889 transport_options: Optional[transport.TransportOptions] = None,
6890 ) -> None:
6891 """Remove a User from Group"""
6892 group_id = self.encode_path_param(group_id)
6893 user_id = self.encode_path_param(user_id)
6894 response = cast(
6895 None,
6896 self.delete(
6897 path=f"/groups/{group_id}/users/{user_id}",
6898 structure=None,
6899 transport_options=transport_options,
6900 ),
6901 )
6902 return response
6903
6904 # ### Removes a group from a group.
6905 #
6906 # DELETE /groups/{group_id}/groups/{deleting_group_id} -> None
6907 def delete_group_from_group(
6908 self,
6909 # Id of group
6910 group_id: str,
6911 # Id of group to delete
6912 deleting_group_id: str,
6913 transport_options: Optional[transport.TransportOptions] = None,
6914 ) -> None:
6915 """Deletes a Group from Group"""
6916 group_id = self.encode_path_param(group_id)
6917 deleting_group_id = self.encode_path_param(deleting_group_id)
6918 response = cast(
6919 None,
6920 self.delete(
6921 path=f"/groups/{group_id}/groups/{deleting_group_id}",
6922 structure=None,
6923 transport_options=transport_options,
6924 ),
6925 )
6926 return response
6927
6928 # ### Set the value of a user attribute for a group.
6929 #
6930 # For information about how user attribute values are calculated, see [Set User Attribute Group Values](#!/UserAttribute/set_user_attribute_group_values).
6931 #
6932 # PATCH /groups/{group_id}/attribute_values/{user_attribute_id} -> mdls.UserAttributeGroupValue
6933 def update_user_attribute_group_value(
6934 self,
6935 # Id of group
6936 group_id: str,
6937 # Id of user attribute
6938 user_attribute_id: str,
6939 # WARNING: no writeable properties found for POST, PUT, or PATCH
6940 body: mdls.UserAttributeGroupValue,
6941 transport_options: Optional[transport.TransportOptions] = None,
6942 ) -> mdls.UserAttributeGroupValue:
6943 """Set User Attribute Group Value"""
6944 group_id = self.encode_path_param(group_id)
6945 user_attribute_id = self.encode_path_param(user_attribute_id)
6946 response = cast(
6947 mdls.UserAttributeGroupValue,
6948 self.patch(
6949 path=f"/groups/{group_id}/attribute_values/{user_attribute_id}",
6950 structure=mdls.UserAttributeGroupValue,
6951 body=body,
6952 transport_options=transport_options,
6953 ),
6954 )
6955 return response
6956
6957 # ### Remove a user attribute value from a group.
6958 #
6959 # DELETE /groups/{group_id}/attribute_values/{user_attribute_id} -> None
6960 def delete_user_attribute_group_value(
6961 self,
6962 # Id of group
6963 group_id: str,
6964 # Id of user attribute
6965 user_attribute_id: str,
6966 transport_options: Optional[transport.TransportOptions] = None,
6967 ) -> None:
6968 """Delete User Attribute Group Value"""
6969 group_id = self.encode_path_param(group_id)
6970 user_attribute_id = self.encode_path_param(user_attribute_id)
6971 response = cast(
6972 None,
6973 self.delete(
6974 path=f"/groups/{group_id}/attribute_values/{user_attribute_id}",
6975 structure=None,
6976 transport_options=transport_options,
6977 ),
6978 )
6979 return response
6980
6981 # endregion
6982
6983 # region Homepage: Manage Homepage
6984
6985 # ### Get information about the primary homepage's sections.
6986 #
6987 # GET /primary_homepage_sections -> Sequence[mdls.HomepageSection]
6988 def all_primary_homepage_sections(
6989 self,
6990 # Requested fields.
6991 fields: Optional[str] = None,
6992 transport_options: Optional[transport.TransportOptions] = None,
6993 ) -> Sequence[mdls.HomepageSection]:
6994 """Get All Primary homepage sections"""
6995 response = cast(
6996 Sequence[mdls.HomepageSection],
6997 self.get(
6998 path="/primary_homepage_sections",
6999 structure=Sequence[mdls.HomepageSection],
7000 query_params={"fields": fields},
7001 transport_options=transport_options,
7002 ),
7003 )
7004 return response
7005
7006 # endregion
7007
7008 # region Integration: Manage Integrations
7009
7010 # ### Get information about all Integration Hubs.
7011 #
7012 # GET /integration_hubs -> Sequence[mdls.IntegrationHub]
7013 def all_integration_hubs(
7014 self,
7015 # Requested fields.
7016 fields: Optional[str] = None,
7017 transport_options: Optional[transport.TransportOptions] = None,
7018 ) -> Sequence[mdls.IntegrationHub]:
7019 """Get All Integration Hubs"""
7020 response = cast(
7021 Sequence[mdls.IntegrationHub],
7022 self.get(
7023 path="/integration_hubs",
7024 structure=Sequence[mdls.IntegrationHub],
7025 query_params={"fields": fields},
7026 transport_options=transport_options,
7027 ),
7028 )
7029 return response
7030
7031 # ### Create a new Integration Hub.
7032 #
7033 # This API is rate limited to prevent it from being used for SSRF attacks
7034 #
7035 # POST /integration_hubs -> mdls.IntegrationHub
7036 def create_integration_hub(
7037 self,
7038 body: mdls.WriteIntegrationHub,
7039 # Requested fields.
7040 fields: Optional[str] = None,
7041 transport_options: Optional[transport.TransportOptions] = None,
7042 ) -> mdls.IntegrationHub:
7043 """Create Integration Hub"""
7044 response = cast(
7045 mdls.IntegrationHub,
7046 self.post(
7047 path="/integration_hubs",
7048 structure=mdls.IntegrationHub,
7049 query_params={"fields": fields},
7050 body=body,
7051 transport_options=transport_options,
7052 ),
7053 )
7054 return response
7055
7056 # ### Get information about a Integration Hub.
7057 #
7058 # GET /integration_hubs/{integration_hub_id} -> mdls.IntegrationHub
7059 def integration_hub(
7060 self,
7061 # Id of integration_hub
7062 integration_hub_id: str,
7063 # Requested fields.
7064 fields: Optional[str] = None,
7065 transport_options: Optional[transport.TransportOptions] = None,
7066 ) -> mdls.IntegrationHub:
7067 """Get Integration Hub"""
7068 integration_hub_id = self.encode_path_param(integration_hub_id)
7069 response = cast(
7070 mdls.IntegrationHub,
7071 self.get(
7072 path=f"/integration_hubs/{integration_hub_id}",
7073 structure=mdls.IntegrationHub,
7074 query_params={"fields": fields},
7075 transport_options=transport_options,
7076 ),
7077 )
7078 return response
7079
7080 # ### Update a Integration Hub definition.
7081 #
7082 # This API is rate limited to prevent it from being used for SSRF attacks
7083 #
7084 # PATCH /integration_hubs/{integration_hub_id} -> mdls.IntegrationHub
7085 def update_integration_hub(
7086 self,
7087 # Id of integration_hub
7088 integration_hub_id: str,
7089 body: mdls.WriteIntegrationHub,
7090 # Requested fields.
7091 fields: Optional[str] = None,
7092 transport_options: Optional[transport.TransportOptions] = None,
7093 ) -> mdls.IntegrationHub:
7094 """Update Integration Hub"""
7095 integration_hub_id = self.encode_path_param(integration_hub_id)
7096 response = cast(
7097 mdls.IntegrationHub,
7098 self.patch(
7099 path=f"/integration_hubs/{integration_hub_id}",
7100 structure=mdls.IntegrationHub,
7101 query_params={"fields": fields},
7102 body=body,
7103 transport_options=transport_options,
7104 ),
7105 )
7106 return response
7107
7108 # ### Delete a Integration Hub.
7109 #
7110 # DELETE /integration_hubs/{integration_hub_id} -> str
7111 def delete_integration_hub(
7112 self,
7113 # Id of integration_hub
7114 integration_hub_id: str,
7115 transport_options: Optional[transport.TransportOptions] = None,
7116 ) -> str:
7117 """Delete Integration Hub"""
7118 integration_hub_id = self.encode_path_param(integration_hub_id)
7119 response = cast(
7120 str,
7121 self.delete(
7122 path=f"/integration_hubs/{integration_hub_id}",
7123 structure=str,
7124 transport_options=transport_options,
7125 ),
7126 )
7127 return response
7128
7129 # Checks to see if the user is able to connect to their integration hub
7130 #
7131 # GET /integration_hubs/{integration_hub_id}/health -> mdls.IntegrationHubHealthResult
7132 def get_integration_hub_health(
7133 self,
7134 # Id of integration_hub
7135 integration_hub_id: str,
7136 # Requested fields.
7137 fields: Optional[str] = None,
7138 transport_options: Optional[transport.TransportOptions] = None,
7139 ) -> mdls.IntegrationHubHealthResult:
7140 """Check the health of Integration Hub"""
7141 integration_hub_id = self.encode_path_param(integration_hub_id)
7142 response = cast(
7143 mdls.IntegrationHubHealthResult,
7144 self.get(
7145 path=f"/integration_hubs/{integration_hub_id}/health",
7146 structure=mdls.IntegrationHubHealthResult,
7147 query_params={"fields": fields},
7148 transport_options=transport_options,
7149 ),
7150 )
7151 return response
7152
7153 # 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.
7154 #
7155 # POST /integration_hubs/{integration_hub_id}/accept_legal_agreement -> mdls.IntegrationHub
7156 def accept_integration_hub_legal_agreement(
7157 self,
7158 # Id of integration_hub
7159 integration_hub_id: str,
7160 transport_options: Optional[transport.TransportOptions] = None,
7161 ) -> mdls.IntegrationHub:
7162 """Accept Integration Hub Legal Agreement"""
7163 integration_hub_id = self.encode_path_param(integration_hub_id)
7164 response = cast(
7165 mdls.IntegrationHub,
7166 self.post(
7167 path=f"/integration_hubs/{integration_hub_id}/accept_legal_agreement",
7168 structure=mdls.IntegrationHub,
7169 transport_options=transport_options,
7170 ),
7171 )
7172 return response
7173
7174 # ### Get information about all Integrations.
7175 #
7176 # GET /integrations -> Sequence[mdls.Integration]
7177 def all_integrations(
7178 self,
7179 # Requested fields.
7180 fields: Optional[str] = None,
7181 # Filter to a specific provider
7182 integration_hub_id: Optional[str] = None,
7183 transport_options: Optional[transport.TransportOptions] = None,
7184 ) -> Sequence[mdls.Integration]:
7185 """Get All Integrations"""
7186 response = cast(
7187 Sequence[mdls.Integration],
7188 self.get(
7189 path="/integrations",
7190 structure=Sequence[mdls.Integration],
7191 query_params={
7192 "fields": fields,
7193 "integration_hub_id": integration_hub_id,
7194 },
7195 transport_options=transport_options,
7196 ),
7197 )
7198 return response
7199
7200 # ### Get information about a Integration.
7201 #
7202 # GET /integrations/{integration_id} -> mdls.Integration
7203 def integration(
7204 self,
7205 # Id of integration
7206 integration_id: str,
7207 # Requested fields.
7208 fields: Optional[str] = None,
7209 transport_options: Optional[transport.TransportOptions] = None,
7210 ) -> mdls.Integration:
7211 """Get Integration"""
7212 integration_id = self.encode_path_param(integration_id)
7213 response = cast(
7214 mdls.Integration,
7215 self.get(
7216 path=f"/integrations/{integration_id}",
7217 structure=mdls.Integration,
7218 query_params={"fields": fields},
7219 transport_options=transport_options,
7220 ),
7221 )
7222 return response
7223
7224 # ### Update parameters on a Integration.
7225 #
7226 # PATCH /integrations/{integration_id} -> mdls.Integration
7227 def update_integration(
7228 self,
7229 # Id of integration
7230 integration_id: str,
7231 body: mdls.WriteIntegration,
7232 # Requested fields.
7233 fields: Optional[str] = None,
7234 transport_options: Optional[transport.TransportOptions] = None,
7235 ) -> mdls.Integration:
7236 """Update Integration"""
7237 integration_id = self.encode_path_param(integration_id)
7238 response = cast(
7239 mdls.Integration,
7240 self.patch(
7241 path=f"/integrations/{integration_id}",
7242 structure=mdls.Integration,
7243 query_params={"fields": fields},
7244 body=body,
7245 transport_options=transport_options,
7246 ),
7247 )
7248 return response
7249
7250 # Returns the Integration form for presentation to the user.
7251 #
7252 # POST /integrations/{integration_id}/form -> mdls.DataActionForm
7253 def fetch_integration_form(
7254 self,
7255 # Id of integration
7256 integration_id: str,
7257 body: Optional[MutableMapping[str, Any]] = None,
7258 transport_options: Optional[transport.TransportOptions] = None,
7259 ) -> mdls.DataActionForm:
7260 """Fetch Remote Integration Form"""
7261 integration_id = self.encode_path_param(integration_id)
7262 response = cast(
7263 mdls.DataActionForm,
7264 self.post(
7265 path=f"/integrations/{integration_id}/form",
7266 structure=mdls.DataActionForm,
7267 body=body,
7268 transport_options=transport_options,
7269 ),
7270 )
7271 return response
7272
7273 # Tests the integration to make sure all the settings are working.
7274 #
7275 # POST /integrations/{integration_id}/test -> mdls.IntegrationTestResult
7276 def test_integration(
7277 self,
7278 # Id of integration
7279 integration_id: str,
7280 transport_options: Optional[transport.TransportOptions] = None,
7281 ) -> mdls.IntegrationTestResult:
7282 """Test integration"""
7283 integration_id = self.encode_path_param(integration_id)
7284 response = cast(
7285 mdls.IntegrationTestResult,
7286 self.post(
7287 path=f"/integrations/{integration_id}/test",
7288 structure=mdls.IntegrationTestResult,
7289 transport_options=transport_options,
7290 ),
7291 )
7292 return response
7293
7294 # endregion
7295
7296 # region Look: Run and Manage Looks
7297
7298 # ### Get information about all active Looks
7299 #
7300 # Returns an array of **abbreviated Look objects** describing all the looks that the caller has access to. Soft-deleted Looks are **not** included.
7301 #
7302 # Get the **full details** of a specific look by id with [look(id)](#!/Look/look)
7303 #
7304 # Find **soft-deleted looks** with [search_looks()](#!/Look/search_looks)
7305 #
7306 # GET /looks -> Sequence[mdls.Look]
7307 def all_looks(
7308 self,
7309 # Requested fields.
7310 fields: Optional[str] = None,
7311 transport_options: Optional[transport.TransportOptions] = None,
7312 ) -> Sequence[mdls.Look]:
7313 """Get All Looks"""
7314 response = cast(
7315 Sequence[mdls.Look],
7316 self.get(
7317 path="/looks",
7318 structure=Sequence[mdls.Look],
7319 query_params={"fields": fields},
7320 transport_options=transport_options,
7321 ),
7322 )
7323 return response
7324
7325 # ### Create a Look
7326 #
7327 # To create a look to display query data, first create the query with [create_query()](#!/Query/create_query)
7328 # then assign the query's id to the `query_id` property in the call to `create_look()`.
7329 #
7330 # To place the look into a particular space, assign the space's id to the `space_id` property
7331 # in the call to `create_look()`.
7332 #
7333 # POST /looks -> mdls.LookWithQuery
7334 def create_look(
7335 self,
7336 body: mdls.WriteLookWithQuery,
7337 # Requested fields.
7338 fields: Optional[str] = None,
7339 transport_options: Optional[transport.TransportOptions] = None,
7340 ) -> mdls.LookWithQuery:
7341 """Create Look"""
7342 response = cast(
7343 mdls.LookWithQuery,
7344 self.post(
7345 path="/looks",
7346 structure=mdls.LookWithQuery,
7347 query_params={"fields": fields},
7348 body=body,
7349 transport_options=transport_options,
7350 ),
7351 )
7352 return response
7353
7354 # ### Search Looks
7355 #
7356 # Returns an **array of Look objects** that match the specified search criteria.
7357 #
7358 # If multiple search params are given and `filter_or` is FALSE or not specified,
7359 # search params are combined in a logical AND operation.
7360 # Only rows that match *all* search param criteria will be returned.
7361 #
7362 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
7363 # Results will include rows that match **any** of the search criteria.
7364 #
7365 # String search params use case-insensitive matching.
7366 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
7367 # example="dan%" will match "danger" and "Danzig" but not "David"
7368 # example="D_m%" will match "Damage" and "dump"
7369 #
7370 # Integer search params can accept a single value or a comma separated list of values. The multiple
7371 # values will be combined under a logical OR operation - results will match at least one of
7372 # the given values.
7373 #
7374 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
7375 # or exclude (respectively) rows where the column is null.
7376 #
7377 # Boolean search params accept only "true" and "false" as values.
7378 #
7379 #
7380 # Get a **single look** by id with [look(id)](#!/Look/look)
7381 #
7382 # GET /looks/search -> Sequence[mdls.Look]
7383 def search_looks(
7384 self,
7385 # Match look id.
7386 id: Optional[str] = None,
7387 # Match Look title.
7388 title: Optional[str] = None,
7389 # Match Look description.
7390 description: Optional[str] = None,
7391 # Select looks with a particular content favorite id
7392 content_favorite_id: Optional[str] = None,
7393 # Select looks in a particular folder.
7394 folder_id: Optional[str] = None,
7395 # Select looks created by a particular user.
7396 user_id: Optional[str] = None,
7397 # Select looks with particular view_count value
7398 view_count: Optional[str] = None,
7399 # Select soft-deleted looks
7400 deleted: Optional[bool] = None,
7401 # Select looks that reference a particular query by query_id
7402 query_id: Optional[str] = None,
7403 # Exclude items that exist only in personal spaces other than the users
7404 curate: Optional[bool] = None,
7405 # Select looks based on when they were last viewed
7406 last_viewed_at: Optional[str] = None,
7407 # Requested fields.
7408 fields: Optional[str] = None,
7409 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
7410 page: Optional[int] = None,
7411 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
7412 per_page: Optional[int] = None,
7413 # Number of results to return. (used with offset and takes priority over page and per_page)
7414 limit: Optional[int] = None,
7415 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
7416 offset: Optional[int] = None,
7417 # 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, :certification_status]
7418 sorts: Optional[str] = None,
7419 # Combine given search criteria in a boolean OR expression
7420 filter_or: Optional[bool] = None,
7421 transport_options: Optional[transport.TransportOptions] = None,
7422 ) -> Sequence[mdls.Look]:
7423 """Search Looks"""
7424 response = cast(
7425 Sequence[mdls.Look],
7426 self.get(
7427 path="/looks/search",
7428 structure=Sequence[mdls.Look],
7429 query_params={
7430 "id": id,
7431 "title": title,
7432 "description": description,
7433 "content_favorite_id": content_favorite_id,
7434 "folder_id": folder_id,
7435 "user_id": user_id,
7436 "view_count": view_count,
7437 "deleted": deleted,
7438 "query_id": query_id,
7439 "curate": curate,
7440 "last_viewed_at": last_viewed_at,
7441 "fields": fields,
7442 "page": page,
7443 "per_page": per_page,
7444 "limit": limit,
7445 "offset": offset,
7446 "sorts": sorts,
7447 "filter_or": filter_or,
7448 },
7449 transport_options=transport_options,
7450 ),
7451 )
7452 return response
7453
7454 # ### Get a Look.
7455 #
7456 # Returns detailed information about a Look and its associated Query.
7457 #
7458 # GET /looks/{look_id} -> mdls.LookWithQuery
7459 def look(
7460 self,
7461 # Id of look
7462 look_id: str,
7463 # Requested fields.
7464 fields: Optional[str] = None,
7465 transport_options: Optional[transport.TransportOptions] = None,
7466 ) -> mdls.LookWithQuery:
7467 """Get Look"""
7468 look_id = self.encode_path_param(look_id)
7469 response = cast(
7470 mdls.LookWithQuery,
7471 self.get(
7472 path=f"/looks/{look_id}",
7473 structure=mdls.LookWithQuery,
7474 query_params={"fields": fields},
7475 transport_options=transport_options,
7476 ),
7477 )
7478 return response
7479
7480 # ### Modify a Look
7481 #
7482 # Use this function to modify parts of a look. Property values given in a call to `update_look` are
7483 # applied to the existing look, so there's no need to include properties whose values are not changing.
7484 # It's best to specify only the properties you want to change and leave everything else out
7485 # of your `update_look` call. **Look properties marked 'read-only' will be ignored.**
7486 #
7487 # When a user deletes a look in the Looker UI, the look data remains in the database but is
7488 # marked with a deleted flag ("soft-deleted"). Soft-deleted looks can be undeleted (by an admin)
7489 # if the delete was in error.
7490 #
7491 # To soft-delete a look via the API, use [update_look()](#!/Look/update_look) to change the look's `deleted` property to `true`.
7492 # You can undelete a look by calling `update_look` to change the look's `deleted` property to `false`.
7493 #
7494 # Soft-deleted looks are excluded from the results of [all_looks()](#!/Look/all_looks) and [search_looks()](#!/Look/search_looks), so they
7495 # essentially disappear from view even though they still reside in the db.
7496 # You can pass `deleted: true` as a parameter to [search_looks()](#!/Look/search_looks) to list soft-deleted looks.
7497 #
7498 # NOTE: [delete_look()](#!/Look/delete_look) performs a "hard delete" - the look data is removed from the Looker
7499 # database and destroyed. There is no "undo" for `delete_look()`.
7500 #
7501 # PATCH /looks/{look_id} -> mdls.LookWithQuery
7502 def update_look(
7503 self,
7504 # Id of look
7505 look_id: str,
7506 body: mdls.WriteLookWithQuery,
7507 # Requested fields.
7508 fields: Optional[str] = None,
7509 transport_options: Optional[transport.TransportOptions] = None,
7510 ) -> mdls.LookWithQuery:
7511 """Update Look"""
7512 look_id = self.encode_path_param(look_id)
7513 response = cast(
7514 mdls.LookWithQuery,
7515 self.patch(
7516 path=f"/looks/{look_id}",
7517 structure=mdls.LookWithQuery,
7518 query_params={"fields": fields},
7519 body=body,
7520 transport_options=transport_options,
7521 ),
7522 )
7523 return response
7524
7525 # ### Permanently Delete a Look
7526 #
7527 # This operation **permanently** removes a look from the Looker database.
7528 #
7529 # NOTE: There is no "undo" for this kind of delete.
7530 #
7531 # For information about soft-delete (which can be undone) see [update_look()](#!/Look/update_look).
7532 #
7533 # DELETE /looks/{look_id} -> str
7534 def delete_look(
7535 self,
7536 # Id of look
7537 look_id: str,
7538 transport_options: Optional[transport.TransportOptions] = None,
7539 ) -> str:
7540 """Delete Look"""
7541 look_id = self.encode_path_param(look_id)
7542 response = cast(
7543 str,
7544 self.delete(
7545 path=f"/looks/{look_id}",
7546 structure=str,
7547 transport_options=transport_options,
7548 ),
7549 )
7550 return response
7551
7552 # ### Run a Look
7553 #
7554 # Runs a given look's query and returns the results in the requested format.
7555 #
7556 # Supported formats:
7557 #
7558 # | result_format | Description
7559 # | :-----------: | :--- |
7560 # | json | Plain json
7561 # | json_bi | (*RECOMMENDED*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query. See JsonBi type for schema
7562 # | json_detail | (*LEGACY*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
7563 # | csv | Comma separated values with a header
7564 # | txt | Tab separated values with a header
7565 # | html | Simple html
7566 # | md | Simple markdown
7567 # | xlsx | MS Excel spreadsheet
7568 # | sql | Returns the generated SQL rather than running the query
7569 # | png | A PNG image of the visualization of the query
7570 # | jpg | A JPG image of the visualization of the query
7571 #
7572 # GET /looks/{look_id}/run/{result_format} -> Union[str, bytes]
7573 def run_look(
7574 self,
7575 # Id of look
7576 look_id: str,
7577 # Format of result
7578 result_format: str,
7579 # Row limit (may override the limit in the saved query).
7580 limit: Optional[int] = None,
7581 # Apply model-specified formatting to each result.
7582 apply_formatting: Optional[bool] = None,
7583 # Apply visualization options to results.
7584 apply_vis: Optional[bool] = None,
7585 # Get results from cache if available.
7586 cache: Optional[bool] = None,
7587 # Render width for image formats.
7588 image_width: Optional[int] = None,
7589 # Render height for image formats.
7590 image_height: Optional[int] = None,
7591 # Generate drill links (only applicable to 'json_detail' format.
7592 generate_drill_links: Optional[bool] = None,
7593 # 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.
7594 force_production: Optional[bool] = None,
7595 # Retrieve any results from cache even if the results have expired.
7596 cache_only: Optional[bool] = None,
7597 # Prefix to use for drill links (url encoded).
7598 path_prefix: Optional[str] = None,
7599 # Rebuild PDTS used in query.
7600 rebuild_pdts: Optional[bool] = None,
7601 # Perform table calculations on query results
7602 server_table_calcs: Optional[bool] = None,
7603 transport_options: Optional[transport.TransportOptions] = None,
7604 ) -> Union[str, bytes]:
7605 """Run Look"""
7606 look_id = self.encode_path_param(look_id)
7607 result_format = self.encode_path_param(result_format)
7608 response = cast(
7609 Union[str, bytes],
7610 self.get(
7611 path=f"/looks/{look_id}/run/{result_format}",
7612 structure=Union[str, bytes], # type: ignore
7613 query_params={
7614 "limit": limit,
7615 "apply_formatting": apply_formatting,
7616 "apply_vis": apply_vis,
7617 "cache": cache,
7618 "image_width": image_width,
7619 "image_height": image_height,
7620 "generate_drill_links": generate_drill_links,
7621 "force_production": force_production,
7622 "cache_only": cache_only,
7623 "path_prefix": path_prefix,
7624 "rebuild_pdts": rebuild_pdts,
7625 "server_table_calcs": server_table_calcs,
7626 },
7627 transport_options=transport_options,
7628 ),
7629 )
7630 return response
7631
7632 # ### Copy an existing look
7633 #
7634 # Creates a copy of an existing look, in a specified folder, and returns the copied look.
7635 #
7636 # `look_id` and `folder_id` are required.
7637 #
7638 # `look_id` and `folder_id` must already exist, and `folder_id` must be different from the current `folder_id` of the dashboard.
7639 #
7640 # POST /looks/{look_id}/copy -> mdls.LookWithQuery
7641 def copy_look(
7642 self,
7643 # Look id to copy.
7644 look_id: str,
7645 # Folder id to copy to.
7646 folder_id: Optional[str] = None,
7647 transport_options: Optional[transport.TransportOptions] = None,
7648 ) -> mdls.LookWithQuery:
7649 """Copy Look"""
7650 look_id = self.encode_path_param(look_id)
7651 response = cast(
7652 mdls.LookWithQuery,
7653 self.post(
7654 path=f"/looks/{look_id}/copy",
7655 structure=mdls.LookWithQuery,
7656 query_params={"folder_id": folder_id},
7657 transport_options=transport_options,
7658 ),
7659 )
7660 return response
7661
7662 # ### Move an existing look
7663 #
7664 # Moves a look to a specified folder, and returns the moved look.
7665 #
7666 # `look_id` and `folder_id` are required.
7667 # `look_id` and `folder_id` must already exist, and `folder_id` must be different from the current `folder_id` of the dashboard.
7668 #
7669 # PATCH /looks/{look_id}/move -> mdls.LookWithQuery
7670 def move_look(
7671 self,
7672 # Look id to move.
7673 look_id: str,
7674 # Folder id to move to.
7675 folder_id: str,
7676 transport_options: Optional[transport.TransportOptions] = None,
7677 ) -> mdls.LookWithQuery:
7678 """Move Look"""
7679 look_id = self.encode_path_param(look_id)
7680 response = cast(
7681 mdls.LookWithQuery,
7682 self.patch(
7683 path=f"/looks/{look_id}/move",
7684 structure=mdls.LookWithQuery,
7685 query_params={"folder_id": folder_id},
7686 transport_options=transport_options,
7687 ),
7688 )
7689 return response
7690
7691 # ### Update look certification
7692 #
7693 # PATCH /looks/{look_id}/certification -> mdls.Look
7694 def update_look_certification(
7695 self,
7696 # Look id to update certification.
7697 look_id: str,
7698 body: mdls.WriteCertification,
7699 transport_options: Optional[transport.TransportOptions] = None,
7700 ) -> mdls.Look:
7701 """Update Look Certification"""
7702 look_id = self.encode_path_param(look_id)
7703 response = cast(
7704 mdls.Look,
7705 self.patch(
7706 path=f"/looks/{look_id}/certification",
7707 structure=mdls.Look,
7708 body=body,
7709 transport_options=transport_options,
7710 ),
7711 )
7712 return response
7713
7714 # endregion
7715
7716 # region LookmlModel: Manage LookML Models
7717
7718 # ### Get information about all lookml models.
7719 #
7720 # GET /lookml_models -> Sequence[mdls.LookmlModel]
7721 def all_lookml_models(
7722 self,
7723 # Requested fields.
7724 fields: Optional[str] = None,
7725 # Number of results to return. (can be used with offset)
7726 limit: Optional[int] = None,
7727 # Number of results to skip before returning any. (Defaults to 0 if not set when limit is used)
7728 offset: Optional[int] = None,
7729 # Whether or not to exclude models with no explores from the response (Defaults to false)
7730 exclude_empty: Optional[bool] = None,
7731 # Whether or not to exclude hidden explores from the response (Defaults to false)
7732 exclude_hidden: Optional[bool] = None,
7733 # Whether or not to include built-in models such as System Activity (Defaults to false)
7734 include_internal: Optional[bool] = None,
7735 # Whether or not to include self service models (Defaults to false)
7736 include_self_service: Optional[bool] = None,
7737 transport_options: Optional[transport.TransportOptions] = None,
7738 ) -> Sequence[mdls.LookmlModel]:
7739 """Get All LookML Models"""
7740 response = cast(
7741 Sequence[mdls.LookmlModel],
7742 self.get(
7743 path="/lookml_models",
7744 structure=Sequence[mdls.LookmlModel],
7745 query_params={
7746 "fields": fields,
7747 "limit": limit,
7748 "offset": offset,
7749 "exclude_empty": exclude_empty,
7750 "exclude_hidden": exclude_hidden,
7751 "include_internal": include_internal,
7752 "include_self_service": include_self_service,
7753 },
7754 transport_options=transport_options,
7755 ),
7756 )
7757 return response
7758
7759 # ### Create a lookml model using the specified configuration.
7760 #
7761 # POST /lookml_models -> mdls.LookmlModel
7762 def create_lookml_model(
7763 self,
7764 body: mdls.WriteLookmlModel,
7765 transport_options: Optional[transport.TransportOptions] = None,
7766 ) -> mdls.LookmlModel:
7767 """Create LookML Model"""
7768 response = cast(
7769 mdls.LookmlModel,
7770 self.post(
7771 path="/lookml_models",
7772 structure=mdls.LookmlModel,
7773 body=body,
7774 transport_options=transport_options,
7775 ),
7776 )
7777 return response
7778
7779 # ### Get information about a lookml model.
7780 #
7781 # GET /lookml_models/{lookml_model_name} -> mdls.LookmlModel
7782 def lookml_model(
7783 self,
7784 # Name of lookml model.
7785 lookml_model_name: str,
7786 # Requested fields.
7787 fields: Optional[str] = None,
7788 transport_options: Optional[transport.TransportOptions] = None,
7789 ) -> mdls.LookmlModel:
7790 """Get LookML Model"""
7791 lookml_model_name = self.encode_path_param(lookml_model_name)
7792 response = cast(
7793 mdls.LookmlModel,
7794 self.get(
7795 path=f"/lookml_models/{lookml_model_name}",
7796 structure=mdls.LookmlModel,
7797 query_params={"fields": fields},
7798 transport_options=transport_options,
7799 ),
7800 )
7801 return response
7802
7803 # ### Update a lookml model using the specified configuration.
7804 #
7805 # PATCH /lookml_models/{lookml_model_name} -> mdls.LookmlModel
7806 def update_lookml_model(
7807 self,
7808 # Name of lookml model.
7809 lookml_model_name: str,
7810 body: mdls.WriteLookmlModel,
7811 transport_options: Optional[transport.TransportOptions] = None,
7812 ) -> mdls.LookmlModel:
7813 """Update LookML Model"""
7814 lookml_model_name = self.encode_path_param(lookml_model_name)
7815 response = cast(
7816 mdls.LookmlModel,
7817 self.patch(
7818 path=f"/lookml_models/{lookml_model_name}",
7819 structure=mdls.LookmlModel,
7820 body=body,
7821 transport_options=transport_options,
7822 ),
7823 )
7824 return response
7825
7826 # ### Delete a lookml model.
7827 #
7828 # DELETE /lookml_models/{lookml_model_name} -> str
7829 def delete_lookml_model(
7830 self,
7831 # Name of lookml model.
7832 lookml_model_name: str,
7833 transport_options: Optional[transport.TransportOptions] = None,
7834 ) -> str:
7835 """Delete LookML Model"""
7836 lookml_model_name = self.encode_path_param(lookml_model_name)
7837 response = cast(
7838 str,
7839 self.delete(
7840 path=f"/lookml_models/{lookml_model_name}",
7841 structure=str,
7842 transport_options=transport_options,
7843 ),
7844 )
7845 return response
7846
7847 # ### Get information about a lookml model explore.
7848 #
7849 # GET /lookml_models/{lookml_model_name}/explores/{explore_name} -> mdls.LookmlModelExplore
7850 def lookml_model_explore(
7851 self,
7852 # Name of lookml model.
7853 lookml_model_name: str,
7854 # Name of explore.
7855 explore_name: str,
7856 # Requested fields.
7857 fields: Optional[str] = None,
7858 # Whether response should include drill field metadata.
7859 add_drills_metadata: Optional[bool] = None,
7860 transport_options: Optional[transport.TransportOptions] = None,
7861 ) -> mdls.LookmlModelExplore:
7862 """Get LookML Model Explore"""
7863 lookml_model_name = self.encode_path_param(lookml_model_name)
7864 explore_name = self.encode_path_param(explore_name)
7865 response = cast(
7866 mdls.LookmlModelExplore,
7867 self.get(
7868 path=f"/lookml_models/{lookml_model_name}/explores/{explore_name}",
7869 structure=mdls.LookmlModelExplore,
7870 query_params={
7871 "fields": fields,
7872 "add_drills_metadata": add_drills_metadata,
7873 },
7874 transport_options=transport_options,
7875 ),
7876 )
7877 return response
7878
7879 # endregion
7880
7881 # region Metadata: Connection Metadata Features
7882
7883 # ### Field name suggestions for a model and view
7884 #
7885 # `filters` is a string hash of values, with the key as the field name and the string value as the filter expression:
7886 #
7887 # ```ruby
7888 # {'users.age': '>=60'}
7889 # ```
7890 #
7891 # or
7892 #
7893 # ```ruby
7894 # {'users.age': '<30'}
7895 # ```
7896 #
7897 # or
7898 #
7899 # ```ruby
7900 # {'users.age': '=50'}
7901 # ```
7902 #
7903 # GET /models/{model_name}/views/{view_name}/fields/{field_name}/suggestions -> mdls.ModelFieldSuggestions
7904 def model_fieldname_suggestions(
7905 self,
7906 # Name of model
7907 model_name: str,
7908 # Name of view
7909 view_name: str,
7910 # Name of field to use for suggestions
7911 field_name: str,
7912 # Search term pattern (evaluated as as `%term%`)
7913 term: Optional[str] = None,
7914 # Suggestion filters with field name keys and comparison expressions
7915 filters: Optional[str] = None,
7916 transport_options: Optional[transport.TransportOptions] = None,
7917 ) -> mdls.ModelFieldSuggestions:
7918 """Model field name suggestions"""
7919 model_name = self.encode_path_param(model_name)
7920 view_name = self.encode_path_param(view_name)
7921 field_name = self.encode_path_param(field_name)
7922 response = cast(
7923 mdls.ModelFieldSuggestions,
7924 self.get(
7925 path=f"/models/{model_name}/views/{view_name}/fields/{field_name}/suggestions",
7926 structure=mdls.ModelFieldSuggestions,
7927 query_params={"term": term, "filters": filters},
7928 transport_options=transport_options,
7929 ),
7930 )
7931 return response
7932
7933 # ### Get a single model
7934 #
7935 # GET /models/{model_name} -> mdls.Model
7936 def get_model(
7937 self,
7938 # Name of model
7939 model_name: str,
7940 transport_options: Optional[transport.TransportOptions] = None,
7941 ) -> mdls.Model:
7942 """Get a single model"""
7943 model_name = self.encode_path_param(model_name)
7944 response = cast(
7945 mdls.Model,
7946 self.get(
7947 path=f"/models/{model_name}",
7948 structure=mdls.Model,
7949 transport_options=transport_options,
7950 ),
7951 )
7952 return response
7953
7954 # ### List databases available to this connection
7955 #
7956 # Certain dialects can support multiple databases per single connection.
7957 # If this connection supports multiple databases, the database names will be returned in an array.
7958 #
7959 # Connections using dialects that do not support multiple databases will return an empty array.
7960 #
7961 # **Note**: [Connection Features](#!/Metadata/connection_features) can be used to determine if a connection supports
7962 # multiple databases.
7963 #
7964 # GET /connections/{connection_name}/databases -> Sequence[str]
7965 def connection_databases(
7966 self,
7967 # Name of connection
7968 connection_name: str,
7969 transport_options: Optional[transport.TransportOptions] = None,
7970 ) -> Sequence[str]:
7971 """List accessible databases to this connection"""
7972 connection_name = self.encode_path_param(connection_name)
7973 response = cast(
7974 Sequence[str],
7975 self.get(
7976 path=f"/connections/{connection_name}/databases",
7977 structure=Sequence[str],
7978 transport_options=transport_options,
7979 ),
7980 )
7981 return response
7982
7983 # ### Retrieve metadata features for this connection
7984 #
7985 # Returns a list of feature names with `true` (available) or `false` (not available)
7986 #
7987 # GET /connections/{connection_name}/features -> mdls.ConnectionFeatures
7988 def connection_features(
7989 self,
7990 # Name of connection
7991 connection_name: str,
7992 # Requested fields.
7993 fields: Optional[str] = None,
7994 transport_options: Optional[transport.TransportOptions] = None,
7995 ) -> mdls.ConnectionFeatures:
7996 """Metadata features supported by this connection"""
7997 connection_name = self.encode_path_param(connection_name)
7998 response = cast(
7999 mdls.ConnectionFeatures,
8000 self.get(
8001 path=f"/connections/{connection_name}/features",
8002 structure=mdls.ConnectionFeatures,
8003 query_params={"fields": fields},
8004 transport_options=transport_options,
8005 ),
8006 )
8007 return response
8008
8009 # ### Get the list of schemas and tables for a connection
8010 #
8011 # GET /connections/{connection_name}/schemas -> Sequence[mdls.Schema]
8012 def connection_schemas(
8013 self,
8014 # Name of connection
8015 connection_name: str,
8016 # For dialects that support multiple databases, optionally identify which to use
8017 database: Optional[str] = None,
8018 # True to use fetch from cache, false to load fresh
8019 cache: Optional[bool] = None,
8020 # Requested fields.
8021 fields: Optional[str] = None,
8022 transport_options: Optional[transport.TransportOptions] = None,
8023 ) -> Sequence[mdls.Schema]:
8024 """Get schemas for a connection"""
8025 connection_name = self.encode_path_param(connection_name)
8026 response = cast(
8027 Sequence[mdls.Schema],
8028 self.get(
8029 path=f"/connections/{connection_name}/schemas",
8030 structure=Sequence[mdls.Schema],
8031 query_params={"database": database, "cache": cache, "fields": fields},
8032 transport_options=transport_options,
8033 ),
8034 )
8035 return response
8036
8037 # ### Get the list of tables for a schema
8038 #
8039 # For dialects that support multiple databases, optionally identify which to use. If not provided, the default
8040 # database for the connection will be used.
8041 #
8042 # For dialects that do **not** support multiple databases, **do not use** the database parameter
8043 #
8044 # GET /connections/{connection_name}/tables -> Sequence[mdls.SchemaTables]
8045 def connection_tables(
8046 self,
8047 # Name of connection
8048 connection_name: str,
8049 # Optional. Name of database to use for the query, only if applicable
8050 database: Optional[str] = None,
8051 # Optional. Return only tables for this schema
8052 schema_name: Optional[str] = None,
8053 # True to fetch from cache, false to load fresh
8054 cache: Optional[bool] = None,
8055 # Requested fields.
8056 fields: Optional[str] = None,
8057 # Optional. Return tables with names that contain this value
8058 table_filter: Optional[str] = None,
8059 # Optional. Return tables up to the table_limit
8060 table_limit: Optional[int] = None,
8061 transport_options: Optional[transport.TransportOptions] = None,
8062 ) -> Sequence[mdls.SchemaTables]:
8063 """Get tables for a connection"""
8064 connection_name = self.encode_path_param(connection_name)
8065 response = cast(
8066 Sequence[mdls.SchemaTables],
8067 self.get(
8068 path=f"/connections/{connection_name}/tables",
8069 structure=Sequence[mdls.SchemaTables],
8070 query_params={
8071 "database": database,
8072 "schema_name": schema_name,
8073 "cache": cache,
8074 "fields": fields,
8075 "table_filter": table_filter,
8076 "table_limit": table_limit,
8077 },
8078 transport_options=transport_options,
8079 ),
8080 )
8081 return response
8082
8083 # ### Get the columns (and therefore also the tables) in a specific schema
8084 #
8085 # GET /connections/{connection_name}/columns -> Sequence[mdls.SchemaColumns]
8086 def connection_columns(
8087 self,
8088 # Name of connection
8089 connection_name: str,
8090 # For dialects that support multiple databases, optionally identify which to use
8091 database: Optional[str] = None,
8092 # Name of schema to use.
8093 schema_name: Optional[str] = None,
8094 # True to fetch from cache, false to load fresh
8095 cache: Optional[bool] = None,
8096 # limits the tables per schema returned
8097 table_limit: Optional[int] = None,
8098 # only fetch columns for a given (comma-separated) list of tables
8099 table_names: Optional[str] = None,
8100 # Requested fields.
8101 fields: Optional[str] = None,
8102 transport_options: Optional[transport.TransportOptions] = None,
8103 ) -> Sequence[mdls.SchemaColumns]:
8104 """Get columns for a connection"""
8105 connection_name = self.encode_path_param(connection_name)
8106 response = cast(
8107 Sequence[mdls.SchemaColumns],
8108 self.get(
8109 path=f"/connections/{connection_name}/columns",
8110 structure=Sequence[mdls.SchemaColumns],
8111 query_params={
8112 "database": database,
8113 "schema_name": schema_name,
8114 "cache": cache,
8115 "table_limit": table_limit,
8116 "table_names": table_names,
8117 "fields": fields,
8118 },
8119 transport_options=transport_options,
8120 ),
8121 )
8122 return response
8123
8124 # ### Search a connection for columns matching the specified name
8125 #
8126 # **Note**: `column_name` must be a valid column name. It is not a search pattern.
8127 #
8128 # GET /connections/{connection_name}/search_columns -> Sequence[mdls.ColumnSearch]
8129 def connection_search_columns(
8130 self,
8131 # Name of connection
8132 connection_name: str,
8133 # Column name to find
8134 column_name: Optional[str] = None,
8135 # Requested fields.
8136 fields: Optional[str] = None,
8137 transport_options: Optional[transport.TransportOptions] = None,
8138 ) -> Sequence[mdls.ColumnSearch]:
8139 """Search a connection for columns"""
8140 connection_name = self.encode_path_param(connection_name)
8141 response = cast(
8142 Sequence[mdls.ColumnSearch],
8143 self.get(
8144 path=f"/connections/{connection_name}/search_columns",
8145 structure=Sequence[mdls.ColumnSearch],
8146 query_params={"column_name": column_name, "fields": fields},
8147 transport_options=transport_options,
8148 ),
8149 )
8150 return response
8151
8152 # ### Connection cost estimating
8153 #
8154 # Assign a `sql` statement to the body of the request. e.g., for Ruby, `{sql: 'select * from users'}`
8155 #
8156 # **Note**: If the connection's dialect has no support for cost estimates, an error will be returned
8157 #
8158 # POST /connections/{connection_name}/cost_estimate -> mdls.CostEstimate
8159 def connection_cost_estimate(
8160 self,
8161 # Name of connection
8162 connection_name: str,
8163 # WARNING: no writeable properties found for POST, PUT, or PATCH
8164 body: mdls.CreateCostEstimate,
8165 # Requested fields.
8166 fields: Optional[str] = None,
8167 transport_options: Optional[transport.TransportOptions] = None,
8168 ) -> mdls.CostEstimate:
8169 """Estimate costs for a connection"""
8170 connection_name = self.encode_path_param(connection_name)
8171 response = cast(
8172 mdls.CostEstimate,
8173 self.post(
8174 path=f"/connections/{connection_name}/cost_estimate",
8175 structure=mdls.CostEstimate,
8176 query_params={"fields": fields},
8177 body=body,
8178 transport_options=transport_options,
8179 ),
8180 )
8181 return response
8182
8183 # endregion
8184
8185 # region Project: Manage Projects
8186
8187 # ### Fetches a CI Run.
8188 #
8189 # GET /projects/{project_id}/ci/runs/{run_id} -> mdls.ProjectRun
8190 def get_ci_run(
8191 self,
8192 # Project Id
8193 project_id: str,
8194 # Run Id
8195 run_id: str,
8196 # Requested fields
8197 fields: Optional[str] = None,
8198 transport_options: Optional[transport.TransportOptions] = None,
8199 ) -> mdls.ProjectRun:
8200 """Fetch Continuous Integration run"""
8201 project_id = self.encode_path_param(project_id)
8202 run_id = self.encode_path_param(run_id)
8203 response = cast(
8204 mdls.ProjectRun,
8205 self.get(
8206 path=f"/projects/{project_id}/ci/runs/{run_id}",
8207 structure=mdls.ProjectRun,
8208 query_params={"fields": fields},
8209 transport_options=transport_options,
8210 ),
8211 )
8212 return response
8213
8214 # ### Creates a CI Run.
8215 #
8216 # POST /projects/{project_id}/ci/run -> mdls.CreateCIRunResponse
8217 def create_ci_run(
8218 self,
8219 # Project Id
8220 project_id: str,
8221 body: mdls.CreateCIRunRequest,
8222 # Requested fields
8223 fields: Optional[str] = None,
8224 transport_options: Optional[transport.TransportOptions] = None,
8225 ) -> mdls.CreateCIRunResponse:
8226 """Create a Continuous Integration run"""
8227 project_id = self.encode_path_param(project_id)
8228 response = cast(
8229 mdls.CreateCIRunResponse,
8230 self.post(
8231 path=f"/projects/{project_id}/ci/run",
8232 structure=mdls.CreateCIRunResponse,
8233 query_params={"fields": fields},
8234 body=body,
8235 transport_options=transport_options,
8236 ),
8237 )
8238 return response
8239
8240 # ### Generate Lockfile for All LookML Dependencies
8241 #
8242 # Git must have been configured, must be in dev mode and deploy permission required
8243 #
8244 # Install_all is a two step process
8245 # 1. For each remote_dependency in a project the dependency manager will resolve any ambiguous ref.
8246 # 2. The project will then write out a lockfile including each remote_dependency with its resolved ref.
8247 #
8248 # POST /projects/{project_id}/manifest/lock_all -> str
8249 def lock_all(
8250 self,
8251 # Id of project
8252 project_id: str,
8253 # Requested fields
8254 fields: Optional[str] = None,
8255 transport_options: Optional[transport.TransportOptions] = None,
8256 ) -> str:
8257 """Lock All"""
8258 project_id = self.encode_path_param(project_id)
8259 response = cast(
8260 str,
8261 self.post(
8262 path=f"/projects/{project_id}/manifest/lock_all",
8263 structure=str,
8264 query_params={"fields": fields},
8265 transport_options=transport_options,
8266 ),
8267 )
8268 return response
8269
8270 # ### Get All Git Branches
8271 #
8272 # Returns a list of git branches in the project repository
8273 #
8274 # GET /projects/{project_id}/git_branches -> Sequence[mdls.GitBranch]
8275 def all_git_branches(
8276 self,
8277 # Project Id
8278 project_id: str,
8279 transport_options: Optional[transport.TransportOptions] = None,
8280 ) -> Sequence[mdls.GitBranch]:
8281 """Get All Git Branches"""
8282 project_id = self.encode_path_param(project_id)
8283 response = cast(
8284 Sequence[mdls.GitBranch],
8285 self.get(
8286 path=f"/projects/{project_id}/git_branches",
8287 structure=Sequence[mdls.GitBranch],
8288 transport_options=transport_options,
8289 ),
8290 )
8291 return response
8292
8293 # ### Get the Current Git Branch
8294 #
8295 # Returns the git branch currently checked out in the given project repository
8296 #
8297 # GET /projects/{project_id}/git_branch -> mdls.GitBranch
8298 def git_branch(
8299 self,
8300 # Project Id
8301 project_id: str,
8302 transport_options: Optional[transport.TransportOptions] = None,
8303 ) -> mdls.GitBranch:
8304 """Get Active Git Branch"""
8305 project_id = self.encode_path_param(project_id)
8306 response = cast(
8307 mdls.GitBranch,
8308 self.get(
8309 path=f"/projects/{project_id}/git_branch",
8310 structure=mdls.GitBranch,
8311 transport_options=transport_options,
8312 ),
8313 )
8314 return response
8315
8316 # ### Checkout and/or reset --hard an existing Git Branch
8317 #
8318 # Only allowed in development mode
8319 # - Call `update_session` to select the 'dev' workspace.
8320 #
8321 # Checkout an existing branch if name field is different from the name of the currently checked out branch.
8322 #
8323 # Optionally specify a branch name, tag name or commit SHA to which the branch should be reset.
8324 # **DANGER** hard reset will be force pushed to the remote. Unsaved changes and commits may be permanently lost.
8325 #
8326 # PUT /projects/{project_id}/git_branch -> mdls.GitBranch
8327 def update_git_branch(
8328 self,
8329 # Project Id
8330 project_id: str,
8331 body: mdls.WriteGitBranch,
8332 transport_options: Optional[transport.TransportOptions] = None,
8333 ) -> mdls.GitBranch:
8334 """Update Project Git Branch"""
8335 project_id = self.encode_path_param(project_id)
8336 response = cast(
8337 mdls.GitBranch,
8338 self.put(
8339 path=f"/projects/{project_id}/git_branch",
8340 structure=mdls.GitBranch,
8341 body=body,
8342 transport_options=transport_options,
8343 ),
8344 )
8345 return response
8346
8347 # ### Create and Checkout a Git Branch
8348 #
8349 # Creates and checks out a new branch in the given project repository
8350 # Only allowed in development mode
8351 # - Call `update_session` to select the 'dev' workspace.
8352 #
8353 # Optionally specify a branch name, tag name or commit SHA as the start point in the ref field.
8354 # If no ref is specified, HEAD of the current branch will be used as the start point for the new branch.
8355 #
8356 # POST /projects/{project_id}/git_branch -> mdls.GitBranch
8357 def create_git_branch(
8358 self,
8359 # Project Id
8360 project_id: str,
8361 body: mdls.WriteGitBranch,
8362 transport_options: Optional[transport.TransportOptions] = None,
8363 ) -> mdls.GitBranch:
8364 """Checkout New Git Branch"""
8365 project_id = self.encode_path_param(project_id)
8366 response = cast(
8367 mdls.GitBranch,
8368 self.post(
8369 path=f"/projects/{project_id}/git_branch",
8370 structure=mdls.GitBranch,
8371 body=body,
8372 transport_options=transport_options,
8373 ),
8374 )
8375 return response
8376
8377 # ### Get the specified Git Branch
8378 #
8379 # Returns the git branch specified in branch_name path param if it exists in the given project repository
8380 #
8381 # GET /projects/{project_id}/git_branch/{branch_name} -> mdls.GitBranch
8382 def find_git_branch(
8383 self,
8384 # Project Id
8385 project_id: str,
8386 # Branch Name
8387 branch_name: str,
8388 transport_options: Optional[transport.TransportOptions] = None,
8389 ) -> mdls.GitBranch:
8390 """Find a Git Branch"""
8391 project_id = self.encode_path_param(project_id)
8392 branch_name = self.encode_path_param(branch_name)
8393 response = cast(
8394 mdls.GitBranch,
8395 self.get(
8396 path=f"/projects/{project_id}/git_branch/{branch_name}",
8397 structure=mdls.GitBranch,
8398 transport_options=transport_options,
8399 ),
8400 )
8401 return response
8402
8403 # ### Delete the specified Git Branch
8404 #
8405 # Delete git branch specified in branch_name path param from local and remote of specified project repository
8406 #
8407 # DELETE /projects/{project_id}/git_branch/{branch_name} -> str
8408 def delete_git_branch(
8409 self,
8410 # Project Id
8411 project_id: str,
8412 # Branch Name
8413 branch_name: str,
8414 transport_options: Optional[transport.TransportOptions] = None,
8415 ) -> str:
8416 """Delete a Git Branch"""
8417 project_id = self.encode_path_param(project_id)
8418 branch_name = self.encode_path_param(branch_name)
8419 response = cast(
8420 str,
8421 self.delete(
8422 path=f"/projects/{project_id}/git_branch/{branch_name}",
8423 structure=str,
8424 transport_options=transport_options,
8425 ),
8426 )
8427 return response
8428
8429 # ### Deploy a Remote Branch or Ref to Production
8430 #
8431 # Git must have been configured and deploy permission required.
8432 #
8433 # Deploy is a one/two step process
8434 # 1. If this is the first deploy of this project, create the production project with git repository.
8435 # 2. Pull the branch or ref into the production project.
8436 #
8437 # Can only specify either a branch or a ref.
8438 #
8439 # POST /projects/{project_id}/deploy_ref_to_production -> str
8440 def deploy_ref_to_production(
8441 self,
8442 # Id of project
8443 project_id: str,
8444 # Branch to deploy to production
8445 branch: Optional[str] = None,
8446 # Ref to deploy to production
8447 ref: Optional[str] = None,
8448 transport_options: Optional[transport.TransportOptions] = None,
8449 ) -> str:
8450 """Deploy Remote Branch or Ref to Production"""
8451 project_id = self.encode_path_param(project_id)
8452 response = cast(
8453 str,
8454 self.post(
8455 path=f"/projects/{project_id}/deploy_ref_to_production",
8456 structure=str,
8457 query_params={"branch": branch, "ref": ref},
8458 transport_options=transport_options,
8459 ),
8460 )
8461 return response
8462
8463 # ### Deploy LookML from this Development Mode Project to Production
8464 #
8465 # Git must have been configured, must be in dev mode and deploy permission required
8466 #
8467 # Deploy is a two / three step process:
8468 #
8469 # 1. Push commits in current branch of dev mode project to the production branch (origin/master).
8470 # Note a. This step is skipped in read-only projects.
8471 # Note b. If this step is unsuccessful for any reason (e.g. rejected non-fastforward because production branch has
8472 # commits not in current branch), subsequent steps will be skipped.
8473 # 2. If this is the first deploy of this project, create the production project with git repository.
8474 # 3. Pull the production branch into the production project.
8475 #
8476 # POST /projects/{project_id}/deploy_to_production -> str
8477 def deploy_to_production(
8478 self,
8479 # Id of project
8480 project_id: str,
8481 transport_options: Optional[transport.TransportOptions] = None,
8482 ) -> str:
8483 """Deploy To Production"""
8484 project_id = self.encode_path_param(project_id)
8485 response = cast(
8486 str,
8487 self.post(
8488 path=f"/projects/{project_id}/deploy_to_production",
8489 structure=str,
8490 transport_options=transport_options,
8491 ),
8492 )
8493 return response
8494
8495 # ### Reset a project to the revision of the project that is in production.
8496 #
8497 # **DANGER** this will delete any changes that have not been pushed to a remote repository.
8498 #
8499 # POST /projects/{project_id}/reset_to_production -> str
8500 def reset_project_to_production(
8501 self,
8502 # Id of project
8503 project_id: str,
8504 transport_options: Optional[transport.TransportOptions] = None,
8505 ) -> str:
8506 """Reset To Production"""
8507 project_id = self.encode_path_param(project_id)
8508 response = cast(
8509 str,
8510 self.post(
8511 path=f"/projects/{project_id}/reset_to_production",
8512 structure=str,
8513 transport_options=transport_options,
8514 ),
8515 )
8516 return response
8517
8518 # ### Reset a project development branch to the revision of the project that is on the remote.
8519 #
8520 # **DANGER** this will delete any changes that have not been pushed to a remote repository.
8521 #
8522 # POST /projects/{project_id}/reset_to_remote -> str
8523 def reset_project_to_remote(
8524 self,
8525 # Id of project
8526 project_id: str,
8527 transport_options: Optional[transport.TransportOptions] = None,
8528 ) -> str:
8529 """Reset To Remote"""
8530 project_id = self.encode_path_param(project_id)
8531 response = cast(
8532 str,
8533 self.post(
8534 path=f"/projects/{project_id}/reset_to_remote",
8535 structure=str,
8536 transport_options=transport_options,
8537 ),
8538 )
8539 return response
8540
8541 # ### Get All Projects
8542 #
8543 # Returns all projects visible to the current user
8544 #
8545 # GET /projects -> Sequence[mdls.Project]
8546 def all_projects(
8547 self,
8548 # Requested fields
8549 fields: Optional[str] = None,
8550 transport_options: Optional[transport.TransportOptions] = None,
8551 ) -> Sequence[mdls.Project]:
8552 """Get All Projects"""
8553 response = cast(
8554 Sequence[mdls.Project],
8555 self.get(
8556 path="/projects",
8557 structure=Sequence[mdls.Project],
8558 query_params={"fields": fields},
8559 transport_options=transport_options,
8560 ),
8561 )
8562 return response
8563
8564 # ### Create A Project
8565 #
8566 # dev mode required.
8567 # - Call `update_session` to select the 'dev' workspace.
8568 #
8569 # `name` is required.
8570 # `git_remote_url` is not allowed. To configure Git for the newly created project, follow the instructions in `update_project`.
8571 #
8572 # POST /projects -> mdls.Project
8573 def create_project(
8574 self,
8575 body: mdls.WriteProject,
8576 transport_options: Optional[transport.TransportOptions] = None,
8577 ) -> mdls.Project:
8578 """Create Project"""
8579 response = cast(
8580 mdls.Project,
8581 self.post(
8582 path="/projects",
8583 structure=mdls.Project,
8584 body=body,
8585 transport_options=transport_options,
8586 ),
8587 )
8588 return response
8589
8590 # ### Get A Project
8591 #
8592 # Returns the project with the given project id
8593 #
8594 # GET /projects/{project_id} -> mdls.Project
8595 def project(
8596 self,
8597 # Project Id
8598 project_id: str,
8599 # Requested fields
8600 fields: Optional[str] = None,
8601 transport_options: Optional[transport.TransportOptions] = None,
8602 ) -> mdls.Project:
8603 """Get Project"""
8604 project_id = self.encode_path_param(project_id)
8605 response = cast(
8606 mdls.Project,
8607 self.get(
8608 path=f"/projects/{project_id}",
8609 structure=mdls.Project,
8610 query_params={"fields": fields},
8611 transport_options=transport_options,
8612 ),
8613 )
8614 return response
8615
8616 # ### Update Project Configuration
8617 #
8618 # Apply changes to a project's configuration.
8619 #
8620 #
8621 # #### Configuring Git for a Project
8622 #
8623 # To set up a Looker project with a remote git repository, follow these steps:
8624 #
8625 # 1. Call `update_session` to select the 'dev' workspace.
8626 # 1. Call `create_git_deploy_key` to create a new deploy key for the project
8627 # 1. Copy the deploy key text into the remote git repository's ssh key configuration
8628 # 1. Call `update_project` to set project's `git_remote_url` ()and `git_service_name`, if necessary).
8629 #
8630 # When you modify a project's `git_remote_url`, Looker connects to the remote repository to fetch
8631 # metadata. The remote git repository MUST be configured with the Looker-generated deploy
8632 # key for this project prior to setting the project's `git_remote_url`.
8633 #
8634 # Note that Looker will validate the git connection when the `git_remote_url` is modified.
8635 # If Looker cannot connect to the remote repository (e.g. because the deploy key has not
8636 # been added), the update will fail with a 400 Bad Request error.
8637 #
8638 # To set up a Looker project with a git repository residing on the Looker server (a 'bare' git repo):
8639 #
8640 # 1. Call `update_session` to select the 'dev' workspace.
8641 # 1. Call `update_project` setting `git_remote_url` to null and `git_service_name` to "bare".
8642 #
8643 # PATCH /projects/{project_id} -> mdls.Project
8644 def update_project(
8645 self,
8646 # Project Id
8647 project_id: str,
8648 body: mdls.WriteProject,
8649 # Requested fields
8650 fields: Optional[str] = None,
8651 transport_options: Optional[transport.TransportOptions] = None,
8652 ) -> mdls.Project:
8653 """Update Project"""
8654 project_id = self.encode_path_param(project_id)
8655 response = cast(
8656 mdls.Project,
8657 self.patch(
8658 path=f"/projects/{project_id}",
8659 structure=mdls.Project,
8660 query_params={"fields": fields},
8661 body=body,
8662 transport_options=transport_options,
8663 ),
8664 )
8665 return response
8666
8667 # ### Get A Projects Manifest object
8668 #
8669 # Returns the project with the given project id
8670 #
8671 # GET /projects/{project_id}/manifest -> mdls.Manifest
8672 def manifest(
8673 self,
8674 # Project Id
8675 project_id: str,
8676 transport_options: Optional[transport.TransportOptions] = None,
8677 ) -> mdls.Manifest:
8678 """Get Manifest"""
8679 project_id = self.encode_path_param(project_id)
8680 response = cast(
8681 mdls.Manifest,
8682 self.get(
8683 path=f"/projects/{project_id}/manifest",
8684 structure=mdls.Manifest,
8685 transport_options=transport_options,
8686 ),
8687 )
8688 return response
8689
8690 # ### Git Deploy Key
8691 #
8692 # Returns the ssh public key previously created for a project's git repository.
8693 #
8694 # GET /projects/{project_id}/git/deploy_key -> str
8695 def git_deploy_key(
8696 self,
8697 # Project Id
8698 project_id: str,
8699 transport_options: Optional[transport.TransportOptions] = None,
8700 ) -> str:
8701 """Git Deploy Key"""
8702 project_id = self.encode_path_param(project_id)
8703 response = cast(
8704 str,
8705 self.get(
8706 path=f"/projects/{project_id}/git/deploy_key",
8707 structure=str,
8708 transport_options=transport_options,
8709 ),
8710 )
8711 return response
8712
8713 # ### Create Git Deploy Key
8714 #
8715 # Create a public/private key pair for authenticating ssh git requests from Looker to a remote git repository
8716 # for a particular Looker project.
8717 #
8718 # Returns the public key of the generated ssh key pair.
8719 #
8720 # Copy this public key to your remote git repository's ssh keys configuration so that the remote git service can
8721 # validate and accept git requests from the Looker server.
8722 #
8723 # POST /projects/{project_id}/git/deploy_key -> str
8724 def create_git_deploy_key(
8725 self,
8726 # Project Id
8727 project_id: str,
8728 transport_options: Optional[transport.TransportOptions] = None,
8729 ) -> str:
8730 """Create Deploy Key"""
8731 project_id = self.encode_path_param(project_id)
8732 response = cast(
8733 str,
8734 self.post(
8735 path=f"/projects/{project_id}/git/deploy_key",
8736 structure=str,
8737 transport_options=transport_options,
8738 ),
8739 )
8740 return response
8741
8742 # ### Get Cached Project Validation Results
8743 #
8744 # Returns the cached results of a previous project validation calculation, if any.
8745 # Returns http status 204 No Content if no validation results exist.
8746 #
8747 # Validating the content of all the files in a project can be computationally intensive
8748 # for large projects. Use this API to simply fetch the results of the most recent
8749 # project validation rather than revalidating the entire project from scratch.
8750 #
8751 # A value of `"stale": true` in the response indicates that the project has changed since
8752 # the cached validation results were computed. The cached validation results may no longer
8753 # reflect the current state of the project.
8754 #
8755 # GET /projects/{project_id}/validate -> mdls.ProjectValidationCache
8756 def project_validation_results(
8757 self,
8758 # Project Id
8759 project_id: str,
8760 # Requested fields
8761 fields: Optional[str] = None,
8762 transport_options: Optional[transport.TransportOptions] = None,
8763 ) -> mdls.ProjectValidationCache:
8764 """Cached Project Validation Results"""
8765 project_id = self.encode_path_param(project_id)
8766 response = cast(
8767 mdls.ProjectValidationCache,
8768 self.get(
8769 path=f"/projects/{project_id}/validate",
8770 structure=mdls.ProjectValidationCache,
8771 query_params={"fields": fields},
8772 transport_options=transport_options,
8773 ),
8774 )
8775 return response
8776
8777 # ### Validate Project
8778 #
8779 # Performs lint validation of all lookml files in the project.
8780 # Returns a list of errors found, if any.
8781 #
8782 # Validating the content of all the files in a project can be computationally intensive
8783 # for large projects. For best performance, call `validate_project(project_id)` only
8784 # when you really want to recompute project validation. To quickly display the results of
8785 # the most recent project validation (without recomputing), use `project_validation_results(project_id)`
8786 #
8787 # POST /projects/{project_id}/validate -> mdls.ProjectValidation
8788 def validate_project(
8789 self,
8790 # Project Id
8791 project_id: str,
8792 # Requested fields
8793 fields: Optional[str] = None,
8794 transport_options: Optional[transport.TransportOptions] = None,
8795 ) -> mdls.ProjectValidation:
8796 """Validate Project"""
8797 project_id = self.encode_path_param(project_id)
8798 response = cast(
8799 mdls.ProjectValidation,
8800 self.post(
8801 path=f"/projects/{project_id}/validate",
8802 structure=mdls.ProjectValidation,
8803 query_params={"fields": fields},
8804 transport_options=transport_options,
8805 ),
8806 )
8807 return response
8808
8809 # ### Get Project Workspace
8810 #
8811 # Returns information about the state of the project files in the currently selected workspace
8812 #
8813 # GET /projects/{project_id}/current_workspace -> mdls.ProjectWorkspace
8814 def project_workspace(
8815 self,
8816 # Project Id
8817 project_id: str,
8818 # Requested fields
8819 fields: Optional[str] = None,
8820 transport_options: Optional[transport.TransportOptions] = None,
8821 ) -> mdls.ProjectWorkspace:
8822 """Get Project Workspace"""
8823 project_id = self.encode_path_param(project_id)
8824 response = cast(
8825 mdls.ProjectWorkspace,
8826 self.get(
8827 path=f"/projects/{project_id}/current_workspace",
8828 structure=mdls.ProjectWorkspace,
8829 query_params={"fields": fields},
8830 transport_options=transport_options,
8831 ),
8832 )
8833 return response
8834
8835 # ### Get All Project Files
8836 #
8837 # Returns a list of the files in the project
8838 #
8839 # GET /projects/{project_id}/files -> Sequence[mdls.ProjectFile]
8840 def all_project_files(
8841 self,
8842 # Project Id
8843 project_id: str,
8844 # Requested fields
8845 fields: Optional[str] = None,
8846 transport_options: Optional[transport.TransportOptions] = None,
8847 ) -> Sequence[mdls.ProjectFile]:
8848 """Get All Project Files"""
8849 project_id = self.encode_path_param(project_id)
8850 response = cast(
8851 Sequence[mdls.ProjectFile],
8852 self.get(
8853 path=f"/projects/{project_id}/files",
8854 structure=Sequence[mdls.ProjectFile],
8855 query_params={"fields": fields},
8856 transport_options=transport_options,
8857 ),
8858 )
8859 return response
8860
8861 # ### Get Project File Info
8862 #
8863 # Returns information about a file in the project
8864 #
8865 # GET /projects/{project_id}/files/file -> mdls.ProjectFile
8866 def project_file(
8867 self,
8868 # Project Id
8869 project_id: str,
8870 # File Id
8871 file_id: str,
8872 # Requested fields
8873 fields: Optional[str] = None,
8874 transport_options: Optional[transport.TransportOptions] = None,
8875 ) -> mdls.ProjectFile:
8876 """Get Project File"""
8877 project_id = self.encode_path_param(project_id)
8878 response = cast(
8879 mdls.ProjectFile,
8880 self.get(
8881 path=f"/projects/{project_id}/files/file",
8882 structure=mdls.ProjectFile,
8883 query_params={"file_id": file_id, "fields": fields},
8884 transport_options=transport_options,
8885 ),
8886 )
8887 return response
8888
8889 # ### Get All Git Connection Tests
8890 #
8891 # 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.
8892 #
8893 # 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.
8894 #
8895 # For example, a late-stage test for write access is meaningless if connecting to the git server (an early test) is failing.
8896 #
8897 # GET /projects/{project_id}/git_connection_tests -> Sequence[mdls.GitConnectionTest]
8898 def all_git_connection_tests(
8899 self,
8900 # Project Id
8901 project_id: str,
8902 # (Optional: leave blank for root project) The remote url for remote dependency to test.
8903 remote_url: Optional[str] = None,
8904 transport_options: Optional[transport.TransportOptions] = None,
8905 ) -> Sequence[mdls.GitConnectionTest]:
8906 """Get All Git Connection Tests"""
8907 project_id = self.encode_path_param(project_id)
8908 response = cast(
8909 Sequence[mdls.GitConnectionTest],
8910 self.get(
8911 path=f"/projects/{project_id}/git_connection_tests",
8912 structure=Sequence[mdls.GitConnectionTest],
8913 query_params={"remote_url": remote_url},
8914 transport_options=transport_options,
8915 ),
8916 )
8917 return response
8918
8919 # ### Run a git connection test
8920 #
8921 # 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
8922 # is intended to help debug git connections when things do not work properly, to give
8923 # more helpful information about why a git url is not working with Looker.
8924 #
8925 # Tests should be run in the order they are returned by [Get All Git Connection Tests](#!/Project/all_git_connection_tests).
8926 #
8927 # GET /projects/{project_id}/git_connection_tests/{test_id} -> mdls.GitConnectionTestResult
8928 def run_git_connection_test(
8929 self,
8930 # Project Id
8931 project_id: str,
8932 # Test Id
8933 test_id: str,
8934 # (Optional: leave blank for root project) The remote url for remote dependency to test.
8935 remote_url: Optional[str] = None,
8936 # (Optional: leave blank for dev credentials) Whether to use git production credentials.
8937 use_production: Optional[str] = None,
8938 transport_options: Optional[transport.TransportOptions] = None,
8939 ) -> mdls.GitConnectionTestResult:
8940 """Run Git Connection Test"""
8941 project_id = self.encode_path_param(project_id)
8942 test_id = self.encode_path_param(test_id)
8943 response = cast(
8944 mdls.GitConnectionTestResult,
8945 self.get(
8946 path=f"/projects/{project_id}/git_connection_tests/{test_id}",
8947 structure=mdls.GitConnectionTestResult,
8948 query_params={
8949 "remote_url": remote_url,
8950 "use_production": use_production,
8951 },
8952 transport_options=transport_options,
8953 ),
8954 )
8955 return response
8956
8957 # ### Get All LookML Tests
8958 #
8959 # Returns a list of tests which can be run to validate a project's LookML code and/or the underlying data,
8960 # optionally filtered by the file id.
8961 # Call [Run LookML Test](#!/Project/run_lookml_test) to execute tests.
8962 #
8963 # GET /projects/{project_id}/lookml_tests -> Sequence[mdls.LookmlTest]
8964 def all_lookml_tests(
8965 self,
8966 # Project Id
8967 project_id: str,
8968 # File Id
8969 file_id: Optional[str] = None,
8970 transport_options: Optional[transport.TransportOptions] = None,
8971 ) -> Sequence[mdls.LookmlTest]:
8972 """Get All LookML Tests"""
8973 project_id = self.encode_path_param(project_id)
8974 response = cast(
8975 Sequence[mdls.LookmlTest],
8976 self.get(
8977 path=f"/projects/{project_id}/lookml_tests",
8978 structure=Sequence[mdls.LookmlTest],
8979 query_params={"file_id": file_id},
8980 transport_options=transport_options,
8981 ),
8982 )
8983 return response
8984
8985 # ### Run LookML Tests
8986 #
8987 # Runs all tests in the project, optionally filtered by file, test, and/or model.
8988 #
8989 # GET /projects/{project_id}/lookml_tests/run -> Sequence[mdls.LookmlTestResult]
8990 def run_lookml_test(
8991 self,
8992 # Project Id
8993 project_id: str,
8994 # File Name
8995 file_id: Optional[str] = None,
8996 # Test Name
8997 test: Optional[str] = None,
8998 # Model Name
8999 model: Optional[str] = None,
9000 transport_options: Optional[transport.TransportOptions] = None,
9001 ) -> Sequence[mdls.LookmlTestResult]:
9002 """Run LookML Test"""
9003 project_id = self.encode_path_param(project_id)
9004 response = cast(
9005 Sequence[mdls.LookmlTestResult],
9006 self.get(
9007 path=f"/projects/{project_id}/lookml_tests/run",
9008 structure=Sequence[mdls.LookmlTestResult],
9009 query_params={"file_id": file_id, "test": test, "model": model},
9010 transport_options=transport_options,
9011 ),
9012 )
9013 return response
9014
9015 # ### Creates a tag for the most recent commit, or a specific ref is a SHA is provided
9016 #
9017 # POST /projects/{project_id}/tag -> mdls.Project
9018 def tag_ref(
9019 self,
9020 # Project Id
9021 project_id: str,
9022 body: mdls.WriteProject,
9023 # (Optional): Commit Sha to Tag
9024 commit_sha: Optional[str] = None,
9025 # Tag Name
9026 tag_name: Optional[str] = None,
9027 # (Optional): Tag Message
9028 tag_message: Optional[str] = None,
9029 transport_options: Optional[transport.TransportOptions] = None,
9030 ) -> mdls.Project:
9031 """Tag Ref"""
9032 project_id = self.encode_path_param(project_id)
9033 response = cast(
9034 mdls.Project,
9035 self.post(
9036 path=f"/projects/{project_id}/tag",
9037 structure=mdls.Project,
9038 query_params={
9039 "commit_sha": commit_sha,
9040 "tag_name": tag_name,
9041 "tag_message": tag_message,
9042 },
9043 body=body,
9044 transport_options=transport_options,
9045 ),
9046 )
9047 return response
9048
9049 # ### Configure Repository Credential for a remote dependency
9050 #
9051 # Admin required.
9052 #
9053 # `root_project_id` is required.
9054 # `credential_id` is required.
9055 #
9056 # PUT /projects/{root_project_id}/credential/{credential_id} -> mdls.RepositoryCredential
9057 def update_repository_credential(
9058 self,
9059 # Root Project Id
9060 root_project_id: str,
9061 # Credential Id
9062 credential_id: str,
9063 body: mdls.WriteRepositoryCredential,
9064 transport_options: Optional[transport.TransportOptions] = None,
9065 ) -> mdls.RepositoryCredential:
9066 """Create Repository Credential"""
9067 root_project_id = self.encode_path_param(root_project_id)
9068 credential_id = self.encode_path_param(credential_id)
9069 response = cast(
9070 mdls.RepositoryCredential,
9071 self.put(
9072 path=f"/projects/{root_project_id}/credential/{credential_id}",
9073 structure=mdls.RepositoryCredential,
9074 body=body,
9075 transport_options=transport_options,
9076 ),
9077 )
9078 return response
9079
9080 # ### Repository Credential for a remote dependency
9081 #
9082 # Admin required.
9083 #
9084 # `root_project_id` is required.
9085 # `credential_id` is required.
9086 #
9087 # DELETE /projects/{root_project_id}/credential/{credential_id} -> str
9088 def delete_repository_credential(
9089 self,
9090 # Root Project Id
9091 root_project_id: str,
9092 # Credential Id
9093 credential_id: str,
9094 transport_options: Optional[transport.TransportOptions] = None,
9095 ) -> str:
9096 """Delete Repository Credential"""
9097 root_project_id = self.encode_path_param(root_project_id)
9098 credential_id = self.encode_path_param(credential_id)
9099 response = cast(
9100 str,
9101 self.delete(
9102 path=f"/projects/{root_project_id}/credential/{credential_id}",
9103 structure=str,
9104 transport_options=transport_options,
9105 ),
9106 )
9107 return response
9108
9109 # ### Get all Repository Credentials for a project
9110 #
9111 # `root_project_id` is required.
9112 #
9113 # GET /projects/{root_project_id}/credentials -> Sequence[mdls.RepositoryCredential]
9114 def get_all_repository_credentials(
9115 self,
9116 # Root Project Id
9117 root_project_id: str,
9118 transport_options: Optional[transport.TransportOptions] = None,
9119 ) -> Sequence[mdls.RepositoryCredential]:
9120 """Get All Repository Credentials"""
9121 root_project_id = self.encode_path_param(root_project_id)
9122 response = cast(
9123 Sequence[mdls.RepositoryCredential],
9124 self.get(
9125 path=f"/projects/{root_project_id}/credentials",
9126 structure=Sequence[mdls.RepositoryCredential],
9127 transport_options=transport_options,
9128 ),
9129 )
9130 return response
9131
9132 # endregion
9133
9134 # region Query: Run and Manage Queries
9135
9136 # ### Create an async query task
9137 #
9138 # Creates a query task (job) to run a previously created query asynchronously. Returns a Query Task ID.
9139 #
9140 # Use [query_task(query_task_id)](#!/Query/query_task) to check the execution status of the query task.
9141 # 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.
9142 #
9143 # POST /query_tasks -> mdls.QueryTask
9144 def create_query_task(
9145 self,
9146 body: mdls.WriteCreateQueryTask,
9147 # Row limit (may override the limit in the saved query).
9148 limit: Optional[int] = None,
9149 # Apply model-specified formatting to each result.
9150 apply_formatting: Optional[bool] = None,
9151 # Apply visualization options to results.
9152 apply_vis: Optional[bool] = None,
9153 # Get results from cache if available.
9154 cache: Optional[bool] = None,
9155 # Generate drill links (only applicable to 'json_detail' format.
9156 generate_drill_links: Optional[bool] = None,
9157 # 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.
9158 force_production: Optional[bool] = None,
9159 # Retrieve any results from cache even if the results have expired.
9160 cache_only: Optional[bool] = None,
9161 # Prefix to use for drill links (url encoded).
9162 path_prefix: Optional[str] = None,
9163 # Rebuild PDTS used in query.
9164 rebuild_pdts: Optional[bool] = None,
9165 # Perform table calculations on query results
9166 server_table_calcs: Optional[bool] = None,
9167 # Requested fields
9168 fields: Optional[str] = None,
9169 transport_options: Optional[transport.TransportOptions] = None,
9170 ) -> mdls.QueryTask:
9171 """Run Query Async"""
9172 response = cast(
9173 mdls.QueryTask,
9174 self.post(
9175 path="/query_tasks",
9176 structure=mdls.QueryTask,
9177 query_params={
9178 "limit": limit,
9179 "apply_formatting": apply_formatting,
9180 "apply_vis": apply_vis,
9181 "cache": cache,
9182 "generate_drill_links": generate_drill_links,
9183 "force_production": force_production,
9184 "cache_only": cache_only,
9185 "path_prefix": path_prefix,
9186 "rebuild_pdts": rebuild_pdts,
9187 "server_table_calcs": server_table_calcs,
9188 "fields": fields,
9189 },
9190 body=body,
9191 transport_options=transport_options,
9192 ),
9193 )
9194 return response
9195
9196 # ### Fetch results of multiple async queries
9197 #
9198 # Returns the results of multiple async queries in one request.
9199 #
9200 # For Query Tasks that are not completed, the response will include the execution status of the Query Task but will not include query results.
9201 # Query Tasks whose results have expired will have a status of 'expired'.
9202 # 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'
9203 #
9204 # GET /query_tasks/multi_results -> MutableMapping[str, Any]
9205 def query_task_multi_results(
9206 self,
9207 # List of Query Task IDs
9208 query_task_ids: mdls.DelimSequence[str],
9209 transport_options: Optional[transport.TransportOptions] = None,
9210 ) -> MutableMapping[str, Any]:
9211 """Get Multiple Async Query Results"""
9212 response = cast(
9213 MutableMapping[str, Any],
9214 self.get(
9215 path="/query_tasks/multi_results",
9216 structure=MutableMapping[str, Any],
9217 query_params={"query_task_ids": query_task_ids},
9218 transport_options=transport_options,
9219 ),
9220 )
9221 return response
9222
9223 # ### Get Query Task details
9224 #
9225 # Use this function to check the status of an async query task. After the status
9226 # reaches "Complete", you can call [query_task_results(query_task_id)](#!/Query/query_task_results) to
9227 # retrieve the results of the query.
9228 #
9229 # Use [create_query_task()](#!/Query/create_query_task) to create an async query task.
9230 #
9231 # GET /query_tasks/{query_task_id} -> mdls.QueryTask
9232 def query_task(
9233 self,
9234 # ID of the Query Task
9235 query_task_id: str,
9236 # Requested fields.
9237 fields: Optional[str] = None,
9238 transport_options: Optional[transport.TransportOptions] = None,
9239 ) -> mdls.QueryTask:
9240 """Get Async Query Info"""
9241 query_task_id = self.encode_path_param(query_task_id)
9242 response = cast(
9243 mdls.QueryTask,
9244 self.get(
9245 path=f"/query_tasks/{query_task_id}",
9246 structure=mdls.QueryTask,
9247 query_params={"fields": fields},
9248 transport_options=transport_options,
9249 ),
9250 )
9251 return response
9252
9253 # ### Get Async Query Results
9254 #
9255 # Returns the results of an async query task if the query has completed.
9256 #
9257 # If the query task is still running or waiting to run, this function returns 202 Accepted.
9258 #
9259 # If the query task ID is invalid or the cached results of the query task have expired, this function returns 404 Not Found.
9260 #
9261 # Use [query_task(query_task_id)](#!/Query/query_task) to check the execution status of the query task
9262 # Call query_task_results only after the query task status reaches "Complete".
9263 #
9264 # You can also use [query_task_multi_results()](#!/Query/query_task_multi_results) retrieve the
9265 # results of multiple async query tasks at the same time.
9266 #
9267 # #### SQL Error Handling:
9268 # 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()`.
9269 #
9270 # For `json_detail` result_format: `query_task_results()` will respond with HTTP status '200 OK' and db SQL error info
9271 # will be in the `errors` property of the response object. The 'data' property will be empty.
9272 #
9273 # For all other result formats: `query_task_results()` will respond with HTTP status `400 Bad Request` and some db SQL error info
9274 # will be in the message of the 400 error response, but not as detailed as expressed in `json_detail.errors`.
9275 # These data formats can only carry row data, and error info is not row data.
9276 #
9277 # GET /query_tasks/{query_task_id}/results -> str
9278 def query_task_results(
9279 self,
9280 # ID of the Query Task
9281 query_task_id: str,
9282 transport_options: Optional[transport.TransportOptions] = None,
9283 ) -> str:
9284 """Get Async Query Results"""
9285 query_task_id = self.encode_path_param(query_task_id)
9286 response = cast(
9287 str,
9288 self.get(
9289 path=f"/query_tasks/{query_task_id}/results",
9290 structure=str,
9291 transport_options=transport_options,
9292 ),
9293 )
9294 return response
9295
9296 # ### Get a previously created query by id.
9297 #
9298 # A Looker query object includes the various parameters that define a database query that has been run or
9299 # could be run in the future. These parameters include: model, view, fields, filters, pivots, etc.
9300 # Query *results* are not part of the query object.
9301 #
9302 # Query objects are unique and immutable. Query objects are created automatically in Looker as users explore data.
9303 # Looker does not delete them; they become part of the query history. When asked to create a query for
9304 # any given set of parameters, Looker will first try to find an existing query object with matching
9305 # parameters and will only create a new object when an appropriate object can not be found.
9306 #
9307 # This 'get' method is used to get the details about a query for a given id. See the other methods here
9308 # to 'create' and 'run' queries.
9309 #
9310 # Note that some fields like 'filter_config' and 'vis_config' etc are specific to how the Looker UI
9311 # builds queries and visualizations and are not generally useful for API use. They are not required when
9312 # creating new queries and can usually just be ignored.
9313 #
9314 # GET /queries/{query_id} -> mdls.Query
9315 def query(
9316 self,
9317 # Id of query
9318 query_id: str,
9319 # Requested fields.
9320 fields: Optional[str] = None,
9321 transport_options: Optional[transport.TransportOptions] = None,
9322 ) -> mdls.Query:
9323 """Get Query"""
9324 query_id = self.encode_path_param(query_id)
9325 response = cast(
9326 mdls.Query,
9327 self.get(
9328 path=f"/queries/{query_id}",
9329 structure=mdls.Query,
9330 query_params={"fields": fields},
9331 transport_options=transport_options,
9332 ),
9333 )
9334 return response
9335
9336 # ### Get the query for a given query slug.
9337 #
9338 # This returns the query for the 'slug' in a query share URL.
9339 #
9340 # The 'slug' is a randomly chosen short string that is used as an alternative to the query's id value
9341 # for use in URLs etc. This method exists as a convenience to help you use the API to 'find' queries that
9342 # have been created using the Looker UI.
9343 #
9344 # You can use the Looker explore page to build a query and then choose the 'Share' option to
9345 # show the share url for the query. Share urls generally look something like 'https://looker.yourcompany/x/vwGSbfc'.
9346 # The trailing 'vwGSbfc' is the share slug. You can pass that string to this api method to get details about the query.
9347 # Those details include the 'id' that you can use to run the query. Or, you can copy the query body
9348 # (perhaps with your own modification) and use that as the basis to make/run new queries.
9349 #
9350 # This will also work with slugs from Looker explore urls like
9351 # 'https://looker.yourcompany/explore/ecommerce/orders?qid=aogBgL6o3cKK1jN3RoZl5s'. In this case
9352 # 'aogBgL6o3cKK1jN3RoZl5s' is the slug.
9353 #
9354 # GET /queries/slug/{slug} -> mdls.Query
9355 def query_for_slug(
9356 self,
9357 # Slug of query
9358 slug: str,
9359 # Requested fields.
9360 fields: Optional[str] = None,
9361 transport_options: Optional[transport.TransportOptions] = None,
9362 ) -> mdls.Query:
9363 """Get Query for Slug"""
9364 slug = self.encode_path_param(slug)
9365 response = cast(
9366 mdls.Query,
9367 self.get(
9368 path=f"/queries/slug/{slug}",
9369 structure=mdls.Query,
9370 query_params={"fields": fields},
9371 transport_options=transport_options,
9372 ),
9373 )
9374 return response
9375
9376 # ### Create a query.
9377 #
9378 # This allows you to create a new query that you can later run. Looker queries are immutable once created
9379 # and are not deleted. If you create a query that is exactly like an existing query then the existing query
9380 # will be returned and no new query will be created. Whether a new query is created or not, you can use
9381 # the 'id' in the returned query with the 'run' method.
9382 #
9383 # The query parameters are passed as json in the body of the request.
9384 #
9385 # POST /queries -> mdls.Query
9386 def create_query(
9387 self,
9388 body: mdls.WriteQuery,
9389 # Requested fields.
9390 fields: Optional[str] = None,
9391 transport_options: Optional[transport.TransportOptions] = None,
9392 ) -> mdls.Query:
9393 """Create Query"""
9394 response = cast(
9395 mdls.Query,
9396 self.post(
9397 path="/queries",
9398 structure=mdls.Query,
9399 query_params={"fields": fields},
9400 body=body,
9401 transport_options=transport_options,
9402 ),
9403 )
9404 return response
9405
9406 # ### Run a saved query.
9407 #
9408 # This runs a previously saved query. You can use this on a query that was generated in the Looker UI
9409 # or one that you have explicitly created using the API. You can also use a query 'id' from a saved 'Look'.
9410 #
9411 # The 'result_format' parameter specifies the desired structure and format of the response.
9412 #
9413 # Supported formats:
9414 #
9415 # | result_format | Description
9416 # | :-----------: | :--- |
9417 # | json | Plain json
9418 # | json_bi | (*RECOMMENDED*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query. See JsonBi type for schema
9419 # | json_detail | (*LEGACY*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
9420 # | csv | Comma separated values with a header
9421 # | txt | Tab separated values with a header
9422 # | html | Simple html
9423 # | md | Simple markdown
9424 # | xlsx | MS Excel spreadsheet
9425 # | sql | Returns the generated SQL rather than running the query
9426 # | png | A PNG image of the visualization of the query
9427 # | jpg | A JPG image of the visualization of the query
9428 #
9429 # GET /queries/{query_id}/run/{result_format} -> Union[str, bytes]
9430 def run_query(
9431 self,
9432 # Id of query
9433 query_id: str,
9434 # Format of result
9435 result_format: str,
9436 # Row limit (may override the limit in the saved query).
9437 limit: Optional[int] = None,
9438 # Apply model-specified formatting to each result.
9439 apply_formatting: Optional[bool] = None,
9440 # Apply visualization options to results.
9441 apply_vis: Optional[bool] = None,
9442 # Get results from cache if available.
9443 cache: Optional[bool] = None,
9444 # Render width for image formats.
9445 image_width: Optional[int] = None,
9446 # Render height for image formats.
9447 image_height: Optional[int] = None,
9448 # Generate drill links (only applicable to 'json_detail' format.
9449 generate_drill_links: Optional[bool] = None,
9450 # 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.
9451 force_production: Optional[bool] = None,
9452 # Retrieve any results from cache even if the results have expired.
9453 cache_only: Optional[bool] = None,
9454 # Prefix to use for drill links (url encoded).
9455 path_prefix: Optional[str] = None,
9456 # Rebuild PDTS used in query.
9457 rebuild_pdts: Optional[bool] = None,
9458 # Perform table calculations on query results
9459 server_table_calcs: Optional[bool] = None,
9460 # Specifies the source of this call.
9461 source: Optional[str] = None,
9462 # Return a specialized OAuth error response if a database OAuth error occurs.
9463 enable_oauth_error_response: Optional[bool] = None,
9464 transport_options: Optional[transport.TransportOptions] = None,
9465 ) -> Union[str, bytes]:
9466 """Run Query"""
9467 query_id = self.encode_path_param(query_id)
9468 result_format = self.encode_path_param(result_format)
9469 response = cast(
9470 Union[str, bytes],
9471 self.get(
9472 path=f"/queries/{query_id}/run/{result_format}",
9473 structure=Union[str, bytes], # type: ignore
9474 query_params={
9475 "limit": limit,
9476 "apply_formatting": apply_formatting,
9477 "apply_vis": apply_vis,
9478 "cache": cache,
9479 "image_width": image_width,
9480 "image_height": image_height,
9481 "generate_drill_links": generate_drill_links,
9482 "force_production": force_production,
9483 "cache_only": cache_only,
9484 "path_prefix": path_prefix,
9485 "rebuild_pdts": rebuild_pdts,
9486 "server_table_calcs": server_table_calcs,
9487 "source": source,
9488 "enable_oauth_error_response": enable_oauth_error_response,
9489 },
9490 transport_options=transport_options,
9491 ),
9492 )
9493 return response
9494
9495 # ### Run the query that is specified inline in the posted body.
9496 #
9497 # This allows running a query as defined in json in the posted body. This combines
9498 # the two actions of posting & running a query into one step.
9499 #
9500 # Here is an example body in json:
9501 # ```
9502 # {
9503 # "model":"thelook",
9504 # "view":"inventory_items",
9505 # "fields":["category.name","inventory_items.days_in_inventory_tier","products.count"],
9506 # "filters":{"category.name":"socks"},
9507 # "sorts":["products.count desc 0"],
9508 # "limit":"500",
9509 # "query_timezone":"America/Los_Angeles"
9510 # }
9511 # ```
9512 #
9513 # When using the Ruby SDK this would be passed as a Ruby hash like:
9514 # ```
9515 # {
9516 # :model=>"thelook",
9517 # :view=>"inventory_items",
9518 # :fields=>
9519 # ["category.name",
9520 # "inventory_items.days_in_inventory_tier",
9521 # "products.count"],
9522 # :filters=>{:"category.name"=>"socks"},
9523 # :sorts=>["products.count desc 0"],
9524 # :limit=>"500",
9525 # :query_timezone=>"America/Los_Angeles",
9526 # }
9527 # ```
9528 #
9529 # This will return the result of running the query in the format specified by the 'result_format' parameter.
9530 #
9531 # Supported formats:
9532 #
9533 # | result_format | Description
9534 # | :-----------: | :--- |
9535 # | json | Plain json
9536 # | json_bi | (*RECOMMENDED*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query. See JsonBi type for schema
9537 # | json_detail | (*LEGACY*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
9538 # | csv | Comma separated values with a header
9539 # | txt | Tab separated values with a header
9540 # | html | Simple html
9541 # | md | Simple markdown
9542 # | xlsx | MS Excel spreadsheet
9543 # | sql | Returns the generated SQL rather than running the query
9544 # | png | A PNG image of the visualization of the query
9545 # | jpg | A JPG image of the visualization of the query
9546 #
9547 # POST /queries/run/{result_format} -> Union[str, bytes]
9548 def run_inline_query(
9549 self,
9550 # Format of result
9551 result_format: str,
9552 body: mdls.WriteQuery,
9553 # Row limit (may override the limit in the saved query).
9554 limit: Optional[int] = None,
9555 # Apply model-specified formatting to each result.
9556 apply_formatting: Optional[bool] = None,
9557 # Apply visualization options to results.
9558 apply_vis: Optional[bool] = None,
9559 # Get results from cache if available.
9560 cache: Optional[bool] = None,
9561 # Render width for image formats.
9562 image_width: Optional[int] = None,
9563 # Render height for image formats.
9564 image_height: Optional[int] = None,
9565 # Generate drill links (only applicable to 'json_detail' format.
9566 generate_drill_links: Optional[bool] = None,
9567 # 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.
9568 force_production: Optional[bool] = None,
9569 # Retrieve any results from cache even if the results have expired.
9570 cache_only: Optional[bool] = None,
9571 # Prefix to use for drill links (url encoded).
9572 path_prefix: Optional[str] = None,
9573 # Rebuild PDTS used in query.
9574 rebuild_pdts: Optional[bool] = None,
9575 # Perform table calculations on query results
9576 server_table_calcs: Optional[bool] = None,
9577 # Return a specialized OAuth error response if a database OAuth error occurs.
9578 enable_oauth_error_response: Optional[bool] = None,
9579 transport_options: Optional[transport.TransportOptions] = None,
9580 ) -> Union[str, bytes]:
9581 """Run Inline Query"""
9582 result_format = self.encode_path_param(result_format)
9583 response = cast(
9584 Union[str, bytes],
9585 self.post(
9586 path=f"/queries/run/{result_format}",
9587 structure=Union[str, bytes], # type: ignore
9588 query_params={
9589 "limit": limit,
9590 "apply_formatting": apply_formatting,
9591 "apply_vis": apply_vis,
9592 "cache": cache,
9593 "image_width": image_width,
9594 "image_height": image_height,
9595 "generate_drill_links": generate_drill_links,
9596 "force_production": force_production,
9597 "cache_only": cache_only,
9598 "path_prefix": path_prefix,
9599 "rebuild_pdts": rebuild_pdts,
9600 "server_table_calcs": server_table_calcs,
9601 "enable_oauth_error_response": enable_oauth_error_response,
9602 },
9603 body=body,
9604 transport_options=transport_options,
9605 ),
9606 )
9607 return response
9608
9609 # ### Run an URL encoded query.
9610 #
9611 # This requires the caller to encode the specifiers for the query into the URL query part using
9612 # Looker-specific syntax as explained below.
9613 #
9614 # Generally, you would want to use one of the methods that takes the parameters as json in the POST body
9615 # for creating and/or running queries. This method exists for cases where one really needs to encode the
9616 # parameters into the URL of a single 'GET' request. This matches the way that the Looker UI formats
9617 # 'explore' URLs etc.
9618 #
9619 # The parameters here are very similar to the json body formatting except that the filter syntax is
9620 # tricky. Unfortunately, this format makes this method not currently callable via the 'Try it out!' button
9621 # in this documentation page. But, this is callable when creating URLs manually or when using the Looker SDK.
9622 #
9623 # Here is an example inline query URL:
9624 #
9625 # ```
9626 # 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
9627 # ```
9628 #
9629 # 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:
9630 #
9631 # ```ruby
9632 # query_params =
9633 # {
9634 # fields: "category.name,inventory_items.days_in_inventory_tier,products.count",
9635 # :"f[category.name]" => "socks",
9636 # sorts: "products.count desc 0",
9637 # limit: "500",
9638 # query_timezone: "America/Los_Angeles"
9639 # }
9640 # response = ruby_sdk.run_url_encoded_query('thelook','inventory_items','json', query_params)
9641 #
9642 # ```
9643 #
9644 # Again, it is generally easier to use the variant of this method that passes the full query in the POST body.
9645 # This method is available for cases where other alternatives won't fit the need.
9646 #
9647 # Supported formats:
9648 #
9649 # | result_format | Description
9650 # | :-----------: | :--- |
9651 # | json | Plain json
9652 # | json_bi | (*RECOMMENDED*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query. See JsonBi type for schema
9653 # | json_detail | (*LEGACY*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
9654 # | csv | Comma separated values with a header
9655 # | txt | Tab separated values with a header
9656 # | html | Simple html
9657 # | md | Simple markdown
9658 # | xlsx | MS Excel spreadsheet
9659 # | sql | Returns the generated SQL rather than running the query
9660 # | png | A PNG image of the visualization of the query
9661 # | jpg | A JPG image of the visualization of the query
9662 #
9663 # GET /queries/models/{model_name}/views/{view_name}/run/{result_format} -> Union[str, bytes]
9664 def run_url_encoded_query(
9665 self,
9666 # Model name
9667 model_name: str,
9668 # View name
9669 view_name: str,
9670 # Format of result
9671 result_format: str,
9672 transport_options: Optional[transport.TransportOptions] = None,
9673 ) -> Union[str, bytes]:
9674 """Run Url Encoded Query"""
9675 model_name = self.encode_path_param(model_name)
9676 view_name = self.encode_path_param(view_name)
9677 result_format = self.encode_path_param(result_format)
9678 response = cast(
9679 Union[str, bytes],
9680 self.get(
9681 path=f"/queries/models/{model_name}/views/{view_name}/run/{result_format}",
9682 structure=Union[str, bytes], # type: ignore
9683 transport_options=transport_options,
9684 ),
9685 )
9686 return response
9687
9688 # ### Get Merge Query
9689 #
9690 # Returns a merge query object given its id.
9691 #
9692 # GET /merge_queries/{merge_query_id} -> mdls.MergeQuery
9693 def merge_query(
9694 self,
9695 # Merge Query Id
9696 merge_query_id: str,
9697 # Requested fields
9698 fields: Optional[str] = None,
9699 transport_options: Optional[transport.TransportOptions] = None,
9700 ) -> mdls.MergeQuery:
9701 """Get Merge Query"""
9702 merge_query_id = self.encode_path_param(merge_query_id)
9703 response = cast(
9704 mdls.MergeQuery,
9705 self.get(
9706 path=f"/merge_queries/{merge_query_id}",
9707 structure=mdls.MergeQuery,
9708 query_params={"fields": fields},
9709 transport_options=transport_options,
9710 ),
9711 )
9712 return response
9713
9714 # ### Create Merge Query
9715 #
9716 # Creates a new merge query object.
9717 #
9718 # A merge query takes the results of one or more queries and combines (merges) the results
9719 # according to field mapping definitions. The result is similar to a SQL left outer join.
9720 #
9721 # A merge query can merge results of queries from different SQL databases.
9722 #
9723 # The order that queries are defined in the source_queries array property is significant. The
9724 # first query in the array defines the primary key into which the results of subsequent
9725 # queries will be merged.
9726 #
9727 # Like model/view query objects, merge queries are immutable and have structural identity - if
9728 # you make a request to create a new merge query that is identical to an existing merge query,
9729 # the existing merge query will be returned instead of creating a duplicate. Conversely, any
9730 # change to the contents of a merge query will produce a new object with a new id.
9731 #
9732 # POST /merge_queries -> mdls.MergeQuery
9733 def create_merge_query(
9734 self,
9735 body: Optional[mdls.WriteMergeQuery] = None,
9736 # Requested fields
9737 fields: Optional[str] = None,
9738 transport_options: Optional[transport.TransportOptions] = None,
9739 ) -> mdls.MergeQuery:
9740 """Create Merge Query"""
9741 response = cast(
9742 mdls.MergeQuery,
9743 self.post(
9744 path="/merge_queries",
9745 structure=mdls.MergeQuery,
9746 query_params={"fields": fields},
9747 body=body,
9748 transport_options=transport_options,
9749 ),
9750 )
9751 return response
9752
9753 # Get information about all running queries.
9754 #
9755 # GET /running_queries -> Sequence[mdls.RunningQueries]
9756 def all_running_queries(
9757 self,
9758 transport_options: Optional[transport.TransportOptions] = None,
9759 ) -> Sequence[mdls.RunningQueries]:
9760 """Get All Running Queries"""
9761 response = cast(
9762 Sequence[mdls.RunningQueries],
9763 self.get(
9764 path="/running_queries",
9765 structure=Sequence[mdls.RunningQueries],
9766 transport_options=transport_options,
9767 ),
9768 )
9769 return response
9770
9771 # Kill a query with a specific query_task_id.
9772 #
9773 # DELETE /running_queries/{query_task_id} -> str
9774 def kill_query(
9775 self,
9776 # Query task id.
9777 query_task_id: str,
9778 transport_options: Optional[transport.TransportOptions] = None,
9779 ) -> str:
9780 """Kill Running Query"""
9781 query_task_id = self.encode_path_param(query_task_id)
9782 response = cast(
9783 str,
9784 self.delete(
9785 path=f"/running_queries/{query_task_id}",
9786 structure=str,
9787 transport_options=transport_options,
9788 ),
9789 )
9790 return response
9791
9792 # ### Create a SQL Runner Query
9793 #
9794 # Either the `connection_name` or `model_name` parameter MUST be provided.
9795 #
9796 # POST /sql_queries -> mdls.SqlQuery
9797 def create_sql_query(
9798 self,
9799 body: mdls.SqlQueryCreate,
9800 transport_options: Optional[transport.TransportOptions] = None,
9801 ) -> mdls.SqlQuery:
9802 """Create SQL Runner Query"""
9803 response = cast(
9804 mdls.SqlQuery,
9805 self.post(
9806 path="/sql_queries",
9807 structure=mdls.SqlQuery,
9808 body=body,
9809 transport_options=transport_options,
9810 ),
9811 )
9812 return response
9813
9814 # Get a SQL Runner query.
9815 #
9816 # GET /sql_queries/{slug} -> mdls.SqlQuery
9817 def sql_query(
9818 self,
9819 # slug of query
9820 slug: str,
9821 transport_options: Optional[transport.TransportOptions] = None,
9822 ) -> mdls.SqlQuery:
9823 """Get SQL Runner Query"""
9824 slug = self.encode_path_param(slug)
9825 response = cast(
9826 mdls.SqlQuery,
9827 self.get(
9828 path=f"/sql_queries/{slug}",
9829 structure=mdls.SqlQuery,
9830 transport_options=transport_options,
9831 ),
9832 )
9833 return response
9834
9835 # Execute a SQL Runner query in a given result_format.
9836 #
9837 # POST /sql_queries/{slug}/run/{result_format} -> str
9838 def run_sql_query(
9839 self,
9840 # slug of query
9841 slug: str,
9842 # Format of result, options are: ["inline_json", "json", "json_detail", "json_fe", "json_bi", "csv", "html", "md", "txt", "xlsx", "gsxml", "sql", "odc", "json_label"]
9843 result_format: str,
9844 # 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.
9845 download: Optional[str] = None,
9846 transport_options: Optional[transport.TransportOptions] = None,
9847 ) -> str:
9848 """Run SQL Runner Query"""
9849 slug = self.encode_path_param(slug)
9850 result_format = self.encode_path_param(result_format)
9851 response = cast(
9852 str,
9853 self.post(
9854 path=f"/sql_queries/{slug}/run/{result_format}",
9855 structure=str,
9856 query_params={"download": download},
9857 transport_options=transport_options,
9858 ),
9859 )
9860 return response
9861
9862 # endregion
9863
9864 # region RenderTask: Manage Render Tasks
9865
9866 # ### Create a new task to render a look to an image.
9867 #
9868 # Returns a render task object.
9869 # To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
9870 # Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
9871 #
9872 # POST /render_tasks/looks/{look_id}/{result_format} -> mdls.RenderTask
9873 def create_look_render_task(
9874 self,
9875 # Id of look to render
9876 look_id: str,
9877 # Output type: png, or jpg
9878 result_format: str,
9879 # Output width in pixels
9880 width: int,
9881 # Output height in pixels
9882 height: int,
9883 # Requested fields.
9884 fields: Optional[str] = None,
9885 transport_options: Optional[transport.TransportOptions] = None,
9886 ) -> mdls.RenderTask:
9887 """Create Look Render Task"""
9888 look_id = self.encode_path_param(look_id)
9889 result_format = self.encode_path_param(result_format)
9890 response = cast(
9891 mdls.RenderTask,
9892 self.post(
9893 path=f"/render_tasks/looks/{look_id}/{result_format}",
9894 structure=mdls.RenderTask,
9895 query_params={"width": width, "height": height, "fields": fields},
9896 transport_options=transport_options,
9897 ),
9898 )
9899 return response
9900
9901 # ### Create a new task to render an existing query to an image.
9902 #
9903 # Returns a render task object.
9904 # To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
9905 # Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
9906 #
9907 # POST /render_tasks/queries/{query_id}/{result_format} -> mdls.RenderTask
9908 def create_query_render_task(
9909 self,
9910 # Id of the query to render
9911 query_id: str,
9912 # Output type: png or jpg
9913 result_format: str,
9914 # Output width in pixels
9915 width: int,
9916 # Output height in pixels
9917 height: int,
9918 # Requested fields.
9919 fields: Optional[str] = None,
9920 transport_options: Optional[transport.TransportOptions] = None,
9921 ) -> mdls.RenderTask:
9922 """Create Query Render Task"""
9923 query_id = self.encode_path_param(query_id)
9924 result_format = self.encode_path_param(result_format)
9925 response = cast(
9926 mdls.RenderTask,
9927 self.post(
9928 path=f"/render_tasks/queries/{query_id}/{result_format}",
9929 structure=mdls.RenderTask,
9930 query_params={"width": width, "height": height, "fields": fields},
9931 transport_options=transport_options,
9932 ),
9933 )
9934 return response
9935
9936 # ### Create a new task to render a dashboard to a document or image.
9937 #
9938 # Returns a render task object.
9939 # To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
9940 # Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
9941 #
9942 # POST /render_tasks/dashboards/{dashboard_id}/{result_format} -> mdls.RenderTask
9943 def create_dashboard_render_task(
9944 self,
9945 # Id of dashboard to render. The ID can be a LookML dashboard also.
9946 dashboard_id: str,
9947 # Output type: pdf, png, or jpg
9948 result_format: str,
9949 body: mdls.CreateDashboardRenderTask,
9950 # Output width in pixels
9951 width: int,
9952 # Output height in pixels
9953 height: int,
9954 # Requested fields.
9955 fields: Optional[str] = None,
9956 # Paper size for pdf. Value can be one of: ["letter","legal","tabloid","a0","a1","a2","a3","a4","a5"]
9957 pdf_paper_size: Optional[str] = None,
9958 # Whether to render pdf in landscape paper orientation
9959 pdf_landscape: Optional[bool] = None,
9960 # Whether or not to expand table vis to full length
9961 long_tables: Optional[bool] = None,
9962 # Theme to apply. Will render embedded version of dashboard if valid
9963 theme: Optional[str] = None,
9964 transport_options: Optional[transport.TransportOptions] = None,
9965 ) -> mdls.RenderTask:
9966 """Create Dashboard Render Task"""
9967 dashboard_id = self.encode_path_param(dashboard_id)
9968 result_format = self.encode_path_param(result_format)
9969 response = cast(
9970 mdls.RenderTask,
9971 self.post(
9972 path=f"/render_tasks/dashboards/{dashboard_id}/{result_format}",
9973 structure=mdls.RenderTask,
9974 query_params={
9975 "width": width,
9976 "height": height,
9977 "fields": fields,
9978 "pdf_paper_size": pdf_paper_size,
9979 "pdf_landscape": pdf_landscape,
9980 "long_tables": long_tables,
9981 "theme": theme,
9982 },
9983 body=body,
9984 transport_options=transport_options,
9985 ),
9986 )
9987 return response
9988
9989 # ### Get information about a render task.
9990 #
9991 # Returns a render task object.
9992 # To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
9993 # Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
9994 #
9995 # GET /render_tasks/{render_task_id} -> mdls.RenderTask
9996 def render_task(
9997 self,
9998 # Id of render task
9999 render_task_id: str,
10000 # Requested fields.
10001 fields: Optional[str] = None,
10002 transport_options: Optional[transport.TransportOptions] = None,
10003 ) -> mdls.RenderTask:
10004 """Get Render Task"""
10005 render_task_id = self.encode_path_param(render_task_id)
10006 response = cast(
10007 mdls.RenderTask,
10008 self.get(
10009 path=f"/render_tasks/{render_task_id}",
10010 structure=mdls.RenderTask,
10011 query_params={"fields": fields},
10012 transport_options=transport_options,
10013 ),
10014 )
10015 return response
10016
10017 # ### Get the document or image produced by a completed render task.
10018 #
10019 # Note that the PDF or image result will be a binary blob in the HTTP response, as indicated by the
10020 # Content-Type in the response headers. This may require specialized (or at least different) handling than text
10021 # responses such as JSON. You may need to tell your HTTP client that the response is binary so that it does not
10022 # attempt to parse the binary data as text.
10023 #
10024 # If the render task exists but has not finished rendering the results, the response HTTP status will be
10025 # **202 Accepted**, the response body will be empty, and the response will have a Retry-After header indicating
10026 # that the caller should repeat the request at a later time.
10027 #
10028 # Returns 404 if the render task cannot be found, if the cached result has expired, or if the caller
10029 # does not have permission to view the results.
10030 #
10031 # For detailed information about the status of the render task, use [Render Task](#!/RenderTask/render_task).
10032 # Polling loops waiting for completion of a render task would be better served by polling **render_task(id)** until
10033 # the task status reaches completion (or error) instead of polling **render_task_results(id)** alone.
10034 #
10035 # GET /render_tasks/{render_task_id}/results -> bytes
10036 def render_task_results(
10037 self,
10038 # Id of render task
10039 render_task_id: str,
10040 transport_options: Optional[transport.TransportOptions] = None,
10041 ) -> bytes:
10042 """Render Task Results"""
10043 render_task_id = self.encode_path_param(render_task_id)
10044 response = cast(
10045 bytes,
10046 self.get(
10047 path=f"/render_tasks/{render_task_id}/results",
10048 structure=bytes,
10049 transport_options=transport_options,
10050 ),
10051 )
10052 return response
10053
10054 # ### Create a new task to render a dashboard element to an image.
10055 #
10056 # Returns a render task object.
10057 # To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
10058 # Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
10059 #
10060 # POST /render_tasks/dashboard_elements/{dashboard_element_id}/{result_format} -> mdls.RenderTask
10061 def create_dashboard_element_render_task(
10062 self,
10063 # 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
10064 dashboard_element_id: str,
10065 # Output type: png or jpg
10066 result_format: str,
10067 # Output width in pixels
10068 width: int,
10069 # Output height in pixels
10070 height: int,
10071 # Requested fields.
10072 fields: Optional[str] = None,
10073 transport_options: Optional[transport.TransportOptions] = None,
10074 ) -> mdls.RenderTask:
10075 """Create Dashboard Element Render Task"""
10076 dashboard_element_id = self.encode_path_param(dashboard_element_id)
10077 result_format = self.encode_path_param(result_format)
10078 response = cast(
10079 mdls.RenderTask,
10080 self.post(
10081 path=f"/render_tasks/dashboard_elements/{dashboard_element_id}/{result_format}",
10082 structure=mdls.RenderTask,
10083 query_params={"width": width, "height": height, "fields": fields},
10084 transport_options=transport_options,
10085 ),
10086 )
10087 return response
10088
10089 # endregion
10090
10091 # region Report: Report
10092
10093 # ### Search Reports
10094 #
10095 # Returns an **array of Report objects** that match the specified search criteria.
10096 #
10097 # If multiple search params are given and `filter_or` is FALSE or not specified,
10098 # search params are combined in a logical AND operation.
10099 # Only rows that match *all* search param criteria will be returned.
10100 #
10101 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
10102 # Results will include rows that match **any** of the search criteria.
10103 #
10104 # String search params use case-insensitive matching.
10105 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
10106 # example="dan%" will match "danger" and "Danzig" but not "David"
10107 # example="D_m%" will match "Damage" and "dump"
10108 #
10109 # Integer search params can accept a single value or a comma separated list of values. The multiple
10110 # values will be combined under a logical OR operation - results will match at least one of
10111 # the given values.
10112 #
10113 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
10114 # or exclude (respectively) rows where the column is null.
10115 #
10116 # Boolean search params accept only "true" and "false" as values.
10117 #
10118 # GET /reports/search -> Sequence[mdls.Report]
10119 def search_reports(
10120 self,
10121 # Select reports in a particular folder.
10122 folder_id: Optional[str] = None,
10123 # Select favorite reports.
10124 favorite: Optional[bool] = None,
10125 # Select reports viewed recently.
10126 recent: Optional[bool] = None,
10127 # Match report id.
10128 id: Optional[str] = None,
10129 # Match report title.
10130 title: Optional[str] = None,
10131 # One or more fields to sort results by.
10132 sorts: Optional[str] = None,
10133 # Number of results to return.(used with next_page_token)
10134 limit: Optional[int] = None,
10135 # Comma delimited list of field names. If provided, only the fields specified will be included in the response.
10136 fields: Optional[str] = None,
10137 # 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.
10138 next_page_token: Optional[str] = None,
10139 transport_options: Optional[transport.TransportOptions] = None,
10140 ) -> Sequence[mdls.Report]:
10141 """Search Reports"""
10142 response = cast(
10143 Sequence[mdls.Report],
10144 self.get(
10145 path="/reports/search",
10146 structure=Sequence[mdls.Report],
10147 query_params={
10148 "folder_id": folder_id,
10149 "favorite": favorite,
10150 "recent": recent,
10151 "id": id,
10152 "title": title,
10153 "sorts": sorts,
10154 "limit": limit,
10155 "fields": fields,
10156 "next_page_token": next_page_token,
10157 },
10158 transport_options=transport_options,
10159 ),
10160 )
10161 return response
10162
10163 # endregion
10164
10165 # region Role: Manage Roles
10166
10167 # ### Search model sets
10168 # Returns all model set records that match the given search criteria.
10169 # If multiple search params are given and `filter_or` is FALSE or not specified,
10170 # search params are combined in a logical AND operation.
10171 # Only rows that match *all* search param criteria will be returned.
10172 #
10173 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
10174 # Results will include rows that match **any** of the search criteria.
10175 #
10176 # String search params use case-insensitive matching.
10177 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
10178 # example="dan%" will match "danger" and "Danzig" but not "David"
10179 # example="D_m%" will match "Damage" and "dump"
10180 #
10181 # Integer search params can accept a single value or a comma separated list of values. The multiple
10182 # values will be combined under a logical OR operation - results will match at least one of
10183 # the given values.
10184 #
10185 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
10186 # or exclude (respectively) rows where the column is null.
10187 #
10188 # Boolean search params accept only "true" and "false" as values.
10189 #
10190 # GET /model_sets/search -> Sequence[mdls.ModelSet]
10191 def search_model_sets(
10192 self,
10193 # Requested fields.
10194 fields: Optional[str] = None,
10195 # Number of results to return (used with `offset`).
10196 limit: Optional[int] = None,
10197 # Number of results to skip before returning any (used with `limit`).
10198 offset: Optional[int] = None,
10199 # Fields to sort by.
10200 sorts: Optional[str] = None,
10201 # Match model set id.
10202 id: Optional[str] = None,
10203 # Match model set name.
10204 name: Optional[str] = None,
10205 # Match model sets by all_access status.
10206 all_access: Optional[bool] = None,
10207 # Match model sets by built_in status.
10208 built_in: Optional[bool] = None,
10209 # Combine given search criteria in a boolean OR expression.
10210 filter_or: Optional[bool] = None,
10211 transport_options: Optional[transport.TransportOptions] = None,
10212 ) -> Sequence[mdls.ModelSet]:
10213 """Search Model Sets"""
10214 response = cast(
10215 Sequence[mdls.ModelSet],
10216 self.get(
10217 path="/model_sets/search",
10218 structure=Sequence[mdls.ModelSet],
10219 query_params={
10220 "fields": fields,
10221 "limit": limit,
10222 "offset": offset,
10223 "sorts": sorts,
10224 "id": id,
10225 "name": name,
10226 "all_access": all_access,
10227 "built_in": built_in,
10228 "filter_or": filter_or,
10229 },
10230 transport_options=transport_options,
10231 ),
10232 )
10233 return response
10234
10235 # ### Get information about the model set with a specific id.
10236 #
10237 # GET /model_sets/{model_set_id} -> mdls.ModelSet
10238 def model_set(
10239 self,
10240 # Id of model set
10241 model_set_id: str,
10242 # Requested fields.
10243 fields: Optional[str] = None,
10244 transport_options: Optional[transport.TransportOptions] = None,
10245 ) -> mdls.ModelSet:
10246 """Get Model Set"""
10247 model_set_id = self.encode_path_param(model_set_id)
10248 response = cast(
10249 mdls.ModelSet,
10250 self.get(
10251 path=f"/model_sets/{model_set_id}",
10252 structure=mdls.ModelSet,
10253 query_params={"fields": fields},
10254 transport_options=transport_options,
10255 ),
10256 )
10257 return response
10258
10259 # ### Update information about the model set with a specific id.
10260 #
10261 # PATCH /model_sets/{model_set_id} -> mdls.ModelSet
10262 def update_model_set(
10263 self,
10264 # id of model set
10265 model_set_id: str,
10266 body: mdls.WriteModelSet,
10267 transport_options: Optional[transport.TransportOptions] = None,
10268 ) -> mdls.ModelSet:
10269 """Update Model Set"""
10270 model_set_id = self.encode_path_param(model_set_id)
10271 response = cast(
10272 mdls.ModelSet,
10273 self.patch(
10274 path=f"/model_sets/{model_set_id}",
10275 structure=mdls.ModelSet,
10276 body=body,
10277 transport_options=transport_options,
10278 ),
10279 )
10280 return response
10281
10282 # ### Delete the model set with a specific id.
10283 #
10284 # DELETE /model_sets/{model_set_id} -> str
10285 def delete_model_set(
10286 self,
10287 # id of model set
10288 model_set_id: str,
10289 transport_options: Optional[transport.TransportOptions] = None,
10290 ) -> str:
10291 """Delete Model Set"""
10292 model_set_id = self.encode_path_param(model_set_id)
10293 response = cast(
10294 str,
10295 self.delete(
10296 path=f"/model_sets/{model_set_id}",
10297 structure=str,
10298 transport_options=transport_options,
10299 ),
10300 )
10301 return response
10302
10303 # ### Get information about all model sets.
10304 #
10305 # GET /model_sets -> Sequence[mdls.ModelSet]
10306 def all_model_sets(
10307 self,
10308 # Requested fields.
10309 fields: Optional[str] = None,
10310 transport_options: Optional[transport.TransportOptions] = None,
10311 ) -> Sequence[mdls.ModelSet]:
10312 """Get All Model Sets"""
10313 response = cast(
10314 Sequence[mdls.ModelSet],
10315 self.get(
10316 path="/model_sets",
10317 structure=Sequence[mdls.ModelSet],
10318 query_params={"fields": fields},
10319 transport_options=transport_options,
10320 ),
10321 )
10322 return response
10323
10324 # ### Create a model set with the specified information. Model sets are used by Roles.
10325 #
10326 # POST /model_sets -> mdls.ModelSet
10327 def create_model_set(
10328 self,
10329 body: mdls.WriteModelSet,
10330 transport_options: Optional[transport.TransportOptions] = None,
10331 ) -> mdls.ModelSet:
10332 """Create Model Set"""
10333 response = cast(
10334 mdls.ModelSet,
10335 self.post(
10336 path="/model_sets",
10337 structure=mdls.ModelSet,
10338 body=body,
10339 transport_options=transport_options,
10340 ),
10341 )
10342 return response
10343
10344 # ### Get all supported permissions.
10345 #
10346 # GET /permissions -> Sequence[mdls.Permission]
10347 def all_permissions(
10348 self,
10349 transport_options: Optional[transport.TransportOptions] = None,
10350 ) -> Sequence[mdls.Permission]:
10351 """Get All Permissions"""
10352 response = cast(
10353 Sequence[mdls.Permission],
10354 self.get(
10355 path="/permissions",
10356 structure=Sequence[mdls.Permission],
10357 transport_options=transport_options,
10358 ),
10359 )
10360 return response
10361
10362 # ### Search permission sets
10363 # Returns all permission set records that match the given search criteria.
10364 # If multiple search params are given and `filter_or` is FALSE or not specified,
10365 # search params are combined in a logical AND operation.
10366 # Only rows that match *all* search param criteria will be returned.
10367 #
10368 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
10369 # Results will include rows that match **any** of the search criteria.
10370 #
10371 # String search params use case-insensitive matching.
10372 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
10373 # example="dan%" will match "danger" and "Danzig" but not "David"
10374 # example="D_m%" will match "Damage" and "dump"
10375 #
10376 # Integer search params can accept a single value or a comma separated list of values. The multiple
10377 # values will be combined under a logical OR operation - results will match at least one of
10378 # the given values.
10379 #
10380 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
10381 # or exclude (respectively) rows where the column is null.
10382 #
10383 # Boolean search params accept only "true" and "false" as values.
10384 #
10385 # GET /permission_sets/search -> Sequence[mdls.PermissionSet]
10386 def search_permission_sets(
10387 self,
10388 # Requested fields.
10389 fields: Optional[str] = None,
10390 # Number of results to return (used with `offset`).
10391 limit: Optional[int] = None,
10392 # Number of results to skip before returning any (used with `limit`).
10393 offset: Optional[int] = None,
10394 # Fields to sort by.
10395 sorts: Optional[str] = None,
10396 # Match permission set id.
10397 id: Optional[str] = None,
10398 # Match permission set name.
10399 name: Optional[str] = None,
10400 # Match permission sets by all_access status.
10401 all_access: Optional[bool] = None,
10402 # Match permission sets by built_in status.
10403 built_in: Optional[bool] = None,
10404 # Combine given search criteria in a boolean OR expression.
10405 filter_or: Optional[bool] = None,
10406 transport_options: Optional[transport.TransportOptions] = None,
10407 ) -> Sequence[mdls.PermissionSet]:
10408 """Search Permission Sets"""
10409 response = cast(
10410 Sequence[mdls.PermissionSet],
10411 self.get(
10412 path="/permission_sets/search",
10413 structure=Sequence[mdls.PermissionSet],
10414 query_params={
10415 "fields": fields,
10416 "limit": limit,
10417 "offset": offset,
10418 "sorts": sorts,
10419 "id": id,
10420 "name": name,
10421 "all_access": all_access,
10422 "built_in": built_in,
10423 "filter_or": filter_or,
10424 },
10425 transport_options=transport_options,
10426 ),
10427 )
10428 return response
10429
10430 # ### Get information about the permission set with a specific id.
10431 #
10432 # GET /permission_sets/{permission_set_id} -> mdls.PermissionSet
10433 def permission_set(
10434 self,
10435 # Id of permission set
10436 permission_set_id: str,
10437 # Requested fields.
10438 fields: Optional[str] = None,
10439 transport_options: Optional[transport.TransportOptions] = None,
10440 ) -> mdls.PermissionSet:
10441 """Get Permission Set"""
10442 permission_set_id = self.encode_path_param(permission_set_id)
10443 response = cast(
10444 mdls.PermissionSet,
10445 self.get(
10446 path=f"/permission_sets/{permission_set_id}",
10447 structure=mdls.PermissionSet,
10448 query_params={"fields": fields},
10449 transport_options=transport_options,
10450 ),
10451 )
10452 return response
10453
10454 # ### Update information about the permission set with a specific id.
10455 # Providing save_content permission alone will also provide you the abilities of save_looks and save_dashboards.
10456 #
10457 # PATCH /permission_sets/{permission_set_id} -> mdls.PermissionSet
10458 def update_permission_set(
10459 self,
10460 # Id of permission set
10461 permission_set_id: str,
10462 body: mdls.WritePermissionSet,
10463 transport_options: Optional[transport.TransportOptions] = None,
10464 ) -> mdls.PermissionSet:
10465 """Update Permission Set"""
10466 permission_set_id = self.encode_path_param(permission_set_id)
10467 response = cast(
10468 mdls.PermissionSet,
10469 self.patch(
10470 path=f"/permission_sets/{permission_set_id}",
10471 structure=mdls.PermissionSet,
10472 body=body,
10473 transport_options=transport_options,
10474 ),
10475 )
10476 return response
10477
10478 # ### Delete the permission set with a specific id.
10479 #
10480 # DELETE /permission_sets/{permission_set_id} -> str
10481 def delete_permission_set(
10482 self,
10483 # Id of permission set
10484 permission_set_id: str,
10485 transport_options: Optional[transport.TransportOptions] = None,
10486 ) -> str:
10487 """Delete Permission Set"""
10488 permission_set_id = self.encode_path_param(permission_set_id)
10489 response = cast(
10490 str,
10491 self.delete(
10492 path=f"/permission_sets/{permission_set_id}",
10493 structure=str,
10494 transport_options=transport_options,
10495 ),
10496 )
10497 return response
10498
10499 # ### Get information about all permission sets.
10500 #
10501 # GET /permission_sets -> Sequence[mdls.PermissionSet]
10502 def all_permission_sets(
10503 self,
10504 # Requested fields.
10505 fields: Optional[str] = None,
10506 transport_options: Optional[transport.TransportOptions] = None,
10507 ) -> Sequence[mdls.PermissionSet]:
10508 """Get All Permission Sets"""
10509 response = cast(
10510 Sequence[mdls.PermissionSet],
10511 self.get(
10512 path="/permission_sets",
10513 structure=Sequence[mdls.PermissionSet],
10514 query_params={"fields": fields},
10515 transport_options=transport_options,
10516 ),
10517 )
10518 return response
10519
10520 # ### Create a permission set with the specified information. Permission sets are used by Roles.
10521 # Providing save_content permission alone will also provide you the abilities of save_looks and save_dashboards.
10522 #
10523 # POST /permission_sets -> mdls.PermissionSet
10524 def create_permission_set(
10525 self,
10526 body: mdls.WritePermissionSet,
10527 transport_options: Optional[transport.TransportOptions] = None,
10528 ) -> mdls.PermissionSet:
10529 """Create Permission Set"""
10530 response = cast(
10531 mdls.PermissionSet,
10532 self.post(
10533 path="/permission_sets",
10534 structure=mdls.PermissionSet,
10535 body=body,
10536 transport_options=transport_options,
10537 ),
10538 )
10539 return response
10540
10541 # ### Get information about all roles.
10542 #
10543 # GET /roles -> Sequence[mdls.Role]
10544 def all_roles(
10545 self,
10546 # Requested fields.
10547 fields: Optional[str] = None,
10548 # Optional list of ids to get specific roles.
10549 ids: Optional[mdls.DelimSequence[str]] = None,
10550 # Get all Looker support roles.
10551 get_all_support_roles: Optional[bool] = None,
10552 transport_options: Optional[transport.TransportOptions] = None,
10553 ) -> Sequence[mdls.Role]:
10554 """Get All Roles"""
10555 response = cast(
10556 Sequence[mdls.Role],
10557 self.get(
10558 path="/roles",
10559 structure=Sequence[mdls.Role],
10560 query_params={
10561 "fields": fields,
10562 "ids": ids,
10563 "get_all_support_roles": get_all_support_roles,
10564 },
10565 transport_options=transport_options,
10566 ),
10567 )
10568 return response
10569
10570 # ### Create a role with the specified information.
10571 #
10572 # POST /roles -> mdls.Role
10573 def create_role(
10574 self,
10575 body: mdls.WriteRole,
10576 transport_options: Optional[transport.TransportOptions] = None,
10577 ) -> mdls.Role:
10578 """Create Role"""
10579 response = cast(
10580 mdls.Role,
10581 self.post(
10582 path="/roles",
10583 structure=mdls.Role,
10584 body=body,
10585 transport_options=transport_options,
10586 ),
10587 )
10588 return response
10589
10590 # ### Search roles
10591 #
10592 # Returns all role records that match the given search criteria.
10593 #
10594 # If multiple search params are given and `filter_or` is FALSE or not specified,
10595 # search params are combined in a logical AND operation.
10596 # Only rows that match *all* search param criteria will be returned.
10597 #
10598 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
10599 # Results will include rows that match **any** of the search criteria.
10600 #
10601 # String search params use case-insensitive matching.
10602 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
10603 # example="dan%" will match "danger" and "Danzig" but not "David"
10604 # example="D_m%" will match "Damage" and "dump"
10605 #
10606 # Integer search params can accept a single value or a comma separated list of values. The multiple
10607 # values will be combined under a logical OR operation - results will match at least one of
10608 # the given values.
10609 #
10610 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
10611 # or exclude (respectively) rows where the column is null.
10612 #
10613 # Boolean search params accept only "true" and "false" as values.
10614 #
10615 # GET /roles/search -> Sequence[mdls.Role]
10616 def search_roles(
10617 self,
10618 # Requested fields.
10619 fields: Optional[str] = None,
10620 # Number of results to return (used with `offset`).
10621 limit: Optional[int] = None,
10622 # Number of results to skip before returning any (used with `limit`).
10623 offset: Optional[int] = None,
10624 # Fields to sort by.
10625 sorts: Optional[str] = None,
10626 # Match role id.
10627 id: Optional[str] = None,
10628 # Match role name.
10629 name: Optional[str] = None,
10630 # Match roles by built_in status.
10631 built_in: Optional[bool] = None,
10632 # Combine given search criteria in a boolean OR expression.
10633 filter_or: Optional[bool] = None,
10634 transport_options: Optional[transport.TransportOptions] = None,
10635 ) -> Sequence[mdls.Role]:
10636 """Search Roles"""
10637 response = cast(
10638 Sequence[mdls.Role],
10639 self.get(
10640 path="/roles/search",
10641 structure=Sequence[mdls.Role],
10642 query_params={
10643 "fields": fields,
10644 "limit": limit,
10645 "offset": offset,
10646 "sorts": sorts,
10647 "id": id,
10648 "name": name,
10649 "built_in": built_in,
10650 "filter_or": filter_or,
10651 },
10652 transport_options=transport_options,
10653 ),
10654 )
10655 return response
10656
10657 # ### Search roles include user count
10658 #
10659 # Returns all role records that match the given search criteria, and attaches
10660 # associated user counts.
10661 #
10662 # If multiple search params are given and `filter_or` is FALSE or not specified,
10663 # search params are combined in a logical AND operation.
10664 # Only rows that match *all* search param criteria will be returned.
10665 #
10666 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
10667 # Results will include rows that match **any** of the search criteria.
10668 #
10669 # String search params use case-insensitive matching.
10670 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
10671 # example="dan%" will match "danger" and "Danzig" but not "David"
10672 # example="D_m%" will match "Damage" and "dump"
10673 #
10674 # Integer search params can accept a single value or a comma separated list of values. The multiple
10675 # values will be combined under a logical OR operation - results will match at least one of
10676 # the given values.
10677 #
10678 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
10679 # or exclude (respectively) rows where the column is null.
10680 #
10681 # Boolean search params accept only "true" and "false" as values.
10682 #
10683 # GET /roles/search/with_user_count -> Sequence[mdls.RoleSearch]
10684 def search_roles_with_user_count(
10685 self,
10686 # Requested fields.
10687 fields: Optional[str] = None,
10688 # Number of results to return (used with `offset`).
10689 limit: Optional[int] = None,
10690 # Number of results to skip before returning any (used with `limit`).
10691 offset: Optional[int] = None,
10692 # Fields to sort by.
10693 sorts: Optional[str] = None,
10694 # Match role id.
10695 id: Optional[str] = None,
10696 # Match role name.
10697 name: Optional[str] = None,
10698 # Match roles by built_in status.
10699 built_in: Optional[bool] = None,
10700 # Combine given search criteria in a boolean OR expression.
10701 filter_or: Optional[bool] = None,
10702 transport_options: Optional[transport.TransportOptions] = None,
10703 ) -> Sequence[mdls.RoleSearch]:
10704 """Search Roles with User Count"""
10705 response = cast(
10706 Sequence[mdls.RoleSearch],
10707 self.get(
10708 path="/roles/search/with_user_count",
10709 structure=Sequence[mdls.RoleSearch],
10710 query_params={
10711 "fields": fields,
10712 "limit": limit,
10713 "offset": offset,
10714 "sorts": sorts,
10715 "id": id,
10716 "name": name,
10717 "built_in": built_in,
10718 "filter_or": filter_or,
10719 },
10720 transport_options=transport_options,
10721 ),
10722 )
10723 return response
10724
10725 # ### Get information about the role with a specific id.
10726 #
10727 # GET /roles/{role_id} -> mdls.Role
10728 def role(
10729 self,
10730 # id of role
10731 role_id: str,
10732 transport_options: Optional[transport.TransportOptions] = None,
10733 ) -> mdls.Role:
10734 """Get Role"""
10735 role_id = self.encode_path_param(role_id)
10736 response = cast(
10737 mdls.Role,
10738 self.get(
10739 path=f"/roles/{role_id}",
10740 structure=mdls.Role,
10741 transport_options=transport_options,
10742 ),
10743 )
10744 return response
10745
10746 # ### Update information about the role with a specific id.
10747 #
10748 # PATCH /roles/{role_id} -> mdls.Role
10749 def update_role(
10750 self,
10751 # id of role
10752 role_id: str,
10753 body: mdls.WriteRole,
10754 transport_options: Optional[transport.TransportOptions] = None,
10755 ) -> mdls.Role:
10756 """Update Role"""
10757 role_id = self.encode_path_param(role_id)
10758 response = cast(
10759 mdls.Role,
10760 self.patch(
10761 path=f"/roles/{role_id}",
10762 structure=mdls.Role,
10763 body=body,
10764 transport_options=transport_options,
10765 ),
10766 )
10767 return response
10768
10769 # ### Delete the role with a specific id.
10770 #
10771 # DELETE /roles/{role_id} -> str
10772 def delete_role(
10773 self,
10774 # id of role
10775 role_id: str,
10776 transport_options: Optional[transport.TransportOptions] = None,
10777 ) -> str:
10778 """Delete Role"""
10779 role_id = self.encode_path_param(role_id)
10780 response = cast(
10781 str,
10782 self.delete(
10783 path=f"/roles/{role_id}",
10784 structure=str,
10785 transport_options=transport_options,
10786 ),
10787 )
10788 return response
10789
10790 # ### Get information about all the groups with the role that has a specific id.
10791 #
10792 # GET /roles/{role_id}/groups -> Sequence[mdls.Group]
10793 def role_groups(
10794 self,
10795 # id of role
10796 role_id: str,
10797 # Requested fields.
10798 fields: Optional[str] = None,
10799 transport_options: Optional[transport.TransportOptions] = None,
10800 ) -> Sequence[mdls.Group]:
10801 """Get Role Groups"""
10802 role_id = self.encode_path_param(role_id)
10803 response = cast(
10804 Sequence[mdls.Group],
10805 self.get(
10806 path=f"/roles/{role_id}/groups",
10807 structure=Sequence[mdls.Group],
10808 query_params={"fields": fields},
10809 transport_options=transport_options,
10810 ),
10811 )
10812 return response
10813
10814 # ### Set all groups for a role, removing all existing group associations from that role.
10815 #
10816 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
10817 #
10818 # PUT /roles/{role_id}/groups -> Sequence[mdls.Group]
10819 def set_role_groups(
10820 self,
10821 # id of role
10822 role_id: str,
10823 body: Sequence[str],
10824 transport_options: Optional[transport.TransportOptions] = None,
10825 ) -> Sequence[mdls.Group]:
10826 """Update Role Groups"""
10827 role_id = self.encode_path_param(role_id)
10828 response = cast(
10829 Sequence[mdls.Group],
10830 self.put(
10831 path=f"/roles/{role_id}/groups",
10832 structure=Sequence[mdls.Group],
10833 body=body,
10834 transport_options=transport_options,
10835 ),
10836 )
10837 return response
10838
10839 # ### Get information about all the users with the role that has a specific id.
10840 #
10841 # GET /roles/{role_id}/users -> Sequence[mdls.User]
10842 def role_users(
10843 self,
10844 # id of role
10845 role_id: str,
10846 # Requested fields.
10847 fields: Optional[str] = None,
10848 # Get only users associated directly with the role: exclude those only associated through groups.
10849 direct_association_only: Optional[bool] = None,
10850 transport_options: Optional[transport.TransportOptions] = None,
10851 ) -> Sequence[mdls.User]:
10852 """Get Role Users"""
10853 role_id = self.encode_path_param(role_id)
10854 response = cast(
10855 Sequence[mdls.User],
10856 self.get(
10857 path=f"/roles/{role_id}/users",
10858 structure=Sequence[mdls.User],
10859 query_params={
10860 "fields": fields,
10861 "direct_association_only": direct_association_only,
10862 },
10863 transport_options=transport_options,
10864 ),
10865 )
10866 return response
10867
10868 # ### Set all the users of the role with a specific id.
10869 #
10870 # PUT /roles/{role_id}/users -> Sequence[mdls.User]
10871 def set_role_users(
10872 self,
10873 # id of role
10874 role_id: str,
10875 body: Sequence[str],
10876 transport_options: Optional[transport.TransportOptions] = None,
10877 ) -> Sequence[mdls.User]:
10878 """Update Role Users"""
10879 role_id = self.encode_path_param(role_id)
10880 response = cast(
10881 Sequence[mdls.User],
10882 self.put(
10883 path=f"/roles/{role_id}/users",
10884 structure=Sequence[mdls.User],
10885 body=body,
10886 transport_options=transport_options,
10887 ),
10888 )
10889 return response
10890
10891 # endregion
10892
10893 # region ScheduledPlan: Manage Scheduled Plans
10894
10895 # ### Get Scheduled Plans for a Space
10896 #
10897 # Returns scheduled plans owned by the caller for a given space id.
10898 #
10899 # GET /scheduled_plans/space/{space_id} -> Sequence[mdls.ScheduledPlan]
10900 def scheduled_plans_for_space(
10901 self,
10902 # Space Id
10903 space_id: str,
10904 # Requested fields.
10905 fields: Optional[str] = None,
10906 transport_options: Optional[transport.TransportOptions] = None,
10907 ) -> Sequence[mdls.ScheduledPlan]:
10908 """Scheduled Plans for Space"""
10909 space_id = self.encode_path_param(space_id)
10910 response = cast(
10911 Sequence[mdls.ScheduledPlan],
10912 self.get(
10913 path=f"/scheduled_plans/space/{space_id}",
10914 structure=Sequence[mdls.ScheduledPlan],
10915 query_params={"fields": fields},
10916 transport_options=transport_options,
10917 ),
10918 )
10919 return response
10920
10921 # ### Get Information About a Scheduled Plan
10922 #
10923 # Admins can fetch information about other users' Scheduled Plans.
10924 #
10925 # GET /scheduled_plans/{scheduled_plan_id} -> mdls.ScheduledPlan
10926 def scheduled_plan(
10927 self,
10928 # Scheduled Plan Id
10929 scheduled_plan_id: str,
10930 # Requested fields.
10931 fields: Optional[str] = None,
10932 transport_options: Optional[transport.TransportOptions] = None,
10933 ) -> mdls.ScheduledPlan:
10934 """Get Scheduled Plan"""
10935 scheduled_plan_id = self.encode_path_param(scheduled_plan_id)
10936 response = cast(
10937 mdls.ScheduledPlan,
10938 self.get(
10939 path=f"/scheduled_plans/{scheduled_plan_id}",
10940 structure=mdls.ScheduledPlan,
10941 query_params={"fields": fields},
10942 transport_options=transport_options,
10943 ),
10944 )
10945 return response
10946
10947 # ### Update a Scheduled Plan
10948 #
10949 # Admins can update other users' Scheduled Plans.
10950 #
10951 # Note: Any scheduled plan destinations specified in an update will **replace** all scheduled plan destinations
10952 # currently defined for the scheduled plan.
10953 #
10954 # For Example: If a scheduled plan has destinations A, B, and C, and you call update on this scheduled plan
10955 # specifying only B in the destinations, then destinations A and C will be deleted by the update.
10956 #
10957 # 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.
10958 #
10959 # If you omit the scheduled_plan_destinations property from the object passed to update, then the destinations
10960 # defined on the original scheduled plan will remain unchanged.
10961 #
10962 # #### Email Permissions:
10963 #
10964 # For details about permissions required to schedule delivery to email and the safeguards
10965 # Looker offers to protect against sending to unauthorized email destinations, see [Email Domain Allow List for Scheduled Looks](https://docs.cloud.google.com/looker/docs/r/api/embed-permissions).
10966 #
10967 #
10968 # #### Scheduled Plan Destination Formats
10969 #
10970 # Scheduled plan destinations must specify the data format to produce and send to the destination.
10971 #
10972 # Formats:
10973 #
10974 # | format | Description
10975 # | :-----------: | :--- |
10976 # | json | A JSON object containing a `data` property which contains an array of JSON objects, one per row. No metadata.
10977 # | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
10978 # | 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.
10979 # | csv | Comma separated values with a header
10980 # | txt | Tab separated values with a header
10981 # | html | Simple html
10982 # | xlsx | MS Excel spreadsheet
10983 # | wysiwyg_pdf | Dashboard rendered in a tiled layout to produce a PDF document
10984 # | assembled_pdf | Dashboard rendered in a single column layout to produce a PDF document
10985 # | wysiwyg_png | Dashboard rendered in a tiled layout to produce a PNG image
10986 # ||
10987 #
10988 # Valid formats vary by destination type and source object. `wysiwyg_pdf` is only valid for dashboards, for example.
10989 #
10990 # PATCH /scheduled_plans/{scheduled_plan_id} -> mdls.ScheduledPlan
10991 def update_scheduled_plan(
10992 self,
10993 # Scheduled Plan Id
10994 scheduled_plan_id: str,
10995 body: mdls.WriteScheduledPlan,
10996 transport_options: Optional[transport.TransportOptions] = None,
10997 ) -> mdls.ScheduledPlan:
10998 """Update Scheduled Plan"""
10999 scheduled_plan_id = self.encode_path_param(scheduled_plan_id)
11000 response = cast(
11001 mdls.ScheduledPlan,
11002 self.patch(
11003 path=f"/scheduled_plans/{scheduled_plan_id}",
11004 structure=mdls.ScheduledPlan,
11005 body=body,
11006 transport_options=transport_options,
11007 ),
11008 )
11009 return response
11010
11011 # ### Delete a Scheduled Plan
11012 #
11013 # Normal users can only delete their own scheduled plans.
11014 # Admins can delete other users' scheduled plans.
11015 # This delete cannot be undone.
11016 #
11017 # DELETE /scheduled_plans/{scheduled_plan_id} -> str
11018 def delete_scheduled_plan(
11019 self,
11020 # Scheduled Plan Id
11021 scheduled_plan_id: str,
11022 transport_options: Optional[transport.TransportOptions] = None,
11023 ) -> str:
11024 """Delete Scheduled Plan"""
11025 scheduled_plan_id = self.encode_path_param(scheduled_plan_id)
11026 response = cast(
11027 str,
11028 self.delete(
11029 path=f"/scheduled_plans/{scheduled_plan_id}",
11030 structure=str,
11031 transport_options=transport_options,
11032 ),
11033 )
11034 return response
11035
11036 # ### List All Scheduled Plans
11037 #
11038 # Returns all scheduled plans which belong to the caller or given user.
11039 #
11040 # If no user_id is provided, this function returns the scheduled plans owned by the caller.
11041 #
11042 #
11043 # To list all schedules for all users, pass `all_users=true`.
11044 #
11045 #
11046 # The caller must have `see_schedules` permission to see other users' scheduled plans.
11047 #
11048 # GET /scheduled_plans -> Sequence[mdls.ScheduledPlan]
11049 def all_scheduled_plans(
11050 self,
11051 # Return scheduled plans belonging to this user_id. If not provided, returns scheduled plans owned by the caller.
11052 user_id: Optional[str] = None,
11053 # Comma delimited list of field names. If provided, only the fields specified will be included in the response
11054 fields: Optional[str] = None,
11055 # Return scheduled plans belonging to all users (caller needs see_schedules permission)
11056 all_users: Optional[bool] = None,
11057 transport_options: Optional[transport.TransportOptions] = None,
11058 ) -> Sequence[mdls.ScheduledPlan]:
11059 """Get All Scheduled Plans"""
11060 response = cast(
11061 Sequence[mdls.ScheduledPlan],
11062 self.get(
11063 path="/scheduled_plans",
11064 structure=Sequence[mdls.ScheduledPlan],
11065 query_params={
11066 "user_id": user_id,
11067 "fields": fields,
11068 "all_users": all_users,
11069 },
11070 transport_options=transport_options,
11071 ),
11072 )
11073 return response
11074
11075 # ### Create a Scheduled Plan
11076 #
11077 # Create a scheduled plan to render a Look or Dashboard on a recurring schedule.
11078 #
11079 # To create a scheduled plan, you MUST provide values for the following fields:
11080 # `name`
11081 # and
11082 # `look_id`, `dashboard_id`, `lookml_dashboard_id`, or `query_id`
11083 # and
11084 # `cron_tab` or `datagroup`
11085 # and
11086 # at least one scheduled_plan_destination
11087 #
11088 # A scheduled plan MUST have at least one scheduled_plan_destination defined.
11089 #
11090 # When `look_id` is set, `require_no_results`, `require_results`, and `require_change` are all required.
11091 #
11092 # 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.
11093 #
11094 # The queries that provide the data for the look or dashboard are run in the context of user account that owns the scheduled plan.
11095 #
11096 # When `run_as_recipient` is `false` or not specified, the queries that provide the data for the
11097 # look or dashboard are run in the context of user account that owns the scheduled plan.
11098 #
11099 # When `run_as_recipient` is `true` and all the email recipients are Looker user accounts, the
11100 # queries are run in the context of each recipient, so different recipients may see different
11101 # data from the same scheduled render of a look or dashboard. For more details, see [Run As Recipient](https://docs.cloud.google.com/looker/docs/r/admin/run-as-recipient).
11102 #
11103 # Admins can create and modify scheduled plans on behalf of other users by specifying a user id.
11104 # Non-admin users may not create or modify scheduled plans by or for other users.
11105 #
11106 # #### Email Permissions:
11107 #
11108 # For details about permissions required to schedule delivery to email and the safeguards
11109 # Looker offers to protect against sending to unauthorized email destinations, see [Email Domain Allow List for Scheduled Looks](https://docs.cloud.google.com/looker/docs/r/api/embed-permissions).
11110 #
11111 #
11112 # #### Scheduled Plan Destination Formats
11113 #
11114 # Scheduled plan destinations must specify the data format to produce and send to the destination.
11115 #
11116 # Formats:
11117 #
11118 # | format | Description
11119 # | :-----------: | :--- |
11120 # | json | A JSON object containing a `data` property which contains an array of JSON objects, one per row. No metadata.
11121 # | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
11122 # | 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.
11123 # | csv | Comma separated values with a header
11124 # | txt | Tab separated values with a header
11125 # | html | Simple html
11126 # | xlsx | MS Excel spreadsheet
11127 # | wysiwyg_pdf | Dashboard rendered in a tiled layout to produce a PDF document
11128 # | assembled_pdf | Dashboard rendered in a single column layout to produce a PDF document
11129 # | wysiwyg_png | Dashboard rendered in a tiled layout to produce a PNG image
11130 # ||
11131 #
11132 # Valid formats vary by destination type and source object. `wysiwyg_pdf` is only valid for dashboards, for example.
11133 #
11134 # POST /scheduled_plans -> mdls.ScheduledPlan
11135 def create_scheduled_plan(
11136 self,
11137 body: mdls.WriteScheduledPlan,
11138 transport_options: Optional[transport.TransportOptions] = None,
11139 ) -> mdls.ScheduledPlan:
11140 """Create Scheduled Plan"""
11141 response = cast(
11142 mdls.ScheduledPlan,
11143 self.post(
11144 path="/scheduled_plans",
11145 structure=mdls.ScheduledPlan,
11146 body=body,
11147 transport_options=transport_options,
11148 ),
11149 )
11150 return response
11151
11152 # ### Run a Scheduled Plan Immediately
11153 #
11154 # Create a scheduled plan that runs only once, and immediately.
11155 #
11156 # This can be useful for testing a Scheduled Plan before committing to a production schedule.
11157 #
11158 # Admins can create scheduled plans on behalf of other users by specifying a user id.
11159 #
11160 # This API is rate limited to prevent it from being used for relay spam or DoS attacks
11161 #
11162 # #### Email Permissions:
11163 #
11164 # For details about permissions required to schedule delivery to email and the safeguards
11165 # Looker offers to protect against sending to unauthorized email destinations, see [Email Domain Allow List for Scheduled Looks](https://docs.cloud.google.com/looker/docs/r/api/embed-permissions).
11166 #
11167 #
11168 # #### Scheduled Plan Destination Formats
11169 #
11170 # Scheduled plan destinations must specify the data format to produce and send to the destination.
11171 #
11172 # Formats:
11173 #
11174 # | format | Description
11175 # | :-----------: | :--- |
11176 # | json | A JSON object containing a `data` property which contains an array of JSON objects, one per row. No metadata.
11177 # | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
11178 # | 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.
11179 # | csv | Comma separated values with a header
11180 # | txt | Tab separated values with a header
11181 # | html | Simple html
11182 # | xlsx | MS Excel spreadsheet
11183 # | wysiwyg_pdf | Dashboard rendered in a tiled layout to produce a PDF document
11184 # | assembled_pdf | Dashboard rendered in a single column layout to produce a PDF document
11185 # | wysiwyg_png | Dashboard rendered in a tiled layout to produce a PNG image
11186 # ||
11187 #
11188 # Valid formats vary by destination type and source object. `wysiwyg_pdf` is only valid for dashboards, for example.
11189 #
11190 # POST /scheduled_plans/run_once -> mdls.ScheduledPlan
11191 def scheduled_plan_run_once(
11192 self,
11193 body: mdls.WriteScheduledPlan,
11194 transport_options: Optional[transport.TransportOptions] = None,
11195 ) -> mdls.ScheduledPlan:
11196 """Run Scheduled Plan Once"""
11197 response = cast(
11198 mdls.ScheduledPlan,
11199 self.post(
11200 path="/scheduled_plans/run_once",
11201 structure=mdls.ScheduledPlan,
11202 body=body,
11203 transport_options=transport_options,
11204 ),
11205 )
11206 return response
11207
11208 # ### Search Scheduled Plans
11209 #
11210 # Returns all scheduled plans which matches the given search criteria.
11211 #
11212 # If no user_id is provided, this function returns the scheduled plans owned by the caller.
11213 #
11214 #
11215 # To list all schedules for all users, pass `all_users=true`.
11216 #
11217 #
11218 # The caller must have `see_schedules` permission to see other users' scheduled plans.
11219 #
11220 # GET /scheduled_plans/search -> Sequence[mdls.ScheduledPlan]
11221 def search_scheduled_plans(
11222 self,
11223 # Return scheduled plans belonging to this user_id. If not provided, returns scheduled plans owned by the caller.
11224 user_id: Optional[str] = None,
11225 # Comma delimited list of field names. If provided, only the fields specified will be included in the response
11226 fields: Optional[str] = None,
11227 # Return scheduled plans belonging to all users (caller needs see_schedules permission)
11228 all_users: Optional[bool] = None,
11229 # Number of results to return. (used with offset and takes priority over page and per_page)
11230 limit: Optional[int] = None,
11231 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
11232 offset: Optional[int] = None,
11233 # Fields to sort by.
11234 sorts: Optional[str] = None,
11235 # Match Scheduled plan's name.
11236 name: Optional[str] = None,
11237 # Returns scheduled plans belonging to user with this first name.
11238 user_first_name: Optional[str] = None,
11239 # Returns scheduled plans belonging to user with this last name.
11240 user_last_name: Optional[str] = None,
11241 # Returns scheduled plans created on this Dashboard.
11242 dashboard_id: Optional[str] = None,
11243 # Returns scheduled plans created on this Look.
11244 look_id: Optional[str] = None,
11245 # Returns scheduled plans created on this LookML Dashboard.
11246 lookml_dashboard_id: Optional[str] = None,
11247 # Match recipient address.
11248 recipient: Optional[str] = None,
11249 # Match scheduled plan's destination type.
11250 destination_type: Optional[str] = None,
11251 # Match scheduled plan's delivery format.
11252 delivery_format: Optional[str] = None,
11253 # Combine given search criteria in a boolean OR expression
11254 filter_or: Optional[bool] = None,
11255 transport_options: Optional[transport.TransportOptions] = None,
11256 ) -> Sequence[mdls.ScheduledPlan]:
11257 """Search Scheduled Plans"""
11258 response = cast(
11259 Sequence[mdls.ScheduledPlan],
11260 self.get(
11261 path="/scheduled_plans/search",
11262 structure=Sequence[mdls.ScheduledPlan],
11263 query_params={
11264 "user_id": user_id,
11265 "fields": fields,
11266 "all_users": all_users,
11267 "limit": limit,
11268 "offset": offset,
11269 "sorts": sorts,
11270 "name": name,
11271 "user_first_name": user_first_name,
11272 "user_last_name": user_last_name,
11273 "dashboard_id": dashboard_id,
11274 "look_id": look_id,
11275 "lookml_dashboard_id": lookml_dashboard_id,
11276 "recipient": recipient,
11277 "destination_type": destination_type,
11278 "delivery_format": delivery_format,
11279 "filter_or": filter_or,
11280 },
11281 transport_options=transport_options,
11282 ),
11283 )
11284 return response
11285
11286 # ### Get Scheduled Plans for a Look
11287 #
11288 # Returns all scheduled plans for a look which belong to the caller or given user.
11289 #
11290 # If no user_id is provided, this function returns the scheduled plans owned by the caller.
11291 #
11292 #
11293 # To list all schedules for all users, pass `all_users=true`.
11294 #
11295 #
11296 # The caller must have `see_schedules` permission to see other users' scheduled plans.
11297 #
11298 # GET /scheduled_plans/look/{look_id} -> Sequence[mdls.ScheduledPlan]
11299 def scheduled_plans_for_look(
11300 self,
11301 # Look Id
11302 look_id: str,
11303 # User Id (default is requesting user if not specified)
11304 user_id: Optional[str] = None,
11305 # Requested fields.
11306 fields: Optional[str] = None,
11307 # Return scheduled plans belonging to all users for the look
11308 all_users: Optional[bool] = None,
11309 transport_options: Optional[transport.TransportOptions] = None,
11310 ) -> Sequence[mdls.ScheduledPlan]:
11311 """Scheduled Plans for Look"""
11312 look_id = self.encode_path_param(look_id)
11313 response = cast(
11314 Sequence[mdls.ScheduledPlan],
11315 self.get(
11316 path=f"/scheduled_plans/look/{look_id}",
11317 structure=Sequence[mdls.ScheduledPlan],
11318 query_params={
11319 "user_id": user_id,
11320 "fields": fields,
11321 "all_users": all_users,
11322 },
11323 transport_options=transport_options,
11324 ),
11325 )
11326 return response
11327
11328 # ### Get Scheduled Plans for a Dashboard
11329 #
11330 # Returns all scheduled plans for a dashboard which belong to the caller or given user.
11331 #
11332 # If no user_id is provided, this function returns the scheduled plans owned by the caller.
11333 #
11334 #
11335 # To list all schedules for all users, pass `all_users=true`.
11336 #
11337 #
11338 # The caller must have `see_schedules` permission to see other users' scheduled plans.
11339 #
11340 # GET /scheduled_plans/dashboard/{dashboard_id} -> Sequence[mdls.ScheduledPlan]
11341 def scheduled_plans_for_dashboard(
11342 self,
11343 # Dashboard Id
11344 dashboard_id: str,
11345 # User Id (default is requesting user if not specified)
11346 user_id: Optional[str] = None,
11347 # Return scheduled plans belonging to all users for the dashboard
11348 all_users: Optional[bool] = None,
11349 # Requested fields.
11350 fields: Optional[str] = None,
11351 transport_options: Optional[transport.TransportOptions] = None,
11352 ) -> Sequence[mdls.ScheduledPlan]:
11353 """Scheduled Plans for Dashboard"""
11354 dashboard_id = self.encode_path_param(dashboard_id)
11355 response = cast(
11356 Sequence[mdls.ScheduledPlan],
11357 self.get(
11358 path=f"/scheduled_plans/dashboard/{dashboard_id}",
11359 structure=Sequence[mdls.ScheduledPlan],
11360 query_params={
11361 "user_id": user_id,
11362 "all_users": all_users,
11363 "fields": fields,
11364 },
11365 transport_options=transport_options,
11366 ),
11367 )
11368 return response
11369
11370 # ### Get Scheduled Plans for a LookML Dashboard
11371 #
11372 # Returns all scheduled plans for a LookML Dashboard which belong to the caller or given user.
11373 #
11374 # If no user_id is provided, this function returns the scheduled plans owned by the caller.
11375 #
11376 #
11377 # To list all schedules for all users, pass `all_users=true`.
11378 #
11379 #
11380 # The caller must have `see_schedules` permission to see other users' scheduled plans.
11381 #
11382 # GET /scheduled_plans/lookml_dashboard/{lookml_dashboard_id} -> Sequence[mdls.ScheduledPlan]
11383 def scheduled_plans_for_lookml_dashboard(
11384 self,
11385 # LookML Dashboard Id
11386 lookml_dashboard_id: str,
11387 # User Id (default is requesting user if not specified)
11388 user_id: Optional[str] = None,
11389 # Requested fields.
11390 fields: Optional[str] = None,
11391 # Return scheduled plans belonging to all users for the dashboard
11392 all_users: Optional[bool] = None,
11393 transport_options: Optional[transport.TransportOptions] = None,
11394 ) -> Sequence[mdls.ScheduledPlan]:
11395 """Scheduled Plans for LookML Dashboard"""
11396 lookml_dashboard_id = self.encode_path_param(lookml_dashboard_id)
11397 response = cast(
11398 Sequence[mdls.ScheduledPlan],
11399 self.get(
11400 path=f"/scheduled_plans/lookml_dashboard/{lookml_dashboard_id}",
11401 structure=Sequence[mdls.ScheduledPlan],
11402 query_params={
11403 "user_id": user_id,
11404 "fields": fields,
11405 "all_users": all_users,
11406 },
11407 transport_options=transport_options,
11408 ),
11409 )
11410 return response
11411
11412 # ### Run a Scheduled Plan By Id Immediately
11413 # This function creates a run-once schedule plan based on an existing scheduled plan,
11414 # applies modifications (if any) to the new scheduled plan, and runs the new schedule plan immediately.
11415 # This can be useful for testing modifications to an existing scheduled plan before committing to a production schedule.
11416 #
11417 # This function internally performs the following operations:
11418 #
11419 # 1. Copies the properties of the existing scheduled plan into a new scheduled plan
11420 # 2. Copies any properties passed in the JSON body of this request into the new scheduled plan (replacing the original values)
11421 # 3. Creates the new scheduled plan
11422 # 4. Runs the new scheduled plan
11423 #
11424 # The original scheduled plan is not modified by this operation.
11425 # Admins can create, modify, and run scheduled plans on behalf of other users by specifying a user id.
11426 # Non-admins can only create, modify, and run their own scheduled plans.
11427 #
11428 # #### Email Permissions:
11429 #
11430 # For details about permissions required to schedule delivery to email and the safeguards
11431 # Looker offers to protect against sending to unauthorized email destinations, see [Email Domain Allow List for Scheduled Looks](https://docs.cloud.google.com/looker/docs/r/api/embed-permissions).
11432 #
11433 #
11434 # #### Scheduled Plan Destination Formats
11435 #
11436 # Scheduled plan destinations must specify the data format to produce and send to the destination.
11437 #
11438 # Formats:
11439 #
11440 # | format | Description
11441 # | :-----------: | :--- |
11442 # | json | A JSON object containing a `data` property which contains an array of JSON objects, one per row. No metadata.
11443 # | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
11444 # | 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.
11445 # | csv | Comma separated values with a header
11446 # | txt | Tab separated values with a header
11447 # | html | Simple html
11448 # | xlsx | MS Excel spreadsheet
11449 # | wysiwyg_pdf | Dashboard rendered in a tiled layout to produce a PDF document
11450 # | assembled_pdf | Dashboard rendered in a single column layout to produce a PDF document
11451 # | wysiwyg_png | Dashboard rendered in a tiled layout to produce a PNG image
11452 # ||
11453 #
11454 # Valid formats vary by destination type and source object. `wysiwyg_pdf` is only valid for dashboards, for example.
11455 #
11456 #
11457 #
11458 # This API is rate limited to prevent it from being used for relay spam or DoS attacks
11459 #
11460 # POST /scheduled_plans/{scheduled_plan_id}/run_once -> mdls.ScheduledPlan
11461 def scheduled_plan_run_once_by_id(
11462 self,
11463 # Id of schedule plan to copy and run
11464 scheduled_plan_id: str,
11465 body: Optional[mdls.WriteScheduledPlan] = None,
11466 transport_options: Optional[transport.TransportOptions] = None,
11467 ) -> mdls.ScheduledPlan:
11468 """Run Scheduled Plan Once by Id"""
11469 scheduled_plan_id = self.encode_path_param(scheduled_plan_id)
11470 response = cast(
11471 mdls.ScheduledPlan,
11472 self.post(
11473 path=f"/scheduled_plans/{scheduled_plan_id}/run_once",
11474 structure=mdls.ScheduledPlan,
11475 body=body,
11476 transport_options=transport_options,
11477 ),
11478 )
11479 return response
11480
11481 # endregion
11482
11483 # region SelfService: Self Service Models
11484
11485 # ### Update certification for a Self Service Explore
11486 #
11487 # POST /self_service_models/{model_name}/certification -> mdls.Certification
11488 def update_self_service_explore_certification(
11489 self,
11490 # Name of self service model.
11491 model_name: str,
11492 body: mdls.WriteCertification,
11493 transport_options: Optional[transport.TransportOptions] = None,
11494 ) -> mdls.Certification:
11495 """Update certification for a Self Service Explore"""
11496 model_name = self.encode_path_param(model_name)
11497 response = cast(
11498 mdls.Certification,
11499 self.post(
11500 path=f"/self_service_models/{model_name}/certification",
11501 structure=mdls.Certification,
11502 body=body,
11503 transport_options=transport_options,
11504 ),
11505 )
11506 return response
11507
11508 # endregion
11509
11510 # region Session: Session Information
11511
11512 # ### Get API Session
11513 #
11514 # Returns information about the current API session, such as which workspace is selected for the session.
11515 #
11516 # GET /session -> mdls.ApiSession
11517 def session(
11518 self,
11519 transport_options: Optional[transport.TransportOptions] = None,
11520 ) -> mdls.ApiSession:
11521 """Get Auth"""
11522 response = cast(
11523 mdls.ApiSession,
11524 self.get(
11525 path="/session",
11526 structure=mdls.ApiSession,
11527 transport_options=transport_options,
11528 ),
11529 )
11530 return response
11531
11532 # ### Update API Session
11533 #
11534 # #### API Session Workspace
11535 #
11536 # You can use this endpoint to change the active workspace for the current API session.
11537 #
11538 # Only one workspace can be active in a session. The active workspace can be changed
11539 # any number of times in a session.
11540 #
11541 # The default workspace for API sessions is the "production" workspace.
11542 #
11543 # All Looker APIs that use projects or lookml models (such as running queries) will
11544 # use the version of project and model files defined by this workspace for the lifetime of the
11545 # current API session or until the session workspace is changed again.
11546 #
11547 # An API session has the same lifetime as the access_token used to authenticate API requests. Each successful
11548 # API login generates a new access_token and a new API session.
11549 #
11550 # If your Looker API client application needs to work in a dev workspace across multiple
11551 # API sessions, be sure to select the dev workspace after each login.
11552 #
11553 # PATCH /session -> mdls.ApiSession
11554 def update_session(
11555 self,
11556 body: mdls.WriteApiSession,
11557 transport_options: Optional[transport.TransportOptions] = None,
11558 ) -> mdls.ApiSession:
11559 """Update Auth"""
11560 response = cast(
11561 mdls.ApiSession,
11562 self.patch(
11563 path="/session",
11564 structure=mdls.ApiSession,
11565 body=body,
11566 transport_options=transport_options,
11567 ),
11568 )
11569 return response
11570
11571 # endregion
11572
11573 # region SqlInterfaceQuery: Run and Manage SQL Interface Queries
11574
11575 # ### Handles Avatica RPC metadata requests for SQL Interface queries
11576 #
11577 # GET /sql_interface_queries/metadata -> mdls.SqlInterfaceQueryMetadata
11578 def sql_interface_metadata(
11579 self,
11580 # Avatica RPC request
11581 avatica_request: Optional[str] = None,
11582 transport_options: Optional[transport.TransportOptions] = None,
11583 ) -> mdls.SqlInterfaceQueryMetadata:
11584 """Get SQL Interface Query Metadata"""
11585 response = cast(
11586 mdls.SqlInterfaceQueryMetadata,
11587 self.get(
11588 path="/sql_interface_queries/metadata",
11589 structure=mdls.SqlInterfaceQueryMetadata,
11590 query_params={"avatica_request": avatica_request},
11591 transport_options=transport_options,
11592 ),
11593 )
11594 return response
11595
11596 # ### Run a saved SQL interface query.
11597 #
11598 # This runs a previously created SQL interface query.
11599 #
11600 # The 'result_format' parameter specifies the desired structure and format of the response.
11601 #
11602 # Supported formats:
11603 #
11604 # | result_format | Description
11605 # | :-----------: | :--- |
11606 # | json_bi | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
11607 #
11608 # GET /sql_interface_queries/{query_id}/run/{result_format} -> mdls.JsonBi
11609 def run_sql_interface_query(
11610 self,
11611 # Integer id of query
11612 query_id: int,
11613 # Format of result, options are: ["json_bi"]
11614 result_format: str,
11615 transport_options: Optional[transport.TransportOptions] = None,
11616 ) -> mdls.JsonBi:
11617 """Run SQL Interface Query"""
11618 result_format = self.encode_path_param(result_format)
11619 response = cast(
11620 mdls.JsonBi,
11621 self.get(
11622 path=f"/sql_interface_queries/{query_id}/run/{result_format}",
11623 structure=mdls.JsonBi,
11624 transport_options=transport_options,
11625 ),
11626 )
11627 return response
11628
11629 # ### Create a SQL interface query.
11630 #
11631 # This allows you to create a new SQL interface query that you can later run. Looker queries are immutable once created
11632 # and are not deleted. If you create a query that is exactly like an existing query then the existing query
11633 # will be returned and no new query will be created. Whether a new query is created or not, you can use
11634 # the 'id' in the returned query with the 'run' method.
11635 #
11636 # The query parameters are passed as json in the body of the request.
11637 #
11638 # POST /sql_interface_queries -> mdls.SqlInterfaceQuery
11639 def create_sql_interface_query(
11640 self,
11641 body: mdls.WriteSqlInterfaceQueryCreate,
11642 transport_options: Optional[transport.TransportOptions] = None,
11643 ) -> mdls.SqlInterfaceQuery:
11644 """Create SQL Interface Query"""
11645 response = cast(
11646 mdls.SqlInterfaceQuery,
11647 self.post(
11648 path="/sql_interface_queries",
11649 structure=mdls.SqlInterfaceQuery,
11650 body=body,
11651 transport_options=transport_options,
11652 ),
11653 )
11654 return response
11655
11656 # endregion
11657
11658 # region Theme: Manage Themes
11659
11660 # ### Get an array of all existing themes
11661 #
11662 # Get a **single theme** by id with [Theme](#!/Theme/theme)
11663 #
11664 # This method returns an array of all existing themes. The active time for the theme is not considered.
11665 #
11666 # **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.
11667 #
11668 # GET /themes -> Sequence[mdls.Theme]
11669 def all_themes(
11670 self,
11671 # Requested fields.
11672 fields: Optional[str] = None,
11673 transport_options: Optional[transport.TransportOptions] = None,
11674 ) -> Sequence[mdls.Theme]:
11675 """Get All Themes"""
11676 response = cast(
11677 Sequence[mdls.Theme],
11678 self.get(
11679 path="/themes",
11680 structure=Sequence[mdls.Theme],
11681 query_params={"fields": fields},
11682 transport_options=transport_options,
11683 ),
11684 )
11685 return response
11686
11687 # ### Create a theme
11688 #
11689 # Creates a new theme object, returning the theme details, including the created id.
11690 #
11691 # If `settings` are not specified, the default theme settings will be copied into the new theme.
11692 #
11693 # The theme `name` can only contain alphanumeric characters or underscores. Theme names should not contain any confidential information, such as customer names.
11694 #
11695 # **Update** an existing theme with [Update Theme](#!/Theme/update_theme)
11696 #
11697 # **Permanently delete** an existing theme with [Delete Theme](#!/Theme/delete_theme)
11698 #
11699 # For more information, see [Creating and Applying Themes](https://docs.cloud.google.com/looker/docs/r/admin/themes).
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 -> mdls.Theme
11704 def create_theme(
11705 self,
11706 body: mdls.WriteTheme,
11707 transport_options: Optional[transport.TransportOptions] = None,
11708 ) -> mdls.Theme:
11709 """Create Theme"""
11710 response = cast(
11711 mdls.Theme,
11712 self.post(
11713 path="/themes",
11714 structure=mdls.Theme,
11715 body=body,
11716 transport_options=transport_options,
11717 ),
11718 )
11719 return response
11720
11721 # ### Search all themes for matching criteria.
11722 #
11723 # Returns an **array of theme objects** that match the specified search criteria.
11724 #
11725 # | Search Parameters | Description
11726 # | :-------------------: | :------ |
11727 # | `begin_at` only | Find themes active at or after `begin_at`
11728 # | `end_at` only | Find themes active at or before `end_at`
11729 # | both set | Find themes with an active inclusive period between `begin_at` and `end_at`
11730 #
11731 # Note: Range matching requires boolean AND logic.
11732 # When using `begin_at` and `end_at` together, do not use `filter_or`=TRUE
11733 #
11734 # If multiple search params are given and `filter_or` is FALSE or not specified,
11735 # search params are combined in a logical AND operation.
11736 # Only rows that match *all* search param criteria will be returned.
11737 #
11738 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
11739 # Results will include rows that match **any** of the search criteria.
11740 #
11741 # String search params use case-insensitive matching.
11742 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
11743 # example="dan%" will match "danger" and "Danzig" but not "David"
11744 # example="D_m%" will match "Damage" and "dump"
11745 #
11746 # Integer search params can accept a single value or a comma separated list of values. The multiple
11747 # values will be combined under a logical OR operation - results will match at least one of
11748 # the given values.
11749 #
11750 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
11751 # or exclude (respectively) rows where the column is null.
11752 #
11753 # Boolean search params accept only "true" and "false" as values.
11754 #
11755 #
11756 # Get a **single theme** by id with [Theme](#!/Theme/theme)
11757 #
11758 # **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.
11759 #
11760 # GET /themes/search -> Sequence[mdls.Theme]
11761 def search_themes(
11762 self,
11763 # Match theme id.
11764 id: Optional[str] = None,
11765 # Match theme name.
11766 name: Optional[str] = None,
11767 # Timestamp for activation.
11768 begin_at: Optional[datetime.datetime] = None,
11769 # Timestamp for expiration.
11770 end_at: Optional[datetime.datetime] = None,
11771 # Number of results to return (used with `offset`).
11772 limit: Optional[int] = None,
11773 # Number of results to skip before returning any (used with `limit`).
11774 offset: Optional[int] = None,
11775 # Fields to sort by.
11776 sorts: Optional[str] = None,
11777 # Requested fields.
11778 fields: Optional[str] = None,
11779 # Combine given search criteria in a boolean OR expression
11780 filter_or: Optional[bool] = None,
11781 transport_options: Optional[transport.TransportOptions] = None,
11782 ) -> Sequence[mdls.Theme]:
11783 """Search Themes"""
11784 response = cast(
11785 Sequence[mdls.Theme],
11786 self.get(
11787 path="/themes/search",
11788 structure=Sequence[mdls.Theme],
11789 query_params={
11790 "id": id,
11791 "name": name,
11792 "begin_at": begin_at,
11793 "end_at": end_at,
11794 "limit": limit,
11795 "offset": offset,
11796 "sorts": sorts,
11797 "fields": fields,
11798 "filter_or": filter_or,
11799 },
11800 transport_options=transport_options,
11801 ),
11802 )
11803 return response
11804
11805 # ### Get the default theme
11806 #
11807 # Returns the active theme object set as the default.
11808 #
11809 # The **default** theme name can be set in the UI on the Admin|Theme UI page
11810 #
11811 # The optional `ts` parameter can specify a different timestamp than "now." If specified, it returns the default theme at the time indicated.
11812 #
11813 # GET /themes/default -> mdls.Theme
11814 def default_theme(
11815 self,
11816 # Timestamp representing the target datetime for the active period. Defaults to 'now'
11817 ts: Optional[datetime.datetime] = None,
11818 transport_options: Optional[transport.TransportOptions] = None,
11819 ) -> mdls.Theme:
11820 """Get Default Theme"""
11821 response = cast(
11822 mdls.Theme,
11823 self.get(
11824 path="/themes/default",
11825 structure=mdls.Theme,
11826 query_params={"ts": ts},
11827 transport_options=transport_options,
11828 ),
11829 )
11830 return response
11831
11832 # ### Set the global default theme by theme name
11833 #
11834 # Only Admin users can call this function.
11835 #
11836 # 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.
11837 #
11838 # [Create Theme](#!/Theme/create) has detailed information on rules for default and active themes
11839 #
11840 # Returns the new specified default theme object.
11841 #
11842 # **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.
11843 #
11844 # PUT /themes/default -> mdls.Theme
11845 def set_default_theme(
11846 self,
11847 # Name of theme to set as default
11848 name: str,
11849 transport_options: Optional[transport.TransportOptions] = None,
11850 ) -> mdls.Theme:
11851 """Set Default Theme"""
11852 response = cast(
11853 mdls.Theme,
11854 self.put(
11855 path="/themes/default",
11856 structure=mdls.Theme,
11857 query_params={"name": name},
11858 transport_options=transport_options,
11859 ),
11860 )
11861 return response
11862
11863 # ### Get active themes
11864 #
11865 # Returns an array of active themes.
11866 #
11867 # If the `name` parameter is specified, it will return an array with one theme if it's active and found.
11868 #
11869 # The optional `ts` parameter can specify a different timestamp than "now."
11870 #
11871 # **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.
11872 #
11873 # GET /themes/active -> Sequence[mdls.Theme]
11874 def active_themes(
11875 self,
11876 # Name of theme
11877 name: Optional[str] = None,
11878 # Timestamp representing the target datetime for the active period. Defaults to 'now'
11879 ts: Optional[datetime.datetime] = None,
11880 # Requested fields.
11881 fields: Optional[str] = None,
11882 transport_options: Optional[transport.TransportOptions] = None,
11883 ) -> Sequence[mdls.Theme]:
11884 """Get Active Themes"""
11885 response = cast(
11886 Sequence[mdls.Theme],
11887 self.get(
11888 path="/themes/active",
11889 structure=Sequence[mdls.Theme],
11890 query_params={"name": name, "ts": ts, "fields": fields},
11891 transport_options=transport_options,
11892 ),
11893 )
11894 return response
11895
11896 # ### Get the named theme if it's active. Otherwise, return the default theme
11897 #
11898 # The optional `ts` parameter can specify a different timestamp than "now."
11899 # Note: API users with `show` ability can call this function
11900 #
11901 # **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.
11902 #
11903 # GET /themes/theme_or_default -> mdls.Theme
11904 def theme_or_default(
11905 self,
11906 # Name of theme
11907 name: str,
11908 # Timestamp representing the target datetime for the active period. Defaults to 'now'
11909 ts: Optional[datetime.datetime] = None,
11910 transport_options: Optional[transport.TransportOptions] = None,
11911 ) -> mdls.Theme:
11912 """Get Theme or Default"""
11913 response = cast(
11914 mdls.Theme,
11915 self.get(
11916 path="/themes/theme_or_default",
11917 structure=mdls.Theme,
11918 query_params={"name": name, "ts": ts},
11919 transport_options=transport_options,
11920 ),
11921 )
11922 return response
11923
11924 # ### Validate a theme with the specified information
11925 #
11926 # Validates all values set for the theme, returning any errors encountered, or 200 OK if valid
11927 #
11928 # See [Create Theme](#!/Theme/create_theme) for constraints
11929 #
11930 # **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.
11931 #
11932 # POST /themes/validate -> mdls.ValidationError
11933 def validate_theme(
11934 self,
11935 body: mdls.WriteTheme,
11936 transport_options: Optional[transport.TransportOptions] = None,
11937 ) -> mdls.ValidationError:
11938 """Validate Theme"""
11939 response = cast(
11940 mdls.ValidationError,
11941 self.post(
11942 path="/themes/validate",
11943 structure=mdls.ValidationError,
11944 body=body,
11945 transport_options=transport_options,
11946 ),
11947 )
11948 return response
11949
11950 # ### Get a theme by ID
11951 #
11952 # Use this to retrieve a specific theme, whether or not it's currently active.
11953 #
11954 # **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.
11955 #
11956 # GET /themes/{theme_id} -> mdls.Theme
11957 def theme(
11958 self,
11959 # Id of theme
11960 theme_id: str,
11961 # Requested fields.
11962 fields: Optional[str] = None,
11963 transport_options: Optional[transport.TransportOptions] = None,
11964 ) -> mdls.Theme:
11965 """Get Theme"""
11966 theme_id = self.encode_path_param(theme_id)
11967 response = cast(
11968 mdls.Theme,
11969 self.get(
11970 path=f"/themes/{theme_id}",
11971 structure=mdls.Theme,
11972 query_params={"fields": fields},
11973 transport_options=transport_options,
11974 ),
11975 )
11976 return response
11977
11978 # ### Update the theme by id.
11979 #
11980 # **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.
11981 #
11982 # PATCH /themes/{theme_id} -> mdls.Theme
11983 def update_theme(
11984 self,
11985 # Id of theme
11986 theme_id: str,
11987 body: mdls.WriteTheme,
11988 transport_options: Optional[transport.TransportOptions] = None,
11989 ) -> mdls.Theme:
11990 """Update Theme"""
11991 theme_id = self.encode_path_param(theme_id)
11992 response = cast(
11993 mdls.Theme,
11994 self.patch(
11995 path=f"/themes/{theme_id}",
11996 structure=mdls.Theme,
11997 body=body,
11998 transport_options=transport_options,
11999 ),
12000 )
12001 return response
12002
12003 # ### Delete a specific theme by id
12004 #
12005 # This operation permanently deletes the identified theme from the database.
12006 #
12007 # Because multiple themes can have the same name (with different activation time spans) themes can only be deleted by ID.
12008 #
12009 # All IDs associated with a theme name can be retrieved by searching for the theme name with [Theme Search](#!/Theme/search).
12010 #
12011 # **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.
12012 #
12013 # DELETE /themes/{theme_id} -> str
12014 def delete_theme(
12015 self,
12016 # Id of theme
12017 theme_id: str,
12018 transport_options: Optional[transport.TransportOptions] = None,
12019 ) -> str:
12020 """Delete Theme"""
12021 theme_id = self.encode_path_param(theme_id)
12022 response = cast(
12023 str,
12024 self.delete(
12025 path=f"/themes/{theme_id}",
12026 structure=str,
12027 transport_options=transport_options,
12028 ),
12029 )
12030 return response
12031
12032 # endregion
12033
12034 # region User: Manage Users
12035
12036 # ### Search email credentials
12037 #
12038 # Returns all credentials_email records that match the given search criteria.
12039 #
12040 # If multiple search params are given and `filter_or` is FALSE or not specified,
12041 # search params are combined in a logical AND operation.
12042 # Only rows that match *all* search param criteria will be returned.
12043 #
12044 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
12045 # Results will include rows that match **any** of the search criteria.
12046 #
12047 # String search params use case-insensitive matching.
12048 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
12049 # example="dan%" will match "danger" and "Danzig" but not "David"
12050 # example="D_m%" will match "Damage" and "dump"
12051 #
12052 # Integer search params can accept a single value or a comma separated list of values. The multiple
12053 # values will be combined under a logical OR operation - results will match at least one of
12054 # the given values.
12055 #
12056 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
12057 # or exclude (respectively) rows where the column is null.
12058 #
12059 # Boolean search params accept only "true" and "false" as values.
12060 #
12061 #
12062 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
12063 #
12064 # GET /credentials_email/search -> Sequence[mdls.CredentialsEmailSearch]
12065 def search_credentials_email(
12066 self,
12067 # Requested fields.
12068 fields: Optional[str] = None,
12069 # Number of results to return (used with `offset`).
12070 limit: Optional[int] = None,
12071 # Number of results to skip before returning any (used with `limit`).
12072 offset: Optional[int] = None,
12073 # Fields to sort by.
12074 sorts: Optional[str] = None,
12075 # Match credentials_email id.
12076 id: Optional[str] = None,
12077 # Match credentials_email email.
12078 email: Optional[str] = None,
12079 # Find credentials_email that match given emails.
12080 emails: Optional[str] = None,
12081 # Combine given search criteria in a boolean OR expression.
12082 filter_or: Optional[bool] = None,
12083 transport_options: Optional[transport.TransportOptions] = None,
12084 ) -> Sequence[mdls.CredentialsEmailSearch]:
12085 """Search CredentialsEmail"""
12086 response = cast(
12087 Sequence[mdls.CredentialsEmailSearch],
12088 self.get(
12089 path="/credentials_email/search",
12090 structure=Sequence[mdls.CredentialsEmailSearch],
12091 query_params={
12092 "fields": fields,
12093 "limit": limit,
12094 "offset": offset,
12095 "sorts": sorts,
12096 "id": id,
12097 "email": email,
12098 "emails": emails,
12099 "filter_or": filter_or,
12100 },
12101 transport_options=transport_options,
12102 ),
12103 )
12104 return response
12105
12106 # ### Get information about the current user; i.e. the user account currently calling the API.
12107 #
12108 # GET /user -> mdls.User
12109 def me(
12110 self,
12111 # Requested fields.
12112 fields: Optional[str] = None,
12113 transport_options: Optional[transport.TransportOptions] = None,
12114 ) -> mdls.User:
12115 """Get Current User"""
12116 response = cast(
12117 mdls.User,
12118 self.get(
12119 path="/user",
12120 structure=mdls.User,
12121 query_params={"fields": fields},
12122 transport_options=transport_options,
12123 ),
12124 )
12125 return response
12126
12127 # ### Get information about all users.
12128 #
12129 # GET /users -> Sequence[mdls.User]
12130 def all_users(
12131 self,
12132 # Requested fields.
12133 fields: Optional[str] = None,
12134 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
12135 page: Optional[int] = None,
12136 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
12137 per_page: Optional[int] = None,
12138 # Number of results to return. (used with offset and takes priority over page and per_page)
12139 limit: Optional[int] = None,
12140 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
12141 offset: Optional[int] = None,
12142 # Fields to sort by.
12143 sorts: Optional[str] = None,
12144 # Optional list of ids to get specific users.
12145 ids: Optional[mdls.DelimSequence[str]] = None,
12146 transport_options: Optional[transport.TransportOptions] = None,
12147 ) -> Sequence[mdls.User]:
12148 """Get All Users"""
12149 response = cast(
12150 Sequence[mdls.User],
12151 self.get(
12152 path="/users",
12153 structure=Sequence[mdls.User],
12154 query_params={
12155 "fields": fields,
12156 "page": page,
12157 "per_page": per_page,
12158 "limit": limit,
12159 "offset": offset,
12160 "sorts": sorts,
12161 "ids": ids,
12162 },
12163 transport_options=transport_options,
12164 ),
12165 )
12166 return response
12167
12168 # ### Create a user with the specified information.
12169 #
12170 # POST /users -> mdls.User
12171 def create_user(
12172 self,
12173 body: Optional[mdls.WriteUser] = None,
12174 # Requested fields.
12175 fields: Optional[str] = None,
12176 transport_options: Optional[transport.TransportOptions] = None,
12177 ) -> mdls.User:
12178 """Create User"""
12179 response = cast(
12180 mdls.User,
12181 self.post(
12182 path="/users",
12183 structure=mdls.User,
12184 query_params={"fields": fields},
12185 body=body,
12186 transport_options=transport_options,
12187 ),
12188 )
12189 return response
12190
12191 # ### Search users
12192 #
12193 # Returns all<sup>*</sup> user records that match the given search criteria.
12194 #
12195 # If multiple search params are given and `filter_or` is FALSE or not specified,
12196 # search params are combined in a logical AND operation.
12197 # Only rows that match *all* search param criteria will be returned.
12198 #
12199 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
12200 # Results will include rows that match **any** of the search criteria.
12201 #
12202 # String search params use case-insensitive matching.
12203 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
12204 # example="dan%" will match "danger" and "Danzig" but not "David"
12205 # example="D_m%" will match "Damage" and "dump"
12206 #
12207 # Integer search params can accept a single value or a comma separated list of values. The multiple
12208 # values will be combined under a logical OR operation - results will match at least one of
12209 # the given values.
12210 #
12211 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
12212 # or exclude (respectively) rows where the column is null.
12213 #
12214 # Boolean search params accept only "true" and "false" as values.
12215 #
12216 #
12217 # (<sup>*</sup>) Results are always filtered to the level of information the caller is permitted to view.
12218 # Looker admins can see all user details; normal users in an open system can see
12219 # names of other users but no details; normal users in a closed system can only see
12220 # names of other users who are members of the same group as the user.
12221 #
12222 # GET /users/search -> Sequence[mdls.User]
12223 def search_users(
12224 self,
12225 # Include only these fields in the response
12226 fields: Optional[str] = None,
12227 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
12228 page: Optional[int] = None,
12229 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
12230 per_page: Optional[int] = None,
12231 # Number of results to return. (used with offset and takes priority over page and per_page)
12232 limit: Optional[int] = None,
12233 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
12234 offset: Optional[int] = None,
12235 # Fields to sort by.
12236 sorts: Optional[str] = None,
12237 # Match User Id.
12238 id: Optional[str] = None,
12239 # Match First name.
12240 first_name: Optional[str] = None,
12241 # Match Last name.
12242 last_name: Optional[str] = None,
12243 # Match Full name (First Last).
12244 full_name: Optional[str] = None,
12245 # Search for user accounts associated with Looker employees. Availability of this filter is limited to users with permission to view complete user details.
12246 verified_looker_employee: Optional[bool] = None,
12247 # Search for only embed users
12248 embed_user: Optional[bool] = None,
12249 # Search for the user with this email address. Availability of this filter is limited to users with permission to view complete user details.
12250 email: Optional[str] = None,
12251 # Search for disabled user accounts. Availability of this filter is limited to users with permission to view complete user details.
12252 is_disabled: Optional[bool] = None,
12253 # Combine given search criteria in a boolean OR expression
12254 filter_or: Optional[bool] = None,
12255 # Search for users who have access to this content_metadata item
12256 content_metadata_id: Optional[str] = None,
12257 # Search for users who are direct members of this group
12258 group_id: Optional[str] = None,
12259 # Search for users who can manage API3 credentials. This field may only be applicable for [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview). Availability of this filter is limited to users with permission to view complete user details. This is an experimental feature and may not yet be available on your instance.
12260 can_manage_api3_creds: Optional[bool] = None,
12261 # Search for service account users. Send true to get only service accounts, or false to get all other types of users. Availability of this filter is limited to users with permission to view complete user details.
12262 is_service_account: Optional[bool] = None,
12263 transport_options: Optional[transport.TransportOptions] = None,
12264 ) -> Sequence[mdls.User]:
12265 """Search Users"""
12266 response = cast(
12267 Sequence[mdls.User],
12268 self.get(
12269 path="/users/search",
12270 structure=Sequence[mdls.User],
12271 query_params={
12272 "fields": fields,
12273 "page": page,
12274 "per_page": per_page,
12275 "limit": limit,
12276 "offset": offset,
12277 "sorts": sorts,
12278 "id": id,
12279 "first_name": first_name,
12280 "last_name": last_name,
12281 "full_name": full_name,
12282 "verified_looker_employee": verified_looker_employee,
12283 "embed_user": embed_user,
12284 "email": email,
12285 "is_disabled": is_disabled,
12286 "filter_or": filter_or,
12287 "content_metadata_id": content_metadata_id,
12288 "group_id": group_id,
12289 "can_manage_api3_creds": can_manage_api3_creds,
12290 "is_service_account": is_service_account,
12291 },
12292 transport_options=transport_options,
12293 ),
12294 )
12295 return response
12296
12297 # ### Search for user accounts by name
12298 #
12299 # Returns all user accounts where `first_name` OR `last_name` OR `email` field values match a pattern.
12300 # The pattern can contain `%` and `_` wildcards as in SQL LIKE expressions.
12301 #
12302 # Any additional search params will be combined into a logical AND expression.
12303 #
12304 # GET /users/search/names/{pattern} -> Sequence[mdls.User]
12305 def search_users_names(
12306 self,
12307 # Pattern to match
12308 pattern: str,
12309 # Include only these fields in the response
12310 fields: Optional[str] = None,
12311 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
12312 page: Optional[int] = None,
12313 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
12314 per_page: Optional[int] = None,
12315 # Number of results to return. (used with offset and takes priority over page and per_page)
12316 limit: Optional[int] = None,
12317 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
12318 offset: Optional[int] = None,
12319 # Fields to sort by
12320 sorts: Optional[str] = None,
12321 # Match User Id
12322 id: Optional[str] = None,
12323 # Match First name
12324 first_name: Optional[str] = None,
12325 # Match Last name
12326 last_name: Optional[str] = None,
12327 # Match Verified Looker employee
12328 verified_looker_employee: Optional[bool] = None,
12329 # Match Email Address
12330 email: Optional[str] = None,
12331 # Include or exclude disabled accounts in the results
12332 is_disabled: Optional[bool] = None,
12333 transport_options: Optional[transport.TransportOptions] = None,
12334 ) -> Sequence[mdls.User]:
12335 """Search User Names"""
12336 pattern = self.encode_path_param(pattern)
12337 response = cast(
12338 Sequence[mdls.User],
12339 self.get(
12340 path=f"/users/search/names/{pattern}",
12341 structure=Sequence[mdls.User],
12342 query_params={
12343 "fields": fields,
12344 "page": page,
12345 "per_page": per_page,
12346 "limit": limit,
12347 "offset": offset,
12348 "sorts": sorts,
12349 "id": id,
12350 "first_name": first_name,
12351 "last_name": last_name,
12352 "verified_looker_employee": verified_looker_employee,
12353 "email": email,
12354 "is_disabled": is_disabled,
12355 },
12356 transport_options=transport_options,
12357 ),
12358 )
12359 return response
12360
12361 # ### Get information about the user with a specific id.
12362 #
12363 # If the caller is an admin or the caller is the user being specified, then full user information will
12364 # be returned. Otherwise, a minimal 'public' variant of the user information will be returned. This contains
12365 # The user name and avatar url, but no sensitive information.
12366 #
12367 # GET /users/{user_id} -> mdls.User
12368 def user(
12369 self,
12370 # Id of user
12371 user_id: str,
12372 # Requested fields.
12373 fields: Optional[str] = None,
12374 transport_options: Optional[transport.TransportOptions] = None,
12375 ) -> mdls.User:
12376 """Get User by Id"""
12377 user_id = self.encode_path_param(user_id)
12378 response = cast(
12379 mdls.User,
12380 self.get(
12381 path=f"/users/{user_id}",
12382 structure=mdls.User,
12383 query_params={"fields": fields},
12384 transport_options=transport_options,
12385 ),
12386 )
12387 return response
12388
12389 # ### Update information about the user with a specific id.
12390 #
12391 # PATCH /users/{user_id} -> mdls.User
12392 def update_user(
12393 self,
12394 # Id of user
12395 user_id: str,
12396 body: mdls.WriteUser,
12397 # Requested fields.
12398 fields: Optional[str] = None,
12399 transport_options: Optional[transport.TransportOptions] = None,
12400 ) -> mdls.User:
12401 """Update User"""
12402 user_id = self.encode_path_param(user_id)
12403 response = cast(
12404 mdls.User,
12405 self.patch(
12406 path=f"/users/{user_id}",
12407 structure=mdls.User,
12408 query_params={"fields": fields},
12409 body=body,
12410 transport_options=transport_options,
12411 ),
12412 )
12413 return response
12414
12415 # ### Delete the user with a specific id.
12416 #
12417 # **This action cannot be undone.** If you want to keep the user's content, we recommend disabling their accounts instead of deleting them.
12418 #
12419 # Deletion will have the following impact:
12420 # * Their reports, Looks and dashboards will be moved to Trash.
12421 # * Any public URLs owned by them will no longer work.
12422 # * Schedules created by the users or that use their content will be deleted.
12423 # * Alerts will continue to run, but will not be visible or editable from the dashboard.
12424 #
12425 # The user cannot delete themselves.
12426 # The last administrator user cannot be deleted.
12427 #
12428 # Deleting Service Accounts via this endpoint is deprecated and can be blocked in future versions.
12429 # Please use the dedicated `delete_service_account` endpoint.
12430 #
12431 # DELETE /users/{user_id} -> str
12432 def delete_user(
12433 self,
12434 # Id of user
12435 user_id: str,
12436 transport_options: Optional[transport.TransportOptions] = None,
12437 ) -> str:
12438 """Delete User"""
12439 user_id = self.encode_path_param(user_id)
12440 response = cast(
12441 str,
12442 self.delete(
12443 path=f"/users/{user_id}",
12444 structure=str,
12445 transport_options=transport_options,
12446 ),
12447 )
12448 return response
12449
12450 # ### Get information about the user with a credential of given type with specific id.
12451 #
12452 # This is used to do things like find users by their embed external_user_id. Or, find the user with
12453 # a given api3 client_id, etc. The 'credential_type' matches the 'type' name of the various credential
12454 # types. It must be one of the values listed in the table below. The 'credential_id' is your unique Id
12455 # for the user and is specific to each type of credential.
12456 #
12457 # An example using the Ruby sdk might look like:
12458 #
12459 # `sdk.user_for_credential('embed', 'customer-4959425')`
12460 #
12461 # This table shows the supported 'Credential Type' strings. The right column is for reference; it shows
12462 # which field in the given credential type is actually searched when finding a user with the supplied
12463 # 'credential_id'.
12464 #
12465 # | Credential Types | Id Field Matched |
12466 # | ---------------- | ---------------- |
12467 # | email | email |
12468 # | google | google_user_id |
12469 # | saml | saml_user_id |
12470 # | oidc | oidc_user_id |
12471 # | ldap | ldap_id |
12472 # | api | token |
12473 # | api3 | client_id |
12474 # | embed | external_user_id |
12475 # | looker_openid | email |
12476 #
12477 # **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'.
12478 #
12479 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
12480 #
12481 # GET /users/credential/{credential_type}/{credential_id} -> mdls.User
12482 def user_for_credential(
12483 self,
12484 # Type name of credential
12485 credential_type: str,
12486 # Id of credential
12487 credential_id: str,
12488 # Requested fields.
12489 fields: Optional[str] = None,
12490 transport_options: Optional[transport.TransportOptions] = None,
12491 ) -> mdls.User:
12492 """Get User by Credential Id"""
12493 credential_type = self.encode_path_param(credential_type)
12494 credential_id = self.encode_path_param(credential_id)
12495 response = cast(
12496 mdls.User,
12497 self.get(
12498 path=f"/users/credential/{credential_type}/{credential_id}",
12499 structure=mdls.User,
12500 query_params={"fields": fields},
12501 transport_options=transport_options,
12502 ),
12503 )
12504 return response
12505
12506 # ### Update information for a specific service account. This action is restricted to Looker admins.
12507 #
12508 # This endpoint is exclusively for updating service accounts. To update a regular user, please use the `PATCH /api/3.x/users/:user_id` endpoint instead.
12509 #
12510 # PATCH /users/service_accounts/{user_id} -> mdls.ServiceAccount
12511 def update_service_account(
12512 self,
12513 # Id of service account
12514 user_id: str,
12515 body: mdls.WriteServiceAccount,
12516 # Requested fields.
12517 fields: Optional[str] = None,
12518 transport_options: Optional[transport.TransportOptions] = None,
12519 ) -> mdls.ServiceAccount:
12520 """Update Service Account"""
12521 user_id = self.encode_path_param(user_id)
12522 response = cast(
12523 mdls.ServiceAccount,
12524 self.patch(
12525 path=f"/users/service_accounts/{user_id}",
12526 structure=mdls.ServiceAccount,
12527 query_params={"fields": fields},
12528 body=body,
12529 transport_options=transport_options,
12530 ),
12531 )
12532 return response
12533
12534 # ### Delete the service account with a specific id.
12535 #
12536 # **This action cannot be undone.** If you want to keep the service account's content, we recommend disabling their accounts instead of deleting them.
12537 #
12538 # Deletion will have the following impact:
12539 # * Their reports, Looks and dashboards will be moved to Trash.
12540 # * Any public URLs owned by them will no longer work.
12541 # * Schedules created by the service account or that use their content will be deleted.
12542 # * Alerts will continue to run, but will not be visible or editable from the dashboard.
12543 #
12544 # The service account cannot delete itself.
12545 #
12546 # DELETE /users/service_accounts/{user_id} -> str
12547 def delete_service_account(
12548 self,
12549 # Id of service account user
12550 user_id: str,
12551 transport_options: Optional[transport.TransportOptions] = None,
12552 ) -> str:
12553 """Delete Service Account"""
12554 user_id = self.encode_path_param(user_id)
12555 response = cast(
12556 str,
12557 self.delete(
12558 path=f"/users/service_accounts/{user_id}",
12559 structure=str,
12560 transport_options=transport_options,
12561 ),
12562 )
12563 return response
12564
12565 # ### Email/password login information for the specified user.
12566 #
12567 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
12568 #
12569 # GET /users/{user_id}/credentials_email -> mdls.CredentialsEmail
12570 def user_credentials_email(
12571 self,
12572 # Id of user
12573 user_id: str,
12574 # Requested fields.
12575 fields: Optional[str] = None,
12576 transport_options: Optional[transport.TransportOptions] = None,
12577 ) -> mdls.CredentialsEmail:
12578 """Get Email/Password Credential"""
12579 user_id = self.encode_path_param(user_id)
12580 response = cast(
12581 mdls.CredentialsEmail,
12582 self.get(
12583 path=f"/users/{user_id}/credentials_email",
12584 structure=mdls.CredentialsEmail,
12585 query_params={"fields": fields},
12586 transport_options=transport_options,
12587 ),
12588 )
12589 return response
12590
12591 # ### Email/password login information for the specified user.
12592 #
12593 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
12594 #
12595 # POST /users/{user_id}/credentials_email -> mdls.CredentialsEmail
12596 def create_user_credentials_email(
12597 self,
12598 # Id of user
12599 user_id: str,
12600 body: mdls.WriteCredentialsEmail,
12601 # Requested fields.
12602 fields: Optional[str] = None,
12603 transport_options: Optional[transport.TransportOptions] = None,
12604 ) -> mdls.CredentialsEmail:
12605 """Create Email/Password Credential"""
12606 user_id = self.encode_path_param(user_id)
12607 response = cast(
12608 mdls.CredentialsEmail,
12609 self.post(
12610 path=f"/users/{user_id}/credentials_email",
12611 structure=mdls.CredentialsEmail,
12612 query_params={"fields": fields},
12613 body=body,
12614 transport_options=transport_options,
12615 ),
12616 )
12617 return response
12618
12619 # ### Email/password login information for the specified user.
12620 #
12621 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
12622 #
12623 # PATCH /users/{user_id}/credentials_email -> mdls.CredentialsEmail
12624 def update_user_credentials_email(
12625 self,
12626 # Id of user
12627 user_id: str,
12628 body: mdls.WriteCredentialsEmail,
12629 # Requested fields.
12630 fields: Optional[str] = None,
12631 transport_options: Optional[transport.TransportOptions] = None,
12632 ) -> mdls.CredentialsEmail:
12633 """Update Email/Password Credential"""
12634 user_id = self.encode_path_param(user_id)
12635 response = cast(
12636 mdls.CredentialsEmail,
12637 self.patch(
12638 path=f"/users/{user_id}/credentials_email",
12639 structure=mdls.CredentialsEmail,
12640 query_params={"fields": fields},
12641 body=body,
12642 transport_options=transport_options,
12643 ),
12644 )
12645 return response
12646
12647 # ### Email/password login information for the specified user.
12648 #
12649 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
12650 #
12651 # DELETE /users/{user_id}/credentials_email -> str
12652 def delete_user_credentials_email(
12653 self,
12654 # Id of user
12655 user_id: str,
12656 transport_options: Optional[transport.TransportOptions] = None,
12657 ) -> str:
12658 """Delete Email/Password Credential"""
12659 user_id = self.encode_path_param(user_id)
12660 response = cast(
12661 str,
12662 self.delete(
12663 path=f"/users/{user_id}/credentials_email",
12664 structure=str,
12665 transport_options=transport_options,
12666 ),
12667 )
12668 return response
12669
12670 # ### Two-factor login information for the specified user.
12671 #
12672 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
12673 #
12674 # GET /users/{user_id}/credentials_totp -> mdls.CredentialsTotp
12675 def user_credentials_totp(
12676 self,
12677 # Id of user
12678 user_id: str,
12679 # Requested fields.
12680 fields: Optional[str] = None,
12681 transport_options: Optional[transport.TransportOptions] = None,
12682 ) -> mdls.CredentialsTotp:
12683 """Get Two-Factor Credential"""
12684 user_id = self.encode_path_param(user_id)
12685 response = cast(
12686 mdls.CredentialsTotp,
12687 self.get(
12688 path=f"/users/{user_id}/credentials_totp",
12689 structure=mdls.CredentialsTotp,
12690 query_params={"fields": fields},
12691 transport_options=transport_options,
12692 ),
12693 )
12694 return response
12695
12696 # ### Two-factor login information for the specified user.
12697 #
12698 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
12699 #
12700 # POST /users/{user_id}/credentials_totp -> mdls.CredentialsTotp
12701 def create_user_credentials_totp(
12702 self,
12703 # Id of user
12704 user_id: str,
12705 # WARNING: no writeable properties found for POST, PUT, or PATCH
12706 body: Optional[mdls.CredentialsTotp] = None,
12707 # Requested fields.
12708 fields: Optional[str] = None,
12709 transport_options: Optional[transport.TransportOptions] = None,
12710 ) -> mdls.CredentialsTotp:
12711 """Create Two-Factor Credential"""
12712 user_id = self.encode_path_param(user_id)
12713 response = cast(
12714 mdls.CredentialsTotp,
12715 self.post(
12716 path=f"/users/{user_id}/credentials_totp",
12717 structure=mdls.CredentialsTotp,
12718 query_params={"fields": fields},
12719 body=body,
12720 transport_options=transport_options,
12721 ),
12722 )
12723 return response
12724
12725 # ### Two-factor login information for the specified user.
12726 #
12727 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
12728 #
12729 # DELETE /users/{user_id}/credentials_totp -> str
12730 def delete_user_credentials_totp(
12731 self,
12732 # Id of user
12733 user_id: str,
12734 transport_options: Optional[transport.TransportOptions] = None,
12735 ) -> str:
12736 """Delete Two-Factor Credential"""
12737 user_id = self.encode_path_param(user_id)
12738 response = cast(
12739 str,
12740 self.delete(
12741 path=f"/users/{user_id}/credentials_totp",
12742 structure=str,
12743 transport_options=transport_options,
12744 ),
12745 )
12746 return response
12747
12748 # ### LDAP login information for the specified user.
12749 #
12750 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
12751 #
12752 # GET /users/{user_id}/credentials_ldap -> mdls.CredentialsLDAP
12753 def user_credentials_ldap(
12754 self,
12755 # Id of user
12756 user_id: str,
12757 # Requested fields.
12758 fields: Optional[str] = None,
12759 transport_options: Optional[transport.TransportOptions] = None,
12760 ) -> mdls.CredentialsLDAP:
12761 """Get LDAP Credential"""
12762 user_id = self.encode_path_param(user_id)
12763 response = cast(
12764 mdls.CredentialsLDAP,
12765 self.get(
12766 path=f"/users/{user_id}/credentials_ldap",
12767 structure=mdls.CredentialsLDAP,
12768 query_params={"fields": fields},
12769 transport_options=transport_options,
12770 ),
12771 )
12772 return response
12773
12774 # ### LDAP login information for the specified user.
12775 #
12776 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
12777 #
12778 # DELETE /users/{user_id}/credentials_ldap -> str
12779 def delete_user_credentials_ldap(
12780 self,
12781 # Id of user
12782 user_id: str,
12783 transport_options: Optional[transport.TransportOptions] = None,
12784 ) -> str:
12785 """Delete LDAP Credential"""
12786 user_id = self.encode_path_param(user_id)
12787 response = cast(
12788 str,
12789 self.delete(
12790 path=f"/users/{user_id}/credentials_ldap",
12791 structure=str,
12792 transport_options=transport_options,
12793 ),
12794 )
12795 return response
12796
12797 # ### Google authentication login information for the specified user.
12798 #
12799 # GET /users/{user_id}/credentials_google -> mdls.CredentialsGoogle
12800 def user_credentials_google(
12801 self,
12802 # Id of user
12803 user_id: str,
12804 # Requested fields.
12805 fields: Optional[str] = None,
12806 transport_options: Optional[transport.TransportOptions] = None,
12807 ) -> mdls.CredentialsGoogle:
12808 """Get Google Auth Credential"""
12809 user_id = self.encode_path_param(user_id)
12810 response = cast(
12811 mdls.CredentialsGoogle,
12812 self.get(
12813 path=f"/users/{user_id}/credentials_google",
12814 structure=mdls.CredentialsGoogle,
12815 query_params={"fields": fields},
12816 transport_options=transport_options,
12817 ),
12818 )
12819 return response
12820
12821 # ### Google authentication login information for the specified user.
12822 #
12823 # DELETE /users/{user_id}/credentials_google -> str
12824 def delete_user_credentials_google(
12825 self,
12826 # Id of user
12827 user_id: str,
12828 transport_options: Optional[transport.TransportOptions] = None,
12829 ) -> str:
12830 """Delete Google Auth Credential"""
12831 user_id = self.encode_path_param(user_id)
12832 response = cast(
12833 str,
12834 self.delete(
12835 path=f"/users/{user_id}/credentials_google",
12836 structure=str,
12837 transport_options=transport_options,
12838 ),
12839 )
12840 return response
12841
12842 # ### Saml authentication login information for the specified user.
12843 #
12844 # GET /users/{user_id}/credentials_saml -> mdls.CredentialsSaml
12845 def user_credentials_saml(
12846 self,
12847 # Id of user
12848 user_id: str,
12849 # Requested fields.
12850 fields: Optional[str] = None,
12851 transport_options: Optional[transport.TransportOptions] = None,
12852 ) -> mdls.CredentialsSaml:
12853 """Get Saml Auth Credential"""
12854 user_id = self.encode_path_param(user_id)
12855 response = cast(
12856 mdls.CredentialsSaml,
12857 self.get(
12858 path=f"/users/{user_id}/credentials_saml",
12859 structure=mdls.CredentialsSaml,
12860 query_params={"fields": fields},
12861 transport_options=transport_options,
12862 ),
12863 )
12864 return response
12865
12866 # ### Saml authentication login information for the specified user.
12867 #
12868 # DELETE /users/{user_id}/credentials_saml -> str
12869 def delete_user_credentials_saml(
12870 self,
12871 # Id of user
12872 user_id: str,
12873 transport_options: Optional[transport.TransportOptions] = None,
12874 ) -> str:
12875 """Delete Saml Auth Credential"""
12876 user_id = self.encode_path_param(user_id)
12877 response = cast(
12878 str,
12879 self.delete(
12880 path=f"/users/{user_id}/credentials_saml",
12881 structure=str,
12882 transport_options=transport_options,
12883 ),
12884 )
12885 return response
12886
12887 # ### OpenID Connect (OIDC) authentication login information for the specified user.
12888 #
12889 # GET /users/{user_id}/credentials_oidc -> mdls.CredentialsOIDC
12890 def user_credentials_oidc(
12891 self,
12892 # Id of user
12893 user_id: str,
12894 # Requested fields.
12895 fields: Optional[str] = None,
12896 transport_options: Optional[transport.TransportOptions] = None,
12897 ) -> mdls.CredentialsOIDC:
12898 """Get OIDC Auth Credential"""
12899 user_id = self.encode_path_param(user_id)
12900 response = cast(
12901 mdls.CredentialsOIDC,
12902 self.get(
12903 path=f"/users/{user_id}/credentials_oidc",
12904 structure=mdls.CredentialsOIDC,
12905 query_params={"fields": fields},
12906 transport_options=transport_options,
12907 ),
12908 )
12909 return response
12910
12911 # ### OpenID Connect (OIDC) authentication login information for the specified user.
12912 #
12913 # DELETE /users/{user_id}/credentials_oidc -> str
12914 def delete_user_credentials_oidc(
12915 self,
12916 # Id of user
12917 user_id: str,
12918 transport_options: Optional[transport.TransportOptions] = None,
12919 ) -> str:
12920 """Delete OIDC Auth Credential"""
12921 user_id = self.encode_path_param(user_id)
12922 response = cast(
12923 str,
12924 self.delete(
12925 path=f"/users/{user_id}/credentials_oidc",
12926 structure=str,
12927 transport_options=transport_options,
12928 ),
12929 )
12930 return response
12931
12932 # ### API login information for the specified user. This is for the newer API keys that can be added for any user.
12933 #
12934 # GET /users/{user_id}/credentials_api3/{credentials_api3_id} -> mdls.CredentialsApi3
12935 def user_credentials_api3(
12936 self,
12937 # Id of user
12938 user_id: str,
12939 # Id of API Credential
12940 credentials_api3_id: str,
12941 # Requested fields.
12942 fields: Optional[str] = None,
12943 transport_options: Optional[transport.TransportOptions] = None,
12944 ) -> mdls.CredentialsApi3:
12945 """Get API Credential"""
12946 user_id = self.encode_path_param(user_id)
12947 credentials_api3_id = self.encode_path_param(credentials_api3_id)
12948 response = cast(
12949 mdls.CredentialsApi3,
12950 self.get(
12951 path=f"/users/{user_id}/credentials_api3/{credentials_api3_id}",
12952 structure=mdls.CredentialsApi3,
12953 query_params={"fields": fields},
12954 transport_options=transport_options,
12955 ),
12956 )
12957 return response
12958
12959 # ### API login information for the specified user. This is for the newer API keys that can be added for any user.
12960 #
12961 # PATCH /users/{user_id}/credentials_api3/{credentials_api3_id} -> mdls.CredentialsApi3
12962 def update_user_credentials_api3(
12963 self,
12964 # Id of user
12965 user_id: str,
12966 # Id of API Credential
12967 credentials_api3_id: str,
12968 body: mdls.WriteCredentialsApi3,
12969 # Requested fields.
12970 fields: Optional[str] = None,
12971 transport_options: Optional[transport.TransportOptions] = None,
12972 ) -> mdls.CredentialsApi3:
12973 """Update API Credential"""
12974 user_id = self.encode_path_param(user_id)
12975 credentials_api3_id = self.encode_path_param(credentials_api3_id)
12976 response = cast(
12977 mdls.CredentialsApi3,
12978 self.patch(
12979 path=f"/users/{user_id}/credentials_api3/{credentials_api3_id}",
12980 structure=mdls.CredentialsApi3,
12981 query_params={"fields": fields},
12982 body=body,
12983 transport_options=transport_options,
12984 ),
12985 )
12986 return response
12987
12988 # ### API login information for the specified user. This is for the newer API keys that can be added for any user.
12989 #
12990 # DELETE /users/{user_id}/credentials_api3/{credentials_api3_id} -> str
12991 def delete_user_credentials_api3(
12992 self,
12993 # Id of user
12994 user_id: str,
12995 # Id of API Credential
12996 credentials_api3_id: str,
12997 transport_options: Optional[transport.TransportOptions] = None,
12998 ) -> str:
12999 """Delete API Credential"""
13000 user_id = self.encode_path_param(user_id)
13001 credentials_api3_id = self.encode_path_param(credentials_api3_id)
13002 response = cast(
13003 str,
13004 self.delete(
13005 path=f"/users/{user_id}/credentials_api3/{credentials_api3_id}",
13006 structure=str,
13007 transport_options=transport_options,
13008 ),
13009 )
13010 return response
13011
13012 # ### API login information for the specified user. This is for the newer API keys that can be added for any user.
13013 #
13014 # GET /users/{user_id}/credentials_api3 -> Sequence[mdls.CredentialsApi3]
13015 def all_user_credentials_api3s(
13016 self,
13017 # Id of user
13018 user_id: str,
13019 # Requested fields.
13020 fields: Optional[str] = None,
13021 transport_options: Optional[transport.TransportOptions] = None,
13022 ) -> Sequence[mdls.CredentialsApi3]:
13023 """Get All API Credentials"""
13024 user_id = self.encode_path_param(user_id)
13025 response = cast(
13026 Sequence[mdls.CredentialsApi3],
13027 self.get(
13028 path=f"/users/{user_id}/credentials_api3",
13029 structure=Sequence[mdls.CredentialsApi3],
13030 query_params={"fields": fields},
13031 transport_options=transport_options,
13032 ),
13033 )
13034 return response
13035
13036 # ### API login information for the specified user. This is for the newer API keys that can be added for any user.
13037 #
13038 # POST /users/{user_id}/credentials_api3 -> mdls.CreateCredentialsApi3
13039 def create_user_credentials_api3(
13040 self,
13041 # Id of user
13042 user_id: str,
13043 # Requested fields.
13044 fields: Optional[str] = None,
13045 transport_options: Optional[transport.TransportOptions] = None,
13046 ) -> mdls.CreateCredentialsApi3:
13047 """Create API Credential"""
13048 user_id = self.encode_path_param(user_id)
13049 response = cast(
13050 mdls.CreateCredentialsApi3,
13051 self.post(
13052 path=f"/users/{user_id}/credentials_api3",
13053 structure=mdls.CreateCredentialsApi3,
13054 query_params={"fields": fields},
13055 transport_options=transport_options,
13056 ),
13057 )
13058 return response
13059
13060 # ### Embed login information for the specified user.
13061 #
13062 # **NOTE**: Calls to this endpoint require [Embedding](https://docs.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.
13063 #
13064 # GET /users/{user_id}/credentials_embed/{credentials_embed_id} -> mdls.CredentialsEmbed
13065 def user_credentials_embed(
13066 self,
13067 # Id of user
13068 user_id: str,
13069 # Id of Embedding Credential
13070 credentials_embed_id: str,
13071 # Requested fields.
13072 fields: Optional[str] = None,
13073 transport_options: Optional[transport.TransportOptions] = None,
13074 ) -> mdls.CredentialsEmbed:
13075 """Get Embedding Credential"""
13076 user_id = self.encode_path_param(user_id)
13077 credentials_embed_id = self.encode_path_param(credentials_embed_id)
13078 response = cast(
13079 mdls.CredentialsEmbed,
13080 self.get(
13081 path=f"/users/{user_id}/credentials_embed/{credentials_embed_id}",
13082 structure=mdls.CredentialsEmbed,
13083 query_params={"fields": fields},
13084 transport_options=transport_options,
13085 ),
13086 )
13087 return response
13088
13089 # ### Embed login information for the specified user.
13090 #
13091 # **NOTE**: Calls to this endpoint require [Embedding](https://docs.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.
13092 #
13093 # DELETE /users/{user_id}/credentials_embed/{credentials_embed_id} -> str
13094 def delete_user_credentials_embed(
13095 self,
13096 # Id of user
13097 user_id: str,
13098 # Id of Embedding Credential
13099 credentials_embed_id: str,
13100 transport_options: Optional[transport.TransportOptions] = None,
13101 ) -> str:
13102 """Delete Embedding Credential"""
13103 user_id = self.encode_path_param(user_id)
13104 credentials_embed_id = self.encode_path_param(credentials_embed_id)
13105 response = cast(
13106 str,
13107 self.delete(
13108 path=f"/users/{user_id}/credentials_embed/{credentials_embed_id}",
13109 structure=str,
13110 transport_options=transport_options,
13111 ),
13112 )
13113 return response
13114
13115 # ### Embed login information for the specified user.
13116 #
13117 # **NOTE**: Calls to this endpoint require [Embedding](https://docs.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.
13118 #
13119 # GET /users/{user_id}/credentials_embed -> Sequence[mdls.CredentialsEmbed]
13120 def all_user_credentials_embeds(
13121 self,
13122 # Id of user
13123 user_id: str,
13124 # Requested fields.
13125 fields: Optional[str] = None,
13126 transport_options: Optional[transport.TransportOptions] = None,
13127 ) -> Sequence[mdls.CredentialsEmbed]:
13128 """Get All Embedding Credentials"""
13129 user_id = self.encode_path_param(user_id)
13130 response = cast(
13131 Sequence[mdls.CredentialsEmbed],
13132 self.get(
13133 path=f"/users/{user_id}/credentials_embed",
13134 structure=Sequence[mdls.CredentialsEmbed],
13135 query_params={"fields": fields},
13136 transport_options=transport_options,
13137 ),
13138 )
13139 return response
13140
13141 # ### Looker Openid login information for the specified user. Used by Looker Analysts.
13142 #
13143 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
13144 #
13145 # GET /users/{user_id}/credentials_looker_openid -> mdls.CredentialsLookerOpenid
13146 def user_credentials_looker_openid(
13147 self,
13148 # Id of user
13149 user_id: str,
13150 # Requested fields.
13151 fields: Optional[str] = None,
13152 transport_options: Optional[transport.TransportOptions] = None,
13153 ) -> mdls.CredentialsLookerOpenid:
13154 """Get Looker OpenId Credential"""
13155 user_id = self.encode_path_param(user_id)
13156 response = cast(
13157 mdls.CredentialsLookerOpenid,
13158 self.get(
13159 path=f"/users/{user_id}/credentials_looker_openid",
13160 structure=mdls.CredentialsLookerOpenid,
13161 query_params={"fields": fields},
13162 transport_options=transport_options,
13163 ),
13164 )
13165 return response
13166
13167 # ### Looker Openid login information for the specified user. Used by Looker Analysts.
13168 #
13169 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
13170 #
13171 # DELETE /users/{user_id}/credentials_looker_openid -> str
13172 def delete_user_credentials_looker_openid(
13173 self,
13174 # Id of user
13175 user_id: str,
13176 transport_options: Optional[transport.TransportOptions] = None,
13177 ) -> str:
13178 """Delete Looker OpenId Credential"""
13179 user_id = self.encode_path_param(user_id)
13180 response = cast(
13181 str,
13182 self.delete(
13183 path=f"/users/{user_id}/credentials_looker_openid",
13184 structure=str,
13185 transport_options=transport_options,
13186 ),
13187 )
13188 return response
13189
13190 # ### Web login session for the specified user.
13191 #
13192 # GET /users/{user_id}/sessions/{session_id} -> mdls.Session
13193 def user_session(
13194 self,
13195 # Id of user
13196 user_id: str,
13197 # Id of Web Login Session
13198 session_id: str,
13199 # Requested fields.
13200 fields: Optional[str] = None,
13201 transport_options: Optional[transport.TransportOptions] = None,
13202 ) -> mdls.Session:
13203 """Get Web Login Session"""
13204 user_id = self.encode_path_param(user_id)
13205 session_id = self.encode_path_param(session_id)
13206 response = cast(
13207 mdls.Session,
13208 self.get(
13209 path=f"/users/{user_id}/sessions/{session_id}",
13210 structure=mdls.Session,
13211 query_params={"fields": fields},
13212 transport_options=transport_options,
13213 ),
13214 )
13215 return response
13216
13217 # ### Web login session for the specified user.
13218 #
13219 # DELETE /users/{user_id}/sessions/{session_id} -> str
13220 def delete_user_session(
13221 self,
13222 # Id of user
13223 user_id: str,
13224 # Id of Web Login Session
13225 session_id: str,
13226 transport_options: Optional[transport.TransportOptions] = None,
13227 ) -> str:
13228 """Delete Web Login Session"""
13229 user_id = self.encode_path_param(user_id)
13230 session_id = self.encode_path_param(session_id)
13231 response = cast(
13232 str,
13233 self.delete(
13234 path=f"/users/{user_id}/sessions/{session_id}",
13235 structure=str,
13236 transport_options=transport_options,
13237 ),
13238 )
13239 return response
13240
13241 # ### Web login session for the specified user.
13242 #
13243 # GET /users/{user_id}/sessions -> Sequence[mdls.Session]
13244 def all_user_sessions(
13245 self,
13246 # Id of user
13247 user_id: str,
13248 # Requested fields.
13249 fields: Optional[str] = None,
13250 transport_options: Optional[transport.TransportOptions] = None,
13251 ) -> Sequence[mdls.Session]:
13252 """Get All Web Login Sessions"""
13253 user_id = self.encode_path_param(user_id)
13254 response = cast(
13255 Sequence[mdls.Session],
13256 self.get(
13257 path=f"/users/{user_id}/sessions",
13258 structure=Sequence[mdls.Session],
13259 query_params={"fields": fields},
13260 transport_options=transport_options,
13261 ),
13262 )
13263 return response
13264
13265 # ### Create a password reset token.
13266 # This will create a cryptographically secure random password reset token for the user.
13267 # If the user already has a password reset token then this invalidates the old token and creates a new one.
13268 # The token is expressed as the 'password_reset_url' of the user's email/password credential object.
13269 # This takes an optional 'expires' param to indicate if the new token should be an expiring token.
13270 # Tokens that expire are typically used for self-service password resets for existing users.
13271 # Invitation emails for new users typically are not set to expire.
13272 # The expire period is always 60 minutes when expires is enabled.
13273 # This method can be called with an empty body.
13274 #
13275 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
13276 #
13277 # POST /users/{user_id}/credentials_email/password_reset -> mdls.CredentialsEmail
13278 def create_user_credentials_email_password_reset(
13279 self,
13280 # Id of user
13281 user_id: str,
13282 # Expiring token.
13283 expires: Optional[bool] = None,
13284 # Requested fields.
13285 fields: Optional[str] = None,
13286 transport_options: Optional[transport.TransportOptions] = None,
13287 ) -> mdls.CredentialsEmail:
13288 """Create Password Reset Token"""
13289 user_id = self.encode_path_param(user_id)
13290 response = cast(
13291 mdls.CredentialsEmail,
13292 self.post(
13293 path=f"/users/{user_id}/credentials_email/password_reset",
13294 structure=mdls.CredentialsEmail,
13295 query_params={"expires": expires, "fields": fields},
13296 transport_options=transport_options,
13297 ),
13298 )
13299 return response
13300
13301 # ### Get information about roles of a given user
13302 #
13303 # GET /users/{user_id}/roles -> Sequence[mdls.Role]
13304 def user_roles(
13305 self,
13306 # Id of user
13307 user_id: str,
13308 # Requested fields.
13309 fields: Optional[str] = None,
13310 # Get only roles associated directly with the user: exclude those only associated through groups.
13311 direct_association_only: Optional[bool] = None,
13312 transport_options: Optional[transport.TransportOptions] = None,
13313 ) -> Sequence[mdls.Role]:
13314 """Get User Roles"""
13315 user_id = self.encode_path_param(user_id)
13316 response = cast(
13317 Sequence[mdls.Role],
13318 self.get(
13319 path=f"/users/{user_id}/roles",
13320 structure=Sequence[mdls.Role],
13321 query_params={
13322 "fields": fields,
13323 "direct_association_only": direct_association_only,
13324 },
13325 transport_options=transport_options,
13326 ),
13327 )
13328 return response
13329
13330 # ### Set roles of the user with a specific id.
13331 #
13332 # PUT /users/{user_id}/roles -> Sequence[mdls.Role]
13333 def set_user_roles(
13334 self,
13335 # Id of user
13336 user_id: str,
13337 body: Sequence[str],
13338 # Requested fields.
13339 fields: Optional[str] = None,
13340 transport_options: Optional[transport.TransportOptions] = None,
13341 ) -> Sequence[mdls.Role]:
13342 """Set User Roles"""
13343 user_id = self.encode_path_param(user_id)
13344 response = cast(
13345 Sequence[mdls.Role],
13346 self.put(
13347 path=f"/users/{user_id}/roles",
13348 structure=Sequence[mdls.Role],
13349 query_params={"fields": fields},
13350 body=body,
13351 transport_options=transport_options,
13352 ),
13353 )
13354 return response
13355
13356 # ### Get user attribute values for a given user.
13357 #
13358 # Returns the values of specified user attributes (or all user attributes) for a certain user.
13359 #
13360 # A value for each user attribute is searched for in the following locations, in this order:
13361 #
13362 # 1. in the user's account information
13363 # 1. in groups that the user is a member of
13364 # 1. the default value of the user attribute
13365 #
13366 # If more than one group has a value defined for a user attribute, the group with the lowest rank wins.
13367 #
13368 # The response will only include user attributes for which values were found. Use `include_unset=true` to include
13369 # empty records for user attributes with no value.
13370 #
13371 # The value of all hidden user attributes will be blank.
13372 #
13373 # GET /users/{user_id}/attribute_values -> Sequence[mdls.UserAttributeWithValue]
13374 def user_attribute_user_values(
13375 self,
13376 # Id of user
13377 user_id: str,
13378 # Requested fields.
13379 fields: Optional[str] = None,
13380 # Specific user attributes to request. Omit or leave blank to request all user attributes.
13381 user_attribute_ids: Optional[mdls.DelimSequence[str]] = None,
13382 # If true, returns all values in the search path instead of just the first value found. Useful for debugging group precedence.
13383 all_values: Optional[bool] = None,
13384 # If true, returns an empty record for each requested attribute that has no user, group, or default value.
13385 include_unset: Optional[bool] = None,
13386 transport_options: Optional[transport.TransportOptions] = None,
13387 ) -> Sequence[mdls.UserAttributeWithValue]:
13388 """Get User Attribute Values"""
13389 user_id = self.encode_path_param(user_id)
13390 response = cast(
13391 Sequence[mdls.UserAttributeWithValue],
13392 self.get(
13393 path=f"/users/{user_id}/attribute_values",
13394 structure=Sequence[mdls.UserAttributeWithValue],
13395 query_params={
13396 "fields": fields,
13397 "user_attribute_ids": user_attribute_ids,
13398 "all_values": all_values,
13399 "include_unset": include_unset,
13400 },
13401 transport_options=transport_options,
13402 ),
13403 )
13404 return response
13405
13406 # ### Store a custom value for a user attribute in a user's account settings.
13407 #
13408 # Per-user user attribute values take precedence over group or default values.
13409 #
13410 # PATCH /users/{user_id}/attribute_values/{user_attribute_id} -> mdls.UserAttributeWithValue
13411 def set_user_attribute_user_value(
13412 self,
13413 # Id of user
13414 user_id: str,
13415 # Id of user attribute
13416 user_attribute_id: str,
13417 body: mdls.WriteUserAttributeWithValue,
13418 transport_options: Optional[transport.TransportOptions] = None,
13419 ) -> mdls.UserAttributeWithValue:
13420 """Set User Attribute User Value"""
13421 user_id = self.encode_path_param(user_id)
13422 user_attribute_id = self.encode_path_param(user_attribute_id)
13423 response = cast(
13424 mdls.UserAttributeWithValue,
13425 self.patch(
13426 path=f"/users/{user_id}/attribute_values/{user_attribute_id}",
13427 structure=mdls.UserAttributeWithValue,
13428 body=body,
13429 transport_options=transport_options,
13430 ),
13431 )
13432 return response
13433
13434 # ### Delete a user attribute value from a user's account settings.
13435 #
13436 # After the user attribute value is deleted from the user's account settings, subsequent requests
13437 # for the user attribute value for this user will draw from the user's groups or the default
13438 # value of the user attribute. See [Get User Attribute Values](#!/User/user_attribute_user_values) for more
13439 # information about how user attribute values are resolved.
13440 #
13441 # DELETE /users/{user_id}/attribute_values/{user_attribute_id} -> None
13442 def delete_user_attribute_user_value(
13443 self,
13444 # Id of user
13445 user_id: str,
13446 # Id of user attribute
13447 user_attribute_id: str,
13448 transport_options: Optional[transport.TransportOptions] = None,
13449 ) -> None:
13450 """Delete User Attribute User Value"""
13451 user_id = self.encode_path_param(user_id)
13452 user_attribute_id = self.encode_path_param(user_attribute_id)
13453 response = cast(
13454 None,
13455 self.delete(
13456 path=f"/users/{user_id}/attribute_values/{user_attribute_id}",
13457 structure=None,
13458 transport_options=transport_options,
13459 ),
13460 )
13461 return response
13462
13463 # ### Send a password reset token.
13464 # This will send a password reset email to the user. If a password reset token does not already exist
13465 # for this user, it will create one and then send it.
13466 # If the user has not yet set up their account, it will send a setup email to the user.
13467 # The URL sent in the email is expressed as the 'password_reset_url' of the user's email/password credential object.
13468 # Password reset URLs will expire in 60 minutes.
13469 # This method can be called with an empty body.
13470 #
13471 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
13472 #
13473 # POST /users/{user_id}/credentials_email/send_password_reset -> mdls.CredentialsEmail
13474 def send_user_credentials_email_password_reset(
13475 self,
13476 # Id of user
13477 user_id: str,
13478 # Requested fields.
13479 fields: Optional[str] = None,
13480 transport_options: Optional[transport.TransportOptions] = None,
13481 ) -> mdls.CredentialsEmail:
13482 """Send Password Reset Token"""
13483 user_id = self.encode_path_param(user_id)
13484 response = cast(
13485 mdls.CredentialsEmail,
13486 self.post(
13487 path=f"/users/{user_id}/credentials_email/send_password_reset",
13488 structure=mdls.CredentialsEmail,
13489 query_params={"fields": fields},
13490 transport_options=transport_options,
13491 ),
13492 )
13493 return response
13494
13495 # ### Change a disabled user's email addresses
13496 #
13497 # Allows the admin to change the email addresses for all the user's
13498 # associated credentials. Will overwrite all associated email addresses with
13499 # the value supplied in the 'email' body param.
13500 # The user's 'is_disabled' status must be true.
13501 # If the user has a credential email, they will receive a verification email and the user will be disabled until they verify the email
13502 #
13503 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://docs.cloud.google.com/looker/docs/r/looker-core/overview).
13504 #
13505 # POST /users/{user_id}/update_emails -> mdls.User
13506 def wipeout_user_emails(
13507 self,
13508 # Id of user
13509 user_id: str,
13510 body: mdls.UserEmailOnly,
13511 # Requested fields.
13512 fields: Optional[str] = None,
13513 transport_options: Optional[transport.TransportOptions] = None,
13514 ) -> mdls.User:
13515 """Wipeout User Emails"""
13516 user_id = self.encode_path_param(user_id)
13517 response = cast(
13518 mdls.User,
13519 self.post(
13520 path=f"/users/{user_id}/update_emails",
13521 structure=mdls.User,
13522 query_params={"fields": fields},
13523 body=body,
13524 transport_options=transport_options,
13525 ),
13526 )
13527 return response
13528
13529 # Create an embed user from an external user ID
13530 #
13531 # **NOTE**: Calls to this endpoint require [Embedding](https://docs.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.
13532 #
13533 # POST /users/embed_user -> mdls.UserPublic
13534 def create_embed_user(
13535 self,
13536 body: mdls.CreateEmbedUserRequest,
13537 transport_options: Optional[transport.TransportOptions] = None,
13538 ) -> mdls.UserPublic:
13539 """Create an embed user from an external user ID"""
13540 response = cast(
13541 mdls.UserPublic,
13542 self.post(
13543 path="/users/embed_user",
13544 structure=mdls.UserPublic,
13545 body=body,
13546 transport_options=transport_options,
13547 ),
13548 )
13549 return response
13550
13551 # ### Create a service account with the specified information. This action is restricted to Looker admins.
13552 #
13553 # POST /users/service_accounts -> mdls.ServiceAccount
13554 def create_service_account(
13555 self,
13556 body: mdls.WriteServiceAccount,
13557 # Requested fields.
13558 fields: Optional[str] = None,
13559 transport_options: Optional[transport.TransportOptions] = None,
13560 ) -> mdls.ServiceAccount:
13561 """Create Service Account"""
13562 response = cast(
13563 mdls.ServiceAccount,
13564 self.post(
13565 path="/users/service_accounts",
13566 structure=mdls.ServiceAccount,
13567 query_params={"fields": fields},
13568 body=body,
13569 transport_options=transport_options,
13570 ),
13571 )
13572 return response
13573
13574 # endregion
13575
13576 # region UserAttribute: Manage User Attributes
13577
13578 # ### Get information about all user attributes.
13579 #
13580 # GET /user_attributes -> Sequence[mdls.UserAttribute]
13581 def all_user_attributes(
13582 self,
13583 # Requested fields.
13584 fields: Optional[str] = None,
13585 # Fields to order the results by. Sortable fields include: name, label
13586 sorts: Optional[str] = None,
13587 transport_options: Optional[transport.TransportOptions] = None,
13588 ) -> Sequence[mdls.UserAttribute]:
13589 """Get All User Attributes"""
13590 response = cast(
13591 Sequence[mdls.UserAttribute],
13592 self.get(
13593 path="/user_attributes",
13594 structure=Sequence[mdls.UserAttribute],
13595 query_params={"fields": fields, "sorts": sorts},
13596 transport_options=transport_options,
13597 ),
13598 )
13599 return response
13600
13601 # ### Create a new user attribute
13602 #
13603 # Permission information for a user attribute is conveyed through the `can` and `user_can_edit` fields.
13604 # The `user_can_edit` field indicates whether an attribute is user-editable _anywhere_ in the application.
13605 # The `can` field gives more granular access information, with the `set_value` child field indicating whether
13606 # an attribute's value can be set by [Setting the User Attribute User Value](#!/User/set_user_attribute_user_value).
13607 #
13608 # Note: `name` and `label` fields must be unique across all user attributes in the Looker instance.
13609 # Attempting to create a new user attribute with a name or label that duplicates an existing
13610 # user attribute will fail with a 422 error.
13611 #
13612 # POST /user_attributes -> mdls.UserAttribute
13613 def create_user_attribute(
13614 self,
13615 body: mdls.WriteUserAttribute,
13616 # Requested fields.
13617 fields: Optional[str] = None,
13618 transport_options: Optional[transport.TransportOptions] = None,
13619 ) -> mdls.UserAttribute:
13620 """Create User Attribute"""
13621 response = cast(
13622 mdls.UserAttribute,
13623 self.post(
13624 path="/user_attributes",
13625 structure=mdls.UserAttribute,
13626 query_params={"fields": fields},
13627 body=body,
13628 transport_options=transport_options,
13629 ),
13630 )
13631 return response
13632
13633 # ### Get information about a user attribute.
13634 #
13635 # GET /user_attributes/{user_attribute_id} -> mdls.UserAttribute
13636 def user_attribute(
13637 self,
13638 # Id of user attribute
13639 user_attribute_id: str,
13640 # Requested fields.
13641 fields: Optional[str] = None,
13642 transport_options: Optional[transport.TransportOptions] = None,
13643 ) -> mdls.UserAttribute:
13644 """Get User Attribute"""
13645 user_attribute_id = self.encode_path_param(user_attribute_id)
13646 response = cast(
13647 mdls.UserAttribute,
13648 self.get(
13649 path=f"/user_attributes/{user_attribute_id}",
13650 structure=mdls.UserAttribute,
13651 query_params={"fields": fields},
13652 transport_options=transport_options,
13653 ),
13654 )
13655 return response
13656
13657 # ### Update a user attribute definition.
13658 #
13659 # PATCH /user_attributes/{user_attribute_id} -> mdls.UserAttribute
13660 def update_user_attribute(
13661 self,
13662 # Id of user attribute
13663 user_attribute_id: str,
13664 body: mdls.WriteUserAttribute,
13665 # Requested fields.
13666 fields: Optional[str] = None,
13667 transport_options: Optional[transport.TransportOptions] = None,
13668 ) -> mdls.UserAttribute:
13669 """Update User Attribute"""
13670 user_attribute_id = self.encode_path_param(user_attribute_id)
13671 response = cast(
13672 mdls.UserAttribute,
13673 self.patch(
13674 path=f"/user_attributes/{user_attribute_id}",
13675 structure=mdls.UserAttribute,
13676 query_params={"fields": fields},
13677 body=body,
13678 transport_options=transport_options,
13679 ),
13680 )
13681 return response
13682
13683 # ### Delete a user attribute (admin only).
13684 #
13685 # DELETE /user_attributes/{user_attribute_id} -> str
13686 def delete_user_attribute(
13687 self,
13688 # Id of user attribute
13689 user_attribute_id: str,
13690 transport_options: Optional[transport.TransportOptions] = None,
13691 ) -> str:
13692 """Delete User Attribute"""
13693 user_attribute_id = self.encode_path_param(user_attribute_id)
13694 response = cast(
13695 str,
13696 self.delete(
13697 path=f"/user_attributes/{user_attribute_id}",
13698 structure=str,
13699 transport_options=transport_options,
13700 ),
13701 )
13702 return response
13703
13704 # ### Returns all values of a user attribute defined by user groups, in precedence order.
13705 #
13706 # A user may be a member of multiple groups which define different values for a given user attribute.
13707 # The order of group-values in the response determines precedence for selecting which group-value applies
13708 # to a given user. For more information, see [Set User Attribute Group Values](#!/UserAttribute/set_user_attribute_group_values).
13709 #
13710 # Results will only include groups that the caller's user account has permission to see.
13711 #
13712 # GET /user_attributes/{user_attribute_id}/group_values -> Sequence[mdls.UserAttributeGroupValue]
13713 def all_user_attribute_group_values(
13714 self,
13715 # Id of user attribute
13716 user_attribute_id: str,
13717 # Requested fields.
13718 fields: Optional[str] = None,
13719 transport_options: Optional[transport.TransportOptions] = None,
13720 ) -> Sequence[mdls.UserAttributeGroupValue]:
13721 """Get User Attribute Group Values"""
13722 user_attribute_id = self.encode_path_param(user_attribute_id)
13723 response = cast(
13724 Sequence[mdls.UserAttributeGroupValue],
13725 self.get(
13726 path=f"/user_attributes/{user_attribute_id}/group_values",
13727 structure=Sequence[mdls.UserAttributeGroupValue],
13728 query_params={"fields": fields},
13729 transport_options=transport_options,
13730 ),
13731 )
13732 return response
13733
13734 # ### Define values for a user attribute across a set of groups, in priority order.
13735 #
13736 # This function defines all values for a user attribute defined by user groups. This is a global setting, potentially affecting
13737 # all users in the system. This function replaces any existing group value definitions for the indicated user attribute.
13738 #
13739 # The value of a user attribute for a given user is determined by searching the following locations, in this order:
13740 #
13741 # 1. the user's account settings
13742 # 2. the groups that the user is a member of
13743 # 3. the default value of the user attribute, if any
13744 #
13745 # 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
13746 # determines which group takes priority for that user. Lowest array index wins.
13747 #
13748 # An alternate method to indicate the selection precedence of group-values is to assign numbers to the 'rank' property of each
13749 # group-value object in the array. Lowest 'rank' value wins. If you use this technique, you must assign a
13750 # rank value to every group-value object in the array.
13751 #
13752 # To set a user attribute value for a single user, see [Set User Attribute User Value](#!/User/set_user_attribute_user_value).
13753 # To set a user attribute value for all members of a group, see [Set User Attribute Group Value](#!/Group/update_user_attribute_group_value).
13754 #
13755 # POST /user_attributes/{user_attribute_id}/group_values -> Sequence[mdls.UserAttributeGroupValue]
13756 def set_user_attribute_group_values(
13757 self,
13758 # Id of user attribute
13759 user_attribute_id: str,
13760 body: Sequence[mdls.UserAttributeGroupValue],
13761 transport_options: Optional[transport.TransportOptions] = None,
13762 ) -> Sequence[mdls.UserAttributeGroupValue]:
13763 """Set User Attribute Group Values"""
13764 user_attribute_id = self.encode_path_param(user_attribute_id)
13765 response = cast(
13766 Sequence[mdls.UserAttributeGroupValue],
13767 self.post(
13768 path=f"/user_attributes/{user_attribute_id}/group_values",
13769 structure=Sequence[mdls.UserAttributeGroupValue],
13770 body=body,
13771 transport_options=transport_options,
13772 ),
13773 )
13774 return response
13775
13776 # endregion
13777
13778 # region Workspace: Manage Workspaces
13779
13780 # ### Get All Workspaces
13781 #
13782 # Returns all workspaces available to the calling user.
13783 #
13784 # GET /workspaces -> Sequence[mdls.Workspace]
13785 def all_workspaces(
13786 self,
13787 transport_options: Optional[transport.TransportOptions] = None,
13788 ) -> Sequence[mdls.Workspace]:
13789 """Get All Workspaces"""
13790 response = cast(
13791 Sequence[mdls.Workspace],
13792 self.get(
13793 path="/workspaces",
13794 structure=Sequence[mdls.Workspace],
13795 transport_options=transport_options,
13796 ),
13797 )
13798 return response
13799
13800 # ### Get A Workspace
13801 #
13802 # Returns information about a workspace such as the git status and selected branches
13803 # of all projects available to the caller's user account.
13804 #
13805 # A workspace defines which versions of project files will be used to evaluate expressions
13806 # and operations that use model definitions - operations such as running queries or rendering dashboards.
13807 # Each project has its own git repository, and each project in a workspace may be configured to reference
13808 # particular branch or revision within their respective repositories.
13809 #
13810 # There are two predefined workspaces available: "production" and "dev".
13811 #
13812 # The production workspace is shared across all Looker users. Models in the production workspace are read-only.
13813 # Changing files in production is accomplished by modifying files in a git branch and using Pull Requests
13814 # to merge the changes from the dev branch into the production branch, and then telling
13815 # Looker to sync with production.
13816 #
13817 # The dev workspace is local to each Looker user. Changes made to project/model files in the dev workspace only affect
13818 # that user, and only when the dev workspace is selected as the active workspace for the API session.
13819 # (See set_session_workspace()).
13820 #
13821 # The dev workspace is NOT unique to an API session. Two applications accessing the Looker API using
13822 # the same user account will see the same files in the dev workspace. To avoid collisions between
13823 # API clients it's best to have each client login with API credentials for a different user account.
13824 #
13825 # Changes made to files in a dev workspace are persistent across API sessions. It's a good
13826 # idea to commit any changes you've made to the git repository, but not strictly required. Your modified files
13827 # reside in a special user-specific directory on the Looker server and will still be there when you login in again
13828 # later and use update_session(workspace_id: "dev") to select the dev workspace for the new API session.
13829 #
13830 # GET /workspaces/{workspace_id} -> mdls.Workspace
13831 def workspace(
13832 self,
13833 # Id of the workspace
13834 workspace_id: str,
13835 transport_options: Optional[transport.TransportOptions] = None,
13836 ) -> mdls.Workspace:
13837 """Get Workspace"""
13838 workspace_id = self.encode_path_param(workspace_id)
13839 response = cast(
13840 mdls.Workspace,
13841 self.get(
13842 path=f"/workspaces/{workspace_id}",
13843 structure=mdls.Workspace,
13844 transport_options=transport_options,
13845 ),
13846 )
13847 return response
13848
13849 # endregion
13850
13851
13852LookerSDK = Looker40SDK