Creating a Component
Overview
This example uses the API for creating a component.
For details about how to call APIs, see 3 Calling APIs.
Procedure
- Create a component.
Call the API for creating a component. The following shows an example request.
curl -k -H "Content-Type:application/json" -H "X-Environment-ID: $env_id" -H "X-Auth-Token:$Token" -X POST "https://{cae_endpoint}v1/{project_id}/cae/applications/{application_id}/components" -d '{ "api_version": "v1", "kind": "Component", "metadata": { "name": "demo-jar", "annotations": { "version": "1.0.0" } }, "spec": { "runtime": "Java8", "build": { "archive": { "artifact_namespace": "target_namespace" }, "parameters": { "base_image": "openjdk:8u181-jdk-alpine", "build_env": "java-8" } }, "source": { "type": "softwarePackage", "sub_type": "BinObs", "url": "https://xx/demo.jar" }, "resource_limit": { "cpu_limit": "500m", "memory_limit": "1Gi" }, "replica": 1 } }'Information similar to the following is displayed.
{ "api_version": "v1", "kind": "Component", "metadata": { "id": "908aabb3-0b50-4116-8e83-a6933ec1884c", "name": "demo-jar", "annotations": { "version": "1.0.0" }, "created_at": "2022-07-05T08:28:24.4885176Z", "updated_at": "2022-07-05T08:28:24.4885176Z" }, "spec": { "runtime": "Java8", "env_id": "50d18173-5df0-4db4-a2b6-8a428d42146b", "replica": 1, "source": { "type": "softwarePackage", "sub_type": "BinObs", "url": "https://xx/demo.jar" }, "build": { "archive": { "artifact_namespace": "target_namespace" }, "parameters": { "base_image": "xxx" } }, "access_info": null, "image_url": "", "available_replica": 0, "status": "", "build_log_id": "" } }You can obtain the creation status based on the obtained job_id.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot