Connecting conversational AI to Alexa - json

I built my Conversational AI chatbot and followed all the steps to connect it to Alexa but when I try to call my chatbot in alexa simulator,I get the following message:
"There was a problem with the requested skill's response"
this is the code which appears on JSON output 1 and JSON output 2 after the error:
{
"version": "1.0",
"session": {
"new": true,
"sessionId": "amzn1.echo-api.session.5e3bb3da-ba51-4422-80cb-c5cace7e3756",
"application": {
"applicationId": "amzn1.ask.skill.bfb81ac5-d463-4201-b70c-a35f8cc6dbed"
},
"user": {
"userId": "amzn1.ask.account.AHIAWE37M4SE4Q7DBFIIRLYZYXFKPU42HAD35P5XLHMZA4RGRXFERFRKPAN2I34A56TCC2XEGVNKYH7SW2KVB2NBUYAAY73GRDDXNEFFFY46W2FJXXCLSMAIUWDEUESU3ZMGIYPPYA2WXFXBBHGJBLHNVRYBLXTBLOCJMGOMK4VXNONXGGICYKBBIE7LMCTSUOVEYRAS3E2ATNQ"
}
},
"context": {
"System": {
"application": {
"applicationId": "amzn1.ask.skill.bfb81ac5-d463-4201-b70c-a35f8cc6dbed"
},
"user": {
"userId": "amzn1.ask.account.AHIAWE37M4SE4Q7DBFIIRLYZYXFKPU42HAD35P5XLHMZA4RGRXFERFRKPAN2I34A56TCC2XEGVNKYH7SW2KVB2NBUYAAY73GRDDXNEFFFY46W2FJXXCLSMAIUWDEUESU3ZMGIYPPYA2WXFXBBHGJBLHNVRYBLXTBLOCJMGOMK4VXNONXGGICYKBBIE7LMCTSUOVEYRAS3E2ATNQ"
},
"device": {
"deviceId": "amzn1.ask.device.AHAUYPX373VS2JXBI2E5VG4GPJPAUT5I5KRINQVJCDM7C7MZFGHWSEQV6CKKSHEZQT7HRAIAHS5BRCKLRHDDRTOE3XYWTDOSIW4MKRXAEGZIWA6XQTXY7TRC26PTPZWWB5T6D77XQNDTPLUTKRBOCJ2KLCCYRBUMXLD2GLKU4K2OQXHJDAM4Q",
"supportedInterfaces": {}
},
"apiEndpoint": "https://api.amazonalexa.com",
"apiAccessToken": "eyJ0eXAiOiJKV1QiLC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VDdIUkFJQUhTNUJSQ0tMUkhERFJUT0UzWFlXVERPU0lXNE1LUlhBRUdaSVdBNlhRVFhZN1RSQzI2UFRQWldXQjVUNkQ3N1hRTkRUUExVVEtSQk9DSjJLTENDWVJCVU1YTEQyR0xLVTRLMk9RWEhKREFNNFEiLCJ1c2VySWQiOiJhbXpuMS5hc2suYWNjb3VudC5BSElBV0UzN000U0U0UTdEQkZJSVJMWVpZWEZLUFU0MkhBRDM1UDVYTEhNWkE0UkdSWEZFUkZSS1BBTjJJMzRBNTZUQ0MyWEVHVk5LWUg3U1cyS1ZCMk5CVVlBQVk3M0dSRERYTkVGRkZZNDZXMkZKWFhDTFNNQUlVV0RFVUVTVTNaTUdJWVBQWUEyV1hGWEJCSEdKQkxITlZSWUJMWFRCTE9DSk1HT01LNFZYTk9OWEdHSUNZS0JCSUU3TE1DVFNVT1ZFWVJBUzNFMkFUTlEifX0.UV1qiib5UAV4msb27bxN6zBtPnaYg_1ifwWQhuSXNQpDUzM8dQlo29T5O425Itz6M-xufZT5wtJpk-mT2JZUWjdAe8bquTT9YAmAroAp3_Sa-OJ1iXP8qhiPQeu8g7Xwl2XVpFUAuaeqoSyZxzM2dnKBIND18qrcDfDTS9YRzwcrQdBaGlH-_uW0nXDOntyZ7myqB50fBVtlz5xiayHFE5J3-OTaMK4nuggMKzuL8lbYQrcEPwwbt940LiKy4CRjltHA83N1xtyBtkafcOFQPN3UAzFKPI85jUtIFuYUsuIbl7N_f64yOAgtkIQEvjCA-DWQzkerPyHJo2VrF0q7Tw"
},
"Viewport": {
"experiences": [
{
"arcMinuteWidth": 246,
"arcMinuteHeight": 144,
"canRotate": false,
"canResize": false
}
],
"shape": "RECTANGLE",
"pixelWidth": 1024,
"pixelHeight": 600,
"dpi": 160,
"currentPixelWidth": 1024,
"currentPixelHeight": 600,
"touch": [
"SINGLE"
],
"video": {
"codecs": [
"H_264_42",
"H_264_41"
]
}
},
"Viewports": [
{
"type": "APL",
"id": "main",
"shape": "RECTANGLE",
"dpi": 160,
"presentationType": "STANDARD",
"canRotate": false,
"configuration": {
"current": {
"video": {
"codecs": [
"H_264_42",
"H_264_41"
]
},
"size": {
"type": "DISCRETE",
"pixelWidth": 1024,
"pixelHeight": 600
}
}
}
}
]
},
"request": {
"type": "LaunchRequest",
"requestId": "amzn1.echo-api.request.1d812f0b-5bce-42a6-bdd5-4791d5876e8e",
"timestamp": "2020-01-22T09:20:12Z",
"locale": "en-US",
"shouldLinkResultBeReturned": false
}}
JSON Output 2:
{
"version": "1.0",
"session": {
"new": false,
"sessionId": "amzn1.echo-api.session.5e3bb3da-ba51-4422-80cb-c5cace7e3756",
"application": {
"applicationId": "amzn1.ask.skill.bfb81ac5-d463-4201-b70c-a35f8cc6dbed"
},
"user": {
"userId": "amzn1.ask.account.AHIAWE37M4SE4Q7DBFIIRLYZYXFKPU42HAD35P5XLHMZA4RGRXFERFRKPAN2I34A56TCC2XEGVNKYH7SW2KVB2NBUYAAY73GRDDXNEFFFY46W2FJXXCLSMAIUWDEUESU3ZMGIYPPYA2WXFXBBHGJBLHNVRYBLXTBLOCJMGOMK4VXNONXGGICYKBBIE7LMCTSUOVEYRAS3E2ATNQ"
}
},
"context": {
"System": {
"application": {
"applicationId": "amzn1.ask.skill.bfb81ac5-d463-4201-b70c-a35f8cc6dbed"
},
"user": {
"userId": "amzn1.ask.account.AHIAWE37M4SE4Q7DBFIIRLYZYXFKPU42HAD35P5XLHMZA4RGRXFERFRKPAN2I34A56TCC2XEGVNKYH7SW2KVB2NBUYAAY73GRDDXNEFFFY46W2FJXXCLSMAIUWDEUESU3ZMGIYPPYA2WXFXBBHGJBLHNVRYBLXTBLOCJMGOMK4VXNONXGGICYKBBIE7LMCTSUOVEYRAS3E2ATNQ"
},
"device": {
"deviceId": "amzn1.ask.device.AHAUYPX373VS2JXBI2E5VG4GPJPAUT5I5KRINQVJCDM7C7MZFGHWSEQV6CKKSHEZQT7HRAIAHS5BRCKLRHDDRTOE3XYWTDOSIW4MKRXAEGZI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": 1024,
"pixelHeight": 600,
"dpi": 160,
"currentPixelWidth": 1024,
"currentPixelHeight": 600,
"touch": [
"SINGLE"
],
"video": {
"codecs": [
"H_264_42",
"H_264_41"
]
}
},
"Viewports": [
{
"type": "APL",
"id": "main",
"shape": "RECTANGLE",
"dpi": 160,
"presentationType": "STANDARD",
"canRotate": false,
"configuration": {
"current": {
"video": {
"codecs": [
"H_264_42",
"H_264_41"
]
},
"size": {
"type": "DISCRETE",
"pixelWidth": 1024,
"pixelHeight": 600
}
}
}
}
]
},
"request": {
"type": "SessionEndedRequest",
"requestId": "amzn1.echo-api.request.30c39df8-dc26-4dcf-a193-de432a3a0ab1",
"timestamp": "2020-01-22T09:20:13Z",
"locale": "en-US",
"reason": "ERROR",
"error": {
"type": "INVALID_RESPONSE",
"message": "An exception occurred while dispatching the request to the skill."
}
}}{
"body": {
"version": "1.0",
"response": {
"type": "_DEFAULT_RESPONSE"
},
"sessionAttributes": {},
"userAgent": "ask-node/2.7.0 Node/v8.15.0"
}
}

Related

Inserting a Complex Nested JSON Column in MySQL

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.

Using jq search value using regex

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}")

