cloudfabrix / api-postman

SDK library for integrating with CloudFabrix RDA API - Example Postman collection
0 stars 0 forks source link

Organization name is empty when user_group is added, through User_Group POST api. #12

Closed smitesh-cfx closed 1 month ago

smitesh-cfx commented 3 months ago

Screenshot from 2024-05-22 11-00-24

below is the input data passed for user_group creation. data = { "chatbot_policy":"policy", "description":"msp admin user group for API automation", "name":"msp_admin_user_group_12345", "profile":"msp-admin", "selection_type":"tabular_report", "projects":[ { "customerName":"CloudFabrix", "customerId":"94aeb154db9a41ff90050a18c93cacc5" } ], "tenantId":"2572046a-1f45-4d3b-b4f2-56de44a5db77" }

get user group created from above input data, below the project name is empty but projectID is correct. get_user_group = { "chatbot_policy": null, "contactEmail": null, "createdAt": "2024-05-22T05:14:35", "description": null, "name": "msp_admin_user_group_12345", "profile": "msp-admin", "project_cfxql": null, "project_names": "", "projects": "94aeb154db9a41ff90050a18c93cacc5", "role": "msp-admin", "status": "Active", "tags": [], "tenantId": "2572046a-1f45-4d3b-b4f2-56de44a5db77" }

srikrishna-cfx commented 3 months ago

@smitesh-cfx, we need to provide the organization ID (projectId) as customerId. Currently, we don't have validation checks for the inputs provided, which we will add in the next release.

You can check the document below for details and examples of input parameters https://github.com/cloudfabrix/api-postman/blob/main/cookbooks/user_group_management.md

Rajulkr commented 2 months ago

@smitesh-cfx please review above comments and close

smitesh-cfx commented 2 months ago

reviewed the comments @Rajulkr , still the support for validations checks is pending as per @srikrishna-cfx
please update here when the support has been added.

srikrishna-cfx commented 2 months ago

@smitesh-cfx we need to add validation checks in all places, which we are planning to do later. The issue is that the organization name is empty when a user group is added; this should work with the customerId in the inputs as mentioned above.

gopalkpd commented 1 month ago

Added fix to AddUserGroup API to validate the input data and return error with appropriate validation messages for invalid 'project_cfxql', 'customerId' in 'projects], 'data_access_policy' and 'tags'. Sample API Requests and Response are listed below.

Request with Invalid cfxql filter:

{ "name": "gk-cp4", "profile": "msp-admin", "selection_type": "cfxql_filter", "project_cfxql": "customerName 'acm'" }

Response:

{ "detail": "Bad cfxql for organization filter at: customerName |'acm'" }

Sample Request with Invalid Data:

{ "name": "gk-cp4", "profile": "msp-admin", "selection_type": "tabular_report", "projects": [{"customerId": "b8867-b347-4c07-a859-aee167fb"}], "data_access_policy" : [{"name": "licy-name-bcs-oi-invent"}], "tags": [{"tags": "TAG_a"}] }

Sample Responses with 'Internal Server Error' for requests with invalid data:

{ "detail": "Unknown Organization(s) specified as customerId: ['b8867-b347-4c07-a859-aee167fb']. Valid Organization(s): ['f6678867-b347-4c07-a859-aee167fb5ce7']" }

{ "detail": "Unknown Data Access Policy specified: licy-name-bcs-oi-invent. Valid Data Access Policies: ['policy-name-bcs-oi-inventory', 'policy-name-cisco-device-inventory']" }

{ "detail": "Unknown Tags specified: ['TAG_a']. Valid Tags: ['TAG_aia']" }

gopalkpd commented 1 month ago

Fixed Delete UserGroup API failure. Please test that as well.

Delete UserGroup API is failing with exception from ResourceManager saying Tenant Id is expected. 
But API Model doesn't require it. It just requires the Group name.

With the fix, the API can be called with just the Group Name.
gopalkpd commented 1 month ago

PR Merged to rda-dev. https://bitbucket.org/cloudfabrix/cfx-library-modules/pull-requests/1994

Rajulkr commented 1 month ago

@smitesh-cfx to test

Rajulkr commented 1 month ago

@smitesh-cfx any update here ?

smitesh-cfx commented 1 month ago

tested and working @Rajulkr