Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.
I seguenti esempi di codice mostrano come utilizzareCreateProject
.
- AWS CLI
-
Esempio 1: creare un progetto di AWS CodeBuild compilazione
L'
create-project
esempio seguente crea un progetto di CodeBuild compilazione utilizzando i file sorgente di un bucket S3aws codebuild create-project \ --name
"my-demo-project"
\ --source "{\"type\": \"S3\",\"location\": \"codebuild-us-west-2-123456789012-input-bucket/my-source.zip\"}" \ --artifacts {"\"type\": \"S3\",\"location\": \"codebuild-us-west-2-123456789012-output-bucket\""} \ --environment "{\"type\": \"LINUX_CONTAINER\",\"image\": \"aws/codebuild/standard:1.0\",\"computeType\": \"BUILD_GENERAL1_SMALL\"}" \ --service-role"arn:aws:iam::123456789012:role/service-role/my-codebuild-service-role"
Output:
{ "project": { "arn": "arn:aws:codebuild:us-west-2:123456789012:project/my-demo-project", "name": "my-cli-demo-project", "encryptionKey": "arn:aws:kms:us-west-2:123456789012:alias/aws/s3", "serviceRole": "arn:aws:iam::123456789012:role/service-role/my-codebuild-service-role", "lastModified": 1556839783.274, "badge": { "badgeEnabled": false }, "queuedTimeoutInMinutes": 480, "environment": { "image": "aws/codebuild/standard:1.0", "computeType": "BUILD_GENERAL1_SMALL", "type": "LINUX_CONTAINER", "imagePullCredentialsType": "CODEBUILD", "privilegedMode": false, "environmentVariables": [] }, "artifacts": { "location": "codebuild-us-west-2-123456789012-output-bucket", "name": "my-cli-demo-project", "namespaceType": "NONE", "type": "S3", "packaging": "NONE", "encryptionDisabled": false }, "source": { "type": "S3", "location": "codebuild-us-west-2-123456789012-input-bucket/my-source.zip", "insecureSsl": false }, "timeoutInMinutes": 60, "cache": { "type": "NO_CACHE" }, "created": 1556839783.274 } }
Esempio 2: creare un progetto di AWS CodeBuild compilazione utilizzando un file JSON di input per i parametri
L'
create-project
esempio seguente crea un progetto di CodeBuild compilazione passando tutti i parametri richiesti in un file JSON di input. Crea il modello del file di input eseguendo il comando solo con--generate-cli-skeleton parameter
.aws codebuild create-project --cli-input-json
file://create-project.json
Il JSON file di input
create-project.json
contiene il seguente contenuto:{ "name": "codebuild-demo-project", "source": { "type": "S3", "location": "codebuild-region-ID-account-ID-input-bucket/MessageUtil.zip" }, "artifacts": { "type": "S3", "location": "codebuild-region-ID-account-ID-output-bucket" }, "environment": { "type": "LINUX_CONTAINER", "image": "aws/codebuild/standard:1.0", "computeType": "BUILD_GENERAL1_SMALL" }, "serviceRole": "serviceIAMRole" }
Output:
{ "project": { "name": "codebuild-demo-project", "serviceRole": "serviceIAMRole", "tags": [], "artifacts": { "packaging": "NONE", "type": "S3", "location": "codebuild-region-ID-account-ID-output-bucket", "name": "message-util.zip" }, "lastModified": 1472661575.244, "timeoutInMinutes": 60, "created": 1472661575.244, "environment": { "computeType": "BUILD_GENERAL1_SMALL", "image": "aws/codebuild/standard:1.0", "type": "LINUX_CONTAINER", "environmentVariables": [] }, "source": { "type": "S3", "location": "codebuild-region-ID-account-ID-input-bucket/MessageUtil.zip" }, "encryptionKey": "arn:aws:kms:region-ID:account-ID:alias/aws/s3", "arn": "arn:aws:codebuild:region-ID:account-ID:project/codebuild-demo-project" } }
Per ulteriori informazioni, consulta Create a Build Project (AWS CLI) nella Guida AWS CodeBuild per l'utente.
-
Per API i dettagli, consultate CreateProject AWS CLI
Command Reference.
-
Per un elenco completo delle guide per AWS SDK sviluppatori e degli esempi di codice, consultaUtilizzo di questo servizio con un AWS SDK. Questo argomento include anche informazioni su come iniziare e dettagli sulle SDK versioni precedenti.