Updating a Service

Function

This API is used to update a service.

URI

PUT /v2/{project_id}/edgemgr/services/{service_id}

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

service_id

Yes

String

Service ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

service

No

ServiceReqDetail object

Service details.

Table 3 ServiceReqDetail

Parameter

Mandatory

Type

Description

meta_data

Yes

SvcMetadata object

Static properties of the service.

spec

Yes

SvcSpec object

Dynamic properties of the service.

Table 4 SvcMetadata

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.

Table 5 SvcSpec

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.

Table 6 SvcPort

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

Table 7 Response body parameters

Parameter

Type

Description

service

ServiceRespDetail object

Service details.

Table 8 ServiceRespDetail

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.

Table 9 SvcMetadata

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.

Table 10 SvcSpec

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.

Table 11 SvcPort

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

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_message

String

Error description.

Status code: 500

Table 13 Response body parameters

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.