Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/management/__generated/managers/network-acls-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import type { InitOverride, ApiResponse } from '../../../lib/runtime.js';
import type {
GetNetworkAcls200Response,
GetNetworkAclsById200Response,
PatchNetworkAclsById200Response,
PatchNetworkAclsByIdRequest,
PutNetworkAclsByIdRequest,
GetNetworkAcls200ResponseOneOf,
DeleteNetworkAclsByIdRequest,
GetNetworkAclsRequest,
GetNetworkAclsByIdRequest,
PatchNetworkAclsByIdOperationRequest,
PutNetworkAclsByIdOperationRequest,
} from '../models/index.js';

Expand Down Expand Up @@ -114,6 +117,39 @@ export class NetworkAclsManager extends BaseAPI {
return runtime.JSONApiResponse.fromResponse(response);
}

/**
* Update existing access control list for your client.
* Partial Update for an Access Control List
*
* @throws {RequiredError}
*/
async patch(
requestParameters: PatchNetworkAclsByIdOperationRequest,
bodyParameters: PatchNetworkAclsByIdRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<PatchNetworkAclsById200Response>> {
runtime.validateRequiredRequestParams(requestParameters, ['id']);

const headerParameters: runtime.HTTPHeaders = {};

headerParameters['Content-Type'] = 'application/json';

const response = await this.request(
{
path: `/network-acls/{id}`.replace(
'{id}',
encodeURIComponent(String(requestParameters.id))
),
method: 'PATCH',
headers: headerParameters,
body: bodyParameters,
},
initOverrides
);

return runtime.JSONApiResponse.fromResponse(response);
}

/**
* Create a new access control list for your client.
* Create Access Control List
Expand Down
174 changes: 174 additions & 0 deletions src/management/__generated/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5734,7 +5734,7 @@
/**
*
*/
export interface GetConnectionsKeysResponseContent

Check warning on line 5737 in src/management/__generated/models/index.ts

View workflow job for this annotation

GitHub Actions / Build and Test (18.17)

An interface declaring no members is equivalent to its supertype

Check warning on line 5737 in src/management/__generated/models/index.ts

View workflow job for this annotation

GitHub Actions / Build and Test (20.3)

An interface declaring no members is equivalent to its supertype
extends Array<GetConnectionsKeysResponseContentInner> {}
/**
*
Expand Down Expand Up @@ -10510,6 +10510,170 @@
export type PatchLogStreamsByIdRequestSinkOneOf3MixpanelRegionEnum =
(typeof PatchLogStreamsByIdRequestSinkOneOf3MixpanelRegionEnum)[keyof typeof PatchLogStreamsByIdRequestSinkOneOf3MixpanelRegionEnum];

/**
*
*/
export interface PatchNetworkAclsById200Response {
[key: string]: any | any;
/**
*/
id?: string;
/**
*/
description?: string;
/**
*/
active?: boolean;
/**
*/
priority?: number;
/**
*/
rule?: PatchNetworkAclsByIdRequestRule;
/**
* The timestamp when the Network ACL Configuration was created
*
*/
created_at?: string;
/**
* The timestamp when the Network ACL Configuration was last updated
*
*/
updated_at?: string;
}
/**
*
*/
export interface PatchNetworkAclsByIdRequest {
/**
*/
description?: string;
/**
* Indicates whether or not this access control list is actively being used
*
*/
active?: boolean;
/**
* Indicates the order in which the ACL will be evaluated relative to other ACL rules.
*
*/
priority?: number;
/**
*/
rule?: PatchNetworkAclsByIdRequestRule;
}
/**
*
*/
export interface PatchNetworkAclsByIdRequestRule {
/**
*/
action: PatchNetworkAclsByIdRequestRuleAction;
/**
*/
match?: PatchNetworkAclsByIdRequestRuleMatch;
/**
*/
not_match?: PatchNetworkAclsByIdRequestRuleMatch;
/**
* Identifies the origin of the request as the Management API (management), Authentication API (authentication), or either (tenant)
*
*/
scope: PatchNetworkAclsByIdRequestRuleScopeEnum;
}

export const PatchNetworkAclsByIdRequestRuleScopeEnum = {
management: 'management',
authentication: 'authentication',
tenant: 'tenant',
} as const;
export type PatchNetworkAclsByIdRequestRuleScopeEnum =
(typeof PatchNetworkAclsByIdRequestRuleScopeEnum)[keyof typeof PatchNetworkAclsByIdRequestRuleScopeEnum];

/**
*
*/
export interface PatchNetworkAclsByIdRequestRuleAction {
/**
* Indicates the rule will block requests that either match or not_match specific criteria
*
*/
block?: PatchNetworkAclsByIdRequestRuleActionBlockEnum;
/**
* Indicates the rule will allow requests that either match or not_match specific criteria
*
*/
allow?: PatchNetworkAclsByIdRequestRuleActionAllowEnum;
/**
* Indicates the rule will log requests that either match or not_match specific criteria
*
*/
log?: PatchNetworkAclsByIdRequestRuleActionLogEnum;
/**
* Indicates the rule will redirect requests that either match or not_match specific criteria
*
*/
redirect?: PatchNetworkAclsByIdRequestRuleActionRedirectEnum;
/**
* The URI to which the match or not_match requests will be routed
*
*/
redirect_uri?: string;
}

export const PatchNetworkAclsByIdRequestRuleActionBlockEnum = {
true: true,
} as const;
export type PatchNetworkAclsByIdRequestRuleActionBlockEnum =
(typeof PatchNetworkAclsByIdRequestRuleActionBlockEnum)[keyof typeof PatchNetworkAclsByIdRequestRuleActionBlockEnum];

export const PatchNetworkAclsByIdRequestRuleActionAllowEnum = {
true: true,
} as const;
export type PatchNetworkAclsByIdRequestRuleActionAllowEnum =
(typeof PatchNetworkAclsByIdRequestRuleActionAllowEnum)[keyof typeof PatchNetworkAclsByIdRequestRuleActionAllowEnum];

export const PatchNetworkAclsByIdRequestRuleActionLogEnum = {
true: true,
} as const;
export type PatchNetworkAclsByIdRequestRuleActionLogEnum =
(typeof PatchNetworkAclsByIdRequestRuleActionLogEnum)[keyof typeof PatchNetworkAclsByIdRequestRuleActionLogEnum];

export const PatchNetworkAclsByIdRequestRuleActionRedirectEnum = {
true: true,
} as const;
export type PatchNetworkAclsByIdRequestRuleActionRedirectEnum =
(typeof PatchNetworkAclsByIdRequestRuleActionRedirectEnum)[keyof typeof PatchNetworkAclsByIdRequestRuleActionRedirectEnum];

/**
*
*/
export interface PatchNetworkAclsByIdRequestRuleMatch {
/**
*/
asns?: Array<number>;
/**
*/
geo_country_codes?: Array<string>;
/**
*/
geo_subdivision_codes?: Array<string>;
/**
*/
ipv4_cidrs?: Array<GetNetworkAclsById200ResponseRuleAnyOfMatchIpv4CidrsInner>;
/**
*/
ipv6_cidrs?: Array<GetNetworkAclsById200ResponseRuleAnyOfMatchIpv6CidrsInner>;
/**
*/
ja3_fingerprints?: Array<string>;
/**
*/
ja4_fingerprints?: Array<string>;
/**
*/
user_agents?: Array<string>;
}
/**
*
*/
Expand Down Expand Up @@ -13513,7 +13677,7 @@
/**
*
*/
export interface PostFormsRequestNodesInnerAnyOf2ConfigComponentsInnerAnyOf2AnyOf13Config {}

Check warning on line 13680 in src/management/__generated/models/index.ts

View workflow job for this annotation

GitHub Actions / Build and Test (18.17)

An empty interface is equivalent to `{}`

Check warning on line 13680 in src/management/__generated/models/index.ts

View workflow job for this annotation

GitHub Actions / Build and Test (20.3)

An empty interface is equivalent to `{}`
/**
*
*/
Expand Down Expand Up @@ -20510,6 +20674,16 @@
*/
id: string;
}
/**
*
*/
export interface PatchNetworkAclsByIdOperationRequest {
/**
* The id of the ACL to update.
*
*/
id: string;
}
/**
*
*/
Expand Down
57 changes: 57 additions & 0 deletions test/management/network-acls.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
NetworkAclsManager,
ManagementClient,
PutNetworkAclsByIdRequest,
PatchNetworkAclsByIdRequest,
} from '../../src/index.js';

