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.

  • :active_endpoint_cache (Boolean)

    When set to true, a thread polling for endpoints will be running in the background every 60 secs (default). Defaults to false. See Plugins::EndpointDiscovery 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.
  • :disable_host_prefix_injection (Boolean)

    Set to true to disable SDK automatically adding host prefix to default service endpoint when available. See Plugins::EndpointPattern for more details.

  • :endpoint (String)

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

  • :endpoint_cache_max_entries (Integer)

    Used for the maximum size limit of the LRU cache storing endpoints data for endpoint discovery enabled operations. Defaults to 1000. See Plugins::EndpointDiscovery for more details.

  • :endpoint_cache_max_threads (Integer)

    Used for the maximum threads in use for polling endpoints to be cached, defaults to 10. See Plugins::EndpointDiscovery for more details.

  • :endpoint_cache_poll_interval (Integer)

    When :endpoint_discovery and :active_endpoint_cache is enabled, Use this option to config the time interval in seconds for making requests fetching endpoints information. Defaults to 60 sec. See Plugins::EndpointDiscovery for more details.

  • :endpoint_discovery (Boolean)

    When set to true, endpoint discovery will be enabled for operations when available. Defaults to false. See Plugins::EndpointDiscovery 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 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
  allow_classic_flow: false,
  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"],
  identity_pool_tags: {
    "TagKeysType" => "TagValueType",
  },
})

Response structure


resp.identity_pool_id #=> String
resp.identity_pool_name #=> String
resp.allow_unauthenticated_identities #=> true/false
resp.allow_classic_flow #=> 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
resp.identity_pool_tags #=> Hash
resp.identity_pool_tags["TagKeysType"] #=> 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.

  • :allow_classic_flow (Boolean)

    Enables or disables the Basic (Classic) authentication flow. For more information, see Identity Pools (Federated Identities) Authentication Flow in the Amazon Cognito Developer Guide.

  • :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 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.

  • :identity_pool_tags (Hash<String,String>)

    Tags to assign to the identity pool. A tag is a label that you can apply to identity pools to categorize and manage them in different ways, such as by purpose, owner, environment, or other criteria.

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 an identity 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.allow_classic_flow #=> 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
resp.identity_pool_tags #=> Hash
resp.identity_pool_tags["TagKeysType"] #=> 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. The name-value pair will follow the syntax \"provider_name\": \"provider_user_identifier\".

    Logins should not be specified when trying to get credentials for an unauthenticated identity.

    The Logins parameter is required when using identities associated with external identity providers such as FaceBook. For examples of Logins maps, see the code examples in the External Identity Providers section of the Amazon Cognito Developer Guide.

  • :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 user pool: cognito-idp.<region>.amazonaws.com/<YOUR_USER_POOL_ID>, for example, 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 10 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 user pool 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.

    Please provide for a small grace period, usually no more than 5 minutes, to account for clock skew.

Returns:

See Also:

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

Lists the identities in an identity 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:

#list_tags_for_resource(options = {}) ⇒ Types::ListTagsForResourceResponse

Lists the tags that are assigned to an Amazon Cognito identity pool.

A tag is a label that you can apply to identity pools to categorize and manage them in different ways, such as by purpose, owner, environment, or other criteria.

You can use this action up to 10 times per second, per account.

Examples:

Request syntax with placeholder values


resp = client.list_tags_for_resource({
  resource_arn: "ARNString", # required
})

Response structure


resp.tags #=> Hash
resp.tags["TagKeysType"] #=> String

Options Hash (options):

  • :resource_arn (required, String)

    The Amazon Resource Name (ARN) of the identity pool that the tags are assigned to.

Returns:

See Also:

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

Retrieves the IdentityID associated with a DeveloperUserIdentifier or the list of DeveloperUserIdentifier values 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.

LookupDeveloperIdentity is intended for low-throughput control plane operations: for example, to enable customer service to locate an identity ID by username. If you are using it for higher-volume operations such as user authentication, your requests are likely to be throttled. GetOpenIdTokenForDeveloperIdentity is a better option for higher-volume operations for user authentication.

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.

The number of linked logins is limited to 20. So, the number of linked logins for the source user, SourceUserIdentifier, and the destination user, DestinationUserIdentifier, together should not be larger than 20. Otherwise, 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:

#tag_resource(options = {}) ⇒ Struct

Assigns a set of tags to an Amazon Cognito identity pool. A tag is a label that you can use to categorize and manage identity pools in different ways, such as by purpose, owner, environment, or other criteria.

Each tag consists of a key and value, both of which you define. A key is a general category for more specific values. For example, if you have two versions of an identity pool, one for testing and another for production, you might assign an Environment tag key to both identity pools. The value of this key might be Test for one identity pool and Production for the other.

Tags are useful for cost tracking and access control. You can activate your tags so that they appear on the Billing and Cost Management console, where you can track the costs associated with your identity pools. In an IAM policy, you can constrain permissions for identity pools based on specific tags or tag values.

You can use this action up to 5 times per second, per account. An identity pool can have as many as 50 tags.

Examples:

Request syntax with placeholder values


resp = client.tag_resource({
  resource_arn: "ARNString", # required
  tags: { # required
    "TagKeysType" => "TagValueType",
  },
})

Options Hash (options):

  • :resource_arn (required, String)

    The Amazon Resource Name (ARN) of the identity pool to assign the tags to.

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

    The tags to assign to the identity pool.

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:

#untag_resource(options = {}) ⇒ Struct

Removes the specified tags from an Amazon Cognito identity pool. You can use this action up to 5 times per second, per account

Examples:

Request syntax with placeholder values


resp = client.untag_resource({
  resource_arn: "ARNString", # required
  tag_keys: ["TagKeysType"], # required
})

Options Hash (options):

  • :resource_arn (required, String)

    The Amazon Resource Name (ARN) of the identity pool that the tags are assigned to.

  • :tag_keys (required, Array<String>)

    The keys of the tags to remove from the user pool.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

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

Updates an identity 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
  allow_classic_flow: false,
  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"],
  identity_pool_tags: {
    "TagKeysType" => "TagValueType",
  },
})

Response structure


resp.identity_pool_id #=> String
resp.identity_pool_name #=> String
resp.allow_unauthenticated_identities #=> true/false
resp.allow_classic_flow #=> 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
resp.identity_pool_tags #=> Hash
resp.identity_pool_tags["TagKeysType"] #=> 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.

  • :allow_classic_flow (Boolean)

    Enables or disables the Basic (Classic) authentication flow. For more information, see Identity Pools (Federated Identities) Authentication Flow in the Amazon Cognito Developer Guide.

  • :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 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.

  • :identity_pool_tags (Hash<String,String>)

    The tags that are assigned to the identity pool. A tag is a label that you can apply to identity pools to categorize and manage them in different ways, such as by purpose, owner, environment, or other criteria.

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.