|
Post by ratagupt on Feb 5, 2019 12:33:39 GMT
I am looking for the method to delete a specific value from the list item.
In the Account Service schema we have the property named "RemoteRoleMapping" which is a collection of rules, below is the output of GET request of AccountService, I have trimmed some data as my query is specific for "RemoteRoleMapping".
curl --insecure -k -H "X-Auth-Token: $test_token" -X GET https://${TEST_IP}/redfish/v1/AccountService
"@odata.context": "/redfish/v1/$metadata#AccountService.AccountService", "@odata.id": "/redfish/v1/AccountService", "@odata.type": "#AccountService.v1_3_1.AccountService", "Description": "Account Service", "Id": "AccountService", "LDAP": {
"RemoteRoleMapping": [ {"LocalRole": "Administrator", "RemoteGroup": "Admingroup15"}, {"LocalRole": "Administrator1","RemoteGroup": "Admingroup13"} ] }
Now I want to delete one of the value from the RemoteRoleMapping..What should be the good way? So suppose I want to delete the following mapping ("LocalRole": "Administrator1","RemoteGroup": "Admingroup13"") . I am assuming that I need to do PATCH operation on the "RemoteRoleMapping" with the updated list. curl --insecure -k -H "X-Auth-Token: $test_token" -X PATCH https://${BMC_IP}/redfish/v1/AccountService -d '{ "RemoteRoleMapping": [ {"LocalRole": "Administrator", "RemoteGroup": "Admingroup15"} ]}'
Is it the correct way, if no please suggest.
|
|
|
Post by jautor on Feb 5, 2019 15:40:11 GMT
I am looking for the method to delete a specific value from the list item.
In the Account Service schema we have the property named "RemoteRoleMapping" which is a collection of rules, below is the output of GET request of AccountService, I have trimmed some data as my query is specific for "RemoteRoleMapping".
curl --insecure -k -H "X-Auth-Token: $test_token" -X GET https://${TEST_IP}/redfish/v1/AccountService
"@odata.context": "/redfish/v1/$metadata#AccountService.AccountService", "@odata.id": "/redfish/v1/AccountService", "@odata.type": "#AccountService.v1_3_1.AccountService", "Description": "Account Service", "Id": "AccountService", "LDAP": {
"RemoteRoleMapping": [ {"LocalRole": "Administrator", "RemoteGroup": "Admingroup15"}, {"LocalRole": "Administrator1","RemoteGroup": "Admingroup13"} ] }
Now I want to delete one of the value from the RemoteRoleMapping..What should be the good way? So suppose I want to delete the following mapping ("LocalRole": "Administrator1","RemoteGroup": "Admingroup13"") . I am assuming that I need to do PATCH operation on the "RemoteRoleMapping" with the updated list. curl --insecure -k -H "X-Auth-Token: $test_token" -X PATCH https://${BMC_IP}/redfish/v1/AccountService -d '{ "RemoteRoleMapping": [ {"LocalRole": "Administrator", "RemoteGroup": "Admingroup15"} ]}'
Is it the correct way, if no please suggest.
Yes, that will work because your PATCH will replace the array elements. But that one works because you're removing values at the end of the array. I'd suggest the syntax should probably be consistent regardless of where you're removing values. To leave an array element unchanged during patch, you use an empty object, and to delete an array element, you use null. So I'd show your curl command using: "RemoteRoleMapping": [ {}, null ] And using your example to remove the first element, but leaving the second one unchanged: PATCH "RemoteRoleMapping": [ null, {} ] would result in: "RemoteRoleMapping": [ {"LocalRole": "Administrator1","RemoteGroup": "Admingroup13"} ]
|
|
|
Post by ratagupt on Feb 6, 2019 6:09:40 GMT
But suppose if my list is huge and having hundreds of item, and I want to delete one of them.
Let's take an eg:
"RemoteRoleMapping": [
{"LocalRole1": "Administrator1","RemoteGroup": "Admingroup13"}
. . . {"LocalRole10":""}
]
Above list having 10 items and want to delete the 8th one.
Should I PATCH like below?
PATCH "RemoteRoleMapping": [ {}, {},{},{},{},{},{},null,{},{}]
Ratan
|
|
|
Post by nagaraju418 on Feb 6, 2019 11:02:39 GMT
Suppose, If I want to nullify all LDAP related data(properties) how can I do that ?
|
|
|
Post by ratagupt on Feb 8, 2019 3:54:51 GMT
Suppose, If I want to nullify all LDAP related data(properties) how can I do that ? We had two options here, Either set the null value to the LDAP property but I can see in the schema that this(LDAP) property can't be null
<Property Name="LDAP" Type="AccountService.v1_3_0.ExternalAccountProvider" Nullable="false">
which means we can't do like below PATCH {"LDAP": null} however I am hoping that the following PATCH can be used to nullify the LDAP property
PATCH {"LDAP": {"AccountProviderType": null, "ServiceEnabled":null, "ServiceAddresses": null, "Authentication" : null, "LDAPService": null, "RemoteRoleMapping": null}}
|
|
|
Post by jautor on Feb 15, 2019 6:29:27 GMT
Are you trying to allow a user to effectively erase (reset to default) the LDAP configuration?
NULL will not be the correct approach for user-settable fields - those will need to be set to empty strings or other default "not set" values. Arrays can be cleared using null for each element.
I would not expect a service to support setting properties to null in most cases.
Jeff
|
|
|
Post by ratagupt on Feb 15, 2019 16:57:40 GMT
Thx Jeff for the reply.
> Are you trying to allow a user to effectively erase (reset to default) the LDAP configuration? Yes > NULL will not be the correct approach for user-settable fields - those will need to be set to empty strings or other default "not set" values. Arrays can be cleared using null for each element. I thought of instead of setting each property to an empty string, some easy way to clear out the complex property. Anyways we would implement like that.
I also wanted to ask, Is it the right forum to ask such queries or there is some other forum/process?
Ratan
|
|
|
Post by jautor on Feb 20, 2019 16:58:26 GMT
I thought of instead of setting each property to an empty string, some easy way to clear out the complex property. Anyways we would implement like that. I also wanted to ask, Is it the right forum to ask such queries or there is some other forum/process? Ratan
This is the right forum to ask these questions. But if you'd like to submit an enhancement proposal for the specification or the schema, you should submit a proposal to the DMTF feedback portal here: www.dmtf.org/standards/feedback
And we'd always suggest that your company join the DMTF to participate in the Redfish standard directly!
For your specific use case, perhaps the addition of an Action to "ResetAccountConfiguration" with some subset as a parameter [LDAP, AD, External] to do this?
I'm not sure this use case would occur enough to push that functionality onto the Service, rather than having the client perform the necessary PATCH, though. I'll take a look to see if there's value in the 'default' settings for these properties to see if that's something would otherwise not be known to the client (internal to the implementation, and not otherwise exposed if the default values have been changed.)
Jeff
|
|
|
Post by ratagupt on Feb 22, 2019 15:23:29 GMT
Thx Jeff
|
|