cloudvision.Connector.grpc_client package
Submodules
cloudvision.Connector.grpc_client.grpcClient module
- class cloudvision.Connector.grpc_client.grpcClient.GRPCClient(grpcAddr: str, *, certs: str | None = None, key: str | None = None, ca: str | None = None, token: str | None = None, tokenValue: str | None = None, certsValue: str | None = None, keyValue: str | None = None, caValue: str | None = None, channel_options: Dict[str, Any] = {})[source]
Bases:
object
GRPCClient implements the protobuf client as well as its methods. grpcAddr must be a valid apiserver address in the format <ADDRESS>:<PORT>. certs, if present, must be the path to the cert file. key, if present, must be the path to a .pem key file. ca, if present, must be the path to a root certificate authority file. token, if present, must be the path a .tok user access token. tokenValue, if present, is the actual token in string form. Cannot be set with token certsValue, if present, is the actual certs in string form. Cannot be set with certs keyValue, if present, is the actual key in string form. Cannot be set with key caValue, if present, is the actual ca in string form. Cannot be set with ca
- AUTH_KEY_PATH = 'access_token'
- DEFAULT_CHANNEL_OPTIONS = {'grpc.enable_retries': 1, 'grpc.http2.max_pings_without_data': 0, 'grpc.keepalive_time_ms': 60000, 'grpc.primary_user_agent': 'cloudvision.Connector/1.23.4'}
- GRPC_RETRY_POLICY_JSON = '{"methodConfig": [{"name": [{"service": ""}], "retryPolicy": {"maxAttempts": 5, "initialBackoff": "1s", "maxBackoff": "16s", "backoffMultiplier": 2.0, "retryableStatusCodes": ["UNAVAILABLE"]}}]}'
- create_custom_schema_index_request(d_name, path_elements, schema, delete_after_days, d_type) CustomIndexSchema [source]
Create custom index schema request from given imputs.
- Parameters:
d_name – Dataset name on aeris
path_elements – Path elements for which schema needs to be set
schema – Schema to be set
delete_after_days – Number of days after which data would be deleted
d_type – Type of the dataset
- Returns:
Custom index schema request
- get(queries: List[Query], start: Timestamp | datetime | None = None, end: Timestamp | datetime | None = None, versions=0, sharding=None, exact_range=False)[source]
Get creates and executes a Get protobuf message, returning a stream of notificationBatch. queries must be a list of querry protobuf messages. start and end, if present, must be nanoseconds timestamps (uint64). sharding, if present must be a protobuf sharding message.
- get_datasets(types: List[str] | None = None)[source]
GetDatasets retrieves all the datasets streaming on CloudVision. types, if present, filter the queried dataset by types
- publish(dId, notifs: List[Notification], dtype: str = 'device', sync: bool = True, compare: Tuple[Any, Any] | None = None) None [source]
Publish creates and executes a Publish protobuf message. refer to cloudvision/Connector/protobufs/router.proto:124 default to sync publish being true so that changes are reflected
- reenroll(cert_path: str, key_path: str) bytes [source]
Reenroll the existing certificate.
Caller can pass their current key and certificate and receive a renewed certificate in return. The default validity of the renewed certificate is 90 days.
- Parameters:
cert_path – Certificate file path
key_path – Private Key file path
- Returns:
Renewed Certificate in ASN.1 DER
- search(search_type=4, d_type: str = 'device', d_name: str = '', result_size: int = 1, start: Timestamp | datetime | None = None, end: Timestamp | datetime | None = None, path_elements=[], key_filters: Iterable[Filter] = [], value_filters: Iterable[Filter] = [], exact_range: bool = False, offset: int = 0, exact_term: bool = False, sort: Iterable[Sort] = [], count_only: bool = False)[source]
- set_custom_schema(d_name: str, path_elements: Iterable[str], schema: Iterable[IndexField], delete_after_days: int = 34, d_type: str = 'device') Empty [source]
Set custom index schema for given path.
- Parameters:
d_name – Dataset name on aeris
path_elements – Path elements for which schema needs to be set
schema – Schema to be set
delete_after_days – Number of days after which data would be deleted
d_type – Type of the dataset
- Returns:
Empty message
- cloudvision.Connector.grpc_client.grpcClient.create_notification(ts: Timestamp | datetime, paths: List[Any], deletes: List[Any] | None = None, updates: List[Tuple[Any, Any]] | None = None, retracts: List[Any] | None = None) Notification [source]
create_notification creates a notification protobuf message. ts must be a google.protobuf.timestamp_pb2.Timestamp or a python datetime object. paths must be a list of path elements. deletes and retracts, if present, must be lists of keys. updates, if present, must be of the form [(key, value)…].
Module contents
- class cloudvision.Connector.grpc_client.GRPCClient(grpcAddr: str, *, certs: str | None = None, key: str | None = None, ca: str | None = None, token: str | None = None, tokenValue: str | None = None, certsValue: str | None = None, keyValue: str | None = None, caValue: str | None = None, channel_options: Dict[str, Any] = {})[source]
Bases:
object
GRPCClient implements the protobuf client as well as its methods. grpcAddr must be a valid apiserver address in the format <ADDRESS>:<PORT>. certs, if present, must be the path to the cert file. key, if present, must be the path to a .pem key file. ca, if present, must be the path to a root certificate authority file. token, if present, must be the path a .tok user access token. tokenValue, if present, is the actual token in string form. Cannot be set with token certsValue, if present, is the actual certs in string form. Cannot be set with certs keyValue, if present, is the actual key in string form. Cannot be set with key caValue, if present, is the actual ca in string form. Cannot be set with ca
- AUTH_KEY_PATH = 'access_token'
- DEFAULT_CHANNEL_OPTIONS = {'grpc.enable_retries': 1, 'grpc.http2.max_pings_without_data': 0, 'grpc.keepalive_time_ms': 60000, 'grpc.primary_user_agent': 'cloudvision.Connector/1.23.4'}
- GRPC_RETRY_POLICY_JSON = '{"methodConfig": [{"name": [{"service": ""}], "retryPolicy": {"maxAttempts": 5, "initialBackoff": "1s", "maxBackoff": "16s", "backoffMultiplier": 2.0, "retryableStatusCodes": ["UNAVAILABLE"]}}]}'
- create_custom_schema_index_request(d_name, path_elements, schema, delete_after_days, d_type) CustomIndexSchema [source]
Create custom index schema request from given imputs.
- Parameters:
d_name – Dataset name on aeris
path_elements – Path elements for which schema needs to be set
schema – Schema to be set
delete_after_days – Number of days after which data would be deleted
d_type – Type of the dataset
- Returns:
Custom index schema request
- get(queries: List[Query], start: Timestamp | datetime | None = None, end: Timestamp | datetime | None = None, versions=0, sharding=None, exact_range=False)[source]
Get creates and executes a Get protobuf message, returning a stream of notificationBatch. queries must be a list of querry protobuf messages. start and end, if present, must be nanoseconds timestamps (uint64). sharding, if present must be a protobuf sharding message.
- get_datasets(types: List[str] | None = None)[source]
GetDatasets retrieves all the datasets streaming on CloudVision. types, if present, filter the queried dataset by types
- publish(dId, notifs: List[Notification], dtype: str = 'device', sync: bool = True, compare: Tuple[Any, Any] | None = None) None [source]
Publish creates and executes a Publish protobuf message. refer to cloudvision/Connector/protobufs/router.proto:124 default to sync publish being true so that changes are reflected
- reenroll(cert_path: str, key_path: str) bytes [source]
Reenroll the existing certificate.
Caller can pass their current key and certificate and receive a renewed certificate in return. The default validity of the renewed certificate is 90 days.
- Parameters:
cert_path – Certificate file path
key_path – Private Key file path
- Returns:
Renewed Certificate in ASN.1 DER
- search(search_type=4, d_type: str = 'device', d_name: str = '', result_size: int = 1, start: Timestamp | datetime | None = None, end: Timestamp | datetime | None = None, path_elements=[], key_filters: Iterable[Filter] = [], value_filters: Iterable[Filter] = [], exact_range: bool = False, offset: int = 0, exact_term: bool = False, sort: Iterable[Sort] = [], count_only: bool = False)[source]
- set_custom_schema(d_name: str, path_elements: Iterable[str], schema: Iterable[IndexField], delete_after_days: int = 34, d_type: str = 'device') Empty [source]
Set custom index schema for given path.
- Parameters:
d_name – Dataset name on aeris
path_elements – Path elements for which schema needs to be set
schema – Schema to be set
delete_after_days – Number of days after which data would be deleted
d_type – Type of the dataset
- Returns:
Empty message
- cloudvision.Connector.grpc_client.create_notification(ts: Timestamp | datetime, paths: List[Any], deletes: List[Any] | None = None, updates: List[Tuple[Any, Any]] | None = None, retracts: List[Any] | None = None) Notification [source]
create_notification creates a notification protobuf message. ts must be a google.protobuf.timestamp_pb2.Timestamp or a python datetime object. paths must be a list of path elements. deletes and retracts, if present, must be lists of keys. updates, if present, must be of the form [(key, value)…].