View a markdown version of this page

Gunakan ListDocuments dengan CLI - AWS Systems Manager

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

Gunakan ListDocuments dengan CLI

Contoh kode berikut menunjukkan cara menggunakan ListDocuments.

CLI
AWS CLI

Contoh 1: Untuk membuat daftar dokumen

Berikut ini list-documents contoh mencantumkan dokumen yang dimiliki oleh akun yang meminta yang ditandai dengan tag kustom.

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" } ] } ] }

Untuk informasi lebih lanjut, lihat AWS Dokumen Manajer Sistem di AWS Panduan Pengguna Manajer Sistem.

Contoh 2: Untuk membuat daftar dokumen bersama

Berikut ini list-documents contoh daftar dokumen bersama, termasuk dokumen bersama pribadi yang tidak dimiliki oleh 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": [] } ] }

Untuk informasi lebih lanjut, lihat AWS Dokumen Manajer Sistem di AWS Panduan Pengguna Manajer Sistem.

  • Untuk detail API, lihat ListDocuments di AWS CLI Referensi Perintah.

PowerShell
Alat untuk PowerShell V4

Contoh 1: Mencantumkan semua dokumen konfigurasi di akun Anda.

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 ...

Contoh 2: Contoh ini mengambil semua dokumen otomatisasi dengan nama matchingi 'Platform'

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 :
  • Untuk detail API, lihat ListDocuments di Alat AWS untuk PowerShell Referensi Cmdlet (V4).

Alat untuk PowerShell V5

Contoh 1: Mencantumkan semua dokumen konfigurasi di akun Anda.

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 ...

Contoh 2: Contoh ini mengambil semua dokumen otomatisasi dengan nama matchingi 'Platform'

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 :
  • Untuk detail API, lihat ListDocuments di Alat AWS untuk PowerShell Referensi Cmdlet (V5).

Untuk daftar lengkap AWS Panduan pengembang SDK dan contoh kode, lihat Menggunakan layanan ini dengan AWS SDK. Topik ini juga mencakup informasi tentang memulai dan detail tentang versi SDK sebelumnya.