How do I pass secret value from keyvault using Azure ARM Template

I am trying to create Azure Application Gateway with ssl certificate from keyvaults. But didn't find any option to add keyvaults to ARM template with .pfx and .cer files. So I have encoded the certificate contents and added as secret in existing keyvault. Now trying to pass the secrets using ARM template. Validation passed but getting error in Deployment stage. Attached the template and parameters I am using.
Getting Error while deploying the resource
Deployment template validation failed: 'Template parameter JToken type is not valid. Expected 'String, Uri'. Actual 'Object'
"additionalInfo": [
{
"type": "TemplateViolation",
"info": {
"lineNumber": 226,
"linePosition": 33,
"path": "properties.template.parameters.appgwfesslcertsecret"
}
}
]
Updated Template:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"namingSettings": {
"type": "object"
},
"taggingSettings": {
"type": "object"
},
"applicationGatewaySettings": {
"type": "object"
},
"appgwfesslcertsecret": {
"type": "securestring"
},
"appgwbecertsecret": {
"type": "securestring"
}
},
"variables": {
"namePrefix": "[concat(parameters('namingSettings').name.org,'-',parameters('namingSettings').name.cloud,'-',parameters('namingSettings').name.region,'-',parameters('namingSettings').name.businessUnit,'-',parameters('namingSettings').name.account,'-',parameters('namingSettings').name.app,'-',parameters('namingSettings').name.sdlc,'-')]" },
"resources": [
{
"apiVersion": "2018-11-01",
"name": "[concat(variables('namePrefix'),parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].name)]",
"type": "Microsoft.Network/applicationGateways",
"location": "[resourceGroup().location]",
"copy": {
"name": "appgwCopy",
"count": "[length(parameters('applicationGatewaySettings').settings)]"
},
"tags": "[parameters('taggingSettings').tags]",
"properties": {
"sku": {
"name": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].applicationGatewaySku]",
"tier": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].applicationGatewayTier]",
"capacity": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].applicationGatewayInstanceCount]"
},
"sslPolicy": {
"policyType": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].policyType]",
"policyName": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].policy]"
},
"copy": [
{
"name": "frontendPorts",
"count": "[length(parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].frontendPorts)]",
"input": {
"name": "[concat(variables('namePrefix'),parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].frontendPorts[copyIndex('frontendPorts')].name)]",
"properties": {
"port": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].frontendPorts[copyIndex('frontendPorts')].properties.port]"
}
}
},
{
"name": "gatewayIPConfigurations",
"count": "[length(parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].gatewayIPConfigurations)]",
"input": {
"name": "[concat(variables('namePrefix'),parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].gatewayIPConfigurations[copyIndex('gatewayIPConfigurations')].name)]",
"properties": {
"subnet": {
"id": "[resourceId(parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].gatewayIPConfigurations[copyIndex('gatewayIPConfigurations')].properties.subnet.vnetRGName,'microsoft.network/virtualnetworks/subnets', parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].gatewayIPConfigurations[copyIndex('gatewayIPConfigurations')].properties.subnet.vnetName, parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].gatewayIPConfigurations[copyIndex('gatewayIPConfigurations')].properties.subnet.subnetName)]"
}
}
}
},
{
"name": "frontendIPConfigurations",
"count": "[length(parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].frontendIPConfigurations)]",
"input": {
"name": "[concat(variables('namePrefix'),parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].frontendIPConfigurations[copyIndex('frontendIPConfigurations')].name)]",
"properties": {
"subnet": {
"id": "[resourceId(parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].gatewayIPConfigurations[copyIndex('frontendIPConfigurations')].properties.subnet.vnetRGName,'microsoft.network/virtualnetworks/subnets', parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].frontendIPConfigurations[copyIndex('frontendIPConfigurations')].properties.subnet.vnetName, parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].frontendIPConfigurations[copyIndex('frontendIPConfigurations')].properties.subnet.subnetName)]"
}
}
}
},
{
"name": "backendHttpSettingsCollection",
"count": "[length(parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].backendHttpSettingsCollection)]",
"input": {
"name": "[concat(variables('namePrefix'),parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].backendHttpSettingsCollection[copyIndex('backendHttpSettingsCollection')].name)]",
"properties": {
"port": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].backendHttpSettingsCollection[copyIndex('backendHttpSettingsCollection')].properties.port]",
"protocol": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].backendHttpSettingsCollection[copyIndex('backendHttpSettingsCollection')].properties.protocol]",
"authenticationCertificates": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].backendHttpSettingsCollection[copyIndex('backendHttpSettingsCollection')].properties.authenticationCertificates]"
}
}
},
{
"name": "backendAddressPools",
"count": "[length(parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].backendAddressPools)]",
"input": {
"name": "[concat(variables('namePrefix'),parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].backendAddressPools[copyIndex('backendAddressPools')].name)]"
}
},
{
"name": "httpListeners",
"count": "[length(parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].httpListeners)]",
"input": {
"name": "[concat(variables('namePrefix'),parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].httpListeners[copyIndex('httpListeners')].name)]",
"properties": {
"frontendIPConfiguration": {
"id": "[resourceId(resourceGroup().name, 'microsoft.network/applicationGateways/frontendIPConfigurations', concat(variables('namePrefix'),parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].name),concat(variables('namePrefix'), parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].httpListeners[copyIndex('httpListeners')].properties.frontendIPConfiguration))]"
},
"frontendPort": {
"id": "[resourceId(resourceGroup().name, 'microsoft.network/applicationGateways/frontendPorts', concat(variables('namePrefix'),parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].name),concat(variables('namePrefix'), parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].httpListeners[copyIndex('httpListeners')].properties.frontendPort))]"
},
"protocol": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].httpListeners[copyIndex('httpListeners')].properties.protocol]",
"sslCertificate": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].httpListeners[copyIndex('httpListeners')].properties.sslCertificate]"
}
}
},
{
"name": "requestRoutingRules",
"count": "[length(parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].requestRoutingRules)]",
"input": {
"name": "[concat(variables('namePrefix'),parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].requestRoutingRules[copyIndex('requestRoutingRules')].name)]",
"properties": {
"httpListener": {
"id": "[resourceId(resourceGroup().name, 'microsoft.network/applicationGateways/httpListeners', concat(variables('namePrefix'),parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].name),concat(variables('namePrefix'), parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].requestRoutingRules[copyIndex('requestRoutingRules')].properties.httpListener))]"
},
"backendAddressPool": {
"id": "[resourceId(resourceGroup().name, 'microsoft.network/applicationGateways/backendAddressPools', concat(variables('namePrefix'),parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].name),concat(variables('namePrefix'), parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].requestRoutingRules[copyIndex('requestRoutingRules')].properties.backendAddressPool))]"
},
"backendHttpSettings": {
"id": "[resourceId(resourceGroup().name, 'microsoft.network/applicationGateways/backendHttpSettingsCollection', concat(variables('namePrefix'),parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].name),concat(variables('namePrefix'), parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].requestRoutingRules[copyIndex('requestRoutingRules')].properties.backendHttpSettings))]"
}
}
}
},
{
"name": "sslCertificates",
"count": "[length(parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].sslCertificates)]",
"input": {
"name": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].sslCertificates[copyIndex('sslCertificates')].name]",
"properties": {
"data": "[parameters('appgwfesslcertsecret')]",
"password": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].sslCertificates[copyIndex('sslCertificates')].properties.password]"
}
}
},
{
"name": "authenticationCertificates",
"count": "[length(parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].authenticationCertificates)]",
"input": {
"name": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].authenticationCertificates[copyIndex('authenticationCertificates')].name]",
"properties": {
"data": "[parameters('appgwbecertsecret')]"
}
}
}
],
"probes": [],
"webApplicationFirewallConfiguration": {
"enabled": true,
"firewallMode": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].firewallMode]",
"ruleSetType": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].ruleSetType]",
"ruleSetVersion": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].ruleSetVersion]",
"requestBodyCheck": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].requestBodyCheck]",
"maxRequestBodySizeInKb": "[if(parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].requestBodyCheck, parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].maxReqBodySize, json('null'))]",
"fileUploadLimitInMb": "[int(100)]"
},
"enableHttp2": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].enableHTTP2]"
},
"resources": [
{
"type": "providers/diagnosticSettings",
"name": "[concat('Microsoft.Insights/', parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].diagname)]",
"dependsOn": [
"[concat(variables('namePrefix'),parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].name)]"
],
"apiVersion": "2017-05-01-preview",
"properties": {
"name": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].diagname]",
"logs": [
{
"category": "ApplicationGatewayAccessLog",
"enabled": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].enableApplicationGatewayAccessLog]",
"retentionPolicy": {
"days": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].applicationGatewayAccessLogRetentionDays]",
"enabled": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].enableApplicationGatewayAccessLogRetention]"
}
},
{
"category": "ApplicationGatewayPerformanceLog",
"enabled": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].enableApplicationGatewayPerformanceLog]",
"retentionPolicy": {
"days": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].applicationGatewayPerformanceLogRetentionDays]",
"enabled": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].enableApplicationGatewayPerformanceLogRetention]"
}
},
{
"category": "ApplicationGatewayFirewallLog",
"enabled": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].enableApplicationGatewayFirewallLog]",
"retentionPolicy": {
"days": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].applicationGatewayFirewallLogRetentionDays]",
"enabled": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].enableApplicationGatewayFirewallLogRetention]"
}
}
],
"metrics": [
{
"category": "AllMetrics",
"enabled": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].enableAllMetrics]",
"retentionPolicy": {
"enabled": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].enableAllMetricsRetentionPolicy]",
"days": "[parameters('applicationGatewaySettings').settings[copyIndex('appgwCopy')].allMetricsRetentionDays]"
}
}
]
}
}
]
}
],
"outputs": {}
}
Updated Parameter File:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"namingSettings": {
"value": {
"name": {
"app": "demo",
"cloud": "azu",
"region": "eus2",
}
}
},
"taggingSettings": {
"value": {
"tags": {
"AppID": "demo",
"Environment": "nonprod",
}
}
},
"applicationGatewaySettings": {
"value": {
"settings": [
{
"name": "appgw-pcs01",
"applicationGatewaySku": "WAF_Medium",
"applicationGatewayTier": "WAF",
"applicationGatewayInstanceCount": 2,
"policyType": "Predefined",
"policy": "AppGwSslPolicy20170401S",
"publicIP": null,
"firewallMode": "Prevention",
"diagname": "Demo-Appgw",
"ruleSetType": "OWASP",
"ruleSetVersion": "3.0",
"requestBodyCheck": true,
"maxReqBodySize": 10,
"enableHTTP2": false,
"enableApplicationGatewayAccessLog": true,
"applicationGatewayAccessLogRetentionDays": 30,
"enableApplicationGatewayAccessLogRetention": true,
"enableApplicationGatewayPerformanceLog": true,
"applicationGatewayPerformanceLogRetentionDays": 30,
"enableApplicationGatewayPerformanceLogRetention": true,
"enableApplicationGatewayFirewallLog": true,
"applicationGatewayFirewallLogRetentionDays": 30,
"enableApplicationGatewayFirewallLogRetention": true,
"enableAllMetrics": true,
"enableAllMetricsRetentionPolicy": true,
"allMetricsRetentionDays": 30,
"frontendPorts": [
{
"name": "feport-80",
"properties": {
"port": 80
}
},
{
"name": "feport-443",
"properties": {
"port": 443
}
}
],
"gatewayIPConfigurations": [
{
"name": "gwipconfig-pcs01",
"properties": {
"subnet": {
"vnetName": "demo-vnet",
"vnetRGName": "demo",
"subnetName": "demo-subgw"
}
}
}
],
"sslCertificates": [
{
"name": "appgwfesslcert",
"properties": {
"data": null,
"password": "password"
}
}
],
"authenticationCertificates": [
{
"name": "appgwbecert",
"properties": {
"data": null
}
}
],
"frontEndIPConfigurations": [
{
"name": "feipcfg-pcs01",
"properties": {
"subnet": {
"vnetName": "demo-vnet",
"vnetRGName": "demo",
"subnetName": "demo-subgw"
}
}
}
],
"httpListeners": [
{
"name": "httplistener-pcs01",
"properties": {
"frontendIPConfiguration": "feipcfg-pcs01",
"frontendPort": "feport-80",
"protocol": "Http",
"sslCertificate": {}
}
},
{
"name": "httpslistener-pcs01",
"properties": {
"frontendIPConfiguration": "feipcfg-pcs01",
"frontendPort": "feport-443",
"protocol": "Https",
"sslCertificate": {
"id": "/subscriptions/105dcee5-gy46-48e3-9046-265c7379e647/resourceGroups/demo/providers/Microsoft.Network/applicationGateways/azu-eus2-nonprod-appgw-pcs01/sslCertificates/appgwfesslcert"
}
}
}
],
"backendHttpSettingsCollection": [
{
"name": "httpsetcol-default",
"properties": {
"protocol": "Http",
"port": 80,
"authenticationCertificates": []
}
},
{
"name": "httpssetcol-default",
"properties": {
"protocol": "Https",
"port": 443,
"authenticationCertificates": [
{
"id": "/subscriptions/105dcee5-gy46-48e3-9046-265c7379e647/resourceGroups/demo/providers/Microsoft.Network/applicationGateways/azu-eus2-nonprod-appgw-pcs01/authenticationCertificates/appgwbecert"
}
]
}
}
],
"backendAddressPools": [
{
"name": "beap-pcs01"
}
],
"requestRoutingRules": [
{
"name": "httpreqrtrule-pcs01",
"properties": {
"httpListener": "httplistener-pcs01",
"backendAddressPool": "beap-pcs01",
"backendHttpSettings": "httpsetcol-default"
}
},
{
"name": "httpsreqrtrule-pcs01",
"properties": {
"httpListener": "httpslistener-pcs01",
"backendAddressPool": "beap-pcs01",
"backendHttpSettings": "httpssetcol-default"
}
}
]
}
]
}
},
"appgwfesslcertsecret": {
"value": {
"reference": {
"keyVault": {
"id": "/subscriptions/105dcee5-gy46-48e3-9046-265c7379e647/resourceGroups/demo/providers/Microsoft.KeyVault/vaults/demo-kv-new"
},
"secretName": "appgwfesslcert"
}
}
},
"appgwbecertsecret": {
"value": {
"reference": {
"keyVault": {
"id": "/subscriptions/105dcee5-gy46-48e3-9046-265c7379e647/resourceGroups/demo/providers/Microsoft.KeyVault/vaults/demo-kv-new"
},
"secretName": "appgwbecert"
}
}
}
}
}
you can only reference KV secrets in the parameters section of the template (or parameters file). You cannot use it in a random place in the template
https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-tutorial-use-key-vault

