mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-13 19:28:55 +00:00
feat: introduce RCR interface (#4642)
* feat: introduce RCR interface Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com> * fix codegen Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com> Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
This commit is contained in:
parent
b9baae9746
commit
634dff5639
4 changed files with 61 additions and 3 deletions
|
@ -60,6 +60,18 @@ type ClusterReportChangeRequest struct {
|
|||
Results []policyreportv1alpha2.PolicyReportResult `json:"results,omitempty"`
|
||||
}
|
||||
|
||||
func (r *ClusterReportChangeRequest) GetResults() []policyreportv1alpha2.PolicyReportResult {
|
||||
return r.Results
|
||||
}
|
||||
|
||||
func (r *ClusterReportChangeRequest) SetResults(results []policyreportv1alpha2.PolicyReportResult) {
|
||||
r.Results = results
|
||||
}
|
||||
|
||||
func (r *ClusterReportChangeRequest) SetSummary(summary policyreportv1alpha2.PolicyReportSummary) {
|
||||
r.Summary = summary
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
|
|
32
api/kyverno/v1alpha2/interface.go
Normal file
32
api/kyverno/v1alpha2/interface.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
Copyright 2020 The Kubernetes authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha2
|
||||
|
||||
import (
|
||||
policyreportv1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// +kubebuilder:object:generate=false
|
||||
|
||||
// ReportChangeRequestInterface abstracts the concrete report change request type (ReportChangeRequest vs ClusterReportChangeRequest)
|
||||
type ReportChangeRequestInterface interface {
|
||||
metav1.Object
|
||||
GetResults() []policyreportv1alpha2.PolicyReportResult
|
||||
SetResults([]policyreportv1alpha2.PolicyReportResult)
|
||||
SetSummary(policyreportv1alpha2.PolicyReportSummary)
|
||||
}
|
|
@ -22,9 +22,6 @@ import (
|
|||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
|
||||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
|
||||
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +kubebuilder:object:root=true
|
||||
|
@ -62,6 +59,18 @@ type ReportChangeRequest struct {
|
|||
Results []policyreportv1alpha2.PolicyReportResult `json:"results,omitempty"`
|
||||
}
|
||||
|
||||
func (r *ReportChangeRequest) GetResults() []policyreportv1alpha2.PolicyReportResult {
|
||||
return r.Results
|
||||
}
|
||||
|
||||
func (r *ReportChangeRequest) SetResults(results []policyreportv1alpha2.PolicyReportResult) {
|
||||
r.Results = results
|
||||
}
|
||||
|
||||
func (r *ReportChangeRequest) SetSummary(summary policyreportv1alpha2.PolicyReportSummary) {
|
||||
r.Summary = summary
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
|
|
|
@ -233,6 +233,11 @@ github.com/kyverno/kyverno/api/policyreport/v1alpha2.PolicyReportSummary
|
|||
</tbody>
|
||||
</table>
|
||||
<hr />
|
||||
<h3 id="kyverno.io/v1alpha2.ReportChangeRequestInterface">ReportChangeRequestInterface
|
||||
</h3>
|
||||
<p>
|
||||
<p>ReportChangeRequestInterface abstracts the concrete report change request type (ReportChangeRequest vs ClusterReportChangeRequest)</p>
|
||||
</p>
|
||||
</div>
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
|
|
Loading…
Add table
Reference in a new issue