Fiware: NGSI v2 susbcription: getting notified only about the attribute that has changed - fiware

I have this subscription:
{
"id": "5a27abba56256c402cec5654",
"description": "my subscription",
"status": "active",
"subject": {
"entities": [
{
"idPattern": ".*"
}
],
"condition": {
"attrs": []
}
},
"notification": {
"timesSent": 56939,
"lastNotification": "2018-01-29T09:06:45.00Z",
"attrs": [],
"attrsFormat": "normalized",
"http": {
"url": "http://notif_url"
},
"lastFailure": "2018-01-24T15:10:08.00Z",
"lastSuccess": "2018-01-29T09:06:45.00Z"
}
}
Using it I can get notified about new entities whithout specifiying a particular entity ID.
The problem is that when one entity attribute changes I get notified about all attributes.
Is it possible to get notified only about the attribute that has changed and keeping in the same time the possibility to discover new entities?
Something like in if attribut x changed in the condition part, get notified about it:
"condition": {
"attrs": [attribute_X]
}
"notification": {
"attrs": [attribute_X]
}
Thanks!

It works the way you mention. I mean, using:
"condition": {
"attrs": [ "attribute_X" ]
}
...
"notification": {
"attrs": [ "attribute_X" ]
}
Whenever attribute named attribute_X changes (or appears first time, typically at entity creation time) you will receive a notification including only attribute_X

Related

How to operate with json list in CMake?

I have the following code which I'm trying to read in CMake.
{
"demo": [
{
"name": "foo0",
"url": "url1",
"verify_ssl": true
},
{
"name": "foo1",
"url": "url1",
"verify_ssl": true
},
{
"name": "foo2",
"url": "url2",
"verify_ssl": true
}
]
}
I'm trying to access a member from the list above, for example demo[0].name without success, what I'm doing wrong?
file(READ "${CONAN_CACHE}/demo.json" MY_JSON_STRING)
string(JSON CUR_NAME GET ${MY_JSON_STRING} demo[0].name)
One at a time.
string(JSON CUR_NAME GET ${MY_JSON_STRING} demo 0 name)

Autodesk Forge API - Patch Item Input Error

I am trying to use the PATCH projects/:project_id/items/:item_id endpoint in order to update the "displayName" attribute of an item in BIM360. There is an example on how to do exactly that in the Forge documentation, but for some reason I am getting an 400 error.
Here is my payload:
{
"jsonapi": {
"version": "1.0"
},
"data": {
"type": "items",
"id": "ITEM_URN",
"attributes": {
"displayName": "NEW_ITEM_NAME.EXTENSION"
}
}
}
Here is the error I get:
{
"jsonapi": {
"version": "1.0"
},
"errors": [
{
"id": "a4c43bbb-9e34-4973-9f9c-58a7e1d7bdb6",
"status": "400",
"code": "BAD_INPUT",
"title": "One or more input values in the request were bad",
"detail": "Request input is invalid for this operation."
}
]
}
I successfully use the same endpoint in order to change the parent folder for this same item (as described in this post answer: Autodesk Forge; Pragmatically changing file location without new upload ), so the problem must be in the update "displayName" portion. Here the successful payload sample that returns a 200 answer:
{
"jsonapi": {
"version": "1.0"
},
"data": {
"type": "items",
"id": "ITEM_URN",
"relationships": {
"parent": {
"data": {
"type": "folders",
"id": "DESTINATION_FOLDER_URN"
}
}
}
}
}
Forge Documentation with example: https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-items-item_id-PATCH/
What am I missing in order to update the "displayName" attribute?
If you want to change the file name, you can change tip version name and title , creating new version is required, but you don't have to upload file again. Please try the API at https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-versions-POST/ :
POST /versions?copyFrom={tip_version_urn}
{
"jsonapi": {
"version": "1.0"
},
"data": {
"type": "versions",
"attributes": {
"name": "newName"
}
}
}
A new tip version will be created with the updated name.

In SSI using Indy, how verifier chooses the schema for proof request?

In a Self Sovereign Identity, when verifier sends a proof request to the holder of credential, how the verifier makes sure to use correct schema id that is related to the holder during the proof request to the holder?
I get more in depth and I can now say that the verifier can ask for a particular "schema_id" in the proof request's restrictions:(from here)
{
"name": "proof-schema1",
"version": "1.0",
"requested_attributes": [
{
"names": ["class", "grade"],
"restrictions": [{"cred_def_id": "<cred-def-id>"}]
},
{
"name": "phone_number"
}
],
"requested_predicates": [
{
"name": "rank",
"p_type": "<=",
"p_value": 10,
"restrictions": [{"cred_def_id": "<cred-def-id>"}]
}
],
"cred_filter": [
{
"attr_name": "class",
"attr_values": ["Math 100"]
"exclude": true
},
{
"attr_name": "class",
"attr_values": ["Math *"]
}
]
}

property servicetoken cannot be empty