Kubernetes MySQL pod keeps crashing and shows Unable to lock ./ibdata1 error: 11

I have created new docker image and added in kubernetes statefulset yaml for mysql pod. When I scaled mysql pod to 1 , it's keeps crashing and throwing message
unable to lock ./ibdata1 error: 11
I have googled lot about this error but none of them gave a solution. Appreciate if any one help me!
Docker file:
FROM mysql/mysql-server
CMD [ "--max_connections=10000" ]
And Created MySQL YAML like below:
{
"kind": "StatefulSet",
"apiVersion": "apps/v1beta2",
"metadata": {
"name": "mysql-test",
"namespace": "test",
"selfLink": "/apis/apps/v1beta2/namespaces/test/statefulsets/mysql-test",
"uid": "e7768a0b-faf9-11e9-a989-d8c497367e2a",
"resourceVersion": "315823479",
"generation": 33,
"creationTimestamp": "2019-10-30T09:44:44Z",
"labels": {
"app": "mysql-test",
"release": "mysql-test"
}
},
"spec": {
"replicas": 1,
"selector": {
"matchLabels": {
"app": "mysql-test"
}
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"app": "mysql-test"
}
},
"spec": {
"volumes": [
{
"name": "data",
"persistentVolumeClaim": {
"claimName": "mysqldata"
}
},
{
"name": "backup",
"persistentVolumeClaim": {
"claimName": "mysqlbackup"
}
}
],
"containers": [
{
"name": "latest",
"image": "<Enterprise repository>/careercompass/mysql:latest",
"ports": [
{
"name": "mysql",
"containerPort": 3306,
"protocol": "TCP"
}
],
"env": [
{
"name": "MYSQL_PASSWORD",
"valueFrom": {
"secretKeyRef": {
"name": "mysql",
"key": "mysql-password",
"optional": true
}
}
},
{
"name": "MYSQL_ROOT_PASSWORD",
"valueFrom": {
"secretKeyRef": {
"name": "mysql",
"key": "mysql-root-password",
"optional": true
}
}
},
{
"name": "MYSQL_USER",
"value": "mysql"
},
{
"name": "MYSQL_DATABASE"
}
],
"resources": {
"limits": {
"cpu": "10",
"memory": "10000Mi"
},
"requests": {
"cpu": "200m",
"memory": "3000Mi"
}
},
"volumeMounts": [
{
"name": "data",
"mountPath": "/var/lib/mysql"
},
{
"name": "backup",
"mountPath": "/var/lib/mysqlbackup"
}
],
"terminationMessagePath": "/var/lib/termination-log",
"terminationMessagePolicy": "File",
"imagePullPolicy": "IfNotPresent"
}
],
"restartPolicy": "Always",
"terminationGracePeriodSeconds": 30,
"dnsPolicy": "ClusterFirst",
"securityContext": {
"runAsUser": 999,
"fsGroup": 999
},
"schedulerName": "default-scheduler"
}
},
"serviceName": "",
"podManagementPolicy": "OrderedReady",
"updateStrategy": {
"type": "RollingUpdate",
"rollingUpdate": {
"partition": 0
}
},
"revisionHistoryLimit": 10
},
"status": {
"observedGeneration": 33,
"replicas": 1,
"currentReplicas": 1,
"updatedReplicas": 1,
"currentRevision": "mysql-test-68cb64885c",
"updateRevision": "mysql-test-68cb64885c",
"collisionCount": 0
}
}

Reading hierarchy of a JSON using value

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"
}
}
]
}