File tree Expand file tree Collapse file tree
src/resources/magic-network-monitoring
tests/api-resources/magic-network-monitoring/vpc-flows Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- configured_endpoints : 1547
1+ configured_endpoints : 1548
22openapi_spec_url : https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-cc9be7885f16989f56e5e015644178eb17b82304fc31f62ed14b7e9a93cab891.yml
Original file line number Diff line number Diff line change @@ -3447,6 +3447,18 @@ Methods:
34473447
34483448# MagicNetworkMonitoring
34493449
3450+ ## VpcFlows
3451+
3452+ ### Tokens
3453+
3454+ Types:
3455+
3456+ - <code ><a href =" ./src/resources/magic-network-monitoring/vpc-flows/tokens.ts " >TokenCreateResponse</a ></code >
3457+
3458+ Methods:
3459+
3460+ - <code title =" post /accounts/{account_id}/mnm/vpc-flows/token " >client.magicNetworkMonitoring.vpcFlows.tokens.<a href =" ./src/resources/magic-network-monitoring/vpc-flows/tokens.ts " >create</a >({ ...params }) -> TokenCreateResponse</code >
3461+
34503462## Configs
34513463
34523464Types:
Original file line number Diff line number Diff line change @@ -21,3 +21,4 @@ export {
2121 type RuleEditParams ,
2222 type RuleGetParams ,
2323} from './rules/index' ;
24+ export { VpcFlows } from './vpc-flows/index' ;
Original file line number Diff line number Diff line change @@ -23,17 +23,23 @@ import {
2323 RuleUpdateParams ,
2424 Rules ,
2525} from './rules/rules' ;
26+ import * as VpcFlowsAPI from './vpc-flows/vpc-flows' ;
27+ import { VpcFlows } from './vpc-flows/vpc-flows' ;
2628
2729export class MagicNetworkMonitoring extends APIResource {
30+ vpcFlows : VpcFlowsAPI . VpcFlows = new VpcFlowsAPI . VpcFlows ( this . _client ) ;
2831 configs : ConfigsAPI . Configs = new ConfigsAPI . Configs ( this . _client ) ;
2932 rules : RulesAPI . Rules = new RulesAPI . Rules ( this . _client ) ;
3033}
3134
35+ MagicNetworkMonitoring . VpcFlows = VpcFlows ;
3236MagicNetworkMonitoring . Configs = Configs ;
3337MagicNetworkMonitoring . Rules = Rules ;
3438MagicNetworkMonitoring . MagicNetworkMonitoringRulesSinglePage = MagicNetworkMonitoringRulesSinglePage ;
3539
3640export declare namespace MagicNetworkMonitoring {
41+ export { VpcFlows as VpcFlows } ;
42+
3743 export {
3844 Configs as Configs ,
3945 type Configuration as Configuration ,
Original file line number Diff line number Diff line change 1+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+ export { Tokens , type TokenCreateResponse , type TokenCreateParams } from './tokens' ;
4+ export { VpcFlows } from './vpc-flows' ;
Original file line number Diff line number Diff line change 1+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+ import { APIResource } from '../../../resource' ;
4+ import * as Core from '../../../core' ;
5+
6+ export class Tokens extends APIResource {
7+ /**
8+ * Generate authentication token for VPC flow logs export.
9+ */
10+ create ( params : TokenCreateParams , options ?: Core . RequestOptions ) : Core . APIPromise < TokenCreateResponse > {
11+ const { account_id } = params ;
12+ return (
13+ this . _client . post ( `/accounts/${ account_id } /mnm/vpc-flows/token` , options ) as Core . APIPromise < {
14+ result : TokenCreateResponse ;
15+ } >
16+ ) . _thenUnwrap ( ( obj ) => obj . result ) ;
17+ }
18+ }
19+
20+ /**
21+ * Authentication token to be used for VPC Flows export authentication.
22+ */
23+ export type TokenCreateResponse = string ;
24+
25+ export interface TokenCreateParams {
26+ account_id : string ;
27+ }
28+
29+ export declare namespace Tokens {
30+ export { type TokenCreateResponse as TokenCreateResponse , type TokenCreateParams as TokenCreateParams } ;
31+ }
Original file line number Diff line number Diff line change 1+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+ import { APIResource } from '../../../resource' ;
4+ import * as TokensAPI from './tokens' ;
5+ import { TokenCreateParams , TokenCreateResponse , Tokens } from './tokens' ;
6+
7+ export class VpcFlows extends APIResource {
8+ tokens : TokensAPI . Tokens = new TokensAPI . Tokens ( this . _client ) ;
9+ }
10+
11+ VpcFlows . Tokens = Tokens ;
12+
13+ export declare namespace VpcFlows {
14+ export {
15+ Tokens as Tokens ,
16+ type TokenCreateResponse as TokenCreateResponse ,
17+ type TokenCreateParams as TokenCreateParams ,
18+ } ;
19+ }
Original file line number Diff line number Diff line change 1+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+ import Cloudflare from 'cloudflare' ;
4+ import { Response } from 'node-fetch' ;
5+
6+ const client = new Cloudflare ( {
7+ apiKey : '144c9defac04969c7bfad8efaa8ea194' ,
8+ apiEmail : 'user@example.com' ,
9+ baseURL : process . env [ 'TEST_API_BASE_URL' ] ?? 'http://127.0.0.1:4010' ,
10+ } ) ;
11+
12+ describe ( 'resource tokens' , ( ) => {
13+ test ( 'create: only required params' , async ( ) => {
14+ const responsePromise = client . magicNetworkMonitoring . vpcFlows . tokens . create ( {
15+ account_id : '6f91088a406011ed95aed352566e8d4c' ,
16+ } ) ;
17+ const rawResponse = await responsePromise . asResponse ( ) ;
18+ expect ( rawResponse ) . toBeInstanceOf ( Response ) ;
19+ const response = await responsePromise ;
20+ expect ( response ) . not . toBeInstanceOf ( Response ) ;
21+ const dataAndResponse = await responsePromise . withResponse ( ) ;
22+ expect ( dataAndResponse . data ) . toBe ( response ) ;
23+ expect ( dataAndResponse . response ) . toBe ( rawResponse ) ;
24+ } ) ;
25+
26+ test ( 'create: required and optional params' , async ( ) => {
27+ const response = await client . magicNetworkMonitoring . vpcFlows . tokens . create ( {
28+ account_id : '6f91088a406011ed95aed352566e8d4c' ,
29+ } ) ;
30+ } ) ;
31+ } ) ;
You can’t perform that action at this time.
0 commit comments