You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Class: Aws::CognitoIdentity::Client

Inherits:
Seahorse::Client::Base show all
Defined in:
(unknown)

Overview

An API client for Amazon Cognito Identity. To construct a client, you need to configure a :region and :credentials.

cognitoidentity = Aws::CognitoIdentity::Client.new(
  region: region_name,
  credentials: credentials,
  # ...
)

See #initialize for a full list of supported configuration options.

Region

You can configure a default region in the following locations:

  • ENV['AWS_REGION']
  • Aws.config[:region]

Go here for a list of supported regions.

Credentials

Default credentials are loaded automatically from the following locations:

  • ENV['AWS_ACCESS_KEY_ID'] and ENV['AWS_SECRET_ACCESS_KEY']
  • Aws.config[:credentials]
  • The shared credentials ini file at ~/.aws/credentials (more information)
  • From an instance profile when running on EC2

You can also construct a credentials object from one of the following classes:

Alternatively, you configure credentials with :access_key_id and :secret_access_key:

# load credentials from disk
creds = YAML.load(File.read('/path/to/secrets'))

Aws::CognitoIdentity::Client.new(
  access_key_id: creds['access_key_id'],
  secret_access_key: creds['secret_access_key']
)

Always load your credentials from outside your application. Avoid configuring credentials statically and never commit them to source control.

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Base

#config, #handlers

Constructor collapse

API Operations collapse

Instance Method Summary collapse

Methods inherited from Seahorse::Client::Base

add_plugin, api, #build_request, clear_plugins, define, new, #operation, #operation_names, plugins, remove_plugin, set_api, set_plugins

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Constructor Details

#initialize(options = {}) ⇒ Aws::CognitoIdentity::Client

Constructs an API client.

