Skip to content

Commit

Permalink
feat: add ingest api
Browse files Browse the repository at this point in the history
  • Loading branch information
martasd committed Aug 16, 2022
1 parent c36ae7c commit 39576d9
Show file tree
Hide file tree
Showing 16 changed files with 878 additions and 527 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ Currently available functions:
- [Verify email](#verify-email)
- [Send new verification email](#send-new-verification-email-admin-service)
- [Change password](#change-password)
- [Ingest records](#ingest-records)

### Introspect token

Expand Down Expand Up @@ -524,5 +525,16 @@ def change_password(self, token, new_password):
print(response)
```

### Ingest records

```python
def ingest_records(self, config_id, records):
record_iterator = self.generate_records_request(config_id, records)
response_iterator = self.stub.StreamRecords(record_iterator)

for response in response_iterator:
print(response)
```

Happy hacking!

2 changes: 1 addition & 1 deletion jarvis_sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ in the [example_config.json](jarvis-proto-sdk/config_example.json) file.
If you run the package against a local system, then it requires an additional ca.pem file. To set the file's path,
please use the `CAPEM` variable point to the `ca.pem` file.

It is highly suggested that you use absolute paths for the files
It is highly suggested that you use absolute paths for the files.

### Running the sdk with the api.py script

Expand Down
16 changes: 4 additions & 12 deletions jarvis_sdk/cmd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,10 @@ def __init__(self, local=False):
self.stub = pb2_grpc.IdentityManagementAPIStub(channel=self.channel)

# Imported methods
from ._change_password import \
change_password_of_user, \
change_password
from ._get_digital_twin import \
get_digital_twin_by_token, \
get_digital_twin
from ._change_password import change_password_of_user, change_password
from ._get_digital_twin import get_digital_twin_by_token, get_digital_twin
from ._introspect_token import introspect_token
from ._patch_properties import patch_properties_by_token, patch_properties
from ._verification import \
start_digital_twin_email_verification, \
verify_digital_twin_email
from ._delete import \
del_digital_twin, \
del_digital_twin_by_token
from ._verification import start_digital_twin_email_verification, verify_digital_twin_email
from ._delete import del_digital_twin, del_digital_twin_by_token
from ._enrich_token import enrich_token
264 changes: 134 additions & 130 deletions jarvis_sdk/indykite/config/v1beta1/config_management_api_pb2.py

Large diffs are not rendered by default.

276 changes: 157 additions & 119 deletions jarvis_sdk/indykite/config/v1beta1/model_pb2.py

Large diffs are not rendered by default.

18 changes: 4 additions & 14 deletions jarvis_sdk/indykite/identity/v1beta1/attributes_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

271 changes: 136 additions & 135 deletions jarvis_sdk/indykite/identity/v1beta1/identity_management_api_pb2.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import grpc

from jarvis_sdk.indykite.identity.v1beta1 import identity_management_api_pb2 as indykite_dot_identity_dot_v1beta1_dot_identity__management__api__pb2
from jarvis_sdk.indykite.identity.v1beta1 import import_pb2 as indykite_dot_identity_dot_v1beta1_dot_import__pb2


class IdentityManagementAPIStub(object):
Expand Down Expand Up @@ -45,6 +46,11 @@ def __init__(self, channel):
request_serializer=indykite_dot_identity_dot_v1beta1_dot_identity__management__api__pb2.SelfServiceTerminateSessionRequest.SerializeToString,
response_deserializer=indykite_dot_identity_dot_v1beta1_dot_identity__management__api__pb2.SelfServiceTerminateSessionResponse.FromString,
)
self.ImportDigitalTwins = channel.unary_unary(
'/indykite.identity.v1beta1.IdentityManagementAPI/ImportDigitalTwins',
request_serializer=indykite_dot_identity_dot_v1beta1_dot_import__pb2.ImportDigitalTwinsRequest.SerializeToString,
response_deserializer=indykite_dot_identity_dot_v1beta1_dot_import__pb2.ImportDigitalTwinsResponse.FromString,
)
self.GetDigitalTwin = channel.unary_unary(
'/indykite.identity.v1beta1.IdentityManagementAPI/GetDigitalTwin',
request_serializer=indykite_dot_identity_dot_v1beta1_dot_identity__management__api__pb2.GetDigitalTwinRequest.SerializeToString,
Expand Down Expand Up @@ -219,6 +225,15 @@ def SelfServiceTerminateSession(self, request, context):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def ImportDigitalTwins(self, request, context):
"""ImportDigitalTwins imports multiple DigitalTwin into the IndyKite database.
No more than 1000 users can be imported in a single call.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def GetDigitalTwin(self, request, context):
"""GetDigitalTwin gets a DigitalTwin and requested properties.
Expand Down Expand Up @@ -420,6 +435,11 @@ def add_IdentityManagementAPIServicer_to_server(servicer, server):
request_deserializer=indykite_dot_identity_dot_v1beta1_dot_identity__management__api__pb2.SelfServiceTerminateSessionRequest.FromString,
response_serializer=indykite_dot_identity_dot_v1beta1_dot_identity__management__api__pb2.SelfServiceTerminateSessionResponse.SerializeToString,
),
'ImportDigitalTwins': grpc.unary_unary_rpc_method_handler(
servicer.ImportDigitalTwins,
request_deserializer=indykite_dot_identity_dot_v1beta1_dot_import__pb2.ImportDigitalTwinsRequest.FromString,
response_serializer=indykite_dot_identity_dot_v1beta1_dot_import__pb2.ImportDigitalTwinsResponse.SerializeToString,
),
'GetDigitalTwin': grpc.unary_unary_rpc_method_handler(
servicer.GetDigitalTwin,
request_deserializer=indykite_dot_identity_dot_v1beta1_dot_identity__management__api__pb2.GetDigitalTwinRequest.FromString,
Expand Down Expand Up @@ -638,6 +658,23 @@ def SelfServiceTerminateSession(request,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def ImportDigitalTwins(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/indykite.identity.v1beta1.IdentityManagementAPI/ImportDigitalTwins',
indykite_dot_identity_dot_v1beta1_dot_import__pb2.ImportDigitalTwinsRequest.SerializeToString,
indykite_dot_identity_dot_v1beta1_dot_import__pb2.ImportDigitalTwinsResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def GetDigitalTwin(request,
target,
Expand Down

0 comments on commit 39576d9

Please sign in to comment.