AWS文件開發套件範例
搭配使用 GetRepository 與 CLI
下列程式碼範例示範如何使用 GetRepository。
- CLI
-
- AWS CLI
-
取得儲存庫的相關資訊
此範例顯示 AWS CodeCommit 儲存庫的相關詳細資訊。
aws codecommit get-repository \ --repository-nameMyDemoRepo輸出:
{ "repositoryMetadata": { "creationDate": 1429203623.625, "defaultBranch": "main", "repositoryName": "MyDemoRepo", "cloneUrlSsh": "ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/v1/repos/MyDemoRepo", "lastModifiedDate": 1430783812.0869999, "repositoryDescription": "My demonstration repository", "cloneUrlHttp": "https://codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo", "repositoryId": "f7579e13-b83e-4027-aaef-650c0EXAMPLE", "Arn": "arn:aws:codecommit:us-east-1:80398EXAMPLE:MyDemoRepo "accountId": "111111111111" } }-
如需 API 詳細資訊,請參閱《AWS CLI 命令參考》中的 GetRepository
。
-
- PowerShell
-
- Tools for PowerShell V4
-
範例 1:此範例會取得指定儲存庫的資訊。
Get-CCRepository -RepositoryName MyDemoRepo輸出:
AccountId : 80398EXAMPLE Arn : arn:aws:codecommit:us-east-1:80398EXAMPLE:MyDemoRepo CloneUrlHttp : https://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo CloneUrlSsh : ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo CreationDate : 9/8/2015 3:21:33 PM DefaultBranch : LastModifiedDate : 9/8/2015 3:21:33 PM RepositoryDescription : This is a repository for demonstration purposes. RepositoryId : c7d0d2b0-ce40-4303-b4c3-38529EXAMPLE RepositoryName : MyDemoRepo-
如需 API 詳細資訊,請參閱《AWS Tools for PowerShell Cmdlet 參考 (V4)》中的 GetRepository。
-
- Tools for PowerShell V5
-
範例 1:此範例會取得指定儲存庫的資訊。
Get-CCRepository -RepositoryName MyDemoRepo輸出:
AccountId : 80398EXAMPLE Arn : arn:aws:codecommit:us-east-1:80398EXAMPLE:MyDemoRepo CloneUrlHttp : https://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo CloneUrlSsh : ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo CreationDate : 9/8/2015 3:21:33 PM DefaultBranch : LastModifiedDate : 9/8/2015 3:21:33 PM RepositoryDescription : This is a repository for demonstration purposes. RepositoryId : c7d0d2b0-ce40-4303-b4c3-38529EXAMPLE RepositoryName : MyDemoRepo-
如需 API 詳細資訊,請參閱《AWS Tools for PowerShell Cmdlet 參考 (V5)》中的 GetRepository。
-
GetBranch
ListBranches