Options Hash (options):

  • :access_key_id (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :convert_params (Boolean) — default: true

    When true, an attempt is made to coerce request parameters into the required types. See Plugins::ParamConverter for more details.

  • :credentials (required, Credentials)

    Your AWS credentials. The following locations will be searched in order for credentials:

    • :access_key_id, :secret_access_key, and :session_token options
    • ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
    • HOME/.aws/credentials shared credentials file
    • EC2 instance profile credentials See Plugins::RequestSigner for more details.
  • :endpoint (String)

    A default endpoint is constructed from the :region. See Plugins::RegionalEndpoint for more details.

  • :http_continue_timeout (Float) — default: 1

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_idle_timeout (Integer) — default: 5

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_open_timeout (Integer) — default: 15

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_proxy (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_read_timeout (Integer) — default: 60

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_wire_trace (Boolean) — default: false

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :log_level (Symbol) — default: :info

    The log level to send messages to the logger at. See Plugins::Logging for more details.

  • :log_formatter (Logging::LogFormatter)

    The log formatter. Defaults to Seahorse::Client::Logging::Formatter.default. See Plugins::Logging for more details.

  • :logger (Logger) — default: nil

    The Logger instance to send log messages to. If this option is not set, logging will be disabled. See Plugins::Logging for more details.

  • :profile (String)

    Used when loading credentials from the shared credentials file at HOME/.aws/credentials. When not specified, 'default' is used. See Plugins::RequestSigner for more details.

  • :raise_response_errors (Boolean) — default: true

    When true, response errors are raised. See Seahorse::Client::Plugins::RaiseResponseErrors for more details.

  • :region (required, String)

    The AWS region to connect to. The region is used to construct the client endpoint. Defaults to ENV['AWS_REGION']. Also checks AMAZON_REGION and AWS_DEFAULT_REGION. See Plugins::RegionalEndpoint for more details.

  • :retry_limit (Integer) — default: 3

    The maximum number of times to retry failed requests. Only ~ 500 level server errors and certain ~ 400 level client errors are retried. Generally, these are throttling errors, data checksum errors, networking errors, timeout errors and auth errors from expired credentials. See Plugins::RetryErrors for more details.

  • :secret_access_key (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :session_token (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :simple_json (Boolean) — default: false

    Disables request parameter conversion, validation, and formatting. Also disable response data type conversions. This option is useful when you want to ensure the highest level of performance by avoiding overhead of walking request parameters and response data structures.

    When :simple_json is enabled, the request parameters hash must be formatted exactly as the DynamoDB API expects. See Plugins::Protocols::JsonRpc for more details.

  • :ssl_ca_bundle (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_ca_directory (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_ca_store (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_verify_peer (Boolean) — default: true

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :stub_responses (Boolean) — default: false

    Causes the client to return stubbed responses. By default fake responses are generated and returned. You can specify the response data to return or errors to raise by calling Aws::ClientStubs#stub_responses. See Aws::ClientStubs for more information.

    Please note When response stubbing is enabled, no HTTP requests are made, and retries are disabled. See Plugins::StubResponses for more details.

  • :validate_params (Boolean) — default: true

    When true, request parameters are validated before sending the request. See Plugins::ParamValidator for more details.

Instance Method Details

#create_identity_pool(options = {}) ⇒ Types::IdentityPool

Creates a new identity pool. The identity pool is a store of user identity information that is specific to your AWS account. The limit on identity pools is 60 per account. The keys for SupportedLoginProviders are as follows:

  • Facebook: graph.facebook.com

  • Google: accounts.google.com

  • Amazon: www.amazon.com

  • Twitter: api.twitter.com

  • Digits: www.digits.com

You must use AWS Developer credentials to call this API.

Examples:

Request syntax with placeholder values


resp = client.create_identity_pool({
  identity_pool_name: "IdentityPoolName", # required
  allow_unauthenticated_identities: false, # required
  supported_login_providers: {
    "IdentityProviderName" => "IdentityProviderId",
  },
  developer_provider_name: "DeveloperProviderName",
  open_id_connect_provider_arns: ["ARNString"],
  cognito_identity_providers: [
    {
      provider_name: "CognitoIdentityProviderName",
      client_id: "CognitoIdentityProviderClientId",
      server_side_token_check: false,
    },
  ],
  saml_provider_arns: ["ARNString"],
})

Response structure


resp.identity_pool_id #=> String
resp.identity_pool_name #=> String
resp.allow_unauthenticated_identities #=> true/false
resp. #=> Hash
resp.["IdentityProviderName"] #=> String
resp.developer_provider_name #=> String
resp.open_id_connect_provider_arns #=> Array
resp.open_id_connect_provider_arns[0] #=> String
resp.cognito_identity_providers #=> Array
resp.cognito_identity_providers[0].provider_name #=> String
resp.cognito_identity_providers[0].client_id #=> String
resp.cognito_identity_providers[0].server_side_token_check #=> true/false
resp.saml_provider_arns #=> Array
resp.saml_provider_arns[0] #=> String

Options Hash (options):

  • :identity_pool_name (required, String)

    A string that you provide.

  • :allow_unauthenticated_identities (required, Boolean)

    TRUE if the identity pool supports unauthenticated logins.

  • :supported_login_providers (Hash<String,String>)

    Optional key:value pairs mapping provider names to provider app IDs.

  • :developer_provider_name (String)

    The \"domain\" by which Cognito will refer to your users. This name acts as a placeholder that allows your backend and the Cognito service to communicate about the developer provider. For the DeveloperProviderName, you can use letters as well as period (.), underscore (_), and dash (-).

    Once you have set a developer provider name, you cannot change it. Please take care in setting this parameter.

  • :open_id_connect_provider_arns (Array<String>)

    A list of OpendID Connect provider ARNs.

  • :cognito_identity_providers (Array<Types::CognitoIdentityProvider>)

    An array of Amazon Cognito Identity user pools and their client IDs.

  • :saml_provider_arns (Array<String>)

    An array of Amazon Resource Names (ARNs) of the SAML provider for your identity pool.

Returns:

See Also:

#delete_identities(options = {}) ⇒ Types::DeleteIdentitiesResponse

Deletes identities from an identity pool. You can specify a list of 1-60 identities that you want to delete.

You must use AWS Developer credentials to call this API.

Examples:

Request syntax with placeholder values


resp = client.delete_identities({
  identity_ids_to_delete: ["IdentityId"], # required
})

Response structure


resp.unprocessed_identity_ids #=> Array
resp.unprocessed_identity_ids[0].identity_id #=> String
resp.unprocessed_identity_ids[0].error_code #=> String, one of "AccessDenied", "InternalServerError"

Options Hash (options):

  • :identity_ids_to_delete (required, Array<String>)

    A list of 1-60 identities that you want to delete.

Returns:

See Also:

#delete_identity_pool(options = {}) ⇒ Struct

Deletes a user pool. Once a pool is deleted, users will not be able to authenticate with the pool.

You must use AWS Developer credentials to call this API.

Examples:

Request syntax with placeholder values


resp = client.delete_identity_pool({
  identity_pool_id: "IdentityPoolId", # required
})

Options Hash (options):

  • :identity_pool_id (required, String)

    An identity pool ID in the format REGION:GUID.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#describe_identity(options = {}) ⇒ Types::IdentityDescription

Returns metadata related to the given identity, including when the identity was created and any associated linked logins.

You must use AWS Developer credentials to call this API.

Examples:

Request syntax with placeholder values


resp = client.describe_identity({
  identity_id: "IdentityId", # required
})

Response structure


resp.identity_id #=> String
resp.logins #=> Array
resp.logins[0] #=> String
resp.creation_date #=> Time
resp.last_modified_date #=> Time

Options Hash (options):

  • :identity_id (required, String)

    A unique identifier in the format REGION:GUID.

Returns:

See Also:

#describe_identity_pool(options = {}) ⇒ Types::IdentityPool

Gets details about a particular identity pool, including the pool name, ID description, creation date, and current number of users.

You must use AWS Developer credentials to call this API.

Examples:

Request syntax with placeholder values


resp = client.describe_identity_pool({
  identity_pool_id: "IdentityPoolId", # required
})

Response structure


resp.identity_pool_id #=> String
resp.identity_pool_name #=> String
resp.allow_unauthenticated_identities #=> true/false
resp. #=> Hash
resp.["IdentityProviderName"] #=> String
resp.developer_provider_name #=> String
resp.open_id_connect_provider_arns #=> Array
resp.open_id_connect_provider_arns[0] #=> String
resp.cognito_identity_providers #=> Array
resp.cognito_identity_providers[0].provider_name #=> String
resp.cognito_identity_providers[0].client_id #=> String
resp.cognito_identity_providers[0].server_side_token_check #=> true/false
resp.saml_provider_arns #=> Array
resp.saml_provider_arns[0] #=> String

Options Hash (options):

  • :identity_pool_id (required, String)

    An identity pool ID in the format REGION:GUID.

Returns:

See Also:

#get_credentials_for_identity(options = {}) ⇒ Types::GetCredentialsForIdentityResponse

Returns credentials for the provided identity ID. Any provided logins will be validated against supported login providers. If the token is for cognito-identity.amazonaws.com, it will be passed through to AWS Security Token Service with the appropriate role for the token.

This is a public API. You do not need any credentials to call this API.

Examples:

Request syntax with placeholder values


resp = client.get_credentials_for_identity({
  identity_id: "IdentityId", # required
  logins: {
    "IdentityProviderName" => "IdentityProviderToken",
  },
  custom_role_arn: "ARNString",
})

Response structure


resp.identity_id #=> String
resp.credentials.access_key_id #=> String
resp.credentials.secret_key #=> String
resp.credentials.session_token #=> String
resp.credentials.expiration #=> Time

Options Hash (options):

  • :identity_id (required, String)

    A unique identifier in the format REGION:GUID.

  • :logins (Hash<String,String>)

    A set of optional name-value pairs that map provider names to provider tokens.

  • :custom_role_arn (String)

    The Amazon Resource Name (ARN) of the role to be assumed when multiple roles were received in the token from the identity provider. For example, a SAML-based identity provider. This parameter is optional for identity providers that do not support role customization.

Returns:

See Also:

#get_id(options = {}) ⇒ Types::GetIdResponse

Generates (or retrieves) a Cognito ID. Supplying multiple logins will create an implicit linked account.

This is a public API. You do not need any credentials to call this API.

Examples:

Request syntax with placeholder values


resp = client.get_id({
  account_id: "AccountId",
  identity_pool_id: "IdentityPoolId", # required
  logins: {
    "IdentityProviderName" => "IdentityProviderToken",
  },
})

Response structure


resp.identity_id #=> String

Options Hash (options):

  • :account_id (String)

    A standard AWS account ID (9+ digits).

  • :identity_pool_id (required, String)

    An identity pool ID in the format REGION:GUID.

  • :logins (Hash<String,String>)

    A set of optional name-value pairs that map provider names to provider tokens. The available provider names for Logins are as follows:

    • Facebook: graph.facebook.com

    • Amazon Cognito Identity Provider: cognito-idp.us-east-1.amazonaws.com/us-east-1_123456789

    • Google: accounts.google.com

    • Amazon: www.amazon.com

    • Twitter: api.twitter.com

    • Digits: www.digits.com

Returns:

See Also:

#get_identity_pool_roles(options = {}) ⇒ Types::GetIdentityPoolRolesResponse

Gets the roles for an identity pool.

You must use AWS Developer credentials to call this API.

Examples:

Request syntax with placeholder values


resp = client.get_identity_pool_roles({
  identity_pool_id: "IdentityPoolId", # required
})

Response structure


resp.identity_pool_id #=> String
resp.roles #=> Hash
resp.roles["RoleType"] #=> String
resp.role_mappings #=> Hash
resp.role_mappings["IdentityProviderName"].type #=> String, one of "Token", "Rules"
resp.role_mappings["IdentityProviderName"].ambiguous_role_resolution #=> String, one of "AuthenticatedRole", "Deny"
resp.role_mappings["IdentityProviderName"].rules_configuration.rules #=> Array
resp.role_mappings["IdentityProviderName"].rules_configuration.rules[0].claim #=> String
resp.role_mappings["IdentityProviderName"].rules_configuration.rules[0].match_type #=> String, one of "Equals", "Contains", "StartsWith", "NotEqual"
resp.role_mappings["IdentityProviderName"].rules_configuration.rules[0].value #=> String
resp.role_mappings["IdentityProviderName"].rules_configuration.rules[0].role_arn #=> String

Options Hash (options):

  • :identity_pool_id (required, String)

    An identity pool ID in the format REGION:GUID.

Returns:

See Also:

#get_open_id_token(options = {}) ⇒ Types::GetOpenIdTokenResponse

Gets an OpenID token, using a known Cognito ID. This known Cognito ID is returned by GetId. You can optionally add additional logins for the identity. Supplying multiple logins creates an implicit link.

The OpenId token is valid for 15 minutes.

This is a public API. You do not need any credentials to call this API.

Examples:

Request syntax with placeholder values


resp = client.get_open_id_token({
  identity_id: "IdentityId", # required
  logins: {
    "IdentityProviderName" => "IdentityProviderToken",
  },
})

Response structure


resp.identity_id #=> String
resp.token #=> String

Options Hash (options):

  • :identity_id (required, String)

    A unique identifier in the format REGION:GUID.

  • :logins (Hash<String,String>)

    A set of optional name-value pairs that map provider names to provider tokens. When using graph.facebook.com and www.amazon.com, supply the access_token returned from the provider\'s authflow. For accounts.google.com, an Amazon Cognito Identity Provider, or any other OpenId Connect provider, always include the id_token.

Returns:

See Also:

#get_open_id_token_for_developer_identity(options = {}) ⇒ Types::GetOpenIdTokenForDeveloperIdentityResponse

Registers (or retrieves) a Cognito IdentityId and an OpenID Connect token for a user authenticated by your backend authentication process. Supplying multiple logins will create an implicit linked account. You can only specify one developer provider as part of the Logins map, which is linked to the identity pool. The developer provider is the "domain" by which Cognito will refer to your users.

You can use GetOpenIdTokenForDeveloperIdentity to create a new identity and to link new logins (that is, user credentials issued by a public provider or developer provider) to an existing identity. When you want to create a new identity, the IdentityId should be null. When you want to associate a new login with an existing authenticated/unauthenticated identity, you can do so by providing the existing IdentityId. This API will create the identity in the specified IdentityPoolId.

You must use AWS Developer credentials to call this API.

Examples:

Request syntax with placeholder values


resp = client.get_open_id_token_for_developer_identity({
  identity_pool_id: "IdentityPoolId", # required
  identity_id: "IdentityId",
  logins: { # required
    "IdentityProviderName" => "IdentityProviderToken",
  },
  token_duration: 1,
})

Response structure


resp.identity_id #=> String
resp.token #=> String

Options Hash (options):

  • :identity_pool_id (required, String)

    An identity pool ID in the format REGION:GUID.

  • :identity_id (String)

    A unique identifier in the format REGION:GUID.

  • :logins (required, Hash<String,String>)

    A set of optional name-value pairs that map provider names to provider tokens. Each name-value pair represents a user from a public provider or developer provider. If the user is from a developer provider, the name-value pair will follow the syntax "developer_provider_name": "developer_user_identifier". The developer provider is the \"domain\" by which Cognito will refer to your users; you provided this domain while creating/updating the identity pool. The developer user identifier is an identifier from your backend that uniquely identifies a user. When you create an identity pool, you can specify the supported logins.

  • :token_duration (Integer)

    The expiration time of the token, in seconds. You can specify a custom expiration time for the token so that you can cache it. If you don\'t provide an expiration time, the token is valid for 15 minutes. You can exchange the token with Amazon STS for temporary AWS credentials, which are valid for a maximum of one hour. The maximum token duration you can set is 24 hours. You should take care in setting the expiration time for a token, as there are significant security implications: an attacker could use a leaked token to access your AWS resources for the token\'s duration.

Returns:

See Also:

#list_identities(options = {}) ⇒ Types::ListIdentitiesResponse

Lists the identities in a pool.

You must use AWS Developer credentials to call this API.

Examples:

Request syntax with placeholder values


resp = client.list_identities({
  identity_pool_id: "IdentityPoolId", # required
  max_results: 1, # required
  next_token: "PaginationKey",
  hide_disabled: false,
})

Response structure


resp.identity_pool_id #=> String
resp.identities #=> Array
resp.identities[0].identity_id #=> String
resp.identities[0].logins #=> Array
resp.identities[0].logins[0] #=> String
resp.identities[0].creation_date #=> Time
resp.identities[0].last_modified_date #=> Time
resp.next_token #=> String

Options Hash (options):

  • :identity_pool_id (required, String)

    An identity pool ID in the format REGION:GUID.

  • :max_results (required, Integer)

    The maximum number of identities to return.

  • :next_token (String)

    A pagination token.

  • :hide_disabled (Boolean)

    An optional boolean parameter that allows you to hide disabled identities. If omitted, the ListIdentities API will include disabled identities in the response.

Returns:

See Also:

#list_identity_pools(options = {}) ⇒ Types::ListIdentityPoolsResponse

Lists all of the Cognito identity pools registered for your account.

You must use AWS Developer credentials to call this API.

Examples:

Request syntax with placeholder values


resp = client.list_identity_pools({
  max_results: 1, # required
  next_token: "PaginationKey",
})

Response structure


resp.identity_pools #=> Array
resp.identity_pools[0].identity_pool_id #=> String
resp.identity_pools[0].identity_pool_name #=> String
resp.next_token #=> String

Options Hash (options):

  • :max_results (required, Integer)

    The maximum number of identities to return.

  • :next_token (String)

    A pagination token.

Returns:

See Also:

#lookup_developer_identity(options = {}) ⇒ Types::LookupDeveloperIdentityResponse

Retrieves the IdentityID associated with a DeveloperUserIdentifier or the list of DeveloperUserIdentifiers associated with an IdentityId for an existing identity. Either IdentityID or DeveloperUserIdentifier must not be null. If you supply only one of these values, the other value will be searched in the database and returned as a part of the response. If you supply both, DeveloperUserIdentifier will be matched against IdentityID. If the values are verified against the database, the response returns both values and is the same as the request. Otherwise a ResourceConflictException is thrown.

You must use AWS Developer credentials to call this API.

Examples:

Request syntax with placeholder values


resp = client.lookup_developer_identity({
  identity_pool_id: "IdentityPoolId", # required
  identity_id: "IdentityId",
  developer_user_identifier: "DeveloperUserIdentifier",
  max_results: 1,
  next_token: "PaginationKey",
})

Response structure


resp.identity_id #=> String
resp.developer_user_identifier_list #=> Array
resp.developer_user_identifier_list[0] #=> String
resp.next_token #=> String

Options Hash (options):

  • :identity_pool_id (required, String)

    An identity pool ID in the format REGION:GUID.

  • :identity_id (String)

    A unique identifier in the format REGION:GUID.

  • :developer_user_identifier (String)

    A unique ID used by your backend authentication process to identify a user. Typically, a developer identity provider would issue many developer user identifiers, in keeping with the number of users.

  • :max_results (Integer)

    The maximum number of identities to return.

  • :next_token (String)

    A pagination token. The first call you make will have NextToken set to null. After that the service will return NextToken values as needed. For example, let\'s say you make a request with MaxResults set to 10, and there are 20 matches in the database. The service will return a pagination token as a part of the response. This token can be used to call the API again and get results starting from the 11th match.

Returns:

See Also:

#merge_developer_identities(options = {}) ⇒ Types::MergeDeveloperIdentitiesResponse

Merges two users having different IdentityIds, existing in the same identity pool, and identified by the same developer provider. You can use this action to request that discrete users be merged and identified as a single user in the Cognito environment. Cognito associates the given source user (SourceUserIdentifier) with the IdentityId of the DestinationUserIdentifier. Only developer-authenticated users can be merged. If the users to be merged are associated with the same public provider, but as two different users, an exception will be thrown.

You must use AWS Developer credentials to call this API.

Examples:

Request syntax with placeholder values


resp = client.merge_developer_identities({
  source_user_identifier: "DeveloperUserIdentifier", # required
  destination_user_identifier: "DeveloperUserIdentifier", # required
  developer_provider_name: "DeveloperProviderName", # required
  identity_pool_id: "IdentityPoolId", # required
})

Response structure


resp.identity_id #=> String

Options Hash (options):

  • :source_user_identifier (required, String)

    User identifier for the source user. The value should be a DeveloperUserIdentifier.

  • :destination_user_identifier (required, String)

    User identifier for the destination user. The value should be a DeveloperUserIdentifier.

  • :developer_provider_name (required, String)

    The \"domain\" by which Cognito will refer to your users. This is a (pseudo) domain name that you provide while creating an identity pool. This name acts as a placeholder that allows your backend and the Cognito service to communicate about the developer provider. For the DeveloperProviderName, you can use letters as well as period (.), underscore (_), and dash (-).

  • :identity_pool_id (required, String)

    An identity pool ID in the format REGION:GUID.

Returns:

See Also:

#set_identity_pool_roles(options = {}) ⇒ Struct

Sets the roles for an identity pool. These roles are used when making calls to GetCredentialsForIdentity action.

You must use AWS Developer credentials to call this API.

Examples:

Request syntax with placeholder values


resp = client.set_identity_pool_roles({
  identity_pool_id: "IdentityPoolId", # required
  roles: { # required
    "RoleType" => "ARNString",
  },
  role_mappings: {
    "IdentityProviderName" => {
      type: "Token", # required, accepts Token, Rules
      ambiguous_role_resolution: "AuthenticatedRole", # accepts AuthenticatedRole, Deny
      rules_configuration: {
        rules: [ # required
          {
            claim: "ClaimName", # required
            match_type: "Equals", # required, accepts Equals, Contains, StartsWith, NotEqual
            value: "ClaimValue", # required
            role_arn: "ARNString", # required
          },
        ],
      },
    },
  },
})

Options Hash (options):

  • :identity_pool_id (required, String)

    An identity pool ID in the format REGION:GUID.

  • :roles (required, Hash<String,String>)

    The map of roles associated with this pool. For a given role, the key will be either \"authenticated\" or \"unauthenticated\" and the value will be the Role ARN.

  • :role_mappings (Hash<String,Types::RoleMapping>)

    How users for a specific identity provider are to mapped to roles. This is a string to RoleMapping object map. The string identifies the identity provider, for example, \"graph.facebook.com\" or \"cognito-idp-east-1.amazonaws.com/us-east-1_abcdefghi:app_client_id\".

    Up to 25 rules can be specified per identity provider.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

Unlinks a DeveloperUserIdentifier from an existing identity. Unlinked developer users will be considered new identities next time they are seen. If, for a given Cognito identity, you remove all federated identities as well as the developer user identifier, the Cognito identity becomes inaccessible.

You must use AWS Developer credentials to call this API.

Examples:

Request syntax with placeholder values


resp = client.unlink_developer_identity({
  identity_id: "IdentityId", # required
  identity_pool_id: "IdentityPoolId", # required
  developer_provider_name: "DeveloperProviderName", # required
  developer_user_identifier: "DeveloperUserIdentifier", # required
})

Options Hash (options):

  • :identity_id (required, String)

    A unique identifier in the format REGION:GUID.

  • :identity_pool_id (required, String)

    An identity pool ID in the format REGION:GUID.

  • :developer_provider_name (required, String)

    The \"domain\" by which Cognito will refer to your users.

  • :developer_user_identifier (required, String)

    A unique ID used by your backend authentication process to identify a user.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

Unlinks a federated identity from an existing account. Unlinked logins will be considered new identities next time they are seen. Removing the last linked login will make this identity inaccessible.

This is a public API. You do not need any credentials to call this API.

Examples:

Request syntax with placeholder values


resp = client.unlink_identity({
  identity_id: "IdentityId", # required
  logins: { # required
    "IdentityProviderName" => "IdentityProviderToken",
  },
  logins_to_remove: ["IdentityProviderName"], # required
})

Options Hash (options):

  • :identity_id (required, String)

    A unique identifier in the format REGION:GUID.

  • :logins (required, Hash<String,String>)

    A set of optional name-value pairs that map provider names to provider tokens.

  • :logins_to_remove (required, Array<String>)

    Provider names to unlink from this identity.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#update_identity_pool(options = {}) ⇒ Types::IdentityPool

Updates a user pool.

You must use AWS Developer credentials to call this API.

Examples:

Request syntax with placeholder values


resp = client.update_identity_pool({
  identity_pool_id: "IdentityPoolId", # required
  identity_pool_name: "IdentityPoolName", # required
  allow_unauthenticated_identities: false, # required
  supported_login_providers: {
    "IdentityProviderName" => "IdentityProviderId",
  },
  developer_provider_name: "DeveloperProviderName",
  open_id_connect_provider_arns: ["ARNString"],
  cognito_identity_providers: [
    {
      provider_name: "CognitoIdentityProviderName",
      client_id: "CognitoIdentityProviderClientId",
      server_side_token_check: false,
    },
  ],
  saml_provider_arns: ["ARNString"],
})

Response structure


resp.identity_pool_id #=> String
resp.identity_pool_name #=> String
resp.allow_unauthenticated_identities #=> true/false
resp. #=> Hash
resp.["IdentityProviderName"] #=> String
resp.developer_provider_name #=> String
resp.open_id_connect_provider_arns #=> Array
resp.open_id_connect_provider_arns[0] #=> String
resp.cognito_identity_providers #=> Array
resp.cognito_identity_providers[0].provider_name #=> String
resp.cognito_identity_providers[0].client_id #=> String
resp.cognito_identity_providers[0].server_side_token_check #=> true/false
resp.saml_provider_arns #=> Array
resp.saml_provider_arns[0] #=> String

Options Hash (options):

  • :identity_pool_id (required, String)

    An identity pool ID in the format REGION:GUID.

  • :identity_pool_name (required, String)

    A string that you provide.

  • :allow_unauthenticated_identities (required, Boolean)

    TRUE if the identity pool supports unauthenticated logins.

  • :supported_login_providers (Hash<String,String>)

    Optional key:value pairs mapping provider names to provider app IDs.

  • :developer_provider_name (String)

    The \"domain\" by which Cognito will refer to your users.

  • :open_id_connect_provider_arns (Array<String>)

    A list of OpendID Connect provider ARNs.

  • :cognito_identity_providers (Array<Types::CognitoIdentityProvider>)

    A list representing an Amazon Cognito Identity User Pool and its client ID.

  • :saml_provider_arns (Array<String>)

    An array of Amazon Resource Names (ARNs) of the SAML provider for your identity pool.

Returns:

See Also:

#wait_until(waiter_name, params = {}) {|waiter| ... } ⇒ Boolean

Waiters polls an API operation until a resource enters a desired state.

Basic Usage

Waiters will poll until they are succesful, they fail by entering a terminal state, or until a maximum number of attempts are made.

# polls in a loop, sleeping between attempts client.waiter_until(waiter_name, params)

Configuration

You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. You configure waiters by passing a block to #wait_until:

# poll for ~25 seconds
client.wait_until(...) do |w|
  w.max_attempts = 5
  w.delay = 5
end

Callbacks

You can be notified before each polling attempt and before each delay. If you throw :success or :failure from these callbacks, it will terminate the waiter.

started_at = Time.now
client.wait_until(...) do |w|

  # disable max attempts
  w.max_attempts = nil

  # poll for 1 hour, instead of a number of attempts
  w.before_wait do |attempts, response|
    throw :failure if Time.now - started_at > 3600
  end

end

Handling Errors

When a waiter is successful, it returns true. When a waiter fails, it raises an error. All errors raised extend from Waiters::Errors::WaiterFailed.

begin
  client.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
  # resource did not enter the desired state in time
end

Parameters:

  • waiter_name (Symbol)

    The name of the waiter. See #waiter_names for a full list of supported waiters.

  • params (Hash) (defaults to: {})

    Additional request parameters. See the #waiter_names for a list of supported waiters and what request they call. The called request determines the list of accepted parameters.

Yield Parameters:

Returns:

  • (Boolean)

    Returns true if the waiter was successful.

Raises:

  • (Errors::FailureStateError)

    Raised when the waiter terminates because the waiter has entered a state that it will not transition out of, preventing success.

  • (Errors::TooManyAttemptsError)

    Raised when the configured maximum number of attempts have been made, and the waiter is not yet successful.

  • (Errors::UnexpectedError)

    Raised when an error is encounted while polling for a resource that is not expected.

  • (Errors::NoSuchWaiterError)

    Raised when you request to wait for an unknown state.

#waiter_namesArray<Symbol>

Returns the list of supported waiters. The following table lists the supported waiters and the client method they call:

Waiter NameClient MethodDefault Delay:Default Max Attempts:

Returns:

  • (Array<Symbol>)

    the list of supported waiters.