{
  "id": "storage/heartbeat",
  "description": "Allows readonly monitoring and health checks for storage resources",
  "platforms": {
    "aws": [
      {
        "grant": {
          "actions": [
            "s3:GetBucketLocation",
            "s3:GetBucketVersioning",
            "s3:GetLifecycleConfiguration",
            "s3:GetBucketPolicy",
            "s3:GetBucketAcl",
            "s3:GetEncryptionConfiguration",
            "s3:GetBucketPublicAccessBlock",
            "s3:ListBucketVersions"
          ]
        },
        "binding": {
          "stack": {
            "resources": ["arn:aws:s3:::${stackPrefix}-*"]
          },
          "resource": {
            "resources": ["arn:aws:s3:::${resourceName}"]
          }
        }
      }
    ],
    "gcp": [
      {
        "grant": {
          "permissions": [
            "storage.buckets.get",
            "storage.buckets.getIamPolicy",
            "storage.managedFolders.get",
            "storage.managedFolders.list",
            "storage.managedFolders.getIamPolicy",
            "storage.bucketOperations.get",
            "storage.bucketOperations.list",
            "storage.hmacKeys.get",
            "storage.hmacKeys.list"
          ]
        },
        "binding": {
          "stack": {
            "scope": "projects/${projectName}",
            "condition": {
              "title": "Stack prefixed storage management",
              "expression": "resource.type == 'storage.googleapis.com/Bucket' && resource.name.startsWith('projects/${projectName}/buckets/${stackPrefix}-')"
            }
          },
          "resource": {
            "scope": "projects/${projectName}/buckets/${resourceName}"
          }
        }
      }
    ],
    "azure": [
      {
        "grant": {
          "actions": [
            "Microsoft.Storage/storageAccounts/read",
            "Microsoft.Storage/storageAccounts/blobServices/containers/read"
          ]
        },
        "binding": {
          "stack": {
            "scope": "/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}"
          },
          "resource": {
            "scope": "/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/Microsoft.Storage/storageAccounts/${storageAccountName}"
          }
        }
      }
    ]
  }
}
