From 1fd5e47cf08fbdd84f031d9ecb018567d5df6d70 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 31 May 2024 00:55:37 +0000 Subject: [PATCH] feat(api): update via SDK Studio (#676) --- .stats.yml | 4 +- README.md | 2 +- api.md | 248 ++-- src/index.ts | 3 + src/resources/ai-gateway/ai-gateway.ts | 56 +- src/resources/api-gateway/api-gateway.ts | 60 + src/resources/api-gateway/configurations.ts | 154 +++ .../api-gateway/discovery/discovery.ts | 114 ++ src/resources/api-gateway/discovery/index.ts | 10 + .../api-gateway/discovery/operations.ts | 145 +++ src/resources/api-gateway/index.ts | 44 + src/resources/api-gateway/operations/index.ts | 22 + .../api-gateway/operations/operations.ts | 326 +++++ .../operations/schema-validation.ts | 176 +++ .../api-gateway/schema-validation.ts | 59 + src/resources/api-gateway/schemas.ts | 49 + src/resources/api-gateway/settings/index.ts | 9 + .../api-gateway/settings/schema-validation.ts | 92 ++ .../api-gateway/settings/settings.ts | 17 + .../api-gateway/user-schemas/index.ts | 21 + .../api-gateway/user-schemas/operations.ts | 105 ++ .../api-gateway/user-schemas/user-schemas.ts | 265 ++++ src/resources/cache/cache.ts | 95 +- src/resources/d1/d1.ts | 2 + src/resources/d1/database.ts | 75 +- src/resources/d1/index.ts | 2 + src/resources/index.ts | 1 + src/resources/kv/index.ts | 1 + src/resources/kv/kv.ts | 1 + src/resources/kv/namespaces/index.ts | 1 + src/resources/kv/namespaces/namespaces.ts | 25 + src/resources/r2/buckets.ts | 11 + src/resources/radar/bgp/bgp.ts | 7 +- src/resources/radar/bgp/index.ts | 3 +- src/resources/radar/bgp/ips.ts | 138 +++ src/resources/radar/bgp/routes.ts | 118 -- src/resources/zero-trust/access/access.ts | 29 - .../access/applications/applications.ts | 17 - .../zero-trust/access/applications/cas.ts | 175 --- .../zero-trust/access/applications/index.ts | 30 +- .../access/applications/policies.ts | 734 +---------- src/resources/zero-trust/access/bookmarks.ts | 88 +- .../access/certificates/certificates.ts | 176 --- .../zero-trust/access/certificates/index.ts | 4 - .../zero-trust/access/custom-pages.ts | 134 +- src/resources/zero-trust/access/groups.ts | 190 --- src/resources/zero-trust/access/index.ts | 37 +- src/resources/zero-trust/access/keys.ts | 61 +- .../zero-trust/access/logs/access-requests.ts | 17 +- src/resources/zero-trust/access/logs/index.ts | 2 +- src/resources/zero-trust/access/logs/logs.ts | 1 - .../zero-trust/access/service-tokens.ts | 234 ---- src/resources/zero-trust/access/tags.ts | 92 +- .../access/users/active-sessions.ts | 172 +-- .../zero-trust/access/users/failed-logins.ts | 33 +- .../zero-trust/access/users/index.ts | 11 +- .../access/users/last-seen-identity.ts | 15 +- .../zero-trust/access/users/users.ts | 20 - .../zero-trust/identity-providers.ts | 1091 ----------------- src/resources/zero-trust/index.ts | 6 +- src/resources/zero-trust/seats.ts | 39 +- src/resources/zero-trust/zero-trust.ts | 6 - .../ai-gateway/ai-gateway.test.ts | 14 +- .../api-gateway/configurations.test.ts | 52 + .../discovery/discovery.test.ts} | 19 +- .../api-gateway/discovery/operations.test.ts | 62 + .../api-gateway/operations/operations.test.ts | 107 ++ .../operations/schema-validation.test.ts | 81 ++ .../schema-validation.test.ts} | 23 +- .../api-resources/api-gateway/schemas.test.ts | 33 + .../settings/schema-validation.test.ts | 53 + .../user-schemas/operations.test.ts} | 31 +- .../user-schemas/user-schemas.test.ts | 119 ++ tests/api-resources/cache/cache.test.ts | 5 +- tests/api-resources/d1/database.test.ts | 22 + .../kv/namespaces/namespaces.test.ts | 19 + tests/api-resources/r2/buckets.test.ts | 1 + .../bgp/ips.test.ts} | 32 +- tests/api-resources/radar/bgp/routes.test.ts | 36 - .../access/applications/cas.test.ts | 45 - .../access/applications/policies.test.ts | 199 --- .../zero-trust/access/bookmarks.test.ts | 128 -- .../access/certificates/certificates.test.ts | 60 - .../zero-trust/access/custom-pages.test.ts | 144 --- .../zero-trust/access/groups.test.ts | 76 -- .../zero-trust/access/keys.test.ts | 71 -- .../zero-trust/access/service-tokens.test.ts | 95 -- .../zero-trust/access/tags.test.ts | 120 -- .../access/users/active-sessions.test.ts | 64 - .../zero-trust/identity-providers.test.ts | 74 -- tests/api-resources/zero-trust/seats.test.ts | 37 - 91 files changed, 2819 insertions(+), 4878 deletions(-) create mode 100644 src/resources/api-gateway/api-gateway.ts create mode 100644 src/resources/api-gateway/configurations.ts create mode 100644 src/resources/api-gateway/discovery/discovery.ts create mode 100644 src/resources/api-gateway/discovery/index.ts create mode 100644 src/resources/api-gateway/discovery/operations.ts create mode 100644 src/resources/api-gateway/index.ts create mode 100644 src/resources/api-gateway/operations/index.ts create mode 100644 src/resources/api-gateway/operations/operations.ts create mode 100644 src/resources/api-gateway/operations/schema-validation.ts create mode 100644 src/resources/api-gateway/schema-validation.ts create mode 100644 src/resources/api-gateway/schemas.ts create mode 100644 src/resources/api-gateway/settings/index.ts create mode 100644 src/resources/api-gateway/settings/schema-validation.ts create mode 100644 src/resources/api-gateway/settings/settings.ts create mode 100644 src/resources/api-gateway/user-schemas/index.ts create mode 100644 src/resources/api-gateway/user-schemas/operations.ts create mode 100644 src/resources/api-gateway/user-schemas/user-schemas.ts create mode 100644 src/resources/radar/bgp/ips.ts create mode 100644 tests/api-resources/api-gateway/configurations.test.ts rename tests/api-resources/{zero-trust/access/users/users.test.ts => api-gateway/discovery/discovery.test.ts} (56%) create mode 100644 tests/api-resources/api-gateway/discovery/operations.test.ts create mode 100644 tests/api-resources/api-gateway/operations/operations.test.ts create mode 100644 tests/api-resources/api-gateway/operations/schema-validation.test.ts rename tests/api-resources/{zero-trust/access/logs/access-requests.test.ts => api-gateway/schema-validation.test.ts} (54%) create mode 100644 tests/api-resources/api-gateway/schemas.test.ts create mode 100644 tests/api-resources/api-gateway/settings/schema-validation.test.ts rename tests/api-resources/{zero-trust/access/users/failed-logins.test.ts => api-gateway/user-schemas/operations.test.ts} (54%) create mode 100644 tests/api-resources/api-gateway/user-schemas/user-schemas.test.ts rename tests/api-resources/{zero-trust/access/users/last-seen-identity.test.ts => radar/bgp/ips.test.ts} (52%) delete mode 100644 tests/api-resources/zero-trust/access/applications/policies.test.ts delete mode 100644 tests/api-resources/zero-trust/access/bookmarks.test.ts delete mode 100644 tests/api-resources/zero-trust/access/custom-pages.test.ts delete mode 100644 tests/api-resources/zero-trust/access/keys.test.ts delete mode 100644 tests/api-resources/zero-trust/access/tags.test.ts delete mode 100644 tests/api-resources/zero-trust/access/users/active-sessions.test.ts delete mode 100644 tests/api-resources/zero-trust/seats.test.ts diff --git a/.stats.yml b/.stats.yml index 719796ae24..30e67c9adb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 1297 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-5cc7607a4825bf9606463ee28fc976b8498b237c981bcb896211b60b6fe5c146.yml +configured_endpoints: 1274 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-14c9c9adbd65eee546c4f54d95b7627f10b02185348e334a68cbebbe3442733e.yml diff --git a/README.md b/README.md index addc89963b..7b768a83bc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Cloudflare Typescript API Library -[![NPM version](https://img.shields.io/npm/v/cloudflare.svg)](https://npmjs.org/package/cloudflare) +[![NPM version](https://img.shields.io/npm/v/cloudflare.svg)](https://npmjs.org/package/cloudflare) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/cloudflare) This library provides convenient access to the Cloudflare REST API from server-side TypeScript or JavaScript. diff --git a/api.md b/api.md index 024a8b4445..900c76fa41 100644 --- a/api.md +++ b/api.md @@ -2422,6 +2422,7 @@ Methods: - client.kv.namespaces.update(namespaceId, { ...params }) -> NamespaceUpdateResponse - client.kv.namespaces.list({ ...params }) -> NamespacesV4PagePaginationArray - client.kv.namespaces.delete(namespaceId, { ...params }) -> NamespaceDeleteResponse +- client.kv.namespaces.get(namespaceId, { ...params }) -> Namespace ### Bulk @@ -2537,6 +2538,127 @@ Methods: - client.queues.messages.ack(queueId, { ...params }) -> MessageAckResponse | null - client.queues.messages.pull(queueId, { ...params }) -> MessagePullResponse | null +# APIGateway + +## Configurations + +Types: + +- Configuration +- ConfigurationUpdateResponse + +Methods: + +- client.apiGateway.configurations.update({ ...params }) -> ConfigurationUpdateResponse +- client.apiGateway.configurations.get({ ...params }) -> Configuration + +## Discovery + +Types: + +- DiscoveryOperation +- DiscoveryGetResponse + +Methods: + +- client.apiGateway.discovery.get({ ...params }) -> DiscoveryGetResponse + +### Operations + +Types: + +- OperationEditResponse + +Methods: + +- client.apiGateway.discovery.operations.list({ ...params }) -> DiscoveryOperationsSinglePage +- client.apiGateway.discovery.operations.edit(operationId, { ...params }) -> OperationEditResponse + +## Operations + +Types: + +- APIShield +- OperationCreateResponse +- OperationDeleteResponse + +Methods: + +- client.apiGateway.operations.create([ ...body ]) -> OperationCreateResponse | null +- client.apiGateway.operations.list({ ...params }) -> APIShieldsSinglePage +- client.apiGateway.operations.delete(operationId, { ...params }) -> OperationDeleteResponse +- client.apiGateway.operations.get(operationId, { ...params }) -> APIShield + +### SchemaValidation + +Types: + +- SettingsMultipleRequest +- SchemaValidationUpdateResponse +- SchemaValidationGetResponse + +Methods: + +- client.apiGateway.operations.schemaValidation.update(operationId, { ...params }) -> SchemaValidationUpdateResponse +- client.apiGateway.operations.schemaValidation.edit({ ...params }) -> SettingsMultipleRequest +- client.apiGateway.operations.schemaValidation.get(operationId, { ...params }) -> SchemaValidationGetResponse + +## Schemas + +Types: + +- SchemaListResponse + +Methods: + +- client.apiGateway.schemas.list({ ...params }) -> SchemaListResponse + +## Settings + +### SchemaValidation + +Types: + +- Settings + +Methods: + +- client.apiGateway.settings.schemaValidation.update({ ...params }) -> Settings +- client.apiGateway.settings.schemaValidation.get({ ...params }) -> Settings + +## UserSchemas + +Types: + +- Message +- PublicSchema +- SchemaUpload +- UserSchemaDeleteResponse + +Methods: + +- client.apiGateway.userSchemas.create({ ...params }) -> SchemaUpload +- client.apiGateway.userSchemas.list({ ...params }) -> PublicSchemasSinglePage +- client.apiGateway.userSchemas.delete(schemaId, { ...params }) -> UserSchemaDeleteResponse +- client.apiGateway.userSchemas.edit(schemaId, { ...params }) -> PublicSchema +- client.apiGateway.userSchemas.get(schemaId, { ...params }) -> PublicSchema + +### Operations + +Types: + +- OperationListResponse + +Methods: + +- client.apiGateway.userSchemas.operations.list(schemaId, { ...params }) -> OperationListResponsesSinglePage + +## SchemaValidation + +Methods: + +- client.apiGateway.schemaValidation.edit({ ...params }) -> Settings + # ManagedHeaders Types: @@ -3992,6 +4114,7 @@ Types: - DatabaseListResponse - DatabaseDeleteResponse - DatabaseQueryResponse +- DatabaseRawResponse Methods: @@ -4000,6 +4123,7 @@ Methods: - client.d1.database.delete(databaseId, { ...params }) -> DatabaseDeleteResponse - client.d1.database.get(databaseId, { ...params }) -> D1 - client.d1.database.query(databaseId, { ...params }) -> DatabaseQueryResponse +- client.d1.database.raw(databaseId, { ...params }) -> DatabaseRawResponse # R2 @@ -4361,15 +4485,11 @@ Types: - IdentityProviderType - ScimConfig - IdentityProviderListResponse -- IdentityProviderDeleteResponse Methods: - client.zeroTrust.identityProviders.create({ ...params }) -> IdentityProvider -- client.zeroTrust.identityProviders.update(uuid, { ...params }) -> IdentityProvider - client.zeroTrust.identityProviders.list({ ...params }) -> IdentityProviderListResponsesSinglePage -- client.zeroTrust.identityProviders.delete(uuid, { ...params }) -> IdentityProviderDeleteResponse -- client.zeroTrust.identityProviders.get(uuid, { ...params }) -> IdentityProvider ## Organizations @@ -4391,11 +4511,6 @@ Methods: Types: - Seat -- SeatEditResponse - -Methods: - -- client.zeroTrust.seats.edit(identifier, [ ...body ]) -> SeatEditResponse | null ## Access @@ -4461,16 +4576,10 @@ Methods: Types: - CA -- CACreateResponse -- CADeleteResponse -- CAGetResponse Methods: -- client.zeroTrust.access.applications.cas.create(uuid, { ...params }) -> CACreateResponse - client.zeroTrust.access.applications.cas.list({ ...params }) -> CAsSinglePage -- client.zeroTrust.access.applications.cas.delete(uuid, { ...params }) -> CADeleteResponse -- client.zeroTrust.access.applications.cas.get(uuid, { ...params }) -> CAGetResponse #### UserPolicyChecks @@ -4489,19 +4598,6 @@ Types: - ApprovalGroup - Policy -- PolicyCreateResponse -- PolicyUpdateResponse -- PolicyListResponse -- PolicyDeleteResponse -- PolicyGetResponse - -Methods: - -- client.zeroTrust.access.applications.policies.create(uuid, { ...params }) -> PolicyCreateResponse -- client.zeroTrust.access.applications.policies.update(uuid1, uuid, { ...params }) -> PolicyUpdateResponse -- client.zeroTrust.access.applications.policies.list(uuid, { ...params }) -> PolicyListResponsesSinglePage -- client.zeroTrust.access.applications.policies.delete(uuid1, uuid, { ...params }) -> PolicyDeleteResponse -- client.zeroTrust.access.applications.policies.get(uuid1, uuid, { ...params }) -> PolicyGetResponse ### Certificates @@ -4509,15 +4605,11 @@ Types: - AssociatedHostnames - Certificate -- CertificateDeleteResponse Methods: - client.zeroTrust.access.certificates.create({ ...params }) -> Certificate -- client.zeroTrust.access.certificates.update(uuid, { ...params }) -> Certificate - client.zeroTrust.access.certificates.list({ ...params }) -> CertificatesSinglePage -- client.zeroTrust.access.certificates.delete(uuid, { ...params }) -> CertificateDeleteResponse -- client.zeroTrust.access.certificates.get(uuid, { ...params }) -> Certificate #### Settings @@ -4537,15 +4629,11 @@ Methods: Types: - ZeroTrustGroup -- GroupDeleteResponse Methods: - client.zeroTrust.access.groups.create({ ...params }) -> ZeroTrustGroup -- client.zeroTrust.access.groups.update(uuid, { ...params }) -> ZeroTrustGroup - client.zeroTrust.access.groups.list({ ...params }) -> ZeroTrustGroupsSinglePage -- client.zeroTrust.access.groups.delete(uuid, { ...params }) -> GroupDeleteResponse -- client.zeroTrust.access.groups.get(uuid, { ...params }) -> ZeroTrustGroup ### ServiceTokens @@ -4553,47 +4641,20 @@ Types: - ServiceToken - ServiceTokenCreateResponse -- ServiceTokenRotateResponse Methods: - client.zeroTrust.access.serviceTokens.create({ ...params }) -> ServiceTokenCreateResponse -- client.zeroTrust.access.serviceTokens.update(uuid, { ...params }) -> ServiceToken - client.zeroTrust.access.serviceTokens.list({ ...params }) -> ServiceTokensSinglePage -- client.zeroTrust.access.serviceTokens.delete(uuid, { ...params }) -> ServiceToken -- client.zeroTrust.access.serviceTokens.get(uuid, { ...params }) -> ServiceToken -- client.zeroTrust.access.serviceTokens.refresh(identifier, uuid) -> ServiceToken -- client.zeroTrust.access.serviceTokens.rotate(identifier, uuid) -> ServiceTokenRotateResponse ### Bookmarks Types: - Bookmark -- BookmarkDeleteResponse - -Methods: - -- client.zeroTrust.access.bookmarks.create(identifier, uuid, { ...params }) -> Bookmark -- client.zeroTrust.access.bookmarks.update(identifier, uuid, { ...params }) -> Bookmark -- client.zeroTrust.access.bookmarks.list(identifier) -> BookmarksSinglePage -- client.zeroTrust.access.bookmarks.delete(identifier, uuid) -> BookmarkDeleteResponse -- client.zeroTrust.access.bookmarks.get(identifier, uuid) -> Bookmark ### Keys -Types: - -- KeyUpdateResponse -- KeyGetResponse -- KeyRotateResponse - -Methods: - -- client.zeroTrust.access.keys.update(identifier, { ...params }) -> KeyUpdateResponse -- client.zeroTrust.access.keys.get(identifier) -> KeyGetResponse -- client.zeroTrust.access.keys.rotate(identifier) -> KeyRotateResponse - ### Logs #### AccessRequests @@ -4601,11 +4662,6 @@ Methods: Types: - AccessRequests -- AccessRequestListResponse - -Methods: - -- client.zeroTrust.access.logs.accessRequests.list(identifier) -> AccessRequestListResponse | null ### Users @@ -4613,72 +4669,28 @@ Types: - AccessUser -Methods: - -- client.zeroTrust.access.users.list(identifier) -> AccessUsersSinglePage - #### ActiveSessions -Types: - -- ActiveSessionListResponse -- ActiveSessionGetResponse - -Methods: - -- client.zeroTrust.access.users.activeSessions.list(identifier, id) -> ActiveSessionListResponsesSinglePage -- client.zeroTrust.access.users.activeSessions.get(identifier, id, nonce) -> ActiveSessionGetResponse - #### LastSeenIdentity Types: - Identity -Methods: - -- client.zeroTrust.access.users.lastSeenIdentity.get(identifier, id) -> Identity - #### FailedLogins -Types: - -- FailedLoginListResponse - -Methods: - -- client.zeroTrust.access.users.failedLogins.list(identifier, id) -> FailedLoginListResponsesSinglePage - ### CustomPages Types: - CustomPage - CustomPageWithoutHTML -- CustomPageDeleteResponse - -Methods: - -- client.zeroTrust.access.customPages.create(identifier, { ...params }) -> CustomPageWithoutHTML -- client.zeroTrust.access.customPages.update(identifier, uuid, { ...params }) -> CustomPageWithoutHTML -- client.zeroTrust.access.customPages.list(identifier) -> CustomPageWithoutHTMLsSinglePage -- client.zeroTrust.access.customPages.delete(identifier, uuid) -> CustomPageDeleteResponse -- client.zeroTrust.access.customPages.get(identifier, uuid) -> CustomPage ### Tags Types: - Tag -- TagDeleteResponse - -Methods: - -- client.zeroTrust.access.tags.create(identifier, { ...params }) -> Tag -- client.zeroTrust.access.tags.update(identifier, tagName, { ...params }) -> Tag -- client.zeroTrust.access.tags.list(identifier) -> TagsSinglePage -- client.zeroTrust.access.tags.delete(identifier, name) -> TagDeleteResponse -- client.zeroTrust.access.tags.get(identifier, name) -> Tag ## DEX @@ -5435,14 +5447,22 @@ Types: - RouteMoasResponse - RoutePfx2asResponse - RouteStatsResponse -- RouteTimeseriesResponse Methods: - client.radar.bgp.routes.moas({ ...params }) -> RouteMoasResponse - client.radar.bgp.routes.pfx2as({ ...params }) -> RoutePfx2asResponse - client.radar.bgp.routes.stats({ ...params }) -> RouteStatsResponse -- client.radar.bgp.routes.timeseries({ ...params }) -> RouteTimeseriesResponse + +### IPs + +Types: + +- IPTimeseriesResponse + +Methods: + +- client.radar.bgp.ips.timeseries({ ...params }) -> IPTimeseriesResponse ## Datasets diff --git a/src/index.ts b/src/index.ts index db392dfd87..10f30a6964 100644 --- a/src/index.ts +++ b/src/index.ts @@ -180,6 +180,7 @@ export class Cloudflare extends Core.APIClient { kv: API.KV = new API.KV(this); durableObjects: API.DurableObjects = new API.DurableObjects(this); queues: API.Queues = new API.Queues(this); + apiGateway: API.APIGateway = new API.APIGateway(this); managedHeaders: API.ManagedHeaders = new API.ManagedHeaders(this); pageShield: API.PageShield = new API.PageShield(this); rulesets: API.Rulesets = new API.Rulesets(this); @@ -466,6 +467,8 @@ export namespace Cloudflare { export import Queues = API.Queues; + export import APIGateway = API.APIGateway; + export import ManagedHeaders = API.ManagedHeaders; export import PageShield = API.PageShield; diff --git a/src/resources/ai-gateway/ai-gateway.ts b/src/resources/ai-gateway/ai-gateway.ts index 6f4df4ccbb..55f8da923e 100644 --- a/src/resources/ai-gateway/ai-gateway.ts +++ b/src/resources/ai-gateway/ai-gateway.ts @@ -104,7 +104,7 @@ export namespace AIGatewayCreateResponse { cache_invalidate_on_update: boolean; - cache_ttl: number; + cache_ttl: number | null; collect_logs: boolean; @@ -112,11 +112,11 @@ export namespace AIGatewayCreateResponse { modified_at: string; - rate_limiting_interval?: number; + rate_limiting_interval: number | null; - rate_limiting_limit?: number; + rate_limiting_limit: number | null; - rate_limiting_technique?: string; + rate_limiting_technique: 'fixed' | 'sliding'; } } @@ -128,7 +128,7 @@ export interface AIGatewayUpdateResponse { cache_invalidate_on_update: boolean; - cache_ttl: number; + cache_ttl: number | null; collect_logs: boolean; @@ -136,11 +136,11 @@ export interface AIGatewayUpdateResponse { modified_at: string; - rate_limiting_interval?: number; + rate_limiting_interval: number | null; - rate_limiting_limit?: number; + rate_limiting_limit: number | null; - rate_limiting_technique?: string; + rate_limiting_technique: 'fixed' | 'sliding'; } export interface AIGatewayListResponse { @@ -151,7 +151,7 @@ export interface AIGatewayListResponse { cache_invalidate_on_update: boolean; - cache_ttl: number; + cache_ttl: number | null; collect_logs: boolean; @@ -159,11 +159,11 @@ export interface AIGatewayListResponse { modified_at: string; - rate_limiting_interval?: number; + rate_limiting_interval: number | null; - rate_limiting_limit?: number; + rate_limiting_limit: number | null; - rate_limiting_technique?: string; + rate_limiting_technique: 'fixed' | 'sliding'; } export interface AIGatewayDeleteResponse { @@ -174,7 +174,7 @@ export interface AIGatewayDeleteResponse { cache_invalidate_on_update: boolean; - cache_ttl: number; + cache_ttl: number | null; collect_logs: boolean; @@ -182,11 +182,11 @@ export interface AIGatewayDeleteResponse { modified_at: string; - rate_limiting_interval?: number; + rate_limiting_interval: number | null; - rate_limiting_limit?: number; + rate_limiting_limit: number | null; - rate_limiting_technique?: string; + rate_limiting_technique: 'fixed' | 'sliding'; } export interface AIGatewayGetResponse { @@ -197,7 +197,7 @@ export interface AIGatewayGetResponse { cache_invalidate_on_update: boolean; - cache_ttl: number; + cache_ttl: number | null; collect_logs: boolean; @@ -205,11 +205,11 @@ export interface AIGatewayGetResponse { modified_at: string; - rate_limiting_interval?: number; + rate_limiting_interval: number | null; - rate_limiting_limit?: number; + rate_limiting_limit: number | null; - rate_limiting_technique?: string; + rate_limiting_technique: 'fixed' | 'sliding'; } export interface AIGatewayCreateParams { @@ -231,7 +231,7 @@ export interface AIGatewayCreateParams { /** * Body param: */ - cache_ttl: number; + cache_ttl: number | null; /** * Body param: @@ -241,17 +241,17 @@ export interface AIGatewayCreateParams { /** * Body param: */ - rate_limiting_interval?: number; + rate_limiting_interval: number | null; /** * Body param: */ - rate_limiting_limit?: number; + rate_limiting_limit: number | null; /** * Body param: */ - rate_limiting_technique?: string; + rate_limiting_technique: 'fixed' | 'sliding'; } export interface AIGatewayUpdateParams { @@ -268,7 +268,7 @@ export interface AIGatewayUpdateParams { /** * Body param: */ - cache_ttl: number; + cache_ttl: number | null; /** * Body param: @@ -278,17 +278,17 @@ export interface AIGatewayUpdateParams { /** * Body param: */ - rate_limiting_interval?: number; + rate_limiting_interval: number | null; /** * Body param: */ - rate_limiting_limit?: number; + rate_limiting_limit: number | null; /** * Body param: */ - rate_limiting_technique?: string; + rate_limiting_technique: 'fixed' | 'sliding'; } export interface AIGatewayListParams extends V4PagePaginationArrayParams { diff --git a/src/resources/api-gateway/api-gateway.ts b/src/resources/api-gateway/api-gateway.ts new file mode 100644 index 0000000000..0957813e97 --- /dev/null +++ b/src/resources/api-gateway/api-gateway.ts @@ -0,0 +1,60 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as ConfigurationsAPI from './configurations'; +import * as SchemaValidationAPI from './schema-validation'; +import * as SchemasAPI from './schemas'; +import * as DiscoveryAPI from './discovery/discovery'; +import * as OperationsAPI from './operations/operations'; +import * as SettingsAPI from './settings/settings'; +import * as UserSchemasAPI from './user-schemas/user-schemas'; + +export class APIGateway extends APIResource { + configurations: ConfigurationsAPI.Configurations = new ConfigurationsAPI.Configurations(this._client); + discovery: DiscoveryAPI.Discovery = new DiscoveryAPI.Discovery(this._client); + operations: OperationsAPI.Operations = new OperationsAPI.Operations(this._client); + schemas: SchemasAPI.Schemas = new SchemasAPI.Schemas(this._client); + settings: SettingsAPI.Settings = new SettingsAPI.Settings(this._client); + userSchemas: UserSchemasAPI.UserSchemas = new UserSchemasAPI.UserSchemas(this._client); + schemaValidation: SchemaValidationAPI.SchemaValidation = new SchemaValidationAPI.SchemaValidation( + this._client, + ); +} + +export namespace APIGateway { + export import Configurations = ConfigurationsAPI.Configurations; + export import Configuration = ConfigurationsAPI.Configuration; + export import ConfigurationUpdateResponse = ConfigurationsAPI.ConfigurationUpdateResponse; + export import ConfigurationUpdateParams = ConfigurationsAPI.ConfigurationUpdateParams; + export import ConfigurationGetParams = ConfigurationsAPI.ConfigurationGetParams; + export import Discovery = DiscoveryAPI.Discovery; + export import DiscoveryOperation = DiscoveryAPI.DiscoveryOperation; + export import DiscoveryGetResponse = DiscoveryAPI.DiscoveryGetResponse; + export import DiscoveryGetParams = DiscoveryAPI.DiscoveryGetParams; + export import Operations = OperationsAPI.Operations; + export import APIShield = OperationsAPI.APIShield; + export import OperationCreateResponse = OperationsAPI.OperationCreateResponse; + export import OperationDeleteResponse = OperationsAPI.OperationDeleteResponse; + export import APIShieldsSinglePage = OperationsAPI.APIShieldsSinglePage; + export import OperationCreateParams = OperationsAPI.OperationCreateParams; + export import OperationListParams = OperationsAPI.OperationListParams; + export import OperationDeleteParams = OperationsAPI.OperationDeleteParams; + export import OperationGetParams = OperationsAPI.OperationGetParams; + export import Schemas = SchemasAPI.Schemas; + export import SchemaListResponse = SchemasAPI.SchemaListResponse; + export import SchemaListParams = SchemasAPI.SchemaListParams; + export import Settings = SettingsAPI.Settings; + export import UserSchemas = UserSchemasAPI.UserSchemas; + export import Message = UserSchemasAPI.Message; + export import PublicSchema = UserSchemasAPI.PublicSchema; + export import SchemaUpload = UserSchemasAPI.SchemaUpload; + export import UserSchemaDeleteResponse = UserSchemasAPI.UserSchemaDeleteResponse; + export import PublicSchemasSinglePage = UserSchemasAPI.PublicSchemasSinglePage; + export import UserSchemaCreateParams = UserSchemasAPI.UserSchemaCreateParams; + export import UserSchemaListParams = UserSchemasAPI.UserSchemaListParams; + export import UserSchemaDeleteParams = UserSchemasAPI.UserSchemaDeleteParams; + export import UserSchemaEditParams = UserSchemasAPI.UserSchemaEditParams; + export import UserSchemaGetParams = UserSchemasAPI.UserSchemaGetParams; + export import SchemaValidation = SchemaValidationAPI.SchemaValidation; + export import SchemaValidationEditParams = SchemaValidationAPI.SchemaValidationEditParams; +} diff --git a/src/resources/api-gateway/configurations.ts b/src/resources/api-gateway/configurations.ts new file mode 100644 index 0000000000..58a49bcd0e --- /dev/null +++ b/src/resources/api-gateway/configurations.ts @@ -0,0 +1,154 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import * as Core from '../../core'; +import { APIResource } from '../../resource'; +import * as ConfigurationsAPI from './configurations'; + +export class Configurations extends APIResource { + /** + * Set configuration properties + */ + update( + params: ConfigurationUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.put(`/zones/${zone_id}/api_gateway/configuration`, { + body, + ...options, + }) as Core.APIPromise<{ result: ConfigurationUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieve information about specific configuration properties + */ + get(params: ConfigurationGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, ...query } = params; + return ( + this._client.get(`/zones/${zone_id}/api_gateway/configuration`, { + query, + ...options, + }) as Core.APIPromise<{ result: Configuration }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface Configuration { + auth_id_characteristics?: Array< + Configuration.APIShieldAuthIDCharacteristic | Configuration.APIShieldAuthIDCharacteristicJwtClaim + >; +} + +export namespace Configuration { + /** + * Auth ID Characteristic + */ + export interface APIShieldAuthIDCharacteristic { + /** + * The name of the characteristic field, i.e., the header or cookie name. + */ + name: string; + + /** + * The type of characteristic. + */ + type: 'header' | 'cookie'; + } + + /** + * Auth ID Characteristic extracted from JWT Token Claims + */ + export interface APIShieldAuthIDCharacteristicJwtClaim { + /** + * Claim location expressed as `$(token_config_id):$(json_path)`, where + * `token_config_id` is the ID of the token configuration used in validating the + * JWT, and `json_path` is a RFC 9535 JSONPath + * (https://goessner.net/articles/JsonPath/, + * https://www.rfc-editor.org/rfc/rfc9535.html). The JSONPath expression may be in + * dot or bracket notation, may only specify literal keys or array indexes, and + * must return a singleton value, which will be interpreted as a string. + */ + name: string; + + /** + * The type of characteristic. + */ + type: 'jwt'; + } +} + +export type ConfigurationUpdateResponse = unknown | string | null; + +export interface ConfigurationUpdateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: + */ + auth_id_characteristics?: Array< + | ConfigurationUpdateParams.APIShieldAuthIDCharacteristic + | ConfigurationUpdateParams.APIShieldAuthIDCharacteristicJwtClaim + >; +} + +export namespace ConfigurationUpdateParams { + /** + * Auth ID Characteristic + */ + export interface APIShieldAuthIDCharacteristic { + /** + * The name of the characteristic field, i.e., the header or cookie name. + */ + name: string; + + /** + * The type of characteristic. + */ + type: 'header' | 'cookie'; + } + + /** + * Auth ID Characteristic extracted from JWT Token Claims + */ + export interface APIShieldAuthIDCharacteristicJwtClaim { + /** + * Claim location expressed as `$(token_config_id):$(json_path)`, where + * `token_config_id` is the ID of the token configuration used in validating the + * JWT, and `json_path` is a RFC 9535 JSONPath + * (https://goessner.net/articles/JsonPath/, + * https://www.rfc-editor.org/rfc/rfc9535.html). The JSONPath expression may be in + * dot or bracket notation, may only specify literal keys or array indexes, and + * must return a singleton value, which will be interpreted as a string. + */ + name: string; + + /** + * The type of characteristic. + */ + type: 'jwt'; + } +} + +export interface ConfigurationGetParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Query param: Requests information about certain properties. + */ + properties?: Array<'auth_id_characteristics'>; +} + +export namespace Configurations { + export import Configuration = ConfigurationsAPI.Configuration; + export import ConfigurationUpdateResponse = ConfigurationsAPI.ConfigurationUpdateResponse; + export import ConfigurationUpdateParams = ConfigurationsAPI.ConfigurationUpdateParams; + export import ConfigurationGetParams = ConfigurationsAPI.ConfigurationGetParams; +} diff --git a/src/resources/api-gateway/discovery/discovery.ts b/src/resources/api-gateway/discovery/discovery.ts new file mode 100644 index 0000000000..6652c760d9 --- /dev/null +++ b/src/resources/api-gateway/discovery/discovery.ts @@ -0,0 +1,114 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import * as Core from '../../../core'; +import { APIResource } from '../../../resource'; +import * as DiscoveryAPI from './discovery'; +import * as OperationsAPI from './operations'; +import { SinglePage } from '../../../pagination'; + +export class Discovery extends APIResource { + operations: OperationsAPI.Operations = new OperationsAPI.Operations(this._client); + + /** + * Retrieve the most up to date view of discovered operations, rendered as OpenAPI + * schemas + */ + get(params: DiscoveryGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.get(`/zones/${zone_id}/api_gateway/discovery`, options) as Core.APIPromise<{ + result: DiscoveryGetResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class DiscoveryOperationsSinglePage extends SinglePage {} + +export interface DiscoveryOperation { + /** + * UUID identifier + */ + id: string; + + /** + * The endpoint which can contain path parameter templates in curly braces, each + * will be replaced from left to right with {varN}, starting with {var1}, during + * insertion. This will further be Cloudflare-normalized upon insertion. See: + * https://developers.cloudflare.com/rules/normalization/how-it-works/. + */ + endpoint: string; + + /** + * RFC3986-compliant host. + */ + host: string; + + last_updated: string; + + /** + * The HTTP method used to access the endpoint. + */ + method: 'GET' | 'POST' | 'HEAD' | 'OPTIONS' | 'PUT' | 'DELETE' | 'CONNECT' | 'PATCH' | 'TRACE'; + + /** + * API discovery engine(s) that discovered this operation + */ + origin: Array<'ML' | 'SessionIdentifier'>; + + /** + * State of operation in API Discovery + * + * - `review` - Operation is not saved into API Shield Endpoint Management + * - `saved` - Operation is saved into API Shield Endpoint Management + * - `ignored` - Operation is marked as ignored + */ + state: 'review' | 'saved' | 'ignored'; + + features?: DiscoveryOperation.Features; +} + +export namespace DiscoveryOperation { + export interface Features { + traffic_stats?: Features.TrafficStats; + } + + export namespace Features { + export interface TrafficStats { + last_updated: string; + + /** + * The period in seconds these statistics were computed over + */ + period_seconds: number; + + /** + * The average number of requests seen during this period + */ + requests: number; + } + } +} + +export interface DiscoveryGetResponse { + schemas?: Array; + + timestamp?: string; +} + +export interface DiscoveryGetParams { + /** + * Identifier + */ + zone_id: string; +} + +export namespace Discovery { + export import DiscoveryOperation = DiscoveryAPI.DiscoveryOperation; + export import DiscoveryGetResponse = DiscoveryAPI.DiscoveryGetResponse; + export import DiscoveryGetParams = DiscoveryAPI.DiscoveryGetParams; + export import Operations = OperationsAPI.Operations; + export import OperationEditResponse = OperationsAPI.OperationEditResponse; + export import OperationListParams = OperationsAPI.OperationListParams; + export import OperationEditParams = OperationsAPI.OperationEditParams; +} diff --git a/src/resources/api-gateway/discovery/index.ts b/src/resources/api-gateway/discovery/index.ts new file mode 100644 index 0000000000..d9a28a8a0f --- /dev/null +++ b/src/resources/api-gateway/discovery/index.ts @@ -0,0 +1,10 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + DiscoveryOperation, + DiscoveryGetResponse, + DiscoveryGetParams, + DiscoveryOperationsSinglePage, + Discovery, +} from './discovery'; +export { OperationEditResponse, OperationListParams, OperationEditParams, Operations } from './operations'; diff --git a/src/resources/api-gateway/discovery/operations.ts b/src/resources/api-gateway/discovery/operations.ts new file mode 100644 index 0000000000..92b4d50ec8 --- /dev/null +++ b/src/resources/api-gateway/discovery/operations.ts @@ -0,0 +1,145 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import * as Core from '../../../core'; +import { APIResource } from '../../../resource'; +import * as OperationsAPI from './operations'; +import * as DiscoveryAPI from './discovery'; +import { DiscoveryOperationsSinglePage } from './discovery'; + +export class Operations extends APIResource { + /** + * Retrieve the most up to date view of discovered operations + */ + list( + params: OperationListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { zone_id, ...query } = params; + return this._client.getAPIList( + `/zones/${zone_id}/api_gateway/discovery/operations`, + DiscoveryOperationsSinglePage, + { query, ...options }, + ); + } + + /** + * Update the `state` on a discovered operation + */ + edit( + operationId: string, + params: OperationEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.patch(`/zones/${zone_id}/api_gateway/discovery/operations/${operationId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: OperationEditResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface OperationEditResponse { + /** + * State of operation in API Discovery + * + * - `review` - Operation is not saved into API Shield Endpoint Management + * - `saved` - Operation is saved into API Shield Endpoint Management + * - `ignored` - Operation is marked as ignored + */ + state?: 'review' | 'saved' | 'ignored'; +} + +export interface OperationListParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Query param: When `true`, only return API Discovery results that are not saved + * into API Shield Endpoint Management + */ + diff?: boolean; + + /** + * Query param: Direction to order results. + */ + direction?: 'asc' | 'desc'; + + /** + * Query param: Filter results to only include endpoints containing this pattern. + */ + endpoint?: string; + + /** + * Query param: Filter results to only include the specified hosts. + */ + host?: Array; + + /** + * Query param: Filter results to only include the specified HTTP methods. + */ + method?: Array; + + /** + * Query param: Field to order by + */ + order?: 'host' | 'method' | 'endpoint' | 'traffic_stats.requests' | 'traffic_stats.last_updated'; + + /** + * Query param: Filter results to only include discovery results sourced from a + * particular discovery engine + * + * - `ML` - Discovered operations that were sourced using ML API Discovery + * - `SessionIdentifier` - Discovered operations that were sourced using Session + * Identifier API Discovery + */ + origin?: 'ML' | 'SessionIdentifier'; + + /** + * Query param: Page number of paginated results. + */ + page?: unknown; + + /** + * Query param: Maximum number of results per page. + */ + per_page?: unknown; + + /** + * Query param: Filter results to only include discovery results in a particular + * state. States are as follows + * + * - `review` - Discovered operations that are not saved into API Shield Endpoint + * Management + * - `saved` - Discovered operations that are already saved into API Shield + * Endpoint Management + * - `ignored` - Discovered operations that have been marked as ignored + */ + state?: 'review' | 'saved' | 'ignored'; +} + +export interface OperationEditParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: Mark state of operation in API Discovery + * + * - `review` - Mark operation as for review + * - `ignored` - Mark operation as ignored + */ + state?: 'review' | 'ignored'; +} + +export namespace Operations { + export import OperationEditResponse = OperationsAPI.OperationEditResponse; + export import OperationListParams = OperationsAPI.OperationListParams; + export import OperationEditParams = OperationsAPI.OperationEditParams; +} + +export { DiscoveryOperationsSinglePage }; diff --git a/src/resources/api-gateway/index.ts b/src/resources/api-gateway/index.ts new file mode 100644 index 0000000000..80ea14c8e8 --- /dev/null +++ b/src/resources/api-gateway/index.ts @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { APIGateway } from './api-gateway'; +export { + APIShield, + OperationCreateResponse, + OperationDeleteResponse, + OperationCreateParams, + OperationListParams, + OperationDeleteParams, + OperationGetParams, + APIShieldsSinglePage, + Operations, +} from './operations/index'; +export { + Configuration, + ConfigurationUpdateResponse, + ConfigurationUpdateParams, + ConfigurationGetParams, + Configurations, +} from './configurations'; +export { + DiscoveryOperation, + DiscoveryGetResponse, + DiscoveryGetParams, + DiscoveryOperationsSinglePage, + Discovery, +} from './discovery/index'; +export { + Message, + PublicSchema, + SchemaUpload, + UserSchemaDeleteResponse, + UserSchemaCreateParams, + UserSchemaListParams, + UserSchemaDeleteParams, + UserSchemaEditParams, + UserSchemaGetParams, + PublicSchemasSinglePage, + UserSchemas, +} from './user-schemas/index'; +export { SchemaListResponse, SchemaListParams, Schemas } from './schemas'; +export { SchemaValidationEditParams, SchemaValidation } from './schema-validation'; +export { Settings } from './settings/index'; diff --git a/src/resources/api-gateway/operations/index.ts b/src/resources/api-gateway/operations/index.ts new file mode 100644 index 0000000000..b1d264f242 --- /dev/null +++ b/src/resources/api-gateway/operations/index.ts @@ -0,0 +1,22 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + APIShield, + OperationCreateResponse, + OperationDeleteResponse, + OperationCreateParams, + OperationListParams, + OperationDeleteParams, + OperationGetParams, + APIShieldsSinglePage, + Operations, +} from './operations'; +export { + SettingsMultipleRequest, + SchemaValidationUpdateResponse, + SchemaValidationGetResponse, + SchemaValidationUpdateParams, + SchemaValidationEditParams, + SchemaValidationGetParams, + SchemaValidation, +} from './schema-validation'; diff --git a/src/resources/api-gateway/operations/operations.ts b/src/resources/api-gateway/operations/operations.ts new file mode 100644 index 0000000000..2f57455e78 --- /dev/null +++ b/src/resources/api-gateway/operations/operations.ts @@ -0,0 +1,326 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import * as Core from '../../../core'; +import { APIResource } from '../../../resource'; +import * as OperationsAPI from './operations'; +import * as SchemaValidationAPI from './schema-validation'; +import { SinglePage } from '../../../pagination'; + +export class Operations extends APIResource { + schemaValidation: SchemaValidationAPI.SchemaValidation = new SchemaValidationAPI.SchemaValidation( + this._client, + ); + + /** + * Add one or more operations to a zone. Endpoints can contain path variables. + * Host, method, endpoint will be normalized to a canoncial form when creating an + * operation and must be unique on the zone. Inserting an operation that matches an + * existing one will return the record of the already existing operation and update + * its last_updated date. + */ + create( + params: OperationCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, body } = params; + return ( + this._client.post(`/zones/${zone_id}/api_gateway/operations`, { + body: body, + ...options, + }) as Core.APIPromise<{ result: OperationCreateResponse | null }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieve information about all operations on a zone + */ + list( + params: OperationListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { zone_id, ...query } = params; + return this._client.getAPIList(`/zones/${zone_id}/api_gateway/operations`, APIShieldsSinglePage, { + query, + ...options, + }); + } + + /** + * Delete an operation + */ + delete( + operationId: string, + params: OperationDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.delete( + `/zones/${zone_id}/api_gateway/operations/${operationId}`, + options, + ) as Core.APIPromise<{ result: OperationDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieve information about an operation + */ + get( + operationId: string, + params: OperationGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...query } = params; + return ( + this._client.get(`/zones/${zone_id}/api_gateway/operations/${operationId}`, { + query, + ...options, + }) as Core.APIPromise<{ result: APIShield }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class APIShieldsSinglePage extends SinglePage {} + +export interface APIShield { + /** + * The endpoint which can contain path parameter templates in curly braces, each + * will be replaced from left to right with {varN}, starting with {var1}, during + * insertion. This will further be Cloudflare-normalized upon insertion. See: + * https://developers.cloudflare.com/rules/normalization/how-it-works/. + */ + endpoint: string; + + /** + * RFC3986-compliant host. + */ + host: string; + + last_updated: string; + + /** + * The HTTP method used to access the endpoint. + */ + method: 'GET' | 'POST' | 'HEAD' | 'OPTIONS' | 'PUT' | 'DELETE' | 'CONNECT' | 'PATCH' | 'TRACE'; + + /** + * UUID identifier + */ + operation_id: string; + + features?: + | APIShield.APIShieldOperationFeatureThresholds + | APIShield.APIShieldOperationFeatureParameterSchemas; +} + +export namespace APIShield { + export interface APIShieldOperationFeatureThresholds { + thresholds?: APIShieldOperationFeatureThresholds.Thresholds; + } + + export namespace APIShieldOperationFeatureThresholds { + export interface Thresholds { + /** + * The total number of auth-ids seen across this calculation. + */ + auth_id_tokens?: number; + + /** + * The number of data points used for the threshold suggestion calculation. + */ + data_points?: number; + + last_updated?: string; + + /** + * The p50 quantile of requests (in period_seconds). + */ + p50?: number; + + /** + * The p90 quantile of requests (in period_seconds). + */ + p90?: number; + + /** + * The p99 quantile of requests (in period_seconds). + */ + p99?: number; + + /** + * The period over which this threshold is suggested. + */ + period_seconds?: number; + + /** + * The estimated number of requests covered by these calculations. + */ + requests?: number; + + /** + * The suggested threshold in requests done by the same auth_id or period_seconds. + */ + suggested_threshold?: number; + } + } + + export interface APIShieldOperationFeatureParameterSchemas { + parameter_schemas: APIShieldOperationFeatureParameterSchemas.ParameterSchemas; + } + + export namespace APIShieldOperationFeatureParameterSchemas { + export interface ParameterSchemas { + last_updated?: string; + + /** + * An operation schema object containing a response. + */ + parameter_schemas?: ParameterSchemas.ParameterSchemas; + } + + export namespace ParameterSchemas { + /** + * An operation schema object containing a response. + */ + export interface ParameterSchemas { + /** + * An array containing the learned parameter schemas. + */ + parameters?: Array; + + /** + * An empty response object. This field is required to yield a valid operation + * schema. + */ + responses?: unknown | null; + } + } + } +} + +export type OperationCreateResponse = Array; + +export type OperationDeleteResponse = unknown | string | null; + +export interface OperationCreateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: + */ + body: Array; +} + +export namespace OperationCreateParams { + export interface Body { + /** + * The endpoint which can contain path parameter templates in curly braces, each + * will be replaced from left to right with {varN}, starting with {var1}, during + * insertion. This will further be Cloudflare-normalized upon insertion. See: + * https://developers.cloudflare.com/rules/normalization/how-it-works/. + */ + endpoint: string; + + /** + * RFC3986-compliant host. + */ + host: string; + + /** + * The HTTP method used to access the endpoint. + */ + method: 'GET' | 'POST' | 'HEAD' | 'OPTIONS' | 'PUT' | 'DELETE' | 'CONNECT' | 'PATCH' | 'TRACE'; + } +} + +export interface OperationListParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Query param: Direction to order results. + */ + direction?: 'asc' | 'desc'; + + /** + * Query param: Filter results to only include endpoints containing this pattern. + */ + endpoint?: string; + + /** + * Query param: Add feature(s) to the results. The feature name that is given here + * corresponds to the resulting feature object. Have a look at the top-level object + * description for more details on the specific meaning. + */ + feature?: Array<'thresholds' | 'parameter_schemas' | 'schema_info'>; + + /** + * Query param: Filter results to only include the specified hosts. + */ + host?: Array; + + /** + * Query param: Filter results to only include the specified HTTP methods. + */ + method?: Array; + + /** + * Query param: Field to order by. When requesting a feature, the feature keys are + * available for ordering as well, e.g., `thresholds.suggested_threshold`. + */ + order?: 'method' | 'host' | 'endpoint' | 'thresholds.$key'; + + /** + * Query param: Page number of paginated results. + */ + page?: unknown; + + /** + * Query param: Number of results to return per page + */ + per_page?: number; +} + +export interface OperationDeleteParams { + /** + * Identifier + */ + zone_id: string; +} + +export interface OperationGetParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Query param: Add feature(s) to the results. The feature name that is given here + * corresponds to the resulting feature object. Have a look at the top-level object + * description for more details on the specific meaning. + */ + feature?: Array<'thresholds' | 'parameter_schemas' | 'schema_info'>; +} + +export namespace Operations { + export import APIShield = OperationsAPI.APIShield; + export import OperationCreateResponse = OperationsAPI.OperationCreateResponse; + export import OperationDeleteResponse = OperationsAPI.OperationDeleteResponse; + export import APIShieldsSinglePage = OperationsAPI.APIShieldsSinglePage; + export import OperationCreateParams = OperationsAPI.OperationCreateParams; + export import OperationListParams = OperationsAPI.OperationListParams; + export import OperationDeleteParams = OperationsAPI.OperationDeleteParams; + export import OperationGetParams = OperationsAPI.OperationGetParams; + export import SchemaValidation = SchemaValidationAPI.SchemaValidation; + export import SettingsMultipleRequest = SchemaValidationAPI.SettingsMultipleRequest; + export import SchemaValidationUpdateResponse = SchemaValidationAPI.SchemaValidationUpdateResponse; + export import SchemaValidationGetResponse = SchemaValidationAPI.SchemaValidationGetResponse; + export import SchemaValidationUpdateParams = SchemaValidationAPI.SchemaValidationUpdateParams; + export import SchemaValidationEditParams = SchemaValidationAPI.SchemaValidationEditParams; + export import SchemaValidationGetParams = SchemaValidationAPI.SchemaValidationGetParams; +} diff --git a/src/resources/api-gateway/operations/schema-validation.ts b/src/resources/api-gateway/operations/schema-validation.ts new file mode 100644 index 0000000000..967cfd4148 --- /dev/null +++ b/src/resources/api-gateway/operations/schema-validation.ts @@ -0,0 +1,176 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import * as Core from '../../../core'; +import { APIResource } from '../../../resource'; +import * as SchemaValidationAPI from './schema-validation'; + +export class SchemaValidation extends APIResource { + /** + * Updates operation-level schema validation settings on the zone + */ + update( + operationId: string, + params: SchemaValidationUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return this._client.put(`/zones/${zone_id}/api_gateway/operations/${operationId}/schema_validation`, { + body, + ...options, + }); + } + + /** + * Updates multiple operation-level schema validation settings on the zone + */ + edit( + params: SchemaValidationEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, settings_multiple_request } = params; + return ( + this._client.patch(`/zones/${zone_id}/api_gateway/operations/schema_validation`, { + body: settings_multiple_request, + ...options, + }) as Core.APIPromise<{ result: SettingsMultipleRequest }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieves operation-level schema validation settings on the zone + */ + get( + operationId: string, + params: SchemaValidationGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; + return this._client.get( + `/zones/${zone_id}/api_gateway/operations/${operationId}/schema_validation`, + options, + ); + } +} + +export type SettingsMultipleRequest = Record< + string, + SettingsMultipleRequest.api_shield_operation_schema_validation_settings_multiple_request_entry +>; + +export namespace SettingsMultipleRequest { + /** + * Operation ID to mitigation action mappings + */ + export interface api_shield_operation_schema_validation_settings_multiple_request_entry { + /** + * When set, this applies a mitigation action to this operation + * + * - `log` log request when request does not conform to schema for this operation + * - `block` deny access to the site when request does not conform to schema for + * this operation + * - `none` will skip mitigation for this operation + * - `null` indicates that no operation level mitigation is in place, see Zone + * Level Schema Validation Settings for mitigation action that will be applied + */ + mitigation_action?: 'log' | 'block' | 'none' | null; + } +} + +export type SettingsMultipleRequestParam = Record< + string, + SettingsMultipleRequestParam.api_shield_operation_schema_validation_settings_multiple_request_entry +>; + +export namespace SettingsMultipleRequestParam { + /** + * Operation ID to mitigation action mappings + */ + export interface api_shield_operation_schema_validation_settings_multiple_request_entry { + /** + * When set, this applies a mitigation action to this operation + * + * - `log` log request when request does not conform to schema for this operation + * - `block` deny access to the site when request does not conform to schema for + * this operation + * - `none` will skip mitigation for this operation + * - `null` indicates that no operation level mitigation is in place, see Zone + * Level Schema Validation Settings for mitigation action that will be applied + */ + mitigation_action?: 'log' | 'block' | 'none' | null; + } +} + +export interface SchemaValidationUpdateResponse { + /** + * When set, this applies a mitigation action to this operation + * + * - `log` log request when request does not conform to schema for this operation + * - `block` deny access to the site when request does not conform to schema for + * this operation + * - `none` will skip mitigation for this operation + * - `null` indicates that no operation level mitigation is in place, see Zone + * Level Schema Validation Settings for mitigation action that will be applied + */ + mitigation_action?: 'log' | 'block' | 'none' | null; +} + +export interface SchemaValidationGetResponse { + /** + * When set, this applies a mitigation action to this operation + * + * - `log` log request when request does not conform to schema for this operation + * - `block` deny access to the site when request does not conform to schema for + * this operation + * - `none` will skip mitigation for this operation + * - `null` indicates that no operation level mitigation is in place, see Zone + * Level Schema Validation Settings for mitigation action that will be applied + */ + mitigation_action?: 'log' | 'block' | 'none' | null; +} + +export interface SchemaValidationUpdateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: When set, this applies a mitigation action to this operation + * + * - `log` log request when request does not conform to schema for this operation + * - `block` deny access to the site when request does not conform to schema for + * this operation + * - `none` will skip mitigation for this operation + * - `null` indicates that no operation level mitigation is in place, see Zone + * Level Schema Validation Settings for mitigation action that will be applied + */ + mitigation_action?: 'log' | 'block' | 'none' | null; +} + +export interface SchemaValidationEditParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: + */ + settings_multiple_request: SettingsMultipleRequestParam; +} + +export interface SchemaValidationGetParams { + /** + * Identifier + */ + zone_id: string; +} + +export namespace SchemaValidation { + export import SettingsMultipleRequest = SchemaValidationAPI.SettingsMultipleRequest; + export import SchemaValidationUpdateResponse = SchemaValidationAPI.SchemaValidationUpdateResponse; + export import SchemaValidationGetResponse = SchemaValidationAPI.SchemaValidationGetResponse; + export import SchemaValidationUpdateParams = SchemaValidationAPI.SchemaValidationUpdateParams; + export import SchemaValidationEditParams = SchemaValidationAPI.SchemaValidationEditParams; + export import SchemaValidationGetParams = SchemaValidationAPI.SchemaValidationGetParams; +} diff --git a/src/resources/api-gateway/schema-validation.ts b/src/resources/api-gateway/schema-validation.ts new file mode 100644 index 0000000000..cc8b8d52dd --- /dev/null +++ b/src/resources/api-gateway/schema-validation.ts @@ -0,0 +1,59 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import * as Core from '../../core'; +import { APIResource } from '../../resource'; +import * as SchemaValidationAPI from './schema-validation'; +import * as SettingsSchemaValidationAPI from './settings/schema-validation'; + +export class SchemaValidation extends APIResource { + /** + * Updates zone level schema validation settings on the zone + */ + edit( + params: SchemaValidationEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return this._client.patch(`/zones/${zone_id}/api_gateway/settings/schema_validation`, { + body, + ...options, + }); + } +} + +export interface SchemaValidationEditParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: The default mitigation action used when there is no mitigation + * action defined on the operation Mitigation actions are as follows: + * + * - `log` - log request when request does not conform to schema + * - `block` - deny access to the site when request does not conform to schema + * + * A special value of of `none` will skip running schema validation entirely for + * the request when there is no mitigation action defined on the operation + * + * `null` will have no effect. + */ + validation_default_mitigation_action?: 'none' | 'log' | 'block' | null; + + /** + * Body param: When set, this overrides both zone level and operation level + * mitigation actions. + * + * - `none` will skip running schema validation entirely for the request + * + * To clear any override, use the special value `disable_override` + * + * `null` will have no effect. + */ + validation_override_mitigation_action?: 'none' | 'disable_override' | null; +} + +export namespace SchemaValidation { + export import SchemaValidationEditParams = SchemaValidationAPI.SchemaValidationEditParams; +} diff --git a/src/resources/api-gateway/schemas.ts b/src/resources/api-gateway/schemas.ts new file mode 100644 index 0000000000..329a24094e --- /dev/null +++ b/src/resources/api-gateway/schemas.ts @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import * as Core from '../../core'; +import { APIResource } from '../../resource'; +import * as SchemasAPI from './schemas'; + +export class Schemas extends APIResource { + /** + * Retrieve operations and features as OpenAPI schemas + */ + list(params: SchemaListParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, ...query } = params; + return ( + this._client.get(`/zones/${zone_id}/api_gateway/schemas`, { query, ...options }) as Core.APIPromise<{ + result: SchemaListResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface SchemaListResponse { + schemas?: Array; + + timestamp?: string; +} + +export interface SchemaListParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Query param: Add feature(s) to the results. The feature name that is given here + * corresponds to the resulting feature object. Have a look at the top-level object + * description for more details on the specific meaning. + */ + feature?: Array<'thresholds' | 'parameter_schemas' | 'schema_info'>; + + /** + * Query param: Receive schema only for the given host(s). + */ + host?: Array; +} + +export namespace Schemas { + export import SchemaListResponse = SchemasAPI.SchemaListResponse; + export import SchemaListParams = SchemasAPI.SchemaListParams; +} diff --git a/src/resources/api-gateway/settings/index.ts b/src/resources/api-gateway/settings/index.ts new file mode 100644 index 0000000000..dd78b487cc --- /dev/null +++ b/src/resources/api-gateway/settings/index.ts @@ -0,0 +1,9 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Settings } from './settings'; +export { + Settings, + SchemaValidationUpdateParams, + SchemaValidationGetParams, + SchemaValidation, +} from './schema-validation'; diff --git a/src/resources/api-gateway/settings/schema-validation.ts b/src/resources/api-gateway/settings/schema-validation.ts new file mode 100644 index 0000000000..ef00ebf503 --- /dev/null +++ b/src/resources/api-gateway/settings/schema-validation.ts @@ -0,0 +1,92 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import * as Core from '../../../core'; +import { APIResource } from '../../../resource'; +import * as SchemaValidationAPI from './schema-validation'; + +export class SchemaValidation extends APIResource { + /** + * Updates zone level schema validation settings on the zone + */ + update(params: SchemaValidationUpdateParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, ...body } = params; + return this._client.put(`/zones/${zone_id}/api_gateway/settings/schema_validation`, { body, ...options }); + } + + /** + * Retrieves zone level schema validation settings currently set on the zone + */ + get(params: SchemaValidationGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id } = params; + return this._client.get(`/zones/${zone_id}/api_gateway/settings/schema_validation`, options); + } +} + +export interface Settings { + /** + * The default mitigation action used when there is no mitigation action defined on + * the operation + * + * Mitigation actions are as follows: + * + * - `log` - log request when request does not conform to schema + * - `block` - deny access to the site when request does not conform to schema + * + * A special value of of `none` will skip running schema validation entirely for + * the request when there is no mitigation action defined on the operation + */ + validation_default_mitigation_action?: 'none' | 'log' | 'block'; + + /** + * When set, this overrides both zone level and operation level mitigation actions. + * + * - `none` will skip running schema validation entirely for the request + * - `null` indicates that no override is in place + */ + validation_override_mitigation_action?: 'none' | null; +} + +export interface SchemaValidationUpdateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: The default mitigation action used when there is no mitigation + * action defined on the operation + * + * Mitigation actions are as follows: + * + * - `log` - log request when request does not conform to schema + * - `block` - deny access to the site when request does not conform to schema + * + * A special value of of `none` will skip running schema validation entirely for + * the request when there is no mitigation action defined on the operation + */ + validation_default_mitigation_action: 'none' | 'log' | 'block'; + + /** + * Body param: When set, this overrides both zone level and operation level + * mitigation actions. + * + * - `none` will skip running schema validation entirely for the request + * - `null` indicates that no override is in place + * + * To clear any override, use the special value `disable_override` or `null` + */ + validation_override_mitigation_action?: 'none' | 'disable_override' | null; +} + +export interface SchemaValidationGetParams { + /** + * Identifier + */ + zone_id: string; +} + +export namespace SchemaValidation { + export import Settings = SchemaValidationAPI.Settings; + export import SchemaValidationUpdateParams = SchemaValidationAPI.SchemaValidationUpdateParams; + export import SchemaValidationGetParams = SchemaValidationAPI.SchemaValidationGetParams; +} diff --git a/src/resources/api-gateway/settings/settings.ts b/src/resources/api-gateway/settings/settings.ts new file mode 100644 index 0000000000..ce174db515 --- /dev/null +++ b/src/resources/api-gateway/settings/settings.ts @@ -0,0 +1,17 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as SchemaValidationAPI from './schema-validation'; + +export class Settings extends APIResource { + schemaValidation: SchemaValidationAPI.SchemaValidation = new SchemaValidationAPI.SchemaValidation( + this._client, + ); +} + +export namespace Settings { + export import SchemaValidation = SchemaValidationAPI.SchemaValidation; + export import Settings = SchemaValidationAPI.Settings; + export import SchemaValidationUpdateParams = SchemaValidationAPI.SchemaValidationUpdateParams; + export import SchemaValidationGetParams = SchemaValidationAPI.SchemaValidationGetParams; +} diff --git a/src/resources/api-gateway/user-schemas/index.ts b/src/resources/api-gateway/user-schemas/index.ts new file mode 100644 index 0000000000..65baad7b56 --- /dev/null +++ b/src/resources/api-gateway/user-schemas/index.ts @@ -0,0 +1,21 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + Message, + PublicSchema, + SchemaUpload, + UserSchemaDeleteResponse, + UserSchemaCreateParams, + UserSchemaListParams, + UserSchemaDeleteParams, + UserSchemaEditParams, + UserSchemaGetParams, + PublicSchemasSinglePage, + UserSchemas, +} from './user-schemas'; +export { + OperationListResponse, + OperationListParams, + OperationListResponsesSinglePage, + Operations, +} from './operations'; diff --git a/src/resources/api-gateway/user-schemas/operations.ts b/src/resources/api-gateway/user-schemas/operations.ts new file mode 100644 index 0000000000..cb39482eca --- /dev/null +++ b/src/resources/api-gateway/user-schemas/operations.ts @@ -0,0 +1,105 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import * as Core from '../../../core'; +import { APIResource } from '../../../resource'; +import * as UserSchemasOperationsAPI from './operations'; +import * as OperationsAPI from '../operations/operations'; +import { SinglePage } from '../../../pagination'; + +export class Operations extends APIResource { + /** + * Retrieves all operations from the schema. Operations that already exist in API + * Shield Endpoint Management will be returned as full operations. + */ + list( + schemaId: string, + params: OperationListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { zone_id, ...query } = params; + return this._client.getAPIList( + `/zones/${zone_id}/api_gateway/user_schemas/${schemaId}/operations`, + OperationListResponsesSinglePage, + { query, ...options }, + ); + } +} + +export class OperationListResponsesSinglePage extends SinglePage {} + +export type OperationListResponse = OperationsAPI.APIShield | OperationListResponse.APIShieldBasicOperation; + +export namespace OperationListResponse { + export interface APIShieldBasicOperation { + /** + * The endpoint which can contain path parameter templates in curly braces, each + * will be replaced from left to right with {varN}, starting with {var1}, during + * insertion. This will further be Cloudflare-normalized upon insertion. See: + * https://developers.cloudflare.com/rules/normalization/how-it-works/. + */ + endpoint: string; + + /** + * RFC3986-compliant host. + */ + host: string; + + /** + * The HTTP method used to access the endpoint. + */ + method: 'GET' | 'POST' | 'HEAD' | 'OPTIONS' | 'PUT' | 'DELETE' | 'CONNECT' | 'PATCH' | 'TRACE'; + } +} + +export interface OperationListParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Query param: Filter results to only include endpoints containing this pattern. + */ + endpoint?: string; + + /** + * Query param: Add feature(s) to the results. The feature name that is given here + * corresponds to the resulting feature object. Have a look at the top-level object + * description for more details on the specific meaning. + */ + feature?: Array<'thresholds' | 'parameter_schemas' | 'schema_info'>; + + /** + * Query param: Filter results to only include the specified hosts. + */ + host?: Array; + + /** + * Query param: Filter results to only include the specified HTTP methods. + */ + method?: Array; + + /** + * Query param: Filter results by whether operations exist in API Shield Endpoint + * Management or not. `new` will just return operations from the schema that do not + * exist in API Shield Endpoint Management. `existing` will just return operations + * from the schema that already exist in API Shield Endpoint Management. + */ + operation_status?: 'new' | 'existing'; + + /** + * Query param: Page number of paginated results. + */ + page?: unknown; + + /** + * Query param: Maximum number of results per page. + */ + per_page?: unknown; +} + +export namespace Operations { + export import OperationListResponse = UserSchemasOperationsAPI.OperationListResponse; + export import OperationListResponsesSinglePage = UserSchemasOperationsAPI.OperationListResponsesSinglePage; + export import OperationListParams = UserSchemasOperationsAPI.OperationListParams; +} diff --git a/src/resources/api-gateway/user-schemas/user-schemas.ts b/src/resources/api-gateway/user-schemas/user-schemas.ts new file mode 100644 index 0000000000..8f8e2f3070 --- /dev/null +++ b/src/resources/api-gateway/user-schemas/user-schemas.ts @@ -0,0 +1,265 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import * as Core from '../../../core'; +import { APIResource } from '../../../resource'; +import * as UserSchemasAPI from './user-schemas'; +import * as Shared from '../../shared'; +import * as OperationsAPI from './operations'; +import { type Uploadable, multipartFormRequestOptions } from '../../../core'; +import { SinglePage } from '../../../pagination'; + +export class UserSchemas extends APIResource { + operations: OperationsAPI.Operations = new OperationsAPI.Operations(this._client); + + /** + * Upload a schema to a zone + */ + create(params: UserSchemaCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.post( + `/zones/${zone_id}/api_gateway/user_schemas`, + multipartFormRequestOptions({ body, ...options }), + ) as Core.APIPromise<{ result: SchemaUpload }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieve information about all schemas on a zone + */ + list( + params: UserSchemaListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { zone_id, ...query } = params; + return this._client.getAPIList(`/zones/${zone_id}/api_gateway/user_schemas`, PublicSchemasSinglePage, { + query, + ...options, + }); + } + + /** + * Delete a schema + */ + delete( + schemaId: string, + params: UserSchemaDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.delete( + `/zones/${zone_id}/api_gateway/user_schemas/${schemaId}`, + options, + ) as Core.APIPromise<{ result: UserSchemaDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Enable validation for a schema + */ + edit( + schemaId: string, + params: UserSchemaEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.patch(`/zones/${zone_id}/api_gateway/user_schemas/${schemaId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: PublicSchema }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieve information about a specific schema on a zone + */ + get( + schemaId: string, + params: UserSchemaGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...query } = params; + return ( + this._client.get(`/zones/${zone_id}/api_gateway/user_schemas/${schemaId}`, { + query, + ...options, + }) as Core.APIPromise<{ result: PublicSchema }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class PublicSchemasSinglePage extends SinglePage {} + +export type Message = Array; + +export interface PublicSchema { + created_at: string; + + /** + * Kind of schema + */ + kind: 'openapi_v3'; + + /** + * Name of the schema + */ + name: string; + + /** + * UUID identifier + */ + schema_id: string; + + /** + * Source of the schema + */ + source?: string; + + /** + * Flag whether schema is enabled for validation. + */ + validation_enabled?: boolean; +} + +export interface SchemaUpload { + schema: PublicSchema; + + upload_details?: SchemaUpload.UploadDetails; +} + +export namespace SchemaUpload { + export interface UploadDetails { + /** + * Diagnostic warning events that occurred during processing. These events are + * non-critical errors found within the schema. + */ + warnings?: Array; + } + + export namespace UploadDetails { + export interface Warning { + /** + * Code that identifies the event that occurred. + */ + code: number; + + /** + * JSONPath location(s) in the schema where these events were encountered. See + * [https://goessner.net/articles/JsonPath/](https://goessner.net/articles/JsonPath/) + * for JSONPath specification. + */ + locations?: Array; + + /** + * Diagnostic message that describes the event. + */ + message?: string; + } + } +} + +export type UserSchemaDeleteResponse = unknown | string | null; + +export interface UserSchemaCreateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: Schema file bytes + */ + file: Uploadable; + + /** + * Body param: Kind of schema + */ + kind: 'openapi_v3'; + + /** + * Body param: Name of the schema + */ + name?: string; + + /** + * Body param: Flag whether schema is enabled for validation. + */ + validation_enabled?: 'true' | 'false'; +} + +export interface UserSchemaListParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Query param: Omit the source-files of schemas and only retrieve their meta-data. + */ + omit_source?: boolean; + + /** + * Query param: Page number of paginated results. + */ + page?: unknown; + + /** + * Query param: Maximum number of results per page. + */ + per_page?: unknown; + + /** + * Query param: Flag whether schema is enabled for validation. + */ + validation_enabled?: boolean; +} + +export interface UserSchemaDeleteParams { + /** + * Identifier + */ + zone_id: string; +} + +export interface UserSchemaEditParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: Flag whether schema is enabled for validation. + */ + validation_enabled?: true; +} + +export interface UserSchemaGetParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Query param: Omit the source-files of schemas and only retrieve their meta-data. + */ + omit_source?: boolean; +} + +export namespace UserSchemas { + export import Message = UserSchemasAPI.Message; + export import PublicSchema = UserSchemasAPI.PublicSchema; + export import SchemaUpload = UserSchemasAPI.SchemaUpload; + export import UserSchemaDeleteResponse = UserSchemasAPI.UserSchemaDeleteResponse; + export import PublicSchemasSinglePage = UserSchemasAPI.PublicSchemasSinglePage; + export import UserSchemaCreateParams = UserSchemasAPI.UserSchemaCreateParams; + export import UserSchemaListParams = UserSchemasAPI.UserSchemaListParams; + export import UserSchemaDeleteParams = UserSchemasAPI.UserSchemaDeleteParams; + export import UserSchemaEditParams = UserSchemasAPI.UserSchemaEditParams; + export import UserSchemaGetParams = UserSchemasAPI.UserSchemaGetParams; + export import Operations = OperationsAPI.Operations; + export import OperationListResponse = OperationsAPI.OperationListResponse; + export import OperationListResponsesSinglePage = OperationsAPI.OperationListResponsesSinglePage; + export import OperationListParams = OperationsAPI.OperationListParams; +} diff --git a/src/resources/cache/cache.ts b/src/resources/cache/cache.ts index db60985692..cfe0b40aac 100644 --- a/src/resources/cache/cache.ts +++ b/src/resources/cache/cache.ts @@ -21,6 +21,10 @@ export class Cache extends APIResource { * * Removes ALL files from Cloudflare's cache. All tiers can purge everything. * + * ``` + * {"purge_everything": true} + * ``` + * * ### Purge Cached Content by URL * * Granularly removes one or more files from Cloudflare's cache by specifying URLs. @@ -33,9 +37,23 @@ export class Cache extends APIResource { * * **NB:** When including the Origin header, be sure to include the **scheme** and * **hostname**. The port number can be omitted if it is the default port (80 for - * http, 443 for https), but must be included otherwise. **NB:** For Zones on - * Free/Pro/Business plan, you may purge up to 30 URLs in one API call. For Zones - * on Enterprise plan, you may purge up to 500 URLs in one API call. + * http, 443 for https), but must be included otherwise. + * + * **NB:** For Zones on Free/Pro/Business plan, you may purge up to 30 URLs in one + * API call. For Zones on Enterprise plan, you may purge up to 500 URLs in one API + * call. + * + * Single file purge example with files: + * + * ``` + * {"files": ["http://www.example.com/css/styles.css", "http://www.example.com/js/index.js"]} + * ``` + * + * Single file purge example with url and header pairs: + * + * ``` + * {"files": [{url: "http://www.example.com/cat_picture.jpg", headers: { "CF-IPCountry": "US", "CF-Device-Type": "desktop", "Accept-Language": "zh-CN" }}, {url: "http://www.example.com/dog_picture.jpg", headers: { "CF-IPCountry": "EU", "CF-Device-Type": "mobile", "Accept-Language": "en-US" }}]} + * ``` * * ### Purge Cached Content by Tag, Host or Prefix * @@ -47,6 +65,24 @@ export class Cache extends APIResource { * purge API calls in every 24 hour period. You may purge up to 30 tags, hosts, or * prefixes in one API call. This rate limit can be raised for customers who need * to purge at higher volume. + * + * Flex purge with tags: + * + * ``` + * {"tags": ["a-cache-tag", "another-cache-tag"]} + * ``` + * + * Flex purge with hosts: + * + * ``` + * {"hosts": ["www.example.com", "images.example.com"]} + * ``` + * + * Flex purge with prefixes: + * + * ``` + * {"prefixes": ["www.example.com/foo", "images.example.com/bar/baz"]} + * ``` */ purge(params: CachePurgeParams, options?: Core.RequestOptions): Core.APIPromise { const { zone_id, ...body } = params; @@ -66,45 +102,50 @@ export interface CachePurgeResponse { } export type CachePurgeParams = - | CachePurgeParams.CachePurgeTags - | CachePurgeParams.CachePurgeHosts - | CachePurgeParams.CachePurgePrefixes + | CachePurgeParams.CachePurgeFlexPurgeByTags + | CachePurgeParams.CachePurgeFlexPurgeByHostnames + | CachePurgeParams.CachePurgeFlexPurgeByPrefixes | CachePurgeParams.CachePurgeEverything - | CachePurgeParams.CachePurgeFiles; + | CachePurgeParams.CachePurgeSingleFile + | CachePurgeParams.CachePurgeSingleFileWithURLAndHeaders; export namespace CachePurgeParams { - export interface CachePurgeTags { + export interface CachePurgeFlexPurgeByTags { /** * Path param: */ zone_id: string; /** - * Body param: + * Body param: For more information on cache tags and purging by tags, please refer + * to + * [purge by cache-tags documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-tags/#purge-cache-by-cache-tags-enterprise-only). */ tags?: Array; } - export interface CachePurgeHosts { + export interface CachePurgeFlexPurgeByHostnames { /** * Path param: */ zone_id: string; /** - * Body param: + * Body param: For more information purging by hostnames, please refer to + * [purge by hostname documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-hostname/). */ hosts?: Array; } - export interface CachePurgePrefixes { + export interface CachePurgeFlexPurgeByPrefixes { /** * Path param: */ zone_id: string; /** - * Body param: + * Body param: For more information on purging by prefixes, please refer to + * [purge by prefix documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge_by_prefix/). */ prefixes?: Array; } @@ -116,25 +157,41 @@ export namespace CachePurgeParams { zone_id: string; /** - * Body param: + * Body param: For more information, please refer to + * [purge everything documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-everything/). */ purge_everything?: boolean; } - export interface CachePurgeFiles { + export interface CachePurgeSingleFile { + /** + * Path param: + */ + zone_id: string; + + /** + * Body param: For more information on purging files, please refer to + * [purge by single-file documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-single-file/). + */ + files?: Array; + } + + export interface CachePurgeSingleFileWithURLAndHeaders { /** * Path param: */ zone_id: string; /** - * Body param: + * Body param: For more information on purging files with URL and headers, please + * refer to + * [purge by single-file documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-single-file/). */ - files?: Array; + files?: Array; } - export namespace CachePurgeFiles { - export interface CachePurgeURLAndHeaders { + export namespace CachePurgeSingleFileWithURLAndHeaders { + export interface File { headers?: unknown; url?: string; diff --git a/src/resources/d1/d1.ts b/src/resources/d1/d1.ts index 494b3c4ae2..b8f1fa2253 100644 --- a/src/resources/d1/d1.ts +++ b/src/resources/d1/d1.ts @@ -34,10 +34,12 @@ export namespace D1Resource { export import DatabaseListResponse = DatabaseAPI.DatabaseListResponse; export import DatabaseDeleteResponse = DatabaseAPI.DatabaseDeleteResponse; export import DatabaseQueryResponse = DatabaseAPI.DatabaseQueryResponse; + export import DatabaseRawResponse = DatabaseAPI.DatabaseRawResponse; export import DatabaseListResponsesV4PagePaginationArray = DatabaseAPI.DatabaseListResponsesV4PagePaginationArray; export import DatabaseCreateParams = DatabaseAPI.DatabaseCreateParams; export import DatabaseListParams = DatabaseAPI.DatabaseListParams; export import DatabaseDeleteParams = DatabaseAPI.DatabaseDeleteParams; export import DatabaseGetParams = DatabaseAPI.DatabaseGetParams; export import DatabaseQueryParams = DatabaseAPI.DatabaseQueryParams; + export import DatabaseRawParams = DatabaseAPI.DatabaseRawParams; } diff --git a/src/resources/d1/database.ts b/src/resources/d1/database.ts index f9a12d153e..1d9c04b6cf 100644 --- a/src/resources/d1/database.ts +++ b/src/resources/d1/database.ts @@ -70,7 +70,7 @@ export class Database extends APIResource { } /** - * Returns the query result. + * Returns the query result as an object. */ query( databaseId: string, @@ -85,6 +85,24 @@ export class Database extends APIResource { }) as Core.APIPromise<{ result: DatabaseQueryResponse }> )._thenUnwrap((obj) => obj.result); } + + /** + * Returns the query result rows as arrays rather than objects. This is a + * performance-optimized version of the /query endpoint. + */ + raw( + databaseId: string, + params: DatabaseRawParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/d1/database/${databaseId}/raw`, { + body, + ...options, + }) as Core.APIPromise<{ result: DatabaseRawResponse }> + )._thenUnwrap((obj) => obj.result); + } } export class DatabaseListResponsesV4PagePaginationArray extends V4PagePaginationArray {} @@ -145,6 +163,42 @@ export type DatabaseDeleteResponse = unknown | string | null; export type DatabaseQueryResponse = Array; +export type DatabaseRawResponse = Array; + +export namespace DatabaseRawResponse { + export interface DatabaseRawResponseItem { + meta?: DatabaseRawResponseItem.Meta; + + results?: DatabaseRawResponseItem.Results; + + success?: boolean; + } + + export namespace DatabaseRawResponseItem { + export interface Meta { + changed_db?: boolean; + + changes?: number; + + duration?: number; + + last_row_id?: number; + + rows_read?: number; + + rows_written?: number; + + size_after?: number; + } + + export interface Results { + columns?: Array; + + rows?: Array>; + } + } +} + export interface DatabaseCreateParams { /** * Path param: Account identifier tag. @@ -200,16 +254,35 @@ export interface DatabaseQueryParams { params?: Array; } +export interface DatabaseRawParams { + /** + * Path param: Account identifier tag. + */ + account_id: string; + + /** + * Body param: + */ + sql: string; + + /** + * Body param: + */ + params?: Array; +} + export namespace Database { export import QueryResult = DatabaseAPI.QueryResult; export import DatabaseCreateResponse = DatabaseAPI.DatabaseCreateResponse; export import DatabaseListResponse = DatabaseAPI.DatabaseListResponse; export import DatabaseDeleteResponse = DatabaseAPI.DatabaseDeleteResponse; export import DatabaseQueryResponse = DatabaseAPI.DatabaseQueryResponse; + export import DatabaseRawResponse = DatabaseAPI.DatabaseRawResponse; export import DatabaseListResponsesV4PagePaginationArray = DatabaseAPI.DatabaseListResponsesV4PagePaginationArray; export import DatabaseCreateParams = DatabaseAPI.DatabaseCreateParams; export import DatabaseListParams = DatabaseAPI.DatabaseListParams; export import DatabaseDeleteParams = DatabaseAPI.DatabaseDeleteParams; export import DatabaseGetParams = DatabaseAPI.DatabaseGetParams; export import DatabaseQueryParams = DatabaseAPI.DatabaseQueryParams; + export import DatabaseRawParams = DatabaseAPI.DatabaseRawParams; } diff --git a/src/resources/d1/index.ts b/src/resources/d1/index.ts index 13afa77f41..90d4c26d23 100644 --- a/src/resources/d1/index.ts +++ b/src/resources/d1/index.ts @@ -7,11 +7,13 @@ export { DatabaseListResponse, DatabaseDeleteResponse, DatabaseQueryResponse, + DatabaseRawResponse, DatabaseCreateParams, DatabaseListParams, DatabaseDeleteParams, DatabaseGetParams, DatabaseQueryParams, + DatabaseRawParams, DatabaseListResponsesV4PagePaginationArray, Database, } from './database'; diff --git a/src/resources/index.ts b/src/resources/index.ts index 96daa41565..96d932eeed 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -3,6 +3,7 @@ export * from './shared'; export { ACM } from './acm/acm'; export { AIGateway } from './ai-gateway/ai-gateway'; +export { APIGateway } from './api-gateway/api-gateway'; export { Accounts } from './accounts/accounts'; export { Addressing } from './addressing/addressing'; export { Alerting } from './alerting/alerting'; diff --git a/src/resources/kv/index.ts b/src/resources/kv/index.ts index e54fea2b0d..ecc5cc36fe 100644 --- a/src/resources/kv/index.ts +++ b/src/resources/kv/index.ts @@ -9,6 +9,7 @@ export { NamespaceUpdateParams, NamespaceListParams, NamespaceDeleteParams, + NamespaceGetParams, NamespacesV4PagePaginationArray, Namespaces, } from './namespaces/index'; diff --git a/src/resources/kv/kv.ts b/src/resources/kv/kv.ts index 581d6ef2ed..d68cc9a01c 100644 --- a/src/resources/kv/kv.ts +++ b/src/resources/kv/kv.ts @@ -17,4 +17,5 @@ export namespace KV { export import NamespaceUpdateParams = NamespacesAPI.NamespaceUpdateParams; export import NamespaceListParams = NamespacesAPI.NamespaceListParams; export import NamespaceDeleteParams = NamespacesAPI.NamespaceDeleteParams; + export import NamespaceGetParams = NamespacesAPI.NamespaceGetParams; } diff --git a/src/resources/kv/namespaces/index.ts b/src/resources/kv/namespaces/index.ts index be0e4ed221..aae9be09ec 100644 --- a/src/resources/kv/namespaces/index.ts +++ b/src/resources/kv/namespaces/index.ts @@ -11,6 +11,7 @@ export { NamespaceUpdateParams, NamespaceListParams, NamespaceDeleteParams, + NamespaceGetParams, NamespacesV4PagePaginationArray, Namespaces, } from './namespaces'; diff --git a/src/resources/kv/namespaces/namespaces.ts b/src/resources/kv/namespaces/namespaces.ts index 8450b03859..71856898cb 100644 --- a/src/resources/kv/namespaces/namespaces.ts +++ b/src/resources/kv/namespaces/namespaces.ts @@ -78,6 +78,23 @@ export class Namespaces extends APIResource { ) as Core.APIPromise<{ result: NamespaceDeleteResponse }> )._thenUnwrap((obj) => obj.result); } + + /** + * Get the namespace corresponding to the given ID. + */ + get( + namespaceId: string, + params: NamespaceGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/storage/kv/namespaces/${namespaceId}`, + options, + ) as Core.APIPromise<{ result: Namespace }> + )._thenUnwrap((obj) => obj.result); + } } export class NamespacesV4PagePaginationArray extends V4PagePaginationArray {} @@ -152,6 +169,13 @@ export interface NamespaceDeleteParams { account_id: string; } +export interface NamespaceGetParams { + /** + * Identifier + */ + account_id: string; +} + export namespace Namespaces { export import Namespace = NamespacesAPI.Namespace; export import NamespaceUpdateResponse = NamespacesAPI.NamespaceUpdateResponse; @@ -161,6 +185,7 @@ export namespace Namespaces { export import NamespaceUpdateParams = NamespacesAPI.NamespaceUpdateParams; export import NamespaceListParams = NamespacesAPI.NamespaceListParams; export import NamespaceDeleteParams = NamespacesAPI.NamespaceDeleteParams; + export import NamespaceGetParams = NamespacesAPI.NamespaceGetParams; export import Bulk = BulkAPI.Bulk; export import BulkUpdateResponse = BulkAPI.BulkUpdateResponse; export import BulkDeleteResponse = BulkAPI.BulkDeleteResponse; diff --git a/src/resources/r2/buckets.ts b/src/resources/r2/buckets.ts index 1096ec550b..e0473b5016 100644 --- a/src/resources/r2/buckets.ts +++ b/src/resources/r2/buckets.ts @@ -81,6 +81,11 @@ export interface Bucket { * Name of the bucket */ name?: string; + + /** + * Storage class for newly uploaded objects, unless specified otherwise. + */ + storage_class?: 'Standard' | 'InfrequentAccess'; } export type BucketDeleteResponse = unknown; @@ -100,6 +105,12 @@ export interface BucketCreateParams { * Body param: Location of the bucket */ locationHint?: 'apac' | 'eeur' | 'enam' | 'weur' | 'wnam'; + + /** + * Body param: Storage class for newly uploaded objects, unless specified + * otherwise. + */ + storageClass?: 'Standard' | 'InfrequentAccess'; } export interface BucketListParams extends CursorPaginationParams { diff --git a/src/resources/radar/bgp/bgp.ts b/src/resources/radar/bgp/bgp.ts index 2c9c162e1c..0ac07d0f39 100644 --- a/src/resources/radar/bgp/bgp.ts +++ b/src/resources/radar/bgp/bgp.ts @@ -4,6 +4,7 @@ import * as Core from '../../../core'; import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as BGPAPI from './bgp'; +import * as IPsAPI from './ips'; import * as RoutesAPI from './routes'; import * as HijacksAPI from './hijacks/hijacks'; import * as LeaksAPI from './leaks/leaks'; @@ -14,6 +15,7 @@ export class BGP extends APIResource { top: TopAPI.Top = new TopAPI.Top(this._client); hijacks: HijacksAPI.Hijacks = new HijacksAPI.Hijacks(this._client); routes: RoutesAPI.Routes = new RoutesAPI.Routes(this._client); + ips: IPsAPI.IPs = new IPsAPI.IPs(this._client); /** * Gets BGP updates change over time. Raw values are returned. When requesting @@ -196,9 +198,10 @@ export namespace BGP { export import RouteMoasResponse = RoutesAPI.RouteMoasResponse; export import RoutePfx2asResponse = RoutesAPI.RoutePfx2asResponse; export import RouteStatsResponse = RoutesAPI.RouteStatsResponse; - export import RouteTimeseriesResponse = RoutesAPI.RouteTimeseriesResponse; export import RouteMoasParams = RoutesAPI.RouteMoasParams; export import RoutePfx2asParams = RoutesAPI.RoutePfx2asParams; export import RouteStatsParams = RoutesAPI.RouteStatsParams; - export import RouteTimeseriesParams = RoutesAPI.RouteTimeseriesParams; + export import IPs = IPsAPI.IPs; + export import IPTimeseriesResponse = IPsAPI.IPTimeseriesResponse; + export import IPTimeseriesParams = IPsAPI.IPTimeseriesParams; } diff --git a/src/resources/radar/bgp/index.ts b/src/resources/radar/bgp/index.ts index 3e0332b321..8942af9a1b 100644 --- a/src/resources/radar/bgp/index.ts +++ b/src/resources/radar/bgp/index.ts @@ -2,16 +2,15 @@ export { BGPTimeseriesResponse, BGPTimeseriesParams, BGP } from './bgp'; export { Hijacks } from './hijacks/index'; +export { IPTimeseriesResponse, IPTimeseriesParams, IPs } from './ips'; export { Leaks } from './leaks/index'; export { RouteMoasResponse, RoutePfx2asResponse, RouteStatsResponse, - RouteTimeseriesResponse, RouteMoasParams, RoutePfx2asParams, RouteStatsParams, - RouteTimeseriesParams, Routes, } from './routes'; export { TopPrefixesResponse, TopPrefixesParams, Top } from './top/index'; diff --git a/src/resources/radar/bgp/ips.ts b/src/resources/radar/bgp/ips.ts new file mode 100644 index 0000000000..e6df7b4951 --- /dev/null +++ b/src/resources/radar/bgp/ips.ts @@ -0,0 +1,138 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import * as Core from '../../../core'; +import { APIResource } from '../../../resource'; +import { isRequestOptions } from '../../../core'; +import * as IPsAPI from './ips'; + +export class IPs extends APIResource { + /** + * Gets time-series data for the announced IP space count, represented as the + * number of IPv4 /24s and IPv6 /48s, for a given ASN. + */ + timeseries( + query?: IPTimeseriesParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseries(options?: Core.RequestOptions): Core.APIPromise; + timeseries( + query: IPTimeseriesParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.timeseries({}, query); + } + return ( + this._client.get('/radar/bgp/ips/timeseries', { query, ...options }) as Core.APIPromise<{ + result: IPTimeseriesResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface IPTimeseriesResponse { + meta: IPTimeseriesResponse.Meta; + + serie_174: IPTimeseriesResponse.Serie174; + + serie_cn: IPTimeseriesResponse.SerieCn; +} + +export namespace IPTimeseriesResponse { + export interface Meta { + dateRange: Array; + } + + export namespace Meta { + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + } + + export interface Serie174 { + ipv4: Array; + + ipv6: Array; + + timestamps: Array; + } + + export interface SerieCn { + ipv4: Array; + + ipv6: Array; + + timestamps: Array; + } +} + +export interface IPTimeseriesParams { + /** + * Comma separated list of ASNs. + */ + asn?: string; + + /** + * End of the date range (inclusive). + */ + dateEnd?: string; + + /** + * Shorthand date ranges for the last X days - use when you don't need specific + * start and end dates. + */ + dateRange?: + | '1d' + | '2d' + | '7d' + | '14d' + | '28d' + | '12w' + | '24w' + | '52w' + | '1dControl' + | '2dControl' + | '7dControl' + | '14dControl' + | '28dControl' + | '12wControl' + | '24wControl'; + + /** + * Start of the date range (inclusive). + */ + dateStart?: string; + + /** + * Format results are returned in. + */ + format?: 'JSON' | 'CSV'; + + /** + * Include data delay meta information + */ + includeDelay?: boolean; + + /** + * Comma separated list of locations. + */ + location?: string; + + /** + * Array of names that will be used to name the series in responses. + */ + name?: Array; +} + +export namespace IPs { + export import IPTimeseriesResponse = IPsAPI.IPTimeseriesResponse; + export import IPTimeseriesParams = IPsAPI.IPTimeseriesParams; +} diff --git a/src/resources/radar/bgp/routes.ts b/src/resources/radar/bgp/routes.ts index 44fe6d3d7f..8a2da6adf5 100644 --- a/src/resources/radar/bgp/routes.ts +++ b/src/resources/radar/bgp/routes.ts @@ -62,29 +62,6 @@ export class Routes extends APIResource { }> )._thenUnwrap((obj) => obj.result); } - - /** - * Gets time-series data for the announced IP space count, represented as the - * number of IPv4 /24s and IPv6 /48s, for a given ASN. - */ - timeseries( - query?: RouteTimeseriesParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - timeseries(options?: Core.RequestOptions): Core.APIPromise; - timeseries( - query: RouteTimeseriesParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(query)) { - return this.timeseries({}, query); - } - return ( - this._client.get('/radar/bgp/routes/timeseries', { query, ...options }) as Core.APIPromise<{ - result: RouteTimeseriesResponse; - }> - )._thenUnwrap((obj) => obj.result); - } } export interface RouteMoasResponse { @@ -199,46 +176,6 @@ export namespace RouteStatsResponse { } } -export interface RouteTimeseriesResponse { - meta: RouteTimeseriesResponse.Meta; - - serie_ipv4_24s: RouteTimeseriesResponse.SerieIPV4_24s; - - serie_ipv6_48s: RouteTimeseriesResponse.SerieIPV6_48s; -} - -export namespace RouteTimeseriesResponse { - export interface Meta { - dateRange: Array; - } - - export namespace Meta { - export interface DateRange { - /** - * Adjusted end of date range. - */ - endTime: string; - - /** - * Adjusted start of date range. - */ - startTime: string; - } - } - - export interface SerieIPV4_24s { - timestamps: Array; - - values: Array; - } - - export interface SerieIPV6_48s { - timestamps: Array; - - values: Array; - } -} - export interface RouteMoasParams { /** * Format results are returned in. @@ -306,66 +243,11 @@ export interface RouteStatsParams { location?: string; } -export interface RouteTimeseriesParams { - /** - * Single ASN as integer. - */ - asn?: number; - - /** - * End of the date range (inclusive). - */ - dateEnd?: string; - - /** - * Shorthand date ranges for the last X days - use when you don't need specific - * start and end dates. - */ - dateRange?: - | '1d' - | '2d' - | '7d' - | '14d' - | '28d' - | '12w' - | '24w' - | '52w' - | '1dControl' - | '2dControl' - | '7dControl' - | '14dControl' - | '28dControl' - | '12wControl' - | '24wControl'; - - /** - * Start of the date range (inclusive). - */ - dateStart?: string; - - /** - * Format results are returned in. - */ - format?: 'JSON' | 'CSV'; - - /** - * Include data delay meta information - */ - includeDelay?: boolean; - - /** - * Location Alpha2 code. - */ - location?: string; -} - export namespace Routes { export import RouteMoasResponse = RoutesAPI.RouteMoasResponse; export import RoutePfx2asResponse = RoutesAPI.RoutePfx2asResponse; export import RouteStatsResponse = RoutesAPI.RouteStatsResponse; - export import RouteTimeseriesResponse = RoutesAPI.RouteTimeseriesResponse; export import RouteMoasParams = RoutesAPI.RouteMoasParams; export import RoutePfx2asParams = RoutesAPI.RoutePfx2asParams; export import RouteStatsParams = RoutesAPI.RouteStatsParams; - export import RouteTimeseriesParams = RoutesAPI.RouteTimeseriesParams; } diff --git a/src/resources/zero-trust/access/access.ts b/src/resources/zero-trust/access/access.ts index d45a705f08..50d7ed5610 100644 --- a/src/resources/zero-trust/access/access.ts +++ b/src/resources/zero-trust/access/access.ts @@ -756,58 +756,29 @@ export namespace Access { export import Certificates = CertificatesAPI.Certificates; export import AssociatedHostnames = CertificatesAPI.AssociatedHostnames; export import Certificate = CertificatesAPI.Certificate; - export import CertificateDeleteResponse = CertificatesAPI.CertificateDeleteResponse; export import CertificatesSinglePage = CertificatesAPI.CertificatesSinglePage; export import CertificateCreateParams = CertificatesAPI.CertificateCreateParams; - export import CertificateUpdateParams = CertificatesAPI.CertificateUpdateParams; export import CertificateListParams = CertificatesAPI.CertificateListParams; - export import CertificateDeleteParams = CertificatesAPI.CertificateDeleteParams; - export import CertificateGetParams = CertificatesAPI.CertificateGetParams; export import Groups = GroupsAPI.Groups; export import ZeroTrustGroup = GroupsAPI.ZeroTrustGroup; - export import GroupDeleteResponse = GroupsAPI.GroupDeleteResponse; export import ZeroTrustGroupsSinglePage = GroupsAPI.ZeroTrustGroupsSinglePage; export import GroupCreateParams = GroupsAPI.GroupCreateParams; - export import GroupUpdateParams = GroupsAPI.GroupUpdateParams; export import GroupListParams = GroupsAPI.GroupListParams; - export import GroupDeleteParams = GroupsAPI.GroupDeleteParams; - export import GroupGetParams = GroupsAPI.GroupGetParams; export import ServiceTokens = ServiceTokensAPI.ServiceTokens; export import ServiceToken = ServiceTokensAPI.ServiceToken; export import ServiceTokenCreateResponse = ServiceTokensAPI.ServiceTokenCreateResponse; - export import ServiceTokenRotateResponse = ServiceTokensAPI.ServiceTokenRotateResponse; export import ServiceTokensSinglePage = ServiceTokensAPI.ServiceTokensSinglePage; export import ServiceTokenCreateParams = ServiceTokensAPI.ServiceTokenCreateParams; - export import ServiceTokenUpdateParams = ServiceTokensAPI.ServiceTokenUpdateParams; export import ServiceTokenListParams = ServiceTokensAPI.ServiceTokenListParams; - export import ServiceTokenDeleteParams = ServiceTokensAPI.ServiceTokenDeleteParams; - export import ServiceTokenGetParams = ServiceTokensAPI.ServiceTokenGetParams; export import Bookmarks = BookmarksAPI.Bookmarks; export import Bookmark = BookmarksAPI.Bookmark; - export import BookmarkDeleteResponse = BookmarksAPI.BookmarkDeleteResponse; - export import BookmarksSinglePage = BookmarksAPI.BookmarksSinglePage; - export import BookmarkCreateParams = BookmarksAPI.BookmarkCreateParams; - export import BookmarkUpdateParams = BookmarksAPI.BookmarkUpdateParams; export import Keys = KeysAPI.Keys; - export import KeyUpdateResponse = KeysAPI.KeyUpdateResponse; - export import KeyGetResponse = KeysAPI.KeyGetResponse; - export import KeyRotateResponse = KeysAPI.KeyRotateResponse; - export import KeyUpdateParams = KeysAPI.KeyUpdateParams; export import Logs = LogsAPI.Logs; export import Users = UsersAPI.Users; export import AccessUser = UsersAPI.AccessUser; - export import AccessUsersSinglePage = UsersAPI.AccessUsersSinglePage; export import CustomPages = CustomPagesAPI.CustomPages; export import CustomPage = CustomPagesAPI.CustomPage; export import CustomPageWithoutHTML = CustomPagesAPI.CustomPageWithoutHTML; - export import CustomPageDeleteResponse = CustomPagesAPI.CustomPageDeleteResponse; - export import CustomPageWithoutHTMLsSinglePage = CustomPagesAPI.CustomPageWithoutHTMLsSinglePage; - export import CustomPageCreateParams = CustomPagesAPI.CustomPageCreateParams; - export import CustomPageUpdateParams = CustomPagesAPI.CustomPageUpdateParams; export import Tags = TagsAPI.Tags; export import Tag = TagsAPI.Tag; - export import TagDeleteResponse = TagsAPI.TagDeleteResponse; - export import TagsSinglePage = TagsAPI.TagsSinglePage; - export import TagCreateParams = TagsAPI.TagCreateParams; - export import TagUpdateParams = TagsAPI.TagUpdateParams; } diff --git a/src/resources/zero-trust/access/applications/applications.ts b/src/resources/zero-trust/access/applications/applications.ts index 8d204506da..aca1a2fa97 100644 --- a/src/resources/zero-trust/access/applications/applications.ts +++ b/src/resources/zero-trust/access/applications/applications.ts @@ -20492,14 +20492,8 @@ export namespace Applications { export import ApplicationRevokeTokensParams = ApplicationsAPI.ApplicationRevokeTokensParams; export import CAs = CAsAPI.CAs; export import CA = CAsAPI.CA; - export import CACreateResponse = CAsAPI.CACreateResponse; - export import CADeleteResponse = CAsAPI.CADeleteResponse; - export import CAGetResponse = CAsAPI.CAGetResponse; export import CAsSinglePage = CAsAPI.CAsSinglePage; - export import CACreateParams = CAsAPI.CACreateParams; export import CAListParams = CAsAPI.CAListParams; - export import CADeleteParams = CAsAPI.CADeleteParams; - export import CAGetParams = CAsAPI.CAGetParams; export import UserPolicyChecks = UserPolicyChecksAPI.UserPolicyChecks; export import UserPolicyCheckGeo = UserPolicyChecksAPI.UserPolicyCheckGeo; export import UserPolicyCheckListResponse = UserPolicyChecksAPI.UserPolicyCheckListResponse; @@ -20507,15 +20501,4 @@ export namespace Applications { export import Policies = PoliciesAPI.Policies; export import ApprovalGroup = PoliciesAPI.ApprovalGroup; export import Policy = PoliciesAPI.Policy; - export import PolicyCreateResponse = PoliciesAPI.PolicyCreateResponse; - export import PolicyUpdateResponse = PoliciesAPI.PolicyUpdateResponse; - export import PolicyListResponse = PoliciesAPI.PolicyListResponse; - export import PolicyDeleteResponse = PoliciesAPI.PolicyDeleteResponse; - export import PolicyGetResponse = PoliciesAPI.PolicyGetResponse; - export import PolicyListResponsesSinglePage = PoliciesAPI.PolicyListResponsesSinglePage; - export import PolicyCreateParams = PoliciesAPI.PolicyCreateParams; - export import PolicyUpdateParams = PoliciesAPI.PolicyUpdateParams; - export import PolicyListParams = PoliciesAPI.PolicyListParams; - export import PolicyDeleteParams = PoliciesAPI.PolicyDeleteParams; - export import PolicyGetParams = PoliciesAPI.PolicyGetParams; } diff --git a/src/resources/zero-trust/access/applications/cas.ts b/src/resources/zero-trust/access/applications/cas.ts index 02aef3098d..3a6193c6d1 100644 --- a/src/resources/zero-trust/access/applications/cas.ts +++ b/src/resources/zero-trust/access/applications/cas.ts @@ -8,48 +8,6 @@ import * as CAsAPI from './cas'; import { SinglePage } from '../../../../pagination'; export class CAs extends APIResource { - /** - * Generates a new short-lived certificate CA and public key. - */ - create( - uuid: string, - params?: CACreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - create(uuid: string, options?: Core.RequestOptions): Core.APIPromise; - create( - uuid: string, - params: CACreateParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(params)) { - return this.create(uuid, {}, params); - } - const { account_id, zone_id } = params; - if (!account_id && !zone_id) { - throw new CloudflareError('You must provide either account_id or zone_id.'); - } - if (account_id && zone_id) { - throw new CloudflareError('You cannot provide both account_id and zone_id.'); - } - const { accountOrZone, accountOrZoneId } = - account_id ? - { - accountOrZone: 'accounts', - accountOrZoneId: account_id, - } - : { - accountOrZone: 'zones', - accountOrZoneId: zone_id, - }; - return ( - this._client.post( - `/${accountOrZone}/${accountOrZoneId}/access/apps/${uuid}/ca`, - options, - ) as Core.APIPromise<{ result: CACreateResponse }> - )._thenUnwrap((obj) => obj.result); - } - /** * Lists short-lived certificate CAs and their public keys. */ @@ -85,86 +43,6 @@ export class CAs extends APIResource { options, ); } - - /** - * Deletes a short-lived certificate CA. - */ - delete( - uuid: string, - params?: CADeleteParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - delete(uuid: string, options?: Core.RequestOptions): Core.APIPromise; - delete( - uuid: string, - params: CADeleteParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(params)) { - return this.delete(uuid, {}, params); - } - const { account_id, zone_id } = params; - if (!account_id && !zone_id) { - throw new CloudflareError('You must provide either account_id or zone_id.'); - } - if (account_id && zone_id) { - throw new CloudflareError('You cannot provide both account_id and zone_id.'); - } - const { accountOrZone, accountOrZoneId } = - account_id ? - { - accountOrZone: 'accounts', - accountOrZoneId: account_id, - } - : { - accountOrZone: 'zones', - accountOrZoneId: zone_id, - }; - return ( - this._client.delete( - `/${accountOrZone}/${accountOrZoneId}/access/apps/${uuid}/ca`, - options, - ) as Core.APIPromise<{ result: CADeleteResponse }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Fetches a short-lived certificate CA and its public key. - */ - get(uuid: string, params?: CAGetParams, options?: Core.RequestOptions): Core.APIPromise; - get(uuid: string, options?: Core.RequestOptions): Core.APIPromise; - get( - uuid: string, - params: CAGetParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(params)) { - return this.get(uuid, {}, params); - } - const { account_id, zone_id } = params; - if (!account_id && !zone_id) { - throw new CloudflareError('You must provide either account_id or zone_id.'); - } - if (account_id && zone_id) { - throw new CloudflareError('You cannot provide both account_id and zone_id.'); - } - const { accountOrZone, accountOrZoneId } = - account_id ? - { - accountOrZone: 'accounts', - accountOrZoneId: account_id, - } - : { - accountOrZone: 'zones', - accountOrZoneId: zone_id, - }; - return ( - this._client.get( - `/${accountOrZone}/${accountOrZoneId}/access/apps/${uuid}/ca`, - options, - ) as Core.APIPromise<{ result: CAGetResponse }> - )._thenUnwrap((obj) => obj.result); - } } export class CAsSinglePage extends SinglePage {} @@ -187,29 +65,6 @@ export interface CA { public_key?: string; } -export type CACreateResponse = unknown | string | null; - -export interface CADeleteResponse { - /** - * The ID of the CA. - */ - id?: string; -} - -export type CAGetResponse = unknown | string | null; - -export interface CACreateParams { - /** - * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - */ - account_id?: string; - - /** - * The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - */ - zone_id?: string; -} - export interface CAListParams { /** * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -222,38 +77,8 @@ export interface CAListParams { zone_id?: string; } -export interface CADeleteParams { - /** - * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - */ - account_id?: string; - - /** - * The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - */ - zone_id?: string; -} - -export interface CAGetParams { - /** - * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - */ - account_id?: string; - - /** - * The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - */ - zone_id?: string; -} - export namespace CAs { export import CA = CAsAPI.CA; - export import CACreateResponse = CAsAPI.CACreateResponse; - export import CADeleteResponse = CAsAPI.CADeleteResponse; - export import CAGetResponse = CAsAPI.CAGetResponse; export import CAsSinglePage = CAsAPI.CAsSinglePage; - export import CACreateParams = CAsAPI.CACreateParams; export import CAListParams = CAsAPI.CAListParams; - export import CADeleteParams = CAsAPI.CADeleteParams; - export import CAGetParams = CAsAPI.CAGetParams; } diff --git a/src/resources/zero-trust/access/applications/index.ts b/src/resources/zero-trust/access/applications/index.ts index ed76c33146..f9cc6f8b23 100644 --- a/src/resources/zero-trust/access/applications/index.ts +++ b/src/resources/zero-trust/access/applications/index.ts @@ -30,34 +30,8 @@ export { ApplicationListResponsesSinglePage, Applications, } from './applications'; -export { - ApprovalGroup, - Policy, - PolicyCreateResponse, - PolicyUpdateResponse, - PolicyListResponse, - PolicyDeleteResponse, - PolicyGetResponse, - PolicyCreateParams, - PolicyUpdateParams, - PolicyListParams, - PolicyDeleteParams, - PolicyGetParams, - PolicyListResponsesSinglePage, - Policies, -} from './policies'; -export { - CA, - CACreateResponse, - CADeleteResponse, - CAGetResponse, - CACreateParams, - CAListParams, - CADeleteParams, - CAGetParams, - CAsSinglePage, - CAs, -} from './cas'; +export { ApprovalGroup, Policy, Policies } from './policies'; +export { CA, CAListParams, CAsSinglePage, CAs } from './cas'; export { UserPolicyCheckGeo, UserPolicyCheckListResponse, diff --git a/src/resources/zero-trust/access/applications/policies.ts b/src/resources/zero-trust/access/applications/policies.ts index 014e628827..502dfc2cb5 100644 --- a/src/resources/zero-trust/access/applications/policies.ts +++ b/src/resources/zero-trust/access/applications/policies.ts @@ -1,223 +1,11 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import * as Core from '../../../../core'; import { APIResource } from '../../../../resource'; -import { isRequestOptions } from '../../../../core'; -import { CloudflareError } from '../../../../error'; import * as PoliciesAPI from './policies'; import * as AccessAPI from '../access'; import * as ApplicationsAPI from './applications'; -import { SinglePage } from '../../../../pagination'; -export class Policies extends APIResource { - /** - * Creates a policy applying exclusive to a single application that defines the - * users or groups who can reach it. We recommend creating a reusable policy - * instead and subsequently referencing its ID in the application's 'policies' - * array. - */ - create( - uuid: string, - params: PolicyCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, zone_id, ...body } = params; - if (!account_id && !zone_id) { - throw new CloudflareError('You must provide either account_id or zone_id.'); - } - if (account_id && zone_id) { - throw new CloudflareError('You cannot provide both account_id and zone_id.'); - } - const { accountOrZone, accountOrZoneId } = - account_id ? - { - accountOrZone: 'accounts', - accountOrZoneId: account_id, - } - : { - accountOrZone: 'zones', - accountOrZoneId: zone_id, - }; - return ( - this._client.post(`/${accountOrZone}/${accountOrZoneId}/access/apps/${uuid}/policies`, { - body, - ...options, - }) as Core.APIPromise<{ result: PolicyCreateResponse }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Updates an Access policy specific to an application. To update a reusable - * policy, use the /account or zones/{identifier}/policies/{uid} endpoint. - */ - update( - uuid1: string, - uuid: string, - params: PolicyUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, zone_id, ...body } = params; - if (!account_id && !zone_id) { - throw new CloudflareError('You must provide either account_id or zone_id.'); - } - if (account_id && zone_id) { - throw new CloudflareError('You cannot provide both account_id and zone_id.'); - } - const { accountOrZone, accountOrZoneId } = - account_id ? - { - accountOrZone: 'accounts', - accountOrZoneId: account_id, - } - : { - accountOrZone: 'zones', - accountOrZoneId: zone_id, - }; - return ( - this._client.put(`/${accountOrZone}/${accountOrZoneId}/access/apps/${uuid1}/policies/${uuid}`, { - body, - ...options, - }) as Core.APIPromise<{ result: PolicyUpdateResponse }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Lists Access policies configured for an application. Returns both exclusively - * scoped and reusable policies used by the application. - */ - list( - uuid: string, - params?: PolicyListParams, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - uuid: string, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - uuid: string, - params: PolicyListParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.PagePromise { - if (isRequestOptions(params)) { - return this.list(uuid, {}, params); - } - const { account_id, zone_id } = params; - if (!account_id && !zone_id) { - throw new CloudflareError('You must provide either account_id or zone_id.'); - } - if (account_id && zone_id) { - throw new CloudflareError('You cannot provide both account_id and zone_id.'); - } - const { accountOrZone, accountOrZoneId } = - account_id ? - { - accountOrZone: 'accounts', - accountOrZoneId: account_id, - } - : { - accountOrZone: 'zones', - accountOrZoneId: zone_id, - }; - return this._client.getAPIList( - `/${accountOrZone}/${accountOrZoneId}/access/apps/${uuid}/policies`, - PolicyListResponsesSinglePage, - options, - ); - } - - /** - * Deletes an Access policy specific to an application. To delete a reusable - * policy, use the /account or zones/{identifier}/policies/{uid} endpoint. - */ - delete( - uuid1: string, - uuid: string, - params?: PolicyDeleteParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - delete(uuid1: string, uuid: string, options?: Core.RequestOptions): Core.APIPromise; - delete( - uuid1: string, - uuid: string, - params: PolicyDeleteParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(params)) { - return this.delete(uuid1, uuid, {}, params); - } - const { account_id, zone_id } = params; - if (!account_id && !zone_id) { - throw new CloudflareError('You must provide either account_id or zone_id.'); - } - if (account_id && zone_id) { - throw new CloudflareError('You cannot provide both account_id and zone_id.'); - } - const { accountOrZone, accountOrZoneId } = - account_id ? - { - accountOrZone: 'accounts', - accountOrZoneId: account_id, - } - : { - accountOrZone: 'zones', - accountOrZoneId: zone_id, - }; - return ( - this._client.delete( - `/${accountOrZone}/${accountOrZoneId}/access/apps/${uuid1}/policies/${uuid}`, - options, - ) as Core.APIPromise<{ result: PolicyDeleteResponse }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Fetches a single Access policy configured for an application. Returns both - * exclusively owned and reusable policies used by the application. - */ - get( - uuid1: string, - uuid: string, - params?: PolicyGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - get(uuid1: string, uuid: string, options?: Core.RequestOptions): Core.APIPromise; - get( - uuid1: string, - uuid: string, - params: PolicyGetParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(params)) { - return this.get(uuid1, uuid, {}, params); - } - const { account_id, zone_id } = params; - if (!account_id && !zone_id) { - throw new CloudflareError('You must provide either account_id or zone_id.'); - } - if (account_id && zone_id) { - throw new CloudflareError('You cannot provide both account_id and zone_id.'); - } - const { accountOrZone, accountOrZoneId } = - account_id ? - { - accountOrZone: 'accounts', - accountOrZoneId: account_id, - } - : { - accountOrZone: 'zones', - accountOrZoneId: zone_id, - }; - return ( - this._client.get( - `/${accountOrZone}/${accountOrZoneId}/access/apps/${uuid1}/policies/${uuid}`, - options, - ) as Core.APIPromise<{ result: PolicyGetResponse }> - )._thenUnwrap((obj) => obj.result); - } -} - -export class PolicyListResponsesSinglePage extends SinglePage {} +export class Policies extends APIResource {} /** * A group of email addresses that can approve a temporary authentication request. @@ -352,527 +140,7 @@ export namespace Policy { } } -export interface PolicyCreateResponse { - /** - * UUID - */ - id?: string; - - /** - * Administrators who can approve a temporary authentication request. - */ - approval_groups?: Array; - - /** - * Requires the user to request access from an administrator at the start of each - * session. - */ - approval_required?: boolean; - - created_at?: string; - - /** - * The action Access will take if a user matches this policy. - */ - decision?: ApplicationsAPI.Decision; - - /** - * Rules evaluated with a NOT logical operator. To match the policy, a user cannot - * meet any of the Exclude rules. - */ - exclude?: Array; - - /** - * Rules evaluated with an OR logical operator. A user needs to meet only one of - * the Include rules. - */ - include?: Array; - - /** - * Require this application to be served in an isolated browser for users matching - * this policy. 'Client Web Isolation' must be on for the account in order to use - * this feature. - */ - isolation_required?: boolean; - - /** - * The name of the Access policy. - */ - name?: string; - - /** - * A custom message that will appear on the purpose justification screen. - */ - purpose_justification_prompt?: string; - - /** - * Require users to enter a justification when they log in to the application. - */ - purpose_justification_required?: boolean; - - /** - * Rules evaluated with an AND logical operator. To match the policy, a user must - * meet all of the Require rules. - */ - require?: Array; - - /** - * The amount of time that tokens issued for the application will be valid. Must be - * in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, - * m, h. - */ - session_duration?: string; - - updated_at?: string; -} - -export interface PolicyUpdateResponse { - /** - * UUID - */ - id?: string; - - /** - * Administrators who can approve a temporary authentication request. - */ - approval_groups?: Array; - - /** - * Requires the user to request access from an administrator at the start of each - * session. - */ - approval_required?: boolean; - - created_at?: string; - - /** - * The action Access will take if a user matches this policy. - */ - decision?: ApplicationsAPI.Decision; - - /** - * Rules evaluated with a NOT logical operator. To match the policy, a user cannot - * meet any of the Exclude rules. - */ - exclude?: Array; - - /** - * Rules evaluated with an OR logical operator. A user needs to meet only one of - * the Include rules. - */ - include?: Array; - - /** - * Require this application to be served in an isolated browser for users matching - * this policy. 'Client Web Isolation' must be on for the account in order to use - * this feature. - */ - isolation_required?: boolean; - - /** - * The name of the Access policy. - */ - name?: string; - - /** - * A custom message that will appear on the purpose justification screen. - */ - purpose_justification_prompt?: string; - - /** - * Require users to enter a justification when they log in to the application. - */ - purpose_justification_required?: boolean; - - /** - * Rules evaluated with an AND logical operator. To match the policy, a user must - * meet all of the Require rules. - */ - require?: Array; - - /** - * The amount of time that tokens issued for the application will be valid. Must be - * in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, - * m, h. - */ - session_duration?: string; - - updated_at?: string; -} - -export interface PolicyListResponse { - /** - * UUID - */ - id?: string; - - /** - * Administrators who can approve a temporary authentication request. - */ - approval_groups?: Array; - - /** - * Requires the user to request access from an administrator at the start of each - * session. - */ - approval_required?: boolean; - - created_at?: string; - - /** - * The action Access will take if a user matches this policy. - */ - decision?: ApplicationsAPI.Decision; - - /** - * Rules evaluated with a NOT logical operator. To match the policy, a user cannot - * meet any of the Exclude rules. - */ - exclude?: Array; - - /** - * Rules evaluated with an OR logical operator. A user needs to meet only one of - * the Include rules. - */ - include?: Array; - - /** - * Require this application to be served in an isolated browser for users matching - * this policy. 'Client Web Isolation' must be on for the account in order to use - * this feature. - */ - isolation_required?: boolean; - - /** - * The name of the Access policy. - */ - name?: string; - - /** - * A custom message that will appear on the purpose justification screen. - */ - purpose_justification_prompt?: string; - - /** - * Require users to enter a justification when they log in to the application. - */ - purpose_justification_required?: boolean; - - /** - * Rules evaluated with an AND logical operator. To match the policy, a user must - * meet all of the Require rules. - */ - require?: Array; - - /** - * The amount of time that tokens issued for the application will be valid. Must be - * in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, - * m, h. - */ - session_duration?: string; - - updated_at?: string; -} - -export interface PolicyDeleteResponse { - /** - * UUID - */ - id?: string; -} - -export interface PolicyGetResponse { - /** - * UUID - */ - id?: string; - - /** - * Administrators who can approve a temporary authentication request. - */ - approval_groups?: Array; - - /** - * Requires the user to request access from an administrator at the start of each - * session. - */ - approval_required?: boolean; - - created_at?: string; - - /** - * The action Access will take if a user matches this policy. - */ - decision?: ApplicationsAPI.Decision; - - /** - * Rules evaluated with a NOT logical operator. To match the policy, a user cannot - * meet any of the Exclude rules. - */ - exclude?: Array; - - /** - * Rules evaluated with an OR logical operator. A user needs to meet only one of - * the Include rules. - */ - include?: Array; - - /** - * Require this application to be served in an isolated browser for users matching - * this policy. 'Client Web Isolation' must be on for the account in order to use - * this feature. - */ - isolation_required?: boolean; - - /** - * The name of the Access policy. - */ - name?: string; - - /** - * A custom message that will appear on the purpose justification screen. - */ - purpose_justification_prompt?: string; - - /** - * Require users to enter a justification when they log in to the application. - */ - purpose_justification_required?: boolean; - - /** - * Rules evaluated with an AND logical operator. To match the policy, a user must - * meet all of the Require rules. - */ - require?: Array; - - /** - * The amount of time that tokens issued for the application will be valid. Must be - * in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, - * m, h. - */ - session_duration?: string; - - updated_at?: string; -} - -export interface PolicyCreateParams { - /** - * Body param: The action Access will take if a user matches this policy. - */ - decision: ApplicationsAPI.DecisionParam; - - /** - * Body param: Rules evaluated with an OR logical operator. A user needs to meet - * only one of the Include rules. - */ - include: Array; - - /** - * Body param: The name of the Access policy. - */ - name: string; - - /** - * Path param: The Account ID to use for this endpoint. Mutually exclusive with the - * Zone ID. - */ - account_id?: string; - - /** - * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the - * Account ID. - */ - zone_id?: string; - - /** - * Body param: Administrators who can approve a temporary authentication request. - */ - approval_groups?: Array; - - /** - * Body param: Requires the user to request access from an administrator at the - * start of each session. - */ - approval_required?: boolean; - - /** - * Body param: Rules evaluated with a NOT logical operator. To match the policy, a - * user cannot meet any of the Exclude rules. - */ - exclude?: Array; - - /** - * Body param: Require this application to be served in an isolated browser for - * users matching this policy. 'Client Web Isolation' must be on for the account in - * order to use this feature. - */ - isolation_required?: boolean; - - /** - * Body param: The order of execution for this policy. Must be unique for each - * policy within an app. - */ - precedence?: number; - - /** - * Body param: A custom message that will appear on the purpose justification - * screen. - */ - purpose_justification_prompt?: string; - - /** - * Body param: Require users to enter a justification when they log in to the - * application. - */ - purpose_justification_required?: boolean; - - /** - * Body param: Rules evaluated with an AND logical operator. To match the policy, a - * user must meet all of the Require rules. - */ - require?: Array; - - /** - * Body param: The amount of time that tokens issued for the application will be - * valid. Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us - * (or µs), ms, s, m, h. - */ - session_duration?: string; -} - -export interface PolicyUpdateParams { - /** - * Body param: The action Access will take if a user matches this policy. - */ - decision: ApplicationsAPI.DecisionParam; - - /** - * Body param: Rules evaluated with an OR logical operator. A user needs to meet - * only one of the Include rules. - */ - include: Array; - - /** - * Body param: The name of the Access policy. - */ - name: string; - - /** - * Path param: The Account ID to use for this endpoint. Mutually exclusive with the - * Zone ID. - */ - account_id?: string; - - /** - * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the - * Account ID. - */ - zone_id?: string; - - /** - * Body param: Administrators who can approve a temporary authentication request. - */ - approval_groups?: Array; - - /** - * Body param: Requires the user to request access from an administrator at the - * start of each session. - */ - approval_required?: boolean; - - /** - * Body param: Rules evaluated with a NOT logical operator. To match the policy, a - * user cannot meet any of the Exclude rules. - */ - exclude?: Array; - - /** - * Body param: Require this application to be served in an isolated browser for - * users matching this policy. 'Client Web Isolation' must be on for the account in - * order to use this feature. - */ - isolation_required?: boolean; - - /** - * Body param: The order of execution for this policy. Must be unique for each - * policy within an app. - */ - precedence?: number; - - /** - * Body param: A custom message that will appear on the purpose justification - * screen. - */ - purpose_justification_prompt?: string; - - /** - * Body param: Require users to enter a justification when they log in to the - * application. - */ - purpose_justification_required?: boolean; - - /** - * Body param: Rules evaluated with an AND logical operator. To match the policy, a - * user must meet all of the Require rules. - */ - require?: Array; - - /** - * Body param: The amount of time that tokens issued for the application will be - * valid. Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us - * (or µs), ms, s, m, h. - */ - session_duration?: string; -} - -export interface PolicyListParams { - /** - * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - */ - account_id?: string; - - /** - * The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - */ - zone_id?: string; -} - -export interface PolicyDeleteParams { - /** - * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - */ - account_id?: string; - - /** - * The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - */ - zone_id?: string; -} - -export interface PolicyGetParams { - /** - * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - */ - account_id?: string; - - /** - * The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - */ - zone_id?: string; -} - export namespace Policies { export import ApprovalGroup = PoliciesAPI.ApprovalGroup; export import Policy = PoliciesAPI.Policy; - export import PolicyCreateResponse = PoliciesAPI.PolicyCreateResponse; - export import PolicyUpdateResponse = PoliciesAPI.PolicyUpdateResponse; - export import PolicyListResponse = PoliciesAPI.PolicyListResponse; - export import PolicyDeleteResponse = PoliciesAPI.PolicyDeleteResponse; - export import PolicyGetResponse = PoliciesAPI.PolicyGetResponse; - export import PolicyListResponsesSinglePage = PoliciesAPI.PolicyListResponsesSinglePage; - export import PolicyCreateParams = PoliciesAPI.PolicyCreateParams; - export import PolicyUpdateParams = PoliciesAPI.PolicyUpdateParams; - export import PolicyListParams = PoliciesAPI.PolicyListParams; - export import PolicyDeleteParams = PoliciesAPI.PolicyDeleteParams; - export import PolicyGetParams = PoliciesAPI.PolicyGetParams; } diff --git a/src/resources/zero-trust/access/bookmarks.ts b/src/resources/zero-trust/access/bookmarks.ts index a26571b47f..c832d6f4f7 100644 --- a/src/resources/zero-trust/access/bookmarks.ts +++ b/src/resources/zero-trust/access/bookmarks.ts @@ -1,80 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import * as Core from '../../../core'; import { APIResource } from '../../../resource'; import * as BookmarksAPI from './bookmarks'; -import { SinglePage } from '../../../pagination'; -export class Bookmarks extends APIResource { - /** - * Create a new Bookmark application. - */ - create( - identifier: string, - uuid: string, - body: BookmarkCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return ( - this._client.post(`/accounts/${identifier}/access/bookmarks/${uuid}`, { - body, - ...options, - }) as Core.APIPromise<{ result: Bookmark }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Updates a configured Bookmark application. - */ - update( - identifier: string, - uuid: string, - body: BookmarkUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return ( - this._client.put(`/accounts/${identifier}/access/bookmarks/${uuid}`, { - body, - ...options, - }) as Core.APIPromise<{ result: Bookmark }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Lists Bookmark applications. - */ - list(identifier: string, options?: Core.RequestOptions): Core.PagePromise { - return this._client.getAPIList(`/accounts/${identifier}/access/bookmarks`, BookmarksSinglePage, options); - } - - /** - * Deletes a Bookmark application. - */ - delete( - identifier: string, - uuid: string, - options?: Core.RequestOptions, - ): Core.APIPromise { - return ( - this._client.delete(`/accounts/${identifier}/access/bookmarks/${uuid}`, options) as Core.APIPromise<{ - result: BookmarkDeleteResponse; - }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Fetches a single Bookmark application. - */ - get(identifier: string, uuid: string, options?: Core.RequestOptions): Core.APIPromise { - return ( - this._client.get(`/accounts/${identifier}/access/bookmarks/${uuid}`, options) as Core.APIPromise<{ - result: Bookmark; - }> - )._thenUnwrap((obj) => obj.result); - } -} - -export class BookmarksSinglePage extends SinglePage {} +export class Bookmarks extends APIResource {} export interface Bookmark { /** @@ -107,21 +36,6 @@ export interface Bookmark { updated_at?: string; } -export interface BookmarkDeleteResponse { - /** - * UUID - */ - id?: string; -} - -export type BookmarkCreateParams = unknown; - -export type BookmarkUpdateParams = unknown; - export namespace Bookmarks { export import Bookmark = BookmarksAPI.Bookmark; - export import BookmarkDeleteResponse = BookmarksAPI.BookmarkDeleteResponse; - export import BookmarksSinglePage = BookmarksAPI.BookmarksSinglePage; - export import BookmarkCreateParams = BookmarksAPI.BookmarkCreateParams; - export import BookmarkUpdateParams = BookmarksAPI.BookmarkUpdateParams; } diff --git a/src/resources/zero-trust/access/certificates/certificates.ts b/src/resources/zero-trust/access/certificates/certificates.ts index 2a6c13cb42..ddf4e02c77 100644 --- a/src/resources/zero-trust/access/certificates/certificates.ts +++ b/src/resources/zero-trust/access/certificates/certificates.ts @@ -40,39 +40,6 @@ export class Certificates extends APIResource { )._thenUnwrap((obj) => obj.result); } - /** - * Updates a configured mTLS certificate. - */ - update( - uuid: string, - params: CertificateUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, zone_id, ...body } = params; - if (!account_id && !zone_id) { - throw new CloudflareError('You must provide either account_id or zone_id.'); - } - if (account_id && zone_id) { - throw new CloudflareError('You cannot provide both account_id and zone_id.'); - } - const { accountOrZone, accountOrZoneId } = - account_id ? - { - accountOrZone: 'accounts', - accountOrZoneId: account_id, - } - : { - accountOrZone: 'zones', - accountOrZoneId: zone_id, - }; - return ( - this._client.put(`/${accountOrZone}/${accountOrZoneId}/access/certificates/${uuid}`, { - body, - ...options, - }) as Core.APIPromise<{ result: Certificate }> - )._thenUnwrap((obj) => obj.result); - } - /** * Lists all mTLS root certificates. */ @@ -111,90 +78,6 @@ export class Certificates extends APIResource { options, ); } - - /** - * Deletes an mTLS certificate. - */ - delete( - uuid: string, - params?: CertificateDeleteParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - delete(uuid: string, options?: Core.RequestOptions): Core.APIPromise; - delete( - uuid: string, - params: CertificateDeleteParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(params)) { - return this.delete(uuid, {}, params); - } - const { account_id, zone_id } = params; - if (!account_id && !zone_id) { - throw new CloudflareError('You must provide either account_id or zone_id.'); - } - if (account_id && zone_id) { - throw new CloudflareError('You cannot provide both account_id and zone_id.'); - } - const { accountOrZone, accountOrZoneId } = - account_id ? - { - accountOrZone: 'accounts', - accountOrZoneId: account_id, - } - : { - accountOrZone: 'zones', - accountOrZoneId: zone_id, - }; - return ( - this._client.delete( - `/${accountOrZone}/${accountOrZoneId}/access/certificates/${uuid}`, - options, - ) as Core.APIPromise<{ result: CertificateDeleteResponse }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Fetches a single mTLS certificate. - */ - get( - uuid: string, - params?: CertificateGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - get(uuid: string, options?: Core.RequestOptions): Core.APIPromise; - get( - uuid: string, - params: CertificateGetParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(params)) { - return this.get(uuid, {}, params); - } - const { account_id, zone_id } = params; - if (!account_id && !zone_id) { - throw new CloudflareError('You must provide either account_id or zone_id.'); - } - if (account_id && zone_id) { - throw new CloudflareError('You cannot provide both account_id and zone_id.'); - } - const { accountOrZone, accountOrZoneId } = - account_id ? - { - accountOrZone: 'accounts', - accountOrZoneId: account_id, - } - : { - accountOrZone: 'zones', - accountOrZoneId: zone_id, - }; - return ( - this._client.get( - `/${accountOrZone}/${accountOrZoneId}/access/certificates/${uuid}`, - options, - ) as Core.APIPromise<{ result: Certificate }> - )._thenUnwrap((obj) => obj.result); - } } export class CertificatesSinglePage extends SinglePage {} @@ -237,13 +120,6 @@ export interface Certificate { updated_at?: string; } -export interface CertificateDeleteResponse { - /** - * UUID - */ - id?: string; -} - export interface CertificateCreateParams { /** * Body param: The certificate content. @@ -273,30 +149,6 @@ export interface CertificateCreateParams { associated_hostnames?: Array; } -export interface CertificateUpdateParams { - /** - * Body param: The hostnames of the applications that will use this certificate. - */ - associated_hostnames: Array; - - /** - * Path param: The Account ID to use for this endpoint. Mutually exclusive with the - * Zone ID. - */ - account_id?: string; - - /** - * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the - * Account ID. - */ - zone_id?: string; - - /** - * Body param: The name of the certificate. - */ - name?: string; -} - export interface CertificateListParams { /** * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -309,40 +161,12 @@ export interface CertificateListParams { zone_id?: string; } -export interface CertificateDeleteParams { - /** - * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - */ - account_id?: string; - - /** - * The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - */ - zone_id?: string; -} - -export interface CertificateGetParams { - /** - * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - */ - account_id?: string; - - /** - * The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - */ - zone_id?: string; -} - export namespace Certificates { export import AssociatedHostnames = CertificatesAPI.AssociatedHostnames; export import Certificate = CertificatesAPI.Certificate; - export import CertificateDeleteResponse = CertificatesAPI.CertificateDeleteResponse; export import CertificatesSinglePage = CertificatesAPI.CertificatesSinglePage; export import CertificateCreateParams = CertificatesAPI.CertificateCreateParams; - export import CertificateUpdateParams = CertificatesAPI.CertificateUpdateParams; export import CertificateListParams = CertificatesAPI.CertificateListParams; - export import CertificateDeleteParams = CertificatesAPI.CertificateDeleteParams; - export import CertificateGetParams = CertificatesAPI.CertificateGetParams; export import Settings = SettingsAPI.Settings; export import CertificateSettings = SettingsAPI.CertificateSettings; export import SettingUpdateResponse = SettingsAPI.SettingUpdateResponse; diff --git a/src/resources/zero-trust/access/certificates/index.ts b/src/resources/zero-trust/access/certificates/index.ts index 3c2abc1cbf..848e3341be 100644 --- a/src/resources/zero-trust/access/certificates/index.ts +++ b/src/resources/zero-trust/access/certificates/index.ts @@ -3,12 +3,8 @@ export { AssociatedHostnames, Certificate, - CertificateDeleteResponse, CertificateCreateParams, - CertificateUpdateParams, CertificateListParams, - CertificateDeleteParams, - CertificateGetParams, CertificatesSinglePage, Certificates, } from './certificates'; diff --git a/src/resources/zero-trust/access/custom-pages.ts b/src/resources/zero-trust/access/custom-pages.ts index f599bbe114..dc101f810f 100644 --- a/src/resources/zero-trust/access/custom-pages.ts +++ b/src/resources/zero-trust/access/custom-pages.ts @@ -1,86 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import * as Core from '../../../core'; import { APIResource } from '../../../resource'; import * as CustomPagesAPI from './custom-pages'; -import { SinglePage } from '../../../pagination'; -export class CustomPages extends APIResource { - /** - * Create a custom page - */ - create( - identifier: string, - body: CustomPageCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return ( - this._client.post(`/accounts/${identifier}/access/custom_pages`, { - body, - ...options, - }) as Core.APIPromise<{ result: CustomPageWithoutHTML }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Update a custom page - */ - update( - identifier: string, - uuid: string, - body: CustomPageUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return ( - this._client.put(`/accounts/${identifier}/access/custom_pages/${uuid}`, { - body, - ...options, - }) as Core.APIPromise<{ result: CustomPageWithoutHTML }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * List custom pages - */ - list( - identifier: string, - options?: Core.RequestOptions, - ): Core.PagePromise { - return this._client.getAPIList( - `/accounts/${identifier}/access/custom_pages`, - CustomPageWithoutHTMLsSinglePage, - options, - ); - } - - /** - * Delete a custom page - */ - delete( - identifier: string, - uuid: string, - options?: Core.RequestOptions, - ): Core.APIPromise { - return ( - this._client.delete(`/accounts/${identifier}/access/custom_pages/${uuid}`, options) as Core.APIPromise<{ - result: CustomPageDeleteResponse; - }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Fetches a custom page and also returns its HTML. - */ - get(identifier: string, uuid: string, options?: Core.RequestOptions): Core.APIPromise { - return ( - this._client.get(`/accounts/${identifier}/access/custom_pages/${uuid}`, options) as Core.APIPromise<{ - result: CustomPage; - }> - )._thenUnwrap((obj) => obj.result); - } -} - -export class CustomPageWithoutHTMLsSinglePage extends SinglePage {} +export class CustomPages extends APIResource {} export interface CustomPage { /** @@ -139,62 +62,7 @@ export interface CustomPageWithoutHTML { updated_at?: string; } -export interface CustomPageDeleteResponse { - /** - * UUID - */ - id?: string; -} - -export interface CustomPageCreateParams { - /** - * Custom page HTML. - */ - custom_html: string; - - /** - * Custom page name. - */ - name: string; - - /** - * Custom page type. - */ - type: 'identity_denied' | 'forbidden'; - - /** - * Number of apps the custom page is assigned to. - */ - app_count?: number; -} - -export interface CustomPageUpdateParams { - /** - * Custom page HTML. - */ - custom_html: string; - - /** - * Custom page name. - */ - name: string; - - /** - * Custom page type. - */ - type: 'identity_denied' | 'forbidden'; - - /** - * Number of apps the custom page is assigned to. - */ - app_count?: number; -} - export namespace CustomPages { export import CustomPage = CustomPagesAPI.CustomPage; export import CustomPageWithoutHTML = CustomPagesAPI.CustomPageWithoutHTML; - export import CustomPageDeleteResponse = CustomPagesAPI.CustomPageDeleteResponse; - export import CustomPageWithoutHTMLsSinglePage = CustomPagesAPI.CustomPageWithoutHTMLsSinglePage; - export import CustomPageCreateParams = CustomPagesAPI.CustomPageCreateParams; - export import CustomPageUpdateParams = CustomPagesAPI.CustomPageUpdateParams; } diff --git a/src/resources/zero-trust/access/groups.ts b/src/resources/zero-trust/access/groups.ts index 5d135d10a5..9cc298c02a 100644 --- a/src/resources/zero-trust/access/groups.ts +++ b/src/resources/zero-trust/access/groups.ts @@ -38,39 +38,6 @@ export class Groups extends APIResource { )._thenUnwrap((obj) => obj.result); } - /** - * Updates a configured Access group. - */ - update( - uuid: string, - params: GroupUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, zone_id, ...body } = params; - if (!account_id && !zone_id) { - throw new CloudflareError('You must provide either account_id or zone_id.'); - } - if (account_id && zone_id) { - throw new CloudflareError('You cannot provide both account_id and zone_id.'); - } - const { accountOrZone, accountOrZoneId } = - account_id ? - { - accountOrZone: 'accounts', - accountOrZoneId: account_id, - } - : { - accountOrZone: 'zones', - accountOrZoneId: zone_id, - }; - return ( - this._client.put(`/${accountOrZone}/${accountOrZoneId}/access/groups/${uuid}`, { - body, - ...options, - }) as Core.APIPromise<{ result: ZeroTrustGroup }> - )._thenUnwrap((obj) => obj.result); - } - /** * Lists all Access groups. */ @@ -109,86 +76,6 @@ export class Groups extends APIResource { options, ); } - - /** - * Deletes an Access group. - */ - delete( - uuid: string, - params?: GroupDeleteParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - delete(uuid: string, options?: Core.RequestOptions): Core.APIPromise; - delete( - uuid: string, - params: GroupDeleteParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(params)) { - return this.delete(uuid, {}, params); - } - const { account_id, zone_id } = params; - if (!account_id && !zone_id) { - throw new CloudflareError('You must provide either account_id or zone_id.'); - } - if (account_id && zone_id) { - throw new CloudflareError('You cannot provide both account_id and zone_id.'); - } - const { accountOrZone, accountOrZoneId } = - account_id ? - { - accountOrZone: 'accounts', - accountOrZoneId: account_id, - } - : { - accountOrZone: 'zones', - accountOrZoneId: zone_id, - }; - return ( - this._client.delete( - `/${accountOrZone}/${accountOrZoneId}/access/groups/${uuid}`, - options, - ) as Core.APIPromise<{ result: GroupDeleteResponse }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Fetches a single Access group. - */ - get(uuid: string, params?: GroupGetParams, options?: Core.RequestOptions): Core.APIPromise; - get(uuid: string, options?: Core.RequestOptions): Core.APIPromise; - get( - uuid: string, - params: GroupGetParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(params)) { - return this.get(uuid, {}, params); - } - const { account_id, zone_id } = params; - if (!account_id && !zone_id) { - throw new CloudflareError('You must provide either account_id or zone_id.'); - } - if (account_id && zone_id) { - throw new CloudflareError('You cannot provide both account_id and zone_id.'); - } - const { accountOrZone, accountOrZoneId } = - account_id ? - { - accountOrZone: 'accounts', - accountOrZoneId: account_id, - } - : { - accountOrZone: 'zones', - accountOrZoneId: zone_id, - }; - return ( - this._client.get( - `/${accountOrZone}/${accountOrZoneId}/access/groups/${uuid}`, - options, - ) as Core.APIPromise<{ result: ZeroTrustGroup }> - )._thenUnwrap((obj) => obj.result); - } } export class ZeroTrustGroupsSinglePage extends SinglePage {} @@ -233,13 +120,6 @@ export interface ZeroTrustGroup { updated_at?: string; } -export interface GroupDeleteResponse { - /** - * UUID - */ - id?: string; -} - export interface GroupCreateParams { /** * Body param: Rules evaluated with an OR logical operator. A user needs to meet @@ -282,48 +162,6 @@ export interface GroupCreateParams { require?: Array; } -export interface GroupUpdateParams { - /** - * Body param: Rules evaluated with an OR logical operator. A user needs to meet - * only one of the Include rules. - */ - include: Array; - - /** - * Body param: The name of the Access group. - */ - name: string; - - /** - * Path param: The Account ID to use for this endpoint. Mutually exclusive with the - * Zone ID. - */ - account_id?: string; - - /** - * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the - * Account ID. - */ - zone_id?: string; - - /** - * Body param: Rules evaluated with a NOT logical operator. To match a policy, a - * user cannot meet any of the Exclude rules. - */ - exclude?: Array; - - /** - * Body param: Whether this is the default group - */ - is_default?: boolean; - - /** - * Body param: Rules evaluated with an AND logical operator. To match a policy, a - * user must meet all of the Require rules. - */ - require?: Array; -} - export interface GroupListParams { /** * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -336,37 +174,9 @@ export interface GroupListParams { zone_id?: string; } -export interface GroupDeleteParams { - /** - * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - */ - account_id?: string; - - /** - * The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - */ - zone_id?: string; -} - -export interface GroupGetParams { - /** - * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - */ - account_id?: string; - - /** - * The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - */ - zone_id?: string; -} - export namespace Groups { export import ZeroTrustGroup = GroupsAPI.ZeroTrustGroup; - export import GroupDeleteResponse = GroupsAPI.GroupDeleteResponse; export import ZeroTrustGroupsSinglePage = GroupsAPI.ZeroTrustGroupsSinglePage; export import GroupCreateParams = GroupsAPI.GroupCreateParams; - export import GroupUpdateParams = GroupsAPI.GroupUpdateParams; export import GroupListParams = GroupsAPI.GroupListParams; - export import GroupDeleteParams = GroupsAPI.GroupDeleteParams; - export import GroupGetParams = GroupsAPI.GroupGetParams; } diff --git a/src/resources/zero-trust/access/index.ts b/src/resources/zero-trust/access/index.ts index c701f3e8c9..3360ad649d 100644 --- a/src/resources/zero-trust/access/index.ts +++ b/src/resources/zero-trust/access/index.ts @@ -23,7 +23,7 @@ export { ServiceTokenRule, Access, } from './access'; -export { AccessUser, AccessUsersSinglePage, Users } from './users/index'; +export { AccessUser, Users } from './users/index'; export { AllowedHeaders, AllowedIdPs, @@ -57,55 +57,28 @@ export { export { AssociatedHostnames, Certificate, - CertificateDeleteResponse, CertificateCreateParams, - CertificateUpdateParams, CertificateListParams, - CertificateDeleteParams, - CertificateGetParams, CertificatesSinglePage, Certificates, } from './certificates/index'; -export { - Bookmark, - BookmarkDeleteResponse, - BookmarkCreateParams, - BookmarkUpdateParams, - BookmarksSinglePage, - Bookmarks, -} from './bookmarks'; -export { - CustomPage, - CustomPageWithoutHTML, - CustomPageDeleteResponse, - CustomPageCreateParams, - CustomPageUpdateParams, - CustomPageWithoutHTMLsSinglePage, - CustomPages, -} from './custom-pages'; -export { KeyUpdateResponse, KeyGetResponse, KeyRotateResponse, KeyUpdateParams, Keys } from './keys'; +export { Bookmark, Bookmarks } from './bookmarks'; +export { CustomPage, CustomPageWithoutHTML, CustomPages } from './custom-pages'; +export { Keys } from './keys'; export { Logs } from './logs/index'; export { ServiceToken, ServiceTokenCreateResponse, - ServiceTokenRotateResponse, ServiceTokenCreateParams, - ServiceTokenUpdateParams, ServiceTokenListParams, - ServiceTokenDeleteParams, - ServiceTokenGetParams, ServiceTokensSinglePage, ServiceTokens, } from './service-tokens'; -export { Tag, TagDeleteResponse, TagCreateParams, TagUpdateParams, TagsSinglePage, Tags } from './tags'; +export { Tag, Tags } from './tags'; export { ZeroTrustGroup, - GroupDeleteResponse, GroupCreateParams, - GroupUpdateParams, GroupListParams, - GroupDeleteParams, - GroupGetParams, ZeroTrustGroupsSinglePage, Groups, } from './groups'; diff --git a/src/resources/zero-trust/access/keys.ts b/src/resources/zero-trust/access/keys.ts index 70c8151b19..2bb90ee421 100644 --- a/src/resources/zero-trust/access/keys.ts +++ b/src/resources/zero-trust/access/keys.ts @@ -1,64 +1,5 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import * as Core from '../../../core'; import { APIResource } from '../../../resource'; -import * as KeysAPI from './keys'; -export class Keys extends APIResource { - /** - * Updates the Access key rotation settings for an account. - */ - update( - identifier: string, - body: KeyUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return ( - this._client.put(`/accounts/${identifier}/access/keys`, { body, ...options }) as Core.APIPromise<{ - result: KeyUpdateResponse; - }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Gets the Access key rotation settings for an account. - */ - get(identifier: string, options?: Core.RequestOptions): Core.APIPromise { - return ( - this._client.get(`/accounts/${identifier}/access/keys`, options) as Core.APIPromise<{ - result: KeyGetResponse; - }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Perfoms a key rotation for an account. - */ - rotate(identifier: string, options?: Core.RequestOptions): Core.APIPromise { - return ( - this._client.post(`/accounts/${identifier}/access/keys/rotate`, options) as Core.APIPromise<{ - result: KeyRotateResponse; - }> - )._thenUnwrap((obj) => obj.result); - } -} - -export type KeyUpdateResponse = unknown | string; - -export type KeyGetResponse = unknown | string; - -export type KeyRotateResponse = unknown | string; - -export interface KeyUpdateParams { - /** - * The number of days between key rotations. - */ - key_rotation_interval_days: number; -} - -export namespace Keys { - export import KeyUpdateResponse = KeysAPI.KeyUpdateResponse; - export import KeyGetResponse = KeysAPI.KeyGetResponse; - export import KeyRotateResponse = KeysAPI.KeyRotateResponse; - export import KeyUpdateParams = KeysAPI.KeyUpdateParams; -} +export class Keys extends APIResource {} diff --git a/src/resources/zero-trust/access/logs/access-requests.ts b/src/resources/zero-trust/access/logs/access-requests.ts index b1fe770657..57f919e34d 100644 --- a/src/resources/zero-trust/access/logs/access-requests.ts +++ b/src/resources/zero-trust/access/logs/access-requests.ts @@ -1,21 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import * as Core from '../../../../core'; import { APIResource } from '../../../../resource'; import * as AccessRequestsAPI from './access-requests'; -export class AccessRequests extends APIResource { - /** - * Gets a list of Access authentication audit logs for an account. - */ - list(identifier: string, options?: Core.RequestOptions): Core.APIPromise { - return ( - this._client.get(`/accounts/${identifier}/access/logs/access_requests`, options) as Core.APIPromise<{ - result: AccessRequestListResponse | null; - }> - )._thenUnwrap((obj) => obj.result); - } -} +export class AccessRequests extends APIResource {} export interface AccessRequests { /** @@ -61,9 +49,6 @@ export interface AccessRequests { user_email?: string; } -export type AccessRequestListResponse = Array; - export namespace AccessRequests { export import AccessRequests = AccessRequestsAPI.AccessRequests; - export import AccessRequestListResponse = AccessRequestsAPI.AccessRequestListResponse; } diff --git a/src/resources/zero-trust/access/logs/index.ts b/src/resources/zero-trust/access/logs/index.ts index ec9c1f634a..b454fdb4b4 100644 --- a/src/resources/zero-trust/access/logs/index.ts +++ b/src/resources/zero-trust/access/logs/index.ts @@ -1,4 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { AccessRequests, AccessRequestListResponse } from './access-requests'; +export { AccessRequests } from './access-requests'; export { Logs } from './logs'; diff --git a/src/resources/zero-trust/access/logs/logs.ts b/src/resources/zero-trust/access/logs/logs.ts index 7480ab283e..fa67d65b57 100644 --- a/src/resources/zero-trust/access/logs/logs.ts +++ b/src/resources/zero-trust/access/logs/logs.ts @@ -9,5 +9,4 @@ export class Logs extends APIResource { export namespace Logs { export import AccessRequests = AccessRequestsAPI.AccessRequests; - export import AccessRequestListResponse = AccessRequestsAPI.AccessRequestListResponse; } diff --git a/src/resources/zero-trust/access/service-tokens.ts b/src/resources/zero-trust/access/service-tokens.ts index 6d1d0e7e30..0c52f8696a 100644 --- a/src/resources/zero-trust/access/service-tokens.ts +++ b/src/resources/zero-trust/access/service-tokens.ts @@ -42,39 +42,6 @@ export class ServiceTokens extends APIResource { )._thenUnwrap((obj) => obj.result); } - /** - * Updates a configured service token. - */ - update( - uuid: string, - params: ServiceTokenUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, zone_id, ...body } = params; - if (!account_id && !zone_id) { - throw new CloudflareError('You must provide either account_id or zone_id.'); - } - if (account_id && zone_id) { - throw new CloudflareError('You cannot provide both account_id and zone_id.'); - } - const { accountOrZone, accountOrZoneId } = - account_id ? - { - accountOrZone: 'accounts', - accountOrZoneId: account_id, - } - : { - accountOrZone: 'zones', - accountOrZoneId: zone_id, - }; - return ( - this._client.put(`/${accountOrZone}/${accountOrZoneId}/access/service_tokens/${uuid}`, { - body, - ...options, - }) as Core.APIPromise<{ result: ServiceToken }> - )._thenUnwrap((obj) => obj.result); - } - /** * Lists all service tokens. */ @@ -113,118 +80,6 @@ export class ServiceTokens extends APIResource { options, ); } - - /** - * Deletes a service token. - */ - delete( - uuid: string, - params?: ServiceTokenDeleteParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - delete(uuid: string, options?: Core.RequestOptions): Core.APIPromise; - delete( - uuid: string, - params: ServiceTokenDeleteParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(params)) { - return this.delete(uuid, {}, params); - } - const { account_id, zone_id } = params; - if (!account_id && !zone_id) { - throw new CloudflareError('You must provide either account_id or zone_id.'); - } - if (account_id && zone_id) { - throw new CloudflareError('You cannot provide both account_id and zone_id.'); - } - const { accountOrZone, accountOrZoneId } = - account_id ? - { - accountOrZone: 'accounts', - accountOrZoneId: account_id, - } - : { - accountOrZone: 'zones', - accountOrZoneId: zone_id, - }; - return ( - this._client.delete( - `/${accountOrZone}/${accountOrZoneId}/access/service_tokens/${uuid}`, - options, - ) as Core.APIPromise<{ result: ServiceToken }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Fetches a single service token. - */ - get( - uuid: string, - params?: ServiceTokenGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - get(uuid: string, options?: Core.RequestOptions): Core.APIPromise; - get( - uuid: string, - params: ServiceTokenGetParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(params)) { - return this.get(uuid, {}, params); - } - const { account_id, zone_id } = params; - if (!account_id && !zone_id) { - throw new CloudflareError('You must provide either account_id or zone_id.'); - } - if (account_id && zone_id) { - throw new CloudflareError('You cannot provide both account_id and zone_id.'); - } - const { accountOrZone, accountOrZoneId } = - account_id ? - { - accountOrZone: 'accounts', - accountOrZoneId: account_id, - } - : { - accountOrZone: 'zones', - accountOrZoneId: zone_id, - }; - return ( - this._client.get( - `/${accountOrZone}/${accountOrZoneId}/access/service_tokens/${uuid}`, - options, - ) as Core.APIPromise<{ result: ServiceToken }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Refreshes the expiration of a service token. - */ - refresh(identifier: string, uuid: string, options?: Core.RequestOptions): Core.APIPromise { - return ( - this._client.post( - `/accounts/${identifier}/access/service_tokens/${uuid}/refresh`, - options, - ) as Core.APIPromise<{ result: ServiceToken }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Generates a new Client Secret for a service token and revokes the old one. - */ - rotate( - identifier: string, - uuid: string, - options?: Core.RequestOptions, - ): Core.APIPromise { - return ( - this._client.post( - `/accounts/${identifier}/access/service_tokens/${uuid}/rotate`, - options, - ) as Core.APIPromise<{ result: ServiceTokenRotateResponse }> - )._thenUnwrap((obj) => obj.result); - } } export class ServiceTokensSinglePage extends SinglePage {} @@ -293,41 +148,6 @@ export interface ServiceTokenCreateResponse { updated_at?: string; } -export interface ServiceTokenRotateResponse { - /** - * The ID of the service token. - */ - id?: string; - - /** - * The Client ID for the service token. Access will check for this value in the - * `CF-Access-Client-ID` request header. - */ - client_id?: string; - - /** - * The Client Secret for the service token. Access will check for this value in the - * `CF-Access-Client-Secret` request header. - */ - client_secret?: string; - - created_at?: string; - - /** - * The duration for how long the service token will be valid. Must be in the format - * `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, m, h. The - * default is 1 year in hours (8760h). - */ - duration?: string; - - /** - * The name of the service token. - */ - name?: string; - - updated_at?: string; -} - export interface ServiceTokenCreateParams { /** * Body param: The name of the service token. @@ -354,32 +174,6 @@ export interface ServiceTokenCreateParams { duration?: string; } -export interface ServiceTokenUpdateParams { - /** - * Path param: The Account ID to use for this endpoint. Mutually exclusive with the - * Zone ID. - */ - account_id?: string; - - /** - * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the - * Account ID. - */ - zone_id?: string; - - /** - * Body param: The duration for how long the service token will be valid. Must be - * in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, - * m, h. The default is 1 year in hours (8760h). - */ - duration?: string; - - /** - * Body param: The name of the service token. - */ - name?: string; -} - export interface ServiceTokenListParams { /** * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -392,38 +186,10 @@ export interface ServiceTokenListParams { zone_id?: string; } -export interface ServiceTokenDeleteParams { - /** - * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - */ - account_id?: string; - - /** - * The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - */ - zone_id?: string; -} - -export interface ServiceTokenGetParams { - /** - * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - */ - account_id?: string; - - /** - * The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - */ - zone_id?: string; -} - export namespace ServiceTokens { export import ServiceToken = ServiceTokensAPI.ServiceToken; export import ServiceTokenCreateResponse = ServiceTokensAPI.ServiceTokenCreateResponse; - export import ServiceTokenRotateResponse = ServiceTokensAPI.ServiceTokenRotateResponse; export import ServiceTokensSinglePage = ServiceTokensAPI.ServiceTokensSinglePage; export import ServiceTokenCreateParams = ServiceTokensAPI.ServiceTokenCreateParams; - export import ServiceTokenUpdateParams = ServiceTokensAPI.ServiceTokenUpdateParams; export import ServiceTokenListParams = ServiceTokensAPI.ServiceTokenListParams; - export import ServiceTokenDeleteParams = ServiceTokensAPI.ServiceTokenDeleteParams; - export import ServiceTokenGetParams = ServiceTokensAPI.ServiceTokenGetParams; } diff --git a/src/resources/zero-trust/access/tags.ts b/src/resources/zero-trust/access/tags.ts index 9a47c958b2..b719c5b274 100644 --- a/src/resources/zero-trust/access/tags.ts +++ b/src/resources/zero-trust/access/tags.ts @@ -1,74 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import * as Core from '../../../core'; import { APIResource } from '../../../resource'; import * as TagsAPI from './tags'; -import { SinglePage } from '../../../pagination'; -export class Tags extends APIResource { - /** - * Create a tag - */ - create(identifier: string, body: TagCreateParams, options?: Core.RequestOptions): Core.APIPromise { - return ( - this._client.post(`/accounts/${identifier}/access/tags`, { body, ...options }) as Core.APIPromise<{ - result: Tag; - }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Update a tag - */ - update( - identifier: string, - tagName: string, - body: TagUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return ( - this._client.put(`/accounts/${identifier}/access/tags/${tagName}`, { - body, - ...options, - }) as Core.APIPromise<{ result: Tag }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * List tags - */ - list(identifier: string, options?: Core.RequestOptions): Core.PagePromise { - return this._client.getAPIList(`/accounts/${identifier}/access/tags`, TagsSinglePage, options); - } - - /** - * Delete a tag - */ - delete( - identifier: string, - name: string, - options?: Core.RequestOptions, - ): Core.APIPromise { - return ( - this._client.delete(`/accounts/${identifier}/access/tags/${name}`, options) as Core.APIPromise<{ - result: TagDeleteResponse; - }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Get a tag - */ - get(identifier: string, name: string, options?: Core.RequestOptions): Core.APIPromise { - return ( - this._client.get(`/accounts/${identifier}/access/tags/${name}`, options) as Core.APIPromise<{ - result: Tag; - }> - )._thenUnwrap((obj) => obj.result); - } -} - -export class TagsSinglePage extends SinglePage {} +export class Tags extends APIResource {} /** * A tag @@ -89,31 +24,6 @@ export interface Tag { updated_at?: string; } -export interface TagDeleteResponse { - /** - * The name of the tag - */ - name?: string; -} - -export interface TagCreateParams { - /** - * The name of the tag - */ - name: string; -} - -export interface TagUpdateParams { - /** - * The name of the tag - */ - name: string; -} - export namespace Tags { export import Tag = TagsAPI.Tag; - export import TagDeleteResponse = TagsAPI.TagDeleteResponse; - export import TagsSinglePage = TagsAPI.TagsSinglePage; - export import TagCreateParams = TagsAPI.TagCreateParams; - export import TagUpdateParams = TagsAPI.TagUpdateParams; } diff --git a/src/resources/zero-trust/access/users/active-sessions.ts b/src/resources/zero-trust/access/users/active-sessions.ts index 31178910e7..354017c029 100644 --- a/src/resources/zero-trust/access/users/active-sessions.ts +++ b/src/resources/zero-trust/access/users/active-sessions.ts @@ -1,175 +1,5 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import * as Core from '../../../../core'; import { APIResource } from '../../../../resource'; -import * as ActiveSessionsAPI from './active-sessions'; -import * as UserPolicyChecksAPI from '../applications/user-policy-checks'; -import { SinglePage } from '../../../../pagination'; -export class ActiveSessions extends APIResource { - /** - * Get active sessions for a single user. - */ - list( - identifier: string, - id: string, - options?: Core.RequestOptions, - ): Core.PagePromise { - return this._client.getAPIList( - `/accounts/${identifier}/access/users/${id}/active_sessions`, - ActiveSessionListResponsesSinglePage, - options, - ); - } - - /** - * Get an active session for a single user. - */ - get( - identifier: string, - id: string, - nonce: string, - options?: Core.RequestOptions, - ): Core.APIPromise { - return ( - this._client.get( - `/accounts/${identifier}/access/users/${id}/active_sessions/${nonce}`, - options, - ) as Core.APIPromise<{ result: ActiveSessionGetResponse }> - )._thenUnwrap((obj) => obj.result); - } -} - -export class ActiveSessionListResponsesSinglePage extends SinglePage {} - -export interface ActiveSessionListResponse { - expiration?: number; - - metadata?: ActiveSessionListResponse.Metadata; - - name?: string; -} - -export namespace ActiveSessionListResponse { - export interface Metadata { - apps?: Record; - - expires?: number; - - iat?: number; - - nonce?: string; - - ttl?: number; - } - - export namespace Metadata { - export interface Apps { - hostname?: string; - - name?: string; - - type?: string; - - uid?: string; - } - } -} - -export interface ActiveSessionGetResponse { - account_id?: string; - - auth_status?: string; - - common_name?: string; - - device_id?: string; - - device_sessions?: Record; - - devicePosture?: Record; - - email?: string; - - geo?: UserPolicyChecksAPI.UserPolicyCheckGeo; - - iat?: number; - - idp?: ActiveSessionGetResponse.IdP; - - ip?: string; - - is_gateway?: boolean; - - is_warp?: boolean; - - isActive?: boolean; - - mtls_auth?: ActiveSessionGetResponse.MTLSAuth; - - service_token_id?: string; - - service_token_status?: boolean; - - user_uuid?: string; - - version?: number; -} - -export namespace ActiveSessionGetResponse { - export interface DeviceSessions { - last_authenticated?: number; - } - - export interface DevicePosture { - id?: string; - - check?: DevicePosture.Check; - - data?: unknown; - - description?: string; - - error?: string; - - rule_name?: string; - - success?: boolean; - - timestamp?: string; - - type?: string; - } - - export namespace DevicePosture { - export interface Check { - exists?: boolean; - - path?: string; - } - } - - export interface IdP { - id?: string; - - type?: string; - } - - export interface MTLSAuth { - auth_status?: string; - - cert_issuer_dn?: string; - - cert_issuer_ski?: string; - - cert_presented?: boolean; - - cert_serial?: string; - } -} - -export namespace ActiveSessions { - export import ActiveSessionListResponse = ActiveSessionsAPI.ActiveSessionListResponse; - export import ActiveSessionGetResponse = ActiveSessionsAPI.ActiveSessionGetResponse; - export import ActiveSessionListResponsesSinglePage = ActiveSessionsAPI.ActiveSessionListResponsesSinglePage; -} +export class ActiveSessions extends APIResource {} diff --git a/src/resources/zero-trust/access/users/failed-logins.ts b/src/resources/zero-trust/access/users/failed-logins.ts index fcd3137144..296de81891 100644 --- a/src/resources/zero-trust/access/users/failed-logins.ts +++ b/src/resources/zero-trust/access/users/failed-logins.ts @@ -1,36 +1,5 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import * as Core from '../../../../core'; import { APIResource } from '../../../../resource'; -import * as FailedLoginsAPI from './failed-logins'; -import { SinglePage } from '../../../../pagination'; -export class FailedLogins extends APIResource { - /** - * Get all failed login attempts for a single user. - */ - list( - identifier: string, - id: string, - options?: Core.RequestOptions, - ): Core.PagePromise { - return this._client.getAPIList( - `/accounts/${identifier}/access/users/${id}/failed_logins`, - FailedLoginListResponsesSinglePage, - options, - ); - } -} - -export class FailedLoginListResponsesSinglePage extends SinglePage {} - -export interface FailedLoginListResponse { - expiration?: number; - - metadata?: unknown; -} - -export namespace FailedLogins { - export import FailedLoginListResponse = FailedLoginsAPI.FailedLoginListResponse; - export import FailedLoginListResponsesSinglePage = FailedLoginsAPI.FailedLoginListResponsesSinglePage; -} +export class FailedLogins extends APIResource {} diff --git a/src/resources/zero-trust/access/users/index.ts b/src/resources/zero-trust/access/users/index.ts index abbf1fdd96..559dd2384e 100644 --- a/src/resources/zero-trust/access/users/index.ts +++ b/src/resources/zero-trust/access/users/index.ts @@ -1,11 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { AccessUser, AccessUsersSinglePage, Users } from './users'; -export { - ActiveSessionListResponse, - ActiveSessionGetResponse, - ActiveSessionListResponsesSinglePage, - ActiveSessions, -} from './active-sessions'; -export { FailedLoginListResponse, FailedLoginListResponsesSinglePage, FailedLogins } from './failed-logins'; +export { AccessUser, Users } from './users'; +export { ActiveSessions } from './active-sessions'; +export { FailedLogins } from './failed-logins'; export { Identity, LastSeenIdentity } from './last-seen-identity'; diff --git a/src/resources/zero-trust/access/users/last-seen-identity.ts b/src/resources/zero-trust/access/users/last-seen-identity.ts index 7186509ed3..653416254e 100644 --- a/src/resources/zero-trust/access/users/last-seen-identity.ts +++ b/src/resources/zero-trust/access/users/last-seen-identity.ts @@ -1,23 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import * as Core from '../../../../core'; import { APIResource } from '../../../../resource'; import * as LastSeenIdentityAPI from './last-seen-identity'; import * as UserPolicyChecksAPI from '../applications/user-policy-checks'; -export class LastSeenIdentity extends APIResource { - /** - * Get last seen identity for a single user. - */ - get(identifier: string, id: string, options?: Core.RequestOptions): Core.APIPromise { - return ( - this._client.get( - `/accounts/${identifier}/access/users/${id}/last_seen_identity`, - options, - ) as Core.APIPromise<{ result: Identity }> - )._thenUnwrap((obj) => obj.result); - } -} +export class LastSeenIdentity extends APIResource {} export interface Identity { account_id?: string; diff --git a/src/resources/zero-trust/access/users/users.ts b/src/resources/zero-trust/access/users/users.ts index f9471e943d..b004cadefb 100644 --- a/src/resources/zero-trust/access/users/users.ts +++ b/src/resources/zero-trust/access/users/users.ts @@ -1,12 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import * as Core from '../../../../core'; import { APIResource } from '../../../../resource'; import * as UsersAPI from './users'; import * as ActiveSessionsAPI from './active-sessions'; import * as FailedLoginsAPI from './failed-logins'; import * as LastSeenIdentityAPI from './last-seen-identity'; -import { SinglePage } from '../../../../pagination'; export class Users extends APIResource { activeSessions: ActiveSessionsAPI.ActiveSessions = new ActiveSessionsAPI.ActiveSessions(this._client); @@ -14,20 +12,8 @@ export class Users extends APIResource { this._client, ); failedLogins: FailedLoginsAPI.FailedLogins = new FailedLoginsAPI.FailedLogins(this._client); - - /** - * Gets a list of users for an account. - */ - list( - identifier: string, - options?: Core.RequestOptions, - ): Core.PagePromise { - return this._client.getAPIList(`/accounts/${identifier}/access/users`, AccessUsersSinglePage, options); - } } -export class AccessUsersSinglePage extends SinglePage {} - export interface AccessUser { /** * UUID @@ -81,14 +67,8 @@ export interface AccessUser { export namespace Users { export import AccessUser = UsersAPI.AccessUser; - export import AccessUsersSinglePage = UsersAPI.AccessUsersSinglePage; export import ActiveSessions = ActiveSessionsAPI.ActiveSessions; - export import ActiveSessionListResponse = ActiveSessionsAPI.ActiveSessionListResponse; - export import ActiveSessionGetResponse = ActiveSessionsAPI.ActiveSessionGetResponse; - export import ActiveSessionListResponsesSinglePage = ActiveSessionsAPI.ActiveSessionListResponsesSinglePage; export import LastSeenIdentity = LastSeenIdentityAPI.LastSeenIdentity; export import Identity = LastSeenIdentityAPI.Identity; export import FailedLogins = FailedLoginsAPI.FailedLogins; - export import FailedLoginListResponse = FailedLoginsAPI.FailedLoginListResponse; - export import FailedLoginListResponsesSinglePage = FailedLoginsAPI.FailedLoginListResponsesSinglePage; } diff --git a/src/resources/zero-trust/identity-providers.ts b/src/resources/zero-trust/identity-providers.ts index a3a547f1fd..c003f9afec 100644 --- a/src/resources/zero-trust/identity-providers.ts +++ b/src/resources/zero-trust/identity-providers.ts @@ -40,39 +40,6 @@ export class IdentityProviders extends APIResource { )._thenUnwrap((obj) => obj.result); } - /** - * Updates a configured identity provider. - */ - update( - uuid: string, - params: IdentityProviderUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, zone_id, ...body } = params; - if (!account_id && !zone_id) { - throw new CloudflareError('You must provide either account_id or zone_id.'); - } - if (account_id && zone_id) { - throw new CloudflareError('You cannot provide both account_id and zone_id.'); - } - const { accountOrZone, accountOrZoneId } = - account_id ? - { - accountOrZone: 'accounts', - accountOrZoneId: account_id, - } - : { - accountOrZone: 'zones', - accountOrZoneId: zone_id, - }; - return ( - this._client.put(`/${accountOrZone}/${accountOrZoneId}/access/identity_providers/${uuid}`, { - body, - ...options, - }) as Core.APIPromise<{ result: IdentityProvider }> - )._thenUnwrap((obj) => obj.result); - } - /** * Lists all configured identity providers. */ @@ -113,90 +80,6 @@ export class IdentityProviders extends APIResource { options, ); } - - /** - * Deletes an identity provider from Access. - */ - delete( - uuid: string, - params?: IdentityProviderDeleteParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - delete(uuid: string, options?: Core.RequestOptions): Core.APIPromise; - delete( - uuid: string, - params: IdentityProviderDeleteParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(params)) { - return this.delete(uuid, {}, params); - } - const { account_id, zone_id } = params; - if (!account_id && !zone_id) { - throw new CloudflareError('You must provide either account_id or zone_id.'); - } - if (account_id && zone_id) { - throw new CloudflareError('You cannot provide both account_id and zone_id.'); - } - const { accountOrZone, accountOrZoneId } = - account_id ? - { - accountOrZone: 'accounts', - accountOrZoneId: account_id, - } - : { - accountOrZone: 'zones', - accountOrZoneId: zone_id, - }; - return ( - this._client.delete( - `/${accountOrZone}/${accountOrZoneId}/access/identity_providers/${uuid}`, - options, - ) as Core.APIPromise<{ result: IdentityProviderDeleteResponse }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Fetches a configured identity provider. - */ - get( - uuid: string, - params?: IdentityProviderGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - get(uuid: string, options?: Core.RequestOptions): Core.APIPromise; - get( - uuid: string, - params: IdentityProviderGetParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(params)) { - return this.get(uuid, {}, params); - } - const { account_id, zone_id } = params; - if (!account_id && !zone_id) { - throw new CloudflareError('You must provide either account_id or zone_id.'); - } - if (account_id && zone_id) { - throw new CloudflareError('You cannot provide both account_id and zone_id.'); - } - const { accountOrZone, accountOrZoneId } = - account_id ? - { - accountOrZone: 'accounts', - accountOrZoneId: account_id, - } - : { - accountOrZone: 'zones', - accountOrZoneId: zone_id, - }; - return ( - this._client.get( - `/${accountOrZone}/${accountOrZoneId}/access/identity_providers/${uuid}`, - options, - ) as Core.APIPromise<{ result: IdentityProvider }> - )._thenUnwrap((obj) => obj.result); - } } export class IdentityProviderListResponsesSinglePage extends SinglePage {} @@ -1904,13 +1787,6 @@ export namespace IdentityProviderListResponse { } } -export interface IdentityProviderDeleteResponse { - /** - * UUID - */ - id?: string; -} - export type IdentityProviderCreateParams = | IdentityProviderCreateParams.AzureAD | IdentityProviderCreateParams.AccessCentrify @@ -2850,945 +2726,6 @@ export namespace IdentityProviderCreateParams { } } -export type IdentityProviderUpdateParams = - | IdentityProviderUpdateParams.AzureAD - | IdentityProviderUpdateParams.AccessCentrify - | IdentityProviderUpdateParams.AccessFacebook - | IdentityProviderUpdateParams.AccessGitHub - | IdentityProviderUpdateParams.AccessGoogle - | IdentityProviderUpdateParams.AccessGoogleApps - | IdentityProviderUpdateParams.AccessLinkedin - | IdentityProviderUpdateParams.AccessOIDC - | IdentityProviderUpdateParams.AccessOkta - | IdentityProviderUpdateParams.AccessOnelogin - | IdentityProviderUpdateParams.AccessPingone - | IdentityProviderUpdateParams.AccessSAML - | IdentityProviderUpdateParams.AccessYandex - | IdentityProviderUpdateParams.AccessOnetimepin; - -export namespace IdentityProviderUpdateParams { - export interface AzureAD { - /** - * Body param: The configuration parameters for the identity provider. To view the - * required parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - config: IdentityProviderUpdateParams.AzureAD.Config; - - /** - * Body param: The name of the identity provider, shown to users on the login page. - */ - name: string; - - /** - * Body param: The type of identity provider. To determine the value for a specific - * provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - type: IdentityProviderTypeParam; - - /** - * Path param: The Account ID to use for this endpoint. Mutually exclusive with the - * Zone ID. - */ - account_id?: string; - - /** - * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the - * Account ID. - */ - zone_id?: string; - - /** - * Body param: The configuration settings for enabling a System for Cross-Domain - * Identity Management (SCIM) with the identity provider. - */ - scim_config?: ScimConfigParam; - } - - export namespace AzureAD { - /** - * The configuration parameters for the identity provider. To view the required - * parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - export interface Config { - /** - * Custom claims - */ - claims?: Array; - - /** - * Your OAuth Client ID - */ - client_id?: string; - - /** - * Your OAuth Client Secret - */ - client_secret?: string; - - /** - * Should Cloudflare try to load authentication contexts from your account - */ - conditional_access_enabled?: boolean; - - /** - * Your Azure directory uuid - */ - directory_id?: string; - - /** - * The claim name for email in the id_token response. - */ - email_claim_name?: string; - - /** - * Indicates the type of user interaction that is required. prompt=login forces the - * user to enter their credentials on that request, negating single-sign on. - * prompt=none is the opposite. It ensures that the user isn't presented with any - * interactive prompt. If the request can't be completed silently by using - * single-sign on, the Microsoft identity platform returns an interaction_required - * error. prompt=select_account interrupts single sign-on providing account - * selection experience listing all the accounts either in session or any - * remembered account or an option to choose to use a different account altogether. - */ - prompt?: 'login' | 'select_account' | 'none'; - - /** - * Should Cloudflare try to load groups from your account - */ - support_groups?: boolean; - } - } - - export interface AccessCentrify { - /** - * Body param: The configuration parameters for the identity provider. To view the - * required parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - config: IdentityProviderUpdateParams.AccessCentrify.Config; - - /** - * Body param: The name of the identity provider, shown to users on the login page. - */ - name: string; - - /** - * Body param: The type of identity provider. To determine the value for a specific - * provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - type: IdentityProviderTypeParam; - - /** - * Path param: The Account ID to use for this endpoint. Mutually exclusive with the - * Zone ID. - */ - account_id?: string; - - /** - * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the - * Account ID. - */ - zone_id?: string; - - /** - * Body param: The configuration settings for enabling a System for Cross-Domain - * Identity Management (SCIM) with the identity provider. - */ - scim_config?: ScimConfigParam; - } - - export namespace AccessCentrify { - /** - * The configuration parameters for the identity provider. To view the required - * parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - export interface Config { - /** - * Your centrify account url - */ - centrify_account?: string; - - /** - * Your centrify app id - */ - centrify_app_id?: string; - - /** - * Custom claims - */ - claims?: Array; - - /** - * Your OAuth Client ID - */ - client_id?: string; - - /** - * Your OAuth Client Secret - */ - client_secret?: string; - - /** - * The claim name for email in the id_token response. - */ - email_claim_name?: string; - } - } - - export interface AccessFacebook { - /** - * Body param: The configuration parameters for the identity provider. To view the - * required parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - config: GenericOAuthConfigParam; - - /** - * Body param: The name of the identity provider, shown to users on the login page. - */ - name: string; - - /** - * Body param: The type of identity provider. To determine the value for a specific - * provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - type: IdentityProviderTypeParam; - - /** - * Path param: The Account ID to use for this endpoint. Mutually exclusive with the - * Zone ID. - */ - account_id?: string; - - /** - * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the - * Account ID. - */ - zone_id?: string; - - /** - * Body param: The configuration settings for enabling a System for Cross-Domain - * Identity Management (SCIM) with the identity provider. - */ - scim_config?: ScimConfigParam; - } - - export interface AccessGitHub { - /** - * Body param: The configuration parameters for the identity provider. To view the - * required parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - config: GenericOAuthConfigParam; - - /** - * Body param: The name of the identity provider, shown to users on the login page. - */ - name: string; - - /** - * Body param: The type of identity provider. To determine the value for a specific - * provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - type: IdentityProviderTypeParam; - - /** - * Path param: The Account ID to use for this endpoint. Mutually exclusive with the - * Zone ID. - */ - account_id?: string; - - /** - * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the - * Account ID. - */ - zone_id?: string; - - /** - * Body param: The configuration settings for enabling a System for Cross-Domain - * Identity Management (SCIM) with the identity provider. - */ - scim_config?: ScimConfigParam; - } - - export interface AccessGoogle { - /** - * Body param: The configuration parameters for the identity provider. To view the - * required parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - config: IdentityProviderUpdateParams.AccessGoogle.Config; - - /** - * Body param: The name of the identity provider, shown to users on the login page. - */ - name: string; - - /** - * Body param: The type of identity provider. To determine the value for a specific - * provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - type: IdentityProviderTypeParam; - - /** - * Path param: The Account ID to use for this endpoint. Mutually exclusive with the - * Zone ID. - */ - account_id?: string; - - /** - * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the - * Account ID. - */ - zone_id?: string; - - /** - * Body param: The configuration settings for enabling a System for Cross-Domain - * Identity Management (SCIM) with the identity provider. - */ - scim_config?: ScimConfigParam; - } - - export namespace AccessGoogle { - /** - * The configuration parameters for the identity provider. To view the required - * parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - export interface Config { - /** - * Custom claims - */ - claims?: Array; - - /** - * Your OAuth Client ID - */ - client_id?: string; - - /** - * Your OAuth Client Secret - */ - client_secret?: string; - - /** - * The claim name for email in the id_token response. - */ - email_claim_name?: string; - } - } - - export interface AccessGoogleApps { - /** - * Body param: The configuration parameters for the identity provider. To view the - * required parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - config: IdentityProviderUpdateParams.AccessGoogleApps.Config; - - /** - * Body param: The name of the identity provider, shown to users on the login page. - */ - name: string; - - /** - * Body param: The type of identity provider. To determine the value for a specific - * provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - type: IdentityProviderTypeParam; - - /** - * Path param: The Account ID to use for this endpoint. Mutually exclusive with the - * Zone ID. - */ - account_id?: string; - - /** - * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the - * Account ID. - */ - zone_id?: string; - - /** - * Body param: The configuration settings for enabling a System for Cross-Domain - * Identity Management (SCIM) with the identity provider. - */ - scim_config?: ScimConfigParam; - } - - export namespace AccessGoogleApps { - /** - * The configuration parameters for the identity provider. To view the required - * parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - export interface Config { - /** - * Your companies TLD - */ - apps_domain?: string; - - /** - * Custom claims - */ - claims?: Array; - - /** - * Your OAuth Client ID - */ - client_id?: string; - - /** - * Your OAuth Client Secret - */ - client_secret?: string; - - /** - * The claim name for email in the id_token response. - */ - email_claim_name?: string; - } - } - - export interface AccessLinkedin { - /** - * Body param: The configuration parameters for the identity provider. To view the - * required parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - config: GenericOAuthConfigParam; - - /** - * Body param: The name of the identity provider, shown to users on the login page. - */ - name: string; - - /** - * Body param: The type of identity provider. To determine the value for a specific - * provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - type: IdentityProviderTypeParam; - - /** - * Path param: The Account ID to use for this endpoint. Mutually exclusive with the - * Zone ID. - */ - account_id?: string; - - /** - * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the - * Account ID. - */ - zone_id?: string; - - /** - * Body param: The configuration settings for enabling a System for Cross-Domain - * Identity Management (SCIM) with the identity provider. - */ - scim_config?: ScimConfigParam; - } - - export interface AccessOIDC { - /** - * Body param: The configuration parameters for the identity provider. To view the - * required parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - config: IdentityProviderUpdateParams.AccessOIDC.Config; - - /** - * Body param: The name of the identity provider, shown to users on the login page. - */ - name: string; - - /** - * Body param: The type of identity provider. To determine the value for a specific - * provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - type: IdentityProviderTypeParam; - - /** - * Path param: The Account ID to use for this endpoint. Mutually exclusive with the - * Zone ID. - */ - account_id?: string; - - /** - * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the - * Account ID. - */ - zone_id?: string; - - /** - * Body param: The configuration settings for enabling a System for Cross-Domain - * Identity Management (SCIM) with the identity provider. - */ - scim_config?: ScimConfigParam; - } - - export namespace AccessOIDC { - /** - * The configuration parameters for the identity provider. To view the required - * parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - export interface Config { - /** - * The authorization_endpoint URL of your IdP - */ - auth_url?: string; - - /** - * The jwks_uri endpoint of your IdP to allow the IdP keys to sign the tokens - */ - certs_url?: string; - - /** - * Custom claims - */ - claims?: Array; - - /** - * Your OAuth Client ID - */ - client_id?: string; - - /** - * Your OAuth Client Secret - */ - client_secret?: string; - - /** - * The claim name for email in the id_token response. - */ - email_claim_name?: string; - - /** - * OAuth scopes - */ - scopes?: Array; - - /** - * The token_endpoint URL of your IdP - */ - token_url?: string; - } - } - - export interface AccessOkta { - /** - * Body param: The configuration parameters for the identity provider. To view the - * required parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - config: IdentityProviderUpdateParams.AccessOkta.Config; - - /** - * Body param: The name of the identity provider, shown to users on the login page. - */ - name: string; - - /** - * Body param: The type of identity provider. To determine the value for a specific - * provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - type: IdentityProviderTypeParam; - - /** - * Path param: The Account ID to use for this endpoint. Mutually exclusive with the - * Zone ID. - */ - account_id?: string; - - /** - * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the - * Account ID. - */ - zone_id?: string; - - /** - * Body param: The configuration settings for enabling a System for Cross-Domain - * Identity Management (SCIM) with the identity provider. - */ - scim_config?: ScimConfigParam; - } - - export namespace AccessOkta { - /** - * The configuration parameters for the identity provider. To view the required - * parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - export interface Config { - /** - * Your okta authorization server id - */ - authorization_server_id?: string; - - /** - * Custom claims - */ - claims?: Array; - - /** - * Your OAuth Client ID - */ - client_id?: string; - - /** - * Your OAuth Client Secret - */ - client_secret?: string; - - /** - * The claim name for email in the id_token response. - */ - email_claim_name?: string; - - /** - * Your okta account url - */ - okta_account?: string; - } - } - - export interface AccessOnelogin { - /** - * Body param: The configuration parameters for the identity provider. To view the - * required parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - config: IdentityProviderUpdateParams.AccessOnelogin.Config; - - /** - * Body param: The name of the identity provider, shown to users on the login page. - */ - name: string; - - /** - * Body param: The type of identity provider. To determine the value for a specific - * provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - type: IdentityProviderTypeParam; - - /** - * Path param: The Account ID to use for this endpoint. Mutually exclusive with the - * Zone ID. - */ - account_id?: string; - - /** - * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the - * Account ID. - */ - zone_id?: string; - - /** - * Body param: The configuration settings for enabling a System for Cross-Domain - * Identity Management (SCIM) with the identity provider. - */ - scim_config?: ScimConfigParam; - } - - export namespace AccessOnelogin { - /** - * The configuration parameters for the identity provider. To view the required - * parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - export interface Config { - /** - * Custom claims - */ - claims?: Array; - - /** - * Your OAuth Client ID - */ - client_id?: string; - - /** - * Your OAuth Client Secret - */ - client_secret?: string; - - /** - * The claim name for email in the id_token response. - */ - email_claim_name?: string; - - /** - * Your OneLogin account url - */ - onelogin_account?: string; - } - } - - export interface AccessPingone { - /** - * Body param: The configuration parameters for the identity provider. To view the - * required parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - config: IdentityProviderUpdateParams.AccessPingone.Config; - - /** - * Body param: The name of the identity provider, shown to users on the login page. - */ - name: string; - - /** - * Body param: The type of identity provider. To determine the value for a specific - * provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - type: IdentityProviderTypeParam; - - /** - * Path param: The Account ID to use for this endpoint. Mutually exclusive with the - * Zone ID. - */ - account_id?: string; - - /** - * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the - * Account ID. - */ - zone_id?: string; - - /** - * Body param: The configuration settings for enabling a System for Cross-Domain - * Identity Management (SCIM) with the identity provider. - */ - scim_config?: ScimConfigParam; - } - - export namespace AccessPingone { - /** - * The configuration parameters for the identity provider. To view the required - * parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - export interface Config { - /** - * Custom claims - */ - claims?: Array; - - /** - * Your OAuth Client ID - */ - client_id?: string; - - /** - * Your OAuth Client Secret - */ - client_secret?: string; - - /** - * The claim name for email in the id_token response. - */ - email_claim_name?: string; - - /** - * Your PingOne environment identifier - */ - ping_env_id?: string; - } - } - - export interface AccessSAML { - /** - * Body param: The configuration parameters for the identity provider. To view the - * required parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - config: IdentityProviderUpdateParams.AccessSAML.Config; - - /** - * Body param: The name of the identity provider, shown to users on the login page. - */ - name: string; - - /** - * Body param: The type of identity provider. To determine the value for a specific - * provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - type: IdentityProviderTypeParam; - - /** - * Path param: The Account ID to use for this endpoint. Mutually exclusive with the - * Zone ID. - */ - account_id?: string; - - /** - * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the - * Account ID. - */ - zone_id?: string; - - /** - * Body param: The configuration settings for enabling a System for Cross-Domain - * Identity Management (SCIM) with the identity provider. - */ - scim_config?: ScimConfigParam; - } - - export namespace AccessSAML { - /** - * The configuration parameters for the identity provider. To view the required - * parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - export interface Config { - /** - * A list of SAML attribute names that will be added to your signed JWT token and - * can be used in SAML policy rules. - */ - attributes?: Array; - - /** - * The attribute name for email in the SAML response. - */ - email_attribute_name?: string; - - /** - * Add a list of attribute names that will be returned in the response header from - * the Access callback. - */ - header_attributes?: Array; - - /** - * X509 certificate to verify the signature in the SAML authentication response - */ - idp_public_certs?: Array; - - /** - * IdP Entity ID or Issuer URL - */ - issuer_url?: string; - - /** - * Sign the SAML authentication request with Access credentials. To verify the - * signature, use the public key from the Access certs endpoints. - */ - sign_request?: boolean; - - /** - * URL to send the SAML authentication requests to - */ - sso_target_url?: string; - } - - export namespace Config { - export interface HeaderAttribute { - /** - * attribute name from the IDP - */ - attribute_name?: string; - - /** - * header that will be added on the request to the origin - */ - header_name?: string; - } - } - } - - export interface AccessYandex { - /** - * Body param: The configuration parameters for the identity provider. To view the - * required parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - config: GenericOAuthConfigParam; - - /** - * Body param: The name of the identity provider, shown to users on the login page. - */ - name: string; - - /** - * Body param: The type of identity provider. To determine the value for a specific - * provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - type: IdentityProviderTypeParam; - - /** - * Path param: The Account ID to use for this endpoint. Mutually exclusive with the - * Zone ID. - */ - account_id?: string; - - /** - * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the - * Account ID. - */ - zone_id?: string; - - /** - * Body param: The configuration settings for enabling a System for Cross-Domain - * Identity Management (SCIM) with the identity provider. - */ - scim_config?: ScimConfigParam; - } - - export interface AccessOnetimepin { - /** - * Body param: The configuration parameters for the identity provider. To view the - * required parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - config: unknown; - - /** - * Body param: The name of the identity provider, shown to users on the login page. - */ - name: string; - - /** - * Body param: The type of identity provider. To determine the value for a specific - * provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). - */ - type: IdentityProviderTypeParam; - - /** - * Path param: The Account ID to use for this endpoint. Mutually exclusive with the - * Zone ID. - */ - account_id?: string; - - /** - * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the - * Account ID. - */ - zone_id?: string; - - /** - * Body param: The configuration settings for enabling a System for Cross-Domain - * Identity Management (SCIM) with the identity provider. - */ - scim_config?: ScimConfigParam; - } -} - export interface IdentityProviderListParams { /** * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. @@ -3801,30 +2738,6 @@ export interface IdentityProviderListParams { zone_id?: string; } -export interface IdentityProviderDeleteParams { - /** - * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - */ - account_id?: string; - - /** - * The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - */ - zone_id?: string; -} - -export interface IdentityProviderGetParams { - /** - * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - */ - account_id?: string; - - /** - * The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - */ - zone_id?: string; -} - export namespace IdentityProviders { export import AzureAD = IdentityProvidersAPI.AzureAD; export import GenericOAuthConfig = IdentityProvidersAPI.GenericOAuthConfig; @@ -3832,11 +2745,7 @@ export namespace IdentityProviders { export import IdentityProviderType = IdentityProvidersAPI.IdentityProviderType; export import ScimConfig = IdentityProvidersAPI.ScimConfig; export import IdentityProviderListResponse = IdentityProvidersAPI.IdentityProviderListResponse; - export import IdentityProviderDeleteResponse = IdentityProvidersAPI.IdentityProviderDeleteResponse; export import IdentityProviderListResponsesSinglePage = IdentityProvidersAPI.IdentityProviderListResponsesSinglePage; export import IdentityProviderCreateParams = IdentityProvidersAPI.IdentityProviderCreateParams; - export import IdentityProviderUpdateParams = IdentityProvidersAPI.IdentityProviderUpdateParams; export import IdentityProviderListParams = IdentityProvidersAPI.IdentityProviderListParams; - export import IdentityProviderDeleteParams = IdentityProvidersAPI.IdentityProviderDeleteParams; - export import IdentityProviderGetParams = IdentityProvidersAPI.IdentityProviderGetParams; } diff --git a/src/resources/zero-trust/index.ts b/src/resources/zero-trust/index.ts index acf3c1cdb3..ed61e8ff7b 100644 --- a/src/resources/zero-trust/index.ts +++ b/src/resources/zero-trust/index.ts @@ -30,12 +30,8 @@ export { IdentityProviderType, ScimConfig, IdentityProviderListResponse, - IdentityProviderDeleteResponse, IdentityProviderCreateParams, - IdentityProviderUpdateParams, IdentityProviderListParams, - IdentityProviderDeleteParams, - IdentityProviderGetParams, IdentityProviderListResponsesSinglePage, IdentityProviders, } from './identity-providers'; @@ -95,5 +91,5 @@ export { RiskScoringGetParams, RiskScoring, } from './risk-scoring/index'; -export { Seat, SeatEditResponse, SeatEditParams, Seats } from './seats'; +export { Seat, Seats } from './seats'; export { ZeroTrust } from './zero-trust'; diff --git a/src/resources/zero-trust/seats.ts b/src/resources/zero-trust/seats.ts index 387affcca8..84b0574957 100644 --- a/src/resources/zero-trust/seats.ts +++ b/src/resources/zero-trust/seats.ts @@ -1,26 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import * as Core from '../../core'; import { APIResource } from '../../resource'; import * as SeatsAPI from './seats'; -export class Seats extends APIResource { - /** - * Removes a user from a Zero Trust seat when both `access_seat` and `gateway_seat` - * are set to false. - */ - edit( - identifier: string, - body: SeatEditParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return ( - this._client.patch(`/accounts/${identifier}/access/seats`, { body, ...options }) as Core.APIPromise<{ - result: SeatEditResponse | null; - }> - )._thenUnwrap((obj) => obj.result); - } -} +export class Seats extends APIResource {} export interface Seat { /** @@ -43,26 +26,6 @@ export interface Seat { updated_at?: string; } -export type SeatEditResponse = Array; - -export type SeatEditParams = Array; - -export namespace SeatEditParams { - export interface Body { - /** - * True if the seat is part of Access. - */ - access_seat: boolean; - - /** - * True if the seat is part of Gateway. - */ - gateway_seat: boolean; - } -} - export namespace Seats { export import Seat = SeatsAPI.Seat; - export import SeatEditResponse = SeatsAPI.SeatEditResponse; - export import SeatEditParams = SeatsAPI.SeatEditParams; } diff --git a/src/resources/zero-trust/zero-trust.ts b/src/resources/zero-trust/zero-trust.ts index 45f05d017f..4f91cd1dc2 100644 --- a/src/resources/zero-trust/zero-trust.ts +++ b/src/resources/zero-trust/zero-trust.ts @@ -46,13 +46,9 @@ export namespace ZeroTrust { export import IdentityProviderType = IdentityProvidersAPI.IdentityProviderType; export import ScimConfig = IdentityProvidersAPI.ScimConfig; export import IdentityProviderListResponse = IdentityProvidersAPI.IdentityProviderListResponse; - export import IdentityProviderDeleteResponse = IdentityProvidersAPI.IdentityProviderDeleteResponse; export import IdentityProviderListResponsesSinglePage = IdentityProvidersAPI.IdentityProviderListResponsesSinglePage; export import IdentityProviderCreateParams = IdentityProvidersAPI.IdentityProviderCreateParams; - export import IdentityProviderUpdateParams = IdentityProvidersAPI.IdentityProviderUpdateParams; export import IdentityProviderListParams = IdentityProvidersAPI.IdentityProviderListParams; - export import IdentityProviderDeleteParams = IdentityProvidersAPI.IdentityProviderDeleteParams; - export import IdentityProviderGetParams = IdentityProvidersAPI.IdentityProviderGetParams; export import Organizations = OrganizationsAPI.Organizations; export import LoginDesign = OrganizationsAPI.LoginDesign; export import Organization = OrganizationsAPI.Organization; @@ -63,8 +59,6 @@ export namespace ZeroTrust { export import OrganizationRevokeUsersParams = OrganizationsAPI.OrganizationRevokeUsersParams; export import Seats = SeatsAPI.Seats; export import Seat = SeatsAPI.Seat; - export import SeatEditResponse = SeatsAPI.SeatEditResponse; - export import SeatEditParams = SeatsAPI.SeatEditParams; export import Access = AccessAPI.Access; export import AccessDevicePostureRule = AccessAPI.AccessDevicePostureRule; export import AccessRule = AccessAPI.AccessRule; diff --git a/tests/api-resources/ai-gateway/ai-gateway.test.ts b/tests/api-resources/ai-gateway/ai-gateway.test.ts index 80304c3da7..252fd1276d 100644 --- a/tests/api-resources/ai-gateway/ai-gateway.test.ts +++ b/tests/api-resources/ai-gateway/ai-gateway.test.ts @@ -17,6 +17,9 @@ describe('resource aiGateway', () => { cache_invalidate_on_update: true, cache_ttl: 0, collect_logs: true, + rate_limiting_interval: 0, + rate_limiting_limit: 0, + rate_limiting_technique: 'fixed', }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -36,7 +39,7 @@ describe('resource aiGateway', () => { collect_logs: true, rate_limiting_interval: 0, rate_limiting_limit: 0, - rate_limiting_technique: 'string', + rate_limiting_technique: 'fixed', }); }); @@ -46,6 +49,9 @@ describe('resource aiGateway', () => { cache_invalidate_on_update: true, cache_ttl: 0, collect_logs: true, + rate_limiting_interval: 0, + rate_limiting_limit: 0, + rate_limiting_technique: 'fixed', }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -64,7 +70,7 @@ describe('resource aiGateway', () => { collect_logs: true, rate_limiting_interval: 0, rate_limiting_limit: 0, - rate_limiting_technique: 'string', + rate_limiting_technique: 'fixed', }); }); @@ -90,7 +96,7 @@ describe('resource aiGateway', () => { }); test('delete: only required params', async () => { - const responsePromise = cloudflare.aiGateway.delete('my-gateway', { + const responsePromise = cloudflare.aiGateway.delete('string', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', }); const rawResponse = await responsePromise.asResponse(); @@ -103,7 +109,7 @@ describe('resource aiGateway', () => { }); test('delete: required and optional params', async () => { - const response = await cloudflare.aiGateway.delete('my-gateway', { + const response = await cloudflare.aiGateway.delete('string', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', }); }); diff --git a/tests/api-resources/api-gateway/configurations.test.ts b/tests/api-resources/api-gateway/configurations.test.ts new file mode 100644 index 0000000000..6db1de3a07 --- /dev/null +++ b/tests/api-resources/api-gateway/configurations.test.ts @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const cloudflare = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource configurations', () => { + test('update: only required params', async () => { + const responsePromise = cloudflare.apiGateway.configurations.update({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('update: required and optional params', async () => { + const response = await cloudflare.apiGateway.configurations.update({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + auth_id_characteristics: [{ name: 'authorization', type: 'header' }], + }); + }); + + test('get: only required params', async () => { + const responsePromise = cloudflare.apiGateway.configurations.get({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await cloudflare.apiGateway.configurations.get({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + properties: ['auth_id_characteristics'], + }); + }); +}); diff --git a/tests/api-resources/zero-trust/access/users/users.test.ts b/tests/api-resources/api-gateway/discovery/discovery.test.ts similarity index 56% rename from tests/api-resources/zero-trust/access/users/users.test.ts rename to tests/api-resources/api-gateway/discovery/discovery.test.ts index f795e8681f..e3d2829f59 100644 --- a/tests/api-resources/zero-trust/access/users/users.test.ts +++ b/tests/api-resources/api-gateway/discovery/discovery.test.ts @@ -9,9 +9,11 @@ const cloudflare = new Cloudflare({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); -describe('resource users', () => { - test('list', async () => { - const responsePromise = cloudflare.zeroTrust.access.users.list('023e105f4ecef8ad9ca31a8372d0c353'); +describe('resource discovery', () => { + test('get: only required params', async () => { + const responsePromise = cloudflare.apiGateway.discovery.get({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -21,12 +23,9 @@ describe('resource users', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('list: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - cloudflare.zeroTrust.access.users.list('023e105f4ecef8ad9ca31a8372d0c353', { - path: '/_stainless_unknown_path', - }), - ).rejects.toThrow(Cloudflare.NotFoundError); + test('get: required and optional params', async () => { + const response = await cloudflare.apiGateway.discovery.get({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); }); }); diff --git a/tests/api-resources/api-gateway/discovery/operations.test.ts b/tests/api-resources/api-gateway/discovery/operations.test.ts new file mode 100644 index 0000000000..e2d982e54b --- /dev/null +++ b/tests/api-resources/api-gateway/discovery/operations.test.ts @@ -0,0 +1,62 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const cloudflare = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource operations', () => { + test('list: only required params', async () => { + const responsePromise = cloudflare.apiGateway.discovery.operations.list({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('list: required and optional params', async () => { + const response = await cloudflare.apiGateway.discovery.operations.list({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + diff: true, + direction: 'desc', + endpoint: '/api/v1', + host: ['api.cloudflare.com'], + method: ['GET'], + order: 'method', + origin: 'ML', + page: {}, + per_page: {}, + state: 'review', + }); + }); + + test('edit: only required params', async () => { + const responsePromise = cloudflare.apiGateway.discovery.operations.edit( + '0d9bf70c-92e1-4bb3-9411-34a3bcc59003', + { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('edit: required and optional params', async () => { + const response = await cloudflare.apiGateway.discovery.operations.edit( + '0d9bf70c-92e1-4bb3-9411-34a3bcc59003', + { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', state: 'review' }, + ); + }); +}); diff --git a/tests/api-resources/api-gateway/operations/operations.test.ts b/tests/api-resources/api-gateway/operations/operations.test.ts new file mode 100644 index 0000000000..1e56dff57d --- /dev/null +++ b/tests/api-resources/api-gateway/operations/operations.test.ts @@ -0,0 +1,107 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const cloudflare = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource operations', () => { + test('create: only required params', async () => { + const responsePromise = cloudflare.apiGateway.operations.create({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + body: [ + { endpoint: '/api/v1/users/{var1}', host: 'www.example.com', method: 'GET' }, + { endpoint: '/api/v1/users/{var1}', host: 'www.example.com', method: 'GET' }, + { endpoint: '/api/v1/users/{var1}', host: 'www.example.com', method: 'GET' }, + ], + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('create: required and optional params', async () => { + const response = await cloudflare.apiGateway.operations.create({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + body: [ + { endpoint: '/api/v1/users/{var1}', host: 'www.example.com', method: 'GET' }, + { endpoint: '/api/v1/users/{var1}', host: 'www.example.com', method: 'GET' }, + { endpoint: '/api/v1/users/{var1}', host: 'www.example.com', method: 'GET' }, + ], + }); + }); + + test('list: only required params', async () => { + const responsePromise = cloudflare.apiGateway.operations.list({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('list: required and optional params', async () => { + const response = await cloudflare.apiGateway.operations.list({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + direction: 'desc', + endpoint: '/api/v1', + feature: ['thresholds'], + host: ['api.cloudflare.com'], + method: ['GET'], + order: 'method', + page: {}, + per_page: 5, + }); + }); + + test('delete: only required params', async () => { + const responsePromise = cloudflare.apiGateway.operations.delete('f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('delete: required and optional params', async () => { + const response = await cloudflare.apiGateway.operations.delete('f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + }); + + test('get: only required params', async () => { + const responsePromise = cloudflare.apiGateway.operations.get('f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await cloudflare.apiGateway.operations.get('f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + feature: ['thresholds'], + }); + }); +}); diff --git a/tests/api-resources/api-gateway/operations/schema-validation.test.ts b/tests/api-resources/api-gateway/operations/schema-validation.test.ts new file mode 100644 index 0000000000..09209477dc --- /dev/null +++ b/tests/api-resources/api-gateway/operations/schema-validation.test.ts @@ -0,0 +1,81 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const cloudflare = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource schemaValidation', () => { + test('update: only required params', async () => { + const responsePromise = cloudflare.apiGateway.operations.schemaValidation.update( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('update: required and optional params', async () => { + const response = await cloudflare.apiGateway.operations.schemaValidation.update( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', mitigation_action: 'block' }, + ); + }); + + test('edit: only required params', async () => { + const responsePromise = cloudflare.apiGateway.operations.schemaValidation.edit({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + settings_multiple_request: { + '3818d821-5901-4147-a474-f5f5aec1d54e': {}, + 'b17c8043-99a0-4202-b7d9-8f7cdbee02cd': {}, + }, + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('edit: required and optional params', async () => { + const response = await cloudflare.apiGateway.operations.schemaValidation.edit({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + settings_multiple_request: { + '3818d821-5901-4147-a474-f5f5aec1d54e': { mitigation_action: 'log' }, + 'b17c8043-99a0-4202-b7d9-8f7cdbee02cd': { mitigation_action: 'block' }, + }, + }); + }); + + test('get: only required params', async () => { + const responsePromise = cloudflare.apiGateway.operations.schemaValidation.get( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await cloudflare.apiGateway.operations.schemaValidation.get( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + }); +}); diff --git a/tests/api-resources/zero-trust/access/logs/access-requests.test.ts b/tests/api-resources/api-gateway/schema-validation.test.ts similarity index 54% rename from tests/api-resources/zero-trust/access/logs/access-requests.test.ts rename to tests/api-resources/api-gateway/schema-validation.test.ts index 94214bddd9..fd0ea78112 100644 --- a/tests/api-resources/zero-trust/access/logs/access-requests.test.ts +++ b/tests/api-resources/api-gateway/schema-validation.test.ts @@ -9,11 +9,11 @@ const cloudflare = new Cloudflare({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); -describe('resource accessRequests', () => { - test('list', async () => { - const responsePromise = cloudflare.zeroTrust.access.logs.accessRequests.list( - '023e105f4ecef8ad9ca31a8372d0c353', - ); +describe('resource schemaValidation', () => { + test('edit: only required params', async () => { + const responsePromise = cloudflare.apiGateway.schemaValidation.edit({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -23,12 +23,11 @@ describe('resource accessRequests', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('list: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - cloudflare.zeroTrust.access.logs.accessRequests.list('023e105f4ecef8ad9ca31a8372d0c353', { - path: '/_stainless_unknown_path', - }), - ).rejects.toThrow(Cloudflare.NotFoundError); + test('edit: required and optional params', async () => { + const response = await cloudflare.apiGateway.schemaValidation.edit({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + validation_default_mitigation_action: 'block', + validation_override_mitigation_action: 'none', + }); }); }); diff --git a/tests/api-resources/api-gateway/schemas.test.ts b/tests/api-resources/api-gateway/schemas.test.ts new file mode 100644 index 0000000000..56d4e47af0 --- /dev/null +++ b/tests/api-resources/api-gateway/schemas.test.ts @@ -0,0 +1,33 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const cloudflare = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource schemas', () => { + test('list: only required params', async () => { + const responsePromise = cloudflare.apiGateway.schemas.list({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('list: required and optional params', async () => { + const response = await cloudflare.apiGateway.schemas.list({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + feature: ['thresholds'], + host: ['www.example.com'], + }); + }); +}); diff --git a/tests/api-resources/api-gateway/settings/schema-validation.test.ts b/tests/api-resources/api-gateway/settings/schema-validation.test.ts new file mode 100644 index 0000000000..c57bcf2868 --- /dev/null +++ b/tests/api-resources/api-gateway/settings/schema-validation.test.ts @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const cloudflare = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource schemaValidation', () => { + test('update: only required params', async () => { + const responsePromise = cloudflare.apiGateway.settings.schemaValidation.update({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + validation_default_mitigation_action: 'block', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('update: required and optional params', async () => { + const response = await cloudflare.apiGateway.settings.schemaValidation.update({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + validation_default_mitigation_action: 'block', + validation_override_mitigation_action: 'none', + }); + }); + + test('get: only required params', async () => { + const responsePromise = cloudflare.apiGateway.settings.schemaValidation.get({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await cloudflare.apiGateway.settings.schemaValidation.get({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + }); +}); diff --git a/tests/api-resources/zero-trust/access/users/failed-logins.test.ts b/tests/api-resources/api-gateway/user-schemas/operations.test.ts similarity index 54% rename from tests/api-resources/zero-trust/access/users/failed-logins.test.ts rename to tests/api-resources/api-gateway/user-schemas/operations.test.ts index ff222f220a..c0bd4403fb 100644 --- a/tests/api-resources/zero-trust/access/users/failed-logins.test.ts +++ b/tests/api-resources/api-gateway/user-schemas/operations.test.ts @@ -9,11 +9,11 @@ const cloudflare = new Cloudflare({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); -describe('resource failedLogins', () => { - test('list', async () => { - const responsePromise = cloudflare.zeroTrust.access.users.failedLogins.list( - '023e105f4ecef8ad9ca31a8372d0c353', +describe('resource operations', () => { + test('list: only required params', async () => { + const responsePromise = cloudflare.apiGateway.userSchemas.operations.list( 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -24,14 +24,19 @@ describe('resource failedLogins', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('list: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - cloudflare.zeroTrust.access.users.failedLogins.list( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Cloudflare.NotFoundError); + test('list: required and optional params', async () => { + const response = await cloudflare.apiGateway.userSchemas.operations.list( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + endpoint: '/api/v1', + feature: ['thresholds'], + host: ['api.cloudflare.com'], + method: ['GET'], + operation_status: 'new', + page: {}, + per_page: {}, + }, + ); }); }); diff --git a/tests/api-resources/api-gateway/user-schemas/user-schemas.test.ts b/tests/api-resources/api-gateway/user-schemas/user-schemas.test.ts new file mode 100644 index 0000000000..55f16e3dec --- /dev/null +++ b/tests/api-resources/api-gateway/user-schemas/user-schemas.test.ts @@ -0,0 +1,119 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare, { toFile } from 'cloudflare'; +import { Response } from 'node-fetch'; + +const cloudflare = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource userSchemas', () => { + test('create: only required params', async () => { + const responsePromise = cloudflare.apiGateway.userSchemas.create({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + file: await toFile(Buffer.from('# my file contents'), 'README.md'), + kind: 'openapi_v3', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('create: required and optional params', async () => { + const response = await cloudflare.apiGateway.userSchemas.create({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + file: await toFile(Buffer.from('# my file contents'), 'README.md'), + kind: 'openapi_v3', + name: 'petstore schema', + validation_enabled: 'true', + }); + }); + + test('list: only required params', async () => { + const responsePromise = cloudflare.apiGateway.userSchemas.list({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('list: required and optional params', async () => { + const response = await cloudflare.apiGateway.userSchemas.list({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + omit_source: true, + page: {}, + per_page: {}, + validation_enabled: true, + }); + }); + + test('delete: only required params', async () => { + const responsePromise = cloudflare.apiGateway.userSchemas.delete('f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('delete: required and optional params', async () => { + const response = await cloudflare.apiGateway.userSchemas.delete('f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + }); + + test('edit: only required params', async () => { + const responsePromise = cloudflare.apiGateway.userSchemas.edit('f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('edit: required and optional params', async () => { + const response = await cloudflare.apiGateway.userSchemas.edit('f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + validation_enabled: true, + }); + }); + + test('get: only required params', async () => { + const responsePromise = cloudflare.apiGateway.userSchemas.get('f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await cloudflare.apiGateway.userSchemas.get('f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + omit_source: true, + }); + }); +}); diff --git a/tests/api-resources/cache/cache.test.ts b/tests/api-resources/cache/cache.test.ts index df8a22b8c7..b99c19abde 100644 --- a/tests/api-resources/cache/cache.test.ts +++ b/tests/api-resources/cache/cache.test.ts @@ -22,6 +22,9 @@ describe('resource cache', () => { }); test('purge: required and optional params', async () => { - const response = await cloudflare.cache.purge({ zone_id: 'string', tags: ['some-tag', 'another-tag'] }); + const response = await cloudflare.cache.purge({ + zone_id: 'string', + tags: ['a-cache-tag', 'another-cache-tag'], + }); }); }); diff --git a/tests/api-resources/d1/database.test.ts b/tests/api-resources/d1/database.test.ts index c13216b1b2..4f36048f8a 100644 --- a/tests/api-resources/d1/database.test.ts +++ b/tests/api-resources/d1/database.test.ts @@ -110,4 +110,26 @@ describe('resource database', () => { params: ['firstParam', 'secondParam'], }); }); + + test('raw: only required params', async () => { + const responsePromise = cloudflare.d1.database.raw('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + sql: 'SELECT * FROM myTable WHERE field = ? OR field = ?;', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('raw: required and optional params', async () => { + const response = await cloudflare.d1.database.raw('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + sql: 'SELECT * FROM myTable WHERE field = ? OR field = ?;', + params: ['firstParam', 'secondParam'], + }); + }); }); diff --git a/tests/api-resources/kv/namespaces/namespaces.test.ts b/tests/api-resources/kv/namespaces/namespaces.test.ts index 4c16d9b42d..1816b3f4f1 100644 --- a/tests/api-resources/kv/namespaces/namespaces.test.ts +++ b/tests/api-resources/kv/namespaces/namespaces.test.ts @@ -91,4 +91,23 @@ describe('resource namespaces', () => { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); }); + + test('get: only required params', async () => { + const responsePromise = cloudflare.kv.namespaces.get('0f2ac74b498b48028cb68387c421e279', { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await cloudflare.kv.namespaces.get('0f2ac74b498b48028cb68387c421e279', { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + }); }); diff --git a/tests/api-resources/r2/buckets.test.ts b/tests/api-resources/r2/buckets.test.ts index 0dceadeb95..5ae4693ccd 100644 --- a/tests/api-resources/r2/buckets.test.ts +++ b/tests/api-resources/r2/buckets.test.ts @@ -29,6 +29,7 @@ describe('resource buckets', () => { account_id: '023e105f4ecef8ad9ca31a8372d0c353', name: 'example-bucket', locationHint: 'apac', + storageClass: 'Standard', }); }); diff --git a/tests/api-resources/zero-trust/access/users/last-seen-identity.test.ts b/tests/api-resources/radar/bgp/ips.test.ts similarity index 52% rename from tests/api-resources/zero-trust/access/users/last-seen-identity.test.ts rename to tests/api-resources/radar/bgp/ips.test.ts index 96b296c3d2..28dab69c29 100644 --- a/tests/api-resources/zero-trust/access/users/last-seen-identity.test.ts +++ b/tests/api-resources/radar/bgp/ips.test.ts @@ -9,12 +9,9 @@ const cloudflare = new Cloudflare({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); -describe('resource lastSeenIdentity', () => { - test('get', async () => { - const responsePromise = cloudflare.zeroTrust.access.users.lastSeenIdentity.get( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - ); +describe('resource ips', () => { + test('timeseries', async () => { + const responsePromise = cloudflare.radar.bgp.ips.timeseries(); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -24,12 +21,27 @@ describe('resource lastSeenIdentity', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('get: request options instead of params are passed correctly', async () => { + test('timeseries: request options instead of params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect(cloudflare.radar.bgp.ips.timeseries({ path: '/_stainless_unknown_path' })).rejects.toThrow( + Cloudflare.NotFoundError, + ); + }); + + test('timeseries: request options and params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( - cloudflare.zeroTrust.access.users.lastSeenIdentity.get( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + cloudflare.radar.bgp.ips.timeseries( + { + asn: '174,7922', + dateEnd: '2023-09-01T11:41:33.782Z', + dateRange: '7d', + dateStart: '2023-09-01T11:41:33.782Z', + format: 'JSON', + includeDelay: true, + location: 'US,CA', + name: ['string', 'string', 'string'], + }, { path: '/_stainless_unknown_path' }, ), ).rejects.toThrow(Cloudflare.NotFoundError); diff --git a/tests/api-resources/radar/bgp/routes.test.ts b/tests/api-resources/radar/bgp/routes.test.ts index ff1762a7ad..62aa761ca5 100644 --- a/tests/api-resources/radar/bgp/routes.test.ts +++ b/tests/api-resources/radar/bgp/routes.test.ts @@ -93,40 +93,4 @@ describe('resource routes', () => { ), ).rejects.toThrow(Cloudflare.NotFoundError); }); - - test('timeseries', async () => { - const responsePromise = cloudflare.radar.bgp.routes.timeseries(); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('timeseries: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - cloudflare.radar.bgp.routes.timeseries({ path: '/_stainless_unknown_path' }), - ).rejects.toThrow(Cloudflare.NotFoundError); - }); - - test('timeseries: request options and params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - cloudflare.radar.bgp.routes.timeseries( - { - asn: 174, - dateEnd: '2023-09-01T11:41:33.782Z', - dateRange: '7d', - dateStart: '2023-09-01T11:41:33.782Z', - format: 'JSON', - includeDelay: true, - location: 'US', - }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Cloudflare.NotFoundError); - }); }); diff --git a/tests/api-resources/zero-trust/access/applications/cas.test.ts b/tests/api-resources/zero-trust/access/applications/cas.test.ts index 553c9af20e..6167d7fed3 100644 --- a/tests/api-resources/zero-trust/access/applications/cas.test.ts +++ b/tests/api-resources/zero-trust/access/applications/cas.test.ts @@ -10,21 +10,6 @@ const cloudflare = new Cloudflare({ }); describe('resource cas', () => { - // TODO: investigate broken test - test.skip('create', async () => { - const responsePromise = cloudflare.zeroTrust.access.applications.cas.create( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { account_id: 'string' }, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - // TODO: investigate broken test test.skip('list', async () => { const responsePromise = cloudflare.zeroTrust.access.applications.cas.list({ account_id: 'string' }); @@ -36,34 +21,4 @@ describe('resource cas', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); - - // TODO: investigate broken test - test.skip('delete', async () => { - const responsePromise = cloudflare.zeroTrust.access.applications.cas.delete( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { account_id: 'string' }, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // TODO: investigate broken test - test.skip('get', async () => { - const responsePromise = cloudflare.zeroTrust.access.applications.cas.get( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { account_id: 'string' }, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); }); diff --git a/tests/api-resources/zero-trust/access/applications/policies.test.ts b/tests/api-resources/zero-trust/access/applications/policies.test.ts deleted file mode 100644 index a9e9830136..0000000000 --- a/tests/api-resources/zero-trust/access/applications/policies.test.ts +++ /dev/null @@ -1,199 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import Cloudflare from 'cloudflare'; -import { Response } from 'node-fetch'; - -const cloudflare = new Cloudflare({ - apiKey: '144c9defac04969c7bfad8efaa8ea194', - apiEmail: 'user@example.com', - baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', -}); - -describe('resource policies', () => { - // TODO: investigate broken test - test.skip('create: only required params', async () => { - const responsePromise = cloudflare.zeroTrust.access.applications.policies.create( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { - decision: 'allow', - include: [ - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - ], - name: 'Allow devs', - account_id: 'string', - }, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // TODO: investigate broken test - test.skip('create: required and optional params', async () => { - const response = await cloudflare.zeroTrust.access.applications.policies.create( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { - decision: 'allow', - include: [ - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - ], - name: 'Allow devs', - account_id: 'string', - approval_groups: [ - { - approvals_needed: 1, - email_addresses: ['test1@cloudflare.com', 'test2@cloudflare.com'], - email_list_uuid: 'string', - }, - { - approvals_needed: 3, - email_addresses: ['test@cloudflare.com', 'test2@cloudflare.com'], - email_list_uuid: '597147a1-976b-4ef2-9af0-81d5d007fc34', - }, - ], - approval_required: true, - exclude: [ - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - ], - isolation_required: false, - precedence: 0, - purpose_justification_prompt: 'Please enter a justification for entering this protected domain.', - purpose_justification_required: true, - require: [ - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - ], - session_duration: '24h', - }, - ); - }); - - // TODO: investigate broken test - test.skip('update: only required params', async () => { - const responsePromise = cloudflare.zeroTrust.access.applications.policies.update( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { - decision: 'allow', - include: [ - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - ], - name: 'Allow devs', - account_id: 'string', - }, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // TODO: investigate broken test - test.skip('update: required and optional params', async () => { - const response = await cloudflare.zeroTrust.access.applications.policies.update( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { - decision: 'allow', - include: [ - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - ], - name: 'Allow devs', - account_id: 'string', - approval_groups: [ - { - approvals_needed: 1, - email_addresses: ['test1@cloudflare.com', 'test2@cloudflare.com'], - email_list_uuid: 'string', - }, - { - approvals_needed: 3, - email_addresses: ['test@cloudflare.com', 'test2@cloudflare.com'], - email_list_uuid: '597147a1-976b-4ef2-9af0-81d5d007fc34', - }, - ], - approval_required: true, - exclude: [ - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - ], - isolation_required: false, - precedence: 0, - purpose_justification_prompt: 'Please enter a justification for entering this protected domain.', - purpose_justification_required: true, - require: [ - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - ], - session_duration: '24h', - }, - ); - }); - - // TODO: investigate broken test - test.skip('list', async () => { - const responsePromise = cloudflare.zeroTrust.access.applications.policies.list( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { account_id: 'string' }, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // TODO: investigate broken test - test.skip('delete', async () => { - const responsePromise = cloudflare.zeroTrust.access.applications.policies.delete( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { account_id: 'string' }, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // TODO: investigate broken test - test.skip('get', async () => { - const responsePromise = cloudflare.zeroTrust.access.applications.policies.get( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { account_id: 'string' }, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); -}); diff --git a/tests/api-resources/zero-trust/access/bookmarks.test.ts b/tests/api-resources/zero-trust/access/bookmarks.test.ts deleted file mode 100644 index b4e309c381..0000000000 --- a/tests/api-resources/zero-trust/access/bookmarks.test.ts +++ /dev/null @@ -1,128 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import Cloudflare from 'cloudflare'; -import { Response } from 'node-fetch'; - -const cloudflare = new Cloudflare({ - apiKey: '144c9defac04969c7bfad8efaa8ea194', - apiEmail: 'user@example.com', - baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', -}); - -describe('resource bookmarks', () => { - test('create: only required params', async () => { - const responsePromise = cloudflare.zeroTrust.access.bookmarks.create( - '699d98642c564d2e855e9661899b7252', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - {}, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('create: required and optional params', async () => { - const response = await cloudflare.zeroTrust.access.bookmarks.create( - '699d98642c564d2e855e9661899b7252', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - {}, - ); - }); - - test('update: only required params', async () => { - const responsePromise = cloudflare.zeroTrust.access.bookmarks.update( - '699d98642c564d2e855e9661899b7252', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - {}, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('update: required and optional params', async () => { - const response = await cloudflare.zeroTrust.access.bookmarks.update( - '699d98642c564d2e855e9661899b7252', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - {}, - ); - }); - - test('list', async () => { - const responsePromise = cloudflare.zeroTrust.access.bookmarks.list('699d98642c564d2e855e9661899b7252'); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('list: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - cloudflare.zeroTrust.access.bookmarks.list('699d98642c564d2e855e9661899b7252', { - path: '/_stainless_unknown_path', - }), - ).rejects.toThrow(Cloudflare.NotFoundError); - }); - - test('delete', async () => { - const responsePromise = cloudflare.zeroTrust.access.bookmarks.delete( - '699d98642c564d2e855e9661899b7252', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('delete: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - cloudflare.zeroTrust.access.bookmarks.delete( - '699d98642c564d2e855e9661899b7252', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Cloudflare.NotFoundError); - }); - - test('get', async () => { - const responsePromise = cloudflare.zeroTrust.access.bookmarks.get( - '699d98642c564d2e855e9661899b7252', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('get: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - cloudflare.zeroTrust.access.bookmarks.get( - '699d98642c564d2e855e9661899b7252', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Cloudflare.NotFoundError); - }); -}); diff --git a/tests/api-resources/zero-trust/access/certificates/certificates.test.ts b/tests/api-resources/zero-trust/access/certificates/certificates.test.ts index 1e779d2b5c..d07c9fa9f3 100644 --- a/tests/api-resources/zero-trust/access/certificates/certificates.test.ts +++ b/tests/api-resources/zero-trust/access/certificates/certificates.test.ts @@ -38,36 +38,6 @@ describe('resource certificates', () => { }); }); - // TODO: investigate broken test - test.skip('update: only required params', async () => { - const responsePromise = cloudflare.zeroTrust.access.certificates.update( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { - associated_hostnames: ['admin.example.com', 'admin.example.com', 'admin.example.com'], - account_id: 'string', - }, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // TODO: investigate broken test - test.skip('update: required and optional params', async () => { - const response = await cloudflare.zeroTrust.access.certificates.update( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { - associated_hostnames: ['admin.example.com', 'admin.example.com', 'admin.example.com'], - account_id: 'string', - name: 'Allow devs', - }, - ); - }); - // TODO: investigate broken test test.skip('list', async () => { const responsePromise = cloudflare.zeroTrust.access.certificates.list({ account_id: 'string' }); @@ -79,34 +49,4 @@ describe('resource certificates', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); - - // TODO: investigate broken test - test.skip('delete', async () => { - const responsePromise = cloudflare.zeroTrust.access.certificates.delete( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { account_id: 'string' }, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // TODO: investigate broken test - test.skip('get', async () => { - const responsePromise = cloudflare.zeroTrust.access.certificates.get( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { account_id: 'string' }, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); }); diff --git a/tests/api-resources/zero-trust/access/custom-pages.test.ts b/tests/api-resources/zero-trust/access/custom-pages.test.ts deleted file mode 100644 index 6c50153ce9..0000000000 --- a/tests/api-resources/zero-trust/access/custom-pages.test.ts +++ /dev/null @@ -1,144 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import Cloudflare from 'cloudflare'; -import { Response } from 'node-fetch'; - -const cloudflare = new Cloudflare({ - apiKey: '144c9defac04969c7bfad8efaa8ea194', - apiEmail: 'user@example.com', - baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', -}); - -describe('resource customPages', () => { - test('create: only required params', async () => { - const responsePromise = cloudflare.zeroTrust.access.customPages.create( - '023e105f4ecef8ad9ca31a8372d0c353', - { - custom_html: '

Access Denied

', - name: 'string', - type: 'identity_denied', - }, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('create: required and optional params', async () => { - const response = await cloudflare.zeroTrust.access.customPages.create( - '023e105f4ecef8ad9ca31a8372d0c353', - { - custom_html: '

Access Denied

', - name: 'string', - type: 'identity_denied', - app_count: 0, - }, - ); - }); - - test('update: only required params', async () => { - const responsePromise = cloudflare.zeroTrust.access.customPages.update( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { - custom_html: '

Access Denied

', - name: 'string', - type: 'identity_denied', - }, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('update: required and optional params', async () => { - const response = await cloudflare.zeroTrust.access.customPages.update( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { - custom_html: '

Access Denied

', - name: 'string', - type: 'identity_denied', - app_count: 0, - }, - ); - }); - - test('list', async () => { - const responsePromise = cloudflare.zeroTrust.access.customPages.list('023e105f4ecef8ad9ca31a8372d0c353'); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('list: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - cloudflare.zeroTrust.access.customPages.list('023e105f4ecef8ad9ca31a8372d0c353', { - path: '/_stainless_unknown_path', - }), - ).rejects.toThrow(Cloudflare.NotFoundError); - }); - - test('delete', async () => { - const responsePromise = cloudflare.zeroTrust.access.customPages.delete( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('delete: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - cloudflare.zeroTrust.access.customPages.delete( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Cloudflare.NotFoundError); - }); - - test('get', async () => { - const responsePromise = cloudflare.zeroTrust.access.customPages.get( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('get: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - cloudflare.zeroTrust.access.customPages.get( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Cloudflare.NotFoundError); - }); -}); diff --git a/tests/api-resources/zero-trust/access/groups.test.ts b/tests/api-resources/zero-trust/access/groups.test.ts index 3f26bfeba1..6e4de3e912 100644 --- a/tests/api-resources/zero-trust/access/groups.test.ts +++ b/tests/api-resources/zero-trust/access/groups.test.ts @@ -54,53 +54,6 @@ describe('resource groups', () => { }); }); - // TODO: investigate broken test - test.skip('update: only required params', async () => { - const responsePromise = cloudflare.zeroTrust.access.groups.update( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { - include: [ - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - ], - name: 'Allow devs', - account_id: 'string', - }, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // TODO: investigate broken test - test.skip('update: required and optional params', async () => { - const response = await cloudflare.zeroTrust.access.groups.update('f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { - include: [ - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - ], - name: 'Allow devs', - account_id: 'string', - exclude: [ - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - ], - is_default: true, - require: [ - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - { email: { email: 'test@example.com' } }, - ], - }); - }); - // TODO: investigate broken test test.skip('list', async () => { const responsePromise = cloudflare.zeroTrust.access.groups.list({ account_id: 'string' }); @@ -112,33 +65,4 @@ describe('resource groups', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); - - // TODO: investigate broken test - test.skip('delete', async () => { - const responsePromise = cloudflare.zeroTrust.access.groups.delete( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { account_id: 'string' }, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // TODO: investigate broken test - test.skip('get', async () => { - const responsePromise = cloudflare.zeroTrust.access.groups.get('f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { - account_id: 'string', - }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); }); diff --git a/tests/api-resources/zero-trust/access/keys.test.ts b/tests/api-resources/zero-trust/access/keys.test.ts deleted file mode 100644 index dacc709690..0000000000 --- a/tests/api-resources/zero-trust/access/keys.test.ts +++ /dev/null @@ -1,71 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import Cloudflare from 'cloudflare'; -import { Response } from 'node-fetch'; - -const cloudflare = new Cloudflare({ - apiKey: '144c9defac04969c7bfad8efaa8ea194', - apiEmail: 'user@example.com', - baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', -}); - -describe('resource keys', () => { - test('update: only required params', async () => { - const responsePromise = cloudflare.zeroTrust.access.keys.update('023e105f4ecef8ad9ca31a8372d0c353', { - key_rotation_interval_days: 30, - }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('update: required and optional params', async () => { - const response = await cloudflare.zeroTrust.access.keys.update('023e105f4ecef8ad9ca31a8372d0c353', { - key_rotation_interval_days: 30, - }); - }); - - test('get', async () => { - const responsePromise = cloudflare.zeroTrust.access.keys.get('023e105f4ecef8ad9ca31a8372d0c353'); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('get: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - cloudflare.zeroTrust.access.keys.get('023e105f4ecef8ad9ca31a8372d0c353', { - path: '/_stainless_unknown_path', - }), - ).rejects.toThrow(Cloudflare.NotFoundError); - }); - - test('rotate', async () => { - const responsePromise = cloudflare.zeroTrust.access.keys.rotate('023e105f4ecef8ad9ca31a8372d0c353'); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('rotate: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - cloudflare.zeroTrust.access.keys.rotate('023e105f4ecef8ad9ca31a8372d0c353', { - path: '/_stainless_unknown_path', - }), - ).rejects.toThrow(Cloudflare.NotFoundError); - }); -}); diff --git a/tests/api-resources/zero-trust/access/service-tokens.test.ts b/tests/api-resources/zero-trust/access/service-tokens.test.ts index cdaa6d5da8..deda8ffb7b 100644 --- a/tests/api-resources/zero-trust/access/service-tokens.test.ts +++ b/tests/api-resources/zero-trust/access/service-tokens.test.ts @@ -34,21 +34,6 @@ describe('resource serviceTokens', () => { }); }); - // TODO: investigate broken test - test.skip('update', async () => { - const responsePromise = cloudflare.zeroTrust.access.serviceTokens.update( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { account_id: 'string' }, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - // TODO: investigate broken test test.skip('list', async () => { const responsePromise = cloudflare.zeroTrust.access.serviceTokens.list({ account_id: 'string' }); @@ -60,84 +45,4 @@ describe('resource serviceTokens', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); - - // TODO: investigate broken test - test.skip('delete', async () => { - const responsePromise = cloudflare.zeroTrust.access.serviceTokens.delete( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { account_id: 'string' }, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // TODO: investigate broken test - test.skip('get', async () => { - const responsePromise = cloudflare.zeroTrust.access.serviceTokens.get( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { account_id: 'string' }, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('refresh', async () => { - const responsePromise = cloudflare.zeroTrust.access.serviceTokens.refresh( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('refresh: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - cloudflare.zeroTrust.access.serviceTokens.refresh( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Cloudflare.NotFoundError); - }); - - test('rotate', async () => { - const responsePromise = cloudflare.zeroTrust.access.serviceTokens.rotate( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('rotate: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - cloudflare.zeroTrust.access.serviceTokens.rotate( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Cloudflare.NotFoundError); - }); }); diff --git a/tests/api-resources/zero-trust/access/tags.test.ts b/tests/api-resources/zero-trust/access/tags.test.ts deleted file mode 100644 index 39200eb27b..0000000000 --- a/tests/api-resources/zero-trust/access/tags.test.ts +++ /dev/null @@ -1,120 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import Cloudflare from 'cloudflare'; -import { Response } from 'node-fetch'; - -const cloudflare = new Cloudflare({ - apiKey: '144c9defac04969c7bfad8efaa8ea194', - apiEmail: 'user@example.com', - baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', -}); - -describe('resource tags', () => { - test('create: only required params', async () => { - const responsePromise = cloudflare.zeroTrust.access.tags.create('023e105f4ecef8ad9ca31a8372d0c353', { - name: 'engineers', - }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('create: required and optional params', async () => { - const response = await cloudflare.zeroTrust.access.tags.create('023e105f4ecef8ad9ca31a8372d0c353', { - name: 'engineers', - }); - }); - - test('update: only required params', async () => { - const responsePromise = cloudflare.zeroTrust.access.tags.update( - '023e105f4ecef8ad9ca31a8372d0c353', - 'engineers', - { name: 'engineers' }, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('update: required and optional params', async () => { - const response = await cloudflare.zeroTrust.access.tags.update( - '023e105f4ecef8ad9ca31a8372d0c353', - 'engineers', - { name: 'engineers' }, - ); - }); - - test('list', async () => { - const responsePromise = cloudflare.zeroTrust.access.tags.list('023e105f4ecef8ad9ca31a8372d0c353'); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('list: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - cloudflare.zeroTrust.access.tags.list('023e105f4ecef8ad9ca31a8372d0c353', { - path: '/_stainless_unknown_path', - }), - ).rejects.toThrow(Cloudflare.NotFoundError); - }); - - test('delete', async () => { - const responsePromise = cloudflare.zeroTrust.access.tags.delete( - '023e105f4ecef8ad9ca31a8372d0c353', - 'engineers', - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('delete: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - cloudflare.zeroTrust.access.tags.delete('023e105f4ecef8ad9ca31a8372d0c353', 'engineers', { - path: '/_stainless_unknown_path', - }), - ).rejects.toThrow(Cloudflare.NotFoundError); - }); - - test('get', async () => { - const responsePromise = cloudflare.zeroTrust.access.tags.get( - '023e105f4ecef8ad9ca31a8372d0c353', - 'engineers', - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('get: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - cloudflare.zeroTrust.access.tags.get('023e105f4ecef8ad9ca31a8372d0c353', 'engineers', { - path: '/_stainless_unknown_path', - }), - ).rejects.toThrow(Cloudflare.NotFoundError); - }); -}); diff --git a/tests/api-resources/zero-trust/access/users/active-sessions.test.ts b/tests/api-resources/zero-trust/access/users/active-sessions.test.ts deleted file mode 100644 index a26699661a..0000000000 --- a/tests/api-resources/zero-trust/access/users/active-sessions.test.ts +++ /dev/null @@ -1,64 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import Cloudflare from 'cloudflare'; -import { Response } from 'node-fetch'; - -const cloudflare = new Cloudflare({ - apiKey: '144c9defac04969c7bfad8efaa8ea194', - apiEmail: 'user@example.com', - baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', -}); - -describe('resource activeSessions', () => { - test('list', async () => { - const responsePromise = cloudflare.zeroTrust.access.users.activeSessions.list( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('list: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - cloudflare.zeroTrust.access.users.activeSessions.list( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Cloudflare.NotFoundError); - }); - - test('get', async () => { - const responsePromise = cloudflare.zeroTrust.access.users.activeSessions.get( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - 'X1aXj1lFVcqqyoXF', - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('get: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - cloudflare.zeroTrust.access.users.activeSessions.get( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - 'X1aXj1lFVcqqyoXF', - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Cloudflare.NotFoundError); - }); -}); diff --git a/tests/api-resources/zero-trust/identity-providers.test.ts b/tests/api-resources/zero-trust/identity-providers.test.ts index e33eac6b01..09f40970c2 100644 --- a/tests/api-resources/zero-trust/identity-providers.test.ts +++ b/tests/api-resources/zero-trust/identity-providers.test.ts @@ -53,50 +53,6 @@ describe('resource identityProviders', () => { }); }); - // TODO: investigate broken test - test.skip('update: only required params', async () => { - const responsePromise = cloudflare.zeroTrust.identityProviders.update( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { config: {}, name: 'Widget Corps IDP', type: 'onetimepin', account_id: 'string' }, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // TODO: investigate broken test - test.skip('update: required and optional params', async () => { - const response = await cloudflare.zeroTrust.identityProviders.update( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { - config: { - client_id: '', - client_secret: '', - claims: ['email_verified', 'preferred_username', 'custom_claim_name'], - email_claim_name: 'custom_claim_name', - conditional_access_enabled: true, - directory_id: '', - prompt: 'login', - support_groups: true, - }, - name: 'Widget Corps IDP', - type: 'onetimepin', - account_id: 'string', - scim_config: { - enabled: true, - group_member_deprovision: true, - seat_deprovision: true, - secret: 'string', - user_deprovision: true, - }, - }, - ); - }); - // TODO: investigate broken test test.skip('list', async () => { const responsePromise = cloudflare.zeroTrust.identityProviders.list({ account_id: 'string' }); @@ -108,34 +64,4 @@ describe('resource identityProviders', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); - - // TODO: investigate broken test - test.skip('delete', async () => { - const responsePromise = cloudflare.zeroTrust.identityProviders.delete( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { account_id: 'string' }, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // TODO: investigate broken test - test.skip('get', async () => { - const responsePromise = cloudflare.zeroTrust.identityProviders.get( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { account_id: 'string' }, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); }); diff --git a/tests/api-resources/zero-trust/seats.test.ts b/tests/api-resources/zero-trust/seats.test.ts deleted file mode 100644 index 47854f8f99..0000000000 --- a/tests/api-resources/zero-trust/seats.test.ts +++ /dev/null @@ -1,37 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import Cloudflare from 'cloudflare'; -import { Response } from 'node-fetch'; - -const cloudflare = new Cloudflare({ - apiKey: '144c9defac04969c7bfad8efaa8ea194', - apiEmail: 'user@example.com', - baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', -}); - -describe('resource seats', () => { - // TODO: investigate broken test - test.skip('edit: only required params', async () => { - const responsePromise = cloudflare.zeroTrust.seats.edit('023e105f4ecef8ad9ca31a8372d0c353', [ - { access_seat: false, gateway_seat: false }, - { access_seat: false, gateway_seat: false }, - { access_seat: false, gateway_seat: false }, - ]); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - // TODO: investigate broken test - test.skip('edit: required and optional params', async () => { - const response = await cloudflare.zeroTrust.seats.edit('023e105f4ecef8ad9ca31a8372d0c353', [ - { access_seat: false, gateway_seat: false }, - { access_seat: false, gateway_seat: false }, - { access_seat: false, gateway_seat: false }, - ]); - }); -});