Skip to content

Commit

Permalink
Update constants
Browse files Browse the repository at this point in the history
Signed-off-by: pritamdas99 <[email protected]>
  • Loading branch information
pritamdas99 committed Jul 17, 2024
1 parent c18134a commit fee8fa0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
5 changes: 4 additions & 1 deletion solr/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ const (
Action = "action"
ActionBackup = "BACKUP"
ActionRestore = "RESTORE"
ActionCreate = "CREATE"
ActionDeleteBackup = "DELETEBACKUP"
BackupName = "name"
Name = "name"
Location = "location"
Repository = "repository"
Collection = "collection"
Expand All @@ -23,6 +24,8 @@ const (
DeleteStatus = "DELETESTATUS"
RequestStatus = "REQUESTSTATUS"
RequestId = "requestid"
NumShards = "numShards"
ReplicationFactor = "replicationFactor"
)

type SLClient interface {
Expand Down
16 changes: 8 additions & 8 deletions solr/solrv8.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ func (sc *SLClientV8) CreateCollection() (*Response, error) {
req := sc.Client.R().SetDoNotParseResponse(true)
req.SetHeader("Content-Type", "application/json")
params := map[string]string{
"action": "CREATE",
"name": writeCollectionName,
"numShards": "1",
"replicationFactor": "1",
Action: ActionCreate,
Name: writeCollectionName,
NumShards: "1",
ReplicationFactor: "1",
}

req.SetQueryParams(params)
Expand Down Expand Up @@ -131,7 +131,7 @@ func (sc *SLClientV8) BackupCollection(ctx context.Context, collection string, b
req.SetHeader("Content-Type", "application/json")
params := map[string]string{
Action: ActionBackup,
BackupName: backupName,
Name: backupName,
Collection: collection,
Location: location,
Repository: repository,
Expand Down Expand Up @@ -160,7 +160,7 @@ func (sc *SLClientV8) RestoreCollection(ctx context.Context, collection string,
req.SetHeader("Content-Type", "application/json")
params := map[string]string{
Action: ActionRestore,
BackupName: backupName,
Name: backupName,
Location: location,
Collection: collection,
Repository: repository,
Expand Down Expand Up @@ -240,7 +240,7 @@ func (sc *SLClientV8) DeleteBackup(ctx context.Context, backupName string, colle
}
params := map[string]string{
Action: ActionDeleteBackup,
BackupName: backupName,
Name: backupName,
Location: location,
Repository: repository,
BackupId: strconv.Itoa(backupId),
Expand Down Expand Up @@ -272,7 +272,7 @@ func (sc *SLClientV8) PurgeBackup(ctx context.Context, backupName string, collec
}
params := map[string]string{
Action: ActionDeleteBackup,
BackupName: backupName,
Name: backupName,
Location: location,
Repository: repository,
PurgeUnused: "true",
Expand Down
8 changes: 4 additions & 4 deletions solr/solrv9.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (sc *SLClientV9) BackupCollection(ctx context.Context, collection string, b
req.SetHeader("Content-Type", "application/json")
backupParams := map[string]string{
Action: ActionBackup,
BackupName: backupName,
Name: backupName,
Collection: collection,
Location: location,
Repository: repository,
Expand Down Expand Up @@ -163,7 +163,7 @@ func (sc *SLClientV9) RestoreCollection(ctx context.Context, collection string,
req.SetHeader("Content-Type", "application/json")
restoreParams := map[string]string{
Action: ActionRestore,
BackupName: backupName,
Name: backupName,
Location: location,
Collection: collection,
Repository: repository,
Expand Down Expand Up @@ -232,7 +232,7 @@ func (sc *SLClientV9) DeleteBackup(ctx context.Context, backupName string, colle
}
params := map[string]string{
Action: ActionDeleteBackup,
BackupName: backupName,
Name: backupName,
Location: location,
Repository: repository,
BackupId: strconv.Itoa(backupId),
Expand Down Expand Up @@ -264,7 +264,7 @@ func (sc *SLClientV9) PurgeBackup(ctx context.Context, backupName string, collec
}
params := map[string]string{
Action: ActionDeleteBackup,
BackupName: backupName,
Name: backupName,
Location: location,
Repository: repository,
PurgeUnused: "true",
Expand Down

0 comments on commit fee8fa0

Please sign in to comment.