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

Class: Aws::CognitoIdentity::Client

Inherits:
Seahorse::Client::Base show all
Includes:
Aws::ClientStubs
Defined in:
gems/aws-sdk-cognitoidentity/lib/aws-sdk-cognitoidentity/client.rb

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Base

#config, #handlers

API Operations collapse

Instance Method Summary collapse

Methods included from Aws::ClientStubs

#api_requests, #stub_data, #stub_responses

Methods inherited from Seahorse::Client::Base

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

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Constructor Details

#initialize(options) ⇒ Client

Returns a new instance of Client

Parameters:

  • options (Hash)

Options Hash (options):

  • :credentials (required, Aws::CredentialProvider)

    Your AWS credentials. This can be an instance of any one of the following classes:

    • Aws::Credentials - Used for configuring static, non-refreshing credentials.

    • Aws::InstanceProfileCredentials - Used for loading credentials from an EC2 IMDS on an EC2 instance.

    • Aws::SharedCredentials - Used for loading credentials from a shared file, such as ~/.aws/config.

    • Aws::AssumeRoleCredentials - Used when you need to assume a role.

    When :credentials are not configured directly, the following locations will be searched for credentials:

    • Aws.config[:credentials]
    • The :access_key_id, :secret_access_key, and :session_token options.
    • ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
    • ~/.aws/credentials
    • ~/.aws/config
    • EC2 IMDS instance profile - When used by default, the timeouts are very aggressive. Construct and pass an instance of Aws::InstanceProfileCredentails to enable retries and extended timeouts.
  • :region (required, String)

    The AWS region to connect to. The configured :region is used to determine the service :endpoint. When not passed, a default :region is search for in the following locations:

    • Aws.config[:region]
    • ENV['AWS_REGION']
    • ENV['AMAZON_REGION']
    • ENV['AWS_DEFAULT_REGION']
    • ~/.aws/credentials
    • ~/.aws/config
  • :access_key_id (String)
  • :active_endpoint_cache (Boolean) — default: false

    When set to true, a thread polling for endpoints will be running in the background every 60 secs (default). Defaults to false.

  • :client_side_monitoring (Boolean) — default: false

    When true, client-side metrics will be collected for all API requests from this client.

  • :client_side_monitoring_client_id (String) — default: ""

    Allows you to provide an identifier for this client which will be attached to all generated client side metrics. Defaults to an empty string.

  • :client_side_monitoring_host (String) — default: "127.0.0.1"

    Allows you to specify the DNS hostname or IPv4 or IPv6 address that the client side monitoring agent is running on, where client metrics will be published via UDP.

  • :client_side_monitoring_port (Integer) — default: 31000

    Required for publishing client metrics. The port that the client side monitoring agent is running on, where client metrics will be published via UDP.

  • :client_side_monitoring_publisher (Aws::ClientSideMonitoring::Publisher) — default: Aws::ClientSideMonitoring::Publisher

    Allows you to provide a custom client-side monitoring publisher class. By default, will use the Client Side Monitoring Agent Publisher.

  • :convert_params (Boolean) — default: true

    When true, an attempt is made to coerce request parameters into the required types.

  • :disable_host_prefix_injection (Boolean) — default: false

    Set to true to disable SDK automatically adding host prefix to default service endpoint when available.

  • :endpoint (String)

    The client endpoint is normally constructed from the :region option. You should only configure an :endpoint when connecting to test endpoints. This should be avalid HTTP(S) URI.

  • :endpoint_cache_max_entries (Integer) — default: 1000

    Used for the maximum size limit of the LRU cache storing endpoints data for endpoint discovery enabled operations. Defaults to 1000.

  • :endpoint_cache_max_threads (Integer) — default: 10

    Used for the maximum threads in use for polling endpoints to be cached, defaults to 10.

  • :endpoint_cache_poll_interval (Integer) — default: 60

    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.

  • :endpoint_discovery (Boolean) — default: false

    When set to true, endpoint discovery will be enabled for operations when available. Defaults to false.

  • :log_formatter (Aws::Log::Formatter) — default: Aws::Log::Formatter.default

    The log formatter.

  • :log_level (Symbol) — default: :info

    The log level to send messages to the :logger at.

  • :logger (Logger)

    The Logger instance to send log messages to. If this option is not set, logging will be disabled.

  • :profile (String) — default: "default"

    Used when loading credentials from the shared credentials file at HOME/.aws/credentials. When not specified, 'default' is used.

  • :retry_base_delay (Float) — default: 0.3

    The base delay in seconds used by the default backoff function.

  • :retry_jitter (Symbol) — default: :none

    A delay randomiser function used by the default backoff function. Some predefined functions can be referenced by name - :none, :equal, :full, otherwise a Proc that takes and returns a number.

    @see https://www.awsarchitectureblog.com/2015/03/backoff.html

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

  • :retry_max_delay (Integer) — default: 0

    The maximum number of seconds to delay between retries (0 for no limit) used by the default backoff function.

  • :secret_access_key (String)
  • :session_token (String)
  • :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.

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

  • :validate_params (Boolean) — default: true

    When true, request parameters are validated before sending the request.

  • :http_proxy (URI::HTTP, String)

    A proxy to send requests through. Formatted like 'http://proxy.com:123'.

  • :http_open_timeout (Float) — default: 15

    The number of seconds to wait when opening a HTTP session before rasing a Timeout::Error.

  • :http_read_timeout (Integer) — default: 60

    The default number of seconds to wait for response data. This value can safely be set per-request on the session yeidled by #session_for.

  • :http_idle_timeout (Float) — default: 5

    The number of seconds a connection is allowed to sit idble before it is considered stale. Stale connections are closed and removed from the pool before making a request.

  • :http_continue_timeout (Float) — default: 1

    The number of seconds to wait for a 100-continue response before sending the request body. This option has no effect unless the request has "Expect" header set to "100-continue". Defaults to nil which disables this behaviour. This value can safely be set per request on the session yeidled by #session_for.

  • :http_wire_trace (Boolean) — default: false

    When true, HTTP debug output will be sent to the :logger.

  • :ssl_verify_peer (Boolean) — default: true

    When true, SSL peer certificates are verified when establishing a connection.

  • :ssl_ca_bundle (String)

    Full path to the SSL certificate authority bundle file that should be used when verifying peer certificates. If you do not pass :ssl_ca_bundle or :ssl_ca_directory the the system default will be used if available.

  • :ssl_ca_directory (String)

    Full path of the directory that contains the unbundled SSL certificate authority files for verifying peer certificates. If you do not pass :ssl_ca_bundle or :ssl_ca_directory the the system default will be used if available.



