templates.go 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. // Copyright Joyent, Inc.
  2. //
  3. // This Source Code Form is subject to the terms of the Mozilla Public
  4. // License, v. 2.0. If a copy of the MPL was not distributed with this
  5. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
  6. package main
  7. const validationStatesWithResultsTemplate = `{{ range . }}
  8. - ID: {{ .ID }}
  9. Created: {{ TimeStr .Created }}
  10. Completed: {{ TimeStr .Completed }}
  11. Status: {{ .Status }}
  12. Validation Plan: {{ .ValidationPlan.Name }}{{ if len .Results }}
  13. Results:
  14. {{ .Results }}
  15. {{ end }}{{ end }}
  16. `
  17. const deviceTemplate = `
  18. ID: {{ .ID }}
  19. Serial: {{ .Serial }}
  20. Asset Tag: {{ .AssetTag }}
  21. Hostname: {{ .Hostname }}
  22. System UUID: {{ .SystemUUID }}
  23. Phase: {{ .Phase }}
  24. Health: {{ .Health }}
  25. Validated: {{ if not $.Validated.IsZero }}{{ .Validated.Local }}{{ end }}
  26. Created: {{ TimeStr .Created }}
  27. Updated: {{ TimeStr .Updated }}
  28. Last Seen: {{ TimeStr .LastSeen }}{{ if .Links }}
  29. Links: {{ range .Links }}
  30. - {{ $ }}
  31. {{ end }}{{ end }}
  32. Hardware:
  33. Name: {{ .HardwareProduct.Name }}
  34. Legacy Name: {{ .HardwareProduct.LegacyProductName }}
  35. Alias: {{ .HardwareProduct.Alias }}
  36. Prefix: {{ .HardwareProduct.Prefix }}
  37. SKU: {{ .HardwareProduct.SKU }}
  38. Generation Name: {{ .HardwareProduct.GenerationName }}
  39. Location: {{- if ne .Phase "integration" }} ** Device has left integration. This data is historic and likely not accurate. **{{ end }}
  40. AZ: {{ .Location.Room.AZ }}
  41. Datacenter:
  42. ID: {{ .Location.Datacenter.ID }}
  43. Vendor: {{ .Location.Datacenter.Vendor }} / {{ .Location.Datacenter.VendorName }}
  44. Region: {{ .Location.Datacenter.Region }}
  45. Location: {{ .Location.Datacenter.Location }}
  46. Room:
  47. ID: {{ .Location.Room.ID }}
  48. Alias: {{ .Location.Room.Alias }}
  49. Vendor Name: {{ .Location.Room.VendorName }}
  50. Rack:
  51. ID: {{ .Location.Rack.ID }}
  52. Name: {{ .Location.Rack.Name }}{{ if ne .RackRole.Name "" }}
  53. Role: {{ .RackRole.Name }}{{ end }}
  54. Phase: {{ .Location.Rack.Phase }}
  55. RU: {{ .Location.RackUnitStart }}
  56. Network Interfaces: {{ range .Nics }}
  57. - {{ .InterfaceName }} - {{ .Mac }}
  58. Type: {{ .InterfaceType }}
  59. Vendor: {{ .InterfaceVendor }}{{ if ne .PeerMac "" }}
  60. Peer: {{ .PeerMac }}{{ end }}{{ if ne .PeerSwitch "" }} - {{ .PeerSwitch }}{{ end }}
  61. {{ end }}
  62. Disks:{{range $name, $slots := .Enclosures}}
  63. Enclosure: {{ $name }}{{ range $slots }}
  64. Slot: {{ .Slot }}
  65. SN: {{ .SerialNumber }}
  66. Type: {{ .DriveType }}
  67. Vendor: {{ .Vendor }}
  68. Model: {{ .Model }}
  69. Size: {{ .Size }}
  70. Health: {{ .Health }}
  71. Firmware: {{ .Firmware }}
  72. Transport: {{ .Transport }}
  73. {{ end }}{{ end }}
  74. Validations:
  75. {{ .Validations }}
  76. `
  77. const workspaceRelayTemplate = `
  78. ID: {{ .ID }}
  79. Name: {{ .Alias }}
  80. Version: {{ .Version }}
  81. Created: {{ TimeStr .Created }}
  82. Updated: {{ TimeStr .Updated }}
  83. Last Seen: {{ TimeStr .LastSeen }}
  84. IP Address: {{ .IpAddr }}
  85. SSH Port: {{ .SshPort }}
  86. Location:
  87. AZ: {{ .Location.AZ }}
  88. Rack Name: {{ .Location.RackName }}
  89. Rack Unit: {{ .Location.RackUnitStart }}
  90. Rack ID: {{ .Location.RackID }}
  91. `
  92. const relayTemplate = `
  93. ID: {{ .ID }}
  94. Serial Number: {{ .SerialNumber }}
  95. Name: {{ .Name }}
  96. Version: {{ .Version }}
  97. Created: {{ TimeStr .Created }}
  98. Updated: {{ TimeStr .Updated }}
  99. IP Address: {{ .IpAddr }}
  100. SSH Port: {{ .SshPort }}
  101. `
  102. const rackSummaryTemplate = `
  103. Name: {{ .AZ }} {{ .Name }}
  104. ID: {{ .ID }}
  105. Size: {{ .RackSize }}
  106. Phase: {{ .Phase }}
  107. Device Progress: {{ range .Statuses }}
  108. * {{ .Status }}: {{ .Count -}}
  109. {{end}}
  110. `
  111. const workspaceTemplate = `
  112. Name: {{ .Name }}
  113. ID: {{ .ID }}
  114. Description: {{ .Description }}
  115. Your Role: {{ .Role }}
  116. Your Role Was Derived From: {{ if eq "" $.Via }}[Direct Assignment]{{ else }}{{ .Via }}{{ end }}
  117. `
  118. const detailedUserTemplate = `
  119. ID: {{ .ID }}
  120. Name: {{ .Name }}
  121. Email: {{ .Email }}
  122. System Admin: {{ if $.IsAdmin }}Yes{{ else }}No{{ end }}
  123. Created: {{ TimeStr .Created }}
  124. Last Login: {{ if $.LastLogin.IsZero }}Never/Unknown{{ else }}{{ TimeStr .LastLogin }}{{ end }}
  125. Workspaces:
  126. {{ .Workspaces }}
  127. `
  128. const datacenterTemplate = `
  129. ID: {{ .ID }}
  130. Vendor: {{ .Vendor }}
  131. Vendor Name: {{ .VendorName }}
  132. Region: {{ .Region }}
  133. Location: {{ .Location }}
  134. Created: {{ TimeStr .Created }}
  135. Updated: {{ TimeStr .Updated }}
  136. `
  137. const roomTemplate = `
  138. Alias: {{ .Alias }}
  139. AZ: {{ .AZ }}
  140. Vendor Name: {{ .VendorName }}
  141. Datacenter ID: {{ .DatacenterID }}
  142. Created: {{ TimeStr .Created }}
  143. Updated: {{ TimeStr .Updated }}
  144. `
  145. const rackRoleTemplate = `
  146. Name: {{ .Name }}
  147. Rack Size: {{ .RackSize }}
  148. Created: {{ TimeStr .Created }}
  149. Updated: {{ TimeStr .Updated }}
  150. `
  151. const rackTemplate = `
  152. ID: {{ .ID }}
  153. Name: {{ .Name }}
  154. Serial Number: {{ .SerialNumber }}
  155. Asset Tag: {{ .AssetTag }}
  156. Phase: {{ .Phase }}
  157. Role: {{ .Role.Name }}
  158. Room: {{ .Room.Alias }}
  159. Created: {{ TimeStr .Created }}
  160. Updated: {{ TimeStr .Updated }}
  161. `
  162. const deviceLocationTemplate = `
  163. Datacenter:
  164. ID: {{ .Datacenter.ID }}
  165. Vendor: {{ .Datacenter.Vendor }}
  166. Vendor Name: {{ .Datacenter.VendorName }}
  167. Region: {{ .Datacenter.Region }}
  168. Location: {{ .Datacenter.Location }}
  169. Room:
  170. ID: {{ .Room.ID }}
  171. Alias: {{ .Room.Alias }}
  172. AZ: {{ .Room.AZ }}
  173. Vendor Name: {{ .Room.VendorName }}
  174. Rack:
  175. ID: {{ .Rack.ID }}
  176. Name: {{ .Rack.Name }}
  177. Serial Number: {{ .Rack.SerialNumber }}
  178. Asset Tag: {{ .Rack.AssetTag }}
  179. Phase: {{ .Rack.Phase }}
  180. Role: {{ .Rack.Role.Name }}
  181. Rack Unit Start: {{ .RackUnitStart }}
  182. `
  183. const deviceNicTemplate = `
  184. Name: {{ .InterfaceName }}
  185. Vendor: {{ .InterfaceVendor }}
  186. Driver: {{ .InterfaceDriver }}
  187. IP Address: {{ .IpAddress }}
  188. MAC: {{ .MAC }}
  189. MTU: {{ .MTU }}
  190. State: {{ .State }}
  191. Device ID: {{ .DeviceID }}
  192. `