ALIYUN::APIG::Service类型用于创建服务。
语法
{
  "Type": "ALIYUN::APIG::Service",
  "Properties": {
    "Addresses": List,
    "GatewayId": String,
    "ServiceName": String,
    "SourceType": String,
    "GroupName": String,
    "ResourceGroupId": String,
    "Namespace": String,
    "Qualifier": String,
    "AiServiceConfig": Map
  }
}属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| Addresses | List | 否 | 是 | 地址信息。 | IP或者域名列表,最多支持输入10组地址。 | 
| GatewayId | String | 是 | 否 | 网关实例 ID。 | 无 | 
| GroupName | String | 否 | 否 | 服务分组名。 | 当 SourceType 为 MSE_NACOS 时, 需要指定。 | 
| ResourceGroupId | String | 否 | 是 | 资源组 ID。 | 无 | 
| Namespace | String | 否 | 否 | 服务的命名空间。 | 
 当 SourceType 为 K8S 和 MSE_NACOS 时, 需要指定。 | 
| Qualifier | String | 否 | 否 | 函数版本或别名。 | 无 | 
| AiServiceConfig | Map | 否 | 否 | AI 服务配置。 | 更多信息,请参考AiServiceConfig属性。 | 
| ServiceName | String | 否 | 否 | 服务名。 | 无 | 
| SourceType | String | 否 | 否 | 服务来源类型。 | 取值:DNS | 
AiServiceConfig语法
"AiServiceConfig": {
  "Provider": String,
  "Address": String,
  "Protocols": List,
  "ApiKeys": List,
  "EnableHealthCheck": Boolean
}AiServiceConfig属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| Provider | String | 否 | 是 | 大模型提供商。 | 无 | 
| Address | String | 否 | 是 | 服务地址。 | 无 | 
| Protocols | List | 否 | 是 | 模型协议列表。 | 无 | 
| ApiKeys | List | 否 | 是 | ApiKey 列表。 | 无 | 
| EnableHealthCheck | Boolean | 否 | 是 | 是否启用健康检查。 | 无 | 
返回值
Fn::GetAtt
- Addresses:地址信息。 
- ServiceName:服务名。 
- GatewayId:网关实例 ID。 
- ServiceId:服务ID。 
- AiServiceConfig:AI 服务配置。 
- GroupName:服务分组名。 
- Qualifier:函数版本或别名。 
- ResourceGroupId:资源组 ID。 
- Namespace:服务的命名空间。 
示例
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  GatewayId:
    Type: String
    Description:
      en: The ID of the Cloud Native API Gateway.
    Required: true
    AssociationProperty: ALIYUN::APIG::Gateway::GatewayId
Resources:
  ExtensionResource:
    Type: ALIYUN::APIG::Service
    Properties:
      GatewayId:
        Ref: GatewayId
      SourceType: DNS
      ServiceName: test1
      Addresses:
        - ros.test:80
        - ros.test:801
Outputs:
  Addresses:
    Description: Service Address List.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Addresses
  ServiceName:
    Description: The Name of the service .
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - ServiceName
  SourceType:
    Description: Service source type.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - SourceType
  GatewayId:
    Description: The ID of the Cloud Native API Gateway.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - GatewayId
  ServiceId:
    Description: The ID of the service.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - ServiceId
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "GatewayId": {
      "Type": "String",
      "Description": {
        "en": "The ID of the Cloud Native API Gateway."
      },
      "Required": true,
      "AssociationProperty":"ALIYUN::APIG::Gateway::GatewayId"
    }
  },
  "Resources": {
    "ExtensionResource": {
      "Type": "ALIYUN::APIG::Service",
      "Properties": {
        "GatewayId": {
          "Ref": "GatewayId"
        },
        "SourceType": "DNS",
        "ServiceName": "test1",
        "Addresses": [
          "ros.test:80",
          "ros.test:801"
        ]
      }
    }
  },
  "Outputs": {
    "Addresses": {
      "Description": "Service Address List.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Addresses"
        ]
      }
    },
    "ServiceName": {
      "Description": "The Name of the service .",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "ServiceName"
        ]
      }
    },
    "SourceType": {
      "Description": "Service source type.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "SourceType"
        ]
      }
    },
    "GatewayId": {
      "Description": "The ID of the Cloud Native API Gateway.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "GatewayId"
        ]
      }
    },
    "ServiceId": {
      "Description": "The ID of the service.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "ServiceId"
        ]
      }
    }
  }
}