Skip to content

Commit

Permalink
Merge the WLM related APIs now that both of them are in shared
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 699201186
  • Loading branch information
karkunpavan authored and copybara-github committed Nov 22, 2024
1 parent a1c5931 commit afd84b7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 49 deletions.
49 changes: 0 additions & 49 deletions integration/common/shared/gce/wlm.go

This file was deleted.

23 changes: 23 additions & 0 deletions integration/common/shared/gce/wlm/wlm.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"net/http"
"runtime"

"github.com/pkg/errors"
"google.golang.org/api/googleapi"
"google.golang.org/api/option/internaloption"
"google.golang.org/api/option"
Expand All @@ -41,6 +42,28 @@ const (
defaultUniverseDomain = "googleapis.com"
)

// WLM is a wrapper for Workload Manager API services.
type WLM struct {
service *DataWarehouseService
}

// NewWLMClient creates a new WLM service wrapper.
func NewWLMClient(ctx context.Context, basePath string) (*WLM, error) {
s, err := NewService(ctx, option.WithEndpoint(basePath))
if err != nil {
return nil, errors.Wrap(err, "error creating WLM client")
}
log.Logger.Infow("WLM Service with base path", "basePath", s.BasePath)
return &WLM{s}, nil
}

// WriteInsight wraps a call to the WLM insights:write API.
func (w *WLM) WriteInsight(project string, location string, writeInsightRequest *dwpb.WriteInsightRequest) error {
res, err := w.service.WriteInsight(project, location, writeInsightRequest)
log.Logger.Debugw("WriteInsight response", "res", res, "err", err)
return err
}

// DataWarehouseService implements the Data Warehouse service.
type DataWarehouseService struct {
c *http.Client
Expand Down

0 comments on commit afd84b7

Please sign in to comment.