"certificatefordns":{
"Type" : "AWS::CertificateManager::Certificate",
"Properties" : {
"DomainName" : "*.test-elb.acb.com",
"ValidationMethod" : "DNS"
},
"CertificateDNSRecord":{
"Type": "Custom::CertificateDNSRecord",
"Properties": {
"CertificateArn": {
"Ref": "certificatefordns"
},
"DomainName": "*.test-elb.acb.com"
}},
"DNS": {
"Type": "AWS::Route53::RecordSetGroup",
"Properties": {
"HostedZoneId": "Z01724793QXGY7AZ",
"RecordSets": [
{
"Name": {
"Ref": "AlternateDomainNames"
},
"Type": "A",
"AliasTarget": {
"HostedZoneId": "Z23TAZ6MNIO",
"DNSName": {
"Fn::GetAtt": [
"WebLoadBalancer",
"DNSName"
]
}
}
},
{
"Name": {
"Fn::Sub": "${CertificateDNSRecord.Name}"
},
"Type": {
"Fn::Sub": "${CertificateDNSRecord.Type}"
},
"TTL": "60",
"Weight": 1,
"SetIdentifier": "*.test-elb.acb.com",
"ResourceRecords": [
{
"Fn::Sub": "${CertificateDNSRecord.Value}"
}
]
}
]
}
}
Hi Team,
I want to create a new certificate for Load balancer and with the help of this json code I am able to create that certificate but after some time it will through an error that property servicetoken cannot be empty So As i searched I am confused that I need to create lambda function or what?
Or Is there any other way to decline this error.
Please guide me into this.
Custom resources in CloudFormation require a ServiceToken:
The service token that was given to the template developer by the service provider to access the service, such as an Amazon SNS topic ARN or Lambda function ARN. The service token must be from the same region in which you are creating the stack.
Your Custom::CertificateDNSRecord is missing it. Thus you have to provide it.
If the custom resource is for validating ACM certifications, you can check the new option, which should not require custom lambda function:
AWS Certificate Manager Extends Automation of Certificate Issuance Via CloudFormation
Yes I got the solution own my own. We just need to use this template that's it.
"certificatefordns":{
"Type" : "AWS::CertificateManager::Certificate",
"Properties" : {
"DomainName" : "*.test-elb.acb.com",
"ValidationMethod" : "DNS",
"DomainValidationOptions": [
{
"DomainName": {
"Ref": "AlternateDomainNames"
},
"HostedZoneId": "Z01724793QXGL8FOZ"
}]
}
},
It will create a new certificate.

How to add TimeInstant, CreationDate and ModifiedDate into CrateDB with Orion Context Broker?

I'm setting up a Firmware-Framework, where I unforutunately have to add historically Sensor Values. But I also need the creationDate and the modificationDate for other usecases.
Therefore I add the Attribute "Metadata" with the variable "TimeInstant". Then I create an Entity, create an Orion-Subscription for that Entity and update the Entity with my old Sensor-Valses.
The Json-File I send to the Orion-Context Broker to update the Attribute looks like this:
{
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2015-02-02T11:35:25.0000Z"
}
},
"type": "Number",
"value": 0.0132361 }
The Output in my Mongo-DB like this:
"_id": {
"id": "urn:ngsi-ld:SensorB-K1200____",
"type": "Sensor",
"servicePath": "/test/servicepath"
},
"attrNames": [
"Sensor_value"
],
"attrs": {
"Sensor_value": {
"value": 0.01632361,
"type": "Number",
"md": {
"TimeInstant": {
"type": "DateTime",
"value": 1422876989
}
},
"mdNames": [
"TimeInstant"
],
"creDate": 1568712813,
"modDate": 1568735930
}
},
"creDate": 1568712813,
"modDate": 1568735930,
"lastCorrelator": "0a129232-d964-11e9-8e5a-0242ac130009" }
But my Crate-DB only has the columns:
entity_id entity_type fiware_servicepath sensor_value time_index
My Subscription File looks like this:
{
"expires": "2019-12-24T18:00:00",
"notification": {
"http": {
"url": "http://quantumleap:8668/v2/notify"
},
"metadata": [
"dateCreated",
"dateModified",
"TimeInstant"
]
},
"subject": {
"entities": [
{
"id": "urn:ngsi-ld:SensorB-K1200____",
"type": "Sensor"
}
]
},
"throttling": 0 }
I've tried changing the "Metadata" Attributes in the Subscription-File, also tried restartig Crate-DB, ContextBroker e.g..
I excpect the CrateDb to show all three values: "dateCreated", "dateModified" and "TimeInstant".
Did you check what's the message notification actually sent by Orion to QuantumLeap?
As regards the payload I would try as follow:
{
"TimeInstant": {
"type": "DateTime",
"value": "2015-02-02T11:35:25.0000Z"
},
"type": "Number",
"value": 0.0132361
}
Internally we usually use as attribute name for this type of scenario dateObserved, but it would not make any difference w.r.t. TimeInstant.
I am not actually sure you can attach metadata to the root of NGSI message, I believe they are supposed to be attached only to attributes.
Anyhow, QuantumLeaps does not support NGSI metadata (i.e. metadata attached to NGSI attributes). Still it support time indexing based on them.
The way Quantum Leap handles TimeInstant metadata and other time metadata is via time_index. See documentation here: https://quantumleap.readthedocs.io/en/latest/user/#time-index