

文档 AWS SDK 示例 GitHub 存储库中还有更多 [S AWS DK 示例](https://github.com/awsdocs/aws-doc-sdk-examples)。

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 将 `DescribeDocumentPermission` 与 CLI 配合使用
<a name="ssm_example_ssm_DescribeDocumentPermission_section"></a>

以下代码示例演示如何使用 `DescribeDocumentPermission`。

------
#### [ CLI ]

**AWS CLI**  
**描述文档权限**  
以下 `describe-document-permission` 示例显示有关公开共享 Systems Manager 文档的权限详细信息。  

```
aws ssm describe-document-permission \
    --name {{"Example"}} \
    --permission-type {{"Share"}}
```
输出：  

```
{
    "AccountIds": [
        "all"
    ],
    "AccountSharingInfoList": [
        {
            "AccountId": "all",
            "SharedDocumentVersion": "$DEFAULT"
        }
    ]
}
```
有关更多信息，请参阅《AWS Systems Manager 用户指南》**中的[共享 Systems Manager 文档](https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-how-to-share.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DescribeDocumentPermission](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ssm/describe-document-permission.html)*中的。

------
#### [ PowerShell ]

**适用于 PowerShell V4 的工具**  
**示例 1：此示例列出文档的所有版本。**  

```
Get-SSMDocumentVersionList -Name "RunShellScript"
```
**输出**：  

```
CreatedDate          DocumentVersion IsDefaultVersion Name
-----------          --------------- ---------------- ----
2/24/2017 5:25:13 AM 1               True             RunShellScript
```
+  有关 API 的详细信息，请参阅 *AWS Tools for PowerShell Cmdlet 参考 (V* 4) [DescribeDocumentPermission](https://docs.aws.amazon.com/powershell/v4/reference)中的。

**适用于 PowerShell V5 的工具**  
**示例 1：此示例列出文档的所有版本。**  

```
Get-SSMDocumentVersionList -Name "RunShellScript"
```
**输出**：  

```
CreatedDate          DocumentVersion IsDefaultVersion Name
-----------          --------------- ---------------- ----
2/24/2017 5:25:13 AM 1               True             RunShellScript
```
+  有关 API 的详细信息，请参阅 *AWS Tools for PowerShell Cmdlet 参考 (V* 5) [DescribeDocumentPermission](https://docs.aws.amazon.com/powershell/v5/reference)中的。

------