Updating a Component
Function
Update a component.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, no identity policy-based permission required for calling this API.
URI
PUT /v1/{project_id}/cae/applications/{application_id}/components/{component_id}
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Project ID. See Obtaining a Project ID. |
|
application_id |
Yes |
String |
Application ID. |
|
component_id |
Yes |
String |
Component ID. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
User token.
|
|
X-Enterprise-Project-ID |
No |
String |
Enterprise project ID.
NOTE:
For details about how to obtain enterprise project IDs and enterprise project features, see Enterprise Management User Guide.
|
|
X-Environment-ID |
Yes |
String |
Environment ID.
|
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
api_version |
Yes |
String |
API version. Fixed value: v1. |
|
kind |
Yes |
String |
API type. Fixed value: Component. |
|
metadata |
Yes |
Request data. |
|
|
spec |
Yes |
UpdateComponentRequestSpec object |
Component specifications. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
name |
Yes |
String |
Component name. |
|
annotations |
No |
Map<String,String> |
Additional parameter for updating a component. Only version is supported. This parameter is mandatory. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
runtime |
No |
String |
Language or runtime. |
|
source |
No |
Source object |
Source information. |
|
build |
No |
Build object |
Build information. |
|
resource_limit |
Yes |
ResourceLimit object |
Instance specifications |
|
replica |
No |
Integer |
Number of instances. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
code |
No |
Repo object |
Source code repository information. |
|
type |
Yes |
String |
Definition Source type. Constraints When updating a component, the source type must match the type used during its initial creation. Range
Default Value N/A |
|
sub_type |
No |
String |
Source subtype.
|
|
url |
Yes |
String |
URL.
|
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
auth_name |
No |
String |
Authorization name. |
|
branch |
No |
String |
Branch. |
|
namespace |
No |
String |
Namespace, which must be Base64-encoded. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
archive |
Yes |
Archive object |
Place where build products are archived for management. |
|
parameters |
Yes |
Map<String,String> |
Additional parameters. Options:
|
Response Parameters
Status code: 200
OK
None
Example Requests
-
Change the component code source to a source code repository: Set the component name to demo, version to 1.0.0, and runtime to Java8, and select source code repository GitLab.
PUT https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/components/{component_id} { "api_version" : "v1", "kind" : "Component", "metadata" : { "name" : "demo", "annotations" : { "version" : "1.0.0" } }, "spec" : { "runtime" : "Java8", "build" : { "archive" : { "artifact_namespace" : "xxx" }, "parameters" : { "base_image" : "xxx", "dockerfile_path" : "xxx" } }, "source" : { "type" : "code", "sub_type" : "GitLab", "url" : "https://xxx:8090/xxx/cae-frontend.git", "code" : { "branch" : "master", "auth_name" : "gitlab-xxx", "namespace" : "em1n" } }, "resource_limit" : { "cpu_limit" : "500m", "memory_limit" : "1Gi" }, "replica" : 1 } } -
Change the component code source to an image: Set the component name to demo, version to 1.0.0, and runtime to Docker, and select image cae-demo.
PUT https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/components/{component_id} { "api_version" : "v1", "kind" : "Component", "metadata" : { "name" : "demo", "annotations" : { "version" : "1.0.0" } }, "spec" : { "runtime" : "Docker", "build" : { "archive" : { "artifact_namespace" : "xxx" }, "parameters" : { "base_image" : "xxx" } }, "source" : { "type" : "image", "url" : "xxx/cae-demo:v1" }, "resource_limit" : { "cpu_limit" : "500m", "memory_limit" : "1Gi" }, "replica" : 1 } } -
Change the component code source to a software package: Set the component name to demo, version to 1.0.0, and runtime to Java8, and select software package forecast-1.0.0.jar.
PUT https://{endpoint}/v1/{project_id}/cae/applications/{application_id}/components/{component_id} { "api_version" : "v1", "kind" : "Component", "metadata" : { "name" : "demo", "annotations" : { "version" : "1.0.0" } }, "spec" : { "runtime" : "Java8", "build" : { "archive" : { "artifact_namespace" : "xxx" }, "parameters" : { "base_image" : "openjdk:8u181-jdk-alpine", "dockerfile_content" : "xxx" } }, "source" : { "type" : "softwarePackage", "sub_type" : "BinObs", "url" : "https://xxx.obs.region.xxx.huawei.com/xxx/forecast-1.0.0.jar" }, "resource_limit" : { "cpu_limit" : "500m", "memory_limit" : "1Gi" }, "replica" : 1 } }
Example Responses
None
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
OK |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank 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