415 415 | /// pub struct ForeverSleep;
|
416 416 | ///
|
417 417 | /// impl AsyncSleep for ForeverSleep {
|
418 418 | /// fn sleep(&self, duration: std::time::Duration) -> Sleep {
|
419 419 | /// Sleep::new(std::future::pending())
|
420 420 | /// }
|
421 421 | /// }
|
422 422 | ///
|
423 423 | /// fn set_never_ending_sleep_impl(builder: &mut Builder) {
|
424 424 | /// let sleep_impl = SharedAsyncSleep::new(ForeverSleep);
|
425 425 | /// builder.set_sleep_impl(Some(sleep_impl));
|
426 426 | /// }
|
427 427 | ///
|
428 428 | /// let mut builder = SdkConfig::builder();
|
429 429 | /// set_never_ending_sleep_impl(&mut builder);
|
430 430 | /// let config = builder.build();
|
431 431 | /// ```
|
432 432 | pub fn set_sleep_impl(&mut self, sleep_impl: Option<SharedAsyncSleep>) -> &mut Self {
|
433 433 | self.sleep_impl = sleep_impl;
|
434 434 | self
|
435 435 | }
|
436 436 |
|
437 437 | /// Set the identity cache for caching credentials and SSO tokens.
|
438 438 | ///
|
439 439 | /// The default identity cache will wait until the first request that requires authentication
|
440 440 | /// to load an identity. Once the identity is loaded, it is cached until shortly before it
|
441 441 | /// expires.
|
442 442 | ///
|
443 443 | /// # Examples
|
444 444 | /// Disabling identity caching:
|
445 - | /// ```rust
|
445 + | /// ```ignore
|
446 446 | /// # use aws_types::SdkConfig;
|
447 447 | /// use aws_smithy_runtime::client::identity::IdentityCache;
|
448 448 | /// let config = SdkConfig::builder()
|
449 449 | /// .identity_cache(IdentityCache::no_cache())
|
450 450 | /// .build();
|
451 451 | /// ```
|
452 452 | /// Changing settings on the default cache implementation:
|
453 - | /// ```rust
|
453 + | /// ```ignore
|
454 454 | /// # use aws_types::SdkConfig;
|
455 455 | /// use aws_smithy_runtime::client::identity::IdentityCache;
|
456 456 | /// use std::time::Duration;
|
457 457 | ///
|
458 458 | /// let config = SdkConfig::builder()
|
459 459 | /// .identity_cache(
|
460 460 | /// IdentityCache::lazy()
|
461 461 | /// .load_timeout(Duration::from_secs(10))
|
462 462 | /// .build()
|
463 463 | /// )
|
464 464 | /// .build();
|
465 465 | /// ```
|
466 466 | pub fn identity_cache(mut self, cache: impl ResolveCachedIdentity + 'static) -> Self {
|
467 467 | self.set_identity_cache(Some(cache.into_shared()));
|
468 468 | self
|
469 469 | }
|
470 470 |
|
471 471 | /// Set the identity cache for caching credentials and SSO tokens.
|
472 472 | ///
|
473 473 | /// The default identity cache will wait until the first request that requires authentication
|
474 474 | /// to load an identity. Once the identity is loaded, it is cached until shortly before it
|
475 475 | /// expires.
|
476 476 | ///
|
477 477 | /// # Examples
|
478 - | /// ```rust
|
478 + | /// ```ignore
|
479 479 | /// # use aws_types::SdkConfig;
|
480 480 | /// use aws_smithy_runtime::client::identity::IdentityCache;
|
481 481 | ///
|
482 482 | /// fn override_identity_cache() -> bool {
|
483 483 | /// // ...
|
484 484 | /// # true
|
485 485 | /// }
|
486 486 | ///
|
487 487 | /// let mut builder = SdkConfig::builder();
|
488 488 | /// if override_identity_cache() {
|
489 489 | /// builder.set_identity_cache(Some(IdentityCache::lazy().build()));
|
490 490 | /// }
|
491 491 | /// let config = builder.build();
|
492 492 | /// ```
|
493 493 | pub fn set_identity_cache(&mut self, cache: Option<SharedIdentityCache>) -> &mut Self {
|
494 494 | self.identity_cache = cache;
|
495 495 | self
|
496 496 | }
|
497 497 |
|
498 498 | /// Set the credentials provider for the builder
|
499 499 | ///
|
500 500 | /// # Examples
|
501 501 | /// ```rust
|
502 502 | /// use aws_credential_types::provider::{ProvideCredentials, SharedCredentialsProvider};
|
503 503 | /// use aws_types::SdkConfig;
|
504 504 | /// fn make_provider() -> impl ProvideCredentials {
|
505 505 | /// // ...
|
506 506 | /// # use aws_credential_types::Credentials;
|
507 507 | /// # Credentials::new("test", "test", None, None, "example")
|
508 508 | /// }
|