@dynatrace-sdk/client-filter-segment-management
v1.4.0
Published
[![npm](https://img.shields.io/badge/npm-v1.4.0-blue)](https://www.npmjs.com/package/@dynatrace-sdk/client-filter-segment-management/v/1.4.0) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0
Downloads
524
Keywords
Readme
@dynatrace-sdk/client-filter-segment-management
Filter-Segment Management for Grail.
Slice, dice and contextualize your data to make it easier to find, understand and work with.
Installation
npm install @dynatrace-sdk/client-filter-segment-management
Getting help
- Visit SDK for Typescript guide in the Dynatrace Developer
- Ask a question in the Dynatrace Community
License
This SDK is distributed under the Apache License, Version 2.0, see LICENSE for more information.
API reference
Full API reference for the latest version of the SDK is also available at the Dynatrace Developer.
filterSegmentsClient
import { filterSegmentsClient } from '@dynatrace-sdk/client-filter-segment-management';
createFilterSegment
Create a new filter-segment.
Create a new segment and define data.
Required scopes:
storage:filter-segments:write
New Filter-Segment
Provide a name and an optional description for the filter-segment.
Variables
Create variables to apply in your filter-segment data filters
Includes (Segment data)
Include all data that should be accessible when applying the filter-segment
IsPublic (Visibility)
false
: The filter-segment is private and only visible to the ownertrue
: The filter-segment is visible to everyone in the environment
Parameters
| Name | Type | | --- | --- | |config.body*required|NewFilterSegment|
Returns
| Return type | Status code | Description | |---|---|---| |DetailedFilterSegment|201|Filter-segment successfully created.|
Throws
| Error Type | Error Message | |---|---| |ErrorEnvelopeError|Filter-segment Bad Request. | unauthorized | missing permissions|
import { filterSegmentsClient } from "@dynatrace-sdk/client-filter-segment-management";
const data = await filterSegmentsClient.createFilterSegment(
{
body: {
name: "dev_environment",
description:
"only includes data of the dev environment",
variables: {
type: "query",
value: "fetch logs | limit 1",
},
isPublic: false,
includes: [
{
filter: "here goes the filter",
dataObject: "logs",
},
{
filter: "here goes another filter",
dataObject: "events",
},
],
},
},
);
deleteFilterSegment
Delete a filter-segment.
Remove the filter-segment from the environment for all users.
Required scopes:
storage:filter-segments:delete
Parameters
| Name | Type | Description | | --- | --- | --- | |config.filterSegmentUid*required|string|UID of the filter-segment |
Returns
| Return type | Status code | Description | |---|---|---| |void|204|Filter-segment successfully deleted.|
Throws
| Error Type | Error Message | |---|---| |ErrorEnvelopeError|bad request | unauthorized | missing permissions | Not found: the server cannot find the requested filter-segment.|
import { filterSegmentsClient } from "@dynatrace-sdk/client-filter-segment-management";
const data = await filterSegmentsClient.deleteFilterSegment(
{ filterSegmentUid: "D82a1jdA23a" },
);
getFilterSegment
Get filter-segment by UID.
Get filter-segment by its UID.
Required scopes:
storage:filter-segments:read
Parameters
| Name | Type | Description | | --- | --- | --- | |config.addFields|"INCLUDES" | "VARIABLES" | "EXTERNALID" | "RESOURCECONTEXT"|Add additional fields. | |config.filterSegmentUid*required|string|UID of the filter-segment |
Returns
| Return type | Status code | Description | |---|---|---| |DetailedFilterSegment|200|Filter-segment successfully retrieved.|
Throws
| Error Type | Error Message | |---|---| |ErrorEnvelopeError|bad request | unauthorized | missing permissions | Not found: the server cannot find the requested filter-segment.|
import { filterSegmentsClient } from "@dynatrace-sdk/client-filter-segment-management";
const data = await filterSegmentsClient.getFilterSegment({
filterSegmentUid: "D82a1jdA23a",
});
getFilterSegments
Get all filter-segments.
Returns all filter-segments.
If details like description are not needed then consider using the :lean
endpoint.
Required scopes:
storage:filter-segments:read
Parameters
| Name | Type | Description | | --- | --- | --- | |config.addFields|"VARIABLES" | "EXTERNALID" | "RESOURCECONTEXT"|Add additional fields. |
Returns
| Return type | Status code | Description | |---|---|---| |FilterSegments|200|Filter-segments successfully retrieved.|
Throws
| Error Type | Error Message | |---|---| |ErrorEnvelopeError|bad request | unauthorized | missing permissions|
import { filterSegmentsClient } from "@dynatrace-sdk/client-filter-segment-management";
const data = await filterSegmentsClient.getFilterSegments();
getLeanFilterSegments
Get all filter-segments in a minimal/lean form.
Returns all filter-segments in a minimal representational form. This endpoint saves resources and as a result quicker response times can be expected over the more detailed get-all endpoint.
Required scopes:
storage:filter-segments:read
Parameters
| Name | Type | Description | | --- | --- | --- | |config.addFields|"VARIABLES" | "EXTERNALID" | "RESOURCECONTEXT" | "OWNER"|Add additional fields. |
Returns
| Return type | Status code | Description | |---|---|---| |LeanFilterSegments|200|Filter-segments successfully retrieved.|
Throws
| Error Type | Error Message | |---|---| |ErrorEnvelopeError|bad request | unauthorized | missing permissions|
import { filterSegmentsClient } from "@dynatrace-sdk/client-filter-segment-management";
const data =
await filterSegmentsClient.getLeanFilterSegments();
partiallyUpdateFilterSegment
Partially update a filter-segment.
Update one or more fields of a filter-segment.
Required scopes:
storage:filter-segments:write
Following fields can be updated:
name
description
isPublic
variables
*includes
*
* If given the value will be overridden.
Fields not given will be ignored.
Parameters
| Name | Type | Description | | --- | --- | --- | |config.body*required|PartialUpdateFilterSegment| | |config.filterSegmentUid*required|string|UID of the filter-segment | |config.optimisticLockingVersion*required|number|version which should be updated. used for optimistic locking. |
Returns
| Return type | Status code | Description | |---|---|---| |void|200|Filter-segment successfully updated.|
Throws
| Error Type | Error Message | |---|---| |ErrorEnvelopeError|bad request | unauthorized | missing permissions | Not found: the server cannot find the requested filter-segment.|
import { filterSegmentsClient } from "@dynatrace-sdk/client-filter-segment-management";
const data =
await filterSegmentsClient.partiallyUpdateFilterSegment({
filterSegmentUid: "D82a1jdA23a",
optimisticLockingVersion: 1,
body: {
description:
"only includes data of the development environment",
},
});
updateFilterSegment
Update a filter-segment. All fields will be overwritten (also undefined or null fields).
Update one or more fields of a filter-segment.
Required scopes:
storage:filter-segments:write
Following fields can be updated:
name
description
isPublic
variables
*includes
*
* Values of the fields will be overridden or removed if not given.
Provide all other fields with unchanged values.
Parameters
| Name | Type | Description | | --- | --- | --- | |config.body*required|UpdateFilterSegment| | |config.filterSegmentUid*required|string|UID of the filter-segment | |config.optimisticLockingVersion*required|number|version which should be updated. used for optimistic locking. |
Returns
| Return type | Status code | Description | |---|---|---| |void|200|Filter-segment successfully updated.|
Throws
| Error Type | Error Message | |---|---| |ErrorEnvelopeError|bad request | unauthorized | missing permissions | Not found: the server cannot find the requested filter-segment.|
import { filterSegmentsClient } from "@dynatrace-sdk/client-filter-segment-management";
const data = await filterSegmentsClient.updateFilterSegment(
{
filterSegmentUid: "D82a1jdA23a",
optimisticLockingVersion: 1,
body: {
uid: "D82a1jdA23a",
name: "dev_environment",
description:
"only includes data of the development environment",
variables: {
type: "query",
value: "fetch logs | limit 1",
},
isPublic: false,
owner: "john.doe",
includes: [
{
filter: "here goes the filter",
dataObject: "logs",
},
{
filter: "here goes another filter",
dataObject: "events",
},
],
},
},
);
Types
CustomValidationErrorInfo
| Name | Type | | --- | --- | |message|string|
DetailedFilterSegment
| Name | Type | Description | | --- | --- | --- | |allowedOperations|Array<"READ" | "WRITE" | "DELETE">|Defines the allowed operations of the current user. | |description|string|Description of the filter-segment. | |externalId|string|Optional unique identifier of the filter-segment. Used for Dynatrace Configuration as Code | |includes|Array<Include>|List of includes of the filter-segment. | |isPublic|boolean|Indicates if the filter-segment is publicly accessible within the tenant. | |name*required|string|Name of the filter-segment. | |owner*required|string|Defines the owner of the filter-segment. | |uid*required|string|Unique identifier of the filter-segment. | |variables|FilterSegmentVariables|Variables of the filter-segment. | |version|number|Used for optimistic locking. Update requests define with this on which version the data updated is based on. This must match with the version stored, otherwise the update will fail due to concurrent modification. |
ErrorEnvelope
| Name | Type | | --- | --- | |error|ExceptionalReturn|
ErrorInfo
| Name | Type | | --- | --- | |message|string|
ExceptionalReturn
| Name | Type | | --- | --- | |code|number| |errorDetails|Array<CustomValidationErrorInfo | InvalidAuditEventsErrorInfo | MediaTypeErrorInfo | ParameterErrorInfo | ProxyErrorInfo | QueryFrontendRawErrorInfo | RequestBodyErrorInfo>| |message|string|
FilterSegment
List of filter-segments.
| Name | Type | Description | | --- | --- | --- | |allowedOperations|Array<"READ" | "WRITE" | "DELETE">|Defines the allowed operations of the current user. | |description|string|Description of the filter-segment. | |externalId|string|Optional unique identifier of the filter-segment. Used for Dynatrace Configuration as Code | |isPublic|boolean|Indicates if the filter-segment is publicly accessible within the tenant. | |name*required|string|Name of the filter-segment. | |owner*required|string|Defines the owner of the filter-segment. | |uid*required|string|Unique identifier of the filter-segment. | |variables|FilterSegmentVariables|Variables of the filter-segment. | |version|number|Used for optimistic locking. Update requests define with this on which version the data updated is based on. This must match with the version stored, otherwise the update will fail due to concurrent modification. |
FilterSegmentVariables
Variables of the filter-segment.
| Name | Type | Description | | --- | --- | --- | |type*required|string|Type of the variable. | |value*required|string|Value of the variable. |
FilterSegments
| Name | Type | Description | | --- | --- | --- | |filterSegments*required|Array<FilterSegment>|List of filter-segments. |
Include
List of includes of the filter-segment.
| Name | Type | Description | | --- | --- | --- | |applyTo|Array<string>|[Experimental] The tables that the entity-filter will be applied to. | |dataObject*required|string|The data object that the filter will be applied to. Use '_all_data_object' to apply it to all dataObjects. | |filter*required|string|Data will be filtered by this value. | |relationship|Relationship|[Experimental] The relationship of an include which has to be be specified when the data object is an entity view. |
InvalidAuditEventsErrorInfo
| Name | Type | | --- | --- | |invalidAuditEventIndices|Array<number>| |invalidEventIndices|Array<number>| |message|string|
LeanFilterSegment
List of filter-segments.
| Name | Type | Description | | --- | --- | --- | |allowedOperations|Array<"READ" | "WRITE" | "DELETE">|Defines the allowed operations of the current user. | |externalId|string|Optional unique identifier of the filter-segment. Used for Dynatrace Configuration as Code | |isPublic|boolean|Indicates if the filter-segment is publicly accessible within the tenant. | |name*required|string|Name of the filter-segment. | |owner|string|Defines the owner of the filter-segment. | |uid*required|string|Unique identifier of the filter-segment. | |variables|FilterSegmentVariables|Variables of the filter-segment. |
LeanFilterSegments
| Name | Type | Description | | --- | --- | --- | |filterSegments*required|Array<LeanFilterSegment>|List of filter-segments. |
MediaTypeErrorInfo
| Name | Type | | --- | --- | |message|string| |supportedMediaTypes|Array<string>|
NewFilterSegment
| Name | Type | Description | | --- | --- | --- | |description|string|Description of the filter-segment. | |externalId|string|Optional unique identifier of the filter-segment. Used for Dynatrace Configuration as Code | |includes|Array<NewInclude>|List of includes of the filter-segment. | |isPublic*required|boolean|Indicates if the filter-segment is publicly accessible within the tenant. | |name*required|string|Name of the filter-segment. | |variables|FilterSegmentVariables|Variables of the filter-segment. |
NewInclude
List of includes of the filter-segment.
| Name | Type | Description | | --- | --- | --- | |applyTo|Array<string>|[Experimental] The tables that the entity-filter will be applied to. | |dataObject*required|string|The data object that the filter will be applied to. Use '_all_data_object' to apply it to all dataObjects. | |filter*required|string|Data will be filtered by this value. | |relationship|NewRelationship|[Experimental] The relationship of an include which has to be be specified when the data object is an entity view. |
NewRelationship
[Experimental] The relationship of an include which has to be be specified when the data object is an entity view.
| Name | Type | Description | | --- | --- | --- | |name*required|string|Name of the relationship. | |target*required|string|Target of the relationship. |
ParameterErrorInfo
| Name | Type | | --- | --- | |message|string| |parameterDescriptor|string|
PartialUpdateFilterSegment
| Name | Type | Description | | --- | --- | --- | |description|string|Description of the filter-segment. | |externalId|string|Optional unique identifier of the filter-segment. Used for Dynatrace Configuration as Code | |includes|Array<NewInclude>|List of includes of the filter-segment. | |isPublic|boolean|Indicates if the filter-segment is publicly accessible within the tenant. | |name|string|Name of the filter-segment. | |variables|FilterSegmentVariables|Variables of the filter-segment. |
ProxyErrorInfo
| Name | Type | | --- | --- | |message|string|
QueryFrontendRawErrorInfo
| Name | Type | | --- | --- | |message|string| |rawQueryFrontendResponse|string|
Relationship
[Experimental] The relationship of an include which has to be be specified when the data object is an entity view.
| Name | Type | Description | | --- | --- | --- | |name*required|string|Name of the relationship. | |target*required|string|Target of the relationship. |
RequestBodyErrorInfo
| Name | Type | | --- | --- | |bodyDescriptor|string| |message|string|
UpdateFilterSegment
| Name | Type | Description | | --- | --- | --- | |description|string|Description of the filter-segment. | |externalId|string|Optional unique identifier of the filter-segment. Used for Dynatrace Configuration as Code | |includes|Array<NewInclude>|List of includes of the filter-segment. | |isPublic*required|boolean|Indicates if the filter-segment is publicly accessible within the tenant. | |name*required|string|Name of the filter-segment. | |owner*required|string|Defines the owner of the filter-segment. | |uid*required|string|Unique identifier of the filter-segment. | |variables|FilterSegmentVariables|Variables of the filter-segment. |
Enums
DetailedFilterSegmentAllowedOperationsItem
Defines the allowed operations of the current user.
Enum keys
Delete
| Read
| Write
FilterSegmentAllowedOperationsItem
Defines the allowed operations of the current user.
Enum keys
Delete
| Read
| Write
GetFilterSegmentQueryAddFieldsItem
Enum keys
Externalid
| Includes
| Resourcecontext
| Variables
GetFilterSegmentsQueryAddFieldsItem
Enum keys
Externalid
| Resourcecontext
| Variables
GetLeanFilterSegmentsQueryAddFieldsItem
Enum keys
Externalid
| Owner
| Resourcecontext
| Variables
LeanFilterSegmentAllowedOperationsItem
Defines the allowed operations of the current user.
Enum keys
Delete
| Read
| Write