auto_cert.ts 1014 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import http from '@/lib/http'
  2. export const AutoCertChallengeMethod = {
  3. http01: 'http01',
  4. dns01: 'dns01',
  5. } as const
  6. export interface DNSProvider {
  7. name?: string
  8. code?: string
  9. provider?: string
  10. configuration: {
  11. credentials: Record<string, string>
  12. additional: Record<string, string>
  13. }
  14. links?: {
  15. api: string
  16. go_client: string
  17. }
  18. }
  19. export interface AutoCertOptions {
  20. name?: string
  21. domains: string[]
  22. code?: string
  23. dns_credential_id?: number | null
  24. challenge_method: keyof typeof AutoCertChallengeMethod
  25. configuration?: DNSProvider['configuration']
  26. key_type: string
  27. acme_user_id?: number
  28. provider?: string
  29. must_staple?: boolean
  30. lego_disable_cname_support?: boolean
  31. revoke_old?: boolean
  32. }
  33. const auto_cert = {
  34. get_dns_providers(): Promise<DNSProvider[]> {
  35. return http.get('/certificate/dns_providers')
  36. },
  37. get_dns_provider(code: string): Promise<DNSProvider> {
  38. return http.get(`/certificate/dns_provider/${code}`)
  39. },
  40. }
  41. export default auto_cert