List all known services. This will traverse the search path and look for all known services. :type type_name: str :param type_name: The type of the service (service-2, paginators-1, waiters-2, etc). This is needed because the list of availab
(self, type_name)
| 258 | |
| 259 | @instance_cache |
| 260 | def list_available_services(self, type_name): |
| 261 | """List all known services. |
| 262 | |
| 263 | This will traverse the search path and look for all known |
| 264 | services. |
| 265 | |
| 266 | :type type_name: str |
| 267 | :param type_name: The type of the service (service-2, |
| 268 | paginators-1, waiters-2, etc). This is needed because |
| 269 | the list of available services depends on the service |
| 270 | type. For example, the latest API version available for |
| 271 | a resource-1.json file may not be the latest API version |
| 272 | available for a services-2.json file. |
| 273 | |
| 274 | :return: A list of all services. The list of services will |
| 275 | be sorted. |
| 276 | |
| 277 | """ |
| 278 | services = set() |
| 279 | for possible_path in self._potential_locations(): |
| 280 | # Any directory in the search path is potentially a service. |
| 281 | # We'll collect any initial list of potential services, |
| 282 | # but we'll then need to further process these directories |
| 283 | # by searching for the corresponding type_name in each |
| 284 | # potential directory. |
| 285 | possible_services = [ |
| 286 | d |
| 287 | for d in os.listdir(possible_path) |
| 288 | if os.path.isdir(os.path.join(possible_path, d)) |
| 289 | ] |
| 290 | for service_name in possible_services: |
| 291 | full_dirname = os.path.join(possible_path, service_name) |
| 292 | api_versions = os.listdir(full_dirname) |
| 293 | for api_version in api_versions: |
| 294 | full_load_path = os.path.join( |
| 295 | full_dirname, api_version, type_name |
| 296 | ) |
| 297 | if self.file_loader.exists(full_load_path): |
| 298 | services.add(service_name) |
| 299 | break |
| 300 | return sorted(services) |
| 301 | |
| 302 | @instance_cache |
| 303 | def determine_latest_version(self, service_name, type_name): |