function _M.addResource()

in scripts/lua/management/lib/resources.lua [30:42]


function _M.addResource(dataStore, resource, gatewayPath, tenantObj)
  
  local redisKey = utils.concatStrings({"resources:", tenantObj.id, ":", gatewayPath})
  local operations = resource.operations
  local apiId = resource.apiId
  local cors = resource.cors
  local resourceObj = dataStore:generateResourceObj(operations, apiId, tenantObj, cors)
  print ('setting snapshot for id: ' .. tenantObj.id)
  dataStore:setSnapshotId(tenantObj.id)
  dataStore:createResource(redisKey, REDIS_FIELD, resourceObj)
  local indexKey = utils.concatStrings({"resources:", tenantObj.id, ":__index__"})
  dataStore:addResourceToIndex(indexKey, redisKey)
end