1# MIT License
2#
3# Copyright (c) 2023 Looker Data Sciences, Inc.
4#
5# Permission is hereby granted, free of charge, to any person obtaining a copy
6# of this software and associated documentation files (the "Software"), to deal
7# in the Software without restriction, including without limitation the rights
8# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9# copies of the Software, and to permit persons to whom the Software is
10# furnished to do so, subject to the following conditions:
11#
12# The above copyright notice and this permission notice shall be included in all
13# copies or substantial portions of the Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21# SOFTWARE.
22#
23
24# 471 API methods
25
26
27# NOTE: Do not edit this file generated by Looker SDK Codegen for API 4.0
28import datetime
29from typing import Any, MutableMapping, Optional, Sequence, Union, cast
30import warnings
31
32from . import models as mdls
33from looker_sdk.rtl import api_methods
34from looker_sdk.rtl import transport
35
36
37class Looker40SDK(api_methods.APIMethods):
38
39 # region Alert: Alert
40
41 # Follow an alert.
42 #
43 # POST /alerts/{alert_id}/follow -> None
44 def follow_alert(
45 self,
46 # ID of an alert
47 alert_id: str,
48 transport_options: Optional[transport.TransportOptions] = None,
49 ) -> None:
50 """Follow an alert"""
51 alert_id = self.encode_path_param(alert_id)
52 response = cast(
53 None,
54 self.post(
55 path=f"/alerts/{alert_id}/follow",
56 structure=None,
57 transport_options=transport_options,
58 ),
59 )
60 return response
61
62 # Unfollow an alert.
63 #
64 # DELETE /alerts/{alert_id}/follow -> None
65 def unfollow_alert(
66 self,
67 # ID of an alert
68 alert_id: str,
69 transport_options: Optional[transport.TransportOptions] = None,
70 ) -> None:
71 """Unfollow an alert"""
72 alert_id = self.encode_path_param(alert_id)
73 response = cast(
74 None,
75 self.delete(
76 path=f"/alerts/{alert_id}/follow",
77 structure=None,
78 transport_options=transport_options,
79 ),
80 )
81 return response
82
83 # ### Search Alerts
84 #
85 # GET /alerts/search -> Sequence[mdls.Alert]
86 def search_alerts(
87 self,
88 # (Optional) Number of results to return (used with `offset`).
89 limit: Optional[int] = None,
90 # (Optional) Number of results to skip before returning any (used with `limit`).
91 offset: Optional[int] = None,
92 # (Optional) Dimension by which to order the results(`dashboard` | `owner`)
93 group_by: Optional[str] = None,
94 # (Optional) Requested fields.
95 fields: Optional[str] = None,
96 # (Optional) Filter on returning only enabled or disabled alerts.
97 disabled: Optional[bool] = None,
98 # (Optional) Filter on alert frequency, such as: monthly, weekly, daily, hourly, minutes
99 frequency: Optional[str] = None,
100 # (Optional) Filter on whether the alert has met its condition when it last executed
101 condition_met: Optional[bool] = None,
102 # (Optional) Filter on the start range of the last time the alerts were run. Example: 2021-01-01T01:01:01-08:00.
103 last_run_start: Optional[str] = None,
104 # (Optional) Filter on the start range of the last time the alerts were run. Example: 2021-01-01T01:01:01-08:00.
105 last_run_end: Optional[str] = None,
106 # (Admin only) (Optional) Filter for all owners.
107 all_owners: Optional[bool] = None,
108 transport_options: Optional[transport.TransportOptions] = None,
109 ) -> Sequence[mdls.Alert]:
110 """Search Alerts"""
111 response = cast(
112 Sequence[mdls.Alert],
113 self.get(
114 path="/alerts/search",
115 structure=Sequence[mdls.Alert],
116 query_params={
117 "limit": limit,
118 "offset": offset,
119 "group_by": group_by,
120 "fields": fields,
121 "disabled": disabled,
122 "frequency": frequency,
123 "condition_met": condition_met,
124 "last_run_start": last_run_start,
125 "last_run_end": last_run_end,
126 "all_owners": all_owners,
127 },
128 transport_options=transport_options,
129 ),
130 )
131 return response
132
133 # ### Get an alert by a given alert ID
134 #
135 # GET /alerts/{alert_id} -> mdls.Alert
136 def get_alert(
137 self,
138 # ID of an alert
139 alert_id: str,
140 transport_options: Optional[transport.TransportOptions] = None,
141 ) -> mdls.Alert:
142 """Get an alert"""
143 alert_id = self.encode_path_param(alert_id)
144 response = cast(
145 mdls.Alert,
146 self.get(
147 path=f"/alerts/{alert_id}",
148 structure=mdls.Alert,
149 transport_options=transport_options,
150 ),
151 )
152 return response
153
154 # ### Update an alert
155 # # Required fields: `owner_id`, `field`, `destinations`, `comparison_type`, `threshold`, `cron`
156 # #
157 #
158 # PUT /alerts/{alert_id} -> mdls.Alert
159 def update_alert(
160 self,
161 # ID of an alert
162 alert_id: str,
163 body: mdls.WriteAlert,
164 transport_options: Optional[transport.TransportOptions] = None,
165 ) -> mdls.Alert:
166 """Update an alert"""
167 alert_id = self.encode_path_param(alert_id)
168 response = cast(
169 mdls.Alert,
170 self.put(
171 path=f"/alerts/{alert_id}",
172 structure=mdls.Alert,
173 body=body,
174 transport_options=transport_options,
175 ),
176 )
177 return response
178
179 # ### Update select alert fields
180 # # Available fields: `owner_id`, `is_disabled`, `disabled_reason`, `is_public`, `threshold`
181 # #
182 #
183 # PATCH /alerts/{alert_id} -> mdls.Alert
184 def update_alert_field(
185 self,
186 # ID of an alert
187 alert_id: str,
188 body: mdls.AlertPatch,
189 transport_options: Optional[transport.TransportOptions] = None,
190 ) -> mdls.Alert:
191 """Update select fields on an alert"""
192 alert_id = self.encode_path_param(alert_id)
193 response = cast(
194 mdls.Alert,
195 self.patch(
196 path=f"/alerts/{alert_id}",
197 structure=mdls.Alert,
198 body=body,
199 transport_options=transport_options,
200 ),
201 )
202 return response
203
204 # ### Delete an alert by a given alert ID
205 #
206 # DELETE /alerts/{alert_id} -> None
207 def delete_alert(
208 self,
209 # ID of an alert
210 alert_id: str,
211 transport_options: Optional[transport.TransportOptions] = None,
212 ) -> None:
213 """Delete an alert"""
214 alert_id = self.encode_path_param(alert_id)
215 response = cast(
216 None,
217 self.delete(
218 path=f"/alerts/{alert_id}",
219 structure=None,
220 transport_options=transport_options,
221 ),
222 )
223 return response
224
225 # ### Create a new alert and return details of the newly created object
226 #
227 # Required fields: `field`, `destinations`, `comparison_type`, `threshold`, `cron`
228 #
229 # Example Request:
230 # Run alert on dashboard element '103' at 5am every day. Send an email to 'test@test.com' if inventory for Los Angeles (using dashboard filter `Warehouse Name`) is lower than 1,000
231 # ```
232 # {
233 # "cron": "0 5 * * *",
234 # "custom_title": "Alert when LA inventory is low",
235 # "dashboard_element_id": 103,
236 # "applied_dashboard_filters": [
237 # {
238 # "filter_title": "Warehouse Name",
239 # "field_name": "distribution_centers.name",
240 # "filter_value": "Los Angeles CA",
241 # "filter_description": "is Los Angeles CA"
242 # }
243 # ],
244 # "comparison_type": "LESS_THAN",
245 # "destinations": [
246 # {
247 # "destination_type": "EMAIL",
248 # "email_address": "test@test.com"
249 # }
250 # ],
251 # "field": {
252 # "title": "Number on Hand",
253 # "name": "inventory_items.number_on_hand"
254 # },
255 # "is_disabled": false,
256 # "is_public": true,
257 # "threshold": 1000
258 # }
259 # ```
260 #
261 # POST /alerts -> mdls.Alert
262 def create_alert(
263 self,
264 body: mdls.WriteAlert,
265 transport_options: Optional[transport.TransportOptions] = None,
266 ) -> mdls.Alert:
267 """Create an alert"""
268 response = cast(
269 mdls.Alert,
270 self.post(
271 path="/alerts",
272 structure=mdls.Alert,
273 body=body,
274 transport_options=transport_options,
275 ),
276 )
277 return response
278
279 # ### Enqueue an Alert by ID
280 #
281 # POST /alerts/{alert_id}/enqueue -> None
282 def enqueue_alert(
283 self,
284 # ID of an alert
285 alert_id: str,
286 # Whether to enqueue an alert again if its already running.
287 force: Optional[bool] = None,
288 transport_options: Optional[transport.TransportOptions] = None,
289 ) -> None:
290 """Enqueue an alert"""
291 alert_id = self.encode_path_param(alert_id)
292 response = cast(
293 None,
294 self.post(
295 path=f"/alerts/{alert_id}/enqueue",
296 structure=None,
297 query_params={"force": force},
298 transport_options=transport_options,
299 ),
300 )
301 return response
302
303 # # Alert Notifications.
304 # The endpoint returns all the alert notifications received by the user on email in the past 7 days. It also returns whether the notifications have been read by the user.
305 #
306 # GET /alert_notifications -> Sequence[mdls.AlertNotifications]
307 def alert_notifications(
308 self,
309 # (Optional) Number of results to return (used with `offset`).
310 limit: Optional[int] = None,
311 # (Optional) Number of results to skip before returning any (used with `limit`).
312 offset: Optional[int] = None,
313 transport_options: Optional[transport.TransportOptions] = None,
314 ) -> Sequence[mdls.AlertNotifications]:
315 """Alert Notifications"""
316 response = cast(
317 Sequence[mdls.AlertNotifications],
318 self.get(
319 path="/alert_notifications",
320 structure=Sequence[mdls.AlertNotifications],
321 query_params={"limit": limit, "offset": offset},
322 transport_options=transport_options,
323 ),
324 )
325 return response
326
327 # # Reads a Notification
328 # The endpoint marks a given alert notification as read by the user, in case it wasn't already read. The AlertNotification model is updated for this purpose. It returns the notification as a response.
329 #
330 # PATCH /alert_notifications/{alert_notification_id} -> mdls.AlertNotifications
331 def read_alert_notification(
332 self,
333 # ID of a notification
334 alert_notification_id: str,
335 transport_options: Optional[transport.TransportOptions] = None,
336 ) -> mdls.AlertNotifications:
337 """Read a Notification"""
338 alert_notification_id = self.encode_path_param(alert_notification_id)
339 response = cast(
340 mdls.AlertNotifications,
341 self.patch(
342 path=f"/alert_notifications/{alert_notification_id}",
343 structure=mdls.AlertNotifications,
344 transport_options=transport_options,
345 ),
346 )
347 return response
348
349 # endregion
350
351 # region ApiAuth: API Authentication
352
353 # ### Present client credentials to obtain an authorization token
354 #
355 # Looker API implements the OAuth2 [Resource Owner Password Credentials Grant](https://cloud.google.com/looker/docs/r/api/outh2_resource_owner_pc) pattern.
356 # The client credentials required for this login must be obtained by creating an API key on a user account
357 # in the Looker Admin console. The API key consists of a public `client_id` and a private `client_secret`.
358 #
359 # The access token returned by `login` must be used in the HTTP Authorization header of subsequent
360 # API requests, like this:
361 # ```
362 # Authorization: token 4QDkCyCtZzYgj4C2p2cj3csJH7zqS5RzKs2kTnG4
363 # ```
364 # Replace "4QDkCy..." with the `access_token` value returned by `login`.
365 # The word `token` is a string literal and must be included exactly as shown.
366 #
367 # This function can accept `client_id` and `client_secret` parameters as URL query params or as www-form-urlencoded params in the body of the HTTP request. Since there is a small risk that URL parameters may be visible to intermediate nodes on the network route (proxies, routers, etc), passing credentials in the body of the request is considered more secure than URL params.
368 #
369 # Example of passing credentials in the HTTP request body:
370 # ````
371 # POST HTTP /login
372 # Content-Type: application/x-www-form-urlencoded
373 #
374 # client_id=CGc9B7v7J48dQSJvxxx&client_secret=nNVS9cSS3xNpSC9JdsBvvvvv
375 # ````
376 #
377 # ### Best Practice:
378 # Always pass credentials in body params. Pass credentials in URL query params **only** when you cannot pass body params due to application, tool, or other limitations.
379 #
380 # For more information and detailed examples of Looker API authorization, see [How to Authenticate to Looker API](https://github.com/looker/looker-sdk-ruby/blob/master/authentication.md).
381 #
382 # POST /login -> mdls.AccessToken
383 def login(
384 self,
385 # client_id part of API Key.
386 client_id: Optional[str] = None,
387 # client_secret part of API Key.
388 client_secret: Optional[str] = None,
389 transport_options: Optional[transport.TransportOptions] = None,
390 ) -> mdls.AccessToken:
391 """Login"""
392 response = cast(
393 mdls.AccessToken,
394 self.post(
395 path="/login",
396 structure=mdls.AccessToken,
397 query_params={"client_id": client_id, "client_secret": client_secret},
398 transport_options=transport_options,
399 ),
400 )
401 return response
402
403 # ### Create an access token that runs as a given user.
404 #
405 # This can only be called by an authenticated admin user. It allows that admin to generate a new
406 # authentication token for the user with the given user id. That token can then be used for subsequent
407 # API calls - which are then performed *as* that target user.
408 #
409 # The target user does *not* need to have a pre-existing API client_id/client_secret pair. And, no such
410 # credentials are created by this call.
411 #
412 # This allows for building systems where api user authentication for an arbitrary number of users is done
413 # outside of Looker and funneled through a single 'service account' with admin permissions. Note that a
414 # new access token is generated on each call. If target users are going to be making numerous API
415 # calls in a short period then it is wise to cache this authentication token rather than call this before
416 # each of those API calls.
417 #
418 # See 'login' for more detail on the access token and how to use it.
419 #
420 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
421 #
422 # POST /login/{user_id} -> mdls.AccessToken
423 def login_user(
424 self,
425 # Id of user.
426 user_id: str,
427 # When true (default), API calls using the returned access_token are attributed to the admin user who created the access_token. When false, API activity is attributed to the user the access_token runs as. False requires a looker license.
428 associative: Optional[bool] = None,
429 transport_options: Optional[transport.TransportOptions] = None,
430 ) -> mdls.AccessToken:
431 """Login user"""
432 user_id = self.encode_path_param(user_id)
433 warnings.warn(
434 "login_user behavior changed significantly in 21.4.0. See https://git.io/JOtH1"
435 )
436 response = cast(
437 mdls.AccessToken,
438 self.post(
439 path=f"/login/{user_id}",
440 structure=mdls.AccessToken,
441 query_params={"associative": associative},
442 transport_options=transport_options,
443 ),
444 )
445 return response
446
447 # ### Logout of the API and invalidate the current access token.
448 #
449 # DELETE /logout -> str
450 def logout(
451 self,
452 transport_options: Optional[transport.TransportOptions] = None,
453 ) -> str:
454 """Logout"""
455 response = cast(
456 str,
457 self.delete(
458 path="/logout", structure=str, transport_options=transport_options
459 ),
460 )
461 return response
462
463 # endregion
464
465 # region Artifact: Artifact Storage
466
467 # Get the maximum configured size of the entire artifact store, and the currently used storage in bytes.
468 #
469 # **Note**: The artifact storage API can only be used by Looker-built extensions.
470 #
471 # GET /artifact/usage -> mdls.ArtifactUsage
472 def artifact_usage(
473 self,
474 # Comma-delimited names of fields to return in responses. Omit for all fields
475 fields: Optional[str] = None,
476 transport_options: Optional[transport.TransportOptions] = None,
477 ) -> mdls.ArtifactUsage:
478 """Artifact store usage"""
479 response = cast(
480 mdls.ArtifactUsage,
481 self.get(
482 path="/artifact/usage",
483 structure=mdls.ArtifactUsage,
484 query_params={"fields": fields},
485 transport_options=transport_options,
486 ),
487 )
488 return response
489
490 # Get all artifact namespaces and the count of artifacts in each namespace
491 #
492 # **Note**: The artifact storage API can only be used by Looker-built extensions.
493 #
494 # GET /artifact/namespaces -> Sequence[mdls.ArtifactNamespace]
495 def artifact_namespaces(
496 self,
497 # Comma-delimited names of fields to return in responses. Omit for all fields
498 fields: Optional[str] = None,
499 # Number of results to return. (used with offset)
500 limit: Optional[int] = None,
501 # Number of results to skip before returning any. (used with limit)
502 offset: Optional[int] = None,
503 transport_options: Optional[transport.TransportOptions] = None,
504 ) -> Sequence[mdls.ArtifactNamespace]:
505 """Get namespaces and counts"""
506 response = cast(
507 Sequence[mdls.ArtifactNamespace],
508 self.get(
509 path="/artifact/namespaces",
510 structure=Sequence[mdls.ArtifactNamespace],
511 query_params={"fields": fields, "limit": limit, "offset": offset},
512 transport_options=transport_options,
513 ),
514 )
515 return response
516
517 # ### Return the value of an artifact
518 #
519 # The MIME type for the API response is set to the `content_type` of the value
520 #
521 # **Note**: The artifact storage API can only be used by Looker-built extensions.
522 #
523 # GET /artifact/{namespace}/value -> str
524 def artifact_value(
525 self,
526 # Artifact storage namespace
527 namespace: str,
528 # Artifact storage key. Namespace + Key must be unique
529 key: Optional[str] = None,
530 transport_options: Optional[transport.TransportOptions] = None,
531 ) -> str:
532 """Get an artifact value"""
533 namespace = self.encode_path_param(namespace)
534 response = cast(
535 str,
536 self.get(
537 path=f"/artifact/{namespace}/value",
538 structure=str,
539 query_params={"key": key},
540 transport_options=transport_options,
541 ),
542 )
543 return response
544
545 # Remove *all* artifacts from a namespace. Purged artifacts are permanently deleted
546 #
547 # **Note**: The artifact storage API can only be used by Looker-built extensions.
548 #
549 # DELETE /artifact/{namespace}/purge -> None
550 def purge_artifacts(
551 self,
552 # Artifact storage namespace
553 namespace: str,
554 transport_options: Optional[transport.TransportOptions] = None,
555 ) -> None:
556 """Purge artifacts"""
557 namespace = self.encode_path_param(namespace)
558 response = cast(
559 None,
560 self.delete(
561 path=f"/artifact/{namespace}/purge",
562 structure=None,
563 transport_options=transport_options,
564 ),
565 )
566 return response
567
568 # ### Search all key/value pairs in a namespace for matching criteria.
569 #
570 # Returns an array of artifacts matching the specified search criteria.
571 #
572 # Key search patterns use case-insensitive matching and can contain `%` and `_` as SQL LIKE pattern match wildcard expressions.
573 #
574 # The parameters `min_size` and `max_size` can be used individually or together.
575 #
576 # - `min_size` finds artifacts with sizes greater than or equal to its value
577 # - `max_size` finds artifacts with sizes less than or equal to its value
578 # - using both parameters restricts the minimum and maximum size range for artifacts
579 #
580 # **NOTE**: Artifacts are always returned in alphanumeric order by key.
581 #
582 # Get a **single artifact** by namespace and key with [`artifact`](#!/Artifact/artifact)
583 #
584 # **Note**: The artifact storage API can only be used by Looker-built extensions.
585 #
586 # GET /artifact/{namespace}/search -> Sequence[mdls.Artifact]
587 def search_artifacts(
588 self,
589 # Artifact storage namespace
590 namespace: str,
591 # Comma-delimited names of fields to return in responses. Omit for all fields
592 fields: Optional[str] = None,
593 # Key pattern to match
594 key: Optional[str] = None,
595 # Ids of users who created or updated the artifact (comma-delimited list)
596 user_ids: Optional[str] = None,
597 # Minimum storage size of the artifact
598 min_size: Optional[int] = None,
599 # Maximum storage size of the artifact
600 max_size: Optional[int] = None,
601 # Number of results to return. (used with offset)
602 limit: Optional[int] = None,
603 # Number of results to skip before returning any. (used with limit)
604 offset: Optional[int] = None,
605 # Return the full count of results in the X-Total-Count response header. (Slight performance hit.)
606 tally: Optional[bool] = None,
607 transport_options: Optional[transport.TransportOptions] = None,
608 ) -> Sequence[mdls.Artifact]:
609 """Search artifacts"""
610 namespace = self.encode_path_param(namespace)
611 response = cast(
612 Sequence[mdls.Artifact],
613 self.get(
614 path=f"/artifact/{namespace}/search",
615 structure=Sequence[mdls.Artifact],
616 query_params={
617 "fields": fields,
618 "key": key,
619 "user_ids": user_ids,
620 "min_size": min_size,
621 "max_size": max_size,
622 "limit": limit,
623 "offset": offset,
624 "tally": tally,
625 },
626 transport_options=transport_options,
627 ),
628 )
629 return response
630
631 # ### Get one or more artifacts
632 #
633 # Returns an array of artifacts matching the specified key value(s).
634 #
635 # **Note**: The artifact storage API can only be used by Looker-built extensions.
636 #
637 # GET /artifact/{namespace} -> Sequence[mdls.Artifact]
638 def artifact(
639 self,
640 # Artifact storage namespace
641 namespace: str,
642 # Comma-delimited list of keys. Wildcards not allowed.
643 key: str,
644 # Comma-delimited names of fields to return in responses. Omit for all fields
645 fields: Optional[str] = None,
646 # Number of results to return. (used with offset)
647 limit: Optional[int] = None,
648 # Number of results to skip before returning any. (used with limit)
649 offset: Optional[int] = None,
650 # Return the full count of results in the X-Total-Count response header. (Slight performance hit.)
651 tally: Optional[bool] = None,
652 transport_options: Optional[transport.TransportOptions] = None,
653 ) -> Sequence[mdls.Artifact]:
654 """Get one or more artifacts"""
655 namespace = self.encode_path_param(namespace)
656 response = cast(
657 Sequence[mdls.Artifact],
658 self.get(
659 path=f"/artifact/{namespace}",
660 structure=Sequence[mdls.Artifact],
661 query_params={
662 "key": key,
663 "fields": fields,
664 "limit": limit,
665 "offset": offset,
666 "tally": tally,
667 },
668 transport_options=transport_options,
669 ),
670 )
671 return response
672
673 # ### Delete one or more artifacts
674 #
675 # To avoid rate limiting on deletion requests, multiple artifacts can be deleted at the same time by using a comma-delimited list of artifact keys.
676 #
677 # **Note**: The artifact storage API can only be used by Looker-built extensions.
678 #
679 # DELETE /artifact/{namespace} -> None
680 def delete_artifact(
681 self,
682 # Artifact storage namespace
683 namespace: str,
684 # Comma-delimited list of keys. Wildcards not allowed.
685 key: str,
686 transport_options: Optional[transport.TransportOptions] = None,
687 ) -> None:
688 """Delete one or more artifacts"""
689 namespace = self.encode_path_param(namespace)
690 response = cast(
691 None,
692 self.delete(
693 path=f"/artifact/{namespace}",
694 structure=None,
695 query_params={"key": key},
696 transport_options=transport_options,
697 ),
698 )
699 return response
700
701 # ### Create or update one or more artifacts
702 #
703 # Only `key` and `value` are required to _create_ an artifact.
704 # To _update_ an artifact, its current `version` value must be provided.
705 #
706 # In the following example `body` payload, `one` and `two` are existing artifacts, and `three` is new:
707 #
708 # ```json
709 # [
710 # { "key": "one", "value": "[ \"updating\", \"existing\", \"one\" ]", "version": 10, "content_type": "application/json" },
711 # { "key": "two", "value": "updating existing two", "version": 20 },
712 # { "key": "three", "value": "creating new three" },
713 # ]
714 # ```
715 #
716 # Notes for this body:
717 #
718 # - The `value` for `key` **one** is a JSON payload, so a `content_type` override is needed. This override must be done **every** time a JSON value is set.
719 # - The `version` values for **one** and **two** mean they have been saved 10 and 20 times, respectively.
720 # - If `version` is **not** provided for an existing artifact, the entire request will be refused and a `Bad Request` response will be sent.
721 # - If `version` is provided for an artifact, it is only used for helping to prevent inadvertent data overwrites. It cannot be used to **set** the version of an artifact. The Looker server controls `version`.
722 # - We suggest encoding binary values as base64. Because the MIME content type for base64 is detected as plain text, also provide `content_type` to correctly indicate the value's type for retrieval and client-side processing.
723 #
724 # Because artifacts are stored encrypted, the same value can be written multiple times (provided the correct `version` number is used). Looker does not examine any values stored in the artifact store, and only decrypts when sending artifacts back in an API response.
725 #
726 # **Note**: The artifact storage API can only be used by Looker-built extensions.
727 #
728 # PUT /artifacts/{namespace} -> Sequence[mdls.Artifact]
729 def update_artifacts(
730 self,
731 # Artifact storage namespace
732 namespace: str,
733 body: Sequence[mdls.UpdateArtifact],
734 # Comma-delimited names of fields to return in responses. Omit for all fields
735 fields: Optional[str] = None,
736 transport_options: Optional[transport.TransportOptions] = None,
737 ) -> Sequence[mdls.Artifact]:
738 """Create or update artifacts"""
739 namespace = self.encode_path_param(namespace)
740 response = cast(
741 Sequence[mdls.Artifact],
742 self.put(
743 path=f"/artifacts/{namespace}",
744 structure=Sequence[mdls.Artifact],
745 query_params={"fields": fields},
746 body=body,
747 transport_options=transport_options,
748 ),
749 )
750 return response
751
752 # endregion
753
754 # region Auth: Manage User Authentication Configuration
755
756 # ### Create an embed secret using the specified information.
757 #
758 # The value of the `secret` field will be set by Looker and returned.
759 #
760 # **NOTE**: Calls to this endpoint require [Embedding](https://cloud.google.com/looker/docs/r/looker-core-feature-embed) to be enabled. Usage of this endpoint is not authorized for Looker Core Standard and Looker Core Enterprise.
761 #
762 # POST /embed_config/secrets -> mdls.EmbedSecret
763 def create_embed_secret(
764 self,
765 body: Optional[mdls.WriteEmbedSecret] = None,
766 transport_options: Optional[transport.TransportOptions] = None,
767 ) -> mdls.EmbedSecret:
768 """Create Embed Secret"""
769 response = cast(
770 mdls.EmbedSecret,
771 self.post(
772 path="/embed_config/secrets",
773 structure=mdls.EmbedSecret,
774 body=body,
775 transport_options=transport_options,
776 ),
777 )
778 return response
779
780 # ### Delete an embed secret.
781 #
782 # **NOTE**: Calls to this endpoint require [Embedding](https://cloud.google.com/looker/docs/r/looker-core-feature-embed) to be enabled. Usage of this endpoint is not authorized for Looker Core Standard and Looker Core Enterprise.
783 #
784 # DELETE /embed_config/secrets/{embed_secret_id} -> str
785 def delete_embed_secret(
786 self,
787 # Id of Embed Secret
788 embed_secret_id: str,
789 transport_options: Optional[transport.TransportOptions] = None,
790 ) -> str:
791 """Delete Embed Secret"""
792 embed_secret_id = self.encode_path_param(embed_secret_id)
793 response = cast(
794 str,
795 self.delete(
796 path=f"/embed_config/secrets/{embed_secret_id}",
797 structure=str,
798 transport_options=transport_options,
799 ),
800 )
801 return response
802
803 # ### Create Signed Embed URL
804 #
805 # Creates a signed embed URL and cryptographically signs it with an embed secret.
806 # This signed URL can then be used to instantiate a Looker embed session in a PBL web application.
807 # Do not make any modifications to the returned URL - any change may invalidate the signature and
808 # cause the URL to fail to load a Looker embed session.
809 #
810 # A signed embed URL can only be **used once**. After the URL has been used to request a page from the
811 # Looker server, it is invalid. Future requests using the same URL will fail. This is to prevent
812 # 'replay attacks'.
813 #
814 # The `target_url` property must be a complete URL of a Looker UI page - scheme, hostname, path and query params.
815 # To load a dashboard with id 56 and with a filter of `Date=1 years`, the looker URL would look like `https:/myname.looker.com/dashboards/56?Date=1%20years`.
816 # The best way to obtain this `target_url` is to navigate to the desired Looker page in your web browser and use the "Get embed URL" menu option
817 # to copy it to your clipboard and paste it into the `target_url` property as a quoted string value in this API request.
818 #
819 # Permissions for the embed user are defined by the groups in which the embed user is a member (`group_ids` property)
820 # and the lists of models and permissions assigned to the embed user.
821 # At a minimum, you must provide values for either the `group_ids` property, or **both** the models and permissions properties.
822 # These properties are additive; an embed user can be a member of certain groups AND be granted access to models and permissions.
823 #
824 # The embed user's access is the union of permissions granted by the `group_ids`, `models`, and `permissions` properties.
825 #
826 # This function does not strictly require all group_ids, user attribute names, or model names to exist at the moment the
827 # embed url is created. Unknown group_id, user attribute names or model names will be passed through to the output URL.
828 # Because of this, **these parameters are not validated** when the API call is made.
829 #
830 # The [Get Embed Url](https://cloud.google.com/looker/docs/r/get-signed-url) dialog can be used to determine and validate the correct permissions for signing an embed url.
831 # This dialog also provides the SDK syntax for the API call to make. Alternatively, you can copy the signed URL into the Embed URI Validator text box
832 # in `<your looker instance>/admin/embed` to diagnose potential problems.
833 #
834 # The `secret_id` parameter is optional. If specified, its value must be the id of an active secret defined in the Looker instance.
835 # if not specified, the URL will be signed using the most recent active signing secret. If there is no active secret for signing embed urls,
836 # a default secret will be created. This default secret is encrypted using HMAC/SHA-256.
837 #
838 # The `embed_domain` parameter is optional. If specified and valid, the domain will be added to the embed domain allowlist if it is missing.
839 #
840 # #### Security Note
841 # Protect this signed URL as you would an access token or password credentials - do not write
842 # it to disk, do not pass it to a third party, and only pass it through a secure HTTPS
843 # encrypted transport.
844 #
845 #
846 # **NOTE**: Calls to this endpoint require [Embedding](https://cloud.google.com/looker/docs/r/looker-core-feature-embed) to be enabled. Usage of this endpoint is not authorized for Looker Core Standard and Looker Core Enterprise.
847 #
848 # POST /embed/sso_url -> mdls.EmbedUrlResponse
849 def create_sso_embed_url(
850 self,
851 body: mdls.EmbedSsoParams,
852 transport_options: Optional[transport.TransportOptions] = None,
853 ) -> mdls.EmbedUrlResponse:
854 """Create Signed Embed Url"""
855 response = cast(
856 mdls.EmbedUrlResponse,
857 self.post(
858 path="/embed/sso_url",
859 structure=mdls.EmbedUrlResponse,
860 body=body,
861 transport_options=transport_options,
862 ),
863 )
864 return response
865
866 # ### Create an Embed URL
867 #
868 # Creates an embed URL that runs as the Looker user making this API call. ("Embed as me")
869 # This embed URL can then be used to instantiate a Looker embed session in a
870 # "Powered by Looker" (PBL) web application.
871 #
872 # This is similar to Private Embedding (https://cloud.google.com/looker/docs/r/admin/embed/private-embed). Instead of
873 # logging into the Web UI to authenticate, the user has already authenticated against the API to be able to
874 # make this call. However, unlike Private Embed where the user has access to any other part of the Looker UI,
875 # the embed web session created by requesting the EmbedUrlResponse.url in a browser only has access to
876 # content visible under the `/embed` context.
877 #
878 # An embed URL can only be used once, and must be used within 5 minutes of being created. After it
879 # has been used to request a page from the Looker server, the URL is invalid. Future requests using
880 # the same URL will fail. This is to prevent 'replay attacks'.
881 #
882 # The `target_url` property must be a complete URL of a Looker Embedded UI page - scheme, hostname, path starting with "/embed" and query params.
883 # To load a dashboard with id 56 and with a filter of `Date=1 years`, the looker Embed URL would look like `https://myname.looker.com/embed/dashboards/56?Date=1%20years`.
884 # The best way to obtain this target_url is to navigate to the desired Looker page in your web browser,
885 # copy the URL shown in the browser address bar, insert "/embed" after the host/port, and paste it into the `target_url` property as a quoted string value in this API request.
886 #
887 # #### Security Note
888 # Protect this signed URL as you would an access token or password credentials - do not write
889 # it to disk, do not pass it to a third party, and only pass it through a secure HTTPS
890 # encrypted transport.
891 #
892 # POST /embed/token_url/me -> mdls.EmbedUrlResponse
893 def create_embed_url_as_me(
894 self,
895 body: mdls.EmbedParams,
896 transport_options: Optional[transport.TransportOptions] = None,
897 ) -> mdls.EmbedUrlResponse:
898 """Create Embed URL"""
899 response = cast(
900 mdls.EmbedUrlResponse,
901 self.post(
902 path="/embed/token_url/me",
903 structure=mdls.EmbedUrlResponse,
904 body=body,
905 transport_options=transport_options,
906 ),
907 )
908 return response
909
910 # ### Validate a Signed Embed URL
911 #
912 # GET /embed/sso/validate -> mdls.EmbedUrlResponse
913 def validate_embed_url(
914 self,
915 # URL to validate
916 url: Optional[str] = None,
917 transport_options: Optional[transport.TransportOptions] = None,
918 ) -> mdls.EmbedUrlResponse:
919 """Get Embed URL Validation"""
920 response = cast(
921 mdls.EmbedUrlResponse,
922 self.get(
923 path="/embed/sso/validate",
924 structure=mdls.EmbedUrlResponse,
925 query_params={"url": url},
926 transport_options=transport_options,
927 ),
928 )
929 return response
930
931 # ### Acquire a cookieless embed session.
932 #
933 # The acquire session endpoint negates the need for signing the embed url and passing it as a parameter
934 # to the embed login. This endpoint accepts an embed user definition and creates or updates it. This is
935 # similar behavior to the embed SSO login as they both can create and update embed user data.
936 #
937 # The endpoint also accepts an optional `session_reference_token`. If present and the session has not expired
938 # and the credentials match the credentials for the embed session, a new authentication token will be
939 # generated. This allows the embed session to attach a new embedded IFRAME to the embed session. Note that
940 # the session is NOT extended in this scenario. In other words the session_length parameter is ignored.
941 #
942 # **IMPORTANT:** If the `session_reference_token` is provided and the session has NOT expired, the embed user
943 # is NOT updated. This is done for performance reasons and to support the embed SSO usecase where the
944 # first IFRAME created on a page uses a signed url and subsequently created IFRAMEs do not.
945 #
946 # If the `session_reference_token` is provided but the session has expired, the token will be ignored and a
947 # new embed session will be created. Note that the embed user definition will be updated in this scenario.
948 #
949 # If the credentials do not match the credentials associated with an existing session_reference_token, a
950 # 404 will be returned.
951 #
952 # The endpoint returns the following:
953 # - Authentication token - a token that is passed to `/embed/login` endpoint that creates or attaches to the
954 # embed session. This token can be used once and has a lifetime of 30 seconds.
955 # - Session reference token - a token that lives for the length of the session. This token is used to
956 # generate new api and navigation tokens OR create new embed IFRAMEs.
957 # - Api token - lives for 10 minutes. The Looker client will ask for this token once it is loaded into the
958 # iframe.
959 # - Navigation token - lives for 10 minutes. The Looker client will ask for this token once it is loaded into
960 # the iframe.
961 #
962 # **NOTE**: Calls to this endpoint require [Embedding](https://cloud.google.com/looker/docs/r/looker-core-feature-embed) to be enabled. Usage of this endpoint is not authorized for Looker Core Standard and Looker Core Enterprise.
963 #
964 # POST /embed/cookieless_session/acquire -> mdls.EmbedCookielessSessionAcquireResponse
965 def acquire_embed_cookieless_session(
966 self,
967 body: mdls.EmbedCookielessSessionAcquire,
968 transport_options: Optional[transport.TransportOptions] = None,
969 ) -> mdls.EmbedCookielessSessionAcquireResponse:
970 """Create Acquire cookieless embed session"""
971 response = cast(
972 mdls.EmbedCookielessSessionAcquireResponse,
973 self.post(
974 path="/embed/cookieless_session/acquire",
975 structure=mdls.EmbedCookielessSessionAcquireResponse,
976 body=body,
977 transport_options=transport_options,
978 ),
979 )
980 return response
981
982 # ### Delete cookieless embed session
983 #
984 # This will delete the session associated with the given session reference token. Calling this endpoint will result
985 # in the session and session reference data being cleared from the system. This endpoint can be used to log an embed
986 # user out of the Looker instance.
987 #
988 # **NOTE**: Calls to this endpoint require [Embedding](https://cloud.google.com/looker/docs/r/looker-core-feature-embed) to be enabled. Usage of this endpoint is not authorized for Looker Core Standard and Looker Core Enterprise.
989 #
990 # DELETE /embed/cookieless_session/{session_reference_token} -> str
991 def delete_embed_cookieless_session(
992 self,
993 # Embed session reference token
994 session_reference_token: str,
995 transport_options: Optional[transport.TransportOptions] = None,
996 ) -> str:
997 """Delete cookieless embed session"""
998 session_reference_token = self.encode_path_param(session_reference_token)
999 response = cast(
1000 str,
1001 self.delete(
1002 path=f"/embed/cookieless_session/{session_reference_token}",
1003 structure=str,
1004 transport_options=transport_options,
1005 ),
1006 )
1007 return response
1008
1009 # ### Generate api and navigation tokens for a cookieless embed session
1010 #
1011 # The generate tokens endpoint is used to create new tokens of type:
1012 # - Api token.
1013 # - Navigation token.
1014 # The generate tokens endpoint should be called every time the Looker client asks for a token (except for the
1015 # first time when the tokens returned by the acquire_session endpoint should be used).
1016 #
1017 # #### Embed session expiration handling
1018 #
1019 # This endpoint does NOT return an error when the embed session expires. This is to simplify processing
1020 # in the caller as errors can happen for non session expiration reasons. Instead the endpoint returns
1021 # the session time to live in the `session_reference_token_ttl` response property. If this property
1022 # contains a zero, the embed session has expired.
1023 #
1024 # **NOTE**: Calls to this endpoint require [Embedding](https://cloud.google.com/looker/docs/r/looker-core-feature-embed) to be enabled. Usage of this endpoint is not authorized for Looker Core Standard and Looker Core Enterprise.
1025 #
1026 # PUT /embed/cookieless_session/generate_tokens -> mdls.EmbedCookielessSessionGenerateTokensResponse
1027 def generate_tokens_for_cookieless_session(
1028 self,
1029 body: mdls.EmbedCookielessSessionGenerateTokens,
1030 transport_options: Optional[transport.TransportOptions] = None,
1031 ) -> mdls.EmbedCookielessSessionGenerateTokensResponse:
1032 """Generate tokens for cookieless embed session"""
1033 response = cast(
1034 mdls.EmbedCookielessSessionGenerateTokensResponse,
1035 self.put(
1036 path="/embed/cookieless_session/generate_tokens",
1037 structure=mdls.EmbedCookielessSessionGenerateTokensResponse,
1038 body=body,
1039 transport_options=transport_options,
1040 ),
1041 )
1042 return response
1043
1044 # ### Get the LDAP configuration.
1045 #
1046 # Looker can be optionally configured to authenticate users against an Active Directory or other LDAP directory server.
1047 # LDAP setup requires coordination with an administrator of that directory server.
1048 #
1049 # Only Looker administrators can read and update the LDAP configuration.
1050 #
1051 # Configuring LDAP impacts authentication for all users. This configuration should be done carefully.
1052 #
1053 # Looker maintains a single LDAP configuration. It can be read and updated. Updates only succeed if the new state will be valid (in the sense that all required fields are populated); it is up to you to ensure that the configuration is appropriate and correct).
1054 #
1055 # LDAP is enabled or disabled for Looker using the **enabled** field.
1056 #
1057 # Looker will never return an **auth_password** field. That value can be set, but never retrieved.
1058 #
1059 # See the [Looker LDAP docs](https://cloud.google.com/looker/docs/r/api/ldap_setup) for additional information.
1060 #
1061 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1062 #
1063 # GET /ldap_config -> mdls.LDAPConfig
1064 def ldap_config(
1065 self,
1066 transport_options: Optional[transport.TransportOptions] = None,
1067 ) -> mdls.LDAPConfig:
1068 """Get LDAP Configuration"""
1069 response = cast(
1070 mdls.LDAPConfig,
1071 self.get(
1072 path="/ldap_config",
1073 structure=mdls.LDAPConfig,
1074 transport_options=transport_options,
1075 ),
1076 )
1077 return response
1078
1079 # ### Update the LDAP configuration.
1080 #
1081 # Configuring LDAP impacts authentication for all users. This configuration should be done carefully.
1082 #
1083 # Only Looker administrators can read and update the LDAP configuration.
1084 #
1085 # LDAP is enabled or disabled for Looker using the **enabled** field.
1086 #
1087 # It is **highly** recommended that any LDAP setting changes be tested using the APIs below before being set globally.
1088 #
1089 # See the [Looker LDAP docs](https://cloud.google.com/looker/docs/r/api/ldap_setup) for additional information.
1090 #
1091 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1092 #
1093 # PATCH /ldap_config -> mdls.LDAPConfig
1094 def update_ldap_config(
1095 self,
1096 body: mdls.WriteLDAPConfig,
1097 transport_options: Optional[transport.TransportOptions] = None,
1098 ) -> mdls.LDAPConfig:
1099 """Update LDAP Configuration"""
1100 response = cast(
1101 mdls.LDAPConfig,
1102 self.patch(
1103 path="/ldap_config",
1104 structure=mdls.LDAPConfig,
1105 body=body,
1106 transport_options=transport_options,
1107 ),
1108 )
1109 return response
1110
1111 # ### Test the connection settings for an LDAP configuration.
1112 #
1113 # This tests that the connection is possible given a connection_host and connection_port.
1114 #
1115 # **connection_host** and **connection_port** are required. **connection_tls** is optional.
1116 #
1117 # Example:
1118 # ```json
1119 # {
1120 # "connection_host": "ldap.example.com",
1121 # "connection_port": "636",
1122 # "connection_tls": true
1123 # }
1124 # ```
1125 #
1126 # No authentication to the LDAP server is attempted.
1127 #
1128 # The active LDAP settings are not modified.
1129 #
1130 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1131 #
1132 # PUT /ldap_config/test_connection -> mdls.LDAPConfigTestResult
1133 def test_ldap_config_connection(
1134 self,
1135 body: mdls.WriteLDAPConfig,
1136 transport_options: Optional[transport.TransportOptions] = None,
1137 ) -> mdls.LDAPConfigTestResult:
1138 """Test LDAP Connection"""
1139 response = cast(
1140 mdls.LDAPConfigTestResult,
1141 self.put(
1142 path="/ldap_config/test_connection",
1143 structure=mdls.LDAPConfigTestResult,
1144 body=body,
1145 transport_options=transport_options,
1146 ),
1147 )
1148 return response
1149
1150 # ### Test the connection authentication settings for an LDAP configuration.
1151 #
1152 # This tests that the connection is possible and that a 'server' account to be used by Looker can authenticate to the LDAP server given connection and authentication information.
1153 #
1154 # **connection_host**, **connection_port**, and **auth_username**, are required. **connection_tls** and **auth_password** are optional.
1155 #
1156 # Example:
1157 # ```json
1158 # {
1159 # "connection_host": "ldap.example.com",
1160 # "connection_port": "636",
1161 # "connection_tls": true,
1162 # "auth_username": "cn=looker,dc=example,dc=com",
1163 # "auth_password": "secret"
1164 # }
1165 # ```
1166 #
1167 # Looker will never return an **auth_password**. If this request omits the **auth_password** field, then the **auth_password** value from the active config (if present) will be used for the test.
1168 #
1169 # The active LDAP settings are not modified.
1170 #
1171 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1172 #
1173 # PUT /ldap_config/test_auth -> mdls.LDAPConfigTestResult
1174 def test_ldap_config_auth(
1175 self,
1176 body: mdls.WriteLDAPConfig,
1177 transport_options: Optional[transport.TransportOptions] = None,
1178 ) -> mdls.LDAPConfigTestResult:
1179 """Test LDAP Auth"""
1180 response = cast(
1181 mdls.LDAPConfigTestResult,
1182 self.put(
1183 path="/ldap_config/test_auth",
1184 structure=mdls.LDAPConfigTestResult,
1185 body=body,
1186 transport_options=transport_options,
1187 ),
1188 )
1189 return response
1190
1191 # ### Test the user authentication settings for an LDAP configuration without authenticating the user.
1192 #
1193 # This test will let you easily test the mapping for user properties and roles for any user withoutneeding to authenticate as that user.
1194 #
1195 # This test accepts a full LDAP configuration along with a username and attempts to find the full infofor the user from the LDAP server without actually authenticating the user. So, user password is notrequired.The configuration is validated before attempting to contact the server.
1196 #
1197 # **test_ldap_user** is required.
1198 #
1199 # The active LDAP settings are not modified.
1200 #
1201 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1202 #
1203 # PUT /ldap_config/test_user_info -> mdls.LDAPConfigTestResult
1204 def test_ldap_config_user_info(
1205 self,
1206 body: mdls.WriteLDAPConfig,
1207 transport_options: Optional[transport.TransportOptions] = None,
1208 ) -> mdls.LDAPConfigTestResult:
1209 """Test LDAP User Info"""
1210 response = cast(
1211 mdls.LDAPConfigTestResult,
1212 self.put(
1213 path="/ldap_config/test_user_info",
1214 structure=mdls.LDAPConfigTestResult,
1215 body=body,
1216 transport_options=transport_options,
1217 ),
1218 )
1219 return response
1220
1221 # ### Test the user authentication settings for an LDAP configuration.
1222 #
1223 # This test accepts a full LDAP configuration along with a username/password pair and attempts to authenticate the user with the LDAP server. The configuration is validated before attempting the authentication.
1224 #
1225 # Looker will never return an **auth_password**. If this request omits the **auth_password** field, then the **auth_password** value from the active config (if present) will be used for the test.
1226 #
1227 # **test_ldap_user** and **test_ldap_password** are required.
1228 #
1229 # The active LDAP settings are not modified.
1230 #
1231 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1232 #
1233 # PUT /ldap_config/test_user_auth -> mdls.LDAPConfigTestResult
1234 def test_ldap_config_user_auth(
1235 self,
1236 body: mdls.WriteLDAPConfig,
1237 transport_options: Optional[transport.TransportOptions] = None,
1238 ) -> mdls.LDAPConfigTestResult:
1239 """Test LDAP User Auth"""
1240 response = cast(
1241 mdls.LDAPConfigTestResult,
1242 self.put(
1243 path="/ldap_config/test_user_auth",
1244 structure=mdls.LDAPConfigTestResult,
1245 body=body,
1246 transport_options=transport_options,
1247 ),
1248 )
1249 return response
1250
1251 # ### Registers a mobile device.
1252 # # Required fields: [:device_token, :device_type]
1253 #
1254 # POST /mobile/device -> mdls.MobileToken
1255 def register_mobile_device(
1256 self,
1257 body: mdls.WriteMobileToken,
1258 transport_options: Optional[transport.TransportOptions] = None,
1259 ) -> mdls.MobileToken:
1260 """Register Mobile Device"""
1261 response = cast(
1262 mdls.MobileToken,
1263 self.post(
1264 path="/mobile/device",
1265 structure=mdls.MobileToken,
1266 body=body,
1267 transport_options=transport_options,
1268 ),
1269 )
1270 return response
1271
1272 # ### Updates the mobile device registration
1273 #
1274 # PATCH /mobile/device/{device_id} -> mdls.MobileToken
1275 def update_mobile_device_registration(
1276 self,
1277 # Unique id of the device.
1278 device_id: str,
1279 transport_options: Optional[transport.TransportOptions] = None,
1280 ) -> mdls.MobileToken:
1281 """Update Mobile Device Registration"""
1282 device_id = self.encode_path_param(device_id)
1283 response = cast(
1284 mdls.MobileToken,
1285 self.patch(
1286 path=f"/mobile/device/{device_id}",
1287 structure=mdls.MobileToken,
1288 transport_options=transport_options,
1289 ),
1290 )
1291 return response
1292
1293 # ### Deregister a mobile device.
1294 #
1295 # DELETE /mobile/device/{device_id} -> None
1296 def deregister_mobile_device(
1297 self,
1298 # Unique id of the device.
1299 device_id: str,
1300 transport_options: Optional[transport.TransportOptions] = None,
1301 ) -> None:
1302 """Deregister Mobile Device"""
1303 device_id = self.encode_path_param(device_id)
1304 response = cast(
1305 None,
1306 self.delete(
1307 path=f"/mobile/device/{device_id}",
1308 structure=None,
1309 transport_options=transport_options,
1310 ),
1311 )
1312 return response
1313
1314 # ### List All OAuth Client Apps
1315 #
1316 # Lists all applications registered to use OAuth2 login with this Looker instance, including
1317 # enabled and disabled apps.
1318 #
1319 # Results are filtered to include only the apps that the caller (current user)
1320 # has permission to see.
1321 #
1322 # GET /oauth_client_apps -> Sequence[mdls.OauthClientApp]
1323 def all_oauth_client_apps(
1324 self,
1325 # Requested fields.
1326 fields: Optional[str] = None,
1327 transport_options: Optional[transport.TransportOptions] = None,
1328 ) -> Sequence[mdls.OauthClientApp]:
1329 """Get All OAuth Client Apps"""
1330 response = cast(
1331 Sequence[mdls.OauthClientApp],
1332 self.get(
1333 path="/oauth_client_apps",
1334 structure=Sequence[mdls.OauthClientApp],
1335 query_params={"fields": fields},
1336 transport_options=transport_options,
1337 ),
1338 )
1339 return response
1340
1341 # ### Get Oauth Client App
1342 #
1343 # Returns the registered app client with matching client_guid.
1344 #
1345 # GET /oauth_client_apps/{client_guid} -> mdls.OauthClientApp
1346 def oauth_client_app(
1347 self,
1348 # The unique id of this application
1349 client_guid: str,
1350 # Requested fields.
1351 fields: Optional[str] = None,
1352 transport_options: Optional[transport.TransportOptions] = None,
1353 ) -> mdls.OauthClientApp:
1354 """Get OAuth Client App"""
1355 client_guid = self.encode_path_param(client_guid)
1356 response = cast(
1357 mdls.OauthClientApp,
1358 self.get(
1359 path=f"/oauth_client_apps/{client_guid}",
1360 structure=mdls.OauthClientApp,
1361 query_params={"fields": fields},
1362 transport_options=transport_options,
1363 ),
1364 )
1365 return response
1366
1367 # ### Register an OAuth2 Client App
1368 #
1369 # Registers details identifying an external web app or native app as an OAuth2 login client of the Looker instance.
1370 # The app registration must provide a unique client_guid and redirect_uri that the app will present
1371 # in OAuth login requests. If the client_guid and redirect_uri parameters in the login request do not match
1372 # the app details registered with the Looker instance, the request is assumed to be a forgery and is rejected.
1373 #
1374 # POST /oauth_client_apps/{client_guid} -> mdls.OauthClientApp
1375 def register_oauth_client_app(
1376 self,
1377 # The unique id of this application
1378 client_guid: str,
1379 body: mdls.WriteOauthClientApp,
1380 # Requested fields.
1381 fields: Optional[str] = None,
1382 transport_options: Optional[transport.TransportOptions] = None,
1383 ) -> mdls.OauthClientApp:
1384 """Register OAuth App"""
1385 client_guid = self.encode_path_param(client_guid)
1386 response = cast(
1387 mdls.OauthClientApp,
1388 self.post(
1389 path=f"/oauth_client_apps/{client_guid}",
1390 structure=mdls.OauthClientApp,
1391 query_params={"fields": fields},
1392 body=body,
1393 transport_options=transport_options,
1394 ),
1395 )
1396 return response
1397
1398 # ### Update OAuth2 Client App Details
1399 #
1400 # Modifies the details a previously registered OAuth2 login client app.
1401 #
1402 # PATCH /oauth_client_apps/{client_guid} -> mdls.OauthClientApp
1403 def update_oauth_client_app(
1404 self,
1405 # The unique id of this application
1406 client_guid: str,
1407 body: mdls.WriteOauthClientApp,
1408 # Requested fields.
1409 fields: Optional[str] = None,
1410 transport_options: Optional[transport.TransportOptions] = None,
1411 ) -> mdls.OauthClientApp:
1412 """Update OAuth App"""
1413 client_guid = self.encode_path_param(client_guid)
1414 response = cast(
1415 mdls.OauthClientApp,
1416 self.patch(
1417 path=f"/oauth_client_apps/{client_guid}",
1418 structure=mdls.OauthClientApp,
1419 query_params={"fields": fields},
1420 body=body,
1421 transport_options=transport_options,
1422 ),
1423 )
1424 return response
1425
1426 # ### Delete OAuth Client App
1427 #
1428 # Deletes the registration info of the app with the matching client_guid.
1429 # All active sessions and tokens issued for this app will immediately become invalid.
1430 #
1431 # As with most REST DELETE operations, this endpoint does not return an error if the
1432 # indicated resource does not exist.
1433 #
1434 # ### Note: this deletion cannot be undone.
1435 #
1436 # DELETE /oauth_client_apps/{client_guid} -> str
1437 def delete_oauth_client_app(
1438 self,
1439 # The unique id of this application
1440 client_guid: str,
1441 transport_options: Optional[transport.TransportOptions] = None,
1442 ) -> str:
1443 """Delete OAuth Client App"""
1444 client_guid = self.encode_path_param(client_guid)
1445 response = cast(
1446 str,
1447 self.delete(
1448 path=f"/oauth_client_apps/{client_guid}",
1449 structure=str,
1450 transport_options=transport_options,
1451 ),
1452 )
1453 return response
1454
1455 # ### Invalidate All Issued Tokens
1456 #
1457 # Immediately invalidates all auth codes, sessions, access tokens and refresh tokens issued for
1458 # this app for ALL USERS of this app.
1459 #
1460 # DELETE /oauth_client_apps/{client_guid}/tokens -> str
1461 def invalidate_tokens(
1462 self,
1463 # The unique id of the application
1464 client_guid: str,
1465 transport_options: Optional[transport.TransportOptions] = None,
1466 ) -> str:
1467 """Invalidate Tokens"""
1468 client_guid = self.encode_path_param(client_guid)
1469 response = cast(
1470 str,
1471 self.delete(
1472 path=f"/oauth_client_apps/{client_guid}/tokens",
1473 structure=str,
1474 transport_options=transport_options,
1475 ),
1476 )
1477 return response
1478
1479 # ### Activate an app for a user
1480 #
1481 # Activates a user for a given oauth client app. This indicates the user has been informed that
1482 # the app will have access to the user's looker data, and that the user has accepted and allowed
1483 # the app to use their Looker account.
1484 #
1485 # Activating a user for an app that the user is already activated with returns a success response.
1486 #
1487 # POST /oauth_client_apps/{client_guid}/users/{user_id} -> str
1488 def activate_app_user(
1489 self,
1490 # The unique id of this application
1491 client_guid: str,
1492 # The id of the user to enable use of this app
1493 user_id: str,
1494 # Requested fields.
1495 fields: Optional[str] = None,
1496 transport_options: Optional[transport.TransportOptions] = None,
1497 ) -> str:
1498 """Activate OAuth App User"""
1499 client_guid = self.encode_path_param(client_guid)
1500 user_id = self.encode_path_param(user_id)
1501 response = cast(
1502 str,
1503 self.post(
1504 path=f"/oauth_client_apps/{client_guid}/users/{user_id}",
1505 structure=str,
1506 query_params={"fields": fields},
1507 transport_options=transport_options,
1508 ),
1509 )
1510 return response
1511
1512 # ### Deactivate an app for a user
1513 #
1514 # Deactivate a user for a given oauth client app. All tokens issued to the app for
1515 # this user will be invalid immediately. Before the user can use the app with their
1516 # Looker account, the user will have to read and accept an account use disclosure statement for the app.
1517 #
1518 # Admin users can deactivate other users, but non-admin users can only deactivate themselves.
1519 #
1520 # As with most REST DELETE operations, this endpoint does not return an error if the indicated
1521 # resource (app or user) does not exist or has already been deactivated.
1522 #
1523 # DELETE /oauth_client_apps/{client_guid}/users/{user_id} -> str
1524 def deactivate_app_user(
1525 self,
1526 # The unique id of this application
1527 client_guid: str,
1528 # The id of the user to enable use of this app
1529 user_id: str,
1530 # Requested fields.
1531 fields: Optional[str] = None,
1532 transport_options: Optional[transport.TransportOptions] = None,
1533 ) -> str:
1534 """Deactivate OAuth App User"""
1535 client_guid = self.encode_path_param(client_guid)
1536 user_id = self.encode_path_param(user_id)
1537 response = cast(
1538 str,
1539 self.delete(
1540 path=f"/oauth_client_apps/{client_guid}/users/{user_id}",
1541 structure=str,
1542 query_params={"fields": fields},
1543 transport_options=transport_options,
1544 ),
1545 )
1546 return response
1547
1548 # ### Get the OIDC configuration.
1549 #
1550 # Looker can be optionally configured to authenticate users against an OpenID Connect (OIDC)
1551 # authentication server. OIDC setup requires coordination with an administrator of that server.
1552 #
1553 # Only Looker administrators can read and update the OIDC configuration.
1554 #
1555 # Configuring OIDC impacts authentication for all users. This configuration should be done carefully.
1556 #
1557 # Looker maintains a single OIDC configuration. It can be read and updated. Updates only succeed if the new state will be valid (in the sense that all required fields are populated); it is up to you to ensure that the configuration is appropriate and correct).
1558 #
1559 # OIDC is enabled or disabled for Looker using the **enabled** field.
1560 #
1561 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1562 #
1563 # GET /oidc_config -> mdls.OIDCConfig
1564 def oidc_config(
1565 self,
1566 transport_options: Optional[transport.TransportOptions] = None,
1567 ) -> mdls.OIDCConfig:
1568 """Get OIDC Configuration"""
1569 response = cast(
1570 mdls.OIDCConfig,
1571 self.get(
1572 path="/oidc_config",
1573 structure=mdls.OIDCConfig,
1574 transport_options=transport_options,
1575 ),
1576 )
1577 return response
1578
1579 # ### Update the OIDC configuration.
1580 #
1581 # Configuring OIDC impacts authentication for all users. This configuration should be done carefully.
1582 #
1583 # Only Looker administrators can read and update the OIDC configuration.
1584 #
1585 # OIDC is enabled or disabled for Looker using the **enabled** field.
1586 #
1587 # It is **highly** recommended that any OIDC setting changes be tested using the APIs below before being set globally.
1588 #
1589 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1590 #
1591 # PATCH /oidc_config -> mdls.OIDCConfig
1592 def update_oidc_config(
1593 self,
1594 body: mdls.WriteOIDCConfig,
1595 transport_options: Optional[transport.TransportOptions] = None,
1596 ) -> mdls.OIDCConfig:
1597 """Update OIDC Configuration"""
1598 response = cast(
1599 mdls.OIDCConfig,
1600 self.patch(
1601 path="/oidc_config",
1602 structure=mdls.OIDCConfig,
1603 body=body,
1604 transport_options=transport_options,
1605 ),
1606 )
1607 return response
1608
1609 # ### Get a OIDC test configuration by test_slug.
1610 #
1611 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1612 #
1613 # GET /oidc_test_configs/{test_slug} -> mdls.OIDCConfig
1614 def oidc_test_config(
1615 self,
1616 # Slug of test config
1617 test_slug: str,
1618 transport_options: Optional[transport.TransportOptions] = None,
1619 ) -> mdls.OIDCConfig:
1620 """Get OIDC Test Configuration"""
1621 test_slug = self.encode_path_param(test_slug)
1622 response = cast(
1623 mdls.OIDCConfig,
1624 self.get(
1625 path=f"/oidc_test_configs/{test_slug}",
1626 structure=mdls.OIDCConfig,
1627 transport_options=transport_options,
1628 ),
1629 )
1630 return response
1631
1632 # ### Delete a OIDC test configuration.
1633 #
1634 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1635 #
1636 # DELETE /oidc_test_configs/{test_slug} -> str
1637 def delete_oidc_test_config(
1638 self,
1639 # Slug of test config
1640 test_slug: str,
1641 transport_options: Optional[transport.TransportOptions] = None,
1642 ) -> str:
1643 """Delete OIDC Test Configuration"""
1644 test_slug = self.encode_path_param(test_slug)
1645 response = cast(
1646 str,
1647 self.delete(
1648 path=f"/oidc_test_configs/{test_slug}",
1649 structure=str,
1650 transport_options=transport_options,
1651 ),
1652 )
1653 return response
1654
1655 # ### Create a OIDC test configuration.
1656 #
1657 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1658 #
1659 # POST /oidc_test_configs -> mdls.OIDCConfig
1660 def create_oidc_test_config(
1661 self,
1662 body: mdls.WriteOIDCConfig,
1663 transport_options: Optional[transport.TransportOptions] = None,
1664 ) -> mdls.OIDCConfig:
1665 """Create OIDC Test Configuration"""
1666 response = cast(
1667 mdls.OIDCConfig,
1668 self.post(
1669 path="/oidc_test_configs",
1670 structure=mdls.OIDCConfig,
1671 body=body,
1672 transport_options=transport_options,
1673 ),
1674 )
1675 return response
1676
1677 # ### Get password config.
1678 #
1679 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1680 #
1681 # GET /password_config -> mdls.PasswordConfig
1682 def password_config(
1683 self,
1684 transport_options: Optional[transport.TransportOptions] = None,
1685 ) -> mdls.PasswordConfig:
1686 """Get Password Config"""
1687 response = cast(
1688 mdls.PasswordConfig,
1689 self.get(
1690 path="/password_config",
1691 structure=mdls.PasswordConfig,
1692 transport_options=transport_options,
1693 ),
1694 )
1695 return response
1696
1697 # ### Update password config.
1698 #
1699 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1700 #
1701 # PATCH /password_config -> mdls.PasswordConfig
1702 def update_password_config(
1703 self,
1704 body: mdls.WritePasswordConfig,
1705 transport_options: Optional[transport.TransportOptions] = None,
1706 ) -> mdls.PasswordConfig:
1707 """Update Password Config"""
1708 response = cast(
1709 mdls.PasswordConfig,
1710 self.patch(
1711 path="/password_config",
1712 structure=mdls.PasswordConfig,
1713 body=body,
1714 transport_options=transport_options,
1715 ),
1716 )
1717 return response
1718
1719 # ### Force all credentials_email users to reset their login passwords upon their next login.
1720 #
1721 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1722 #
1723 # PUT /password_config/force_password_reset_at_next_login_for_all_users -> str
1724 def force_password_reset_at_next_login_for_all_users(
1725 self,
1726 transport_options: Optional[transport.TransportOptions] = None,
1727 ) -> str:
1728 """Force password reset"""
1729 response = cast(
1730 str,
1731 self.put(
1732 path="/password_config/force_password_reset_at_next_login_for_all_users",
1733 structure=str,
1734 transport_options=transport_options,
1735 ),
1736 )
1737 return response
1738
1739 # ### Get the SAML configuration.
1740 #
1741 # Looker can be optionally configured to authenticate users against a SAML authentication server.
1742 # SAML setup requires coordination with an administrator of that server.
1743 #
1744 # Only Looker administrators can read and update the SAML configuration.
1745 #
1746 # Configuring SAML impacts authentication for all users. This configuration should be done carefully.
1747 #
1748 # Looker maintains a single SAML configuration. It can be read and updated. Updates only succeed if the new state will be valid (in the sense that all required fields are populated); it is up to you to ensure that the configuration is appropriate and correct).
1749 #
1750 # SAML is enabled or disabled for Looker using the **enabled** field.
1751 #
1752 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1753 #
1754 # GET /saml_config -> mdls.SamlConfig
1755 def saml_config(
1756 self,
1757 transport_options: Optional[transport.TransportOptions] = None,
1758 ) -> mdls.SamlConfig:
1759 """Get SAML Configuration"""
1760 response = cast(
1761 mdls.SamlConfig,
1762 self.get(
1763 path="/saml_config",
1764 structure=mdls.SamlConfig,
1765 transport_options=transport_options,
1766 ),
1767 )
1768 return response
1769
1770 # ### Update the SAML configuration.
1771 #
1772 # Configuring SAML impacts authentication for all users. This configuration should be done carefully.
1773 #
1774 # Only Looker administrators can read and update the SAML configuration.
1775 #
1776 # SAML is enabled or disabled for Looker using the **enabled** field.
1777 #
1778 # It is **highly** recommended that any SAML setting changes be tested using the APIs below before being set globally.
1779 #
1780 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1781 #
1782 # PATCH /saml_config -> mdls.SamlConfig
1783 def update_saml_config(
1784 self,
1785 body: mdls.WriteSamlConfig,
1786 transport_options: Optional[transport.TransportOptions] = None,
1787 ) -> mdls.SamlConfig:
1788 """Update SAML Configuration"""
1789 response = cast(
1790 mdls.SamlConfig,
1791 self.patch(
1792 path="/saml_config",
1793 structure=mdls.SamlConfig,
1794 body=body,
1795 transport_options=transport_options,
1796 ),
1797 )
1798 return response
1799
1800 # ### Get a SAML test configuration by test_slug.
1801 #
1802 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1803 #
1804 # GET /saml_test_configs/{test_slug} -> mdls.SamlConfig
1805 def saml_test_config(
1806 self,
1807 # Slug of test config
1808 test_slug: str,
1809 transport_options: Optional[transport.TransportOptions] = None,
1810 ) -> mdls.SamlConfig:
1811 """Get SAML Test Configuration"""
1812 test_slug = self.encode_path_param(test_slug)
1813 response = cast(
1814 mdls.SamlConfig,
1815 self.get(
1816 path=f"/saml_test_configs/{test_slug}",
1817 structure=mdls.SamlConfig,
1818 transport_options=transport_options,
1819 ),
1820 )
1821 return response
1822
1823 # ### Delete a SAML test configuration.
1824 #
1825 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1826 #
1827 # DELETE /saml_test_configs/{test_slug} -> str
1828 def delete_saml_test_config(
1829 self,
1830 # Slug of test config
1831 test_slug: str,
1832 transport_options: Optional[transport.TransportOptions] = None,
1833 ) -> str:
1834 """Delete SAML Test Configuration"""
1835 test_slug = self.encode_path_param(test_slug)
1836 response = cast(
1837 str,
1838 self.delete(
1839 path=f"/saml_test_configs/{test_slug}",
1840 structure=str,
1841 transport_options=transport_options,
1842 ),
1843 )
1844 return response
1845
1846 # ### Create a SAML test configuration.
1847 #
1848 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1849 #
1850 # POST /saml_test_configs -> mdls.SamlConfig
1851 def create_saml_test_config(
1852 self,
1853 body: mdls.WriteSamlConfig,
1854 transport_options: Optional[transport.TransportOptions] = None,
1855 ) -> mdls.SamlConfig:
1856 """Create SAML Test Configuration"""
1857 response = cast(
1858 mdls.SamlConfig,
1859 self.post(
1860 path="/saml_test_configs",
1861 structure=mdls.SamlConfig,
1862 body=body,
1863 transport_options=transport_options,
1864 ),
1865 )
1866 return response
1867
1868 # ### Parse the given xml as a SAML IdP metadata document and return the result.
1869 #
1870 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1871 #
1872 # POST /parse_saml_idp_metadata -> mdls.SamlMetadataParseResult
1873 def parse_saml_idp_metadata(
1874 self,
1875 body: str,
1876 transport_options: Optional[transport.TransportOptions] = None,
1877 ) -> mdls.SamlMetadataParseResult:
1878 """Parse SAML IdP XML"""
1879 response = cast(
1880 mdls.SamlMetadataParseResult,
1881 self.post(
1882 path="/parse_saml_idp_metadata",
1883 structure=mdls.SamlMetadataParseResult,
1884 body=body,
1885 transport_options=transport_options,
1886 ),
1887 )
1888 return response
1889
1890 # ### Fetch the given url and parse it as a SAML IdP metadata document and return the result.
1891 # Note that this requires that the url be public or at least at a location where the Looker instance
1892 # can fetch it without requiring any special authentication.
1893 #
1894 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1895 #
1896 # POST /fetch_and_parse_saml_idp_metadata -> mdls.SamlMetadataParseResult
1897 def fetch_and_parse_saml_idp_metadata(
1898 self,
1899 body: str,
1900 transport_options: Optional[transport.TransportOptions] = None,
1901 ) -> mdls.SamlMetadataParseResult:
1902 """Parse SAML IdP Url"""
1903 response = cast(
1904 mdls.SamlMetadataParseResult,
1905 self.post(
1906 path="/fetch_and_parse_saml_idp_metadata",
1907 structure=mdls.SamlMetadataParseResult,
1908 body=body,
1909 transport_options=transport_options,
1910 ),
1911 )
1912 return response
1913
1914 # ### Get session config.
1915 #
1916 # GET /session_config -> mdls.SessionConfig
1917 def session_config(
1918 self,
1919 transport_options: Optional[transport.TransportOptions] = None,
1920 ) -> mdls.SessionConfig:
1921 """Get Session Config"""
1922 response = cast(
1923 mdls.SessionConfig,
1924 self.get(
1925 path="/session_config",
1926 structure=mdls.SessionConfig,
1927 transport_options=transport_options,
1928 ),
1929 )
1930 return response
1931
1932 # ### Update session config.
1933 #
1934 # PATCH /session_config -> mdls.SessionConfig
1935 def update_session_config(
1936 self,
1937 body: mdls.WriteSessionConfig,
1938 transport_options: Optional[transport.TransportOptions] = None,
1939 ) -> mdls.SessionConfig:
1940 """Update Session Config"""
1941 response = cast(
1942 mdls.SessionConfig,
1943 self.patch(
1944 path="/session_config",
1945 structure=mdls.SessionConfig,
1946 body=body,
1947 transport_options=transport_options,
1948 ),
1949 )
1950 return response
1951
1952 # ### Get Support Access Allowlist Users
1953 #
1954 # Returns the users that have been added to the Support Access Allowlist
1955 #
1956 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1957 #
1958 # GET /support_access/allowlist -> Sequence[mdls.SupportAccessAllowlistEntry]
1959 def get_support_access_allowlist_entries(
1960 self,
1961 # Requested fields.
1962 fields: Optional[str] = None,
1963 transport_options: Optional[transport.TransportOptions] = None,
1964 ) -> Sequence[mdls.SupportAccessAllowlistEntry]:
1965 """Get Support Access Allowlist Users"""
1966 response = cast(
1967 Sequence[mdls.SupportAccessAllowlistEntry],
1968 self.get(
1969 path="/support_access/allowlist",
1970 structure=Sequence[mdls.SupportAccessAllowlistEntry],
1971 query_params={"fields": fields},
1972 transport_options=transport_options,
1973 ),
1974 )
1975 return response
1976
1977 # ### Add Support Access Allowlist Users
1978 #
1979 # Adds a list of emails to the Allowlist, using the provided reason
1980 #
1981 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
1982 #
1983 # POST /support_access/allowlist -> Sequence[mdls.SupportAccessAllowlistEntry]
1984 def add_support_access_allowlist_entries(
1985 self,
1986 body: mdls.SupportAccessAddEntries,
1987 transport_options: Optional[transport.TransportOptions] = None,
1988 ) -> Sequence[mdls.SupportAccessAllowlistEntry]:
1989 """Add Support Access Allowlist Users"""
1990 response = cast(
1991 Sequence[mdls.SupportAccessAllowlistEntry],
1992 self.post(
1993 path="/support_access/allowlist",
1994 structure=Sequence[mdls.SupportAccessAllowlistEntry],
1995 body=body,
1996 transport_options=transport_options,
1997 ),
1998 )
1999 return response
2000
2001 # ### Delete Support Access Allowlist User
2002 #
2003 # Deletes the specified Allowlist Entry Id
2004 #
2005 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
2006 #
2007 # DELETE /support_access/allowlist/{entry_id} -> str
2008 def delete_support_access_allowlist_entry(
2009 self,
2010 # Id of Allowlist Entry
2011 entry_id: str,
2012 transport_options: Optional[transport.TransportOptions] = None,
2013 ) -> str:
2014 """Delete Support Access Allowlist Entry"""
2015 entry_id = self.encode_path_param(entry_id)
2016 response = cast(
2017 str,
2018 self.delete(
2019 path=f"/support_access/allowlist/{entry_id}",
2020 structure=str,
2021 transport_options=transport_options,
2022 ),
2023 )
2024 return response
2025
2026 # ### Enable Support Access
2027 #
2028 # Enables Support Access for the provided duration
2029 #
2030 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
2031 #
2032 # PUT /support_access/enable -> mdls.SupportAccessStatus
2033 def enable_support_access(
2034 self,
2035 body: mdls.SupportAccessEnable,
2036 transport_options: Optional[transport.TransportOptions] = None,
2037 ) -> mdls.SupportAccessStatus:
2038 """Enable Support Access"""
2039 response = cast(
2040 mdls.SupportAccessStatus,
2041 self.put(
2042 path="/support_access/enable",
2043 structure=mdls.SupportAccessStatus,
2044 body=body,
2045 transport_options=transport_options,
2046 ),
2047 )
2048 return response
2049
2050 # ### Disable Support Access
2051 #
2052 # Disables Support Access immediately
2053 #
2054 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
2055 #
2056 # PUT /support_access/disable -> mdls.SupportAccessStatus
2057 def disable_support_access(
2058 self,
2059 transport_options: Optional[transport.TransportOptions] = None,
2060 ) -> mdls.SupportAccessStatus:
2061 """Disable Support Access"""
2062 response = cast(
2063 mdls.SupportAccessStatus,
2064 self.put(
2065 path="/support_access/disable",
2066 structure=mdls.SupportAccessStatus,
2067 transport_options=transport_options,
2068 ),
2069 )
2070 return response
2071
2072 # ### Support Access Status
2073 #
2074 # Returns the current Support Access Status
2075 #
2076 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
2077 #
2078 # GET /support_access/status -> mdls.SupportAccessStatus
2079 def support_access_status(
2080 self,
2081 transport_options: Optional[transport.TransportOptions] = None,
2082 ) -> mdls.SupportAccessStatus:
2083 """Support Access Status"""
2084 response = cast(
2085 mdls.SupportAccessStatus,
2086 self.get(
2087 path="/support_access/status",
2088 structure=mdls.SupportAccessStatus,
2089 transport_options=transport_options,
2090 ),
2091 )
2092 return response
2093
2094 # ### Get currently locked-out users.
2095 #
2096 # GET /user_login_lockouts -> Sequence[mdls.UserLoginLockout]
2097 def all_user_login_lockouts(
2098 self,
2099 # Include only these fields in the response
2100 fields: Optional[str] = None,
2101 transport_options: Optional[transport.TransportOptions] = None,
2102 ) -> Sequence[mdls.UserLoginLockout]:
2103 """Get All User Login Lockouts"""
2104 response = cast(
2105 Sequence[mdls.UserLoginLockout],
2106 self.get(
2107 path="/user_login_lockouts",
2108 structure=Sequence[mdls.UserLoginLockout],
2109 query_params={"fields": fields},
2110 transport_options=transport_options,
2111 ),
2112 )
2113 return response
2114
2115 # ### Search currently locked-out users.
2116 #
2117 # GET /user_login_lockouts/search -> Sequence[mdls.UserLoginLockout]
2118 def search_user_login_lockouts(
2119 self,
2120 # Include only these fields in the response
2121 fields: Optional[str] = None,
2122 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
2123 page: Optional[int] = None,
2124 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
2125 per_page: Optional[int] = None,
2126 # Number of results to return. (used with offset and takes priority over page and per_page)
2127 limit: Optional[int] = None,
2128 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
2129 offset: Optional[int] = None,
2130 # Fields to sort by.
2131 sorts: Optional[str] = None,
2132 # Auth type user is locked out for (email, ldap, totp, api)
2133 auth_type: Optional[str] = None,
2134 # Match name
2135 full_name: Optional[str] = None,
2136 # Match email
2137 email: Optional[str] = None,
2138 # Match remote LDAP ID
2139 remote_id: Optional[str] = None,
2140 # Combine given search criteria in a boolean OR expression
2141 filter_or: Optional[bool] = None,
2142 transport_options: Optional[transport.TransportOptions] = None,
2143 ) -> Sequence[mdls.UserLoginLockout]:
2144 """Search User Login Lockouts"""
2145 response = cast(
2146 Sequence[mdls.UserLoginLockout],
2147 self.get(
2148 path="/user_login_lockouts/search",
2149 structure=Sequence[mdls.UserLoginLockout],
2150 query_params={
2151 "fields": fields,
2152 "page": page,
2153 "per_page": per_page,
2154 "limit": limit,
2155 "offset": offset,
2156 "sorts": sorts,
2157 "auth_type": auth_type,
2158 "full_name": full_name,
2159 "email": email,
2160 "remote_id": remote_id,
2161 "filter_or": filter_or,
2162 },
2163 transport_options=transport_options,
2164 ),
2165 )
2166 return response
2167
2168 # ### Removes login lockout for the associated user.
2169 #
2170 # DELETE /user_login_lockout/{key} -> str
2171 def delete_user_login_lockout(
2172 self,
2173 # The key associated with the locked user
2174 key: str,
2175 transport_options: Optional[transport.TransportOptions] = None,
2176 ) -> str:
2177 """Delete User Login Lockout"""
2178 key = self.encode_path_param(key)
2179 response = cast(
2180 str,
2181 self.delete(
2182 path=f"/user_login_lockout/{key}",
2183 structure=str,
2184 transport_options=transport_options,
2185 ),
2186 )
2187 return response
2188
2189 # endregion
2190
2191 # region Board: Manage Boards
2192
2193 # ### Get information about all boards.
2194 #
2195 # GET /boards -> Sequence[mdls.Board]
2196 def all_boards(
2197 self,
2198 # Requested fields.
2199 fields: Optional[str] = None,
2200 transport_options: Optional[transport.TransportOptions] = None,
2201 ) -> Sequence[mdls.Board]:
2202 """Get All Boards"""
2203 response = cast(
2204 Sequence[mdls.Board],
2205 self.get(
2206 path="/boards",
2207 structure=Sequence[mdls.Board],
2208 query_params={"fields": fields},
2209 transport_options=transport_options,
2210 ),
2211 )
2212 return response
2213
2214 # ### Create a new board.
2215 #
2216 # POST /boards -> mdls.Board
2217 def create_board(
2218 self,
2219 body: mdls.WriteBoard,
2220 # Requested fields.
2221 fields: Optional[str] = None,
2222 transport_options: Optional[transport.TransportOptions] = None,
2223 ) -> mdls.Board:
2224 """Create Board"""
2225 response = cast(
2226 mdls.Board,
2227 self.post(
2228 path="/boards",
2229 structure=mdls.Board,
2230 query_params={"fields": fields},
2231 body=body,
2232 transport_options=transport_options,
2233 ),
2234 )
2235 return response
2236
2237 # ### Search Boards
2238 #
2239 # If multiple search params are given and `filter_or` is FALSE or not specified,
2240 # search params are combined in a logical AND operation.
2241 # Only rows that match *all* search param criteria will be returned.
2242 #
2243 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
2244 # Results will include rows that match **any** of the search criteria.
2245 #
2246 # String search params use case-insensitive matching.
2247 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
2248 # example="dan%" will match "danger" and "Danzig" but not "David"
2249 # example="D_m%" will match "Damage" and "dump"
2250 #
2251 # Integer search params can accept a single value or a comma separated list of values. The multiple
2252 # values will be combined under a logical OR operation - results will match at least one of
2253 # the given values.
2254 #
2255 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
2256 # or exclude (respectively) rows where the column is null.
2257 #
2258 # Boolean search params accept only "true" and "false" as values.
2259 #
2260 # GET /boards/search -> Sequence[mdls.Board]
2261 def search_boards(
2262 self,
2263 # Matches board title.
2264 title: Optional[str] = None,
2265 # Matches the timestamp for when the board was created.
2266 created_at: Optional[str] = None,
2267 # The first name of the user who created this board.
2268 first_name: Optional[str] = None,
2269 # The last name of the user who created this board.
2270 last_name: Optional[str] = None,
2271 # Requested fields.
2272 fields: Optional[str] = None,
2273 # Return favorited boards when true.
2274 favorited: Optional[bool] = None,
2275 # Filter on boards created by a particular user.
2276 creator_id: Optional[str] = None,
2277 # The fields to sort the results by
2278 sorts: Optional[str] = None,
2279 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
2280 page: Optional[int] = None,
2281 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
2282 per_page: Optional[int] = None,
2283 # Number of results to return. (used with offset and takes priority over page and per_page)
2284 offset: Optional[int] = None,
2285 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
2286 limit: Optional[int] = None,
2287 # Combine given search criteria in a boolean OR expression
2288 filter_or: Optional[bool] = None,
2289 # Filter results based on permission, either show (default) or update
2290 permission: Optional[str] = None,
2291 transport_options: Optional[transport.TransportOptions] = None,
2292 ) -> Sequence[mdls.Board]:
2293 """Search Boards"""
2294 response = cast(
2295 Sequence[mdls.Board],
2296 self.get(
2297 path="/boards/search",
2298 structure=Sequence[mdls.Board],
2299 query_params={
2300 "title": title,
2301 "created_at": created_at,
2302 "first_name": first_name,
2303 "last_name": last_name,
2304 "fields": fields,
2305 "favorited": favorited,
2306 "creator_id": creator_id,
2307 "sorts": sorts,
2308 "page": page,
2309 "per_page": per_page,
2310 "offset": offset,
2311 "limit": limit,
2312 "filter_or": filter_or,
2313 "permission": permission,
2314 },
2315 transport_options=transport_options,
2316 ),
2317 )
2318 return response
2319
2320 # ### Get information about a board.
2321 #
2322 # GET /boards/{board_id} -> mdls.Board
2323 def board(
2324 self,
2325 # Id of board
2326 board_id: str,
2327 # Requested fields.
2328 fields: Optional[str] = None,
2329 transport_options: Optional[transport.TransportOptions] = None,
2330 ) -> mdls.Board:
2331 """Get Board"""
2332 board_id = self.encode_path_param(board_id)
2333 response = cast(
2334 mdls.Board,
2335 self.get(
2336 path=f"/boards/{board_id}",
2337 structure=mdls.Board,
2338 query_params={"fields": fields},
2339 transport_options=transport_options,
2340 ),
2341 )
2342 return response
2343
2344 # ### Update a board definition.
2345 #
2346 # PATCH /boards/{board_id} -> mdls.Board
2347 def update_board(
2348 self,
2349 # Id of board
2350 board_id: str,
2351 body: mdls.WriteBoard,
2352 # Requested fields.
2353 fields: Optional[str] = None,
2354 transport_options: Optional[transport.TransportOptions] = None,
2355 ) -> mdls.Board:
2356 """Update Board"""
2357 board_id = self.encode_path_param(board_id)
2358 response = cast(
2359 mdls.Board,
2360 self.patch(
2361 path=f"/boards/{board_id}",
2362 structure=mdls.Board,
2363 query_params={"fields": fields},
2364 body=body,
2365 transport_options=transport_options,
2366 ),
2367 )
2368 return response
2369
2370 # ### Delete a board.
2371 #
2372 # DELETE /boards/{board_id} -> str
2373 def delete_board(
2374 self,
2375 # Id of board
2376 board_id: str,
2377 transport_options: Optional[transport.TransportOptions] = None,
2378 ) -> str:
2379 """Delete Board"""
2380 board_id = self.encode_path_param(board_id)
2381 response = cast(
2382 str,
2383 self.delete(
2384 path=f"/boards/{board_id}",
2385 structure=str,
2386 transport_options=transport_options,
2387 ),
2388 )
2389 return response
2390
2391 # ### Get information about all board items.
2392 #
2393 # GET /board_items -> Sequence[mdls.BoardItem]
2394 def all_board_items(
2395 self,
2396 # Requested fields.
2397 fields: Optional[str] = None,
2398 # Fields to sort by.
2399 sorts: Optional[str] = None,
2400 # Filter to a specific board section
2401 board_section_id: Optional[str] = None,
2402 transport_options: Optional[transport.TransportOptions] = None,
2403 ) -> Sequence[mdls.BoardItem]:
2404 """Get All Board Items"""
2405 response = cast(
2406 Sequence[mdls.BoardItem],
2407 self.get(
2408 path="/board_items",
2409 structure=Sequence[mdls.BoardItem],
2410 query_params={
2411 "fields": fields,
2412 "sorts": sorts,
2413 "board_section_id": board_section_id,
2414 },
2415 transport_options=transport_options,
2416 ),
2417 )
2418 return response
2419
2420 # ### Create a new board item.
2421 #
2422 # POST /board_items -> mdls.BoardItem
2423 def create_board_item(
2424 self,
2425 body: mdls.WriteBoardItem,
2426 # Requested fields.
2427 fields: Optional[str] = None,
2428 transport_options: Optional[transport.TransportOptions] = None,
2429 ) -> mdls.BoardItem:
2430 """Create Board Item"""
2431 response = cast(
2432 mdls.BoardItem,
2433 self.post(
2434 path="/board_items",
2435 structure=mdls.BoardItem,
2436 query_params={"fields": fields},
2437 body=body,
2438 transport_options=transport_options,
2439 ),
2440 )
2441 return response
2442
2443 # ### Get information about a board item.
2444 #
2445 # GET /board_items/{board_item_id} -> mdls.BoardItem
2446 def board_item(
2447 self,
2448 # Id of board item
2449 board_item_id: str,
2450 # Requested fields.
2451 fields: Optional[str] = None,
2452 transport_options: Optional[transport.TransportOptions] = None,
2453 ) -> mdls.BoardItem:
2454 """Get Board Item"""
2455 board_item_id = self.encode_path_param(board_item_id)
2456 response = cast(
2457 mdls.BoardItem,
2458 self.get(
2459 path=f"/board_items/{board_item_id}",
2460 structure=mdls.BoardItem,
2461 query_params={"fields": fields},
2462 transport_options=transport_options,
2463 ),
2464 )
2465 return response
2466
2467 # ### Update a board item definition.
2468 #
2469 # PATCH /board_items/{board_item_id} -> mdls.BoardItem
2470 def update_board_item(
2471 self,
2472 # Id of board item
2473 board_item_id: str,
2474 body: mdls.WriteBoardItem,
2475 # Requested fields.
2476 fields: Optional[str] = None,
2477 transport_options: Optional[transport.TransportOptions] = None,
2478 ) -> mdls.BoardItem:
2479 """Update Board Item"""
2480 board_item_id = self.encode_path_param(board_item_id)
2481 response = cast(
2482 mdls.BoardItem,
2483 self.patch(
2484 path=f"/board_items/{board_item_id}",
2485 structure=mdls.BoardItem,
2486 query_params={"fields": fields},
2487 body=body,
2488 transport_options=transport_options,
2489 ),
2490 )
2491 return response
2492
2493 # ### Delete a board item.
2494 #
2495 # DELETE /board_items/{board_item_id} -> str
2496 def delete_board_item(
2497 self,
2498 # Id of board item
2499 board_item_id: str,
2500 transport_options: Optional[transport.TransportOptions] = None,
2501 ) -> str:
2502 """Delete Board Item"""
2503 board_item_id = self.encode_path_param(board_item_id)
2504 response = cast(
2505 str,
2506 self.delete(
2507 path=f"/board_items/{board_item_id}",
2508 structure=str,
2509 transport_options=transport_options,
2510 ),
2511 )
2512 return response
2513
2514 # ### Get information about all board sections.
2515 #
2516 # GET /board_sections -> Sequence[mdls.BoardSection]
2517 def all_board_sections(
2518 self,
2519 # Requested fields.
2520 fields: Optional[str] = None,
2521 # Fields to sort by.
2522 sorts: Optional[str] = None,
2523 transport_options: Optional[transport.TransportOptions] = None,
2524 ) -> Sequence[mdls.BoardSection]:
2525 """Get All Board sections"""
2526 response = cast(
2527 Sequence[mdls.BoardSection],
2528 self.get(
2529 path="/board_sections",
2530 structure=Sequence[mdls.BoardSection],
2531 query_params={"fields": fields, "sorts": sorts},
2532 transport_options=transport_options,
2533 ),
2534 )
2535 return response
2536
2537 # ### Create a new board section.
2538 #
2539 # POST /board_sections -> mdls.BoardSection
2540 def create_board_section(
2541 self,
2542 body: mdls.WriteBoardSection,
2543 # Requested fields.
2544 fields: Optional[str] = None,
2545 transport_options: Optional[transport.TransportOptions] = None,
2546 ) -> mdls.BoardSection:
2547 """Create Board section"""
2548 response = cast(
2549 mdls.BoardSection,
2550 self.post(
2551 path="/board_sections",
2552 structure=mdls.BoardSection,
2553 query_params={"fields": fields},
2554 body=body,
2555 transport_options=transport_options,
2556 ),
2557 )
2558 return response
2559
2560 # ### Get information about a board section.
2561 #
2562 # GET /board_sections/{board_section_id} -> mdls.BoardSection
2563 def board_section(
2564 self,
2565 # Id of board section
2566 board_section_id: str,
2567 # Requested fields.
2568 fields: Optional[str] = None,
2569 transport_options: Optional[transport.TransportOptions] = None,
2570 ) -> mdls.BoardSection:
2571 """Get Board section"""
2572 board_section_id = self.encode_path_param(board_section_id)
2573 response = cast(
2574 mdls.BoardSection,
2575 self.get(
2576 path=f"/board_sections/{board_section_id}",
2577 structure=mdls.BoardSection,
2578 query_params={"fields": fields},
2579 transport_options=transport_options,
2580 ),
2581 )
2582 return response
2583
2584 # ### Update a board section definition.
2585 #
2586 # PATCH /board_sections/{board_section_id} -> mdls.BoardSection
2587 def update_board_section(
2588 self,
2589 # Id of board section
2590 board_section_id: str,
2591 body: mdls.WriteBoardSection,
2592 # Requested fields.
2593 fields: Optional[str] = None,
2594 transport_options: Optional[transport.TransportOptions] = None,
2595 ) -> mdls.BoardSection:
2596 """Update Board section"""
2597 board_section_id = self.encode_path_param(board_section_id)
2598 response = cast(
2599 mdls.BoardSection,
2600 self.patch(
2601 path=f"/board_sections/{board_section_id}",
2602 structure=mdls.BoardSection,
2603 query_params={"fields": fields},
2604 body=body,
2605 transport_options=transport_options,
2606 ),
2607 )
2608 return response
2609
2610 # ### Delete a board section.
2611 #
2612 # DELETE /board_sections/{board_section_id} -> str
2613 def delete_board_section(
2614 self,
2615 # Id of board section
2616 board_section_id: str,
2617 transport_options: Optional[transport.TransportOptions] = None,
2618 ) -> str:
2619 """Delete Board section"""
2620 board_section_id = self.encode_path_param(board_section_id)
2621 response = cast(
2622 str,
2623 self.delete(
2624 path=f"/board_sections/{board_section_id}",
2625 structure=str,
2626 transport_options=transport_options,
2627 ),
2628 )
2629 return response
2630
2631 # endregion
2632
2633 # region ColorCollection: Manage Color Collections
2634
2635 # ### Get an array of all existing Color Collections
2636 # Get a **single** color collection by id with [ColorCollection](#!/ColorCollection/color_collection)
2637 #
2638 # Get all **standard** color collections with [ColorCollection](#!/ColorCollection/color_collections_standard)
2639 #
2640 # Get all **custom** color collections with [ColorCollection](#!/ColorCollection/color_collections_custom)
2641 #
2642 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2643 #
2644 # GET /color_collections -> Sequence[mdls.ColorCollection]
2645 def all_color_collections(
2646 self,
2647 # Requested fields.
2648 fields: Optional[str] = None,
2649 transport_options: Optional[transport.TransportOptions] = None,
2650 ) -> Sequence[mdls.ColorCollection]:
2651 """Get all Color Collections"""
2652 response = cast(
2653 Sequence[mdls.ColorCollection],
2654 self.get(
2655 path="/color_collections",
2656 structure=Sequence[mdls.ColorCollection],
2657 query_params={"fields": fields},
2658 transport_options=transport_options,
2659 ),
2660 )
2661 return response
2662
2663 # ### Create a custom color collection with the specified information
2664 #
2665 # Creates a new custom color collection object, returning the details, including the created id.
2666 #
2667 # **Update** an existing color collection with [Update Color Collection](#!/ColorCollection/update_color_collection)
2668 #
2669 # **Permanently delete** an existing custom color collection with [Delete Color Collection](#!/ColorCollection/delete_color_collection)
2670 #
2671 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2672 #
2673 # POST /color_collections -> mdls.ColorCollection
2674 def create_color_collection(
2675 self,
2676 body: mdls.WriteColorCollection,
2677 transport_options: Optional[transport.TransportOptions] = None,
2678 ) -> mdls.ColorCollection:
2679 """Create ColorCollection"""
2680 response = cast(
2681 mdls.ColorCollection,
2682 self.post(
2683 path="/color_collections",
2684 structure=mdls.ColorCollection,
2685 body=body,
2686 transport_options=transport_options,
2687 ),
2688 )
2689 return response
2690
2691 # ### Get an array of all existing **Custom** Color Collections
2692 # Get a **single** color collection by id with [ColorCollection](#!/ColorCollection/color_collection)
2693 #
2694 # Get all **standard** color collections with [ColorCollection](#!/ColorCollection/color_collections_standard)
2695 #
2696 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2697 #
2698 # GET /color_collections/custom -> Sequence[mdls.ColorCollection]
2699 def color_collections_custom(
2700 self,
2701 # Requested fields.
2702 fields: Optional[str] = None,
2703 transport_options: Optional[transport.TransportOptions] = None,
2704 ) -> Sequence[mdls.ColorCollection]:
2705 """Get all Custom Color Collections"""
2706 response = cast(
2707 Sequence[mdls.ColorCollection],
2708 self.get(
2709 path="/color_collections/custom",
2710 structure=Sequence[mdls.ColorCollection],
2711 query_params={"fields": fields},
2712 transport_options=transport_options,
2713 ),
2714 )
2715 return response
2716
2717 # ### Get an array of all existing **Standard** Color Collections
2718 # Get a **single** color collection by id with [ColorCollection](#!/ColorCollection/color_collection)
2719 #
2720 # Get all **custom** color collections with [ColorCollection](#!/ColorCollection/color_collections_custom)
2721 #
2722 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2723 #
2724 # GET /color_collections/standard -> Sequence[mdls.ColorCollection]
2725 def color_collections_standard(
2726 self,
2727 # Requested fields.
2728 fields: Optional[str] = None,
2729 transport_options: Optional[transport.TransportOptions] = None,
2730 ) -> Sequence[mdls.ColorCollection]:
2731 """Get all Standard Color Collections"""
2732 response = cast(
2733 Sequence[mdls.ColorCollection],
2734 self.get(
2735 path="/color_collections/standard",
2736 structure=Sequence[mdls.ColorCollection],
2737 query_params={"fields": fields},
2738 transport_options=transport_options,
2739 ),
2740 )
2741 return response
2742
2743 # ### Get the default color collection
2744 #
2745 # Use this to retrieve the default Color Collection.
2746 #
2747 # Set the default color collection with [ColorCollection](#!/ColorCollection/set_default_color_collection)
2748 #
2749 # GET /color_collections/default -> mdls.ColorCollection
2750 def default_color_collection(
2751 self,
2752 transport_options: Optional[transport.TransportOptions] = None,
2753 ) -> mdls.ColorCollection:
2754 """Get Default Color Collection"""
2755 response = cast(
2756 mdls.ColorCollection,
2757 self.get(
2758 path="/color_collections/default",
2759 structure=mdls.ColorCollection,
2760 transport_options=transport_options,
2761 ),
2762 )
2763 return response
2764
2765 # ### Set the global default Color Collection by ID
2766 #
2767 # Returns the new specified default Color Collection object.
2768 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2769 #
2770 # PUT /color_collections/default -> mdls.ColorCollection
2771 def set_default_color_collection(
2772 self,
2773 # ID of color collection to set as default
2774 collection_id: str,
2775 transport_options: Optional[transport.TransportOptions] = None,
2776 ) -> mdls.ColorCollection:
2777 """Set Default Color Collection"""
2778 response = cast(
2779 mdls.ColorCollection,
2780 self.put(
2781 path="/color_collections/default",
2782 structure=mdls.ColorCollection,
2783 query_params={"collection_id": collection_id},
2784 transport_options=transport_options,
2785 ),
2786 )
2787 return response
2788
2789 # ### Get a Color Collection by ID
2790 #
2791 # Use this to retrieve a specific Color Collection.
2792 # Get a **single** color collection by id with [ColorCollection](#!/ColorCollection/color_collection)
2793 #
2794 # Get all **standard** color collections with [ColorCollection](#!/ColorCollection/color_collections_standard)
2795 #
2796 # Get all **custom** color collections with [ColorCollection](#!/ColorCollection/color_collections_custom)
2797 #
2798 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2799 #
2800 # GET /color_collections/{collection_id} -> mdls.ColorCollection
2801 def color_collection(
2802 self,
2803 # Id of Color Collection
2804 collection_id: str,
2805 # Requested fields.
2806 fields: Optional[str] = None,
2807 transport_options: Optional[transport.TransportOptions] = None,
2808 ) -> mdls.ColorCollection:
2809 """Get Color Collection by ID"""
2810 collection_id = self.encode_path_param(collection_id)
2811 response = cast(
2812 mdls.ColorCollection,
2813 self.get(
2814 path=f"/color_collections/{collection_id}",
2815 structure=mdls.ColorCollection,
2816 query_params={"fields": fields},
2817 transport_options=transport_options,
2818 ),
2819 )
2820 return response
2821
2822 # ### Update a custom color collection by id.
2823 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2824 #
2825 # PATCH /color_collections/{collection_id} -> mdls.ColorCollection
2826 def update_color_collection(
2827 self,
2828 # Id of Custom Color Collection
2829 collection_id: str,
2830 body: mdls.WriteColorCollection,
2831 transport_options: Optional[transport.TransportOptions] = None,
2832 ) -> mdls.ColorCollection:
2833 """Update Custom Color collection"""
2834 collection_id = self.encode_path_param(collection_id)
2835 response = cast(
2836 mdls.ColorCollection,
2837 self.patch(
2838 path=f"/color_collections/{collection_id}",
2839 structure=mdls.ColorCollection,
2840 body=body,
2841 transport_options=transport_options,
2842 ),
2843 )
2844 return response
2845
2846 # ### Delete a custom color collection by id
2847 #
2848 # This operation permanently deletes the identified **Custom** color collection.
2849 #
2850 # **Standard** color collections cannot be deleted
2851 #
2852 # Because multiple color collections can have the same label, they must be deleted by ID, not name.
2853 # **Note**: Only an API user with the Admin role can call this endpoint. Unauthorized requests will return `Not Found` (404) errors.
2854 #
2855 # DELETE /color_collections/{collection_id} -> str
2856 def delete_color_collection(
2857 self,
2858 # Id of Color Collection
2859 collection_id: str,
2860 transport_options: Optional[transport.TransportOptions] = None,
2861 ) -> str:
2862 """Delete ColorCollection"""
2863 collection_id = self.encode_path_param(collection_id)
2864 response = cast(
2865 str,
2866 self.delete(
2867 path=f"/color_collections/{collection_id}",
2868 structure=str,
2869 transport_options=transport_options,
2870 ),
2871 )
2872 return response
2873
2874 # endregion
2875
2876 # region Config: Manage General Configuration
2877
2878 # Get the current Cloud Storage Configuration.
2879 #
2880 # GET /cloud_storage -> mdls.BackupConfiguration
2881 def cloud_storage_configuration(
2882 self,
2883 transport_options: Optional[transport.TransportOptions] = None,
2884 ) -> mdls.BackupConfiguration:
2885 """Get Cloud Storage"""
2886 response = cast(
2887 mdls.BackupConfiguration,
2888 self.get(
2889 path="/cloud_storage",
2890 structure=mdls.BackupConfiguration,
2891 transport_options=transport_options,
2892 ),
2893 )
2894 return response
2895
2896 # Update the current Cloud Storage Configuration.
2897 #
2898 # PATCH /cloud_storage -> mdls.BackupConfiguration
2899 def update_cloud_storage_configuration(
2900 self,
2901 body: mdls.WriteBackupConfiguration,
2902 transport_options: Optional[transport.TransportOptions] = None,
2903 ) -> mdls.BackupConfiguration:
2904 """Update Cloud Storage"""
2905 response = cast(
2906 mdls.BackupConfiguration,
2907 self.patch(
2908 path="/cloud_storage",
2909 structure=mdls.BackupConfiguration,
2910 body=body,
2911 transport_options=transport_options,
2912 ),
2913 )
2914 return response
2915
2916 # ### Get the current status and content of custom welcome emails
2917 #
2918 # GET /custom_welcome_email -> mdls.CustomWelcomeEmail
2919 def custom_welcome_email(
2920 self,
2921 transport_options: Optional[transport.TransportOptions] = None,
2922 ) -> mdls.CustomWelcomeEmail:
2923 """Get Custom Welcome Email"""
2924 response = cast(
2925 mdls.CustomWelcomeEmail,
2926 self.get(
2927 path="/custom_welcome_email",
2928 structure=mdls.CustomWelcomeEmail,
2929 transport_options=transport_options,
2930 ),
2931 )
2932 return response
2933
2934 # Update custom welcome email setting and values. Optionally send a test email with the new content to the currently logged in user.
2935 #
2936 # PATCH /custom_welcome_email -> mdls.CustomWelcomeEmail
2937 def update_custom_welcome_email(
2938 self,
2939 body: mdls.CustomWelcomeEmail,
2940 # If true a test email with the content from the request will be sent to the current user after saving
2941 send_test_welcome_email: Optional[bool] = None,
2942 transport_options: Optional[transport.TransportOptions] = None,
2943 ) -> mdls.CustomWelcomeEmail:
2944 """Update Custom Welcome Email Content"""
2945 response = cast(
2946 mdls.CustomWelcomeEmail,
2947 self.patch(
2948 path="/custom_welcome_email",
2949 structure=mdls.CustomWelcomeEmail,
2950 query_params={"send_test_welcome_email": send_test_welcome_email},
2951 body=body,
2952 transport_options=transport_options,
2953 ),
2954 )
2955 return response
2956
2957 # Requests to this endpoint will send a welcome email with the custom content provided in the body to the currently logged in user.
2958 #
2959 # PUT /custom_welcome_email_test -> mdls.WelcomeEmailTest
2960 def update_custom_welcome_email_test(
2961 self,
2962 body: mdls.WelcomeEmailTest,
2963 transport_options: Optional[transport.TransportOptions] = None,
2964 ) -> mdls.WelcomeEmailTest:
2965 """Send a test welcome email to the currently logged in user with the supplied content"""
2966 response = cast(
2967 mdls.WelcomeEmailTest,
2968 self.put(
2969 path="/custom_welcome_email_test",
2970 structure=mdls.WelcomeEmailTest,
2971 body=body,
2972 transport_options=transport_options,
2973 ),
2974 )
2975 return response
2976
2977 # ### Retrieve the value for whether or not digest emails is enabled
2978 #
2979 # GET /digest_emails_enabled -> mdls.DigestEmails
2980 def digest_emails_enabled(
2981 self,
2982 transport_options: Optional[transport.TransportOptions] = None,
2983 ) -> mdls.DigestEmails:
2984 """Get Digest_emails"""
2985 response = cast(
2986 mdls.DigestEmails,
2987 self.get(
2988 path="/digest_emails_enabled",
2989 structure=mdls.DigestEmails,
2990 transport_options=transport_options,
2991 ),
2992 )
2993 return response
2994
2995 # ### Update the setting for enabling/disabling digest emails
2996 #
2997 # PATCH /digest_emails_enabled -> mdls.DigestEmails
2998 def update_digest_emails_enabled(
2999 self,
3000 body: mdls.DigestEmails,
3001 transport_options: Optional[transport.TransportOptions] = None,
3002 ) -> mdls.DigestEmails:
3003 """Update Digest_emails"""
3004 response = cast(
3005 mdls.DigestEmails,
3006 self.patch(
3007 path="/digest_emails_enabled",
3008 structure=mdls.DigestEmails,
3009 body=body,
3010 transport_options=transport_options,
3011 ),
3012 )
3013 return response
3014
3015 # ### Trigger the generation of digest email records and send them to Looker's internal system. This does not send
3016 # any actual emails, it generates records containing content which may be of interest for users who have become inactive.
3017 # Emails will be sent at a later time from Looker's internal system if the Digest Emails feature is enabled in settings.
3018 #
3019 # POST /digest_email_send -> mdls.DigestEmailSend
3020 def create_digest_email_send(
3021 self,
3022 transport_options: Optional[transport.TransportOptions] = None,
3023 ) -> mdls.DigestEmailSend:
3024 """Deliver digest email contents"""
3025 response = cast(
3026 mdls.DigestEmailSend,
3027 self.post(
3028 path="/digest_email_send",
3029 structure=mdls.DigestEmailSend,
3030 transport_options=transport_options,
3031 ),
3032 )
3033 return response
3034
3035 # ### Get Egress IP Addresses
3036 #
3037 # Returns the list of public egress IP Addresses for a hosted customer's instance
3038 #
3039 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
3040 #
3041 # GET /public_egress_ip_addresses -> mdls.EgressIpAddresses
3042 def public_egress_ip_addresses(
3043 self,
3044 transport_options: Optional[transport.TransportOptions] = None,
3045 ) -> mdls.EgressIpAddresses:
3046 """Public Egress IP Addresses"""
3047 response = cast(
3048 mdls.EgressIpAddresses,
3049 self.get(
3050 path="/public_egress_ip_addresses",
3051 structure=mdls.EgressIpAddresses,
3052 transport_options=transport_options,
3053 ),
3054 )
3055 return response
3056
3057 # ### Set the menu item name and content for internal help resources
3058 #
3059 # GET /internal_help_resources_content -> mdls.InternalHelpResourcesContent
3060 def internal_help_resources_content(
3061 self,
3062 transport_options: Optional[transport.TransportOptions] = None,
3063 ) -> mdls.InternalHelpResourcesContent:
3064 """Get Internal Help Resources Content"""
3065 response = cast(
3066 mdls.InternalHelpResourcesContent,
3067 self.get(
3068 path="/internal_help_resources_content",
3069 structure=mdls.InternalHelpResourcesContent,
3070 transport_options=transport_options,
3071 ),
3072 )
3073 return response
3074
3075 # Update internal help resources content
3076 #
3077 # PATCH /internal_help_resources_content -> mdls.InternalHelpResourcesContent
3078 def update_internal_help_resources_content(
3079 self,
3080 body: mdls.WriteInternalHelpResourcesContent,
3081 transport_options: Optional[transport.TransportOptions] = None,
3082 ) -> mdls.InternalHelpResourcesContent:
3083 """Update internal help resources content"""
3084 response = cast(
3085 mdls.InternalHelpResourcesContent,
3086 self.patch(
3087 path="/internal_help_resources_content",
3088 structure=mdls.InternalHelpResourcesContent,
3089 body=body,
3090 transport_options=transport_options,
3091 ),
3092 )
3093 return response
3094
3095 # ### Get and set the options for internal help resources
3096 #
3097 # GET /internal_help_resources_enabled -> mdls.InternalHelpResources
3098 def internal_help_resources(
3099 self,
3100 transport_options: Optional[transport.TransportOptions] = None,
3101 ) -> mdls.InternalHelpResources:
3102 """Get Internal Help Resources"""
3103 response = cast(
3104 mdls.InternalHelpResources,
3105 self.get(
3106 path="/internal_help_resources_enabled",
3107 structure=mdls.InternalHelpResources,
3108 transport_options=transport_options,
3109 ),
3110 )
3111 return response
3112
3113 # Update internal help resources settings
3114 #
3115 # PATCH /internal_help_resources -> mdls.InternalHelpResources
3116 def update_internal_help_resources(
3117 self,
3118 body: mdls.WriteInternalHelpResources,
3119 transport_options: Optional[transport.TransportOptions] = None,
3120 ) -> mdls.InternalHelpResources:
3121 """Update internal help resources configuration"""
3122 response = cast(
3123 mdls.InternalHelpResources,
3124 self.patch(
3125 path="/internal_help_resources",
3126 structure=mdls.InternalHelpResources,
3127 body=body,
3128 transport_options=transport_options,
3129 ),
3130 )
3131 return response
3132
3133 # ### Get all legacy features.
3134 #
3135 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
3136 #
3137 # GET /legacy_features -> Sequence[mdls.LegacyFeature]
3138 def all_legacy_features(
3139 self,
3140 transport_options: Optional[transport.TransportOptions] = None,
3141 ) -> Sequence[mdls.LegacyFeature]:
3142 """Get All Legacy Features"""
3143 response = cast(
3144 Sequence[mdls.LegacyFeature],
3145 self.get(
3146 path="/legacy_features",
3147 structure=Sequence[mdls.LegacyFeature],
3148 transport_options=transport_options,
3149 ),
3150 )
3151 return response
3152
3153 # ### Get information about the legacy feature with a specific id.
3154 #
3155 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
3156 #
3157 # GET /legacy_features/{legacy_feature_id} -> mdls.LegacyFeature
3158 def legacy_feature(
3159 self,
3160 # id of legacy feature
3161 legacy_feature_id: str,
3162 transport_options: Optional[transport.TransportOptions] = None,
3163 ) -> mdls.LegacyFeature:
3164 """Get Legacy Feature"""
3165 legacy_feature_id = self.encode_path_param(legacy_feature_id)
3166 response = cast(
3167 mdls.LegacyFeature,
3168 self.get(
3169 path=f"/legacy_features/{legacy_feature_id}",
3170 structure=mdls.LegacyFeature,
3171 transport_options=transport_options,
3172 ),
3173 )
3174 return response
3175
3176 # ### Update information about the legacy feature with a specific id.
3177 #
3178 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
3179 #
3180 # PATCH /legacy_features/{legacy_feature_id} -> mdls.LegacyFeature
3181 def update_legacy_feature(
3182 self,
3183 # id of legacy feature
3184 legacy_feature_id: str,
3185 body: mdls.WriteLegacyFeature,
3186 transport_options: Optional[transport.TransportOptions] = None,
3187 ) -> mdls.LegacyFeature:
3188 """Update Legacy Feature"""
3189 legacy_feature_id = self.encode_path_param(legacy_feature_id)
3190 response = cast(
3191 mdls.LegacyFeature,
3192 self.patch(
3193 path=f"/legacy_features/{legacy_feature_id}",
3194 structure=mdls.LegacyFeature,
3195 body=body,
3196 transport_options=transport_options,
3197 ),
3198 )
3199 return response
3200
3201 # ### Get a list of locales that Looker supports.
3202 #
3203 # GET /locales -> Sequence[mdls.Locale]
3204 def all_locales(
3205 self,
3206 transport_options: Optional[transport.TransportOptions] = None,
3207 ) -> Sequence[mdls.Locale]:
3208 """Get All Locales"""
3209 response = cast(
3210 Sequence[mdls.Locale],
3211 self.get(
3212 path="/locales",
3213 structure=Sequence[mdls.Locale],
3214 transport_options=transport_options,
3215 ),
3216 )
3217 return response
3218
3219 # ### Get all mobile settings.
3220 #
3221 # GET /mobile/settings -> mdls.MobileSettings
3222 def mobile_settings(
3223 self,
3224 transport_options: Optional[transport.TransportOptions] = None,
3225 ) -> mdls.MobileSettings:
3226 """Get Mobile_Settings"""
3227 response = cast(
3228 mdls.MobileSettings,
3229 self.get(
3230 path="/mobile/settings",
3231 structure=mdls.MobileSettings,
3232 transport_options=transport_options,
3233 ),
3234 )
3235 return response
3236
3237 # ### Get Looker Settings
3238 #
3239 # Available settings are:
3240 # - allow_user_timezones
3241 # - custom_welcome_email
3242 # - data_connector_default_enabled
3243 # - dashboard_auto_refresh_restriction
3244 # - dashboard_auto_refresh_minimum_interval
3245 # - extension_framework_enabled
3246 # - extension_load_url_enabled
3247 # - instance_config
3248 # - managed_certificate_uri
3249 # - marketplace_auto_install_enabled
3250 # - marketplace_automation
3251 # - marketplace_terms_accepted
3252 # - marketplace_enabled
3253 # - marketplace_site
3254 # - onboarding_enabled
3255 # - privatelabel_configuration
3256 # - timezone
3257 # - host_url
3258 # - email_domain_allowlist
3259 # - embed_cookieless_v2
3260 # - embed_enabled
3261 # - embed_config
3262 #
3263 # GET /setting -> mdls.Setting
3264 def get_setting(
3265 self,
3266 # Requested fields
3267 fields: Optional[str] = None,
3268 transport_options: Optional[transport.TransportOptions] = None,
3269 ) -> mdls.Setting:
3270 """Get Setting"""
3271 response = cast(
3272 mdls.Setting,
3273 self.get(
3274 path="/setting",
3275 structure=mdls.Setting,
3276 query_params={"fields": fields},
3277 transport_options=transport_options,
3278 ),
3279 )
3280 return response
3281
3282 # ### Configure Looker Settings
3283 #
3284 # Available settings are:
3285 # - allow_user_timezones
3286 # - custom_welcome_email
3287 # - data_connector_default_enabled
3288 # - dashboard_auto_refresh_restriction
3289 # - dashboard_auto_refresh_minimum_interval
3290 # - extension_framework_enabled
3291 # - extension_load_url_enabled
3292 # - instance_config
3293 # - managed_certificate_uri
3294 # - marketplace_auto_install_enabled
3295 # - marketplace_automation
3296 # - marketplace_terms_accepted
3297 # - marketplace_enabled
3298 # - marketplace_site
3299 # - onboarding_enabled
3300 # - privatelabel_configuration
3301 # - timezone
3302 # - host_url
3303 # - email_domain_allowlist
3304 # - embed_cookieless_v2
3305 # - embed_enabled
3306 # - embed_config
3307 #
3308 # See the `Setting` type for more information on the specific values that can be configured.
3309 #
3310 # If a setting update is rejected, the API error payload should provide information on the cause of the rejection.
3311 #
3312 # PATCH /setting -> mdls.Setting
3313 def set_setting(
3314 self,
3315 body: mdls.WriteSetting,
3316 # Requested fields
3317 fields: Optional[str] = None,
3318 transport_options: Optional[transport.TransportOptions] = None,
3319 ) -> mdls.Setting:
3320 """Set Setting"""
3321 response = cast(
3322 mdls.Setting,
3323 self.patch(
3324 path="/setting",
3325 structure=mdls.Setting,
3326 query_params={"fields": fields},
3327 body=body,
3328 transport_options=transport_options,
3329 ),
3330 )
3331 return response
3332
3333 # ### Configure SMTP Settings
3334 # This API allows users to configure the SMTP settings on the Looker instance.
3335 # Only admin users are authorised to call this API.
3336 #
3337 # POST /smtp_settings -> None
3338 def set_smtp_settings(
3339 self,
3340 body: mdls.SmtpSettings,
3341 transport_options: Optional[transport.TransportOptions] = None,
3342 ) -> None:
3343 """Set SMTP Setting"""
3344 response = cast(
3345 None,
3346 self.post(
3347 path="/smtp_settings",
3348 structure=None,
3349 body=body,
3350 transport_options=transport_options,
3351 ),
3352 )
3353 return response
3354
3355 # ### Get current SMTP status.
3356 #
3357 # GET /smtp_status -> mdls.SmtpStatus
3358 def smtp_status(
3359 self,
3360 # Include only these fields in the response
3361 fields: Optional[str] = None,
3362 transport_options: Optional[transport.TransportOptions] = None,
3363 ) -> mdls.SmtpStatus:
3364 """Get SMTP Status"""
3365 response = cast(
3366 mdls.SmtpStatus,
3367 self.get(
3368 path="/smtp_status",
3369 structure=mdls.SmtpStatus,
3370 query_params={"fields": fields},
3371 transport_options=transport_options,
3372 ),
3373 )
3374 return response
3375
3376 # ### Get a list of timezones that Looker supports (e.g. useful for scheduling tasks).
3377 #
3378 # GET /timezones -> Sequence[mdls.Timezone]
3379 def all_timezones(
3380 self,
3381 transport_options: Optional[transport.TransportOptions] = None,
3382 ) -> Sequence[mdls.Timezone]:
3383 """Get All Timezones"""
3384 response = cast(
3385 Sequence[mdls.Timezone],
3386 self.get(
3387 path="/timezones",
3388 structure=Sequence[mdls.Timezone],
3389 transport_options=transport_options,
3390 ),
3391 )
3392 return response
3393
3394 # ### Get information about all API versions supported by this Looker instance.
3395 #
3396 # GET /versions -> mdls.ApiVersion
3397 def versions(
3398 self,
3399 # Requested fields.
3400 fields: Optional[str] = None,
3401 transport_options: Optional[transport.TransportOptions] = None,
3402 ) -> mdls.ApiVersion:
3403 """Get ApiVersion"""
3404 response = cast(
3405 mdls.ApiVersion,
3406 self.get(
3407 path="/versions",
3408 structure=mdls.ApiVersion,
3409 query_params={"fields": fields},
3410 transport_options=transport_options,
3411 ),
3412 )
3413 return response
3414
3415 # ### Get an API specification for this Looker instance.
3416 #
3417 # The specification is returned as a JSON document in Swagger 2.x format
3418 #
3419 # GET /api_spec/{api_version}/{specification} -> Any
3420 def api_spec(
3421 self,
3422 # API version
3423 api_version: str,
3424 # Specification name. Typically, this is "swagger.json"
3425 specification: str,
3426 transport_options: Optional[transport.TransportOptions] = None,
3427 ) -> Any:
3428 """Get an API specification"""
3429 api_version = self.encode_path_param(api_version)
3430 specification = self.encode_path_param(specification)
3431 response = cast(
3432 Any,
3433 self.get(
3434 path=f"/api_spec/{api_version}/{specification}",
3435 structure=Any,
3436 transport_options=transport_options,
3437 ),
3438 )
3439 return response
3440
3441 # ### This feature is enabled only by special license.
3442 #
3443 # This endpoint provides the private label configuration, which includes hiding documentation links, custom favicon uploading, etc.
3444 #
3445 # This endpoint is deprecated. [Get Setting](#!/Config/get_setting) should be used to retrieve private label settings instead
3446 #
3447 # GET /whitelabel_configuration -> mdls.WhitelabelConfiguration
3448 def whitelabel_configuration(
3449 self,
3450 # Requested fields.
3451 fields: Optional[str] = None,
3452 transport_options: Optional[transport.TransportOptions] = None,
3453 ) -> mdls.WhitelabelConfiguration:
3454 """Get Private label configuration"""
3455 response = cast(
3456 mdls.WhitelabelConfiguration,
3457 self.get(
3458 path="/whitelabel_configuration",
3459 structure=mdls.WhitelabelConfiguration,
3460 query_params={"fields": fields},
3461 transport_options=transport_options,
3462 ),
3463 )
3464 return response
3465
3466 # ### Update the private label configuration
3467 #
3468 # This endpoint is deprecated. [Set Setting](#!/Config/set_setting) should be used to update private label settings instead
3469 #
3470 # PUT /whitelabel_configuration -> mdls.WhitelabelConfiguration
3471 def update_whitelabel_configuration(
3472 self,
3473 body: mdls.WriteWhitelabelConfiguration,
3474 transport_options: Optional[transport.TransportOptions] = None,
3475 ) -> mdls.WhitelabelConfiguration:
3476 """Update Private label configuration"""
3477 response = cast(
3478 mdls.WhitelabelConfiguration,
3479 self.put(
3480 path="/whitelabel_configuration",
3481 structure=mdls.WhitelabelConfiguration,
3482 body=body,
3483 transport_options=transport_options,
3484 ),
3485 )
3486 return response
3487
3488 # endregion
3489
3490 # region Connection: Manage Database Connections
3491
3492 # ### Get information about all connections.
3493 #
3494 # GET /connections -> Sequence[mdls.DBConnection]
3495 def all_connections(
3496 self,
3497 # Requested fields.
3498 fields: Optional[str] = None,
3499 transport_options: Optional[transport.TransportOptions] = None,
3500 ) -> Sequence[mdls.DBConnection]:
3501 """Get All Connections"""
3502 response = cast(
3503 Sequence[mdls.DBConnection],
3504 self.get(
3505 path="/connections",
3506 structure=Sequence[mdls.DBConnection],
3507 query_params={"fields": fields},
3508 transport_options=transport_options,
3509 ),
3510 )
3511 return response
3512
3513 # ### Create a connection using the specified configuration.
3514 #
3515 # POST /connections -> mdls.DBConnection
3516 def create_connection(
3517 self,
3518 body: mdls.WriteDBConnection,
3519 transport_options: Optional[transport.TransportOptions] = None,
3520 ) -> mdls.DBConnection:
3521 """Create Connection"""
3522 response = cast(
3523 mdls.DBConnection,
3524 self.post(
3525 path="/connections",
3526 structure=mdls.DBConnection,
3527 body=body,
3528 transport_options=transport_options,
3529 ),
3530 )
3531 return response
3532
3533 # ### Get information about a connection.
3534 #
3535 # GET /connections/{connection_name} -> mdls.DBConnection
3536 def connection(
3537 self,
3538 # Name of connection
3539 connection_name: str,
3540 # Requested fields.
3541 fields: Optional[str] = None,
3542 transport_options: Optional[transport.TransportOptions] = None,
3543 ) -> mdls.DBConnection:
3544 """Get Connection"""
3545 connection_name = self.encode_path_param(connection_name)
3546 response = cast(
3547 mdls.DBConnection,
3548 self.get(
3549 path=f"/connections/{connection_name}",
3550 structure=mdls.DBConnection,
3551 query_params={"fields": fields},
3552 transport_options=transport_options,
3553 ),
3554 )
3555 return response
3556
3557 # ### Update a connection using the specified configuration.
3558 #
3559 # PATCH /connections/{connection_name} -> mdls.DBConnection
3560 def update_connection(
3561 self,
3562 # Name of connection
3563 connection_name: str,
3564 body: mdls.WriteDBConnection,
3565 transport_options: Optional[transport.TransportOptions] = None,
3566 ) -> mdls.DBConnection:
3567 """Update Connection"""
3568 connection_name = self.encode_path_param(connection_name)
3569 response = cast(
3570 mdls.DBConnection,
3571 self.patch(
3572 path=f"/connections/{connection_name}",
3573 structure=mdls.DBConnection,
3574 body=body,
3575 transport_options=transport_options,
3576 ),
3577 )
3578 return response
3579
3580 # ### Delete a connection.
3581 #
3582 # DELETE /connections/{connection_name} -> str
3583 def delete_connection(
3584 self,
3585 # Name of connection
3586 connection_name: str,
3587 transport_options: Optional[transport.TransportOptions] = None,
3588 ) -> str:
3589 """Delete Connection"""
3590 connection_name = self.encode_path_param(connection_name)
3591 response = cast(
3592 str,
3593 self.delete(
3594 path=f"/connections/{connection_name}",
3595 structure=str,
3596 transport_options=transport_options,
3597 ),
3598 )
3599 return response
3600
3601 # ### Delete a connection override.
3602 #
3603 # DELETE /connections/{connection_name}/connection_override/{override_context} -> str
3604 def delete_connection_override(
3605 self,
3606 # Name of connection
3607 connection_name: str,
3608 # Context of connection override
3609 override_context: str,
3610 transport_options: Optional[transport.TransportOptions] = None,
3611 ) -> str:
3612 """Delete Connection Override"""
3613 connection_name = self.encode_path_param(connection_name)
3614 override_context = self.encode_path_param(override_context)
3615 response = cast(
3616 str,
3617 self.delete(
3618 path=f"/connections/{connection_name}/connection_override/{override_context}",
3619 structure=str,
3620 transport_options=transport_options,
3621 ),
3622 )
3623 return response
3624
3625 # ### Test an existing connection.
3626 #
3627 # Note that a connection's 'dialect' property has a 'connection_tests' property that lists the
3628 # specific types of tests that the connection supports.
3629 #
3630 # This API is rate limited.
3631 #
3632 # Unsupported tests in the request will be ignored.
3633 #
3634 # PUT /connections/{connection_name}/test -> Sequence[mdls.DBConnectionTestResult]
3635 def test_connection(
3636 self,
3637 # Name of connection
3638 connection_name: str,
3639 # Array of names of tests to run
3640 tests: Optional[mdls.DelimSequence[str]] = None,
3641 transport_options: Optional[transport.TransportOptions] = None,
3642 ) -> Sequence[mdls.DBConnectionTestResult]:
3643 """Test Connection"""
3644 connection_name = self.encode_path_param(connection_name)
3645 response = cast(
3646 Sequence[mdls.DBConnectionTestResult],
3647 self.put(
3648 path=f"/connections/{connection_name}/test",
3649 structure=Sequence[mdls.DBConnectionTestResult],
3650 query_params={"tests": tests},
3651 transport_options=transport_options,
3652 ),
3653 )
3654 return response
3655
3656 # ### Test a connection configuration.
3657 #
3658 # Note that a connection's 'dialect' property has a 'connection_tests' property that lists the
3659 # specific types of tests that the connection supports.
3660 #
3661 # This API is rate limited.
3662 #
3663 # Unsupported tests in the request will be ignored.
3664 #
3665 # PUT /connections/test -> Sequence[mdls.DBConnectionTestResult]
3666 def test_connection_config(
3667 self,
3668 body: mdls.WriteDBConnection,
3669 # Array of names of tests to run
3670 tests: Optional[mdls.DelimSequence[str]] = None,
3671 transport_options: Optional[transport.TransportOptions] = None,
3672 ) -> Sequence[mdls.DBConnectionTestResult]:
3673 """Test Connection Configuration"""
3674 response = cast(
3675 Sequence[mdls.DBConnectionTestResult],
3676 self.put(
3677 path="/connections/test",
3678 structure=Sequence[mdls.DBConnectionTestResult],
3679 query_params={"tests": tests},
3680 body=body,
3681 transport_options=transport_options,
3682 ),
3683 )
3684 return response
3685
3686 # ### Get information about all dialects.
3687 #
3688 # GET /dialect_info -> Sequence[mdls.DialectInfo]
3689 def all_dialect_infos(
3690 self,
3691 # Requested fields.
3692 fields: Optional[str] = None,
3693 transport_options: Optional[transport.TransportOptions] = None,
3694 ) -> Sequence[mdls.DialectInfo]:
3695 """Get All Dialect Infos"""
3696 response = cast(
3697 Sequence[mdls.DialectInfo],
3698 self.get(
3699 path="/dialect_info",
3700 structure=Sequence[mdls.DialectInfo],
3701 query_params={"fields": fields},
3702 transport_options=transport_options,
3703 ),
3704 )
3705 return response
3706
3707 # ### Get all External OAuth Applications.
3708 #
3709 # This is an OAuth Application which Looker uses to access external systems.
3710 #
3711 # GET /external_oauth_applications -> Sequence[mdls.ExternalOauthApplication]
3712 def all_external_oauth_applications(
3713 self,
3714 # Application name
3715 name: Optional[str] = None,
3716 # Application Client ID
3717 client_id: Optional[str] = None,
3718 transport_options: Optional[transport.TransportOptions] = None,
3719 ) -> Sequence[mdls.ExternalOauthApplication]:
3720 """Get All External OAuth Applications"""
3721 response = cast(
3722 Sequence[mdls.ExternalOauthApplication],
3723 self.get(
3724 path="/external_oauth_applications",
3725 structure=Sequence[mdls.ExternalOauthApplication],
3726 query_params={"name": name, "client_id": client_id},
3727 transport_options=transport_options,
3728 ),
3729 )
3730 return response
3731
3732 # ### Create an OAuth Application using the specified configuration.
3733 #
3734 # This is an OAuth Application which Looker uses to access external systems.
3735 #
3736 # POST /external_oauth_applications -> mdls.ExternalOauthApplication
3737 def create_external_oauth_application(
3738 self,
3739 body: mdls.WriteExternalOauthApplication,
3740 transport_options: Optional[transport.TransportOptions] = None,
3741 ) -> mdls.ExternalOauthApplication:
3742 """Create External OAuth Application"""
3743 response = cast(
3744 mdls.ExternalOauthApplication,
3745 self.post(
3746 path="/external_oauth_applications",
3747 structure=mdls.ExternalOauthApplication,
3748 body=body,
3749 transport_options=transport_options,
3750 ),
3751 )
3752 return response
3753
3754 # ### Update an OAuth Application's client secret.
3755 #
3756 # This is an OAuth Application which Looker uses to access external systems.
3757 #
3758 # PATCH /external_oauth_applications/{client_id} -> mdls.ExternalOauthApplication
3759 def update_external_oauth_application(
3760 self,
3761 # The client ID of the OAuth App to update
3762 client_id: str,
3763 body: mdls.WriteExternalOauthApplication,
3764 transport_options: Optional[transport.TransportOptions] = None,
3765 ) -> mdls.ExternalOauthApplication:
3766 """Update External OAuth Application"""
3767 client_id = self.encode_path_param(client_id)
3768 response = cast(
3769 mdls.ExternalOauthApplication,
3770 self.patch(
3771 path=f"/external_oauth_applications/{client_id}",
3772 structure=mdls.ExternalOauthApplication,
3773 body=body,
3774 transport_options=transport_options,
3775 ),
3776 )
3777 return response
3778
3779 # ### Create OAuth User state.
3780 #
3781 # POST /external_oauth_applications/user_state -> mdls.CreateOAuthApplicationUserStateResponse
3782 def create_oauth_application_user_state(
3783 self,
3784 body: mdls.CreateOAuthApplicationUserStateRequest,
3785 transport_options: Optional[transport.TransportOptions] = None,
3786 ) -> mdls.CreateOAuthApplicationUserStateResponse:
3787 """Create Create OAuth user state."""
3788 response = cast(
3789 mdls.CreateOAuthApplicationUserStateResponse,
3790 self.post(
3791 path="/external_oauth_applications/user_state",
3792 structure=mdls.CreateOAuthApplicationUserStateResponse,
3793 body=body,
3794 transport_options=transport_options,
3795 ),
3796 )
3797 return response
3798
3799 # ### Get information about all SSH Servers.
3800 #
3801 # GET /ssh_servers -> Sequence[mdls.SshServer]
3802 def all_ssh_servers(
3803 self,
3804 # Requested fields.
3805 fields: Optional[str] = None,
3806 transport_options: Optional[transport.TransportOptions] = None,
3807 ) -> Sequence[mdls.SshServer]:
3808 """Get All SSH Servers"""
3809 response = cast(
3810 Sequence[mdls.SshServer],
3811 self.get(
3812 path="/ssh_servers",
3813 structure=Sequence[mdls.SshServer],
3814 query_params={"fields": fields},
3815 transport_options=transport_options,
3816 ),
3817 )
3818 return response
3819
3820 # ### Create an SSH Server.
3821 #
3822 # POST /ssh_servers -> mdls.SshServer
3823 def create_ssh_server(
3824 self,
3825 body: mdls.WriteSshServer,
3826 transport_options: Optional[transport.TransportOptions] = None,
3827 ) -> mdls.SshServer:
3828 """Create SSH Server"""
3829 response = cast(
3830 mdls.SshServer,
3831 self.post(
3832 path="/ssh_servers",
3833 structure=mdls.SshServer,
3834 body=body,
3835 transport_options=transport_options,
3836 ),
3837 )
3838 return response
3839
3840 # ### Get information about an SSH Server.
3841 #
3842 # GET /ssh_server/{ssh_server_id} -> mdls.SshServer
3843 def ssh_server(
3844 self,
3845 # Id of SSH Server
3846 ssh_server_id: str,
3847 transport_options: Optional[transport.TransportOptions] = None,
3848 ) -> mdls.SshServer:
3849 """Get SSH Server"""
3850 ssh_server_id = self.encode_path_param(ssh_server_id)
3851 response = cast(
3852 mdls.SshServer,
3853 self.get(
3854 path=f"/ssh_server/{ssh_server_id}",
3855 structure=mdls.SshServer,
3856 transport_options=transport_options,
3857 ),
3858 )
3859 return response
3860
3861 # ### Update an SSH Server.
3862 #
3863 # PATCH /ssh_server/{ssh_server_id} -> mdls.SshServer
3864 def update_ssh_server(
3865 self,
3866 # Id of SSH Server
3867 ssh_server_id: str,
3868 body: mdls.WriteSshServer,
3869 transport_options: Optional[transport.TransportOptions] = None,
3870 ) -> mdls.SshServer:
3871 """Update SSH Server"""
3872 ssh_server_id = self.encode_path_param(ssh_server_id)
3873 response = cast(
3874 mdls.SshServer,
3875 self.patch(
3876 path=f"/ssh_server/{ssh_server_id}",
3877 structure=mdls.SshServer,
3878 body=body,
3879 transport_options=transport_options,
3880 ),
3881 )
3882 return response
3883
3884 # ### Delete an SSH Server.
3885 #
3886 # DELETE /ssh_server/{ssh_server_id} -> str
3887 def delete_ssh_server(
3888 self,
3889 # Id of SSH Server
3890 ssh_server_id: str,
3891 transport_options: Optional[transport.TransportOptions] = None,
3892 ) -> str:
3893 """Delete SSH Server"""
3894 ssh_server_id = self.encode_path_param(ssh_server_id)
3895 response = cast(
3896 str,
3897 self.delete(
3898 path=f"/ssh_server/{ssh_server_id}",
3899 structure=str,
3900 transport_options=transport_options,
3901 ),
3902 )
3903 return response
3904
3905 # ### Test the SSH Server
3906 #
3907 # GET /ssh_server/{ssh_server_id}/test -> mdls.SshServer
3908 def test_ssh_server(
3909 self,
3910 # Id of SSH Server
3911 ssh_server_id: str,
3912 transport_options: Optional[transport.TransportOptions] = None,
3913 ) -> mdls.SshServer:
3914 """Test SSH Server"""
3915 ssh_server_id = self.encode_path_param(ssh_server_id)
3916 response = cast(
3917 mdls.SshServer,
3918 self.get(
3919 path=f"/ssh_server/{ssh_server_id}/test",
3920 structure=mdls.SshServer,
3921 transport_options=transport_options,
3922 ),
3923 )
3924 return response
3925
3926 # ### Get information about all SSH Tunnels.
3927 #
3928 # GET /ssh_tunnels -> Sequence[mdls.SshTunnel]
3929 def all_ssh_tunnels(
3930 self,
3931 # Requested fields.
3932 fields: Optional[str] = None,
3933 transport_options: Optional[transport.TransportOptions] = None,
3934 ) -> Sequence[mdls.SshTunnel]:
3935 """Get All SSH Tunnels"""
3936 response = cast(
3937 Sequence[mdls.SshTunnel],
3938 self.get(
3939 path="/ssh_tunnels",
3940 structure=Sequence[mdls.SshTunnel],
3941 query_params={"fields": fields},
3942 transport_options=transport_options,
3943 ),
3944 )
3945 return response
3946
3947 # ### Create an SSH Tunnel
3948 #
3949 # POST /ssh_tunnels -> mdls.SshTunnel
3950 def create_ssh_tunnel(
3951 self,
3952 body: mdls.WriteSshTunnel,
3953 transport_options: Optional[transport.TransportOptions] = None,
3954 ) -> mdls.SshTunnel:
3955 """Create SSH Tunnel"""
3956 response = cast(
3957 mdls.SshTunnel,
3958 self.post(
3959 path="/ssh_tunnels",
3960 structure=mdls.SshTunnel,
3961 body=body,
3962 transport_options=transport_options,
3963 ),
3964 )
3965 return response
3966
3967 # ### Get information about an SSH Tunnel.
3968 #
3969 # GET /ssh_tunnel/{ssh_tunnel_id} -> mdls.SshTunnel
3970 def ssh_tunnel(
3971 self,
3972 # Id of SSH Tunnel
3973 ssh_tunnel_id: str,
3974 transport_options: Optional[transport.TransportOptions] = None,
3975 ) -> mdls.SshTunnel:
3976 """Get SSH Tunnel"""
3977 ssh_tunnel_id = self.encode_path_param(ssh_tunnel_id)
3978 response = cast(
3979 mdls.SshTunnel,
3980 self.get(
3981 path=f"/ssh_tunnel/{ssh_tunnel_id}",
3982 structure=mdls.SshTunnel,
3983 transport_options=transport_options,
3984 ),
3985 )
3986 return response
3987
3988 # ### Update an SSH Tunnel
3989 #
3990 # PATCH /ssh_tunnel/{ssh_tunnel_id} -> mdls.SshTunnel
3991 def update_ssh_tunnel(
3992 self,
3993 # Id of SSH Tunnel
3994 ssh_tunnel_id: str,
3995 body: mdls.WriteSshTunnel,
3996 transport_options: Optional[transport.TransportOptions] = None,
3997 ) -> mdls.SshTunnel:
3998 """Update SSH Tunnel"""
3999 ssh_tunnel_id = self.encode_path_param(ssh_tunnel_id)
4000 response = cast(
4001 mdls.SshTunnel,
4002 self.patch(
4003 path=f"/ssh_tunnel/{ssh_tunnel_id}",
4004 structure=mdls.SshTunnel,
4005 body=body,
4006 transport_options=transport_options,
4007 ),
4008 )
4009 return response
4010
4011 # ### Delete an SSH Tunnel
4012 #
4013 # DELETE /ssh_tunnel/{ssh_tunnel_id} -> str
4014 def delete_ssh_tunnel(
4015 self,
4016 # Id of SSH Tunnel
4017 ssh_tunnel_id: str,
4018 transport_options: Optional[transport.TransportOptions] = None,
4019 ) -> str:
4020 """Delete SSH Tunnel"""
4021 ssh_tunnel_id = self.encode_path_param(ssh_tunnel_id)
4022 response = cast(
4023 str,
4024 self.delete(
4025 path=f"/ssh_tunnel/{ssh_tunnel_id}",
4026 structure=str,
4027 transport_options=transport_options,
4028 ),
4029 )
4030 return response
4031
4032 # ### Test the SSH Tunnel
4033 #
4034 # GET /ssh_tunnel/{ssh_tunnel_id}/test -> mdls.SshTunnel
4035 def test_ssh_tunnel(
4036 self,
4037 # Id of SSH Tunnel
4038 ssh_tunnel_id: str,
4039 transport_options: Optional[transport.TransportOptions] = None,
4040 ) -> mdls.SshTunnel:
4041 """Test SSH Tunnel"""
4042 ssh_tunnel_id = self.encode_path_param(ssh_tunnel_id)
4043 response = cast(
4044 mdls.SshTunnel,
4045 self.get(
4046 path=f"/ssh_tunnel/{ssh_tunnel_id}/test",
4047 structure=mdls.SshTunnel,
4048 transport_options=transport_options,
4049 ),
4050 )
4051 return response
4052
4053 # ### Get the SSH public key
4054 #
4055 # Get the public key created for this instance to identify itself to a remote SSH server.
4056 #
4057 # GET /ssh_public_key -> mdls.SshPublicKey
4058 def ssh_public_key(
4059 self,
4060 transport_options: Optional[transport.TransportOptions] = None,
4061 ) -> mdls.SshPublicKey:
4062 """Get SSH Public Key"""
4063 response = cast(
4064 mdls.SshPublicKey,
4065 self.get(
4066 path="/ssh_public_key",
4067 structure=mdls.SshPublicKey,
4068 transport_options=transport_options,
4069 ),
4070 )
4071 return response
4072
4073 # endregion
4074
4075 # region Content: Manage Content
4076
4077 # ### Search Favorite Content
4078 #
4079 # If multiple search params are given and `filter_or` is FALSE or not specified,
4080 # search params are combined in a logical AND operation.
4081 # Only rows that match *all* search param criteria will be returned.
4082 #
4083 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
4084 # Results will include rows that match **any** of the search criteria.
4085 #
4086 # String search params use case-insensitive matching.
4087 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
4088 # example="dan%" will match "danger" and "Danzig" but not "David"
4089 # example="D_m%" will match "Damage" and "dump"
4090 #
4091 # Integer search params can accept a single value or a comma separated list of values. The multiple
4092 # values will be combined under a logical OR operation - results will match at least one of
4093 # the given values.
4094 #
4095 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
4096 # or exclude (respectively) rows where the column is null.
4097 #
4098 # Boolean search params accept only "true" and "false" as values.
4099 #
4100 # GET /content_favorite/search -> Sequence[mdls.ContentFavorite]
4101 def search_content_favorites(
4102 self,
4103 # Match content favorite id(s)
4104 id: Optional[str] = None,
4105 # Match user id(s).To create a list of multiple ids, use commas as separators
4106 user_id: Optional[str] = None,
4107 # Match content metadata id(s).To create a list of multiple ids, use commas as separators
4108 content_metadata_id: Optional[str] = None,
4109 # Match dashboard id(s).To create a list of multiple ids, use commas as separators
4110 dashboard_id: Optional[str] = None,
4111 # Match look id(s).To create a list of multiple ids, use commas as separators
4112 look_id: Optional[str] = None,
4113 # Match board id(s).To create a list of multiple ids, use commas as separators
4114 board_id: Optional[str] = None,
4115 # Number of results to return. (used with offset)
4116 limit: Optional[int] = None,
4117 # Number of results to skip before returning any. (used with limit)
4118 offset: Optional[int] = None,
4119 # Fields to sort by.
4120 sorts: Optional[str] = None,
4121 # Requested fields.
4122 fields: Optional[str] = None,
4123 # Combine given search criteria in a boolean OR expression
4124 filter_or: Optional[bool] = None,
4125 transport_options: Optional[transport.TransportOptions] = None,
4126 ) -> Sequence[mdls.ContentFavorite]:
4127 """Search Favorite Contents"""
4128 response = cast(
4129 Sequence[mdls.ContentFavorite],
4130 self.get(
4131 path="/content_favorite/search",
4132 structure=Sequence[mdls.ContentFavorite],
4133 query_params={
4134 "id": id,
4135 "user_id": user_id,
4136 "content_metadata_id": content_metadata_id,
4137 "dashboard_id": dashboard_id,
4138 "look_id": look_id,
4139 "board_id": board_id,
4140 "limit": limit,
4141 "offset": offset,
4142 "sorts": sorts,
4143 "fields": fields,
4144 "filter_or": filter_or,
4145 },
4146 transport_options=transport_options,
4147 ),
4148 )
4149 return response
4150
4151 # ### Get favorite content by its id
4152 #
4153 # GET /content_favorite/{content_favorite_id} -> mdls.ContentFavorite
4154 def content_favorite(
4155 self,
4156 # Id of favorite content
4157 content_favorite_id: str,
4158 # Requested fields.
4159 fields: Optional[str] = None,
4160 transport_options: Optional[transport.TransportOptions] = None,
4161 ) -> mdls.ContentFavorite:
4162 """Get Favorite Content"""
4163 content_favorite_id = self.encode_path_param(content_favorite_id)
4164 response = cast(
4165 mdls.ContentFavorite,
4166 self.get(
4167 path=f"/content_favorite/{content_favorite_id}",
4168 structure=mdls.ContentFavorite,
4169 query_params={"fields": fields},
4170 transport_options=transport_options,
4171 ),
4172 )
4173 return response
4174
4175 # ### Delete favorite content
4176 #
4177 # DELETE /content_favorite/{content_favorite_id} -> str
4178 def delete_content_favorite(
4179 self,
4180 # Id of favorite content
4181 content_favorite_id: str,
4182 transport_options: Optional[transport.TransportOptions] = None,
4183 ) -> str:
4184 """Delete Favorite Content"""
4185 content_favorite_id = self.encode_path_param(content_favorite_id)
4186 response = cast(
4187 str,
4188 self.delete(
4189 path=f"/content_favorite/{content_favorite_id}",
4190 structure=str,
4191 transport_options=transport_options,
4192 ),
4193 )
4194 return response
4195
4196 # ### Create favorite content
4197 #
4198 # POST /content_favorite -> mdls.ContentFavorite
4199 def create_content_favorite(
4200 self,
4201 body: mdls.WriteContentFavorite,
4202 transport_options: Optional[transport.TransportOptions] = None,
4203 ) -> mdls.ContentFavorite:
4204 """Create Favorite Content"""
4205 response = cast(
4206 mdls.ContentFavorite,
4207 self.post(
4208 path="/content_favorite",
4209 structure=mdls.ContentFavorite,
4210 body=body,
4211 transport_options=transport_options,
4212 ),
4213 )
4214 return response
4215
4216 # ### Get information about all content metadata in a space.
4217 #
4218 # GET /content_metadata -> Sequence[mdls.ContentMeta]
4219 def all_content_metadatas(
4220 self,
4221 # Parent space of content.
4222 parent_id: str,
4223 # Requested fields.
4224 fields: Optional[str] = None,
4225 transport_options: Optional[transport.TransportOptions] = None,
4226 ) -> Sequence[mdls.ContentMeta]:
4227 """Get All Content Metadatas"""
4228 response = cast(
4229 Sequence[mdls.ContentMeta],
4230 self.get(
4231 path="/content_metadata",
4232 structure=Sequence[mdls.ContentMeta],
4233 query_params={"parent_id": parent_id, "fields": fields},
4234 transport_options=transport_options,
4235 ),
4236 )
4237 return response
4238
4239 # ### Get information about an individual content metadata record.
4240 #
4241 # GET /content_metadata/{content_metadata_id} -> mdls.ContentMeta
4242 def content_metadata(
4243 self,
4244 # Id of content metadata
4245 content_metadata_id: str,
4246 # Requested fields.
4247 fields: Optional[str] = None,
4248 transport_options: Optional[transport.TransportOptions] = None,
4249 ) -> mdls.ContentMeta:
4250 """Get Content Metadata"""
4251 content_metadata_id = self.encode_path_param(content_metadata_id)
4252 response = cast(
4253 mdls.ContentMeta,
4254 self.get(
4255 path=f"/content_metadata/{content_metadata_id}",
4256 structure=mdls.ContentMeta,
4257 query_params={"fields": fields},
4258 transport_options=transport_options,
4259 ),
4260 )
4261 return response
4262
4263 # ### Move a piece of content.
4264 #
4265 # PATCH /content_metadata/{content_metadata_id} -> mdls.ContentMeta
4266 def update_content_metadata(
4267 self,
4268 # Id of content metadata
4269 content_metadata_id: str,
4270 body: mdls.WriteContentMeta,
4271 transport_options: Optional[transport.TransportOptions] = None,
4272 ) -> mdls.ContentMeta:
4273 """Update Content Metadata"""
4274 content_metadata_id = self.encode_path_param(content_metadata_id)
4275 response = cast(
4276 mdls.ContentMeta,
4277 self.patch(
4278 path=f"/content_metadata/{content_metadata_id}",
4279 structure=mdls.ContentMeta,
4280 body=body,
4281 transport_options=transport_options,
4282 ),
4283 )
4284 return response
4285
4286 # ### All content metadata access records for a content metadata item.
4287 #
4288 # GET /content_metadata_access -> Sequence[mdls.ContentMetaGroupUser]
4289 def all_content_metadata_accesses(
4290 self,
4291 # Id of content metadata
4292 content_metadata_id: str,
4293 # Requested fields.
4294 fields: Optional[str] = None,
4295 transport_options: Optional[transport.TransportOptions] = None,
4296 ) -> Sequence[mdls.ContentMetaGroupUser]:
4297 """Get All Content Metadata Accesses"""
4298 response = cast(
4299 Sequence[mdls.ContentMetaGroupUser],
4300 self.get(
4301 path="/content_metadata_access",
4302 structure=Sequence[mdls.ContentMetaGroupUser],
4303 query_params={
4304 "content_metadata_id": content_metadata_id,
4305 "fields": fields,
4306 },
4307 transport_options=transport_options,
4308 ),
4309 )
4310 return response
4311
4312 # ### Create content metadata access.
4313 #
4314 # POST /content_metadata_access -> mdls.ContentMetaGroupUser
4315 def create_content_metadata_access(
4316 self,
4317 # WARNING: no writeable properties found for POST, PUT, or PATCH
4318 body: mdls.ContentMetaGroupUser,
4319 # Optionally sends notification email when granting access to a board.
4320 send_boards_notification_email: Optional[bool] = None,
4321 transport_options: Optional[transport.TransportOptions] = None,
4322 ) -> mdls.ContentMetaGroupUser:
4323 """Create Content Metadata Access"""
4324 response = cast(
4325 mdls.ContentMetaGroupUser,
4326 self.post(
4327 path="/content_metadata_access",
4328 structure=mdls.ContentMetaGroupUser,
4329 query_params={
4330 "send_boards_notification_email": send_boards_notification_email
4331 },
4332 body=body,
4333 transport_options=transport_options,
4334 ),
4335 )
4336 return response
4337
4338 # ### Update type of access for content metadata.
4339 #
4340 # PUT /content_metadata_access/{content_metadata_access_id} -> mdls.ContentMetaGroupUser
4341 def update_content_metadata_access(
4342 self,
4343 # Id of content metadata access
4344 content_metadata_access_id: str,
4345 # WARNING: no writeable properties found for POST, PUT, or PATCH
4346 body: mdls.ContentMetaGroupUser,
4347 transport_options: Optional[transport.TransportOptions] = None,
4348 ) -> mdls.ContentMetaGroupUser:
4349 """Update Content Metadata Access"""
4350 content_metadata_access_id = self.encode_path_param(content_metadata_access_id)
4351 response = cast(
4352 mdls.ContentMetaGroupUser,
4353 self.put(
4354 path=f"/content_metadata_access/{content_metadata_access_id}",
4355 structure=mdls.ContentMetaGroupUser,
4356 body=body,
4357 transport_options=transport_options,
4358 ),
4359 )
4360 return response
4361
4362 # ### Remove content metadata access.
4363 #
4364 # DELETE /content_metadata_access/{content_metadata_access_id} -> str
4365 def delete_content_metadata_access(
4366 self,
4367 # Id of content metadata access
4368 content_metadata_access_id: str,
4369 transport_options: Optional[transport.TransportOptions] = None,
4370 ) -> str:
4371 """Delete Content Metadata Access"""
4372 content_metadata_access_id = self.encode_path_param(content_metadata_access_id)
4373 response = cast(
4374 str,
4375 self.delete(
4376 path=f"/content_metadata_access/{content_metadata_access_id}",
4377 structure=str,
4378 transport_options=transport_options,
4379 ),
4380 )
4381 return response
4382
4383 # ### Search across looks, dashboards, and lookml dashboards. The terms field will be matched against the
4384 # title and description of the content and the closest results are returned. Content that has been frequently
4385 # viewed and those pieces of content stored in public folders will be ranked more highly in the results.
4386 #
4387 # This endpoint does not return a full description of these content types. For more specific information
4388 # about each type please refer to the individual content specific API endpoints.
4389 #
4390 # Get the **full details** of a specific dashboard (or lookml dashboard) by id with [dashboard()](#!/Dashboard/dashboard)
4391 # Get the **full details** of a specific look by id with [look()](#!/Look/look)
4392 #
4393 # GET /content/{terms} -> Sequence[mdls.ContentSearch]
4394 def search_content(
4395 self,
4396 # Search terms
4397 terms: str,
4398 # Requested fields.
4399 fields: Optional[str] = None,
4400 # Content types requested (dashboard, look, lookml_dashboard).
4401 types: Optional[str] = None,
4402 # Number of results to return. (used with offset and takes priority over page and per_page)
4403 limit: Optional[int] = None,
4404 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
4405 offset: Optional[int] = None,
4406 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
4407 page: Optional[int] = None,
4408 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
4409 per_page: Optional[int] = None,
4410 transport_options: Optional[transport.TransportOptions] = None,
4411 ) -> Sequence[mdls.ContentSearch]:
4412 """Search Content"""
4413 terms = self.encode_path_param(terms)
4414 response = cast(
4415 Sequence[mdls.ContentSearch],
4416 self.get(
4417 path=f"/content/{terms}",
4418 structure=Sequence[mdls.ContentSearch],
4419 query_params={
4420 "fields": fields,
4421 "types": types,
4422 "limit": limit,
4423 "offset": offset,
4424 "page": page,
4425 "per_page": per_page,
4426 },
4427 transport_options=transport_options,
4428 ),
4429 )
4430 return response
4431
4432 # ### Get Content Summary
4433 #
4434 # Retrieves a collection of content items related to user activity and engagement, such as recently viewed content,
4435 # favorites and scheduled items.
4436 #
4437 # GET /content_summary -> Sequence[mdls.ContentSummary]
4438 def content_summary(
4439 self,
4440 # Comma-delimited names of fields to return in responses. Omit for all fields
4441 fields: Optional[str] = None,
4442 # Number of results to return. (used with offset)
4443 limit: Optional[int] = None,
4444 # Number of results to skip before returning any. (used with limit)
4445 offset: Optional[int] = None,
4446 # Match group id
4447 target_group_id: Optional[str] = None,
4448 # Match user id
4449 target_user_id: Optional[str] = None,
4450 # Content type to match, options are: look, dashboard. Can be provided as a comma delimited list.
4451 target_content_type: Optional[str] = None,
4452 # Fields to sort by
4453 sorts: Optional[str] = None,
4454 transport_options: Optional[transport.TransportOptions] = None,
4455 ) -> Sequence[mdls.ContentSummary]:
4456 """Search Content Summaries"""
4457 response = cast(
4458 Sequence[mdls.ContentSummary],
4459 self.get(
4460 path="/content_summary",
4461 structure=Sequence[mdls.ContentSummary],
4462 query_params={
4463 "fields": fields,
4464 "limit": limit,
4465 "offset": offset,
4466 "target_group_id": target_group_id,
4467 "target_user_id": target_user_id,
4468 "target_content_type": target_content_type,
4469 "sorts": sorts,
4470 },
4471 transport_options=transport_options,
4472 ),
4473 )
4474 return response
4475
4476 # ### Get an image representing the contents of a dashboard or look.
4477 #
4478 # The returned thumbnail is an abstract representation of the contents of a dashboard or look and does not
4479 # reflect the actual data displayed in the respective visualizations.
4480 #
4481 # GET /content_thumbnail/{type}/{resource_id} -> Union[str, bytes]
4482 def content_thumbnail(
4483 self,
4484 # Either dashboard or look
4485 type: str,
4486 # ID of the dashboard or look to render
4487 resource_id: str,
4488 # Whether or not to refresh the rendered image with the latest content
4489 reload: Optional[str] = None,
4490 # Light or dark background. Default is "light"
4491 theme: Optional[str] = None,
4492 # A value of png produces a thumbnail in PNG format instead of SVG (default)
4493 format: Optional[str] = None,
4494 # The width of the image if format is supplied
4495 width: Optional[int] = None,
4496 # The height of the image if format is supplied
4497 height: Optional[int] = None,
4498 transport_options: Optional[transport.TransportOptions] = None,
4499 ) -> Union[str, bytes]:
4500 """Get Content Thumbnail"""
4501 type = self.encode_path_param(type)
4502 resource_id = self.encode_path_param(resource_id)
4503 response = cast(
4504 Union[str, bytes],
4505 self.get(
4506 path=f"/content_thumbnail/{type}/{resource_id}",
4507 structure=Union[str, bytes], # type: ignore
4508 query_params={
4509 "reload": reload,
4510 "theme": theme,
4511 "format": format,
4512 "width": width,
4513 "height": height,
4514 },
4515 transport_options=transport_options,
4516 ),
4517 )
4518 return response
4519
4520 # ### Validate All Content
4521 #
4522 # Performs validation of all looks and dashboards
4523 # Returns a list of errors found as well as metadata about the content validation run.
4524 #
4525 # GET /content_validation -> mdls.ContentValidation
4526 def content_validation(
4527 self,
4528 # Requested fields.
4529 fields: Optional[str] = None,
4530 # Optional list of project names to filter by
4531 project_names: Optional[mdls.DelimSequence[str]] = None,
4532 # Optional list of space ids to filter by
4533 space_ids: Optional[mdls.DelimSequence[str]] = None,
4534 transport_options: Optional[transport.TransportOptions] = None,
4535 ) -> mdls.ContentValidation:
4536 """Validate Content"""
4537 response = cast(
4538 mdls.ContentValidation,
4539 self.get(
4540 path="/content_validation",
4541 structure=mdls.ContentValidation,
4542 query_params={
4543 "fields": fields,
4544 "project_names": project_names,
4545 "space_ids": space_ids,
4546 },
4547 transport_options=transport_options,
4548 ),
4549 )
4550 return response
4551
4552 # ### Search Content Views
4553 #
4554 # If multiple search params are given and `filter_or` is FALSE or not specified,
4555 # search params are combined in a logical AND operation.
4556 # Only rows that match *all* search param criteria will be returned.
4557 #
4558 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
4559 # Results will include rows that match **any** of the search criteria.
4560 #
4561 # String search params use case-insensitive matching.
4562 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
4563 # example="dan%" will match "danger" and "Danzig" but not "David"
4564 # example="D_m%" will match "Damage" and "dump"
4565 #
4566 # Integer search params can accept a single value or a comma separated list of values. The multiple
4567 # values will be combined under a logical OR operation - results will match at least one of
4568 # the given values.
4569 #
4570 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
4571 # or exclude (respectively) rows where the column is null.
4572 #
4573 # Boolean search params accept only "true" and "false" as values.
4574 #
4575 # GET /content_view/search -> Sequence[mdls.ContentView]
4576 def search_content_views(
4577 self,
4578 # Match view count
4579 view_count: Optional[str] = None,
4580 # Match Group Id
4581 group_id: Optional[str] = None,
4582 # Match look_id
4583 look_id: Optional[str] = None,
4584 # Match dashboard_id
4585 dashboard_id: Optional[str] = None,
4586 # Match content metadata id
4587 content_metadata_id: Optional[str] = None,
4588 # Match start of week date (format is "YYYY-MM-DD")
4589 start_of_week_date: Optional[str] = None,
4590 # True if only all time view records should be returned
4591 all_time: Optional[bool] = None,
4592 # Match user id
4593 user_id: Optional[str] = None,
4594 # Requested fields
4595 fields: Optional[str] = None,
4596 # Number of results to return. Use with `offset` to manage pagination of results
4597 limit: Optional[int] = None,
4598 # Number of results to skip before returning data
4599 offset: Optional[int] = None,
4600 # Fields to sort by
4601 sorts: Optional[str] = None,
4602 # Combine given search criteria in a boolean OR expression
4603 filter_or: Optional[bool] = None,
4604 transport_options: Optional[transport.TransportOptions] = None,
4605 ) -> Sequence[mdls.ContentView]:
4606 """Search Content Views"""
4607 response = cast(
4608 Sequence[mdls.ContentView],
4609 self.get(
4610 path="/content_view/search",
4611 structure=Sequence[mdls.ContentView],
4612 query_params={
4613 "view_count": view_count,
4614 "group_id": group_id,
4615 "look_id": look_id,
4616 "dashboard_id": dashboard_id,
4617 "content_metadata_id": content_metadata_id,
4618 "start_of_week_date": start_of_week_date,
4619 "all_time": all_time,
4620 "user_id": user_id,
4621 "fields": fields,
4622 "limit": limit,
4623 "offset": offset,
4624 "sorts": sorts,
4625 "filter_or": filter_or,
4626 },
4627 transport_options=transport_options,
4628 ),
4629 )
4630 return response
4631
4632 # ### Get a vector image representing the contents of a dashboard or look.
4633 #
4634 # # DEPRECATED: Use [content_thumbnail()](#!/Content/content_thumbnail)
4635 #
4636 # The returned thumbnail is an abstract representation of the contents of a dashboard or look and does not
4637 # reflect the actual data displayed in the respective visualizations.
4638 #
4639 # GET /vector_thumbnail/{type}/{resource_id} -> str
4640 def vector_thumbnail(
4641 self,
4642 # Either dashboard or look
4643 type: str,
4644 # ID of the dashboard or look to render
4645 resource_id: str,
4646 # Whether or not to refresh the rendered image with the latest content
4647 reload: Optional[str] = None,
4648 transport_options: Optional[transport.TransportOptions] = None,
4649 ) -> str:
4650 """Get Vector Thumbnail"""
4651 type = self.encode_path_param(type)
4652 resource_id = self.encode_path_param(resource_id)
4653 response = cast(
4654 str,
4655 self.get(
4656 path=f"/vector_thumbnail/{type}/{resource_id}",
4657 structure=str,
4658 query_params={"reload": reload},
4659 transport_options=transport_options,
4660 ),
4661 )
4662 return response
4663
4664 # endregion
4665
4666 # region Dashboard: Manage Dashboards
4667
4668 # ### Get information about all active dashboards.
4669 #
4670 # Returns an array of **abbreviated dashboard objects**. Dashboards marked as deleted are excluded from this list.
4671 #
4672 # Get the **full details** of a specific dashboard by id with [dashboard()](#!/Dashboard/dashboard)
4673 #
4674 # Find **deleted dashboards** with [search_dashboards()](#!/Dashboard/search_dashboards)
4675 #
4676 # GET /dashboards -> Sequence[mdls.DashboardBase]
4677 def all_dashboards(
4678 self,
4679 # Requested fields.
4680 fields: Optional[str] = None,
4681 transport_options: Optional[transport.TransportOptions] = None,
4682 ) -> Sequence[mdls.DashboardBase]:
4683 """Get All Dashboards"""
4684 response = cast(
4685 Sequence[mdls.DashboardBase],
4686 self.get(
4687 path="/dashboards",
4688 structure=Sequence[mdls.DashboardBase],
4689 query_params={"fields": fields},
4690 transport_options=transport_options,
4691 ),
4692 )
4693 return response
4694
4695 # ### Create a new dashboard
4696 #
4697 # Creates a new dashboard object and returns the details of the newly created dashboard.
4698 #
4699 # `Title` and `space_id` are required fields.
4700 # `Space_id` must contain the id of an existing space.
4701 # A dashboard's `title` must be unique within the space in which it resides.
4702 #
4703 # If you receive a 422 error response when creating a dashboard, be sure to look at the
4704 # response body for information about exactly which fields are missing or contain invalid data.
4705 #
4706 # You can **update** an existing dashboard with [update_dashboard()](#!/Dashboard/update_dashboard)
4707 #
4708 # You can **permanently delete** an existing dashboard with [delete_dashboard()](#!/Dashboard/delete_dashboard)
4709 #
4710 # POST /dashboards -> mdls.Dashboard
4711 def create_dashboard(
4712 self,
4713 body: mdls.WriteDashboard,
4714 transport_options: Optional[transport.TransportOptions] = None,
4715 ) -> mdls.Dashboard:
4716 """Create Dashboard"""
4717 response = cast(
4718 mdls.Dashboard,
4719 self.post(
4720 path="/dashboards",
4721 structure=mdls.Dashboard,
4722 body=body,
4723 transport_options=transport_options,
4724 ),
4725 )
4726 return response
4727
4728 # ### Search Dashboards
4729 #
4730 # Returns an array of **user-defined dashboard** objects that match the specified search criteria.
4731 # Note, [search_dashboards()](#!/Dashboard/search_dashboards) does not return LookML dashboard objects.
4732 #
4733 # If multiple search params are given and `filter_or` is FALSE or not specified,
4734 # search params are combined in a logical AND operation.
4735 # Only rows that match *all* search param criteria will be returned.
4736 #
4737 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
4738 # Results will include rows that match **any** of the search criteria.
4739 #
4740 # String search params use case-insensitive matching.
4741 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
4742 # example="dan%" will match "danger" and "Danzig" but not "David"
4743 # example="D_m%" will match "Damage" and "dump"
4744 #
4745 # Integer search params can accept a single value or a comma separated list of values. The multiple
4746 # values will be combined under a logical OR operation - results will match at least one of
4747 # the given values.
4748 #
4749 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
4750 # or exclude (respectively) rows where the column is null.
4751 #
4752 # Boolean search params accept only "true" and "false" as values.
4753 #
4754 #
4755 # The parameters `limit`, and `offset` are recommended for fetching results in page-size chunks.
4756 #
4757 # Get a **single dashboard** by id with [dashboard()](#!/Dashboard/dashboard)
4758 #
4759 # GET /dashboards/search -> Sequence[mdls.Dashboard]
4760 def search_dashboards(
4761 self,
4762 # Match dashboard id.
4763 id: Optional[str] = None,
4764 # Match dashboard slug.
4765 slug: Optional[str] = None,
4766 # Match Dashboard title.
4767 title: Optional[str] = None,
4768 # Match Dashboard description.
4769 description: Optional[str] = None,
4770 # Filter on a content favorite id.
4771 content_favorite_id: Optional[str] = None,
4772 # Filter on a particular folder.
4773 folder_id: Optional[str] = None,
4774 # Filter on dashboards deleted status.
4775 deleted: Optional[str] = None,
4776 # Filter on dashboards created by a particular user.
4777 user_id: Optional[str] = None,
4778 # Filter on a particular value of view_count
4779 view_count: Optional[str] = None,
4780 # Filter on a content favorite id.
4781 content_metadata_id: Optional[str] = None,
4782 # Exclude items that exist only in personal spaces other than the users
4783 curate: Optional[bool] = None,
4784 # Select dashboards based on when they were last viewed
4785 last_viewed_at: Optional[str] = None,
4786 # Requested fields.
4787 fields: Optional[str] = None,
4788 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
4789 page: Optional[int] = None,
4790 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
4791 per_page: Optional[int] = None,
4792 # Number of results to return. (used with offset and takes priority over page and per_page)
4793 limit: Optional[int] = None,
4794 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
4795 offset: Optional[int] = None,
4796 # One or more fields to sort by. Sortable fields: [:title, :user_id, :id, :created_at, :space_id, :folder_id, :description, :view_count, :favorite_count, :slug, :content_favorite_id, :content_metadata_id, :deleted, :deleted_at, :last_viewed_at, :last_accessed_at]
4797 sorts: Optional[str] = None,
4798 # Combine given search criteria in a boolean OR expression
4799 filter_or: Optional[bool] = None,
4800 # Filter out the dashboards owned by the user passed at the :user_id params
4801 not_owned_by: Optional[bool] = None,
4802 transport_options: Optional[transport.TransportOptions] = None,
4803 ) -> Sequence[mdls.Dashboard]:
4804 """Search Dashboards"""
4805 response = cast(
4806 Sequence[mdls.Dashboard],
4807 self.get(
4808 path="/dashboards/search",
4809 structure=Sequence[mdls.Dashboard],
4810 query_params={
4811 "id": id,
4812 "slug": slug,
4813 "title": title,
4814 "description": description,
4815 "content_favorite_id": content_favorite_id,
4816 "folder_id": folder_id,
4817 "deleted": deleted,
4818 "user_id": user_id,
4819 "view_count": view_count,
4820 "content_metadata_id": content_metadata_id,
4821 "curate": curate,
4822 "last_viewed_at": last_viewed_at,
4823 "fields": fields,
4824 "page": page,
4825 "per_page": per_page,
4826 "limit": limit,
4827 "offset": offset,
4828 "sorts": sorts,
4829 "filter_or": filter_or,
4830 "not_owned_by": not_owned_by,
4831 },
4832 transport_options=transport_options,
4833 ),
4834 )
4835 return response
4836
4837 # ### Import a LookML dashboard to a space as a UDD
4838 # Creates a UDD (a dashboard which exists in the Looker database rather than as a LookML file) from the LookML dashboard
4839 # and places it in the space specified. The created UDD will have a lookml_link_id which links to the original LookML dashboard.
4840 #
4841 # To give the imported dashboard specify a (e.g. title: "my title") in the body of your request, otherwise the imported
4842 # dashboard will have the same title as the original LookML dashboard.
4843 #
4844 # For this operation to succeed the user must have permission to see the LookML dashboard in question, and have permission to
4845 # create content in the space the dashboard is being imported to.
4846 #
4847 # **Sync** a linked UDD with [sync_lookml_dashboard()](#!/Dashboard/sync_lookml_dashboard)
4848 # **Unlink** a linked UDD by setting lookml_link_id to null with [update_dashboard()](#!/Dashboard/update_dashboard)
4849 #
4850 # POST /dashboards/{lookml_dashboard_id}/import/{space_id} -> mdls.Dashboard
4851 def import_lookml_dashboard(
4852 self,
4853 # Id of LookML dashboard
4854 lookml_dashboard_id: str,
4855 # Id of space to import the dashboard to
4856 space_id: str,
4857 body: Optional[mdls.WriteDashboard] = None,
4858 # If true, and this dashboard is localized, export it with the raw keys, not localized.
4859 raw_locale: Optional[bool] = None,
4860 transport_options: Optional[transport.TransportOptions] = None,
4861 ) -> mdls.Dashboard:
4862 """Import LookML Dashboard"""
4863 lookml_dashboard_id = self.encode_path_param(lookml_dashboard_id)
4864 space_id = self.encode_path_param(space_id)
4865 response = cast(
4866 mdls.Dashboard,
4867 self.post(
4868 path=f"/dashboards/{lookml_dashboard_id}/import/{space_id}",
4869 structure=mdls.Dashboard,
4870 query_params={"raw_locale": raw_locale},
4871 body=body,
4872 transport_options=transport_options,
4873 ),
4874 )
4875 return response
4876
4877 # ### Update all linked dashboards to match the specified LookML dashboard.
4878 #
4879 # Any UDD (a dashboard which exists in the Looker database rather than as a LookML file) which has a `lookml_link_id`
4880 # property value referring to a LookML dashboard's id (model::dashboardname) will be updated so that it matches the current state of the LookML dashboard.
4881 #
4882 # If the dashboard_ids parameter is specified, only the dashboards with the specified ids will be updated.
4883 #
4884 # For this operation to succeed the user must have permission to view the LookML dashboard, and only linked dashboards
4885 # that the user has permission to update will be synced.
4886 #
4887 # To **link** or **unlink** a UDD set the `lookml_link_id` property with [update_dashboard()](#!/Dashboard/update_dashboard)
4888 #
4889 # PATCH /dashboards/{lookml_dashboard_id}/sync -> Sequence[int]
4890 def sync_lookml_dashboard(
4891 self,
4892 # Id of LookML dashboard, in the form 'model::dashboardname'
4893 lookml_dashboard_id: str,
4894 # If true, and this dashboard is localized, export it with the raw keys, not localized.
4895 raw_locale: Optional[bool] = None,
4896 # An array of UDD dashboard IDs to sync. If not specified, all UDD dashboards will be synced.
4897 dashboard_ids: Optional[mdls.DelimSequence[str]] = None,
4898 transport_options: Optional[transport.TransportOptions] = None,
4899 ) -> Sequence[int]:
4900 """Sync LookML Dashboard"""
4901 lookml_dashboard_id = self.encode_path_param(lookml_dashboard_id)
4902 response = cast(
4903 Sequence[int],
4904 self.patch(
4905 path=f"/dashboards/{lookml_dashboard_id}/sync",
4906 structure=Sequence[int],
4907 query_params={"raw_locale": raw_locale, "dashboard_ids": dashboard_ids},
4908 transport_options=transport_options,
4909 ),
4910 )
4911 return response
4912
4913 # ### Get information about a dashboard
4914 #
4915 # Returns the full details of the identified dashboard object
4916 #
4917 # Get a **summary list** of all active dashboards with [all_dashboards()](#!/Dashboard/all_dashboards)
4918 #
4919 # You can **Search** for dashboards with [search_dashboards()](#!/Dashboard/search_dashboards)
4920 #
4921 # GET /dashboards/{dashboard_id} -> mdls.Dashboard
4922 def dashboard(
4923 self,
4924 # Id of dashboard
4925 dashboard_id: str,
4926 # Requested fields.
4927 fields: Optional[str] = None,
4928 transport_options: Optional[transport.TransportOptions] = None,
4929 ) -> mdls.Dashboard:
4930 """Get Dashboard"""
4931 dashboard_id = self.encode_path_param(dashboard_id)
4932 response = cast(
4933 mdls.Dashboard,
4934 self.get(
4935 path=f"/dashboards/{dashboard_id}",
4936 structure=mdls.Dashboard,
4937 query_params={"fields": fields},
4938 transport_options=transport_options,
4939 ),
4940 )
4941 return response
4942
4943 # ### Update a dashboard
4944 #
4945 # You can use this function to change the string and integer properties of
4946 # a dashboard. Nested objects such as filters, dashboard elements, or dashboard layout components
4947 # cannot be modified by this function - use the update functions for the respective
4948 # nested object types (like [update_dashboard_filter()](#!/Dashboard/update_dashboard_filter) to change a filter)
4949 # to modify nested objects referenced by a dashboard.
4950 #
4951 # If you receive a 422 error response when updating a dashboard, be sure to look at the
4952 # response body for information about exactly which fields are missing or contain invalid data.
4953 #
4954 # PATCH /dashboards/{dashboard_id} -> mdls.Dashboard
4955 def update_dashboard(
4956 self,
4957 # Id of dashboard
4958 dashboard_id: str,
4959 body: mdls.WriteDashboard,
4960 transport_options: Optional[transport.TransportOptions] = None,
4961 ) -> mdls.Dashboard:
4962 """Update Dashboard"""
4963 dashboard_id = self.encode_path_param(dashboard_id)
4964 response = cast(
4965 mdls.Dashboard,
4966 self.patch(
4967 path=f"/dashboards/{dashboard_id}",
4968 structure=mdls.Dashboard,
4969 body=body,
4970 transport_options=transport_options,
4971 ),
4972 )
4973 return response
4974
4975 # ### Delete the dashboard with the specified id
4976 #
4977 # Permanently **deletes** a dashboard. (The dashboard cannot be recovered after this operation.)
4978 #
4979 # "Soft" delete or hide a dashboard by setting its `deleted` status to `True` with [update_dashboard()](#!/Dashboard/update_dashboard).
4980 #
4981 # Note: When a dashboard is deleted in the UI, it is soft deleted. Use this API call to permanently remove it, if desired.
4982 #
4983 # DELETE /dashboards/{dashboard_id} -> str
4984 def delete_dashboard(
4985 self,
4986 # Id of dashboard
4987 dashboard_id: str,
4988 transport_options: Optional[transport.TransportOptions] = None,
4989 ) -> str:
4990 """Delete Dashboard"""
4991 dashboard_id = self.encode_path_param(dashboard_id)
4992 response = cast(
4993 str,
4994 self.delete(
4995 path=f"/dashboards/{dashboard_id}",
4996 structure=str,
4997 transport_options=transport_options,
4998 ),
4999 )
5000 return response
5001
5002 # ### Get Aggregate Table LookML for Each Query on a Dashboard
5003 #
5004 # Returns a JSON object that contains the dashboard id and Aggregate Table lookml
5005 #
5006 # GET /dashboards/aggregate_table_lookml/{dashboard_id} -> mdls.DashboardAggregateTableLookml
5007 def dashboard_aggregate_table_lookml(
5008 self,
5009 # Id of dashboard
5010 dashboard_id: str,
5011 transport_options: Optional[transport.TransportOptions] = None,
5012 ) -> mdls.DashboardAggregateTableLookml:
5013 """Get Aggregate Table LookML for a dashboard"""
5014 dashboard_id = self.encode_path_param(dashboard_id)
5015 response = cast(
5016 mdls.DashboardAggregateTableLookml,
5017 self.get(
5018 path=f"/dashboards/aggregate_table_lookml/{dashboard_id}",
5019 structure=mdls.DashboardAggregateTableLookml,
5020 transport_options=transport_options,
5021 ),
5022 )
5023 return response
5024
5025 # ### Get lookml of a UDD
5026 #
5027 # Returns a JSON object that contains the dashboard id and the full lookml
5028 #
5029 # GET /dashboards/lookml/{dashboard_id} -> mdls.DashboardLookml
5030 def dashboard_lookml(
5031 self,
5032 # Id of dashboard
5033 dashboard_id: str,
5034 transport_options: Optional[transport.TransportOptions] = None,
5035 ) -> mdls.DashboardLookml:
5036 """Get lookml of a UDD"""
5037 dashboard_id = self.encode_path_param(dashboard_id)
5038 response = cast(
5039 mdls.DashboardLookml,
5040 self.get(
5041 path=f"/dashboards/lookml/{dashboard_id}",
5042 structure=mdls.DashboardLookml,
5043 transport_options=transport_options,
5044 ),
5045 )
5046 return response
5047
5048 # ### Move an existing dashboard
5049 #
5050 # Moves a dashboard to a specified folder, and returns the moved dashboard.
5051 #
5052 # `dashboard_id` and `folder_id` are required.
5053 # `dashboard_id` and `folder_id` must already exist, and `folder_id` must be different from the current `folder_id` of the dashboard.
5054 #
5055 # PATCH /dashboards/{dashboard_id}/move -> mdls.Dashboard
5056 def move_dashboard(
5057 self,
5058 # Dashboard id to move.
5059 dashboard_id: str,
5060 # Folder id to move to.
5061 folder_id: str,
5062 transport_options: Optional[transport.TransportOptions] = None,
5063 ) -> mdls.Dashboard:
5064 """Move Dashboard"""
5065 dashboard_id = self.encode_path_param(dashboard_id)
5066 response = cast(
5067 mdls.Dashboard,
5068 self.patch(
5069 path=f"/dashboards/{dashboard_id}/move",
5070 structure=mdls.Dashboard,
5071 query_params={"folder_id": folder_id},
5072 transport_options=transport_options,
5073 ),
5074 )
5075 return response
5076
5077 # ### Creates a dashboard object based on LookML Dashboard YAML, and returns the details of the newly created dashboard.
5078 #
5079 # If a dashboard exists with the YAML-defined "preferred_slug", the new dashboard will overwrite it. Otherwise, a new
5080 # dashboard will be created. Note that when a dashboard is overwritten, alerts will not be maintained.
5081 #
5082 # If a folder_id is specified: new dashboards will be placed in that folder, and overwritten dashboards will be moved to it
5083 # If the folder_id isn't specified: new dashboards will be placed in the caller's personal folder, and overwritten dashboards
5084 # will remain where they were
5085 #
5086 # LookML must contain valid LookML YAML code. It's recommended to use the LookML format returned
5087 # from [dashboard_lookml()](#!/Dashboard/dashboard_lookml) as the input LookML (newlines replaced with
5088 # ).
5089 #
5090 # Note that the created dashboard is not linked to any LookML Dashboard,
5091 # i.e. [sync_lookml_dashboard()](#!/Dashboard/sync_lookml_dashboard) will not update dashboards created by this method.
5092 #
5093 # POST /dashboards/lookml -> mdls.Dashboard
5094 def import_dashboard_from_lookml(
5095 self,
5096 body: mdls.WriteDashboardLookml,
5097 transport_options: Optional[transport.TransportOptions] = None,
5098 ) -> mdls.Dashboard:
5099 """Import Dashboard from LookML"""
5100 response = cast(
5101 mdls.Dashboard,
5102 self.post(
5103 path="/dashboards/lookml",
5104 structure=mdls.Dashboard,
5105 body=body,
5106 transport_options=transport_options,
5107 ),
5108 )
5109 return response
5110
5111 # # DEPRECATED: Use [import_dashboard_from_lookml()](#!/Dashboard/import_dashboard_from_lookml)
5112 #
5113 # POST /dashboards/from_lookml -> mdls.Dashboard
5114 def create_dashboard_from_lookml(
5115 self,
5116 body: mdls.WriteDashboardLookml,
5117 transport_options: Optional[transport.TransportOptions] = None,
5118 ) -> mdls.Dashboard:
5119 """Create Dashboard from LookML"""
5120 response = cast(
5121 mdls.Dashboard,
5122 self.post(
5123 path="/dashboards/from_lookml",
5124 structure=mdls.Dashboard,
5125 body=body,
5126 transport_options=transport_options,
5127 ),
5128 )
5129 return response
5130
5131 # ### Copy an existing dashboard
5132 #
5133 # Creates a copy of an existing dashboard, in a specified folder, and returns the copied dashboard.
5134 #
5135 # `dashboard_id` is required, `dashboard_id` and `folder_id` must already exist if specified.
5136 # `folder_id` will default to the existing folder.
5137 #
5138 # If a dashboard with the same title already exists in the target folder, the copy will have '(copy)'
5139 # or '(copy <# of copies>)' appended.
5140 #
5141 # POST /dashboards/{dashboard_id}/copy -> mdls.Dashboard
5142 def copy_dashboard(
5143 self,
5144 # Dashboard id to copy.
5145 dashboard_id: str,
5146 # Folder id to copy to.
5147 folder_id: Optional[str] = None,
5148 transport_options: Optional[transport.TransportOptions] = None,
5149 ) -> mdls.Dashboard:
5150 """Copy Dashboard"""
5151 dashboard_id = self.encode_path_param(dashboard_id)
5152 response = cast(
5153 mdls.Dashboard,
5154 self.post(
5155 path=f"/dashboards/{dashboard_id}/copy",
5156 structure=mdls.Dashboard,
5157 query_params={"folder_id": folder_id},
5158 transport_options=transport_options,
5159 ),
5160 )
5161 return response
5162
5163 # ### Search Dashboard Elements
5164 #
5165 # Returns an **array of DashboardElement objects** that match the specified search criteria.
5166 #
5167 # If multiple search params are given and `filter_or` is FALSE or not specified,
5168 # search params are combined in a logical AND operation.
5169 # Only rows that match *all* search param criteria will be returned.
5170 #
5171 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
5172 # Results will include rows that match **any** of the search criteria.
5173 #
5174 # String search params use case-insensitive matching.
5175 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
5176 # example="dan%" will match "danger" and "Danzig" but not "David"
5177 # example="D_m%" will match "Damage" and "dump"
5178 #
5179 # Integer search params can accept a single value or a comma separated list of values. The multiple
5180 # values will be combined under a logical OR operation - results will match at least one of
5181 # the given values.
5182 #
5183 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
5184 # or exclude (respectively) rows where the column is null.
5185 #
5186 # Boolean search params accept only "true" and "false" as values.
5187 #
5188 # GET /dashboard_elements/search -> Sequence[mdls.DashboardElement]
5189 def search_dashboard_elements(
5190 self,
5191 # Select elements that refer to a given dashboard id
5192 dashboard_id: Optional[str] = None,
5193 # Select elements that refer to a given look id
5194 look_id: Optional[str] = None,
5195 # Match the title of element
5196 title: Optional[str] = None,
5197 # Select soft-deleted dashboard elements
5198 deleted: Optional[bool] = None,
5199 # Requested fields.
5200 fields: Optional[str] = None,
5201 # Combine given search criteria in a boolean OR expression
5202 filter_or: Optional[bool] = None,
5203 # Fields to sort by. Sortable fields: [:look_id, :dashboard_id, :deleted, :title]
5204 sorts: Optional[str] = None,
5205 transport_options: Optional[transport.TransportOptions] = None,
5206 ) -> Sequence[mdls.DashboardElement]:
5207 """Search Dashboard Elements"""
5208 response = cast(
5209 Sequence[mdls.DashboardElement],
5210 self.get(
5211 path="/dashboard_elements/search",
5212 structure=Sequence[mdls.DashboardElement],
5213 query_params={
5214 "dashboard_id": dashboard_id,
5215 "look_id": look_id,
5216 "title": title,
5217 "deleted": deleted,
5218 "fields": fields,
5219 "filter_or": filter_or,
5220 "sorts": sorts,
5221 },
5222 transport_options=transport_options,
5223 ),
5224 )
5225 return response
5226
5227 # ### Get information about the dashboard element with a specific id.
5228 #
5229 # GET /dashboard_elements/{dashboard_element_id} -> mdls.DashboardElement
5230 def dashboard_element(
5231 self,
5232 # Id of dashboard element
5233 dashboard_element_id: str,
5234 # Requested fields.
5235 fields: Optional[str] = None,
5236 transport_options: Optional[transport.TransportOptions] = None,
5237 ) -> mdls.DashboardElement:
5238 """Get DashboardElement"""
5239 dashboard_element_id = self.encode_path_param(dashboard_element_id)
5240 response = cast(
5241 mdls.DashboardElement,
5242 self.get(
5243 path=f"/dashboard_elements/{dashboard_element_id}",
5244 structure=mdls.DashboardElement,
5245 query_params={"fields": fields},
5246 transport_options=transport_options,
5247 ),
5248 )
5249 return response
5250
5251 # ### Update the dashboard element with a specific id.
5252 #
5253 # PATCH /dashboard_elements/{dashboard_element_id} -> mdls.DashboardElement
5254 def update_dashboard_element(
5255 self,
5256 # Id of dashboard element
5257 dashboard_element_id: str,
5258 body: mdls.WriteDashboardElement,
5259 # Requested fields.
5260 fields: Optional[str] = None,
5261 transport_options: Optional[transport.TransportOptions] = None,
5262 ) -> mdls.DashboardElement:
5263 """Update DashboardElement"""
5264 dashboard_element_id = self.encode_path_param(dashboard_element_id)
5265 response = cast(
5266 mdls.DashboardElement,
5267 self.patch(
5268 path=f"/dashboard_elements/{dashboard_element_id}",
5269 structure=mdls.DashboardElement,
5270 query_params={"fields": fields},
5271 body=body,
5272 transport_options=transport_options,
5273 ),
5274 )
5275 return response
5276
5277 # ### Delete a dashboard element with a specific id.
5278 #
5279 # DELETE /dashboard_elements/{dashboard_element_id} -> str
5280 def delete_dashboard_element(
5281 self,
5282 # Id of dashboard element
5283 dashboard_element_id: str,
5284 transport_options: Optional[transport.TransportOptions] = None,
5285 ) -> str:
5286 """Delete DashboardElement"""
5287 dashboard_element_id = self.encode_path_param(dashboard_element_id)
5288 response = cast(
5289 str,
5290 self.delete(
5291 path=f"/dashboard_elements/{dashboard_element_id}",
5292 structure=str,
5293 transport_options=transport_options,
5294 ),
5295 )
5296 return response
5297
5298 # ### Get information about all the dashboard elements on a dashboard with a specific id.
5299 #
5300 # GET /dashboards/{dashboard_id}/dashboard_elements -> Sequence[mdls.DashboardElement]
5301 def dashboard_dashboard_elements(
5302 self,
5303 # Id of dashboard
5304 dashboard_id: str,
5305 # Requested fields.
5306 fields: Optional[str] = None,
5307 transport_options: Optional[transport.TransportOptions] = None,
5308 ) -> Sequence[mdls.DashboardElement]:
5309 """Get All DashboardElements"""
5310 dashboard_id = self.encode_path_param(dashboard_id)
5311 response = cast(
5312 Sequence[mdls.DashboardElement],
5313 self.get(
5314 path=f"/dashboards/{dashboard_id}/dashboard_elements",
5315 structure=Sequence[mdls.DashboardElement],
5316 query_params={"fields": fields},
5317 transport_options=transport_options,
5318 ),
5319 )
5320 return response
5321
5322 # ### Create a dashboard element on the dashboard with a specific id.
5323 #
5324 # POST /dashboard_elements -> mdls.DashboardElement
5325 def create_dashboard_element(
5326 self,
5327 body: mdls.WriteDashboardElement,
5328 # Requested fields.
5329 fields: Optional[str] = None,
5330 # Apply relevant filters on dashboard to this tile
5331 apply_filters: Optional[bool] = None,
5332 transport_options: Optional[transport.TransportOptions] = None,
5333 ) -> mdls.DashboardElement:
5334 """Create DashboardElement"""
5335 response = cast(
5336 mdls.DashboardElement,
5337 self.post(
5338 path="/dashboard_elements",
5339 structure=mdls.DashboardElement,
5340 query_params={"fields": fields, "apply_filters": apply_filters},
5341 body=body,
5342 transport_options=transport_options,
5343 ),
5344 )
5345 return response
5346
5347 # ### Get information about the dashboard filters with a specific id.
5348 #
5349 # GET /dashboard_filters/{dashboard_filter_id} -> mdls.DashboardFilter
5350 def dashboard_filter(
5351 self,
5352 # Id of dashboard filters
5353 dashboard_filter_id: str,
5354 # Requested fields.
5355 fields: Optional[str] = None,
5356 transport_options: Optional[transport.TransportOptions] = None,
5357 ) -> mdls.DashboardFilter:
5358 """Get Dashboard Filter"""
5359 dashboard_filter_id = self.encode_path_param(dashboard_filter_id)
5360 response = cast(
5361 mdls.DashboardFilter,
5362 self.get(
5363 path=f"/dashboard_filters/{dashboard_filter_id}",
5364 structure=mdls.DashboardFilter,
5365 query_params={"fields": fields},
5366 transport_options=transport_options,
5367 ),
5368 )
5369 return response
5370
5371 # ### Update the dashboard filter with a specific id.
5372 #
5373 # PATCH /dashboard_filters/{dashboard_filter_id} -> mdls.DashboardFilter
5374 def update_dashboard_filter(
5375 self,
5376 # Id of dashboard filter
5377 dashboard_filter_id: str,
5378 body: mdls.WriteDashboardFilter,
5379 # Requested fields.
5380 fields: Optional[str] = None,
5381 transport_options: Optional[transport.TransportOptions] = None,
5382 ) -> mdls.DashboardFilter:
5383 """Update Dashboard Filter"""
5384 dashboard_filter_id = self.encode_path_param(dashboard_filter_id)
5385 response = cast(
5386 mdls.DashboardFilter,
5387 self.patch(
5388 path=f"/dashboard_filters/{dashboard_filter_id}",
5389 structure=mdls.DashboardFilter,
5390 query_params={"fields": fields},
5391 body=body,
5392 transport_options=transport_options,
5393 ),
5394 )
5395 return response
5396
5397 # ### Delete a dashboard filter with a specific id.
5398 #
5399 # DELETE /dashboard_filters/{dashboard_filter_id} -> str
5400 def delete_dashboard_filter(
5401 self,
5402 # Id of dashboard filter
5403 dashboard_filter_id: str,
5404 transport_options: Optional[transport.TransportOptions] = None,
5405 ) -> str:
5406 """Delete Dashboard Filter"""
5407 dashboard_filter_id = self.encode_path_param(dashboard_filter_id)
5408 response = cast(
5409 str,
5410 self.delete(
5411 path=f"/dashboard_filters/{dashboard_filter_id}",
5412 structure=str,
5413 transport_options=transport_options,
5414 ),
5415 )
5416 return response
5417
5418 # ### Get information about all the dashboard filters on a dashboard with a specific id.
5419 #
5420 # GET /dashboards/{dashboard_id}/dashboard_filters -> Sequence[mdls.DashboardFilter]
5421 def dashboard_dashboard_filters(
5422 self,
5423 # Id of dashboard
5424 dashboard_id: str,
5425 # Requested fields.
5426 fields: Optional[str] = None,
5427 transport_options: Optional[transport.TransportOptions] = None,
5428 ) -> Sequence[mdls.DashboardFilter]:
5429 """Get All Dashboard Filters"""
5430 dashboard_id = self.encode_path_param(dashboard_id)
5431 response = cast(
5432 Sequence[mdls.DashboardFilter],
5433 self.get(
5434 path=f"/dashboards/{dashboard_id}/dashboard_filters",
5435 structure=Sequence[mdls.DashboardFilter],
5436 query_params={"fields": fields},
5437 transport_options=transport_options,
5438 ),
5439 )
5440 return response
5441
5442 # ### Create a dashboard filter on the dashboard with a specific id.
5443 #
5444 # POST /dashboard_filters -> mdls.DashboardFilter
5445 def create_dashboard_filter(
5446 self,
5447 body: mdls.WriteCreateDashboardFilter,
5448 # Requested fields
5449 fields: Optional[str] = None,
5450 transport_options: Optional[transport.TransportOptions] = None,
5451 ) -> mdls.DashboardFilter:
5452 """Create Dashboard Filter"""
5453 response = cast(
5454 mdls.DashboardFilter,
5455 self.post(
5456 path="/dashboard_filters",
5457 structure=mdls.DashboardFilter,
5458 query_params={"fields": fields},
5459 body=body,
5460 transport_options=transport_options,
5461 ),
5462 )
5463 return response
5464
5465 # ### Get information about the dashboard elements with a specific id.
5466 #
5467 # GET /dashboard_layout_components/{dashboard_layout_component_id} -> mdls.DashboardLayoutComponent
5468 def dashboard_layout_component(
5469 self,
5470 # Id of dashboard layout component
5471 dashboard_layout_component_id: str,
5472 # Requested fields.
5473 fields: Optional[str] = None,
5474 transport_options: Optional[transport.TransportOptions] = None,
5475 ) -> mdls.DashboardLayoutComponent:
5476 """Get DashboardLayoutComponent"""
5477 dashboard_layout_component_id = self.encode_path_param(
5478 dashboard_layout_component_id
5479 )
5480 response = cast(
5481 mdls.DashboardLayoutComponent,
5482 self.get(
5483 path=f"/dashboard_layout_components/{dashboard_layout_component_id}",
5484 structure=mdls.DashboardLayoutComponent,
5485 query_params={"fields": fields},
5486 transport_options=transport_options,
5487 ),
5488 )
5489 return response
5490
5491 # ### Update the dashboard element with a specific id.
5492 #
5493 # PATCH /dashboard_layout_components/{dashboard_layout_component_id} -> mdls.DashboardLayoutComponent
5494 def update_dashboard_layout_component(
5495 self,
5496 # Id of dashboard layout component
5497 dashboard_layout_component_id: str,
5498 body: mdls.WriteDashboardLayoutComponent,
5499 # Requested fields.
5500 fields: Optional[str] = None,
5501 transport_options: Optional[transport.TransportOptions] = None,
5502 ) -> mdls.DashboardLayoutComponent:
5503 """Update DashboardLayoutComponent"""
5504 dashboard_layout_component_id = self.encode_path_param(
5505 dashboard_layout_component_id
5506 )
5507 response = cast(
5508 mdls.DashboardLayoutComponent,
5509 self.patch(
5510 path=f"/dashboard_layout_components/{dashboard_layout_component_id}",
5511 structure=mdls.DashboardLayoutComponent,
5512 query_params={"fields": fields},
5513 body=body,
5514 transport_options=transport_options,
5515 ),
5516 )
5517 return response
5518
5519 # ### Get information about all the dashboard layout components for a dashboard layout with a specific id.
5520 #
5521 # GET /dashboard_layouts/{dashboard_layout_id}/dashboard_layout_components -> Sequence[mdls.DashboardLayoutComponent]
5522 def dashboard_layout_dashboard_layout_components(
5523 self,
5524 # Id of dashboard layout component
5525 dashboard_layout_id: str,
5526 # Requested fields.
5527 fields: Optional[str] = None,
5528 transport_options: Optional[transport.TransportOptions] = None,
5529 ) -> Sequence[mdls.DashboardLayoutComponent]:
5530 """Get All DashboardLayoutComponents"""
5531 dashboard_layout_id = self.encode_path_param(dashboard_layout_id)
5532 response = cast(
5533 Sequence[mdls.DashboardLayoutComponent],
5534 self.get(
5535 path=f"/dashboard_layouts/{dashboard_layout_id}/dashboard_layout_components",
5536 structure=Sequence[mdls.DashboardLayoutComponent],
5537 query_params={"fields": fields},
5538 transport_options=transport_options,
5539 ),
5540 )
5541 return response
5542
5543 # ### Get information about the dashboard layouts with a specific id.
5544 #
5545 # GET /dashboard_layouts/{dashboard_layout_id} -> mdls.DashboardLayout
5546 def dashboard_layout(
5547 self,
5548 # Id of dashboard layouts
5549 dashboard_layout_id: str,
5550 # Requested fields.
5551 fields: Optional[str] = None,
5552 transport_options: Optional[transport.TransportOptions] = None,
5553 ) -> mdls.DashboardLayout:
5554 """Get DashboardLayout"""
5555 dashboard_layout_id = self.encode_path_param(dashboard_layout_id)
5556 response = cast(
5557 mdls.DashboardLayout,
5558 self.get(
5559 path=f"/dashboard_layouts/{dashboard_layout_id}",
5560 structure=mdls.DashboardLayout,
5561 query_params={"fields": fields},
5562 transport_options=transport_options,
5563 ),
5564 )
5565 return response
5566
5567 # ### Update the dashboard layout with a specific id.
5568 #
5569 # PATCH /dashboard_layouts/{dashboard_layout_id} -> mdls.DashboardLayout
5570 def update_dashboard_layout(
5571 self,
5572 # Id of dashboard layout
5573 dashboard_layout_id: str,
5574 body: mdls.WriteDashboardLayout,
5575 # Requested fields.
5576 fields: Optional[str] = None,
5577 transport_options: Optional[transport.TransportOptions] = None,
5578 ) -> mdls.DashboardLayout:
5579 """Update DashboardLayout"""
5580 dashboard_layout_id = self.encode_path_param(dashboard_layout_id)
5581 response = cast(
5582 mdls.DashboardLayout,
5583 self.patch(
5584 path=f"/dashboard_layouts/{dashboard_layout_id}",
5585 structure=mdls.DashboardLayout,
5586 query_params={"fields": fields},
5587 body=body,
5588 transport_options=transport_options,
5589 ),
5590 )
5591 return response
5592
5593 # ### Delete a dashboard layout with a specific id.
5594 #
5595 # DELETE /dashboard_layouts/{dashboard_layout_id} -> str
5596 def delete_dashboard_layout(
5597 self,
5598 # Id of dashboard layout
5599 dashboard_layout_id: str,
5600 transport_options: Optional[transport.TransportOptions] = None,
5601 ) -> str:
5602 """Delete DashboardLayout"""
5603 dashboard_layout_id = self.encode_path_param(dashboard_layout_id)
5604 response = cast(
5605 str,
5606 self.delete(
5607 path=f"/dashboard_layouts/{dashboard_layout_id}",
5608 structure=str,
5609 transport_options=transport_options,
5610 ),
5611 )
5612 return response
5613
5614 # ### Get information about all the dashboard elements on a dashboard with a specific id.
5615 #
5616 # GET /dashboards/{dashboard_id}/dashboard_layouts -> Sequence[mdls.DashboardLayout]
5617 def dashboard_dashboard_layouts(
5618 self,
5619 # Id of dashboard
5620 dashboard_id: str,
5621 # Requested fields.
5622 fields: Optional[str] = None,
5623 transport_options: Optional[transport.TransportOptions] = None,
5624 ) -> Sequence[mdls.DashboardLayout]:
5625 """Get All DashboardLayouts"""
5626 dashboard_id = self.encode_path_param(dashboard_id)
5627 response = cast(
5628 Sequence[mdls.DashboardLayout],
5629 self.get(
5630 path=f"/dashboards/{dashboard_id}/dashboard_layouts",
5631 structure=Sequence[mdls.DashboardLayout],
5632 query_params={"fields": fields},
5633 transport_options=transport_options,
5634 ),
5635 )
5636 return response
5637
5638 # ### Create a dashboard layout on the dashboard with a specific id.
5639 #
5640 # POST /dashboard_layouts -> mdls.DashboardLayout
5641 def create_dashboard_layout(
5642 self,
5643 body: mdls.WriteDashboardLayout,
5644 # Requested fields.
5645 fields: Optional[str] = None,
5646 transport_options: Optional[transport.TransportOptions] = None,
5647 ) -> mdls.DashboardLayout:
5648 """Create DashboardLayout"""
5649 response = cast(
5650 mdls.DashboardLayout,
5651 self.post(
5652 path="/dashboard_layouts",
5653 structure=mdls.DashboardLayout,
5654 query_params={"fields": fields},
5655 body=body,
5656 transport_options=transport_options,
5657 ),
5658 )
5659 return response
5660
5661 # endregion
5662
5663 # region DataAction: Run Data Actions
5664
5665 # Perform a data action. The data action object can be obtained from query results, and used to perform an arbitrary action.
5666 #
5667 # POST /data_actions -> mdls.DataActionResponse
5668 def perform_data_action(
5669 self,
5670 body: mdls.DataActionRequest,
5671 transport_options: Optional[transport.TransportOptions] = None,
5672 ) -> mdls.DataActionResponse:
5673 """Send a Data Action"""
5674 response = cast(
5675 mdls.DataActionResponse,
5676 self.post(
5677 path="/data_actions",
5678 structure=mdls.DataActionResponse,
5679 body=body,
5680 transport_options=transport_options,
5681 ),
5682 )
5683 return response
5684
5685 # For some data actions, the remote server may supply a form requesting further user input. This endpoint takes a data action, asks the remote server to generate a form for it, and returns that form to you for presentation to the user.
5686 #
5687 # POST /data_actions/form -> mdls.DataActionForm
5688 def fetch_remote_data_action_form(
5689 self,
5690 body: MutableMapping[str, Any],
5691 transport_options: Optional[transport.TransportOptions] = None,
5692 ) -> mdls.DataActionForm:
5693 """Fetch Remote Data Action Form"""
5694 response = cast(
5695 mdls.DataActionForm,
5696 self.post(
5697 path="/data_actions/form",
5698 structure=mdls.DataActionForm,
5699 body=body,
5700 transport_options=transport_options,
5701 ),
5702 )
5703 return response
5704
5705 # endregion
5706
5707 # region Datagroup: Manage Datagroups
5708
5709 # ### Get information about all datagroups.
5710 #
5711 # GET /datagroups -> Sequence[mdls.Datagroup]
5712 def all_datagroups(
5713 self,
5714 transport_options: Optional[transport.TransportOptions] = None,
5715 ) -> Sequence[mdls.Datagroup]:
5716 """Get All Datagroups"""
5717 response = cast(
5718 Sequence[mdls.Datagroup],
5719 self.get(
5720 path="/datagroups",
5721 structure=Sequence[mdls.Datagroup],
5722 transport_options=transport_options,
5723 ),
5724 )
5725 return response
5726
5727 # ### Get information about a datagroup.
5728 #
5729 # GET /datagroups/{datagroup_id} -> mdls.Datagroup
5730 def datagroup(
5731 self,
5732 # ID of datagroup.
5733 datagroup_id: str,
5734 transport_options: Optional[transport.TransportOptions] = None,
5735 ) -> mdls.Datagroup:
5736 """Get Datagroup"""
5737 datagroup_id = self.encode_path_param(datagroup_id)
5738 response = cast(
5739 mdls.Datagroup,
5740 self.get(
5741 path=f"/datagroups/{datagroup_id}",
5742 structure=mdls.Datagroup,
5743 transport_options=transport_options,
5744 ),
5745 )
5746 return response
5747
5748 # ### Update a datagroup using the specified params.
5749 #
5750 # PATCH /datagroups/{datagroup_id} -> mdls.Datagroup
5751 def update_datagroup(
5752 self,
5753 # ID of datagroup.
5754 datagroup_id: str,
5755 body: mdls.WriteDatagroup,
5756 transport_options: Optional[transport.TransportOptions] = None,
5757 ) -> mdls.Datagroup:
5758 """Update Datagroup"""
5759 datagroup_id = self.encode_path_param(datagroup_id)
5760 response = cast(
5761 mdls.Datagroup,
5762 self.patch(
5763 path=f"/datagroups/{datagroup_id}",
5764 structure=mdls.Datagroup,
5765 body=body,
5766 transport_options=transport_options,
5767 ),
5768 )
5769 return response
5770
5771 # endregion
5772
5773 # region DerivedTable: View Derived Table graphs
5774
5775 # ### Discover information about derived tables
5776 #
5777 # GET /derived_table/graph/model/{model} -> mdls.DependencyGraph
5778 def graph_derived_tables_for_model(
5779 self,
5780 # The name of the Lookml model.
5781 model: str,
5782 # The format of the graph. Valid values are [dot]. Default is `dot`
5783 format: Optional[str] = None,
5784 # Color denoting the build status of the graph. Grey = not built, green = built, yellow = building, red = error.
5785 color: Optional[str] = None,
5786 transport_options: Optional[transport.TransportOptions] = None,
5787 ) -> mdls.DependencyGraph:
5788 """Get Derived Table graph for model"""
5789 model = self.encode_path_param(model)
5790 response = cast(
5791 mdls.DependencyGraph,
5792 self.get(
5793 path=f"/derived_table/graph/model/{model}",
5794 structure=mdls.DependencyGraph,
5795 query_params={"format": format, "color": color},
5796 transport_options=transport_options,
5797 ),
5798 )
5799 return response
5800
5801 # ### Get the subgraph representing this derived table and its dependencies.
5802 #
5803 # GET /derived_table/graph/view/{view} -> mdls.DependencyGraph
5804 def graph_derived_tables_for_view(
5805 self,
5806 # The derived table's view name.
5807 view: str,
5808 # The models where this derived table is defined.
5809 models: Optional[str] = None,
5810 # The model directory to look in, either `dev` or `production`.
5811 workspace: Optional[str] = None,
5812 transport_options: Optional[transport.TransportOptions] = None,
5813 ) -> mdls.DependencyGraph:
5814 """Get subgraph of derived table and dependencies"""
5815 view = self.encode_path_param(view)
5816 response = cast(
5817 mdls.DependencyGraph,
5818 self.get(
5819 path=f"/derived_table/graph/view/{view}",
5820 structure=mdls.DependencyGraph,
5821 query_params={"models": models, "workspace": workspace},
5822 transport_options=transport_options,
5823 ),
5824 )
5825 return response
5826
5827 # Enqueue materialization for a PDT with the given model name and view name
5828 #
5829 # GET /derived_table/{model_name}/{view_name}/start -> mdls.MaterializePDT
5830 def start_pdt_build(
5831 self,
5832 # The model of the PDT to start building.
5833 model_name: str,
5834 # The view name of the PDT to start building.
5835 view_name: str,
5836 # Force rebuild of required dependent PDTs, even if they are already materialized.
5837 force_rebuild: Optional[str] = None,
5838 # Force involved incremental PDTs to fully re-materialize.
5839 force_full_incremental: Optional[str] = None,
5840 # Workspace in which to materialize selected PDT ('dev' or default 'production').
5841 workspace: Optional[str] = None,
5842 # The source of this request.
5843 source: Optional[str] = None,
5844 transport_options: Optional[transport.TransportOptions] = None,
5845 ) -> mdls.MaterializePDT:
5846 """Start a PDT materialization"""
5847 model_name = self.encode_path_param(model_name)
5848 view_name = self.encode_path_param(view_name)
5849 response = cast(
5850 mdls.MaterializePDT,
5851 self.get(
5852 path=f"/derived_table/{model_name}/{view_name}/start",
5853 structure=mdls.MaterializePDT,
5854 query_params={
5855 "force_rebuild": force_rebuild,
5856 "force_full_incremental": force_full_incremental,
5857 "workspace": workspace,
5858 "source": source,
5859 },
5860 transport_options=transport_options,
5861 ),
5862 )
5863 return response
5864
5865 # Check status of PDT materialization
5866 #
5867 # GET /derived_table/{materialization_id}/status -> mdls.MaterializePDT
5868 def check_pdt_build(
5869 self,
5870 # The materialization id to check status for.
5871 materialization_id: str,
5872 transport_options: Optional[transport.TransportOptions] = None,
5873 ) -> mdls.MaterializePDT:
5874 """Check status of a PDT materialization"""
5875 materialization_id = self.encode_path_param(materialization_id)
5876 response = cast(
5877 mdls.MaterializePDT,
5878 self.get(
5879 path=f"/derived_table/{materialization_id}/status",
5880 structure=mdls.MaterializePDT,
5881 transport_options=transport_options,
5882 ),
5883 )
5884 return response
5885
5886 # Stop a PDT materialization
5887 #
5888 # GET /derived_table/{materialization_id}/stop -> mdls.MaterializePDT
5889 def stop_pdt_build(
5890 self,
5891 # The materialization id to stop.
5892 materialization_id: str,
5893 # The source of this request.
5894 source: Optional[str] = None,
5895 transport_options: Optional[transport.TransportOptions] = None,
5896 ) -> mdls.MaterializePDT:
5897 """Stop a PDT materialization"""
5898 materialization_id = self.encode_path_param(materialization_id)
5899 response = cast(
5900 mdls.MaterializePDT,
5901 self.get(
5902 path=f"/derived_table/{materialization_id}/stop",
5903 structure=mdls.MaterializePDT,
5904 query_params={"source": source},
5905 transport_options=transport_options,
5906 ),
5907 )
5908 return response
5909
5910 # endregion
5911
5912 # region Folder: Manage Folders
5913
5914 # Search for folders by creator id, parent id, name, etc
5915 #
5916 # GET /folders/search -> Sequence[mdls.Folder]
5917 def search_folders(
5918 self,
5919 # Requested fields.
5920 fields: Optional[str] = None,
5921 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
5922 page: Optional[int] = None,
5923 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
5924 per_page: Optional[int] = None,
5925 # Number of results to return. (used with offset and takes priority over page and per_page)
5926 limit: Optional[int] = None,
5927 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
5928 offset: Optional[int] = None,
5929 # Fields to sort by.
5930 sorts: Optional[str] = None,
5931 # Match Space title.
5932 name: Optional[str] = None,
5933 # Match Space id
5934 id: Optional[str] = None,
5935 # Filter on a children of a particular folder.
5936 parent_id: Optional[str] = None,
5937 # Filter on folder created by a particular user.
5938 creator_id: Optional[str] = None,
5939 # Combine given search criteria in a boolean OR expression
5940 filter_or: Optional[bool] = None,
5941 # Match is shared root
5942 is_shared_root: Optional[bool] = None,
5943 # Match is users root
5944 is_users_root: Optional[bool] = None,
5945 transport_options: Optional[transport.TransportOptions] = None,
5946 ) -> Sequence[mdls.Folder]:
5947 """Search Folders"""
5948 response = cast(
5949 Sequence[mdls.Folder],
5950 self.get(
5951 path="/folders/search",
5952 structure=Sequence[mdls.Folder],
5953 query_params={
5954 "fields": fields,
5955 "page": page,
5956 "per_page": per_page,
5957 "limit": limit,
5958 "offset": offset,
5959 "sorts": sorts,
5960 "name": name,
5961 "id": id,
5962 "parent_id": parent_id,
5963 "creator_id": creator_id,
5964 "filter_or": filter_or,
5965 "is_shared_root": is_shared_root,
5966 "is_users_root": is_users_root,
5967 },
5968 transport_options=transport_options,
5969 ),
5970 )
5971 return response
5972
5973 # ### Get information about the folder with a specific id.
5974 #
5975 # GET /folders/{folder_id} -> mdls.Folder
5976 def folder(
5977 self,
5978 # Id of folder
5979 folder_id: str,
5980 # Requested fields.
5981 fields: Optional[str] = None,
5982 transport_options: Optional[transport.TransportOptions] = None,
5983 ) -> mdls.Folder:
5984 """Get Folder"""
5985 folder_id = self.encode_path_param(folder_id)
5986 response = cast(
5987 mdls.Folder,
5988 self.get(
5989 path=f"/folders/{folder_id}",
5990 structure=mdls.Folder,
5991 query_params={"fields": fields},
5992 transport_options=transport_options,
5993 ),
5994 )
5995 return response
5996
5997 # ### Update the folder with a specific id.
5998 #
5999 # PATCH /folders/{folder_id} -> mdls.Folder
6000 def update_folder(
6001 self,
6002 # Id of folder
6003 folder_id: str,
6004 body: mdls.UpdateFolder,
6005 transport_options: Optional[transport.TransportOptions] = None,
6006 ) -> mdls.Folder:
6007 """Update Folder"""
6008 folder_id = self.encode_path_param(folder_id)
6009 response = cast(
6010 mdls.Folder,
6011 self.patch(
6012 path=f"/folders/{folder_id}",
6013 structure=mdls.Folder,
6014 body=body,
6015 transport_options=transport_options,
6016 ),
6017 )
6018 return response
6019
6020 # ### Delete the folder with a specific id including any children folders.
6021 # **DANGER** this will delete all looks and dashboards in the folder.
6022 #
6023 # DELETE /folders/{folder_id} -> str
6024 def delete_folder(
6025 self,
6026 # Id of folder
6027 folder_id: str,
6028 transport_options: Optional[transport.TransportOptions] = None,
6029 ) -> str:
6030 """Delete Folder"""
6031 folder_id = self.encode_path_param(folder_id)
6032 response = cast(
6033 str,
6034 self.delete(
6035 path=f"/folders/{folder_id}",
6036 structure=str,
6037 transport_options=transport_options,
6038 ),
6039 )
6040 return response
6041
6042 # ### Get information about all folders.
6043 #
6044 # All personal folders will be returned.
6045 #
6046 # GET /folders -> Sequence[mdls.FolderBase]
6047 def all_folders(
6048 self,
6049 # Requested fields.
6050 fields: Optional[str] = None,
6051 transport_options: Optional[transport.TransportOptions] = None,
6052 ) -> Sequence[mdls.FolderBase]:
6053 """Get All Folders"""
6054 response = cast(
6055 Sequence[mdls.FolderBase],
6056 self.get(
6057 path="/folders",
6058 structure=Sequence[mdls.FolderBase],
6059 query_params={"fields": fields},
6060 transport_options=transport_options,
6061 ),
6062 )
6063 return response
6064
6065 # ### Create a folder with specified information.
6066 #
6067 # Caller must have permission to edit the parent folder and to create folders, otherwise the request
6068 # returns 404 Not Found.
6069 #
6070 # POST /folders -> mdls.Folder
6071 def create_folder(
6072 self,
6073 body: mdls.CreateFolder,
6074 transport_options: Optional[transport.TransportOptions] = None,
6075 ) -> mdls.Folder:
6076 """Create Folder"""
6077 response = cast(
6078 mdls.Folder,
6079 self.post(
6080 path="/folders",
6081 structure=mdls.Folder,
6082 body=body,
6083 transport_options=transport_options,
6084 ),
6085 )
6086 return response
6087
6088 # ### Get the children of a folder.
6089 #
6090 # GET /folders/{folder_id}/children -> Sequence[mdls.Folder]
6091 def folder_children(
6092 self,
6093 # Id of folder
6094 folder_id: str,
6095 # Requested fields.
6096 fields: Optional[str] = None,
6097 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
6098 page: Optional[int] = None,
6099 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
6100 per_page: Optional[int] = None,
6101 # Number of results to return. (used with offset and takes priority over page and per_page)
6102 limit: Optional[int] = None,
6103 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
6104 offset: Optional[int] = None,
6105 # Fields to sort by.
6106 sorts: Optional[str] = None,
6107 transport_options: Optional[transport.TransportOptions] = None,
6108 ) -> Sequence[mdls.Folder]:
6109 """Get Folder Children"""
6110 folder_id = self.encode_path_param(folder_id)
6111 response = cast(
6112 Sequence[mdls.Folder],
6113 self.get(
6114 path=f"/folders/{folder_id}/children",
6115 structure=Sequence[mdls.Folder],
6116 query_params={
6117 "fields": fields,
6118 "page": page,
6119 "per_page": per_page,
6120 "limit": limit,
6121 "offset": offset,
6122 "sorts": sorts,
6123 },
6124 transport_options=transport_options,
6125 ),
6126 )
6127 return response
6128
6129 # ### Search the children of a folder
6130 #
6131 # GET /folders/{folder_id}/children/search -> Sequence[mdls.Folder]
6132 def folder_children_search(
6133 self,
6134 # Id of folder
6135 folder_id: str,
6136 # Requested fields.
6137 fields: Optional[str] = None,
6138 # Fields to sort by.
6139 sorts: Optional[str] = None,
6140 # Match folder name.
6141 name: Optional[str] = None,
6142 transport_options: Optional[transport.TransportOptions] = None,
6143 ) -> Sequence[mdls.Folder]:
6144 """Search Folder Children"""
6145 folder_id = self.encode_path_param(folder_id)
6146 response = cast(
6147 Sequence[mdls.Folder],
6148 self.get(
6149 path=f"/folders/{folder_id}/children/search",
6150 structure=Sequence[mdls.Folder],
6151 query_params={"fields": fields, "sorts": sorts, "name": name},
6152 transport_options=transport_options,
6153 ),
6154 )
6155 return response
6156
6157 # ### Get the parent of a folder
6158 #
6159 # GET /folders/{folder_id}/parent -> mdls.Folder
6160 def folder_parent(
6161 self,
6162 # Id of folder
6163 folder_id: str,
6164 # Requested fields.
6165 fields: Optional[str] = None,
6166 transport_options: Optional[transport.TransportOptions] = None,
6167 ) -> mdls.Folder:
6168 """Get Folder Parent"""
6169 folder_id = self.encode_path_param(folder_id)
6170 response = cast(
6171 mdls.Folder,
6172 self.get(
6173 path=f"/folders/{folder_id}/parent",
6174 structure=mdls.Folder,
6175 query_params={"fields": fields},
6176 transport_options=transport_options,
6177 ),
6178 )
6179 return response
6180
6181 # ### Get the ancestors of a folder
6182 #
6183 # GET /folders/{folder_id}/ancestors -> Sequence[mdls.Folder]
6184 def folder_ancestors(
6185 self,
6186 # Id of folder
6187 folder_id: str,
6188 # Requested fields.
6189 fields: Optional[str] = None,
6190 transport_options: Optional[transport.TransportOptions] = None,
6191 ) -> Sequence[mdls.Folder]:
6192 """Get Folder Ancestors"""
6193 folder_id = self.encode_path_param(folder_id)
6194 response = cast(
6195 Sequence[mdls.Folder],
6196 self.get(
6197 path=f"/folders/{folder_id}/ancestors",
6198 structure=Sequence[mdls.Folder],
6199 query_params={"fields": fields},
6200 transport_options=transport_options,
6201 ),
6202 )
6203 return response
6204
6205 # ### Get all looks in a folder.
6206 # In API 4.0+, all looks in a folder will be returned, excluding looks in the trash.
6207 #
6208 # GET /folders/{folder_id}/looks -> Sequence[mdls.LookWithQuery]
6209 def folder_looks(
6210 self,
6211 # Id of folder
6212 folder_id: str,
6213 # Requested fields.
6214 fields: Optional[str] = None,
6215 transport_options: Optional[transport.TransportOptions] = None,
6216 ) -> Sequence[mdls.LookWithQuery]:
6217 """Get Folder Looks"""
6218 folder_id = self.encode_path_param(folder_id)
6219 response = cast(
6220 Sequence[mdls.LookWithQuery],
6221 self.get(
6222 path=f"/folders/{folder_id}/looks",
6223 structure=Sequence[mdls.LookWithQuery],
6224 query_params={"fields": fields},
6225 transport_options=transport_options,
6226 ),
6227 )
6228 return response
6229
6230 # ### Get the dashboards in a folder
6231 #
6232 # GET /folders/{folder_id}/dashboards -> Sequence[mdls.Dashboard]
6233 def folder_dashboards(
6234 self,
6235 # Id of folder
6236 folder_id: str,
6237 # Requested fields.
6238 fields: Optional[str] = None,
6239 transport_options: Optional[transport.TransportOptions] = None,
6240 ) -> Sequence[mdls.Dashboard]:
6241 """Get Folder Dashboards"""
6242 folder_id = self.encode_path_param(folder_id)
6243 response = cast(
6244 Sequence[mdls.Dashboard],
6245 self.get(
6246 path=f"/folders/{folder_id}/dashboards",
6247 structure=Sequence[mdls.Dashboard],
6248 query_params={"fields": fields},
6249 transport_options=transport_options,
6250 ),
6251 )
6252 return response
6253
6254 # endregion
6255
6256 # region Group: Manage Groups
6257
6258 # ### Get information about all groups.
6259 #
6260 # GET /groups -> Sequence[mdls.Group]
6261 def all_groups(
6262 self,
6263 # Requested fields.
6264 fields: Optional[str] = None,
6265 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
6266 page: Optional[int] = None,
6267 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
6268 per_page: Optional[int] = None,
6269 # Number of results to return. (used with offset and takes priority over page and per_page)
6270 limit: Optional[int] = None,
6271 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
6272 offset: Optional[int] = None,
6273 # Fields to sort by.
6274 sorts: Optional[str] = None,
6275 # Optional of ids to get specific groups.
6276 ids: Optional[mdls.DelimSequence[str]] = None,
6277 # Id of content metadata to which groups must have access.
6278 content_metadata_id: Optional[str] = None,
6279 # Select only groups that either can/cannot be given access to content.
6280 can_add_to_content_metadata: Optional[bool] = None,
6281 transport_options: Optional[transport.TransportOptions] = None,
6282 ) -> Sequence[mdls.Group]:
6283 """Get All Groups"""
6284 response = cast(
6285 Sequence[mdls.Group],
6286 self.get(
6287 path="/groups",
6288 structure=Sequence[mdls.Group],
6289 query_params={
6290 "fields": fields,
6291 "page": page,
6292 "per_page": per_page,
6293 "limit": limit,
6294 "offset": offset,
6295 "sorts": sorts,
6296 "ids": ids,
6297 "content_metadata_id": content_metadata_id,
6298 "can_add_to_content_metadata": can_add_to_content_metadata,
6299 },
6300 transport_options=transport_options,
6301 ),
6302 )
6303 return response
6304
6305 # ### Creates a new group (admin only).
6306 #
6307 # POST /groups -> mdls.Group
6308 def create_group(
6309 self,
6310 body: mdls.WriteGroup,
6311 # Requested fields.
6312 fields: Optional[str] = None,
6313 transport_options: Optional[transport.TransportOptions] = None,
6314 ) -> mdls.Group:
6315 """Create Group"""
6316 response = cast(
6317 mdls.Group,
6318 self.post(
6319 path="/groups",
6320 structure=mdls.Group,
6321 query_params={"fields": fields},
6322 body=body,
6323 transport_options=transport_options,
6324 ),
6325 )
6326 return response
6327
6328 # ### Search groups
6329 #
6330 # Returns all group records that match the given search criteria.
6331 #
6332 # If multiple search params are given and `filter_or` is FALSE or not specified,
6333 # search params are combined in a logical AND operation.
6334 # Only rows that match *all* search param criteria will be returned.
6335 #
6336 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
6337 # Results will include rows that match **any** of the search criteria.
6338 #
6339 # String search params use case-insensitive matching.
6340 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
6341 # example="dan%" will match "danger" and "Danzig" but not "David"
6342 # example="D_m%" will match "Damage" and "dump"
6343 #
6344 # Integer search params can accept a single value or a comma separated list of values. The multiple
6345 # values will be combined under a logical OR operation - results will match at least one of
6346 # the given values.
6347 #
6348 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
6349 # or exclude (respectively) rows where the column is null.
6350 #
6351 # Boolean search params accept only "true" and "false" as values.
6352 #
6353 # GET /groups/search -> Sequence[mdls.Group]
6354 def search_groups(
6355 self,
6356 # Requested fields.
6357 fields: Optional[str] = None,
6358 # Number of results to return (used with `offset`).
6359 limit: Optional[int] = None,
6360 # Number of results to skip before returning any (used with `limit`).
6361 offset: Optional[int] = None,
6362 # Fields to sort by.
6363 sorts: Optional[str] = None,
6364 # Combine given search criteria in a boolean OR expression
6365 filter_or: Optional[bool] = None,
6366 # Match group id.
6367 id: Optional[str] = None,
6368 # Match group name.
6369 name: Optional[str] = None,
6370 # Match group external_group_id.
6371 external_group_id: Optional[str] = None,
6372 # Match group externally_managed.
6373 externally_managed: Optional[bool] = None,
6374 # Match group externally_orphaned.
6375 externally_orphaned: Optional[bool] = None,
6376 transport_options: Optional[transport.TransportOptions] = None,
6377 ) -> Sequence[mdls.Group]:
6378 """Search Groups"""
6379 response = cast(
6380 Sequence[mdls.Group],
6381 self.get(
6382 path="/groups/search",
6383 structure=Sequence[mdls.Group],
6384 query_params={
6385 "fields": fields,
6386 "limit": limit,
6387 "offset": offset,
6388 "sorts": sorts,
6389 "filter_or": filter_or,
6390 "id": id,
6391 "name": name,
6392 "external_group_id": external_group_id,
6393 "externally_managed": externally_managed,
6394 "externally_orphaned": externally_orphaned,
6395 },
6396 transport_options=transport_options,
6397 ),
6398 )
6399 return response
6400
6401 # ### Search groups include roles
6402 #
6403 # Returns all group records that match the given search criteria, and attaches any associated roles.
6404 #
6405 # If multiple search params are given and `filter_or` is FALSE or not specified,
6406 # search params are combined in a logical AND operation.
6407 # Only rows that match *all* search param criteria will be returned.
6408 #
6409 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
6410 # Results will include rows that match **any** of the search criteria.
6411 #
6412 # String search params use case-insensitive matching.
6413 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
6414 # example="dan%" will match "danger" and "Danzig" but not "David"
6415 # example="D_m%" will match "Damage" and "dump"
6416 #
6417 # Integer search params can accept a single value or a comma separated list of values. The multiple
6418 # values will be combined under a logical OR operation - results will match at least one of
6419 # the given values.
6420 #
6421 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
6422 # or exclude (respectively) rows where the column is null.
6423 #
6424 # Boolean search params accept only "true" and "false" as values.
6425 #
6426 # GET /groups/search/with_roles -> Sequence[mdls.GroupSearch]
6427 def search_groups_with_roles(
6428 self,
6429 # Requested fields.
6430 fields: Optional[str] = None,
6431 # Number of results to return (used with `offset`).
6432 limit: Optional[int] = None,
6433 # Number of results to skip before returning any (used with `limit`).
6434 offset: Optional[int] = None,
6435 # Fields to sort by.
6436 sorts: Optional[str] = None,
6437 # Combine given search criteria in a boolean OR expression
6438 filter_or: Optional[bool] = None,
6439 # Match group id.
6440 id: Optional[str] = None,
6441 # Match group name.
6442 name: Optional[str] = None,
6443 # Match group external_group_id.
6444 external_group_id: Optional[str] = None,
6445 # Match group externally_managed.
6446 externally_managed: Optional[bool] = None,
6447 # Match group externally_orphaned.
6448 externally_orphaned: Optional[bool] = None,
6449 transport_options: Optional[transport.TransportOptions] = None,
6450 ) -> Sequence[mdls.GroupSearch]:
6451 """Search Groups with Roles"""
6452 response = cast(
6453 Sequence[mdls.GroupSearch],
6454 self.get(
6455 path="/groups/search/with_roles",
6456 structure=Sequence[mdls.GroupSearch],
6457 query_params={
6458 "fields": fields,
6459 "limit": limit,
6460 "offset": offset,
6461 "sorts": sorts,
6462 "filter_or": filter_or,
6463 "id": id,
6464 "name": name,
6465 "external_group_id": external_group_id,
6466 "externally_managed": externally_managed,
6467 "externally_orphaned": externally_orphaned,
6468 },
6469 transport_options=transport_options,
6470 ),
6471 )
6472 return response
6473
6474 # ### Search groups include hierarchy
6475 #
6476 # Returns all group records that match the given search criteria, and attaches
6477 # associated role_ids and parent group_ids.
6478 #
6479 # If multiple search params are given and `filter_or` is FALSE or not specified,
6480 # search params are combined in a logical AND operation.
6481 # Only rows that match *all* search param criteria will be returned.
6482 #
6483 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
6484 # Results will include rows that match **any** of the search criteria.
6485 #
6486 # String search params use case-insensitive matching.
6487 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
6488 # example="dan%" will match "danger" and "Danzig" but not "David"
6489 # example="D_m%" will match "Damage" and "dump"
6490 #
6491 # Integer search params can accept a single value or a comma separated list of values. The multiple
6492 # values will be combined under a logical OR operation - results will match at least one of
6493 # the given values.
6494 #
6495 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
6496 # or exclude (respectively) rows where the column is null.
6497 #
6498 # Boolean search params accept only "true" and "false" as values.
6499 #
6500 # GET /groups/search/with_hierarchy -> Sequence[mdls.GroupHierarchy]
6501 def search_groups_with_hierarchy(
6502 self,
6503 # Requested fields.
6504 fields: Optional[str] = None,
6505 # Number of results to return (used with `offset`).
6506 limit: Optional[int] = None,
6507 # Number of results to skip before returning any (used with `limit`).
6508 offset: Optional[int] = None,
6509 # Fields to sort by.
6510 sorts: Optional[str] = None,
6511 # Combine given search criteria in a boolean OR expression
6512 filter_or: Optional[bool] = None,
6513 # Match group id.
6514 id: Optional[str] = None,
6515 # Match group name.
6516 name: Optional[str] = None,
6517 # Match group external_group_id.
6518 external_group_id: Optional[str] = None,
6519 # Match group externally_managed.
6520 externally_managed: Optional[bool] = None,
6521 # Match group externally_orphaned.
6522 externally_orphaned: Optional[bool] = None,
6523 transport_options: Optional[transport.TransportOptions] = None,
6524 ) -> Sequence[mdls.GroupHierarchy]:
6525 """Search Groups with Hierarchy"""
6526 response = cast(
6527 Sequence[mdls.GroupHierarchy],
6528 self.get(
6529 path="/groups/search/with_hierarchy",
6530 structure=Sequence[mdls.GroupHierarchy],
6531 query_params={
6532 "fields": fields,
6533 "limit": limit,
6534 "offset": offset,
6535 "sorts": sorts,
6536 "filter_or": filter_or,
6537 "id": id,
6538 "name": name,
6539 "external_group_id": external_group_id,
6540 "externally_managed": externally_managed,
6541 "externally_orphaned": externally_orphaned,
6542 },
6543 transport_options=transport_options,
6544 ),
6545 )
6546 return response
6547
6548 # ### Get information about a group.
6549 #
6550 # GET /groups/{group_id} -> mdls.Group
6551 def group(
6552 self,
6553 # Id of group
6554 group_id: str,
6555 # Requested fields.
6556 fields: Optional[str] = None,
6557 transport_options: Optional[transport.TransportOptions] = None,
6558 ) -> mdls.Group:
6559 """Get Group"""
6560 group_id = self.encode_path_param(group_id)
6561 response = cast(
6562 mdls.Group,
6563 self.get(
6564 path=f"/groups/{group_id}",
6565 structure=mdls.Group,
6566 query_params={"fields": fields},
6567 transport_options=transport_options,
6568 ),
6569 )
6570 return response
6571
6572 # ### Updates the a group (admin only).
6573 #
6574 # PATCH /groups/{group_id} -> mdls.Group
6575 def update_group(
6576 self,
6577 # Id of group
6578 group_id: str,
6579 body: mdls.WriteGroup,
6580 # Requested fields.
6581 fields: Optional[str] = None,
6582 transport_options: Optional[transport.TransportOptions] = None,
6583 ) -> mdls.Group:
6584 """Update Group"""
6585 group_id = self.encode_path_param(group_id)
6586 response = cast(
6587 mdls.Group,
6588 self.patch(
6589 path=f"/groups/{group_id}",
6590 structure=mdls.Group,
6591 query_params={"fields": fields},
6592 body=body,
6593 transport_options=transport_options,
6594 ),
6595 )
6596 return response
6597
6598 # ### Deletes a group (admin only).
6599 #
6600 # DELETE /groups/{group_id} -> str
6601 def delete_group(
6602 self,
6603 # Id of group
6604 group_id: str,
6605 transport_options: Optional[transport.TransportOptions] = None,
6606 ) -> str:
6607 """Delete Group"""
6608 group_id = self.encode_path_param(group_id)
6609 response = cast(
6610 str,
6611 self.delete(
6612 path=f"/groups/{group_id}",
6613 structure=str,
6614 transport_options=transport_options,
6615 ),
6616 )
6617 return response
6618
6619 # ### Get information about all the groups in a group
6620 #
6621 # GET /groups/{group_id}/groups -> Sequence[mdls.Group]
6622 def all_group_groups(
6623 self,
6624 # Id of group
6625 group_id: str,
6626 # Requested fields.
6627 fields: Optional[str] = None,
6628 transport_options: Optional[transport.TransportOptions] = None,
6629 ) -> Sequence[mdls.Group]:
6630 """Get All Groups in Group"""
6631 group_id = self.encode_path_param(group_id)
6632 response = cast(
6633 Sequence[mdls.Group],
6634 self.get(
6635 path=f"/groups/{group_id}/groups",
6636 structure=Sequence[mdls.Group],
6637 query_params={"fields": fields},
6638 transport_options=transport_options,
6639 ),
6640 )
6641 return response
6642
6643 # ### Adds a new group to a group.
6644 #
6645 # POST /groups/{group_id}/groups -> mdls.Group
6646 def add_group_group(
6647 self,
6648 # Id of group
6649 group_id: str,
6650 # WARNING: no writeable properties found for POST, PUT, or PATCH
6651 body: mdls.GroupIdForGroupInclusion,
6652 transport_options: Optional[transport.TransportOptions] = None,
6653 ) -> mdls.Group:
6654 """Add a Group to Group"""
6655 group_id = self.encode_path_param(group_id)
6656 response = cast(
6657 mdls.Group,
6658 self.post(
6659 path=f"/groups/{group_id}/groups",
6660 structure=mdls.Group,
6661 body=body,
6662 transport_options=transport_options,
6663 ),
6664 )
6665 return response
6666
6667 # ### Get information about all the users directly included in a group.
6668 #
6669 # GET /groups/{group_id}/users -> Sequence[mdls.User]
6670 def all_group_users(
6671 self,
6672 # Id of group
6673 group_id: str,
6674 # Requested fields.
6675 fields: Optional[str] = None,
6676 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
6677 page: Optional[int] = None,
6678 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
6679 per_page: Optional[int] = None,
6680 # Number of results to return. (used with offset and takes priority over page and per_page)
6681 limit: Optional[int] = None,
6682 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
6683 offset: Optional[int] = None,
6684 # Fields to sort by.
6685 sorts: Optional[str] = None,
6686 transport_options: Optional[transport.TransportOptions] = None,
6687 ) -> Sequence[mdls.User]:
6688 """Get All Users in Group"""
6689 group_id = self.encode_path_param(group_id)
6690 response = cast(
6691 Sequence[mdls.User],
6692 self.get(
6693 path=f"/groups/{group_id}/users",
6694 structure=Sequence[mdls.User],
6695 query_params={
6696 "fields": fields,
6697 "page": page,
6698 "per_page": per_page,
6699 "limit": limit,
6700 "offset": offset,
6701 "sorts": sorts,
6702 },
6703 transport_options=transport_options,
6704 ),
6705 )
6706 return response
6707
6708 # ### Adds a new user to a group.
6709 #
6710 # POST /groups/{group_id}/users -> mdls.User
6711 def add_group_user(
6712 self,
6713 # Id of group
6714 group_id: str,
6715 # WARNING: no writeable properties found for POST, PUT, or PATCH
6716 body: mdls.GroupIdForGroupUserInclusion,
6717 transport_options: Optional[transport.TransportOptions] = None,
6718 ) -> mdls.User:
6719 """Add a User to Group"""
6720 group_id = self.encode_path_param(group_id)
6721 response = cast(
6722 mdls.User,
6723 self.post(
6724 path=f"/groups/{group_id}/users",
6725 structure=mdls.User,
6726 body=body,
6727 transport_options=transport_options,
6728 ),
6729 )
6730 return response
6731
6732 # ### Removes a user from a group.
6733 #
6734 # DELETE /groups/{group_id}/users/{user_id} -> None
6735 def delete_group_user(
6736 self,
6737 # Id of group
6738 group_id: str,
6739 # Id of user to remove from group
6740 user_id: str,
6741 transport_options: Optional[transport.TransportOptions] = None,
6742 ) -> None:
6743 """Remove a User from Group"""
6744 group_id = self.encode_path_param(group_id)
6745 user_id = self.encode_path_param(user_id)
6746 response = cast(
6747 None,
6748 self.delete(
6749 path=f"/groups/{group_id}/users/{user_id}",
6750 structure=None,
6751 transport_options=transport_options,
6752 ),
6753 )
6754 return response
6755
6756 # ### Removes a group from a group.
6757 #
6758 # DELETE /groups/{group_id}/groups/{deleting_group_id} -> None
6759 def delete_group_from_group(
6760 self,
6761 # Id of group
6762 group_id: str,
6763 # Id of group to delete
6764 deleting_group_id: str,
6765 transport_options: Optional[transport.TransportOptions] = None,
6766 ) -> None:
6767 """Deletes a Group from Group"""
6768 group_id = self.encode_path_param(group_id)
6769 deleting_group_id = self.encode_path_param(deleting_group_id)
6770 response = cast(
6771 None,
6772 self.delete(
6773 path=f"/groups/{group_id}/groups/{deleting_group_id}",
6774 structure=None,
6775 transport_options=transport_options,
6776 ),
6777 )
6778 return response
6779
6780 # ### Set the value of a user attribute for a group.
6781 #
6782 # For information about how user attribute values are calculated, see [Set User Attribute Group Values](#!/UserAttribute/set_user_attribute_group_values).
6783 #
6784 # PATCH /groups/{group_id}/attribute_values/{user_attribute_id} -> mdls.UserAttributeGroupValue
6785 def update_user_attribute_group_value(
6786 self,
6787 # Id of group
6788 group_id: str,
6789 # Id of user attribute
6790 user_attribute_id: str,
6791 # WARNING: no writeable properties found for POST, PUT, or PATCH
6792 body: mdls.UserAttributeGroupValue,
6793 transport_options: Optional[transport.TransportOptions] = None,
6794 ) -> mdls.UserAttributeGroupValue:
6795 """Set User Attribute Group Value"""
6796 group_id = self.encode_path_param(group_id)
6797 user_attribute_id = self.encode_path_param(user_attribute_id)
6798 response = cast(
6799 mdls.UserAttributeGroupValue,
6800 self.patch(
6801 path=f"/groups/{group_id}/attribute_values/{user_attribute_id}",
6802 structure=mdls.UserAttributeGroupValue,
6803 body=body,
6804 transport_options=transport_options,
6805 ),
6806 )
6807 return response
6808
6809 # ### Remove a user attribute value from a group.
6810 #
6811 # DELETE /groups/{group_id}/attribute_values/{user_attribute_id} -> None
6812 def delete_user_attribute_group_value(
6813 self,
6814 # Id of group
6815 group_id: str,
6816 # Id of user attribute
6817 user_attribute_id: str,
6818 transport_options: Optional[transport.TransportOptions] = None,
6819 ) -> None:
6820 """Delete User Attribute Group Value"""
6821 group_id = self.encode_path_param(group_id)
6822 user_attribute_id = self.encode_path_param(user_attribute_id)
6823 response = cast(
6824 None,
6825 self.delete(
6826 path=f"/groups/{group_id}/attribute_values/{user_attribute_id}",
6827 structure=None,
6828 transport_options=transport_options,
6829 ),
6830 )
6831 return response
6832
6833 # endregion
6834
6835 # region Homepage: Manage Homepage
6836
6837 # ### Get information about the primary homepage's sections.
6838 #
6839 # GET /primary_homepage_sections -> Sequence[mdls.HomepageSection]
6840 def all_primary_homepage_sections(
6841 self,
6842 # Requested fields.
6843 fields: Optional[str] = None,
6844 transport_options: Optional[transport.TransportOptions] = None,
6845 ) -> Sequence[mdls.HomepageSection]:
6846 """Get All Primary homepage sections"""
6847 response = cast(
6848 Sequence[mdls.HomepageSection],
6849 self.get(
6850 path="/primary_homepage_sections",
6851 structure=Sequence[mdls.HomepageSection],
6852 query_params={"fields": fields},
6853 transport_options=transport_options,
6854 ),
6855 )
6856 return response
6857
6858 # endregion
6859
6860 # region Integration: Manage Integrations
6861
6862 # ### Get information about all Integration Hubs.
6863 #
6864 # GET /integration_hubs -> Sequence[mdls.IntegrationHub]
6865 def all_integration_hubs(
6866 self,
6867 # Requested fields.
6868 fields: Optional[str] = None,
6869 transport_options: Optional[transport.TransportOptions] = None,
6870 ) -> Sequence[mdls.IntegrationHub]:
6871 """Get All Integration Hubs"""
6872 response = cast(
6873 Sequence[mdls.IntegrationHub],
6874 self.get(
6875 path="/integration_hubs",
6876 structure=Sequence[mdls.IntegrationHub],
6877 query_params={"fields": fields},
6878 transport_options=transport_options,
6879 ),
6880 )
6881 return response
6882
6883 # ### Create a new Integration Hub.
6884 #
6885 # This API is rate limited to prevent it from being used for SSRF attacks
6886 #
6887 # POST /integration_hubs -> mdls.IntegrationHub
6888 def create_integration_hub(
6889 self,
6890 body: mdls.WriteIntegrationHub,
6891 # Requested fields.
6892 fields: Optional[str] = None,
6893 transport_options: Optional[transport.TransportOptions] = None,
6894 ) -> mdls.IntegrationHub:
6895 """Create Integration Hub"""
6896 response = cast(
6897 mdls.IntegrationHub,
6898 self.post(
6899 path="/integration_hubs",
6900 structure=mdls.IntegrationHub,
6901 query_params={"fields": fields},
6902 body=body,
6903 transport_options=transport_options,
6904 ),
6905 )
6906 return response
6907
6908 # ### Get information about a Integration Hub.
6909 #
6910 # GET /integration_hubs/{integration_hub_id} -> mdls.IntegrationHub
6911 def integration_hub(
6912 self,
6913 # Id of integration_hub
6914 integration_hub_id: str,
6915 # Requested fields.
6916 fields: Optional[str] = None,
6917 transport_options: Optional[transport.TransportOptions] = None,
6918 ) -> mdls.IntegrationHub:
6919 """Get Integration Hub"""
6920 integration_hub_id = self.encode_path_param(integration_hub_id)
6921 response = cast(
6922 mdls.IntegrationHub,
6923 self.get(
6924 path=f"/integration_hubs/{integration_hub_id}",
6925 structure=mdls.IntegrationHub,
6926 query_params={"fields": fields},
6927 transport_options=transport_options,
6928 ),
6929 )
6930 return response
6931
6932 # ### Update a Integration Hub definition.
6933 #
6934 # This API is rate limited to prevent it from being used for SSRF attacks
6935 #
6936 # PATCH /integration_hubs/{integration_hub_id} -> mdls.IntegrationHub
6937 def update_integration_hub(
6938 self,
6939 # Id of integration_hub
6940 integration_hub_id: str,
6941 body: mdls.WriteIntegrationHub,
6942 # Requested fields.
6943 fields: Optional[str] = None,
6944 transport_options: Optional[transport.TransportOptions] = None,
6945 ) -> mdls.IntegrationHub:
6946 """Update Integration Hub"""
6947 integration_hub_id = self.encode_path_param(integration_hub_id)
6948 response = cast(
6949 mdls.IntegrationHub,
6950 self.patch(
6951 path=f"/integration_hubs/{integration_hub_id}",
6952 structure=mdls.IntegrationHub,
6953 query_params={"fields": fields},
6954 body=body,
6955 transport_options=transport_options,
6956 ),
6957 )
6958 return response
6959
6960 # ### Delete a Integration Hub.
6961 #
6962 # DELETE /integration_hubs/{integration_hub_id} -> str
6963 def delete_integration_hub(
6964 self,
6965 # Id of integration_hub
6966 integration_hub_id: str,
6967 transport_options: Optional[transport.TransportOptions] = None,
6968 ) -> str:
6969 """Delete Integration Hub"""
6970 integration_hub_id = self.encode_path_param(integration_hub_id)
6971 response = cast(
6972 str,
6973 self.delete(
6974 path=f"/integration_hubs/{integration_hub_id}",
6975 structure=str,
6976 transport_options=transport_options,
6977 ),
6978 )
6979 return response
6980
6981 # Accepts the legal agreement for a given integration hub. This only works for integration hubs that have legal_agreement_required set to true and legal_agreement_signed set to false.
6982 #
6983 # POST /integration_hubs/{integration_hub_id}/accept_legal_agreement -> mdls.IntegrationHub
6984 def accept_integration_hub_legal_agreement(
6985 self,
6986 # Id of integration_hub
6987 integration_hub_id: str,
6988 transport_options: Optional[transport.TransportOptions] = None,
6989 ) -> mdls.IntegrationHub:
6990 """Accept Integration Hub Legal Agreement"""
6991 integration_hub_id = self.encode_path_param(integration_hub_id)
6992 response = cast(
6993 mdls.IntegrationHub,
6994 self.post(
6995 path=f"/integration_hubs/{integration_hub_id}/accept_legal_agreement",
6996 structure=mdls.IntegrationHub,
6997 transport_options=transport_options,
6998 ),
6999 )
7000 return response
7001
7002 # ### Get information about all Integrations.
7003 #
7004 # GET /integrations -> Sequence[mdls.Integration]
7005 def all_integrations(
7006 self,
7007 # Requested fields.
7008 fields: Optional[str] = None,
7009 # Filter to a specific provider
7010 integration_hub_id: Optional[str] = None,
7011 transport_options: Optional[transport.TransportOptions] = None,
7012 ) -> Sequence[mdls.Integration]:
7013 """Get All Integrations"""
7014 response = cast(
7015 Sequence[mdls.Integration],
7016 self.get(
7017 path="/integrations",
7018 structure=Sequence[mdls.Integration],
7019 query_params={
7020 "fields": fields,
7021 "integration_hub_id": integration_hub_id,
7022 },
7023 transport_options=transport_options,
7024 ),
7025 )
7026 return response
7027
7028 # ### Get information about a Integration.
7029 #
7030 # GET /integrations/{integration_id} -> mdls.Integration
7031 def integration(
7032 self,
7033 # Id of integration
7034 integration_id: str,
7035 # Requested fields.
7036 fields: Optional[str] = None,
7037 transport_options: Optional[transport.TransportOptions] = None,
7038 ) -> mdls.Integration:
7039 """Get Integration"""
7040 integration_id = self.encode_path_param(integration_id)
7041 response = cast(
7042 mdls.Integration,
7043 self.get(
7044 path=f"/integrations/{integration_id}",
7045 structure=mdls.Integration,
7046 query_params={"fields": fields},
7047 transport_options=transport_options,
7048 ),
7049 )
7050 return response
7051
7052 # ### Update parameters on a Integration.
7053 #
7054 # PATCH /integrations/{integration_id} -> mdls.Integration
7055 def update_integration(
7056 self,
7057 # Id of integration
7058 integration_id: str,
7059 body: mdls.WriteIntegration,
7060 # Requested fields.
7061 fields: Optional[str] = None,
7062 transport_options: Optional[transport.TransportOptions] = None,
7063 ) -> mdls.Integration:
7064 """Update Integration"""
7065 integration_id = self.encode_path_param(integration_id)
7066 response = cast(
7067 mdls.Integration,
7068 self.patch(
7069 path=f"/integrations/{integration_id}",
7070 structure=mdls.Integration,
7071 query_params={"fields": fields},
7072 body=body,
7073 transport_options=transport_options,
7074 ),
7075 )
7076 return response
7077
7078 # Returns the Integration form for presentation to the user.
7079 #
7080 # POST /integrations/{integration_id}/form -> mdls.DataActionForm
7081 def fetch_integration_form(
7082 self,
7083 # Id of integration
7084 integration_id: str,
7085 body: Optional[MutableMapping[str, Any]] = None,
7086 transport_options: Optional[transport.TransportOptions] = None,
7087 ) -> mdls.DataActionForm:
7088 """Fetch Remote Integration Form"""
7089 integration_id = self.encode_path_param(integration_id)
7090 response = cast(
7091 mdls.DataActionForm,
7092 self.post(
7093 path=f"/integrations/{integration_id}/form",
7094 structure=mdls.DataActionForm,
7095 body=body,
7096 transport_options=transport_options,
7097 ),
7098 )
7099 return response
7100
7101 # Tests the integration to make sure all the settings are working.
7102 #
7103 # POST /integrations/{integration_id}/test -> mdls.IntegrationTestResult
7104 def test_integration(
7105 self,
7106 # Id of integration
7107 integration_id: str,
7108 transport_options: Optional[transport.TransportOptions] = None,
7109 ) -> mdls.IntegrationTestResult:
7110 """Test integration"""
7111 integration_id = self.encode_path_param(integration_id)
7112 response = cast(
7113 mdls.IntegrationTestResult,
7114 self.post(
7115 path=f"/integrations/{integration_id}/test",
7116 structure=mdls.IntegrationTestResult,
7117 transport_options=transport_options,
7118 ),
7119 )
7120 return response
7121
7122 # endregion
7123
7124 # region Look: Run and Manage Looks
7125
7126 # ### Get information about all active Looks
7127 #
7128 # Returns an array of **abbreviated Look objects** describing all the looks that the caller has access to. Soft-deleted Looks are **not** included.
7129 #
7130 # Get the **full details** of a specific look by id with [look(id)](#!/Look/look)
7131 #
7132 # Find **soft-deleted looks** with [search_looks()](#!/Look/search_looks)
7133 #
7134 # GET /looks -> Sequence[mdls.Look]
7135 def all_looks(
7136 self,
7137 # Requested fields.
7138 fields: Optional[str] = None,
7139 transport_options: Optional[transport.TransportOptions] = None,
7140 ) -> Sequence[mdls.Look]:
7141 """Get All Looks"""
7142 response = cast(
7143 Sequence[mdls.Look],
7144 self.get(
7145 path="/looks",
7146 structure=Sequence[mdls.Look],
7147 query_params={"fields": fields},
7148 transport_options=transport_options,
7149 ),
7150 )
7151 return response
7152
7153 # ### Create a Look
7154 #
7155 # To create a look to display query data, first create the query with [create_query()](#!/Query/create_query)
7156 # then assign the query's id to the `query_id` property in the call to `create_look()`.
7157 #
7158 # To place the look into a particular space, assign the space's id to the `space_id` property
7159 # in the call to `create_look()`.
7160 #
7161 # POST /looks -> mdls.LookWithQuery
7162 def create_look(
7163 self,
7164 body: mdls.WriteLookWithQuery,
7165 # Requested fields.
7166 fields: Optional[str] = None,
7167 transport_options: Optional[transport.TransportOptions] = None,
7168 ) -> mdls.LookWithQuery:
7169 """Create Look"""
7170 response = cast(
7171 mdls.LookWithQuery,
7172 self.post(
7173 path="/looks",
7174 structure=mdls.LookWithQuery,
7175 query_params={"fields": fields},
7176 body=body,
7177 transport_options=transport_options,
7178 ),
7179 )
7180 return response
7181
7182 # ### Search Looks
7183 #
7184 # Returns an **array of Look objects** that match the specified search criteria.
7185 #
7186 # If multiple search params are given and `filter_or` is FALSE or not specified,
7187 # search params are combined in a logical AND operation.
7188 # Only rows that match *all* search param criteria will be returned.
7189 #
7190 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
7191 # Results will include rows that match **any** of the search criteria.
7192 #
7193 # String search params use case-insensitive matching.
7194 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
7195 # example="dan%" will match "danger" and "Danzig" but not "David"
7196 # example="D_m%" will match "Damage" and "dump"
7197 #
7198 # Integer search params can accept a single value or a comma separated list of values. The multiple
7199 # values will be combined under a logical OR operation - results will match at least one of
7200 # the given values.
7201 #
7202 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
7203 # or exclude (respectively) rows where the column is null.
7204 #
7205 # Boolean search params accept only "true" and "false" as values.
7206 #
7207 #
7208 # Get a **single look** by id with [look(id)](#!/Look/look)
7209 #
7210 # GET /looks/search -> Sequence[mdls.Look]
7211 def search_looks(
7212 self,
7213 # Match look id.
7214 id: Optional[str] = None,
7215 # Match Look title.
7216 title: Optional[str] = None,
7217 # Match Look description.
7218 description: Optional[str] = None,
7219 # Select looks with a particular content favorite id
7220 content_favorite_id: Optional[str] = None,
7221 # Select looks in a particular folder.
7222 folder_id: Optional[str] = None,
7223 # Select looks created by a particular user.
7224 user_id: Optional[str] = None,
7225 # Select looks with particular view_count value
7226 view_count: Optional[str] = None,
7227 # Select soft-deleted looks
7228 deleted: Optional[bool] = None,
7229 # Select looks that reference a particular query by query_id
7230 query_id: Optional[str] = None,
7231 # Exclude items that exist only in personal spaces other than the users
7232 curate: Optional[bool] = None,
7233 # Select looks based on when they were last viewed
7234 last_viewed_at: Optional[str] = None,
7235 # Requested fields.
7236 fields: Optional[str] = None,
7237 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
7238 page: Optional[int] = None,
7239 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
7240 per_page: Optional[int] = None,
7241 # Number of results to return. (used with offset and takes priority over page and per_page)
7242 limit: Optional[int] = None,
7243 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
7244 offset: Optional[int] = None,
7245 # One or more fields to sort results by. Sortable fields: [:title, :user_id, :id, :created_at, :space_id, :folder_id, :description, :updated_at, :last_updater_id, :view_count, :favorite_count, :content_favorite_id, :deleted, :deleted_at, :last_viewed_at, :last_accessed_at, :query_id]
7246 sorts: Optional[str] = None,
7247 # Combine given search criteria in a boolean OR expression
7248 filter_or: Optional[bool] = None,
7249 transport_options: Optional[transport.TransportOptions] = None,
7250 ) -> Sequence[mdls.Look]:
7251 """Search Looks"""
7252 response = cast(
7253 Sequence[mdls.Look],
7254 self.get(
7255 path="/looks/search",
7256 structure=Sequence[mdls.Look],
7257 query_params={
7258 "id": id,
7259 "title": title,
7260 "description": description,
7261 "content_favorite_id": content_favorite_id,
7262 "folder_id": folder_id,
7263 "user_id": user_id,
7264 "view_count": view_count,
7265 "deleted": deleted,
7266 "query_id": query_id,
7267 "curate": curate,
7268 "last_viewed_at": last_viewed_at,
7269 "fields": fields,
7270 "page": page,
7271 "per_page": per_page,
7272 "limit": limit,
7273 "offset": offset,
7274 "sorts": sorts,
7275 "filter_or": filter_or,
7276 },
7277 transport_options=transport_options,
7278 ),
7279 )
7280 return response
7281
7282 # ### Get a Look.
7283 #
7284 # Returns detailed information about a Look and its associated Query.
7285 #
7286 # GET /looks/{look_id} -> mdls.LookWithQuery
7287 def look(
7288 self,
7289 # Id of look
7290 look_id: str,
7291 # Requested fields.
7292 fields: Optional[str] = None,
7293 transport_options: Optional[transport.TransportOptions] = None,
7294 ) -> mdls.LookWithQuery:
7295 """Get Look"""
7296 look_id = self.encode_path_param(look_id)
7297 response = cast(
7298 mdls.LookWithQuery,
7299 self.get(
7300 path=f"/looks/{look_id}",
7301 structure=mdls.LookWithQuery,
7302 query_params={"fields": fields},
7303 transport_options=transport_options,
7304 ),
7305 )
7306 return response
7307
7308 # ### Modify a Look
7309 #
7310 # Use this function to modify parts of a look. Property values given in a call to `update_look` are
7311 # applied to the existing look, so there's no need to include properties whose values are not changing.
7312 # It's best to specify only the properties you want to change and leave everything else out
7313 # of your `update_look` call. **Look properties marked 'read-only' will be ignored.**
7314 #
7315 # When a user deletes a look in the Looker UI, the look data remains in the database but is
7316 # marked with a deleted flag ("soft-deleted"). Soft-deleted looks can be undeleted (by an admin)
7317 # if the delete was in error.
7318 #
7319 # To soft-delete a look via the API, use [update_look()](#!/Look/update_look) to change the look's `deleted` property to `true`.
7320 # You can undelete a look by calling `update_look` to change the look's `deleted` property to `false`.
7321 #
7322 # Soft-deleted looks are excluded from the results of [all_looks()](#!/Look/all_looks) and [search_looks()](#!/Look/search_looks), so they
7323 # essentially disappear from view even though they still reside in the db.
7324 # You can pass `deleted: true` as a parameter to [search_looks()](#!/Look/search_looks) to list soft-deleted looks.
7325 #
7326 # NOTE: [delete_look()](#!/Look/delete_look) performs a "hard delete" - the look data is removed from the Looker
7327 # database and destroyed. There is no "undo" for `delete_look()`.
7328 #
7329 # PATCH /looks/{look_id} -> mdls.LookWithQuery
7330 def update_look(
7331 self,
7332 # Id of look
7333 look_id: str,
7334 body: mdls.WriteLookWithQuery,
7335 # Requested fields.
7336 fields: Optional[str] = None,
7337 transport_options: Optional[transport.TransportOptions] = None,
7338 ) -> mdls.LookWithQuery:
7339 """Update Look"""
7340 look_id = self.encode_path_param(look_id)
7341 response = cast(
7342 mdls.LookWithQuery,
7343 self.patch(
7344 path=f"/looks/{look_id}",
7345 structure=mdls.LookWithQuery,
7346 query_params={"fields": fields},
7347 body=body,
7348 transport_options=transport_options,
7349 ),
7350 )
7351 return response
7352
7353 # ### Permanently Delete a Look
7354 #
7355 # This operation **permanently** removes a look from the Looker database.
7356 #
7357 # NOTE: There is no "undo" for this kind of delete.
7358 #
7359 # For information about soft-delete (which can be undone) see [update_look()](#!/Look/update_look).
7360 #
7361 # DELETE /looks/{look_id} -> str
7362 def delete_look(
7363 self,
7364 # Id of look
7365 look_id: str,
7366 transport_options: Optional[transport.TransportOptions] = None,
7367 ) -> str:
7368 """Delete Look"""
7369 look_id = self.encode_path_param(look_id)
7370 response = cast(
7371 str,
7372 self.delete(
7373 path=f"/looks/{look_id}",
7374 structure=str,
7375 transport_options=transport_options,
7376 ),
7377 )
7378 return response
7379
7380 # ### Run a Look
7381 #
7382 # Runs a given look's query and returns the results in the requested format.
7383 #
7384 # Supported formats:
7385 #
7386 # | result_format | Description
7387 # | :-----------: | :--- |
7388 # | json | Plain json
7389 # | json_bi | (*RECOMMENDED*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query. See JsonBi type for schema
7390 # | json_detail | (*LEGACY*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
7391 # | csv | Comma separated values with a header
7392 # | txt | Tab separated values with a header
7393 # | html | Simple html
7394 # | md | Simple markdown
7395 # | xlsx | MS Excel spreadsheet
7396 # | sql | Returns the generated SQL rather than running the query
7397 # | png | A PNG image of the visualization of the query
7398 # | jpg | A JPG image of the visualization of the query
7399 #
7400 # GET /looks/{look_id}/run/{result_format} -> Union[str, bytes]
7401 def run_look(
7402 self,
7403 # Id of look
7404 look_id: str,
7405 # Format of result
7406 result_format: str,
7407 # Row limit (may override the limit in the saved query).
7408 limit: Optional[int] = None,
7409 # Apply model-specified formatting to each result.
7410 apply_formatting: Optional[bool] = None,
7411 # Apply visualization options to results.
7412 apply_vis: Optional[bool] = None,
7413 # Get results from cache if available.
7414 cache: Optional[bool] = None,
7415 # Render width for image formats.
7416 image_width: Optional[int] = None,
7417 # Render height for image formats.
7418 image_height: Optional[int] = None,
7419 # Generate drill links (only applicable to 'json_detail' format.
7420 generate_drill_links: Optional[bool] = None,
7421 # Force use of production models even if the user is in development mode. Note that this flag being false does not guarantee development models will be used.
7422 force_production: Optional[bool] = None,
7423 # Retrieve any results from cache even if the results have expired.
7424 cache_only: Optional[bool] = None,
7425 # Prefix to use for drill links (url encoded).
7426 path_prefix: Optional[str] = None,
7427 # Rebuild PDTS used in query.
7428 rebuild_pdts: Optional[bool] = None,
7429 # Perform table calculations on query results
7430 server_table_calcs: Optional[bool] = None,
7431 transport_options: Optional[transport.TransportOptions] = None,
7432 ) -> Union[str, bytes]:
7433 """Run Look"""
7434 look_id = self.encode_path_param(look_id)
7435 result_format = self.encode_path_param(result_format)
7436 response = cast(
7437 Union[str, bytes],
7438 self.get(
7439 path=f"/looks/{look_id}/run/{result_format}",
7440 structure=Union[str, bytes], # type: ignore
7441 query_params={
7442 "limit": limit,
7443 "apply_formatting": apply_formatting,
7444 "apply_vis": apply_vis,
7445 "cache": cache,
7446 "image_width": image_width,
7447 "image_height": image_height,
7448 "generate_drill_links": generate_drill_links,
7449 "force_production": force_production,
7450 "cache_only": cache_only,
7451 "path_prefix": path_prefix,
7452 "rebuild_pdts": rebuild_pdts,
7453 "server_table_calcs": server_table_calcs,
7454 },
7455 transport_options=transport_options,
7456 ),
7457 )
7458 return response
7459
7460 # ### Copy an existing look
7461 #
7462 # Creates a copy of an existing look, in a specified folder, and returns the copied look.
7463 #
7464 # `look_id` and `folder_id` are required.
7465 #
7466 # `look_id` and `folder_id` must already exist, and `folder_id` must be different from the current `folder_id` of the dashboard.
7467 #
7468 # POST /looks/{look_id}/copy -> mdls.LookWithQuery
7469 def copy_look(
7470 self,
7471 # Look id to copy.
7472 look_id: str,
7473 # Folder id to copy to.
7474 folder_id: Optional[str] = None,
7475 transport_options: Optional[transport.TransportOptions] = None,
7476 ) -> mdls.LookWithQuery:
7477 """Copy Look"""
7478 look_id = self.encode_path_param(look_id)
7479 response = cast(
7480 mdls.LookWithQuery,
7481 self.post(
7482 path=f"/looks/{look_id}/copy",
7483 structure=mdls.LookWithQuery,
7484 query_params={"folder_id": folder_id},
7485 transport_options=transport_options,
7486 ),
7487 )
7488 return response
7489
7490 # ### Move an existing look
7491 #
7492 # Moves a look to a specified folder, and returns the moved look.
7493 #
7494 # `look_id` and `folder_id` are required.
7495 # `look_id` and `folder_id` must already exist, and `folder_id` must be different from the current `folder_id` of the dashboard.
7496 #
7497 # PATCH /looks/{look_id}/move -> mdls.LookWithQuery
7498 def move_look(
7499 self,
7500 # Look id to move.
7501 look_id: str,
7502 # Folder id to move to.
7503 folder_id: str,
7504 transport_options: Optional[transport.TransportOptions] = None,
7505 ) -> mdls.LookWithQuery:
7506 """Move Look"""
7507 look_id = self.encode_path_param(look_id)
7508 response = cast(
7509 mdls.LookWithQuery,
7510 self.patch(
7511 path=f"/looks/{look_id}/move",
7512 structure=mdls.LookWithQuery,
7513 query_params={"folder_id": folder_id},
7514 transport_options=transport_options,
7515 ),
7516 )
7517 return response
7518
7519 # endregion
7520
7521 # region LookmlModel: Manage LookML Models
7522
7523 # ### Get information about all lookml models.
7524 #
7525 # GET /lookml_models -> Sequence[mdls.LookmlModel]
7526 def all_lookml_models(
7527 self,
7528 # Requested fields.
7529 fields: Optional[str] = None,
7530 # Number of results to return. (can be used with offset)
7531 limit: Optional[int] = None,
7532 # Number of results to skip before returning any. (Defaults to 0 if not set when limit is used)
7533 offset: Optional[int] = None,
7534 # Whether or not to exclude models with no explores from the response (Defaults to false)
7535 exclude_empty: Optional[bool] = None,
7536 # Whether or not to exclude hidden explores from the response (Defaults to false)
7537 exclude_hidden: Optional[bool] = None,
7538 # Whether or not to include built-in models such as System Activity (Defaults to false)
7539 include_internal: Optional[bool] = None,
7540 transport_options: Optional[transport.TransportOptions] = None,
7541 ) -> Sequence[mdls.LookmlModel]:
7542 """Get All LookML Models"""
7543 response = cast(
7544 Sequence[mdls.LookmlModel],
7545 self.get(
7546 path="/lookml_models",
7547 structure=Sequence[mdls.LookmlModel],
7548 query_params={
7549 "fields": fields,
7550 "limit": limit,
7551 "offset": offset,
7552 "exclude_empty": exclude_empty,
7553 "exclude_hidden": exclude_hidden,
7554 "include_internal": include_internal,
7555 },
7556 transport_options=transport_options,
7557 ),
7558 )
7559 return response
7560
7561 # ### Create a lookml model using the specified configuration.
7562 #
7563 # POST /lookml_models -> mdls.LookmlModel
7564 def create_lookml_model(
7565 self,
7566 body: mdls.WriteLookmlModel,
7567 transport_options: Optional[transport.TransportOptions] = None,
7568 ) -> mdls.LookmlModel:
7569 """Create LookML Model"""
7570 response = cast(
7571 mdls.LookmlModel,
7572 self.post(
7573 path="/lookml_models",
7574 structure=mdls.LookmlModel,
7575 body=body,
7576 transport_options=transport_options,
7577 ),
7578 )
7579 return response
7580
7581 # ### Get information about a lookml model.
7582 #
7583 # GET /lookml_models/{lookml_model_name} -> mdls.LookmlModel
7584 def lookml_model(
7585 self,
7586 # Name of lookml model.
7587 lookml_model_name: str,
7588 # Requested fields.
7589 fields: Optional[str] = None,
7590 transport_options: Optional[transport.TransportOptions] = None,
7591 ) -> mdls.LookmlModel:
7592 """Get LookML Model"""
7593 lookml_model_name = self.encode_path_param(lookml_model_name)
7594 response = cast(
7595 mdls.LookmlModel,
7596 self.get(
7597 path=f"/lookml_models/{lookml_model_name}",
7598 structure=mdls.LookmlModel,
7599 query_params={"fields": fields},
7600 transport_options=transport_options,
7601 ),
7602 )
7603 return response
7604
7605 # ### Update a lookml model using the specified configuration.
7606 #
7607 # PATCH /lookml_models/{lookml_model_name} -> mdls.LookmlModel
7608 def update_lookml_model(
7609 self,
7610 # Name of lookml model.
7611 lookml_model_name: str,
7612 body: mdls.WriteLookmlModel,
7613 transport_options: Optional[transport.TransportOptions] = None,
7614 ) -> mdls.LookmlModel:
7615 """Update LookML Model"""
7616 lookml_model_name = self.encode_path_param(lookml_model_name)
7617 response = cast(
7618 mdls.LookmlModel,
7619 self.patch(
7620 path=f"/lookml_models/{lookml_model_name}",
7621 structure=mdls.LookmlModel,
7622 body=body,
7623 transport_options=transport_options,
7624 ),
7625 )
7626 return response
7627
7628 # ### Delete a lookml model.
7629 #
7630 # DELETE /lookml_models/{lookml_model_name} -> str
7631 def delete_lookml_model(
7632 self,
7633 # Name of lookml model.
7634 lookml_model_name: str,
7635 transport_options: Optional[transport.TransportOptions] = None,
7636 ) -> str:
7637 """Delete LookML Model"""
7638 lookml_model_name = self.encode_path_param(lookml_model_name)
7639 response = cast(
7640 str,
7641 self.delete(
7642 path=f"/lookml_models/{lookml_model_name}",
7643 structure=str,
7644 transport_options=transport_options,
7645 ),
7646 )
7647 return response
7648
7649 # ### Get information about a lookml model explore.
7650 #
7651 # GET /lookml_models/{lookml_model_name}/explores/{explore_name} -> mdls.LookmlModelExplore
7652 def lookml_model_explore(
7653 self,
7654 # Name of lookml model.
7655 lookml_model_name: str,
7656 # Name of explore.
7657 explore_name: str,
7658 # Requested fields.
7659 fields: Optional[str] = None,
7660 # Whether response should include drill field metadata.
7661 add_drills_metadata: Optional[bool] = None,
7662 transport_options: Optional[transport.TransportOptions] = None,
7663 ) -> mdls.LookmlModelExplore:
7664 """Get LookML Model Explore"""
7665 lookml_model_name = self.encode_path_param(lookml_model_name)
7666 explore_name = self.encode_path_param(explore_name)
7667 response = cast(
7668 mdls.LookmlModelExplore,
7669 self.get(
7670 path=f"/lookml_models/{lookml_model_name}/explores/{explore_name}",
7671 structure=mdls.LookmlModelExplore,
7672 query_params={
7673 "fields": fields,
7674 "add_drills_metadata": add_drills_metadata,
7675 },
7676 transport_options=transport_options,
7677 ),
7678 )
7679 return response
7680
7681 # endregion
7682
7683 # region Metadata: Connection Metadata Features
7684
7685 # ### Field name suggestions for a model and view
7686 #
7687 # `filters` is a string hash of values, with the key as the field name and the string value as the filter expression:
7688 #
7689 # ```ruby
7690 # {'users.age': '>=60'}
7691 # ```
7692 #
7693 # or
7694 #
7695 # ```ruby
7696 # {'users.age': '<30'}
7697 # ```
7698 #
7699 # or
7700 #
7701 # ```ruby
7702 # {'users.age': '=50'}
7703 # ```
7704 #
7705 # GET /models/{model_name}/views/{view_name}/fields/{field_name}/suggestions -> mdls.ModelFieldSuggestions
7706 def model_fieldname_suggestions(
7707 self,
7708 # Name of model
7709 model_name: str,
7710 # Name of view
7711 view_name: str,
7712 # Name of field to use for suggestions
7713 field_name: str,
7714 # Search term pattern (evaluated as as `%term%`)
7715 term: Optional[str] = None,
7716 # Suggestion filters with field name keys and comparison expressions
7717 filters: Optional[str] = None,
7718 transport_options: Optional[transport.TransportOptions] = None,
7719 ) -> mdls.ModelFieldSuggestions:
7720 """Model field name suggestions"""
7721 model_name = self.encode_path_param(model_name)
7722 view_name = self.encode_path_param(view_name)
7723 field_name = self.encode_path_param(field_name)
7724 response = cast(
7725 mdls.ModelFieldSuggestions,
7726 self.get(
7727 path=f"/models/{model_name}/views/{view_name}/fields/{field_name}/suggestions",
7728 structure=mdls.ModelFieldSuggestions,
7729 query_params={"term": term, "filters": filters},
7730 transport_options=transport_options,
7731 ),
7732 )
7733 return response
7734
7735 # ### Get a single model
7736 #
7737 # GET /models/{model_name} -> mdls.Model
7738 def get_model(
7739 self,
7740 # Name of model
7741 model_name: str,
7742 transport_options: Optional[transport.TransportOptions] = None,
7743 ) -> mdls.Model:
7744 """Get a single model"""
7745 model_name = self.encode_path_param(model_name)
7746 response = cast(
7747 mdls.Model,
7748 self.get(
7749 path=f"/models/{model_name}",
7750 structure=mdls.Model,
7751 transport_options=transport_options,
7752 ),
7753 )
7754 return response
7755
7756 # ### List databases available to this connection
7757 #
7758 # Certain dialects can support multiple databases per single connection.
7759 # If this connection supports multiple databases, the database names will be returned in an array.
7760 #
7761 # Connections using dialects that do not support multiple databases will return an empty array.
7762 #
7763 # **Note**: [Connection Features](#!/Metadata/connection_features) can be used to determine if a connection supports
7764 # multiple databases.
7765 #
7766 # GET /connections/{connection_name}/databases -> Sequence[str]
7767 def connection_databases(
7768 self,
7769 # Name of connection
7770 connection_name: str,
7771 transport_options: Optional[transport.TransportOptions] = None,
7772 ) -> Sequence[str]:
7773 """List accessible databases to this connection"""
7774 connection_name = self.encode_path_param(connection_name)
7775 response = cast(
7776 Sequence[str],
7777 self.get(
7778 path=f"/connections/{connection_name}/databases",
7779 structure=Sequence[str],
7780 transport_options=transport_options,
7781 ),
7782 )
7783 return response
7784
7785 # ### Retrieve metadata features for this connection
7786 #
7787 # Returns a list of feature names with `true` (available) or `false` (not available)
7788 #
7789 # GET /connections/{connection_name}/features -> mdls.ConnectionFeatures
7790 def connection_features(
7791 self,
7792 # Name of connection
7793 connection_name: str,
7794 # Requested fields.
7795 fields: Optional[str] = None,
7796 transport_options: Optional[transport.TransportOptions] = None,
7797 ) -> mdls.ConnectionFeatures:
7798 """Metadata features supported by this connection"""
7799 connection_name = self.encode_path_param(connection_name)
7800 response = cast(
7801 mdls.ConnectionFeatures,
7802 self.get(
7803 path=f"/connections/{connection_name}/features",
7804 structure=mdls.ConnectionFeatures,
7805 query_params={"fields": fields},
7806 transport_options=transport_options,
7807 ),
7808 )
7809 return response
7810
7811 # ### Get the list of schemas and tables for a connection
7812 #
7813 # GET /connections/{connection_name}/schemas -> Sequence[mdls.Schema]
7814 def connection_schemas(
7815 self,
7816 # Name of connection
7817 connection_name: str,
7818 # For dialects that support multiple databases, optionally identify which to use
7819 database: Optional[str] = None,
7820 # True to use fetch from cache, false to load fresh
7821 cache: Optional[bool] = None,
7822 # Requested fields.
7823 fields: Optional[str] = None,
7824 transport_options: Optional[transport.TransportOptions] = None,
7825 ) -> Sequence[mdls.Schema]:
7826 """Get schemas for a connection"""
7827 connection_name = self.encode_path_param(connection_name)
7828 response = cast(
7829 Sequence[mdls.Schema],
7830 self.get(
7831 path=f"/connections/{connection_name}/schemas",
7832 structure=Sequence[mdls.Schema],
7833 query_params={"database": database, "cache": cache, "fields": fields},
7834 transport_options=transport_options,
7835 ),
7836 )
7837 return response
7838
7839 # ### Get the list of tables for a schema
7840 #
7841 # For dialects that support multiple databases, optionally identify which to use. If not provided, the default
7842 # database for the connection will be used.
7843 #
7844 # For dialects that do **not** support multiple databases, **do not use** the database parameter
7845 #
7846 # GET /connections/{connection_name}/tables -> Sequence[mdls.SchemaTables]
7847 def connection_tables(
7848 self,
7849 # Name of connection
7850 connection_name: str,
7851 # Optional. Name of database to use for the query, only if applicable
7852 database: Optional[str] = None,
7853 # Optional. Return only tables for this schema
7854 schema_name: Optional[str] = None,
7855 # True to fetch from cache, false to load fresh
7856 cache: Optional[bool] = None,
7857 # Requested fields.
7858 fields: Optional[str] = None,
7859 # Optional. Return tables with names that contain this value
7860 table_filter: Optional[str] = None,
7861 # Optional. Return tables up to the table_limit
7862 table_limit: Optional[int] = None,
7863 transport_options: Optional[transport.TransportOptions] = None,
7864 ) -> Sequence[mdls.SchemaTables]:
7865 """Get tables for a connection"""
7866 connection_name = self.encode_path_param(connection_name)
7867 response = cast(
7868 Sequence[mdls.SchemaTables],
7869 self.get(
7870 path=f"/connections/{connection_name}/tables",
7871 structure=Sequence[mdls.SchemaTables],
7872 query_params={
7873 "database": database,
7874 "schema_name": schema_name,
7875 "cache": cache,
7876 "fields": fields,
7877 "table_filter": table_filter,
7878 "table_limit": table_limit,
7879 },
7880 transport_options=transport_options,
7881 ),
7882 )
7883 return response
7884
7885 # ### Get the columns (and therefore also the tables) in a specific schema
7886 #
7887 # GET /connections/{connection_name}/columns -> Sequence[mdls.SchemaColumns]
7888 def connection_columns(
7889 self,
7890 # Name of connection
7891 connection_name: str,
7892 # For dialects that support multiple databases, optionally identify which to use
7893 database: Optional[str] = None,
7894 # Name of schema to use.
7895 schema_name: Optional[str] = None,
7896 # True to fetch from cache, false to load fresh
7897 cache: Optional[bool] = None,
7898 # limits the tables per schema returned
7899 table_limit: Optional[int] = None,
7900 # only fetch columns for a given (comma-separated) list of tables
7901 table_names: Optional[str] = None,
7902 # Requested fields.
7903 fields: Optional[str] = None,
7904 transport_options: Optional[transport.TransportOptions] = None,
7905 ) -> Sequence[mdls.SchemaColumns]:
7906 """Get columns for a connection"""
7907 connection_name = self.encode_path_param(connection_name)
7908 response = cast(
7909 Sequence[mdls.SchemaColumns],
7910 self.get(
7911 path=f"/connections/{connection_name}/columns",
7912 structure=Sequence[mdls.SchemaColumns],
7913 query_params={
7914 "database": database,
7915 "schema_name": schema_name,
7916 "cache": cache,
7917 "table_limit": table_limit,
7918 "table_names": table_names,
7919 "fields": fields,
7920 },
7921 transport_options=transport_options,
7922 ),
7923 )
7924 return response
7925
7926 # ### Search a connection for columns matching the specified name
7927 #
7928 # **Note**: `column_name` must be a valid column name. It is not a search pattern.
7929 #
7930 # GET /connections/{connection_name}/search_columns -> Sequence[mdls.ColumnSearch]
7931 def connection_search_columns(
7932 self,
7933 # Name of connection
7934 connection_name: str,
7935 # Column name to find
7936 column_name: Optional[str] = None,
7937 # Requested fields.
7938 fields: Optional[str] = None,
7939 transport_options: Optional[transport.TransportOptions] = None,
7940 ) -> Sequence[mdls.ColumnSearch]:
7941 """Search a connection for columns"""
7942 connection_name = self.encode_path_param(connection_name)
7943 response = cast(
7944 Sequence[mdls.ColumnSearch],
7945 self.get(
7946 path=f"/connections/{connection_name}/search_columns",
7947 structure=Sequence[mdls.ColumnSearch],
7948 query_params={"column_name": column_name, "fields": fields},
7949 transport_options=transport_options,
7950 ),
7951 )
7952 return response
7953
7954 # ### Connection cost estimating
7955 #
7956 # Assign a `sql` statement to the body of the request. e.g., for Ruby, `{sql: 'select * from users'}`
7957 #
7958 # **Note**: If the connection's dialect has no support for cost estimates, an error will be returned
7959 #
7960 # POST /connections/{connection_name}/cost_estimate -> mdls.CostEstimate
7961 def connection_cost_estimate(
7962 self,
7963 # Name of connection
7964 connection_name: str,
7965 # WARNING: no writeable properties found for POST, PUT, or PATCH
7966 body: mdls.CreateCostEstimate,
7967 # Requested fields.
7968 fields: Optional[str] = None,
7969 transport_options: Optional[transport.TransportOptions] = None,
7970 ) -> mdls.CostEstimate:
7971 """Estimate costs for a connection"""
7972 connection_name = self.encode_path_param(connection_name)
7973 response = cast(
7974 mdls.CostEstimate,
7975 self.post(
7976 path=f"/connections/{connection_name}/cost_estimate",
7977 structure=mdls.CostEstimate,
7978 query_params={"fields": fields},
7979 body=body,
7980 transport_options=transport_options,
7981 ),
7982 )
7983 return response
7984
7985 # endregion
7986
7987 # region Project: Manage Projects
7988
7989 # ### Fetches a CI Run.
7990 #
7991 # GET /projects/{project_id}/ci/runs/{run_id} -> mdls.ProjectCIRun
7992 def get_ci_run(
7993 self,
7994 # Project Id
7995 project_id: str,
7996 # Run Id
7997 run_id: str,
7998 # Requested fields
7999 fields: Optional[str] = None,
8000 transport_options: Optional[transport.TransportOptions] = None,
8001 ) -> mdls.ProjectCIRun:
8002 """Fetch Continuous Integration run"""
8003 project_id = self.encode_path_param(project_id)
8004 run_id = self.encode_path_param(run_id)
8005 response = cast(
8006 mdls.ProjectCIRun,
8007 self.get(
8008 path=f"/projects/{project_id}/ci/runs/{run_id}",
8009 structure=mdls.ProjectCIRun,
8010 query_params={"fields": fields},
8011 transport_options=transport_options,
8012 ),
8013 )
8014 return response
8015
8016 # ### Creates a CI Run.
8017 #
8018 # POST /projects/{project_id}/ci/run -> mdls.CreateCIRunResponse
8019 def create_ci_run(
8020 self,
8021 # Project Id
8022 project_id: str,
8023 body: mdls.CreateCIRunRequest,
8024 # Requested fields
8025 fields: Optional[str] = None,
8026 transport_options: Optional[transport.TransportOptions] = None,
8027 ) -> mdls.CreateCIRunResponse:
8028 """Create a Continuous Integration run"""
8029 project_id = self.encode_path_param(project_id)
8030 response = cast(
8031 mdls.CreateCIRunResponse,
8032 self.post(
8033 path=f"/projects/{project_id}/ci/run",
8034 structure=mdls.CreateCIRunResponse,
8035 query_params={"fields": fields},
8036 body=body,
8037 transport_options=transport_options,
8038 ),
8039 )
8040 return response
8041
8042 # ### Generate Lockfile for All LookML Dependencies
8043 #
8044 # Git must have been configured, must be in dev mode and deploy permission required
8045 #
8046 # Install_all is a two step process
8047 # 1. For each remote_dependency in a project the dependency manager will resolve any ambiguous ref.
8048 # 2. The project will then write out a lockfile including each remote_dependency with its resolved ref.
8049 #
8050 # POST /projects/{project_id}/manifest/lock_all -> str
8051 def lock_all(
8052 self,
8053 # Id of project
8054 project_id: str,
8055 # Requested fields
8056 fields: Optional[str] = None,
8057 transport_options: Optional[transport.TransportOptions] = None,
8058 ) -> str:
8059 """Lock All"""
8060 project_id = self.encode_path_param(project_id)
8061 response = cast(
8062 str,
8063 self.post(
8064 path=f"/projects/{project_id}/manifest/lock_all",
8065 structure=str,
8066 query_params={"fields": fields},
8067 transport_options=transport_options,
8068 ),
8069 )
8070 return response
8071
8072 # ### Get All Git Branches
8073 #
8074 # Returns a list of git branches in the project repository
8075 #
8076 # GET /projects/{project_id}/git_branches -> Sequence[mdls.GitBranch]
8077 def all_git_branches(
8078 self,
8079 # Project Id
8080 project_id: str,
8081 transport_options: Optional[transport.TransportOptions] = None,
8082 ) -> Sequence[mdls.GitBranch]:
8083 """Get All Git Branches"""
8084 project_id = self.encode_path_param(project_id)
8085 response = cast(
8086 Sequence[mdls.GitBranch],
8087 self.get(
8088 path=f"/projects/{project_id}/git_branches",
8089 structure=Sequence[mdls.GitBranch],
8090 transport_options=transport_options,
8091 ),
8092 )
8093 return response
8094
8095 # ### Get the Current Git Branch
8096 #
8097 # Returns the git branch currently checked out in the given project repository
8098 #
8099 # GET /projects/{project_id}/git_branch -> mdls.GitBranch
8100 def git_branch(
8101 self,
8102 # Project Id
8103 project_id: str,
8104 transport_options: Optional[transport.TransportOptions] = None,
8105 ) -> mdls.GitBranch:
8106 """Get Active Git Branch"""
8107 project_id = self.encode_path_param(project_id)
8108 response = cast(
8109 mdls.GitBranch,
8110 self.get(
8111 path=f"/projects/{project_id}/git_branch",
8112 structure=mdls.GitBranch,
8113 transport_options=transport_options,
8114 ),
8115 )
8116 return response
8117
8118 # ### Checkout and/or reset --hard an existing Git Branch
8119 #
8120 # Only allowed in development mode
8121 # - Call `update_session` to select the 'dev' workspace.
8122 #
8123 # Checkout an existing branch if name field is different from the name of the currently checked out branch.
8124 #
8125 # Optionally specify a branch name, tag name or commit SHA to which the branch should be reset.
8126 # **DANGER** hard reset will be force pushed to the remote. Unsaved changes and commits may be permanently lost.
8127 #
8128 # PUT /projects/{project_id}/git_branch -> mdls.GitBranch
8129 def update_git_branch(
8130 self,
8131 # Project Id
8132 project_id: str,
8133 body: mdls.WriteGitBranch,
8134 transport_options: Optional[transport.TransportOptions] = None,
8135 ) -> mdls.GitBranch:
8136 """Update Project Git Branch"""
8137 project_id = self.encode_path_param(project_id)
8138 response = cast(
8139 mdls.GitBranch,
8140 self.put(
8141 path=f"/projects/{project_id}/git_branch",
8142 structure=mdls.GitBranch,
8143 body=body,
8144 transport_options=transport_options,
8145 ),
8146 )
8147 return response
8148
8149 # ### Create and Checkout a Git Branch
8150 #
8151 # Creates and checks out a new branch in the given project repository
8152 # Only allowed in development mode
8153 # - Call `update_session` to select the 'dev' workspace.
8154 #
8155 # Optionally specify a branch name, tag name or commit SHA as the start point in the ref field.
8156 # If no ref is specified, HEAD of the current branch will be used as the start point for the new branch.
8157 #
8158 # POST /projects/{project_id}/git_branch -> mdls.GitBranch
8159 def create_git_branch(
8160 self,
8161 # Project Id
8162 project_id: str,
8163 body: mdls.WriteGitBranch,
8164 transport_options: Optional[transport.TransportOptions] = None,
8165 ) -> mdls.GitBranch:
8166 """Checkout New Git Branch"""
8167 project_id = self.encode_path_param(project_id)
8168 response = cast(
8169 mdls.GitBranch,
8170 self.post(
8171 path=f"/projects/{project_id}/git_branch",
8172 structure=mdls.GitBranch,
8173 body=body,
8174 transport_options=transport_options,
8175 ),
8176 )
8177 return response
8178
8179 # ### Get the specified Git Branch
8180 #
8181 # Returns the git branch specified in branch_name path param if it exists in the given project repository
8182 #
8183 # GET /projects/{project_id}/git_branch/{branch_name} -> mdls.GitBranch
8184 def find_git_branch(
8185 self,
8186 # Project Id
8187 project_id: str,
8188 # Branch Name
8189 branch_name: str,
8190 transport_options: Optional[transport.TransportOptions] = None,
8191 ) -> mdls.GitBranch:
8192 """Find a Git Branch"""
8193 project_id = self.encode_path_param(project_id)
8194 branch_name = self.encode_path_param(branch_name)
8195 response = cast(
8196 mdls.GitBranch,
8197 self.get(
8198 path=f"/projects/{project_id}/git_branch/{branch_name}",
8199 structure=mdls.GitBranch,
8200 transport_options=transport_options,
8201 ),
8202 )
8203 return response
8204
8205 # ### Delete the specified Git Branch
8206 #
8207 # Delete git branch specified in branch_name path param from local and remote of specified project repository
8208 #
8209 # DELETE /projects/{project_id}/git_branch/{branch_name} -> str
8210 def delete_git_branch(
8211 self,
8212 # Project Id
8213 project_id: str,
8214 # Branch Name
8215 branch_name: str,
8216 transport_options: Optional[transport.TransportOptions] = None,
8217 ) -> str:
8218 """Delete a Git Branch"""
8219 project_id = self.encode_path_param(project_id)
8220 branch_name = self.encode_path_param(branch_name)
8221 response = cast(
8222 str,
8223 self.delete(
8224 path=f"/projects/{project_id}/git_branch/{branch_name}",
8225 structure=str,
8226 transport_options=transport_options,
8227 ),
8228 )
8229 return response
8230
8231 # ### Deploy a Remote Branch or Ref to Production
8232 #
8233 # Git must have been configured and deploy permission required.
8234 #
8235 # Deploy is a one/two step process
8236 # 1. If this is the first deploy of this project, create the production project with git repository.
8237 # 2. Pull the branch or ref into the production project.
8238 #
8239 # Can only specify either a branch or a ref.
8240 #
8241 # POST /projects/{project_id}/deploy_ref_to_production -> str
8242 def deploy_ref_to_production(
8243 self,
8244 # Id of project
8245 project_id: str,
8246 # Branch to deploy to production
8247 branch: Optional[str] = None,
8248 # Ref to deploy to production
8249 ref: Optional[str] = None,
8250 transport_options: Optional[transport.TransportOptions] = None,
8251 ) -> str:
8252 """Deploy Remote Branch or Ref to Production"""
8253 project_id = self.encode_path_param(project_id)
8254 response = cast(
8255 str,
8256 self.post(
8257 path=f"/projects/{project_id}/deploy_ref_to_production",
8258 structure=str,
8259 query_params={"branch": branch, "ref": ref},
8260 transport_options=transport_options,
8261 ),
8262 )
8263 return response
8264
8265 # ### Deploy LookML from this Development Mode Project to Production
8266 #
8267 # Git must have been configured, must be in dev mode and deploy permission required
8268 #
8269 # Deploy is a two / three step process:
8270 #
8271 # 1. Push commits in current branch of dev mode project to the production branch (origin/master).
8272 # Note a. This step is skipped in read-only projects.
8273 # Note b. If this step is unsuccessful for any reason (e.g. rejected non-fastforward because production branch has
8274 # commits not in current branch), subsequent steps will be skipped.
8275 # 2. If this is the first deploy of this project, create the production project with git repository.
8276 # 3. Pull the production branch into the production project.
8277 #
8278 # POST /projects/{project_id}/deploy_to_production -> str
8279 def deploy_to_production(
8280 self,
8281 # Id of project
8282 project_id: str,
8283 transport_options: Optional[transport.TransportOptions] = None,
8284 ) -> str:
8285 """Deploy To Production"""
8286 project_id = self.encode_path_param(project_id)
8287 response = cast(
8288 str,
8289 self.post(
8290 path=f"/projects/{project_id}/deploy_to_production",
8291 structure=str,
8292 transport_options=transport_options,
8293 ),
8294 )
8295 return response
8296
8297 # ### Reset a project to the revision of the project that is in production.
8298 #
8299 # **DANGER** this will delete any changes that have not been pushed to a remote repository.
8300 #
8301 # POST /projects/{project_id}/reset_to_production -> str
8302 def reset_project_to_production(
8303 self,
8304 # Id of project
8305 project_id: str,
8306 transport_options: Optional[transport.TransportOptions] = None,
8307 ) -> str:
8308 """Reset To Production"""
8309 project_id = self.encode_path_param(project_id)
8310 response = cast(
8311 str,
8312 self.post(
8313 path=f"/projects/{project_id}/reset_to_production",
8314 structure=str,
8315 transport_options=transport_options,
8316 ),
8317 )
8318 return response
8319
8320 # ### Reset a project development branch to the revision of the project that is on the remote.
8321 #
8322 # **DANGER** this will delete any changes that have not been pushed to a remote repository.
8323 #
8324 # POST /projects/{project_id}/reset_to_remote -> str
8325 def reset_project_to_remote(
8326 self,
8327 # Id of project
8328 project_id: str,
8329 transport_options: Optional[transport.TransportOptions] = None,
8330 ) -> str:
8331 """Reset To Remote"""
8332 project_id = self.encode_path_param(project_id)
8333 response = cast(
8334 str,
8335 self.post(
8336 path=f"/projects/{project_id}/reset_to_remote",
8337 structure=str,
8338 transport_options=transport_options,
8339 ),
8340 )
8341 return response
8342
8343 # ### Get All Projects
8344 #
8345 # Returns all projects visible to the current user
8346 #
8347 # GET /projects -> Sequence[mdls.Project]
8348 def all_projects(
8349 self,
8350 # Requested fields
8351 fields: Optional[str] = None,
8352 transport_options: Optional[transport.TransportOptions] = None,
8353 ) -> Sequence[mdls.Project]:
8354 """Get All Projects"""
8355 response = cast(
8356 Sequence[mdls.Project],
8357 self.get(
8358 path="/projects",
8359 structure=Sequence[mdls.Project],
8360 query_params={"fields": fields},
8361 transport_options=transport_options,
8362 ),
8363 )
8364 return response
8365
8366 # ### Create A Project
8367 #
8368 # dev mode required.
8369 # - Call `update_session` to select the 'dev' workspace.
8370 #
8371 # `name` is required.
8372 # `git_remote_url` is not allowed. To configure Git for the newly created project, follow the instructions in `update_project`.
8373 #
8374 # POST /projects -> mdls.Project
8375 def create_project(
8376 self,
8377 body: mdls.WriteProject,
8378 transport_options: Optional[transport.TransportOptions] = None,
8379 ) -> mdls.Project:
8380 """Create Project"""
8381 response = cast(
8382 mdls.Project,
8383 self.post(
8384 path="/projects",
8385 structure=mdls.Project,
8386 body=body,
8387 transport_options=transport_options,
8388 ),
8389 )
8390 return response
8391
8392 # ### Get A Project
8393 #
8394 # Returns the project with the given project id
8395 #
8396 # GET /projects/{project_id} -> mdls.Project
8397 def project(
8398 self,
8399 # Project Id
8400 project_id: str,
8401 # Requested fields
8402 fields: Optional[str] = None,
8403 transport_options: Optional[transport.TransportOptions] = None,
8404 ) -> mdls.Project:
8405 """Get Project"""
8406 project_id = self.encode_path_param(project_id)
8407 response = cast(
8408 mdls.Project,
8409 self.get(
8410 path=f"/projects/{project_id}",
8411 structure=mdls.Project,
8412 query_params={"fields": fields},
8413 transport_options=transport_options,
8414 ),
8415 )
8416 return response
8417
8418 # ### Update Project Configuration
8419 #
8420 # Apply changes to a project's configuration.
8421 #
8422 #
8423 # #### Configuring Git for a Project
8424 #
8425 # To set up a Looker project with a remote git repository, follow these steps:
8426 #
8427 # 1. Call `update_session` to select the 'dev' workspace.
8428 # 1. Call `create_git_deploy_key` to create a new deploy key for the project
8429 # 1. Copy the deploy key text into the remote git repository's ssh key configuration
8430 # 1. Call `update_project` to set project's `git_remote_url` ()and `git_service_name`, if necessary).
8431 #
8432 # When you modify a project's `git_remote_url`, Looker connects to the remote repository to fetch
8433 # metadata. The remote git repository MUST be configured with the Looker-generated deploy
8434 # key for this project prior to setting the project's `git_remote_url`.
8435 #
8436 # To set up a Looker project with a git repository residing on the Looker server (a 'bare' git repo):
8437 #
8438 # 1. Call `update_session` to select the 'dev' workspace.
8439 # 1. Call `update_project` setting `git_remote_url` to null and `git_service_name` to "bare".
8440 #
8441 # PATCH /projects/{project_id} -> mdls.Project
8442 def update_project(
8443 self,
8444 # Project Id
8445 project_id: str,
8446 body: mdls.WriteProject,
8447 # Requested fields
8448 fields: Optional[str] = None,
8449 transport_options: Optional[transport.TransportOptions] = None,
8450 ) -> mdls.Project:
8451 """Update Project"""
8452 project_id = self.encode_path_param(project_id)
8453 response = cast(
8454 mdls.Project,
8455 self.patch(
8456 path=f"/projects/{project_id}",
8457 structure=mdls.Project,
8458 query_params={"fields": fields},
8459 body=body,
8460 transport_options=transport_options,
8461 ),
8462 )
8463 return response
8464
8465 # ### Get A Projects Manifest object
8466 #
8467 # Returns the project with the given project id
8468 #
8469 # GET /projects/{project_id}/manifest -> mdls.Manifest
8470 def manifest(
8471 self,
8472 # Project Id
8473 project_id: str,
8474 transport_options: Optional[transport.TransportOptions] = None,
8475 ) -> mdls.Manifest:
8476 """Get Manifest"""
8477 project_id = self.encode_path_param(project_id)
8478 response = cast(
8479 mdls.Manifest,
8480 self.get(
8481 path=f"/projects/{project_id}/manifest",
8482 structure=mdls.Manifest,
8483 transport_options=transport_options,
8484 ),
8485 )
8486 return response
8487
8488 # ### Git Deploy Key
8489 #
8490 # Returns the ssh public key previously created for a project's git repository.
8491 #
8492 # GET /projects/{project_id}/git/deploy_key -> str
8493 def git_deploy_key(
8494 self,
8495 # Project Id
8496 project_id: str,
8497 transport_options: Optional[transport.TransportOptions] = None,
8498 ) -> str:
8499 """Git Deploy Key"""
8500 project_id = self.encode_path_param(project_id)
8501 response = cast(
8502 str,
8503 self.get(
8504 path=f"/projects/{project_id}/git/deploy_key",
8505 structure=str,
8506 transport_options=transport_options,
8507 ),
8508 )
8509 return response
8510
8511 # ### Create Git Deploy Key
8512 #
8513 # Create a public/private key pair for authenticating ssh git requests from Looker to a remote git repository
8514 # for a particular Looker project.
8515 #
8516 # Returns the public key of the generated ssh key pair.
8517 #
8518 # Copy this public key to your remote git repository's ssh keys configuration so that the remote git service can
8519 # validate and accept git requests from the Looker server.
8520 #
8521 # POST /projects/{project_id}/git/deploy_key -> str
8522 def create_git_deploy_key(
8523 self,
8524 # Project Id
8525 project_id: str,
8526 transport_options: Optional[transport.TransportOptions] = None,
8527 ) -> str:
8528 """Create Deploy Key"""
8529 project_id = self.encode_path_param(project_id)
8530 response = cast(
8531 str,
8532 self.post(
8533 path=f"/projects/{project_id}/git/deploy_key",
8534 structure=str,
8535 transport_options=transport_options,
8536 ),
8537 )
8538 return response
8539
8540 # ### Get Cached Project Validation Results
8541 #
8542 # Returns the cached results of a previous project validation calculation, if any.
8543 # Returns http status 204 No Content if no validation results exist.
8544 #
8545 # Validating the content of all the files in a project can be computationally intensive
8546 # for large projects. Use this API to simply fetch the results of the most recent
8547 # project validation rather than revalidating the entire project from scratch.
8548 #
8549 # A value of `"stale": true` in the response indicates that the project has changed since
8550 # the cached validation results were computed. The cached validation results may no longer
8551 # reflect the current state of the project.
8552 #
8553 # GET /projects/{project_id}/validate -> mdls.ProjectValidationCache
8554 def project_validation_results(
8555 self,
8556 # Project Id
8557 project_id: str,
8558 # Requested fields
8559 fields: Optional[str] = None,
8560 transport_options: Optional[transport.TransportOptions] = None,
8561 ) -> mdls.ProjectValidationCache:
8562 """Cached Project Validation Results"""
8563 project_id = self.encode_path_param(project_id)
8564 response = cast(
8565 mdls.ProjectValidationCache,
8566 self.get(
8567 path=f"/projects/{project_id}/validate",
8568 structure=mdls.ProjectValidationCache,
8569 query_params={"fields": fields},
8570 transport_options=transport_options,
8571 ),
8572 )
8573 return response
8574
8575 # ### Validate Project
8576 #
8577 # Performs lint validation of all lookml files in the project.
8578 # Returns a list of errors found, if any.
8579 #
8580 # Validating the content of all the files in a project can be computationally intensive
8581 # for large projects. For best performance, call `validate_project(project_id)` only
8582 # when you really want to recompute project validation. To quickly display the results of
8583 # the most recent project validation (without recomputing), use `project_validation_results(project_id)`
8584 #
8585 # POST /projects/{project_id}/validate -> mdls.ProjectValidation
8586 def validate_project(
8587 self,
8588 # Project Id
8589 project_id: str,
8590 # Requested fields
8591 fields: Optional[str] = None,
8592 transport_options: Optional[transport.TransportOptions] = None,
8593 ) -> mdls.ProjectValidation:
8594 """Validate Project"""
8595 project_id = self.encode_path_param(project_id)
8596 response = cast(
8597 mdls.ProjectValidation,
8598 self.post(
8599 path=f"/projects/{project_id}/validate",
8600 structure=mdls.ProjectValidation,
8601 query_params={"fields": fields},
8602 transport_options=transport_options,
8603 ),
8604 )
8605 return response
8606
8607 # ### Get Project Workspace
8608 #
8609 # Returns information about the state of the project files in the currently selected workspace
8610 #
8611 # GET /projects/{project_id}/current_workspace -> mdls.ProjectWorkspace
8612 def project_workspace(
8613 self,
8614 # Project Id
8615 project_id: str,
8616 # Requested fields
8617 fields: Optional[str] = None,
8618 transport_options: Optional[transport.TransportOptions] = None,
8619 ) -> mdls.ProjectWorkspace:
8620 """Get Project Workspace"""
8621 project_id = self.encode_path_param(project_id)
8622 response = cast(
8623 mdls.ProjectWorkspace,
8624 self.get(
8625 path=f"/projects/{project_id}/current_workspace",
8626 structure=mdls.ProjectWorkspace,
8627 query_params={"fields": fields},
8628 transport_options=transport_options,
8629 ),
8630 )
8631 return response
8632
8633 # ### Get All Project Files
8634 #
8635 # Returns a list of the files in the project
8636 #
8637 # GET /projects/{project_id}/files -> Sequence[mdls.ProjectFile]
8638 def all_project_files(
8639 self,
8640 # Project Id
8641 project_id: str,
8642 # Requested fields
8643 fields: Optional[str] = None,
8644 transport_options: Optional[transport.TransportOptions] = None,
8645 ) -> Sequence[mdls.ProjectFile]:
8646 """Get All Project Files"""
8647 project_id = self.encode_path_param(project_id)
8648 response = cast(
8649 Sequence[mdls.ProjectFile],
8650 self.get(
8651 path=f"/projects/{project_id}/files",
8652 structure=Sequence[mdls.ProjectFile],
8653 query_params={"fields": fields},
8654 transport_options=transport_options,
8655 ),
8656 )
8657 return response
8658
8659 # ### Get Project File Info
8660 #
8661 # Returns information about a file in the project
8662 #
8663 # GET /projects/{project_id}/files/file -> mdls.ProjectFile
8664 def project_file(
8665 self,
8666 # Project Id
8667 project_id: str,
8668 # File Id
8669 file_id: str,
8670 # Requested fields
8671 fields: Optional[str] = None,
8672 transport_options: Optional[transport.TransportOptions] = None,
8673 ) -> mdls.ProjectFile:
8674 """Get Project File"""
8675 project_id = self.encode_path_param(project_id)
8676 response = cast(
8677 mdls.ProjectFile,
8678 self.get(
8679 path=f"/projects/{project_id}/files/file",
8680 structure=mdls.ProjectFile,
8681 query_params={"file_id": file_id, "fields": fields},
8682 transport_options=transport_options,
8683 ),
8684 )
8685 return response
8686
8687 # ### Get All Git Connection Tests
8688 #
8689 # 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.
8690 #
8691 # 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.
8692 #
8693 # For example, a late-stage test for write access is meaningless if connecting to the git server (an early test) is failing.
8694 #
8695 # GET /projects/{project_id}/git_connection_tests -> Sequence[mdls.GitConnectionTest]
8696 def all_git_connection_tests(
8697 self,
8698 # Project Id
8699 project_id: str,
8700 # (Optional: leave blank for root project) The remote url for remote dependency to test.
8701 remote_url: Optional[str] = None,
8702 transport_options: Optional[transport.TransportOptions] = None,
8703 ) -> Sequence[mdls.GitConnectionTest]:
8704 """Get All Git Connection Tests"""
8705 project_id = self.encode_path_param(project_id)
8706 response = cast(
8707 Sequence[mdls.GitConnectionTest],
8708 self.get(
8709 path=f"/projects/{project_id}/git_connection_tests",
8710 structure=Sequence[mdls.GitConnectionTest],
8711 query_params={"remote_url": remote_url},
8712 transport_options=transport_options,
8713 ),
8714 )
8715 return response
8716
8717 # ### Run a git connection test
8718 #
8719 # 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
8720 # is intended to help debug git connections when things do not work properly, to give
8721 # more helpful information about why a git url is not working with Looker.
8722 #
8723 # Tests should be run in the order they are returned by [Get All Git Connection Tests](#!/Project/all_git_connection_tests).
8724 #
8725 # GET /projects/{project_id}/git_connection_tests/{test_id} -> mdls.GitConnectionTestResult
8726 def run_git_connection_test(
8727 self,
8728 # Project Id
8729 project_id: str,
8730 # Test Id
8731 test_id: str,
8732 # (Optional: leave blank for root project) The remote url for remote dependency to test.
8733 remote_url: Optional[str] = None,
8734 # (Optional: leave blank for dev credentials) Whether to use git production credentials.
8735 use_production: Optional[str] = None,
8736 transport_options: Optional[transport.TransportOptions] = None,
8737 ) -> mdls.GitConnectionTestResult:
8738 """Run Git Connection Test"""
8739 project_id = self.encode_path_param(project_id)
8740 test_id = self.encode_path_param(test_id)
8741 response = cast(
8742 mdls.GitConnectionTestResult,
8743 self.get(
8744 path=f"/projects/{project_id}/git_connection_tests/{test_id}",
8745 structure=mdls.GitConnectionTestResult,
8746 query_params={
8747 "remote_url": remote_url,
8748 "use_production": use_production,
8749 },
8750 transport_options=transport_options,
8751 ),
8752 )
8753 return response
8754
8755 # ### Get All LookML Tests
8756 #
8757 # Returns a list of tests which can be run to validate a project's LookML code and/or the underlying data,
8758 # optionally filtered by the file id.
8759 # Call [Run LookML Test](#!/Project/run_lookml_test) to execute tests.
8760 #
8761 # GET /projects/{project_id}/lookml_tests -> Sequence[mdls.LookmlTest]
8762 def all_lookml_tests(
8763 self,
8764 # Project Id
8765 project_id: str,
8766 # File Id
8767 file_id: Optional[str] = None,
8768 transport_options: Optional[transport.TransportOptions] = None,
8769 ) -> Sequence[mdls.LookmlTest]:
8770 """Get All LookML Tests"""
8771 project_id = self.encode_path_param(project_id)
8772 response = cast(
8773 Sequence[mdls.LookmlTest],
8774 self.get(
8775 path=f"/projects/{project_id}/lookml_tests",
8776 structure=Sequence[mdls.LookmlTest],
8777 query_params={"file_id": file_id},
8778 transport_options=transport_options,
8779 ),
8780 )
8781 return response
8782
8783 # ### Run LookML Tests
8784 #
8785 # Runs all tests in the project, optionally filtered by file, test, and/or model.
8786 #
8787 # GET /projects/{project_id}/lookml_tests/run -> Sequence[mdls.LookmlTestResult]
8788 def run_lookml_test(
8789 self,
8790 # Project Id
8791 project_id: str,
8792 # File Name
8793 file_id: Optional[str] = None,
8794 # Test Name
8795 test: Optional[str] = None,
8796 # Model Name
8797 model: Optional[str] = None,
8798 transport_options: Optional[transport.TransportOptions] = None,
8799 ) -> Sequence[mdls.LookmlTestResult]:
8800 """Run LookML Test"""
8801 project_id = self.encode_path_param(project_id)
8802 response = cast(
8803 Sequence[mdls.LookmlTestResult],
8804 self.get(
8805 path=f"/projects/{project_id}/lookml_tests/run",
8806 structure=Sequence[mdls.LookmlTestResult],
8807 query_params={"file_id": file_id, "test": test, "model": model},
8808 transport_options=transport_options,
8809 ),
8810 )
8811 return response
8812
8813 # ### Creates a tag for the most recent commit, or a specific ref is a SHA is provided
8814 #
8815 # POST /projects/{project_id}/tag -> mdls.Project
8816 def tag_ref(
8817 self,
8818 # Project Id
8819 project_id: str,
8820 body: mdls.WriteProject,
8821 # (Optional): Commit Sha to Tag
8822 commit_sha: Optional[str] = None,
8823 # Tag Name
8824 tag_name: Optional[str] = None,
8825 # (Optional): Tag Message
8826 tag_message: Optional[str] = None,
8827 transport_options: Optional[transport.TransportOptions] = None,
8828 ) -> mdls.Project:
8829 """Tag Ref"""
8830 project_id = self.encode_path_param(project_id)
8831 response = cast(
8832 mdls.Project,
8833 self.post(
8834 path=f"/projects/{project_id}/tag",
8835 structure=mdls.Project,
8836 query_params={
8837 "commit_sha": commit_sha,
8838 "tag_name": tag_name,
8839 "tag_message": tag_message,
8840 },
8841 body=body,
8842 transport_options=transport_options,
8843 ),
8844 )
8845 return response
8846
8847 # ### Configure Repository Credential for a remote dependency
8848 #
8849 # Admin required.
8850 #
8851 # `root_project_id` is required.
8852 # `credential_id` is required.
8853 #
8854 # PUT /projects/{root_project_id}/credential/{credential_id} -> mdls.RepositoryCredential
8855 def update_repository_credential(
8856 self,
8857 # Root Project Id
8858 root_project_id: str,
8859 # Credential Id
8860 credential_id: str,
8861 body: mdls.WriteRepositoryCredential,
8862 transport_options: Optional[transport.TransportOptions] = None,
8863 ) -> mdls.RepositoryCredential:
8864 """Create Repository Credential"""
8865 root_project_id = self.encode_path_param(root_project_id)
8866 credential_id = self.encode_path_param(credential_id)
8867 response = cast(
8868 mdls.RepositoryCredential,
8869 self.put(
8870 path=f"/projects/{root_project_id}/credential/{credential_id}",
8871 structure=mdls.RepositoryCredential,
8872 body=body,
8873 transport_options=transport_options,
8874 ),
8875 )
8876 return response
8877
8878 # ### Repository Credential for a remote dependency
8879 #
8880 # Admin required.
8881 #
8882 # `root_project_id` is required.
8883 # `credential_id` is required.
8884 #
8885 # DELETE /projects/{root_project_id}/credential/{credential_id} -> str
8886 def delete_repository_credential(
8887 self,
8888 # Root Project Id
8889 root_project_id: str,
8890 # Credential Id
8891 credential_id: str,
8892 transport_options: Optional[transport.TransportOptions] = None,
8893 ) -> str:
8894 """Delete Repository Credential"""
8895 root_project_id = self.encode_path_param(root_project_id)
8896 credential_id = self.encode_path_param(credential_id)
8897 response = cast(
8898 str,
8899 self.delete(
8900 path=f"/projects/{root_project_id}/credential/{credential_id}",
8901 structure=str,
8902 transport_options=transport_options,
8903 ),
8904 )
8905 return response
8906
8907 # ### Get all Repository Credentials for a project
8908 #
8909 # `root_project_id` is required.
8910 #
8911 # GET /projects/{root_project_id}/credentials -> Sequence[mdls.RepositoryCredential]
8912 def get_all_repository_credentials(
8913 self,
8914 # Root Project Id
8915 root_project_id: str,
8916 transport_options: Optional[transport.TransportOptions] = None,
8917 ) -> Sequence[mdls.RepositoryCredential]:
8918 """Get All Repository Credentials"""
8919 root_project_id = self.encode_path_param(root_project_id)
8920 response = cast(
8921 Sequence[mdls.RepositoryCredential],
8922 self.get(
8923 path=f"/projects/{root_project_id}/credentials",
8924 structure=Sequence[mdls.RepositoryCredential],
8925 transport_options=transport_options,
8926 ),
8927 )
8928 return response
8929
8930 # endregion
8931
8932 # region Query: Run and Manage Queries
8933
8934 # ### Create an async query task
8935 #
8936 # Creates a query task (job) to run a previously created query asynchronously. Returns a Query Task ID.
8937 #
8938 # Use [query_task(query_task_id)](#!/Query/query_task) to check the execution status of the query task.
8939 # 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.
8940 #
8941 # POST /query_tasks -> mdls.QueryTask
8942 def create_query_task(
8943 self,
8944 body: mdls.WriteCreateQueryTask,
8945 # Row limit (may override the limit in the saved query).
8946 limit: Optional[int] = None,
8947 # Apply model-specified formatting to each result.
8948 apply_formatting: Optional[bool] = None,
8949 # Apply visualization options to results.
8950 apply_vis: Optional[bool] = None,
8951 # Get results from cache if available.
8952 cache: Optional[bool] = None,
8953 # Generate drill links (only applicable to 'json_detail' format.
8954 generate_drill_links: Optional[bool] = None,
8955 # 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.
8956 force_production: Optional[bool] = None,
8957 # Retrieve any results from cache even if the results have expired.
8958 cache_only: Optional[bool] = None,
8959 # Prefix to use for drill links (url encoded).
8960 path_prefix: Optional[str] = None,
8961 # Rebuild PDTS used in query.
8962 rebuild_pdts: Optional[bool] = None,
8963 # Perform table calculations on query results
8964 server_table_calcs: Optional[bool] = None,
8965 # Requested fields
8966 fields: Optional[str] = None,
8967 transport_options: Optional[transport.TransportOptions] = None,
8968 ) -> mdls.QueryTask:
8969 """Run Query Async"""
8970 response = cast(
8971 mdls.QueryTask,
8972 self.post(
8973 path="/query_tasks",
8974 structure=mdls.QueryTask,
8975 query_params={
8976 "limit": limit,
8977 "apply_formatting": apply_formatting,
8978 "apply_vis": apply_vis,
8979 "cache": cache,
8980 "generate_drill_links": generate_drill_links,
8981 "force_production": force_production,
8982 "cache_only": cache_only,
8983 "path_prefix": path_prefix,
8984 "rebuild_pdts": rebuild_pdts,
8985 "server_table_calcs": server_table_calcs,
8986 "fields": fields,
8987 },
8988 body=body,
8989 transport_options=transport_options,
8990 ),
8991 )
8992 return response
8993
8994 # ### Fetch results of multiple async queries
8995 #
8996 # Returns the results of multiple async queries in one request.
8997 #
8998 # For Query Tasks that are not completed, the response will include the execution status of the Query Task but will not include query results.
8999 # Query Tasks whose results have expired will have a status of 'expired'.
9000 # 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'
9001 #
9002 # GET /query_tasks/multi_results -> MutableMapping[str, Any]
9003 def query_task_multi_results(
9004 self,
9005 # List of Query Task IDs
9006 query_task_ids: mdls.DelimSequence[str],
9007 transport_options: Optional[transport.TransportOptions] = None,
9008 ) -> MutableMapping[str, Any]:
9009 """Get Multiple Async Query Results"""
9010 response = cast(
9011 MutableMapping[str, Any],
9012 self.get(
9013 path="/query_tasks/multi_results",
9014 structure=MutableMapping[str, Any],
9015 query_params={"query_task_ids": query_task_ids},
9016 transport_options=transport_options,
9017 ),
9018 )
9019 return response
9020
9021 # ### Get Query Task details
9022 #
9023 # Use this function to check the status of an async query task. After the status
9024 # reaches "Complete", you can call [query_task_results(query_task_id)](#!/Query/query_task_results) to
9025 # retrieve the results of the query.
9026 #
9027 # Use [create_query_task()](#!/Query/create_query_task) to create an async query task.
9028 #
9029 # GET /query_tasks/{query_task_id} -> mdls.QueryTask
9030 def query_task(
9031 self,
9032 # ID of the Query Task
9033 query_task_id: str,
9034 # Requested fields.
9035 fields: Optional[str] = None,
9036 transport_options: Optional[transport.TransportOptions] = None,
9037 ) -> mdls.QueryTask:
9038 """Get Async Query Info"""
9039 query_task_id = self.encode_path_param(query_task_id)
9040 response = cast(
9041 mdls.QueryTask,
9042 self.get(
9043 path=f"/query_tasks/{query_task_id}",
9044 structure=mdls.QueryTask,
9045 query_params={"fields": fields},
9046 transport_options=transport_options,
9047 ),
9048 )
9049 return response
9050
9051 # ### Get Async Query Results
9052 #
9053 # Returns the results of an async query task if the query has completed.
9054 #
9055 # If the query task is still running or waiting to run, this function returns 202 Accepted.
9056 #
9057 # If the query task ID is invalid or the cached results of the query task have expired, this function returns 404 Not Found.
9058 #
9059 # Use [query_task(query_task_id)](#!/Query/query_task) to check the execution status of the query task
9060 # Call query_task_results only after the query task status reaches "Complete".
9061 #
9062 # You can also use [query_task_multi_results()](#!/Query/query_task_multi_results) retrieve the
9063 # results of multiple async query tasks at the same time.
9064 #
9065 # #### SQL Error Handling:
9066 # 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()`.
9067 #
9068 # For `json_detail` result_format: `query_task_results()` will respond with HTTP status '200 OK' and db SQL error info
9069 # will be in the `errors` property of the response object. The 'data' property will be empty.
9070 #
9071 # For all other result formats: `query_task_results()` will respond with HTTP status `400 Bad Request` and some db SQL error info
9072 # will be in the message of the 400 error response, but not as detailed as expressed in `json_detail.errors`.
9073 # These data formats can only carry row data, and error info is not row data.
9074 #
9075 # GET /query_tasks/{query_task_id}/results -> str
9076 def query_task_results(
9077 self,
9078 # ID of the Query Task
9079 query_task_id: str,
9080 transport_options: Optional[transport.TransportOptions] = None,
9081 ) -> str:
9082 """Get Async Query Results"""
9083 query_task_id = self.encode_path_param(query_task_id)
9084 response = cast(
9085 str,
9086 self.get(
9087 path=f"/query_tasks/{query_task_id}/results",
9088 structure=str,
9089 transport_options=transport_options,
9090 ),
9091 )
9092 return response
9093
9094 # ### Get a previously created query by id.
9095 #
9096 # A Looker query object includes the various parameters that define a database query that has been run or
9097 # could be run in the future. These parameters include: model, view, fields, filters, pivots, etc.
9098 # Query *results* are not part of the query object.
9099 #
9100 # Query objects are unique and immutable. Query objects are created automatically in Looker as users explore data.
9101 # Looker does not delete them; they become part of the query history. When asked to create a query for
9102 # any given set of parameters, Looker will first try to find an existing query object with matching
9103 # parameters and will only create a new object when an appropriate object can not be found.
9104 #
9105 # This 'get' method is used to get the details about a query for a given id. See the other methods here
9106 # to 'create' and 'run' queries.
9107 #
9108 # Note that some fields like 'filter_config' and 'vis_config' etc are specific to how the Looker UI
9109 # builds queries and visualizations and are not generally useful for API use. They are not required when
9110 # creating new queries and can usually just be ignored.
9111 #
9112 # GET /queries/{query_id} -> mdls.Query
9113 def query(
9114 self,
9115 # Id of query
9116 query_id: str,
9117 # Requested fields.
9118 fields: Optional[str] = None,
9119 transport_options: Optional[transport.TransportOptions] = None,
9120 ) -> mdls.Query:
9121 """Get Query"""
9122 query_id = self.encode_path_param(query_id)
9123 response = cast(
9124 mdls.Query,
9125 self.get(
9126 path=f"/queries/{query_id}",
9127 structure=mdls.Query,
9128 query_params={"fields": fields},
9129 transport_options=transport_options,
9130 ),
9131 )
9132 return response
9133
9134 # ### Get the query for a given query slug.
9135 #
9136 # This returns the query for the 'slug' in a query share URL.
9137 #
9138 # The 'slug' is a randomly chosen short string that is used as an alternative to the query's id value
9139 # for use in URLs etc. This method exists as a convenience to help you use the API to 'find' queries that
9140 # have been created using the Looker UI.
9141 #
9142 # You can use the Looker explore page to build a query and then choose the 'Share' option to
9143 # show the share url for the query. Share urls generally look something like 'https://looker.yourcompany/x/vwGSbfc'.
9144 # The trailing 'vwGSbfc' is the share slug. You can pass that string to this api method to get details about the query.
9145 # Those details include the 'id' that you can use to run the query. Or, you can copy the query body
9146 # (perhaps with your own modification) and use that as the basis to make/run new queries.
9147 #
9148 # This will also work with slugs from Looker explore urls like
9149 # 'https://looker.yourcompany/explore/ecommerce/orders?qid=aogBgL6o3cKK1jN3RoZl5s'. In this case
9150 # 'aogBgL6o3cKK1jN3RoZl5s' is the slug.
9151 #
9152 # GET /queries/slug/{slug} -> mdls.Query
9153 def query_for_slug(
9154 self,
9155 # Slug of query
9156 slug: str,
9157 # Requested fields.
9158 fields: Optional[str] = None,
9159 transport_options: Optional[transport.TransportOptions] = None,
9160 ) -> mdls.Query:
9161 """Get Query for Slug"""
9162 slug = self.encode_path_param(slug)
9163 response = cast(
9164 mdls.Query,
9165 self.get(
9166 path=f"/queries/slug/{slug}",
9167 structure=mdls.Query,
9168 query_params={"fields": fields},
9169 transport_options=transport_options,
9170 ),
9171 )
9172 return response
9173
9174 # ### Create a query.
9175 #
9176 # This allows you to create a new query that you can later run. Looker queries are immutable once created
9177 # and are not deleted. If you create a query that is exactly like an existing query then the existing query
9178 # will be returned and no new query will be created. Whether a new query is created or not, you can use
9179 # the 'id' in the returned query with the 'run' method.
9180 #
9181 # The query parameters are passed as json in the body of the request.
9182 #
9183 # POST /queries -> mdls.Query
9184 def create_query(
9185 self,
9186 body: mdls.WriteQuery,
9187 # Requested fields.
9188 fields: Optional[str] = None,
9189 transport_options: Optional[transport.TransportOptions] = None,
9190 ) -> mdls.Query:
9191 """Create Query"""
9192 response = cast(
9193 mdls.Query,
9194 self.post(
9195 path="/queries",
9196 structure=mdls.Query,
9197 query_params={"fields": fields},
9198 body=body,
9199 transport_options=transport_options,
9200 ),
9201 )
9202 return response
9203
9204 # ### Run a saved query.
9205 #
9206 # This runs a previously saved query. You can use this on a query that was generated in the Looker UI
9207 # or one that you have explicitly created using the API. You can also use a query 'id' from a saved 'Look'.
9208 #
9209 # The 'result_format' parameter specifies the desired structure and format of the response.
9210 #
9211 # Supported formats:
9212 #
9213 # | result_format | Description
9214 # | :-----------: | :--- |
9215 # | json | Plain json
9216 # | json_bi | (*RECOMMENDED*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query. See JsonBi type for schema
9217 # | json_detail | (*LEGACY*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
9218 # | csv | Comma separated values with a header
9219 # | txt | Tab separated values with a header
9220 # | html | Simple html
9221 # | md | Simple markdown
9222 # | xlsx | MS Excel spreadsheet
9223 # | sql | Returns the generated SQL rather than running the query
9224 # | png | A PNG image of the visualization of the query
9225 # | jpg | A JPG image of the visualization of the query
9226 #
9227 # GET /queries/{query_id}/run/{result_format} -> Union[str, bytes]
9228 def run_query(
9229 self,
9230 # Id of query
9231 query_id: str,
9232 # Format of result
9233 result_format: str,
9234 # Row limit (may override the limit in the saved query).
9235 limit: Optional[int] = None,
9236 # Apply model-specified formatting to each result.
9237 apply_formatting: Optional[bool] = None,
9238 # Apply visualization options to results.
9239 apply_vis: Optional[bool] = None,
9240 # Get results from cache if available.
9241 cache: Optional[bool] = None,
9242 # Render width for image formats.
9243 image_width: Optional[int] = None,
9244 # Render height for image formats.
9245 image_height: Optional[int] = None,
9246 # Generate drill links (only applicable to 'json_detail' format.
9247 generate_drill_links: Optional[bool] = None,
9248 # 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.
9249 force_production: Optional[bool] = None,
9250 # Retrieve any results from cache even if the results have expired.
9251 cache_only: Optional[bool] = None,
9252 # Prefix to use for drill links (url encoded).
9253 path_prefix: Optional[str] = None,
9254 # Rebuild PDTS used in query.
9255 rebuild_pdts: Optional[bool] = None,
9256 # Perform table calculations on query results
9257 server_table_calcs: Optional[bool] = None,
9258 # Specifies the source of this call.
9259 source: Optional[str] = None,
9260 # Return a specialized OAuth error response if a database OAuth error occurs.
9261 enable_oauth_error_response: Optional[bool] = None,
9262 transport_options: Optional[transport.TransportOptions] = None,
9263 ) -> Union[str, bytes]:
9264 """Run Query"""
9265 query_id = self.encode_path_param(query_id)
9266 result_format = self.encode_path_param(result_format)
9267 response = cast(
9268 Union[str, bytes],
9269 self.get(
9270 path=f"/queries/{query_id}/run/{result_format}",
9271 structure=Union[str, bytes], # type: ignore
9272 query_params={
9273 "limit": limit,
9274 "apply_formatting": apply_formatting,
9275 "apply_vis": apply_vis,
9276 "cache": cache,
9277 "image_width": image_width,
9278 "image_height": image_height,
9279 "generate_drill_links": generate_drill_links,
9280 "force_production": force_production,
9281 "cache_only": cache_only,
9282 "path_prefix": path_prefix,
9283 "rebuild_pdts": rebuild_pdts,
9284 "server_table_calcs": server_table_calcs,
9285 "source": source,
9286 "enable_oauth_error_response": enable_oauth_error_response,
9287 },
9288 transport_options=transport_options,
9289 ),
9290 )
9291 return response
9292
9293 # ### Run the query that is specified inline in the posted body.
9294 #
9295 # This allows running a query as defined in json in the posted body. This combines
9296 # the two actions of posting & running a query into one step.
9297 #
9298 # Here is an example body in json:
9299 # ```
9300 # {
9301 # "model":"thelook",
9302 # "view":"inventory_items",
9303 # "fields":["category.name","inventory_items.days_in_inventory_tier","products.count"],
9304 # "filters":{"category.name":"socks"},
9305 # "sorts":["products.count desc 0"],
9306 # "limit":"500",
9307 # "query_timezone":"America/Los_Angeles"
9308 # }
9309 # ```
9310 #
9311 # When using the Ruby SDK this would be passed as a Ruby hash like:
9312 # ```
9313 # {
9314 # :model=>"thelook",
9315 # :view=>"inventory_items",
9316 # :fields=>
9317 # ["category.name",
9318 # "inventory_items.days_in_inventory_tier",
9319 # "products.count"],
9320 # :filters=>{:"category.name"=>"socks"},
9321 # :sorts=>["products.count desc 0"],
9322 # :limit=>"500",
9323 # :query_timezone=>"America/Los_Angeles",
9324 # }
9325 # ```
9326 #
9327 # This will return the result of running the query in the format specified by the 'result_format' parameter.
9328 #
9329 # Supported formats:
9330 #
9331 # | result_format | Description
9332 # | :-----------: | :--- |
9333 # | json | Plain json
9334 # | json_bi | (*RECOMMENDED*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query. See JsonBi type for schema
9335 # | json_detail | (*LEGACY*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
9336 # | csv | Comma separated values with a header
9337 # | txt | Tab separated values with a header
9338 # | html | Simple html
9339 # | md | Simple markdown
9340 # | xlsx | MS Excel spreadsheet
9341 # | sql | Returns the generated SQL rather than running the query
9342 # | png | A PNG image of the visualization of the query
9343 # | jpg | A JPG image of the visualization of the query
9344 #
9345 # POST /queries/run/{result_format} -> Union[str, bytes]
9346 def run_inline_query(
9347 self,
9348 # Format of result
9349 result_format: str,
9350 body: mdls.WriteQuery,
9351 # Row limit (may override the limit in the saved query).
9352 limit: Optional[int] = None,
9353 # Apply model-specified formatting to each result.
9354 apply_formatting: Optional[bool] = None,
9355 # Apply visualization options to results.
9356 apply_vis: Optional[bool] = None,
9357 # Get results from cache if available.
9358 cache: Optional[bool] = None,
9359 # Render width for image formats.
9360 image_width: Optional[int] = None,
9361 # Render height for image formats.
9362 image_height: Optional[int] = None,
9363 # Generate drill links (only applicable to 'json_detail' format.
9364 generate_drill_links: Optional[bool] = None,
9365 # 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.
9366 force_production: Optional[bool] = None,
9367 # Retrieve any results from cache even if the results have expired.
9368 cache_only: Optional[bool] = None,
9369 # Prefix to use for drill links (url encoded).
9370 path_prefix: Optional[str] = None,
9371 # Rebuild PDTS used in query.
9372 rebuild_pdts: Optional[bool] = None,
9373 # Perform table calculations on query results
9374 server_table_calcs: Optional[bool] = None,
9375 # Return a specialized OAuth error response if a database OAuth error occurs.
9376 enable_oauth_error_response: Optional[bool] = None,
9377 transport_options: Optional[transport.TransportOptions] = None,
9378 ) -> Union[str, bytes]:
9379 """Run Inline Query"""
9380 result_format = self.encode_path_param(result_format)
9381 response = cast(
9382 Union[str, bytes],
9383 self.post(
9384 path=f"/queries/run/{result_format}",
9385 structure=Union[str, bytes], # type: ignore
9386 query_params={
9387 "limit": limit,
9388 "apply_formatting": apply_formatting,
9389 "apply_vis": apply_vis,
9390 "cache": cache,
9391 "image_width": image_width,
9392 "image_height": image_height,
9393 "generate_drill_links": generate_drill_links,
9394 "force_production": force_production,
9395 "cache_only": cache_only,
9396 "path_prefix": path_prefix,
9397 "rebuild_pdts": rebuild_pdts,
9398 "server_table_calcs": server_table_calcs,
9399 "enable_oauth_error_response": enable_oauth_error_response,
9400 },
9401 body=body,
9402 transport_options=transport_options,
9403 ),
9404 )
9405 return response
9406
9407 # ### Run an URL encoded query.
9408 #
9409 # This requires the caller to encode the specifiers for the query into the URL query part using
9410 # Looker-specific syntax as explained below.
9411 #
9412 # Generally, you would want to use one of the methods that takes the parameters as json in the POST body
9413 # for creating and/or running queries. This method exists for cases where one really needs to encode the
9414 # parameters into the URL of a single 'GET' request. This matches the way that the Looker UI formats
9415 # 'explore' URLs etc.
9416 #
9417 # The parameters here are very similar to the json body formatting except that the filter syntax is
9418 # tricky. Unfortunately, this format makes this method not currently callable via the 'Try it out!' button
9419 # in this documentation page. But, this is callable when creating URLs manually or when using the Looker SDK.
9420 #
9421 # Here is an example inline query URL:
9422 #
9423 # ```
9424 # 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
9425 # ```
9426 #
9427 # 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:
9428 #
9429 # ```ruby
9430 # query_params =
9431 # {
9432 # fields: "category.name,inventory_items.days_in_inventory_tier,products.count",
9433 # :"f[category.name]" => "socks",
9434 # sorts: "products.count desc 0",
9435 # limit: "500",
9436 # query_timezone: "America/Los_Angeles"
9437 # }
9438 # response = ruby_sdk.run_url_encoded_query('thelook','inventory_items','json', query_params)
9439 #
9440 # ```
9441 #
9442 # Again, it is generally easier to use the variant of this method that passes the full query in the POST body.
9443 # This method is available for cases where other alternatives won't fit the need.
9444 #
9445 # Supported formats:
9446 #
9447 # | result_format | Description
9448 # | :-----------: | :--- |
9449 # | json | Plain json
9450 # | json_bi | (*RECOMMENDED*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query. See JsonBi type for schema
9451 # | json_detail | (*LEGACY*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
9452 # | csv | Comma separated values with a header
9453 # | txt | Tab separated values with a header
9454 # | html | Simple html
9455 # | md | Simple markdown
9456 # | xlsx | MS Excel spreadsheet
9457 # | sql | Returns the generated SQL rather than running the query
9458 # | png | A PNG image of the visualization of the query
9459 # | jpg | A JPG image of the visualization of the query
9460 #
9461 # GET /queries/models/{model_name}/views/{view_name}/run/{result_format} -> Union[str, bytes]
9462 def run_url_encoded_query(
9463 self,
9464 # Model name
9465 model_name: str,
9466 # View name
9467 view_name: str,
9468 # Format of result
9469 result_format: str,
9470 transport_options: Optional[transport.TransportOptions] = None,
9471 ) -> Union[str, bytes]:
9472 """Run Url Encoded Query"""
9473 model_name = self.encode_path_param(model_name)
9474 view_name = self.encode_path_param(view_name)
9475 result_format = self.encode_path_param(result_format)
9476 response = cast(
9477 Union[str, bytes],
9478 self.get(
9479 path=f"/queries/models/{model_name}/views/{view_name}/run/{result_format}",
9480 structure=Union[str, bytes], # type: ignore
9481 transport_options=transport_options,
9482 ),
9483 )
9484 return response
9485
9486 # ### Get Merge Query
9487 #
9488 # Returns a merge query object given its id.
9489 #
9490 # GET /merge_queries/{merge_query_id} -> mdls.MergeQuery
9491 def merge_query(
9492 self,
9493 # Merge Query Id
9494 merge_query_id: str,
9495 # Requested fields
9496 fields: Optional[str] = None,
9497 transport_options: Optional[transport.TransportOptions] = None,
9498 ) -> mdls.MergeQuery:
9499 """Get Merge Query"""
9500 merge_query_id = self.encode_path_param(merge_query_id)
9501 response = cast(
9502 mdls.MergeQuery,
9503 self.get(
9504 path=f"/merge_queries/{merge_query_id}",
9505 structure=mdls.MergeQuery,
9506 query_params={"fields": fields},
9507 transport_options=transport_options,
9508 ),
9509 )
9510 return response
9511
9512 # ### Create Merge Query
9513 #
9514 # Creates a new merge query object.
9515 #
9516 # A merge query takes the results of one or more queries and combines (merges) the results
9517 # according to field mapping definitions. The result is similar to a SQL left outer join.
9518 #
9519 # A merge query can merge results of queries from different SQL databases.
9520 #
9521 # The order that queries are defined in the source_queries array property is significant. The
9522 # first query in the array defines the primary key into which the results of subsequent
9523 # queries will be merged.
9524 #
9525 # Like model/view query objects, merge queries are immutable and have structural identity - if
9526 # you make a request to create a new merge query that is identical to an existing merge query,
9527 # the existing merge query will be returned instead of creating a duplicate. Conversely, any
9528 # change to the contents of a merge query will produce a new object with a new id.
9529 #
9530 # POST /merge_queries -> mdls.MergeQuery
9531 def create_merge_query(
9532 self,
9533 body: Optional[mdls.WriteMergeQuery] = None,
9534 # Requested fields
9535 fields: Optional[str] = None,
9536 transport_options: Optional[transport.TransportOptions] = None,
9537 ) -> mdls.MergeQuery:
9538 """Create Merge Query"""
9539 response = cast(
9540 mdls.MergeQuery,
9541 self.post(
9542 path="/merge_queries",
9543 structure=mdls.MergeQuery,
9544 query_params={"fields": fields},
9545 body=body,
9546 transport_options=transport_options,
9547 ),
9548 )
9549 return response
9550
9551 # Get information about all running queries.
9552 #
9553 # GET /running_queries -> Sequence[mdls.RunningQueries]
9554 def all_running_queries(
9555 self,
9556 transport_options: Optional[transport.TransportOptions] = None,
9557 ) -> Sequence[mdls.RunningQueries]:
9558 """Get All Running Queries"""
9559 response = cast(
9560 Sequence[mdls.RunningQueries],
9561 self.get(
9562 path="/running_queries",
9563 structure=Sequence[mdls.RunningQueries],
9564 transport_options=transport_options,
9565 ),
9566 )
9567 return response
9568
9569 # Kill a query with a specific query_task_id.
9570 #
9571 # DELETE /running_queries/{query_task_id} -> str
9572 def kill_query(
9573 self,
9574 # Query task id.
9575 query_task_id: str,
9576 transport_options: Optional[transport.TransportOptions] = None,
9577 ) -> str:
9578 """Kill Running Query"""
9579 query_task_id = self.encode_path_param(query_task_id)
9580 response = cast(
9581 str,
9582 self.delete(
9583 path=f"/running_queries/{query_task_id}",
9584 structure=str,
9585 transport_options=transport_options,
9586 ),
9587 )
9588 return response
9589
9590 # ### Create a SQL Runner Query
9591 #
9592 # Either the `connection_name` or `model_name` parameter MUST be provided.
9593 #
9594 # POST /sql_queries -> mdls.SqlQuery
9595 def create_sql_query(
9596 self,
9597 body: mdls.SqlQueryCreate,
9598 transport_options: Optional[transport.TransportOptions] = None,
9599 ) -> mdls.SqlQuery:
9600 """Create SQL Runner Query"""
9601 response = cast(
9602 mdls.SqlQuery,
9603 self.post(
9604 path="/sql_queries",
9605 structure=mdls.SqlQuery,
9606 body=body,
9607 transport_options=transport_options,
9608 ),
9609 )
9610 return response
9611
9612 # Get a SQL Runner query.
9613 #
9614 # GET /sql_queries/{slug} -> mdls.SqlQuery
9615 def sql_query(
9616 self,
9617 # slug of query
9618 slug: str,
9619 transport_options: Optional[transport.TransportOptions] = None,
9620 ) -> mdls.SqlQuery:
9621 """Get SQL Runner Query"""
9622 slug = self.encode_path_param(slug)
9623 response = cast(
9624 mdls.SqlQuery,
9625 self.get(
9626 path=f"/sql_queries/{slug}",
9627 structure=mdls.SqlQuery,
9628 transport_options=transport_options,
9629 ),
9630 )
9631 return response
9632
9633 # Execute a SQL Runner query in a given result_format.
9634 #
9635 # POST /sql_queries/{slug}/run/{result_format} -> str
9636 def run_sql_query(
9637 self,
9638 # slug of query
9639 slug: str,
9640 # Format of result, options are: ["inline_json", "json", "json_detail", "json_fe", "json_bi", "csv", "html", "md", "txt", "xlsx", "gsxml", "sql", "odc", "json_label"]
9641 result_format: str,
9642 # 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.
9643 download: Optional[str] = None,
9644 transport_options: Optional[transport.TransportOptions] = None,
9645 ) -> str:
9646 """Run SQL Runner Query"""
9647 slug = self.encode_path_param(slug)
9648 result_format = self.encode_path_param(result_format)
9649 response = cast(
9650 str,
9651 self.post(
9652 path=f"/sql_queries/{slug}/run/{result_format}",
9653 structure=str,
9654 query_params={"download": download},
9655 transport_options=transport_options,
9656 ),
9657 )
9658 return response
9659
9660 # endregion
9661
9662 # region RenderTask: Manage Render Tasks
9663
9664 # ### Create a new task to render a look to an image.
9665 #
9666 # Returns a render task object.
9667 # To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
9668 # Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
9669 #
9670 # POST /render_tasks/looks/{look_id}/{result_format} -> mdls.RenderTask
9671 def create_look_render_task(
9672 self,
9673 # Id of look to render
9674 look_id: str,
9675 # Output type: png, or jpg
9676 result_format: str,
9677 # Output width in pixels
9678 width: int,
9679 # Output height in pixels
9680 height: int,
9681 # Requested fields.
9682 fields: Optional[str] = None,
9683 transport_options: Optional[transport.TransportOptions] = None,
9684 ) -> mdls.RenderTask:
9685 """Create Look Render Task"""
9686 look_id = self.encode_path_param(look_id)
9687 result_format = self.encode_path_param(result_format)
9688 response = cast(
9689 mdls.RenderTask,
9690 self.post(
9691 path=f"/render_tasks/looks/{look_id}/{result_format}",
9692 structure=mdls.RenderTask,
9693 query_params={"width": width, "height": height, "fields": fields},
9694 transport_options=transport_options,
9695 ),
9696 )
9697 return response
9698
9699 # ### Create a new task to render an existing query to an image.
9700 #
9701 # Returns a render task object.
9702 # To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
9703 # Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
9704 #
9705 # POST /render_tasks/queries/{query_id}/{result_format} -> mdls.RenderTask
9706 def create_query_render_task(
9707 self,
9708 # Id of the query to render
9709 query_id: str,
9710 # Output type: png or jpg
9711 result_format: str,
9712 # Output width in pixels
9713 width: int,
9714 # Output height in pixels
9715 height: int,
9716 # Requested fields.
9717 fields: Optional[str] = None,
9718 transport_options: Optional[transport.TransportOptions] = None,
9719 ) -> mdls.RenderTask:
9720 """Create Query Render Task"""
9721 query_id = self.encode_path_param(query_id)
9722 result_format = self.encode_path_param(result_format)
9723 response = cast(
9724 mdls.RenderTask,
9725 self.post(
9726 path=f"/render_tasks/queries/{query_id}/{result_format}",
9727 structure=mdls.RenderTask,
9728 query_params={"width": width, "height": height, "fields": fields},
9729 transport_options=transport_options,
9730 ),
9731 )
9732 return response
9733
9734 # ### Create a new task to render a dashboard to a document or image.
9735 #
9736 # Returns a render task object.
9737 # To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
9738 # Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
9739 #
9740 # POST /render_tasks/dashboards/{dashboard_id}/{result_format} -> mdls.RenderTask
9741 def create_dashboard_render_task(
9742 self,
9743 # Id of dashboard to render. The ID can be a LookML dashboard also.
9744 dashboard_id: str,
9745 # Output type: pdf, png, or jpg
9746 result_format: str,
9747 body: mdls.CreateDashboardRenderTask,
9748 # Output width in pixels
9749 width: int,
9750 # Output height in pixels
9751 height: int,
9752 # Requested fields.
9753 fields: Optional[str] = None,
9754 # Paper size for pdf. Value can be one of: ["letter","legal","tabloid","a0","a1","a2","a3","a4","a5"]
9755 pdf_paper_size: Optional[str] = None,
9756 # Whether to render pdf in landscape paper orientation
9757 pdf_landscape: Optional[bool] = None,
9758 # Whether or not to expand table vis to full length
9759 long_tables: Optional[bool] = None,
9760 # Theme to apply. Will render embedded version of dashboard if valid
9761 theme: Optional[str] = None,
9762 transport_options: Optional[transport.TransportOptions] = None,
9763 ) -> mdls.RenderTask:
9764 """Create Dashboard Render Task"""
9765 dashboard_id = self.encode_path_param(dashboard_id)
9766 result_format = self.encode_path_param(result_format)
9767 response = cast(
9768 mdls.RenderTask,
9769 self.post(
9770 path=f"/render_tasks/dashboards/{dashboard_id}/{result_format}",
9771 structure=mdls.RenderTask,
9772 query_params={
9773 "width": width,
9774 "height": height,
9775 "fields": fields,
9776 "pdf_paper_size": pdf_paper_size,
9777 "pdf_landscape": pdf_landscape,
9778 "long_tables": long_tables,
9779 "theme": theme,
9780 },
9781 body=body,
9782 transport_options=transport_options,
9783 ),
9784 )
9785 return response
9786
9787 # ### Get information about a render task.
9788 #
9789 # Returns a render task object.
9790 # To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
9791 # Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
9792 #
9793 # GET /render_tasks/{render_task_id} -> mdls.RenderTask
9794 def render_task(
9795 self,
9796 # Id of render task
9797 render_task_id: str,
9798 # Requested fields.
9799 fields: Optional[str] = None,
9800 transport_options: Optional[transport.TransportOptions] = None,
9801 ) -> mdls.RenderTask:
9802 """Get Render Task"""
9803 render_task_id = self.encode_path_param(render_task_id)
9804 response = cast(
9805 mdls.RenderTask,
9806 self.get(
9807 path=f"/render_tasks/{render_task_id}",
9808 structure=mdls.RenderTask,
9809 query_params={"fields": fields},
9810 transport_options=transport_options,
9811 ),
9812 )
9813 return response
9814
9815 # ### Get the document or image produced by a completed render task.
9816 #
9817 # Note that the PDF or image result will be a binary blob in the HTTP response, as indicated by the
9818 # Content-Type in the response headers. This may require specialized (or at least different) handling than text
9819 # responses such as JSON. You may need to tell your HTTP client that the response is binary so that it does not
9820 # attempt to parse the binary data as text.
9821 #
9822 # If the render task exists but has not finished rendering the results, the response HTTP status will be
9823 # **202 Accepted**, the response body will be empty, and the response will have a Retry-After header indicating
9824 # that the caller should repeat the request at a later time.
9825 #
9826 # Returns 404 if the render task cannot be found, if the cached result has expired, or if the caller
9827 # does not have permission to view the results.
9828 #
9829 # For detailed information about the status of the render task, use [Render Task](#!/RenderTask/render_task).
9830 # Polling loops waiting for completion of a render task would be better served by polling **render_task(id)** until
9831 # the task status reaches completion (or error) instead of polling **render_task_results(id)** alone.
9832 #
9833 # GET /render_tasks/{render_task_id}/results -> bytes
9834 def render_task_results(
9835 self,
9836 # Id of render task
9837 render_task_id: str,
9838 transport_options: Optional[transport.TransportOptions] = None,
9839 ) -> bytes:
9840 """Render Task Results"""
9841 render_task_id = self.encode_path_param(render_task_id)
9842 response = cast(
9843 bytes,
9844 self.get(
9845 path=f"/render_tasks/{render_task_id}/results",
9846 structure=bytes,
9847 transport_options=transport_options,
9848 ),
9849 )
9850 return response
9851
9852 # ### Create a new task to render a dashboard element to an image.
9853 #
9854 # Returns a render task object.
9855 # To check the status of a render task, pass the render_task.id to [Get Render Task](#!/RenderTask/get_render_task).
9856 # Once the render task is complete, you can download the resulting document or image using [Get Render Task Results](#!/RenderTask/get_render_task_results).
9857 #
9858 # POST /render_tasks/dashboard_elements/{dashboard_element_id}/{result_format} -> mdls.RenderTask
9859 def create_dashboard_element_render_task(
9860 self,
9861 # 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
9862 dashboard_element_id: str,
9863 # Output type: png or jpg
9864 result_format: str,
9865 # Output width in pixels
9866 width: int,
9867 # Output height in pixels
9868 height: int,
9869 # Requested fields.
9870 fields: Optional[str] = None,
9871 transport_options: Optional[transport.TransportOptions] = None,
9872 ) -> mdls.RenderTask:
9873 """Create Dashboard Element Render Task"""
9874 dashboard_element_id = self.encode_path_param(dashboard_element_id)
9875 result_format = self.encode_path_param(result_format)
9876 response = cast(
9877 mdls.RenderTask,
9878 self.post(
9879 path=f"/render_tasks/dashboard_elements/{dashboard_element_id}/{result_format}",
9880 structure=mdls.RenderTask,
9881 query_params={"width": width, "height": height, "fields": fields},
9882 transport_options=transport_options,
9883 ),
9884 )
9885 return response
9886
9887 # endregion
9888
9889 # region Report: Report
9890
9891 # ### Search Reports
9892 #
9893 # Returns an **array of Report objects** that match the specified search criteria.
9894 #
9895 # If multiple search params are given and `filter_or` is FALSE or not specified,
9896 # search params are combined in a logical AND operation.
9897 # Only rows that match *all* search param criteria will be returned.
9898 #
9899 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
9900 # Results will include rows that match **any** of the search criteria.
9901 #
9902 # String search params use case-insensitive matching.
9903 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
9904 # example="dan%" will match "danger" and "Danzig" but not "David"
9905 # example="D_m%" will match "Damage" and "dump"
9906 #
9907 # Integer search params can accept a single value or a comma separated list of values. The multiple
9908 # values will be combined under a logical OR operation - results will match at least one of
9909 # the given values.
9910 #
9911 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
9912 # or exclude (respectively) rows where the column is null.
9913 #
9914 # Boolean search params accept only "true" and "false" as values.
9915 #
9916 # GET /reports/search -> Sequence[mdls.Report]
9917 def search_reports(
9918 self,
9919 # Select reports in a particular folder.
9920 folder_id: Optional[str] = None,
9921 # Select favorite reports.
9922 favorite: Optional[bool] = None,
9923 # Select reports viewed recently.
9924 recent: Optional[bool] = None,
9925 # Match report id.
9926 id: Optional[str] = None,
9927 # Match report title.
9928 title: Optional[str] = None,
9929 # One or more fields to sort results by.
9930 sorts: Optional[str] = None,
9931 # Number of results to return.(used with next_page_token)
9932 limit: Optional[int] = None,
9933 # Comma delimited list of field names. If provided, only the fields specified will be included in the response.
9934 fields: Optional[str] = None,
9935 # 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.
9936 next_page_token: Optional[str] = None,
9937 transport_options: Optional[transport.TransportOptions] = None,
9938 ) -> Sequence[mdls.Report]:
9939 """Search Reports"""
9940 response = cast(
9941 Sequence[mdls.Report],
9942 self.get(
9943 path="/reports/search",
9944 structure=Sequence[mdls.Report],
9945 query_params={
9946 "folder_id": folder_id,
9947 "favorite": favorite,
9948 "recent": recent,
9949 "id": id,
9950 "title": title,
9951 "sorts": sorts,
9952 "limit": limit,
9953 "fields": fields,
9954 "next_page_token": next_page_token,
9955 },
9956 transport_options=transport_options,
9957 ),
9958 )
9959 return response
9960
9961 # endregion
9962
9963 # region Role: Manage Roles
9964
9965 # ### Search model sets
9966 # Returns all model set records that match the given search criteria.
9967 # If multiple search params are given and `filter_or` is FALSE or not specified,
9968 # search params are combined in a logical AND operation.
9969 # Only rows that match *all* search param criteria will be returned.
9970 #
9971 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
9972 # Results will include rows that match **any** of the search criteria.
9973 #
9974 # String search params use case-insensitive matching.
9975 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
9976 # example="dan%" will match "danger" and "Danzig" but not "David"
9977 # example="D_m%" will match "Damage" and "dump"
9978 #
9979 # Integer search params can accept a single value or a comma separated list of values. The multiple
9980 # values will be combined under a logical OR operation - results will match at least one of
9981 # the given values.
9982 #
9983 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
9984 # or exclude (respectively) rows where the column is null.
9985 #
9986 # Boolean search params accept only "true" and "false" as values.
9987 #
9988 # GET /model_sets/search -> Sequence[mdls.ModelSet]
9989 def search_model_sets(
9990 self,
9991 # Requested fields.
9992 fields: Optional[str] = None,
9993 # Number of results to return (used with `offset`).
9994 limit: Optional[int] = None,
9995 # Number of results to skip before returning any (used with `limit`).
9996 offset: Optional[int] = None,
9997 # Fields to sort by.
9998 sorts: Optional[str] = None,
9999 # Match model set id.
10000 id: Optional[str] = None,
10001 # Match model set name.
10002 name: Optional[str] = None,
10003 # Match model sets by all_access status.
10004 all_access: Optional[bool] = None,
10005 # Match model sets by built_in status.
10006 built_in: Optional[bool] = None,
10007 # Combine given search criteria in a boolean OR expression.
10008 filter_or: Optional[bool] = None,
10009 transport_options: Optional[transport.TransportOptions] = None,
10010 ) -> Sequence[mdls.ModelSet]:
10011 """Search Model Sets"""
10012 response = cast(
10013 Sequence[mdls.ModelSet],
10014 self.get(
10015 path="/model_sets/search",
10016 structure=Sequence[mdls.ModelSet],
10017 query_params={
10018 "fields": fields,
10019 "limit": limit,
10020 "offset": offset,
10021 "sorts": sorts,
10022 "id": id,
10023 "name": name,
10024 "all_access": all_access,
10025 "built_in": built_in,
10026 "filter_or": filter_or,
10027 },
10028 transport_options=transport_options,
10029 ),
10030 )
10031 return response
10032
10033 # ### Get information about the model set with a specific id.
10034 #
10035 # GET /model_sets/{model_set_id} -> mdls.ModelSet
10036 def model_set(
10037 self,
10038 # Id of model set
10039 model_set_id: str,
10040 # Requested fields.
10041 fields: Optional[str] = None,
10042 transport_options: Optional[transport.TransportOptions] = None,
10043 ) -> mdls.ModelSet:
10044 """Get Model Set"""
10045 model_set_id = self.encode_path_param(model_set_id)
10046 response = cast(
10047 mdls.ModelSet,
10048 self.get(
10049 path=f"/model_sets/{model_set_id}",
10050 structure=mdls.ModelSet,
10051 query_params={"fields": fields},
10052 transport_options=transport_options,
10053 ),
10054 )
10055 return response
10056
10057 # ### Update information about the model set with a specific id.
10058 #
10059 # PATCH /model_sets/{model_set_id} -> mdls.ModelSet
10060 def update_model_set(
10061 self,
10062 # id of model set
10063 model_set_id: str,
10064 body: mdls.WriteModelSet,
10065 transport_options: Optional[transport.TransportOptions] = None,
10066 ) -> mdls.ModelSet:
10067 """Update Model Set"""
10068 model_set_id = self.encode_path_param(model_set_id)
10069 response = cast(
10070 mdls.ModelSet,
10071 self.patch(
10072 path=f"/model_sets/{model_set_id}",
10073 structure=mdls.ModelSet,
10074 body=body,
10075 transport_options=transport_options,
10076 ),
10077 )
10078 return response
10079
10080 # ### Delete the model set with a specific id.
10081 #
10082 # DELETE /model_sets/{model_set_id} -> str
10083 def delete_model_set(
10084 self,
10085 # id of model set
10086 model_set_id: str,
10087 transport_options: Optional[transport.TransportOptions] = None,
10088 ) -> str:
10089 """Delete Model Set"""
10090 model_set_id = self.encode_path_param(model_set_id)
10091 response = cast(
10092 str,
10093 self.delete(
10094 path=f"/model_sets/{model_set_id}",
10095 structure=str,
10096 transport_options=transport_options,
10097 ),
10098 )
10099 return response
10100
10101 # ### Get information about all model sets.
10102 #
10103 # GET /model_sets -> Sequence[mdls.ModelSet]
10104 def all_model_sets(
10105 self,
10106 # Requested fields.
10107 fields: Optional[str] = None,
10108 transport_options: Optional[transport.TransportOptions] = None,
10109 ) -> Sequence[mdls.ModelSet]:
10110 """Get All Model Sets"""
10111 response = cast(
10112 Sequence[mdls.ModelSet],
10113 self.get(
10114 path="/model_sets",
10115 structure=Sequence[mdls.ModelSet],
10116 query_params={"fields": fields},
10117 transport_options=transport_options,
10118 ),
10119 )
10120 return response
10121
10122 # ### Create a model set with the specified information. Model sets are used by Roles.
10123 #
10124 # POST /model_sets -> mdls.ModelSet
10125 def create_model_set(
10126 self,
10127 body: mdls.WriteModelSet,
10128 transport_options: Optional[transport.TransportOptions] = None,
10129 ) -> mdls.ModelSet:
10130 """Create Model Set"""
10131 response = cast(
10132 mdls.ModelSet,
10133 self.post(
10134 path="/model_sets",
10135 structure=mdls.ModelSet,
10136 body=body,
10137 transport_options=transport_options,
10138 ),
10139 )
10140 return response
10141
10142 # ### Get all supported permissions.
10143 #
10144 # GET /permissions -> Sequence[mdls.Permission]
10145 def all_permissions(
10146 self,
10147 transport_options: Optional[transport.TransportOptions] = None,
10148 ) -> Sequence[mdls.Permission]:
10149 """Get All Permissions"""
10150 response = cast(
10151 Sequence[mdls.Permission],
10152 self.get(
10153 path="/permissions",
10154 structure=Sequence[mdls.Permission],
10155 transport_options=transport_options,
10156 ),
10157 )
10158 return response
10159
10160 # ### Search permission sets
10161 # Returns all permission set records that match the given search criteria.
10162 # If multiple search params are given and `filter_or` is FALSE or not specified,
10163 # search params are combined in a logical AND operation.
10164 # Only rows that match *all* search param criteria will be returned.
10165 #
10166 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
10167 # Results will include rows that match **any** of the search criteria.
10168 #
10169 # String search params use case-insensitive matching.
10170 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
10171 # example="dan%" will match "danger" and "Danzig" but not "David"
10172 # example="D_m%" will match "Damage" and "dump"
10173 #
10174 # Integer search params can accept a single value or a comma separated list of values. The multiple
10175 # values will be combined under a logical OR operation - results will match at least one of
10176 # the given values.
10177 #
10178 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
10179 # or exclude (respectively) rows where the column is null.
10180 #
10181 # Boolean search params accept only "true" and "false" as values.
10182 #
10183 # GET /permission_sets/search -> Sequence[mdls.PermissionSet]
10184 def search_permission_sets(
10185 self,
10186 # Requested fields.
10187 fields: Optional[str] = None,
10188 # Number of results to return (used with `offset`).
10189 limit: Optional[int] = None,
10190 # Number of results to skip before returning any (used with `limit`).
10191 offset: Optional[int] = None,
10192 # Fields to sort by.
10193 sorts: Optional[str] = None,
10194 # Match permission set id.
10195 id: Optional[str] = None,
10196 # Match permission set name.
10197 name: Optional[str] = None,
10198 # Match permission sets by all_access status.
10199 all_access: Optional[bool] = None,
10200 # Match permission sets by built_in status.
10201 built_in: Optional[bool] = None,
10202 # Combine given search criteria in a boolean OR expression.
10203 filter_or: Optional[bool] = None,
10204 transport_options: Optional[transport.TransportOptions] = None,
10205 ) -> Sequence[mdls.PermissionSet]:
10206 """Search Permission Sets"""
10207 response = cast(
10208 Sequence[mdls.PermissionSet],
10209 self.get(
10210 path="/permission_sets/search",
10211 structure=Sequence[mdls.PermissionSet],
10212 query_params={
10213 "fields": fields,
10214 "limit": limit,
10215 "offset": offset,
10216 "sorts": sorts,
10217 "id": id,
10218 "name": name,
10219 "all_access": all_access,
10220 "built_in": built_in,
10221 "filter_or": filter_or,
10222 },
10223 transport_options=transport_options,
10224 ),
10225 )
10226 return response
10227
10228 # ### Get information about the permission set with a specific id.
10229 #
10230 # GET /permission_sets/{permission_set_id} -> mdls.PermissionSet
10231 def permission_set(
10232 self,
10233 # Id of permission set
10234 permission_set_id: str,
10235 # Requested fields.
10236 fields: Optional[str] = None,
10237 transport_options: Optional[transport.TransportOptions] = None,
10238 ) -> mdls.PermissionSet:
10239 """Get Permission Set"""
10240 permission_set_id = self.encode_path_param(permission_set_id)
10241 response = cast(
10242 mdls.PermissionSet,
10243 self.get(
10244 path=f"/permission_sets/{permission_set_id}",
10245 structure=mdls.PermissionSet,
10246 query_params={"fields": fields},
10247 transport_options=transport_options,
10248 ),
10249 )
10250 return response
10251
10252 # ### Update information about the permission set with a specific id.
10253 # Providing save_content permission alone will also provide you the abilities of save_looks and save_dashboards.
10254 #
10255 # PATCH /permission_sets/{permission_set_id} -> mdls.PermissionSet
10256 def update_permission_set(
10257 self,
10258 # Id of permission set
10259 permission_set_id: str,
10260 body: mdls.WritePermissionSet,
10261 transport_options: Optional[transport.TransportOptions] = None,
10262 ) -> mdls.PermissionSet:
10263 """Update Permission Set"""
10264 permission_set_id = self.encode_path_param(permission_set_id)
10265 response = cast(
10266 mdls.PermissionSet,
10267 self.patch(
10268 path=f"/permission_sets/{permission_set_id}",
10269 structure=mdls.PermissionSet,
10270 body=body,
10271 transport_options=transport_options,
10272 ),
10273 )
10274 return response
10275
10276 # ### Delete the permission set with a specific id.
10277 #
10278 # DELETE /permission_sets/{permission_set_id} -> str
10279 def delete_permission_set(
10280 self,
10281 # Id of permission set
10282 permission_set_id: str,
10283 transport_options: Optional[transport.TransportOptions] = None,
10284 ) -> str:
10285 """Delete Permission Set"""
10286 permission_set_id = self.encode_path_param(permission_set_id)
10287 response = cast(
10288 str,
10289 self.delete(
10290 path=f"/permission_sets/{permission_set_id}",
10291 structure=str,
10292 transport_options=transport_options,
10293 ),
10294 )
10295 return response
10296
10297 # ### Get information about all permission sets.
10298 #
10299 # GET /permission_sets -> Sequence[mdls.PermissionSet]
10300 def all_permission_sets(
10301 self,
10302 # Requested fields.
10303 fields: Optional[str] = None,
10304 transport_options: Optional[transport.TransportOptions] = None,
10305 ) -> Sequence[mdls.PermissionSet]:
10306 """Get All Permission Sets"""
10307 response = cast(
10308 Sequence[mdls.PermissionSet],
10309 self.get(
10310 path="/permission_sets",
10311 structure=Sequence[mdls.PermissionSet],
10312 query_params={"fields": fields},
10313 transport_options=transport_options,
10314 ),
10315 )
10316 return response
10317
10318 # ### Create a permission set with the specified information. Permission sets are used by Roles.
10319 # Providing save_content permission alone will also provide you the abilities of save_looks and save_dashboards.
10320 #
10321 # POST /permission_sets -> mdls.PermissionSet
10322 def create_permission_set(
10323 self,
10324 body: mdls.WritePermissionSet,
10325 transport_options: Optional[transport.TransportOptions] = None,
10326 ) -> mdls.PermissionSet:
10327 """Create Permission Set"""
10328 response = cast(
10329 mdls.PermissionSet,
10330 self.post(
10331 path="/permission_sets",
10332 structure=mdls.PermissionSet,
10333 body=body,
10334 transport_options=transport_options,
10335 ),
10336 )
10337 return response
10338
10339 # ### Get information about all roles.
10340 #
10341 # GET /roles -> Sequence[mdls.Role]
10342 def all_roles(
10343 self,
10344 # Requested fields.
10345 fields: Optional[str] = None,
10346 # Optional list of ids to get specific roles.
10347 ids: Optional[mdls.DelimSequence[str]] = None,
10348 transport_options: Optional[transport.TransportOptions] = None,
10349 ) -> Sequence[mdls.Role]:
10350 """Get All Roles"""
10351 response = cast(
10352 Sequence[mdls.Role],
10353 self.get(
10354 path="/roles",
10355 structure=Sequence[mdls.Role],
10356 query_params={"fields": fields, "ids": ids},
10357 transport_options=transport_options,
10358 ),
10359 )
10360 return response
10361
10362 # ### Create a role with the specified information.
10363 #
10364 # POST /roles -> mdls.Role
10365 def create_role(
10366 self,
10367 body: mdls.WriteRole,
10368 transport_options: Optional[transport.TransportOptions] = None,
10369 ) -> mdls.Role:
10370 """Create Role"""
10371 response = cast(
10372 mdls.Role,
10373 self.post(
10374 path="/roles",
10375 structure=mdls.Role,
10376 body=body,
10377 transport_options=transport_options,
10378 ),
10379 )
10380 return response
10381
10382 # ### Search roles
10383 #
10384 # Returns all role records that match the given search criteria.
10385 #
10386 # If multiple search params are given and `filter_or` is FALSE or not specified,
10387 # search params are combined in a logical AND operation.
10388 # Only rows that match *all* search param criteria will be returned.
10389 #
10390 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
10391 # Results will include rows that match **any** of the search criteria.
10392 #
10393 # String search params use case-insensitive matching.
10394 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
10395 # example="dan%" will match "danger" and "Danzig" but not "David"
10396 # example="D_m%" will match "Damage" and "dump"
10397 #
10398 # Integer search params can accept a single value or a comma separated list of values. The multiple
10399 # values will be combined under a logical OR operation - results will match at least one of
10400 # the given values.
10401 #
10402 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
10403 # or exclude (respectively) rows where the column is null.
10404 #
10405 # Boolean search params accept only "true" and "false" as values.
10406 #
10407 # GET /roles/search -> Sequence[mdls.Role]
10408 def search_roles(
10409 self,
10410 # Requested fields.
10411 fields: Optional[str] = None,
10412 # Number of results to return (used with `offset`).
10413 limit: Optional[int] = None,
10414 # Number of results to skip before returning any (used with `limit`).
10415 offset: Optional[int] = None,
10416 # Fields to sort by.
10417 sorts: Optional[str] = None,
10418 # Match role id.
10419 id: Optional[str] = None,
10420 # Match role name.
10421 name: Optional[str] = None,
10422 # Match roles by built_in status.
10423 built_in: Optional[bool] = None,
10424 # Combine given search criteria in a boolean OR expression.
10425 filter_or: Optional[bool] = None,
10426 # Search for Looker support roles.
10427 is_support_role: Optional[bool] = None,
10428 transport_options: Optional[transport.TransportOptions] = None,
10429 ) -> Sequence[mdls.Role]:
10430 """Search Roles"""
10431 response = cast(
10432 Sequence[mdls.Role],
10433 self.get(
10434 path="/roles/search",
10435 structure=Sequence[mdls.Role],
10436 query_params={
10437 "fields": fields,
10438 "limit": limit,
10439 "offset": offset,
10440 "sorts": sorts,
10441 "id": id,
10442 "name": name,
10443 "built_in": built_in,
10444 "filter_or": filter_or,
10445 "is_support_role": is_support_role,
10446 },
10447 transport_options=transport_options,
10448 ),
10449 )
10450 return response
10451
10452 # ### Search roles include user count
10453 #
10454 # Returns all role records that match the given search criteria, and attaches
10455 # associated user counts.
10456 #
10457 # If multiple search params are given and `filter_or` is FALSE or not specified,
10458 # search params are combined in a logical AND operation.
10459 # Only rows that match *all* search param criteria will be returned.
10460 #
10461 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
10462 # Results will include rows that match **any** of the search criteria.
10463 #
10464 # String search params use case-insensitive matching.
10465 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
10466 # example="dan%" will match "danger" and "Danzig" but not "David"
10467 # example="D_m%" will match "Damage" and "dump"
10468 #
10469 # Integer search params can accept a single value or a comma separated list of values. The multiple
10470 # values will be combined under a logical OR operation - results will match at least one of
10471 # the given values.
10472 #
10473 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
10474 # or exclude (respectively) rows where the column is null.
10475 #
10476 # Boolean search params accept only "true" and "false" as values.
10477 #
10478 # GET /roles/search/with_user_count -> Sequence[mdls.RoleSearch]
10479 def search_roles_with_user_count(
10480 self,
10481 # Requested fields.
10482 fields: Optional[str] = None,
10483 # Number of results to return (used with `offset`).
10484 limit: Optional[int] = None,
10485 # Number of results to skip before returning any (used with `limit`).
10486 offset: Optional[int] = None,
10487 # Fields to sort by.
10488 sorts: Optional[str] = None,
10489 # Match role id.
10490 id: Optional[str] = None,
10491 # Match role name.
10492 name: Optional[str] = None,
10493 # Match roles by built_in status.
10494 built_in: Optional[bool] = None,
10495 # Combine given search criteria in a boolean OR expression.
10496 filter_or: Optional[bool] = None,
10497 transport_options: Optional[transport.TransportOptions] = None,
10498 ) -> Sequence[mdls.RoleSearch]:
10499 """Search Roles with User Count"""
10500 response = cast(
10501 Sequence[mdls.RoleSearch],
10502 self.get(
10503 path="/roles/search/with_user_count",
10504 structure=Sequence[mdls.RoleSearch],
10505 query_params={
10506 "fields": fields,
10507 "limit": limit,
10508 "offset": offset,
10509 "sorts": sorts,
10510 "id": id,
10511 "name": name,
10512 "built_in": built_in,
10513 "filter_or": filter_or,
10514 },
10515 transport_options=transport_options,
10516 ),
10517 )
10518 return response
10519
10520 # ### Get information about the role with a specific id.
10521 #
10522 # GET /roles/{role_id} -> mdls.Role
10523 def role(
10524 self,
10525 # id of role
10526 role_id: str,
10527 transport_options: Optional[transport.TransportOptions] = None,
10528 ) -> mdls.Role:
10529 """Get Role"""
10530 role_id = self.encode_path_param(role_id)
10531 response = cast(
10532 mdls.Role,
10533 self.get(
10534 path=f"/roles/{role_id}",
10535 structure=mdls.Role,
10536 transport_options=transport_options,
10537 ),
10538 )
10539 return response
10540
10541 # ### Update information about the role with a specific id.
10542 #
10543 # PATCH /roles/{role_id} -> mdls.Role
10544 def update_role(
10545 self,
10546 # id of role
10547 role_id: str,
10548 body: mdls.WriteRole,
10549 transport_options: Optional[transport.TransportOptions] = None,
10550 ) -> mdls.Role:
10551 """Update Role"""
10552 role_id = self.encode_path_param(role_id)
10553 response = cast(
10554 mdls.Role,
10555 self.patch(
10556 path=f"/roles/{role_id}",
10557 structure=mdls.Role,
10558 body=body,
10559 transport_options=transport_options,
10560 ),
10561 )
10562 return response
10563
10564 # ### Delete the role with a specific id.
10565 #
10566 # DELETE /roles/{role_id} -> str
10567 def delete_role(
10568 self,
10569 # id of role
10570 role_id: str,
10571 transport_options: Optional[transport.TransportOptions] = None,
10572 ) -> str:
10573 """Delete Role"""
10574 role_id = self.encode_path_param(role_id)
10575 response = cast(
10576 str,
10577 self.delete(
10578 path=f"/roles/{role_id}",
10579 structure=str,
10580 transport_options=transport_options,
10581 ),
10582 )
10583 return response
10584
10585 # ### Get information about all the groups with the role that has a specific id.
10586 #
10587 # GET /roles/{role_id}/groups -> Sequence[mdls.Group]
10588 def role_groups(
10589 self,
10590 # id of role
10591 role_id: str,
10592 # Requested fields.
10593 fields: Optional[str] = None,
10594 transport_options: Optional[transport.TransportOptions] = None,
10595 ) -> Sequence[mdls.Group]:
10596 """Get Role Groups"""
10597 role_id = self.encode_path_param(role_id)
10598 response = cast(
10599 Sequence[mdls.Group],
10600 self.get(
10601 path=f"/roles/{role_id}/groups",
10602 structure=Sequence[mdls.Group],
10603 query_params={"fields": fields},
10604 transport_options=transport_options,
10605 ),
10606 )
10607 return response
10608
10609 # ### Set all groups for a role, removing all existing group associations from that role.
10610 #
10611 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
10612 #
10613 # PUT /roles/{role_id}/groups -> Sequence[mdls.Group]
10614 def set_role_groups(
10615 self,
10616 # id of role
10617 role_id: str,
10618 body: Sequence[str],
10619 transport_options: Optional[transport.TransportOptions] = None,
10620 ) -> Sequence[mdls.Group]:
10621 """Update Role Groups"""
10622 role_id = self.encode_path_param(role_id)
10623 response = cast(
10624 Sequence[mdls.Group],
10625 self.put(
10626 path=f"/roles/{role_id}/groups",
10627 structure=Sequence[mdls.Group],
10628 body=body,
10629 transport_options=transport_options,
10630 ),
10631 )
10632 return response
10633
10634 # ### Get information about all the users with the role that has a specific id.
10635 #
10636 # GET /roles/{role_id}/users -> Sequence[mdls.User]
10637 def role_users(
10638 self,
10639 # id of role
10640 role_id: str,
10641 # Requested fields.
10642 fields: Optional[str] = None,
10643 # Get only users associated directly with the role: exclude those only associated through groups.
10644 direct_association_only: Optional[bool] = None,
10645 transport_options: Optional[transport.TransportOptions] = None,
10646 ) -> Sequence[mdls.User]:
10647 """Get Role Users"""
10648 role_id = self.encode_path_param(role_id)
10649 response = cast(
10650 Sequence[mdls.User],
10651 self.get(
10652 path=f"/roles/{role_id}/users",
10653 structure=Sequence[mdls.User],
10654 query_params={
10655 "fields": fields,
10656 "direct_association_only": direct_association_only,
10657 },
10658 transport_options=transport_options,
10659 ),
10660 )
10661 return response
10662
10663 # ### Set all the users of the role with a specific id.
10664 #
10665 # PUT /roles/{role_id}/users -> Sequence[mdls.User]
10666 def set_role_users(
10667 self,
10668 # id of role
10669 role_id: str,
10670 body: Sequence[str],
10671 transport_options: Optional[transport.TransportOptions] = None,
10672 ) -> Sequence[mdls.User]:
10673 """Update Role Users"""
10674 role_id = self.encode_path_param(role_id)
10675 response = cast(
10676 Sequence[mdls.User],
10677 self.put(
10678 path=f"/roles/{role_id}/users",
10679 structure=Sequence[mdls.User],
10680 body=body,
10681 transport_options=transport_options,
10682 ),
10683 )
10684 return response
10685
10686 # endregion
10687
10688 # region ScheduledPlan: Manage Scheduled Plans
10689
10690 # ### Get Scheduled Plans for a Space
10691 #
10692 # Returns scheduled plans owned by the caller for a given space id.
10693 #
10694 # GET /scheduled_plans/space/{space_id} -> Sequence[mdls.ScheduledPlan]
10695 def scheduled_plans_for_space(
10696 self,
10697 # Space Id
10698 space_id: str,
10699 # Requested fields.
10700 fields: Optional[str] = None,
10701 transport_options: Optional[transport.TransportOptions] = None,
10702 ) -> Sequence[mdls.ScheduledPlan]:
10703 """Scheduled Plans for Space"""
10704 space_id = self.encode_path_param(space_id)
10705 response = cast(
10706 Sequence[mdls.ScheduledPlan],
10707 self.get(
10708 path=f"/scheduled_plans/space/{space_id}",
10709 structure=Sequence[mdls.ScheduledPlan],
10710 query_params={"fields": fields},
10711 transport_options=transport_options,
10712 ),
10713 )
10714 return response
10715
10716 # ### Get Information About a Scheduled Plan
10717 #
10718 # Admins can fetch information about other users' Scheduled Plans.
10719 #
10720 # GET /scheduled_plans/{scheduled_plan_id} -> mdls.ScheduledPlan
10721 def scheduled_plan(
10722 self,
10723 # Scheduled Plan Id
10724 scheduled_plan_id: str,
10725 # Requested fields.
10726 fields: Optional[str] = None,
10727 transport_options: Optional[transport.TransportOptions] = None,
10728 ) -> mdls.ScheduledPlan:
10729 """Get Scheduled Plan"""
10730 scheduled_plan_id = self.encode_path_param(scheduled_plan_id)
10731 response = cast(
10732 mdls.ScheduledPlan,
10733 self.get(
10734 path=f"/scheduled_plans/{scheduled_plan_id}",
10735 structure=mdls.ScheduledPlan,
10736 query_params={"fields": fields},
10737 transport_options=transport_options,
10738 ),
10739 )
10740 return response
10741
10742 # ### Update a Scheduled Plan
10743 #
10744 # Admins can update other users' Scheduled Plans.
10745 #
10746 # Note: Any scheduled plan destinations specified in an update will **replace** all scheduled plan destinations
10747 # currently defined for the scheduled plan.
10748 #
10749 # For Example: If a scheduled plan has destinations A, B, and C, and you call update on this scheduled plan
10750 # specifying only B in the destinations, then destinations A and C will be deleted by the update.
10751 #
10752 # 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.
10753 #
10754 # If you omit the scheduled_plan_destinations property from the object passed to update, then the destinations
10755 # defined on the original scheduled plan will remain unchanged.
10756 #
10757 # #### Email Permissions:
10758 #
10759 # For details about permissions required to schedule delivery to email and the safeguards
10760 # 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).
10761 #
10762 #
10763 # #### Scheduled Plan Destination Formats
10764 #
10765 # Scheduled plan destinations must specify the data format to produce and send to the destination.
10766 #
10767 # Formats:
10768 #
10769 # | format | Description
10770 # | :-----------: | :--- |
10771 # | json | A JSON object containing a `data` property which contains an array of JSON objects, one per row. No metadata.
10772 # | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
10773 # | 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.
10774 # | csv | Comma separated values with a header
10775 # | txt | Tab separated values with a header
10776 # | html | Simple html
10777 # | xlsx | MS Excel spreadsheet
10778 # | wysiwyg_pdf | Dashboard rendered in a tiled layout to produce a PDF document
10779 # | assembled_pdf | Dashboard rendered in a single column layout to produce a PDF document
10780 # | wysiwyg_png | Dashboard rendered in a tiled layout to produce a PNG image
10781 # ||
10782 #
10783 # Valid formats vary by destination type and source object. `wysiwyg_pdf` is only valid for dashboards, for example.
10784 #
10785 # PATCH /scheduled_plans/{scheduled_plan_id} -> mdls.ScheduledPlan
10786 def update_scheduled_plan(
10787 self,
10788 # Scheduled Plan Id
10789 scheduled_plan_id: str,
10790 body: mdls.WriteScheduledPlan,
10791 transport_options: Optional[transport.TransportOptions] = None,
10792 ) -> mdls.ScheduledPlan:
10793 """Update Scheduled Plan"""
10794 scheduled_plan_id = self.encode_path_param(scheduled_plan_id)
10795 response = cast(
10796 mdls.ScheduledPlan,
10797 self.patch(
10798 path=f"/scheduled_plans/{scheduled_plan_id}",
10799 structure=mdls.ScheduledPlan,
10800 body=body,
10801 transport_options=transport_options,
10802 ),
10803 )
10804 return response
10805
10806 # ### Delete a Scheduled Plan
10807 #
10808 # Normal users can only delete their own scheduled plans.
10809 # Admins can delete other users' scheduled plans.
10810 # This delete cannot be undone.
10811 #
10812 # DELETE /scheduled_plans/{scheduled_plan_id} -> str
10813 def delete_scheduled_plan(
10814 self,
10815 # Scheduled Plan Id
10816 scheduled_plan_id: str,
10817 transport_options: Optional[transport.TransportOptions] = None,
10818 ) -> str:
10819 """Delete Scheduled Plan"""
10820 scheduled_plan_id = self.encode_path_param(scheduled_plan_id)
10821 response = cast(
10822 str,
10823 self.delete(
10824 path=f"/scheduled_plans/{scheduled_plan_id}",
10825 structure=str,
10826 transport_options=transport_options,
10827 ),
10828 )
10829 return response
10830
10831 # ### List All Scheduled Plans
10832 #
10833 # Returns all scheduled plans which belong to the caller or given user.
10834 #
10835 # If no user_id is provided, this function returns the scheduled plans owned by the caller.
10836 #
10837 #
10838 # To list all schedules for all users, pass `all_users=true`.
10839 #
10840 #
10841 # The caller must have `see_schedules` permission to see other users' scheduled plans.
10842 #
10843 # GET /scheduled_plans -> Sequence[mdls.ScheduledPlan]
10844 def all_scheduled_plans(
10845 self,
10846 # Return scheduled plans belonging to this user_id. If not provided, returns scheduled plans owned by the caller.
10847 user_id: Optional[str] = None,
10848 # Comma delimited list of field names. If provided, only the fields specified will be included in the response
10849 fields: Optional[str] = None,
10850 # Return scheduled plans belonging to all users (caller needs see_schedules permission)
10851 all_users: Optional[bool] = None,
10852 transport_options: Optional[transport.TransportOptions] = None,
10853 ) -> Sequence[mdls.ScheduledPlan]:
10854 """Get All Scheduled Plans"""
10855 response = cast(
10856 Sequence[mdls.ScheduledPlan],
10857 self.get(
10858 path="/scheduled_plans",
10859 structure=Sequence[mdls.ScheduledPlan],
10860 query_params={
10861 "user_id": user_id,
10862 "fields": fields,
10863 "all_users": all_users,
10864 },
10865 transport_options=transport_options,
10866 ),
10867 )
10868 return response
10869
10870 # ### Create a Scheduled Plan
10871 #
10872 # Create a scheduled plan to render a Look or Dashboard on a recurring schedule.
10873 #
10874 # To create a scheduled plan, you MUST provide values for the following fields:
10875 # `name`
10876 # and
10877 # `look_id`, `dashboard_id`, `lookml_dashboard_id`, or `query_id`
10878 # and
10879 # `cron_tab` or `datagroup`
10880 # and
10881 # at least one scheduled_plan_destination
10882 #
10883 # A scheduled plan MUST have at least one scheduled_plan_destination defined.
10884 #
10885 # When `look_id` is set, `require_no_results`, `require_results`, and `require_change` are all required.
10886 #
10887 # 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.
10888 #
10889 # The queries that provide the data for the look or dashboard are run in the context of user account that owns the scheduled plan.
10890 #
10891 # When `run_as_recipient` is `false` or not specified, the queries that provide the data for the
10892 # look or dashboard are run in the context of user account that owns the scheduled plan.
10893 #
10894 # When `run_as_recipient` is `true` and all the email recipients are Looker user accounts, the
10895 # queries are run in the context of each recipient, so different recipients may see different
10896 # 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).
10897 #
10898 # Admins can create and modify scheduled plans on behalf of other users by specifying a user id.
10899 # Non-admin users may not create or modify scheduled plans by or for other users.
10900 #
10901 # #### Email Permissions:
10902 #
10903 # For details about permissions required to schedule delivery to email and the safeguards
10904 # 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).
10905 #
10906 #
10907 # #### Scheduled Plan Destination Formats
10908 #
10909 # Scheduled plan destinations must specify the data format to produce and send to the destination.
10910 #
10911 # Formats:
10912 #
10913 # | format | Description
10914 # | :-----------: | :--- |
10915 # | json | A JSON object containing a `data` property which contains an array of JSON objects, one per row. No metadata.
10916 # | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
10917 # | 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.
10918 # | csv | Comma separated values with a header
10919 # | txt | Tab separated values with a header
10920 # | html | Simple html
10921 # | xlsx | MS Excel spreadsheet
10922 # | wysiwyg_pdf | Dashboard rendered in a tiled layout to produce a PDF document
10923 # | assembled_pdf | Dashboard rendered in a single column layout to produce a PDF document
10924 # | wysiwyg_png | Dashboard rendered in a tiled layout to produce a PNG image
10925 # ||
10926 #
10927 # Valid formats vary by destination type and source object. `wysiwyg_pdf` is only valid for dashboards, for example.
10928 #
10929 # POST /scheduled_plans -> mdls.ScheduledPlan
10930 def create_scheduled_plan(
10931 self,
10932 body: mdls.WriteScheduledPlan,
10933 transport_options: Optional[transport.TransportOptions] = None,
10934 ) -> mdls.ScheduledPlan:
10935 """Create Scheduled Plan"""
10936 response = cast(
10937 mdls.ScheduledPlan,
10938 self.post(
10939 path="/scheduled_plans",
10940 structure=mdls.ScheduledPlan,
10941 body=body,
10942 transport_options=transport_options,
10943 ),
10944 )
10945 return response
10946
10947 # ### Run a Scheduled Plan Immediately
10948 #
10949 # Create a scheduled plan that runs only once, and immediately.
10950 #
10951 # This can be useful for testing a Scheduled Plan before committing to a production schedule.
10952 #
10953 # Admins can create scheduled plans on behalf of other users by specifying a user id.
10954 #
10955 # This API is rate limited to prevent it from being used for relay spam or DoS attacks
10956 #
10957 # #### Email Permissions:
10958 #
10959 # For details about permissions required to schedule delivery to email and the safeguards
10960 # 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).
10961 #
10962 #
10963 # #### Scheduled Plan Destination Formats
10964 #
10965 # Scheduled plan destinations must specify the data format to produce and send to the destination.
10966 #
10967 # Formats:
10968 #
10969 # | format | Description
10970 # | :-----------: | :--- |
10971 # | json | A JSON object containing a `data` property which contains an array of JSON objects, one per row. No metadata.
10972 # | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
10973 # | 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.
10974 # | csv | Comma separated values with a header
10975 # | txt | Tab separated values with a header
10976 # | html | Simple html
10977 # | xlsx | MS Excel spreadsheet
10978 # | wysiwyg_pdf | Dashboard rendered in a tiled layout to produce a PDF document
10979 # | assembled_pdf | Dashboard rendered in a single column layout to produce a PDF document
10980 # | wysiwyg_png | Dashboard rendered in a tiled layout to produce a PNG image
10981 # ||
10982 #
10983 # Valid formats vary by destination type and source object. `wysiwyg_pdf` is only valid for dashboards, for example.
10984 #
10985 # POST /scheduled_plans/run_once -> mdls.ScheduledPlan
10986 def scheduled_plan_run_once(
10987 self,
10988 body: mdls.WriteScheduledPlan,
10989 transport_options: Optional[transport.TransportOptions] = None,
10990 ) -> mdls.ScheduledPlan:
10991 """Run Scheduled Plan Once"""
10992 response = cast(
10993 mdls.ScheduledPlan,
10994 self.post(
10995 path="/scheduled_plans/run_once",
10996 structure=mdls.ScheduledPlan,
10997 body=body,
10998 transport_options=transport_options,
10999 ),
11000 )
11001 return response
11002
11003 # ### Search Scheduled Plans
11004 #
11005 # Returns all scheduled plans which matches the given search criteria.
11006 #
11007 # If no user_id is provided, this function returns the scheduled plans owned by the caller.
11008 #
11009 #
11010 # To list all schedules for all users, pass `all_users=true`.
11011 #
11012 #
11013 # The caller must have `see_schedules` permission to see other users' scheduled plans.
11014 #
11015 # GET /scheduled_plans/search -> Sequence[mdls.ScheduledPlan]
11016 def search_scheduled_plans(
11017 self,
11018 # Return scheduled plans belonging to this user_id. If not provided, returns scheduled plans owned by the caller.
11019 user_id: Optional[str] = None,
11020 # Comma delimited list of field names. If provided, only the fields specified will be included in the response
11021 fields: Optional[str] = None,
11022 # Return scheduled plans belonging to all users (caller needs see_schedules permission)
11023 all_users: Optional[bool] = None,
11024 # Number of results to return. (used with offset and takes priority over page and per_page)
11025 limit: Optional[int] = None,
11026 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
11027 offset: Optional[int] = None,
11028 # Fields to sort by.
11029 sorts: Optional[str] = None,
11030 # Match Scheduled plan's name.
11031 name: Optional[str] = None,
11032 # Returns scheduled plans belonging to user with this first name.
11033 user_first_name: Optional[str] = None,
11034 # Returns scheduled plans belonging to user with this last name.
11035 user_last_name: Optional[str] = None,
11036 # Returns scheduled plans created on this Dashboard.
11037 dashboard_id: Optional[str] = None,
11038 # Returns scheduled plans created on this Look.
11039 look_id: Optional[str] = None,
11040 # Returns scheduled plans created on this LookML Dashboard.
11041 lookml_dashboard_id: Optional[str] = None,
11042 # Match recipient address.
11043 recipient: Optional[str] = None,
11044 # Match scheduled plan's destination type.
11045 destination_type: Optional[str] = None,
11046 # Match scheduled plan's delivery format.
11047 delivery_format: Optional[str] = None,
11048 # Combine given search criteria in a boolean OR expression
11049 filter_or: Optional[bool] = None,
11050 transport_options: Optional[transport.TransportOptions] = None,
11051 ) -> Sequence[mdls.ScheduledPlan]:
11052 """Search Scheduled Plans"""
11053 response = cast(
11054 Sequence[mdls.ScheduledPlan],
11055 self.get(
11056 path="/scheduled_plans/search",
11057 structure=Sequence[mdls.ScheduledPlan],
11058 query_params={
11059 "user_id": user_id,
11060 "fields": fields,
11061 "all_users": all_users,
11062 "limit": limit,
11063 "offset": offset,
11064 "sorts": sorts,
11065 "name": name,
11066 "user_first_name": user_first_name,
11067 "user_last_name": user_last_name,
11068 "dashboard_id": dashboard_id,
11069 "look_id": look_id,
11070 "lookml_dashboard_id": lookml_dashboard_id,
11071 "recipient": recipient,
11072 "destination_type": destination_type,
11073 "delivery_format": delivery_format,
11074 "filter_or": filter_or,
11075 },
11076 transport_options=transport_options,
11077 ),
11078 )
11079 return response
11080
11081 # ### Get Scheduled Plans for a Look
11082 #
11083 # Returns all scheduled plans for a look which belong to the caller or given user.
11084 #
11085 # If no user_id is provided, this function returns the scheduled plans owned by the caller.
11086 #
11087 #
11088 # To list all schedules for all users, pass `all_users=true`.
11089 #
11090 #
11091 # The caller must have `see_schedules` permission to see other users' scheduled plans.
11092 #
11093 # GET /scheduled_plans/look/{look_id} -> Sequence[mdls.ScheduledPlan]
11094 def scheduled_plans_for_look(
11095 self,
11096 # Look Id
11097 look_id: str,
11098 # User Id (default is requesting user if not specified)
11099 user_id: Optional[str] = None,
11100 # Requested fields.
11101 fields: Optional[str] = None,
11102 # Return scheduled plans belonging to all users for the look
11103 all_users: Optional[bool] = None,
11104 transport_options: Optional[transport.TransportOptions] = None,
11105 ) -> Sequence[mdls.ScheduledPlan]:
11106 """Scheduled Plans for Look"""
11107 look_id = self.encode_path_param(look_id)
11108 response = cast(
11109 Sequence[mdls.ScheduledPlan],
11110 self.get(
11111 path=f"/scheduled_plans/look/{look_id}",
11112 structure=Sequence[mdls.ScheduledPlan],
11113 query_params={
11114 "user_id": user_id,
11115 "fields": fields,
11116 "all_users": all_users,
11117 },
11118 transport_options=transport_options,
11119 ),
11120 )
11121 return response
11122
11123 # ### Get Scheduled Plans for a Dashboard
11124 #
11125 # Returns all scheduled plans for a dashboard which belong to the caller or given user.
11126 #
11127 # If no user_id is provided, this function returns the scheduled plans owned by the caller.
11128 #
11129 #
11130 # To list all schedules for all users, pass `all_users=true`.
11131 #
11132 #
11133 # The caller must have `see_schedules` permission to see other users' scheduled plans.
11134 #
11135 # GET /scheduled_plans/dashboard/{dashboard_id} -> Sequence[mdls.ScheduledPlan]
11136 def scheduled_plans_for_dashboard(
11137 self,
11138 # Dashboard Id
11139 dashboard_id: str,
11140 # User Id (default is requesting user if not specified)
11141 user_id: Optional[str] = None,
11142 # Return scheduled plans belonging to all users for the dashboard
11143 all_users: Optional[bool] = None,
11144 # Requested fields.
11145 fields: Optional[str] = None,
11146 transport_options: Optional[transport.TransportOptions] = None,
11147 ) -> Sequence[mdls.ScheduledPlan]:
11148 """Scheduled Plans for Dashboard"""
11149 dashboard_id = self.encode_path_param(dashboard_id)
11150 response = cast(
11151 Sequence[mdls.ScheduledPlan],
11152 self.get(
11153 path=f"/scheduled_plans/dashboard/{dashboard_id}",
11154 structure=Sequence[mdls.ScheduledPlan],
11155 query_params={
11156 "user_id": user_id,
11157 "all_users": all_users,
11158 "fields": fields,
11159 },
11160 transport_options=transport_options,
11161 ),
11162 )
11163 return response
11164
11165 # ### Get Scheduled Plans for a LookML Dashboard
11166 #
11167 # Returns all scheduled plans for a LookML Dashboard which belong to the caller or given user.
11168 #
11169 # If no user_id is provided, this function returns the scheduled plans owned by the caller.
11170 #
11171 #
11172 # To list all schedules for all users, pass `all_users=true`.
11173 #
11174 #
11175 # The caller must have `see_schedules` permission to see other users' scheduled plans.
11176 #
11177 # GET /scheduled_plans/lookml_dashboard/{lookml_dashboard_id} -> Sequence[mdls.ScheduledPlan]
11178 def scheduled_plans_for_lookml_dashboard(
11179 self,
11180 # LookML Dashboard Id
11181 lookml_dashboard_id: str,
11182 # User Id (default is requesting user if not specified)
11183 user_id: Optional[str] = None,
11184 # Requested fields.
11185 fields: Optional[str] = None,
11186 # Return scheduled plans belonging to all users for the dashboard
11187 all_users: Optional[bool] = None,
11188 transport_options: Optional[transport.TransportOptions] = None,
11189 ) -> Sequence[mdls.ScheduledPlan]:
11190 """Scheduled Plans for LookML Dashboard"""
11191 lookml_dashboard_id = self.encode_path_param(lookml_dashboard_id)
11192 response = cast(
11193 Sequence[mdls.ScheduledPlan],
11194 self.get(
11195 path=f"/scheduled_plans/lookml_dashboard/{lookml_dashboard_id}",
11196 structure=Sequence[mdls.ScheduledPlan],
11197 query_params={
11198 "user_id": user_id,
11199 "fields": fields,
11200 "all_users": all_users,
11201 },
11202 transport_options=transport_options,
11203 ),
11204 )
11205 return response
11206
11207 # ### Run a Scheduled Plan By Id Immediately
11208 # This function creates a run-once schedule plan based on an existing scheduled plan,
11209 # applies modifications (if any) to the new scheduled plan, and runs the new schedule plan immediately.
11210 # This can be useful for testing modifications to an existing scheduled plan before committing to a production schedule.
11211 #
11212 # This function internally performs the following operations:
11213 #
11214 # 1. Copies the properties of the existing scheduled plan into a new scheduled plan
11215 # 2. Copies any properties passed in the JSON body of this request into the new scheduled plan (replacing the original values)
11216 # 3. Creates the new scheduled plan
11217 # 4. Runs the new scheduled plan
11218 #
11219 # The original scheduled plan is not modified by this operation.
11220 # Admins can create, modify, and run scheduled plans on behalf of other users by specifying a user id.
11221 # Non-admins can only create, modify, and run their own scheduled plans.
11222 #
11223 # #### Email Permissions:
11224 #
11225 # For details about permissions required to schedule delivery to email and the safeguards
11226 # 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).
11227 #
11228 #
11229 # #### Scheduled Plan Destination Formats
11230 #
11231 # Scheduled plan destinations must specify the data format to produce and send to the destination.
11232 #
11233 # Formats:
11234 #
11235 # | format | Description
11236 # | :-----------: | :--- |
11237 # | json | A JSON object containing a `data` property which contains an array of JSON objects, one per row. No metadata.
11238 # | json_detail | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
11239 # | 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.
11240 # | csv | Comma separated values with a header
11241 # | txt | Tab separated values with a header
11242 # | html | Simple html
11243 # | xlsx | MS Excel spreadsheet
11244 # | wysiwyg_pdf | Dashboard rendered in a tiled layout to produce a PDF document
11245 # | assembled_pdf | Dashboard rendered in a single column layout to produce a PDF document
11246 # | wysiwyg_png | Dashboard rendered in a tiled layout to produce a PNG image
11247 # ||
11248 #
11249 # Valid formats vary by destination type and source object. `wysiwyg_pdf` is only valid for dashboards, for example.
11250 #
11251 #
11252 #
11253 # This API is rate limited to prevent it from being used for relay spam or DoS attacks
11254 #
11255 # POST /scheduled_plans/{scheduled_plan_id}/run_once -> mdls.ScheduledPlan
11256 def scheduled_plan_run_once_by_id(
11257 self,
11258 # Id of schedule plan to copy and run
11259 scheduled_plan_id: str,
11260 body: Optional[mdls.WriteScheduledPlan] = None,
11261 transport_options: Optional[transport.TransportOptions] = None,
11262 ) -> mdls.ScheduledPlan:
11263 """Run Scheduled Plan Once by Id"""
11264 scheduled_plan_id = self.encode_path_param(scheduled_plan_id)
11265 response = cast(
11266 mdls.ScheduledPlan,
11267 self.post(
11268 path=f"/scheduled_plans/{scheduled_plan_id}/run_once",
11269 structure=mdls.ScheduledPlan,
11270 body=body,
11271 transport_options=transport_options,
11272 ),
11273 )
11274 return response
11275
11276 # endregion
11277
11278 # region Session: Session Information
11279
11280 # ### Get API Session
11281 #
11282 # Returns information about the current API session, such as which workspace is selected for the session.
11283 #
11284 # GET /session -> mdls.ApiSession
11285 def session(
11286 self,
11287 transport_options: Optional[transport.TransportOptions] = None,
11288 ) -> mdls.ApiSession:
11289 """Get Auth"""
11290 response = cast(
11291 mdls.ApiSession,
11292 self.get(
11293 path="/session",
11294 structure=mdls.ApiSession,
11295 transport_options=transport_options,
11296 ),
11297 )
11298 return response
11299
11300 # ### Update API Session
11301 #
11302 # #### API Session Workspace
11303 #
11304 # You can use this endpoint to change the active workspace for the current API session.
11305 #
11306 # Only one workspace can be active in a session. The active workspace can be changed
11307 # any number of times in a session.
11308 #
11309 # The default workspace for API sessions is the "production" workspace.
11310 #
11311 # All Looker APIs that use projects or lookml models (such as running queries) will
11312 # use the version of project and model files defined by this workspace for the lifetime of the
11313 # current API session or until the session workspace is changed again.
11314 #
11315 # An API session has the same lifetime as the access_token used to authenticate API requests. Each successful
11316 # API login generates a new access_token and a new API session.
11317 #
11318 # If your Looker API client application needs to work in a dev workspace across multiple
11319 # API sessions, be sure to select the dev workspace after each login.
11320 #
11321 # PATCH /session -> mdls.ApiSession
11322 def update_session(
11323 self,
11324 body: mdls.WriteApiSession,
11325 transport_options: Optional[transport.TransportOptions] = None,
11326 ) -> mdls.ApiSession:
11327 """Update Auth"""
11328 response = cast(
11329 mdls.ApiSession,
11330 self.patch(
11331 path="/session",
11332 structure=mdls.ApiSession,
11333 body=body,
11334 transport_options=transport_options,
11335 ),
11336 )
11337 return response
11338
11339 # endregion
11340
11341 # region SqlInterfaceQuery: Run and Manage SQL Interface Queries
11342
11343 # ### Handles Avatica RPC metadata requests for SQL Interface queries
11344 #
11345 # GET /sql_interface_queries/metadata -> mdls.SqlInterfaceQueryMetadata
11346 def sql_interface_metadata(
11347 self,
11348 # Avatica RPC request
11349 avatica_request: Optional[str] = None,
11350 transport_options: Optional[transport.TransportOptions] = None,
11351 ) -> mdls.SqlInterfaceQueryMetadata:
11352 """Get SQL Interface Query Metadata"""
11353 response = cast(
11354 mdls.SqlInterfaceQueryMetadata,
11355 self.get(
11356 path="/sql_interface_queries/metadata",
11357 structure=mdls.SqlInterfaceQueryMetadata,
11358 query_params={"avatica_request": avatica_request},
11359 transport_options=transport_options,
11360 ),
11361 )
11362 return response
11363
11364 # ### Run a saved SQL interface query.
11365 #
11366 # This runs a previously created SQL interface query.
11367 #
11368 # The 'result_format' parameter specifies the desired structure and format of the response.
11369 #
11370 # Supported formats:
11371 #
11372 # | result_format | Description
11373 # | :-----------: | :--- |
11374 # | json_bi | Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
11375 #
11376 # GET /sql_interface_queries/{query_id}/run/{result_format} -> mdls.JsonBi
11377 def run_sql_interface_query(
11378 self,
11379 # Integer id of query
11380 query_id: int,
11381 # Format of result, options are: ["json_bi"]
11382 result_format: str,
11383 transport_options: Optional[transport.TransportOptions] = None,
11384 ) -> mdls.JsonBi:
11385 """Run SQL Interface Query"""
11386 result_format = self.encode_path_param(result_format)
11387 response = cast(
11388 mdls.JsonBi,
11389 self.get(
11390 path=f"/sql_interface_queries/{query_id}/run/{result_format}",
11391 structure=mdls.JsonBi,
11392 transport_options=transport_options,
11393 ),
11394 )
11395 return response
11396
11397 # ### Create a SQL interface query.
11398 #
11399 # This allows you to create a new SQL interface query that you can later run. Looker queries are immutable once created
11400 # and are not deleted. If you create a query that is exactly like an existing query then the existing query
11401 # will be returned and no new query will be created. Whether a new query is created or not, you can use
11402 # the 'id' in the returned query with the 'run' method.
11403 #
11404 # The query parameters are passed as json in the body of the request.
11405 #
11406 # POST /sql_interface_queries -> mdls.SqlInterfaceQuery
11407 def create_sql_interface_query(
11408 self,
11409 body: mdls.WriteSqlInterfaceQueryCreate,
11410 transport_options: Optional[transport.TransportOptions] = None,
11411 ) -> mdls.SqlInterfaceQuery:
11412 """Create SQL Interface Query"""
11413 response = cast(
11414 mdls.SqlInterfaceQuery,
11415 self.post(
11416 path="/sql_interface_queries",
11417 structure=mdls.SqlInterfaceQuery,
11418 body=body,
11419 transport_options=transport_options,
11420 ),
11421 )
11422 return response
11423
11424 # endregion
11425
11426 # region Theme: Manage Themes
11427
11428 # ### Get an array of all existing themes
11429 #
11430 # Get a **single theme** by id with [Theme](#!/Theme/theme)
11431 #
11432 # This method returns an array of all existing themes. The active time for the theme is not considered.
11433 #
11434 # **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.
11435 #
11436 # GET /themes -> Sequence[mdls.Theme]
11437 def all_themes(
11438 self,
11439 # Requested fields.
11440 fields: Optional[str] = None,
11441 transport_options: Optional[transport.TransportOptions] = None,
11442 ) -> Sequence[mdls.Theme]:
11443 """Get All Themes"""
11444 response = cast(
11445 Sequence[mdls.Theme],
11446 self.get(
11447 path="/themes",
11448 structure=Sequence[mdls.Theme],
11449 query_params={"fields": fields},
11450 transport_options=transport_options,
11451 ),
11452 )
11453 return response
11454
11455 # ### Create a theme
11456 #
11457 # Creates a new theme object, returning the theme details, including the created id.
11458 #
11459 # If `settings` are not specified, the default theme settings will be copied into the new theme.
11460 #
11461 # The theme `name` can only contain alphanumeric characters or underscores. Theme names should not contain any confidential information, such as customer names.
11462 #
11463 # **Update** an existing theme with [Update Theme](#!/Theme/update_theme)
11464 #
11465 # **Permanently delete** an existing theme with [Delete Theme](#!/Theme/delete_theme)
11466 #
11467 # For more information, see [Creating and Applying Themes](https://cloud.google.com/looker/docs/r/admin/themes).
11468 #
11469 # **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.
11470 #
11471 # POST /themes -> mdls.Theme
11472 def create_theme(
11473 self,
11474 body: mdls.WriteTheme,
11475 transport_options: Optional[transport.TransportOptions] = None,
11476 ) -> mdls.Theme:
11477 """Create Theme"""
11478 response = cast(
11479 mdls.Theme,
11480 self.post(
11481 path="/themes",
11482 structure=mdls.Theme,
11483 body=body,
11484 transport_options=transport_options,
11485 ),
11486 )
11487 return response
11488
11489 # ### Search all themes for matching criteria.
11490 #
11491 # Returns an **array of theme objects** that match the specified search criteria.
11492 #
11493 # | Search Parameters | Description
11494 # | :-------------------: | :------ |
11495 # | `begin_at` only | Find themes active at or after `begin_at`
11496 # | `end_at` only | Find themes active at or before `end_at`
11497 # | both set | Find themes with an active inclusive period between `begin_at` and `end_at`
11498 #
11499 # Note: Range matching requires boolean AND logic.
11500 # When using `begin_at` and `end_at` together, do not use `filter_or`=TRUE
11501 #
11502 # If multiple search params are given and `filter_or` is FALSE or not specified,
11503 # search params are combined in a logical AND operation.
11504 # Only rows that match *all* search param criteria will be returned.
11505 #
11506 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
11507 # Results will include rows that match **any** of the search criteria.
11508 #
11509 # String search params use case-insensitive matching.
11510 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
11511 # example="dan%" will match "danger" and "Danzig" but not "David"
11512 # example="D_m%" will match "Damage" and "dump"
11513 #
11514 # Integer search params can accept a single value or a comma separated list of values. The multiple
11515 # values will be combined under a logical OR operation - results will match at least one of
11516 # the given values.
11517 #
11518 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
11519 # or exclude (respectively) rows where the column is null.
11520 #
11521 # Boolean search params accept only "true" and "false" as values.
11522 #
11523 #
11524 # Get a **single theme** by id with [Theme](#!/Theme/theme)
11525 #
11526 # **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.
11527 #
11528 # GET /themes/search -> Sequence[mdls.Theme]
11529 def search_themes(
11530 self,
11531 # Match theme id.
11532 id: Optional[str] = None,
11533 # Match theme name.
11534 name: Optional[str] = None,
11535 # Timestamp for activation.
11536 begin_at: Optional[datetime.datetime] = None,
11537 # Timestamp for expiration.
11538 end_at: Optional[datetime.datetime] = None,
11539 # Number of results to return (used with `offset`).
11540 limit: Optional[int] = None,
11541 # Number of results to skip before returning any (used with `limit`).
11542 offset: Optional[int] = None,
11543 # Fields to sort by.
11544 sorts: Optional[str] = None,
11545 # Requested fields.
11546 fields: Optional[str] = None,
11547 # Combine given search criteria in a boolean OR expression
11548 filter_or: Optional[bool] = None,
11549 transport_options: Optional[transport.TransportOptions] = None,
11550 ) -> Sequence[mdls.Theme]:
11551 """Search Themes"""
11552 response = cast(
11553 Sequence[mdls.Theme],
11554 self.get(
11555 path="/themes/search",
11556 structure=Sequence[mdls.Theme],
11557 query_params={
11558 "id": id,
11559 "name": name,
11560 "begin_at": begin_at,
11561 "end_at": end_at,
11562 "limit": limit,
11563 "offset": offset,
11564 "sorts": sorts,
11565 "fields": fields,
11566 "filter_or": filter_or,
11567 },
11568 transport_options=transport_options,
11569 ),
11570 )
11571 return response
11572
11573 # ### Get the default theme
11574 #
11575 # Returns the active theme object set as the default.
11576 #
11577 # The **default** theme name can be set in the UI on the Admin|Theme UI page
11578 #
11579 # The optional `ts` parameter can specify a different timestamp than "now." If specified, it returns the default theme at the time indicated.
11580 #
11581 # GET /themes/default -> mdls.Theme
11582 def default_theme(
11583 self,
11584 # Timestamp representing the target datetime for the active period. Defaults to 'now'
11585 ts: Optional[datetime.datetime] = None,
11586 transport_options: Optional[transport.TransportOptions] = None,
11587 ) -> mdls.Theme:
11588 """Get Default Theme"""
11589 response = cast(
11590 mdls.Theme,
11591 self.get(
11592 path="/themes/default",
11593 structure=mdls.Theme,
11594 query_params={"ts": ts},
11595 transport_options=transport_options,
11596 ),
11597 )
11598 return response
11599
11600 # ### Set the global default theme by theme name
11601 #
11602 # Only Admin users can call this function.
11603 #
11604 # 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.
11605 #
11606 # [Create Theme](#!/Theme/create) has detailed information on rules for default and active themes
11607 #
11608 # Returns the new specified default theme object.
11609 #
11610 # **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.
11611 #
11612 # PUT /themes/default -> mdls.Theme
11613 def set_default_theme(
11614 self,
11615 # Name of theme to set as default
11616 name: str,
11617 transport_options: Optional[transport.TransportOptions] = None,
11618 ) -> mdls.Theme:
11619 """Set Default Theme"""
11620 response = cast(
11621 mdls.Theme,
11622 self.put(
11623 path="/themes/default",
11624 structure=mdls.Theme,
11625 query_params={"name": name},
11626 transport_options=transport_options,
11627 ),
11628 )
11629 return response
11630
11631 # ### Get active themes
11632 #
11633 # Returns an array of active themes.
11634 #
11635 # If the `name` parameter is specified, it will return an array with one theme if it's active and found.
11636 #
11637 # The optional `ts` parameter can specify a different timestamp than "now."
11638 #
11639 # **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.
11640 #
11641 # GET /themes/active -> Sequence[mdls.Theme]
11642 def active_themes(
11643 self,
11644 # Name of theme
11645 name: Optional[str] = None,
11646 # Timestamp representing the target datetime for the active period. Defaults to 'now'
11647 ts: Optional[datetime.datetime] = None,
11648 # Requested fields.
11649 fields: Optional[str] = None,
11650 transport_options: Optional[transport.TransportOptions] = None,
11651 ) -> Sequence[mdls.Theme]:
11652 """Get Active Themes"""
11653 response = cast(
11654 Sequence[mdls.Theme],
11655 self.get(
11656 path="/themes/active",
11657 structure=Sequence[mdls.Theme],
11658 query_params={"name": name, "ts": ts, "fields": fields},
11659 transport_options=transport_options,
11660 ),
11661 )
11662 return response
11663
11664 # ### Get the named theme if it's active. Otherwise, return the default theme
11665 #
11666 # The optional `ts` parameter can specify a different timestamp than "now."
11667 # Note: API users with `show` ability can call this function
11668 #
11669 # **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.
11670 #
11671 # GET /themes/theme_or_default -> mdls.Theme
11672 def theme_or_default(
11673 self,
11674 # Name of theme
11675 name: str,
11676 # Timestamp representing the target datetime for the active period. Defaults to 'now'
11677 ts: Optional[datetime.datetime] = None,
11678 transport_options: Optional[transport.TransportOptions] = None,
11679 ) -> mdls.Theme:
11680 """Get Theme or Default"""
11681 response = cast(
11682 mdls.Theme,
11683 self.get(
11684 path="/themes/theme_or_default",
11685 structure=mdls.Theme,
11686 query_params={"name": name, "ts": ts},
11687 transport_options=transport_options,
11688 ),
11689 )
11690 return response
11691
11692 # ### Validate a theme with the specified information
11693 #
11694 # Validates all values set for the theme, returning any errors encountered, or 200 OK if valid
11695 #
11696 # See [Create Theme](#!/Theme/create_theme) for constraints
11697 #
11698 # **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.
11699 #
11700 # POST /themes/validate -> mdls.ValidationError
11701 def validate_theme(
11702 self,
11703 body: mdls.WriteTheme,
11704 transport_options: Optional[transport.TransportOptions] = None,
11705 ) -> mdls.ValidationError:
11706 """Validate Theme"""
11707 response = cast(
11708 mdls.ValidationError,
11709 self.post(
11710 path="/themes/validate",
11711 structure=mdls.ValidationError,
11712 body=body,
11713 transport_options=transport_options,
11714 ),
11715 )
11716 return response
11717
11718 # ### Get a theme by ID
11719 #
11720 # Use this to retrieve a specific theme, whether or not it's currently active.
11721 #
11722 # **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.
11723 #
11724 # GET /themes/{theme_id} -> mdls.Theme
11725 def theme(
11726 self,
11727 # Id of theme
11728 theme_id: str,
11729 # Requested fields.
11730 fields: Optional[str] = None,
11731 transport_options: Optional[transport.TransportOptions] = None,
11732 ) -> mdls.Theme:
11733 """Get Theme"""
11734 theme_id = self.encode_path_param(theme_id)
11735 response = cast(
11736 mdls.Theme,
11737 self.get(
11738 path=f"/themes/{theme_id}",
11739 structure=mdls.Theme,
11740 query_params={"fields": fields},
11741 transport_options=transport_options,
11742 ),
11743 )
11744 return response
11745
11746 # ### Update the theme by id.
11747 #
11748 # **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.
11749 #
11750 # PATCH /themes/{theme_id} -> mdls.Theme
11751 def update_theme(
11752 self,
11753 # Id of theme
11754 theme_id: str,
11755 body: mdls.WriteTheme,
11756 transport_options: Optional[transport.TransportOptions] = None,
11757 ) -> mdls.Theme:
11758 """Update Theme"""
11759 theme_id = self.encode_path_param(theme_id)
11760 response = cast(
11761 mdls.Theme,
11762 self.patch(
11763 path=f"/themes/{theme_id}",
11764 structure=mdls.Theme,
11765 body=body,
11766 transport_options=transport_options,
11767 ),
11768 )
11769 return response
11770
11771 # ### Delete a specific theme by id
11772 #
11773 # This operation permanently deletes the identified theme from the database.
11774 #
11775 # Because multiple themes can have the same name (with different activation time spans) themes can only be deleted by ID.
11776 #
11777 # All IDs associated with a theme name can be retrieved by searching for the theme name with [Theme Search](#!/Theme/search).
11778 #
11779 # **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.
11780 #
11781 # DELETE /themes/{theme_id} -> str
11782 def delete_theme(
11783 self,
11784 # Id of theme
11785 theme_id: str,
11786 transport_options: Optional[transport.TransportOptions] = None,
11787 ) -> str:
11788 """Delete Theme"""
11789 theme_id = self.encode_path_param(theme_id)
11790 response = cast(
11791 str,
11792 self.delete(
11793 path=f"/themes/{theme_id}",
11794 structure=str,
11795 transport_options=transport_options,
11796 ),
11797 )
11798 return response
11799
11800 # endregion
11801
11802 # region User: Manage Users
11803
11804 # ### Search email credentials
11805 #
11806 # Returns all credentials_email records that match the given search criteria.
11807 #
11808 # If multiple search params are given and `filter_or` is FALSE or not specified,
11809 # search params are combined in a logical AND operation.
11810 # Only rows that match *all* search param criteria will be returned.
11811 #
11812 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
11813 # Results will include rows that match **any** of the search criteria.
11814 #
11815 # String search params use case-insensitive matching.
11816 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
11817 # example="dan%" will match "danger" and "Danzig" but not "David"
11818 # example="D_m%" will match "Damage" and "dump"
11819 #
11820 # Integer search params can accept a single value or a comma separated list of values. The multiple
11821 # values will be combined under a logical OR operation - results will match at least one of
11822 # the given values.
11823 #
11824 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
11825 # or exclude (respectively) rows where the column is null.
11826 #
11827 # Boolean search params accept only "true" and "false" as values.
11828 #
11829 #
11830 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
11831 #
11832 # GET /credentials_email/search -> Sequence[mdls.CredentialsEmailSearch]
11833 def search_credentials_email(
11834 self,
11835 # Requested fields.
11836 fields: Optional[str] = None,
11837 # Number of results to return (used with `offset`).
11838 limit: Optional[int] = None,
11839 # Number of results to skip before returning any (used with `limit`).
11840 offset: Optional[int] = None,
11841 # Fields to sort by.
11842 sorts: Optional[str] = None,
11843 # Match credentials_email id.
11844 id: Optional[str] = None,
11845 # Match credentials_email email.
11846 email: Optional[str] = None,
11847 # Find credentials_email that match given emails.
11848 emails: Optional[str] = None,
11849 # Combine given search criteria in a boolean OR expression.
11850 filter_or: Optional[bool] = None,
11851 transport_options: Optional[transport.TransportOptions] = None,
11852 ) -> Sequence[mdls.CredentialsEmailSearch]:
11853 """Search CredentialsEmail"""
11854 response = cast(
11855 Sequence[mdls.CredentialsEmailSearch],
11856 self.get(
11857 path="/credentials_email/search",
11858 structure=Sequence[mdls.CredentialsEmailSearch],
11859 query_params={
11860 "fields": fields,
11861 "limit": limit,
11862 "offset": offset,
11863 "sorts": sorts,
11864 "id": id,
11865 "email": email,
11866 "emails": emails,
11867 "filter_or": filter_or,
11868 },
11869 transport_options=transport_options,
11870 ),
11871 )
11872 return response
11873
11874 # ### Get information about the current user; i.e. the user account currently calling the API.
11875 #
11876 # GET /user -> mdls.User
11877 def me(
11878 self,
11879 # Requested fields.
11880 fields: Optional[str] = None,
11881 transport_options: Optional[transport.TransportOptions] = None,
11882 ) -> mdls.User:
11883 """Get Current User"""
11884 response = cast(
11885 mdls.User,
11886 self.get(
11887 path="/user",
11888 structure=mdls.User,
11889 query_params={"fields": fields},
11890 transport_options=transport_options,
11891 ),
11892 )
11893 return response
11894
11895 # ### Get information about all users.
11896 #
11897 # GET /users -> Sequence[mdls.User]
11898 def all_users(
11899 self,
11900 # Requested fields.
11901 fields: Optional[str] = None,
11902 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
11903 page: Optional[int] = None,
11904 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
11905 per_page: Optional[int] = None,
11906 # Number of results to return. (used with offset and takes priority over page and per_page)
11907 limit: Optional[int] = None,
11908 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
11909 offset: Optional[int] = None,
11910 # Fields to sort by.
11911 sorts: Optional[str] = None,
11912 # Optional list of ids to get specific users.
11913 ids: Optional[mdls.DelimSequence[str]] = None,
11914 transport_options: Optional[transport.TransportOptions] = None,
11915 ) -> Sequence[mdls.User]:
11916 """Get All Users"""
11917 response = cast(
11918 Sequence[mdls.User],
11919 self.get(
11920 path="/users",
11921 structure=Sequence[mdls.User],
11922 query_params={
11923 "fields": fields,
11924 "page": page,
11925 "per_page": per_page,
11926 "limit": limit,
11927 "offset": offset,
11928 "sorts": sorts,
11929 "ids": ids,
11930 },
11931 transport_options=transport_options,
11932 ),
11933 )
11934 return response
11935
11936 # ### Create a user with the specified information.
11937 #
11938 # POST /users -> mdls.User
11939 def create_user(
11940 self,
11941 body: Optional[mdls.WriteUser] = None,
11942 # Requested fields.
11943 fields: Optional[str] = None,
11944 transport_options: Optional[transport.TransportOptions] = None,
11945 ) -> mdls.User:
11946 """Create User"""
11947 response = cast(
11948 mdls.User,
11949 self.post(
11950 path="/users",
11951 structure=mdls.User,
11952 query_params={"fields": fields},
11953 body=body,
11954 transport_options=transport_options,
11955 ),
11956 )
11957 return response
11958
11959 # ### Search users
11960 #
11961 # Returns all<sup>*</sup> user records that match the given search criteria.
11962 #
11963 # If multiple search params are given and `filter_or` is FALSE or not specified,
11964 # search params are combined in a logical AND operation.
11965 # Only rows that match *all* search param criteria will be returned.
11966 #
11967 # If `filter_or` is TRUE, multiple search params are combined in a logical OR operation.
11968 # Results will include rows that match **any** of the search criteria.
11969 #
11970 # String search params use case-insensitive matching.
11971 # String search params can contain `%` and '_' as SQL LIKE pattern match wildcard expressions.
11972 # example="dan%" will match "danger" and "Danzig" but not "David"
11973 # example="D_m%" will match "Damage" and "dump"
11974 #
11975 # Integer search params can accept a single value or a comma separated list of values. The multiple
11976 # values will be combined under a logical OR operation - results will match at least one of
11977 # the given values.
11978 #
11979 # Most search params can accept "IS NULL" and "NOT NULL" as special expressions to match
11980 # or exclude (respectively) rows where the column is null.
11981 #
11982 # Boolean search params accept only "true" and "false" as values.
11983 #
11984 #
11985 # (<sup>*</sup>) Results are always filtered to the level of information the caller is permitted to view.
11986 # Looker admins can see all user details; normal users in an open system can see
11987 # names of other users but no details; normal users in a closed system can only see
11988 # names of other users who are members of the same group as the user.
11989 #
11990 # GET /users/search -> Sequence[mdls.User]
11991 def search_users(
11992 self,
11993 # Include only these fields in the response
11994 fields: Optional[str] = None,
11995 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
11996 page: Optional[int] = None,
11997 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
11998 per_page: Optional[int] = None,
11999 # Number of results to return. (used with offset and takes priority over page and per_page)
12000 limit: Optional[int] = None,
12001 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
12002 offset: Optional[int] = None,
12003 # Fields to sort by.
12004 sorts: Optional[str] = None,
12005 # Match User Id.
12006 id: Optional[str] = None,
12007 # Match First name.
12008 first_name: Optional[str] = None,
12009 # Match Last name.
12010 last_name: Optional[str] = None,
12011 # Search for user accounts associated with Looker employees
12012 verified_looker_employee: Optional[bool] = None,
12013 # Search for only embed users
12014 embed_user: Optional[bool] = None,
12015 # Search for the user with this email address
12016 email: Optional[str] = None,
12017 # Search for disabled user accounts
12018 is_disabled: Optional[bool] = None,
12019 # Combine given search criteria in a boolean OR expression
12020 filter_or: Optional[bool] = None,
12021 # Search for users who have access to this content_metadata item
12022 content_metadata_id: Optional[str] = None,
12023 # Search for users who are direct members of this group
12024 group_id: Optional[str] = None,
12025 transport_options: Optional[transport.TransportOptions] = None,
12026 ) -> Sequence[mdls.User]:
12027 """Search Users"""
12028 response = cast(
12029 Sequence[mdls.User],
12030 self.get(
12031 path="/users/search",
12032 structure=Sequence[mdls.User],
12033 query_params={
12034 "fields": fields,
12035 "page": page,
12036 "per_page": per_page,
12037 "limit": limit,
12038 "offset": offset,
12039 "sorts": sorts,
12040 "id": id,
12041 "first_name": first_name,
12042 "last_name": last_name,
12043 "verified_looker_employee": verified_looker_employee,
12044 "embed_user": embed_user,
12045 "email": email,
12046 "is_disabled": is_disabled,
12047 "filter_or": filter_or,
12048 "content_metadata_id": content_metadata_id,
12049 "group_id": group_id,
12050 },
12051 transport_options=transport_options,
12052 ),
12053 )
12054 return response
12055
12056 # ### Search for user accounts by name
12057 #
12058 # Returns all user accounts where `first_name` OR `last_name` OR `email` field values match a pattern.
12059 # The pattern can contain `%` and `_` wildcards as in SQL LIKE expressions.
12060 #
12061 # Any additional search params will be combined into a logical AND expression.
12062 #
12063 # GET /users/search/names/{pattern} -> Sequence[mdls.User]
12064 def search_users_names(
12065 self,
12066 # Pattern to match
12067 pattern: str,
12068 # Include only these fields in the response
12069 fields: Optional[str] = None,
12070 # DEPRECATED. Use limit and offset instead. Return only page N of paginated results
12071 page: Optional[int] = None,
12072 # DEPRECATED. Use limit and offset instead. Return N rows of data per page
12073 per_page: Optional[int] = None,
12074 # Number of results to return. (used with offset and takes priority over page and per_page)
12075 limit: Optional[int] = None,
12076 # Number of results to skip before returning any. (used with limit and takes priority over page and per_page)
12077 offset: Optional[int] = None,
12078 # Fields to sort by
12079 sorts: Optional[str] = None,
12080 # Match User Id
12081 id: Optional[str] = None,
12082 # Match First name
12083 first_name: Optional[str] = None,
12084 # Match Last name
12085 last_name: Optional[str] = None,
12086 # Match Verified Looker employee
12087 verified_looker_employee: Optional[bool] = None,
12088 # Match Email Address
12089 email: Optional[str] = None,
12090 # Include or exclude disabled accounts in the results
12091 is_disabled: Optional[bool] = None,
12092 transport_options: Optional[transport.TransportOptions] = None,
12093 ) -> Sequence[mdls.User]:
12094 """Search User Names"""
12095 pattern = self.encode_path_param(pattern)
12096 response = cast(
12097 Sequence[mdls.User],
12098 self.get(
12099 path=f"/users/search/names/{pattern}",
12100 structure=Sequence[mdls.User],
12101 query_params={
12102 "fields": fields,
12103 "page": page,
12104 "per_page": per_page,
12105 "limit": limit,
12106 "offset": offset,
12107 "sorts": sorts,
12108 "id": id,
12109 "first_name": first_name,
12110 "last_name": last_name,
12111 "verified_looker_employee": verified_looker_employee,
12112 "email": email,
12113 "is_disabled": is_disabled,
12114 },
12115 transport_options=transport_options,
12116 ),
12117 )
12118 return response
12119
12120 # ### Get information about the user with a specific id.
12121 #
12122 # If the caller is an admin or the caller is the user being specified, then full user information will
12123 # be returned. Otherwise, a minimal 'public' variant of the user information will be returned. This contains
12124 # The user name and avatar url, but no sensitive information.
12125 #
12126 # GET /users/{user_id} -> mdls.User
12127 def user(
12128 self,
12129 # Id of user
12130 user_id: str,
12131 # Requested fields.
12132 fields: Optional[str] = None,
12133 transport_options: Optional[transport.TransportOptions] = None,
12134 ) -> mdls.User:
12135 """Get User by Id"""
12136 user_id = self.encode_path_param(user_id)
12137 response = cast(
12138 mdls.User,
12139 self.get(
12140 path=f"/users/{user_id}",
12141 structure=mdls.User,
12142 query_params={"fields": fields},
12143 transport_options=transport_options,
12144 ),
12145 )
12146 return response
12147
12148 # ### Update information about the user with a specific id.
12149 #
12150 # PATCH /users/{user_id} -> mdls.User
12151 def update_user(
12152 self,
12153 # Id of user
12154 user_id: str,
12155 body: mdls.WriteUser,
12156 # Requested fields.
12157 fields: Optional[str] = None,
12158 transport_options: Optional[transport.TransportOptions] = None,
12159 ) -> mdls.User:
12160 """Update User"""
12161 user_id = self.encode_path_param(user_id)
12162 response = cast(
12163 mdls.User,
12164 self.patch(
12165 path=f"/users/{user_id}",
12166 structure=mdls.User,
12167 query_params={"fields": fields},
12168 body=body,
12169 transport_options=transport_options,
12170 ),
12171 )
12172 return response
12173
12174 # ### Delete the user with a specific id.
12175 #
12176 # **DANGER** this will delete the user and all looks and other information owned by the user.
12177 #
12178 # DELETE /users/{user_id} -> str
12179 def delete_user(
12180 self,
12181 # Id of user
12182 user_id: str,
12183 transport_options: Optional[transport.TransportOptions] = None,
12184 ) -> str:
12185 """Delete User"""
12186 user_id = self.encode_path_param(user_id)
12187 response = cast(
12188 str,
12189 self.delete(
12190 path=f"/users/{user_id}",
12191 structure=str,
12192 transport_options=transport_options,
12193 ),
12194 )
12195 return response
12196
12197 # ### Get information about the user with a credential of given type with specific id.
12198 #
12199 # This is used to do things like find users by their embed external_user_id. Or, find the user with
12200 # a given api3 client_id, etc. The 'credential_type' matches the 'type' name of the various credential
12201 # types. It must be one of the values listed in the table below. The 'credential_id' is your unique Id
12202 # for the user and is specific to each type of credential.
12203 #
12204 # An example using the Ruby sdk might look like:
12205 #
12206 # `sdk.user_for_credential('embed', 'customer-4959425')`
12207 #
12208 # This table shows the supported 'Credential Type' strings. The right column is for reference; it shows
12209 # which field in the given credential type is actually searched when finding a user with the supplied
12210 # 'credential_id'.
12211 #
12212 # | Credential Types | Id Field Matched |
12213 # | ---------------- | ---------------- |
12214 # | email | email |
12215 # | google | google_user_id |
12216 # | saml | saml_user_id |
12217 # | oidc | oidc_user_id |
12218 # | ldap | ldap_id |
12219 # | api | token |
12220 # | api3 | client_id |
12221 # | embed | external_user_id |
12222 # | looker_openid | email |
12223 #
12224 # **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'.
12225 #
12226 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12227 #
12228 # GET /users/credential/{credential_type}/{credential_id} -> mdls.User
12229 def user_for_credential(
12230 self,
12231 # Type name of credential
12232 credential_type: str,
12233 # Id of credential
12234 credential_id: str,
12235 # Requested fields.
12236 fields: Optional[str] = None,
12237 transport_options: Optional[transport.TransportOptions] = None,
12238 ) -> mdls.User:
12239 """Get User by Credential Id"""
12240 credential_type = self.encode_path_param(credential_type)
12241 credential_id = self.encode_path_param(credential_id)
12242 response = cast(
12243 mdls.User,
12244 self.get(
12245 path=f"/users/credential/{credential_type}/{credential_id}",
12246 structure=mdls.User,
12247 query_params={"fields": fields},
12248 transport_options=transport_options,
12249 ),
12250 )
12251 return response
12252
12253 # ### Email/password login information for the specified user.
12254 #
12255 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12256 #
12257 # GET /users/{user_id}/credentials_email -> mdls.CredentialsEmail
12258 def user_credentials_email(
12259 self,
12260 # Id of user
12261 user_id: str,
12262 # Requested fields.
12263 fields: Optional[str] = None,
12264 transport_options: Optional[transport.TransportOptions] = None,
12265 ) -> mdls.CredentialsEmail:
12266 """Get Email/Password Credential"""
12267 user_id = self.encode_path_param(user_id)
12268 response = cast(
12269 mdls.CredentialsEmail,
12270 self.get(
12271 path=f"/users/{user_id}/credentials_email",
12272 structure=mdls.CredentialsEmail,
12273 query_params={"fields": fields},
12274 transport_options=transport_options,
12275 ),
12276 )
12277 return response
12278
12279 # ### Email/password login information for the specified user.
12280 #
12281 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12282 #
12283 # POST /users/{user_id}/credentials_email -> mdls.CredentialsEmail
12284 def create_user_credentials_email(
12285 self,
12286 # Id of user
12287 user_id: str,
12288 body: mdls.WriteCredentialsEmail,
12289 # Requested fields.
12290 fields: Optional[str] = None,
12291 transport_options: Optional[transport.TransportOptions] = None,
12292 ) -> mdls.CredentialsEmail:
12293 """Create Email/Password Credential"""
12294 user_id = self.encode_path_param(user_id)
12295 response = cast(
12296 mdls.CredentialsEmail,
12297 self.post(
12298 path=f"/users/{user_id}/credentials_email",
12299 structure=mdls.CredentialsEmail,
12300 query_params={"fields": fields},
12301 body=body,
12302 transport_options=transport_options,
12303 ),
12304 )
12305 return response
12306
12307 # ### Email/password login information for the specified user.
12308 #
12309 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12310 #
12311 # PATCH /users/{user_id}/credentials_email -> mdls.CredentialsEmail
12312 def update_user_credentials_email(
12313 self,
12314 # Id of user
12315 user_id: str,
12316 body: mdls.WriteCredentialsEmail,
12317 # Requested fields.
12318 fields: Optional[str] = None,
12319 transport_options: Optional[transport.TransportOptions] = None,
12320 ) -> mdls.CredentialsEmail:
12321 """Update Email/Password Credential"""
12322 user_id = self.encode_path_param(user_id)
12323 response = cast(
12324 mdls.CredentialsEmail,
12325 self.patch(
12326 path=f"/users/{user_id}/credentials_email",
12327 structure=mdls.CredentialsEmail,
12328 query_params={"fields": fields},
12329 body=body,
12330 transport_options=transport_options,
12331 ),
12332 )
12333 return response
12334
12335 # ### Email/password login information for the specified user.
12336 #
12337 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12338 #
12339 # DELETE /users/{user_id}/credentials_email -> str
12340 def delete_user_credentials_email(
12341 self,
12342 # Id of user
12343 user_id: str,
12344 transport_options: Optional[transport.TransportOptions] = None,
12345 ) -> str:
12346 """Delete Email/Password Credential"""
12347 user_id = self.encode_path_param(user_id)
12348 response = cast(
12349 str,
12350 self.delete(
12351 path=f"/users/{user_id}/credentials_email",
12352 structure=str,
12353 transport_options=transport_options,
12354 ),
12355 )
12356 return response
12357
12358 # ### Two-factor login information for the specified user.
12359 #
12360 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12361 #
12362 # GET /users/{user_id}/credentials_totp -> mdls.CredentialsTotp
12363 def user_credentials_totp(
12364 self,
12365 # Id of user
12366 user_id: str,
12367 # Requested fields.
12368 fields: Optional[str] = None,
12369 transport_options: Optional[transport.TransportOptions] = None,
12370 ) -> mdls.CredentialsTotp:
12371 """Get Two-Factor Credential"""
12372 user_id = self.encode_path_param(user_id)
12373 response = cast(
12374 mdls.CredentialsTotp,
12375 self.get(
12376 path=f"/users/{user_id}/credentials_totp",
12377 structure=mdls.CredentialsTotp,
12378 query_params={"fields": fields},
12379 transport_options=transport_options,
12380 ),
12381 )
12382 return response
12383
12384 # ### Two-factor login information for the specified user.
12385 #
12386 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12387 #
12388 # POST /users/{user_id}/credentials_totp -> mdls.CredentialsTotp
12389 def create_user_credentials_totp(
12390 self,
12391 # Id of user
12392 user_id: str,
12393 # WARNING: no writeable properties found for POST, PUT, or PATCH
12394 body: Optional[mdls.CredentialsTotp] = None,
12395 # Requested fields.
12396 fields: Optional[str] = None,
12397 transport_options: Optional[transport.TransportOptions] = None,
12398 ) -> mdls.CredentialsTotp:
12399 """Create Two-Factor Credential"""
12400 user_id = self.encode_path_param(user_id)
12401 response = cast(
12402 mdls.CredentialsTotp,
12403 self.post(
12404 path=f"/users/{user_id}/credentials_totp",
12405 structure=mdls.CredentialsTotp,
12406 query_params={"fields": fields},
12407 body=body,
12408 transport_options=transport_options,
12409 ),
12410 )
12411 return response
12412
12413 # ### Two-factor login information for the specified user.
12414 #
12415 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12416 #
12417 # DELETE /users/{user_id}/credentials_totp -> str
12418 def delete_user_credentials_totp(
12419 self,
12420 # Id of user
12421 user_id: str,
12422 transport_options: Optional[transport.TransportOptions] = None,
12423 ) -> str:
12424 """Delete Two-Factor Credential"""
12425 user_id = self.encode_path_param(user_id)
12426 response = cast(
12427 str,
12428 self.delete(
12429 path=f"/users/{user_id}/credentials_totp",
12430 structure=str,
12431 transport_options=transport_options,
12432 ),
12433 )
12434 return response
12435
12436 # ### LDAP login information for the specified user.
12437 #
12438 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12439 #
12440 # GET /users/{user_id}/credentials_ldap -> mdls.CredentialsLDAP
12441 def user_credentials_ldap(
12442 self,
12443 # Id of user
12444 user_id: str,
12445 # Requested fields.
12446 fields: Optional[str] = None,
12447 transport_options: Optional[transport.TransportOptions] = None,
12448 ) -> mdls.CredentialsLDAP:
12449 """Get LDAP Credential"""
12450 user_id = self.encode_path_param(user_id)
12451 response = cast(
12452 mdls.CredentialsLDAP,
12453 self.get(
12454 path=f"/users/{user_id}/credentials_ldap",
12455 structure=mdls.CredentialsLDAP,
12456 query_params={"fields": fields},
12457 transport_options=transport_options,
12458 ),
12459 )
12460 return response
12461
12462 # ### LDAP login information for the specified user.
12463 #
12464 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12465 #
12466 # DELETE /users/{user_id}/credentials_ldap -> str
12467 def delete_user_credentials_ldap(
12468 self,
12469 # Id of user
12470 user_id: str,
12471 transport_options: Optional[transport.TransportOptions] = None,
12472 ) -> str:
12473 """Delete LDAP Credential"""
12474 user_id = self.encode_path_param(user_id)
12475 response = cast(
12476 str,
12477 self.delete(
12478 path=f"/users/{user_id}/credentials_ldap",
12479 structure=str,
12480 transport_options=transport_options,
12481 ),
12482 )
12483 return response
12484
12485 # ### Google authentication login information for the specified user.
12486 #
12487 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12488 #
12489 # GET /users/{user_id}/credentials_google -> mdls.CredentialsGoogle
12490 def user_credentials_google(
12491 self,
12492 # Id of user
12493 user_id: str,
12494 # Requested fields.
12495 fields: Optional[str] = None,
12496 transport_options: Optional[transport.TransportOptions] = None,
12497 ) -> mdls.CredentialsGoogle:
12498 """Get Google Auth Credential"""
12499 user_id = self.encode_path_param(user_id)
12500 response = cast(
12501 mdls.CredentialsGoogle,
12502 self.get(
12503 path=f"/users/{user_id}/credentials_google",
12504 structure=mdls.CredentialsGoogle,
12505 query_params={"fields": fields},
12506 transport_options=transport_options,
12507 ),
12508 )
12509 return response
12510
12511 # ### Google authentication login information for the specified user.
12512 #
12513 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12514 #
12515 # DELETE /users/{user_id}/credentials_google -> str
12516 def delete_user_credentials_google(
12517 self,
12518 # Id of user
12519 user_id: str,
12520 transport_options: Optional[transport.TransportOptions] = None,
12521 ) -> str:
12522 """Delete Google Auth Credential"""
12523 user_id = self.encode_path_param(user_id)
12524 response = cast(
12525 str,
12526 self.delete(
12527 path=f"/users/{user_id}/credentials_google",
12528 structure=str,
12529 transport_options=transport_options,
12530 ),
12531 )
12532 return response
12533
12534 # ### Saml authentication login information for the specified user.
12535 #
12536 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12537 #
12538 # GET /users/{user_id}/credentials_saml -> mdls.CredentialsSaml
12539 def user_credentials_saml(
12540 self,
12541 # Id of user
12542 user_id: str,
12543 # Requested fields.
12544 fields: Optional[str] = None,
12545 transport_options: Optional[transport.TransportOptions] = None,
12546 ) -> mdls.CredentialsSaml:
12547 """Get Saml Auth Credential"""
12548 user_id = self.encode_path_param(user_id)
12549 response = cast(
12550 mdls.CredentialsSaml,
12551 self.get(
12552 path=f"/users/{user_id}/credentials_saml",
12553 structure=mdls.CredentialsSaml,
12554 query_params={"fields": fields},
12555 transport_options=transport_options,
12556 ),
12557 )
12558 return response
12559
12560 # ### Saml authentication login information for the specified user.
12561 #
12562 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12563 #
12564 # DELETE /users/{user_id}/credentials_saml -> str
12565 def delete_user_credentials_saml(
12566 self,
12567 # Id of user
12568 user_id: str,
12569 transport_options: Optional[transport.TransportOptions] = None,
12570 ) -> str:
12571 """Delete Saml Auth Credential"""
12572 user_id = self.encode_path_param(user_id)
12573 response = cast(
12574 str,
12575 self.delete(
12576 path=f"/users/{user_id}/credentials_saml",
12577 structure=str,
12578 transport_options=transport_options,
12579 ),
12580 )
12581 return response
12582
12583 # ### OpenID Connect (OIDC) authentication login information for the specified user.
12584 #
12585 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12586 #
12587 # GET /users/{user_id}/credentials_oidc -> mdls.CredentialsOIDC
12588 def user_credentials_oidc(
12589 self,
12590 # Id of user
12591 user_id: str,
12592 # Requested fields.
12593 fields: Optional[str] = None,
12594 transport_options: Optional[transport.TransportOptions] = None,
12595 ) -> mdls.CredentialsOIDC:
12596 """Get OIDC Auth Credential"""
12597 user_id = self.encode_path_param(user_id)
12598 response = cast(
12599 mdls.CredentialsOIDC,
12600 self.get(
12601 path=f"/users/{user_id}/credentials_oidc",
12602 structure=mdls.CredentialsOIDC,
12603 query_params={"fields": fields},
12604 transport_options=transport_options,
12605 ),
12606 )
12607 return response
12608
12609 # ### OpenID Connect (OIDC) authentication login information for the specified user.
12610 #
12611 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12612 #
12613 # DELETE /users/{user_id}/credentials_oidc -> str
12614 def delete_user_credentials_oidc(
12615 self,
12616 # Id of user
12617 user_id: str,
12618 transport_options: Optional[transport.TransportOptions] = None,
12619 ) -> str:
12620 """Delete OIDC Auth Credential"""
12621 user_id = self.encode_path_param(user_id)
12622 response = cast(
12623 str,
12624 self.delete(
12625 path=f"/users/{user_id}/credentials_oidc",
12626 structure=str,
12627 transport_options=transport_options,
12628 ),
12629 )
12630 return response
12631
12632 # ### API login information for the specified user. This is for the newer API keys that can be added for any user.
12633 #
12634 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12635 #
12636 # GET /users/{user_id}/credentials_api3/{credentials_api3_id} -> mdls.CredentialsApi3
12637 def user_credentials_api3(
12638 self,
12639 # Id of user
12640 user_id: str,
12641 # Id of API Credential
12642 credentials_api3_id: str,
12643 # Requested fields.
12644 fields: Optional[str] = None,
12645 transport_options: Optional[transport.TransportOptions] = None,
12646 ) -> mdls.CredentialsApi3:
12647 """Get API Credential"""
12648 user_id = self.encode_path_param(user_id)
12649 credentials_api3_id = self.encode_path_param(credentials_api3_id)
12650 response = cast(
12651 mdls.CredentialsApi3,
12652 self.get(
12653 path=f"/users/{user_id}/credentials_api3/{credentials_api3_id}",
12654 structure=mdls.CredentialsApi3,
12655 query_params={"fields": fields},
12656 transport_options=transport_options,
12657 ),
12658 )
12659 return response
12660
12661 # ### API login information for the specified user. This is for the newer API keys that can be added for any user.
12662 #
12663 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12664 #
12665 # DELETE /users/{user_id}/credentials_api3/{credentials_api3_id} -> str
12666 def delete_user_credentials_api3(
12667 self,
12668 # Id of user
12669 user_id: str,
12670 # Id of API Credential
12671 credentials_api3_id: str,
12672 transport_options: Optional[transport.TransportOptions] = None,
12673 ) -> str:
12674 """Delete API Credential"""
12675 user_id = self.encode_path_param(user_id)
12676 credentials_api3_id = self.encode_path_param(credentials_api3_id)
12677 response = cast(
12678 str,
12679 self.delete(
12680 path=f"/users/{user_id}/credentials_api3/{credentials_api3_id}",
12681 structure=str,
12682 transport_options=transport_options,
12683 ),
12684 )
12685 return response
12686
12687 # ### API login information for the specified user. This is for the newer API keys that can be added for any user.
12688 #
12689 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12690 #
12691 # GET /users/{user_id}/credentials_api3 -> Sequence[mdls.CredentialsApi3]
12692 def all_user_credentials_api3s(
12693 self,
12694 # Id of user
12695 user_id: str,
12696 # Requested fields.
12697 fields: Optional[str] = None,
12698 transport_options: Optional[transport.TransportOptions] = None,
12699 ) -> Sequence[mdls.CredentialsApi3]:
12700 """Get All API Credentials"""
12701 user_id = self.encode_path_param(user_id)
12702 response = cast(
12703 Sequence[mdls.CredentialsApi3],
12704 self.get(
12705 path=f"/users/{user_id}/credentials_api3",
12706 structure=Sequence[mdls.CredentialsApi3],
12707 query_params={"fields": fields},
12708 transport_options=transport_options,
12709 ),
12710 )
12711 return response
12712
12713 # ### API login information for the specified user. This is for the newer API keys that can be added for any user.
12714 #
12715 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12716 #
12717 # POST /users/{user_id}/credentials_api3 -> mdls.CreateCredentialsApi3
12718 def create_user_credentials_api3(
12719 self,
12720 # Id of user
12721 user_id: str,
12722 # Requested fields.
12723 fields: Optional[str] = None,
12724 transport_options: Optional[transport.TransportOptions] = None,
12725 ) -> mdls.CreateCredentialsApi3:
12726 """Create API Credential"""
12727 user_id = self.encode_path_param(user_id)
12728 response = cast(
12729 mdls.CreateCredentialsApi3,
12730 self.post(
12731 path=f"/users/{user_id}/credentials_api3",
12732 structure=mdls.CreateCredentialsApi3,
12733 query_params={"fields": fields},
12734 transport_options=transport_options,
12735 ),
12736 )
12737 return response
12738
12739 # ### Embed login information for the specified user.
12740 #
12741 # **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.
12742 #
12743 # GET /users/{user_id}/credentials_embed/{credentials_embed_id} -> mdls.CredentialsEmbed
12744 def user_credentials_embed(
12745 self,
12746 # Id of user
12747 user_id: str,
12748 # Id of Embedding Credential
12749 credentials_embed_id: str,
12750 # Requested fields.
12751 fields: Optional[str] = None,
12752 transport_options: Optional[transport.TransportOptions] = None,
12753 ) -> mdls.CredentialsEmbed:
12754 """Get Embedding Credential"""
12755 user_id = self.encode_path_param(user_id)
12756 credentials_embed_id = self.encode_path_param(credentials_embed_id)
12757 response = cast(
12758 mdls.CredentialsEmbed,
12759 self.get(
12760 path=f"/users/{user_id}/credentials_embed/{credentials_embed_id}",
12761 structure=mdls.CredentialsEmbed,
12762 query_params={"fields": fields},
12763 transport_options=transport_options,
12764 ),
12765 )
12766 return response
12767
12768 # ### Embed login information for the specified user.
12769 #
12770 # **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.
12771 #
12772 # DELETE /users/{user_id}/credentials_embed/{credentials_embed_id} -> str
12773 def delete_user_credentials_embed(
12774 self,
12775 # Id of user
12776 user_id: str,
12777 # Id of Embedding Credential
12778 credentials_embed_id: str,
12779 transport_options: Optional[transport.TransportOptions] = None,
12780 ) -> str:
12781 """Delete Embedding Credential"""
12782 user_id = self.encode_path_param(user_id)
12783 credentials_embed_id = self.encode_path_param(credentials_embed_id)
12784 response = cast(
12785 str,
12786 self.delete(
12787 path=f"/users/{user_id}/credentials_embed/{credentials_embed_id}",
12788 structure=str,
12789 transport_options=transport_options,
12790 ),
12791 )
12792 return response
12793
12794 # ### Embed login information for the specified user.
12795 #
12796 # **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.
12797 #
12798 # GET /users/{user_id}/credentials_embed -> Sequence[mdls.CredentialsEmbed]
12799 def all_user_credentials_embeds(
12800 self,
12801 # Id of user
12802 user_id: str,
12803 # Requested fields.
12804 fields: Optional[str] = None,
12805 transport_options: Optional[transport.TransportOptions] = None,
12806 ) -> Sequence[mdls.CredentialsEmbed]:
12807 """Get All Embedding Credentials"""
12808 user_id = self.encode_path_param(user_id)
12809 response = cast(
12810 Sequence[mdls.CredentialsEmbed],
12811 self.get(
12812 path=f"/users/{user_id}/credentials_embed",
12813 structure=Sequence[mdls.CredentialsEmbed],
12814 query_params={"fields": fields},
12815 transport_options=transport_options,
12816 ),
12817 )
12818 return response
12819
12820 # ### Looker Openid login information for the specified user. Used by Looker Analysts.
12821 #
12822 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12823 #
12824 # GET /users/{user_id}/credentials_looker_openid -> mdls.CredentialsLookerOpenid
12825 def user_credentials_looker_openid(
12826 self,
12827 # Id of user
12828 user_id: str,
12829 # Requested fields.
12830 fields: Optional[str] = None,
12831 transport_options: Optional[transport.TransportOptions] = None,
12832 ) -> mdls.CredentialsLookerOpenid:
12833 """Get Looker OpenId Credential"""
12834 user_id = self.encode_path_param(user_id)
12835 response = cast(
12836 mdls.CredentialsLookerOpenid,
12837 self.get(
12838 path=f"/users/{user_id}/credentials_looker_openid",
12839 structure=mdls.CredentialsLookerOpenid,
12840 query_params={"fields": fields},
12841 transport_options=transport_options,
12842 ),
12843 )
12844 return response
12845
12846 # ### Looker Openid login information for the specified user. Used by Looker Analysts.
12847 #
12848 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12849 #
12850 # DELETE /users/{user_id}/credentials_looker_openid -> str
12851 def delete_user_credentials_looker_openid(
12852 self,
12853 # Id of user
12854 user_id: str,
12855 transport_options: Optional[transport.TransportOptions] = None,
12856 ) -> str:
12857 """Delete Looker OpenId Credential"""
12858 user_id = self.encode_path_param(user_id)
12859 response = cast(
12860 str,
12861 self.delete(
12862 path=f"/users/{user_id}/credentials_looker_openid",
12863 structure=str,
12864 transport_options=transport_options,
12865 ),
12866 )
12867 return response
12868
12869 # ### Web login session for the specified user.
12870 #
12871 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12872 #
12873 # GET /users/{user_id}/sessions/{session_id} -> mdls.Session
12874 def user_session(
12875 self,
12876 # Id of user
12877 user_id: str,
12878 # Id of Web Login Session
12879 session_id: str,
12880 # Requested fields.
12881 fields: Optional[str] = None,
12882 transport_options: Optional[transport.TransportOptions] = None,
12883 ) -> mdls.Session:
12884 """Get Web Login Session"""
12885 user_id = self.encode_path_param(user_id)
12886 session_id = self.encode_path_param(session_id)
12887 response = cast(
12888 mdls.Session,
12889 self.get(
12890 path=f"/users/{user_id}/sessions/{session_id}",
12891 structure=mdls.Session,
12892 query_params={"fields": fields},
12893 transport_options=transport_options,
12894 ),
12895 )
12896 return response
12897
12898 # ### Web login session for the specified user.
12899 #
12900 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12901 #
12902 # DELETE /users/{user_id}/sessions/{session_id} -> str
12903 def delete_user_session(
12904 self,
12905 # Id of user
12906 user_id: str,
12907 # Id of Web Login Session
12908 session_id: str,
12909 transport_options: Optional[transport.TransportOptions] = None,
12910 ) -> str:
12911 """Delete Web Login Session"""
12912 user_id = self.encode_path_param(user_id)
12913 session_id = self.encode_path_param(session_id)
12914 response = cast(
12915 str,
12916 self.delete(
12917 path=f"/users/{user_id}/sessions/{session_id}",
12918 structure=str,
12919 transport_options=transport_options,
12920 ),
12921 )
12922 return response
12923
12924 # ### Web login session for the specified user.
12925 #
12926 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12927 #
12928 # GET /users/{user_id}/sessions -> Sequence[mdls.Session]
12929 def all_user_sessions(
12930 self,
12931 # Id of user
12932 user_id: str,
12933 # Requested fields.
12934 fields: Optional[str] = None,
12935 transport_options: Optional[transport.TransportOptions] = None,
12936 ) -> Sequence[mdls.Session]:
12937 """Get All Web Login Sessions"""
12938 user_id = self.encode_path_param(user_id)
12939 response = cast(
12940 Sequence[mdls.Session],
12941 self.get(
12942 path=f"/users/{user_id}/sessions",
12943 structure=Sequence[mdls.Session],
12944 query_params={"fields": fields},
12945 transport_options=transport_options,
12946 ),
12947 )
12948 return response
12949
12950 # ### Create a password reset token.
12951 # This will create a cryptographically secure random password reset token for the user.
12952 # If the user already has a password reset token then this invalidates the old token and creates a new one.
12953 # The token is expressed as the 'password_reset_url' of the user's email/password credential object.
12954 # This takes an optional 'expires' param to indicate if the new token should be an expiring token.
12955 # Tokens that expire are typically used for self-service password resets for existing users.
12956 # Invitation emails for new users typically are not set to expire.
12957 # The expire period is always 60 minutes when expires is enabled.
12958 # This method can be called with an empty body.
12959 #
12960 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
12961 #
12962 # POST /users/{user_id}/credentials_email/password_reset -> mdls.CredentialsEmail
12963 def create_user_credentials_email_password_reset(
12964 self,
12965 # Id of user
12966 user_id: str,
12967 # Expiring token.
12968 expires: Optional[bool] = None,
12969 # Requested fields.
12970 fields: Optional[str] = None,
12971 transport_options: Optional[transport.TransportOptions] = None,
12972 ) -> mdls.CredentialsEmail:
12973 """Create Password Reset Token"""
12974 user_id = self.encode_path_param(user_id)
12975 response = cast(
12976 mdls.CredentialsEmail,
12977 self.post(
12978 path=f"/users/{user_id}/credentials_email/password_reset",
12979 structure=mdls.CredentialsEmail,
12980 query_params={"expires": expires, "fields": fields},
12981 transport_options=transport_options,
12982 ),
12983 )
12984 return response
12985
12986 # ### Get information about roles of a given user
12987 #
12988 # GET /users/{user_id}/roles -> Sequence[mdls.Role]
12989 def user_roles(
12990 self,
12991 # Id of user
12992 user_id: str,
12993 # Requested fields.
12994 fields: Optional[str] = None,
12995 # Get only roles associated directly with the user: exclude those only associated through groups.
12996 direct_association_only: Optional[bool] = None,
12997 transport_options: Optional[transport.TransportOptions] = None,
12998 ) -> Sequence[mdls.Role]:
12999 """Get User Roles"""
13000 user_id = self.encode_path_param(user_id)
13001 response = cast(
13002 Sequence[mdls.Role],
13003 self.get(
13004 path=f"/users/{user_id}/roles",
13005 structure=Sequence[mdls.Role],
13006 query_params={
13007 "fields": fields,
13008 "direct_association_only": direct_association_only,
13009 },
13010 transport_options=transport_options,
13011 ),
13012 )
13013 return response
13014
13015 # ### Set roles of the user with a specific id.
13016 #
13017 # PUT /users/{user_id}/roles -> Sequence[mdls.Role]
13018 def set_user_roles(
13019 self,
13020 # Id of user
13021 user_id: str,
13022 body: Sequence[str],
13023 # Requested fields.
13024 fields: Optional[str] = None,
13025 transport_options: Optional[transport.TransportOptions] = None,
13026 ) -> Sequence[mdls.Role]:
13027 """Set User Roles"""
13028 user_id = self.encode_path_param(user_id)
13029 response = cast(
13030 Sequence[mdls.Role],
13031 self.put(
13032 path=f"/users/{user_id}/roles",
13033 structure=Sequence[mdls.Role],
13034 query_params={"fields": fields},
13035 body=body,
13036 transport_options=transport_options,
13037 ),
13038 )
13039 return response
13040
13041 # ### Get user attribute values for a given user.
13042 #
13043 # Returns the values of specified user attributes (or all user attributes) for a certain user.
13044 #
13045 # A value for each user attribute is searched for in the following locations, in this order:
13046 #
13047 # 1. in the user's account information
13048 # 1. in groups that the user is a member of
13049 # 1. the default value of the user attribute
13050 #
13051 # If more than one group has a value defined for a user attribute, the group with the lowest rank wins.
13052 #
13053 # The response will only include user attributes for which values were found. Use `include_unset=true` to include
13054 # empty records for user attributes with no value.
13055 #
13056 # The value of all hidden user attributes will be blank.
13057 #
13058 # GET /users/{user_id}/attribute_values -> Sequence[mdls.UserAttributeWithValue]
13059 def user_attribute_user_values(
13060 self,
13061 # Id of user
13062 user_id: str,
13063 # Requested fields.
13064 fields: Optional[str] = None,
13065 # Specific user attributes to request. Omit or leave blank to request all user attributes.
13066 user_attribute_ids: Optional[mdls.DelimSequence[str]] = None,
13067 # If true, returns all values in the search path instead of just the first value found. Useful for debugging group precedence.
13068 all_values: Optional[bool] = None,
13069 # If true, returns an empty record for each requested attribute that has no user, group, or default value.
13070 include_unset: Optional[bool] = None,
13071 transport_options: Optional[transport.TransportOptions] = None,
13072 ) -> Sequence[mdls.UserAttributeWithValue]:
13073 """Get User Attribute Values"""
13074 user_id = self.encode_path_param(user_id)
13075 response = cast(
13076 Sequence[mdls.UserAttributeWithValue],
13077 self.get(
13078 path=f"/users/{user_id}/attribute_values",
13079 structure=Sequence[mdls.UserAttributeWithValue],
13080 query_params={
13081 "fields": fields,
13082 "user_attribute_ids": user_attribute_ids,
13083 "all_values": all_values,
13084 "include_unset": include_unset,
13085 },
13086 transport_options=transport_options,
13087 ),
13088 )
13089 return response
13090
13091 # ### Store a custom value for a user attribute in a user's account settings.
13092 #
13093 # Per-user user attribute values take precedence over group or default values.
13094 #
13095 # PATCH /users/{user_id}/attribute_values/{user_attribute_id} -> mdls.UserAttributeWithValue
13096 def set_user_attribute_user_value(
13097 self,
13098 # Id of user
13099 user_id: str,
13100 # Id of user attribute
13101 user_attribute_id: str,
13102 body: mdls.WriteUserAttributeWithValue,
13103 transport_options: Optional[transport.TransportOptions] = None,
13104 ) -> mdls.UserAttributeWithValue:
13105 """Set User Attribute User Value"""
13106 user_id = self.encode_path_param(user_id)
13107 user_attribute_id = self.encode_path_param(user_attribute_id)
13108 response = cast(
13109 mdls.UserAttributeWithValue,
13110 self.patch(
13111 path=f"/users/{user_id}/attribute_values/{user_attribute_id}",
13112 structure=mdls.UserAttributeWithValue,
13113 body=body,
13114 transport_options=transport_options,
13115 ),
13116 )
13117 return response
13118
13119 # ### Delete a user attribute value from a user's account settings.
13120 #
13121 # After the user attribute value is deleted from the user's account settings, subsequent requests
13122 # for the user attribute value for this user will draw from the user's groups or the default
13123 # value of the user attribute. See [Get User Attribute Values](#!/User/user_attribute_user_values) for more
13124 # information about how user attribute values are resolved.
13125 #
13126 # DELETE /users/{user_id}/attribute_values/{user_attribute_id} -> None
13127 def delete_user_attribute_user_value(
13128 self,
13129 # Id of user
13130 user_id: str,
13131 # Id of user attribute
13132 user_attribute_id: str,
13133 transport_options: Optional[transport.TransportOptions] = None,
13134 ) -> None:
13135 """Delete User Attribute User Value"""
13136 user_id = self.encode_path_param(user_id)
13137 user_attribute_id = self.encode_path_param(user_attribute_id)
13138 response = cast(
13139 None,
13140 self.delete(
13141 path=f"/users/{user_id}/attribute_values/{user_attribute_id}",
13142 structure=None,
13143 transport_options=transport_options,
13144 ),
13145 )
13146 return response
13147
13148 # ### Send a password reset token.
13149 # This will send a password reset email to the user. If a password reset token does not already exist
13150 # for this user, it will create one and then send it.
13151 # If the user has not yet set up their account, it will send a setup email to the user.
13152 # The URL sent in the email is expressed as the 'password_reset_url' of the user's email/password credential object.
13153 # Password reset URLs will expire in 60 minutes.
13154 # This method can be called with an empty body.
13155 #
13156 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
13157 #
13158 # POST /users/{user_id}/credentials_email/send_password_reset -> mdls.CredentialsEmail
13159 def send_user_credentials_email_password_reset(
13160 self,
13161 # Id of user
13162 user_id: str,
13163 # Requested fields.
13164 fields: Optional[str] = None,
13165 transport_options: Optional[transport.TransportOptions] = None,
13166 ) -> mdls.CredentialsEmail:
13167 """Send Password Reset Token"""
13168 user_id = self.encode_path_param(user_id)
13169 response = cast(
13170 mdls.CredentialsEmail,
13171 self.post(
13172 path=f"/users/{user_id}/credentials_email/send_password_reset",
13173 structure=mdls.CredentialsEmail,
13174 query_params={"fields": fields},
13175 transport_options=transport_options,
13176 ),
13177 )
13178 return response
13179
13180 # ### Change a disabled user's email addresses
13181 #
13182 # Allows the admin to change the email addresses for all the user's
13183 # associated credentials. Will overwrite all associated email addresses with
13184 # the value supplied in the 'email' body param.
13185 # The user's 'is_disabled' status must be true.
13186 # If the user has a credential email, they will receive a verification email and the user will be disabled until they verify the email
13187 #
13188 # Calls to this endpoint may be denied by [Looker (Google Cloud core)](https://cloud.google.com/looker/docs/r/looker-core/overview).
13189 #
13190 # POST /users/{user_id}/update_emails -> mdls.User
13191 def wipeout_user_emails(
13192 self,
13193 # Id of user
13194 user_id: str,
13195 body: mdls.UserEmailOnly,
13196 # Requested fields.
13197 fields: Optional[str] = None,
13198 transport_options: Optional[transport.TransportOptions] = None,
13199 ) -> mdls.User:
13200 """Wipeout User Emails"""
13201 user_id = self.encode_path_param(user_id)
13202 response = cast(
13203 mdls.User,
13204 self.post(
13205 path=f"/users/{user_id}/update_emails",
13206 structure=mdls.User,
13207 query_params={"fields": fields},
13208 body=body,
13209 transport_options=transport_options,
13210 ),
13211 )
13212 return response
13213
13214 # Create an embed user from an external user ID
13215 #
13216 # **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.
13217 #
13218 # POST /users/embed_user -> mdls.UserPublic
13219 def create_embed_user(
13220 self,
13221 body: mdls.CreateEmbedUserRequest,
13222 transport_options: Optional[transport.TransportOptions] = None,
13223 ) -> mdls.UserPublic:
13224 """Create an embed user from an external user ID"""
13225 response = cast(
13226 mdls.UserPublic,
13227 self.post(
13228 path="/users/embed_user",
13229 structure=mdls.UserPublic,
13230 body=body,
13231 transport_options=transport_options,
13232 ),
13233 )
13234 return response
13235
13236 # endregion
13237
13238 # region UserAttribute: Manage User Attributes
13239
13240 # ### Get information about all user attributes.
13241 #
13242 # GET /user_attributes -> Sequence[mdls.UserAttribute]
13243 def all_user_attributes(
13244 self,
13245 # Requested fields.
13246 fields: Optional[str] = None,
13247 # Fields to order the results by. Sortable fields include: name, label
13248 sorts: Optional[str] = None,
13249 transport_options: Optional[transport.TransportOptions] = None,
13250 ) -> Sequence[mdls.UserAttribute]:
13251 """Get All User Attributes"""
13252 response = cast(
13253 Sequence[mdls.UserAttribute],
13254 self.get(
13255 path="/user_attributes",
13256 structure=Sequence[mdls.UserAttribute],
13257 query_params={"fields": fields, "sorts": sorts},
13258 transport_options=transport_options,
13259 ),
13260 )
13261 return response
13262
13263 # ### Create a new user attribute
13264 #
13265 # Permission information for a user attribute is conveyed through the `can` and `user_can_edit` fields.
13266 # The `user_can_edit` field indicates whether an attribute is user-editable _anywhere_ in the application.
13267 # The `can` field gives more granular access information, with the `set_value` child field indicating whether
13268 # an attribute's value can be set by [Setting the User Attribute User Value](#!/User/set_user_attribute_user_value).
13269 #
13270 # Note: `name` and `label` fields must be unique across all user attributes in the Looker instance.
13271 # Attempting to create a new user attribute with a name or label that duplicates an existing
13272 # user attribute will fail with a 422 error.
13273 #
13274 # POST /user_attributes -> mdls.UserAttribute
13275 def create_user_attribute(
13276 self,
13277 body: mdls.WriteUserAttribute,
13278 # Requested fields.
13279 fields: Optional[str] = None,
13280 transport_options: Optional[transport.TransportOptions] = None,
13281 ) -> mdls.UserAttribute:
13282 """Create User Attribute"""
13283 response = cast(
13284 mdls.UserAttribute,
13285 self.post(
13286 path="/user_attributes",
13287 structure=mdls.UserAttribute,
13288 query_params={"fields": fields},
13289 body=body,
13290 transport_options=transport_options,
13291 ),
13292 )
13293 return response
13294
13295 # ### Get information about a user attribute.
13296 #
13297 # GET /user_attributes/{user_attribute_id} -> mdls.UserAttribute
13298 def user_attribute(
13299 self,
13300 # Id of user attribute
13301 user_attribute_id: str,
13302 # Requested fields.
13303 fields: Optional[str] = None,
13304 transport_options: Optional[transport.TransportOptions] = None,
13305 ) -> mdls.UserAttribute:
13306 """Get User Attribute"""
13307 user_attribute_id = self.encode_path_param(user_attribute_id)
13308 response = cast(
13309 mdls.UserAttribute,
13310 self.get(
13311 path=f"/user_attributes/{user_attribute_id}",
13312 structure=mdls.UserAttribute,
13313 query_params={"fields": fields},
13314 transport_options=transport_options,
13315 ),
13316 )
13317 return response
13318
13319 # ### Update a user attribute definition.
13320 #
13321 # PATCH /user_attributes/{user_attribute_id} -> mdls.UserAttribute
13322 def update_user_attribute(
13323 self,
13324 # Id of user attribute
13325 user_attribute_id: str,
13326 body: mdls.WriteUserAttribute,
13327 # Requested fields.
13328 fields: Optional[str] = None,
13329 transport_options: Optional[transport.TransportOptions] = None,
13330 ) -> mdls.UserAttribute:
13331 """Update User Attribute"""
13332 user_attribute_id = self.encode_path_param(user_attribute_id)
13333 response = cast(
13334 mdls.UserAttribute,
13335 self.patch(
13336 path=f"/user_attributes/{user_attribute_id}",
13337 structure=mdls.UserAttribute,
13338 query_params={"fields": fields},
13339 body=body,
13340 transport_options=transport_options,
13341 ),
13342 )
13343 return response
13344
13345 # ### Delete a user attribute (admin only).
13346 #
13347 # DELETE /user_attributes/{user_attribute_id} -> str
13348 def delete_user_attribute(
13349 self,
13350 # Id of user attribute
13351 user_attribute_id: str,
13352 transport_options: Optional[transport.TransportOptions] = None,
13353 ) -> str:
13354 """Delete User Attribute"""
13355 user_attribute_id = self.encode_path_param(user_attribute_id)
13356 response = cast(
13357 str,
13358 self.delete(
13359 path=f"/user_attributes/{user_attribute_id}",
13360 structure=str,
13361 transport_options=transport_options,
13362 ),
13363 )
13364 return response
13365
13366 # ### Returns all values of a user attribute defined by user groups, in precedence order.
13367 #
13368 # A user may be a member of multiple groups which define different values for a given user attribute.
13369 # The order of group-values in the response determines precedence for selecting which group-value applies
13370 # to a given user. For more information, see [Set User Attribute Group Values](#!/UserAttribute/set_user_attribute_group_values).
13371 #
13372 # Results will only include groups that the caller's user account has permission to see.
13373 #
13374 # GET /user_attributes/{user_attribute_id}/group_values -> Sequence[mdls.UserAttributeGroupValue]
13375 def all_user_attribute_group_values(
13376 self,
13377 # Id of user attribute
13378 user_attribute_id: str,
13379 # Requested fields.
13380 fields: Optional[str] = None,
13381 transport_options: Optional[transport.TransportOptions] = None,
13382 ) -> Sequence[mdls.UserAttributeGroupValue]:
13383 """Get User Attribute Group Values"""
13384 user_attribute_id = self.encode_path_param(user_attribute_id)
13385 response = cast(
13386 Sequence[mdls.UserAttributeGroupValue],
13387 self.get(
13388 path=f"/user_attributes/{user_attribute_id}/group_values",
13389 structure=Sequence[mdls.UserAttributeGroupValue],
13390 query_params={"fields": fields},
13391 transport_options=transport_options,
13392 ),
13393 )
13394 return response
13395
13396 # ### Define values for a user attribute across a set of groups, in priority order.
13397 #
13398 # This function defines all values for a user attribute defined by user groups. This is a global setting, potentially affecting
13399 # all users in the system. This function replaces any existing group value definitions for the indicated user attribute.
13400 #
13401 # The value of a user attribute for a given user is determined by searching the following locations, in this order:
13402 #
13403 # 1. the user's account settings
13404 # 2. the groups that the user is a member of
13405 # 3. the default value of the user attribute, if any
13406 #
13407 # 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
13408 # determines which group takes priority for that user. Lowest array index wins.
13409 #
13410 # An alternate method to indicate the selection precedence of group-values is to assign numbers to the 'rank' property of each
13411 # group-value object in the array. Lowest 'rank' value wins. If you use this technique, you must assign a
13412 # rank value to every group-value object in the array.
13413 #
13414 # To set a user attribute value for a single user, see [Set User Attribute User Value](#!/User/set_user_attribute_user_value).
13415 # To set a user attribute value for all members of a group, see [Set User Attribute Group Value](#!/Group/update_user_attribute_group_value).
13416 #
13417 # POST /user_attributes/{user_attribute_id}/group_values -> Sequence[mdls.UserAttributeGroupValue]
13418 def set_user_attribute_group_values(
13419 self,
13420 # Id of user attribute
13421 user_attribute_id: str,
13422 body: Sequence[mdls.UserAttributeGroupValue],
13423 transport_options: Optional[transport.TransportOptions] = None,
13424 ) -> Sequence[mdls.UserAttributeGroupValue]:
13425 """Set User Attribute Group Values"""
13426 user_attribute_id = self.encode_path_param(user_attribute_id)
13427 response = cast(
13428 Sequence[mdls.UserAttributeGroupValue],
13429 self.post(
13430 path=f"/user_attributes/{user_attribute_id}/group_values",
13431 structure=Sequence[mdls.UserAttributeGroupValue],
13432 body=body,
13433 transport_options=transport_options,
13434 ),
13435 )
13436 return response
13437
13438 # endregion
13439
13440 # region Workspace: Manage Workspaces
13441
13442 # ### Get All Workspaces
13443 #
13444 # Returns all workspaces available to the calling user.
13445 #
13446 # GET /workspaces -> Sequence[mdls.Workspace]
13447 def all_workspaces(
13448 self,
13449 transport_options: Optional[transport.TransportOptions] = None,
13450 ) -> Sequence[mdls.Workspace]:
13451 """Get All Workspaces"""
13452 response = cast(
13453 Sequence[mdls.Workspace],
13454 self.get(
13455 path="/workspaces",
13456 structure=Sequence[mdls.Workspace],
13457 transport_options=transport_options,
13458 ),
13459 )
13460 return response
13461
13462 # ### Get A Workspace
13463 #
13464 # Returns information about a workspace such as the git status and selected branches
13465 # of all projects available to the caller's user account.
13466 #
13467 # A workspace defines which versions of project files will be used to evaluate expressions
13468 # and operations that use model definitions - operations such as running queries or rendering dashboards.
13469 # Each project has its own git repository, and each project in a workspace may be configured to reference
13470 # particular branch or revision within their respective repositories.
13471 #
13472 # There are two predefined workspaces available: "production" and "dev".
13473 #
13474 # The production workspace is shared across all Looker users. Models in the production workspace are read-only.
13475 # Changing files in production is accomplished by modifying files in a git branch and using Pull Requests
13476 # to merge the changes from the dev branch into the production branch, and then telling
13477 # Looker to sync with production.
13478 #
13479 # The dev workspace is local to each Looker user. Changes made to project/model files in the dev workspace only affect
13480 # that user, and only when the dev workspace is selected as the active workspace for the API session.
13481 # (See set_session_workspace()).
13482 #
13483 # The dev workspace is NOT unique to an API session. Two applications accessing the Looker API using
13484 # the same user account will see the same files in the dev workspace. To avoid collisions between
13485 # API clients it's best to have each client login with API credentials for a different user account.
13486 #
13487 # Changes made to files in a dev workspace are persistent across API sessions. It's a good
13488 # idea to commit any changes you've made to the git repository, but not strictly required. Your modified files
13489 # reside in a special user-specific directory on the Looker server and will still be there when you login in again
13490 # later and use update_session(workspace_id: "dev") to select the dev workspace for the new API session.
13491 #
13492 # GET /workspaces/{workspace_id} -> mdls.Workspace
13493 def workspace(
13494 self,
13495 # Id of the workspace
13496 workspace_id: str,
13497 transport_options: Optional[transport.TransportOptions] = None,
13498 ) -> mdls.Workspace:
13499 """Get Workspace"""
13500 workspace_id = self.encode_path_param(workspace_id)
13501 response = cast(
13502 mdls.Workspace,
13503 self.get(
13504 path=f"/workspaces/{workspace_id}",
13505 structure=mdls.Workspace,
13506 transport_options=transport_options,
13507 ),
13508 )
13509 return response
13510
13511 # endregion
13512
13513
13514LookerSDK = Looker40SDK