ivcap_client.ivcap

Module Contents

Classes

IVCAP

A class to represent a particular IVCAP deployment and it's capabilities

Attributes

URN

ivcap_client.ivcap.URN
class ivcap_client.ivcap.IVCAP(url: Optional[str] = None, token: Optional[str] = None, account_id: Optional[str] = None)[source]

A class to represent a particular IVCAP deployment and it’s capabilities

property url: str

Returns the URL of the IVCAP deployment

Returns:

URL of IVCAP deployment

Return type:

str

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][source]

Return an iterator over all the available services fulfilling certain constraints.

Parameters:
  • limit (Optional[int]) – The ‘limit’ query option sets the maximum number of items to be included in the result. Default: 10. Example: 10.

  • filter (Optional[str]) –

    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%’.

  • order_by (Optional[str]) –

    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.

  • order_desc (Optional[bool]) – When set order result in descending order. Ascending order is the lt. Default: False.

  • at_time (Optional[datetime.datetime]) – Return the state of the respective resources at that time [now] Example: 1996-12-19T16:39:57-08:00.

Returns:

An iterator over a list of services

Return type:

Iterator[Service]

Yields:

Service – A Service object

get_service_by_name(name: str) ivcap_client.service.Service[source]

Return a Service instance named ‘name’

Parameters:

name (str) – Name of service requested

Raises:
Returns:

The Service instance for the requested service

Return type:

Service

get_service(service_id: URN) ivcap_client.service.Service[source]

Returns a Service instance for service ‘service_id’

Parameters:

service_id (URN) – URN of service

Returns:

Returns a Service instance if service exists

Return type:

Service

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][source]

Return an iterator over all the available orders fulfilling certain constraints.

Parameters:
  • limit (Optional[int]) – The ‘limit’ query option sets the maximum number of items to be included in the result. Default: 10. Example: 10.

  • filter (Optional[str]) –

    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%’.

  • order_by (Optional[str]) –

    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.

  • order_desc (Optional[bool]) – When set order result in descending order. Ascending order is the lt. Default: False.

  • at_time (Optional[datetime.datetime]) – Return the state of the respective resources at that time [now] Example: 1996-12-19T16:39:57-08:00.

Returns:

An iterator over a list of orders

Return type:

Iterator[Order]

Yields:

Order – An order object

get_order(order_id: URN) ivcap_client.order.Order[source]

Returns a Service instance for service ‘service_id’

Parameters:

order_id (URN) – URN of order

Returns:

Returns an Order instance if order exists

Return type:

Order

add_aspect(entity: str, aspect: Dict[str, any], *, schema: Optional[str] = None, policy: Optional[URN] = None) ivcap_client.aspect.Aspect[source]

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.

Parameters:
  • entity (str) – URN of the entity to attach the aspect to

  • aspect (dict) – The aspect to be attached

  • schema (Optional[str], optional) – Schema of the aspect. Defaults to ‘aspect[“$schema”]’.

  • policy – Optional[URN]: Set specific policy controlling access (’urn:ivcap:policy:…’).

Returns:

The created aspect record

Return type:

aspect

update_aspect(entity: str, aspect: Dict[str, any], *, schema: Optional[str] = None, policy: Optional[URN] = None) ivcap_client.aspect.Aspect[source]

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.

Parameters:
  • entity (str) – URN of the entity to attach the aspect to

  • aspect (dict) – The aspect to be attached

  • schema (Optional[str], optional) – Schema of the aspect. Defaults to ‘aspect[“$schema”]’.

  • policy – Optional[URN]: Set specific policy controlling access (’urn:ivcap:policy:…’).

Returns:

The created aspect record

Return type:

aspect

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][source]

Return an iterator over all the aspect records fulfilling certain constraints.

