Provisioning: bulk move by name (#108869)

* Add ResourceRef to move job spec
* Implement move by name
* Use map to struct
This commit is contained in:
Roberto Jiménez Sánchez
2025-07-30 11:30:24 +03:00
committed by GitHub
parent f4335fc5ce
commit f4e45bf3bc
11 changed files with 747 additions and 22 deletions
+6
View File
@@ -178,6 +178,12 @@ type MoveJobOptions struct {
// Destination path for the move (e.g. "new-location/")
TargetPath string `json:"targetPath,omitempty"`
// Resources to move
// This option has been created because currently the frontend does not use
// standarized app platform APIs. For performance and API consistency reasons, the preferred option
// is it to use the paths.
Resources []ResourceRef `json:"resources,omitempty"`
}
// The job status
@@ -512,6 +512,11 @@ func (in *MoveJobOptions) DeepCopyInto(out *MoveJobOptions) {
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Resources != nil {
in, out := &in.Resources, &out.Resources
*out = make([]ResourceRef, len(*in))
copy(*out, *in)
}
return
}
@@ -1150,9 +1150,25 @@ func schema_pkg_apis_provisioning_v0alpha1_MoveJobOptions(ref common.ReferenceCa
Format: "",
},
},
"resources": {
SchemaProps: spec.SchemaProps{
Description: "Resources to move This option has been created because currently the frontend does not use standarized app platform APIs. For performance and API consistency reasons, the preferred option is it to use the paths.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceRef"),
},
},
},
},
},
},
},
},
Dependencies: []string{
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceRef"},
}
}
@@ -7,6 +7,7 @@ API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provis
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,JobStatus,Summary
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,ManagerStats,Stats
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,MoveJobOptions,Paths
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,MoveJobOptions,Resources
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,RefList,Items
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,RepositoryList,Items
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,RepositorySpec,Workflows