I'm unable to execute payment transaction in Stellar testnet.
Initially i use find_path:
curl -X POST https://test.stellar.org:9002 -d '
{
"method": "static_path_find",
"params": [
{
"source_account": "g4e5v2ERpKvdBZrchn6DrWUtvezkXsu5wo",
"destination_account": "gJ3e65GzqERgeeS5oXsv8NGfdZWzm93ej6",
"source_currencies" : [ { "currency" : "SGD", "issuer" : "gDfapfG5hDHuYkbVpugtupkGYVTKXwd59r"} ],
"destination_amount": {
"currency": "MYR",
"value": "1",
"issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS"
}
}
]
}'
The result I get:
{
"result": {
"alternatives": [
{
"paths_computed": [
[
{
"currency": "MYR",
"issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
"type": 48
},
{
"account": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
"type": 1
}
]
],
"source_amount": {
"currency": "SGD",
"issuer": "gDfapfG5hDHuYkbVpugtupkGYVTKXwd59r",
"value": "0.375"
}
}
],
"destination_account": "gJ3e65GzqERgeeS5oXsv8NGfdZWzm93ej6",
"destination_currencies": [
"MYR",
"STR"
],
"status": "success"
}
}
Then I trying to broadcast transaction in the network:
curl -X POST https://test.stellar.org:9002 -d '
{
"method": "submit",
"params": [
{
"secret": "sfk7dUd4N8cxVFVowsZL4DQgonNP9k8WFBgaV2NmwEQKGzWuqXT",
"tx_json": {
"TransactionType": "Payment",
"Account": "g4e5v2ERpKvdBZrchn6DrWUtvezkXsu5wo",
"Destination": "gJ3e65GzqERgeeS5oXsv8NGfdZWzm93ej6",
"Amount": {
"currency": "MYR",
"value": "1",
"issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS"
},
"Paths": [
[
{
"currency": "MYR",
"issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
"type": 48
},
{
"account": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
"type": 1
}
]
]
}
}
]
}'
And finally I'm getting unsuccessful result when transaction passed through consensus:
{
"engine_result": "tecPATH_PARTIAL",
"engine_result_code": 101,
"engine_result_message": "Path could not send full amount.",
"ledger_hash": "82BCF42941EF00BEA9E575B696CD88EC7E14FDE8CFD39FDA6A76B5710FDD0755",
"ledger_index": 704612,
"meta": {
"AffectedNodes": [
{
"ModifiedNode": {
"FinalFields": {
"Account": "g4e5v2ERpKvdBZrchn6DrWUtvezkXsu5wo",
"Balance": "199999960",
"Flags": 0,
"OwnerCount": 1,
"Sequence": 5
},
"LedgerEntryType": "AccountRoot",
"LedgerIndex": "D3433DEE556200D8AB72DED7156A597A273103D2BC50F526193EB9C4D8C8B735",
"PreviousFields": {
"Balance": "199999970",
"Sequence": 4
},
"PreviousTxnID": "6ADF48B45D95B3ABD20FD78F95F7E4F20D91FF5D169ECC5EFD6DB0CA78BEA486",
"PreviousTxnLgrSeq": 704445
}
}
],
"TransactionIndex": 0,
"TransactionResult": "tecPATH_PARTIAL"
},
"status": "closed",
"transaction": {
"Account": "g4e5v2ERpKvdBZrchn6DrWUtvezkXsu5wo",
"Amount": {
"currency": "MYR",
"issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
"value": "1"
},
"Destination": "gJ3e65GzqERgeeS5oXsv8NGfdZWzm93ej6",
"Fee": "10",
"Flags": 2147483648,
"Paths": [
[
{
"currency": "MYR",
"issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
"type": 48
},
{
"account": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
"type": 1
}
]
],
"Sequence": 4,
"SigningPubKey": "4B640AC0C64AEF1C97EAAD0629CADDCA95FBA5F095BD20BD6282BEC450A125B1",
"TransactionType": "Payment",
"TxnSignature": "7BF5772EB916F20F56C5F148E99C3C3DD77C2916EAA47AB2D7FA8306F2B4A9D3FA4B789BDB79899A634B0C33F50A6ACB447CA6A9633C1C73BAB754FBFE74C105",
"date": 485412700,
"hash": "846AB6502D3B7A3137B2B538E6616B9C4459D2A67C48E58AF6B64F4659FF0016"
},
"type": "transaction",
"validated": true
}
Why? What I did wrong? I really can't understand...
Anyway I found the problem.
I forgot to add required SendMax parameter when submitting transaction.
curl -X POST https://test.stellar.org:9002 -d '
{
"method": "submit",
"params": [
{
"secret": "sfk7dUd4N8cxVFVowsZL4DQgonNP9k8WFBgaV2NmwEQKGzWuqXT",
"tx_json": {
"TransactionType": "Payment",
"Account": "g4e5v2ERpKvdBZrchn6DrWUtvezkXsu5wo",
"Destination": "gJ3e65GzqERgeeS5oXsv8NGfdZWzm93ej6",
"Amount": {
"currency": "MYR",
"value": "1",
"issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS"
},
"Paths": [
[
{
"currency": "MYR",
"issuer": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
"type": 48
},
{
"account": "gsQuUKcxM68nEX9tKR71UH5hZXwrvT2mpS",
"type": 1
}
]
],
"SendMax" : { "currency" : "SGD", "value" : "0.375", "issuer": "gDfapfG5hDHuYkbVpugtupkGYVTKXwd59r" }
}
}
]
}'
Related
Here is my use case :-
I am trying to get the deployment details in a JSON format using :
kubectl get deployment -o json depl_name
and inserting result back to a column: meta_data in MySQL. The column data type is json . But the insert statement is failing with error :-
ERROR 3140 (22032): Invalid JSON text: "Missing a comma or '}' after an object member." at position 1035 in value for column
Here is my entire JSON :-
{
"uuid": {
"view": "demoBoard",
"demo": [
{
"serviceName": "wordpress-backend",
"configurations": {
"ec2_iam": {
"user": [],
"roles": null,
"permissions": null
}
},
"deployment_config": {
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"annotations": {
"deployment.kubernetes.io/revision": "6",
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"labels\":{\"app\":\"wordpress-backend\",\"wordpress_app_id\":\"w26\"},\"name\":\"wordpress-backend\",\"namespace\":\"wordpress\"},\"spec\":{\"selector\":{\"matchLabels\":{\"app\":\"wordpress-backend\"}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"wordpress-backend\",\"wordpress_app_id\":\"w26\"}},\"spec\":{\"containers\":[{\"envFrom\":[{\"configMapRef\":{\"name\":\"wordpress-backend-config\"}}],\"image\":\"docker-image\",\"imagePullPolicy\":\"IfNotPresent\",\"name\":\"wordpress-backend\",\"ports\":[{\"containerPort\":8000}],\"resources\":{},\"volumeMounts\":[{\"mountPath\":\"/tmp/me/cloud\",\"name\":\"my-key\"}]}],\"imagePullSecrets\":[{\"name\":\"my-json\"}],\"volumes\":[{\"name\":\"my-cloud-key\",\"secret\":{\"defaultMode\":123,\"secretName\":\"my-key\"}}]}}}}\n"
},
"creationTimestamp": "2022-09-12T13:56:34Z",
"generation": 7,
"labels": {
"app": "wordpress-backend",
"wordpress_app_id": "w26"
},
"name": "wordpress-backend",
"namespace": "wordpress",
"resourceVersion": "v2",
"uid": "0da99b29"
},
"spec": {
"progressDeadlineSeconds": 600,
"replicas": 1,
"revisionHistoryLimit": 10,
"selector": {
"matchLabels": {
"app": "wordpress-backend"
}
},
"strategy": {
"rollingUpdate": {
"maxSurge": "25%",
"maxUnavailable": "25%"
},
"type": "RollingUpdate"
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"app": "wordpress-backend",
"wordpress_app_id": "267"
}
},
"spec": {
"containers": [
{
"envFrom": [
{
"configMapRef": {
"name": "wordpress-backend-config"
}
}
],
"image": "docker.io/my-image",
"imagePullPolicy": "IfNotPresent",
"name": "wordpress-backend",
"ports": [
{
"containerPort": 8000,
"protocol": "TCP"
}
],
"resources": {},
"terminationMessagePath": "/dev/termination-log",
"terminationMessagePolicy": "File",
"volumeMounts": [
{
"mountPath": "/my/path/cloud",
"name": "my-key"
}
]
}
],
"dnsPolicy": "ClusterFirst",
"imagePullSecrets": [
{
"name": "my-key"
}
],
"restartPolicy": "Always",
"schedulerName": "default-scheduler",
"securityContext": {},
"terminationGracePeriodSeconds": 30,
"volumes": [
{
"name": "my-key",
"secret": {
"defaultMode": 123,
"secretName": "sampleKeyName"
}
}
]
}
}
},
"status": {
"availableReplicas": 1,
"conditions": [
{
"lastTransitionTime": "2022-09-29T15:11:14Z",
"lastUpdateTime": "2022-09-29T15:11:14Z",
"message": "Deployment has minimum availability.",
"reason": "MinimumReplicasAvailable",
"status": "True",
"type": "Available"
},
{
"lastTransitionTime": "2022-09-12T14:20:35Z",
"lastUpdateTime": "2022-09-30T14:13:08Z",
"message": "ReplicaSet \"wordpress-backend-abc123\" has successfully progressed.",
"reason": "NewReplicaSetAvailable",
"status": "True",
"type": "Progressing"
}
],
"observedGeneration": 7,
"readyReplicas": 1,
"replicas": 1,
"updatedReplicas": 1
}
}
}
]
}
}
I guess, because of escape sequence in below line causing the failure :-
"message": "ReplicaSet \"wordpress-backend-abc123\" has successfully progressed.", tried removing that, but no luck.
Im trying to use jq on kubernetes json output, to create new json object containing list of objects - container and image per pod, however im getting cartesian product.
my input data (truncated from sensitive info):
{
"apiVersion": "v1",
"items": [
{
"apiVersion": "v1",
"kind": "Pod",
"metadata": {
"creationTimestamp": "2021-06-30T12:45:40Z",
"name": "pod-1",
"namespace": "default",
"resourceVersion": "757679286",
"selfLink": "/api/v1/namespaces/default/pods/pod-1"
},
"spec": {
"containers": [
{
"image": "image-1",
"imagePullPolicy": "Always",
"name": "container-1",
"resources": {},
"terminationMessagePath": "/dev/termination-log",
"terminationMessagePolicy": "File",
"volumeMounts": [
{
"mountPath": "/var/run/secrets/kubernetes.io/serviceaccount",
"readOnly": true
}
]
},
{
"image": "image-2",
"imagePullPolicy": "Always",
"name": "container-2",
"resources": {},
"terminationMessagePath": "/dev/termination-log",
"terminationMessagePolicy": "File",
"volumeMounts": [
{
"mountPath": "/var/run/secrets/kubernetes.io/serviceaccount",
"readOnly": true
}
]
}
],
"dnsPolicy": "ClusterFirst",
"enableServiceLinks": true,
"priority": 0,
"restartPolicy": "Always",
"schedulerName": "default-scheduler",
"securityContext": {},
"serviceAccount": "default",
"serviceAccountName": "default",
"terminationGracePeriodSeconds": 30,
"tolerations": [
{
"effect": "NoExecute",
"key": "node.kubernetes.io/not-ready",
"operator": "Exists",
"tolerationSeconds": 300
},
{
"effect": "NoExecute",
"key": "node.kubernetes.io/unreachable",
"operator": "Exists",
"tolerationSeconds": 300
}
],
"volumes": [
{
"name": "default-token-b954f",
"secret": {
"defaultMode": 420,
"secretName": "default-token-b954f"
}
}
]
},
"status": {
"conditions": [
{
"lastProbeTime": null,
"lastTransitionTime": "2021-06-30T12:45:40Z",
"status": "True",
"type": "Initialized"
},
{
"lastProbeTime": null,
"lastTransitionTime": "2021-06-30T12:45:40Z",
"message": "containers with unready status: [container-1 container-2]",
"reason": "ContainersNotReady",
"status": "False",
"type": "Ready"
},
{
"lastProbeTime": null,
"lastTransitionTime": "2021-06-30T12:45:40Z",
"message": "containers with unready status: [container-1 container-2]",
"reason": "ContainersNotReady",
"status": "False",
"type": "ContainersReady"
},
{
"lastProbeTime": null,
"lastTransitionTime": "2021-06-30T12:45:40Z",
"status": "True",
"type": "PodScheduled"
}
],
"containerStatuses": [
{
"image": "image-1",
"imageID": "",
"lastState": {},
"name": "container-1",
"ready": false,
"restartCount": 0,
"started": false,
"state": {
"waiting": {
"message": "Back-off pulling image \"image-1\"",
"reason": "ImagePullBackOff"
}
}
},
{
"image": "image-2",
"imageID": "",
"lastState": {},
"name": "container-2",
"ready": false,
"restartCount": 0,
"started": false,
"state": {
"waiting": {
"message": "Back-off pulling image \"image-2\"",
"reason": "ImagePullBackOff"
}
}
}
],
"qosClass": "BestEffort",
"startTime": "2021-06-30T12:45:40Z"
}
}
],
"kind": "List",
"metadata": {
"resourceVersion": "",
"selfLink": ""
}
}
my command:
jq '.items[] | { "name": .metadata.name, "containers": [{ "name": .spec.containers[].name, "image": .spec.containers[].image }]} '
desired output:
{
"name": "pod_1",
"containers": [
{
"name": "container_1",
"image": "image_1"
},
{
"name": "container_2",
"image": "image_2"
}
]
}
output I get:
{
"name": "pod-1",
"containers": [
{
"name": "container-1",
"image": "image-1"
},
{
"name": "container-1",
"image": "image-2"
},
{
"name": "container-2",
"image": "image-1"
},
{
"name": "container-2",
"image": "image-2"
}
]
}
Could anyone explain what am I doing wrong?
Best Regards, Piotr.
The problem is "name": .spec.containers[].name and "image": .spec.containers[].image:
Both expressions generate a sequence of each value for name and image which will than be combined.
Simplified example of why you get a Cartesian product:
jq -c -n '{name: ("A", "B"), value: ("C", "D")}'
outputs:
{"name":"A","value":"C"}
{"name":"A","value":"D"}
{"name":"B","value":"C"}
{"name":"B","value":"D"}
You get the desired output using this jq filter on your input:
jq '
.items[]
| {
"name": .metadata.name,
"containers": .spec.containers
| map({name, image})
}'
output:
{
"name": "pod-1",
"containers": [
{
"name": "container-1",
"image": "image-1"
},
{
"name": "container-2",
"image": "image-2"
}
]
}
I want to read the status of clusters and servers inside it.
Below is the sample json file
"data": [{
"id": 7865,
"timeCreated": 1602589399294,
"timeUpdated": 1602748892149,
"name": "gw-ext-1",
"type": "CLUSTER",
"status": "RUNNING",
"multicastEnabled": false,
"primaryNodeId": 546,
"servers": [{
"id": 768,
"timeCreated": 1602589028419,
"timeUpdated": 1602747941321,
"name": "gw-jpg208765-1",
"type": "SERVER",
"serverType": "GATEWAY",
"status": "RUNNING",
"addresses": [{
"networkInterface": "eng123"
},
{
"networkInterface": "eng124"
}],
"clusterId": 098,
"clusterName": "gw-ext-1",
"currentClusteringPort": 897,
"runtimeInformation": {
"Information": {
"runtime": {
"name": "abctech",
"version": "1.6.8"
},
"specification": {
"vendor": "rrr",
"name": "rrrt",
"version": "1.8.89"
}
},
"osInformation": {
"name": "LX",
"version": "35",
"architecture": "klh"
},
"mExpirationDate": 098765589283662
}
},
{
"id": 876,
"timeCreated": 1602589007370,
"timeUpdated": 1602748894901,
"name": "gw-jpg208765-2",
"type": "SERVER",
"serverType": "GATEWAY",
"mVersion": "3.9.1",
"gaVersion": "3.9.1",
"agentVersion": "1.9.5",
"ExpirationDate": 32521996800000,
"ExpirationDate": 1665661007000,
"status": "DISCONNECTED",
"addresses": [{
"networkInterface": "engg"
},
{
"networkInterface": "engg"
}],
"clusterId": 768,
"clusterName": "gw-ext-1",
"serverPort": 987,
"currentClusteringPort": 987,
"runtimeInformation": {
"abcInfo": {
"runtime": {
"name": "abc",
"version": "1.2.3"
},
"specification": {
"vendor": "RRR",
"name": "RTR",
"version": "1.8.0"
}
},
"osInformation": {
"name": "LX",
"version": "4.78",
"architecture": "eng"
},
"ExpirationDate": 8765478999765
}
}],
"visibilityMap": {
"mapNodes": [{
"serverId": 765,
"visibleNodeIds": [765,
876],
"unknownNodeIps": []
},
{
"serverId": 876,
"visibleNodeIds": [765,
876],
"unknownNodeIps": []
}]
}
},
{
"id": 7865,
"timeCreated": 1602589399294,
"timeUpdated": 1602748892149,
"name": "gw-ext-2",
"type": "CLUSTER",
"status": "RUNNING",
"multicastEnabled": false,
"primaryNodeId": 546,
"servers": [{
"id": 768,
"timeCreated": 1602589028419,
"timeUpdated": 1602747941321,
"name": "gw-jpg208766-1",
"type": "SERVER",
"serverType": "GATEWAY",
"status": "RUNNING",
"addresses": [{
"networkInterface": "eng123"
},
{
"networkInterface": "eng124"
}],
"clusterId": 098,
"clusterName": "gw-ext-2",
"currentClusteringPort": 897,
"runtimeInformation": {
"Information": {
"runtime": {
"name": "abctech",
"version": "1.6.8"
},
"specification": {
"vendor": "rrr",
"name": "rrrt",
"version": "1.8.89"
}
},
"osInformation": {
"name": "LX",
"version": "35",
"architecture": "klh"
},
"mExpirationDate": 098765589283662
}
},
{
"id": 876,
"timeCreated": 1602589007370,
"timeUpdated": 1602748894901,
"name": "gw-jpg208766-2",
"type": "SERVER",
"serverType": "GATEWAY",
"mVersion": "3.9.1",
"gaVersion": "3.9.1",
"agentVersion": "1.9.5",
"ExpirationDate": 32521996800000,
"ExpirationDate": 1665661007000,
"status": "DISCONNECTED",
"addresses": [{
"networkInterface": "engg"
},
{
"networkInterface": "engg"
}],
"clusterId": 768,
"clusterName": "gw-ext-2",
"serverPort": 987,
"currentClusteringPort": 987,
"runtimeInformation": {
"abcInfo": {
"runtime": {
"name": "abc",
"version": "1.2.3"
},
"specification": {
"vendor": "RRR",
"name": "RTR",
"version": "1.8.0"
}
},
"osInformation": {
"name": "LX",
"version": "4.78",
"architecture": "eng"
},
"ExpirationDate": 8765478999765
}
}],
"visibilityMap": {
"mapNodes": [{
"serverId": 765,
"visibleNodeIds": [765,
876],
"unknownNodeIps": []
},
{
"serverId": 876,
"visibleNodeIds": [765,
876],
"unknownNodeIps": []
}]
}
}]
So in each cluster we have two servers and this json continues to have around 15 clusters.
I want to filter out the status of each cluster and server in below format
name cluster/server status
gw-ext-1 CLUSTER RUNNING
gw-jpg208765-1 SERVER RUNNING
gw-jpg208765-2 SERVER DISCONNECTED
similarly for other clusters also.
I tried few things but its not giving me the servers .. it gives only cluster's details
target_id=echo \$targetIdResponse | ${env.WORKSPACE}/jq -r '.data[] | [.name, .type, .status]'
OR
target_id=echo \$targetIdResponse | ${env.WORKSPACE}/jq -r '.data[] | [.name, .type, .status, .servers.name, .servers.type, .servers.status]'
where $targetIdResponse contains my json data
I want to know how i can filter the above json to get the required data.
You need to have the header array the required fields in a separate array and put them together in a tabular format using #tsv
jq -r '[ "name", "cluster/server", "status" ],
( .data[] | [.name, .type, .status] ),
( .data[].servers[] | [ .name, .type, .status ] ) | #tsv'
The requirement was modified since originally posted to have the server information exactly below the cluster information
jq -r '[ "name", "cluster/server", "status" ],
( .data[] | [.name, .type, .status], ( .servers[] | [.name, .type, .status] ) ) | #tsv'
I have this json object and I am trying to find a way to use regex in jq to search value in issuer_dn that is more than 8 characters. A regex like [A-Z]{8} should work but I am unable to get results. I am still learning jq and if there is any other tool that can be used then please share.
{
"ip": "127.0.0.1",
"data": {
"tls": {
"status": "success",
"protocol": "tls",
"result": {
"handshake_log": {
"server_hello": {
"version": {
"name": "TLSv1.2",
"value": 771
},
"random": "hhdshfhhdhfhshdh",
"session_id": "hjdsfyyueujhfjaskdfjjl",
"cipher_suite": {
"hex": "0xC014",
"name": "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
"value": 49172
},
"compression_method": 0,
"ocsp_stapling": false,
"ticket": false,
"secure_renegotiation": true,
"heartbeat": false,
"extended_master_secret": false
},
"server_certificates": {
"certificate": {
"raw": "dGVzdCBkYXRhIGFuZCBnYXJiYWdldGVzdC==",
"parsed": {
"version": 3,
"serial_number": "1234567890",
"signature_algorithm": {
"name": "SHA256-RSA",
"oid": "1.2.840.113549.1.1.11"
},
"issuer": {
"common_name": [
"ABC"
],
"country": [
"ABC"
],
"locality": [
"ABC"
],
"province": [
"ABC"
],
"organization": [
"ABC"
],
"organizational_unit": [
"ABC"
]
},
"issuer_dn": "C=ABCD, ST=ABCD, L=ABCD, O=ABCD, OU=ABCD, CN=ABCD",
"validity": {
"start": "2020-02-01T01:09:22Z",
"end": "2021-02-01T03:09:22Z",
"length": 7883663
},
"subject": {
"common_name": [
"ABC"
],
"country": [
"ABC"
],
"locality": [
"ABC"
],
"province": [
"ABC"
],
"organization": [
"ABC"
],
"organizational_unit": [
"ABC"
]
},
"subject_dn": "C=ABCD, ST=ABCD, L=ABCD, O=ABCD, OU=ABCD, CN=ABCD",
"subject_key_info": {
"key_algorithm": {
"name": "RSA"
},
"rsa_public_key": {
"exponent": 65537,
"modulus": "dGVzdCBkYXRhIGFuZCBnYXJiYWdldGVzdC",
"length": 2048
},
"fingerprint_sha256": "73hh3g39920jfjj38723bb3993hh3774994002"
},
"extensions": {
"basic_constraints": {
"is_ca": true
},
"authority_key_id": "73hh3g39920jfjj38723bb3993hh3774994002",
"subject_key_id": "73hh3g39920jfjj38723bb3993hh3774994002"
},
"signature": {
"signature_algorithm": {
"name": "SHA256-RSA",
"oid": "1.2.840.113549.1.1.11"
},
"value": "dGVzdCBkYXRhIGFuZCBnYXJiYWdldGVzdC",
"valid": true,
"self_signed": true
},
"fingerprint_md5": "73hh3g39920jfjj38723bb3993hh3774994002",
"fingerprint_sha1": "73hh3g39920jfjj38723bb3993hh3774994002",
"fingerprint_sha256": "73hh3g39920jfjj38723bb3993hh3774994002",
"tbs_noct_fingerprint": "73hh3g39920jfjj38723bb3993hh3774994002",
"spki_subject_fingerprint": "73hh3g39920jfjj38723bb3993hh3774994002",
"tbs_fingerprint": "73hh3g39920jfjj38723bb3993hh3774994002",
"validation_level": "73hh3g39920jfjj38723bb3993hh3774994002",
"redacted": false
}
},
"validation": {
"browser_trusted": false,
"browser_error": "x509: failed to load system roots and no roots provided"
}
},
"server_key_exchange": {
"ecdh_params": {
"curve_id": {
"name": "secp256r1",
"id": 23
},
"server_public": {
"x": {
"value": "73hh3g39920jfjj38723bb3993hh3774994002",
"length": 256
},
"y": {
"value": "73hh3g39920jfjj38723bb3993hh3774994002",
"length": 256
}
}
},
"digest": "dGVzdCBkYXRhIGFuZCBnYXJiYWdldGVzdC",
"signature": {
"raw": "dGVzdCBkYXRhIGFuZCBnYXJiYWdldGVzdC",
"type": "rsa",
"valid": true,
"signature_and_hash_type": {
"signature_algorithm": "rsa",
"hash_algorithm": "sha256"
},
"tls_version": {
"name": "TLSv1.2",
"value": 771
}
}
},
"client_key_exchange": {
"ecdh_params": {
"curve_id": {
"name": "secp256r1",
"id": 23
},
"client_public": {
"x": {
"value": "dGVzdCBkYXRhIGFuZCBnYXJiYWdldGVzdC=",
"length": 256
},
"y": {
"value": "dGVzdCBkYXRhIGFuZCBnYXJiYWdldGVzdC=",
"length": 256
}
},
"client_private": {
"value": "dGVzdCBkYXRhIGFuZCBnYXJiYWdldGVzdC=",
"length": 32
}
}
},
"client_finished": {
"verify_data": "dGVzdCBkY"
},
"server_finished": {
"verify_data": "dGVzdCBkY"
},
"key_material": {
"master_secret": {
"value": "dGVzdCBkY",
"length": 48
},
"pre_master_secret": {
"value": "dGVzdCBkY",
"length": 32
}
}
}
},
"timestamp": "2020-02-9T07:14:47Z"
}
}
}
I would use the following :
.data.tls.result.handshake_log.server_certificates.certificate.parsed.issuer_dn \
| select(length > 8)
You can try it here.
You could use:
test("[A-Z]{8}")
I want to get the hierarchy of a JSON using a value. For example: In below JSON for value "Medical record number" , the desired information is "resource->identifier->type->coding->display" . IS their any inbuilt function to do so.
The one way to look for opening and ending braces to locate nodes. Any other efficient way ?
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"fullUrl": "Patient/996-756-495-101",
"resource": {
"resourceType": "Patient",
"id": "996-756-495-101",
"identifier": [
{
"type": {
"coding": [
{
"system": "http://hl7.org/fhir/v2/0203",
"code": "MR",
"display": "Medical record number"
}
]
},
"system": "https://www.lumc.nl",
"value": "996-756-495-101"
}
],
"name": [
{
"use": "usual",
"family": [
"Levin_4"
],
"given": [
"Henry_4"
]
}
],
"gender": "male",
"birthDate": "1932-09-24",
"maritalStatus": {
"coding": [
{}
]
},
"managingOrganization": {
"reference": "Organization/12"
}
},
"request": {
"method": "POST",
"url": "Patient",
"ifNoneExist": "identifier=https://www.lumc.nl|996-756-495-101"
}
},
{
"fullUrl": "FamilyMemberHistory/d42ebf70-5c89-11db-b0de-0800200c9a66",
"resource": {
"resourceType": "FamilyMemberHistory",
"id": "d42ebf70-5c89-11db-b0de-0800200c9a66",
"patient": {
"reference": "Patient/996-756-495-101"
},
"status": "Partial",
"relationship": {
"coding": [
{
"system": "http://hl7.org/fhir/ValueSet/v3-FamilyMember",
"code": "FTH",
"display": "Father"
}
],
"text": "Father"
},
"gender": "male",
"bornDate": "1912",
"deceasedBoolean": true
},
"request": {
"method": "POST",
"url": "FamilyMemberHistory"
}
},
{
"fullUrl": "FamilyMemberHistory/a13c6160-5c8b-11db-b0de-0800200c9a66",
"resource": {
"resourceType": "FamilyMemberHistory",
"id": "a13c6160-5c8b-11db-b0de-0800200c9a66",
"patient": {
"reference": "Patient/996-756-495-101"
},
"status": "Partial",
"relationship": {
"coding": [
{
"system": "http://hl7.org/fhir/ValueSet/v3-FamilyMember",
"code": "MTH",
"display": "Mother"
}
],
"text": "Mother"
},
"gender": "female",
"bornDate": "1912",
"deceasedBoolean": false
},
"request": {
"method": "POST",
"url": "FamilyMemberHistory"
}
}
]
}