-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add solr client. #106
Merged
Merged
Add solr client. #106
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
78d6ae7
Add solr client.
pritamdas99 e9822fc
Update go mod
pritamdas99 a77ea4d
Update conatant.
pritamdas99 d9e49ac
Apply goimport.
pritamdas99 63c3d0e
Update backup restore api
pritamdas99 f07bef3
Update to v1 api.
pritamdas99 625ead2
Update backup api
pritamdas99 323695e
Update purge api call
pritamdas99 4eb1785
Update backup api with constants
pritamdas99 c18134a
Update formatting go imports
pritamdas99 fee8fa0
Update constants
pritamdas99 cbb2afe
Update client
pritamdas99 0b7b7ad
Update go mod dependency
pritamdas99 8d83901
Merge branch 'master' into solr
pritamdas99 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ package mssql | |
|
||
import ( | ||
"context" | ||
|
||
"fmt" | ||
|
||
_ "github.com/microsoft/go-mssqldb" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ package pgpool | |
|
||
import ( | ||
"context" | ||
|
||
"fmt" | ||
|
||
olddbapi "kubedb.dev/apimachinery/apis/kubedb/v1alpha2" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ package rabbitmq | |
import ( | ||
"context" | ||
"errors" | ||
|
||
"fmt" | ||
"strings" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package solr | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/go-logr/logr" | ||
"github.com/go-resty/resty/v2" | ||
) | ||
|
||
const ( | ||
writeCollectionName = "kubedb-system" | ||
Action = "action" | ||
ActionBackup = "BACKUP" | ||
ActionRestore = "RESTORE" | ||
ActionCreate = "CREATE" | ||
ActionDeleteBackup = "DELETEBACKUP" | ||
Name = "name" | ||
Location = "location" | ||
Repository = "repository" | ||
Collection = "collection" | ||
Async = "async" | ||
PurgeUnused = "purgeUnused" | ||
BackupId = "backupId" | ||
DeleteStatus = "DELETESTATUS" | ||
RequestStatus = "REQUESTSTATUS" | ||
RequestId = "requestid" | ||
NumShards = "numShards" | ||
ReplicationFactor = "replicationFactor" | ||
) | ||
|
||
type SLClient interface { | ||
GetClusterStatus() (*Response, error) | ||
ListCollection() (*Response, error) | ||
CreateCollection() (*Response, error) | ||
WriteCollection() (*Response, error) | ||
ReadCollection() (*Response, error) | ||
BackupCollection(ctx context.Context, collection string, backupName string, location string, repository string) (*Response, error) | ||
RestoreCollection(ctx context.Context, collection string, backupName string, location string, repository string, backupId int) (*Response, error) | ||
FlushStatus(asyncId string) (*Response, error) | ||
RequestStatus(asyncId string) (*Response, error) | ||
DeleteBackup(ctx context.Context, backupName string, collection string, location string, repository string, backupId int, snap string) (*Response, error) | ||
PurgeBackup(ctx context.Context, backupName string, collection string, location string, repository string, snap string) (*Response, error) | ||
GetConfig() *Config | ||
GetClient() *resty.Client | ||
GetLog() logr.Logger | ||
DecodeBackupResponse(data map[string]interface{}, collection string) ([]byte, error) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package solr | ||
|
||
import ( | ||
"context" | ||
"io" | ||
"net/http" | ||
|
||
"github.com/go-logr/logr" | ||
api "kubedb.dev/apimachinery/apis/kubedb/v1alpha2" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
) | ||
|
||
type Client struct { | ||
SLClient | ||
} | ||
|
||
type ClientOptions struct { | ||
KBClient client.Client | ||
DB *api.Solr | ||
Ctx context.Context | ||
Log logr.Logger | ||
} | ||
|
||
type Config struct { | ||
host string | ||
connectionScheme string | ||
transport *http.Transport | ||
log logr.Logger | ||
} | ||
|
||
type Response struct { | ||
Code int | ||
header http.Header | ||
body io.ReadCloser | ||
} | ||
|
||
type Doc struct { | ||
Id int `json:"id,omitempty" yaml:"id,omitempty"` | ||
DB string `json:"db,omitempty" yaml:"db,omitempty"` | ||
} | ||
|
||
type Data struct { | ||
CommitWithin int `json:"commitWithin,omitempty" yaml:"commitWithin,omitempty"` | ||
Overwrite bool `json:"overwrite,omitempty" yaml:"overwrite,omitempty"` | ||
Doc *Doc `json:"doc,omitempty" yaml:"doc,omitempty"` | ||
} | ||
|
||
type ADD struct { | ||
Add *Data `json:"add,omitempty" yaml:"add,omitempty"` | ||
} | ||
|
||
type QueryParams struct { | ||
Query string `json:"query,omitempty" yaml:"query,omitempty"` | ||
Limit int `json:"limit,omitempty" yaml:"limit,omitempty"` | ||
} | ||
|
||
type CreateParams struct { | ||
Name string `json:"name,omitempty" yaml:"name,omitempty"` | ||
Config string `json:"config,omitempty" yaml:"config,omitempty"` | ||
NumShards int `json:"numShards,omitempty" yaml:"numShards,omitempty"` | ||
ReplicationFactor int `json:"replicationFactor,omitempty" yaml:"replicationFactor,omitempty"` | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this pointer type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't use pointer for embedded types