

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 檢視 Amazon S3 Storage Lens 儀表板組態詳細資訊
<a name="storage_lens_viewing"></a>

您可以從 Amazon S3 主控台 AWS CLI和適用於 Java 的 SDK 檢視 Amazon S3 Storage Lens 儀表板。

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

**Example**  
下列範例會擷取 S3 Storage Lens 組態，以便您檢視組態詳細資訊。若要使用這些範例，請以您自己的資訊取代 `user input placeholders`。  

```
aws s3control get-storage-lens-configuration --account-id=222222222222 --config-id=your-configuration-id --region=us-east-1
```

## 使用適用於 Java 的 AWS 開發套件
<a name="S3GetStorageLensConfigurationJava"></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.GetStorageLensConfigurationRequest;
import com.amazonaws.services.s3control.model.GetStorageLensConfigurationResult;
import com.amazonaws.services.s3control.model.StorageLensConfiguration;

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

public class GetDashboard {

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

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

            final StorageLensConfiguration configuration =
                    s3ControlClient.getStorageLensConfiguration(new GetStorageLensConfigurationRequest()
                            .withAccountId(sourceAccountId)
                            .withConfigId(configurationId)
                    ).getStorageLensConfiguration();

            System.out.println(configuration.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();
        }
    }
}
```