Skip to main content

Class: TopicsClient

Defined in: src/management/topics.ts:25

Client for AIRS custom topic CRUD operations.

Constructors

Constructor

new TopicsClient(opts): TopicsClient;

Defined in: src/management/topics.ts:31

Parameters

ParameterType
optsTopicsClientOptions

Returns

TopicsClient

Methods

create()

create(body): Promise<objectOutputType<{
topic_id: ZodOptional<ZodString>;
topic_name: ZodString;
revision: ZodNumber;
active: ZodOptional<ZodBoolean>;
description: ZodString;
examples: ZodArray<ZodString, "many">;
created_by: ZodOptional<ZodString>;
updated_by: ZodOptional<ZodString>;
last_modified_ts: ZodOptional<ZodString>;
created_ts: ZodOptional<ZodString>;
}, ZodTypeAny, "passthrough">>;

Defined in: src/management/topics.ts:58

Create a new custom topic.

Parameters

ParameterTypeDescription
bodyobjectOutputTypeTopic definition with name, description, and examples.

Returns

Promise<objectOutputType<{ topic_id: ZodOptional<ZodString>; topic_name: ZodString; revision: ZodNumber; active: ZodOptional<ZodBoolean>; description: ZodString; examples: ZodArray<ZodString, "many">; created_by: ZodOptional<ZodString>; updated_by: ZodOptional<ZodString>; last_modified_ts: ZodOptional<ZodString>; created_ts: ZodOptional<ZodString>; }, ZodTypeAny, "passthrough">>

The created custom topic.

Example

import { ManagementClient } from '@cdot65/prisma-airs-sdk';
const mgmt = new ManagementClient(); // reads PANW_MGMT_* env vars

const topic = await mgmt.topics.create({
topic_name: 'credit-card-numbers',
active: true,
description: 'Detects credit card numbers in prompts and responses',
examples: ['4111-1111-1111-1111', '5500 0000 0000 0004'],
});
// topic =>
// { topic_id: '550e8400-...', topic_name: 'credit-card-numbers',
// revision: 1, active: true, examples: ['4111-1111-1111-1111', ...] }

list()

list(opts?): Promise<objectOutputType<{
custom_topics: ZodArray<ZodObject<{
topic_id: ZodOptional<ZodString>;
topic_name: ZodString;
revision: ZodNumber;
active: ZodOptional<ZodBoolean>;
description: ZodString;
examples: ZodArray<ZodString, "many">;
created_by: ZodOptional<ZodString>;
updated_by: ZodOptional<ZodString>;
last_modified_ts: ZodOptional<ZodString>;
created_ts: ZodOptional<ZodString>;
}, "passthrough", ZodTypeAny, objectOutputType<{
topic_id: ZodOptional<ZodString>;
topic_name: ZodString;
revision: ZodNumber;
active: ZodOptional<ZodBoolean>;
description: ZodString;
examples: ZodArray<ZodString, "many">;
created_by: ZodOptional<ZodString>;
updated_by: ZodOptional<ZodString>;
last_modified_ts: ZodOptional<ZodString>;
created_ts: ZodOptional<ZodString>;
}, ZodTypeAny, "passthrough">, objectInputType<{
topic_id: ZodOptional<ZodString>;
topic_name: ZodString;
revision: ZodNumber;
active: ZodOptional<ZodBoolean>;
description: ZodString;
examples: ZodArray<ZodString, "many">;
created_by: ZodOptional<ZodString>;
updated_by: ZodOptional<ZodString>;
last_modified_ts: ZodOptional<ZodString>;
created_ts: ZodOptional<ZodString>;
}, ZodTypeAny, "passthrough">>, "many">;
next_offset: ZodOptional<ZodNumber>;
}, ZodTypeAny, "passthrough">>;

Defined in: src/management/topics.ts:85

List custom topics for the TSG.

Parameters

ParameterTypeDescription
opts?PaginationOptionsPagination options.

Returns

Promise<objectOutputType<{ custom_topics: ZodArray<ZodObject<{ topic_id: ZodOptional<ZodString>; topic_name: ZodString; revision: ZodNumber; active: ZodOptional<ZodBoolean>; description: ZodString; examples: ZodArray<ZodString, "many">; created_by: ZodOptional<ZodString>; updated_by: ZodOptional<ZodString>; last_modified_ts: ZodOptional<ZodString>; created_ts: ZodOptional<ZodString>; }, "passthrough", ZodTypeAny, objectOutputType<{ topic_id: ZodOptional<ZodString>; topic_name: ZodString; revision: ZodNumber; active: ZodOptional<ZodBoolean>; description: ZodString; examples: ZodArray<ZodString, "many">; created_by: ZodOptional<ZodString>; updated_by: ZodOptional<ZodString>; last_modified_ts: ZodOptional<ZodString>; created_ts: ZodOptional<ZodString>; }, ZodTypeAny, "passthrough">, objectInputType<{ topic_id: ZodOptional<ZodString>; topic_name: ZodString; revision: ZodNumber; active: ZodOptional<ZodBoolean>; description: ZodString; examples: ZodArray<ZodString, "many">; created_by: ZodOptional<ZodString>; updated_by: ZodOptional<ZodString>; last_modified_ts: ZodOptional<ZodString>; created_ts: ZodOptional<ZodString>; }, ZodTypeAny, "passthrough">>, "many">; next_offset: ZodOptional<ZodNumber>; }, ZodTypeAny, "passthrough">>

