cloudflare/cloudflare-typescript
Publicmirrored from https://github.com/cloudflare/cloudflare-typescriptAvailable
src/resources/acm/total-tls.ts
130lines · modecode
| 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | |
| 3 | import { APIResource } from '../../resource'; |
| 4 | import * as Core from '../../core'; |
| 5 | |
| 6 | export class TotalTLS extends APIResource { |
| 7 | /** |
| 8 | * Set Total TLS Settings or disable the feature for a Zone. |
| 9 | * |
| 10 | * @example |
| 11 | * ```ts |
| 12 | * const totalTLS = await client.acm.totalTLS.create({ |
| 13 | * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', |
| 14 | * enabled: true, |
| 15 | * }); |
| 16 | * ``` |
| 17 | */ |
| 18 | create( |
| 19 | params: TotalTLSCreateParams, |
| 20 | options?: Core.RequestOptions, |
| 21 | ): Core.APIPromise<TotalTLSCreateResponse> { |
| 22 | const { zone_id, ...body } = params; |
| 23 | return ( |
| 24 | this._client.post(`/zones/${zone_id}/acm/total_tls`, { body, ...options }) as Core.APIPromise<{ |
| 25 | result: TotalTLSCreateResponse; |
| 26 | }> |
| 27 | )._thenUnwrap((obj) => obj.result); |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Get Total TLS Settings for a Zone. |
| 32 | * |
| 33 | * @example |
| 34 | * ```ts |
| 35 | * const totalTLS = await client.acm.totalTLS.get({ |
| 36 | * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', |
| 37 | * }); |
| 38 | * ``` |
| 39 | */ |
| 40 | get(params: TotalTLSGetParams, options?: Core.RequestOptions): Core.APIPromise<TotalTLSGetResponse> { |
| 41 | const { zone_id } = params; |
| 42 | return ( |
| 43 | this._client.get(`/zones/${zone_id}/acm/total_tls`, options) as Core.APIPromise<{ |
| 44 | result: TotalTLSGetResponse; |
| 45 | }> |
| 46 | )._thenUnwrap((obj) => obj.result); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * The Certificate Authority that Total TLS certificates will be issued through. |
| 52 | */ |
| 53 | export type CertificateAuthority = 'google' | 'lets_encrypt' | 'ssl_com'; |
| 54 | |
| 55 | /** |
| 56 | * The Certificate Authority that Total TLS certificates will be issued through. |
| 57 | */ |
| 58 | export type CertificateAuthorityParam = 'google' | 'lets_encrypt' | 'ssl_com'; |
| 59 | |
| 60 | export interface TotalTLSCreateResponse { |
| 61 | /** |
| 62 | * The Certificate Authority that Total TLS certificates will be issued through. |
| 63 | */ |
| 64 | certificate_authority?: CertificateAuthority; |
| 65 | |
| 66 | /** |
| 67 | * If enabled, Total TLS will order a hostname specific TLS certificate for any |
| 68 | * proxied A, AAAA, or CNAME record in your zone. |
| 69 | */ |
| 70 | enabled?: boolean; |
| 71 | |
| 72 | /** |
| 73 | * The validity period in days for the certificates ordered via Total TLS. |
| 74 | */ |
| 75 | validity_period?: 90; |
| 76 | } |
| 77 | |
| 78 | export interface TotalTLSGetResponse { |
| 79 | /** |
| 80 | * The Certificate Authority that Total TLS certificates will be issued through. |
| 81 | */ |
| 82 | certificate_authority?: CertificateAuthority; |
| 83 | |
| 84 | /** |
| 85 | * If enabled, Total TLS will order a hostname specific TLS certificate for any |
| 86 | * proxied A, AAAA, or CNAME record in your zone. |
| 87 | */ |
| 88 | enabled?: boolean; |
| 89 | |
| 90 | /** |
| 91 | * The validity period in days for the certificates ordered via Total TLS. |
| 92 | */ |
| 93 | validity_period?: 90; |
| 94 | } |
| 95 | |
| 96 | export interface TotalTLSCreateParams { |
| 97 | /** |
| 98 | * Path param: Identifier. |
| 99 | */ |
| 100 | zone_id: string; |
| 101 | |
| 102 | /** |
| 103 | * Body param: If enabled, Total TLS will order a hostname specific TLS certificate |
| 104 | * for any proxied A, AAAA, or CNAME record in your zone. |
| 105 | */ |
| 106 | enabled: boolean; |
| 107 | |
| 108 | /** |
| 109 | * Body param: The Certificate Authority that Total TLS certificates will be issued |
| 110 | * through. |
| 111 | */ |
| 112 | certificate_authority?: CertificateAuthorityParam; |
| 113 | } |
| 114 | |
| 115 | export interface TotalTLSGetParams { |
| 116 | /** |
| 117 | * Identifier. |
| 118 | */ |
| 119 | zone_id: string; |
| 120 | } |
| 121 | |
| 122 | export declare namespace TotalTLS { |
| 123 | export { |
| 124 | type CertificateAuthority as CertificateAuthority, |
| 125 | type TotalTLSCreateResponse as TotalTLSCreateResponse, |
| 126 | type TotalTLSGetResponse as TotalTLSGetResponse, |
| 127 | type TotalTLSCreateParams as TotalTLSCreateParams, |
| 128 | type TotalTLSGetParams as TotalTLSGetParams, |
| 129 | }; |
| 130 | } |
| 131 | |