AWS 文档 AWS SDK示例 GitHub 存储库中还有更多SDK示例
本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
与 AWS SDK或ListApplicationRevisions
一起使用 CLI
以下代码示例演示如何使用 ListApplicationRevisions
。
- CLI
-
- AWS CLI
-
获取有关应用程序修订的信息
以下
list-application-revisions
示例显示与指定应用程序关联的所有应用程序修订版的相关信息。aws deploy list-application-revisions \ --application-name
WordPress_App
\ --s-3-bucketCodeDeployDemoBucket
\ --deployedexclude
\ --s-3-key-prefixWordPress_
\ --sort-bylastUsedTime
\ --sort-orderdescending
输出:
{ "revisions": [ { "revisionType": "S3", "s3Location": { "version": "uTecLusvCB_JqHFXtfUcyfV8bEXAMPLE", "bucket": "CodeDeployDemoBucket", "key": "WordPress_App.zip", "bundleType": "zip" } }, { "revisionType": "S3", "s3Location": { "version": "tMk.UxgDpMEVb7V187ZM6wVAWEXAMPLE", "bucket": "CodeDeployDemoBucket", "key": "WordPress_App_2-0.zip", "bundleType": "zip" } } ] }
-
有关API详细信息,请参阅 “ListApplicationRevisions AWS CLI
命令参考”。
-
- PowerShell
-
- 用于 PowerShell
-
示例 1:此示例获取有关指定应用程序可用修订版的信息。
ForEach ($revision in (Get-CDApplicationRevisionList -ApplicationName CodeDeployDemoApplication -Deployed Ignore)) { >> If ($revision.RevisionType -Eq "S3") { >> Write-Output ("Type = S3, Bucket = " + $revision.S3Location.Bucket + ", BundleType = " + $revision.S3Location.BundleType + ", ETag = " + $revision.S3Location.ETag + ", Key = " + $revision.S3Location.Key) >> } >> If ($revision.RevisionType -Eq "GitHub") { >> Write-Output ("Type = GitHub, CommitId = " + $revision.GitHubLocation.CommitId + ", Repository = " + $revision.GitHubLocation.Repository) >> } >> } >>
输出:
Type = S3, Bucket = MyBucket, BundleType = zip, ETag = 4565c1ac97187f190c1a90265EXAMPLE, Key = 5xd27EX.zip Type = GitHub, CommitId = f48933c3...76405362, Repository = MyGitHubUser/CodeDeployDemoRepo
-
有关API详细信息,请参阅 AWS Tools for PowerShell Cmdlet 参考ListApplicationRevisions中的。
-
GetOnPremisesInstance
ListApplications