Reference¶
Session Class¶
Source code in iam_rolesanywhere_session/iam_rolesanywhere_session.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 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 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 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 422 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 488 489 490 491 492 493 494 495 | |
__get_credentials()
¶
Compute and make the request to rolesanywhere endpoint to retrieve IAM Credentials
Raises:
| Type | Description |
|---|---|
CredentialsRetrievalError
|
The service returned an error status, an unparseable body, or a body without a credential set. |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
IAMCredentials
|
Dict of AWS Credentials acquired from rolesanywhere: { "access_key": accessKeyId, "secret_key": secretAccessKey, "token": sessionToken, "expiry_time": expirationTime, |
IAMCredentials
|
} |
Source code in iam_rolesanywhere_session/iam_rolesanywhere_session.py
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 488 489 490 491 492 493 494 495 | |
get_refreshable_credentials()
¶
Return refreshable credentials
Returns:
| Name | Type | Description |
|---|---|---|
DeferredRefreshableCredentials |
DeferredRefreshableCredentials
|
set credentials needed to authentificate requests. Credentials will be auto refreshed when needed. |
Source code in iam_rolesanywhere_session/iam_rolesanywhere_session.py
393 394 395 396 397 398 399 400 401 402 | |
get_session(**kwargs)
¶
Get a botocore session
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kwargs
|
dict
|
Key value of configuration parameter for Session object |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
Session |
Session
|
Botocore session object |
Source code in iam_rolesanywhere_session/iam_rolesanywhere_session.py
354 355 356 357 358 359 360 361 362 363 364 365 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 | |
Signer Class¶
Bases: SigV4Auth
Source code in iam_rolesanywhere_session/iam_rolesanywhere_session.py
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 562 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 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 | |
__encode_to_der(cert)
staticmethod
¶
Encode certificate or chain to der
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cert
|
Union[Certificate, List[Certificate]]
|
Representation of the certificate(s) in PEM format. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
return the certificate(s) encoded in der format |
Source code in iam_rolesanywhere_session/iam_rolesanywhere_session.py
609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | |
__load_certificate(certificate)
staticmethod
¶
Load the certificate
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
certificate
|
Union[str, bytes]
|
Representation of the certificate in PEM format. |
required |
Returns:
| Type | Description |
|---|---|
Certificate
|
x509.Certificate: return the certificate |
Source code in iam_rolesanywhere_session/iam_rolesanywhere_session.py
652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | |
__load_certificate_chain(certificate_chain)
staticmethod
¶
Load a certificate chain
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
certificate_chain
|
Union[str, bytes]
|
Representation of the certificate chain in PEM format. |
required |
Returns:
| Type | Description |
|---|---|
List[Certificate]
|
List[x509.Certificate]: return a list of certificate |
Source code in iam_rolesanywhere_session/iam_rolesanywhere_session.py
633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 | |
__load_private_key(private_key, passphrase=None)
staticmethod
¶
Load the private key
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
private_key
|
Union[str, bytes]
|
Representation of the private key in PEM format. |
required |
passphrase
|
Optional[bytes]
|
Passphrase protecting the key, if any. |
None
|
Raises:
| Type | Description |
|---|---|
UnsupportedPrivateKeyError
|
The key is neither RSA nor elliptic curve. |
Returns:
| Type | Description |
|---|---|
Union[RSAPrivateKey, EllipticCurvePrivateKey]
|
Union[RSAPrivateKey, EllipticCurvePrivateKey]: the loaded private key |
Source code in iam_rolesanywhere_session/iam_rolesanywhere_session.py
670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | |
string_to_sign(request, canonical_request)
¶
Return the canonical StringToSign as well as a dict containing the original version of all headers that were included in the StringToSign.
Source code in iam_rolesanywhere_session/iam_rolesanywhere_session.py
580 581 582 583 584 585 586 587 588 589 590 | |
Typed Dict¶
Bases: TypedDict
A dictionary of proxy servers, keyed by the URL scheme they apply to.
botocore selects a proxy with proxies.get(url.scheme), so the keys are
the schemes themselves rather than environment-variable style names.
Attributes:
| Name | Type | Description |
|---|---|---|
http |
str
|
Proxy server, with port, for plain HTTP destinations. |
https |
str
|
Proxy server, with port, for HTTPS destinations. |
Examples:
{'https': "http://URL:PORT", 'http': "http://URL:PORT"}
Source code in iam_rolesanywhere_session/iam_rolesanywhere_session.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
Bases: TypedDict
A dictionary of additional proxy configurations.
Attributes:
| Name | Type | Description |
|---|---|---|
proxy_ca_bundle |
str
|
The path to a custom certificate bundle to use when establishing SSL/TLS connections with the proxy. |
proxy_client_cert |
Union[str, tuple]
|
The path to a certificate for proxy TLS client
authentication. A |
proxy_use_forwarding_for_https |
bool
|
For HTTPS proxies, forward requests to HTTPS destinations with an absolute URI. We strongly recommend using this option only with trusted or corporate proxies. |
Source code in iam_rolesanywhere_session/iam_rolesanywhere_session.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
Bases: TypedDict
IAMCredentials.
Source code in iam_rolesanywhere_session/iam_rolesanywhere_session.py
62 63 64 65 66 67 68 | |
Exceptions¶
Bases: Exception
Base class for every error raised by this package.
Source code in iam_rolesanywhere_session/exceptions.py
18 19 | |
Bases: IAMRolesAnywhereError
Raised when IAM Roles Anywhere does not return usable credentials.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
status_code
|
int
|
HTTP status code returned by the |
required |
message
|
str
|
Error detail reported by the service, or a description of why the response could not be interpreted. |
required |
Source code in iam_rolesanywhere_session/exceptions.py
22 23 24 25 26 27 28 29 30 31 32 33 34 | |
Bases: IAMRolesAnywhereError, TypeError
Raised when the supplied private key is neither RSA nor elliptic curve.
Also inherits :class:TypeError so that callers written against v2, which
raised a bare TypeError here, keep working.
Source code in iam_rolesanywhere_session/exceptions.py
37 38 39 40 41 42 | |
Bases: IAMRolesAnywhereError, ValueError
Raised when the requested session duration is outside the allowed range.
Also inherits :class:ValueError for consistency with other argument
validation errors.
Source code in iam_rolesanywhere_session/exceptions.py
68 69 70 71 72 73 | |