We have our files in BIM 360 container. We are trying to create the viewer app which consume the BIM360 file and display it in browser, the sample code which available in Forge site for Viewer is working fine in our local environment but we are facing issue with accessing BIM360 urn in same app (we already tried with the 3- legged authentication token too ). Could you please guide us to get the right URN for the file which are stored in BIM360 container? Please find the sample URN (we have converted to base64 while accessing in viewer app)which belongs to the DWG file in BIM360 , kindly let us know whether it is right one or not.
urn:adsk.objects:os.object:wip.dm.prod/7c21a6f0-41c9-42ae-a2b2-4b5741fa4d0c.dwg
urn:adsk.objects:os.object:wip.dm.prod/9ece42b9-c71c-4a27-90bb-87775f370164.dwg
Also please find the item details response json,
{
"jsonapi": {
"version": "1.0"
},
"links": {
"self": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/items/urn:adsk.wipprod:dm.lineage:1sbrvwIVRJ6J_hnfeVDA2g"
}
},
"data": {
"type": "items",
"id": "urn:adsk.wipprod:dm.lineage:1sbrvwIVRJ6J_hnfeVDA2g",
"attributes": {
"displayName": "bandra ga.dwg",
"createTime": "2021-02-16T11:06:47.0000000Z",
"createUserId": "8DCHNK3XFCM2",
"createUserName": "VBSL System Integrator",
"lastModifiedTime": "2021-02-16T11:06:47.0000000Z",
"lastModifiedUserId": "8DCHNK3XFCM2",
"lastModifiedUserName": "VBSL System Integrator",
"hidden": false,
"reserved": false,
"extension": {
"type": "items:autodesk.bim360:File",
"version": "1.0",
"schema": {
"href": "https://developer.api.autodesk.com/schema/v1/versions/items:autodesk.bim360:File-1.0"
},
"data": {
"sourceFileName": "bandra ga.dwg"
}
}
},
"links": {
"self": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/items/urn:adsk.wipprod:dm.lineage:1sbrvwIVRJ6J_hnfeVDA2g"
},
"webView": {
"href": "https://docs.b360.autodesk.com/projects/56fded29-645c-44b6-9498-29c0f9517fec/folders/urn%3Aadsk.wipprod%3Afs.folder%3Aco.nPlZOfdwQQiTrkXjS0FVVw/detail/viewer/items/urn%3Aadsk.wipprod%3Adm.lineage%3A1sbrvwIVRJ6J_hnfeVDA2g"
}
},
"relationships": {
"tip": {
"data": {
"type": "versions",
"id": "urn:adsk.wipprod:fs.file:vf.1sbrvwIVRJ6J_hnfeVDA2g?version=1"
},
"links": {
"related": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/items/urn:adsk.wipprod:dm.lineage:1sbrvwIVRJ6J_hnfeVDA2g/tip"
}
}
},
"versions": {
"links": {
"related": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/items/urn:adsk.wipprod:dm.lineage:1sbrvwIVRJ6J_hnfeVDA2g/versions"
}
}
},
"parent": {
"data": {
"type": "folders",
"id": "urn:adsk.wipprod:fs.folder:co.nPlZOfdwQQiTrkXjS0FVVw"
},
"links": {
"related": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/items/urn:adsk.wipprod:dm.lineage:1sbrvwIVRJ6J_hnfeVDA2g/parent"
}
}
},
"refs": {
"links": {
"self": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/items/urn:adsk.wipprod:dm.lineage:1sbrvwIVRJ6J_hnfeVDA2g/relationships/refs"
},
"related": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/items/urn:adsk.wipprod:dm.lineage:1sbrvwIVRJ6J_hnfeVDA2g/refs"
}
}
},
"links": {
"links": {
"self": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/items/urn:adsk.wipprod:dm.lineage:1sbrvwIVRJ6J_hnfeVDA2g/relationships/links"
}
}
}
}
},
"included": [
{
"type": "versions",
"id": "urn:adsk.wipprod:fs.file:vf.1sbrvwIVRJ6J_hnfeVDA2g?version=1",
"attributes": {
"name": "bandra ga.dwg",
"displayName": "bandra ga.dwg",
"createTime": "2021-02-16T11:06:47.0000000Z",
"createUserId": "8DCHNK3XFCM2",
"createUserName": "VBSL System Integrator",
"lastModifiedTime": "2021-02-16T11:08:00.0000000Z",
"lastModifiedUserId": "8DCHNK3XFCM2",
"lastModifiedUserName": "VBSL System Integrator",
"versionNumber": 1,
"storageSize": 2227450,
"fileType": "dwg",
"extension": {
"type": "versions:autodesk.bim360:File",
"version": "1.0",
"schema": {
"href": "https://developer.api.autodesk.com/schema/v1/versions/versions:autodesk.bim360:File-1.0"
},
"data": {
"processState": "PROCESSING_COMPLETE",
"extractionState": "SUCCESS",
"splittingState": "NOT_SPLIT",
"reviewState": "NOT_IN_REVIEW",
"revisionDisplayLabel": "1",
"sourceFileName": "bandra ga.dwg"
}
}
},
"links": {
"self": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/versions/urn:adsk.wipprod:fs.file:vf.1sbrvwIVRJ6J_hnfeVDA2g%3Fversion=1"
},
"webView": {
"href": "https://docs.b360.autodesk.com/projects/56fded29-645c-44b6-9498-29c0f9517fec/folders/urn%3Aadsk.wipprod%3Afs.folder%3Aco.nPlZOfdwQQiTrkXjS0FVVw/detail/viewer/items/urn%3Aadsk.wipprod%3Afs.file%3Avf.1sbrvwIVRJ6J_hnfeVDA2g%3Fversion%3D1"
}
},
"relationships": {
"item": {
"data": {
"type": "items",
"id": "urn:adsk.wipprod:dm.lineage:1sbrvwIVRJ6J_hnfeVDA2g"
},
"links": {
"related": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/versions/urn:adsk.wipprod:fs.file:vf.1sbrvwIVRJ6J_hnfeVDA2g%3Fversion=1/item"
}
}
},
"links": {
"links": {
"self": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/versions/urn:adsk.wipprod:fs.file:vf.1sbrvwIVRJ6J_hnfeVDA2g%3Fversion=1/relationships/links"
}
}
},
"refs": {
"links": {
"self": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/versions/urn:adsk.wipprod:fs.file:vf.1sbrvwIVRJ6J_hnfeVDA2g%3Fversion=1/relationships/refs"
},
"related": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/versions/urn:adsk.wipprod:fs.file:vf.1sbrvwIVRJ6J_hnfeVDA2g%3Fversion=1/refs"
}
}
},
"downloadFormats": {
"links": {
"related": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/versions/urn:adsk.wipprod:fs.file:vf.1sbrvwIVRJ6J_hnfeVDA2g%3Fversion=1/downloadFormats"
}
}
},
"derivatives": {
"data": {
"type": "derivatives",
"id": "dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLjFzYnJ2d0lWUko2Sl9obmZlVkRBMmc_dmVyc2lvbj0x"
},
"meta": {
"link": {
"href": "https://developer.api.autodesk.com/modelderivative/v2/designdata/dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLjFzYnJ2d0lWUko2Sl9obmZlVkRBMmc_dmVyc2lvbj0x/manifest?scopes=b360project.56fded29-645c-44b6-9498-29c0f9517fec,O2tenant.5902118"
}
}
},
"thumbnails": {
"data": {
"type": "thumbnails",
"id": "dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLjFzYnJ2d0lWUko2Sl9obmZlVkRBMmc_dmVyc2lvbj0x"
},
"meta": {
"link": {
"href": "https://developer.api.autodesk.com/modelderivative/v2/designdata/dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLjFzYnJ2d0lWUko2Sl9obmZlVkRBMmc_dmVyc2lvbj0x/thumbnail?scopes=b360project.56fded29-645c-44b6-9498-29c0f9517fec,O2tenant.5902118"
}
}
},
"storage": {
"data": {
"type": "objects",
"id": "urn:adsk.objects:os.object:wip.dm.prod/9ece42b9-c71c-4a27-90bb-87775f370164.dwg"
},
"meta": {
"link": {
"href": "https://developer.api.autodesk.com/oss/v2/buckets/wip.dm.prod/objects/9ece42b9-c71c-4a27-90bb-87775f370164.dwg?scopes=b360project.56fded29-645c-44b6-9498-29c0f9517fec,O2tenant.5902118"
}
}
}
}
}
]
}
It's here: dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLjFzYnJ2d0lWUko2Sl9obmZlVkRBMmc_dmVyc2lvbj0x
"derivatives": {
"data": {
"type": "derivatives",
"id": "dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLjFzYnJ2d0lWUko2Sl9obmZlVkRBMmc_dmVyc2lvbj0x"
},
"meta": {
"link": {
"href": "https://developer.api.autodesk.com/modelderivative/v2/designdata/dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLjFzYnJ2d0lWUko2Sl9obmZlVkRBMmc_dmVyc2lvbj0x/manifest?scopes=b360project.56fded29-645c-44b6-9498-29c0f9517fec,O2tenant.5902118"
}
}
},
To get the storage location of the an item (in your case urn:adsk.wipprod:dm.lineage:1sbrvwIVRJ6J_hnfeVDA2g), query the data of the tip (latest version) of the item using {{FORGE_HOST}}/data/v1/projects/:project/items/:item/tip (in your case, you can simply add /tip to your .links.self.href, ie. https://developer.api.autodesk.com/data/v1/projects/b.56fded29-645c-44b6-9498-29c0f9517fec/items/urn:adsk.wipprod:dm.lineage:1sbrvwIVRJ6J_hnfeVDA2g/tip.
This will return details of the latest version of the item (docs).
There, you should find data.relationships.storage.data.id, which is the the storage urn.
Related
I am trying to create a JSON file that will add env variables to a TFE workspace via API.. I am new to JSON so bear with me.. below is what I am trying to use but I can’t seem to get the brackets or formatting correct.. can someone help me out?
{
"data": {
"type":"vars",
"attributes": {
"key":"ID1",
"value":"xxxxxx",
"description":"",
"category":"terraform",
"hcl":false,
"sensitive":false
}
}
"data": {
"type":"vars",
"attributes": {
"key":"ID2",
"value":"xxxxxx",
"description":"",
"category":"terraform",
"hcl":false,
"sensitive":false
}
}
"data": {
"type":"vars",
"attributes": {
"key":"ID3",
"value":"xxxxxx",
"description":"",
"category":"terraform",
"hcl":false,
"sensitive":true
}
}
"data": {
"type":"vars",
"attributes": {
"key":"ID4",
"value":"xxxxxx",
"description":"",
"category":"terraform",
"hcl":false,
"sensitive":true
}
}
}
The following is a valid JSON payload:
{
"data": [
{
"type": "vars",
"attributes": {
"key": "ID1",
"value": "xxxxxx",
"description": "",
"category": "terraform",
"hcl": false,
"sensitive": false
}
},
{
"type": "vars",
"attributes": {
"key": "ID2",
"value": "xxxxxx",
"description": "",
"category": "terraform",
"hcl": false,
"sensitive": false
}
},
{
"type": "vars",
"attributes": {
"key": "ID3",
"value": "xxxxxx",
"description": "",
"category": "terraform",
"hcl": false,
"sensitive": true
}
},
{
"type": "vars",
"attributes": {
"key": "ID4",
"value": "xxxxxx",
"description": "",
"category": "terraform",
"hcl": false,
"sensitive": true
}
}
]
}
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
I am trying to flatten a nested JSON returned from a Rest source. The pipeline code is as follows.
The problem here is this pipeline returns only first object from JSON dataset and skips all the rest of the rows.
Can you please guide me on how to iterate over nested objects.
Thanks
Sameet
{
"name": "STG_NCR2",
"properties": {
"activities": [
{
"name": "Copy data1",
"type": "Copy",
"dependsOn": [],
"policy": {
"timeout": "7.00:00:00",
"retry": 0,
"retryIntervalInSeconds": 30,
"secureOutput": false,
"secureInput": false
},
"userProperties": [],
"typeProperties": {
"source": {
"type": "RestSource",
"httpRequestTimeout": "00:01:40",
"requestInterval": "00.00:00:00.010",
"requestMethod": "GET",
"additionalHeaders": {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Prefer": "odata.include-annotations=*"
}
},
"sink": {
"type": "AzureSqlSink"
},
"enableStaging": false,
"translator": {
"type": "TabularTranslator",
"mappings": [
{
"source": {
"path": "$['value'][0]['tco_ncrid']"
},
"sink": {
"name": "NCRID"
}
},
{
"source": {
"path": "['tco_name']"
},
"sink": {
"name": "EquipmentSerialNumber"
}
}
],
"collectionReference": "$['value'][0]['tco_ncr_tco_equipment']"
}
},
"inputs": [
{
"referenceName": "Rest_PowerApps_NCR",
"type": "DatasetReference"
}
],
"outputs": [
{
"referenceName": "Prestaging_PowerApps_NCREquipments",
"type": "DatasetReference"
}
]
}
],
"annotations": []
}
}
The JSON is in the following format
[
{
"value":[
{
"tco_ncrid":"abc-123",
"tco_ncr_tco_equipment":[
{
"tco_name":"abc"
}
]
},
{
"tco_ncrid":"abc-456",
"tco_ncr_tco_equipment":[
{
"tco_name":"xyz"
},
{
"tco_name":"yzx"
}
}
]
]
}
]
This can be resolved by amending the translator property as follows.
"translator": {
"type": "TabularTranslator",
"mappings": [
{
"source": {
"path": "$.['value'][0].['tco_ncrid']"
},
"sink": {
"name": "NCRID",
"type": "String"
}
},
{
"source": {
"path": "$.['value'][0].['tco_text_id']"
},
"sink": {
"name": "EquipmentDescription",
"type": "String"
}
},
{
"source": {
"path": "['tco_name']"
},
"sink": {
"name": "EquipmentSerialNumber",
"type": "String"
}
}
],
"collectionReference": "$.['value'][*].['tco_ncr_tco_equipment']"
}
This code forces the pipeline to iterate over nested array but as you can see that the NCRID is hardcoded to first element of the value array. This is not exactly what I want as I am looking for all Equipment Serial Numbers against every NCRID. Still researching...
According to the documentation (https://forge.autodesk.com/en/docs/data/v2/tutorials/download-file/)
I should get the storage object id from included.relationships.storage.data.id.
I can do it for all files uploaded to the bim360 except plans pdf files.
There is nothing about 'storage' in a whole response.
Here is "included" from my response:
'''
"included": [
{
"type": "versions",
"id": "XXX",
"attributes": {
"name": "1ST FLOOR PLAN",
"displayName": "1ST FLOOR PLAN",
"createTime": "2019-01-10T09:19:16Z",
"createUserId": "3MYGKJ73V3SD",
"createUserName": "XXX",
"lastModifiedTime": "2019-01-10T09:19:19Z",
"lastModifiedUserId": "XXX",
"lastModifiedUserName": "XXX",
"versionNumber": 1,
"extension": {
"type": "versions:autodesk.bim360:Document",
"version": "1.0",
"schema": {
"href": "https://developer.api.autodesk.com/schema/v1/versions/versions:autodesk.bim360:Document-1.0"
},
"data": {
"processState": "PROCESSING_COMPLETE",
"viewableId": "1",
"viewableGuid": "XXX",
"viewableName": "(1)",
"viewableOrder": 1,
"sourceFileName": "A1-1 DIMS FIRST FLOOR DIMENSION PLAN_V1_2019-01-10_09-54-54am.pdf"
}
}
},
"links": {
"self": {
"href": "XXX"
}
},
"relationships": {
"item": {
"data": {
"type": "items",
"id": "XXX"
},
"links": {
"related": {
"href": "XXX"
}
}
},
"refs": {
"links": {
"self": {
"href": "XXX"
},
"related": {
"href": "XXX"
}
}
},
"links": {
"links": {
"self": {
"href": "XXX"
}
}
},
"downloadFormats": {
"links": {
"related": {
"href": "XXX"
}
}
}
}
}
]
'''
How can I deal with it?
Yes, please call GET versions/:version_id/relationships/refs instead. Since the item listed in the Plan folder is a type of items:autodesk.bim360:Document, this type item won't have storage attribute shown in its responses of GET versions/:version_id and GET items/:item_id directly. see also here: Download a Document with Autodesk API
In addition to my last question ember.js JSONAPIAdapter with hasMany a colleague asked if the "kind-of"-sideloaded relationships in the working
JSON:API structure could be embedded like this:
{
"data": [
{
"type": "altersgruppe",
"id": "1",
"attributes": {
"name": "UNTER_21"
},
"relationships": {
"tarifbeitraege": {
"data": [
{
"type": "tarifbeitrag",
"id": "3",
"attributes": {
"name": "ZAHN70",
"beitrag": "3-29,70",
"proergaenzung": "7,00",
"gesamtbeitrag": "25.99"
}
},
{
"type": "tarifbeitrag",
"id": "4",
"attributes": {
"name": "ZAHN90",
"beitrag": "4-28,70",
"proergaenzung": "7,00",
"gesamtbeitrag": "30.99"
}
}
]
}
}
},
{
"type": "altersgruppe",
"id": "2",
"attributes": {
"name": "ALTER_21_24"
},
"relationships":{
"tarifbeitraege": {
"data": [
{
"type": "tarifbeitrag",
"id": "1",
"attributes": {
"name": "ZAHN70",
"beitrag": "1-25,70",
"proergaenzung": "7,00",
"gesamtbeitrag": "25.99"
}
},
{
"type": "tarifbeitrag",
"id": "2",
"attributes": {
"name": "ZAHN90",
"beitrag": "2-25,70",
"proergaenzung": "7,00",
"gesamtbeitrag": "25.99"
}
}]
}
}
}
]
}
The idea behind that: We can use relationships with less problems in the java backend (where sideloaded structures are harder to implement).
But the JSON above structure does not work. The store contains only the first level of data, which is "altersgruppe", but "tarifbeitraege" are empty.
This type of document is referred to as a compound document in the JSON:API specification.
The "relationships" section of a compound document is supposed to have only the relationships - individual objects there are supposed to be resource identifier objects. Putting attributes there doesn't work because that's not where they are supposed to be.
Instead, the full objects are side-loaded in a top-level "included" section. Thus, your response should probably look more like this:
{
"data": [
{
"type": "altersgruppe",
"id": "1",
"attributes": {
"name": "UNTER_21"
},
"relationships": {
"tarifbeitraege": {
"data": [
{ "type": "tarifbeitrag", "id": "3" },
{ "type": "tarifbeitrag", "id": "4" }
]
}
}
},
{
"type": "altersgruppe",
"id": "2",
"attributes": {
"name": "ALTER_21_24"
},
"relationships":{
"tarifbeitraege": {
"data": [
{ "type": "tarifbeitrag", "id": "1" },
{ "type": "tarifbeitrag", "id": "2" }
]
}
}
}
],
"included": [
{
"type": "tarifbeitrag",
"id": "3",
"attributes": {
"name": "ZAHN70",
"beitrag": "3-29,70",
"proergaenzung": "7,00",
"gesamtbeitrag": "25.99"
}
},
{
"type": "tarifbeitrag",
"id": "4",
"attributes": {
"name": "ZAHN90",
"beitrag": "4-28,70",
"proergaenzung": "7,00",
"gesamtbeitrag": "30.99"
}
},
{
"type": "tarifbeitrag",
"id": "1",
"attributes": {
"name": "ZAHN70",
"beitrag": "1-25,70",
"proergaenzung": "7,00",
"gesamtbeitrag": "25.99"
}
},
{
"type": "tarifbeitrag",
"id": "2",
"attributes": {
"name": "ZAHN90",
"beitrag": "2-25,70",
"proergaenzung": "7,00",
"gesamtbeitrag": "25.99"
}
}
]
}
There's an example on the home page of http://jsonapi.org that shows an example that includes a side load, as well as one in the section of the specification describing compound documents.