Parameters:
  • entity (Optional[str]) – Optional entity for which to request aspects Example: urn:blue:image.collA#12.

  • schema (Optional[str]) – Schema prefix using ‘%’ as wildcard indicator Example: urn:blue:schema:image%.

  • content_path (Optional[str]) –

    To learn more about the supported format, see

    https://www.postgresql.org/docs/current/datatype-json.html#DATATYPE-JSONPATH Example:

    $.images[*] ? (@.size > 10000).

  • at_time (Optional[datetime.datetime]) – Return aspect which where valid at that time [now] Example: 1996-12-19T16:39:57-08:00.

  • limit (Optional[int]) –

    The ‘limit’ system query option requests the number of items in the queried

    collection to be included in the result. Default: 10. Example: 10.

  • filter (Optional[str]) –

    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’.

  • order_by (Optional[str]) – 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.

  • order_direction (Optional[str]) – Set the sort direction ‘ASC’, ‘DESC’ for each order- by element. Default: ‘DESC’. Example: desc.

  • include_content (Optional[bool]) – When set, also include aspect content in list.

Returns:

An iterator over a list of aspect records

Return type:

Iterator[Aspect]

Yields:

Aspect – A aspect object

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][source]

Return an iterator over all the available artifacts fulfilling certain constraints.

Parameters:
  • limit (Optional[int]) – The ‘limit’ query option sets the maximum number of items to be included in the result. Default: 10. Example: 10.

  • filter (Optional[str]) –

    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%’.

  • order_by (Optional[str]) –

    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.

  • order_desc (Optional[bool]) – When set order result in descending order. Ascending order is the lt. Default: False.

  • at_time (Optional[datetime.datetime]) – Return the state of the respective resources at that time [now] Example: 1996-12-19T16:39:57-08:00.

Returns:

An iterator over a list of services

Return type:

Iterator[Service]

Yields:

Artifact – An artifact object

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[source]

Uploads content which is either identified as a file_path or io_stream. In the latter case, content type need to be provided.

Parameters:
  • file_path (Optional[str]) – File to upload

  • io_stream (Optional[IO]) – Content as IO stream.

  • content_type (Optional[str]) – Content type - needs to be declared for io_stream.

  • content_size (Optional[int]) – Overall size of content to be uploaded. Defaults to -1 (don’t know).

  • collection – Optional[URN]: Additionally adds artifact to named collection (‘urn:…’).

  • policy – Optional[URN]: Set specific policy controlling access (’urn:ivcap:policy:…’).

  • chunk_size (Optional[int]) – Chunk size to use for each individual upload. Defaults to MAXSIZE.

  • retries (Optional[int]) – The number of attempts should be made in the case of a failed upload. Defaults to 0.

  • retry_delay (Optional[int], optional) – How long (in seconds) should we wait before retrying a failed upload attempt. Defaults to 30.

  • force_upload (Optional[bool], optional) – Upload file even if it has been uploaded before.

artifact_for_file(file_path: str) Optional[ivcap_client.artifact.Artifact][source]

Return an Artifact instance if local file ‘file_path’ has already been uploaded as artifact.

Parameters:

file_path (str) – Path to local file

Returns:

Return artifact instance if file has been uploaded, otherwise return None

Return type:

Optional[Artifact]

get_artifact(id: URN) ivcap_client.artifact.Artifact[source]

Returns an Artifact instance for artifact ‘id’

Parameters:

id (URN) – URN of artifact

Returns:

Returns an Artifact instance if artifact exists

Return type:

Artifact

search(query)[source]

Execute query provided in body and return a list of search result.

Parameters:
  • at_time (datetime.datetime) – Return search which where valid at that time [now] Example: 1996-12-19T16:39:57-08:00.

  • limit (int) – The number of items to be included in the result. Default: 10. Example: 10.

Raises:
  • errors.UnexpectedStatus – If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.

  • httpx.TimeoutException – If the request takes longer than Client.timeout.

Returns:

Response[Union[Any, BadRequestT, InvalidParameterT, InvalidScopesT, SearchListRT]]

__repr__()[source]

Return repr(self).