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