Filter

The Filter entity within ConfigHub can be used to store filters for reuse. Instead of or in addition to filters specified directly in where expressions on API calls, filter IDs may be specified to apply a saved filter.

A Filter specifies:

  • From: The entity type to filter (e.g., Unit, Space, Trigger).
  • Where: A where expression on entity metadata attributes.
  • WhereData: A filter expression on configuration data content (Units only).
  • ResourceType: A resource type to match, such as apps/v1/Deployment (Units only).
  • FromSpaceID: An optional Space to restrict the filter scope to.

Filters may be used to easily identify sets of units requiring attention. The following is a set of "quick filters" finding such units:

cub filter create --space "$space" apply-not-completed Unit --where-field "LastAppliedRevisionNum != LiveRevisionNum"
cub filter create --space "$space" unapplied-changes Unit --where-field "HeadRevisionNum > LiveRevisionNum AND TargetID IS NOT NULL"
cub filter create --space "$space" not-approved Unit --where-field "HeadRevisionNum > LiveRevisionNum AND LEN(ApprovedBy) = 0"
cub filter create --space "$space" has-apply-gates Unit --where-field "LEN(ApplyGates) > 0"
cub filter create --space "$space" needs-upgrade Unit --where-field "Unit.UpstreamRevisionNum < UpstreamUnit.HeadRevisionNum"
cub filter create --space "$space" has-upstream Unit --where-field "UpstreamRevisionNum > 0"

Filters are also intended to be used to identify sets of your units, spaces, and other entities, such as by filtering on labels, that are managed as a group.

Filters can be referenced by Views and used with any command that supports the --filter flag, including bulk operations like cub function do, cub unit approve, and cub unit apply. See the Filters and Views guide for more.