Skip to content
v2.276.0

WarningOptions Struct ​

Options for adding an acknowledgeable warning via Annotations.addWarningV2 or Validations.addWarning.

Example ​

ts
// The construct attaches context describing this specific occurrence:
Validations.of(this).addWarning(
  'my-lib:unsupportedActionType',
  'This action type is not supported and will be ignored',
  { context: { service: 'aiops', resource: 'investigation-group' } },
);

// Acknowledge only the occurrences that match. `where` is an objectLike partial
// match against the context: any key you do not mention is left unconstrained,
// so the filter below also suppresses an occurrence whose context is
// `{ service: 'aiops', resource: 'other' }`:
Validations.of(this).acknowledge({
  id: 'my-lib:unsupportedActionType',
  reason: 'aiops actions are attached intentionally',
  where: { service: 'aiops' },
});

Properties ​

contextoptional{ [key: string]: any }contextoptionaltyping.Mapping[str, Any]contextoptionalMap<String, Object>ContextoptionalIDictionary<string, object>Contextoptional*map[string]interface{}#
Structured context describing this specific warning occurrence.

Default: no context is attached

notes

The construct chooses the keys and values (e.g. { service: 'aiops' }, or richer values such as numbers or arrays). A later acknowledge({ where }) is matched against this context as an objectLike partial match, to selectively suppress only the matching occurrences of the warning id while the rest continue to warn. When omitted, the warning carries no context and can only be suppressed by an unfiltered acknowledgement.