Skip to content
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

Querying snapshots by Volume Name #58

Open
jwatson-gcu opened this issue Nov 24, 2021 · 0 comments
Open

Querying snapshots by Volume Name #58

jwatson-gcu opened this issue Nov 24, 2021 · 0 comments

Comments

@jwatson-gcu
Copy link

jwatson-gcu commented Nov 24, 2021

NOTE: This behavior is observed on the master branch as of Aug 5, 2021.

I found an issue when querying for snapshots by Volume Name when the volume name contains characters unsafe for URL's. In the event that a volume name contains something like :, which is not url safe, the SDK will convert the request to an advanced search.

This advanced search request is rejected by the SAN.

Here is an example of the code snip-it:

	params := &param.GetParams{
		Filter: &param.SearchFilter{
			Criteria: []*param.SearchFilter{
				{FieldName: &nimbleos.SnapshotFields.VolName, Operator: param.EQUALS.String(), Value: *vol.Name},
				{FieldName: &nimbleos.SnapshotFields.IsManuallyManaged, Operator: param.EQUALS.String(), Value: "true"},
			},
		},
	}
	snaps, err := service.GetSnapshotService().GetSnapshots(params)

Here is the REST API debug log:

==============================================================================
Volume: SERVER-Data-Daily-7-Day-2021-10-26::20:41:18.409:EDT
2021/11/23 14:39:43.863943 DEBUG RESTY 
==============================================================================
~~~ REQUEST ~~~
POST  /v1/snapshots/detail  HTTP/1.1
HOST   : x.x.x.x:5392
HEADERS:
	Content-Type: application/json
	User-Agent: go-resty/2.6.0 (https://github.com/go-resty/resty)
	X-Auth-Token: 32aa460f44d0a95ee57982c92a71f47e
BODY   :
{
   "data": {
      "_constructor": "AdvancedCriteria",
      "operator": "",
      "criteria": [
         {
            "fieldName": "vol_name",
            "operator": "equals",
            "value": "SERVER-Data-Daily-7-Day-2021-10-26::20:41:18.409:EDT"
         },
         {
            "fieldName": "is_manually_managed",
            "operator": "equals",
            "value": "true"
         }
      ]
   },
   "operationType": "fetch"
}
------------------------------------------------------------------------------
~~~ RESPONSE ~~~
STATUS       : 400 OK
PROTO        : HTTP/1.1
RECEIVED AT  : 2021-11-23T14:39:43.863640016-05:00
TIME DURATION: 42.352938ms
HEADERS      :
	Connection: Keep-Alive
	Content-Type: application/json;charset=utf-8
	Date: Tue, 23 Nov 2021 19:39:43 GMT
BODY         :
{
   "messages": [
      {
         "code": "SM_http_bad_request",
         "severity": "error",
         "text": "The request could not be understood by the server."
      },
      {
         "code": "SM_unsupported_query_operator",
         "severity": "error",
         "arguments": {
            "field": "AdvancedCriteria",
            "op": ""
         },
         "text": "Unsupported filter operator '' specified for the attribute 'AdvancedCriteria'."
      }
   ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant