ALIYUN::APIG::Service

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 时,表示是 K8S 服务所在的命名空间。

  • sourceType 为 MSE_NACOS 时, 表示是 Nacos 里的命名空间。

当 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"
        ]
      }
    }
  }
}