MCPcopy Index your code
hub / github.com/aws/aws-cli / load_service_model

Method load_service_model

awscli/botocore/loaders.py:356–406  ·  view source on GitHub ↗

Load a botocore service model This is the main method for loading botocore models (e.g. a service model, pagination configs, waiter configs, etc.). :type service_name: str :param service_name: The name of the service (e.g ``ec2``, ``s3``). :type type_name:

(self, service_name, type_name, api_version=None)

Source from the content-addressed store, hash-verified

354
355 @instance_cache
356 def load_service_model(self, service_name, type_name, api_version=None):
357 """Load a botocore service model
358
359 This is the main method for loading botocore models (e.g. a service
360 model, pagination configs, waiter configs, etc.).
361
362 :type service_name: str
363 :param service_name: The name of the service (e.g ``ec2``, ``s3``).
364
365 :type type_name: str
366 :param type_name: The model type. Valid types include, but are not
367 limited to: ``service-2``, ``paginators-1``, ``waiters-2``.
368
369 :type api_version: str
370 :param api_version: The API version to load. If this is not
371 provided, then the latest API version will be used.
372
373 :type load_extras: bool
374 :param load_extras: Whether or not to load the tool extras which
375 contain additional data to be added to the model.
376
377 :raises: UnknownServiceError if there is no known service with
378 the provided service_name.
379
380 :raises: DataNotFoundError if no data could be found for the
381 service_name/type_name.
382
383 :return: The loaded data, as a python type (e.g. dict, list, etc).
384 """
385 # Wrapper around the load_data. This will calculate the path
386 # to call load_data with.
387 known_services = self.list_available_services(type_name)
388 if service_name not in known_services:
389 raise UnknownServiceError(
390 service_name=service_name,
391 known_service_names=', '.join(sorted(known_services)),
392 )
393
394 if api_version is None:
395 api_version = self.determine_latest_version(
396 service_name, type_name
397 )
398
399 full_path = os.path.join(service_name, api_version, type_name)
400 model = self.load_data(full_path)
401
402 # Load in all the extras
403 extras_data = self._find_extras(service_name, type_name, api_version)
404 self._extras_processor.process(model, extras_data)
405
406 return model
407
408 def _find_extras(self, service_name, type_name, api_version):
409 """Creates an iterator over all the extras data."""

Calls 6

load_dataMethod · 0.95
_find_extrasMethod · 0.95
UnknownServiceErrorClass · 0.90
processMethod · 0.80