(customDomain *management.CustomDomain)
| 140 | } |
| 141 | |
| 142 | func makeCustomDomainView(customDomain *management.CustomDomain) *customDomainView { |
| 143 | metadata, err := toJSONString(customDomain.GetDomainMetadata()) |
| 144 | if err != nil { |
| 145 | return nil |
| 146 | } |
| 147 | |
| 148 | view := &customDomainView{ |
| 149 | ID: ansi.Faint(customDomain.GetID()), |
| 150 | Domain: customDomain.GetDomain(), |
| 151 | Status: customDomainStatusColor(customDomain.GetStatus()), |
| 152 | Primary: boolean(customDomain.GetPrimary()), |
| 153 | ProvisioningType: customDomain.GetType(), |
| 154 | TLSPolicy: customDomain.GetTLSPolicy(), |
| 155 | CustomClientIPHeader: customDomain.GetCustomClientIPHeader(), |
| 156 | DomainMetadata: metadata, |
| 157 | CertificateStatus: customDomain.GetCertificate().GetStatus(), |
| 158 | CertificateAuthority: customDomain.GetCertificate().GetCertificateAuthority(), |
| 159 | CertificateRenewsBefore: customDomain.GetCertificate().GetRenewsBefore(), |
| 160 | IsDefault: boolean(customDomain.GetIsDefault()), |
| 161 | raw: customDomain, |
| 162 | } |
| 163 | |
| 164 | if len(customDomain.GetVerification().Methods) > 0 { |
| 165 | method := customDomain.GetVerification().Methods[0] |
| 166 | if name, ok := method["name"].(string); ok { |
| 167 | view.VerificationMethod = name |
| 168 | } |
| 169 | if record, ok := method["record"].(string); ok { |
| 170 | view.VerificationRecord = record |
| 171 | } |
| 172 | if domain, ok := method["domain"].(string); ok { |
| 173 | view.VerificationDomain = domain |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | return view |
| 178 | } |
| 179 | |
| 180 | func customDomainStatusColor(v string) string { |
| 181 | switch v { |
no test coverage detected