CredentialProviderFactory

public struct CredentialProviderFactory

A helper struct to defer the creation of a CredentialProvider until after the AWSClient has been created.

  • The initialization context for a ContextProvider

    See more

    Declaration

    Swift

    public struct Context
  • The default CredentialProvider used to access credentials

    Declaration

    Swift

    public static var `default`: CredentialProviderFactory { get }
  • Use this method to initialize your custom CredentialProvider

    Declaration

    Swift

    public static func custom(_ factory: @escaping (Context) -> CredentialProvider) -> CredentialProviderFactory
  • Use this method to enforce the use of a CredentialProvider that uses the environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY to create the credentials.

    Declaration

    Swift

    public static var environment: CredentialProviderFactory { get }
  • Use this method to enforce the use of a CredentialProvider that uses static credentials.

    Declaration

    Swift

    public static func `static`(accessKeyId: String, secretAccessKey: String, sessionToken: String? = nil) -> CredentialProviderFactory
  • ecs

    Use this method to enforce the usage of the Credentials supplied via the ECS Metadata endpoint

    Declaration

    Swift

    public static var ecs: CredentialProviderFactory { get }
  • ec2

    Use this method to enforce the usage of the Credentials supplied via the EC2 Instance Metadata endpoint

    Declaration

    Swift

    public static var ec2: CredentialProviderFactory { get }
  • Use this method to load credentials from your AWS cli credentials and optional profile configuration files, normally located at ~/.aws/credentials and ~/.aws/config.

    Declaration

    Swift

    public static func configFile(
        credentialsFilePath: String = ConfigFile.defaultCredentialsPath,
        configFilePath: String = ConfigFile.defaultProfileConfigPath,
        profile: String? = nil
    ) -> CredentialProviderFactory
  • Enforce the use of no credentials.

    Declaration

    Swift

    public static var empty: CredentialProviderFactory { get }
  • Use the list of credential providers supplied to get credentials. The first one in the list that manages to supply credentials is the one to use

    Declaration

    Swift

    public static func selector(_ providers: CredentialProviderFactory...) -> CredentialProviderFactory