

Doc AWS SDK Examples GitHub リポジトリには、他にも SDK の例があります。 [AWS](https://github.com/awsdocs/aws-doc-sdk-examples)

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# AWS SDKs を使用した Amazon Cognito Sync の基本的な例
<a name="cognito-sync_code_examples_basics"></a>

次のコード例では、Amazon Cognito Sync を AWS SDK と使用する基本的な方法を示しています。

**Contents**
+ [アクション](cognito-sync_code_examples_actions.md)
  + [`ListIdentityPoolUsage`](cognito-sync_example_cognito-sync_ListIdentityPoolUsage_section.md)

# SDK を使用した Amazon Cognito Sync のアクション AWS SDKs
<a name="cognito-sync_code_examples_actions"></a>

次のコード例は、 AWS SDKs で個々の Amazon Cognito Sync アクションを実行する方法を示しています。それぞれの例には、GitHub へのリンクがあり、そこにはコードの設定と実行に関する説明が記載されています。

 以下の例には、最も一般的に使用されるアクションのみ含まれています。詳細なリストについては、[Amazon Cognito Sync API Reference](https://docs.aws.amazon.com/cognitosync/latest/APIReference/Welcome.html) (Amazon Cognito Sync API リファレンス) を参照してください。

**Topics**
+ [`ListIdentityPoolUsage`](cognito-sync_example_cognito-sync_ListIdentityPoolUsage_section.md)

# AWS SDK `ListIdentityPoolUsage`で を使用する
<a name="cognito-sync_example_cognito-sync_ListIdentityPoolUsage_section"></a>

次の例は、`ListIdentityPoolUsage` を使用する方法を説明しています。

------
#### [ Rust ]

**SDK for Rust**  
 GitHub には、その他のリソースもあります。用例一覧を検索し、[AWS コード例リポジトリ](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/rustv1/examples/cognitosync#code-examples)での設定と実行の方法を確認してください。

```
async fn show_pools(client: &Client) -> Result<(), Error> {
    let response = client
        .list_identity_pool_usage()
        .max_results(10)
        .send()
        .await?;

    let pools = response.identity_pool_usages();
    println!("Identity pools:");

    for pool in pools {
        println!(
            "  Identity pool ID:    {}",
            pool.identity_pool_id().unwrap_or_default()
        );
        println!(
            "  Data storage:        {}",
            pool.data_storage().unwrap_or_default()
        );
        println!(
            "  Sync sessions count: {}",
            pool.sync_sessions_count().unwrap_or_default()
        );
        println!(
            "  Last modified:       {}",
            pool.last_modified_date().unwrap().to_chrono_utc()?
        );
        println!();
    }

    println!("Next token: {}", response.next_token().unwrap_or_default());

    Ok(())
}
```
+  API の詳細については、*AWS SDK for Rust API リファレンス*の「[ListIdentityPoolUsage](https://docs.rs/aws-sdk-cognitosync/latest/aws_sdk_cognitosync/client/struct.Client.html#method.list_identity_pool_usage)」を参照してください。

------