Paginated list of custom topics.

Example

import { ManagementClient } from '@cdot65/prisma-airs-sdk';
const mgmt = new ManagementClient(); // reads PANW_MGMT_* env vars

const page = await mgmt.topics.list({ offset: 0, limit: 5 });
// page =>
// { custom_topics: [ { topic_id: '550e8400-...', topic_name: 'credit-cards',
// revision: 1, active: true } ], next_offset: 20 }

update()

update(topicId, body): Promise<objectOutputType<{
topic_id: ZodOptional<ZodString>;
topic_name: ZodString;
revision: ZodNumber;
active: ZodOptional<ZodBoolean>;
description: ZodString;
examples: ZodArray<ZodString, "many">;
created_by: ZodOptional<ZodString>;
updated_by: ZodOptional<ZodString>;
last_modified_ts: ZodOptional<ZodString>;
created_ts: ZodOptional<ZodString>;
}, ZodTypeAny, "passthrough">>;

Defined in: src/management/topics.ts:121

Update an existing custom topic.

Parameters

ParameterTypeDescription
topicIdstringUUID of the topic to update.
bodyobjectOutputTypeUpdated topic definition.

Returns

Promise<objectOutputType<{ topic_id: ZodOptional<ZodString>; topic_name: ZodString; revision: ZodNumber; active: ZodOptional<ZodBoolean>; description: ZodString; examples: ZodArray<ZodString, "many">; created_by: ZodOptional<ZodString>; updated_by: ZodOptional<ZodString>; last_modified_ts: ZodOptional<ZodString>; created_ts: ZodOptional<ZodString>; }, ZodTypeAny, "passthrough">>

The updated custom topic.

Example

import { ManagementClient } from '@cdot65/prisma-airs-sdk';
const mgmt = new ManagementClient(); // reads PANW_MGMT_* env vars

const updated = await mgmt.topics.update('550e8400-e29b-41d4-a716-446655440000', {
topic_name: 'credit-card-numbers',
description: 'Updated: detects credit card numbers and CVVs',
examples: ['4111-1111-1111-1111', 'CVV: 123'],
});
// updated =>
// { topic_id: '550e8400-...', topic_name: 'credit-card-numbers', revision: 2, active: true }

delete()

delete(topicId): Promise<
| {
message: string;
}
| objectOutputType<{
message: ZodString;
}, ZodTypeAny, "passthrough">>;

Defined in: src/management/topics.ts:147

Delete a custom topic. Fails if topic is referenced by a profile.

Parameters

ParameterTypeDescription
topicIdstringUUID of the topic to delete.

Returns

Promise< | { message: string; } | objectOutputType<{ message: ZodString; }, ZodTypeAny, "passthrough">>

Deletion confirmation message.

Example

import { ManagementClient } from '@cdot65/prisma-airs-sdk';
const mgmt = new ManagementClient(); // reads PANW_MGMT_* env vars

const result = await mgmt.topics.delete('550e8400-e29b-41d4-a716-446655440000');
// result => { message: 'deleted' }

forceDelete()

forceDelete(topicId, updatedBy?): Promise<
| {
message: string;
}
| objectOutputType<{
message: ZodString;
}, ZodTypeAny, "passthrough">>;

Defined in: src/management/topics.ts:176

Force-delete a custom topic, removing it from any referencing profiles.

Parameters

ParameterTypeDescription
topicIdstringUUID of the topic to force-delete.
updatedBy?stringOptional. Email of the user performing the deletion.

Returns

Promise< | { message: string; } | objectOutputType<{ message: ZodString; }, ZodTypeAny, "passthrough">>

Deletion confirmation message.

Example

import { ManagementClient } from '@cdot65/prisma-airs-sdk';
const mgmt = new ManagementClient(); // reads PANW_MGMT_* env vars

const result = await mgmt.topics.forceDelete(
'550e8400-e29b-41d4-a716-446655440000',
'admin@example.com',
);
// result => { message: 'force deleted' }