Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
AWS CodeStar contoh menggunakan AWS CLI
Contoh kode berikut menunjukkan cara melakukan tindakan dan mengimplementasikan skenario umum dengan menggunakan AWS Command Line Interface with AWS CodeStar.
Tindakan adalah kutipan kode dari program yang lebih besar dan harus dijalankan dalam konteks. Sementara tindakan menunjukkan cara memanggil fungsi layanan individual, Anda dapat melihat tindakan dalam konteks dalam skenario terkait.
Setiap contoh menyertakan tautan ke kode sumber lengkap, di mana Anda dapat menemukan instruksi tentang cara mengatur dan menjalankan kode dalam konteks.
Topik
Tindakan
Contoh kode berikut menunjukkan cara menggunakanassociate-team-member
.
- AWS CLI
-
Untuk menambahkan anggota tim ke proyek
associate-team-member
Contoh berikut membuatintern
pengguna penampil pada proyek dengan ID yang ditentukan.aws codestar associate-team-member \ --project-id
my-project
\ --user-arnarn:aws:iam::123456789012:user/intern
\ --project-roleViewer
Perintah ini tidak menghasilkan output.
-
Untuk API detailnya, lihat AssociateTeamMember
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-project
.
- AWS CLI
-
Untuk membuat proyek
create-project
Contoh berikut menggunakan file JSON input untuk membuat CodeStar proyek.aws codestar create-project \ --cli-input-json
file://create-project.json
Isi dari
create-project.json
:{ "name": "Custom Project", "id": "custom-project", "sourceCode": [ { "source": { "s3": { "bucketName": "codestar-artifacts", "bucketKey": "nodejs-function.zip" } }, "destination": { "codeCommit": { "name": "codestar-custom-project" } } } ], "toolchain": { "source": { "s3": { "bucketName": "codestar-artifacts", "bucketKey": "toolchain.yml" } }, "roleArn": "arn:aws:iam::123456789012:role/service-role/aws-codestar-service-role", "stackParameters": { "ProjectId": "custom-project" } } }
Output:
{ "id": "my-project", "arn": "arn:aws:codestar:us-east-2:123456789012:project/custom-project" }
Untuk tutorial yang menyertakan contoh kode dan template untuk proyek kustom, lihat Membuat Proyek AWS CodeStar dengan AWS CLI < https://docs.aws.amazon.com/codestar/ latest/userguide/cli-tutorial.html> di Panduan Pengguna.AWS CodeStar
-
Untuk API detailnya, lihat CreateProject
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-user-profile
.
- AWS CLI
-
Untuk membuat profil pengguna
create-user-profile
Contoh berikut membuat profil pengguna untuk IAM pengguna dengan yang ditentukanARN.aws codestar create-user-profile \ --user-arn
arn:aws:iam::123456789012:user/intern
\ --display-nameIntern
\ --email-addressintern@example.com
Output:
{ "userArn": "arn:aws:iam::123456789012:user/intern", "displayName": "Intern", "emailAddress": "intern@example.com", "sshPublicKey": "", "createdTimestamp": 1572552308.607, "lastModifiedTimestamp": 1572552308.607 }
-
Untuk API detailnya, lihat CreateUserProfile
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-project
.
- AWS CLI
-
Untuk menghapus proyek
delete-project
Contoh berikut menghapus proyek yang ditentukan.aws codestar delete-project \ --project-id
my-project
Output:
{ "projectArn": "arn:aws:codestar:us-east-2:123456789012:project/my-project" }
-
Untuk API detailnya, lihat DeleteProject
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-user-profile
.
- AWS CLI
-
Untuk menghapus profil pengguna
delete-user-profile
Contoh berikut menghapus profil pengguna untuk pengguna dengan yang ditentukanARN.aws codestar delete-user-profile \ --user-arn
arn:aws:iam::123456789012:user/intern
Output:
{ "userArn": "arn:aws:iam::123456789012:user/intern" }
-
Untuk API detailnya, lihat DeleteUserProfile
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandescribe-project
.
- AWS CLI
-
Untuk melihat proyek
describe-project
Contoh berikut mengambil rincian tentang proyek yang ditentukan.aws codestar describe-project \ --id
my-project
Output:
{ "name": "my project", "id": "my-project", "arn": "arn:aws:codestar:us-west-2:123456789012:project/my-project", "description": "My first CodeStar project.", "createdTimeStamp": 1572547510.128, "status": { "state": "CreateComplete" } }
-
Untuk API detailnya, lihat DescribeProject
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandescribe-user-profile
.
- AWS CLI
-
Untuk melihat profil pengguna
describe-user-profile
Contoh berikut mengambil rincian tentang profil pengguna untuk pengguna dengan yang ditentukanARN.aws codestar describe-user-profile \ --user-arn
arn:aws:iam::123456789012:user/intern
Output:
{ "userArn": "arn:aws:iam::123456789012:user/intern", "displayName": "Intern", "emailAddress": "intern@example.com", "sshPublicKey": "intern", "createdTimestamp": 1572552308.607, "lastModifiedTimestamp": 1572553495.47 }
-
Untuk API detailnya, lihat DescribeUserProfile
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandisassociate-team-member
.
- AWS CLI
-
Untuk menghapus anggota tim
disassociate-team-member
Contoh berikut menghapus pengguna dengan yang ditentukan ARN dari proyekmy-project
.aws codestar disassociate-team-member \ --project-id
my-project
\ --user-arnarn:aws:iam::123456789012:user/intern
Perintah ini tidak menghasilkan output.
-
Untuk API detailnya, lihat DisassociateTeamMember
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-projects
.
- AWS CLI
-
Untuk melihat proyek
list-projects
Contoh berikut mengambil daftar proyek di Wilayah saat ini.aws codestar list-projects
Output:
{ "projects": [ { "projectId": "intern-projects", "projectArn": "arn:aws:codestar:us-west-2:123456789012:project/intern-projects" }, { "projectId": "my-project", "projectArn": "arn:aws:codestar:us-west-2:123456789012:project/my-project" } ] }
-
Untuk API detailnya, lihat ListProjects
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-resources
.
- AWS CLI
-
Untuk melihat sumber daya
list-resources
Contoh berikut mengambil daftar sumber daya untuk proyek tertentu.aws codestar list-resources \ --id
my-project
Output:
{ "resources": [ { "id": "arn:aws:execute-api:us-east-2:123456789012:r3wxmplbv8" }, { "id": "arn:aws:codedeploy:us-east-2:123456789012:application:awscodestar-my-project-lambda-ServerlessDeploymentApplication-PF0LXMPL1KA0" }, { "id": "arn:aws:s3:::aws-codestar-us-east-2-123456789012-my-project-pipe" }, { "id": "arn:aws:lambda:us-east-2:123456789012:function:awscodestar-my-project-lambda-GetHelloWorld-16W3LVXMPLNNS" }, { "id": "arn:aws:cloudformation:us-east-2:123456789012:stack/awscodestar-my-project-lambda/b4904ea0-fc20-xmpl-bec6-029123b1cc42" }, { "id": "arn:aws:cloudformation:us-east-2:123456789012:stack/awscodestar-my-project/1b133f30-fc20-xmpl-a93a-0688c4290cb8" }, { "id": "arn:aws:iam::123456789012:role/CodeStarWorker-my-project-ToolChain" }, { "id": "arn:aws:iam::123456789012:policy/CodeStar_my-project_PermissionsBoundary" }, { "id": "arn:aws:s3:::aws-codestar-us-east-2-123456789012-my-project-app" }, { "id": "arn:aws:codepipeline:us-east-2:123456789012:my-project-Pipeline" }, { "id": "arn:aws:codedeploy:us-east-2:123456789012:deploymentgroup:my-project/awscodestar-my-project-lambda-GetHelloWorldDeploymentGroup-P7YWXMPLT0QB" }, { "id": "arn:aws:iam::123456789012:role/CodeStar-my-project-Execution" }, { "id": "arn:aws:iam::123456789012:role/CodeStarWorker-my-project-CodeDeploy" }, { "id": "arn:aws:codebuild:us-east-2:123456789012:project/my-project" }, { "id": "arn:aws:iam::123456789012:role/CodeStarWorker-my-project-CloudFormation" }, { "id": "arn:aws:codecommit:us-east-2:123456789012:Go-project" } ] }
-
Untuk API detailnya, lihat ListResources
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-tags-for-project
.
- AWS CLI
-
Untuk melihat tag untuk proyek
list-tags-for-project
Contoh berikut mengambil tag yang dilampirkan ke proyek yang ditentukan.aws codestar list-tags-for-project \ --id
my-project
Output:
{ "tags": { "Department": "Marketing", "Team": "Website" } }
-
Untuk API detailnya, lihat ListTagsForProject
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-team-members
.
- AWS CLI
-
Untuk melihat daftar anggota tim
list-team-members
Contoh berikut mengambil daftar pengguna yang terkait dengan proyek yang ditentukan.aws codestar list-team-members \ --project-id
my-project
Output:
{ "teamMembers": [ { "userArn": "arn:aws:iam::123456789012:user/admin", "projectRole": "Owner", "remoteAccessAllowed": false }, { "userArn": "arn:aws:iam::123456789012:user/intern", "projectRole": "Contributor", "remoteAccessAllowed": false } ] }
-
Untuk API detailnya, lihat ListTeamMembers
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-user-profiles
.
- AWS CLI
-
Untuk melihat daftar profil pengguna
list-user-profiles
Contoh berikut mengambil daftar semua profil pengguna di Wilayah saat ini.aws codestar list-user-profiles
Output:
{ "userProfiles": [ { "userArn": "arn:aws:iam::123456789012:user/admin", "displayName": "me", "emailAddress": "me@example.com", "sshPublicKey": "" }, { "userArn": "arn:aws:iam::123456789012:user/intern", "displayName": "Intern", "emailAddress": "intern@example.com", "sshPublicKey": "intern" } ] }
-
Untuk API detailnya, lihat ListUserProfiles
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakantag-project
.
- AWS CLI
-
Untuk melampirkan tag ke proyek
tag-project
Contoh berikut menambahkan tag bernamaDepartment
dan nilaiMarketing
untuk proyek tertentu.aws codestar tag-project \ --id
my-project
\ --tagsDepartment=Marketing
Output:
{ "tags": { "Department": "Marketing" } }
-
Untuk API detailnya, lihat TagProject
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanuntag-project
.
- AWS CLI
-
Untuk menghapus tag dari proyek
untag-project
Contoh berikut menghapus tag apapun dengan nama kunciTeam
dari dari proyek specifiec.aws codestar untag-project \ --id
my-project
\ --tagsTeam
Perintah ini tidak menghasilkan output.
-
Untuk API detailnya, lihat UntagProject
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-project
.
- AWS CLI
-
Untuk memperbarui proyek
update-project
Contoh berikut menambahkan deskripsi untuk proyek yang ditentukan.aws codestar update-project \ --id
my-project
\ --description"My first CodeStar project"
Perintah ini tidak menghasilkan output.
-
Untuk API detailnya, lihat UpdateProject
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-team-member
.
- AWS CLI
-
Untuk memodifikasi anggota tim
update-team-member
Contoh berikut membuat pengguna tertentu kontributor pada proyek dan memberi mereka akses jarak jauh ke sumber daya proyek.aws codestar update-team-member \ --project-id
my-project
\ --user-arnarn:aws:iam::123456789012:user/intern
\ --project-roleContributor
-
\ --remote-access-allowedOutput:
{ "userArn": "arn:aws:iam::123456789012:user/intern", "projectRole": "Contributor", "remoteAccessAllowed": true }
-
Untuk API detailnya, lihat UpdateTeamMember
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanupdate-user-profile
.
- AWS CLI
-
Untuk memodifikasi profil pengguna
update-user-profile
Contoh berikut menambahkan SHH kunci yang ditentukan untuk pengguna tertentu.aws codestar update-user-profile \ --ssh-public-key
intern
\ --user-arnarn:aws:iam::123456789012:user/intern
Output:
{ "userArn": "arn:aws:iam::123456789012:user/intern", "displayName": "Intern", "emailAddress": "intern@example.com", "sshPublicKey": "intern", "createdTimestamp": 1572552308.607, "lastModifiedTimestamp": 1572553495.47 }
-
Untuk API detailnya, lihat UpdateUserProfile
di Referensi AWS CLI Perintah.
-