更新时间:2022-02-22 GMT+08:00

base64_encode

base64_encode用于对字符串进行base64编码。

语法

 base64_encode: param

参数说明

表1 参数说明

参数

参数说明

param

用户需要编码的字符串。

返回值

param经过base64编码的结果

示例

tosca_definitions_version: cloud_tosca_version_1_0
inputs:
  ecs_availabilityZone:
    description: 云服务器对应可用区信息
    label: ''
  ecs_flavor:
    description: 云服务器的规格
    label: ''
  ecs_imageId:
    description: 云服务器使用的镜像ID
    label: ''
  ecs_nics_0_subnetId:
    description: 待创建云服务器的网卡信息。
    label: ''
  ecs-key:
    description: 登录使用的ssh密钥对
    label: ''
  user-name:
    default: test
  password:
    label: ''
  ecs_vpcId:
    description: 云服务器所属VPC的ID
    label: ''
node_templates:
  ecs:
    properties:
      availabilityZone:
        get_input: ecs_availabilityZone
      flavor:
        get_input: ecs_flavor
      imageId:
        get_input: ecs_imageId
      instances: 1
      name: jkhlh
      nics:
        - subnetId:
            get_input: ecs_nics_0_subnetId
      publicIP:
        eip:
          bandwidth:
            shareType: PER
          ipType: 5_bgp
      rootVolume:
        size: 40
        volumeType: SATA
      sshKeyName:
        get_input: ecs-key
      userData:
        base64_encode:
          replace:
            - |
              #!/bin/bash -x
              useradd ${user_name} 
              echo '${user_name}:${user_pwd}' | chpasswd 
            - user_name:
                get_input: user-name
              user_pwd:
                get_input: password
      vpcId:
        get_input: ecs_vpcId
    type: Cloud.ECS.CloudServer