View a markdown version of this page

Utilizzo di ListDocuments con una CLI - AWS Systems Manager

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

Utilizzo di ListDocuments con una CLI

I seguenti esempi di codice mostrano come usare ListDocuments.

CLI
AWS CLI

Esempio 1: per elencare i documenti

L’esempio seguente list-documents elenca i documenti di proprietà dell’account richiedente contrassegnati con il tag personalizzato.

aws ssm list-documents \ --filters Key=Owner,Values=Self Key=tag:DocUse,Values=Testing

Output:

{ "DocumentIdentifiers": [ { "Name": "Example", "Owner": "29884EXAMPLE", "PlatformTypes": [ "Windows", "Linux" ], "DocumentVersion": "1", "DocumentType": "Automation", "SchemaVersion": "0.3", "DocumentFormat": "YAML", "Tags": [ { "Key": "DocUse", "Value": "Testing" } ] } ] }

Per ulteriori informazioni, consulta Documenti AWS Systems Manager nella Guida per l'utente di AWS Systems Manager.

Esempio 2: come elencare i documenti condivisi

Quanto segue list-documents l'esempio elenca i documenti condivisi, inclusi i documenti condivisi privati non di proprietà di AWS.

aws ssm list-documents \ --filters Key=Name,Values=sharedDocNamePrefix Key=Owner,Values=Private

Output:

{ "DocumentIdentifiers": [ { "Name": "Example", "Owner": "12345EXAMPLE", "PlatformTypes": [ "Windows", "Linux" ], "DocumentVersion": "1", "DocumentType": "Command", "SchemaVersion": "0.3", "DocumentFormat": "YAML", "Tags": [] } ] }

Per ulteriori informazioni, consulta Documenti di AWS Systems Manager nella Guida per l’utente di AWS Systems Manager.

  • Per i dettagli sull'API, consulta ListDocuments nel AWS CLI Riferimento al comando.

PowerShell
Strumenti per PowerShell V4

Esempio 1: elenca tutti i documenti di configurazione dell’account.

Get-SSMDocumentList

Output:

DocumentType : Command DocumentVersion : 1 Name : AWS-ApplyPatchBaseline Owner : Amazon PlatformTypes : {Windows} SchemaVersion : 1.2 DocumentType : Command DocumentVersion : 1 Name : AWS-ConfigureAWSPackage Owner : Amazon PlatformTypes : {Windows, Linux} SchemaVersion : 2.0 DocumentType : Command DocumentVersion : 1 Name : AWS-ConfigureCloudWatch Owner : Amazon PlatformTypes : {Windows} SchemaVersion : 1.2 ...

Esempio 2: questo esempio recupera tutti i documenti di automazione il cui nome corrisponde a “Piattaforma”

Get-SSMDocumentList -DocumentFilterList @{Key="DocumentType";Value="Automation"} | Where-Object Name -Match "Platform"

Output:

DocumentFormat : JSON DocumentType : Automation DocumentVersion : 7 Name : KT-Get-Platform Owner : 987654123456 PlatformTypes : {Windows, Linux} SchemaVersion : 0.3 Tags : {} TargetType : VersionName :
  • Per i dettagli sull'API, vedi ListDocuments nel AWS Strumenti per PowerShell Riferimento al cmdlet (V4).

Strumenti per PowerShell V5

Esempio 1: elenca tutti i documenti di configurazione dell’account.

Get-SSMDocumentList

Output:

DocumentType : Command DocumentVersion : 1 Name : AWS-ApplyPatchBaseline Owner : Amazon PlatformTypes : {Windows} SchemaVersion : 1.2 DocumentType : Command DocumentVersion : 1 Name : AWS-ConfigureAWSPackage Owner : Amazon PlatformTypes : {Windows, Linux} SchemaVersion : 2.0 DocumentType : Command DocumentVersion : 1 Name : AWS-ConfigureCloudWatch Owner : Amazon PlatformTypes : {Windows} SchemaVersion : 1.2 ...

Esempio 2: questo esempio recupera tutti i documenti di automazione il cui nome corrisponde a “Piattaforma”

Get-SSMDocumentList -DocumentFilterList @{Key="DocumentType";Value="Automation"} | Where-Object Name -Match "Platform"

Output:

DocumentFormat : JSON DocumentType : Automation DocumentVersion : 7 Name : KT-Get-Platform Owner : 987654123456 PlatformTypes : {Windows, Linux} SchemaVersion : 0.3 Tags : {} TargetType : VersionName :
  • Per i dettagli sull'API, vedi ListDocuments nel AWS Strumenti per PowerShell Riferimento al cmdlet (V5).

Per un elenco completo di AWS Guide per sviluppatori SDK ed esempi di codice, consulta L'utilizzo di questo servizio con un AWS SDK. Questo argomento include anche informazioni su come iniziare e dettagli sulle versioni precedenti dell’SDK.