Skip to content

Commit

Permalink
Adds refresh API (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
delldubey authored Dec 6, 2023
1 parent 839e45e commit 274de89
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,4 +424,7 @@ type Pmax interface {
DeleteNASServer(ctx context.Context, symID, nasID string) error
// GetFileInterfaceByID gets a FileInterface
GetFileInterfaceByID(ctx context.Context, symID, interfaceID string) (*types.FileInterface, error)

// RefreshSymmetrix refreshes cache on the symID
RefreshSymmetrix(ctx context.Context, symID string) error
}
23 changes: 23 additions & 0 deletions system.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,29 @@ func (c *Client) GetISCSITargets(ctx context.Context, symID string) ([]ISCSITarg
return targets, nil
}

// RefreshSymmetrix refreshes symmetrix cache
func (c *Client) RefreshSymmetrix(ctx context.Context, symID string) error {
defer c.TimeSpent("RefreshSymmetrix", time.Now())
if _, err := c.IsAllowedArray(symID); err != nil {
return err
}
// univmax/restapi/101/system/symmetrix/{{symID}}/refresh
URL := fmt.Sprintf("%s%d/system/symmetrix/%s/refresh", RESTPrefix, 101, symID)
fields := map[string]interface{}{
http.MethodPut: URL,
}
log.WithFields(fields).Info("Refresh symmetrix")
ctx, cancel := c.GetTimeoutContext(ctx)
defer cancel()
err := c.api.Post(
ctx, URL, c.getDefaultHeaders(), nil, nil)
if err != nil {
log.WithFields(fields).Error("Error in RefreshSymmetrix: " + err.Error())
return err
}
return nil
}

// SetAllowedArrays sets the list of arrays which can be manipulated
// an empty list will allow all arrays to be accessed
func (c *Client) SetAllowedArrays(arrays []string) error {
Expand Down

0 comments on commit 274de89

Please sign in to comment.