{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--iam.json",
  "description": "Collection of schemas to be used together with Aws IAM",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/lalcebo/json-schema/master/serverless/components/iam.json",
    "sourceSha256": "a25f0d8dc48b3bf7cc3c007043bb14ae673055ce3084e56b0906abdb42d647ee"
  },
  "type": "object",
  "id": "https://raw.githubusercontent.com/lalcebo/json-schema/master/serverless/components/iam.json",
  "schema": "https://json-schema.org/draft-07/schema#",
  "AwsIamConfiguration": {
    "title": "AwsIamConfiguration",
    "description": "The new IAM object definition with version 3. See docs here:- <https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml#iam-permissions>",
    "type": "object",
    "properties": {
      "stackPolicy": {
        "type": "array",
        "items": {
          "$ref": "#/AwsStackPolicyStatement"
        }
      },
      "role": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "object",
            "properties": {
              "statements": {
                "type": "array",
                "items": {
                  "$ref": "#/AwsIamRoleStatement"
                }
              },
              "name": {
                "type": "string"
              },
              "path": {
                "type": "string"
              },
              "managedPolicies": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "permissionsBoundary": {
                "type": "string"
              },
              "tags": {
                "type": "object",
                "additionalProperties": true
              }
            },
            "additionalProperties": false
          }
        ]
      },
      "deploymentRole": {
        "type": "string",
        "description": "ARN of an IAM role for CloudFormation service. If specified, CloudFormation uses the role's credentials"
      }
    },
    "additionalProperties": false
  },
  "additionalProperties": false,
  "required": [
    "AwsIamRoleStatement"
  ],
  "AwsIamRoleStatement": {
    "title": "AwsIamRoleStatement",
    "type": "object",
    "additionalProperties": false,
    "properties": {
      "Action": {
        "anyOf": [
          {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          {
            "additionalProperties": {},
            "type": "object"
          },
          {
            "type": "string"
          }
        ]
      },
      "Condition": {
        "additionalProperties": {},
        "type": "object"
      },
      "Effect": {
        "enum": [
          "Allow",
          "Deny"
        ],
        "type": "string"
      },
      "NotAction": {
        "anyOf": [
          {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          {
            "additionalProperties": {},
            "type": "object"
          },
          {
            "type": "string"
          }
        ]
      },
      "NotResource": {
        "anyOf": [
          {
            "items": {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_Function"
            },
            "type": "array"
          },
          {
            "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_Function"
          },
          {
            "type": "string"
          },
          {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        ]
      },
      "Resource": {
        "anyOf": [
          {
            "items": {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_Function"
            },
            "type": "array"
          },
          {
            "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_Function"
          },
          {
            "type": "string"
          },
          {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        ]
      },
      "Sid": {
        "type": "string"
      }
    }
  },
  "AwsStackPolicyAllowedAction": {
    "title": "AwsStackPolicyAllowedAction",
    "type": "string",
    "enum": [
      "Update:Modify",
      "Update:Replace",
      "Update:Delete",
      "Update:*"
    ]
  },
  "AwsStackPolicyStatement": {
    "title": "AwsStackPolicyStatement",
    "type": "object",
    "additionalProperties": false,
    "properties": {
      "Action": {
        "anyOf": [
          {
            "items": {
              "$ref": "#/AwsStackPolicyAllowedAction"
            },
            "type": "array"
          },
          {
            "$ref": "#/AwsStackPolicyAllowedAction"
          }
        ]
      },
      "NotAction": {
        "anyOf": [
          {
            "items": {
              "$ref": "#/AwsStackPolicyAllowedAction"
            },
            "type": "array"
          },
          {
            "$ref": "#/AwsStackPolicyAllowedAction"
          }
        ]
      },
      "Condition": {
        "additionalProperties": {},
        "type": "object"
      },
      "Effect": {
        "enum": [
          "Allow",
          "Deny"
        ],
        "type": "string"
      },
      "Resource": {
        "anyOf": [
          {
            "items": {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_Function"
            },
            "type": "array"
          },
          {
            "$ref": "https://catalog.lintel.tools/schemas/schemastore/serverless-framework-configuration/_shared/latest--cf.functions.json#/Aws_CF_Function"
          },
          {
            "type": "string"
          },
          {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        ]
      },
      "Principal": {
        "type": "string",
        "enum": [
          "*"
        ]
      }
    }
  }
}
