Skip to content

Commit

Permalink
feat: replace ingestv2 by ingestv3
Browse files Browse the repository at this point in the history
implementing: ENG-2911
  • Loading branch information
cowan-macady committed Feb 21, 2024
1 parent 2fb19e9 commit 8e4ba3e
Show file tree
Hide file tree
Showing 23 changed files with 410 additions and 382 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,6 @@ jobs:
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
files: coverage.xml
42 changes: 23 additions & 19 deletions indykite_sdk/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2603,15 +2603,17 @@ def main():
# replace with actual values
record_id = "96523658"
external_id = "external-dt-id22737"
kind = "DIGITAL_TWIN_KIND_PERSON"
type = "CarOwner"
ingest_property = client_ingest.ingest_property("something", "741")
properties = [ingest_property]
upsert = client_ingest.upsert_data_node_digital_twin(
upsert = client_ingest.upsert_data_node(
external_id,
type,
[],
properties)
properties,
"",
True
)
record = client_ingest.record_upsert(record_id, upsert)
ingest_record_digital_twin = client_ingest.ingest_record(record)
if ingest_record_digital_twin:
Expand All @@ -2627,11 +2629,13 @@ def main():
ingest_property = client_ingest.ingest_property("customProp100", "9654")
properties = [ingest_property]
tags = []
upsert = client_ingest.upsert_data_node_resource(
upsert = client_ingest.upsert_data_node(
external_id,
type,
tags,
properties)
properties,
"",
False)
record = client_ingest.record_upsert(record_id, upsert)
ingest_record_resource = client_ingest.ingest_record(record)
if ingest_record_resource:
Expand All @@ -2645,11 +2649,10 @@ def main():
type = "CAN_USE"
source_match = client_ingest.node_match("vehicle-1", "Vehicle")
target_match = client_ingest.node_match("lot-1", "ParkingLot")
match = client_ingest.relation_match(source_match, target_match, type)
ingest_property = client_ingest.ingest_property("customProp", "8742")
properties = [ingest_property]
upsert = client_ingest.upsert_data_relation(
match,
upsert = client_ingest.upsert_data_relationship(
source_match, target_match, type,
properties)
record = client_ingest.record_upsert(record_id, upsert)
ingest_record_relation = client_ingest.ingest_record(record)
Expand All @@ -2676,8 +2679,8 @@ def main():
type = "CAN_USE"
source_match = client_ingest.node_match("vehicle-1", "Vehicle")
target_match = client_ingest.node_match("lot-1", "ParkingLot")
relation = client_ingest.relation_match(source_match, target_match, type)
delete = client_ingest.delete_data_relation(relation)
relationship = client_ingest.relationship(source_match, target_match, type, [])
delete = client_ingest.delete_data_relation(relationship)
record = client_ingest.record_delete(record_id, delete)
delete_record_relation = client_ingest.ingest_record(record)
if delete_record_relation:
Expand All @@ -2689,8 +2692,8 @@ def main():
elif command == "delete_record_node_property":
record_id = "745890"
match = client_ingest.node_match("vehicle-1", "Vehicle")
key = "nodePropertyName"
node_property = client_ingest.node_property_match(match, key)
property_type = "nodePropertyName"
node_property = client_ingest.node_property_match(match, property_type)
delete = client_ingest.delete_data_node_property(node_property)
record = client_ingest.record_delete(record_id, delete)
delete_record_node_property = client_ingest.ingest_record(record)
Expand All @@ -2705,10 +2708,9 @@ def main():
type = "CAN_USE"
source_match = client_ingest.node_match("vehicle-1", "Vehicle")
target_match = client_ingest.node_match("lot-1", "ParkingLot")
match = client_ingest.relation_match(source_match, target_match, type)
key = "relationPropertyName"
relation_property = client_ingest.relation_property_match(match, key)
delete = client_ingest.delete_data_relation_property(relation_property)
property_type = "relationPropertyName"
relationship_property = client_ingest.relationship_property_match(source_match, target_match, type, property_type)
delete = client_ingest.delete_data_relation_property(relationship_property)
record = client_ingest.record_delete(record_id, delete)
delete_record_relation_property = client_ingest.ingest_record(record)
if delete_record_relation_property:
Expand All @@ -2725,11 +2727,13 @@ def main():
tags = []
ingest_property = client_ingest.ingest_property("customPropST1904", "741")
properties = [ingest_property]
upsert = client_ingest.upsert_data_node_digital_twin(
upsert = client_ingest.upsert_data_node(
external_id,
type,
tags,
properties)
properties,
"",
True)
record = client_ingest.record_upsert(record_id, upsert)

record_id2 = "114589905"
Expand All @@ -2738,7 +2742,7 @@ def main():
ingest_property = client_ingest.ingest_property("customProp905", "9654")
properties = [ingest_property]
tags = []
upsert2 = client_ingest.upsert_data_node_resource(
upsert2 = client_ingest.upsert_data_node(
external_id,
type,
tags,
Expand Down
8 changes: 6 additions & 2 deletions indykite_sdk/identity/token_introspect.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
from indykite_sdk.indykite.identity.v1beta2 import identity_management_api_pb2 as pb2
from indykite_sdk.model.token_info import TokenInfo
from indykite_sdk.model.token_info import IdentityTokenInfo, ThirdPartyIdentityTokenInfo
import indykite_sdk.utils.logger as logger


Expand All @@ -20,4 +20,8 @@ def token_introspect(self, user_token):
if not response or not response.active:
return None

return TokenInfo.deserialize(response.token_info)
if response.identity_token_info:
return IdentityTokenInfo.deserialize(response.identity_token_info)
elif response.third_party_identity_token:
return ThirdPartyIdentityTokenInfo.deserialize(response.third_party_identity_token)
return None
35 changes: 35 additions & 0 deletions indykite_sdk/indykite/auditsink/v1beta1/ai_pb2.py

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

4 changes: 4 additions & 0 deletions indykite_sdk/indykite/auditsink/v1beta1/ai_pb2_grpc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

246 changes: 123 additions & 123 deletions indykite_sdk/indykite/identity/v1beta2/identity_management_api_pb2.py

Large diffs are not rendered by default.

0 comments on commit 8e4ba3e

Please sign in to comment.