Membuat komponen image. Komponen image digunakan untuk menyimpan perintah templat build yang umum digunakan untuk pembuatan image.
Deskripsi operasi
Deskripsi Operasi
Sebelum membuat komponen image, perhatikan hal-hal berikut:
Hanya komponen gambar kustom yang dapat dibuat.
Nomor versi komponen harus unik untuk nama komponen yang sama. Saat menggunakan komponen di templat, Anda dapat mereferensikannya berdasarkan nama dan nomor versi.
Ukuran konten komponen image tidak boleh melebihi 16 KB. Untuk detail perintah yang didukung, lihat Perintah yang didukung oleh Image Builder.
Untuk informasi lebih lanjut, lihat Ikhtisar Image Builder.
Coba sekarang
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ecs:CreateImageComponent |
create |
*ImageComponent
|
None | None |
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
ID wilayah. Anda dapat memanggil DescribeRegions untuk mengkueri daftar wilayah terbaru. |
cn-hangzhou |
| ResourceGroupId |
string |
No |
ID kelompok sumber daya enterprise. |
rg-bp67acfmxazb4p**** |
| Tag |
array<object> |
No |
Tag. |
|
|
object |
No |
|||
| Key |
string |
No |
Kunci tag. Nilai valid N: 1 hingga 20. Kunci tag tidak boleh berupa string kosong. Panjang kunci tag dapat mencapai 128 karakter dan tidak boleh diawali dengan aliyun atau acs:. Kunci tag tidak boleh mengandung http:// atau https://. |
TestKey |
| Value |
string |
No |
Nilai tag. Nilai valid N: 1 hingga 20. Nilai tag dapat berupa string kosong. Panjang nilai tag dapat mencapai 128 karakter dan tidak boleh diawali dengan acs:. Nilai tag tidak boleh mengandung http:// atau https://. |
TestValue |
| Name |
string |
No |
Nama komponen. Panjang nama harus 2 hingga 128 karakter dan harus diawali dengan huruf atau karakter Tionghoa. Nama tidak boleh diawali dengan http:// atau https://. Nama dapat mengandung huruf, karakter Tionghoa, digit, titik dua (:), garis bawah (_), titik (.), atau tanda hubung (-). Catatan
Jika Anda tidak menentukan |
testComponent |
| Description |
string |
No |
Deskripsi. Panjang deskripsi harus 2 hingga 256 karakter dan tidak boleh diawali dengan http:// atau https://. |
This is description. |
| SystemType |
string |
No |
Sistem operasi yang didukung komponen. Nilai valid:
Nilai default: Linux. |
Linux |
| ComponentType |
string |
No |
Tipe komponen. Komponen build image dan komponen test didukung. Nilai valid:
Nilai default: Build. Catatan
Komponen build hanya dapat digunakan di templat build, dan komponen test hanya dapat digunakan di templat test. |
Build |
| Content |
string |
No |
Konten komponen. Konten terdiri dari beberapa perintah dan tidak boleh melebihi 16 KB. Untuk informasi lebih lanjut tentang perintah yang didukung dan format perintah, lihat Perintah yang didukung oleh Image Builder. |
Tasks: - Name: HelloWorld Action: RunShellCommand Properties: commandContent: echo hello world |
| ClientToken |
string |
No |
Token klien yang digunakan untuk memastikan idempotensi permintaan. Anda dapat menggunakan klien untuk menghasilkan token, tetapi Anda harus memastikan bahwa token tersebut unik di antara permintaan yang berbeda. Nilai ClientToken hanya dapat mengandung karakter ASCII dan panjangnya tidak boleh melebihi 64 karakter. Untuk informasi lebih lanjut, lihat Cara memastikan idempotensi. |
123e4567-e89b-12d3-a456-426655440000 |
| ComponentVersion |
string |
No |
Nomor versi komponen. Parameter ini digunakan bersama dengan nama komponen. Formatnya adalah major.minor.patch, di mana semua nilai adalah bilangan bulat non-negatif. Nilai default: (x+1).0.0, di mana x adalah nomor versi utama maksimum saat ini dari komponen. |
1.0.0 |
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
|||
| ImageComponentId |
string |
ID komponen image. |
ic-bp67acfmxazb4p**** |
| RequestId |
string |
ID permintaan. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
Contoh
Respons sukses
JSONformat
{
"ImageComponentId": "ic-bp67acfmxazb4p****",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
Kode kesalahan
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidCommand.Component | Image component does not support component command. | |
| 400 | InvalidName.Malformed | %s | |
| 400 | InvalidDescription.Malformed | %s | |
| 400 | InvalidSystemType.NotSupportedValue | %s | |
| 400 | InvalidComponentType.NotSupportedValue | %s | |
| 400 | InvalidContent.LengthExceeded | %s | |
| 400 | InvalidImageTemplateCommandSize.ExceededMaxNumber | %s | |
| 400 | InvalidImageTemplateCommand.NotSupported | %s | |
| 400 | InvalidCommandContent.RUN | %s | |
| 400 | InvalidCommandContent.ENV | %s | |
| 400 | InvalidCommandContent.WORKDIR | %s | |
| 400 | InvalidCommandContent.COPY | %s | |
| 400 | InvalidCommandContent.USER | %s | |
| 400 | InvalidCommandContent.CMD | %s | |
| 400 | InvalidCommandContent.ENTRYPOINT | %s | |
| 400 | MissingParameter.Content | %s | |
| 400 | EmptyCommandContent.RUN | %s. | |
| 400 | EmptyCommandContent.ENV | %s. | |
| 400 | EmptyCommandContent.LABEL | %s. | |
| 400 | EmptyCommandContent.COPY | %s. | |
| 400 | EmptyCommandContent.ENTRYPOINT | %s. | |
| 400 | EmptyCommandContent.CMD | %s. | |
| 400 | NotEmptyCommandContent.RESTART | %s. | |
| 400 | EmptyCommandContent.WORKDIR | %s. | |
| 400 | EmptyCommandContent.USER | %s. | |
| 400 | QuotaExceed.ImageComponent | %s. | |
| 400 | InvalidParameter.Content | %s. | |
| 400 | InvalidImage.OsTypeUnsupported | The specified base image does not support image building. | |
| 400 | InvalidParameter.ComponentVersion | The specified ComponentVersion is invalid. | |
| 403 | InvalidComponentVersion.Exist | The specified ComponentVersion does exist with the specified Name. | |
| 403 | InvalidOperation.NoPermissionCreateServiceLinkedRole | You are not authorized to create Service-linked role. The system will automatically create it when the API is called for the first time. Check your RAM policies, and ensure that you are using the correct credentials. | |
| 404 | InvalidResourceGroup.NotFound | The ResourceGroup provided does not exist in our records. | |
| 404 | NotSupportedCommand.FROM | %s |
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.