

# 列出 Amazon S3 Storage Lens 存储统计管理工具控制面板
<a name="storage_lens_list_dashboard"></a>

 

## 使用 Amazon CLI
<a name="S3ListStorageLensConfigurationsCLI"></a>

**Example**  
以下示例命令列出了 Amazon Web Services 账户中的 S3 Storage Lens 存储统计管理工具控制面板。要使用这些示例，请将 `{{user input placeholders}}` 替换为您自己的信息。  

```
aws s3control list-storage-lens-configurations --account-id={{222222222222}} --region={{us-east-1}} --next-token={{abcdefghij1234}}
```

**Example**  
以下示例列出了没有下一个令牌的 S3 Storage Lens 存储统计管理工具配置。要使用这些示例，请将 `{{user input placeholders}}` 替换为您自己的信息。  

```
aws s3control list-storage-lens-configurations --account-id={{222222222222}} --region={{us-east-1}}
```

## 使用适用于 Java 的 Amazon SDK
<a name="S3ListStorageLensConfigurationsJava"></a>

**Example – 列出 S3 Storage Lens 存储统计管理工具控制面板配置**  
以下示例显示了如何在适用于 Java 的 SDK 中列出 S3 Storage Lens 存储统计管理工具配置。要使用此示例，请将每个示例描述中的 `{{user input placeholders}}` 替换为 您自己的信息。  

```
package aws.example.s3control;

import com.amazonaws.AmazonServiceException;
import com.amazonaws.SdkClientException;
import com.amazonaws.auth.profile.ProfileCredentialsProvider;
import com.amazonaws.services.s3control.AWSS3Control;
import com.amazonaws.services.s3control.AWSS3ControlClient;
import com.amazonaws.services.s3control.model.ListStorageLensConfigurationEntry;
import com.amazonaws.services.s3control.model.ListStorageLensConfigurationsRequest;

import java.util.List;

import static com.amazonaws.regions.Regions.{{US_WEST_2}};

public class ListDashboard {

    public static void main(String[] args) {
        String sourceAccountId = "{{111122223333}}";
        String nextToken = "{{nextToken}}";

        try {
            AWSS3Control s3ControlClient = AWSS3ControlClient.builder()
                    .withCredentials(new ProfileCredentialsProvider())
                    .withRegion({{US_WEST_2}})
                    .build();

            final List<ListStorageLensConfigurationEntry> configurations =
                    s3ControlClient.listStorageLensConfigurations(new ListStorageLensConfigurationsRequest()
                            .withAccountId(sourceAccountId)
                            .withNextToken(nextToken)
                    ).getStorageLensConfigurationList();

            System.out.println(configurations.toString());
        } catch (AmazonServiceException e) {
            // The call was transmitted successfully, but Amazon S3 couldn't process
            // it and returned an error response.
            e.printStackTrace();
        } catch (SdkClientException e) {
            // Amazon S3 couldn't be contacted for a response, or the client
            // couldn't parse the response from Amazon S3.
            e.printStackTrace();
        }
    }
}
```