261
262
263
# File 'gems/aws-sdk-cognitoidentity/lib/aws-sdk-cognitoidentity/client.rb', line 261

def initialize(*args)
  super
end

Instance Method Details

#create_identity_pool(params = {}) ⇒ 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"],
  identity_pool_tags: {
    "TagKeysType" => "TagValueType",
  },
})

Response structure


resp.identity_pool_id #=> String
resp.identity_pool_name #=> String
resp.allow_unauthenticated_identities #=> Boolean
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 #=> Boolean
resp.saml_provider_arns #=> Array
resp.saml_provider_arns[0] #=> String
resp.identity_pool_tags #=> Hash
resp.identity_pool_tags["TagKeysType"] #=> String

Parameters:

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

    ({})

Options Hash (params):

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



376
377
378
379
# File 'gems/aws-sdk-cognitoidentity/lib/aws-sdk-cognitoidentity/client.rb', line 376

def create_identity_pool(params = {}, options = {})
  req = build_request(:create_identity_pool, params)
  req.send_request(options)
end

#delete_identities(params = {}) ⇒ 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"

Parameters:

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

    ({})

Options Hash (params):

  • :identity_ids_to_delete (required, Array<String>)

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

Returns:

See Also:



409
410
411
412
# File 'gems/aws-sdk-cognitoidentity/lib/aws-sdk-cognitoidentity/client.rb', line 409

def delete_identities(params = {}, options = {})
  req = build_request(:delete_identities, params)
  req.send_request(options)
end

#delete_identity_pool(params = {}) ⇒ 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
})

Parameters:

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

    ({})

Options Hash (params):

  • :identity_pool_id (required, String)

    An identity pool ID in the format REGION:GUID.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



434
435
436
437
# File 'gems/aws-sdk-cognitoidentity/lib/aws-sdk-cognitoidentity/client.rb', line 434

