

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

# SDK を使用した Amazon Cognito Sync のコード例 AWS SDKs
<a name="service_code_examples_cognito-sync"></a>

次のコード例は、 AWS Software Development Kit (SDK) で Amazon Cognito Sync を使用する方法を示しています。

*アクション*はより大きなプログラムからのコードの抜粋であり、コンテキスト内で実行する必要があります。アクションは個々のサービス機能を呼び出す方法を示していますが、コンテキスト内のアクションは、関連するシナリオで確認できます。

 AWS SDK 開発者ガイドとコード例の完全なリストについては、「」を参照してください[AWS SDK でのこのサービスの使用](sdk-general-information-section.md)。このトピックには、使用開始方法に関する情報と、以前の SDK バージョンの詳細も含まれています。

**Contents**
+ [基本](service_code_examples_cognito-sync_basics.md)
  + [アクション](service_code_examples_cognito-sync_actions.md)
    + [`ListIdentityPoolUsage`](cognito-sync_example_cognito-sync_ListIdentityPoolUsage_section.md)

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

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

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

# SDK を使用した Amazon Cognito Sync のアクション AWS SDKs
<a name="service_code_examples_cognito-sync_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)」を参照してください。

------

 AWS SDK 開発者ガイドとコード例の完全なリストについては、「」を参照してください[AWS SDK でのこのサービスの使用](sdk-general-information-section.md)。このトピックには、使用開始方法に関する情報と、以前の SDK バージョンの詳細も含まれています。