const API_URL = 'https://tenant.auth0.com/api/v2';
Expand Down Expand Up @@ -248,4 +249,60 @@ describe('NetworkAclsManager', () => {
});
});
});

describe('#patch', () => {
const data = { id: 'acl_123' };

const body: PatchNetworkAclsByIdRequest = {
description: 'Patch ACL',
active: true,
rule: {
action: {
block: true,
},
scope: 'tenant',
},
};

beforeEach(() => {
request = nock(API_URL).patch(`/network-acls/${data.id}`).reply(200, body);
});

it('should return a promise if no callback is given', (done) => {
networkAcls
.patch(data, body as any)
.then(done.bind(null, null))
.catch(done.bind(null, null));
});

it('should pass any errors to the promise catch handler', (done) => {
nock.cleanAll();

nock(API_URL).patch(`/network-acls/${data.id}`).reply(500, {});

networkAcls.patch(data, body).catch((err) => {
expect(err).toBeDefined();
done();
});
});

it('should perform a PATCH request to /api/v2/network-acls/:id', (done) => {
networkAcls.patch(data, body as any).then(() => {
expect(request.isDone()).toBe(true);
done();
});
});
it('should pass the data in the body of the request', (done) => {
nock.cleanAll();

const request = nock(API_URL)
.patch(`/network-acls/${data.id}`, body as any)
.reply(200, body);

networkAcls.patch(data, body).then(() => {
expect(request.isDone()).toBe(true);
done();
});
});
});
});
Loading