**************** ``aas_registry`` **************** :py:mod:`aas_client3_2.aas_registry` implements the Asset Administration Shell Registry API: it stores the descriptors of the shells, which tell where each shell lives, and which interface its endpoint speaks. A client looks up the descriptor, and then talks to the shell at its endpoint (see :doc:`aas`). .. code-block:: python import requests import aas_core3_2.types as aas_types from aas_client3_2 import ( aas_registry as aas_client_aas_registry, http as aas_client_http, requests_transport as aas_client_requests_transport, ) transport = aas_client_requests_transport.RequestsTransport( requests.Session() ) server = aas_client_http.Server( transport=transport, base_url="http://localhost:5007" ) Register a Shell ================ The descriptor of a shell lists its endpoints. The address of an endpoint, ``href``, is the address of the shell itself; here, a shell in the AAS Repository at ``http://localhost:5004``, whose identifier is encoded in the path: .. code-block:: python shell_id = "https://example.com/ids/aas/getting-started/registry" descriptor = aas_types.AssetAdministrationShellDescriptor( id=shell_id, id_short="Compressor", global_asset_id="https://example.com/ids/asset/compressor-0001", endpoints=[ aas_types.Endpoint( interface="AAS-3.2", protocol_information=aas_types.ProtocolInformation( href="http://localhost:5004/shells/" + aas_client_http.encode_base64url(shell_id), endpoint_protocol="HTTP", ), ) ], ) Post the descriptor to register the shell: .. code-block:: python aas_client_aas_registry.post_asset_administration_shell_descriptor( server, descriptor ) Or put it, which registers the shell, or replaces the descriptor if the shell has been registered before. This is practical for a service which registers its shell whenever it starts: .. code-block:: python aas_client_aas_registry.put_asset_administration_shell_descriptor_by_id( server, shell_id, descriptor ) Look It Up ========== .. code-block:: python got = aas_client_aas_registry.get_asset_administration_shell_descriptor_by_id( server, shell_id ) for endpoint in got.over_endpoints_or_empty(): print(endpoint.interface, endpoint.protocol_information.href) List all the descriptors of the instances, page by page (see :doc:`../pagination`): .. code-block:: python page = aas_client_aas_registry.get_all_asset_administration_shell_descriptors( server, asset_kind=aas_types.AssetKind.INSTANCE, limit=10 ) The descriptors of the submodels of a shell are managed through the shell, for example, with :py:func:`~aas_client3_2.aas_registry.post_submodel_descriptor_through_superpath`. To register many shells at once, use the bulk operations, see :doc:`async_bulk`. Clean Up ======== Delete what we created in this chapter, so that you can run the code of this chapter again. The identifiers are unique, so the server would refuse to create the descriptor a second time: .. code-block:: python aas_client_aas_registry.delete_asset_administration_shell_descriptor_by_id( server, shell_id )