Skip to content

Commit b12ae03

Browse files
committed
add search label to inject events annotation
1 parent f819cd9 commit b12ae03

File tree

5 files changed

+19
-3
lines changed

5 files changed

+19
-3
lines changed

pkg/generated/openapi/zz_generated.openapi.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/storage/internalstorage/resource_storage.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,11 @@ func (s *ResourceStorage) Get(ctx context.Context, cluster, namespace, name stri
203203
func (s *ResourceStorage) genListObjectsQuery(ctx context.Context, opts *internal.ListOptions) (int64, *int64, *gorm.DB, ObjectList, error) {
204204
var result ObjectList
205205
switch {
206-
case opts.OnlyMetadata && opts.WithEvents:
206+
case opts.OnlyMetadata && opts.InjectEvents:
207207
result = &ResourceMetadataWithEventsList{}
208208
case opts.OnlyMetadata:
209209
result = &ResourceMetadataList{}
210-
case opts.WithEvents:
210+
case opts.InjectEvents:
211211
result = &BytesWithEventsList{}
212212
default:
213213
result = &BytesList{}

staging/src/github.com/clusterpedia-io/api/clusterpedia/types.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const (
2323
SearchLabelOwnerGroupResource = "search.clusterpedia.io/owner-gr"
2424
SearchLabelOwnerSeniority = "search.clusterpedia.io/owner-seniority"
2525

26+
SearchLabelInjectEvents = "search.clusterpedia.io/with-events"
2627
SearchLabelWithContinue = "search.clusterpedia.io/with-continue"
2728
SearchLabelWithRemainingCount = "search.clusterpedia.io/with-remaining-count"
2829

@@ -62,7 +63,7 @@ type ListOptions struct {
6263
Since *metav1.Time
6364
Before *metav1.Time
6465

65-
WithEvents bool
66+
InjectEvents bool
6667
WithContinue *bool
6768
WithRemainingCount *bool
6869

staging/src/github.com/clusterpedia-io/api/clusterpedia/v1beta1/conversion.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ func Convert_v1beta1_ListOptions_To_clusterpedia_ListOptions(in *ListOptions, ou
6868
return err
6969
}
7070

71+
out.InjectEvents = in.InjectEvents
7172
out.WithContinue = in.WithContinue
7273
out.WithRemainingCount = in.WithRemainingCount
7374

@@ -150,6 +151,10 @@ func Convert_v1beta1_ListOptions_To_clusterpedia_ListOptions(in *ListOptions, ou
150151
return fmt.Errorf("Invalid Query Offset(%s): %w", out.Continue, err)
151152
}
152153
}
154+
case clusterpedia.SearchLabelInjectEvents:
155+
if err := runtime.Convert_Slice_string_To_bool(&values, &out.InjectEvents, s); err != nil {
156+
return err
157+
}
153158
case clusterpedia.SearchLabelWithContinue:
154159
if in.WithContinue == nil && len(values) != 0 {
155160
if err := runtime.Convert_Slice_string_To_Pointer_bool(&values, &out.WithContinue, s); err != nil {
@@ -226,6 +231,7 @@ func Convert_clusterpedia_ListOptions_To_v1beta1_ListOptions(in *clusterpedia.Li
226231
return err
227232
}
228233

234+
out.InjectEvents = in.InjectEvents
229235
out.WithContinue = in.WithContinue
230236
out.WithRemainingCount = in.WithRemainingCount
231237
return nil

staging/src/github.com/clusterpedia-io/api/clusterpedia/v1beta1/types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ type ListOptions struct {
4444
// +optional
4545
OwnerSeniority int `json:"ownerSeniority,omitempty"`
4646

47+
// +optional
48+
InjectEvents bool `json:"injectEvents,omitempty"`
49+
4750
// +optional
4851
WithContinue *bool `json:"withContinue,omitempty"`
4952

0 commit comments

Comments
 (0)