Skip to content

Commit

Permalink
Update method
Browse files Browse the repository at this point in the history
Signed-off-by: pritamdas99 <[email protected]>
  • Loading branch information
pritamdas99 committed Sep 19, 2024
1 parent fc2ddb3 commit 8ab0f41
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
3 changes: 3 additions & 0 deletions solr/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ const (
Repository = "repository"
Collection = "collection"
Async = "async"
Replica = "replica"
MoveReplica = "MOVEREPLICA"
PurgeUnused = "purgeUnused"
TargetNode = "TargetNode"
BackupId = "backupId"
DeleteStatus = "DELETESTATUS"
RequestStatus = "REQUESTSTATUS"
Expand Down
26 changes: 17 additions & 9 deletions solr/solrv8.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,16 +346,24 @@ func (sc *SLClientV8) DecodeBackupResponse(data map[string]interface{}, collecti
func (sc *SLClientV8) MoveReplica(target string, replica string, collection string, async string) (*Response, error) {
sc.Config.log.V(5).Info(fmt.Sprintf("Move replica %v of collection %v to target node %v", replica, collection, target))
req := sc.Client.R().SetDoNotParseResponse(true)
req.SetHeader("Content-Type", "application/json")
moveReplica := &MoveReplicaParams{
MoveReplica: MoveReplicaInfo{
TargetNode: target,
Replica: replica,
Async: async,
},
params := map[string]string{
Action: MoveReplica,
Collection: collection,
Replica: replica,
TargetNode: target,
Async: async,
}
req.SetBody(moveReplica)
res, err := req.Post(fmt.Sprintf("/api/c/%s", collection))
req.SetQueryParams(params)
//req.SetHeader("Content-Type", "application/json")
//moveReplica := &MoveReplicaParams{
// MoveReplica: MoveReplicaInfo{
// TargetNode: target,
// Replica: replica,
// Async: async,
// },
//}
//req.SetBody(moveReplica)
res, err := req.Post("/solr/admin/collections")
if err != nil {
sc.Config.log.Error(err, "Failed to send http request to move replica")
return nil, err
Expand Down

0 comments on commit 8ab0f41

Please sign in to comment.