okta/okta-sdk-python

Bug when calling zon API - NetworkZoneClient.list_network_zones() - exception raised

leha007 opened this issue · 2 comments

Calling zone API (list_network_zones()) on my OKTA preview tenant with default zones in it:
image
Getting exception from the API call:

okta_api.errors.okta_errors_generic.OktaGenericError: 0

From the debugging it's clearly seen that the method expects to get collection of type list but getting dictionary instead.
image

This line throws the error

if not OktaCollection.is_formed(collection[index], data_type):

Problem originates from here

class NetworkZone(
    OktaObject
)
...
self.asns = OktaCollection.form_list(
                config["asns"] if "asns"\
                    in config else [],
                str
            )

Data got from OKTA

{
   "type":"DYNAMIC_V2",
   "id":".<reducted>",
   "name":"DefaultEnhancedDynamicZone",
   "status":"INACTIVE",
   "usage":"BLOCKLIST",
   "created":"2024-08-09T01:16:38.000Z",
   "lastUpdated":"2024-08-11T15:31:59.000Z",
   "system":true,
   "locations":{
      "include":[
         
      ],
      "exclude":[
         
      ]
   },
   "ipServiceCategories":{
      "include":[
         "ALL_ANONYMIZERS"
      ],
      "exclude":[
         
      ]
   },
   "asns":{
      "include":[
         
      ],
      "exclude":[
         
      ]
   },
   "links":{
      "activate":{
         "href":"https://<reducted>.oktapreview.com/api/v1/zones/<reducted>/lifecycle/activate",
         "hints":{
            "allow":[
               "POST"
            ]
         }
      },
      "self":{
         "href":"https://<reducted>.oktapreview.com/api/v1/zones/<reducted>",
         "hints":{
            "allow":[
               "GET",
               "PUT",
               "DELETE"
            ]
         }
      }
   }
}

OKTA package version 2.9.7