def delete_identity_pool(params = {}, options = {})
  req = build_request(:delete_identity_pool, params)
  req.send_request(options)
end

#describe_identity(params = {}) ⇒ 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

Parameters:

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

    ({})

Options Hash (params):

  • :identity_id (required, String)

    A unique identifier in the format REGION:GUID.

Returns:

See Also:



472
473
474
475
# File 'gems/aws-sdk-cognitoidentity/lib/aws-sdk-cognitoidentity/client.rb', line 472

def describe_identity(params = {}, options = {})
  req = build_request(:describe_identity, params)
  req.send_request(options)
end

#describe_identity_pool(params = {}) ⇒ 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 #=> Boolean
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 #=> Boolean
resp.saml_provider_arns #=> Array
resp.saml_provider_arns[0] #=> String
resp.identity_pool_tags #=> Hash
resp.identity_pool_tags["TagKeysType"] #=> String

Parameters:

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

    ({})

Options Hash (params):

  • :identity_pool_id (required, String)

    An identity pool ID in the format REGION:GUID.

Returns:

See Also:



526
527
528
529
# File 'gems/aws-sdk-cognitoidentity/lib/aws-sdk-cognitoidentity/client.rb', line 526

def describe_identity_pool(params = {}, options = {})
  req = build_request(:describe_identity_pool, params)
  req.send_request(options)
end

#get_credentials_for_identity(params = {}) ⇒ 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

Parameters:

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

    ({})

Options Hash (params):

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



592
593
594
595
# File 'gems/aws-sdk-cognitoidentity/lib/aws-sdk-cognitoidentity/client.rb', line 592

def get_credentials_for_identity(params = {}, options = {})
  req = build_request(:get_credentials_for_identity, params)
  req.send_request(options)
end

#get_id(params = {}) ⇒ 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

Parameters:

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

    ({})

Options Hash (params):

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



649
650
651
652
# File 'gems/aws-sdk-cognitoidentity/lib/aws-sdk-cognitoidentity/client.rb', line 649

def get_id(params = {}, options = {})
  req = build_request(:get_id, params)
  req.send_request(options)
end

#get_identity_pool_roles(params = {}) ⇒ 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

Parameters:

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

    ({})

Options Hash (params):

  • :identity_pool_id (required, String)

    An identity pool ID in the format REGION:GUID.

Returns:

See Also:



691
692
693
694
# File 'gems/aws-sdk-cognitoidentity/lib/aws-sdk-cognitoidentity/client.rb', line 691

def get_identity_pool_roles(params = {}, options = {})
  req = build_request(:get_identity_pool_roles, params)
  req.send_request(options)
end

#get_open_id_token(params = {}) ⇒ 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

Parameters:

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

    ({})

Options Hash (params):

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



738
739
740
741
# File 'gems/aws-sdk-cognitoidentity/lib/aws-sdk-cognitoidentity/client.rb', line 738

def get_open_id_token(params = {}, options = {})
  req = build_request(:get_open_id_token, params)
  req.send_request(options)
end

#get_open_id_token_for_developer_identity(params = {}) ⇒ 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

Parameters:

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

    ({})

Options Hash (params):

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



815
816
817
818
# File 'gems/aws-sdk-cognitoidentity/lib/aws-sdk-cognitoidentity/client.rb', line 815

def get_open_id_token_for_developer_identity(params = {}, options = {})
  req = build_request(:get_open_id_token_for_developer_identity, params)
  req.send_request(options)
end

#list_identities(params = {}) ⇒ 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

Parameters:

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

    ({})

Options Hash (params):

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



868
869
870
871
# File 'gems/aws-sdk-cognitoidentity/lib/aws-sdk-cognitoidentity/client.rb', line 868

def list_identities(params = {}, options = {})
  req = build_request(:list_identities, params)
  req.send_request(options)
end

#list_identity_pools(params = {}) ⇒ 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

Parameters:

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

    ({})

Options Hash (params):

  • :max_results (required, Integer)

    The maximum number of identities to return.

  • :next_token (String)

    A pagination token.

Returns:

See Also:



906
907
908
909
# File 'gems/aws-sdk-cognitoidentity/lib/aws-sdk-cognitoidentity/client.rb', line 906

