Use Metadata para agrupar parâmetros definidos na seção Parameters de um modelo e ocultar parâmetros específicos. Para visualizar como os parâmetros são exibidos, acesse a etapa Configure Parameters no console do Resource Orchestration Service (ROS).
Sintaxe de Metadata
Metadata:
ALIYUN::ROS::Interface:
# ParameterGroups is required.
ParameterGroups:
- <ParameterGroup1>
- <ParameterGroup2>
- ...
Sintaxe de ParameterGroup
# Parameters is required.
Parameters:
- <Parameter1>
- <Parameter2>
- ...
# Label is required.
Label:
default: <Custom String>
Exemplo: Agrupar parâmetros
Agrupe os parâmetros definidos na seção Parameters de um modelo e especifique um rótulo para cada grupo.
ROSTemplateFormatVersion: '2015-09-01'
Description: Metadata example.
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- VpcName
- VpcCidrBlock
Label:
default: VPC
- Parameters:
- VswName
- VswCidrBlock
Label:
default: VSwitch
Parameters:
VpcName:
Type: String
Label: Name
Description: The name must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). It must start with a letter.
Default: MyVPC
VswName:
Type: String
Label: Name
Description: The name must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). It must start with a letter.
Default: MyVSwitch
VpcCidrBlock:
Type: String
AllowedValues:
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
Description: The CIDR block of the VPC. To specify a custom CIDR block, you must change the valid CIDR blocks that are specified by AllowedValues in the template. The custom CIDR block must be a subnet of the valid CIDR blocks.
Label: IPv4 CIDR Block
Default: 192.168.0.0/16
VswCidrBlock:
Type: String
Description: The CIDR block of the vSwitch must be a subnet of the VPC CIDR block and must not be used by other vSwitches.
Label: IPv4 CIDR Block
Default: 192.168.1.0/24
Resources:
VSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
VpcId:
Ref: VPC
ZoneId:
Fn::Select:
- '1'
- Fn::GetAZs:
Ref: ALIYUN::Region
CidrBlock:
Ref: VswCidrBlock
VSwitchName:
Ref: VswName
VPC:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock:
Ref: VpcCidrBlock
VpcName:
Ref: VpcName
Exemplo: Ocultar parâmetros
Especifique os parâmetros desejados em Hidden no modelo para evitar que o console do ROS exiba as informações desses parâmetros.
ROSTemplateFormatVersion: '2015-09-01'
Description: Metadata example.
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- VpcName
Label:
default: VPC
- Parameters:
- VswName
Label:
default: VSwitch
# The parameters that you specify in Hidden are not displayed in the ROS console.
Hidden:
- VpcCidrBlock
- VswCidrBlock
Parameters:
VpcName:
Type: String
Label: Name
Description: The name must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). It must start with a letter.
Default: MyVPC
VswName:
Type: String
Label: Name
Description: The name must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). It must start with a letter.
Default: MyVSwitch
VpcCidrBlock:
Type: String
AllowedValues:
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
Description: The CIDR block of the VPC. To specify a custom CIDR block, you must change the valid CIDR blocks that are specified by AllowedValues in the template. The custom CIDR block must be a subnet of the valid CIDR blocks.
Label: IPv4 CIDR Block
Default: 192.168.0.0/16
VswCidrBlock:
Type: String
Description: The CIDR block of the vSwitch must be a subnet of the VPC CIDR block and must not be used by other vSwitches.
Label: IPv4 CIDR Block
Default: 192.168.1.0/24
Resources:
VSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
VpcId:
Ref: VPC
ZoneId:
Fn::Select:
- '1'
- Fn::GetAZs:
Ref: ALIYUN::Region
CidrBlock:
Ref: VswCidrBlock
VSwitchName:
Ref: VswName
VPC:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock:
Ref: VpcCidrBlock
VpcName:
Ref: VpcName