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# 476 API methods
25
26
27# NOTE: Do not edit this file generated by Looker SDK Codegen for API 4.0
28import datetime
29from typing import Any, MutableMapping, Optional, Sequence, Union, cast
30import warnings
31
32from . import models as mdls
33from looker_sdk.rtl import api_methods
34from looker_sdk.rtl import transport
35
36
37class Looker40SDK(api_methods.APIMethods):
38
39 # region Alert: Alert
40
41 # Follow an alert.
42 #
43 # POST /alerts/{alert_id}/follow -> None
44 def follow_alert(
45 self,
46 # ID of an alert
47 alert_id: str,
48 transport_options: Optional[transport.TransportOptions] = None,
49 ) -> None:
50 """Follow an alert"""
51 alert_id = self.encode_path_param(alert_id)
52 response = cast(
53 None,
54 self.post(
55 path=f"/alerts/{alert_id}/follow",
56 structure=None,
57 transport_options=transport_options,
58 ),
59 )
60 return response
61
62 # Unfollow an alert.
63 #
64 # DELETE /alerts/{alert_id}/follow -> None
65 def unfollow_alert(
66 self,
67 # ID of an alert
68 alert_id: str,
69 transport_options: Optional[transport.TransportOptions] = None,
70 ) -> None:
71 """Unfollow an alert"""
72 alert_id = self.encode_path_param(alert_id)
73 response = cast(
74 None,
75 self.delete(
76 path=f"/alerts/{alert_id}/follow",
77 structure=None,
78 transport_options=transport_options,
79 ),
80 )
81 return response
82
83 # ### Search Alerts
84 #
85 # GET /alerts/search -> Sequence[mdls.Alert]
86 def search_alerts(
87 self,
88 # (Optional) Number of results to return (used with `offset`).
89 limit: Optional[int] = None,
90 # (Optional) Number of results to skip before returning any (used with `limit`).
91 offset: Optional[int] = None,
92 # (Optional) Dimension by which to order the results(`dashboard` | `owner`)
93 group_by: Optional[str] = None,
94 # (Optional) Requested fields.
95 fields: Optional[str] = None,
96 # (Optional) Filter on returning only enabled or disabled alerts.
97 disabled: Optional[bool] = None,
98 # (Optional) Filter on alert frequency, such as: monthly, weekly, daily, hourly, minutes
99 frequency: Optional[str] = None,
100 # (Optional) Filter on whether the alert has met its condition when it last executed
101 condition_met: Optional[bool] = None,
102 # (Optional) Filter on the start range of the last time the alerts were run. Example: 2021-01-01T01:01:01-08:00.
103 last_run_start: Optional[str] = None,
104 # (Optional) Filter on the start range of the last time the alerts were run. Example: 2021-01-01T01:01:01-08:00.
105 last_run_end: Optional[str] = None,
106 # (Admin only) (Optional) Filter for all owners.
107 all_owners: Optional[bool] = None,
108 transport_options: Optional[transport.TransportOptions] = None,
109 ) -> Sequence[mdls.Alert]:
110 """Search Alerts"""
111 response = cast(
112 Sequence[mdls.Alert],
113 self.get(
114 path="/alerts/search",
115 structure=Sequence[mdls.Alert],
116 query_params={
117 "limit": limit,
118 "offset": offset,
119 "group_by": group_by,
120 "fields": fields,
121 "disabled": disabled,
122 "frequency": frequency,
123 "condition_met": condition_met,
124 "last_run_start": last_run_start,
125 "last_run_end": last_run_end,
126 "all_owners": all_owners,
127 },
128 transport_options=transport_options,
129 ),
130 )
131 return response
132
133 # ### Get an alert by a given alert ID
134 #
135 # GET /alerts/{alert_id} -> mdls.Alert
136 def get_alert(
137 self,
138 # ID of an alert
139 alert_id: str,
140 transport_options: Optional[transport.TransportOptions] = None,
141 ) -> mdls.Alert:
142 """Get an alert"""
143 alert_id = self.encode_path_param(alert_id)
144 response = cast(
145 mdls.Alert,
146 self.get(
147 path=f"/alerts/{alert_id}",
148 structure=mdls.Alert,
149 transport_options=transport_options,
150 ),
151 )
152 return response
153
154 # ### Update an alert
155 # # Required fields: `owner_id`, `field`, `destinations`, `comparison_type`, `threshold`, `cron`
156 # #
157 #
158 # PUT /alerts/{alert_id} -> mdls.Alert
159 def update_alert(
160 self,
161 # ID of an alert
162 alert_id: str,
163 body: mdls.WriteAlert,
164 transport_options: Optional[transport.TransportOptions] = None,
165 ) -> mdls.Alert:
166 """Update an alert"""
167 alert_id = self.encode_path_param(alert_id)
168 response = cast(
169 mdls.Alert,
170 self.put(
171 path=f"/alerts/{alert_id}",
172 structure=mdls.Alert,
173 body=body,
174 transport_options=transport_options,
175 ),
176 )
177 return response
178
179 # ### Update select alert fields
180 # # Available fields: `owner_id`, `is_disabled`, `disabled_reason`, `is_public`, `threshold`
181 # #
182 #
183 # PATCH /alerts/{alert_id} -> mdls.Alert
184 def update_alert_field(
185 self,
186 # ID of an alert
187 alert_id: str,
188 body: mdls.AlertPatch,
189 transport_options: Optional[transport.TransportOptions] = None,
190 ) -> mdls.Alert:
191 """Update select fields on an alert"""
192 alert_id = self.encode_path_param(alert_id)
193 response = cast(
194 mdls.Alert,
195 self.patch(
196 path=f"/alerts/{alert_id}",
197 structure=mdls.Alert,
198 body=body,
199 transport_options=transport_options,
200 ),
201 )
202 return response
203
204 # ### Delete an alert by a given alert ID
205 #
206 # DELETE /alerts/{alert_id} -> None
207 def delete_alert(
208 self,
209 # ID of an alert
210 alert_id: str,
211 transport_options: Optional[transport.TransportOptions] = None,
212 ) -> None:
213 """Delete an alert"""
214 alert_id = self.encode_path_param(alert_id)
215 response = cast(
216 None,
217 self.delete(
218 path=f"/alerts/{alert_id}",
219 structure=None,
220 transport_options=transport_options,
221 ),
222 )
223 return response
224
225 # ### Create a new alert and return details of the newly created object
226 #
227 # Required fields: `field`, `destinations`, `comparison_type`, `threshold`, `cron`
228 #
229 # Example Request:
230 # Run alert on dashboard element '103' at 5am every day. Send an email to 'test@test.com' if inventory for Los Angeles (using dashboard filter `Warehouse Name`) is lower than 1,000
231 # ```
232 # {
233 # "cron": "0 5 * * *",
234 # "custom_title": "Alert when LA inventory is low",
235 # "dashboard_element_id": 103,
236 # "applied_dashboard_filters": [
237 # {
238 # "filter_title": "Warehouse Name",
239 # "field_name": "distribution_centers.name",
240 # "filter_value": "Los Angeles CA",
241 # "filter_description": "is Los Angeles CA"
242 # }
243 # ],
244 # "comparison_type": "LESS_THAN",
245 # "destinations": [
246 # {
247 # "destination_type": "EMAIL",
248 # "email_address": "test@test.com"
249 # }
250 # ],
251 # "field": {
252 # "title": "Number on Hand",
253 # "name": "inventory_items.number_on_hand"
254 # },
255 # "is_disabled": false,
256 # "is_public": true,
257 # "threshold": 1000
258 # }
259 # ```
260 #
261 # POST /alerts -> mdls.Alert
262 def create_alert(
263 self,
264 body: mdls.WriteAlert,
265 transport_options: Optional[transport.TransportOptions] = None,
266 ) -> mdls.Alert:
267 """Create an alert"""
268 response = cast(
269 mdls.Alert,
270 self.post(
271 path="/alerts",
272 structure=mdls.Alert,
273 body=body,
274 transport_options=transport_options,
275 ),
276 )
277 return response
278
279 # ### Enqueue an Alert by ID
280 #
281 # POST /alerts/{alert_id}/enqueue -> None
282 def enqueue_alert(
283 self,
284 # ID of an alert
285 alert_id: str,
286 # Whether to enqueue an alert again if its already running.
287 force: Optional[bool] = None,
288 transport_options: Optional[transport.TransportOptions] = None,
289 ) -> None:
290 """Enqueue an alert"""
291 alert_id = self.encode_path_param(alert_id)
292 response = cast(
293 None,
294 self.post(
295 path=f"/alerts/{alert_id}/enqueue",
296 structure=None,
297 query_params={"force": force},
298 transport_options=transport_options,
299 ),
300 )
301 return response
302
303 # # Alert Notifications.
304 # The endpoint returns all the alert notifications received by the user on email in the past 7 days. It also returns whether the notifications have been read by the user.
305 #
306 # GET /alert_notifications -> Sequence[mdls.AlertNotifications]
307 def alert_notifications(
308 self,
309 # (Optional) Number of results to return (used with `offset`).
310 limit: Optional[int] = None,
311 # (Optional) Number of results to skip before returning any (used with `limit`).
312 offset: Optional[int] = None,
313 transport_options: Optional[transport.TransportOptions] = None,
314 ) -> Sequence[mdls.AlertNotifications]:
315 """Alert Notifications"""
316 response = cast(
317 Sequence[mdls.AlertNotifications],
318 self.get(
319 path="/alert_notifications",
320 structure=Sequence[mdls.AlertNotifications],
321 query_params={"limit": limit, "offset": offset},
322 transport_options=transport_options,
323 ),
324 )
325 return response
326
327 # # Reads a Notification
328 # The endpoint marks a given alert notification as read by the user, in case it wasn't already read. The AlertNotification model is updated for this purpose. It returns the notification as a response.
329 #
330 # PATCH /alert_notifications/{alert_notification_id} -> mdls.AlertNotifications
331 def read_alert_notification(
332 self,
333 # ID of a notification
334 alert_notification_id: str,
335 transport_options: Optional[transport.TransportOptions] = None,
336 ) -> mdls.AlertNotifications:
337 """Read a Notification"""
338 alert_notification_id = self.encode_path_param(alert_notification_id)
339 response = cast(
340 mdls.AlertNotifications,
341 self.patch(
342 path=f"/alert_notifications/{alert_notification_id}",
343 structure=mdls.AlertNotifications,
344 transport_options=transport_options,
345 ),
346 )
347 return response
348
349 # endregion
350
351 # region ApiAuth: API Authentication
352
353 # ### Present client credentials to obtain an authorization token
354 #
355 # Looker API implements the OAuth2 [Resource Owner Password Credentials Grant](https://cloud.google.com/looker/docs/r/api/outh2_resource_owner_pc) pattern.
356 # The client credentials required for this login must be obtained by creating an API key on a user account
357 # in the Looker Admin console. The API key consists of a public `client_id` and a private `client_secret`.
358 #
359 # The access token returned by `login` must be used in the HTTP Authorization header of subsequent
360 # API requests, like this:
361 # ```
362 # Authorization: token 4QDkCyCtZzYgj4C2p2cj3csJH7zqS5RzKs2kTnG4
363 # ```
364 # Replace "4QDkCy..." with the `access_token` value returned by `login`.
365 # The word `token` is a string literal and must be included exactly as shown.
366 #
367 # This function can accept `client_id` and `client_secret` parameters as URL query params or as www-form-urlencoded params in the body of the HTTP request. Since there is a small risk that URL parameters may be visible to intermediate nodes on the network route (proxies, routers, etc), passing credentials in the body of the request is considered more secure than URL params.
368 #
369 # Example of passing credentials in the HTTP request body:
370 # ````
371 # POST HTTP /login
372 # Content-Type: application/x-www-form-urlencoded
373 #
374 # client_id=CGc9B7v7J48dQSJvxxx&client_secret=nNVS9cSS3xNpSC9JdsBvvvvv
375 # ````
376 #
377 # ### Best Practice:
378 # Always pass credentials in body params. Pass credentials in URL query params **only** when you cannot pass body params due to application, tool, or other limitations.
379 #
380 # For more information and detailed examples of Looker API authorization, see [How to Authenticate to Looker API](https://github.com/looker/looker-sdk-ruby/blob/master/authentication.md).
381 #
382 # POST /login -> mdls.AccessToken
383 def login(
384 self,
385 # client_id part of API Key.
386 client_id: Optional[str] = None,
387 # client_secret part of API Key.
388 client_secret: Optional[str] = None,
389 transport_options: Optional[transport.TransportOptions] = None,
390 ) -> mdls.AccessToken:
391 """Login"""
392 response = cast(
393 mdls.AccessToken,
394 self.post(
395 path="/login",
396 structure=mdls.AccessToken,
397 query_params={"client_id": client_id, "client_secret": client_secret},
398 transport_options=transport_options,
399 ),
400 )
401 return response
402
403 # ### Create an access token that runs as a given user.
404 #
405 # This can only be called by an authenticated admin user. It allows that admin to generate a new
406 # authentication token for the user with the given user id. That token can then be used for subsequent
407 # API calls - which are then performed *as* that target user.
408 #
409 # The target user does *not* need to have a pre-existing API client_id/client_secret pair. And, no such
410 # credentials are created by this call.
411 #
412 # This allows for building systems where api user authentication for an arbitrary number of users is done
413 # outside of Looker and funneled through a single 'service account' with admin permissions. Note that a
414 # new access token is generated on each call. If target users are going to be making numerous API
415 # calls in a short period then it is wise to cache this authentication token rather than call this before
416 # each of those API calls.
417 #
418 # See 'login' for more detail on the access token and how to use it.
419 #
420 # In [Looker (Google Cloud core)](https://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://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://cloud.google.com/looker/docs/r/single-sign-on-embedding)
423 # Regular user types can not be impersonated in [Looker (Google Cloud core)](https://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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://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 # ### Create OAuth User state.
3783 #
3784 # POST /external_oauth_applications/user_state -> mdls.CreateOAuthApplicationUserStateResponse
3785 def create_oauth_application_user_state(
3786 self,
3787 body: mdls.CreateOAuthApplicationUserStateRequest,
3788 transport_options: Optional[transport.TransportOptions] = None,
3789 ) -> mdls.CreateOAuthApplicationUserStateResponse:
3790 """Create Create OAuth user state."""
3791 response = cast(
3792 mdls.CreateOAuthApplicationUserStateResponse,
3793 self.post(
3794 path="/external_oauth_applications/user_state",
3795 structure=mdls.CreateOAuthApplicationUserStateResponse,
3796 body=body,
3797 transport_options=transport_options,
3798 ),
3799 )
3800 return response
3801
3802 # ### Get information about all SSH Servers.
3803 #
3804 # GET /ssh_servers -> Sequence[mdls.SshServer]
3805 def all_ssh_servers(
3806 self,
3807 # Requested fields.
3808 fields: Optional[str] = None,
3809 transport_options: Optional[transport.TransportOptions] = None,
3810 ) -> Sequence[mdls.SshServer]:
3811 """Get All SSH Servers"""
3812 response = cast(
3813 Sequence[mdls.SshServer],
3814 self.get(
3815 path="/ssh_servers",
3816 structure=Sequence[mdls.SshServer],
3817 query_params={"fields": fields},
3818 transport_options=transport_options,
3819 ),
3820 )
3821 return response
3822
3823 # ### Create an SSH Server.
3824 #
3825 # POST /ssh_servers -> mdls.SshServer
3826 def create_ssh_server(
3827 self,
3828 body: mdls.WriteSshServer,
3829 transport_options: Optional[transport.TransportOptions] = None,
3830 ) -> mdls.SshServer:
3831 """Create SSH Server"""
3832 response = cast(
3833 mdls.SshServer,
3834 self.post(
3835 path="/ssh_servers",
3836 structure=mdls.SshServer,
3837 body=body,
3838 transport_options=transport_options,
3839 ),
3840 )
3841 return response
3842
3843 # ### Get information about an SSH Server.
3844 #
3845 # GET /ssh_server/{ssh_server_id} -> mdls.SshServer
3846 def ssh_server(
3847 self,
3848 # Id of SSH Server
3849 ssh_server_id: str,
3850 transport_options: Optional[transport.TransportOptions] = None,
3851 ) -> mdls.SshServer:
3852 """Get SSH Server"""
3853 ssh_server_id = self.encode_path_param(ssh_server_id)
3854 response = cast(
3855 mdls.SshServer,
3856 self.get(
3857 path=f"/ssh_server/{ssh_server_id}",
3858 structure=mdls.SshServer,
3859 transport_options=transport_options,
3860 ),
3861 )
3862 return response
3863
3864 # ### Update an SSH Server.
3865 #
3866 # PATCH /ssh_server/{ssh_server_id} -> mdls.SshServer
3867 def update_ssh_server(
3868 self,
3869 # Id of SSH Server
3870 ssh_server_id: str,
3871 body: mdls.WriteSshServer,
3872 transport_options: Optional[transport.TransportOptions] = None,
3873 ) -> mdls.SshServer:
3874 """Update SSH Server"""
3875 ssh_server_id = self.encode_path_param(ssh_server_id)
3876 response = cast(
3877 mdls.SshServer,
3878 self.patch(
3879 path=f"/ssh_server/{ssh_server_id}",
3880 structure=mdls.SshServer,
3881 body=body,
3882 transport_options=transport_options,
3883 ),
3884 )
3885 return response
3886
3887 # ### Delete an SSH Server.
3888 #
3889 # DELETE /ssh_server/{ssh_server_id} -> str
3890 def delete_ssh_server(
3891 self,
3892 # Id of SSH Server
3893 ssh_server_id: str,
3894 transport_options: Optional[transport.TransportOptions] = None,
3895 ) -> str:
3896 """Delete SSH Server"""
3897 ssh_server_id = self.encode_path_param(ssh_server_id)
3898 response = cast(
3899 str,
3900 self.delete(
3901 path=f"/ssh_server/{ssh_server_id}",
3902 structure=str,
3903 transport_options=transport_options,
3904 ),
3905 )
3906 return response
3907
3908 # ### Test the SSH Server
3909 #
3910 # GET /ssh_server/{ssh_server_id}/test -> mdls.SshServer
3911 def test_ssh_server(
3912 self,
3913 # Id of SSH Server
3914 ssh_server_id: str,
3915 transport_options: Optional[transport.TransportOptions] = None,
3916 ) -> mdls.SshServer:
3917 """Test SSH Server"""
3918 ssh_server_id = self.encode_path_param(ssh_server_id)
3919 response = cast(
3920 mdls.SshServer,
3921 self.get(
3922 path=f"/ssh_server/{ssh_server_id}/test",
3923 structure=mdls.SshServer,
3924 transport_options=transport_options,
3925 ),
3926 )
3927 return response
3928
3929 # ### Get information about all SSH Tunnels.
3930 #
3931 # GET /ssh_tunnels -> Sequence[mdls.SshTunnel]
3932 def all_ssh_tunnels(
3933 self,
3934 # Requested fields.
3935 fields: Optional[str] = None,
3936 transport_options: Optional[transport.TransportOptions] = None,
3937 ) -> Sequence[mdls.SshTunnel]:
3938 """Get All SSH Tunnels"""
3939 response = cast(
3940 Sequence[mdls.SshTunnel],
3941 self.get(
3942 path="/ssh_tunnels",
3943 structure=Sequence[mdls.SshTunnel],
3944 query_params={"fields": fields},
3945 transport_options=transport_options,
3946 ),
3947 )
3948 return response
3949
3950 # ### Create an SSH Tunnel
3951 #
3952 # POST /ssh_tunnels -> mdls.SshTunnel
3953 def create_ssh_tunnel(
3954 self,
3955 body: mdls.WriteSshTunnel,
3956 transport_options: Optional[transport.TransportOptions] = None,
3957 ) -> mdls.SshTunnel:
3958 """Create SSH Tunnel"""
3959 response = cast(
3960 mdls.SshTunnel,
3961 self.post(
3962 path="/ssh_tunnels",
3963 structure=mdls.SshTunnel,
3964 body=body,
3965 transport_options=transport_options,
3966 ),
3967 )
3968 return response
3969
3970 # ### Get information about an SSH Tunnel.
3971 #
3972 # GET /ssh_tunnel/{ssh_tunnel_id} -> mdls.SshTunnel
3973 def ssh_tunnel(
3974 self,
3975 # Id of SSH Tunnel
3976 ssh_tunnel_id: str,
3977 transport_options: Optional[transport.TransportOptions] = None,
3978 ) -> mdls.SshTunnel:
3979 """Get SSH Tunnel"""
3980 ssh_tunnel_id = self.encode_path_param(ssh_tunnel_id)
3981 response = cast(
3982 mdls.SshTunnel,
3983 self.get(
3984 path=f"/ssh_tunnel/{ssh_tunnel_id}",
3985 structure=mdls.SshTunnel,
3986 transport_options=transport_options,
3987 ),
3988 )
3989 return response
3990
3991 # ### Update an SSH Tunnel
3992 #
3993 # PATCH /ssh_tunnel/{ssh_tunnel_id} -> mdls.SshTunnel
3994 def update_ssh_tunnel(
3995 self,
3996 # Id of SSH Tunnel
3997 ssh_tunnel_id: str,
3998 body: mdls.WriteSshTunnel,
3999 transport_options: Optional[transport.TransportOptions] = None,
4000 ) -> mdls.SshTunnel:
4001 """Update SSH Tunnel"""
4002 ssh_tunnel_id = self.encode_path_param(ssh_tunnel_id)
4003 response = cast(
4004 mdls.SshTunnel,
4005 self.patch(
4006 path=f"/ssh_tunnel/{ssh_tunnel_id}",
4007 structure=mdls.SshTunnel,
4008 body=body,
4009 transport_options=transport_options,
4010 ),
4011 )
4012 return response
4013
4014 # ### Delete an SSH Tunnel
4015 #
4016 # DELETE /ssh_tunnel/{ssh_tunnel_id} -> str
4017 def delete_ssh_tunnel(
4018 self,
4019 # Id of SSH Tunnel
4020 ssh_tunnel_id: str,
4021 transport_options: Optional[transport.TransportOptions] = None,
4022 ) -> str:
4023 """Delete SSH Tunnel"""
4024 ssh_tunnel_id = self.encode_path_param(ssh_tunnel_id)
4025 response = cast(
4026 str,
4027 self.delete(
4028 path=f"/ssh_tunnel/{ssh_tunnel_id}",
4029 structure=str,
4030 transport_options=transport_options,
4031 ),
4032 )
4033 return response
4034
4035 # ### Test the SSH Tunnel
4036 #
4037 # GET /ssh_tunnel/{ssh_tunnel_id}/test -> mdls.SshTunnel
4038 def test_ssh_tunnel(
4039 self,
4040 # Id of SSH Tunnel
4041 ssh_tunnel_id: str,
4042 transport_options: Optional[transport.TransportOptions] = None,
4043 ) -> mdls.SshTunnel:
4044 """Test SSH Tunnel"""
4045 ssh_tunnel_id = self.encode_path_param(ssh_tunnel_id)
4046 response = cast(
4047 mdls.SshTunnel,
4048 self.get(
4049 path=f"/ssh_tunnel/{ssh_tunnel_id}/test",
4050 structure=mdls.SshTunnel,
4051 transport_options=transport_options,
4052 ),
4053 )
4054 return response
4055
4056 # ### Get the SSH public key
4057 #
4058 # Get the public key created for this instance to identify itself to a remote SSH server.
4059 #
4060 # GET /ssh_public_key -> mdls.SshPublicKey
4061 def ssh_public_key(
4062 self,
4063 transport_options: Optional[transport.TransportOptions] = None,
4064 ) -> mdls.SshPublicKey:
4065 """Get SSH Public Key"""
4066 response = cast(
4067 mdls.SshPublicKey,
4068 self.get(
4069 path="/ssh_public_key",
4070 structure=mdls.SshPublicKey,
4071 transport_options=transport_options,
4072 ),
4073 )
4074 return response
4075
4076 # endregion
4077
4078 # region Content: Manage Content
4079
4080 # ### Search Favorite Content
4081 #
4082 # If multiple search params are given and `filter_or` is FALSE or not specified,
4083 # search params are combined in a logical AND operation.
4084 # Only rows that match *all* search param criteria will be returned.
4085 #
4086 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
4087 # Results will include rows that match **any** of the search criteria.
4088 #
4089 # String search params use case-insensitive matching.
4090 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
4091 # example="dan%" will match "danger" and "Danzig" but not "David"
4092 # example="D_m%" will match "Damage" and "dump"
4093 #
4094 # Integer search params can accept a single value or a comma separated list of values. The multiple
4095 # values will be combined under a logical OR operation - results will match at least one of
4096 # the given values.
4097 #
4098 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
4099 # or exclude (respectively) rows where the column is null.
4100 #
4101 # Boolean search params accept only "true" and "false" as values.
4102 #
4103 # GET /content_favorite/search -> Sequence[mdls.ContentFavorite]
4104 def search_content_favorites(
4105 self,
4106 # Match content favorite id(s)
4107 id: Optional[str] = None,
4108 # Match user id(s). To create a list of multiple ids, use commas as separators
4109 user_id: Optional[str] = None,
4110 # Match content metadata id(s). To create a list of multiple ids, use commas as separators
4111 content_metadata_id: Optional[str] = None,
4112 # Match dashboard id(s). To create a list of multiple ids, use commas as separators
4113 dashboard_id: Optional[str] = None,
4114 # Match look id(s). To create a list of multiple ids, use commas as separators
4115 look_id: Optional[str] = None,
4116 # Match board id(s). To create a list of multiple ids, use commas as separators
4117 board_id: Optional[str] = None,
4118 # 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.
4119 include_board_items: Optional[bool] = None,
4120 # Number of results to return. (used with offset)
4121 limit: Optional[int] = None,
4122 # Number of results to skip before returning any. (used with limit)
4123 offset: Optional[int] = None,
4124 # Fields to sort by.
4125 sorts: Optional[str] = None,
4126 # Requested fields.
4127 fields: Optional[str] = None,
4128 # Combine given search criteria in a boolean OR expression
4129 filter_or: Optional[bool] = None,
4130 transport_options: Optional[transport.TransportOptions] = None,
4131 ) -> Sequence[mdls.ContentFavorite]:
4132 """Search Favorite Contents"""
4133 response = cast(
4134 Sequence[mdls.ContentFavorite],
4135 self.get(
4136 path="/content_favorite/search",
4137 structure=Sequence[mdls.ContentFavorite],
4138 query_params={
4139 "id": id,
4140 "user_id": user_id,
4141 "content_metadata_id": content_metadata_id,
4142 "dashboard_id": dashboard_id,
4143 "look_id": look_id,
4144 "board_id": board_id,
4145 "include_board_items": include_board_items,
4146 "limit": limit,
4147 "offset": offset,
4148 "sorts": sorts,
4149 "fields": fields,
4150 "filter_or": filter_or,
4151 },
4152 transport_options=transport_options,
4153 ),
4154 )
4155 return response
4156
4157 # ### Get favorite content by its id
4158 #
4159 # GET /content_favorite/{content_favorite_id} -> mdls.ContentFavorite
4160 def content_favorite(
4161 self,
4162 # Id of favorite content
4163 content_favorite_id: str,
4164 # Requested fields.
4165 fields: Optional[str] = None,
4166 transport_options: Optional[transport.TransportOptions] = None,
4167 ) -> mdls.ContentFavorite:
4168 """Get Favorite Content"""
4169 content_favorite_id = self.encode_path_param(content_favorite_id)
4170 response = cast(
4171 mdls.ContentFavorite,
4172 self.get(
4173 path=f"/content_favorite/{content_favorite_id}",
4174 structure=mdls.ContentFavorite,
4175 query_params={"fields": fields},
4176 transport_options=transport_options,
4177 ),
4178 )
4179 return response
4180
4181 # ### Delete favorite content
4182 #
4183 # DELETE /content_favorite/{content_favorite_id} -> str
4184 def delete_content_favorite(
4185 self,
4186 # Id of favorite content
4187 content_favorite_id: str,
4188 transport_options: Optional[transport.TransportOptions] = None,
4189 ) -> str:
4190 """Delete Favorite Content"""
4191 content_favorite_id = self.encode_path_param(content_favorite_id)
4192 response = cast(
4193 str,
4194 self.delete(
4195 path=f"/content_favorite/{content_favorite_id}",
4196 structure=str,
4197 transport_options=transport_options,
4198 ),
4199 )
4200 return response
4201
4202 # ### Create favorite content
4203 #
4204 # POST /content_favorite -> mdls.ContentFavorite
4205 def create_content_favorite(
4206 self,
4207 body: mdls.WriteContentFavorite,
4208 transport_options: Optional[transport.TransportOptions] = None,
4209 ) -> mdls.ContentFavorite:
4210 """Create Favorite Content"""
4211 response = cast(
4212 mdls.ContentFavorite,
4213 self.post(
4214 path="/content_favorite",
4215 structure=mdls.ContentFavorite,
4216 body=body,
4217 transport_options=transport_options,
4218 ),
4219 )
4220 return response
4221
4222 # ### Get information about all content metadata in a space.
4223 #
4224 # GET /content_metadata -> Sequence[mdls.ContentMeta]
4225 def all_content_metadatas(
4226 self,
4227 # Parent space of content.
4228 parent_id: str,
4229 # Requested fields.
4230 fields: Optional[str] = None,
4231 transport_options: Optional[transport.TransportOptions] = None,
4232 ) -> Sequence[mdls.ContentMeta]:
4233 """Get All Content Metadatas"""
4234 response = cast(
4235 Sequence[mdls.ContentMeta],
4236 self.get(
4237 path="/content_metadata",
4238 structure=Sequence[mdls.ContentMeta],
4239 query_params={"parent_id": parent_id, "fields": fields},
4240 transport_options=transport_options,
4241 ),
4242 )
4243 return response
4244
4245 # ### Get information about an individual content metadata record.
4246 #
4247 # GET /content_metadata/{content_metadata_id} -> mdls.ContentMeta
4248 def content_metadata(
4249 self,
4250 # Id of content metadata
4251 content_metadata_id: str,
4252 # Requested fields.
4253 fields: Optional[str] = None,
4254 transport_options: Optional[transport.TransportOptions] = None,
4255 ) -> mdls.ContentMeta:
4256 """Get Content Metadata"""
4257 content_metadata_id = self.encode_path_param(content_metadata_id)
4258 response = cast(
4259 mdls.ContentMeta,
4260 self.get(
4261 path=f"/content_metadata/{content_metadata_id}",
4262 structure=mdls.ContentMeta,
4263 query_params={"fields": fields},
4264 transport_options=transport_options,
4265 ),
4266 )
4267 return response
4268
4269 # ### Move a piece of content.
4270 #
4271 # PATCH /content_metadata/{content_metadata_id} -> mdls.ContentMeta
4272 def update_content_metadata(
4273 self,
4274 # Id of content metadata
4275 content_metadata_id: str,
4276 body: mdls.WriteContentMeta,
4277 transport_options: Optional[transport.TransportOptions] = None,
4278 ) -> mdls.ContentMeta:
4279 """Update Content Metadata"""
4280 content_metadata_id = self.encode_path_param(content_metadata_id)
4281 response = cast(
4282 mdls.ContentMeta,
4283 self.patch(
4284 path=f"/content_metadata/{content_metadata_id}",
4285 structure=mdls.ContentMeta,
4286 body=body,
4287 transport_options=transport_options,
4288 ),
4289 )
4290 return response
4291
4292 # ### All content metadata access records for a content metadata item.
4293 #
4294 # GET /content_metadata_access -> Sequence[mdls.ContentMetaGroupUser]
4295 def all_content_metadata_accesses(
4296 self,
4297 # Id of content metadata
4298 content_metadata_id: str,
4299 # Requested fields.
4300 fields: Optional[str] = None,
4301 transport_options: Optional[transport.TransportOptions] = None,
4302 ) -> Sequence[mdls.ContentMetaGroupUser]:
4303 """Get All Content Metadata Accesses"""
4304 response = cast(
4305 Sequence[mdls.ContentMetaGroupUser],
4306 self.get(
4307 path="/content_metadata_access",
4308 structure=Sequence[mdls.ContentMetaGroupUser],
4309 query_params={
4310 "content_metadata_id": content_metadata_id,
4311 "fields": fields,
4312 },
4313 transport_options=transport_options,
4314 ),
4315 )
4316 return response
4317
4318 # ### Create content metadata access.
4319 #
4320 # POST /content_metadata_access -> mdls.ContentMetaGroupUser
4321 def create_content_metadata_access(
4322 self,
4323 # WARNING: no writeable properties found for POST, PUT, or PATCH
4324 body: mdls.ContentMetaGroupUser,
4325 # Optionally sends notification email when granting access to a board.
4326 send_boards_notification_email: Optional[bool] = None,
4327 transport_options: Optional[transport.TransportOptions] = None,
4328 ) -> mdls.ContentMetaGroupUser:
4329 """Create Content Metadata Access"""
4330 response = cast(
4331 mdls.ContentMetaGroupUser,
4332 self.post(
4333 path="/content_metadata_access",
4334 structure=mdls.ContentMetaGroupUser,
4335 query_params={
4336 "send_boards_notification_email": send_boards_notification_email
4337 },
4338 body=body,
4339 transport_options=transport_options,
4340 ),
4341 )
4342 return response
4343
4344 # ### Update type of access for content metadata.
4345 #
4346 # PUT /content_metadata_access/{content_metadata_access_id} -> mdls.ContentMetaGroupUser
4347 def update_content_metadata_access(
4348 self,
4349 # Id of content metadata access
4350 content_metadata_access_id: str,
4351 # WARNING: no writeable properties found for POST, PUT, or PATCH
4352 body: mdls.ContentMetaGroupUser,
4353 transport_options: Optional[transport.TransportOptions] = None,
4354 ) -> mdls.ContentMetaGroupUser:
4355 """Update Content Metadata Access"""
4356 content_metadata_access_id = self.encode_path_param(content_metadata_access_id)
4357 response = cast(
4358 mdls.ContentMetaGroupUser,
4359 self.put(
4360 path=f"/content_metadata_access/{content_metadata_access_id}",
4361 structure=mdls.ContentMetaGroupUser,
4362 body=body,
4363 transport_options=transport_options,
4364 ),
4365 )
4366 return response
4367
4368 # ### Remove content metadata access.
4369 #
4370 # DELETE /content_metadata_access/{content_metadata_access_id} -> str
4371 def delete_content_metadata_access(
4372 self,
4373 # Id of content metadata access
4374 content_metadata_access_id: str,
4375 transport_options: Optional[transport.TransportOptions] = None,
4376 ) -> str:
4377 """Delete Content Metadata Access"""
4378 content_metadata_access_id = self.encode_path_param(content_metadata_access_id)
4379 response = cast(
4380 str,
4381 self.delete(
4382 path=f"/content_metadata_access/{content_metadata_access_id}",
4383 structure=str,
4384 transport_options=transport_options,
4385 ),
4386 )
4387 return response
4388
4389 # ### Search across looks, dashboards, and lookml dashboards. The terms field will be matched against the
4390 # title and description of the content and the closest results are returned. Content that has been frequently
4391 # viewed and those pieces of content stored in public folders will be ranked more highly in the results.
4392 #
4393 # This endpoint does not return a full description of these content types. For more specific information
4394 # about each type please refer to the individual content specific API endpoints.
4395 #
4396 # Get the **full details** of a specific dashboard (or lookml dashboard) by id with [dashboard()](#!/Dashboard/dashboard)
4397 # Get the **full details** of a specific look by id with [look()](#!/Look/look)
4398 #
4399 # GET /content/{terms} -> Sequence[mdls.ContentSearch]
4400 def search_content(
4401 self,
4402 # Search terms
4403 terms: str,
4404 # Requested fields.
4405 fields: Optional[str] = None,
4406 # Content types requested (dashboard, look, lookml_dashboard).
4407 types: Optional[str] = None,
4408 # Number of results to return. (used with offset and takes priority over page and per_page)
4409 limit: Optional[int] = None,
4410 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
4411 offset: Optional[int] = None,
4412 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
4413 page: Optional[int] = None,
4414 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
4415 per_page: Optional[int] = None,
4416 transport_options: Optional[transport.TransportOptions] = None,
4417 ) -> Sequence[mdls.ContentSearch]:
4418 """Search Content"""
4419 terms = self.encode_path_param(terms)
4420 response = cast(
4421 Sequence[mdls.ContentSearch],
4422 self.get(
4423 path=f"/content/{terms}",
4424 structure=Sequence[mdls.ContentSearch],
4425 query_params={
4426 "fields": fields,
4427 "types": types,
4428 "limit": limit,
4429 "offset": offset,
4430 "page": page,
4431 "per_page": per_page,
4432 },
4433 transport_options=transport_options,
4434 ),
4435 )
4436 return response
4437
4438 # ### Get Content Summary
4439 #
4440 # Retrieves a collection of content items related to user activity and engagement, such as recently viewed content,
4441 # favorites and scheduled items.
4442 #
4443 # GET /content_summary -> Sequence[mdls.ContentSummary]
4444 def content_summary(
4445 self,
4446 # Comma-delimited names of fields to return in responses. Omit for all fields
4447 fields: Optional[str] = None,
4448 # Number of results to return. (used with offset)
4449 limit: Optional[int] = None,
4450 # Number of results to skip before returning any. (used with limit)
4451 offset: Optional[int] = None,
4452 # Match group id
4453 target_group_id: Optional[str] = None,
4454 # Match user id
4455 target_user_id: Optional[str] = None,
4456 # Content type to match, options are: look, dashboard. Can be provided as a comma delimited list.
4457 target_content_type: Optional[str] = None,
4458 # Fields to sort by
4459 sorts: Optional[str] = None,
4460 transport_options: Optional[transport.TransportOptions] = None,
4461 ) -> Sequence[mdls.ContentSummary]:
4462 """Search Content Summaries"""
4463 response = cast(
4464 Sequence[mdls.ContentSummary],
4465 self.get(
4466 path="/content_summary",
4467 structure=Sequence[mdls.ContentSummary],
4468 query_params={
4469 "fields": fields,
4470 "limit": limit,
4471 "offset": offset,
4472 "target_group_id": target_group_id,
4473 "target_user_id": target_user_id,
4474 "target_content_type": target_content_type,
4475 "sorts": sorts,
4476 },
4477 transport_options=transport_options,
4478 ),
4479 )
4480 return response
4481
4482 # ### Get an image representing the contents of a dashboard or look.
4483 #
4484 # The returned thumbnail is an abstract representation of the contents of a dashboard or look and does not
4485 # reflect the actual data displayed in the respective visualizations.
4486 #
4487 # GET /content_thumbnail/{type}/{resource_id} -> Union[str, bytes]
4488 def content_thumbnail(
4489 self,
4490 # Either dashboard or look
4491 type: str,
4492 # ID of the dashboard or look to render
4493 resource_id: str,
4494 # Whether or not to refresh the rendered image with the latest content
4495 reload: Optional[str] = None,
4496 # Light or dark background. Default is "light"
4497 theme: Optional[str] = None,
4498 # A value of png produces a thumbnail in PNG format instead of SVG (default)
4499 format: Optional[str] = None,
4500 # The width of the image if format is supplied
4501 width: Optional[int] = None,
4502 # The height of the image if format is supplied
4503 height: Optional[int] = None,
4504 transport_options: Optional[transport.TransportOptions] = None,
4505 ) -> Union[str, bytes]:
4506 """Get Content Thumbnail"""
4507 type = self.encode_path_param(type)
4508 resource_id = self.encode_path_param(resource_id)
4509 response = cast(
4510 Union[str, bytes],
4511 self.get(
4512 path=f"/content_thumbnail/{type}/{resource_id}",
4513 structure=Union[str, bytes], # type: ignore
4514 query_params={
4515 "reload": reload,
4516 "theme": theme,
4517 "format": format,
4518 "width": width,
4519 "height": height,
4520 },
4521 transport_options=transport_options,
4522 ),
4523 )
4524 return response
4525
4526 # ### Validate All Content
4527 #
4528 # Performs validation of all looks and dashboards
4529 # Returns a list of errors found as well as metadata about the content validation run.
4530 #
4531 # GET /content_validation -> mdls.ContentValidation
4532 def content_validation(
4533 self,
4534 # Requested fields.
4535 fields: Optional[str] = None,
4536 # Optional list of project names to filter by
4537 project_names: Optional[mdls.DelimSequence[str]] = None,
4538 # Optional list of space ids to filter by
4539 space_ids: Optional[mdls.DelimSequence[str]] = None,
4540 transport_options: Optional[transport.TransportOptions] = None,
4541 ) -> mdls.ContentValidation:
4542 """Validate Content"""
4543 response = cast(
4544 mdls.ContentValidation,
4545 self.get(
4546 path="/content_validation",
4547 structure=mdls.ContentValidation,
4548 query_params={
4549 "fields": fields,
4550 "project_names": project_names,
4551 "space_ids": space_ids,
4552 },
4553 transport_options=transport_options,
4554 ),
4555 )
4556 return response
4557
4558 # ### Search Content Views
4559 #
4560 # If multiple search params are given and `filter_or` is FALSE or not specified,
4561 # search params are combined in a logical AND operation.
4562 # Only rows that match *all* search param criteria will be returned.
4563 #
4564 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
4565 # Results will include rows that match **any** of the search criteria.
4566 #
4567 # String search params use case-insensitive matching.
4568 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
4569 # example="dan%" will match "danger" and "Danzig" but not "David"
4570 # example="D_m%" will match "Damage" and "dump"
4571 #
4572 # Integer search params can accept a single value or a comma separated list of values. The multiple
4573 # values will be combined under a logical OR operation - results will match at least one of
4574 # the given values.
4575 #
4576 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
4577 # or exclude (respectively) rows where the column is null.
4578 #
4579 # Boolean search params accept only "true" and "false" as values.
4580 #
4581 # GET /content_view/search -> Sequence[mdls.ContentView]
4582 def search_content_views(
4583 self,
4584 # Match view count
4585 view_count: Optional[str] = None,
4586 # Match Group Id
4587 group_id: Optional[str] = None,
4588 # Match look_id
4589 look_id: Optional[str] = None,
4590 # Match dashboard_id
4591 dashboard_id: Optional[str] = None,
4592 # Match content metadata id
4593 content_metadata_id: Optional[str] = None,
4594 # Match start of week date (format is "YYYY-MM-DD")
4595 start_of_week_date: Optional[str] = None,
4596 # True if only all time view records should be returned
4597 all_time: Optional[bool] = None,
4598 # Match user id
4599 user_id: Optional[str] = None,
4600 # Requested fields
4601 fields: Optional[str] = None,
4602 # Number of results to return. Use with `offset` to manage pagination of results
4603 limit: Optional[int] = None,
4604 # Number of results to skip before returning data
4605 offset: Optional[int] = None,
4606 # Fields to sort by
4607 sorts: Optional[str] = None,
4608 # Combine given search criteria in a boolean OR expression
4609 filter_or: Optional[bool] = None,
4610 transport_options: Optional[transport.TransportOptions] = None,
4611 ) -> Sequence[mdls.ContentView]:
4612 """Search Content Views"""
4613 response = cast(
4614 Sequence[mdls.ContentView],
4615 self.get(
4616 path="/content_view/search",
4617 structure=Sequence[mdls.ContentView],
4618 query_params={
4619 "view_count": view_count,
4620 "group_id": group_id,
4621 "look_id": look_id,
4622 "dashboard_id": dashboard_id,
4623 "content_metadata_id": content_metadata_id,
4624 "start_of_week_date": start_of_week_date,
4625 "all_time": all_time,
4626 "user_id": user_id,
4627 "fields": fields,
4628 "limit": limit,
4629 "offset": offset,
4630 "sorts": sorts,
4631 "filter_or": filter_or,
4632 },
4633 transport_options=transport_options,
4634 ),
4635 )
4636 return response
4637
4638 # ### Get a vector image representing the contents of a dashboard or look.
4639 #
4640 # # DEPRECATED: Use [content_thumbnail()](#!/Content/content_thumbnail)
4641 #
4642 # The returned thumbnail is an abstract representation of the contents of a dashboard or look and does not
4643 # reflect the actual data displayed in the respective visualizations.
4644 #
4645 # GET /vector_thumbnail/{type}/{resource_id} -> str
4646 def vector_thumbnail(
4647 self,
4648 # Either dashboard or look
4649 type: str,
4650 # ID of the dashboard or look to render
4651 resource_id: str,
4652 # Whether or not to refresh the rendered image with the latest content
4653 reload: Optional[str] = None,
4654 transport_options: Optional[transport.TransportOptions] = None,
4655 ) -> str:
4656 """Get Vector Thumbnail"""
4657 type = self.encode_path_param(type)
4658 resource_id = self.encode_path_param(resource_id)
4659 response = cast(
4660 str,
4661 self.get(
4662 path=f"/vector_thumbnail/{type}/{resource_id}",
4663 structure=str,
4664 query_params={"reload": reload},
4665 transport_options=transport_options,
4666 ),
4667 )
4668 return response
4669
4670 # endregion
4671
4672 # region Dashboard: Manage Dashboards
4673
4674 # ### Get information about all active dashboards.
4675 #
4676 # Returns an array of **abbreviated dashboard objects**. Dashboards marked as deleted are excluded from this list.
4677 #
4678 # Get the **full details** of a specific dashboard by id with [dashboard()](#!/Dashboard/dashboard)
4679 #
4680 # Find **deleted dashboards** with [search_dashboards()](#!/Dashboard/search_dashboards)
4681 #
4682 # GET /dashboards -> Sequence[mdls.DashboardBase]
4683 def all_dashboards(
4684 self,
4685 # Requested fields.
4686 fields: Optional[str] = None,
4687 transport_options: Optional[transport.TransportOptions] = None,
4688 ) -> Sequence[mdls.DashboardBase]:
4689 """Get All Dashboards"""
4690 response = cast(
4691 Sequence[mdls.DashboardBase],
4692 self.get(
4693 path="/dashboards",
4694 structure=Sequence[mdls.DashboardBase],
4695 query_params={"fields": fields},
4696 transport_options=transport_options,
4697 ),
4698 )
4699 return response
4700
4701 # ### Create a new dashboard
4702 #
4703 # Creates a new dashboard object and returns the details of the newly created dashboard.
4704 #
4705 # `Title` and `space_id` are required fields.
4706 # `Space_id` must contain the id of an existing space.
4707 # A dashboard's `title` must be unique within the space in which it resides.
4708 #
4709 # If you receive a 422 error response when creating a dashboard, be sure to look at the
4710 # response body for information about exactly which fields are missing or contain invalid data.
4711 #
4712 # You can **update** an existing dashboard with [update_dashboard()](#!/Dashboard/update_dashboard)
4713 #
4714 # You can **permanently delete** an existing dashboard with [delete_dashboard()](#!/Dashboard/delete_dashboard)
4715 #
4716 # POST /dashboards -> mdls.Dashboard
4717 def create_dashboard(
4718 self,
4719 body: mdls.WriteDashboard,
4720 transport_options: Optional[transport.TransportOptions] = None,
4721 ) -> mdls.Dashboard:
4722 """Create Dashboard"""
4723 response = cast(
4724 mdls.Dashboard,
4725 self.post(
4726 path="/dashboards",
4727 structure=mdls.Dashboard,
4728 body=body,
4729 transport_options=transport_options,
4730 ),
4731 )
4732 return response
4733
4734 # ### Search Dashboards
4735 #
4736 # Returns an array of **user-defined dashboard** objects that match the specified search criteria.
4737 # Note, [search_dashboards()](#!/Dashboard/search_dashboards) does not return LookML dashboard objects.
4738 #
4739 # If multiple search params are given and `filter_or` is FALSE or not specified,
4740 # search params are combined in a logical AND operation.
4741 # Only rows that match *all* search param criteria will be returned.
4742 #
4743 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
4744 # Results will include rows that match **any** of the search criteria.
4745 #
4746 # String search params use case-insensitive matching.
4747 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
4748 # example="dan%" will match "danger" and "Danzig" but not "David"
4749 # example="D_m%" will match "Damage" and "dump"
4750 #
4751 # Integer search params can accept a single value or a comma separated list of values. The multiple
4752 # values will be combined under a logical OR operation - results will match at least one of
4753 # the given values.
4754 #
4755 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
4756 # or exclude (respectively) rows where the column is null.
4757 #
4758 # Boolean search params accept only "true" and "false" as values.
4759 #
4760 #
4761 # The parameters `limit`, and `offset` are recommended for fetching results in page-size chunks.
4762 #
4763 # Get a **single dashboard** by id with [dashboard()](#!/Dashboard/dashboard)
4764 #
4765 # GET /dashboards/search -> Sequence[mdls.Dashboard]
4766 def search_dashboards(
4767 self,
4768 # Match dashboard id.
4769 id: Optional[str] = None,
4770 # Match dashboard slug.
4771 slug: Optional[str] = None,
4772 # Match Dashboard title.
4773 title: Optional[str] = None,
4774 # Match Dashboard description.
4775 description: Optional[str] = None,
4776 # Filter on a content favorite id.
4777 content_favorite_id: Optional[str] = None,
4778 # Filter on a particular folder.
4779 folder_id: Optional[str] = None,
4780 # Filter on dashboards deleted status.
4781 deleted: Optional[str] = None,
4782 # Filter on dashboards created by a particular user.
4783 user_id: Optional[str] = None,
4784 # Filter on a particular value of view_count
4785 view_count: Optional[str] = None,
4786 # Filter on a content favorite id.
4787 content_metadata_id: Optional[str] = None,
4788 # Exclude items that exist only in personal spaces other than the users
4789 curate: Optional[bool] = None,
4790 # Select dashboards based on when they were last viewed
4791 last_viewed_at: Optional[str] = None,
4792 # Requested fields.
4793 fields: Optional[str] = None,
4794 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
4795 page: Optional[int] = None,
4796 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
4797 per_page: Optional[int] = None,
4798 # Number of results to return. (used with offset and takes priority over page and per_page)
4799 limit: Optional[int] = None,
4800 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
4801 offset: Optional[int] = None,
4802 # 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]
4803 sorts: Optional[str] = None,
4804 # Combine given search criteria in a boolean OR expression
4805 filter_or: Optional[bool] = None,
4806 # Filter out the dashboards owned by the user passed at the :user_id params
4807 not_owned_by: Optional[bool] = None,
4808 transport_options: Optional[transport.TransportOptions] = None,
4809 ) -> Sequence[mdls.Dashboard]:
4810 """Search Dashboards"""
4811 response = cast(
4812 Sequence[mdls.Dashboard],
4813 self.get(
4814 path="/dashboards/search",
4815 structure=Sequence[mdls.Dashboard],
4816 query_params={
4817 "id": id,
4818 "slug": slug,
4819 "title": title,
4820 "description": description,
4821 "content_favorite_id": content_favorite_id,
4822 "folder_id": folder_id,
4823 "deleted": deleted,
4824 "user_id": user_id,
4825 "view_count": view_count,
4826 "content_metadata_id": content_metadata_id,
4827 "curate": curate,
4828 "last_viewed_at": last_viewed_at,
4829 "fields": fields,
4830 "page": page,
4831 "per_page": per_page,
4832 "limit": limit,
4833 "offset": offset,
4834 "sorts": sorts,
4835 "filter_or": filter_or,
4836 "not_owned_by": not_owned_by,
4837 },
4838 transport_options=transport_options,
4839 ),
4840 )
4841 return response
4842
4843 # ### Import a LookML dashboard to a space as a UDD
4844 # Creates a UDD (a dashboard which exists in the Looker database rather than as a LookML file) from the LookML dashboard
4845 # and places it in the space specified. The created UDD will have a lookml_link_id which links to the original LookML dashboard.
4846 #
4847 # To give the imported dashboard specify a (e.g. title: "my title") in the body of your request, otherwise the imported
4848 # dashboard will have the same title as the original LookML dashboard.
4849 #
4850 # For this operation to succeed the user must have permission to see the LookML dashboard in question, and have permission to
4851 # create content in the space the dashboard is being imported to.
4852 #
4853 # **Sync** a linked UDD with [sync_lookml_dashboard()](#!/Dashboard/sync_lookml_dashboard)
4854 # **Unlink** a linked UDD by setting lookml_link_id to null with [update_dashboard()](#!/Dashboard/update_dashboard)
4855 #
4856 # POST /dashboards/{lookml_dashboard_id}/import/{space_id} -> mdls.Dashboard
4857 def import_lookml_dashboard(
4858 self,
4859 # Id of LookML dashboard
4860 lookml_dashboard_id: str,
4861 # Id of space to import the dashboard to
4862 space_id: str,
4863 body: Optional[mdls.WriteDashboard] = None,
4864 # If true, and this dashboard is localized, export it with the raw keys, not localized.
4865 raw_locale: Optional[bool] = None,
4866 transport_options: Optional[transport.TransportOptions] = None,
4867 ) -> mdls.Dashboard:
4868 """Import LookML Dashboard"""
4869 lookml_dashboard_id = self.encode_path_param(lookml_dashboard_id)
4870 space_id = self.encode_path_param(space_id)
4871 response = cast(
4872 mdls.Dashboard,
4873 self.post(
4874 path=f"/dashboards/{lookml_dashboard_id}/import/{space_id}",
4875 structure=mdls.Dashboard,
4876 query_params={"raw_locale": raw_locale},
4877 body=body,
4878 transport_options=transport_options,
4879 ),
4880 )
4881 return response
4882
4883 # ### Update all linked dashboards to match the specified LookML dashboard.
4884 #
4885 # Any UDD (a dashboard which exists in the Looker database rather than as a LookML file) which has a `lookml_link_id`
4886 # 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.
4887 #
4888 # If the dashboard_ids parameter is specified, only the dashboards with the specified ids will be updated.
4889 #
4890 # For this operation to succeed the user must have permission to view the LookML dashboard, and only linked dashboards
4891 # that the user has permission to update will be synced.
4892 #
4893 # To **link** or **unlink** a UDD set the `lookml_link_id` property with [update_dashboard()](#!/Dashboard/update_dashboard)
4894 #
4895 # PATCH /dashboards/{lookml_dashboard_id}/sync -> Sequence[int]
4896 def sync_lookml_dashboard(
4897 self,
4898 # Id of LookML dashboard, in the form 'model::dashboardname'
4899 lookml_dashboard_id: str,
4900 # If true, and this dashboard is localized, export it with the raw keys, not localized.
4901 raw_locale: Optional[bool] = None,
4902 # An array of UDD dashboard IDs to sync. If not specified, all UDD dashboards will be synced.
4903 dashboard_ids: Optional[mdls.DelimSequence[str]] = None,
4904 transport_options: Optional[transport.TransportOptions] = None,
4905 ) -> Sequence[int]:
4906 """Sync LookML Dashboard"""
4907 lookml_dashboard_id = self.encode_path_param(lookml_dashboard_id)
4908 response = cast(
4909 Sequence[int],
4910 self.patch(
4911 path=f"/dashboards/{lookml_dashboard_id}/sync",
4912 structure=Sequence[int],
4913 query_params={"raw_locale": raw_locale, "dashboard_ids": dashboard_ids},
4914 transport_options=transport_options,
4915 ),
4916 )
4917 return response
4918
4919 # ### Get information about a dashboard
4920 #
4921 # Returns the full details of the identified dashboard object
4922 #
4923 # Get a **summary list** of all active dashboards with [all_dashboards()](#!/Dashboard/all_dashboards)
4924 #
4925 # You can **Search** for dashboards with [search_dashboards()](#!/Dashboard/search_dashboards)
4926 #
4927 # GET /dashboards/{dashboard_id} -> mdls.Dashboard
4928 def dashboard(
4929 self,
4930 # Id of dashboard
4931 dashboard_id: str,
4932 # Requested fields.
4933 fields: Optional[str] = None,
4934 transport_options: Optional[transport.TransportOptions] = None,
4935 ) -> mdls.Dashboard:
4936 """Get Dashboard"""
4937 dashboard_id = self.encode_path_param(dashboard_id)
4938 response = cast(
4939 mdls.Dashboard,
4940 self.get(
4941 path=f"/dashboards/{dashboard_id}",
4942 structure=mdls.Dashboard,
4943 query_params={"fields": fields},
4944 transport_options=transport_options,
4945 ),
4946 )
4947 return response
4948
4949 # ### Update a dashboard
4950 #
4951 # You can use this function to change the string and integer properties of
4952 # a dashboard. Nested objects such as filters, dashboard elements, or dashboard layout components
4953 # cannot be modified by this function - use the update functions for the respective
4954 # nested object types (like [update_dashboard_filter()](#!/Dashboard/update_dashboard_filter) to change a filter)
4955 # to modify nested objects referenced by a dashboard.
4956 #
4957 # If you receive a 422 error response when updating a dashboard, be sure to look at the
4958 # response body for information about exactly which fields are missing or contain invalid data.
4959 #
4960 # PATCH /dashboards/{dashboard_id} -> mdls.Dashboard
4961 def update_dashboard(
4962 self,
4963 # Id of dashboard
4964 dashboard_id: str,
4965 body: mdls.WriteDashboard,
4966 transport_options: Optional[transport.TransportOptions] = None,
4967 ) -> mdls.Dashboard:
4968 """Update Dashboard"""
4969 dashboard_id = self.encode_path_param(dashboard_id)
4970 response = cast(
4971 mdls.Dashboard,
4972 self.patch(
4973 path=f"/dashboards/{dashboard_id}",
4974 structure=mdls.Dashboard,
4975 body=body,
4976 transport_options=transport_options,
4977 ),
4978 )
4979 return response
4980
4981 # ### Delete the dashboard with the specified id
4982 #
4983 # Permanently **deletes** a dashboard. (The dashboard cannot be recovered after this operation.)
4984 #
4985 # "Soft" delete or hide a dashboard by setting its `deleted` status to `True` with [update_dashboard()](#!/Dashboard/update_dashboard).
4986 #
4987 # Note: When a dashboard is deleted in the UI, it is soft deleted. Use this API call to permanently remove it, if desired.
4988 #
4989 # DELETE /dashboards/{dashboard_id} -> str
4990 def delete_dashboard(
4991 self,
4992 # Id of dashboard
4993 dashboard_id: str,
4994 transport_options: Optional[transport.TransportOptions] = None,
4995 ) -> str:
4996 """Delete Dashboard"""
4997 dashboard_id = self.encode_path_param(dashboard_id)
4998 response = cast(
4999 str,
5000 self.delete(
5001 path=f"/dashboards/{dashboard_id}",
5002 structure=str,
5003 transport_options=transport_options,
5004 ),
5005 )
5006 return response
5007
5008 # ### Get Aggregate Table LookML for Each Query on a Dashboard
5009 #
5010 # Returns a JSON object that contains the dashboard id and Aggregate Table lookml
5011 #
5012 # GET /dashboards/aggregate_table_lookml/{dashboard_id} -> mdls.DashboardAggregateTableLookml
5013 def dashboard_aggregate_table_lookml(
5014 self,
5015 # Id of dashboard
5016 dashboard_id: str,
5017 transport_options: Optional[transport.TransportOptions] = None,
5018 ) -> mdls.DashboardAggregateTableLookml:
5019 """Get Aggregate Table LookML for a dashboard"""
5020 dashboard_id = self.encode_path_param(dashboard_id)
5021 response = cast(
5022 mdls.DashboardAggregateTableLookml,
5023 self.get(
5024 path=f"/dashboards/aggregate_table_lookml/{dashboard_id}",
5025 structure=mdls.DashboardAggregateTableLookml,
5026 transport_options=transport_options,
5027 ),
5028 )
5029 return response
5030
5031 # ### Search LookML Dashboards
5032 #
5033 # Returns an array of **LookML Dashboard** objects that match the specified search criteria.
5034 # Note, this only returns LookML Dashboards in production.
5035 #
5036 # If multiple search params are given and `filter_or` is FALSE or not specified,
5037 # search params are combined in a logical AND operation.
5038 # Only rows that match *all* search param criteria will be returned.
5039 #
5040 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
5041 # Results will include rows that match **any** of the search criteria.
5042 #
5043 # String search params use case-insensitive matching.
5044 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
5045 # example="dan%" will match "danger" and "Danzig" but not "David"
5046 # example="D_m%" will match "Damage" and "dump"
5047 #
5048 # Integer search params can accept a single value or a comma separated list of values. The multiple
5049 # values will be combined under a logical OR operation - results will match at least one of
5050 # the given values.
5051 #
5052 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
5053 # or exclude (respectively) rows where the column is null.
5054 #
5055 # Boolean search params accept only "true" and "false" as values.
5056 #
5057 #
5058 # The parameters `limit`, and `offset` are recommended for fetching results in page-size chunks.
5059 #
5060 # Get a **single LookML dashboard** by id with [dashboard_lookml()](#!/Dashboard/dashboard_lookml)
5061 #
5062 # GET /dashboards/lookml/search -> mdls.DashboardLookml
5063 def search_lookml_dashboards(
5064 self,
5065 # Filter on a particular folder.
5066 folder_id: Optional[str] = None,
5067 # Match LookML Dashboard title.
5068 title: Optional[str] = None,
5069 # Filter on a content favorite id.
5070 content_favorite_id: Optional[str] = None,
5071 # Requested fields.
5072 fields: Optional[str] = None,
5073 # Number of results to return. (used with offset and takes priority over page and per_page)
5074 limit: Optional[int] = None,
5075 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
5076 offset: Optional[int] = None,
5077 # One or more fields to sort by. Sortable fields: [:title, :id, :folder_id, :content_favorite_id, :content_metadata_id]
5078 sorts: Optional[str] = None,
5079 transport_options: Optional[transport.TransportOptions] = None,
5080 ) -> mdls.DashboardLookml:
5081 """Search LookML Dashboards"""
5082 response = cast(
5083 mdls.DashboardLookml,
5084 self.get(
5085 path="/dashboards/lookml/search",
5086 structure=mdls.DashboardLookml,
5087 query_params={
5088 "folder_id": folder_id,
5089 "title": title,
5090 "content_favorite_id": content_favorite_id,
5091 "fields": fields,
5092 "limit": limit,
5093 "offset": offset,
5094 "sorts": sorts,
5095 },
5096 transport_options=transport_options,
5097 ),
5098 )
5099 return response
5100
5101 # ### Get lookml of a UDD
5102 #
5103 # Returns a JSON object that contains the dashboard id and the full lookml
5104 #
5105 # GET /dashboards/lookml/{dashboard_id} -> mdls.DashboardLookml
5106 def dashboard_lookml(
5107 self,
5108 # Id of dashboard
5109 dashboard_id: str,
5110 transport_options: Optional[transport.TransportOptions] = None,
5111 ) -> mdls.DashboardLookml:
5112 """Get lookml of a UDD"""
5113 dashboard_id = self.encode_path_param(dashboard_id)
5114 response = cast(
5115 mdls.DashboardLookml,
5116 self.get(
5117 path=f"/dashboards/lookml/{dashboard_id}",
5118 structure=mdls.DashboardLookml,
5119 transport_options=transport_options,
5120 ),
5121 )
5122 return response
5123
5124 # ### Move an existing dashboard
5125 #
5126 # Moves a dashboard to a specified folder, and returns the moved dashboard.
5127 #
5128 # `dashboard_id` and `folder_id` are required.
5129 # `dashboard_id` and `folder_id` must already exist, and `folder_id` must be different from the current `folder_id` of the dashboard.
5130 #
5131 # PATCH /dashboards/{dashboard_id}/move -> mdls.Dashboard
5132 def move_dashboard(
5133 self,
5134 # Dashboard id to move.
5135 dashboard_id: str,
5136 # Folder id to move to.
5137 folder_id: str,
5138 transport_options: Optional[transport.TransportOptions] = None,
5139 ) -> mdls.Dashboard:
5140 """Move Dashboard"""
5141 dashboard_id = self.encode_path_param(dashboard_id)
5142 response = cast(
5143 mdls.Dashboard,
5144 self.patch(
5145 path=f"/dashboards/{dashboard_id}/move",
5146 structure=mdls.Dashboard,
5147 query_params={"folder_id": folder_id},
5148 transport_options=transport_options,
5149 ),
5150 )
5151 return response
5152
5153 # ### Creates a dashboard object based on LookML Dashboard YAML, and returns the details of the newly created dashboard.
5154 #
5155 # If a dashboard exists with the YAML-defined "preferred_slug", the new dashboard will overwrite it. Otherwise, a new
5156 # dashboard will be created. Note that when a dashboard is overwritten, alerts will not be maintained.
5157 #
5158 # If a folder_id is specified: new dashboards will be placed in that folder, and overwritten dashboards will be moved to it
5159 # If the folder_id isn't specified: new dashboards will be placed in the caller's personal folder, and overwritten dashboards
5160 # will remain where they were
5161 #
5162 # LookML must contain valid LookML YAML code. It's recommended to use the LookML format returned
5163 # from [dashboard_lookml()](#!/Dashboard/dashboard_lookml) as the input LookML (newlines replaced with
5164 # ).
5165 #
5166 # Note that the created dashboard is not linked to any LookML Dashboard,
5167 # i.e. [sync_lookml_dashboard()](#!/Dashboard/sync_lookml_dashboard) will not update dashboards created by this method.
5168 #
5169 # POST /dashboards/lookml -> mdls.Dashboard
5170 def import_dashboard_from_lookml(
5171 self,
5172 body: mdls.WriteDashboardLookml,
5173 transport_options: Optional[transport.TransportOptions] = None,
5174 ) -> mdls.Dashboard:
5175 """Import Dashboard from LookML"""
5176 response = cast(
5177 mdls.Dashboard,
5178 self.post(
5179 path="/dashboards/lookml",
5180 structure=mdls.Dashboard,
5181 body=body,
5182 transport_options=transport_options,
5183 ),
5184 )
5185 return response
5186
5187 # # DEPRECATED: Use [import_dashboard_from_lookml()](#!/Dashboard/import_dashboard_from_lookml)
5188 #
5189 # POST /dashboards/from_lookml -> mdls.Dashboard
5190 def create_dashboard_from_lookml(
5191 self,
5192 body: mdls.WriteDashboardLookml,
5193 transport_options: Optional[transport.TransportOptions] = None,
5194 ) -> mdls.Dashboard:
5195 """Create Dashboard from LookML"""
5196 response = cast(
5197 mdls.Dashboard,
5198 self.post(
5199 path="/dashboards/from_lookml",
5200 structure=mdls.Dashboard,
5201 body=body,
5202 transport_options=transport_options,
5203 ),
5204 )
5205 return response
5206
5207 # ### Copy an existing dashboard
5208 #
5209 # Creates a copy of an existing dashboard, in a specified folder, and returns the copied dashboard.
5210 #
5211 # `dashboard_id` is required, `dashboard_id` and `folder_id` must already exist if specified.
5212 # `folder_id` will default to the existing folder.
5213 #
5214 # If a dashboard with the same title already exists in the target folder, the copy will have '(copy)'
5215 # or '(copy <# of copies>)' appended.
5216 #
5217 # POST /dashboards/{dashboard_id}/copy -> mdls.Dashboard
5218 def copy_dashboard(
5219 self,
5220 # Dashboard id to copy.
5221 dashboard_id: str,
5222 # Folder id to copy to.
5223 folder_id: Optional[str] = None,
5224 transport_options: Optional[transport.TransportOptions] = None,
5225 ) -> mdls.Dashboard:
5226 """Copy Dashboard"""
5227 dashboard_id = self.encode_path_param(dashboard_id)
5228 response = cast(
5229 mdls.Dashboard,
5230 self.post(
5231 path=f"/dashboards/{dashboard_id}/copy",
5232 structure=mdls.Dashboard,
5233 query_params={"folder_id": folder_id},
5234 transport_options=transport_options,
5235 ),
5236 )
5237 return response
5238
5239 # ### Search Dashboard Elements
5240 #
5241 # Returns an **array of DashboardElement objects** that match the specified search criteria.
5242 #
5243 # If multiple search params are given and `filter_or` is FALSE or not specified,
5244 # search params are combined in a logical AND operation.
5245 # Only rows that match *all* search param criteria will be returned.
5246 #
5247 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
5248 # Results will include rows that match **any** of the search criteria.
5249 #
5250 # String search params use case-insensitive matching.
5251 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
5252 # example="dan%" will match "danger" and "Danzig" but not "David"
5253 # example="D_m%" will match "Damage" and "dump"
5254 #
5255 # Integer search params can accept a single value or a comma separated list of values. The multiple
5256 # values will be combined under a logical OR operation - results will match at least one of
5257 # the given values.
5258 #
5259 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
5260 # or exclude (respectively) rows where the column is null.
5261 #
5262 # Boolean search params accept only "true" and "false" as values.
5263 #
5264 # GET /dashboard_elements/search -> Sequence[mdls.DashboardElement]
5265 def search_dashboard_elements(
5266 self,
5267 # Select elements that refer to a given dashboard id
5268 dashboard_id: Optional[str] = None,
5269 # Select elements that refer to a given look id
5270 look_id: Optional[str] = None,
5271 # Match the title of element
5272 title: Optional[str] = None,
5273 # Select soft-deleted dashboard elements
5274 deleted: Optional[bool] = None,
5275 # Requested fields.
5276 fields: Optional[str] = None,
5277 # Combine given search criteria in a boolean OR expression
5278 filter_or: Optional[bool] = None,
5279 # Fields to sort by. Sortable fields: [:look_id, :dashboard_id, :deleted, :title]
5280 sorts: Optional[str] = None,
5281 transport_options: Optional[transport.TransportOptions] = None,
5282 ) -> Sequence[mdls.DashboardElement]:
5283 """Search Dashboard Elements"""
5284 response = cast(
5285 Sequence[mdls.DashboardElement],
5286 self.get(
5287 path="/dashboard_elements/search",
5288 structure=Sequence[mdls.DashboardElement],
5289 query_params={
5290 "dashboard_id": dashboard_id,
5291 "look_id": look_id,
5292 "title": title,
5293 "deleted": deleted,
5294 "fields": fields,
5295 "filter_or": filter_or,
5296 "sorts": sorts,
5297 },
5298 transport_options=transport_options,
5299 ),
5300 )
5301 return response
5302
5303 # ### Get information about the dashboard element with a specific id.
5304 #
5305 # GET /dashboard_elements/{dashboard_element_id} -> mdls.DashboardElement
5306 def dashboard_element(
5307 self,
5308 # Id of dashboard element
5309 dashboard_element_id: str,
5310 # Requested fields.
5311 fields: Optional[str] = None,
5312 transport_options: Optional[transport.TransportOptions] = None,
5313 ) -> mdls.DashboardElement:
5314 """Get DashboardElement"""
5315 dashboard_element_id = self.encode_path_param(dashboard_element_id)
5316 response = cast(
5317 mdls.DashboardElement,
5318 self.get(
5319 path=f"/dashboard_elements/{dashboard_element_id}",
5320 structure=mdls.DashboardElement,
5321 query_params={"fields": fields},
5322 transport_options=transport_options,
5323 ),
5324 )
5325 return response
5326
5327 # ### Update the dashboard element with a specific id.
5328 #
5329 # PATCH /dashboard_elements/{dashboard_element_id} -> mdls.DashboardElement
5330 def update_dashboard_element(
5331 self,
5332 # Id of dashboard element
5333 dashboard_element_id: str,
5334 body: mdls.WriteDashboardElement,
5335 # Requested fields.
5336 fields: Optional[str] = None,
5337 transport_options: Optional[transport.TransportOptions] = None,
5338 ) -> mdls.DashboardElement:
5339 """Update DashboardElement"""
5340 dashboard_element_id = self.encode_path_param(dashboard_element_id)
5341 response = cast(
5342 mdls.DashboardElement,
5343 self.patch(
5344 path=f"/dashboard_elements/{dashboard_element_id}",
5345 structure=mdls.DashboardElement,
5346 query_params={"fields": fields},
5347 body=body,
5348 transport_options=transport_options,
5349 ),
5350 )
5351 return response
5352
5353 # ### Delete a dashboard element with a specific id.
5354 #
5355 # DELETE /dashboard_elements/{dashboard_element_id} -> str
5356 def delete_dashboard_element(
5357 self,
5358 # Id of dashboard element
5359 dashboard_element_id: str,
5360 transport_options: Optional[transport.TransportOptions] = None,
5361 ) -> str:
5362 """Delete DashboardElement"""
5363 dashboard_element_id = self.encode_path_param(dashboard_element_id)
5364 response = cast(
5365 str,
5366 self.delete(
5367 path=f"/dashboard_elements/{dashboard_element_id}",
5368 structure=str,
5369 transport_options=transport_options,
5370 ),
5371 )
5372 return response
5373
5374 # ### Get information about all the dashboard elements on a dashboard with a specific id.
5375 #
5376 # GET /dashboards/{dashboard_id}/dashboard_elements -> Sequence[mdls.DashboardElement]
5377 def dashboard_dashboard_elements(
5378 self,
5379 # Id of dashboard
5380 dashboard_id: str,
5381 # Requested fields.
5382 fields: Optional[str] = None,
5383 transport_options: Optional[transport.TransportOptions] = None,
5384 ) -> Sequence[mdls.DashboardElement]:
5385 """Get All DashboardElements"""
5386 dashboard_id = self.encode_path_param(dashboard_id)
5387 response = cast(
5388 Sequence[mdls.DashboardElement],
5389 self.get(
5390 path=f"/dashboards/{dashboard_id}/dashboard_elements",
5391 structure=Sequence[mdls.DashboardElement],
5392 query_params={"fields": fields},
5393 transport_options=transport_options,
5394 ),
5395 )
5396 return response
5397
5398 # ### Create a dashboard element on the dashboard with a specific id.
5399 #
5400 # POST /dashboard_elements -> mdls.DashboardElement
5401 def create_dashboard_element(
5402 self,
5403 body: mdls.WriteDashboardElement,
5404 # Requested fields.
5405 fields: Optional[str] = None,
5406 # Apply relevant filters on dashboard to this tile
5407 apply_filters: Optional[bool] = None,
5408 transport_options: Optional[transport.TransportOptions] = None,
5409 ) -> mdls.DashboardElement:
5410 """Create DashboardElement"""
5411 response = cast(
5412 mdls.DashboardElement,
5413 self.post(
5414 path="/dashboard_elements",
5415 structure=mdls.DashboardElement,
5416 query_params={"fields": fields, "apply_filters": apply_filters},
5417 body=body,
5418 transport_options=transport_options,
5419 ),
5420 )
5421 return response
5422
5423 # ### Get information about the dashboard filters with a specific id.
5424 #
5425 # GET /dashboard_filters/{dashboard_filter_id} -> mdls.DashboardFilter
5426 def dashboard_filter(
5427 self,
5428 # Id of dashboard filters
5429 dashboard_filter_id: str,
5430 # Requested fields.
5431 fields: Optional[str] = None,
5432 transport_options: Optional[transport.TransportOptions] = None,
5433 ) -> mdls.DashboardFilter:
5434 """Get Dashboard Filter"""
5435 dashboard_filter_id = self.encode_path_param(dashboard_filter_id)
5436 response = cast(
5437 mdls.DashboardFilter,
5438 self.get(
5439 path=f"/dashboard_filters/{dashboard_filter_id}",
5440 structure=mdls.DashboardFilter,
5441 query_params={"fields": fields},
5442 transport_options=transport_options,
5443 ),
5444 )
5445 return response
5446
5447 # ### Update the dashboard filter with a specific id.
5448 #
5449 # PATCH /dashboard_filters/{dashboard_filter_id} -> mdls.DashboardFilter
5450 def update_dashboard_filter(
5451 self,
5452 # Id of dashboard filter
5453 dashboard_filter_id: str,
5454 body: mdls.WriteDashboardFilter,
5455 # Requested fields.
5456 fields: Optional[str] = None,
5457 transport_options: Optional[transport.TransportOptions] = None,
5458 ) -> mdls.DashboardFilter:
5459 """Update Dashboard Filter"""
5460 dashboard_filter_id = self.encode_path_param(dashboard_filter_id)
5461 response = cast(
5462 mdls.DashboardFilter,
5463 self.patch(
5464 path=f"/dashboard_filters/{dashboard_filter_id}",
5465 structure=mdls.DashboardFilter,
5466 query_params={"fields": fields},
5467 body=body,
5468 transport_options=transport_options,
5469 ),
5470 )
5471 return response
5472
5473 # ### Delete a dashboard filter with a specific id.
5474 #
5475 # DELETE /dashboard_filters/{dashboard_filter_id} -> str
5476 def delete_dashboard_filter(
5477 self,
5478 # Id of dashboard filter
5479 dashboard_filter_id: str,
5480 transport_options: Optional[transport.TransportOptions] = None,
5481 ) -> str:
5482 """Delete Dashboard Filter"""
5483 dashboard_filter_id = self.encode_path_param(dashboard_filter_id)
5484 response = cast(
5485 str,
5486 self.delete(
5487 path=f"/dashboard_filters/{dashboard_filter_id}",
5488 structure=str,
5489 transport_options=transport_options,
5490 ),
5491 )
5492 return response
5493
5494 # ### Get information about all the dashboard filters on a dashboard with a specific id.
5495 #
5496 # GET /dashboards/{dashboard_id}/dashboard_filters -> Sequence[mdls.DashboardFilter]
5497 def dashboard_dashboard_filters(
5498 self,
5499 # Id of dashboard
5500 dashboard_id: str,
5501 # Requested fields.
5502 fields: Optional[str] = None,
5503 transport_options: Optional[transport.TransportOptions] = None,
5504 ) -> Sequence[mdls.DashboardFilter]:
5505 """Get All Dashboard Filters"""
5506 dashboard_id = self.encode_path_param(dashboard_id)
5507 response = cast(
5508 Sequence[mdls.DashboardFilter],
5509 self.get(
5510 path=f"/dashboards/{dashboard_id}/dashboard_filters",
5511 structure=Sequence[mdls.DashboardFilter],
5512 query_params={"fields": fields},
5513 transport_options=transport_options,
5514 ),
5515 )
5516 return response
5517
5518 # ### Create a dashboard filter on the dashboard with a specific id.
5519 #
5520 # POST /dashboard_filters -> mdls.DashboardFilter
5521 def create_dashboard_filter(
5522 self,
5523 body: mdls.WriteCreateDashboardFilter,
5524 # Requested fields
5525 fields: Optional[str] = None,
5526 transport_options: Optional[transport.TransportOptions] = None,
5527 ) -> mdls.DashboardFilter:
5528 """Create Dashboard Filter"""
5529 response = cast(
5530 mdls.DashboardFilter,
5531 self.post(
5532 path="/dashboard_filters",
5533 structure=mdls.DashboardFilter,
5534 query_params={"fields": fields},
5535 body=body,
5536 transport_options=transport_options,
5537 ),
5538 )
5539 return response
5540
5541 # ### Get information about the dashboard elements with a specific id.
5542 #
5543 # GET /dashboard_layout_components/{dashboard_layout_component_id} -> mdls.DashboardLayoutComponent
5544 def dashboard_layout_component(
5545 self,
5546 # Id of dashboard layout component
5547 dashboard_layout_component_id: str,
5548 # Requested fields.
5549 fields: Optional[str] = None,
5550 transport_options: Optional[transport.TransportOptions] = None,
5551 ) -> mdls.DashboardLayoutComponent:
5552 """Get DashboardLayoutComponent"""
5553 dashboard_layout_component_id = self.encode_path_param(
5554 dashboard_layout_component_id
5555 )
5556 response = cast(
5557 mdls.DashboardLayoutComponent,
5558 self.get(
5559 path=f"/dashboard_layout_components/{dashboard_layout_component_id}",
5560 structure=mdls.DashboardLayoutComponent,
5561 query_params={"fields": fields},
5562 transport_options=transport_options,
5563 ),
5564 )
5565 return response
5566
5567 # ### Update the dashboard element with a specific id.
5568 #
5569 # PATCH /dashboard_layout_components/{dashboard_layout_component_id} -> mdls.DashboardLayoutComponent
5570 def update_dashboard_layout_component(
5571 self,
5572 # Id of dashboard layout component
5573 dashboard_layout_component_id: str,
5574 body: mdls.WriteDashboardLayoutComponent,
5575 # Requested fields.
5576 fields: Optional[str] = None,
5577 transport_options: Optional[transport.TransportOptions] = None,
5578 ) -> mdls.DashboardLayoutComponent:
5579 """Update DashboardLayoutComponent"""
5580 dashboard_layout_component_id = self.encode_path_param(
5581 dashboard_layout_component_id
5582 )
5583 response = cast(
5584 mdls.DashboardLayoutComponent,
5585 self.patch(
5586 path=f"/dashboard_layout_components/{dashboard_layout_component_id}",
5587 structure=mdls.DashboardLayoutComponent,
5588 query_params={"fields": fields},
5589 body=body,
5590 transport_options=transport_options,
5591 ),
5592 )
5593 return response
5594
5595 # ### Get information about all the dashboard layout components for a dashboard layout with a specific id.
5596 #
5597 # GET /dashboard_layouts/{dashboard_layout_id}/dashboard_layout_components -> Sequence[mdls.DashboardLayoutComponent]
5598 def dashboard_layout_dashboard_layout_components(
5599 self,
5600 # Id of dashboard layout component
5601 dashboard_layout_id: str,
5602 # Requested fields.
5603 fields: Optional[str] = None,
5604 transport_options: Optional[transport.TransportOptions] = None,
5605 ) -> Sequence[mdls.DashboardLayoutComponent]:
5606 """Get All DashboardLayoutComponents"""
5607 dashboard_layout_id = self.encode_path_param(dashboard_layout_id)
5608 response = cast(
5609 Sequence[mdls.DashboardLayoutComponent],
5610 self.get(
5611 path=f"/dashboard_layouts/{dashboard_layout_id}/dashboard_layout_components",
5612 structure=Sequence[mdls.DashboardLayoutComponent],
5613 query_params={"fields": fields},
5614 transport_options=transport_options,
5615 ),
5616 )
5617 return response
5618
5619 # ### Get information about the dashboard layouts with a specific id.
5620 #
5621 # GET /dashboard_layouts/{dashboard_layout_id} -> mdls.DashboardLayout
5622 def dashboard_layout(
5623 self,
5624 # Id of dashboard layouts
5625 dashboard_layout_id: str,
5626 # Requested fields.
5627 fields: Optional[str] = None,
5628 transport_options: Optional[transport.TransportOptions] = None,
5629 ) -> mdls.DashboardLayout:
5630 """Get DashboardLayout"""
5631 dashboard_layout_id = self.encode_path_param(dashboard_layout_id)
5632 response = cast(
5633 mdls.DashboardLayout,
5634 self.get(
5635 path=f"/dashboard_layouts/{dashboard_layout_id}",
5636 structure=mdls.DashboardLayout,
5637 query_params={"fields": fields},
5638 transport_options=transport_options,
5639 ),
5640 )
5641 return response
5642
5643 # ### Update the dashboard layout with a specific id.
5644 #
5645 # PATCH /dashboard_layouts/{dashboard_layout_id} -> mdls.DashboardLayout
5646 def update_dashboard_layout(
5647 self,
5648 # Id of dashboard layout
5649 dashboard_layout_id: str,
5650 body: mdls.WriteDashboardLayout,
5651 # Requested fields.
5652 fields: Optional[str] = None,
5653 transport_options: Optional[transport.TransportOptions] = None,
5654 ) -> mdls.DashboardLayout:
5655 """Update DashboardLayout"""
5656 dashboard_layout_id = self.encode_path_param(dashboard_layout_id)
5657 response = cast(
5658 mdls.DashboardLayout,
5659 self.patch(
5660 path=f"/dashboard_layouts/{dashboard_layout_id}",
5661 structure=mdls.DashboardLayout,
5662 query_params={"fields": fields},
5663 body=body,
5664 transport_options=transport_options,
5665 ),
5666 )
5667 return response
5668
5669 # ### Delete a dashboard layout with a specific id.
5670 #
5671 # DELETE /dashboard_layouts/{dashboard_layout_id} -> str
5672 def delete_dashboard_layout(
5673 self,
5674 # Id of dashboard layout
5675 dashboard_layout_id: str,
5676 transport_options: Optional[transport.TransportOptions] = None,
5677 ) -> str:
5678 """Delete DashboardLayout"""
5679 dashboard_layout_id = self.encode_path_param(dashboard_layout_id)
5680 response = cast(
5681 str,
5682 self.delete(
5683 path=f"/dashboard_layouts/{dashboard_layout_id}",
5684 structure=str,
5685 transport_options=transport_options,
5686 ),
5687 )
5688 return response
5689
5690 # ### Get information about all the dashboard elements on a dashboard with a specific id.
5691 #
5692 # GET /dashboards/{dashboard_id}/dashboard_layouts -> Sequence[mdls.DashboardLayout]
5693 def dashboard_dashboard_layouts(
5694 self,
5695 # Id of dashboard
5696 dashboard_id: str,
5697 # Requested fields.
5698 fields: Optional[str] = None,
5699 transport_options: Optional[transport.TransportOptions] = None,
5700 ) -> Sequence[mdls.DashboardLayout]:
5701 """Get All DashboardLayouts"""
5702 dashboard_id = self.encode_path_param(dashboard_id)
5703 response = cast(
5704 Sequence[mdls.DashboardLayout],
5705 self.get(
5706 path=f"/dashboards/{dashboard_id}/dashboard_layouts",
5707 structure=Sequence[mdls.DashboardLayout],
5708 query_params={"fields": fields},
5709 transport_options=transport_options,
5710 ),
5711 )
5712 return response
5713
5714 # ### Create a dashboard layout on the dashboard with a specific id.
5715 #
5716 # POST /dashboard_layouts -> mdls.DashboardLayout
5717 def create_dashboard_layout(
5718 self,
5719 body: mdls.WriteDashboardLayout,
5720 # Requested fields.
5721 fields: Optional[str] = None,
5722 transport_options: Optional[transport.TransportOptions] = None,
5723 ) -> mdls.DashboardLayout:
5724 """Create DashboardLayout"""
5725 response = cast(
5726 mdls.DashboardLayout,
5727 self.post(
5728 path="/dashboard_layouts",
5729 structure=mdls.DashboardLayout,
5730 query_params={"fields": fields},
5731 body=body,
5732 transport_options=transport_options,
5733 ),
5734 )
5735 return response
5736
5737 # endregion
5738
5739 # region DataAction: Run Data Actions
5740
5741 # Perform a data action. The data action object can be obtained from query results, and used to perform an arbitrary action.
5742 #
5743 # POST /data_actions -> mdls.DataActionResponse
5744 def perform_data_action(
5745 self,
5746 body: mdls.DataActionRequest,
5747 transport_options: Optional[transport.TransportOptions] = None,
5748 ) -> mdls.DataActionResponse:
5749 """Send a Data Action"""
5750 response = cast(
5751 mdls.DataActionResponse,
5752 self.post(
5753 path="/data_actions",
5754 structure=mdls.DataActionResponse,
5755 body=body,
5756 transport_options=transport_options,
5757 ),
5758 )
5759 return response
5760
5761 # 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.
5762 #
5763 # POST /data_actions/form -> mdls.DataActionForm
5764 def fetch_remote_data_action_form(
5765 self,
5766 body: MutableMapping[str, Any],
5767 transport_options: Optional[transport.TransportOptions] = None,
5768 ) -> mdls.DataActionForm:
5769 """Fetch Remote Data Action Form"""
5770 response = cast(
5771 mdls.DataActionForm,
5772 self.post(
5773 path="/data_actions/form",
5774 structure=mdls.DataActionForm,
5775 body=body,
5776 transport_options=transport_options,
5777 ),
5778 )
5779 return response
5780
5781 # endregion
5782
5783 # region Datagroup: Manage Datagroups
5784
5785 # ### Get information about all datagroups.
5786 #
5787 # GET /datagroups -> Sequence[mdls.Datagroup]
5788 def all_datagroups(
5789 self,
5790 transport_options: Optional[transport.TransportOptions] = None,
5791 ) -> Sequence[mdls.Datagroup]:
5792 """Get All Datagroups"""
5793 response = cast(
5794 Sequence[mdls.Datagroup],
5795 self.get(
5796 path="/datagroups",
5797 structure=Sequence[mdls.Datagroup],
5798 transport_options=transport_options,
5799 ),
5800 )
5801 return response
5802
5803 # ### Get information about a datagroup.
5804 #
5805 # GET /datagroups/{datagroup_id} -> mdls.Datagroup
5806 def datagroup(
5807 self,
5808 # ID of datagroup.
5809 datagroup_id: str,
5810 transport_options: Optional[transport.TransportOptions] = None,
5811 ) -> mdls.Datagroup:
5812 """Get Datagroup"""
5813 datagroup_id = self.encode_path_param(datagroup_id)
5814 response = cast(
5815 mdls.Datagroup,
5816 self.get(
5817 path=f"/datagroups/{datagroup_id}",
5818 structure=mdls.Datagroup,
5819 transport_options=transport_options,
5820 ),
5821 )
5822 return response
5823
5824 # ### Update a datagroup using the specified params.
5825 #
5826 # PATCH /datagroups/{datagroup_id} -> mdls.Datagroup
5827 def update_datagroup(
5828 self,
5829 # ID of datagroup.
5830 datagroup_id: str,
5831 body: mdls.WriteDatagroup,
5832 transport_options: Optional[transport.TransportOptions] = None,
5833 ) -> mdls.Datagroup:
5834 """Update Datagroup"""
5835 datagroup_id = self.encode_path_param(datagroup_id)
5836 response = cast(
5837 mdls.Datagroup,
5838 self.patch(
5839 path=f"/datagroups/{datagroup_id}",
5840 structure=mdls.Datagroup,
5841 body=body,
5842 transport_options=transport_options,
5843 ),
5844 )
5845 return response
5846
5847 # endregion
5848
5849 # region DerivedTable: View Derived Table graphs
5850
5851 # ### Discover information about derived tables
5852 #
5853 # GET /derived_table/graph/model/{model} -> mdls.DependencyGraph
5854 def graph_derived_tables_for_model(
5855 self,
5856 # The name of the Lookml model.
5857 model: str,
5858 # The format of the graph. Valid values are [dot]. Default is `dot`
5859 format: Optional[str] = None,
5860 # Color denoting the build status of the graph. Grey = not built, green = built, yellow = building, red = error.
5861 color: Optional[str] = None,
5862 transport_options: Optional[transport.TransportOptions] = None,
5863 ) -> mdls.DependencyGraph:
5864 """Get Derived Table graph for model"""
5865 model = self.encode_path_param(model)
5866 response = cast(
5867 mdls.DependencyGraph,
5868 self.get(
5869 path=f"/derived_table/graph/model/{model}",
5870 structure=mdls.DependencyGraph,
5871 query_params={"format": format, "color": color},
5872 transport_options=transport_options,
5873 ),
5874 )
5875 return response
5876
5877 # ### Get the subgraph representing this derived table and its dependencies.
5878 #
5879 # GET /derived_table/graph/view/{view} -> mdls.DependencyGraph
5880 def graph_derived_tables_for_view(
5881 self,
5882 # The derived table's view name.
5883 view: str,
5884 # The models where this derived table is defined.
5885 models: Optional[str] = None,
5886 # The model directory to look in, either `dev` or `production`.
5887 workspace: Optional[str] = None,
5888 transport_options: Optional[transport.TransportOptions] = None,
5889 ) -> mdls.DependencyGraph:
5890 """Get subgraph of derived table and dependencies"""
5891 view = self.encode_path_param(view)
5892 response = cast(
5893 mdls.DependencyGraph,
5894 self.get(
5895 path=f"/derived_table/graph/view/{view}",
5896 structure=mdls.DependencyGraph,
5897 query_params={"models": models, "workspace": workspace},
5898 transport_options=transport_options,
5899 ),
5900 )
5901 return response
5902
5903 # Enqueue materialization for a PDT with the given model name and view name
5904 #
5905 # GET /derived_table/{model_name}/{view_name}/start -> mdls.MaterializePDT
5906 def start_pdt_build(
5907 self,
5908 # The model of the PDT to start building.
5909 model_name: str,
5910 # The view name of the PDT to start building.
5911 view_name: str,
5912 # Force rebuild of required dependent PDTs, even if they are already materialized.
5913 force_rebuild: Optional[str] = None,
5914 # Force involved incremental PDTs to fully re-materialize.
5915 force_full_incremental: Optional[str] = None,
5916 # Workspace in which to materialize selected PDT ('dev' or default 'production').
5917 workspace: Optional[str] = None,
5918 # The source of this request.
5919 source: Optional[str] = None,
5920 transport_options: Optional[transport.TransportOptions] = None,
5921 ) -> mdls.MaterializePDT:
5922 """Start a PDT materialization"""
5923 model_name = self.encode_path_param(model_name)
5924 view_name = self.encode_path_param(view_name)
5925 response = cast(
5926 mdls.MaterializePDT,
5927 self.get(
5928 path=f"/derived_table/{model_name}/{view_name}/start",
5929 structure=mdls.MaterializePDT,
5930 query_params={
5931 "force_rebuild": force_rebuild,
5932 "force_full_incremental": force_full_incremental,
5933 "workspace": workspace,
5934 "source": source,
5935 },
5936 transport_options=transport_options,
5937 ),
5938 )
5939 return response
5940
5941 # Check status of PDT materialization
5942 #
5943 # GET /derived_table/{materialization_id}/status -> mdls.MaterializePDT
5944 def check_pdt_build(
5945 self,
5946 # The materialization id to check status for.
5947 materialization_id: str,
5948 transport_options: Optional[transport.TransportOptions] = None,
5949 ) -> mdls.MaterializePDT:
5950 """Check status of a PDT materialization"""
5951 materialization_id = self.encode_path_param(materialization_id)
5952 response = cast(
5953 mdls.MaterializePDT,
5954 self.get(
5955 path=f"/derived_table/{materialization_id}/status",
5956 structure=mdls.MaterializePDT,
5957 transport_options=transport_options,
5958 ),
5959 )
5960 return response
5961
5962 # Stop a PDT materialization
5963 #
5964 # GET /derived_table/{materialization_id}/stop -> mdls.MaterializePDT
5965 def stop_pdt_build(
5966 self,
5967 # The materialization id to stop.
5968 materialization_id: str,
5969 # The source of this request.
5970 source: Optional[str] = None,
5971 transport_options: Optional[transport.TransportOptions] = None,
5972 ) -> mdls.MaterializePDT:
5973 """Stop a PDT materialization"""
5974 materialization_id = self.encode_path_param(materialization_id)
5975 response = cast(
5976 mdls.MaterializePDT,
5977 self.get(
5978 path=f"/derived_table/{materialization_id}/stop",
5979 structure=mdls.MaterializePDT,
5980 query_params={"source": source},
5981 transport_options=transport_options,
5982 ),
5983 )
5984 return response
5985
5986 # endregion
5987
5988 # region Folder: Manage Folders
5989
5990 # Search for folders by creator id, parent id, name, etc
5991 #
5992 # GET /folders/search -> Sequence[mdls.Folder]
5993 def search_folders(
5994 self,
5995 # Requested fields.
5996 fields: Optional[str] = None,
5997 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
5998 page: Optional[int] = None,
5999 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
6000 per_page: Optional[int] = None,
6001 # Number of results to return. (used with offset and takes priority over page and per_page)
6002 limit: Optional[int] = None,
6003 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
6004 offset: Optional[int] = None,
6005 # Fields to sort by.
6006 sorts: Optional[str] = None,
6007 # Match Space title.
6008 name: Optional[str] = None,
6009 # Match Space id
6010 id: Optional[str] = None,
6011 # Filter on a children of a particular folder.
6012 parent_id: Optional[str] = None,
6013 # Filter on folder created by a particular user.
6014 creator_id: Optional[str] = None,
6015 # Combine given search criteria in a boolean OR expression
6016 filter_or: Optional[bool] = None,
6017 # Match is shared root
6018 is_shared_root: Optional[bool] = None,
6019 # Match is users root
6020 is_users_root: Optional[bool] = None,
6021 transport_options: Optional[transport.TransportOptions] = None,
6022 ) -> Sequence[mdls.Folder]:
6023 """Search Folders"""
6024 response = cast(
6025 Sequence[mdls.Folder],
6026 self.get(
6027 path="/folders/search",
6028 structure=Sequence[mdls.Folder],
6029 query_params={
6030 "fields": fields,
6031 "page": page,
6032 "per_page": per_page,
6033 "limit": limit,
6034 "offset": offset,
6035 "sorts": sorts,
6036 "name": name,
6037 "id": id,
6038 "parent_id": parent_id,
6039 "creator_id": creator_id,
6040 "filter_or": filter_or,
6041 "is_shared_root": is_shared_root,
6042 "is_users_root": is_users_root,
6043 },
6044 transport_options=transport_options,
6045 ),
6046 )
6047 return response
6048
6049 # ### Get information about the folder with a specific id.
6050 #
6051 # GET /folders/{folder_id} -> mdls.Folder
6052 def folder(
6053 self,
6054 # Id of folder
6055 folder_id: str,
6056 # Requested fields.
6057 fields: Optional[str] = None,
6058 transport_options: Optional[transport.TransportOptions] = None,
6059 ) -> mdls.Folder:
6060 """Get Folder"""
6061 folder_id = self.encode_path_param(folder_id)
6062 response = cast(
6063 mdls.Folder,
6064 self.get(
6065 path=f"/folders/{folder_id}",
6066 structure=mdls.Folder,
6067 query_params={"fields": fields},
6068 transport_options=transport_options,
6069 ),
6070 )
6071 return response
6072
6073 # ### Update the folder with a specific id.
6074 #
6075 # PATCH /folders/{folder_id} -> mdls.Folder
6076 def update_folder(
6077 self,
6078 # Id of folder
6079 folder_id: str,
6080 body: mdls.UpdateFolder,
6081 transport_options: Optional[transport.TransportOptions] = None,
6082 ) -> mdls.Folder:
6083 """Update Folder"""
6084 folder_id = self.encode_path_param(folder_id)
6085 response = cast(
6086 mdls.Folder,
6087 self.patch(
6088 path=f"/folders/{folder_id}",
6089 structure=mdls.Folder,
6090 body=body,
6091 transport_options=transport_options,
6092 ),
6093 )
6094 return response
6095
6096 # ### Delete the folder with a specific id including any children folders.
6097 # **DANGER** this will delete all looks and dashboards in the folder.
6098 #
6099 # DELETE /folders/{folder_id} -> str
6100 def delete_folder(
6101 self,
6102 # Id of folder
6103 folder_id: str,
6104 transport_options: Optional[transport.TransportOptions] = None,
6105 ) -> str:
6106 """Delete Folder"""
6107 folder_id = self.encode_path_param(folder_id)
6108 response = cast(
6109 str,
6110 self.delete(
6111 path=f"/folders/{folder_id}",
6112 structure=str,
6113 transport_options=transport_options,
6114 ),
6115 )
6116 return response
6117
6118 # ### Get information about all folders.
6119 #
6120 # All personal folders will be returned.
6121 #
6122 # GET /folders -> Sequence[mdls.FolderBase]
6123 def all_folders(
6124 self,
6125 # Requested fields.
6126 fields: Optional[str] = None,
6127 transport_options: Optional[transport.TransportOptions] = None,
6128 ) -> Sequence[mdls.FolderBase]:
6129 """Get All Folders"""
6130 response = cast(
6131 Sequence[mdls.FolderBase],
6132 self.get(
6133 path="/folders",
6134 structure=Sequence[mdls.FolderBase],
6135 query_params={"fields": fields},
6136 transport_options=transport_options,
6137 ),
6138 )
6139 return response
6140
6141 # ### Create a folder with specified information.
6142 #
6143 # Caller must have permission to edit the parent folder and to create folders, otherwise the request
6144 # returns 404 Not Found.
6145 #
6146 # POST /folders -> mdls.Folder
6147 def create_folder(
6148 self,
6149 body: mdls.CreateFolder,
6150 transport_options: Optional[transport.TransportOptions] = None,
6151 ) -> mdls.Folder:
6152 """Create Folder"""
6153 response = cast(
6154 mdls.Folder,
6155 self.post(
6156 path="/folders",
6157 structure=mdls.Folder,
6158 body=body,
6159 transport_options=transport_options,
6160 ),
6161 )
6162 return response
6163
6164 # ### Get the children of a folder.
6165 #
6166 # GET /folders/{folder_id}/children -> Sequence[mdls.Folder]
6167 def folder_children(
6168 self,
6169 # Id of folder
6170 folder_id: str,
6171 # Requested fields.
6172 fields: Optional[str] = None,
6173 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
6174 page: Optional[int] = None,
6175 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
6176 per_page: Optional[int] = None,
6177 # Number of results to return. (used with offset and takes priority over page and per_page)
6178 limit: Optional[int] = None,
6179 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
6180 offset: Optional[int] = None,
6181 # Fields to sort by.
6182 sorts: Optional[str] = None,
6183 transport_options: Optional[transport.TransportOptions] = None,
6184 ) -> Sequence[mdls.Folder]:
6185 """Get Folder Children"""
6186 folder_id = self.encode_path_param(folder_id)
6187 response = cast(
6188 Sequence[mdls.Folder],
6189 self.get(
6190 path=f"/folders/{folder_id}/children",
6191 structure=Sequence[mdls.Folder],
6192 query_params={
6193 "fields": fields,
6194 "page": page,
6195 "per_page": per_page,
6196 "limit": limit,
6197 "offset": offset,
6198 "sorts": sorts,
6199 },
6200 transport_options=transport_options,
6201 ),
6202 )
6203 return response
6204
6205 # ### Search the children of a folder
6206 #
6207 # GET /folders/{folder_id}/children/search -> Sequence[mdls.Folder]
6208 def folder_children_search(
6209 self,
6210 # Id of folder
6211 folder_id: str,
6212 # Requested fields.
6213 fields: Optional[str] = None,
6214 # Fields to sort by.
6215 sorts: Optional[str] = None,
6216 # Match folder name.
6217 name: Optional[str] = None,
6218 transport_options: Optional[transport.TransportOptions] = None,
6219 ) -> Sequence[mdls.Folder]:
6220 """Search Folder Children"""
6221 folder_id = self.encode_path_param(folder_id)
6222 response = cast(
6223 Sequence[mdls.Folder],
6224 self.get(
6225 path=f"/folders/{folder_id}/children/search",
6226 structure=Sequence[mdls.Folder],
6227 query_params={"fields": fields, "sorts": sorts, "name": name},
6228 transport_options=transport_options,
6229 ),
6230 )
6231 return response
6232
6233 # ### Get the parent of a folder
6234 #
6235 # GET /folders/{folder_id}/parent -> mdls.Folder
6236 def folder_parent(
6237 self,
6238 # Id of folder
6239 folder_id: str,
6240 # Requested fields.
6241 fields: Optional[str] = None,
6242 transport_options: Optional[transport.TransportOptions] = None,
6243 ) -> mdls.Folder:
6244 """Get Folder Parent"""
6245 folder_id = self.encode_path_param(folder_id)
6246 response = cast(
6247 mdls.Folder,
6248 self.get(
6249 path=f"/folders/{folder_id}/parent",
6250 structure=mdls.Folder,
6251 query_params={"fields": fields},
6252 transport_options=transport_options,
6253 ),
6254 )
6255 return response
6256
6257 # ### Get the ancestors of a folder
6258 #
6259 # GET /folders/{folder_id}/ancestors -> Sequence[mdls.Folder]
6260 def folder_ancestors(
6261 self,
6262 # Id of folder
6263 folder_id: str,
6264 # Requested fields.
6265 fields: Optional[str] = None,
6266 transport_options: Optional[transport.TransportOptions] = None,
6267 ) -> Sequence[mdls.Folder]:
6268 """Get Folder Ancestors"""
6269 folder_id = self.encode_path_param(folder_id)
6270 response = cast(
6271 Sequence[mdls.Folder],
6272 self.get(
6273 path=f"/folders/{folder_id}/ancestors",
6274 structure=Sequence[mdls.Folder],
6275 query_params={"fields": fields},
6276 transport_options=transport_options,
6277 ),
6278 )
6279 return response
6280
6281 # ### Get all looks in a folder.
6282 # In API 4.0+, all looks in a folder will be returned, excluding looks in the trash.
6283 #
6284 # GET /folders/{folder_id}/looks -> Sequence[mdls.LookWithQuery]
6285 def folder_looks(
6286 self,
6287 # Id of folder
6288 folder_id: str,
6289 # Requested fields.
6290 fields: Optional[str] = None,
6291 transport_options: Optional[transport.TransportOptions] = None,
6292 ) -> Sequence[mdls.LookWithQuery]:
6293 """Get Folder Looks"""
6294 folder_id = self.encode_path_param(folder_id)
6295 response = cast(
6296 Sequence[mdls.LookWithQuery],
6297 self.get(
6298 path=f"/folders/{folder_id}/looks",
6299 structure=Sequence[mdls.LookWithQuery],
6300 query_params={"fields": fields},
6301 transport_options=transport_options,
6302 ),
6303 )
6304 return response
6305
6306 # ### Get the dashboards in a folder
6307 #
6308 # GET /folders/{folder_id}/dashboards -> Sequence[mdls.Dashboard]
6309 def folder_dashboards(
6310 self,
6311 # Id of folder
6312 folder_id: str,
6313 # Requested fields.
6314 fields: Optional[str] = None,
6315 transport_options: Optional[transport.TransportOptions] = None,
6316 ) -> Sequence[mdls.Dashboard]:
6317 """Get Folder Dashboards"""
6318 folder_id = self.encode_path_param(folder_id)
6319 response = cast(
6320 Sequence[mdls.Dashboard],
6321 self.get(
6322 path=f"/folders/{folder_id}/dashboards",
6323 structure=Sequence[mdls.Dashboard],
6324 query_params={"fields": fields},
6325 transport_options=transport_options,
6326 ),
6327 )
6328 return response
6329
6330 # endregion
6331
6332 # region Group: Manage Groups
6333
6334 # ### Get information about all groups.
6335 #
6336 # GET /groups -> Sequence[mdls.Group]
6337 def all_groups(
6338 self,
6339 # Requested fields.
6340 fields: Optional[str] = None,
6341 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
6342 page: Optional[int] = None,
6343 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
6344 per_page: Optional[int] = None,
6345 # Number of results to return. (used with offset and takes priority over page and per_page)
6346 limit: Optional[int] = None,
6347 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
6348 offset: Optional[int] = None,
6349 # Fields to sort by.
6350 sorts: Optional[str] = None,
6351 # Optional of ids to get specific groups.
6352 ids: Optional[mdls.DelimSequence[str]] = None,
6353 # Id of content metadata to which groups must have access.
6354 content_metadata_id: Optional[str] = None,
6355 # Select only groups that either can/cannot be given access to content.
6356 can_add_to_content_metadata: Optional[bool] = None,
6357 transport_options: Optional[transport.TransportOptions] = None,
6358 ) -> Sequence[mdls.Group]:
6359 """Get All Groups"""
6360 response = cast(
6361 Sequence[mdls.Group],
6362 self.get(
6363 path="/groups",
6364 structure=Sequence[mdls.Group],
6365 query_params={
6366 "fields": fields,
6367 "page": page,
6368 "per_page": per_page,
6369 "limit": limit,
6370 "offset": offset,
6371 "sorts": sorts,
6372 "ids": ids,
6373 "content_metadata_id": content_metadata_id,
6374 "can_add_to_content_metadata": can_add_to_content_metadata,
6375 },
6376 transport_options=transport_options,
6377 ),
6378 )
6379 return response
6380
6381 # ### Creates a new group (admin only).
6382 #
6383 # POST /groups -> mdls.Group
6384 def create_group(
6385 self,
6386 body: mdls.WriteGroup,
6387 # Requested fields.
6388 fields: Optional[str] = None,
6389 transport_options: Optional[transport.TransportOptions] = None,
6390 ) -> mdls.Group:
6391 """Create Group"""
6392 response = cast(
6393 mdls.Group,
6394 self.post(
6395 path="/groups",
6396 structure=mdls.Group,
6397 query_params={"fields": fields},
6398 body=body,
6399 transport_options=transport_options,
6400 ),
6401 )
6402 return response
6403
6404 # ### Search groups
6405 #
6406 # Returns all group records that match the given search criteria.
6407 #
6408 # If multiple search params are given and `filter_or` is FALSE or not specified,
6409 # search params are combined in a logical AND operation.
6410 # Only rows that match *all* search param criteria will be returned.
6411 #
6412 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
6413 # Results will include rows that match **any** of the search criteria.
6414 #
6415 # String search params use case-insensitive matching.
6416 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
6417 # example="dan%" will match "danger" and "Danzig" but not "David"
6418 # example="D_m%" will match "Damage" and "dump"
6419 #
6420 # Integer search params can accept a single value or a comma separated list of values. The multiple
6421 # values will be combined under a logical OR operation - results will match at least one of
6422 # the given values.
6423 #
6424 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
6425 # or exclude (respectively) rows where the column is null.
6426 #
6427 # Boolean search params accept only "true" and "false" as values.
6428 #
6429 # GET /groups/search -> Sequence[mdls.Group]
6430 def search_groups(
6431 self,
6432 # Requested fields.
6433 fields: Optional[str] = None,
6434 # Number of results to return (used with `offset`).
6435 limit: Optional[int] = None,
6436 # Number of results to skip before returning any (used with `limit`).
6437 offset: Optional[int] = None,
6438 # Fields to sort by.
6439 sorts: Optional[str] = None,
6440 # Combine given search criteria in a boolean OR expression
6441 filter_or: Optional[bool] = None,
6442 # Match group id.
6443 id: Optional[str] = None,
6444 # Match group name.
6445 name: Optional[str] = None,
6446 # Match group external_group_id.
6447 external_group_id: Optional[str] = None,
6448 # Match group externally_managed.
6449 externally_managed: Optional[bool] = None,
6450 # Match group externally_orphaned.
6451 externally_orphaned: Optional[bool] = None,
6452 transport_options: Optional[transport.TransportOptions] = None,
6453 ) -> Sequence[mdls.Group]:
6454 """Search Groups"""
6455 response = cast(
6456 Sequence[mdls.Group],
6457 self.get(
6458 path="/groups/search",
6459 structure=Sequence[mdls.Group],
6460 query_params={
6461 "fields": fields,
6462 "limit": limit,
6463 "offset": offset,
6464 "sorts": sorts,
6465 "filter_or": filter_or,
6466 "id": id,
6467 "name": name,
6468 "external_group_id": external_group_id,
6469 "externally_managed": externally_managed,
6470 "externally_orphaned": externally_orphaned,
6471 },
6472 transport_options=transport_options,
6473 ),
6474 )
6475 return response
6476
6477 # ### Search groups include roles
6478 #
6479 # Returns all group records that match the given search criteria, and attaches any associated roles.
6480 #
6481 # If multiple search params are given and `filter_or` is FALSE or not specified,
6482 # search params are combined in a logical AND operation.
6483 # Only rows that match *all* search param criteria will be returned.
6484 #
6485 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
6486 # Results will include rows that match **any** of the search criteria.
6487 #
6488 # String search params use case-insensitive matching.
6489 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
6490 # example="dan%" will match "danger" and "Danzig" but not "David"
6491 # example="D_m%" will match "Damage" and "dump"
6492 #
6493 # Integer search params can accept a single value or a comma separated list of values. The multiple
6494 # values will be combined under a logical OR operation - results will match at least one of
6495 # the given values.
6496 #
6497 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
6498 # or exclude (respectively) rows where the column is null.
6499 #
6500 # Boolean search params accept only "true" and "false" as values.
6501 #
6502 # GET /groups/search/with_roles -> Sequence[mdls.GroupSearch]
6503 def search_groups_with_roles(
6504 self,
6505 # Requested fields.
6506 fields: Optional[str] = None,
6507 # Number of results to return (used with `offset`).
6508 limit: Optional[int] = None,
6509 # Number of results to skip before returning any (used with `limit`).
6510 offset: Optional[int] = None,
6511 # Fields to sort by.
6512 sorts: Optional[str] = None,
6513 # Combine given search criteria in a boolean OR expression
6514 filter_or: Optional[bool] = None,
6515 # Match group id.
6516 id: Optional[str] = None,
6517 # Match group name.
6518 name: Optional[str] = None,
6519 # Match group external_group_id.
6520 external_group_id: Optional[str] = None,
6521 # Match group externally_managed.
6522 externally_managed: Optional[bool] = None,
6523 # Match group externally_orphaned.
6524 externally_orphaned: Optional[bool] = None,
6525 transport_options: Optional[transport.TransportOptions] = None,
6526 ) -> Sequence[mdls.GroupSearch]:
6527 """Search Groups with Roles"""
6528 response = cast(
6529 Sequence[mdls.GroupSearch],
6530 self.get(
6531 path="/groups/search/with_roles",
6532 structure=Sequence[mdls.GroupSearch],
6533 query_params={
6534 "fields": fields,
6535 "limit": limit,
6536 "offset": offset,
6537 "sorts": sorts,
6538 "filter_or": filter_or,
6539 "id": id,
6540 "name": name,
6541 "external_group_id": external_group_id,
6542 "externally_managed": externally_managed,
6543 "externally_orphaned": externally_orphaned,
6544 },
6545 transport_options=transport_options,
6546 ),
6547 )
6548 return response
6549
6550 # ### Search groups include hierarchy
6551 #
6552 # Returns all group records that match the given search criteria, and attaches
6553 # associated role_ids and parent group_ids.
6554 #
6555 # If multiple search params are given and `filter_or` is FALSE or not specified,
6556 # search params are combined in a logical AND operation.
6557 # Only rows that match *all* search param criteria will be returned.
6558 #
6559 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
6560 # Results will include rows that match **any** of the search criteria.
6561 #
6562 # String search params use case-insensitive matching.
6563 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
6564 # example="dan%" will match "danger" and "Danzig" but not "David"
6565 # example="D_m%" will match "Damage" and "dump"
6566 #
6567 # Integer search params can accept a single value or a comma separated list of values. The multiple
6568 # values will be combined under a logical OR operation - results will match at least one of
6569 # the given values.
6570 #
6571 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
6572 # or exclude (respectively) rows where the column is null.
6573 #
6574 # Boolean search params accept only "true" and "false" as values.
6575 #
6576 # GET /groups/search/with_hierarchy -> Sequence[mdls.GroupHierarchy]
6577 def search_groups_with_hierarchy(
6578 self,
6579 # Requested fields.
6580 fields: Optional[str] = None,
6581 # Number of results to return (used with `offset`).
6582 limit: Optional[int] = None,
6583 # Number of results to skip before returning any (used with `limit`).
6584 offset: Optional[int] = None,
6585 # Fields to sort by.
6586 sorts: Optional[str] = None,
6587 # Combine given search criteria in a boolean OR expression
6588 filter_or: Optional[bool] = None,
6589 # Match group id.
6590 id: Optional[str] = None,
6591 # Match group name.
6592 name: Optional[str] = None,
6593 # Match group external_group_id.
6594 external_group_id: Optional[str] = None,
6595 # Match group externally_managed.
6596 externally_managed: Optional[bool] = None,
6597 # Match group externally_orphaned.
6598 externally_orphaned: Optional[bool] = None,
6599 transport_options: Optional[transport.TransportOptions] = None,
6600 ) -> Sequence[mdls.GroupHierarchy]:
6601 """Search Groups with Hierarchy"""
6602 response = cast(
6603 Sequence[mdls.GroupHierarchy],
6604 self.get(
6605 path="/groups/search/with_hierarchy",
6606 structure=Sequence[mdls.GroupHierarchy],
6607 query_params={
6608 "fields": fields,
6609 "limit": limit,
6610 "offset": offset,
6611 "sorts": sorts,
6612 "filter_or": filter_or,
6613 "id": id,
6614 "name": name,
6615 "external_group_id": external_group_id,
6616 "externally_managed": externally_managed,
6617 "externally_orphaned": externally_orphaned,
6618 },
6619 transport_options=transport_options,
6620 ),
6621 )
6622 return response
6623
6624 # ### Get information about a group.
6625 #
6626 # GET /groups/{group_id} -> mdls.Group
6627 def group(
6628 self,
6629 # Id of group
6630 group_id: str,
6631 # Requested fields.
6632 fields: Optional[str] = None,
6633 transport_options: Optional[transport.TransportOptions] = None,
6634 ) -> mdls.Group:
6635 """Get Group"""
6636 group_id = self.encode_path_param(group_id)
6637 response = cast(
6638 mdls.Group,
6639 self.get(
6640 path=f"/groups/{group_id}",
6641 structure=mdls.Group,
6642 query_params={"fields": fields},
6643 transport_options=transport_options,
6644 ),
6645 )
6646 return response
6647
6648 # ### Updates the a group (admin only).
6649 #
6650 # PATCH /groups/{group_id} -> mdls.Group
6651 def update_group(
6652 self,
6653 # Id of group
6654 group_id: str,
6655 body: mdls.WriteGroup,
6656 # Requested fields.
6657 fields: Optional[str] = None,
6658 transport_options: Optional[transport.TransportOptions] = None,
6659 ) -> mdls.Group:
6660 """Update Group"""
6661 group_id = self.encode_path_param(group_id)
6662 response = cast(
6663 mdls.Group,
6664 self.patch(
6665 path=f"/groups/{group_id}",
6666 structure=mdls.Group,
6667 query_params={"fields": fields},
6668 body=body,
6669 transport_options=transport_options,
6670 ),
6671 )
6672 return response
6673
6674 # ### Deletes a group (admin only).
6675 #
6676 # DELETE /groups/{group_id} -> str
6677 def delete_group(
6678 self,
6679 # Id of group
6680 group_id: str,
6681 transport_options: Optional[transport.TransportOptions] = None,
6682 ) -> str:
6683 """Delete Group"""
6684 group_id = self.encode_path_param(group_id)
6685 response = cast(
6686 str,
6687 self.delete(
6688 path=f"/groups/{group_id}",
6689 structure=str,
6690 transport_options=transport_options,
6691 ),
6692 )
6693 return response
6694
6695 # ### Get information about all the groups in a group
6696 #
6697 # GET /groups/{group_id}/groups -> Sequence[mdls.Group]
6698 def all_group_groups(
6699 self,
6700 # Id of group
6701 group_id: str,
6702 # Requested fields.
6703 fields: Optional[str] = None,
6704 transport_options: Optional[transport.TransportOptions] = None,
6705 ) -> Sequence[mdls.Group]:
6706 """Get All Groups in Group"""
6707 group_id = self.encode_path_param(group_id)
6708 response = cast(
6709 Sequence[mdls.Group],
6710 self.get(
6711 path=f"/groups/{group_id}/groups",
6712 structure=Sequence[mdls.Group],
6713 query_params={"fields": fields},
6714 transport_options=transport_options,
6715 ),
6716 )
6717 return response
6718
6719 # ### Adds a new group to a group.
6720 #
6721 # POST /groups/{group_id}/groups -> mdls.Group
6722 def add_group_group(
6723 self,
6724 # Id of group
6725 group_id: str,
6726 # WARNING: no writeable properties found for POST, PUT, or PATCH
6727 body: mdls.GroupIdForGroupInclusion,
6728 transport_options: Optional[transport.TransportOptions] = None,
6729 ) -> mdls.Group:
6730 """Add a Group to Group"""
6731 group_id = self.encode_path_param(group_id)
6732 response = cast(
6733 mdls.Group,
6734 self.post(
6735 path=f"/groups/{group_id}/groups",
6736 structure=mdls.Group,
6737 body=body,
6738 transport_options=transport_options,
6739 ),
6740 )
6741 return response
6742
6743 # ### Get information about all the users directly included in a group.
6744 #
6745 # GET /groups/{group_id}/users -> Sequence[mdls.User]
6746 def all_group_users(
6747 self,
6748 # Id of group
6749 group_id: str,
6750 # Requested fields.
6751 fields: Optional[str] = None,
6752 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
6753 page: Optional[int] = None,
6754 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
6755 per_page: Optional[int] = None,
6756 # Number of results to return. (used with offset and takes priority over page and per_page)
6757 limit: Optional[int] = None,
6758 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
6759 offset: Optional[int] = None,
6760 # Fields to sort by.
6761 sorts: Optional[str] = None,
6762 transport_options: Optional[transport.TransportOptions] = None,
6763 ) -> Sequence[mdls.User]:
6764 """Get All Users in Group"""
6765 group_id = self.encode_path_param(group_id)
6766 response = cast(
6767 Sequence[mdls.User],
6768 self.get(
6769 path=f"/groups/{group_id}/users",
6770 structure=Sequence[mdls.User],
6771 query_params={
6772 "fields": fields,
6773 "page": page,
6774 "per_page": per_page,
6775 "limit": limit,
6776 "offset": offset,
6777 "sorts": sorts,
6778 },
6779 transport_options=transport_options,
6780 ),
6781 )
6782 return response
6783
6784 # ### Adds a new user to a group.
6785 #
6786 # POST /groups/{group_id}/users -> mdls.User
6787 def add_group_user(
6788 self,
6789 # Id of group
6790 group_id: str,
6791 # WARNING: no writeable properties found for POST, PUT, or PATCH
6792 body: mdls.GroupIdForGroupUserInclusion,
6793 transport_options: Optional[transport.TransportOptions] = None,
6794 ) -> mdls.User:
6795 """Add a User to Group"""
6796 group_id = self.encode_path_param(group_id)
6797 response = cast(
6798 mdls.User,
6799 self.post(
6800 path=f"/groups/{group_id}/users",
6801 structure=mdls.User,
6802 body=body,
6803 transport_options=transport_options,
6804 ),
6805 )
6806 return response
6807
6808 # ### Removes a user from a group.
6809 #
6810 # DELETE /groups/{group_id}/users/{user_id} -> None
6811 def delete_group_user(
6812 self,
6813 # Id of group
6814 group_id: str,
6815 # Id of user to remove from group
6816 user_id: str,
6817 transport_options: Optional[transport.TransportOptions] = None,
6818 ) -> None:
6819 """Remove a User from Group"""
6820 group_id = self.encode_path_param(group_id)
6821 user_id = self.encode_path_param(user_id)
6822 response = cast(
6823 None,
6824 self.delete(
6825 path=f"/groups/{group_id}/users/{user_id}",
6826 structure=None,
6827 transport_options=transport_options,
6828 ),
6829 )
6830 return response
6831
6832 # ### Removes a group from a group.
6833 #
6834 # DELETE /groups/{group_id}/groups/{deleting_group_id} -> None
6835 def delete_group_from_group(
6836 self,
6837 # Id of group
6838 group_id: str,
6839 # Id of group to delete
6840 deleting_group_id: str,
6841 transport_options: Optional[transport.TransportOptions] = None,
6842 ) -> None:
6843 """Deletes a Group from Group"""
6844 group_id = self.encode_path_param(group_id)
6845 deleting_group_id = self.encode_path_param(deleting_group_id)
6846 response = cast(
6847 None,
6848 self.delete(
6849 path=f"/groups/{group_id}/groups/{deleting_group_id}",
6850 structure=None,
6851 transport_options=transport_options,
6852 ),
6853 )
6854 return response
6855
6856 # ### Set the value of a user attribute for a group.
6857 #
6858 # For information about how user attribute values are calculated, see [Set User Attribute Group Values](#!/UserAttribute/set_user_attribute_group_values).
6859 #
6860 # PATCH /groups/{group_id}/attribute_values/{user_attribute_id} -> mdls.UserAttributeGroupValue
6861 def update_user_attribute_group_value(
6862 self,
6863 # Id of group
6864 group_id: str,
6865 # Id of user attribute
6866 user_attribute_id: str,
6867 # WARNING: no writeable properties found for POST, PUT, or PATCH
6868 body: mdls.UserAttributeGroupValue,
6869 transport_options: Optional[transport.TransportOptions] = None,
6870 ) -> mdls.UserAttributeGroupValue:
6871 """Set User Attribute Group Value"""
6872 group_id = self.encode_path_param(group_id)
6873 user_attribute_id = self.encode_path_param(user_attribute_id)
6874 response = cast(
6875 mdls.UserAttributeGroupValue,
6876 self.patch(
6877 path=f"/groups/{group_id}/attribute_values/{user_attribute_id}",
6878 structure=mdls.UserAttributeGroupValue,
6879 body=body,
6880 transport_options=transport_options,
6881 ),
6882 )
6883 return response
6884
6885 # ### Remove a user attribute value from a group.
6886 #
6887 # DELETE /groups/{group_id}/attribute_values/{user_attribute_id} -> None
6888 def delete_user_attribute_group_value(
6889 self,
6890 # Id of group
6891 group_id: str,
6892 # Id of user attribute
6893 user_attribute_id: str,
6894 transport_options: Optional[transport.TransportOptions] = None,
6895 ) -> None:
6896 """Delete User Attribute Group Value"""
6897 group_id = self.encode_path_param(group_id)
6898 user_attribute_id = self.encode_path_param(user_attribute_id)
6899 response = cast(
6900 None,
6901 self.delete(
6902 path=f"/groups/{group_id}/attribute_values/{user_attribute_id}",
6903 structure=None,
6904 transport_options=transport_options,
6905 ),
6906 )
6907 return response
6908
6909 # endregion
6910
6911 # region Homepage: Manage Homepage
6912
6913 # ### Get information about the primary homepage's sections.
6914 #
6915 # GET /primary_homepage_sections -> Sequence[mdls.HomepageSection]
6916 def all_primary_homepage_sections(
6917 self,
6918 # Requested fields.
6919 fields: Optional[str] = None,
6920 transport_options: Optional[transport.TransportOptions] = None,
6921 ) -> Sequence[mdls.HomepageSection]:
6922 """Get All Primary homepage sections"""
6923 response = cast(
6924 Sequence[mdls.HomepageSection],
6925 self.get(
6926 path="/primary_homepage_sections",
6927 structure=Sequence[mdls.HomepageSection],
6928 query_params={"fields": fields},
6929 transport_options=transport_options,
6930 ),
6931 )
6932 return response
6933
6934 # endregion
6935
6936 # region Integration: Manage Integrations
6937
6938 # ### Get information about all Integration Hubs.
6939 #
6940 # GET /integration_hubs -> Sequence[mdls.IntegrationHub]
6941 def all_integration_hubs(
6942 self,
6943 # Requested fields.
6944 fields: Optional[str] = None,
6945 transport_options: Optional[transport.TransportOptions] = None,
6946 ) -> Sequence[mdls.IntegrationHub]:
6947 """Get All Integration Hubs"""
6948 response = cast(
6949 Sequence[mdls.IntegrationHub],
6950 self.get(
6951 path="/integration_hubs",
6952 structure=Sequence[mdls.IntegrationHub],
6953 query_params={"fields": fields},
6954 transport_options=transport_options,
6955 ),
6956 )
6957 return response
6958
6959 # ### Create a new Integration Hub.
6960 #
6961 # This API is rate limited to prevent it from being used for SSRF attacks
6962 #
6963 # POST /integration_hubs -> mdls.IntegrationHub
6964 def create_integration_hub(
6965 self,
6966 body: mdls.WriteIntegrationHub,
6967 # Requested fields.
6968 fields: Optional[str] = None,
6969 transport_options: Optional[transport.TransportOptions] = None,
6970 ) -> mdls.IntegrationHub:
6971 """Create Integration Hub"""
6972 response = cast(
6973 mdls.IntegrationHub,
6974 self.post(
6975 path="/integration_hubs",
6976 structure=mdls.IntegrationHub,
6977 query_params={"fields": fields},
6978 body=body,
6979 transport_options=transport_options,
6980 ),
6981 )
6982 return response
6983
6984 # ### Get information about a Integration Hub.
6985 #
6986 # GET /integration_hubs/{integration_hub_id} -> mdls.IntegrationHub
6987 def integration_hub(
6988 self,
6989 # Id of integration_hub
6990 integration_hub_id: str,
6991 # Requested fields.
6992 fields: Optional[str] = None,
6993 transport_options: Optional[transport.TransportOptions] = None,
6994 ) -> mdls.IntegrationHub:
6995 """Get Integration Hub"""
6996 integration_hub_id = self.encode_path_param(integration_hub_id)
6997 response = cast(
6998 mdls.IntegrationHub,
6999 self.get(
7000 path=f"/integration_hubs/{integration_hub_id}",
7001 structure=mdls.IntegrationHub,
7002 query_params={"fields": fields},
7003 transport_options=transport_options,
7004 ),
7005 )
7006 return response
7007
7008 # ### Update a Integration Hub definition.
7009 #
7010 # This API is rate limited to prevent it from being used for SSRF attacks
7011 #
7012 # PATCH /integration_hubs/{integration_hub_id} -> mdls.IntegrationHub
7013 def update_integration_hub(
7014 self,
7015 # Id of integration_hub
7016 integration_hub_id: str,
7017 body: mdls.WriteIntegrationHub,
7018 # Requested fields.
7019 fields: Optional[str] = None,
7020 transport_options: Optional[transport.TransportOptions] = None,
7021 ) -> mdls.IntegrationHub:
7022 """Update Integration Hub"""
7023 integration_hub_id = self.encode_path_param(integration_hub_id)
7024 response = cast(
7025 mdls.IntegrationHub,
7026 self.patch(
7027 path=f"/integration_hubs/{integration_hub_id}",
7028 structure=mdls.IntegrationHub,
7029 query_params={"fields": fields},
7030 body=body,
7031 transport_options=transport_options,
7032 ),
7033 )
7034 return response
7035
7036 # ### Delete a Integration Hub.
7037 #
7038 # DELETE /integration_hubs/{integration_hub_id} -> str
7039 def delete_integration_hub(
7040 self,
7041 # Id of integration_hub
7042 integration_hub_id: str,
7043 transport_options: Optional[transport.TransportOptions] = None,
7044 ) -> str:
7045 """Delete Integration Hub"""
7046 integration_hub_id = self.encode_path_param(integration_hub_id)
7047 response = cast(
7048 str,
7049 self.delete(
7050 path=f"/integration_hubs/{integration_hub_id}",
7051 structure=str,
7052 transport_options=transport_options,
7053 ),
7054 )
7055 return response
7056
7057 # Checks to see if the user is able to connect to their integration hub
7058 #
7059 # GET /integration_hubs/{integration_hub_id}/health -> mdls.IntegrationHubHealthResult
7060 def get_integration_hub_health(
7061 self,
7062 # Id of integration_hub
7063 integration_hub_id: str,
7064 # Requested fields.
7065 fields: Optional[str] = None,
7066 transport_options: Optional[transport.TransportOptions] = None,
7067 ) -> mdls.IntegrationHubHealthResult:
7068 """Check the health of Integration Hub"""
7069 integration_hub_id = self.encode_path_param(integration_hub_id)
7070 response = cast(
7071 mdls.IntegrationHubHealthResult,
7072 self.get(
7073 path=f"/integration_hubs/{integration_hub_id}/health",
7074 structure=mdls.IntegrationHubHealthResult,
7075 query_params={"fields": fields},
7076 transport_options=transport_options,
7077 ),
7078 )
7079 return response
7080
7081 # 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.
7082 #
7083 # POST /integration_hubs/{integration_hub_id}/accept_legal_agreement -> mdls.IntegrationHub
7084 def accept_integration_hub_legal_agreement(
7085 self,
7086 # Id of integration_hub
7087 integration_hub_id: str,
7088 transport_options: Optional[transport.TransportOptions] = None,
7089 ) -> mdls.IntegrationHub:
7090 """Accept Integration Hub Legal Agreement"""
7091 integration_hub_id = self.encode_path_param(integration_hub_id)
7092 response = cast(
7093 mdls.IntegrationHub,
7094 self.post(
7095 path=f"/integration_hubs/{integration_hub_id}/accept_legal_agreement",
7096 structure=mdls.IntegrationHub,
7097 transport_options=transport_options,
7098 ),
7099 )
7100 return response
7101
7102 # ### Get information about all Integrations.
7103 #
7104 # GET /integrations -> Sequence[mdls.Integration]
7105 def all_integrations(
7106 self,
7107 # Requested fields.
7108 fields: Optional[str] = None,
7109 # Filter to a specific provider
7110 integration_hub_id: Optional[str] = None,
7111 transport_options: Optional[transport.TransportOptions] = None,
7112 ) -> Sequence[mdls.Integration]:
7113 """Get All Integrations"""
7114 response = cast(
7115 Sequence[mdls.Integration],
7116 self.get(
7117 path="/integrations",
7118 structure=Sequence[mdls.Integration],
7119 query_params={
7120 "fields": fields,
7121 "integration_hub_id": integration_hub_id,
7122 },
7123 transport_options=transport_options,
7124 ),
7125 )
7126 return response
7127
7128 # ### Get information about a Integration.
7129 #
7130 # GET /integrations/{integration_id} -> mdls.Integration
7131 def integration(
7132 self,
7133 # Id of integration
7134 integration_id: str,
7135 # Requested fields.
7136 fields: Optional[str] = None,
7137 transport_options: Optional[transport.TransportOptions] = None,
7138 ) -> mdls.Integration:
7139 """Get Integration"""
7140 integration_id = self.encode_path_param(integration_id)
7141 response = cast(
7142 mdls.Integration,
7143 self.get(
7144 path=f"/integrations/{integration_id}",
7145 structure=mdls.Integration,
7146 query_params={"fields": fields},
7147 transport_options=transport_options,
7148 ),
7149 )
7150 return response
7151
7152 # ### Update parameters on a Integration.
7153 #
7154 # PATCH /integrations/{integration_id} -> mdls.Integration
7155 def update_integration(
7156 self,
7157 # Id of integration
7158 integration_id: str,
7159 body: mdls.WriteIntegration,
7160 # Requested fields.
7161 fields: Optional[str] = None,
7162 transport_options: Optional[transport.TransportOptions] = None,
7163 ) -> mdls.Integration:
7164 """Update Integration"""
7165 integration_id = self.encode_path_param(integration_id)
7166 response = cast(
7167 mdls.Integration,
7168 self.patch(
7169 path=f"/integrations/{integration_id}",
7170 structure=mdls.Integration,
7171 query_params={"fields": fields},
7172 body=body,
7173 transport_options=transport_options,
7174 ),
7175 )
7176 return response
7177
7178 # Returns the Integration form for presentation to the user.
7179 #
7180 # POST /integrations/{integration_id}/form -> mdls.DataActionForm
7181 def fetch_integration_form(
7182 self,
7183 # Id of integration
7184 integration_id: str,
7185 body: Optional[MutableMapping[str, Any]] = None,
7186 transport_options: Optional[transport.TransportOptions] = None,
7187 ) -> mdls.DataActionForm:
7188 """Fetch Remote Integration Form"""
7189 integration_id = self.encode_path_param(integration_id)
7190 response = cast(
7191 mdls.DataActionForm,
7192 self.post(
7193 path=f"/integrations/{integration_id}/form",
7194 structure=mdls.DataActionForm,
7195 body=body,
7196 transport_options=transport_options,
7197 ),
7198 )
7199 return response
7200
7201 # Tests the integration to make sure all the settings are working.
7202 #
7203 # POST /integrations/{integration_id}/test -> mdls.IntegrationTestResult
7204 def test_integration(
7205 self,
7206 # Id of integration
7207 integration_id: str,
7208 transport_options: Optional[transport.TransportOptions] = None,
7209 ) -> mdls.IntegrationTestResult:
7210 """Test integration"""
7211 integration_id = self.encode_path_param(integration_id)
7212 response = cast(
7213 mdls.IntegrationTestResult,
7214 self.post(
7215 path=f"/integrations/{integration_id}/test",
7216 structure=mdls.IntegrationTestResult,
7217 transport_options=transport_options,
7218 ),
7219 )
7220 return response
7221
7222 # endregion
7223
7224 # region Look: Run and Manage Looks
7225
7226 # ### Get information about all active Looks
7227 #
7228 # Returns an array of **abbreviated Look objects** describing all the looks that the caller has access to. Soft-deleted Looks are **not** included.
7229 #
7230 # Get the **full details** of a specific look by id with [look(id)](#!/Look/look)
7231 #
7232 # Find **soft-deleted looks** with [search_looks()](#!/Look/search_looks)
7233 #
7234 # GET /looks -> Sequence[mdls.Look]
7235 def all_looks(
7236 self,
7237 # Requested fields.
7238 fields: Optional[str] = None,
7239 transport_options: Optional[transport.TransportOptions] = None,
7240 ) -> Sequence[mdls.Look]:
7241 """Get All Looks"""
7242 response = cast(
7243 Sequence[mdls.Look],
7244 self.get(
7245 path="/looks",
7246 structure=Sequence[mdls.Look],
7247 query_params={"fields": fields},
7248 transport_options=transport_options,
7249 ),
7250 )
7251 return response
7252
7253 # ### Create a Look
7254 #
7255 # To create a look to display query data, first create the query with [create_query()](#!/Query/create_query)
7256 # then assign the query's id to the `query_id` property in the call to `create_look()`.
7257 #
7258 # To place the look into a particular space, assign the space's id to the `space_id` property
7259 # in the call to `create_look()`.
7260 #
7261 # POST /looks -> mdls.LookWithQuery
7262 def create_look(
7263 self,
7264 body: mdls.WriteLookWithQuery,
7265 # Requested fields.
7266 fields: Optional[str] = None,
7267 transport_options: Optional[transport.TransportOptions] = None,
7268 ) -> mdls.LookWithQuery:
7269 """Create Look"""
7270 response = cast(
7271 mdls.LookWithQuery,
7272 self.post(
7273 path="/looks",
7274 structure=mdls.LookWithQuery,
7275 query_params={"fields": fields},
7276 body=body,
7277 transport_options=transport_options,
7278 ),
7279 )
7280 return response
7281
7282 # ### Search Looks
7283 #
7284 # Returns an **array of Look objects** that match the specified search criteria.
7285 #
7286 # If multiple search params are given and `filter_or` is FALSE or not specified,
7287 # search params are combined in a logical AND operation.
7288 # Only rows that match *all* search param criteria will be returned.
7289 #
7290 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
7291 # Results will include rows that match **any** of the search criteria.
7292 #
7293 # String search params use case-insensitive matching.
7294 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
7295 # example="dan%" will match "danger" and "Danzig" but not "David"
7296 # example="D_m%" will match "Damage" and "dump"
7297 #
7298 # Integer search params can accept a single value or a comma separated list of values. The multiple
7299 # values will be combined under a logical OR operation - results will match at least one of
7300 # the given values.
7301 #
7302 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
7303 # or exclude (respectively) rows where the column is null.
7304 #
7305 # Boolean search params accept only "true" and "false" as values.
7306 #
7307 #
7308 # Get a **single look** by id with [look(id)](#!/Look/look)
7309 #
7310 # GET /looks/search -> Sequence[mdls.Look]
7311 def search_looks(
7312 self,
7313 # Match look id.
7314 id: Optional[str] = None,
7315 # Match Look title.
7316 title: Optional[str] = None,
7317 # Match Look description.
7318 description: Optional[str] = None,
7319 # Select looks with a particular content favorite id
7320 content_favorite_id: Optional[str] = None,
7321 # Select looks in a particular folder.
7322 folder_id: Optional[str] = None,
7323 # Select looks created by a particular user.
7324 user_id: Optional[str] = None,
7325 # Select looks with particular view_count value
7326 view_count: Optional[str] = None,
7327 # Select soft-deleted looks
7328 deleted: Optional[bool] = None,
7329 # Select looks that reference a particular query by query_id
7330 query_id: Optional[str] = None,
7331 # Exclude items that exist only in personal spaces other than the users
7332 curate: Optional[bool] = None,
7333 # Select looks based on when they were last viewed
7334 last_viewed_at: Optional[str] = None,
7335 # Requested fields.
7336 fields: Optional[str] = None,
7337 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
7338 page: Optional[int] = None,
7339 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
7340 per_page: Optional[int] = None,
7341 # Number of results to return. (used with offset and takes priority over page and per_page)
7342 limit: Optional[int] = None,
7343 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
7344 offset: Optional[int] = None,
7345 # 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]
7346 sorts: Optional[str] = None,
7347 # Combine given search criteria in a boolean OR expression
7348 filter_or: Optional[bool] = None,
7349 transport_options: Optional[transport.TransportOptions] = None,
7350 ) -> Sequence[mdls.Look]:
7351 """Search Looks"""
7352 response = cast(
7353 Sequence[mdls.Look],
7354 self.get(
7355 path="/looks/search",
7356 structure=Sequence[mdls.Look],
7357 query_params={
7358 "id": id,
7359 "title": title,
7360 "description": description,
7361 "content_favorite_id": content_favorite_id,
7362 "folder_id": folder_id,
7363 "user_id": user_id,
7364 "view_count": view_count,
7365 "deleted": deleted,
7366 "query_id": query_id,
7367 "curate": curate,
7368 "last_viewed_at": last_viewed_at,
7369 "fields": fields,
7370 "page": page,
7371 "per_page": per_page,
7372 "limit": limit,
7373 "offset": offset,
7374 "sorts": sorts,
7375 "filter_or": filter_or,
7376 },
7377 transport_options=transport_options,
7378 ),
7379 )
7380 return response
7381
7382 # ### Get a Look.
7383 #
7384 # Returns detailed information about a Look and its associated Query.
7385 #
7386 # GET /looks/{look_id} -> mdls.LookWithQuery
7387 def look(
7388 self,
7389 # Id of look
7390 look_id: str,
7391 # Requested fields.
7392 fields: Optional[str] = None,
7393 transport_options: Optional[transport.TransportOptions] = None,
7394 ) -> mdls.LookWithQuery:
7395 """Get Look"""
7396 look_id = self.encode_path_param(look_id)
7397 response = cast(
7398 mdls.LookWithQuery,
7399 self.get(
7400 path=f"/looks/{look_id}",
7401 structure=mdls.LookWithQuery,
7402 query_params={"fields": fields},
7403 transport_options=transport_options,
7404 ),
7405 )
7406 return response
7407
7408 # ### Modify a Look
7409 #
7410 # Use this function to modify parts of a look. Property values given in a call to `update_look` are
7411 # applied to the existing look, so there's no need to include properties whose values are not changing.
7412 # It's best to specify only the properties you want to change and leave everything else out
7413 # of your `update_look` call. **Look properties marked 'read-only' will be ignored.**
7414 #
7415 # When a user deletes a look in the Looker UI, the look data remains in the database but is
7416 # marked with a deleted flag ("soft-deleted"). Soft-deleted looks can be undeleted (by an admin)
7417 # if the delete was in error.
7418 #
7419 # To soft-delete a look via the API, use [update_look()](#!/Look/update_look) to change the look's `deleted` property to `true`.
7420 # You can undelete a look by calling `update_look` to change the look's `deleted` property to `false`.
7421 #
7422 # Soft-deleted looks are excluded from the results of [all_looks()](#!/Look/all_looks) and [search_looks()](#!/Look/search_looks), so they
7423 # essentially disappear from view even though they still reside in the db.
7424 # You can pass `deleted: true` as a parameter to [search_looks()](#!/Look/search_looks) to list soft-deleted looks.
7425 #
7426 # NOTE: [delete_look()](#!/Look/delete_look) performs a "hard delete" - the look data is removed from the Looker
7427 # database and destroyed. There is no "undo" for `delete_look()`.
7428 #
7429 # PATCH /looks/{look_id} -> mdls.LookWithQuery
7430 def update_look(
7431 self,
7432 # Id of look
7433 look_id: str,
7434 body: mdls.WriteLookWithQuery,
7435 # Requested fields.
7436 fields: Optional[str] = None,
7437 transport_options: Optional[transport.TransportOptions] = None,
7438 ) -> mdls.LookWithQuery:
7439 """Update Look"""
7440 look_id = self.encode_path_param(look_id)
7441 response = cast(
7442 mdls.LookWithQuery,
7443 self.patch(
7444 path=f"/looks/{look_id}",
7445 structure=mdls.LookWithQuery,
7446 query_params={"fields": fields},
7447 body=body,
7448 transport_options=transport_options,
7449 ),
7450 )
7451 return response
7452
7453 # ### Permanently Delete a Look
7454 #
7455 # This operation **permanently** removes a look from the Looker database.
7456 #
7457 # NOTE: There is no "undo" for this kind of delete.
7458 #
7459 # For information about soft-delete (which can be undone) see [update_look()](#!/Look/update_look).
7460 #
7461 # DELETE /looks/{look_id} -> str
7462 def delete_look(
7463 self,
7464 # Id of look
7465 look_id: str,
7466 transport_options: Optional[transport.TransportOptions] = None,
7467 ) -> str:
7468 """Delete Look"""
7469 look_id = self.encode_path_param(look_id)
7470 response = cast(
7471 str,
7472 self.delete(
7473 path=f"/looks/{look_id}",
7474 structure=str,
7475 transport_options=transport_options,
7476 ),
7477 )
7478 return response
7479
7480 # ### Run a Look
7481 #
7482 # Runs a given look's query and returns the results in the requested format.
7483 #
7484 # Supported formats:
7485 #
7486 # | result_format | Description
7487 # | :-----------: | :--- |
7488 # | json | Plain json
7489 # | json_bi | (*RECOMMENDED*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query. See JsonBi type for schema
7490 # | json_detail | (*LEGACY*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
7491 # | csv | Comma separated values with a header
7492 # | txt | Tab separated values with a header
7493 # | html | Simple html
7494 # | md | Simple markdown
7495 # | xlsx | MS Excel spreadsheet
7496 # | sql | Returns the generated SQL rather than running the query
7497 # | png | A PNG image of the visualization of the query
7498 # | jpg | A JPG image of the visualization of the query
7499 #
7500 # GET /looks/{look_id}/run/{result_format} -> Union[str, bytes]
7501 def run_look(
7502 self,
7503 # Id of look
7504 look_id: str,
7505 # Format of result
7506 result_format: str,
7507 # Row limit (may override the limit in the saved query).
7508 limit: Optional[int] = None,
7509 # Apply model-specified formatting to each result.
7510 apply_formatting: Optional[bool] = None,
7511 # Apply visualization options to results.
7512 apply_vis: Optional[bool] = None,
7513 # Get results from cache if available.
7514 cache: Optional[bool] = None,
7515 # Render width for image formats.
7516 image_width: Optional[int] = None,
7517 # Render height for image formats.
7518 image_height: Optional[int] = None,
7519 # Generate drill links (only applicable to 'json_detail' format.
7520 generate_drill_links: Optional[bool] = None,
7521 # 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.
7522 force_production: Optional[bool] = None,
7523 # Retrieve any results from cache even if the results have expired.
7524 cache_only: Optional[bool] = None,
7525 # Prefix to use for drill links (url encoded).
7526 path_prefix: Optional[str] = None,
7527 # Rebuild PDTS used in query.
7528 rebuild_pdts: Optional[bool] = None,
7529 # Perform table calculations on query results
7530 server_table_calcs: Optional[bool] = None,
7531 transport_options: Optional[transport.TransportOptions] = None,
7532 ) -> Union[str, bytes]:
7533 """Run Look"""
7534 look_id = self.encode_path_param(look_id)
7535 result_format = self.encode_path_param(result_format)
7536 response = cast(
7537 Union[str, bytes],
7538 self.get(
7539 path=f"/looks/{look_id}/run/{result_format}",
7540 structure=Union[str, bytes], # type: ignore
7541 query_params={
7542 "limit": limit,
7543 "apply_formatting": apply_formatting,
7544 "apply_vis": apply_vis,
7545 "cache": cache,
7546 "image_width": image_width,
7547 "image_height": image_height,
7548 "generate_drill_links": generate_drill_links,
7549 "force_production": force_production,
7550 "cache_only": cache_only,
7551 "path_prefix": path_prefix,
7552 "rebuild_pdts": rebuild_pdts,
7553 "server_table_calcs": server_table_calcs,
7554 },
7555 transport_options=transport_options,
7556 ),
7557 )
7558 return response
7559
7560 # ### Copy an existing look
7561 #
7562 # Creates a copy of an existing look, in a specified folder, and returns the copied look.
7563 #
7564 # `look_id` and `folder_id` are required.
7565 #
7566 # `look_id` and `folder_id` must already exist, and `folder_id` must be different from the current `folder_id` of the dashboard.
7567 #
7568 # POST /looks/{look_id}/copy -> mdls.LookWithQuery
7569 def copy_look(
7570 self,
7571 # Look id to copy.
7572 look_id: str,
7573 # Folder id to copy to.
7574 folder_id: Optional[str] = None,
7575 transport_options: Optional[transport.TransportOptions] = None,
7576 ) -> mdls.LookWithQuery:
7577 """Copy Look"""
7578 look_id = self.encode_path_param(look_id)
7579 response = cast(
7580 mdls.LookWithQuery,
7581 self.post(
7582 path=f"/looks/{look_id}/copy",
7583 structure=mdls.LookWithQuery,
7584 query_params={"folder_id": folder_id},
7585 transport_options=transport_options,
7586 ),
7587 )
7588 return response
7589
7590 # ### Move an existing look
7591 #
7592 # Moves a look to a specified folder, and returns the moved look.
7593 #
7594 # `look_id` and `folder_id` are required.
7595 # `look_id` and `folder_id` must already exist, and `folder_id` must be different from the current `folder_id` of the dashboard.
7596 #
7597 # PATCH /looks/{look_id}/move -> mdls.LookWithQuery
7598 def move_look(
7599 self,
7600 # Look id to move.
7601 look_id: str,
7602 # Folder id to move to.
7603 folder_id: str,
7604 transport_options: Optional[transport.TransportOptions] = None,
7605 ) -> mdls.LookWithQuery:
7606 """Move Look"""
7607 look_id = self.encode_path_param(look_id)
7608 response = cast(
7609 mdls.LookWithQuery,
7610 self.patch(
7611 path=f"/looks/{look_id}/move",
7612 structure=mdls.LookWithQuery,
7613 query_params={"folder_id": folder_id},
7614 transport_options=transport_options,
7615 ),
7616 )
7617 return response
7618
7619 # endregion
7620
7621 # region LookmlModel: Manage LookML Models
7622
7623 # ### Get information about all lookml models.
7624 #
7625 # GET /lookml_models -> Sequence[mdls.LookmlModel]
7626 def all_lookml_models(
7627 self,
7628 # Requested fields.
7629 fields: Optional[str] = None,
7630 # Number of results to return. (can be used with offset)
7631 limit: Optional[int] = None,
7632 # Number of results to skip before returning any. (Defaults to 0 if not set when limit is used)
7633 offset: Optional[int] = None,
7634 # Whether or not to exclude models with no explores from the response (Defaults to false)
7635 exclude_empty: Optional[bool] = None,
7636 # Whether or not to exclude hidden explores from the response (Defaults to false)
7637 exclude_hidden: Optional[bool] = None,
7638 # Whether or not to include built-in models such as System Activity (Defaults to false)
7639 include_internal: Optional[bool] = None,
7640 # Whether or not to include self service models (Defaults to false)
7641 include_self_service: Optional[bool] = None,
7642 transport_options: Optional[transport.TransportOptions] = None,
7643 ) -> Sequence[mdls.LookmlModel]:
7644 """Get All LookML Models"""
7645 response = cast(
7646 Sequence[mdls.LookmlModel],
7647 self.get(
7648 path="/lookml_models",
7649 structure=Sequence[mdls.LookmlModel],
7650 query_params={
7651 "fields": fields,
7652 "limit": limit,
7653 "offset": offset,
7654 "exclude_empty": exclude_empty,
7655 "exclude_hidden": exclude_hidden,
7656 "include_internal": include_internal,
7657 "include_self_service": include_self_service,
7658 },
7659 transport_options=transport_options,
7660 ),
7661 )
7662 return response
7663
7664 # ### Create a lookml model using the specified configuration.
7665 #
7666 # POST /lookml_models -> mdls.LookmlModel
7667 def create_lookml_model(
7668 self,
7669 body: mdls.WriteLookmlModel,
7670 transport_options: Optional[transport.TransportOptions] = None,
7671 ) -> mdls.LookmlModel:
7672 """Create LookML Model"""
7673 response = cast(
7674 mdls.LookmlModel,
7675 self.post(
7676 path="/lookml_models",
7677 structure=mdls.LookmlModel,
7678 body=body,
7679 transport_options=transport_options,
7680 ),
7681 )
7682 return response
7683
7684 # ### Get information about a lookml model.
7685 #
7686 # GET /lookml_models/{lookml_model_name} -> mdls.LookmlModel
7687 def lookml_model(
7688 self,
7689 # Name of lookml model.
7690 lookml_model_name: str,
7691 # Requested fields.
7692 fields: Optional[str] = None,
7693 transport_options: Optional[transport.TransportOptions] = None,
7694 ) -> mdls.LookmlModel:
7695 """Get LookML Model"""
7696 lookml_model_name = self.encode_path_param(lookml_model_name)
7697 response = cast(
7698 mdls.LookmlModel,
7699 self.get(
7700 path=f"/lookml_models/{lookml_model_name}",
7701 structure=mdls.LookmlModel,
7702 query_params={"fields": fields},
7703 transport_options=transport_options,
7704 ),
7705 )
7706 return response
7707
7708 # ### Update a lookml model using the specified configuration.
7709 #
7710 # PATCH /lookml_models/{lookml_model_name} -> mdls.LookmlModel
7711 def update_lookml_model(
7712 self,
7713 # Name of lookml model.
7714 lookml_model_name: str,
7715 body: mdls.WriteLookmlModel,
7716 transport_options: Optional[transport.TransportOptions] = None,
7717 ) -> mdls.LookmlModel:
7718 """Update LookML Model"""
7719 lookml_model_name = self.encode_path_param(lookml_model_name)
7720 response = cast(
7721 mdls.LookmlModel,
7722 self.patch(
7723 path=f"/lookml_models/{lookml_model_name}",
7724 structure=mdls.LookmlModel,
7725 body=body,
7726 transport_options=transport_options,
7727 ),
7728 )
7729 return response
7730
7731 # ### Delete a lookml model.
7732 #
7733 # DELETE /lookml_models/{lookml_model_name} -> str
7734 def delete_lookml_model(
7735 self,
7736 # Name of lookml model.
7737 lookml_model_name: str,
7738 transport_options: Optional[transport.TransportOptions] = None,
7739 ) -> str:
7740 """Delete LookML Model"""
7741 lookml_model_name = self.encode_path_param(lookml_model_name)
7742 response = cast(
7743 str,
7744 self.delete(
7745 path=f"/lookml_models/{lookml_model_name}",
7746 structure=str,
7747 transport_options=transport_options,
7748 ),
7749 )
7750 return response
7751
7752 # ### Get information about a lookml model explore.
7753 #
7754 # GET /lookml_models/{lookml_model_name}/explores/{explore_name} -> mdls.LookmlModelExplore
7755 def lookml_model_explore(
7756 self,
7757 # Name of lookml model.
7758 lookml_model_name: str,
7759 # Name of explore.
7760 explore_name: str,
7761 # Requested fields.
7762 fields: Optional[str] = None,
7763 # Whether response should include drill field metadata.
7764 add_drills_metadata: Optional[bool] = None,
7765 transport_options: Optional[transport.TransportOptions] = None,
7766 ) -> mdls.LookmlModelExplore:
7767 """Get LookML Model Explore"""
7768 lookml_model_name = self.encode_path_param(lookml_model_name)
7769 explore_name = self.encode_path_param(explore_name)
7770 response = cast(
7771 mdls.LookmlModelExplore,
7772 self.get(
7773 path=f"/lookml_models/{lookml_model_name}/explores/{explore_name}",
7774 structure=mdls.LookmlModelExplore,
7775 query_params={
7776 "fields": fields,
7777 "add_drills_metadata": add_drills_metadata,
7778 },
7779 transport_options=transport_options,
7780 ),
7781 )
7782 return response
7783
7784 # endregion
7785
7786 # region Metadata: Connection Metadata Features
7787
7788 # ### Field name suggestions for a model and view
7789 #
7790 # `filters` is a string hash of values, with the key as the field name and the string value as the filter expression:
7791 #
7792 # ```ruby
7793 # {'users.age': '>=60'}
7794 # ```
7795 #
7796 # or
7797 #
7798 # ```ruby
7799 # {'users.age': '<30'}
7800 # ```
7801 #
7802 # or
7803 #
7804 # ```ruby
7805 # {'users.age': '=50'}
7806 # ```
7807 #
7808 # GET /models/{model_name}/views/{view_name}/fields/{field_name}/suggestions -> mdls.ModelFieldSuggestions
7809 def model_fieldname_suggestions(
7810 self,
7811 # Name of model
7812 model_name: str,
7813 # Name of view
7814 view_name: str,
7815 # Name of field to use for suggestions
7816 field_name: str,
7817 # Search term pattern (evaluated as as `%term%`)
7818 term: Optional[str] = None,
7819 # Suggestion filters with field name keys and comparison expressions
7820 filters: Optional[str] = None,
7821 transport_options: Optional[transport.TransportOptions] = None,
7822 ) -> mdls.ModelFieldSuggestions:
7823 """Model field name suggestions"""
7824 model_name = self.encode_path_param(model_name)
7825 view_name = self.encode_path_param(view_name)
7826 field_name = self.encode_path_param(field_name)
7827 response = cast(
7828 mdls.ModelFieldSuggestions,
7829 self.get(
7830 path=f"/models/{model_name}/views/{view_name}/fields/{field_name}/suggestions",
7831 structure=mdls.ModelFieldSuggestions,
7832 query_params={"term": term, "filters": filters},
7833 transport_options=transport_options,
7834 ),
7835 )
7836 return response
7837
7838 # ### Get a single model
7839 #
7840 # GET /models/{model_name} -> mdls.Model
7841 def get_model(
7842 self,
7843 # Name of model
7844 model_name: str,
7845 transport_options: Optional[transport.TransportOptions] = None,
7846 ) -> mdls.Model:
7847 """Get a single model"""
7848 model_name = self.encode_path_param(model_name)
7849 response = cast(
7850 mdls.Model,
7851 self.get(
7852 path=f"/models/{model_name}",
7853 structure=mdls.Model,
7854 transport_options=transport_options,
7855 ),
7856 )
7857 return response
7858
7859 # ### List databases available to this connection
7860 #
7861 # Certain dialects can support multiple databases per single connection.
7862 # If this connection supports multiple databases, the database names will be returned in an array.
7863 #
7864 # Connections using dialects that do not support multiple databases will return an empty array.
7865 #
7866 # **Note**: [Connection Features](#!/Metadata/connection_features) can be used to determine if a connection supports
7867 # multiple databases.
7868 #
7869 # GET /connections/{connection_name}/databases -> Sequence[str]
7870 def connection_databases(
7871 self,
7872 # Name of connection
7873 connection_name: str,
7874 transport_options: Optional[transport.TransportOptions] = None,
7875 ) -> Sequence[str]:
7876 """List accessible databases to this connection"""
7877 connection_name = self.encode_path_param(connection_name)
7878 response = cast(
7879 Sequence[str],
7880 self.get(
7881 path=f"/connections/{connection_name}/databases",
7882 structure=Sequence[str],
7883 transport_options=transport_options,
7884 ),
7885 )
7886 return response
7887
7888 # ### Retrieve metadata features for this connection
7889 #
7890 # Returns a list of feature names with `true` (available) or `false` (not available)
7891 #
7892 # GET /connections/{connection_name}/features -> mdls.ConnectionFeatures
7893 def connection_features(
7894 self,
7895 # Name of connection
7896 connection_name: str,
7897 # Requested fields.
7898 fields: Optional[str] = None,
7899 transport_options: Optional[transport.TransportOptions] = None,
7900 ) -> mdls.ConnectionFeatures:
7901 """Metadata features supported by this connection"""
7902 connection_name = self.encode_path_param(connection_name)
7903 response = cast(
7904 mdls.ConnectionFeatures,
7905 self.get(
7906 path=f"/connections/{connection_name}/features",
7907 structure=mdls.ConnectionFeatures,
7908 query_params={"fields": fields},
7909 transport_options=transport_options,
7910 ),
7911 )
7912 return response
7913
7914 # ### Get the list of schemas and tables for a connection
7915 #
7916 # GET /connections/{connection_name}/schemas -> Sequence[mdls.Schema]
7917 def connection_schemas(
7918 self,
7919 # Name of connection
7920 connection_name: str,
7921 # For dialects that support multiple databases, optionally identify which to use
7922 database: Optional[str] = None,
7923 # True to use fetch from cache, false to load fresh
7924 cache: Optional[bool] = None,
7925 # Requested fields.
7926 fields: Optional[str] = None,
7927 transport_options: Optional[transport.TransportOptions] = None,
7928 ) -> Sequence[mdls.Schema]:
7929 """Get schemas for a connection"""
7930 connection_name = self.encode_path_param(connection_name)
7931 response = cast(
7932 Sequence[mdls.Schema],
7933 self.get(
7934 path=f"/connections/{connection_name}/schemas",
7935 structure=Sequence[mdls.Schema],
7936 query_params={"database": database, "cache": cache, "fields": fields},
7937 transport_options=transport_options,
7938 ),
7939 )
7940 return response
7941
7942 # ### Get the list of tables for a schema
7943 #
7944 # For dialects that support multiple databases, optionally identify which to use. If not provided, the default
7945 # database for the connection will be used.
7946 #
7947 # For dialects that do **not** support multiple databases, **do not use** the database parameter
7948 #
7949 # GET /connections/{connection_name}/tables -> Sequence[mdls.SchemaTables]
7950 def connection_tables(
7951 self,
7952 # Name of connection
7953 connection_name: str,
7954 # Optional. Name of database to use for the query, only if applicable
7955 database: Optional[str] = None,
7956 # Optional. Return only tables for this schema
7957 schema_name: Optional[str] = None,
7958 # True to fetch from cache, false to load fresh
7959 cache: Optional[bool] = None,
7960 # Requested fields.
7961 fields: Optional[str] = None,
7962 # Optional. Return tables with names that contain this value
7963 table_filter: Optional[str] = None,
7964 # Optional. Return tables up to the table_limit
7965 table_limit: Optional[int] = None,
7966 transport_options: Optional[transport.TransportOptions] = None,
7967 ) -> Sequence[mdls.SchemaTables]:
7968 """Get tables for a connection"""
7969 connection_name = self.encode_path_param(connection_name)
7970 response = cast(
7971 Sequence[mdls.SchemaTables],
7972 self.get(
7973 path=f"/connections/{connection_name}/tables",
7974 structure=Sequence[mdls.SchemaTables],
7975 query_params={
7976 "database": database,
7977 "schema_name": schema_name,
7978 "cache": cache,
7979 "fields": fields,
7980 "table_filter": table_filter,
7981 "table_limit": table_limit,
7982 },
7983 transport_options=transport_options,
7984 ),
7985 )
7986 return response
7987
7988 # ### Get the columns (and therefore also the tables) in a specific schema
7989 #
7990 # GET /connections/{connection_name}/columns -> Sequence[mdls.SchemaColumns]
7991 def connection_columns(
7992 self,
7993 # Name of connection
7994 connection_name: str,
7995 # For dialects that support multiple databases, optionally identify which to use
7996 database: Optional[str] = None,
7997 # Name of schema to use.
7998 schema_name: Optional[str] = None,
7999 # True to fetch from cache, false to load fresh
8000 cache: Optional[bool] = None,
8001 # limits the tables per schema returned
8002 table_limit: Optional[int] = None,
8003 # only fetch columns for a given (comma-separated) list of tables
8004 table_names: Optional[str] = None,
8005 # Requested fields.
8006 fields: Optional[str] = None,
8007 transport_options: Optional[transport.TransportOptions] = None,
8008 ) -> Sequence[mdls.SchemaColumns]:
8009 """Get columns for a connection"""
8010 connection_name = self.encode_path_param(connection_name)
8011 response = cast(
8012 Sequence[mdls.SchemaColumns],
8013 self.get(
8014 path=f"/connections/{connection_name}/columns",
8015 structure=Sequence[mdls.SchemaColumns],
8016 query_params={
8017 "database": database,
8018 "schema_name": schema_name,
8019 "cache": cache,
8020 "table_limit": table_limit,
8021 "table_names": table_names,
8022 "fields": fields,
8023 },
8024 transport_options=transport_options,
8025 ),
8026 )
8027 return response
8028
8029 # ### Search a connection for columns matching the specified name
8030 #
8031 # **Note**: `column_name` must be a valid column name. It is not a search pattern.
8032 #
8033 # GET /connections/{connection_name}/search_columns -> Sequence[mdls.ColumnSearch]
8034 def connection_search_columns(
8035 self,
8036 # Name of connection
8037 connection_name: str,
8038 # Column name to find
8039 column_name: Optional[str] = None,
8040 # Requested fields.
8041 fields: Optional[str] = None,
8042 transport_options: Optional[transport.TransportOptions] = None,
8043 ) -> Sequence[mdls.ColumnSearch]:
8044 """Search a connection for columns"""
8045 connection_name = self.encode_path_param(connection_name)
8046 response = cast(
8047 Sequence[mdls.ColumnSearch],
8048 self.get(
8049 path=f"/connections/{connection_name}/search_columns",
8050 structure=Sequence[mdls.ColumnSearch],
8051 query_params={"column_name": column_name, "fields": fields},
8052 transport_options=transport_options,
8053 ),
8054 )
8055 return response
8056
8057 # ### Connection cost estimating
8058 #
8059 # Assign a `sql` statement to the body of the request. e.g., for Ruby, `{sql: 'select * from users'}`
8060 #
8061 # **Note**: If the connection's dialect has no support for cost estimates, an error will be returned
8062 #
8063 # POST /connections/{connection_name}/cost_estimate -> mdls.CostEstimate
8064 def connection_cost_estimate(
8065 self,
8066 # Name of connection
8067 connection_name: str,
8068 # WARNING: no writeable properties found for POST, PUT, or PATCH
8069 body: mdls.CreateCostEstimate,
8070 # Requested fields.
8071 fields: Optional[str] = None,
8072 transport_options: Optional[transport.TransportOptions] = None,
8073 ) -> mdls.CostEstimate:
8074 """Estimate costs for a connection"""
8075 connection_name = self.encode_path_param(connection_name)
8076 response = cast(
8077 mdls.CostEstimate,
8078 self.post(
8079 path=f"/connections/{connection_name}/cost_estimate",
8080 structure=mdls.CostEstimate,
8081 query_params={"fields": fields},
8082 body=body,
8083 transport_options=transport_options,
8084 ),
8085 )
8086 return response
8087
8088 # endregion
8089
8090 # region Project: Manage Projects
8091
8092 # ### Fetches a CI Run.
8093 #
8094 # GET /projects/{project_id}/ci/runs/{run_id} -> mdls.ProjectRun
8095 def get_ci_run(
8096 self,
8097 # Project Id
8098 project_id: str,
8099 # Run Id
8100 run_id: str,
8101 # Requested fields
8102 fields: Optional[str] = None,
8103 transport_options: Optional[transport.TransportOptions] = None,
8104 ) -> mdls.ProjectRun:
8105 """Fetch Continuous Integration run"""
8106 project_id = self.encode_path_param(project_id)
8107 run_id = self.encode_path_param(run_id)
8108 response = cast(
8109 mdls.ProjectRun,
8110 self.get(
8111 path=f"/projects/{project_id}/ci/runs/{run_id}",
8112 structure=mdls.ProjectRun,
8113 query_params={"fields": fields},
8114 transport_options=transport_options,
8115 ),
8116 )
8117 return response
8118
8119 # ### Creates a CI Run.
8120 #
8121 # POST /projects/{project_id}/ci/run -> mdls.CreateCIRunResponse
8122 def create_ci_run(
8123 self,
8124 # Project Id
8125 project_id: str,
8126 body: mdls.CreateCIRunRequest,
8127 # Requested fields
8128 fields: Optional[str] = None,
8129 transport_options: Optional[transport.TransportOptions] = None,
8130 ) -> mdls.CreateCIRunResponse:
8131 """Create a Continuous Integration run"""
8132 project_id = self.encode_path_param(project_id)
8133 response = cast(
8134 mdls.CreateCIRunResponse,
8135 self.post(
8136 path=f"/projects/{project_id}/ci/run",
8137 structure=mdls.CreateCIRunResponse,
8138 query_params={"fields": fields},
8139 body=body,
8140 transport_options=transport_options,
8141 ),
8142 )
8143 return response
8144
8145 # ### Generate Lockfile for All LookML Dependencies
8146 #
8147 # Git must have been configured, must be in dev mode and deploy permission required
8148 #
8149 # Install_all is a two step process
8150 # 1. For each remote_dependency in a project the dependency manager will resolve any ambiguous ref.
8151 # 2. The project will then write out a lockfile including each remote_dependency with its resolved ref.
8152 #
8153 # POST /projects/{project_id}/manifest/lock_all -> str
8154 def lock_all(
8155 self,
8156 # Id of project
8157 project_id: str,
8158 # Requested fields
8159 fields: Optional[str] = None,
8160 transport_options: Optional[transport.TransportOptions] = None,
8161 ) -> str:
8162 """Lock All"""
8163 project_id = self.encode_path_param(project_id)
8164 response = cast(
8165 str,
8166 self.post(
8167 path=f"/projects/{project_id}/manifest/lock_all",
8168 structure=str,
8169 query_params={"fields": fields},
8170 transport_options=transport_options,
8171 ),
8172 )
8173 return response
8174
8175 # ### Get All Git Branches
8176 #
8177 # Returns a list of git branches in the project repository
8178 #
8179 # GET /projects/{project_id}/git_branches -> Sequence[mdls.GitBranch]
8180 def all_git_branches(
8181 self,
8182 # Project Id
8183 project_id: str,
8184 transport_options: Optional[transport.TransportOptions] = None,
8185 ) -> Sequence[mdls.GitBranch]:
8186 """Get All Git Branches"""
8187 project_id = self.encode_path_param(project_id)
8188 response = cast(
8189 Sequence[mdls.GitBranch],
8190 self.get(
8191 path=f"/projects/{project_id}/git_branches",
8192 structure=Sequence[mdls.GitBranch],
8193 transport_options=transport_options,
8194 ),
8195 )
8196 return response
8197
8198 # ### Get the Current Git Branch
8199 #
8200 # Returns the git branch currently checked out in the given project repository
8201 #
8202 # GET /projects/{project_id}/git_branch -> mdls.GitBranch
8203 def git_branch(
8204 self,
8205 # Project Id
8206 project_id: str,
8207 transport_options: Optional[transport.TransportOptions] = None,
8208 ) -> mdls.GitBranch:
8209 """Get Active Git Branch"""
8210 project_id = self.encode_path_param(project_id)
8211 response = cast(
8212 mdls.GitBranch,
8213 self.get(
8214 path=f"/projects/{project_id}/git_branch",
8215 structure=mdls.GitBranch,
8216 transport_options=transport_options,
8217 ),
8218 )
8219 return response
8220
8221 # ### Checkout and/or reset --hard an existing Git Branch
8222 #
8223 # Only allowed in development mode
8224 # - Call `update_session` to select the 'dev' workspace.
8225 #
8226 # Checkout an existing branch if name field is different from the name of the currently checked out branch.
8227 #
8228 # Optionally specify a branch name, tag name or commit SHA to which the branch should be reset.
8229 # **DANGER** hard reset will be force pushed to the remote. Unsaved changes and commits may be permanently lost.
8230 #
8231 # PUT /projects/{project_id}/git_branch -> mdls.GitBranch
8232 def update_git_branch(
8233 self,
8234 # Project Id
8235 project_id: str,
8236 body: mdls.WriteGitBranch,
8237 transport_options: Optional[transport.TransportOptions] = None,
8238 ) -> mdls.GitBranch:
8239 """Update Project Git Branch"""
8240 project_id = self.encode_path_param(project_id)
8241 response = cast(
8242 mdls.GitBranch,
8243 self.put(
8244 path=f"/projects/{project_id}/git_branch",
8245 structure=mdls.GitBranch,
8246 body=body,
8247 transport_options=transport_options,
8248 ),
8249 )
8250 return response
8251
8252 # ### Create and Checkout a Git Branch
8253 #
8254 # Creates and checks out a new branch in the given project repository
8255 # Only allowed in development mode
8256 # - Call `update_session` to select the 'dev' workspace.
8257 #
8258 # Optionally specify a branch name, tag name or commit SHA as the start point in the ref field.
8259 # If no ref is specified, HEAD of the current branch will be used as the start point for the new branch.
8260 #
8261 # POST /projects/{project_id}/git_branch -> mdls.GitBranch
8262 def create_git_branch(
8263 self,
8264 # Project Id
8265 project_id: str,
8266 body: mdls.WriteGitBranch,
8267 transport_options: Optional[transport.TransportOptions] = None,
8268 ) -> mdls.GitBranch:
8269 """Checkout New Git Branch"""
8270 project_id = self.encode_path_param(project_id)
8271 response = cast(
8272 mdls.GitBranch,
8273 self.post(
8274 path=f"/projects/{project_id}/git_branch",
8275 structure=mdls.GitBranch,
8276 body=body,
8277 transport_options=transport_options,
8278 ),
8279 )
8280 return response
8281
8282 # ### Get the specified Git Branch
8283 #
8284 # Returns the git branch specified in branch_name path param if it exists in the given project repository
8285 #
8286 # GET /projects/{project_id}/git_branch/{branch_name} -> mdls.GitBranch
8287 def find_git_branch(
8288 self,
8289 # Project Id
8290 project_id: str,
8291 # Branch Name
8292 branch_name: str,
8293 transport_options: Optional[transport.TransportOptions] = None,
8294 ) -> mdls.GitBranch:
8295 """Find a Git Branch"""
8296 project_id = self.encode_path_param(project_id)
8297 branch_name = self.encode_path_param(branch_name)
8298 response = cast(
8299 mdls.GitBranch,
8300 self.get(
8301 path=f"/projects/{project_id}/git_branch/{branch_name}",
8302 structure=mdls.GitBranch,
8303 transport_options=transport_options,
8304 ),
8305 )
8306 return response
8307
8308 # ### Delete the specified Git Branch
8309 #
8310 # Delete git branch specified in branch_name path param from local and remote of specified project repository
8311 #
8312 # DELETE /projects/{project_id}/git_branch/{branch_name} -> str
8313 def delete_git_branch(
8314 self,
8315 # Project Id
8316 project_id: str,
8317 # Branch Name
8318 branch_name: str,
8319 transport_options: Optional[transport.TransportOptions] = None,
8320 ) -> str:
8321 """Delete a Git Branch"""
8322 project_id = self.encode_path_param(project_id)
8323 branch_name = self.encode_path_param(branch_name)
8324 response = cast(
8325 str,
8326 self.delete(
8327 path=f"/projects/{project_id}/git_branch/{branch_name}",
8328 structure=str,
8329 transport_options=transport_options,
8330 ),
8331 )
8332 return response
8333
8334 # ### Deploy a Remote Branch or Ref to Production
8335 #
8336 # Git must have been configured and deploy permission required.
8337 #
8338 # Deploy is a one/two step process
8339 # 1. If this is the first deploy of this project, create the production project with git repository.
8340 # 2. Pull the branch or ref into the production project.
8341 #
8342 # Can only specify either a branch or a ref.
8343 #
8344 # POST /projects/{project_id}/deploy_ref_to_production -> str
8345 def deploy_ref_to_production(
8346 self,
8347 # Id of project
8348 project_id: str,
8349 # Branch to deploy to production
8350 branch: Optional[str] = None,
8351 # Ref to deploy to production
8352 ref: Optional[str] = None,
8353 transport_options: Optional[transport.TransportOptions] = None,
8354 ) -> str:
8355 """Deploy Remote Branch or Ref to Production"""
8356 project_id = self.encode_path_param(project_id)
8357 response = cast(
8358 str,
8359 self.post(
8360 path=f"/projects/{project_id}/deploy_ref_to_production",
8361 structure=str,
8362 query_params={"branch": branch, "ref": ref},
8363 transport_options=transport_options,
8364 ),
8365 )
8366 return response
8367
8368 # ### Deploy LookML from this Development Mode Project to Production
8369 #
8370 # Git must have been configured, must be in dev mode and deploy permission required
8371 #
8372 # Deploy is a two / three step process:
8373 #
8374 # 1. Push commits in current branch of dev mode project to the production branch (origin/master).
8375 # Note a. This step is skipped in read-only projects.
8376 # Note b. If this step is unsuccessful for any reason (e.g. rejected non-fastforward because production branch has
8377 # commits not in current branch), subsequent steps will be skipped.
8378 # 2. If this is the first deploy of this project, create the production project with git repository.
8379 # 3. Pull the production branch into the production project.
8380 #
8381 # POST /projects/{project_id}/deploy_to_production -> str
8382 def deploy_to_production(
8383 self,
8384 # Id of project
8385 project_id: str,
8386 transport_options: Optional[transport.TransportOptions] = None,
8387 ) -> str:
8388 """Deploy To Production"""
8389 project_id = self.encode_path_param(project_id)
8390 response = cast(
8391 str,
8392 self.post(
8393 path=f"/projects/{project_id}/deploy_to_production",
8394 structure=str,
8395 transport_options=transport_options,
8396 ),
8397 )
8398 return response
8399
8400 # ### Reset a project to the revision of the project that is in production.
8401 #
8402 # **DANGER** this will delete any changes that have not been pushed to a remote repository.
8403 #
8404 # POST /projects/{project_id}/reset_to_production -> str
8405 def reset_project_to_production(
8406 self,
8407 # Id of project
8408 project_id: str,
8409 transport_options: Optional[transport.TransportOptions] = None,
8410 ) -> str:
8411 """Reset To Production"""
8412 project_id = self.encode_path_param(project_id)
8413 response = cast(
8414 str,
8415 self.post(
8416 path=f"/projects/{project_id}/reset_to_production",
8417 structure=str,
8418 transport_options=transport_options,
8419 ),
8420 )
8421 return response
8422
8423 # ### Reset a project development branch to the revision of the project that is on the remote.
8424 #
8425 # **DANGER** this will delete any changes that have not been pushed to a remote repository.
8426 #
8427 # POST /projects/{project_id}/reset_to_remote -> str
8428 def reset_project_to_remote(
8429 self,
8430 # Id of project
8431 project_id: str,
8432 transport_options: Optional[transport.TransportOptions] = None,
8433 ) -> str:
8434 """Reset To Remote"""
8435 project_id = self.encode_path_param(project_id)
8436 response = cast(
8437 str,
8438 self.post(
8439 path=f"/projects/{project_id}/reset_to_remote",
8440 structure=str,
8441 transport_options=transport_options,
8442 ),
8443 )
8444 return response
8445
8446 # ### Get All Projects
8447 #
8448 # Returns all projects visible to the current user
8449 #
8450 # GET /projects -> Sequence[mdls.Project]
8451 def all_projects(
8452 self,
8453 # Requested fields
8454 fields: Optional[str] = None,
8455 transport_options: Optional[transport.TransportOptions] = None,
8456 ) -> Sequence[mdls.Project]:
8457 """Get All Projects"""
8458 response = cast(
8459 Sequence[mdls.Project],
8460 self.get(
8461 path="/projects",
8462 structure=Sequence[mdls.Project],
8463 query_params={"fields": fields},
8464 transport_options=transport_options,
8465 ),
8466 )
8467 return response
8468
8469 # ### Create A Project
8470 #
8471 # dev mode required.
8472 # - Call `update_session` to select the 'dev' workspace.
8473 #
8474 # `name` is required.
8475 # `git_remote_url` is not allowed. To configure Git for the newly created project, follow the instructions in `update_project`.
8476 #
8477 # POST /projects -> mdls.Project
8478 def create_project(
8479 self,
8480 body: mdls.WriteProject,
8481 transport_options: Optional[transport.TransportOptions] = None,
8482 ) -> mdls.Project:
8483 """Create Project"""
8484 response = cast(
8485 mdls.Project,
8486 self.post(
8487 path="/projects",
8488 structure=mdls.Project,
8489 body=body,
8490 transport_options=transport_options,
8491 ),
8492 )
8493 return response
8494
8495 # ### Get A Project
8496 #
8497 # Returns the project with the given project id
8498 #
8499 # GET /projects/{project_id} -> mdls.Project
8500 def project(
8501 self,
8502 # Project Id
8503 project_id: str,
8504 # Requested fields
8505 fields: Optional[str] = None,
8506 transport_options: Optional[transport.TransportOptions] = None,
8507 ) -> mdls.Project:
8508 """Get Project"""
8509 project_id = self.encode_path_param(project_id)
8510 response = cast(
8511 mdls.Project,
8512 self.get(
8513 path=f"/projects/{project_id}",
8514 structure=mdls.Project,
8515 query_params={"fields": fields},
8516 transport_options=transport_options,
8517 ),
8518 )
8519 return response
8520
8521 # ### Update Project Configuration
8522 #
8523 # Apply changes to a project's configuration.
8524 #
8525 #
8526 # #### Configuring Git for a Project
8527 #
8528 # To set up a Looker project with a remote git repository, follow these steps:
8529 #
8530 # 1. Call `update_session` to select the 'dev' workspace.
8531 # 1. Call `create_git_deploy_key` to create a new deploy key for the project
8532 # 1. Copy the deploy key text into the remote git repository's ssh key configuration
8533 # 1. Call `update_project` to set project's `git_remote_url` ()and `git_service_name`, if necessary).
8534 #
8535 # When you modify a project's `git_remote_url`, Looker connects to the remote repository to fetch
8536 # metadata. The remote git repository MUST be configured with the Looker-generated deploy
8537 # key for this project prior to setting the project's `git_remote_url`.
8538 #
8539 # To set up a Looker project with a git repository residing on the Looker server (a 'bare' git repo):
8540 #
8541 # 1. Call `update_session` to select the 'dev' workspace.
8542 # 1. Call `update_project` setting `git_remote_url` to null and `git_service_name` to "bare".
8543 #
8544 # PATCH /projects/{project_id} -> mdls.Project
8545 def update_project(
8546 self,
8547 # Project Id
8548 project_id: str,
8549 body: mdls.WriteProject,
8550 # Requested fields
8551 fields: Optional[str] = None,
8552 transport_options: Optional[transport.TransportOptions] = None,
8553 ) -> mdls.Project:
8554 """Update Project"""
8555 project_id = self.encode_path_param(project_id)
8556 response = cast(
8557 mdls.Project,
8558 self.patch(
8559 path=f"/projects/{project_id}",
8560 structure=mdls.Project,
8561 query_params={"fields": fields},
8562 body=body,
8563 transport_options=transport_options,
8564 ),
8565 )
8566 return response
8567
8568 # ### Get A Projects Manifest object
8569 #
8570 # Returns the project with the given project id
8571 #
8572 # GET /projects/{project_id}/manifest -> mdls.Manifest
8573 def manifest(
8574 self,
8575 # Project Id
8576 project_id: str,
8577 transport_options: Optional[transport.TransportOptions] = None,
8578 ) -> mdls.Manifest:
8579 """Get Manifest"""
8580 project_id = self.encode_path_param(project_id)
8581 response = cast(
8582 mdls.Manifest,
8583 self.get(
8584 path=f"/projects/{project_id}/manifest",
8585 structure=mdls.Manifest,
8586 transport_options=transport_options,
8587 ),
8588 )
8589 return response
8590
8591 # ### Git Deploy Key
8592 #
8593 # Returns the ssh public key previously created for a project's git repository.
8594 #
8595 # GET /projects/{project_id}/git/deploy_key -> str
8596 def git_deploy_key(
8597 self,
8598 # Project Id
8599 project_id: str,
8600 transport_options: Optional[transport.TransportOptions] = None,
8601 ) -> str:
8602 """Git Deploy Key"""
8603 project_id = self.encode_path_param(project_id)
8604 response = cast(
8605 str,
8606 self.get(
8607 path=f"/projects/{project_id}/git/deploy_key",
8608 structure=str,
8609 transport_options=transport_options,
8610 ),
8611 )
8612 return response
8613
8614 # ### Create Git Deploy Key
8615 #
8616 # Create a public/private key pair for authenticating ssh git requests from Looker to a remote git repository
8617 # for a particular Looker project.
8618 #
8619 # Returns the public key of the generated ssh key pair.
8620 #
8621 # Copy this public key to your remote git repository's ssh keys configuration so that the remote git service can
8622 # validate and accept git requests from the Looker server.
8623 #
8624 # POST /projects/{project_id}/git/deploy_key -> str
8625 def create_git_deploy_key(
8626 self,
8627 # Project Id
8628 project_id: str,
8629 transport_options: Optional[transport.TransportOptions] = None,
8630 ) -> str:
8631 """Create Deploy Key"""
8632 project_id = self.encode_path_param(project_id)
8633 response = cast(
8634 str,
8635 self.post(
8636 path=f"/projects/{project_id}/git/deploy_key",
8637 structure=str,
8638 transport_options=transport_options,
8639 ),
8640 )
8641 return response
8642
8643 # ### Get Cached Project Validation Results
8644 #
8645 # Returns the cached results of a previous project validation calculation, if any.
8646 # Returns http status 204 No Content if no validation results exist.
8647 #
8648 # Validating the content of all the files in a project can be computationally intensive
8649 # for large projects. Use this API to simply fetch the results of the most recent
8650 # project validation rather than revalidating the entire project from scratch.
8651 #
8652 # A value of `"stale": true` in the response indicates that the project has changed since
8653 # the cached validation results were computed. The cached validation results may no longer
8654 # reflect the current state of the project.
8655 #
8656 # GET /projects/{project_id}/validate -> mdls.ProjectValidationCache
8657 def project_validation_results(
8658 self,
8659 # Project Id
8660 project_id: str,
8661 # Requested fields
8662 fields: Optional[str] = None,
8663 transport_options: Optional[transport.TransportOptions] = None,
8664 ) -> mdls.ProjectValidationCache:
8665 """Cached Project Validation Results"""
8666 project_id = self.encode_path_param(project_id)
8667 response = cast(
8668 mdls.ProjectValidationCache,
8669 self.get(
8670 path=f"/projects/{project_id}/validate",
8671 structure=mdls.ProjectValidationCache,
8672 query_params={"fields": fields},
8673 transport_options=transport_options,
8674 ),
8675 )
8676 return response
8677
8678 # ### Validate Project
8679 #
8680 # Performs lint validation of all lookml files in the project.
8681 # Returns a list of errors found, if any.
8682 #
8683 # Validating the content of all the files in a project can be computationally intensive
8684 # for large projects. For best performance, call `validate_project(project_id)` only
8685 # when you really want to recompute project validation. To quickly display the results of
8686 # the most recent project validation (without recomputing), use `project_validation_results(project_id)`
8687 #
8688 # POST /projects/{project_id}/validate -> mdls.ProjectValidation
8689 def validate_project(
8690 self,
8691 # Project Id
8692 project_id: str,
8693 # Requested fields
8694 fields: Optional[str] = None,
8695 transport_options: Optional[transport.TransportOptions] = None,
8696 ) -> mdls.ProjectValidation:
8697 """Validate Project"""
8698 project_id = self.encode_path_param(project_id)
8699 response = cast(
8700 mdls.ProjectValidation,
8701 self.post(
8702 path=f"/projects/{project_id}/validate",
8703 structure=mdls.ProjectValidation,
8704 query_params={"fields": fields},
8705 transport_options=transport_options,
8706 ),
8707 )
8708 return response
8709
8710 # ### Get Project Workspace
8711 #
8712 # Returns information about the state of the project files in the currently selected workspace
8713 #
8714 # GET /projects/{project_id}/current_workspace -> mdls.ProjectWorkspace
8715 def project_workspace(
8716 self,
8717 # Project Id
8718 project_id: str,
8719 # Requested fields
8720 fields: Optional[str] = None,
8721 transport_options: Optional[transport.TransportOptions] = None,
8722 ) -> mdls.ProjectWorkspace:
8723 """Get Project Workspace"""
8724 project_id = self.encode_path_param(project_id)
8725 response = cast(
8726 mdls.ProjectWorkspace,
8727 self.get(
8728 path=f"/projects/{project_id}/current_workspace",
8729 structure=mdls.ProjectWorkspace,
8730 query_params={"fields": fields},
8731 transport_options=transport_options,
8732 ),
8733 )
8734 return response
8735
8736 # ### Get All Project Files
8737 #
8738 # Returns a list of the files in the project
8739 #
8740 # GET /projects/{project_id}/files -> Sequence[mdls.ProjectFile]
8741 def all_project_files(
8742 self,
8743 # Project Id
8744 project_id: str,
8745 # Requested fields
8746 fields: Optional[str] = None,
8747 transport_options: Optional[transport.TransportOptions] = None,
8748 ) -> Sequence[mdls.ProjectFile]:
8749 """Get All Project Files"""
8750 project_id = self.encode_path_param(project_id)
8751 response = cast(
8752 Sequence[mdls.ProjectFile],
8753 self.get(
8754 path=f"/projects/{project_id}/files",
8755 structure=Sequence[mdls.ProjectFile],
8756 query_params={"fields": fields},
8757 transport_options=transport_options,
8758 ),
8759 )
8760 return response
8761
8762 # ### Get Project File Info
8763 #
8764 # Returns information about a file in the project
8765 #
8766 # GET /projects/{project_id}/files/file -> mdls.ProjectFile
8767 def project_file(
8768 self,
8769 # Project Id
8770 project_id: str,
8771 # File Id
8772 file_id: str,
8773 # Requested fields
8774 fields: Optional[str] = None,
8775 transport_options: Optional[transport.TransportOptions] = None,
8776 ) -> mdls.ProjectFile:
8777 """Get Project File"""
8778 project_id = self.encode_path_param(project_id)
8779 response = cast(
8780 mdls.ProjectFile,
8781 self.get(
8782 path=f"/projects/{project_id}/files/file",
8783 structure=mdls.ProjectFile,
8784 query_params={"file_id": file_id, "fields": fields},
8785 transport_options=transport_options,
8786 ),
8787 )
8788 return response
8789
8790 # ### Get All Git Connection Tests
8791 #
8792 # 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.
8793 #
8794 # 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.
8795 #
8796 # For example, a late-stage test for write access is meaningless if connecting to the git server (an early test) is failing.
8797 #
8798 # GET /projects/{project_id}/git_connection_tests -> Sequence[mdls.GitConnectionTest]
8799 def all_git_connection_tests(
8800 self,
8801 # Project Id
8802 project_id: str,
8803 # (Optional: leave blank for root project) The remote url for remote dependency to test.
8804 remote_url: Optional[str] = None,
8805 transport_options: Optional[transport.TransportOptions] = None,
8806 ) -> Sequence[mdls.GitConnectionTest]:
8807 """Get All Git Connection Tests"""
8808 project_id = self.encode_path_param(project_id)
8809 response = cast(
8810 Sequence[mdls.GitConnectionTest],
8811 self.get(
8812 path=f"/projects/{project_id}/git_connection_tests",
8813 structure=Sequence[mdls.GitConnectionTest],
8814 query_params={"remote_url": remote_url},
8815 transport_options=transport_options,
8816 ),
8817 )
8818 return response
8819
8820 # ### Run a git connection test
8821 #
8822 # 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
8823 # is intended to help debug git connections when things do not work properly, to give
8824 # more helpful information about why a git url is not working with Looker.
8825 #
8826 # Tests should be run in the order they are returned by [Get All Git Connection Tests](#!/Project/all_git_connection_tests).
8827 #
8828 # GET /projects/{project_id}/git_connection_tests/{test_id} -> mdls.GitConnectionTestResult
8829 def run_git_connection_test(
8830 self,
8831 # Project Id
8832 project_id: str,
8833 # Test Id
8834 test_id: str,
8835 # (Optional: leave blank for root project) The remote url for remote dependency to test.
8836 remote_url: Optional[str] = None,
8837 # (Optional: leave blank for dev credentials) Whether to use git production credentials.
8838 use_production: Optional[str] = None,
8839 transport_options: Optional[transport.TransportOptions] = None,
8840 ) -> mdls.GitConnectionTestResult:
8841 """Run Git Connection Test"""
8842 project_id = self.encode_path_param(project_id)
8843 test_id = self.encode_path_param(test_id)
8844 response = cast(
8845 mdls.GitConnectionTestResult,
8846 self.get(
8847 path=f"/projects/{project_id}/git_connection_tests/{test_id}",
8848 structure=mdls.GitConnectionTestResult,
8849 query_params={
8850 "remote_url": remote_url,
8851 "use_production": use_production,
8852 },
8853 transport_options=transport_options,
8854 ),
8855 )
8856 return response
8857
8858 # ### Get All LookML Tests
8859 #
8860 # Returns a list of tests which can be run to validate a project's LookML code and/or the underlying data,
8861 # optionally filtered by the file id.
8862 # Call [Run LookML Test](#!/Project/run_lookml_test) to execute tests.
8863 #
8864 # GET /projects/{project_id}/lookml_tests -> Sequence[mdls.LookmlTest]
8865 def all_lookml_tests(
8866 self,
8867 # Project Id
8868 project_id: str,
8869 # File Id
8870 file_id: Optional[str] = None,
8871 transport_options: Optional[transport.TransportOptions] = None,
8872 ) -> Sequence[mdls.LookmlTest]:
8873 """Get All LookML Tests"""
8874 project_id = self.encode_path_param(project_id)
8875 response = cast(
8876 Sequence[mdls.LookmlTest],
8877 self.get(
8878 path=f"/projects/{project_id}/lookml_tests",
8879 structure=Sequence[mdls.LookmlTest],
8880 query_params={"file_id": file_id},
8881 transport_options=transport_options,
8882 ),
8883 )
8884 return response
8885
8886 # ### Run LookML Tests
8887 #
8888 # Runs all tests in the project, optionally filtered by file, test, and/or model.
8889 #
8890 # GET /projects/{project_id}/lookml_tests/run -> Sequence[mdls.LookmlTestResult]
8891 def run_lookml_test(
8892 self,
8893 # Project Id
8894 project_id: str,
8895 # File Name
8896 file_id: Optional[str] = None,
8897 # Test Name
8898 test: Optional[str] = None,
8899 # Model Name
8900 model: Optional[str] = None,
8901 transport_options: Optional[transport.TransportOptions] = None,
8902 ) -> Sequence[mdls.LookmlTestResult]:
8903 """Run LookML Test"""
8904 project_id = self.encode_path_param(project_id)
8905 response = cast(
8906 Sequence[mdls.LookmlTestResult],
8907 self.get(
8908 path=f"/projects/{project_id}/lookml_tests/run",
8909 structure=Sequence[mdls.LookmlTestResult],
8910 query_params={"file_id": file_id, "test": test, "model": model},
8911 transport_options=transport_options,
8912 ),
8913 )
8914 return response
8915
8916 # ### Creates a tag for the most recent commit, or a specific ref is a SHA is provided
8917 #
8918 # POST /projects/{project_id}/tag -> mdls.Project
8919 def tag_ref(
8920 self,
8921 # Project Id
8922 project_id: str,
8923 body: mdls.WriteProject,
8924 # (Optional): Commit Sha to Tag
8925 commit_sha: Optional[str] = None,
8926 # Tag Name
8927 tag_name: Optional[str] = None,
8928 # (Optional): Tag Message
8929 tag_message: Optional[str] = None,
8930 transport_options: Optional[transport.TransportOptions] = None,
8931 ) -> mdls.Project:
8932 """Tag Ref"""
8933 project_id = self.encode_path_param(project_id)
8934 response = cast(
8935 mdls.Project,
8936 self.post(
8937 path=f"/projects/{project_id}/tag",
8938 structure=mdls.Project,
8939 query_params={
8940 "commit_sha": commit_sha,
8941 "tag_name": tag_name,
8942 "tag_message": tag_message,
8943 },
8944 body=body,
8945 transport_options=transport_options,
8946 ),
8947 )
8948 return response
8949
8950 # ### Configure Repository Credential for a remote dependency
8951 #
8952 # Admin required.
8953 #
8954 # `root_project_id` is required.
8955 # `credential_id` is required.
8956 #
8957 # PUT /projects/{root_project_id}/credential/{credential_id} -> mdls.RepositoryCredential
8958 def update_repository_credential(
8959 self,
8960 # Root Project Id
8961 root_project_id: str,
8962 # Credential Id
8963 credential_id: str,
8964 body: mdls.WriteRepositoryCredential,
8965 transport_options: Optional[transport.TransportOptions] = None,
8966 ) -> mdls.RepositoryCredential:
8967 """Create Repository Credential"""
8968 root_project_id = self.encode_path_param(root_project_id)
8969 credential_id = self.encode_path_param(credential_id)
8970 response = cast(
8971 mdls.RepositoryCredential,
8972 self.put(
8973 path=f"/projects/{root_project_id}/credential/{credential_id}",
8974 structure=mdls.RepositoryCredential,
8975 body=body,
8976 transport_options=transport_options,
8977 ),
8978 )
8979 return response
8980
8981 # ### Repository Credential for a remote dependency
8982 #
8983 # Admin required.
8984 #
8985 # `root_project_id` is required.
8986 # `credential_id` is required.
8987 #
8988 # DELETE /projects/{root_project_id}/credential/{credential_id} -> str
8989 def delete_repository_credential(
8990 self,
8991 # Root Project Id
8992 root_project_id: str,
8993 # Credential Id
8994 credential_id: str,
8995 transport_options: Optional[transport.TransportOptions] = None,
8996 ) -> str:
8997 """Delete Repository Credential"""
8998 root_project_id = self.encode_path_param(root_project_id)
8999 credential_id = self.encode_path_param(credential_id)
9000 response = cast(
9001 str,
9002 self.delete(
9003 path=f"/projects/{root_project_id}/credential/{credential_id}",
9004 structure=str,
9005 transport_options=transport_options,
9006 ),
9007 )
9008 return response
9009
9010 # ### Get all Repository Credentials for a project
9011 #
9012 # `root_project_id` is required.
9013 #
9014 # GET /projects/{root_project_id}/credentials -> Sequence[mdls.RepositoryCredential]
9015 def get_all_repository_credentials(
9016 self,
9017 # Root Project Id
9018 root_project_id: str,
9019 transport_options: Optional[transport.TransportOptions] = None,
9020 ) -> Sequence[mdls.RepositoryCredential]:
9021 """Get All Repository Credentials"""
9022 root_project_id = self.encode_path_param(root_project_id)
9023 response = cast(
9024 Sequence[mdls.RepositoryCredential],
9025 self.get(
9026 path=f"/projects/{root_project_id}/credentials",
9027 structure=Sequence[mdls.RepositoryCredential],
9028 transport_options=transport_options,
9029 ),
9030 )
9031 return response
9032
9033 # endregion
9034
9035 # region Query: Run and Manage Queries
9036
9037 # ### Create an async query task
9038 #
9039 # Creates a query task (job) to run a previously created query asynchronously. Returns a Query Task ID.
9040 #
9041 # Use [query_task(query_task_id)](#!/Query/query_task) to check the execution status of the query task.
9042 # 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.
9043 #
9044 # POST /query_tasks -> mdls.QueryTask
9045 def create_query_task(
9046 self,
9047 body: mdls.WriteCreateQueryTask,
9048 # Row limit (may override the limit in the saved query).
9049 limit: Optional[int] = None,
9050 # Apply model-specified formatting to each result.
9051 apply_formatting: Optional[bool] = None,
9052 # Apply visualization options to results.
9053 apply_vis: Optional[bool] = None,
9054 # Get results from cache if available.
9055 cache: Optional[bool] = None,
9056 # Generate drill links (only applicable to 'json_detail' format.
9057 generate_drill_links: Optional[bool] = None,
9058 # 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.
9059 force_production: Optional[bool] = None,
9060 # Retrieve any results from cache even if the results have expired.
9061 cache_only: Optional[bool] = None,
9062 # Prefix to use for drill links (url encoded).
9063 path_prefix: Optional[str] = None,
9064 # Rebuild PDTS used in query.
9065 rebuild_pdts: Optional[bool] = None,
9066 # Perform table calculations on query results
9067 server_table_calcs: Optional[bool] = None,
9068 # Requested fields
9069 fields: Optional[str] = None,
9070 transport_options: Optional[transport.TransportOptions] = None,
9071 ) -> mdls.QueryTask:
9072 """Run Query Async"""
9073 response = cast(
9074 mdls.QueryTask,
9075 self.post(
9076 path="/query_tasks",
9077 structure=mdls.QueryTask,
9078 query_params={
9079 "limit": limit,
9080 "apply_formatting": apply_formatting,
9081 "apply_vis": apply_vis,
9082 "cache": cache,
9083 "generate_drill_links": generate_drill_links,
9084 "force_production": force_production,
9085 "cache_only": cache_only,
9086 "path_prefix": path_prefix,
9087 "rebuild_pdts": rebuild_pdts,
9088 "server_table_calcs": server_table_calcs,
9089 "fields": fields,
9090 },
9091 body=body,
9092 transport_options=transport_options,
9093 ),
9094 )
9095 return response
9096
9097 # ### Fetch results of multiple async queries
9098 #
9099 # Returns the results of multiple async queries in one request.
9100 #
9101 # For Query Tasks that are not completed, the response will include the execution status of the Query Task but will not include query results.
9102 # Query Tasks whose results have expired will have a status of 'expired'.
9103 # 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'
9104 #
9105 # GET /query_tasks/multi_results -> MutableMapping[str, Any]
9106 def query_task_multi_results(
9107 self,
9108 # List of Query Task IDs
9109 query_task_ids: mdls.DelimSequence[str],
9110 transport_options: Optional[transport.TransportOptions] = None,
9111 ) -> MutableMapping[str, Any]:
9112 """Get Multiple Async Query Results"""
9113 response = cast(
9114 MutableMapping[str, Any],
9115 self.get(
9116 path="/query_tasks/multi_results",
9117 structure=MutableMapping[str, Any],
9118 query_params={"query_task_ids": query_task_ids},
9119 transport_options=transport_options,
9120 ),
9121 )
9122 return response
9123
9124 # ### Get Query Task details
9125 #
9126 # Use this function to check the status of an async query task. After the status
9127 # reaches "Complete", you can call [query_task_results(query_task_id)](#!/Query/query_task_results) to
9128 # retrieve the results of the query.
9129 #
9130 # Use [create_query_task()](#!/Query/create_query_task) to create an async query task.
9131 #
9132 # GET /query_tasks/{query_task_id} -> mdls.QueryTask
9133 def query_task(
9134 self,
9135 # ID of the Query Task
9136 query_task_id: str,
9137 # Requested fields.
9138 fields: Optional[str] = None,
9139 transport_options: Optional[transport.TransportOptions] = None,
9140 ) -> mdls.QueryTask:
9141 """Get Async Query Info"""
9142 query_task_id = self.encode_path_param(query_task_id)
9143 response = cast(
9144 mdls.QueryTask,
9145 self.get(
9146 path=f"/query_tasks/{query_task_id}",
9147 structure=mdls.QueryTask,
9148 query_params={"fields": fields},
9149 transport_options=transport_options,
9150 ),
9151 )
9152 return response
9153
9154 # ### Get Async Query Results
9155 #
9156 # Returns the results of an async query task if the query has completed.
9157 #
9158 # If the query task is still running or waiting to run, this function returns 202 Accepted.
9159 #
9160 # If the query task ID is invalid or the cached results of the query task have expired, this function returns 404 Not Found.
9161 #
9162 # Use [query_task(query_task_id)](#!/Query/query_task) to check the execution status of the query task
9163 # Call query_task_results only after the query task status reaches "Complete".
9164 #
9165 # You can also use [query_task_multi_results()](#!/Query/query_task_multi_results) retrieve the
9166 # results of multiple async query tasks at the same time.
9167 #
9168 # #### SQL Error Handling:
9169 # 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()`.
9170 #
9171 # For `json_detail` result_format: `query_task_results()` will respond with HTTP status '200 OK' and db SQL error info
9172 # will be in the `errors` property of the response object. The 'data' property will be empty.
9173 #
9174 # For all other result formats: `query_task_results()` will respond with HTTP status `400 Bad Request` and some db SQL error info
9175 # will be in the message of the 400 error response, but not as detailed as expressed in `json_detail.errors`.
9176 # These data formats can only carry row data, and error info is not row data.
9177 #
9178 # GET /query_tasks/{query_task_id}/results -> str
9179 def query_task_results(
9180 self,
9181 # ID of the Query Task
9182 query_task_id: str,
9183 transport_options: Optional[transport.TransportOptions] = None,
9184 ) -> str:
9185 """Get Async Query Results"""
9186 query_task_id = self.encode_path_param(query_task_id)
9187 response = cast(
9188 str,
9189 self.get(
9190 path=f"/query_tasks/{query_task_id}/results",
9191 structure=str,
9192 transport_options=transport_options,
9193 ),
9194 )
9195 return response
9196
9197 # ### Get a previously created query by id.
9198 #
9199 # A Looker query object includes the various parameters that define a database query that has been run or
9200 # could be run in the future. These parameters include: model, view, fields, filters, pivots, etc.
9201 # Query *results* are not part of the query object.
9202 #
9203 # Query objects are unique and immutable. Query objects are created automatically in Looker as users explore data.
9204 # Looker does not delete them; they become part of the query history. When asked to create a query for
9205 # any given set of parameters, Looker will first try to find an existing query object with matching
9206 # parameters and will only create a new object when an appropriate object can not be found.
9207 #
9208 # This 'get' method is used to get the details about a query for a given id. See the other methods here
9209 # to 'create' and 'run' queries.
9210 #
9211 # Note that some fields like 'filter_config' and 'vis_config' etc are specific to how the Looker UI
9212 # builds queries and visualizations and are not generally useful for API use. They are not required when
9213 # creating new queries and can usually just be ignored.
9214 #
9215 # GET /queries/{query_id} -> mdls.Query
9216 def query(
9217 self,
9218 # Id of query
9219 query_id: str,
9220 # Requested fields.
9221 fields: Optional[str] = None,
9222 transport_options: Optional[transport.TransportOptions] = None,
9223 ) -> mdls.Query:
9224 """Get Query"""
9225 query_id = self.encode_path_param(query_id)
9226 response = cast(
9227 mdls.Query,
9228 self.get(
9229 path=f"/queries/{query_id}",
9230 structure=mdls.Query,
9231 query_params={"fields": fields},
9232 transport_options=transport_options,
9233 ),
9234 )
9235 return response
9236
9237 # ### Get the query for a given query slug.
9238 #
9239 # This returns the query for the 'slug' in a query share URL.
9240 #
9241 # The 'slug' is a randomly chosen short string that is used as an alternative to the query's id value
9242 # for use in URLs etc. This method exists as a convenience to help you use the API to 'find' queries that
9243 # have been created using the Looker UI.
9244 #
9245 # You can use the Looker explore page to build a query and then choose the 'Share' option to
9246 # show the share url for the query. Share urls generally look something like 'https://looker.yourcompany/x/vwGSbfc'.
9247 # The trailing 'vwGSbfc' is the share slug. You can pass that string to this api method to get details about the query.
9248 # Those details include the 'id' that you can use to run the query. Or, you can copy the query body
9249 # (perhaps with your own modification) and use that as the basis to make/run new queries.
9250 #
9251 # This will also work with slugs from Looker explore urls like
9252 # 'https://looker.yourcompany/explore/ecommerce/orders?qid=aogBgL6o3cKK1jN3RoZl5s'. In this case
9253 # 'aogBgL6o3cKK1jN3RoZl5s' is the slug.
9254 #
9255 # GET /queries/slug/{slug} -> mdls.Query
9256 def query_for_slug(
9257 self,
9258 # Slug of query
9259 slug: str,
9260 # Requested fields.
9261 fields: Optional[str] = None,
9262 transport_options: Optional[transport.TransportOptions] = None,
9263 ) -> mdls.Query:
9264 """Get Query for Slug"""
9265 slug = self.encode_path_param(slug)
9266 response = cast(
9267 mdls.Query,
9268 self.get(
9269 path=f"/queries/slug/{slug}",
9270 structure=mdls.Query,
9271 query_params={"fields": fields},
9272 transport_options=transport_options,
9273 ),
9274 )
9275 return response
9276
9277 # ### Create a query.
9278 #
9279 # This allows you to create a new query that you can later run. Looker queries are immutable once created
9280 # and are not deleted. If you create a query that is exactly like an existing query then the existing query
9281 # will be returned and no new query will be created. Whether a new query is created or not, you can use
9282 # the 'id' in the returned query with the 'run' method.
9283 #
9284 # The query parameters are passed as json in the body of the request.
9285 #
9286 # POST /queries -> mdls.Query
9287 def create_query(
9288 self,
9289 body: mdls.WriteQuery,
9290 # Requested fields.
9291 fields: Optional[str] = None,
9292 transport_options: Optional[transport.TransportOptions] = None,
9293 ) -> mdls.Query:
9294 """Create Query"""
9295 response = cast(
9296 mdls.Query,
9297 self.post(
9298 path="/queries",
9299 structure=mdls.Query,
9300 query_params={"fields": fields},
9301 body=body,
9302 transport_options=transport_options,
9303 ),
9304 )
9305 return response
9306
9307 # ### Run a saved query.
9308 #
9309 # This runs a previously saved query. You can use this on a query that was generated in the Looker UI
9310 # or one that you have explicitly created using the API. You can also use a query 'id' from a saved 'Look'.
9311 #
9312 # The 'result_format' parameter specifies the desired structure and format of the response.
9313 #
9314 # Supported formats:
9315 #
9316 # | result_format | Description
9317 # | :-----------: | :--- |
9318 # | json | Plain json
9319 # | json_bi | (*RECOMMENDED*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query. See JsonBi type for schema
9320 # | json_detail | (*LEGACY*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
9321 # | csv | Comma separated values with a header
9322 # | txt | Tab separated values with a header
9323 # | html | Simple html
9324 # | md | Simple markdown
9325 # | xlsx | MS Excel spreadsheet
9326 # | sql | Returns the generated SQL rather than running the query
9327 # | png | A PNG image of the visualization of the query
9328 # | jpg | A JPG image of the visualization of the query
9329 #
9330 # GET /queries/{query_id}/run/{result_format} -> Union[str, bytes]
9331 def run_query(
9332 self,
9333 # Id of query
9334 query_id: str,
9335 # Format of result
9336 result_format: str,
9337 # Row limit (may override the limit in the saved query).
9338 limit: Optional[int] = None,
9339 # Apply model-specified formatting to each result.
9340 apply_formatting: Optional[bool] = None,
9341 # Apply visualization options to results.
9342 apply_vis: Optional[bool] = None,
9343 # Get results from cache if available.
9344 cache: Optional[bool] = None,
9345 # Render width for image formats.
9346 image_width: Optional[int] = None,
9347 # Render height for image formats.
9348 image_height: Optional[int] = None,
9349 # Generate drill links (only applicable to 'json_detail' format.
9350 generate_drill_links: Optional[bool] = None,
9351 # 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.
9352 force_production: Optional[bool] = None,
9353 # Retrieve any results from cache even if the results have expired.
9354 cache_only: Optional[bool] = None,
9355 # Prefix to use for drill links (url encoded).
9356 path_prefix: Optional[str] = None,
9357 # Rebuild PDTS used in query.
9358 rebuild_pdts: Optional[bool] = None,
9359 # Perform table calculations on query results
9360 server_table_calcs: Optional[bool] = None,
9361 # Specifies the source of this call.
9362 source: Optional[str] = None,
9363 # Return a specialized OAuth error response if a database OAuth error occurs.
9364 enable_oauth_error_response: Optional[bool] = None,
9365 transport_options: Optional[transport.TransportOptions] = None,
9366 ) -> Union[str, bytes]:
9367 """Run Query"""
9368 query_id = self.encode_path_param(query_id)
9369 result_format = self.encode_path_param(result_format)
9370 response = cast(
9371 Union[str, bytes],
9372 self.get(
9373 path=f"/queries/{query_id}/run/{result_format}",
9374 structure=Union[str, bytes], # type: ignore
9375 query_params={
9376 "limit": limit,
9377 "apply_formatting": apply_formatting,
9378 "apply_vis": apply_vis,
9379 "cache": cache,
9380 "image_width": image_width,
9381 "image_height": image_height,
9382 "generate_drill_links": generate_drill_links,
9383 "force_production": force_production,
9384 "cache_only": cache_only,
9385 "path_prefix": path_prefix,
9386 "rebuild_pdts": rebuild_pdts,
9387 "server_table_calcs": server_table_calcs,
9388 "source": source,
9389 "enable_oauth_error_response": enable_oauth_error_response,
9390 },
9391 transport_options=transport_options,
9392 ),
9393 )
9394 return response
9395
9396 # ### Run the query that is specified inline in the posted body.
9397 #
9398 # This allows running a query as defined in json in the posted body. This combines
9399 # the two actions of posting & running a query into one step.
9400 #
9401 # Here is an example body in json:
9402 # ```
9403 # {
9404 # "model":"thelook",
9405 # "view":"inventory_items",
9406 # "fields":["category.name","inventory_items.days_in_inventory_tier","products.count"],
9407 # "filters":{"category.name":"socks"},
9408 # "sorts":["products.count desc 0"],
9409 # "limit":"500",
9410 # "query_timezone":"America/Los_Angeles"
9411 # }
9412 # ```
9413 #
9414 # When using the Ruby SDK this would be passed as a Ruby hash like:
9415 # ```
9416 # {
9417 # :model=>"thelook",
9418 # :view=>"inventory_items",
9419 # :fields=>
9420 # ["category.name",
9421 # "inventory_items.days_in_inventory_tier",
9422 # "products.count"],
9423 # :filters=>{:"category.name"=>"socks"},
9424 # :sorts=>["products.count desc 0"],
9425 # :limit=>"500",
9426 # :query_timezone=>"America/Los_Angeles",
9427 # }
9428 # ```
9429 #
9430 # This will return the result of running the query in the format specified by the 'result_format' parameter.
9431 #
9432 # Supported formats:
9433 #
9434 # | result_format | Description
9435 # | :-----------: | :--- |
9436 # | json | Plain json
9437 # | json_bi | (*RECOMMENDED*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query. See JsonBi type for schema
9438 # | json_detail | (*LEGACY*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
9439 # | csv | Comma separated values with a header
9440 # | txt | Tab separated values with a header
9441 # | html | Simple html
9442 # | md | Simple markdown
9443 # | xlsx | MS Excel spreadsheet
9444 # | sql | Returns the generated SQL rather than running the query
9445 # | png | A PNG image of the visualization of the query
9446 # | jpg | A JPG image of the visualization of the query
9447 #
9448 # POST /queries/run/{result_format} -> Union[str, bytes]
9449 def run_inline_query(
9450 self,
9451 # Format of result
9452 result_format: str,
9453 body: mdls.WriteQuery,
9454 # Row limit (may override the limit in the saved query).
9455 limit: Optional[int] = None,
9456 # Apply model-specified formatting to each result.
9457 apply_formatting: Optional[bool] = None,
9458 # Apply visualization options to results.
9459 apply_vis: Optional[bool] = None,
9460 # Get results from cache if available.
9461 cache: Optional[bool] = None,
9462 # Render width for image formats.
9463 image_width: Optional[int] = None,
9464 # Render height for image formats.
9465 image_height: Optional[int] = None,
9466 # Generate drill links (only applicable to 'json_detail' format.
9467 generate_drill_links: Optional[bool] = None,
9468 # 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.
9469 force_production: Optional[bool] = None,
9470 # Retrieve any results from cache even if the results have expired.
9471 cache_only: Optional[bool] = None,
9472 # Prefix to use for drill links (url encoded).
9473 path_prefix: Optional[str] = None,
9474 # Rebuild PDTS used in query.
9475 rebuild_pdts: Optional[bool] = None,
9476 # Perform table calculations on query results
9477 server_table_calcs: Optional[bool] = None,
9478 # Return a specialized OAuth error response if a database OAuth error occurs.
9479 enable_oauth_error_response: Optional[bool] = None,
9480 transport_options: Optional[transport.TransportOptions] = None,
9481 ) -> Union[str, bytes]:
9482 """Run Inline Query"""
9483 result_format = self.encode_path_param(result_format)
9484 response = cast(
9485 Union[str, bytes],
9486 self.post(
9487 path=f"/queries/run/{result_format}",
9488 structure=Union[str, bytes], # type: ignore
9489 query_params={
9490 "limit": limit,
9491 "apply_formatting": apply_formatting,
9492 "apply_vis": apply_vis,
9493 "cache": cache,
9494 "image_width": image_width,
9495 "image_height": image_height,
9496 "generate_drill_links": generate_drill_links,
9497 "force_production": force_production,
9498 "cache_only": cache_only,
9499 "path_prefix": path_prefix,
9500 "rebuild_pdts": rebuild_pdts,
9501 "server_table_calcs": server_table_calcs,
9502 "enable_oauth_error_response": enable_oauth_error_response,
9503 },
9504 body=body,
9505 transport_options=transport_options,
9506 ),
9507 )
9508 return response
9509
9510 # ### Run an URL encoded query.
9511 #
9512 # This requires the caller to encode the specifiers for the query into the URL query part using
9513 # Looker-specific syntax as explained below.
9514 #
9515 # Generally, you would want to use one of the methods that takes the parameters as json in the POST body
9516 # for creating and/or running queries. This method exists for cases where one really needs to encode the
9517 # parameters into the URL of a single 'GET' request. This matches the way that the Looker UI formats
9518 # 'explore' URLs etc.
9519 #
9520 # The parameters here are very similar to the json body formatting except that the filter syntax is
9521 # tricky. Unfortunately, this format makes this method not currently callable via the 'Try it out!' button
9522 # in this documentation page. But, this is callable when creating URLs manually or when using the Looker SDK.
9523 #
9524 # Here is an example inline query URL:
9525 #
9526 # ```
9527 # 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
9528 # ```
9529 #
9530 # 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:
9531 #
9532 # ```ruby
9533 # query_params =
9534 # {
9535 # fields: "category.name,inventory_items.days_in_inventory_tier,products.count",
9536 # :"f[category.name]" => "socks",
9537 # sorts: "products.count desc 0",
9538 # limit: "500",
9539 # query_timezone: "America/Los_Angeles"
9540 # }
9541 # response = ruby_sdk.run_url_encoded_query('thelook','inventory_items','json', query_params)
9542 #
9543 # ```
9544 #
9545 # Again, it is generally easier to use the variant of this method that passes the full query in the POST body.
9546 # This method is available for cases where other alternatives won't fit the need.
9547 #
9548 # Supported formats:
9549 #
9550 # | result_format | Description
9551 # | :-----------: | :--- |
9552 # | json | Plain json
9553 # | json_bi | (*RECOMMENDED*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query. See JsonBi type for schema
9554 # | json_detail | (*LEGACY*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
9555 # | csv | Comma separated values with a header
9556 # | txt | Tab separated values with a header
9557 # | html | Simple html
9558 # | md | Simple markdown
9559 # | xlsx | MS Excel spreadsheet
9560 # | sql | Returns the generated SQL rather than running the query
9561 # | png | A PNG image of the visualization of the query
9562 # | jpg | A JPG image of the visualization of the query
9563 #
9564 # GET /queries/models/{model_name}/views/{view_name}/run/{result_format} -> Union[str, bytes]
9565 def run_url_encoded_query(
9566 self,
9567 # Model name
9568 model_name: str,
9569 # View name
9570 view_name: str,
9571 # Format of result
9572 result_format: str,
9573 transport_options: Optional[transport.TransportOptions] = None,
9574 ) -> Union[str, bytes]:
9575 """Run Url Encoded Query"""
9576 model_name = self.encode_path_param(model_name)
9577 view_name = self.encode_path_param(view_name)
9578 result_format = self.encode_path_param(result_format)
9579 response = cast(
9580 Union[str, bytes],
9581 self.get(
9582 path=f"/queries/models/{model_name}/views/{view_name}/run/{result_format}",
9583 structure=Union[str, bytes], # type: ignore
9584 transport_options=transport_options,
9585 ),
9586 )
9587 return response
9588
9589 # ### Get Merge Query
9590 #
9591 # Returns a merge query object given its id.
9592 #
9593 # GET /merge_queries/{merge_query_id} -> mdls.MergeQuery
9594 def merge_query(
9595 self,
9596 # Merge Query Id
9597 merge_query_id: str,
9598 # Requested fields
9599 fields: Optional[str] = None,
9600 transport_options: Optional[transport.TransportOptions] = None,
9601 ) -> mdls.MergeQuery:
9602 """Get Merge Query"""
9603 merge_query_id = self.encode_path_param(merge_query_id)
9604 response = cast(
9605 mdls.MergeQuery,
9606 self.get(
9607 path=f"/merge_queries/{merge_query_id}",
9608 structure=mdls.MergeQuery,
9609 query_params={"fields": fields},
9610 transport_options=transport_options,
9611 ),
9612 )
9613 return response
9614
9615 # ### Create Merge Query
9616 #
9617 # Creates a new merge query object.
9618 #
9619 # A merge query takes the results of one or more queries and combines (merges) the results
9620 # according to field mapping definitions. The result is similar to a SQL left outer join.
9621 #
9622 # A merge query can merge results of queries from different SQL databases.
9623 #
9624 # The order that queries are defined in the source_queries array property is significant. The
9625 # first query in the array defines the primary key into which the results of subsequent
9626 # queries will be merged.
9627 #
9628 # Like model/view query objects, merge queries are immutable and have structural identity - if
9629 # you make a request to create a new merge query that is identical to an existing merge query,
9630 # the existing merge query will be returned instead of creating a duplicate. Conversely, any
9631 # change to the contents of a merge query will produce a new object with a new id.
9632 #
9633 # POST /merge_queries -> mdls.MergeQuery
9634 def create_merge_query(
9635 self,
9636 body: Optional[mdls.WriteMergeQuery] = None,
9637 # Requested fields
9638 fields: Optional[str] = None,
9639 transport_options: Optional[transport.TransportOptions] = None,
9640 ) -> mdls.MergeQuery:
9641 """Create Merge Query"""
9642 response = cast(
9643 mdls.MergeQuery,
9644 self.post(
9645 path="/merge_queries",
9646 structure=mdls.MergeQuery,
9647 query_params={"fields": fields},
9648 body=body,
9649 transport_options=transport_options,
9650 ),
9651 )
9652 return response
9653
9654 # Get information about all running queries.
9655 #
9656 # GET /running_queries -> Sequence[mdls.RunningQueries]
9657 def all_running_queries(
9658 self,
9659 transport_options: Optional[transport.TransportOptions] = None,
9660 ) -> Sequence[mdls.RunningQueries]:
9661 """Get All Running Queries"""
9662 response = cast(
9663 Sequence[mdls.RunningQueries],
9664 self.get(
9665 path="/running_queries",
9666 structure=Sequence[mdls.RunningQueries],
9667 transport_options=transport_options,
9668 ),
9669 )
9670 return response
9671
9672 # Kill a query with a specific query_task_id.
9673 #
9674 # DELETE /running_queries/{query_task_id} -> str
9675 def kill_query(
9676 self,
9677 # Query task id.
9678 query_task_id: str,
9679 transport_options: Optional[transport.TransportOptions] = None,
9680 ) -> str:
9681 """Kill Running Query"""
9682 query_task_id = self.encode_path_param(query_task_id)
9683 response = cast(
9684 str,
9685 self.delete(
9686 path=f"/running_queries/{query_task_id}",
9687 structure=str,
9688 transport_options=transport_options,
9689 ),
9690 )
9691 return response
9692
9693 # ### Create a SQL Runner Query
9694 #
9695 # Either the `connection_name` or `model_name` parameter MUST be provided.
9696 #
9697 # POST /sql_queries -> mdls.SqlQuery
9698 def create_sql_query(
9699 self,
9700 body: mdls.SqlQueryCreate,
9701 transport_options: Optional[transport.TransportOptions] = None,
9702 ) -> mdls.SqlQuery:
9703 """Create SQL Runner Query"""
9704 response = cast(
9705 mdls.SqlQuery,
9706 self.post(
9707 path="/sql_queries",
9708 structure=mdls.SqlQuery,
9709 body=body,
9710 transport_options=transport_options,
9711 ),
9712 )
9713 return response
9714
9715 # Get a SQL Runner query.
9716 #
9717 # GET /sql_queries/{slug} -> mdls.SqlQuery
9718 def sql_query(
9719 self,
9720 # slug of query
9721 slug: str,
9722 transport_options: Optional[transport.TransportOptions] = None,
9723 ) -> mdls.SqlQuery:
9724 """Get SQL Runner Query"""
9725 slug = self.encode_path_param(slug)
9726 response = cast(
9727 mdls.SqlQuery,
9728 self.get(
9729 path=f"/sql_queries/{slug}",
9730 structure=mdls.SqlQuery,
9731 transport_options=transport_options,
9732 ),
9733 )
9734 return response
9735
9736 # Execute a SQL Runner query in a given result_format.
9737 #
9738 # POST /sql_queries/{slug}/run/{result_format} -> str
9739 def run_sql_query(
9740 self,
9741 # slug of query
9742 slug: str,
9743 # Format of result, options are: ["inline_json", "json", "json_detail", "json_fe", "json_bi", "csv", "html", "md", "txt", "xlsx", "gsxml", "sql", "odc", "json_label"]
9744 result_format: str,
9745 # 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.
9746 download: Optional[str] = None,
9747 transport_options: Optional[transport.TransportOptions] = None,
9748 ) -> str:
9749 """Run SQL Runner Query"""
9750 slug = self.encode_path_param(slug)
9751 result_format = self.encode_path_param(result_format)
9752 response = cast(
9753 str,
9754 self.post(
9755 path=f"/sql_queries/{slug}/run/{result_format}",
9756 structure=str,
9757 query_params={"download": download},
9758 transport_options=transport_options,
9759 ),
9760 )
9761 return response
9762
9763 # endregion
9764
9765 # region RenderTask: Manage Render Tasks
9766
9767 # ### Create a new task to render a look to an image.
9768 #
9769 # Returns a render task object.
9770 # To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
9771 # Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
9772 #
9773 # POST /render_tasks/looks/{look_id}/{result_format} -> mdls.RenderTask
9774 def create_look_render_task(
9775 self,
9776 # Id of look to render
9777 look_id: str,
9778 # Output type: png, or jpg
9779 result_format: str,
9780 # Output width in pixels
9781 width: int,
9782 # Output height in pixels
9783 height: int,
9784 # Requested fields.
9785 fields: Optional[str] = None,
9786 transport_options: Optional[transport.TransportOptions] = None,
9787 ) -> mdls.RenderTask:
9788 """Create Look Render Task"""
9789 look_id = self.encode_path_param(look_id)
9790 result_format = self.encode_path_param(result_format)
9791 response = cast(
9792 mdls.RenderTask,
9793 self.post(
9794 path=f"/render_tasks/looks/{look_id}/{result_format}",
9795 structure=mdls.RenderTask,
9796 query_params={"width": width, "height": height, "fields": fields},
9797 transport_options=transport_options,
9798 ),
9799 )
9800 return response
9801
9802 # ### Create a new task to render an existing query to an image.
9803 #
9804 # Returns a render task object.
9805 # To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
9806 # Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
9807 #
9808 # POST /render_tasks/queries/{query_id}/{result_format} -> mdls.RenderTask
9809 def create_query_render_task(
9810 self,
9811 # Id of the query to render
9812 query_id: str,
9813 # Output type: png or jpg
9814 result_format: str,
9815 # Output width in pixels
9816 width: int,
9817 # Output height in pixels
9818 height: int,
9819 # Requested fields.
9820 fields: Optional[str] = None,
9821 transport_options: Optional[transport.TransportOptions] = None,
9822 ) -> mdls.RenderTask:
9823 """Create Query Render Task"""
9824 query_id = self.encode_path_param(query_id)
9825 result_format = self.encode_path_param(result_format)
9826 response = cast(
9827 mdls.RenderTask,
9828 self.post(
9829 path=f"/render_tasks/queries/{query_id}/{result_format}",
9830 structure=mdls.RenderTask,
9831 query_params={"width": width, "height": height, "fields": fields},
9832 transport_options=transport_options,
9833 ),
9834 )
9835 return response
9836
9837 # ### Create a new task to render a dashboard to a document or image.
9838 #
9839 # Returns a render task object.
9840 # To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
9841 # Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
9842 #
9843 # POST /render_tasks/dashboards/{dashboard_id}/{result_format} -> mdls.RenderTask
9844 def create_dashboard_render_task(
9845 self,
9846 # Id of dashboard to render. The ID can be a LookML dashboard also.
9847 dashboard_id: str,
9848 # Output type: pdf, png, or jpg
9849 result_format: str,
9850 body: mdls.CreateDashboardRenderTask,
9851 # Output width in pixels
9852 width: int,
9853 # Output height in pixels
9854 height: int,
9855 # Requested fields.
9856 fields: Optional[str] = None,
9857 # Paper size for pdf. Value can be one of: ["letter","legal","tabloid","a0","a1","a2","a3","a4","a5"]
9858 pdf_paper_size: Optional[str] = None,
9859 # Whether to render pdf in landscape paper orientation
9860 pdf_landscape: Optional[bool] = None,
9861 # Whether or not to expand table vis to full length
9862 long_tables: Optional[bool] = None,
9863 # Theme to apply. Will render embedded version of dashboard if valid
9864 theme: Optional[str] = None,
9865 transport_options: Optional[transport.TransportOptions] = None,
9866 ) -> mdls.RenderTask:
9867 """Create Dashboard Render Task"""
9868 dashboard_id = self.encode_path_param(dashboard_id)
9869 result_format = self.encode_path_param(result_format)
9870 response = cast(
9871 mdls.RenderTask,
9872 self.post(
9873 path=f"/render_tasks/dashboards/{dashboard_id}/{result_format}",
9874 structure=mdls.RenderTask,
9875 query_params={
9876 "width": width,
9877 "height": height,
9878 "fields": fields,
9879 "pdf_paper_size": pdf_paper_size,
9880 "pdf_landscape": pdf_landscape,
9881 "long_tables": long_tables,
9882 "theme": theme,
9883 },
9884 body=body,
9885 transport_options=transport_options,
9886 ),
9887 )
9888 return response
9889
9890 # ### Get information about a render task.
9891 #
9892 # Returns a render task object.
9893 # To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
9894 # Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
9895 #
9896 # GET /render_tasks/{render_task_id} -> mdls.RenderTask
9897 def render_task(
9898 self,
9899 # Id of render task
9900 render_task_id: str,
9901 # Requested fields.
9902 fields: Optional[str] = None,
9903 transport_options: Optional[transport.TransportOptions] = None,
9904 ) -> mdls.RenderTask:
9905 """Get Render Task"""
9906 render_task_id = self.encode_path_param(render_task_id)
9907 response = cast(
9908 mdls.RenderTask,
9909 self.get(
9910 path=f"/render_tasks/{render_task_id}",
9911 structure=mdls.RenderTask,
9912 query_params={"fields": fields},
9913 transport_options=transport_options,
9914 ),
9915 )
9916 return response
9917
9918 # ### Get the document or image produced by a completed render task.
9919 #
9920 # Note that the PDF or image result will be a binary blob in the HTTP response, as indicated by the
9921 # Content-Type in the response headers. This may require specialized (or at least different) handling than text
9922 # responses such as JSON. You may need to tell your HTTP client that the response is binary so that it does not
9923 # attempt to parse the binary data as text.
9924 #
9925 # If the render task exists but has not finished rendering the results, the response HTTP status will be
9926 # **202 Accepted**, the response body will be empty, and the response will have a Retry-After header indicating
9927 # that the caller should repeat the request at a later time.
9928 #
9929 # Returns 404 if the render task cannot be found, if the cached result has expired, or if the caller
9930 # does not have permission to view the results.
9931 #
9932 # For detailed information about the status of the render task, use [Render Task](#!/RenderTask/render_task).
9933 # Polling loops waiting for completion of a render task would be better served by polling **render_task(id)** until
9934 # the task status reaches completion (or error) instead of polling **render_task_results(id)** alone.
9935 #
9936 # GET /render_tasks/{render_task_id}/results -> bytes
9937 def render_task_results(
9938 self,
9939 # Id of render task
9940 render_task_id: str,
9941 transport_options: Optional[transport.TransportOptions] = None,
9942 ) -> bytes:
9943 """Render Task Results"""
9944 render_task_id = self.encode_path_param(render_task_id)
9945 response = cast(
9946 bytes,
9947 self.get(
9948 path=f"/render_tasks/{render_task_id}/results",
9949 structure=bytes,
9950 transport_options=transport_options,
9951 ),
9952 )
9953 return response
9954
9955 # ### Create a new task to render a dashboard element to an image.
9956 #
9957 # Returns a render task object.
9958 # To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
9959 # Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
9960 #
9961 # POST /render_tasks/dashboard_elements/{dashboard_element_id}/{result_format} -> mdls.RenderTask
9962 def create_dashboard_element_render_task(
9963 self,
9964 # 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
9965 dashboard_element_id: str,
9966 # Output type: png or jpg
9967 result_format: str,
9968 # Output width in pixels
9969 width: int,
9970 # Output height in pixels
9971 height: int,
9972 # Requested fields.
9973 fields: Optional[str] = None,
9974 transport_options: Optional[transport.TransportOptions] = None,
9975 ) -> mdls.RenderTask:
9976 """Create Dashboard Element Render Task"""
9977 dashboard_element_id = self.encode_path_param(dashboard_element_id)
9978 result_format = self.encode_path_param(result_format)
9979 response = cast(
9980 mdls.RenderTask,
9981 self.post(
9982 path=f"/render_tasks/dashboard_elements/{dashboard_element_id}/{result_format}",
9983 structure=mdls.RenderTask,
9984 query_params={"width": width, "height": height, "fields": fields},
9985 transport_options=transport_options,
9986 ),
9987 )
9988 return response
9989
9990 # endregion
9991
9992 # region Report: Report
9993
9994 # ### Search Reports
9995 #
9996 # Returns an **array of Report objects** that match the specified search criteria.
9997 #
9998 # If multiple search params are given and `filter_or` is FALSE or not specified,
9999 # search params are combined in a logical AND operation.
10000 # Only rows that match *all* search param criteria will be returned.
10001 #
10002 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
10003 # Results will include rows that match **any** of the search criteria.
10004 #
10005 # String search params use case-insensitive matching.
10006 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
10007 # example="dan%" will match "danger" and "Danzig" but not "David"
10008 # example="D_m%" will match "Damage" and "dump"
10009 #
10010 # Integer search params can accept a single value or a comma separated list of values. The multiple
10011 # values will be combined under a logical OR operation - results will match at least one of
10012 # the given values.
10013 #
10014 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
10015 # or exclude (respectively) rows where the column is null.
10016 #
10017 # Boolean search params accept only "true" and "false" as values.
10018 #
10019 # GET /reports/search -> Sequence[mdls.Report]
10020 def search_reports(
10021 self,
10022 # Select reports in a particular folder.
10023 folder_id: Optional[str] = None,
10024 # Select favorite reports.
10025 favorite: Optional[bool] = None,
10026 # Select reports viewed recently.
10027 recent: Optional[bool] = None,
10028 # Match report id.
10029 id: Optional[str] = None,
10030 # Match report title.
10031 title: Optional[str] = None,
10032 # One or more fields to sort results by.
10033 sorts: Optional[str] = None,
10034 # Number of results to return.(used with next_page_token)
10035 limit: Optional[int] = None,
10036 # Comma delimited list of field names. If provided, only the fields specified will be included in the response.
10037 fields: Optional[str] = None,
10038 # 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.
10039 next_page_token: Optional[str] = None,
10040 transport_options: Optional[transport.TransportOptions] = None,
10041 ) -> Sequence[mdls.Report]:
10042 """Search Reports"""
10043 response = cast(
10044 Sequence[mdls.Report],
10045 self.get(
10046 path="/reports/search",
10047 structure=Sequence[mdls.Report],
10048 query_params={
10049 "folder_id": folder_id,
10050 "favorite": favorite,
10051 "recent": recent,
10052 "id": id,
10053 "title": title,
10054 "sorts": sorts,
10055 "limit": limit,
10056 "fields": fields,
10057 "next_page_token": next_page_token,
10058 },
10059 transport_options=transport_options,
10060 ),
10061 )
10062 return response
10063
10064 # endregion
10065
10066 # region Role: Manage Roles
10067
10068 # ### Search model sets
10069 # Returns all model set records that match the given search criteria.
10070 # If multiple search params are given and `filter_or` is FALSE or not specified,
10071 # search params are combined in a logical AND operation.
10072 # Only rows that match *all* search param criteria will be returned.
10073 #
10074 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
10075 # Results will include rows that match **any** of the search criteria.
10076 #
10077 # String search params use case-insensitive matching.
10078 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
10079 # example="dan%" will match "danger" and "Danzig" but not "David"
10080 # example="D_m%" will match "Damage" and "dump"
10081 #
10082 # Integer search params can accept a single value or a comma separated list of values. The multiple
10083 # values will be combined under a logical OR operation - results will match at least one of
10084 # the given values.
10085 #
10086 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
10087 # or exclude (respectively) rows where the column is null.
10088 #
10089 # Boolean search params accept only "true" and "false" as values.
10090 #
10091 # GET /model_sets/search -> Sequence[mdls.ModelSet]
10092 def search_model_sets(
10093 self,
10094 # Requested fields.
10095 fields: Optional[str] = None,
10096 # Number of results to return (used with `offset`).
10097 limit: Optional[int] = None,
10098 # Number of results to skip before returning any (used with `limit`).
10099 offset: Optional[int] = None,
10100 # Fields to sort by.
10101 sorts: Optional[str] = None,
10102 # Match model set id.
10103 id: Optional[str] = None,
10104 # Match model set name.
10105 name: Optional[str] = None,
10106 # Match model sets by all_access status.
10107 all_access: Optional[bool] = None,
10108 # Match model sets by built_in status.
10109 built_in: Optional[bool] = None,
10110 # Combine given search criteria in a boolean OR expression.
10111 filter_or: Optional[bool] = None,
10112 transport_options: Optional[transport.TransportOptions] = None,
10113 ) -> Sequence[mdls.ModelSet]:
10114 """Search Model Sets"""
10115 response = cast(
10116 Sequence[mdls.ModelSet],
10117 self.get(
10118 path="/model_sets/search",
10119 structure=Sequence[mdls.ModelSet],
10120 query_params={
10121 "fields": fields,
10122 "limit": limit,
10123 "offset": offset,
10124 "sorts": sorts,
10125 "id": id,
10126 "name": name,
10127 "all_access": all_access,
10128 "built_in": built_in,
10129 "filter_or": filter_or,
10130 },
10131 transport_options=transport_options,
10132 ),
10133 )
10134 return response
10135
10136 # ### Get information about the model set with a specific id.
10137 #
10138 # GET /model_sets/{model_set_id} -> mdls.ModelSet
10139 def model_set(
10140 self,
10141 # Id of model set
10142 model_set_id: str,
10143 # Requested fields.
10144 fields: Optional[str] = None,
10145 transport_options: Optional[transport.TransportOptions] = None,
10146 ) -> mdls.ModelSet:
10147 """Get Model Set"""
10148 model_set_id = self.encode_path_param(model_set_id)
10149 response = cast(
10150 mdls.ModelSet,
10151 self.get(
10152 path=f"/model_sets/{model_set_id}",
10153 structure=mdls.ModelSet,
10154 query_params={"fields": fields},
10155 transport_options=transport_options,
10156 ),
10157 )
10158 return response
10159
10160 # ### Update information about the model set with a specific id.
10161 #
10162 # PATCH /model_sets/{model_set_id} -> mdls.ModelSet
10163 def update_model_set(
10164 self,
10165 # id of model set
10166 model_set_id: str,
10167 body: mdls.WriteModelSet,
10168 transport_options: Optional[transport.TransportOptions] = None,
10169 ) -> mdls.ModelSet:
10170 """Update Model Set"""
10171 model_set_id = self.encode_path_param(model_set_id)
10172 response = cast(
10173 mdls.ModelSet,
10174 self.patch(
10175 path=f"/model_sets/{model_set_id}",
10176 structure=mdls.ModelSet,
10177 body=body,
10178 transport_options=transport_options,
10179 ),
10180 )
10181 return response
10182
10183 # ### Delete the model set with a specific id.
10184 #
10185 # DELETE /model_sets/{model_set_id} -> str
10186 def delete_model_set(
10187 self,
10188 # id of model set
10189 model_set_id: str,
10190 transport_options: Optional[transport.TransportOptions] = None,
10191 ) -> str:
10192 """Delete Model Set"""
10193 model_set_id = self.encode_path_param(model_set_id)
10194 response = cast(
10195 str,
10196 self.delete(
10197 path=f"/model_sets/{model_set_id}",
10198 structure=str,
10199 transport_options=transport_options,
10200 ),
10201 )
10202 return response
10203
10204 # ### Get information about all model sets.
10205 #
10206 # GET /model_sets -> Sequence[mdls.ModelSet]
10207 def all_model_sets(
10208 self,
10209 # Requested fields.
10210 fields: Optional[str] = None,
10211 transport_options: Optional[transport.TransportOptions] = None,
10212 ) -> Sequence[mdls.ModelSet]:
10213 """Get All Model Sets"""
10214 response = cast(
10215 Sequence[mdls.ModelSet],
10216 self.get(
10217 path="/model_sets",
10218 structure=Sequence[mdls.ModelSet],
10219 query_params={"fields": fields},
10220 transport_options=transport_options,
10221 ),
10222 )
10223 return response
10224
10225 # ### Create a model set with the specified information. Model sets are used by Roles.
10226 #
10227 # POST /model_sets -> mdls.ModelSet
10228 def create_model_set(
10229 self,
10230 body: mdls.WriteModelSet,
10231 transport_options: Optional[transport.TransportOptions] = None,
10232 ) -> mdls.ModelSet:
10233 """Create Model Set"""
10234 response = cast(
10235 mdls.ModelSet,
10236 self.post(
10237 path="/model_sets",
10238 structure=mdls.ModelSet,
10239 body=body,
10240 transport_options=transport_options,
10241 ),
10242 )
10243 return response
10244
10245 # ### Get all supported permissions.
10246 #
10247 # GET /permissions -> Sequence[mdls.Permission]
10248 def all_permissions(
10249 self,
10250 transport_options: Optional[transport.TransportOptions] = None,
10251 ) -> Sequence[mdls.Permission]:
10252 """Get All Permissions"""
10253 response = cast(
10254 Sequence[mdls.Permission],
10255 self.get(
10256 path="/permissions",
10257 structure=Sequence[mdls.Permission],
10258 transport_options=transport_options,
10259 ),
10260 )
10261 return response
10262
10263 # ### Search permission sets
10264 # Returns all permission set records that match the given search criteria.
10265 # If multiple search params are given and `filter_or` is FALSE or not specified,
10266 # search params are combined in a logical AND operation.
10267 # Only rows that match *all* search param criteria will be returned.
10268 #
10269 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
10270 # Results will include rows that match **any** of the search criteria.
10271 #
10272 # String search params use case-insensitive matching.
10273 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
10274 # example="dan%" will match "danger" and "Danzig" but not "David"
10275 # example="D_m%" will match "Damage" and "dump"
10276 #
10277 # Integer search params can accept a single value or a comma separated list of values. The multiple
10278 # values will be combined under a logical OR operation - results will match at least one of
10279 # the given values.
10280 #
10281 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
10282 # or exclude (respectively) rows where the column is null.
10283 #
10284 # Boolean search params accept only "true" and "false" as values.
10285 #
10286 # GET /permission_sets/search -> Sequence[mdls.PermissionSet]
10287 def search_permission_sets(
10288 self,
10289 # Requested fields.
10290 fields: Optional[str] = None,
10291 # Number of results to return (used with `offset`).
10292 limit: Optional[int] = None,
10293 # Number of results to skip before returning any (used with `limit`).
10294 offset: Optional[int] = None,
10295 # Fields to sort by.
10296 sorts: Optional[str] = None,
10297 # Match permission set id.
10298 id: Optional[str] = None,
10299 # Match permission set name.
10300 name: Optional[str] = None,
10301 # Match permission sets by all_access status.
10302 all_access: Optional[bool] = None,
10303 # Match permission sets by built_in status.
10304 built_in: Optional[bool] = None,
10305 # Combine given search criteria in a boolean OR expression.
10306 filter_or: Optional[bool] = None,
10307 transport_options: Optional[transport.TransportOptions] = None,
10308 ) -> Sequence[mdls.PermissionSet]:
10309 """Search Permission Sets"""
10310 response = cast(
10311 Sequence[mdls.PermissionSet],
10312 self.get(
10313 path="/permission_sets/search",
10314 structure=Sequence[mdls.PermissionSet],
10315 query_params={
10316 "fields": fields,
10317 "limit": limit,
10318 "offset": offset,
10319 "sorts": sorts,
10320 "id": id,
10321 "name": name,
10322 "all_access": all_access,
10323 "built_in": built_in,
10324 "filter_or": filter_or,
10325 },
10326 transport_options=transport_options,
10327 ),
10328 )
10329 return response
10330
10331 # ### Get information about the permission set with a specific id.
10332 #
10333 # GET /permission_sets/{permission_set_id} -> mdls.PermissionSet
10334 def permission_set(
10335 self,
10336 # Id of permission set
10337 permission_set_id: str,
10338 # Requested fields.
10339 fields: Optional[str] = None,
10340 transport_options: Optional[transport.TransportOptions] = None,
10341 ) -> mdls.PermissionSet:
10342 """Get Permission Set"""
10343 permission_set_id = self.encode_path_param(permission_set_id)
10344 response = cast(
10345 mdls.PermissionSet,
10346 self.get(
10347 path=f"/permission_sets/{permission_set_id}",
10348 structure=mdls.PermissionSet,
10349 query_params={"fields": fields},
10350 transport_options=transport_options,
10351 ),
10352 )
10353 return response
10354
10355 # ### Update information about the permission set with a specific id.
10356 # Providing save_content permission alone will also provide you the abilities of save_looks and save_dashboards.
10357 #
10358 # PATCH /permission_sets/{permission_set_id} -> mdls.PermissionSet
10359 def update_permission_set(
10360 self,
10361 # Id of permission set
10362 permission_set_id: str,
10363 body: mdls.WritePermissionSet,
10364 transport_options: Optional[transport.TransportOptions] = None,
10365 ) -> mdls.PermissionSet:
10366 """Update Permission Set"""
10367 permission_set_id = self.encode_path_param(permission_set_id)
10368 response = cast(
10369 mdls.PermissionSet,
10370 self.patch(
10371 path=f"/permission_sets/{permission_set_id}",
10372 structure=mdls.PermissionSet,
10373 body=body,
10374 transport_options=transport_options,
10375 ),
10376 )
10377 return response
10378
10379 # ### Delete the permission set with a specific id.
10380 #
10381 # DELETE /permission_sets/{permission_set_id} -> str
10382 def delete_permission_set(
10383 self,
10384 # Id of permission set
10385 permission_set_id: str,
10386 transport_options: Optional[transport.TransportOptions] = None,
10387 ) -> str:
10388 """Delete Permission Set"""
10389 permission_set_id = self.encode_path_param(permission_set_id)
10390 response = cast(
10391 str,
10392 self.delete(
10393 path=f"/permission_sets/{permission_set_id}",
10394 structure=str,
10395 transport_options=transport_options,
10396 ),
10397 )
10398 return response
10399
10400 # ### Get information about all permission sets.
10401 #
10402 # GET /permission_sets -> Sequence[mdls.PermissionSet]
10403 def all_permission_sets(
10404 self,
10405 # Requested fields.
10406 fields: Optional[str] = None,
10407 transport_options: Optional[transport.TransportOptions] = None,
10408 ) -> Sequence[mdls.PermissionSet]:
10409 """Get All Permission Sets"""
10410 response = cast(
10411 Sequence[mdls.PermissionSet],
10412 self.get(
10413 path="/permission_sets",
10414 structure=Sequence[mdls.PermissionSet],
10415 query_params={"fields": fields},
10416 transport_options=transport_options,
10417 ),
10418 )
10419 return response
10420
10421 # ### Create a permission set with the specified information. Permission sets are used by Roles.
10422 # Providing save_content permission alone will also provide you the abilities of save_looks and save_dashboards.
10423 #
10424 # POST /permission_sets -> mdls.PermissionSet
10425 def create_permission_set(
10426 self,
10427 body: mdls.WritePermissionSet,
10428 transport_options: Optional[transport.TransportOptions] = None,
10429 ) -> mdls.PermissionSet:
10430 """Create Permission Set"""
10431 response = cast(
10432 mdls.PermissionSet,
10433 self.post(
10434 path="/permission_sets",
10435 structure=mdls.PermissionSet,
10436 body=body,
10437 transport_options=transport_options,
10438 ),
10439 )
10440 return response
10441
10442 # ### Get information about all roles.
10443 #
10444 # GET /roles -> Sequence[mdls.Role]
10445 def all_roles(
10446 self,
10447 # Requested fields.
10448 fields: Optional[str] = None,
10449 # Optional list of ids to get specific roles.
10450 ids: Optional[mdls.DelimSequence[str]] = None,
10451 # Get all Looker support roles.
10452 get_all_support_roles: Optional[bool] = None,
10453 transport_options: Optional[transport.TransportOptions] = None,
10454 ) -> Sequence[mdls.Role]:
10455 """Get All Roles"""
10456 response = cast(
10457 Sequence[mdls.Role],
10458 self.get(
10459 path="/roles",
10460 structure=Sequence[mdls.Role],
10461 query_params={
10462 "fields": fields,
10463 "ids": ids,
10464 "get_all_support_roles": get_all_support_roles,
10465 },
10466 transport_options=transport_options,
10467 ),
10468 )
10469 return response
10470
10471 # ### Create a role with the specified information.
10472 #
10473 # POST /roles -> mdls.Role
10474 def create_role(
10475 self,
10476 body: mdls.WriteRole,
10477 transport_options: Optional[transport.TransportOptions] = None,
10478 ) -> mdls.Role:
10479 """Create Role"""
10480 response = cast(
10481 mdls.Role,
10482 self.post(
10483 path="/roles",
10484 structure=mdls.Role,
10485 body=body,
10486 transport_options=transport_options,
10487 ),
10488 )
10489 return response
10490
10491 # ### Search roles
10492 #
10493 # Returns all role records that match the given search criteria.
10494 #
10495 # If multiple search params are given and `filter_or` is FALSE or not specified,
10496 # search params are combined in a logical AND operation.
10497 # Only rows that match *all* search param criteria will be returned.
10498 #
10499 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
10500 # Results will include rows that match **any** of the search criteria.
10501 #
10502 # String search params use case-insensitive matching.
10503 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
10504 # example="dan%" will match "danger" and "Danzig" but not "David"
10505 # example="D_m%" will match "Damage" and "dump"
10506 #
10507 # Integer search params can accept a single value or a comma separated list of values. The multiple
10508 # values will be combined under a logical OR operation - results will match at least one of
10509 # the given values.
10510 #
10511 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
10512 # or exclude (respectively) rows where the column is null.
10513 #
10514 # Boolean search params accept only "true" and "false" as values.
10515 #
10516 # GET /roles/search -> Sequence[mdls.Role]
10517 def search_roles(
10518 self,
10519 # Requested fields.
10520 fields: Optional[str] = None,
10521 # Number of results to return (used with `offset`).
10522 limit: Optional[int] = None,
10523 # Number of results to skip before returning any (used with `limit`).
10524 offset: Optional[int] = None,
10525 # Fields to sort by.
10526 sorts: Optional[str] = None,
10527 # Match role id.
10528 id: Optional[str] = None,
10529 # Match role name.
10530 name: Optional[str] = None,
10531 # Match roles by built_in status.
10532 built_in: Optional[bool] = None,
10533 # Combine given search criteria in a boolean OR expression.
10534 filter_or: Optional[bool] = None,
10535 transport_options: Optional[transport.TransportOptions] = None,
10536 ) -> Sequence[mdls.Role]:
10537 """Search Roles"""
10538 response = cast(
10539 Sequence[mdls.Role],
10540 self.get(
10541 path="/roles/search",
10542 structure=Sequence[mdls.Role],
10543 query_params={
10544 "fields": fields,
10545 "limit": limit,
10546 "offset": offset,
10547 "sorts": sorts,
10548 "id": id,
10549 "name": name,
10550 "built_in": built_in,
10551 "filter_or": filter_or,
10552 },
10553 transport_options=transport_options,
10554 ),
10555 )
10556 return response
10557
10558 # ### Search roles include user count
10559 #
10560 # Returns all role records that match the given search criteria, and attaches
10561 # associated user counts.
10562 #
10563 # If multiple search params are given and `filter_or` is FALSE or not specified,
10564 # search params are combined in a logical AND operation.
10565 # Only rows that match *all* search param criteria will be returned.
10566 #
10567 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
10568 # Results will include rows that match **any** of the search criteria.
10569 #
10570 # String search params use case-insensitive matching.
10571 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
10572 # example="dan%" will match "danger" and "Danzig" but not "David"
10573 # example="D_m%" will match "Damage" and "dump"
10574 #
10575 # Integer search params can accept a single value or a comma separated list of values. The multiple
10576 # values will be combined under a logical OR operation - results will match at least one of
10577 # the given values.
10578 #
10579 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
10580 # or exclude (respectively) rows where the column is null.
10581 #
10582 # Boolean search params accept only "true" and "false" as values.
10583 #
10584 # GET /roles/search/with_user_count -> Sequence[mdls.RoleSearch]
10585 def search_roles_with_user_count(
10586 self,
10587 # Requested fields.
10588 fields: Optional[str] = None,
10589 # Number of results to return (used with `offset`).
10590 limit: Optional[int] = None,
10591 # Number of results to skip before returning any (used with `limit`).
10592 offset: Optional[int] = None,
10593 # Fields to sort by.
10594 sorts: Optional[str] = None,
10595 # Match role id.
10596 id: Optional[str] = None,
10597 # Match role name.
10598 name: Optional[str] = None,
10599 # Match roles by built_in status.
10600 built_in: Optional[bool] = None,
10601 # Combine given search criteria in a boolean OR expression.
10602 filter_or: Optional[bool] = None,
10603 transport_options: Optional[transport.TransportOptions] = None,
10604 ) -> Sequence[mdls.RoleSearch]:
10605 """Search Roles with User Count"""
10606 response = cast(
10607 Sequence[mdls.RoleSearch],
10608 self.get(
10609 path="/roles/search/with_user_count",
10610 structure=Sequence[mdls.RoleSearch],
10611 query_params={
10612 "fields": fields,
10613 "limit": limit,
10614 "offset": offset,
10615 "sorts": sorts,
10616 "id": id,
10617 "name": name,
10618 "built_in": built_in,
10619 "filter_or": filter_or,
10620 },
10621 transport_options=transport_options,
10622 ),
10623 )
10624 return response
10625
10626 # ### Get information about the role with a specific id.
10627 #
10628 # GET /roles/{role_id} -> mdls.Role
10629 def role(
10630 self,
10631 # id of role
10632 role_id: str,
10633 transport_options: Optional[transport.TransportOptions] = None,
10634 ) -> mdls.Role:
10635 """Get Role"""
10636 role_id = self.encode_path_param(role_id)
10637 response = cast(
10638 mdls.Role,
10639 self.get(
10640 path=f"/roles/{role_id}",
10641 structure=mdls.Role,
10642 transport_options=transport_options,
10643 ),
10644 )
10645 return response
10646
10647 # ### Update information about the role with a specific id.
10648 #
10649 # PATCH /roles/{role_id} -> mdls.Role
10650 def update_role(
10651 self,
10652 # id of role
10653 role_id: str,
10654 body: mdls.WriteRole,
10655 transport_options: Optional[transport.TransportOptions] = None,
10656 ) -> mdls.Role:
10657 """Update Role"""
10658 role_id = self.encode_path_param(role_id)
10659 response = cast(
10660 mdls.Role,
10661 self.patch(
10662 path=f"/roles/{role_id}",
10663 structure=mdls.Role,
10664 body=body,
10665 transport_options=transport_options,
10666 ),
10667 )
10668 return response
10669
10670 # ### Delete the role with a specific id.
10671 #
10672 # DELETE /roles/{role_id} -> str
10673 def delete_role(
10674 self,
10675 # id of role
10676 role_id: str,
10677 transport_options: Optional[transport.TransportOptions] = None,
10678 ) -> str:
10679 """Delete Role"""
10680 role_id = self.encode_path_param(role_id)
10681 response = cast(
10682 str,
10683 self.delete(
10684 path=f"/roles/{role_id}",
10685 structure=str,
10686 transport_options=transport_options,
10687 ),
10688 )
10689 return response
10690
10691 # ### Get information about all the groups with the role that has a specific id.
10692 #
10693 # GET /roles/{role_id}/groups -> Sequence[mdls.Group]
10694 def role_groups(
10695 self,
10696 # id of role
10697 role_id: str,
10698 # Requested fields.
10699 fields: Optional[str] = None,
10700 transport_options: Optional[transport.TransportOptions] = None,
10701 ) -> Sequence[mdls.Group]:
10702 """Get Role Groups"""
10703 role_id = self.encode_path_param(role_id)
10704 response = cast(
10705 Sequence[mdls.Group],
10706 self.get(
10707 path=f"/roles/{role_id}/groups",
10708 structure=Sequence[mdls.Group],
10709 query_params={"fields": fields},
10710 transport_options=transport_options,
10711 ),
10712 )
10713 return response
10714
10715 # ### Set all groups for a role, removing all existing group associations from that role.
10716 #
10717 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
10718 #
10719 # PUT /roles/{role_id}/groups -> Sequence[mdls.Group]
10720 def set_role_groups(
10721 self,
10722 # id of role
10723 role_id: str,
10724 body: Sequence[str],
10725 transport_options: Optional[transport.TransportOptions] = None,
10726 ) -> Sequence[mdls.Group]:
10727 """Update Role Groups"""
10728 role_id = self.encode_path_param(role_id)
10729 response = cast(
10730 Sequence[mdls.Group],
10731 self.put(
10732 path=f"/roles/{role_id}/groups",
10733 structure=Sequence[mdls.Group],
10734 body=body,
10735 transport_options=transport_options,
10736 ),
10737 )
10738 return response
10739
10740 # ### Get information about all the users with the role that has a specific id.
10741 #
10742 # GET /roles/{role_id}/users -> Sequence[mdls.User]
10743 def role_users(
10744 self,
10745 # id of role
10746 role_id: str,
10747 # Requested fields.
10748 fields: Optional[str] = None,
10749 # Get only users associated directly with the role: exclude those only associated through groups.
10750 direct_association_only: Optional[bool] = None,
10751 transport_options: Optional[transport.TransportOptions] = None,
10752 ) -> Sequence[mdls.User]:
10753 """Get Role Users"""
10754 role_id = self.encode_path_param(role_id)
10755 response = cast(
10756 Sequence[mdls.User],
10757 self.get(
10758 path=f"/roles/{role_id}/users",
10759 structure=Sequence[mdls.User],
10760 query_params={
10761 "fields": fields,
10762 "direct_association_only": direct_association_only,
10763 },
10764 transport_options=transport_options,
10765 ),
10766 )
10767 return response
10768
10769 # ### Set all the users of the role with a specific id.
10770 #
10771 # PUT /roles/{role_id}/users -> Sequence[mdls.User]
10772 def set_role_users(
10773 self,
10774 # id of role
10775 role_id: str,
10776 body: Sequence[str],
10777 transport_options: Optional[transport.TransportOptions] = None,
10778 ) -> Sequence[mdls.User]:
10779 """Update Role Users"""
10780 role_id = self.encode_path_param(role_id)
10781 response = cast(
10782 Sequence[mdls.User],
10783 self.put(
10784 path=f"/roles/{role_id}/users",
10785 structure=Sequence[mdls.User],
10786 body=body,
10787 transport_options=transport_options,
10788 ),
10789 )
10790 return response
10791
10792 # endregion
10793
10794 # region ScheduledPlan: Manage Scheduled Plans
10795
10796 # ### Get Scheduled Plans for a Space
10797 #
10798 # Returns scheduled plans owned by the caller for a given space id.
10799 #
10800 # GET /scheduled_plans/space/{space_id} -> Sequence[mdls.ScheduledPlan]
10801 def scheduled_plans_for_space(
10802 self,
10803 # Space Id
10804 space_id: str,
10805 # Requested fields.
10806 fields: Optional[str] = None,
10807 transport_options: Optional[transport.TransportOptions] = None,
10808 ) -> Sequence[mdls.ScheduledPlan]:
10809 """Scheduled Plans for Space"""
10810 space_id = self.encode_path_param(space_id)
10811 response = cast(
10812 Sequence[mdls.ScheduledPlan],
10813 self.get(
10814 path=f"/scheduled_plans/space/{space_id}",
10815 structure=Sequence[mdls.ScheduledPlan],
10816 query_params={"fields": fields},
10817 transport_options=transport_options,
10818 ),
10819 )
10820 return response
10821
10822 # ### Get Information About a Scheduled Plan
10823 #
10824 # Admins can fetch information about other users' Scheduled Plans.
10825 #
10826 # GET /scheduled_plans/{scheduled_plan_id} -> mdls.ScheduledPlan
10827 def scheduled_plan(
10828 self,
10829 # Scheduled Plan Id
10830 scheduled_plan_id: str,
10831 # Requested fields.
10832 fields: Optional[str] = None,
10833 transport_options: Optional[transport.TransportOptions] = None,
10834 ) -> mdls.ScheduledPlan:
10835 """Get Scheduled Plan"""
10836 scheduled_plan_id = self.encode_path_param(scheduled_plan_id)
10837 response = cast(
10838 mdls.ScheduledPlan,
10839 self.get(
10840 path=f"/scheduled_plans/{scheduled_plan_id}",
10841 structure=mdls.ScheduledPlan,
10842 query_params={"fields": fields},
10843 transport_options=transport_options,
10844 ),
10845 )
10846 return response
10847
10848 # ### Update a Scheduled Plan
10849 #
10850 # Admins can update other users' Scheduled Plans.
10851 #
10852 # Note: Any scheduled plan destinations specified in an update will **replace** all scheduled plan destinations
10853 # currently defined for the scheduled plan.
10854 #
10855 # For Example: If a scheduled plan has destinations A, B, and C, and you call update on this scheduled plan
10856 # specifying only B in the destinations, then destinations A and C will be deleted by the update.
10857 #
10858 # 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.
10859 #
10860 # If you omit the scheduled_plan_destinations property from the object passed to update, then the destinations
10861 # defined on the original scheduled plan will remain unchanged.
10862 #
10863 # #### Email Permissions:
10864 #
10865 # For details about permissions required to schedule delivery to email and the safeguards
10866 # Looker offers to protect against sending to unauthorized email destinations, see [Email Domain Allow List for Scheduled Looks](https://cloud.google.com/looker/docs/r/api/embed-permissions).
10867 #
10868 #
10869 # #### Scheduled Plan Destination Formats
10870 #
10871 # Scheduled plan destinations must specify the data format to produce and send to the destination.
10872 #
10873 # Formats:
10874 #
10875 # | format | Description
10876 # | :-----------: | :--- |
10877 # | json | A JSON object containing a `data` property which contains an array of JSON objects, one per row. No metadata.
10878 # | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
10879 # | 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.
10880 # | csv | Comma separated values with a header
10881 # | txt | Tab separated values with a header
10882 # | html | Simple html
10883 # | xlsx | MS Excel spreadsheet
10884 # | wysiwyg_pdf | Dashboard rendered in a tiled layout to produce a PDF document
10885 # | assembled_pdf | Dashboard rendered in a single column layout to produce a PDF document
10886 # | wysiwyg_png | Dashboard rendered in a tiled layout to produce a PNG image
10887 # ||
10888 #
10889 # Valid formats vary by destination type and source object. `wysiwyg_pdf` is only valid for dashboards, for example.
10890 #
10891 # PATCH /scheduled_plans/{scheduled_plan_id} -> mdls.ScheduledPlan
10892 def update_scheduled_plan(
10893 self,
10894 # Scheduled Plan Id
10895 scheduled_plan_id: str,
10896 body: mdls.WriteScheduledPlan,
10897 transport_options: Optional[transport.TransportOptions] = None,
10898 ) -> mdls.ScheduledPlan:
10899 """Update Scheduled Plan"""
10900 scheduled_plan_id = self.encode_path_param(scheduled_plan_id)
10901 response = cast(
10902 mdls.ScheduledPlan,
10903 self.patch(
10904 path=f"/scheduled_plans/{scheduled_plan_id}",
10905 structure=mdls.ScheduledPlan,
10906 body=body,
10907 transport_options=transport_options,
10908 ),
10909 )
10910 return response
10911
10912 # ### Delete a Scheduled Plan
10913 #
10914 # Normal users can only delete their own scheduled plans.
10915 # Admins can delete other users' scheduled plans.
10916 # This delete cannot be undone.
10917 #
10918 # DELETE /scheduled_plans/{scheduled_plan_id} -> str
10919 def delete_scheduled_plan(
10920 self,
10921 # Scheduled Plan Id
10922 scheduled_plan_id: str,
10923 transport_options: Optional[transport.TransportOptions] = None,
10924 ) -> str:
10925 """Delete Scheduled Plan"""
10926 scheduled_plan_id = self.encode_path_param(scheduled_plan_id)
10927 response = cast(
10928 str,
10929 self.delete(
10930 path=f"/scheduled_plans/{scheduled_plan_id}",
10931 structure=str,
10932 transport_options=transport_options,
10933 ),
10934 )
10935 return response
10936
10937 # ### List All Scheduled Plans
10938 #
10939 # Returns all scheduled plans which belong to the caller or given user.
10940 #
10941 # If no user_id is provided, this function returns the scheduled plans owned by the caller.
10942 #
10943 #
10944 # To list all schedules for all users, pass `all_users=true`.
10945 #
10946 #
10947 # The caller must have `see_schedules` permission to see other users' scheduled plans.
10948 #
10949 # GET /scheduled_plans -> Sequence[mdls.ScheduledPlan]
10950 def all_scheduled_plans(
10951 self,
10952 # Return scheduled plans belonging to this user_id. If not provided, returns scheduled plans owned by the caller.
10953 user_id: Optional[str] = None,
10954 # Comma delimited list of field names. If provided, only the fields specified will be included in the response
10955 fields: Optional[str] = None,
10956 # Return scheduled plans belonging to all users (caller needs see_schedules permission)
10957 all_users: Optional[bool] = None,
10958 transport_options: Optional[transport.TransportOptions] = None,
10959 ) -> Sequence[mdls.ScheduledPlan]:
10960 """Get All Scheduled Plans"""
10961 response = cast(
10962 Sequence[mdls.ScheduledPlan],
10963 self.get(
10964 path="/scheduled_plans",
10965 structure=Sequence[mdls.ScheduledPlan],
10966 query_params={
10967 "user_id": user_id,
10968 "fields": fields,
10969 "all_users": all_users,
10970 },
10971 transport_options=transport_options,
10972 ),
10973 )
10974 return response
10975
10976 # ### Create a Scheduled Plan
10977 #
10978 # Create a scheduled plan to render a Look or Dashboard on a recurring schedule.
10979 #
10980 # To create a scheduled plan, you MUST provide values for the following fields:
10981 # `name`
10982 # and
10983 # `look_id`, `dashboard_id`, `lookml_dashboard_id`, or `query_id`
10984 # and
10985 # `cron_tab` or `datagroup`
10986 # and
10987 # at least one scheduled_plan_destination
10988 #
10989 # A scheduled plan MUST have at least one scheduled_plan_destination defined.
10990 #
10991 # When `look_id` is set, `require_no_results`, `require_results`, and `require_change` are all required.
10992 #
10993 # 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.
10994 #
10995 # The queries that provide the data for the look or dashboard are run in the context of user account that owns the scheduled plan.
10996 #
10997 # When `run_as_recipient` is `false` or not specified, the queries that provide the data for the
10998 # look or dashboard are run in the context of user account that owns the scheduled plan.
10999 #
11000 # When `run_as_recipient` is `true` and all the email recipients are Looker user accounts, the
11001 # queries are run in the context of each recipient, so different recipients may see different
11002 # data from the same scheduled render of a look or dashboard. For more details, see [Run As Recipient](https://cloud.google.com/looker/docs/r/admin/run-as-recipient).
11003 #
11004 # Admins can create and modify scheduled plans on behalf of other users by specifying a user id.
11005 # Non-admin users may not create or modify scheduled plans by or for other users.
11006 #
11007 # #### Email Permissions:
11008 #
11009 # For details about permissions required to schedule delivery to email and the safeguards
11010 # Looker offers to protect against sending to unauthorized email destinations, see [Email Domain Allow List for Scheduled Looks](https://cloud.google.com/looker/docs/r/api/embed-permissions).
11011 #
11012 #
11013 # #### Scheduled Plan Destination Formats
11014 #
11015 # Scheduled plan destinations must specify the data format to produce and send to the destination.
11016 #
11017 # Formats:
11018 #
11019 # | format | Description
11020 # | :-----------: | :--- |
11021 # | json | A JSON object containing a `data` property which contains an array of JSON objects, one per row. No metadata.
11022 # | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
11023 # | 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.
11024 # | csv | Comma separated values with a header
11025 # | txt | Tab separated values with a header
11026 # | html | Simple html
11027 # | xlsx | MS Excel spreadsheet
11028 # | wysiwyg_pdf | Dashboard rendered in a tiled layout to produce a PDF document
11029 # | assembled_pdf | Dashboard rendered in a single column layout to produce a PDF document
11030 # | wysiwyg_png | Dashboard rendered in a tiled layout to produce a PNG image
11031 # ||
11032 #
11033 # Valid formats vary by destination type and source object. `wysiwyg_pdf` is only valid for dashboards, for example.
11034 #
11035 # POST /scheduled_plans -> mdls.ScheduledPlan
11036 def create_scheduled_plan(
11037 self,
11038 body: mdls.WriteScheduledPlan,
11039 transport_options: Optional[transport.TransportOptions] = None,
11040 ) -> mdls.ScheduledPlan:
11041 """Create Scheduled Plan"""
11042 response = cast(
11043 mdls.ScheduledPlan,
11044 self.post(
11045 path="/scheduled_plans",
11046 structure=mdls.ScheduledPlan,
11047 body=body,
11048 transport_options=transport_options,
11049 ),
11050 )
11051 return response
11052
11053 # ### Run a Scheduled Plan Immediately
11054 #
11055 # Create a scheduled plan that runs only once, and immediately.
11056 #
11057 # This can be useful for testing a Scheduled Plan before committing to a production schedule.
11058 #
11059 # Admins can create scheduled plans on behalf of other users by specifying a user id.
11060 #
11061 # This API is rate limited to prevent it from being used for relay spam or DoS attacks
11062 #
11063 # #### Email Permissions:
11064 #
11065 # For details about permissions required to schedule delivery to email and the safeguards
11066 # Looker offers to protect against sending to unauthorized email destinations, see [Email Domain Allow List for Scheduled Looks](https://cloud.google.com/looker/docs/r/api/embed-permissions).
11067 #
11068 #
11069 # #### Scheduled Plan Destination Formats
11070 #
11071 # Scheduled plan destinations must specify the data format to produce and send to the destination.
11072 #
11073 # Formats:
11074 #
11075 # | format | Description
11076 # | :-----------: | :--- |
11077 # | json | A JSON object containing a `data` property which contains an array of JSON objects, one per row. No metadata.
11078 # | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
11079 # | 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.
11080 # | csv | Comma separated values with a header
11081 # | txt | Tab separated values with a header
11082 # | html | Simple html
11083 # | xlsx | MS Excel spreadsheet
11084 # | wysiwyg_pdf | Dashboard rendered in a tiled layout to produce a PDF document
11085 # | assembled_pdf | Dashboard rendered in a single column layout to produce a PDF document
11086 # | wysiwyg_png | Dashboard rendered in a tiled layout to produce a PNG image
11087 # ||
11088 #
11089 # Valid formats vary by destination type and source object. `wysiwyg_pdf` is only valid for dashboards, for example.
11090 #
11091 # POST /scheduled_plans/run_once -> mdls.ScheduledPlan
11092 def scheduled_plan_run_once(
11093 self,
11094 body: mdls.WriteScheduledPlan,
11095 transport_options: Optional[transport.TransportOptions] = None,
11096 ) -> mdls.ScheduledPlan:
11097 """Run Scheduled Plan Once"""
11098 response = cast(
11099 mdls.ScheduledPlan,
11100 self.post(
11101 path="/scheduled_plans/run_once",
11102 structure=mdls.ScheduledPlan,
11103 body=body,
11104 transport_options=transport_options,
11105 ),
11106 )
11107 return response
11108
11109 # ### Search Scheduled Plans
11110 #
11111 # Returns all scheduled plans which matches the given search criteria.
11112 #
11113 # If no user_id is provided, this function returns the scheduled plans owned by the caller.
11114 #
11115 #
11116 # To list all schedules for all users, pass `all_users=true`.
11117 #
11118 #
11119 # The caller must have `see_schedules` permission to see other users' scheduled plans.
11120 #
11121 # GET /scheduled_plans/search -> Sequence[mdls.ScheduledPlan]
11122 def search_scheduled_plans(
11123 self,
11124 # Return scheduled plans belonging to this user_id. If not provided, returns scheduled plans owned by the caller.
11125 user_id: Optional[str] = None,
11126 # Comma delimited list of field names. If provided, only the fields specified will be included in the response
11127 fields: Optional[str] = None,
11128 # Return scheduled plans belonging to all users (caller needs see_schedules permission)
11129 all_users: Optional[bool] = None,
11130 # Number of results to return. (used with offset and takes priority over page and per_page)
11131 limit: Optional[int] = None,
11132 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
11133 offset: Optional[int] = None,
11134 # Fields to sort by.
11135 sorts: Optional[str] = None,
11136 # Match Scheduled plan's name.
11137 name: Optional[str] = None,
11138 # Returns scheduled plans belonging to user with this first name.
11139 user_first_name: Optional[str] = None,
11140 # Returns scheduled plans belonging to user with this last name.
11141 user_last_name: Optional[str] = None,
11142 # Returns scheduled plans created on this Dashboard.
11143 dashboard_id: Optional[str] = None,
11144 # Returns scheduled plans created on this Look.
11145 look_id: Optional[str] = None,
11146 # Returns scheduled plans created on this LookML Dashboard.
11147 lookml_dashboard_id: Optional[str] = None,
11148 # Match recipient address.
11149 recipient: Optional[str] = None,
11150 # Match scheduled plan's destination type.
11151 destination_type: Optional[str] = None,
11152 # Match scheduled plan's delivery format.
11153 delivery_format: Optional[str] = None,
11154 # Combine given search criteria in a boolean OR expression
11155 filter_or: Optional[bool] = None,
11156 transport_options: Optional[transport.TransportOptions] = None,
11157 ) -> Sequence[mdls.ScheduledPlan]:
11158 """Search Scheduled Plans"""
11159 response = cast(
11160 Sequence[mdls.ScheduledPlan],
11161 self.get(
11162 path="/scheduled_plans/search",
11163 structure=Sequence[mdls.ScheduledPlan],
11164 query_params={
11165 "user_id": user_id,
11166 "fields": fields,
11167 "all_users": all_users,
11168 "limit": limit,
11169 "offset": offset,
11170 "sorts": sorts,
11171 "name": name,
11172 "user_first_name": user_first_name,
11173 "user_last_name": user_last_name,
11174 "dashboard_id": dashboard_id,
11175 "look_id": look_id,
11176 "lookml_dashboard_id": lookml_dashboard_id,
11177 "recipient": recipient,
11178 "destination_type": destination_type,
11179 "delivery_format": delivery_format,
11180 "filter_or": filter_or,
11181 },
11182 transport_options=transport_options,
11183 ),
11184 )
11185 return response
11186
11187 # ### Get Scheduled Plans for a Look
11188 #
11189 # Returns all scheduled plans for a look which belong to the caller or given user.
11190 #
11191 # If no user_id is provided, this function returns the scheduled plans owned by the caller.
11192 #
11193 #
11194 # To list all schedules for all users, pass `all_users=true`.
11195 #
11196 #
11197 # The caller must have `see_schedules` permission to see other users' scheduled plans.
11198 #
11199 # GET /scheduled_plans/look/{look_id} -> Sequence[mdls.ScheduledPlan]
11200 def scheduled_plans_for_look(
11201 self,
11202 # Look Id
11203 look_id: str,
11204 # User Id (default is requesting user if not specified)
11205 user_id: Optional[str] = None,
11206 # Requested fields.
11207 fields: Optional[str] = None,
11208 # Return scheduled plans belonging to all users for the look
11209 all_users: Optional[bool] = None,
11210 transport_options: Optional[transport.TransportOptions] = None,
11211 ) -> Sequence[mdls.ScheduledPlan]:
11212 """Scheduled Plans for Look"""
11213 look_id = self.encode_path_param(look_id)
11214 response = cast(
11215 Sequence[mdls.ScheduledPlan],
11216 self.get(
11217 path=f"/scheduled_plans/look/{look_id}",
11218 structure=Sequence[mdls.ScheduledPlan],
11219 query_params={
11220 "user_id": user_id,
11221 "fields": fields,
11222 "all_users": all_users,
11223 },
11224 transport_options=transport_options,
11225 ),
11226 )
11227 return response
11228
11229 # ### Get Scheduled Plans for a Dashboard
11230 #
11231 # Returns all scheduled plans for a dashboard which belong to the caller or given user.
11232 #
11233 # If no user_id is provided, this function returns the scheduled plans owned by the caller.
11234 #
11235 #
11236 # To list all schedules for all users, pass `all_users=true`.
11237 #
11238 #
11239 # The caller must have `see_schedules` permission to see other users' scheduled plans.
11240 #
11241 # GET /scheduled_plans/dashboard/{dashboard_id} -> Sequence[mdls.ScheduledPlan]
11242 def scheduled_plans_for_dashboard(
11243 self,
11244 # Dashboard Id
11245 dashboard_id: str,
11246 # User Id (default is requesting user if not specified)
11247 user_id: Optional[str] = None,
11248 # Return scheduled plans belonging to all users for the dashboard
11249 all_users: Optional[bool] = None,
11250 # Requested fields.
11251 fields: Optional[str] = None,
11252 transport_options: Optional[transport.TransportOptions] = None,
11253 ) -> Sequence[mdls.ScheduledPlan]:
11254 """Scheduled Plans for Dashboard"""
11255 dashboard_id = self.encode_path_param(dashboard_id)
11256 response = cast(
11257 Sequence[mdls.ScheduledPlan],
11258 self.get(
11259 path=f"/scheduled_plans/dashboard/{dashboard_id}",
11260 structure=Sequence[mdls.ScheduledPlan],
11261 query_params={
11262 "user_id": user_id,
11263 "all_users": all_users,
11264 "fields": fields,
11265 },
11266 transport_options=transport_options,
11267 ),
11268 )
11269 return response
11270
11271 # ### Get Scheduled Plans for a LookML Dashboard
11272 #
11273 # Returns all scheduled plans for a LookML Dashboard which belong to the caller or given user.
11274 #
11275 # If no user_id is provided, this function returns the scheduled plans owned by the caller.
11276 #
11277 #
11278 # To list all schedules for all users, pass `all_users=true`.
11279 #
11280 #
11281 # The caller must have `see_schedules` permission to see other users' scheduled plans.
11282 #
11283 # GET /scheduled_plans/lookml_dashboard/{lookml_dashboard_id} -> Sequence[mdls.ScheduledPlan]
11284 def scheduled_plans_for_lookml_dashboard(
11285 self,
11286 # LookML Dashboard Id
11287 lookml_dashboard_id: str,
11288 # User Id (default is requesting user if not specified)
11289 user_id: Optional[str] = None,
11290 # Requested fields.
11291 fields: Optional[str] = None,
11292 # Return scheduled plans belonging to all users for the dashboard
11293 all_users: Optional[bool] = None,
11294 transport_options: Optional[transport.TransportOptions] = None,
11295 ) -> Sequence[mdls.ScheduledPlan]:
11296 """Scheduled Plans for LookML Dashboard"""
11297 lookml_dashboard_id = self.encode_path_param(lookml_dashboard_id)
11298 response = cast(
11299 Sequence[mdls.ScheduledPlan],
11300 self.get(
11301 path=f"/scheduled_plans/lookml_dashboard/{lookml_dashboard_id}",
11302 structure=Sequence[mdls.ScheduledPlan],
11303 query_params={
11304 "user_id": user_id,
11305 "fields": fields,
11306 "all_users": all_users,
11307 },
11308 transport_options=transport_options,
11309 ),
11310 )
11311 return response
11312
11313 # ### Run a Scheduled Plan By Id Immediately
11314 # This function creates a run-once schedule plan based on an existing scheduled plan,
11315 # applies modifications (if any) to the new scheduled plan, and runs the new schedule plan immediately.
11316 # This can be useful for testing modifications to an existing scheduled plan before committing to a production schedule.
11317 #
11318 # This function internally performs the following operations:
11319 #
11320 # 1. Copies the properties of the existing scheduled plan into a new scheduled plan
11321 # 2. Copies any properties passed in the JSON body of this request into the new scheduled plan (replacing the original values)
11322 # 3. Creates the new scheduled plan
11323 # 4. Runs the new scheduled plan
11324 #
11325 # The original scheduled plan is not modified by this operation.
11326 # Admins can create, modify, and run scheduled plans on behalf of other users by specifying a user id.
11327 # Non-admins can only create, modify, and run their own scheduled plans.
11328 #
11329 # #### Email Permissions:
11330 #
11331 # For details about permissions required to schedule delivery to email and the safeguards
11332 # Looker offers to protect against sending to unauthorized email destinations, see [Email Domain Allow List for Scheduled Looks](https://cloud.google.com/looker/docs/r/api/embed-permissions).
11333 #
11334 #
11335 # #### Scheduled Plan Destination Formats
11336 #
11337 # Scheduled plan destinations must specify the data format to produce and send to the destination.
11338 #
11339 # Formats:
11340 #
11341 # | format | Description
11342 # | :-----------: | :--- |
11343 # | json | A JSON object containing a `data` property which contains an array of JSON objects, one per row. No metadata.
11344 # | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
11345 # | 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.
11346 # | csv | Comma separated values with a header
11347 # | txt | Tab separated values with a header
11348 # | html | Simple html
11349 # | xlsx | MS Excel spreadsheet
11350 # | wysiwyg_pdf | Dashboard rendered in a tiled layout to produce a PDF document
11351 # | assembled_pdf | Dashboard rendered in a single column layout to produce a PDF document
11352 # | wysiwyg_png | Dashboard rendered in a tiled layout to produce a PNG image
11353 # ||
11354 #
11355 # Valid formats vary by destination type and source object. `wysiwyg_pdf` is only valid for dashboards, for example.
11356 #
11357 #
11358 #
11359 # This API is rate limited to prevent it from being used for relay spam or DoS attacks
11360 #
11361 # POST /scheduled_plans/{scheduled_plan_id}/run_once -> mdls.ScheduledPlan
11362 def scheduled_plan_run_once_by_id(
11363 self,
11364 # Id of schedule plan to copy and run
11365 scheduled_plan_id: str,
11366 body: Optional[mdls.WriteScheduledPlan] = None,
11367 transport_options: Optional[transport.TransportOptions] = None,
11368 ) -> mdls.ScheduledPlan:
11369 """Run Scheduled Plan Once by Id"""
11370 scheduled_plan_id = self.encode_path_param(scheduled_plan_id)
11371 response = cast(
11372 mdls.ScheduledPlan,
11373 self.post(
11374 path=f"/scheduled_plans/{scheduled_plan_id}/run_once",
11375 structure=mdls.ScheduledPlan,
11376 body=body,
11377 transport_options=transport_options,
11378 ),
11379 )
11380 return response
11381
11382 # endregion
11383
11384 # region Session: Session Information
11385
11386 # ### Get API Session
11387 #
11388 # Returns information about the current API session, such as which workspace is selected for the session.
11389 #
11390 # GET /session -> mdls.ApiSession
11391 def session(
11392 self,
11393 transport_options: Optional[transport.TransportOptions] = None,
11394 ) -> mdls.ApiSession:
11395 """Get Auth"""
11396 response = cast(
11397 mdls.ApiSession,
11398 self.get(
11399 path="/session",
11400 structure=mdls.ApiSession,
11401 transport_options=transport_options,
11402 ),
11403 )
11404 return response
11405
11406 # ### Update API Session
11407 #
11408 # #### API Session Workspace
11409 #
11410 # You can use this endpoint to change the active workspace for the current API session.
11411 #
11412 # Only one workspace can be active in a session. The active workspace can be changed
11413 # any number of times in a session.
11414 #
11415 # The default workspace for API sessions is the "production" workspace.
11416 #
11417 # All Looker APIs that use projects or lookml models (such as running queries) will
11418 # use the version of project and model files defined by this workspace for the lifetime of the
11419 # current API session or until the session workspace is changed again.
11420 #
11421 # An API session has the same lifetime as the access_token used to authenticate API requests. Each successful
11422 # API login generates a new access_token and a new API session.
11423 #
11424 # If your Looker API client application needs to work in a dev workspace across multiple
11425 # API sessions, be sure to select the dev workspace after each login.
11426 #
11427 # PATCH /session -> mdls.ApiSession
11428 def update_session(
11429 self,
11430 body: mdls.WriteApiSession,
11431 transport_options: Optional[transport.TransportOptions] = None,
11432 ) -> mdls.ApiSession:
11433 """Update Auth"""
11434 response = cast(
11435 mdls.ApiSession,
11436 self.patch(
11437 path="/session",
11438 structure=mdls.ApiSession,
11439 body=body,
11440 transport_options=transport_options,
11441 ),
11442 )
11443 return response
11444
11445 # endregion
11446
11447 # region SqlInterfaceQuery: Run and Manage SQL Interface Queries
11448
11449 # ### Handles Avatica RPC metadata requests for SQL Interface queries
11450 #
11451 # GET /sql_interface_queries/metadata -> mdls.SqlInterfaceQueryMetadata
11452 def sql_interface_metadata(
11453 self,
11454 # Avatica RPC request
11455 avatica_request: Optional[str] = None,
11456 transport_options: Optional[transport.TransportOptions] = None,
11457 ) -> mdls.SqlInterfaceQueryMetadata:
11458 """Get SQL Interface Query Metadata"""
11459 response = cast(
11460 mdls.SqlInterfaceQueryMetadata,
11461 self.get(
11462 path="/sql_interface_queries/metadata",
11463 structure=mdls.SqlInterfaceQueryMetadata,
11464 query_params={"avatica_request": avatica_request},
11465 transport_options=transport_options,
11466 ),
11467 )
11468 return response
11469
11470 # ### Run a saved SQL interface query.
11471 #
11472 # This runs a previously created SQL interface query.
11473 #
11474 # The 'result_format' parameter specifies the desired structure and format of the response.
11475 #
11476 # Supported formats:
11477 #
11478 # | result_format | Description
11479 # | :-----------: | :--- |
11480 # | json_bi | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
11481 #
11482 # GET /sql_interface_queries/{query_id}/run/{result_format} -> mdls.JsonBi
11483 def run_sql_interface_query(
11484 self,
11485 # Integer id of query
11486 query_id: int,
11487 # Format of result, options are: ["json_bi"]
11488 result_format: str,
11489 transport_options: Optional[transport.TransportOptions] = None,
11490 ) -> mdls.JsonBi:
11491 """Run SQL Interface Query"""
11492 result_format = self.encode_path_param(result_format)
11493 response = cast(
11494 mdls.JsonBi,
11495 self.get(
11496 path=f"/sql_interface_queries/{query_id}/run/{result_format}",
11497 structure=mdls.JsonBi,
11498 transport_options=transport_options,
11499 ),
11500 )
11501 return response
11502
11503 # ### Create a SQL interface query.
11504 #
11505 # This allows you to create a new SQL interface query that you can later run. Looker queries are immutable once created
11506 # and are not deleted. If you create a query that is exactly like an existing query then the existing query
11507 # will be returned and no new query will be created. Whether a new query is created or not, you can use
11508 # the 'id' in the returned query with the 'run' method.
11509 #
11510 # The query parameters are passed as json in the body of the request.
11511 #
11512 # POST /sql_interface_queries -> mdls.SqlInterfaceQuery
11513 def create_sql_interface_query(
11514 self,
11515 body: mdls.WriteSqlInterfaceQueryCreate,
11516 transport_options: Optional[transport.TransportOptions] = None,
11517 ) -> mdls.SqlInterfaceQuery:
11518 """Create SQL Interface Query"""
11519 response = cast(
11520 mdls.SqlInterfaceQuery,
11521 self.post(
11522 path="/sql_interface_queries",
11523 structure=mdls.SqlInterfaceQuery,
11524 body=body,
11525 transport_options=transport_options,
11526 ),
11527 )
11528 return response
11529
11530 # endregion
11531
11532 # region Theme: Manage Themes
11533
11534 # ### Get an array of all existing themes
11535 #
11536 # Get a **single theme** by id with [Theme](#!/Theme/theme)
11537 #
11538 # This method returns an array of all existing themes. The active time for the theme is not considered.
11539 #
11540 # **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.
11541 #
11542 # GET /themes -> Sequence[mdls.Theme]
11543 def all_themes(
11544 self,
11545 # Requested fields.
11546 fields: Optional[str] = None,
11547 transport_options: Optional[transport.TransportOptions] = None,
11548 ) -> Sequence[mdls.Theme]:
11549 """Get All Themes"""
11550 response = cast(
11551 Sequence[mdls.Theme],
11552 self.get(
11553 path="/themes",
11554 structure=Sequence[mdls.Theme],
11555 query_params={"fields": fields},
11556 transport_options=transport_options,
11557 ),
11558 )
11559 return response
11560
11561 # ### Create a theme
11562 #
11563 # Creates a new theme object, returning the theme details, including the created id.
11564 #
11565 # If `settings` are not specified, the default theme settings will be copied into the new theme.
11566 #
11567 # The theme `name` can only contain alphanumeric characters or underscores. Theme names should not contain any confidential information, such as customer names.
11568 #
11569 # **Update** an existing theme with [Update Theme](#!/Theme/update_theme)
11570 #
11571 # **Permanently delete** an existing theme with [Delete Theme](#!/Theme/delete_theme)
11572 #
11573 # For more information, see [Creating and Applying Themes](https://cloud.google.com/looker/docs/r/admin/themes).
11574 #
11575 # **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.
11576 #
11577 # POST /themes -> mdls.Theme
11578 def create_theme(
11579 self,
11580 body: mdls.WriteTheme,
11581 transport_options: Optional[transport.TransportOptions] = None,
11582 ) -> mdls.Theme:
11583 """Create Theme"""
11584 response = cast(
11585 mdls.Theme,
11586 self.post(
11587 path="/themes",
11588 structure=mdls.Theme,
11589 body=body,
11590 transport_options=transport_options,
11591 ),
11592 )
11593 return response
11594
11595 # ### Search all themes for matching criteria.
11596 #
11597 # Returns an **array of theme objects** that match the specified search criteria.
11598 #
11599 # | Search Parameters | Description
11600 # | :-------------------: | :------ |
11601 # | `begin_at` only | Find themes active at or after `begin_at`
11602 # | `end_at` only | Find themes active at or before `end_at`
11603 # | both set | Find themes with an active inclusive period between `begin_at` and `end_at`
11604 #
11605 # Note: Range matching requires boolean AND logic.
11606 # When using `begin_at` and `end_at` together, do not use `filter_or`=TRUE
11607 #
11608 # If multiple search params are given and `filter_or` is FALSE or not specified,
11609 # search params are combined in a logical AND operation.
11610 # Only rows that match *all* search param criteria will be returned.
11611 #
11612 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
11613 # Results will include rows that match **any** of the search criteria.
11614 #
11615 # String search params use case-insensitive matching.
11616 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
11617 # example="dan%" will match "danger" and "Danzig" but not "David"
11618 # example="D_m%" will match "Damage" and "dump"
11619 #
11620 # Integer search params can accept a single value or a comma separated list of values. The multiple
11621 # values will be combined under a logical OR operation - results will match at least one of
11622 # the given values.
11623 #
11624 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
11625 # or exclude (respectively) rows where the column is null.
11626 #
11627 # Boolean search params accept only "true" and "false" as values.
11628 #
11629 #
11630 # Get a **single theme** by id with [Theme](#!/Theme/theme)
11631 #
11632 # **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.
11633 #
11634 # GET /themes/search -> Sequence[mdls.Theme]
11635 def search_themes(
11636 self,
11637 # Match theme id.
11638 id: Optional[str] = None,
11639 # Match theme name.
11640 name: Optional[str] = None,
11641 # Timestamp for activation.
11642 begin_at: Optional[datetime.datetime] = None,
11643 # Timestamp for expiration.
11644 end_at: Optional[datetime.datetime] = None,
11645 # Number of results to return (used with `offset`).
11646 limit: Optional[int] = None,
11647 # Number of results to skip before returning any (used with `limit`).
11648 offset: Optional[int] = None,
11649 # Fields to sort by.
11650 sorts: Optional[str] = None,
11651 # Requested fields.
11652 fields: Optional[str] = None,
11653 # Combine given search criteria in a boolean OR expression
11654 filter_or: Optional[bool] = None,
11655 transport_options: Optional[transport.TransportOptions] = None,
11656 ) -> Sequence[mdls.Theme]:
11657 """Search Themes"""
11658 response = cast(
11659 Sequence[mdls.Theme],
11660 self.get(
11661 path="/themes/search",
11662 structure=Sequence[mdls.Theme],
11663 query_params={
11664 "id": id,
11665 "name": name,
11666 "begin_at": begin_at,
11667 "end_at": end_at,
11668 "limit": limit,
11669 "offset": offset,
11670 "sorts": sorts,
11671 "fields": fields,
11672 "filter_or": filter_or,
11673 },
11674 transport_options=transport_options,
11675 ),
11676 )
11677 return response
11678
11679 # ### Get the default theme
11680 #
11681 # Returns the active theme object set as the default.
11682 #
11683 # The **default** theme name can be set in the UI on the Admin|Theme UI page
11684 #
11685 # The optional `ts` parameter can specify a different timestamp than "now." If specified, it returns the default theme at the time indicated.
11686 #
11687 # GET /themes/default -> mdls.Theme
11688 def default_theme(
11689 self,
11690 # Timestamp representing the target datetime for the active period. Defaults to 'now'
11691 ts: Optional[datetime.datetime] = None,
11692 transport_options: Optional[transport.TransportOptions] = None,
11693 ) -> mdls.Theme:
11694 """Get Default Theme"""
11695 response = cast(
11696 mdls.Theme,
11697 self.get(
11698 path="/themes/default",
11699 structure=mdls.Theme,
11700 query_params={"ts": ts},
11701 transport_options=transport_options,
11702 ),
11703 )
11704 return response
11705
11706 # ### Set the global default theme by theme name
11707 #
11708 # Only Admin users can call this function.
11709 #
11710 # 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.
11711 #
11712 # [Create Theme](#!/Theme/create) has detailed information on rules for default and active themes
11713 #
11714 # Returns the new specified default theme object.
11715 #
11716 # **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.
11717 #
11718 # PUT /themes/default -> mdls.Theme
11719 def set_default_theme(
11720 self,
11721 # Name of theme to set as default
11722 name: str,
11723 transport_options: Optional[transport.TransportOptions] = None,
11724 ) -> mdls.Theme:
11725 """Set Default Theme"""
11726 response = cast(
11727 mdls.Theme,
11728 self.put(
11729 path="/themes/default",
11730 structure=mdls.Theme,
11731 query_params={"name": name},
11732 transport_options=transport_options,
11733 ),
11734 )
11735 return response
11736
11737 # ### Get active themes
11738 #
11739 # Returns an array of active themes.
11740 #
11741 # If the `name` parameter is specified, it will return an array with one theme if it's active and found.
11742 #
11743 # The optional `ts` parameter can specify a different timestamp than "now."
11744 #
11745 # **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.
11746 #
11747 # GET /themes/active -> Sequence[mdls.Theme]
11748 def active_themes(
11749 self,
11750 # Name of theme
11751 name: Optional[str] = None,
11752 # Timestamp representing the target datetime for the active period. Defaults to 'now'
11753 ts: Optional[datetime.datetime] = None,
11754 # Requested fields.
11755 fields: Optional[str] = None,
11756 transport_options: Optional[transport.TransportOptions] = None,
11757 ) -> Sequence[mdls.Theme]:
11758 """Get Active Themes"""
11759 response = cast(
11760 Sequence[mdls.Theme],
11761 self.get(
11762 path="/themes/active",
11763 structure=Sequence[mdls.Theme],
11764 query_params={"name": name, "ts": ts, "fields": fields},
11765 transport_options=transport_options,
11766 ),
11767 )
11768 return response
11769
11770 # ### Get the named theme if it's active. Otherwise, return the default theme
11771 #
11772 # The optional `ts` parameter can specify a different timestamp than "now."
11773 # Note: API users with `show` ability can call this function
11774 #
11775 # **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.
11776 #
11777 # GET /themes/theme_or_default -> mdls.Theme
11778 def theme_or_default(
11779 self,
11780 # Name of theme
11781 name: str,
11782 # Timestamp representing the target datetime for the active period. Defaults to 'now'
11783 ts: Optional[datetime.datetime] = None,
11784 transport_options: Optional[transport.TransportOptions] = None,
11785 ) -> mdls.Theme:
11786 """Get Theme or Default"""
11787 response = cast(
11788 mdls.Theme,
11789 self.get(
11790 path="/themes/theme_or_default",
11791 structure=mdls.Theme,
11792 query_params={"name": name, "ts": ts},
11793 transport_options=transport_options,
11794 ),
11795 )
11796 return response
11797
11798 # ### Validate a theme with the specified information
11799 #
11800 # Validates all values set for the theme, returning any errors encountered, or 200 OK if valid
11801 #
11802 # See [Create Theme](#!/Theme/create_theme) for constraints
11803 #
11804 # **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.
11805 #
11806 # POST /themes/validate -> mdls.ValidationError
11807 def validate_theme(
11808 self,
11809 body: mdls.WriteTheme,
11810 transport_options: Optional[transport.TransportOptions] = None,
11811 ) -> mdls.ValidationError:
11812 """Validate Theme"""
11813 response = cast(
11814 mdls.ValidationError,
11815 self.post(
11816 path="/themes/validate",
11817 structure=mdls.ValidationError,
11818 body=body,
11819 transport_options=transport_options,
11820 ),
11821 )
11822 return response
11823
11824 # ### Get a theme by ID
11825 #
11826 # Use this to retrieve a specific theme, whether or not it's currently active.
11827 #
11828 # **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.
11829 #
11830 # GET /themes/{theme_id} -> mdls.Theme
11831 def theme(
11832 self,
11833 # Id of theme
11834 theme_id: str,
11835 # Requested fields.
11836 fields: Optional[str] = None,
11837 transport_options: Optional[transport.TransportOptions] = None,
11838 ) -> mdls.Theme:
11839 """Get Theme"""
11840 theme_id = self.encode_path_param(theme_id)
11841 response = cast(
11842 mdls.Theme,
11843 self.get(
11844 path=f"/themes/{theme_id}",
11845 structure=mdls.Theme,
11846 query_params={"fields": fields},
11847 transport_options=transport_options,
11848 ),
11849 )
11850 return response
11851
11852 # ### Update the theme by id.
11853 #
11854 # **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.
11855 #
11856 # PATCH /themes/{theme_id} -> mdls.Theme
11857 def update_theme(
11858 self,
11859 # Id of theme
11860 theme_id: str,
11861 body: mdls.WriteTheme,
11862 transport_options: Optional[transport.TransportOptions] = None,
11863 ) -> mdls.Theme:
11864 """Update Theme"""
11865 theme_id = self.encode_path_param(theme_id)
11866 response = cast(
11867 mdls.Theme,
11868 self.patch(
11869 path=f"/themes/{theme_id}",
11870 structure=mdls.Theme,
11871 body=body,
11872 transport_options=transport_options,
11873 ),
11874 )
11875 return response
11876
11877 # ### Delete a specific theme by id
11878 #
11879 # This operation permanently deletes the identified theme from the database.
11880 #
11881 # Because multiple themes can have the same name (with different activation time spans) themes can only be deleted by ID.
11882 #
11883 # All IDs associated with a theme name can be retrieved by searching for the theme name with [Theme Search](#!/Theme/search).
11884 #
11885 # **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.
11886 #
11887 # DELETE /themes/{theme_id} -> str
11888 def delete_theme(
11889 self,
11890 # Id of theme
11891 theme_id: str,
11892 transport_options: Optional[transport.TransportOptions] = None,
11893 ) -> str:
11894 """Delete Theme"""
11895 theme_id = self.encode_path_param(theme_id)
11896 response = cast(
11897 str,
11898 self.delete(
11899 path=f"/themes/{theme_id}",
11900 structure=str,
11901 transport_options=transport_options,
11902 ),
11903 )
11904 return response
11905
11906 # endregion
11907
11908 # region User: Manage Users
11909
11910 # ### Search email credentials
11911 #
11912 # Returns all credentials_email records that match the given search criteria.
11913 #
11914 # If multiple search params are given and `filter_or` is FALSE or not specified,
11915 # search params are combined in a logical AND operation.
11916 # Only rows that match *all* search param criteria will be returned.
11917 #
11918 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
11919 # Results will include rows that match **any** of the search criteria.
11920 #
11921 # String search params use case-insensitive matching.
11922 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
11923 # example="dan%" will match "danger" and "Danzig" but not "David"
11924 # example="D_m%" will match "Damage" and "dump"
11925 #
11926 # Integer search params can accept a single value or a comma separated list of values. The multiple
11927 # values will be combined under a logical OR operation - results will match at least one of
11928 # the given values.
11929 #
11930 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
11931 # or exclude (respectively) rows where the column is null.
11932 #
11933 # Boolean search params accept only "true" and "false" as values.
11934 #
11935 #
11936 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
11937 #
11938 # GET /credentials_email/search -> Sequence[mdls.CredentialsEmailSearch]
11939 def search_credentials_email(
11940 self,
11941 # Requested fields.
11942 fields: Optional[str] = None,
11943 # Number of results to return (used with `offset`).
11944 limit: Optional[int] = None,
11945 # Number of results to skip before returning any (used with `limit`).
11946 offset: Optional[int] = None,
11947 # Fields to sort by.
11948 sorts: Optional[str] = None,
11949 # Match credentials_email id.
11950 id: Optional[str] = None,
11951 # Match credentials_email email.
11952 email: Optional[str] = None,
11953 # Find credentials_email that match given emails.
11954 emails: Optional[str] = None,
11955 # Combine given search criteria in a boolean OR expression.
11956 filter_or: Optional[bool] = None,
11957 transport_options: Optional[transport.TransportOptions] = None,
11958 ) -> Sequence[mdls.CredentialsEmailSearch]:
11959 """Search CredentialsEmail"""
11960 response = cast(
11961 Sequence[mdls.CredentialsEmailSearch],
11962 self.get(
11963 path="/credentials_email/search",
11964 structure=Sequence[mdls.CredentialsEmailSearch],
11965 query_params={
11966 "fields": fields,
11967 "limit": limit,
11968 "offset": offset,
11969 "sorts": sorts,
11970 "id": id,
11971 "email": email,
11972 "emails": emails,
11973 "filter_or": filter_or,
11974 },
11975 transport_options=transport_options,
11976 ),
11977 )
11978 return response
11979
11980 # ### Get information about the current user; i.e. the user account currently calling the API.
11981 #
11982 # GET /user -> mdls.User
11983 def me(
11984 self,
11985 # Requested fields.
11986 fields: Optional[str] = None,
11987 transport_options: Optional[transport.TransportOptions] = None,
11988 ) -> mdls.User:
11989 """Get Current User"""
11990 response = cast(
11991 mdls.User,
11992 self.get(
11993 path="/user",
11994 structure=mdls.User,
11995 query_params={"fields": fields},
11996 transport_options=transport_options,
11997 ),
11998 )
11999 return response
12000
12001 # ### Get information about all users.
12002 #
12003 # GET /users -> Sequence[mdls.User]
12004 def all_users(
12005 self,
12006 # Requested fields.
12007 fields: Optional[str] = None,
12008 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
12009 page: Optional[int] = None,
12010 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
12011 per_page: Optional[int] = None,
12012 # Number of results to return. (used with offset and takes priority over page and per_page)
12013 limit: Optional[int] = None,
12014 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
12015 offset: Optional[int] = None,
12016 # Fields to sort by.
12017 sorts: Optional[str] = None,
12018 # Optional list of ids to get specific users.
12019 ids: Optional[mdls.DelimSequence[str]] = None,
12020 transport_options: Optional[transport.TransportOptions] = None,
12021 ) -> Sequence[mdls.User]:
12022 """Get All Users"""
12023 response = cast(
12024 Sequence[mdls.User],
12025 self.get(
12026 path="/users",
12027 structure=Sequence[mdls.User],
12028 query_params={
12029 "fields": fields,
12030 "page": page,
12031 "per_page": per_page,
12032 "limit": limit,
12033 "offset": offset,
12034 "sorts": sorts,
12035 "ids": ids,
12036 },
12037 transport_options=transport_options,
12038 ),
12039 )
12040 return response
12041
12042 # ### Create a user with the specified information.
12043 #
12044 # POST /users -> mdls.User
12045 def create_user(
12046 self,
12047 body: Optional[mdls.WriteUser] = None,
12048 # Requested fields.
12049 fields: Optional[str] = None,
12050 transport_options: Optional[transport.TransportOptions] = None,
12051 ) -> mdls.User:
12052 """Create User"""
12053 response = cast(
12054 mdls.User,
12055 self.post(
12056 path="/users",
12057 structure=mdls.User,
12058 query_params={"fields": fields},
12059 body=body,
12060 transport_options=transport_options,
12061 ),
12062 )
12063 return response
12064
12065 # ### Search users
12066 #
12067 # Returns all<sup>*</sup> user records that match the given search criteria.
12068 #
12069 # If multiple search params are given and `filter_or` is FALSE or not specified,
12070 # search params are combined in a logical AND operation.
12071 # Only rows that match *all* search param criteria will be returned.
12072 #
12073 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
12074 # Results will include rows that match **any** of the search criteria.
12075 #
12076 # String search params use case-insensitive matching.
12077 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
12078 # example="dan%" will match "danger" and "Danzig" but not "David"
12079 # example="D_m%" will match "Damage" and "dump"
12080 #
12081 # Integer search params can accept a single value or a comma separated list of values. The multiple
12082 # values will be combined under a logical OR operation - results will match at least one of
12083 # the given values.
12084 #
12085 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
12086 # or exclude (respectively) rows where the column is null.
12087 #
12088 # Boolean search params accept only "true" and "false" as values.
12089 #
12090 #
12091 # (<sup>*</sup>) Results are always filtered to the level of information the caller is permitted to view.
12092 # Looker admins can see all user details; normal users in an open system can see
12093 # names of other users but no details; normal users in a closed system can only see
12094 # names of other users who are members of the same group as the user.
12095 #
12096 # GET /users/search -> Sequence[mdls.User]
12097 def search_users(
12098 self,
12099 # Include only these fields in the response
12100 fields: Optional[str] = None,
12101 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
12102 page: Optional[int] = None,
12103 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
12104 per_page: Optional[int] = None,
12105 # Number of results to return. (used with offset and takes priority over page and per_page)
12106 limit: Optional[int] = None,
12107 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
12108 offset: Optional[int] = None,
12109 # Fields to sort by.
12110 sorts: Optional[str] = None,
12111 # Match User Id.
12112 id: Optional[str] = None,
12113 # Match First name.
12114 first_name: Optional[str] = None,
12115 # Match Last name.
12116 last_name: Optional[str] = None,
12117 # Search for user accounts associated with Looker employees. Availability of this filter is limited to users with permission to view complete user details.
12118 verified_looker_employee: Optional[bool] = None,
12119 # Search for only embed users
12120 embed_user: Optional[bool] = None,
12121 # Search for the user with this email address. Availability of this filter is limited to users with permission to view complete user details.
12122 email: Optional[str] = None,
12123 # Search for disabled user accounts. Availability of this filter is limited to users with permission to view complete user details.
12124 is_disabled: Optional[bool] = None,
12125 # Combine given search criteria in a boolean OR expression
12126 filter_or: Optional[bool] = None,
12127 # Search for users who have access to this content_metadata item
12128 content_metadata_id: Optional[str] = None,
12129 # Search for users who are direct members of this group
12130 group_id: Optional[str] = None,
12131 # Search for users who can manage API3 credentials. This field may only be applicable for [Looker (Google Cloud core)](https://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.
12132 can_manage_api3_creds: Optional[bool] = None,
12133 # Search for service account users. Send true to get only service accounts, or false to get all other types of users. This field may only be applicable for [Looker (Google Cloud core)](https://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.
12134 is_service_account: Optional[bool] = None,
12135 transport_options: Optional[transport.TransportOptions] = None,
12136 ) -> Sequence[mdls.User]:
12137 """Search Users"""
12138 response = cast(
12139 Sequence[mdls.User],
12140 self.get(
12141 path="/users/search",
12142 structure=Sequence[mdls.User],
12143 query_params={
12144 "fields": fields,
12145 "page": page,
12146 "per_page": per_page,
12147 "limit": limit,
12148 "offset": offset,
12149 "sorts": sorts,
12150 "id": id,
12151 "first_name": first_name,
12152 "last_name": last_name,
12153 "verified_looker_employee": verified_looker_employee,
12154 "embed_user": embed_user,
12155 "email": email,
12156 "is_disabled": is_disabled,
12157 "filter_or": filter_or,
12158 "content_metadata_id": content_metadata_id,
12159 "group_id": group_id,
12160 "can_manage_api3_creds": can_manage_api3_creds,
12161 "is_service_account": is_service_account,
12162 },
12163 transport_options=transport_options,
12164 ),
12165 )
12166 return response
12167
12168 # ### Search for user accounts by name
12169 #
12170 # Returns all user accounts where `first_name` OR `last_name` OR `email` field values match a pattern.
12171 # The pattern can contain `%` and `_` wildcards as in SQL LIKE expressions.
12172 #
12173 # Any additional search params will be combined into a logical AND expression.
12174 #
12175 # GET /users/search/names/{pattern} -> Sequence[mdls.User]
12176 def search_users_names(
12177 self,
12178 # Pattern to match
12179 pattern: str,
12180 # Include only these fields in the response
12181 fields: Optional[str] = None,
12182 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
12183 page: Optional[int] = None,
12184 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
12185 per_page: Optional[int] = None,
12186 # Number of results to return. (used with offset and takes priority over page and per_page)
12187 limit: Optional[int] = None,
12188 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
12189 offset: Optional[int] = None,
12190 # Fields to sort by
12191 sorts: Optional[str] = None,
12192 # Match User Id
12193 id: Optional[str] = None,
12194 # Match First name
12195 first_name: Optional[str] = None,
12196 # Match Last name
12197 last_name: Optional[str] = None,
12198 # Match Verified Looker employee
12199 verified_looker_employee: Optional[bool] = None,
12200 # Match Email Address
12201 email: Optional[str] = None,
12202 # Include or exclude disabled accounts in the results
12203 is_disabled: Optional[bool] = None,
12204 transport_options: Optional[transport.TransportOptions] = None,
12205 ) -> Sequence[mdls.User]:
12206 """Search User Names"""
12207 pattern = self.encode_path_param(pattern)
12208 response = cast(
12209 Sequence[mdls.User],
12210 self.get(
12211 path=f"/users/search/names/{pattern}",
12212 structure=Sequence[mdls.User],
12213 query_params={
12214 "fields": fields,
12215 "page": page,
12216 "per_page": per_page,
12217 "limit": limit,
12218 "offset": offset,
12219 "sorts": sorts,
12220 "id": id,
12221 "first_name": first_name,
12222 "last_name": last_name,
12223 "verified_looker_employee": verified_looker_employee,
12224 "email": email,
12225 "is_disabled": is_disabled,
12226 },
12227 transport_options=transport_options,
12228 ),
12229 )
12230 return response
12231
12232 # ### Get information about the user with a specific id.
12233 #
12234 # If the caller is an admin or the caller is the user being specified, then full user information will
12235 # be returned. Otherwise, a minimal 'public' variant of the user information will be returned. This contains
12236 # The user name and avatar url, but no sensitive information.
12237 #
12238 # GET /users/{user_id} -> mdls.User
12239 def user(
12240 self,
12241 # Id of user
12242 user_id: str,
12243 # Requested fields.
12244 fields: Optional[str] = None,
12245 transport_options: Optional[transport.TransportOptions] = None,
12246 ) -> mdls.User:
12247 """Get User by Id"""
12248 user_id = self.encode_path_param(user_id)
12249 response = cast(
12250 mdls.User,
12251 self.get(
12252 path=f"/users/{user_id}",
12253 structure=mdls.User,
12254 query_params={"fields": fields},
12255 transport_options=transport_options,
12256 ),
12257 )
12258 return response
12259
12260 # ### Update information about the user with a specific id.
12261 #
12262 # PATCH /users/{user_id} -> mdls.User
12263 def update_user(
12264 self,
12265 # Id of user
12266 user_id: str,
12267 body: mdls.WriteUser,
12268 # Requested fields.
12269 fields: Optional[str] = None,
12270 transport_options: Optional[transport.TransportOptions] = None,
12271 ) -> mdls.User:
12272 """Update User"""
12273 user_id = self.encode_path_param(user_id)
12274 response = cast(
12275 mdls.User,
12276 self.patch(
12277 path=f"/users/{user_id}",
12278 structure=mdls.User,
12279 query_params={"fields": fields},
12280 body=body,
12281 transport_options=transport_options,
12282 ),
12283 )
12284 return response
12285
12286 # ### Delete the user with a specific id.
12287 #
12288 # **DANGER** this will delete the user and all looks and other information owned by the user.
12289 #
12290 # DELETE /users/{user_id} -> str
12291 def delete_user(
12292 self,
12293 # Id of user
12294 user_id: str,
12295 transport_options: Optional[transport.TransportOptions] = None,
12296 ) -> str:
12297 """Delete User"""
12298 user_id = self.encode_path_param(user_id)
12299 response = cast(
12300 str,
12301 self.delete(
12302 path=f"/users/{user_id}",
12303 structure=str,
12304 transport_options=transport_options,
12305 ),
12306 )
12307 return response
12308
12309 # ### Get information about the user with a credential of given type with specific id.
12310 #
12311 # This is used to do things like find users by their embed external_user_id. Or, find the user with
12312 # a given api3 client_id, etc. The 'credential_type' matches the 'type' name of the various credential
12313 # types. It must be one of the values listed in the table below. The 'credential_id' is your unique Id
12314 # for the user and is specific to each type of credential.
12315 #
12316 # An example using the Ruby sdk might look like:
12317 #
12318 # `sdk.user_for_credential('embed', 'customer-4959425')`
12319 #
12320 # This table shows the supported 'Credential Type' strings. The right column is for reference; it shows
12321 # which field in the given credential type is actually searched when finding a user with the supplied
12322 # 'credential_id'.
12323 #
12324 # | Credential Types | Id Field Matched |
12325 # | ---------------- | ---------------- |
12326 # | email | email |
12327 # | google | google_user_id |
12328 # | saml | saml_user_id |
12329 # | oidc | oidc_user_id |
12330 # | ldap | ldap_id |
12331 # | api | token |
12332 # | api3 | client_id |
12333 # | embed | external_user_id |
12334 # | looker_openid | email |
12335 #
12336 # **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'.
12337 #
12338 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12339 #
12340 # GET /users/credential/{credential_type}/{credential_id} -> mdls.User
12341 def user_for_credential(
12342 self,
12343 # Type name of credential
12344 credential_type: str,
12345 # Id of credential
12346 credential_id: str,
12347 # Requested fields.
12348 fields: Optional[str] = None,
12349 transport_options: Optional[transport.TransportOptions] = None,
12350 ) -> mdls.User:
12351 """Get User by Credential Id"""
12352 credential_type = self.encode_path_param(credential_type)
12353 credential_id = self.encode_path_param(credential_id)
12354 response = cast(
12355 mdls.User,
12356 self.get(
12357 path=f"/users/credential/{credential_type}/{credential_id}",
12358 structure=mdls.User,
12359 query_params={"fields": fields},
12360 transport_options=transport_options,
12361 ),
12362 )
12363 return response
12364
12365 # ### Email/password login information for the specified user.
12366 #
12367 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12368 #
12369 # GET /users/{user_id}/credentials_email -> mdls.CredentialsEmail
12370 def user_credentials_email(
12371 self,
12372 # Id of user
12373 user_id: str,
12374 # Requested fields.
12375 fields: Optional[str] = None,
12376 transport_options: Optional[transport.TransportOptions] = None,
12377 ) -> mdls.CredentialsEmail:
12378 """Get Email/Password Credential"""
12379 user_id = self.encode_path_param(user_id)
12380 response = cast(
12381 mdls.CredentialsEmail,
12382 self.get(
12383 path=f"/users/{user_id}/credentials_email",
12384 structure=mdls.CredentialsEmail,
12385 query_params={"fields": fields},
12386 transport_options=transport_options,
12387 ),
12388 )
12389 return response
12390
12391 # ### Email/password login information for the specified user.
12392 #
12393 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12394 #
12395 # POST /users/{user_id}/credentials_email -> mdls.CredentialsEmail
12396 def create_user_credentials_email(
12397 self,
12398 # Id of user
12399 user_id: str,
12400 body: mdls.WriteCredentialsEmail,
12401 # Requested fields.
12402 fields: Optional[str] = None,
12403 transport_options: Optional[transport.TransportOptions] = None,
12404 ) -> mdls.CredentialsEmail:
12405 """Create Email/Password Credential"""
12406 user_id = self.encode_path_param(user_id)
12407 response = cast(
12408 mdls.CredentialsEmail,
12409 self.post(
12410 path=f"/users/{user_id}/credentials_email",
12411 structure=mdls.CredentialsEmail,
12412 query_params={"fields": fields},
12413 body=body,
12414 transport_options=transport_options,
12415 ),
12416 )
12417 return response
12418
12419 # ### Email/password login information for the specified user.
12420 #
12421 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12422 #
12423 # PATCH /users/{user_id}/credentials_email -> mdls.CredentialsEmail
12424 def update_user_credentials_email(
12425 self,
12426 # Id of user
12427 user_id: str,
12428 body: mdls.WriteCredentialsEmail,
12429 # Requested fields.
12430 fields: Optional[str] = None,
12431 transport_options: Optional[transport.TransportOptions] = None,
12432 ) -> mdls.CredentialsEmail:
12433 """Update Email/Password Credential"""
12434 user_id = self.encode_path_param(user_id)
12435 response = cast(
12436 mdls.CredentialsEmail,
12437 self.patch(
12438 path=f"/users/{user_id}/credentials_email",
12439 structure=mdls.CredentialsEmail,
12440 query_params={"fields": fields},
12441 body=body,
12442 transport_options=transport_options,
12443 ),
12444 )
12445 return response
12446
12447 # ### Email/password login information for the specified user.
12448 #
12449 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12450 #
12451 # DELETE /users/{user_id}/credentials_email -> str
12452 def delete_user_credentials_email(
12453 self,
12454 # Id of user
12455 user_id: str,
12456 transport_options: Optional[transport.TransportOptions] = None,
12457 ) -> str:
12458 """Delete Email/Password Credential"""
12459 user_id = self.encode_path_param(user_id)
12460 response = cast(
12461 str,
12462 self.delete(
12463 path=f"/users/{user_id}/credentials_email",
12464 structure=str,
12465 transport_options=transport_options,
12466 ),
12467 )
12468 return response
12469
12470 # ### Two-factor login information for the specified user.
12471 #
12472 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12473 #
12474 # GET /users/{user_id}/credentials_totp -> mdls.CredentialsTotp
12475 def user_credentials_totp(
12476 self,
12477 # Id of user
12478 user_id: str,
12479 # Requested fields.
12480 fields: Optional[str] = None,
12481 transport_options: Optional[transport.TransportOptions] = None,
12482 ) -> mdls.CredentialsTotp:
12483 """Get Two-Factor Credential"""
12484 user_id = self.encode_path_param(user_id)
12485 response = cast(
12486 mdls.CredentialsTotp,
12487 self.get(
12488 path=f"/users/{user_id}/credentials_totp",
12489 structure=mdls.CredentialsTotp,
12490 query_params={"fields": fields},
12491 transport_options=transport_options,
12492 ),
12493 )
12494 return response
12495
12496 # ### Two-factor login information for the specified user.
12497 #
12498 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12499 #
12500 # POST /users/{user_id}/credentials_totp -> mdls.CredentialsTotp
12501 def create_user_credentials_totp(
12502 self,
12503 # Id of user
12504 user_id: str,
12505 # WARNING: no writeable properties found for POST, PUT, or PATCH
12506 body: Optional[mdls.CredentialsTotp] = None,
12507 # Requested fields.
12508 fields: Optional[str] = None,
12509 transport_options: Optional[transport.TransportOptions] = None,
12510 ) -> mdls.CredentialsTotp:
12511 """Create Two-Factor Credential"""
12512 user_id = self.encode_path_param(user_id)
12513 response = cast(
12514 mdls.CredentialsTotp,
12515 self.post(
12516 path=f"/users/{user_id}/credentials_totp",
12517 structure=mdls.CredentialsTotp,
12518 query_params={"fields": fields},
12519 body=body,
12520 transport_options=transport_options,
12521 ),
12522 )
12523 return response
12524
12525 # ### Two-factor login information for the specified user.
12526 #
12527 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12528 #
12529 # DELETE /users/{user_id}/credentials_totp -> str
12530 def delete_user_credentials_totp(
12531 self,
12532 # Id of user
12533 user_id: str,
12534 transport_options: Optional[transport.TransportOptions] = None,
12535 ) -> str:
12536 """Delete Two-Factor Credential"""
12537 user_id = self.encode_path_param(user_id)
12538 response = cast(
12539 str,
12540 self.delete(
12541 path=f"/users/{user_id}/credentials_totp",
12542 structure=str,
12543 transport_options=transport_options,
12544 ),
12545 )
12546 return response
12547
12548 # ### LDAP login information for the specified user.
12549 #
12550 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12551 #
12552 # GET /users/{user_id}/credentials_ldap -> mdls.CredentialsLDAP
12553 def user_credentials_ldap(
12554 self,
12555 # Id of user
12556 user_id: str,
12557 # Requested fields.
12558 fields: Optional[str] = None,
12559 transport_options: Optional[transport.TransportOptions] = None,
12560 ) -> mdls.CredentialsLDAP:
12561 """Get LDAP Credential"""
12562 user_id = self.encode_path_param(user_id)
12563 response = cast(
12564 mdls.CredentialsLDAP,
12565 self.get(
12566 path=f"/users/{user_id}/credentials_ldap",
12567 structure=mdls.CredentialsLDAP,
12568 query_params={"fields": fields},
12569 transport_options=transport_options,
12570 ),
12571 )
12572 return response
12573
12574 # ### LDAP login information for the specified user.
12575 #
12576 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12577 #
12578 # DELETE /users/{user_id}/credentials_ldap -> str
12579 def delete_user_credentials_ldap(
12580 self,
12581 # Id of user
12582 user_id: str,
12583 transport_options: Optional[transport.TransportOptions] = None,
12584 ) -> str:
12585 """Delete LDAP Credential"""
12586 user_id = self.encode_path_param(user_id)
12587 response = cast(
12588 str,
12589 self.delete(
12590 path=f"/users/{user_id}/credentials_ldap",
12591 structure=str,
12592 transport_options=transport_options,
12593 ),
12594 )
12595 return response
12596
12597 # ### Google authentication login information for the specified user.
12598 #
12599 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12600 #
12601 # GET /users/{user_id}/credentials_google -> mdls.CredentialsGoogle
12602 def user_credentials_google(
12603 self,
12604 # Id of user
12605 user_id: str,
12606 # Requested fields.
12607 fields: Optional[str] = None,
12608 transport_options: Optional[transport.TransportOptions] = None,
12609 ) -> mdls.CredentialsGoogle:
12610 """Get Google Auth Credential"""
12611 user_id = self.encode_path_param(user_id)
12612 response = cast(
12613 mdls.CredentialsGoogle,
12614 self.get(
12615 path=f"/users/{user_id}/credentials_google",
12616 structure=mdls.CredentialsGoogle,
12617 query_params={"fields": fields},
12618 transport_options=transport_options,
12619 ),
12620 )
12621 return response
12622
12623 # ### Google authentication login information for the specified user.
12624 #
12625 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12626 #
12627 # DELETE /users/{user_id}/credentials_google -> str
12628 def delete_user_credentials_google(
12629 self,
12630 # Id of user
12631 user_id: str,
12632 transport_options: Optional[transport.TransportOptions] = None,
12633 ) -> str:
12634 """Delete Google Auth Credential"""
12635 user_id = self.encode_path_param(user_id)
12636 response = cast(
12637 str,
12638 self.delete(
12639 path=f"/users/{user_id}/credentials_google",
12640 structure=str,
12641 transport_options=transport_options,
12642 ),
12643 )
12644 return response
12645
12646 # ### Saml authentication login information for the specified user.
12647 #
12648 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12649 #
12650 # GET /users/{user_id}/credentials_saml -> mdls.CredentialsSaml
12651 def user_credentials_saml(
12652 self,
12653 # Id of user
12654 user_id: str,
12655 # Requested fields.
12656 fields: Optional[str] = None,
12657 transport_options: Optional[transport.TransportOptions] = None,
12658 ) -> mdls.CredentialsSaml:
12659 """Get Saml Auth Credential"""
12660 user_id = self.encode_path_param(user_id)
12661 response = cast(
12662 mdls.CredentialsSaml,
12663 self.get(
12664 path=f"/users/{user_id}/credentials_saml",
12665 structure=mdls.CredentialsSaml,
12666 query_params={"fields": fields},
12667 transport_options=transport_options,
12668 ),
12669 )
12670 return response
12671
12672 # ### Saml authentication login information for the specified user.
12673 #
12674 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12675 #
12676 # DELETE /users/{user_id}/credentials_saml -> str
12677 def delete_user_credentials_saml(
12678 self,
12679 # Id of user
12680 user_id: str,
12681 transport_options: Optional[transport.TransportOptions] = None,
12682 ) -> str:
12683 """Delete Saml Auth Credential"""
12684 user_id = self.encode_path_param(user_id)
12685 response = cast(
12686 str,
12687 self.delete(
12688 path=f"/users/{user_id}/credentials_saml",
12689 structure=str,
12690 transport_options=transport_options,
12691 ),
12692 )
12693 return response
12694
12695 # ### OpenID Connect (OIDC) authentication login information for the specified user.
12696 #
12697 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12698 #
12699 # GET /users/{user_id}/credentials_oidc -> mdls.CredentialsOIDC
12700 def user_credentials_oidc(
12701 self,
12702 # Id of user
12703 user_id: str,
12704 # Requested fields.
12705 fields: Optional[str] = None,
12706 transport_options: Optional[transport.TransportOptions] = None,
12707 ) -> mdls.CredentialsOIDC:
12708 """Get OIDC Auth Credential"""
12709 user_id = self.encode_path_param(user_id)
12710 response = cast(
12711 mdls.CredentialsOIDC,
12712 self.get(
12713 path=f"/users/{user_id}/credentials_oidc",
12714 structure=mdls.CredentialsOIDC,
12715 query_params={"fields": fields},
12716 transport_options=transport_options,
12717 ),
12718 )
12719 return response
12720
12721 # ### OpenID Connect (OIDC) authentication login information for the specified user.
12722 #
12723 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12724 #
12725 # DELETE /users/{user_id}/credentials_oidc -> str
12726 def delete_user_credentials_oidc(
12727 self,
12728 # Id of user
12729 user_id: str,
12730 transport_options: Optional[transport.TransportOptions] = None,
12731 ) -> str:
12732 """Delete OIDC Auth Credential"""
12733 user_id = self.encode_path_param(user_id)
12734 response = cast(
12735 str,
12736 self.delete(
12737 path=f"/users/{user_id}/credentials_oidc",
12738 structure=str,
12739 transport_options=transport_options,
12740 ),
12741 )
12742 return response
12743
12744 # ### API login information for the specified user. This is for the newer API keys that can be added for any user.
12745 #
12746 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12747 #
12748 # GET /users/{user_id}/credentials_api3/{credentials_api3_id} -> mdls.CredentialsApi3
12749 def user_credentials_api3(
12750 self,
12751 # Id of user
12752 user_id: str,
12753 # Id of API Credential
12754 credentials_api3_id: str,
12755 # Requested fields.
12756 fields: Optional[str] = None,
12757 transport_options: Optional[transport.TransportOptions] = None,
12758 ) -> mdls.CredentialsApi3:
12759 """Get API Credential"""
12760 user_id = self.encode_path_param(user_id)
12761 credentials_api3_id = self.encode_path_param(credentials_api3_id)
12762 response = cast(
12763 mdls.CredentialsApi3,
12764 self.get(
12765 path=f"/users/{user_id}/credentials_api3/{credentials_api3_id}",
12766 structure=mdls.CredentialsApi3,
12767 query_params={"fields": fields},
12768 transport_options=transport_options,
12769 ),
12770 )
12771 return response
12772
12773 # ### API login information for the specified user. This is for the newer API keys that can be added for any user.
12774 #
12775 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12776 #
12777 # PATCH /users/{user_id}/credentials_api3/{credentials_api3_id} -> mdls.CredentialsApi3
12778 def update_user_credentials_api3(
12779 self,
12780 # Id of user
12781 user_id: str,
12782 # Id of API Credential
12783 credentials_api3_id: str,
12784 body: mdls.WriteCredentialsApi3,
12785 # Requested fields.
12786 fields: Optional[str] = None,
12787 transport_options: Optional[transport.TransportOptions] = None,
12788 ) -> mdls.CredentialsApi3:
12789 """Update API Credential"""
12790 user_id = self.encode_path_param(user_id)
12791 credentials_api3_id = self.encode_path_param(credentials_api3_id)
12792 response = cast(
12793 mdls.CredentialsApi3,
12794 self.patch(
12795 path=f"/users/{user_id}/credentials_api3/{credentials_api3_id}",
12796 structure=mdls.CredentialsApi3,
12797 query_params={"fields": fields},
12798 body=body,
12799 transport_options=transport_options,
12800 ),
12801 )
12802 return response
12803
12804 # ### API login information for the specified user. This is for the newer API keys that can be added for any user.
12805 #
12806 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12807 #
12808 # DELETE /users/{user_id}/credentials_api3/{credentials_api3_id} -> str
12809 def delete_user_credentials_api3(
12810 self,
12811 # Id of user
12812 user_id: str,
12813 # Id of API Credential
12814 credentials_api3_id: str,
12815 transport_options: Optional[transport.TransportOptions] = None,
12816 ) -> str:
12817 """Delete API Credential"""
12818 user_id = self.encode_path_param(user_id)
12819 credentials_api3_id = self.encode_path_param(credentials_api3_id)
12820 response = cast(
12821 str,
12822 self.delete(
12823 path=f"/users/{user_id}/credentials_api3/{credentials_api3_id}",
12824 structure=str,
12825 transport_options=transport_options,
12826 ),
12827 )
12828 return response
12829
12830 # ### API login information for the specified user. This is for the newer API keys that can be added for any user.
12831 #
12832 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12833 #
12834 # GET /users/{user_id}/credentials_api3 -> Sequence[mdls.CredentialsApi3]
12835 def all_user_credentials_api3s(
12836 self,
12837 # Id of user
12838 user_id: str,
12839 # Requested fields.
12840 fields: Optional[str] = None,
12841 transport_options: Optional[transport.TransportOptions] = None,
12842 ) -> Sequence[mdls.CredentialsApi3]:
12843 """Get All API Credentials"""
12844 user_id = self.encode_path_param(user_id)
12845 response = cast(
12846 Sequence[mdls.CredentialsApi3],
12847 self.get(
12848 path=f"/users/{user_id}/credentials_api3",
12849 structure=Sequence[mdls.CredentialsApi3],
12850 query_params={"fields": fields},
12851 transport_options=transport_options,
12852 ),
12853 )
12854 return response
12855
12856 # ### API login information for the specified user. This is for the newer API keys that can be added for any user.
12857 #
12858 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12859 #
12860 # POST /users/{user_id}/credentials_api3 -> mdls.CreateCredentialsApi3
12861 def create_user_credentials_api3(
12862 self,
12863 # Id of user
12864 user_id: str,
12865 # Requested fields.
12866 fields: Optional[str] = None,
12867 transport_options: Optional[transport.TransportOptions] = None,
12868 ) -> mdls.CreateCredentialsApi3:
12869 """Create API Credential"""
12870 user_id = self.encode_path_param(user_id)
12871 response = cast(
12872 mdls.CreateCredentialsApi3,
12873 self.post(
12874 path=f"/users/{user_id}/credentials_api3",
12875 structure=mdls.CreateCredentialsApi3,
12876 query_params={"fields": fields},
12877 transport_options=transport_options,
12878 ),
12879 )
12880 return response
12881
12882 # ### Embed login information for the specified user.
12883 #
12884 # **NOTE**: Calls to this endpoint require [Embedding](https://cloud.google.com/looker/docs/r/looker-core-feature-embed) to be enabled. Usage of this endpoint is not authorized for Looker Core Standard and Looker Core Enterprise.
12885 #
12886 # GET /users/{user_id}/credentials_embed/{credentials_embed_id} -> mdls.CredentialsEmbed
12887 def user_credentials_embed(
12888 self,
12889 # Id of user
12890 user_id: str,
12891 # Id of Embedding Credential
12892 credentials_embed_id: str,
12893 # Requested fields.
12894 fields: Optional[str] = None,
12895 transport_options: Optional[transport.TransportOptions] = None,
12896 ) -> mdls.CredentialsEmbed:
12897 """Get Embedding Credential"""
12898 user_id = self.encode_path_param(user_id)
12899 credentials_embed_id = self.encode_path_param(credentials_embed_id)
12900 response = cast(
12901 mdls.CredentialsEmbed,
12902 self.get(
12903 path=f"/users/{user_id}/credentials_embed/{credentials_embed_id}",
12904 structure=mdls.CredentialsEmbed,
12905 query_params={"fields": fields},
12906 transport_options=transport_options,
12907 ),
12908 )
12909 return response
12910
12911 # ### Embed login information for the specified user.
12912 #
12913 # **NOTE**: Calls to this endpoint require [Embedding](https://cloud.google.com/looker/docs/r/looker-core-feature-embed) to be enabled. Usage of this endpoint is not authorized for Looker Core Standard and Looker Core Enterprise.
12914 #
12915 # DELETE /users/{user_id}/credentials_embed/{credentials_embed_id} -> str
12916 def delete_user_credentials_embed(
12917 self,
12918 # Id of user
12919 user_id: str,
12920 # Id of Embedding Credential
12921 credentials_embed_id: str,
12922 transport_options: Optional[transport.TransportOptions] = None,
12923 ) -> str:
12924 """Delete Embedding Credential"""
12925 user_id = self.encode_path_param(user_id)
12926 credentials_embed_id = self.encode_path_param(credentials_embed_id)
12927 response = cast(
12928 str,
12929 self.delete(
12930 path=f"/users/{user_id}/credentials_embed/{credentials_embed_id}",
12931 structure=str,
12932 transport_options=transport_options,
12933 ),
12934 )
12935 return response
12936
12937 # ### Embed login information for the specified user.
12938 #
12939 # **NOTE**: Calls to this endpoint require [Embedding](https://cloud.google.com/looker/docs/r/looker-core-feature-embed) to be enabled. Usage of this endpoint is not authorized for Looker Core Standard and Looker Core Enterprise.
12940 #
12941 # GET /users/{user_id}/credentials_embed -> Sequence[mdls.CredentialsEmbed]
12942 def all_user_credentials_embeds(
12943 self,
12944 # Id of user
12945 user_id: str,
12946 # Requested fields.
12947 fields: Optional[str] = None,
12948 transport_options: Optional[transport.TransportOptions] = None,
12949 ) -> Sequence[mdls.CredentialsEmbed]:
12950 """Get All Embedding Credentials"""
12951 user_id = self.encode_path_param(user_id)
12952 response = cast(
12953 Sequence[mdls.CredentialsEmbed],
12954 self.get(
12955 path=f"/users/{user_id}/credentials_embed",
12956 structure=Sequence[mdls.CredentialsEmbed],
12957 query_params={"fields": fields},
12958 transport_options=transport_options,
12959 ),
12960 )
12961 return response
12962
12963 # ### Looker Openid login information for the specified user. Used by Looker Analysts.
12964 #
12965 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12966 #
12967 # GET /users/{user_id}/credentials_looker_openid -> mdls.CredentialsLookerOpenid
12968 def user_credentials_looker_openid(
12969 self,
12970 # Id of user
12971 user_id: str,
12972 # Requested fields.
12973 fields: Optional[str] = None,
12974 transport_options: Optional[transport.TransportOptions] = None,
12975 ) -> mdls.CredentialsLookerOpenid:
12976 """Get Looker OpenId Credential"""
12977 user_id = self.encode_path_param(user_id)
12978 response = cast(
12979 mdls.CredentialsLookerOpenid,
12980 self.get(
12981 path=f"/users/{user_id}/credentials_looker_openid",
12982 structure=mdls.CredentialsLookerOpenid,
12983 query_params={"fields": fields},
12984 transport_options=transport_options,
12985 ),
12986 )
12987 return response
12988
12989 # ### Looker Openid login information for the specified user. Used by Looker Analysts.
12990 #
12991 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12992 #
12993 # DELETE /users/{user_id}/credentials_looker_openid -> str
12994 def delete_user_credentials_looker_openid(
12995 self,
12996 # Id of user
12997 user_id: str,
12998 transport_options: Optional[transport.TransportOptions] = None,
12999 ) -> str:
13000 """Delete Looker OpenId Credential"""
13001 user_id = self.encode_path_param(user_id)
13002 response = cast(
13003 str,
13004 self.delete(
13005 path=f"/users/{user_id}/credentials_looker_openid",
13006 structure=str,
13007 transport_options=transport_options,
13008 ),
13009 )
13010 return response
13011
13012 # ### Web login session for the specified user.
13013 #
13014 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
13015 #
13016 # GET /users/{user_id}/sessions/{session_id} -> mdls.Session
13017 def user_session(
13018 self,
13019 # Id of user
13020 user_id: str,
13021 # Id of Web Login Session
13022 session_id: str,
13023 # Requested fields.
13024 fields: Optional[str] = None,
13025 transport_options: Optional[transport.TransportOptions] = None,
13026 ) -> mdls.Session:
13027 """Get Web Login Session"""
13028 user_id = self.encode_path_param(user_id)
13029 session_id = self.encode_path_param(session_id)
13030 response = cast(
13031 mdls.Session,
13032 self.get(
13033 path=f"/users/{user_id}/sessions/{session_id}",
13034 structure=mdls.Session,
13035 query_params={"fields": fields},
13036 transport_options=transport_options,
13037 ),
13038 )
13039 return response
13040
13041 # ### Web login session for the specified user.
13042 #
13043 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
13044 #
13045 # DELETE /users/{user_id}/sessions/{session_id} -> str
13046 def delete_user_session(
13047 self,
13048 # Id of user
13049 user_id: str,
13050 # Id of Web Login Session
13051 session_id: str,
13052 transport_options: Optional[transport.TransportOptions] = None,
13053 ) -> str:
13054 """Delete Web Login Session"""
13055 user_id = self.encode_path_param(user_id)
13056 session_id = self.encode_path_param(session_id)
13057 response = cast(
13058 str,
13059 self.delete(
13060 path=f"/users/{user_id}/sessions/{session_id}",
13061 structure=str,
13062 transport_options=transport_options,
13063 ),
13064 )
13065 return response
13066
13067 # ### Web login session for the specified user.
13068 #
13069 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
13070 #
13071 # GET /users/{user_id}/sessions -> Sequence[mdls.Session]
13072 def all_user_sessions(
13073 self,
13074 # Id of user
13075 user_id: str,
13076 # Requested fields.
13077 fields: Optional[str] = None,
13078 transport_options: Optional[transport.TransportOptions] = None,
13079 ) -> Sequence[mdls.Session]:
13080 """Get All Web Login Sessions"""
13081 user_id = self.encode_path_param(user_id)
13082 response = cast(
13083 Sequence[mdls.Session],
13084 self.get(
13085 path=f"/users/{user_id}/sessions",
13086 structure=Sequence[mdls.Session],
13087 query_params={"fields": fields},
13088 transport_options=transport_options,
13089 ),
13090 )
13091 return response
13092
13093 # ### Create a password reset token.
13094 # This will create a cryptographically secure random password reset token for the user.
13095 # If the user already has a password reset token then this invalidates the old token and creates a new one.
13096 # The token is expressed as the 'password_reset_url' of the user's email/password credential object.
13097 # This takes an optional 'expires' param to indicate if the new token should be an expiring token.
13098 # Tokens that expire are typically used for self-service password resets for existing users.
13099 # Invitation emails for new users typically are not set to expire.
13100 # The expire period is always 60 minutes when expires is enabled.
13101 # This method can be called with an empty body.
13102 #
13103 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
13104 #
13105 # POST /users/{user_id}/credentials_email/password_reset -> mdls.CredentialsEmail
13106 def create_user_credentials_email_password_reset(
13107 self,
13108 # Id of user
13109 user_id: str,
13110 # Expiring token.
13111 expires: Optional[bool] = None,
13112 # Requested fields.
13113 fields: Optional[str] = None,
13114 transport_options: Optional[transport.TransportOptions] = None,
13115 ) -> mdls.CredentialsEmail:
13116 """Create Password Reset Token"""
13117 user_id = self.encode_path_param(user_id)
13118 response = cast(
13119 mdls.CredentialsEmail,
13120 self.post(
13121 path=f"/users/{user_id}/credentials_email/password_reset",
13122 structure=mdls.CredentialsEmail,
13123 query_params={"expires": expires, "fields": fields},
13124 transport_options=transport_options,
13125 ),
13126 )
13127 return response
13128
13129 # ### Get information about roles of a given user
13130 #
13131 # GET /users/{user_id}/roles -> Sequence[mdls.Role]
13132 def user_roles(
13133 self,
13134 # Id of user
13135 user_id: str,
13136 # Requested fields.
13137 fields: Optional[str] = None,
13138 # Get only roles associated directly with the user: exclude those only associated through groups.
13139 direct_association_only: Optional[bool] = None,
13140 transport_options: Optional[transport.TransportOptions] = None,
13141 ) -> Sequence[mdls.Role]:
13142 """Get User Roles"""
13143 user_id = self.encode_path_param(user_id)
13144 response = cast(
13145 Sequence[mdls.Role],
13146 self.get(
13147 path=f"/users/{user_id}/roles",
13148 structure=Sequence[mdls.Role],
13149 query_params={
13150 "fields": fields,
13151 "direct_association_only": direct_association_only,
13152 },
13153 transport_options=transport_options,
13154 ),
13155 )
13156 return response
13157
13158 # ### Set roles of the user with a specific id.
13159 #
13160 # PUT /users/{user_id}/roles -> Sequence[mdls.Role]
13161 def set_user_roles(
13162 self,
13163 # Id of user
13164 user_id: str,
13165 body: Sequence[str],
13166 # Requested fields.
13167 fields: Optional[str] = None,
13168 transport_options: Optional[transport.TransportOptions] = None,
13169 ) -> Sequence[mdls.Role]:
13170 """Set User Roles"""
13171 user_id = self.encode_path_param(user_id)
13172 response = cast(
13173 Sequence[mdls.Role],
13174 self.put(
13175 path=f"/users/{user_id}/roles",
13176 structure=Sequence[mdls.Role],
13177 query_params={"fields": fields},
13178 body=body,
13179 transport_options=transport_options,
13180 ),
13181 )
13182 return response
13183
13184 # ### Get user attribute values for a given user.
13185 #
13186 # Returns the values of specified user attributes (or all user attributes) for a certain user.
13187 #
13188 # A value for each user attribute is searched for in the following locations, in this order:
13189 #
13190 # 1. in the user's account information
13191 # 1. in groups that the user is a member of
13192 # 1. the default value of the user attribute
13193 #
13194 # If more than one group has a value defined for a user attribute, the group with the lowest rank wins.
13195 #
13196 # The response will only include user attributes for which values were found. Use `include_unset=true` to include
13197 # empty records for user attributes with no value.
13198 #
13199 # The value of all hidden user attributes will be blank.
13200 #
13201 # GET /users/{user_id}/attribute_values -> Sequence[mdls.UserAttributeWithValue]
13202 def user_attribute_user_values(
13203 self,
13204 # Id of user
13205 user_id: str,
13206 # Requested fields.
13207 fields: Optional[str] = None,
13208 # Specific user attributes to request. Omit or leave blank to request all user attributes.
13209 user_attribute_ids: Optional[mdls.DelimSequence[str]] = None,
13210 # If true, returns all values in the search path instead of just the first value found. Useful for debugging group precedence.
13211 all_values: Optional[bool] = None,
13212 # If true, returns an empty record for each requested attribute that has no user, group, or default value.
13213 include_unset: Optional[bool] = None,
13214 transport_options: Optional[transport.TransportOptions] = None,
13215 ) -> Sequence[mdls.UserAttributeWithValue]:
13216 """Get User Attribute Values"""
13217 user_id = self.encode_path_param(user_id)
13218 response = cast(
13219 Sequence[mdls.UserAttributeWithValue],
13220 self.get(
13221 path=f"/users/{user_id}/attribute_values",
13222 structure=Sequence[mdls.UserAttributeWithValue],
13223 query_params={
13224 "fields": fields,
13225 "user_attribute_ids": user_attribute_ids,
13226 "all_values": all_values,
13227 "include_unset": include_unset,
13228 },
13229 transport_options=transport_options,
13230 ),
13231 )
13232 return response
13233
13234 # ### Store a custom value for a user attribute in a user's account settings.
13235 #
13236 # Per-user user attribute values take precedence over group or default values.
13237 #
13238 # PATCH /users/{user_id}/attribute_values/{user_attribute_id} -> mdls.UserAttributeWithValue
13239 def set_user_attribute_user_value(
13240 self,
13241 # Id of user
13242 user_id: str,
13243 # Id of user attribute
13244 user_attribute_id: str,
13245 body: mdls.WriteUserAttributeWithValue,
13246 transport_options: Optional[transport.TransportOptions] = None,
13247 ) -> mdls.UserAttributeWithValue:
13248 """Set User Attribute User Value"""
13249 user_id = self.encode_path_param(user_id)
13250 user_attribute_id = self.encode_path_param(user_attribute_id)
13251 response = cast(
13252 mdls.UserAttributeWithValue,
13253 self.patch(
13254 path=f"/users/{user_id}/attribute_values/{user_attribute_id}",
13255 structure=mdls.UserAttributeWithValue,
13256 body=body,
13257 transport_options=transport_options,
13258 ),
13259 )
13260 return response
13261
13262 # ### Delete a user attribute value from a user's account settings.
13263 #
13264 # After the user attribute value is deleted from the user's account settings, subsequent requests
13265 # for the user attribute value for this user will draw from the user's groups or the default
13266 # value of the user attribute. See [Get User Attribute Values](#!/User/user_attribute_user_values) for more
13267 # information about how user attribute values are resolved.
13268 #
13269 # DELETE /users/{user_id}/attribute_values/{user_attribute_id} -> None
13270 def delete_user_attribute_user_value(
13271 self,
13272 # Id of user
13273 user_id: str,
13274 # Id of user attribute
13275 user_attribute_id: str,
13276 transport_options: Optional[transport.TransportOptions] = None,
13277 ) -> None:
13278 """Delete User Attribute User Value"""
13279 user_id = self.encode_path_param(user_id)
13280 user_attribute_id = self.encode_path_param(user_attribute_id)
13281 response = cast(
13282 None,
13283 self.delete(
13284 path=f"/users/{user_id}/attribute_values/{user_attribute_id}",
13285 structure=None,
13286 transport_options=transport_options,
13287 ),
13288 )
13289 return response
13290
13291 # ### Send a password reset token.
13292 # This will send a password reset email to the user. If a password reset token does not already exist
13293 # for this user, it will create one and then send it.
13294 # If the user has not yet set up their account, it will send a setup email to the user.
13295 # The URL sent in the email is expressed as the 'password_reset_url' of the user's email/password credential object.
13296 # Password reset URLs will expire in 60 minutes.
13297 # This method can be called with an empty body.
13298 #
13299 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
13300 #
13301 # POST /users/{user_id}/credentials_email/send_password_reset -> mdls.CredentialsEmail
13302 def send_user_credentials_email_password_reset(
13303 self,
13304 # Id of user
13305 user_id: str,
13306 # Requested fields.
13307 fields: Optional[str] = None,
13308 transport_options: Optional[transport.TransportOptions] = None,
13309 ) -> mdls.CredentialsEmail:
13310 """Send Password Reset Token"""
13311 user_id = self.encode_path_param(user_id)
13312 response = cast(
13313 mdls.CredentialsEmail,
13314 self.post(
13315 path=f"/users/{user_id}/credentials_email/send_password_reset",
13316 structure=mdls.CredentialsEmail,
13317 query_params={"fields": fields},
13318 transport_options=transport_options,
13319 ),
13320 )
13321 return response
13322
13323 # ### Change a disabled user's email addresses
13324 #
13325 # Allows the admin to change the email addresses for all the user's
13326 # associated credentials. Will overwrite all associated email addresses with
13327 # the value supplied in the 'email' body param.
13328 # The user's 'is_disabled' status must be true.
13329 # If the user has a credential email, they will receive a verification email and the user will be disabled until they verify the email
13330 #
13331 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
13332 #
13333 # POST /users/{user_id}/update_emails -> mdls.User
13334 def wipeout_user_emails(
13335 self,
13336 # Id of user
13337 user_id: str,
13338 body: mdls.UserEmailOnly,
13339 # Requested fields.
13340 fields: Optional[str] = None,
13341 transport_options: Optional[transport.TransportOptions] = None,
13342 ) -> mdls.User:
13343 """Wipeout User Emails"""
13344 user_id = self.encode_path_param(user_id)
13345 response = cast(
13346 mdls.User,
13347 self.post(
13348 path=f"/users/{user_id}/update_emails",
13349 structure=mdls.User,
13350 query_params={"fields": fields},
13351 body=body,
13352 transport_options=transport_options,
13353 ),
13354 )
13355 return response
13356
13357 # Create an embed user from an external user ID
13358 #
13359 # **NOTE**: Calls to this endpoint require [Embedding](https://cloud.google.com/looker/docs/r/looker-core-feature-embed) to be enabled. Usage of this endpoint is not authorized for Looker Core Standard and Looker Core Enterprise.
13360 #
13361 # POST /users/embed_user -> mdls.UserPublic
13362 def create_embed_user(
13363 self,
13364 body: mdls.CreateEmbedUserRequest,
13365 transport_options: Optional[transport.TransportOptions] = None,
13366 ) -> mdls.UserPublic:
13367 """Create an embed user from an external user ID"""
13368 response = cast(
13369 mdls.UserPublic,
13370 self.post(
13371 path="/users/embed_user",
13372 structure=mdls.UserPublic,
13373 body=body,
13374 transport_options=transport_options,
13375 ),
13376 )
13377 return response
13378
13379 # ### Create a service account with the specified information. This action is restricted to Looker admins.
13380 #
13381 # Calls to this endpoint may only be available for [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
13382 #
13383 # POST /users/service_accounts -> mdls.ServiceAccount
13384 def create_service_account(
13385 self,
13386 body: mdls.WriteServiceAccount,
13387 # Requested fields.
13388 fields: Optional[str] = None,
13389 transport_options: Optional[transport.TransportOptions] = None,
13390 ) -> mdls.ServiceAccount:
13391 """Create Service Account"""
13392 response = cast(
13393 mdls.ServiceAccount,
13394 self.post(
13395 path="/users/service_accounts",
13396 structure=mdls.ServiceAccount,
13397 query_params={"fields": fields},
13398 body=body,
13399 transport_options=transport_options,
13400 ),
13401 )
13402 return response
13403
13404 # ### Update information for a specific service account. This action is restricted to Looker admins.
13405 #
13406 # 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.
13407 #
13408 # Calls to this endpoint may only be available for [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
13409 #
13410 # PATCH /users/service_accounts/{user_id} -> mdls.ServiceAccount
13411 def update_service_account(
13412 self,
13413 # Id of service account
13414 user_id: str,
13415 body: mdls.WriteServiceAccount,
13416 # Requested fields.
13417 fields: Optional[str] = None,
13418 transport_options: Optional[transport.TransportOptions] = None,
13419 ) -> mdls.ServiceAccount:
13420 """Update Service Account"""
13421 user_id = self.encode_path_param(user_id)
13422 response = cast(
13423 mdls.ServiceAccount,
13424 self.patch(
13425 path=f"/users/service_accounts/{user_id}",
13426 structure=mdls.ServiceAccount,
13427 query_params={"fields": fields},
13428 body=body,
13429 transport_options=transport_options,
13430 ),
13431 )
13432 return response
13433
13434 # endregion
13435
13436 # region UserAttribute: Manage User Attributes
13437
13438 # ### Get information about all user attributes.
13439 #
13440 # GET /user_attributes -> Sequence[mdls.UserAttribute]
13441 def all_user_attributes(
13442 self,
13443 # Requested fields.
13444 fields: Optional[str] = None,
13445 # Fields to order the results by. Sortable fields include: name, label
13446 sorts: Optional[str] = None,
13447 transport_options: Optional[transport.TransportOptions] = None,
13448 ) -> Sequence[mdls.UserAttribute]:
13449 """Get All User Attributes"""
13450 response = cast(
13451 Sequence[mdls.UserAttribute],
13452 self.get(
13453 path="/user_attributes",
13454 structure=Sequence[mdls.UserAttribute],
13455 query_params={"fields": fields, "sorts": sorts},
13456 transport_options=transport_options,
13457 ),
13458 )
13459 return response
13460
13461 # ### Create a new user attribute
13462 #
13463 # Permission information for a user attribute is conveyed through the `can` and `user_can_edit` fields.
13464 # The `user_can_edit` field indicates whether an attribute is user-editable _anywhere_ in the application.
13465 # The `can` field gives more granular access information, with the `set_value` child field indicating whether
13466 # an attribute's value can be set by [Setting the User Attribute User Value](#!/User/set_user_attribute_user_value).
13467 #
13468 # Note: `name` and `label` fields must be unique across all user attributes in the Looker instance.
13469 # Attempting to create a new user attribute with a name or label that duplicates an existing
13470 # user attribute will fail with a 422 error.
13471 #
13472 # POST /user_attributes -> mdls.UserAttribute
13473 def create_user_attribute(
13474 self,
13475 body: mdls.WriteUserAttribute,
13476 # Requested fields.
13477 fields: Optional[str] = None,
13478 transport_options: Optional[transport.TransportOptions] = None,
13479 ) -> mdls.UserAttribute:
13480 """Create User Attribute"""
13481 response = cast(
13482 mdls.UserAttribute,
13483 self.post(
13484 path="/user_attributes",
13485 structure=mdls.UserAttribute,
13486 query_params={"fields": fields},
13487 body=body,
13488 transport_options=transport_options,
13489 ),
13490 )
13491 return response
13492
13493 # ### Get information about a user attribute.
13494 #
13495 # GET /user_attributes/{user_attribute_id} -> mdls.UserAttribute
13496 def user_attribute(
13497 self,
13498 # Id of user attribute
13499 user_attribute_id: str,
13500 # Requested fields.
13501 fields: Optional[str] = None,
13502 transport_options: Optional[transport.TransportOptions] = None,
13503 ) -> mdls.UserAttribute:
13504 """Get User Attribute"""
13505 user_attribute_id = self.encode_path_param(user_attribute_id)
13506 response = cast(
13507 mdls.UserAttribute,
13508 self.get(
13509 path=f"/user_attributes/{user_attribute_id}",
13510 structure=mdls.UserAttribute,
13511 query_params={"fields": fields},
13512 transport_options=transport_options,
13513 ),
13514 )
13515 return response
13516
13517 # ### Update a user attribute definition.
13518 #
13519 # PATCH /user_attributes/{user_attribute_id} -> mdls.UserAttribute
13520 def update_user_attribute(
13521 self,
13522 # Id of user attribute
13523 user_attribute_id: str,
13524 body: mdls.WriteUserAttribute,
13525 # Requested fields.
13526 fields: Optional[str] = None,
13527 transport_options: Optional[transport.TransportOptions] = None,
13528 ) -> mdls.UserAttribute:
13529 """Update User Attribute"""
13530 user_attribute_id = self.encode_path_param(user_attribute_id)
13531 response = cast(
13532 mdls.UserAttribute,
13533 self.patch(
13534 path=f"/user_attributes/{user_attribute_id}",
13535 structure=mdls.UserAttribute,
13536 query_params={"fields": fields},
13537 body=body,
13538 transport_options=transport_options,
13539 ),
13540 )
13541 return response
13542
13543 # ### Delete a user attribute (admin only).
13544 #
13545 # DELETE /user_attributes/{user_attribute_id} -> str
13546 def delete_user_attribute(
13547 self,
13548 # Id of user attribute
13549 user_attribute_id: str,
13550 transport_options: Optional[transport.TransportOptions] = None,
13551 ) -> str:
13552 """Delete User Attribute"""
13553 user_attribute_id = self.encode_path_param(user_attribute_id)
13554 response = cast(
13555 str,
13556 self.delete(
13557 path=f"/user_attributes/{user_attribute_id}",
13558 structure=str,
13559 transport_options=transport_options,
13560 ),
13561 )
13562 return response
13563
13564 # ### Returns all values of a user attribute defined by user groups, in precedence order.
13565 #
13566 # A user may be a member of multiple groups which define different values for a given user attribute.
13567 # The order of group-values in the response determines precedence for selecting which group-value applies
13568 # to a given user. For more information, see [Set User Attribute Group Values](#!/UserAttribute/set_user_attribute_group_values).
13569 #
13570 # Results will only include groups that the caller's user account has permission to see.
13571 #
13572 # GET /user_attributes/{user_attribute_id}/group_values -> Sequence[mdls.UserAttributeGroupValue]
13573 def all_user_attribute_group_values(
13574 self,
13575 # Id of user attribute
13576 user_attribute_id: str,
13577 # Requested fields.
13578 fields: Optional[str] = None,
13579 transport_options: Optional[transport.TransportOptions] = None,
13580 ) -> Sequence[mdls.UserAttributeGroupValue]:
13581 """Get User Attribute Group Values"""
13582 user_attribute_id = self.encode_path_param(user_attribute_id)
13583 response = cast(
13584 Sequence[mdls.UserAttributeGroupValue],
13585 self.get(
13586 path=f"/user_attributes/{user_attribute_id}/group_values",
13587 structure=Sequence[mdls.UserAttributeGroupValue],
13588 query_params={"fields": fields},
13589 transport_options=transport_options,
13590 ),
13591 )
13592 return response
13593
13594 # ### Define values for a user attribute across a set of groups, in priority order.
13595 #
13596 # This function defines all values for a user attribute defined by user groups. This is a global setting, potentially affecting
13597 # all users in the system. This function replaces any existing group value definitions for the indicated user attribute.
13598 #
13599 # The value of a user attribute for a given user is determined by searching the following locations, in this order:
13600 #
13601 # 1. the user's account settings
13602 # 2. the groups that the user is a member of
13603 # 3. the default value of the user attribute, if any
13604 #
13605 # 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
13606 # determines which group takes priority for that user. Lowest array index wins.
13607 #
13608 # An alternate method to indicate the selection precedence of group-values is to assign numbers to the 'rank' property of each
13609 # group-value object in the array. Lowest 'rank' value wins. If you use this technique, you must assign a
13610 # rank value to every group-value object in the array.
13611 #
13612 # To set a user attribute value for a single user, see [Set User Attribute User Value](#!/User/set_user_attribute_user_value).
13613 # To set a user attribute value for all members of a group, see [Set User Attribute Group Value](#!/Group/update_user_attribute_group_value).
13614 #
13615 # POST /user_attributes/{user_attribute_id}/group_values -> Sequence[mdls.UserAttributeGroupValue]
13616 def set_user_attribute_group_values(
13617 self,
13618 # Id of user attribute
13619 user_attribute_id: str,
13620 body: Sequence[mdls.UserAttributeGroupValue],
13621 transport_options: Optional[transport.TransportOptions] = None,
13622 ) -> Sequence[mdls.UserAttributeGroupValue]:
13623 """Set User Attribute Group Values"""
13624 user_attribute_id = self.encode_path_param(user_attribute_id)
13625 response = cast(
13626 Sequence[mdls.UserAttributeGroupValue],
13627 self.post(
13628 path=f"/user_attributes/{user_attribute_id}/group_values",
13629 structure=Sequence[mdls.UserAttributeGroupValue],
13630 body=body,
13631 transport_options=transport_options,
13632 ),
13633 )
13634 return response
13635
13636 # endregion
13637
13638 # region Workspace: Manage Workspaces
13639
13640 # ### Get All Workspaces
13641 #
13642 # Returns all workspaces available to the calling user.
13643 #
13644 # GET /workspaces -> Sequence[mdls.Workspace]
13645 def all_workspaces(
13646 self,
13647 transport_options: Optional[transport.TransportOptions] = None,
13648 ) -> Sequence[mdls.Workspace]:
13649 """Get All Workspaces"""
13650 response = cast(
13651 Sequence[mdls.Workspace],
13652 self.get(
13653 path="/workspaces",
13654 structure=Sequence[mdls.Workspace],
13655 transport_options=transport_options,
13656 ),
13657 )
13658 return response
13659
13660 # ### Get A Workspace
13661 #
13662 # Returns information about a workspace such as the git status and selected branches
13663 # of all projects available to the caller's user account.
13664 #
13665 # A workspace defines which versions of project files will be used to evaluate expressions
13666 # and operations that use model definitions - operations such as running queries or rendering dashboards.
13667 # Each project has its own git repository, and each project in a workspace may be configured to reference
13668 # particular branch or revision within their respective repositories.
13669 #
13670 # There are two predefined workspaces available: "production" and "dev".
13671 #
13672 # The production workspace is shared across all Looker users. Models in the production workspace are read-only.
13673 # Changing files in production is accomplished by modifying files in a git branch and using Pull Requests
13674 # to merge the changes from the dev branch into the production branch, and then telling
13675 # Looker to sync with production.
13676 #
13677 # The dev workspace is local to each Looker user. Changes made to project/model files in the dev workspace only affect
13678 # that user, and only when the dev workspace is selected as the active workspace for the API session.
13679 # (See set_session_workspace()).
13680 #
13681 # The dev workspace is NOT unique to an API session. Two applications accessing the Looker API using
13682 # the same user account will see the same files in the dev workspace. To avoid collisions between
13683 # API clients it's best to have each client login with API credentials for a different user account.
13684 #
13685 # Changes made to files in a dev workspace are persistent across API sessions. It's a good
13686 # idea to commit any changes you've made to the git repository, but not strictly required. Your modified files
13687 # reside in a special user-specific directory on the Looker server and will still be there when you login in again
13688 # later and use update_session(workspace_id: "dev") to select the dev workspace for the new API session.
13689 #
13690 # GET /workspaces/{workspace_id} -> mdls.Workspace
13691 def workspace(
13692 self,
13693 # Id of the workspace
13694 workspace_id: str,
13695 transport_options: Optional[transport.TransportOptions] = None,
13696 ) -> mdls.Workspace:
13697 """Get Workspace"""
13698 workspace_id = self.encode_path_param(workspace_id)
13699 response = cast(
13700 mdls.Workspace,
13701 self.get(
13702 path=f"/workspaces/{workspace_id}",
13703 structure=mdls.Workspace,
13704 transport_options=transport_options,
13705 ),
13706 )
13707 return response
13708
13709 # endregion
13710
13711
13712LookerSDK = Looker40SDK