Ada lebih banyak AWS SDK contoh yang tersedia di GitHub repo SDKContoh AWS Dokumen
Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
Gunakan GetRepository
dengan AWS SDK atau CLI
Contoh kode berikut menunjukkan cara menggunakanGetRepository
.
- CLI
-
- AWS CLI
-
Untuk mendapatkan informasi tentang repositori
Contoh ini menunjukkan rincian tentang AWS CodeCommit repositori.
aws codecommit get-repository \ --repository-name
MyDemoRepo
Output:
{ "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" } }
-
Untuk API detailnya, lihat GetRepository
di Referensi AWS CLI Perintah.
-
- PowerShell
-
- Alat untuk PowerShell
-
Contoh 1: Contoh ini mendapatkan informasi untuk repositori yang ditentukan.
Get-CCRepository -RepositoryName MyDemoRepo
Output:
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
-
Untuk API detailnya, lihat GetRepositorydi AWS Tools for PowerShell Referensi Cmdlet.
-
GetBranch
ListBranches