account_credential
account_credential ¶
DomoAccountCredential
dataclass
¶
DomoAccountCredential(
auth: DomoAuth,
id: int,
raw: dict,
name: str = None,
display_name: str = None,
data_provider_type: str = None,
created_dt: datetime = None,
modified_dt: datetime = None,
owners: list[Any] = None,
is_admin_summary: bool = True,
dataset_count: int = None,
Config: DomoAccount_Config = None,
target_auth: DomoAuth = None,
target_user: DomoUser = None,
target_access_token: DomoAccessToken = None,
target_instance: str = None,
is_valid_full_auth: bool = None,
is_valid_token_auth: bool = None,
_token_auth: DomoAuth = None,
_full_auth: DomoAuth = None,
)
Bases: DomoAccount_Default
Account credential management class for Domo accounts.
This class extends DomoAccount_Default to provide credential management capabilities including authentication testing, password management, and access token operations.
Attributes:
| Name | Type | Description |
|---|---|---|
target_instance |
str
|
Target Domo instance for credential operations |
is_valid_full_auth |
bool
|
Whether full authentication is valid |
is_valid_token_auth |
bool
|
Whether token authentication is valid |
target_auth |
DomoAuth
|
Active authentication object for target instance |
target_user |
DomoUser
|
DomoUser object for the target user |
target_access_token |
DomoAccessToken
|
Access token for the account |
from_dict
classmethod
¶
from_dict(
obj: dict[str, Any],
is_admin_summary: bool = True,
auth: DomoAuth | None = None,
is_use_default_account_class: bool = False,
**kwargs
)
Create Account_Credential from dictionary representation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
dict[str, Any]
|
Dictionary containing account data |
required |
is_admin_summary
|
bool
|
Whether this is an admin summary view |
True
|
auth
|
DomoAuth | None
|
Authentication object |
None
|
**kwargs
|
Additional keyword arguments including target_instance |
{}
|
Returns:
| Type | Description |
|---|---|
|
DomoAccount_Credential instance |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
get_target_access_token
async
¶
get_target_access_token(
token_name: str | None = None,
user_email: str | None = None,
target_auth: DomoAuth | None = None,
debug_api: bool = False,
session: AsyncClient | None = None,
*,
context: RouteContext | None = None,
**context_kwargs
) -> DomoAccessToken
Retrieve an access token for the target user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token_name
|
str | None
|
Name of the access token (defaults to account name) |
None
|
user_email
|
str | None
|
Email address of user (defaults to configured username) |
None
|
target_auth
|
DomoAuth | None
|
Authentication object (defaults to self.target_auth) |
None
|
debug_api
|
bool
|
Enable API debugging |
False
|
session
|
AsyncClient | None
|
HTTP client session (optional) |
None
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
DomoAccessToken
|
DomoAccessToken object if found, None otherwise |
Raises:
| Type | Description |
|---|---|
DACValidAuthError
|
If target authentication is not available |
DAC_NoAccessTokenName
|
If token name is not provided or available |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 | |
get_target_user
async
¶
get_target_user(
user_email: str | None = None,
target_auth: DomoAuth | None = None,
debug_api: bool = False,
session: AsyncClient | None = None,
*,
context: RouteContext | None = None,
**context_kwargs
) -> DomoUser
Retrieve the target user for this account.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_email
|
str | None
|
Email address of user (defaults to configured username) |
None
|
target_auth
|
DomoAuth | None
|
Authentication object (defaults to self.target_auth) |
None
|
debug_api
|
bool
|
Enable API debugging |
False
|
session
|
AsyncClient | None
|
HTTP client session (optional) |
None
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
Returns:
| Type | Description |
|---|---|
DomoUser
|
DomoUser object for the target user |
Raises:
| Type | Description |
|---|---|
DAC_NoUserName
|
If user email is not provided or configured |
DACValidAuthError
|
If target authentication is not available |
DAC_NoTargetUser
|
If user cannot be found |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | |
regenerate_target_access_token
async
¶
regenerate_target_access_token(
token_name: str | None = None,
duration_in_days: int = 90,
user_email: str | None = None,
is_update_account: bool = True,
target_auth: DomoAuth | None = None,
debug_api: bool = False,
session: AsyncClient | None = None,
*,
context: RouteContext | None = None,
**context_kwargs
) -> DomoAccountCredential
Regenerate or create an access token for the target user.
If a token with the given name exists, it will be regenerated. Otherwise, a new token will be created.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token_name
|
str | None
|
Name of the access token (defaults to account name) |
None
|
duration_in_days
|
int
|
Token validity duration in days (default: 90) |
90
|
user_email
|
str | None
|
Email address of user (defaults to configured username) |
None
|
is_update_account
|
bool
|
Whether to update the account config with new token |
True
|
target_auth
|
DomoAuth | None
|
Authentication object (defaults to self.target_auth) |
None
|
debug_api
|
bool
|
Enable API debugging |
False
|
session
|
AsyncClient | None
|
HTTP client session (optional) |
None
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
DomoAccountCredential
|
Self for method chaining |
Raises:
| Type | Description |
|---|---|
DACValidAuthError
|
If target authentication is not available |
DAC_NoTargetUser
|
If target user cannot be retrieved |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 | |
set_access_token ¶
set_access_token(access_token: str) -> bool
Set the access token in the account configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
access_token
|
str
|
New access token to set |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if successful |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
169 170 171 172 173 174 175 176 177 178 179 | |
set_password ¶
set_password(password: str) -> bool
Set the password in the account configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
password
|
str
|
New password to set |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if successful |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
145 146 147 148 149 150 151 152 153 154 155 | |
set_username ¶
set_username(username: str) -> bool
Set the username in the account configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
username
|
str
|
New username to set |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if successful |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
157 158 159 160 161 162 163 164 165 166 167 | |
test_auths
async
¶
test_auths(
backup_auth: DomoAuth | None = None,
debug_api: bool = False,
session: AsyncClient | None = None,
) -> dict
Test both token and full authentication methods.
Attempts to validate both authentication methods and sets the best available as the target authentication.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
backup_auth
|
DomoAuth | None
|
Backup authentication to use if configured auths fail |
None
|
debug_api
|
bool
|
Enable API debugging |
False
|
session
|
AsyncClient | None
|
HTTP client session (optional) |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary with authentication test results |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | |
test_full_auth
async
¶
test_full_auth(
debug_api: bool = False,
session: AsyncClient | None = None,
) -> bool
Test full authentication (username/password) for the account.
Generates a DomoFullAuth object and validates it against the target instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
debug_api
|
bool
|
Enable API debugging |
False
|
session
|
AsyncClient | None
|
HTTP client session (optional) |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if authentication is valid, False otherwise |
Raises:
| Type | Description |
|---|---|
DAC_NoUserName
|
If username is not configured |
DAC_NoPassword
|
If password is not configured |
DAC_NoTargetInstance
|
If target instance is not set |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | |
test_token_auth
async
¶
test_token_auth(
debug_api: bool = False,
session: AsyncClient | None = None,
) -> bool
Test token authentication for the account.
Generates a DomoTokenAuth object and validates it against the target instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
debug_api
|
bool
|
Enable API debugging |
False
|
session
|
AsyncClient | None
|
HTTP client session (optional) |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if authentication is valid, False otherwise |
Raises:
| Type | Description |
|---|---|
DAC_NoAccessToken
|
If access token is not configured |
DAC_NoTargetInstance
|
If target instance is not set |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | |
to_dict ¶
to_dict(return_snake_case: bool = False) -> dict
Convert credential information to dictionary.
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary containing account ID, alias, instance, and auth validity status |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | |
update_target_user_password
async
¶
update_target_user_password(
new_password: str,
user_email: str | None = None,
is_update_account: bool = True,
target_auth: DomoAuth | None = None,
debug_api: bool = False,
session: AsyncClient | None = None,
*,
context: RouteContext | None = None,
**context_kwargs
) -> DomoAccountCredential
Update the password for the target user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
new_password
|
str
|
New password to set for the user |
required |
user_email
|
str | None
|
Email address of user (defaults to configured username) |
None
|
is_update_account
|
bool
|
Whether to update the account config with new password |
True
|
target_auth
|
DomoAuth | None
|
Authentication object (defaults to self.target_auth) |
None
|
debug_api
|
bool
|
Enable API debugging |
False
|
session
|
AsyncClient | None
|
HTTP client session (optional) |
None
|
context
|
RouteContext | None
|
Optional RouteContext for API call configuration |
None
|
**context_kwargs
|
Additional context parameters |
{}
|
Returns:
| Type | Description |
|---|---|
DomoAccountCredential
|
Self for method chaining |
Raises:
| Type | Description |
|---|---|
DACValidAuthError
|
If target authentication is not available |
Source code in src/crew_dcs/classes/DomoAccount/account_credential.py
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 | |