
# 查询目标规则关联的服务列表 - ShowDestinationRuleRelatedService
#### 功能介绍
查询目标规则关联的服务列表
#### 调试
您可以在[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/IEF/doc?api=ShowDestinationRuleRelatedService)中调试该接口，支持自动认证鉴权。API Explorer可以自动生成SDK代码示例，并提供SDK代码示例调试功能。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-ief/ief_02_1003.html)。
#### URI
GET /v3/{project_id}/edgemgr/destination-rules/{destination_rule_name}/services
表1路径参数 
| 参数                    | 是否必选 | 参数类型   | 描述     |
|:---|:---|:---|:---|
| project_id            | 是    | String | 项目ID   |
| destination_rule_name | 是    | String | 目标规则名称 |
#### 请求参数
无
#### 响应参数
**状态码：200**
表2响应Body参数 
| 参数       | 参数类型                                                                                                 | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
|:---|:---|:---|
| count    | Integer                                                                                              | 满足条件的端点个数 Example:3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| services | Array of [ServiceRespDetail] objects | 服务列表Example:\[{"id":"5cf2025b-580e-4617-9205-a2edb6318047","project_id":"e78acc02d9d141eda5ca8e88fa35f6f8","meta_data":{"name":"service-example"},"spec":{"selector":{"app":"ief-zb-nginx"},"ports":\[{"name":"http-0","protocol":"TCP","port":"8888","target_port":"80"}\],"cluster_ip":"None"},"created_at":"2020-07-08 02:01:16.761016 +0000 UTC","updated_at":"2020-07-08 02:01:16.761016 +0000 UTC"},{"id":"90feb9c1-120b-4d74-ae60-daa83633afe8","project_id":"e78acc02d9d141eda5ca8e88fa35f6f8","meta_data":{"name":"ief-zb-svc-wss"},"spec":{"selector":{"app":"ief-zb-wss"},"ports":\[{"name":"http-0","protocol":"TCP","port":"12555","target_port":"10443"}\],"cluster_ip":"None"},"created_at":"2020-06-17 01:42:48.98069 +0000 UTC","updated_at":"2020-06-23 02:14:41.369697 +0000 UTC"},{"id":"2b35f7cb-bfd0-46c2-b4a7-7b88e2015ff7","project_id":"e78acc02d9d141eda5ca8e88fa35f6f8","meta_data":{"name":"ief-zb-svc-ws"},"spec":{"selector":{"app":"ief-zb-ws"},"ports":\[{"name":"http-0","protocol":"TCP","port":"12444","target_port":"8080"}\],"cluster_ip":"None"},"created_at":"2020-06-17 01:42:20.624868 +0000 UTC","updated_at":"2020-06-23 02:14:33.452154 +0000 UTC"}\] |
   
 表3ServiceRespDetail 
| 参数         | 参数类型                                                                           | 描述   |
|:---|:---|:---|
| id         | String                                                                         | 服务ID |
| project_id | String                                                                         | 租户ID |
| meta_data  | [SvcMetadata] object | 元数据  |
| spec       | [SvcSpec] object         | 详细描述 |
| created_at | String                                                                         | 创建时间 |
| updated_at | String                                                                         | 更新时间 |
   
 表4SvcMetadata 
| 参数     | 参数类型                 | 描述                                              |
|:---|:---|:---|
| name   | String               | 服务名称，只允许英文小写字母、数字、中划线，最大长度64，英文小写字母开头，数字或小写字母结尾 |
| labels | Map\<String,String\> | 自定义标签属性列表                                       |
   
 表5SvcSpec 
| 参数            | 参数类型                                                                             | 描述                             |
|:---|:---|:---|
| selector      | Map\<String,String\>                                                             | 标签选择器，将选择具有指定Label标签的Pod作为管理范围 |
| ports         | Array of [SvcPort] objects | 服务需要暴露的端口列表                    |
| cluster_ip    | String                                                                           | 虚拟服务IP地址                       |
| type          | String                                                                           | 服务的类型                          |
| external_name | String                                                                           | 外部名称                           |
| external_ips  | Array of strings                                                                 | 外部IP                           |
   
 表6SvcPort 
| 参数          | 参数类型   | 描述                                |
|:---|:---|:---|
| name        | String | 端口名称                              |
| protocol    | String | 具体的协议，比如TCP                       |
| port        | String | 服务监听的端口号                          |
| target_port | String | 需要转发到后端Pod的端口号                    |
| node_port   | String | 当spec.type=NodePort时，指定映射到物理机的端口号 |
   
#### 请求示例
```
/v3/{project_id}/edgemgr/destination-rules/{destination_rule_name}/services
{ }
```
#### 响应示例
**状态码：200**
查询目标规则关联的服务列表响应体
```
{
  "count" : 0,
  "services" : [ {
    "id" : "string",
    "project_id" : "string",
    "meta_data" : {
      "name" : "string",
      "labels" : {
        "additionalProp1" : "string",
        "additionalProp2" : "string",
        "additionalProp3" : "string"
      }
    },
    "spec" : {
      "selector" : {
        "additionalProp1" : "string",
        "additionalProp2" : "string",
        "additionalProp3" : "string"
      },
      "ports" : [ {
        "name" : "string",
        "protocol" : "string",
        "port" : "string",
        "target_port" : "string",
        "node_port" : "string"
      } ],
      "cluster_ip" : "string",
      "type" : "string",
      "external_name" : "string",
      "external_ips" : [ "string" ]
    },
    "created_at" : "string",
    "updated_at" : "string"
  } ]
}
```
#### 状态码
| 状态码 | 描述               |
|:---|:---|
| 200 | 查询目标规则关联的服务列表响应体 |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-ief/ErrorCode.html)。
