Skip to content

Commit

Permalink
fixup! query: Allow multiple filters to be specified
Browse files Browse the repository at this point in the history
address review comments
  • Loading branch information
adamwg committed Aug 6, 2024
1 parent 557e86b commit 1314853
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
23 changes: 11 additions & 12 deletions apis/query/v1alpha2/query_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ type QueryTopLevelFilter struct {
// objects specifies what to filter. Objects in the query response will
// match all criteria in at least one of the specified filters.
// +required
// +kubebuilder:validation:MinLength=1
Objects []QueryFilter `json:"objects"`
}

Expand Down Expand Up @@ -93,14 +92,14 @@ type Freshness struct {
type QueryFilter struct {
// id is the object ID to query.
ID string `json:"id,omitempty"`
// createdAt queries for objects with a range of creation times.
CreatedAt QueryCreatedAt `json:"createdAt,omitempty"`
// creationTimestamp queries for objects with a range of creation times.
CreationTimestamp QueryCreationTimestamp `json:"creationTimestamp,omitempty"`
// namespace is the namespace WITHIN a control plane to query.
Namespace string `json:"namespace,omitempty"`
// name is the name of objects to query.
Name string `json:"name,omitempty"`
// kind is the GroupKinds of objects to query.
Kind QueryGroupKind `json:"kind,omitempty"`
// groupKind is the GroupKinds of objects to query.
GroupKind QueryGroupKind `json:"groupKind,omitempty"`
// labels are the labels of objects to query.
Labels map[string]string `json:"labels,omitempty"`
// categories is a list of categories to query.
Expand All @@ -117,16 +116,16 @@ type QueryFilter struct {
JSONPath string `json:"jsonpath,omitempty"`
}

// QueryCreatedAt specifies how to query by object creation time.
type QueryCreatedAt struct {
// QueryCreationTimestamp specifies how to query by object creation time.
type QueryCreationTimestamp struct {
After metav1.Time `json:"after,omitempty"`
Before metav1.Time `json:"before,omitempty"`
}

// QueryGroupKind specifies how to query for GroupKinds.
type QueryGroupKind struct {
// group is the API group to query. If empty all groups will be queried.
Group string `json:"group,omitempty"`
// apiGroup is the API group to query. If empty all groups will be queried.
APIGroup string `json:"apiGroup,omitempty"`
// kind is kind to query. Kinds are case-insensitive and also match plural
// resources. If empty all kinds will be queried.
Kind string `json:"kind,omitempty"`
Expand All @@ -151,9 +150,9 @@ type QueryCondition struct {
Type string `json:"type"`
// status is the status of condition to query. This is either True, False
// or Unknown.
//
// +kubebuilder:validation:Required
Status string `json:"status"`
Status string `json:"status,omitempty"`
// reason queries based on the reason field of the condition.
Reason string `json:"reason,omitempty"`
}

// A QueryOwner specifies how to query by owner.
Expand Down
12 changes: 6 additions & 6 deletions apis/query/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1314853

Please sign in to comment.