Skip to content

Commit

Permalink
Update deps
Browse files Browse the repository at this point in the history
Signed-off-by: Md. Ishtiaq Islam <[email protected]>
  • Loading branch information
ishtiaqhimel committed Apr 19, 2024
1 parent bd16888 commit dd5a203
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 36 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ require (
kmodules.xyz/custom-resources v0.29.1
kmodules.xyz/offshoot-api v0.29.0
kubedb.dev/apimachinery v0.44.0
kubedb.dev/db-client-go v0.0.15-0.20240417062702-985900c1a636
kubedb.dev/db-client-go v0.0.15-0.20240419064300-f4fab3d22391
sigs.k8s.io/controller-runtime v0.17.2
stash.appscode.dev/apimachinery v0.34.0
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,8 @@ kmodules.xyz/prober v0.29.0 h1:Ex7m4F9rH7uWNNJlLgP63ROOM+nUATJkC2L5OQ7nwMg=
kmodules.xyz/prober v0.29.0/go.mod h1:UtK+HKyI1lFLEKX+HFLyOCVju6TO93zv3kwGpzqmKOo=
kubedb.dev/apimachinery v0.44.0 h1:R7tiR35tmjJxNlpHUS8PVPmSrnFMfLycDE0c9XEU1/A=
kubedb.dev/apimachinery v0.44.0/go.mod h1:7daaaWragCFLV38plrrJtsOuzinBSX3enMpliqlm3Uo=
kubedb.dev/db-client-go v0.0.15-0.20240417062702-985900c1a636 h1:qdqZ/NZ17Zdxv9PT0pLBL1ojtYw8hz5m/cYB2zvw4yI=
kubedb.dev/db-client-go v0.0.15-0.20240417062702-985900c1a636/go.mod h1:Vv6x2vfdOGzjWa7iOOuMYyABXXAIkJpJ5eZ79GcgNqc=
kubedb.dev/db-client-go v0.0.15-0.20240419064300-f4fab3d22391 h1:QqKQl3YVwOXcmHsCo5k6DSCW7qeUFJlhn7/XyJ4DmuA=
kubedb.dev/db-client-go v0.0.15-0.20240419064300-f4fab3d22391/go.mod h1:Vv6x2vfdOGzjWa7iOOuMYyABXXAIkJpJ5eZ79GcgNqc=
kubeops.dev/petset v0.0.5 h1:VVXi39JhjondlbHyZ98z0MLp6VCmiCMinL59K48Y2zA=
kubeops.dev/petset v0.0.5/go.mod h1:ijtKT1HlAht2vBEZj5LW7C00XEs3B0d1VdCQgd5V4cA=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
Expand Down
4 changes: 4 additions & 0 deletions pkg/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ func (opt *esOptions) getSpaces() ([]elasticsearchdashboard.Space, error) {
return nil, err
}

if len(spaces) == 0 {
return nil, fmt.Errorf("no spaces found in interim data directory")
}

return spaces, nil
} else {
data, err := os.ReadFile(filepath.Join(opt.interimDataDir, SpacesInfoFile))
Expand Down
15 changes: 10 additions & 5 deletions vendor/kubedb.dev/db-client-go/elasticsearchdashboard/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ const (
SpacesURL = "/api/spaces/space"
)

var jsonHeaderForKibanaAPI = map[string]string{
"Content-Type": "application/json",
"kbn-xsrf": "true",
}

type Client struct {
EDClient
}
Expand Down Expand Up @@ -92,9 +97,9 @@ type ResponseBody struct {
type Space struct {
Id string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Color string `json:"color"`
Initials string `json:"initials"`
DisabledFeatures []string `json:"disabledFeatures"`
ImageUrl string `json:"imageUrl"`
Description string `json:"description,omitempty"`
Color string `json:"color,omitempty"`
Initials string `json:"initials,omitempty"`
DisabledFeatures []string `json:"disabledFeatures,omitempty"`
ImageUrl string `json:"imageUrl,omitempty"`
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,7 @@ func (h *EDClientV7) GetStateFromHealthResponse(health *Health) (esapi.Dashboard
func (h *EDClientV7) ExportSavedObjects(spaceName string) (*Response, error) {
req := h.Client.R().
SetDoNotParseResponse(true).
SetHeaders(map[string]string{
"Content-Type": "application/json",
"kbn-xsrf": "true",
}).
SetHeaders(jsonHeaderForKibanaAPI).
SetBody([]byte(SavedObjectsReqBodyES))
res, err := req.Post("/s/" + spaceName + SavedObjectsExportURL)
if err != nil {
Expand Down Expand Up @@ -150,10 +147,7 @@ func (h *EDClientV7) ImportSavedObjects(spaceName, filepath string) (*Response,
func (h *EDClientV7) ListSpaces() ([]Space, error) {
req := h.Client.R().
SetDoNotParseResponse(true).
SetHeaders(map[string]string{
"Content-Type": "application/json",
"kbn-xsrf": "true",
})
SetHeaders(jsonHeaderForKibanaAPI)
res, err := req.Get(SpacesURL)
if err != nil {
klog.Error("Failed to send http request")
Expand All @@ -180,19 +174,21 @@ func (h *EDClientV7) ListSpaces() ([]Space, error) {
func (h *EDClientV7) CreateSpace(space Space) error {
req := h.Client.R().
SetDoNotParseResponse(true).
SetHeaders(map[string]string{
"Content-Type": "application/json",
"kbn-xsrf": "true",
}).
SetHeaders(jsonHeaderForKibanaAPI).
SetBody(space)
res, err := req.Post(SpacesURL)
if err != nil {
klog.Error(err, "Failed to send http request")
return err
}

body, err := io.ReadAll(res.RawBody())
if err != nil {
return err
}

if res.StatusCode() != http.StatusOK {
return fmt.Errorf("failed to create dashboard space %s", space.Name)
return fmt.Errorf("failed to create dashboard space %s: %s", space.Name, string(body))
}

return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,7 @@ func (h *EDClientV8) GetStateFromHealthResponse(health *Health) (esapi.Dashboard
func (h *EDClientV8) ExportSavedObjects(spaceName string) (*Response, error) {
req := h.Client.R().
SetDoNotParseResponse(true).
SetHeaders(map[string]string{
"Content-Type": "application/json",
"kbn-xsrf": "true",
}).
SetHeaders(jsonHeaderForKibanaAPI).
SetBody([]byte(SavedObjectsReqBodyES))
res, err := req.Post("/s/" + spaceName + SavedObjectsExportURL)
if err != nil {
Expand Down Expand Up @@ -148,10 +145,7 @@ func (h *EDClientV8) ImportSavedObjects(spaceName, filepath string) (*Response,
func (h *EDClientV8) ListSpaces() ([]Space, error) {
req := h.Client.R().
SetDoNotParseResponse(true).
SetHeaders(map[string]string{
"Content-Type": "application/json",
"kbn-xsrf": "true",
})
SetHeaders(jsonHeaderForKibanaAPI)
res, err := req.Get(SpacesURL)
if err != nil {
klog.Error("Failed to send http request")
Expand All @@ -178,19 +172,21 @@ func (h *EDClientV8) ListSpaces() ([]Space, error) {
func (h *EDClientV8) CreateSpace(space Space) error {
req := h.Client.R().
SetDoNotParseResponse(true).
SetHeaders(map[string]string{
"Content-Type": "application/json",
"kbn-xsrf": "true",
}).
SetHeaders(jsonHeaderForKibanaAPI).
SetBody(space)
res, err := req.Post(SpacesURL)
if err != nil {
klog.Error(err, "Failed to send http request")
return err
}

body, err := io.ReadAll(res.RawBody())
if err != nil {
return err
}

if res.StatusCode() != http.StatusOK {
return fmt.Errorf("failed to create dashboard space %s", space.Name)
return fmt.Errorf("failed to create dashboard space %s: %s", space.Name, string(body))
}

return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,6 @@ func (h *OSClient) ListSpaces() ([]Space, error) {
return []Space{{Id: "default"}}, nil
}

func (h *OSClient) CreateSpace(space Space) error {
func (h *OSClient) CreateSpace(_ Space) error {
return nil
}
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ kubedb.dev/apimachinery/apis/kubedb
kubedb.dev/apimachinery/apis/kubedb/v1alpha2
kubedb.dev/apimachinery/crds
kubedb.dev/apimachinery/pkg/validator
# kubedb.dev/db-client-go v0.0.15-0.20240417062702-985900c1a636
# kubedb.dev/db-client-go v0.0.15-0.20240419064300-f4fab3d22391
## explicit; go 1.22.0
kubedb.dev/db-client-go/elasticsearchdashboard
# kubeops.dev/petset v0.0.5
Expand Down

0 comments on commit dd5a203

Please sign in to comment.