github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/rts/v1/stacks/fixtures.go (about) 1 package stacks 2 3 // ValidJSONTemplate is a valid OpenStack Heat template in JSON format 4 const ValidJSONTemplate = ` 5 { 6 "heat_template_version": "2014-10-16", 7 "parameters": { 8 "flavor": { 9 "default": "debian2G", 10 "description": "Flavor for the server to be created", 11 "hidden": true, 12 "type": "string" 13 } 14 }, 15 "resources": { 16 "test_server": { 17 "properties": { 18 "flavor": "2 GB General Purpose v1", 19 "image": "Debian 7 (Wheezy) (PVHVM)", 20 "name": "test-server" 21 }, 22 "type": "OS::Nova::Server" 23 } 24 } 25 } 26 ` 27 28 // ValidYAMLTemplate is a valid OpenStack Heat template in YAML format 29 const ValidYAMLTemplate = ` 30 heat_template_version: 2014-10-16 31 parameters: 32 flavor: 33 type: string 34 description: Flavor for the server to be created 35 default: debian2G 36 hidden: true 37 resources: 38 test_server: 39 type: "OS::Nova::Server" 40 properties: 41 name: test-server 42 flavor: 2 GB General Purpose v1 43 image: Debian 7 (Wheezy) (PVHVM) 44 ` 45 46 // InvalidTemplateNoVersion is an invalid template as it has no `version` section 47 const InvalidTemplateNoVersion = ` 48 parameters: 49 flavor: 50 type: string 51 description: Flavor for the server to be created 52 default: debian2G 53 hidden: true 54 resources: 55 test_server: 56 type: "OS::Nova::Server" 57 properties: 58 name: test-server 59 flavor: 2 GB General Purpose v1 60 image: Debian 7 (Wheezy) (PVHVM) 61 ` 62 63 // ValidJSONEnvironment is a valid environment for a stack in JSON format 64 const ValidJSONEnvironment = ` 65 { 66 "parameters": { 67 "user_key": "userkey" 68 }, 69 "resource_registry": { 70 "My::WP::Server": "file:///home/shardy/git/heat-templates/hot/F18/WordPress_Native.yaml", 71 "OS::Quantum*": "OS::Neutron*", 72 "AWS::CloudWatch::Alarm": "file:///etc/heat/templates/AWS_CloudWatch_Alarm.yaml", 73 "OS::Metering::Alarm": "OS::Ceilometer::Alarm", 74 "AWS::RDS::DBInstance": "file:///etc/heat/templates/AWS_RDS_DBInstance.yaml", 75 "resources": { 76 "my_db_server": { 77 "OS::DBInstance": "file:///home/mine/all_my_cool_templates/db.yaml" 78 }, 79 "my_server": { 80 "OS::DBInstance": "file:///home/mine/all_my_cool_templates/db.yaml", 81 "hooks": "pre-create" 82 }, 83 "nested_stack": { 84 "nested_resource": { 85 "hooks": "pre-update" 86 }, 87 "another_resource": { 88 "hooks": [ 89 "pre-create", 90 "pre-update" 91 ] 92 } 93 } 94 } 95 } 96 } 97 ` 98 99 // ValidYAMLEnvironment is a valid environment for a stack in YAML format 100 const ValidYAMLEnvironment = ` 101 parameters: 102 user_key: userkey 103 resource_registry: 104 My::WP::Server: file:///home/shardy/git/heat-templates/hot/F18/WordPress_Native.yaml 105 # allow older templates with Quantum in them. 106 "OS::Quantum*": "OS::Neutron*" 107 # Choose your implementation of AWS::CloudWatch::Alarm 108 "AWS::CloudWatch::Alarm": "file:///etc/heat/templates/AWS_CloudWatch_Alarm.yaml" 109 #"AWS::CloudWatch::Alarm": "OS::Heat::CWLiteAlarm" 110 "OS::Metering::Alarm": "OS::Ceilometer::Alarm" 111 "AWS::RDS::DBInstance": "file:///etc/heat/templates/AWS_RDS_DBInstance.yaml" 112 resources: 113 my_db_server: 114 "OS::DBInstance": file:///home/mine/all_my_cool_templates/db.yaml 115 my_server: 116 "OS::DBInstance": file:///home/mine/all_my_cool_templates/db.yaml 117 hooks: pre-create 118 nested_stack: 119 nested_resource: 120 hooks: pre-update 121 another_resource: 122 hooks: [pre-create, pre-update] 123 ` 124 125 // InvalidEnvironment is an invalid environment as it has an extra section called `resources` 126 const InvalidEnvironment = ` 127 parameters: 128 flavor: 129 type: string 130 description: Flavor for the server to be created 131 default: debian2G 132 hidden: true 133 resources: 134 test_server: 135 type: "OS::Nova::Server" 136 properties: 137 name: test-server 138 flavor: 2 GB General Purpose v1 139 image: Debian 7 (Wheezy) (PVHVM) 140 parameter_defaults: 141 KeyName: heat_key 142 ` 143 144 // ValidJSONEnvironmentParsed is the expected parsed version of ValidJSONEnvironment 145 var ValidJSONEnvironmentParsed = map[string]interface{}{ 146 "parameters": map[string]interface{}{ 147 "user_key": "userkey", 148 }, 149 "resource_registry": map[string]interface{}{ 150 "My::WP::Server": "file:///home/shardy/git/heat-templates/hot/F18/WordPress_Native.yaml", 151 "OS::Quantum*": "OS::Neutron*", 152 "AWS::CloudWatch::Alarm": "file:///etc/heat/templates/AWS_CloudWatch_Alarm.yaml", 153 "OS::Metering::Alarm": "OS::Ceilometer::Alarm", 154 "AWS::RDS::DBInstance": "file:///etc/heat/templates/AWS_RDS_DBInstance.yaml", 155 "resources": map[string]interface{}{ 156 "my_db_server": map[string]interface{}{ 157 "OS::DBInstance": "file:///home/mine/all_my_cool_templates/db.yaml", 158 }, 159 "my_server": map[string]interface{}{ 160 "OS::DBInstance": "file:///home/mine/all_my_cool_templates/db.yaml", 161 "hooks": "pre-create", 162 }, 163 "nested_stack": map[string]interface{}{ 164 "nested_resource": map[string]interface{}{ 165 "hooks": "pre-update", 166 }, 167 "another_resource": map[string]interface{}{ 168 "hooks": []interface{}{ 169 "pre-create", 170 "pre-update", 171 }, 172 }, 173 }, 174 }, 175 }, 176 } 177 178 // ValidJSONTemplateParsed is the expected parsed version of ValidJSONTemplate 179 var ValidJSONTemplateParsed = map[string]interface{}{ 180 "heat_template_version": "2014-10-16", 181 "parameters": map[string]interface{}{ 182 "flavor": map[string]interface{}{ 183 "default": "debian2G", 184 "description": "Flavor for the server to be created", 185 "hidden": true, 186 "type": "string", 187 }, 188 }, 189 "resources": map[string]interface{}{ 190 "test_server": map[string]interface{}{ 191 "properties": map[string]interface{}{ 192 "flavor": "2 GB General Purpose v1", 193 "image": "Debian 7 (Wheezy) (PVHVM)", 194 "name": "test-server", 195 }, 196 "type": "OS::Nova::Server", 197 }, 198 }, 199 }