Updating a Service
Function
This API is used to update a service.
URI
PUT /v2/{project_id}/edgemgr/services/{service_id}
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Project ID. |
| service_id | Yes | String | Service ID. |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| service | No | ServiceReqDetail object | Service details. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| meta_data | Yes | SvcMetadata object | Static properties of the service. |
| spec | Yes | SvcSpec object | Dynamic properties of the service. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| labels | No | Map<String,String> | List of customized labels. |
| name | Yes | String | Service name. Enter a maximum of 64 characters starting with a letter and ending with a letter or digit. Only lowercase letters, digits, and hyphens (-) are allowed. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| cluster_ip | No | String | IP address of a virtual service. |
| external_ips | No | Array of strings | List of external IP addresses. This parameter is not supported currently. |
| external_name | No | String | External domain name. This parameter is not supported currently. |
| ports | No | Array of SvcPort objects | List of service ports to be exposed. |
| selector | Yes | Map<String,String> | Label selector, which is used to select the pods with the specified labels for management. |
| type | No | String | Service type. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | No | String | Port name. |
| node_port | No | String | Port number mapped to the physical machine when spec.type is set to NodePort. |
| port | No | String | Port on which the service listens. |
| protocol | No | String | Protocol, for example, TCP. |
| target_port | No | String | Port number of the backend pod to which requests are forwarded. |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| service | ServiceRespDetail object | Service details. |
| Parameter | Type | Description |
|---|---|---|
| created_at | String | Time when the service is created. |
| id | String | Service ID. |
| meta_data | SvcMetadata object | Static properties of the service. |
| project_id | String | Tenant ID. |
| spec | SvcSpec object | Dynamic properties of the service. |
| updated_at | String | Time when the service is updated. |
| Parameter | Type | Description |
|---|---|---|
| labels | Map<String,String> | List of customized labels. |
| name | String | Service name. Enter a maximum of 64 characters starting with a letter and ending with a letter or digit. Only lowercase letters, digits, and hyphens (-) are allowed. |
| Parameter | Type | Description |
|---|---|---|
| cluster_ip | String | IP address of a virtual service. |
| external_ips | Array of strings | List of external IP addresses. This parameter is not supported currently. |
| external_name | String | External domain name. This parameter is not supported currently. |
| ports | Array of SvcPort objects | List of service ports to be exposed. |
| selector | Map<String,String> | Label selector, which is used to select the pods with the specified labels for management. |
| type | String | Service type. |
| Parameter | Type | Description |
|---|---|---|
| name | String | Port name. |
| node_port | String | Port number mapped to the physical machine when spec.type is set to NodePort. |
| port | String | Port on which the service listens. |
| protocol | String | Protocol, for example, TCP. |
| target_port | String | Port number of the backend pod to which requests are forwarded. |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code. |
| error_message | String | Error description. |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code. |
| error_message | String | Error description. |
Example Requests
{
"service" : {
"meta_data" : {
"name" : "service-example",
"labels" : { }
},
"spec" : {
"cluster_ip" : "None",
"external_ips" : [ ],
"external_name" : "",
"ports" : [ {
"name" : "http-0",
"port" : "8888",
"target_port" : "80",
"protocol" : "TCP",
"node_port" : ""
} ],
"selector" : {
"app" : "ief-nginx"
},
"type" : ""
}
}
} Example Responses
None
Status Codes
| Status Code | Description |
|---|---|
| 200 | OK |
| 400 | Error response. |
| 500 | Error response. |
Error Codes
See Error Codes.
Last Article: Querying Service Details
Next Article: Deleting a Service
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.