:py:mod:`ivcap_client.ivcap` ============================ .. py:module:: ivcap_client.ivcap Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: ivcap_client.ivcap.IVCAP Attributes ~~~~~~~~~~ .. autoapisummary:: ivcap_client.ivcap.URN .. py:data:: URN .. py:class:: IVCAP(url: Optional[str] = None, token: Optional[str] = None, account_id: Optional[str] = None) A class to represent a particular IVCAP deployment and it's capabilities .. py:property:: url :type: str Returns the URL of the IVCAP deployment :returns: URL of IVCAP deployment :rtype: str .. py:method:: list_services(*, filter: Optional[str] = None, limit: Optional[int] = 10, order_by: Optional[str] = None, order_desc: Optional[bool] = False, at_time: Optional[datetime.datetime.datetime] = UNSET) -> Iterator[ivcap_client.service.Service] Return an iterator over all the available services fulfilling certain constraints. :param limit: The 'limit' query option sets the maximum number of items to be included in the result. Default: 10. Example: 10. :type limit: Optional[int] :param filter_: The 'filter' system query option allows clients to filter a collection of resources that are addressed by a request URL. The expression specified with 'filter' is evaluated for each resource in the collection, and only items where the expression evaluates to true are included in the response. Example: name ~= 'Scott%'. :type filter_: Optional[str] :param order_by: The 'orderby' query option allows clients to request resources in either ascending order using asc or descending order using desc. If asc or desc not specified, then the resources will be ordered in ascending order. The request below orders Trips on property EndsAt in descending order. Example: orderby=EndsAt. :type order_by: Optional[str] :param order_desc: When set order result in descending order. Ascending order is the lt. Default: False. :type order_desc: Optional[bool] :param at_time: Return the state of the respective resources at that time [now] Example: 1996-12-19T16:39:57-08:00. :type at_time: Optional[datetime.datetime] :returns: An iterator over a list of services :rtype: Iterator[Service] :Yields: *Service* -- A Service object .. py:method:: get_service_by_name(name: str) -> ivcap_client.service.Service Return a Service instance named 'name' :param name: Name of service requested :type name: str :raises ResourceNotFound: Service is not found :raises AmbiguousRequest: More than one service is found for 'name' :returns: The Service instance for the requested service :rtype: Service .. py:method:: get_service(service_id: URN) -> ivcap_client.service.Service Returns a Service instance for service 'service_id' :param service_id: URN of service :type service_id: URN :returns: Returns a Service instance if service exists :rtype: Service .. py:method:: list_orders(*, filter: Optional[str] = None, limit: Optional[int] = 10, order_by: Optional[str] = None, order_desc: Optional[bool] = False, at_time: Optional[datetime.datetime.datetime] = UNSET) -> Iterator[ivcap_client.order.Order] Return an iterator over all the available orders fulfilling certain constraints. :param limit: The 'limit' query option sets the maximum number of items to be included in the result. Default: 10. Example: 10. :type limit: Optional[int] :param filter_: The 'filter' system query option allows clients to filter a collection of resources that are addressed by a request URL. The expression specified with 'filter' is evaluated for each resource in the collection, and only items where the expression evaluates to true are included in the response. Example: name ~= 'Scott%'. :type filter_: Optional[str] :param order_by: The 'orderby' query option allows clients to request resources in either ascending order using asc or descending order using desc. If asc or desc not specified, then the resources will be ordered in ascending order. The request below orders Trips on property EndsAt in descending order. Example: orderby=EndsAt. :type order_by: Optional[str] :param order_desc: When set order result in descending order. Ascending order is the lt. Default: False. :type order_desc: Optional[bool] :param at_time: Return the state of the respective resources at that time [now] Example: 1996-12-19T16:39:57-08:00. :type at_time: Optional[datetime.datetime] :returns: An iterator over a list of orders :rtype: Iterator[Order] :Yields: *Order* -- An order object .. py:method:: get_order(order_id: URN) -> ivcap_client.order.Order Returns a Service instance for service 'service_id' :param order_id: URN of order :type order_id: URN :returns: Returns an Order instance if order exists :rtype: Order .. py:method:: add_aspect(entity: str, aspect: Dict[str, any], *, schema: Optional[str] = None, policy: Optional[URN] = None) -> ivcap_client.aspect.Aspect Add an 'aspect' to an 'entity'. The 'schema' of the aspect, if not defined is expected to found in the 'aspect' under the '$schema' key. :param entity: URN of the entity to attach the aspect to :type entity: str :param aspect: The aspect to be attached :type aspect: dict :param schema: Schema of the aspect. Defaults to 'aspect["$schema"]'. :type schema: Optional[str], optional :param policy: Optional[URN]: Set specific policy controlling access ('urn:ivcap:policy:...'). :returns: The created aspect record :rtype: aspect .. py:method:: update_aspect(entity: str, aspect: Dict[str, any], *, schema: Optional[str] = None, policy: Optional[URN] = None) -> ivcap_client.aspect.Aspect Create an 'aspect' to an 'entity', but also retract a potentially existing aspect for the same entity with the same schema. The 'schema' of the aspect, if not defined is expected to found in the 'aspect' under the '$schema' key. :param entity: URN of the entity to attach the aspect to :type entity: str :param aspect: The aspect to be attached :type aspect: dict :param schema: Schema of the aspect. Defaults to 'aspect["$schema"]'. :type schema: Optional[str], optional :param policy: Optional[URN]: Set specific policy controlling access ('urn:ivcap:policy:...'). :returns: The created aspect record :rtype: aspect .. py:method:: list_aspects(*, entity: Optional[str] = None, schema: Optional[str] = None, content_path: Optional[str] = None, at_time: Optional[datetime.datetime.datetime] = None, limit: Optional[int] = 10, filter: Optional[str] = None, order_by: Optional[str] = 'valid_from', order_direction: Optional[str] = 'DESC', include_content: Optional[bool] = True) -> Iterator[ivcap_client.aspect.Aspect] Return an iterator over all the aspect records fulfilling certain constraints. :param entity: Optional entity for which to request aspects Example: urn:blue:image.collA#12. :type entity: Optional[str] :param schema: Schema prefix using '%' as wildcard indicator Example: urn:blue:schema:image%. :type schema: Optional[str] :param content_path: To learn more about the supported format, see https://www.postgresql.org/docs/current/datatype-json.html#DATATYPE-JSONPATH Example: $.images[*] ? (@.size > 10000). :type content_path: Optional[str] :param at_time: Return aspect which where valid at that time [now] Example: 1996-12-19T16:39:57-08:00. :type at_time: Optional[datetime.datetime] :param limit: The 'limit' system query option requests the number of items in the queried collection to be included in the result. Default: 10. Example: 10. :type limit: Optional[int] :param filter_: The 'filter' system query option allows clients to filter a collection of resources that are addressed by a request URL. The expression specified with 'filter' is evaluated for each resource in the collection, and only items where the expression evaluates to true are included in the response. Default: ''. Example: FirstName eq 'Scott'. :type filter_: Optional[str] :param order_by: Optional comma-separated list of attributes to sort the list by. * entity * schema * content * policy * account * created_by * retracted_by * replaces * valid_from * valid_to Default: 'valid_from'. Example: entity,created-at. :type order_by: Optional[str] :param order_direction: Set the sort direction 'ASC', 'DESC' for each order- by element. Default: 'DESC'. Example: desc. :type order_direction: Optional[str] :param include_content: When set, also include aspect content in list. :type include_content: Optional[bool] :returns: An iterator over a list of aspect records :rtype: Iterator[Aspect] :Yields: *Aspect* -- A aspect object .. py:method:: list_artifacts(*, filter: Optional[str] = None, limit: Optional[int] = 10, order_by: Optional[str] = None, order_desc: Optional[bool] = False, at_time: Optional[datetime.datetime.datetime] = UNSET) -> Iterator[ivcap_client.artifact.Artifact] Return an iterator over all the available artifacts fulfilling certain constraints. :param limit: The 'limit' query option sets the maximum number of items to be included in the result. Default: 10. Example: 10. :type limit: Optional[int] :param filter_: The 'filter' system query option allows clients to filter a collection of resources that are addressed by a request URL. The expression specified with 'filter' is evaluated for each resource in the collection, and only items where the expression evaluates to true are included in the response. Example: name ~= 'Scott%'. :type filter_: Optional[str] :param order_by: The 'orderby' query option allows clients to request resources in either ascending order using asc or descending order using desc. If asc or desc not specified, then the resources will be ordered in ascending order. The request below orders Trips on property EndsAt in descending order. Example: orderby=EndsAt. :type order_by: Optional[str] :param order_desc: When set order result in descending order. Ascending order is the lt. Default: False. :type order_desc: Optional[bool] :param at_time: Return the state of the respective resources at that time [now] Example: 1996-12-19T16:39:57-08:00. :type at_time: Optional[datetime.datetime] :returns: An iterator over a list of services :rtype: Iterator[Service] :Yields: *Artifact* -- An artifact object .. py:method:: upload_artifact(*, name: Optional[str] = None, file_path: Optional[str] = None, io_stream: Optional[IO] = None, content_type: Optional[str] = None, content_size: Optional[int] = -1, collection: Optional[URN] = None, policy: Optional[URN] = None, chunk_size: Optional[int] = MAXSIZE, retries: Optional[int] = 0, retry_delay: Optional[int] = 30, force_upload: Optional[bool] = False) -> ivcap_client.artifact.Artifact Uploads content which is either identified as a `file_path` or `io_stream`. In the latter case, content type need to be provided. :param file_path: File to upload :type file_path: Optional[str] :param io_stream: Content as IO stream. :type io_stream: Optional[IO] :param content_type: Content type - needs to be declared for `io_stream`. :type content_type: Optional[str] :param content_size: Overall size of content to be uploaded. Defaults to -1 (don't know). :type content_size: Optional[int] :param collection: Optional[URN]: Additionally adds artifact to named collection ('urn:...'). :param policy: Optional[URN]: Set specific policy controlling access ('urn:ivcap:policy:...'). :param chunk_size: Chunk size to use for each individual upload. Defaults to MAXSIZE. :type chunk_size: Optional[int] :param retries: The number of attempts should be made in the case of a failed upload. Defaults to 0. :type retries: Optional[int] :param retry_delay: How long (in seconds) should we wait before retrying a failed upload attempt. Defaults to 30. :type retry_delay: Optional[int], optional :param force_upload: Upload file even if it has been uploaded before. :type force_upload: Optional[bool], optional .. py:method:: artifact_for_file(file_path: str) -> Optional[ivcap_client.artifact.Artifact] Return an Artifact instance if local file 'file_path' has already been uploaded as artifact. :param file_path: Path to local file :type file_path: str :returns: Return artifact instance if file has been uploaded, otherwise return None :rtype: Optional[Artifact] .. py:method:: get_artifact(id: URN) -> ivcap_client.artifact.Artifact Returns an Artifact instance for artifact 'id' :param id: URN of artifact :type id: URN :returns: Returns an Artifact instance if artifact exists :rtype: Artifact .. py:method:: search(query) Execute query provided in body and return a list of search result. :param at_time: Return search which where valid at that time [now] Example: 1996-12-19T16:39:57-08:00. :type at_time: datetime.datetime :param limit: The number of items to be included in the result. Default: 10. Example: 10. :type limit: int :raises errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. :raises httpx.TimeoutException: If the request takes longer than Client.timeout. :returns: Response[Union[Any, BadRequestT, InvalidParameterT, InvalidScopesT, SearchListRT]] .. py:method:: __repr__() Return repr(self).