22
33import { APIResource } from '../../../resource' ;
44import * as Core from '../../../core' ;
5+ import * as ProxyEndpointsAPI from './proxy-endpoints' ;
56import { SinglePage } from '../../../pagination' ;
67
78export class ProxyEndpoints extends APIResource {
@@ -13,7 +14,6 @@ export class ProxyEndpoints extends APIResource {
1314 * const proxyEndpoint =
1415 * await client.zeroTrust.gateway.proxyEndpoints.create({
1516 * account_id: '699d98642c564d2e855e9661899b7252',
16- * ips: ['192.0.2.1/32'],
1717 * name: 'Devops team',
1818 * });
1919 * ```
@@ -33,19 +33,24 @@ export class ProxyEndpoints extends APIResource {
3333 *
3434 * @example
3535 * ```ts
36- * const proxyEndpoint =
37- * await client.zeroTrust.gateway.proxyEndpoints.list({
38- * account_id: '699d98642c564d2e855e9661899b7252',
39- * });
36+ * // Automatically fetches more pages as needed.
37+ * for await (const proxyEndpoint of client.zeroTrust.gateway.proxyEndpoints.list(
38+ * { account_id: '699d98642c564d2e855e9661899b7252' },
39+ * )) {
40+ * // ...
41+ * }
4042 * ```
4143 */
42- list ( params : ProxyEndpointListParams , options ?: Core . RequestOptions ) : Core . APIPromise < ProxyEndpoint > {
44+ list (
45+ params : ProxyEndpointListParams ,
46+ options ?: Core . RequestOptions ,
47+ ) : Core . PagePromise < ProxyEndpointsSinglePage , ProxyEndpoint > {
4348 const { account_id } = params ;
44- return (
45- this . _client . get ( `/accounts/${ account_id } /gateway/proxy_endpoints` , options ) as Core . APIPromise < {
46- result : ProxyEndpoint ;
47- } >
48- ) . _thenUnwrap ( ( obj ) => obj . result ) ;
49+ return this . _client . getAPIList (
50+ `/accounts/${ account_id } /gateway/proxy_endpoints` ,
51+ ProxyEndpointsSinglePage ,
52+ options ,
53+ ) ;
4954 }
5055
5156 /**
@@ -105,26 +110,25 @@ export class ProxyEndpoints extends APIResource {
105110 *
106111 * @example
107112 * ```ts
108- * // Automatically fetches more pages as needed.
109- * for await (const proxyEndpoint of client.zeroTrust.gateway.proxyEndpoints.get(
110- * 'ed35569b41ce4d1facfe683550f54086',
111- * { account_id: '699d98642c564d2e855e9661899b7252' },
112- * )) {
113- * // ...
114- * }
113+ * const proxyEndpoint =
114+ * await client.zeroTrust.gateway.proxyEndpoints.get(
115+ * 'ed35569b41ce4d1facfe683550f54086',
116+ * { account_id: '699d98642c564d2e855e9661899b7252' },
117+ * );
115118 * ```
116119 */
117120 get (
118121 proxyEndpointId : string ,
119122 params : ProxyEndpointGetParams ,
120123 options ?: Core . RequestOptions ,
121- ) : Core . PagePromise < ProxyEndpointsSinglePage , ProxyEndpoint > {
124+ ) : Core . APIPromise < ProxyEndpoint > {
122125 const { account_id } = params ;
123- return this . _client . getAPIList (
124- `/accounts/${ account_id } /gateway/proxy_endpoints/${ proxyEndpointId } ` ,
125- ProxyEndpointsSinglePage ,
126- options ,
127- ) ;
126+ return (
127+ this . _client . get (
128+ `/accounts/${ account_id } /gateway/proxy_endpoints/${ proxyEndpointId } ` ,
129+ options ,
130+ ) as Core . APIPromise < { result : ProxyEndpoint } >
131+ ) . _thenUnwrap ( ( obj ) => obj . result ) ;
128132 }
129133}
130134
@@ -142,46 +146,103 @@ export type GatewayIPs = string;
142146 */
143147export type GatewayIPsParam = string ;
144148
145- export interface ProxyEndpoint {
146- id ?: string ;
149+ export type ProxyEndpoint =
150+ | ProxyEndpoint . ZeroTrustGatewayProxyEndpointIP
151+ | ProxyEndpoint . ZeroTrustGatewayProxyEndpointIdentity ;
147152
148- created_at ?: string ;
153+ export namespace ProxyEndpoint {
154+ export interface ZeroTrustGatewayProxyEndpointIP {
155+ /**
156+ * Specify the list of CIDRs to restrict ingress connections.
157+ */
158+ ips : Array < ProxyEndpointsAPI . GatewayIPs > ;
149159
150- /**
151- * Specify the list of CIDRs to restrict ingress connections .
152- */
153- ips ?: Array < GatewayIPs > ;
160+ /**
161+ * Specify the name of the proxy endpoint .
162+ */
163+ name : string ;
154164
155- /**
156- * Specify the name of the proxy endpoint.
157- */
158- name ?: string ;
165+ id ?: string ;
159166
160- /**
161- * Specify the subdomain to use as the destination in the proxy client.
162- */
163- subdomain ?: string ;
167+ created_at ?: string ;
168+
169+ /**
170+ * The proxy endpoint kind
171+ */
172+ kind ?: 'ip' ;
173+
174+ /**
175+ * Specify the subdomain to use as the destination in the proxy client.
176+ */
177+ subdomain ?: string ;
178+
179+ updated_at ?: string ;
180+ }
181+
182+ export interface ZeroTrustGatewayProxyEndpointIdentity {
183+ /**
184+ * The proxy endpoint kind
185+ */
186+ kind : 'identity' ;
187+
188+ /**
189+ * Specify the name of the proxy endpoint.
190+ */
191+ name : string ;
192+
193+ id ?: string ;
194+
195+ created_at ?: string ;
196+
197+ /**
198+ * Specify the subdomain to use as the destination in the proxy client.
199+ */
200+ subdomain ?: string ;
164201
165- updated_at ?: string ;
202+ updated_at ?: string ;
203+ }
166204}
167205
168206export type ProxyEndpointDeleteResponse = unknown ;
169207
170- export interface ProxyEndpointCreateParams {
171- /**
172- * Path param:
173- */
174- account_id : string ;
208+ export type ProxyEndpointCreateParams =
209+ | ProxyEndpointCreateParams . ZeroTrustGatewayProxyEndpointIPCreate
210+ | ProxyEndpointCreateParams . ZeroTrustGatewayProxyEndpointIdentityCreate ;
175211
176- /**
177- * Body param: Specify the list of CIDRs to restrict ingress connections.
178- */
179- ips : Array < GatewayIPsParam > ;
212+ export declare namespace ProxyEndpointCreateParams {
213+ export interface ZeroTrustGatewayProxyEndpointIPCreate {
214+ /**
215+ * Path param:
216+ */
217+ account_id : string ;
180218
181- /**
182- * Body param: Specify the name of the proxy endpoint.
183- */
184- name : string ;
219+ /**
220+ * Body param: Specify the name of the proxy endpoint.
221+ */
222+ name : string ;
223+
224+ /**
225+ * Body param: The proxy endpoint kind
226+ */
227+ kind ?: 'ip' ;
228+ }
229+
230+ export interface ZeroTrustGatewayProxyEndpointIdentityCreate {
231+ /**
232+ * Path param:
233+ */
234+ account_id : string ;
235+
236+ /**
237+ * Body param: The proxy endpoint kind
238+ */
239+ kind : 'identity' ;
240+
241+ /**
242+ * Body param: Specify the name of the proxy endpoint.
243+ */
244+ name : string ;
245+ }
185246}
186247
187248export interface ProxyEndpointListParams {
0 commit comments