Weitere AWS-SDK-Beispiele sind im GitHub-Repository Beispiele für AWS Doc SDKs
Verwendung von ListDocuments mit einer CLI
Die folgenden Code-Beispiele zeigen, wie ListDocuments verwendet wird.
- CLI
-
- AWS CLI
-
Beispiel 1: Dokumente auflisten
Das folgende
list-documents-Beispiel listet Dokumente auf, die dem anfragenden Konto gehören und mit dem benutzerdefinierten Tag versehen sind.aws ssm list-documents \ --filtersKey=Owner,Values=SelfKey=tag:DocUse,Values=TestingAusgabe:
{ "DocumentIdentifiers": [ { "Name": "Example", "Owner": "29884EXAMPLE", "PlatformTypes": [ "Windows", "Linux" ], "DocumentVersion": "1", "DocumentType": "Automation", "SchemaVersion": "0.3", "DocumentFormat": "YAML", "Tags": [ { "Key": "DocUse", "Value": "Testing" } ] } ] }Weitere Informationen finden Sie unter AWS-Systems-Manager-Dokumenten im AWS-Systems-Manager-Benutzerhandbuch.
Beispiel 2: Geteilte Dokumente auflisten
Das folgende
list-documents-Beispiel listet gemeinsam genutzte Dokumente auf, einschließlich privater geteilter Dokumente, die nicht Eigentum von AWS sind.aws ssm list-documents \ --filtersKey=Name,Values=sharedDocNamePrefixKey=Owner,Values=PrivateAusgabe:
{ "DocumentIdentifiers": [ { "Name": "Example", "Owner": "12345EXAMPLE", "PlatformTypes": [ "Windows", "Linux" ], "DocumentVersion": "1", "DocumentType": "Command", "SchemaVersion": "0.3", "DocumentFormat": "YAML", "Tags": [] } ] }Weitere Informationen finden Sie unter AWS-Systems-Manager-Dokumenten im AWS-Systems-Manager-Benutzerhandbuch.
-
Weitere API-Informationen finden Sie unter ListDocuments
in der AWS CLI-Befehlsreferenz.
-
- PowerShell
-
- Tools für PowerShell V4
-
Beispiel 1: Listet alle Konfigurationsdokumente in Ihrem Konto auf.
Get-SSMDocumentListAusgabe:
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 ...Beispiel 2: In diesem Beispiel werden alle Automatisierungsdokumente abgerufen, deren Name mit „Platform“ übereinstimmt
Get-SSMDocumentList -DocumentFilterList @{Key="DocumentType";Value="Automation"} | Where-Object Name -Match "Platform"Ausgabe:
DocumentFormat : JSON DocumentType : Automation DocumentVersion : 7 Name : KT-Get-Platform Owner : 987654123456 PlatformTypes : {Windows, Linux} SchemaVersion : 0.3 Tags : {} TargetType : VersionName :-
Weitere API-Informationen finden Sie unter ListDocuments in der AWS -Tools für PowerShell-Cmdlet-Referenz (V4).
-
- Tools für PowerShell V5
-
Beispiel 1: Listet alle Konfigurationsdokumente in Ihrem Konto auf.
Get-SSMDocumentListAusgabe:
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 ...Beispiel 2: In diesem Beispiel werden alle Automatisierungsdokumente abgerufen, deren Name mit „Platform“ übereinstimmt
Get-SSMDocumentList -DocumentFilterList @{Key="DocumentType";Value="Automation"} | Where-Object Name -Match "Platform"Ausgabe:
DocumentFormat : JSON DocumentType : Automation DocumentVersion : 7 Name : KT-Get-Platform Owner : 987654123456 PlatformTypes : {Windows, Linux} SchemaVersion : 0.3 Tags : {} TargetType : VersionName :-
Weitere API-Informationen finden Sie unter ListDocuments in der AWS -Tools für PowerShell-Cmdlet-Referenz (V5).
-