def list_identity_pools(params = {}, options = {})
  req = build_request(:list_identity_pools, params)
  req.send_request(options)
end

#list_tags_for_resource(params = {}) ⇒ 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

Parameters:

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

    ({})

Options Hash (params):

  • :resource_arn (required, String)

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

Returns:

See Also:



942
943
944
945
# File 'gems/aws-sdk-cognitoidentity/lib/aws-sdk-cognitoidentity/client.rb', line 942

def list_tags_for_resource(params = {}, options = {})
  req = build_request(:list_tags_for_resource, params)
  req.send_request(options)
end

#lookup_developer_identity(params = {}) ⇒ 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

Parameters:

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

    ({})

Options Hash (params):

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



1017
1018
1019
1020
# File 'gems/aws-sdk-cognitoidentity/lib/aws-sdk-cognitoidentity/client.rb', line 1017

def lookup_developer_identity(params = {}, options = {})
  req = build_request(:lookup_developer_identity, params)
  req.send_request(options)
end

#merge_developer_identities(params = {}) ⇒ 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

Parameters:

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

    ({})

Options Hash (params):

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



1079
1080
1081
1082
# File 'gems/aws-sdk-cognitoidentity/lib/aws-sdk-cognitoidentity/client.rb', line 1079

def merge_developer_identities(params = {}, options = {})
  req = build_request(:merge_developer_identities, params)
  req.send_request(options)
end

#set_identity_pool_roles(params = {}) ⇒ 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
          },
        ],
      },
    },
  },
})

Parameters:

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

    ({})

Options Hash (params):

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



1136
1137
1138
1139
# File 'gems/aws-sdk-cognitoidentity/lib/aws-sdk-cognitoidentity/client.rb', line 1136

def set_identity_pool_roles(params = {}, options = {})
  req = build_request(:set_identity_pool_roles, params)
  req.send_request(options)
end

#tag_resource(params = {}) ⇒ 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: {
    "TagKeysType" => "TagValueType",
  },
})

Parameters:

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

    ({})

Options Hash (params):

  • :resource_arn (required, String)

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

  • :tags (Hash<String,String>)

    The tags to assign to the identity pool.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1184
1185
1186
1187
# File 'gems/aws-sdk-cognitoidentity/lib/aws-sdk-cognitoidentity/client.rb', line 1184

def tag_resource(params = {}, options = {})
  req = build_request(:tag_resource, params)
  req.send_request(options)
end

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
})

Parameters:

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

    ({})

Options Hash (params):

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



1225
1226
1227
1228
# File 'gems/aws-sdk-cognitoidentity/lib/aws-sdk-cognitoidentity/client.rb', line 1225

def unlink_developer_identity(params = {}, options = {})
  req = build_request(:unlink_developer_identity, params)
  req.send_request(options)
end

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
})

Parameters:

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

    ({})

Options Hash (params):

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



1263
1264
1265
1266
# File 'gems/aws-sdk-cognitoidentity/lib/aws-sdk-cognitoidentity/client.rb', line 1263

def unlink_identity(params = {}, options = {})
  req = build_request(:unlink_identity, params)
  req.send_request(options)
end

#untag_resource(params = {}) ⇒ 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"],
})

Parameters:

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

    ({})

Options Hash (params):

  • :resource_arn (required, String)

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

  • :tag_keys (Array<String>)

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

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1291
1292
1293
1294
# File 'gems/aws-sdk-cognitoidentity/lib/aws-sdk-cognitoidentity/client.rb', line 1291

def untag_resource(params = {}, options = {})
  req = build_request(:untag_resource, params)
  req.send_request(options)
end

#update_identity_pool(params = {}) ⇒ 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
  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 #=> Boolean
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 #=> Boolean
resp.saml_provider_arns #=> Array
resp.saml_provider_arns[0] #=> String
resp.identity_pool_tags #=> Hash
resp.identity_pool_tags["TagKeysType"] #=> String

Parameters:

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

    ({})

Options Hash (params):

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



1390
1391
1392
1393
# File 'gems/aws-sdk-cognitoidentity/lib/aws-sdk-cognitoidentity/client.rb', line 1390

def update_identity_pool(params = {}, options = {})
  req = build_request(:update_identity_pool, params)
  req.send_request(options)
end