def __init__(self, http_provider, post_processors, rest_metadata_map=None, is_vapi_rest=True): """ Rest rpc client provider init :type http_provider: :class:`vmware.vapi.protocol.client.rpc.provider.HTTPProvider` :param http_provider: rpc provider object :type post_processors: :class:`list` of :class:`str` :param post_processors: List of post processor class names :type rest_metadata_map: :class:`dict` of (:class:`str`, :class:`str`) and :class:`vmware.vapi.lib.rest.OperationRestMetadata` :param rest_metadata_map: Rest metadata for all operations :type is_vapi_rest: :class:`bool` :param is_vapi_rest: Whether the Rest json message format is VAPI Rest or not """ ApiProvider.__init__(self) self._http_provider = http_provider self._rest_metadata_map = rest_metadata_map or {} self._is_vapi_rest = is_vapi_rest # Load all the post processors self.post_processors = [dynamic_import(p)() for p in post_processors]
def __init__(self, load_introspection=True): """ Initialize LocalProvider :type load_introspection: :class:`bool` :param load_introspection: If true, load introspection services """ ApiProvider.__init__(self) self._name = "LocalProvider" # key = service id, value = api interface self._service_map = {} self._introspector = introspection.LocalProviderIntrospector( self._name) if load_introspection: self.add_interface(self._introspector.get_introspection_services()) self._error_defs_to_augment = [ self._internal_server_error_def, self._invalid_argument_def, self._operation_not_found_def, ] # these are the errors that should be augmented # when `get` operation is invoked on # com.vmware.vapi.std.introspection.Operation self._error_values_to_augment = [ convert_data_def_to_data_value(error_def) for error_def in self._error_defs_to_augment ]
def __init__(self, http_provider, post_processors): """ Json rpc client provider init :type http_provider: :class:`vmware.vapi.protocol.client.rpc.provider.HTTPProvider` :param http_provider: rpc provider object :type post_processors: :class:`list` of :class:`str` :param post_processors: List of post processor class names """ ApiProvider.__init__(self) self.http_provider = http_provider self.counter = itertools.count() self.to_vapi = JsonRpcDictToVapi # Load all the post processors self.post_processors = [ constructor() for constructor in dynamic_import_list(post_processors) ]
def __init__(self, next_provider=None, errors_to_augment=None, name=None): """ Initialize ApiProviderFilter :type next_provider: :class:`vmware.vapi.core.ApiProvider` or ``None`` :param next_provider: API Provider to invoke the requests :type errors_to_augment: :class:`list` of :class:`vmware.vapi.data.definition.ErrorDefinition` or ``None`` :param errors_to_augment: List of error definitions to be added to method definitions :type name: :class:`str` :param name: The name of the filter """ ApiProvider.__init__(self) self.name = name if name is not None else self.__class__.__name__ self.next_provider = next_provider self._error_defs_to_augment = errors_to_augment or [] self._error_values_to_augment = [ convert_data_def_to_data_value(error_def) for error_def in self._error_defs_to_augment ]
def __init__(self): ApiProvider.__init__(self) self._name = 'ApiAggregator' # key = service_id, value = api interface self._service_id_map = {} # key : name, value : provider self._providers = {} # key : name, value : connection info self._provider_data = {} # List of all the services present in the local provider self._local_service_ids = [] self._introspection_service_names = [ Introspection.PROVIDER_SVC, Introspection.SERVICE_SVC, Introspection.OPERATION_SVC ] self._introspector = None self._authn_chain_processors = []