ALIYUN::APIG::Consumer

更新时间:
复制为 MD 格式

ALIYUN::APIG::Consumer类型用于创建消费者。

语法

{
  "Type": "ALIYUN::APIG::Consumer",
  "Properties": {
    "ApikeyIdentityConfig": Map,
    "AkSkIdentityConfigs": List,
    "Description": String,
    "Enable": Boolean,
    "GatewayType": String,
    "JwtIdentityConfig": Map,
    "Name": String
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

AkSkIdentityConfigs

List

AK/SK身份配置列表。

更多信息,请参考AkSkIdentityConfigs属性

ApikeyIdentityConfig

Map

API密钥身份配置。

更多信息,请参考ApikeyIdentityConfig属性

Description

String

消费者的描述。

Enable

Boolean

是否启用消费者。

GatewayType

String

网关类型。

JwtIdentityConfig

Map

JWT身份配置。

更多信息,请参考JwtIdentityConfig属性

Name

String

消费者名称。

JwtIdentityConfig语法

"JwtIdentityConfig": {
  "Type": String,
  "SecretType": String,
  "Jwks": String,
  "JwtPayloadConfig": Map,
  "JwtTokenConfig": Map
}

JwtIdentityConfig属性

属性名称

类型

必须

允许更新

描述

约束

Jwks

String

JWKS配置。

JwtPayloadConfig

Map

JWT Payload配置。

更多信息,请参考JwtPayloadConfig属性

JwtTokenConfig

Map

JWT Token配置。

更多信息,请参考JwtTokenConfig属性

SecretType

String

密钥类型。

取值:

  • Asymmetry:非对称加密,

  • Symmetry:对称加密。

Type

String

身份配置类型。

取值:

  • Jwt

JwtPayloadConfig语法

"JwtPayloadConfig": {
  "PayloadKeyName": String,
  "PayloadKeyValue": String
}

JwtPayloadConfig属性

属性名称

类型

必须

允许更新

描述

约束

PayloadKeyName

String

JWT Payload的键名。

PayloadKeyValue

String

JWT Payload的值。

JwtTokenConfig语法

"JwtTokenConfig": {
  "Pass": Boolean,
  "Position": String,
  "Prefix": String,
  "Key": String
}

JwtTokenConfig属性

属性名称

类型

必须

允许更新

描述

约束

Key

String

JWT的键名。

Pass

Boolean

是否透传JWT。

Position

String

JWT存储位置。取值:HEADER,QUERY。

Prefix

String

JWT Token的前缀。

ApikeyIdentityConfig语法

"ApikeyIdentityConfig": {
  "ApikeySource": Map,
  "Type": String,
  "Credentials": List
}

ApikeyIdentityConfig属性

属性名称

类型

必须

允许更新

描述

约束

ApikeySource

Map

API密钥来源配置。

Credentials

List

凭证列表。

Type

String

身份配置类型。

取值:

  • Apikey

ApikeySource语法

"ApikeySource": {
  "Value": String,
  "Source": String
}

ApikeySource属性

属性名称

类型

必须

允许更新

描述

约束

Source

String

API密钥来源。取值:Header,QueryString,Default。

取值:

  • Header

  • QueryString

  • Default

Value

String

API密钥来源的值。

Credentials语法

"Credentials": [
  {
    "Apikey": String,
    "GenerateMode": String
  }
]

Credentials属性

属性名称

类型

必须

允许更新

描述

约束

GenerateMode

String

生成模式。

取值:

  • Custom

  • System

Apikey

String

API密钥值。

AkSkIdentityConfigs语法

"AkSkIdentityConfigs": [
  {
    "Type": String,
    "Sk": String,
    "Ak": String,
    "GenerateMode": String
  }
]

AkSkIdentityConfigs属性

属性名称

类型

必须

允许更新

描述

约束

Ak

String

Access Key。

GenerateMode

String

生成模式。

取值:

  • Custom

  • System

Sk

String

Secret Key。

Type

String

身份配置类型。

取值:

  • AkSk

返回值

Fn::GetAtt

ConsumerId:消费者ID。

示例

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  Name:
    Type: String
    Description:
      en: The name of the consumer.
    Default: Null
    Required: false
  Description:
    Type: String
    Description:
      en: The description of the consumer.
    AssociationProperty: TextArea
    Default: Null
    Required: false
  JwtIdentityConfig:
    Description:
      en: JWT identity configuration.
    Required: false
    Default: Null
    Type: Json
    AssociationPropertyMetadata:
      Parameters:
        Type:
          Type: String
          Description:
            en: 'The type of the identity configuration. Valid values: Jwt.'
          AllowedValues:
            - Jwt
          Default: Null
          Required: false
        SecretType:
          Type: String
          Description:
            en: 'The secret type. Valid values: Asymmetry (asymmetric encryption), Symmetry (symmetric encryption).'
          Default: Null
          Required: false
        Jwks:
          Type: String
          Description:
            en: The JWKS configuration.
          Default: Null
          Required: false
        JwtTokenConfig:
          Description:
            en: The JWT token configuration.
          Required: false
          Default: Null
          Type: Json
          AssociationPropertyMetadata:
            Parameters:
              Position:
                Type: String
                Description:
                  en: 'The position where JWT is stored. Valid values: HEADER, QUERY.'
                Default: Null
                Required: false
              Key:
                Type: String
                Description:
                  en: The key name for JWT.
                Default: Null
                Required: false
              Prefix:
                Type: String
                Description:
                  en: The prefix for JWT token.
                Default: Null
                Required: false
              Pass:
                Type: Boolean
                Description:
                  en: Whether to pass through the JWT.
                Default: Null
                Required: false
        JwtPayloadConfig:
          Description:
            en: The JWT payload configuration.
          Required: false
          Default: Null
          Type: Json
          AssociationPropertyMetadata:
            Parameters:
              PayloadKeyName:
                Type: String
                Description:
                  en: The key name of the JWT payload.
                Default: Null
                Required: false
              PayloadKeyValue:
                Type: String
                Description:
                  en: The value of the JWT payload.
                Default: Null
                Required: false
  AkSkIdentityConfigs:
    Description:
      en: List of AK/SK identity configurations.
    Required: false
    Default: Null
    Type: Json
    AssociationProperty: List[Parameters]
    AssociationPropertyMetadata:
      Parameters:
        Type:
          Type: String
          Description:
            en: 'The type of the identity configuration. Valid values: AkSk.'
          AllowedValues:
            - AkSk
          Default: Null
          Required: false
        GenerateMode:
          Type: String
          Description:
            en: 'The generation mode. Valid values: Custom, System.'
          AllowedValues:
            - Custom
            - System
          Default: Null
          Required: false
        Ak:
          Type: String
          Description:
            en: The Access Key.
          Default: Null
          Required: false
        Sk:
          Type: String
          Description:
            en: The Secret Key.
          Default: Null
          Required: false
  ApikeyIdentityConfig:
    Description:
      en: API key identity configuration.
    Required: false
    Default: Null
    Type: Json
    AssociationPropertyMetadata:
      Parameters:
        Type:
          Type: String
          Description:
            en: 'The type of the identity configuration. Valid values: Apikey.'
          AllowedValues:
            - Apikey
          Default: Null
          Required: false
        ApikeySource:
          Description:
            en: The API key source configuration.
          Required: false
          Default: Null
          Type: Json
          AssociationPropertyMetadata:
            Parameters:
              Source:
                Type: String
                Description:
                  en: 'The source of the API key. Valid values: Header, QueryString, Default.'
                AllowedValues:
                  - Header
                  - QueryString
                  - Default
                Required: true
              Value:
                Type: String
                Description:
                  en: The value for the API key source.
                Required: true
        Credentials:
          Description:
            en: The list of credentials.
          Required: false
          Default: Null
          Type: Json
          AssociationProperty: List[Parameters]
          AssociationPropertyMetadata:
            Parameters:
              GenerateMode:
                Type: String
                Description:
                  en: 'The generation mode. Valid values: Custom, System.'
                AllowedValues:
                  - Custom
                  - System
                Required: true
              Apikey:
                Type: String
                Description:
                  en: The API key value.
                Default: Null
                Required: false
  Enable:
    Type: Boolean
    Description:
      en: Whether to enable the consumer.
    Default: Null
    Required: false
  GatewayType:
    Type: String
    Description:
      en: The type of the gateway.
    Default: Null
    Required: false
Resources:
  Consumer:
    Type: ALIYUN::APIG::Consumer
    Properties:
      Name:
        Ref: Name
      Description:
        Ref: Description
      JwtIdentityConfig:
        Ref: JwtIdentityConfig
      AkSkIdentityConfigs:
        Ref: AkSkIdentityConfigs
      ApikeyIdentityConfig:
        Ref: ApikeyIdentityConfig
      Enable:
        Ref: Enable
      GatewayType:
        Ref: GatewayType
Outputs:
  ConsumerId:
    Value:
      Fn::GetAtt:
        - Consumer
        - ConsumerId
    Description: The ID of the consumer.
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "Name": {
      "Type": "String",
      "Description": {
        "en": "The name of the consumer."
      },
      "Default": null,
      "Required": false
    },
    "Description": {
      "Type": "String",
      "Description": {
        "en": "The description of the consumer."
      },
      "AssociationProperty": "TextArea",
      "Default": null,
      "Required": false
    },
    "JwtIdentityConfig": {
      "Description": {
        "en": "JWT identity configuration."
      },
      "Required": false,
      "Default": null,
      "Type": "Json",
      "AssociationPropertyMetadata": {
        "Parameters": {
          "Type": {
            "Type": "String",
            "Description": {
              "en": "The type of the identity configuration. Valid values: Jwt."
            },
            "AllowedValues": [
              "Jwt"
            ],
            "Default": null,
            "Required": false
          },
          "SecretType": {
            "Type": "String",
            "Description": {
              "en": "The secret type. Valid values: Asymmetry (asymmetric encryption), Symmetry (symmetric encryption)."
            },
            "Default": null,
            "Required": false
          },
          "Jwks": {
            "Type": "String",
            "Description": {
              "en": "The JWKS configuration."
            },
            "Default": null,
            "Required": false
          },
          "JwtTokenConfig": {
            "Description": {
              "en": "The JWT token configuration."
            },
            "Required": false,
            "Default": null,
            "Type": "Json",
            "AssociationPropertyMetadata": {
              "Parameters": {
                "Position": {
                  "Type": "String",
                  "Description": {
                    "en": "The position where JWT is stored. Valid values: HEADER, QUERY."
                  },
                  "Default": null,
                  "Required": false
                },
                "Key": {
                  "Type": "String",
                  "Description": {
                    "en": "The key name for JWT."
                  },
                  "Default": null,
                  "Required": false
                },
                "Prefix": {
                  "Type": "String",
                  "Description": {
                    "en": "The prefix for JWT token."
                  },
                  "Default": null,
                  "Required": false
                },
                "Pass": {
                  "Type": "Boolean",
                  "Description": {
                    "en": "Whether to pass through the JWT."
                  },
                  "Default": null,
                  "Required": false
                }
              }
            }
          },
          "JwtPayloadConfig": {
            "Description": {
              "en": "The JWT payload configuration."
            },
            "Required": false,
            "Default": null,
            "Type": "Json",
            "AssociationPropertyMetadata": {
              "Parameters": {
                "PayloadKeyName": {
                  "Type": "String",
                  "Description": {
                    "en": "The key name of the JWT payload."
                  },
                  "Default": null,
                  "Required": false
                },
                "PayloadKeyValue": {
                  "Type": "String",
                  "Description": {
                    "en": "The value of the JWT payload."
                  },
                  "Default": null,
                  "Required": false
                }
              }
            }
          }
        }
      }
    },
    "AkSkIdentityConfigs": {
      "Description": {
        "en": "List of AK/SK identity configurations."
      },
      "Required": false,
      "Default": null,
      "Type": "Json",
      "AssociationProperty": "List[Parameters]",
      "AssociationPropertyMetadata": {
        "Parameters": {
          "Type": {
            "Type": "String",
            "Description": {
              "en": "The type of the identity configuration. Valid values: AkSk."
            },
            "AllowedValues": [
              "AkSk"
            ],
            "Default": null,
            "Required": false
          },
          "GenerateMode": {
            "Type": "String",
            "Description": {
              "en": "The generation mode. Valid values: Custom, System."
            },
            "AllowedValues": [
              "Custom",
              "System"
            ],
            "Default": null,
            "Required": false
          },
          "Ak": {
            "Type": "String",
            "Description": {
              "en": "The Access Key."
            },
            "Default": null,
            "Required": false
          },
          "Sk": {
            "Type": "String",
            "Description": {
              "en": "The Secret Key."
            },
            "Default": null,
            "Required": false
          }
        }
      }
    },
    "ApikeyIdentityConfig": {
      "Description": {
        "en": "API key identity configuration."
      },
      "Required": false,
      "Default": null,
      "Type": "Json",
      "AssociationPropertyMetadata": {
        "Parameters": {
          "Type": {
            "Type": "String",
            "Description": {
              "en": "The type of the identity configuration. Valid values: Apikey."
            },
            "AllowedValues": [
              "Apikey"
            ],
            "Default": null,
            "Required": false
          },
          "ApikeySource": {
            "Description": {
              "en": "The API key source configuration."
            },
            "Required": false,
            "Default": null,
            "Type": "Json",
            "AssociationPropertyMetadata": {
              "Parameters": {
                "Source": {
                  "Type": "String",
                  "Description": {
                    "en": "The source of the API key. Valid values: Header, QueryString, Default."
                  },
                  "AllowedValues": [
                    "Header",
                    "QueryString",
                    "Default"
                  ],
                  "Required": true
                },
                "Value": {
                  "Type": "String",
                  "Description": {
                    "en": "The value for the API key source."
                  },
                  "Required": true
                }
              }
            }
          },
          "Credentials": {
            "Description": {
              "en": "The list of credentials."
            },
            "Required": false,
            "Default": null,
            "Type": "Json",
            "AssociationProperty": "List[Parameters]",
            "AssociationPropertyMetadata": {
              "Parameters": {
                "GenerateMode": {
                  "Type": "String",
                  "Description": {
                    "en": "The generation mode. Valid values: Custom, System."
                  },
                  "AllowedValues": [
                    "Custom",
                    "System"
                  ],
                  "Required": true
                },
                "Apikey": {
                  "Type": "String",
                  "Description": {
                    "en": "The API key value."
                  },
                  "Default": null,
                  "Required": false
                }
              }
            }
          }
        }
      }
    },
    "Enable": {
      "Type": "Boolean",
      "Description": {
        "en": "Whether to enable the consumer."
      },
      "Default": null,
      "Required": false
    },
    "GatewayType": {
      "Type": "String",
      "Description": {
        "en": "The type of the gateway."
      },
      "Default": null,
      "Required": false
    }
  },
  "Resources": {
    "Consumer": {
      "Type": "ALIYUN::APIG::Consumer",
      "Properties": {
        "Name": {
          "Ref": "Name"
        },
        "Description": {
          "Ref": "Description"
        },
        "JwtIdentityConfig": {
          "Ref": "JwtIdentityConfig"
        },
        "AkSkIdentityConfigs": {
          "Ref": "AkSkIdentityConfigs"
        },
        "ApikeyIdentityConfig": {
          "Ref": "ApikeyIdentityConfig"
        },
        "Enable": {
          "Ref": "Enable"
        },
        "GatewayType": {
          "Ref": "GatewayType"
        }
      }
    }
  },
  "Outputs": {
    "ConsumerId": {
      "Value": {
        "Fn::GetAtt": [
          "Consumer",
          "ConsumerId"
        ]
      },
      "Description": "The ID of the consumer."
    }
  }
}