{
  "typeName" : "AWS::AppSync::Api",
  "description" : "Resource schema for AppSync Api",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-rpdk.git",
  "definitions" : {
    "EventConfig" : {
      "description" : "The configuration for an Event Api",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "AuthProviders" : {
          "$ref" : "#/definitions/AuthProviders"
        },
        "ConnectionAuthModes" : {
          "$ref" : "#/definitions/AuthModes"
        },
        "DefaultPublishAuthModes" : {
          "$ref" : "#/definitions/AuthModes"
        },
        "DefaultSubscribeAuthModes" : {
          "$ref" : "#/definitions/AuthModes"
        },
        "LogConfig" : {
          "$ref" : "#/definitions/EventLogConfig"
        }
      },
      "required" : [ "AuthProviders", "ConnectionAuthModes", "DefaultPublishAuthModes", "DefaultSubscribeAuthModes" ]
    },
    "AuthMode" : {
      "description" : "An auth mode.",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "AuthType" : {
          "$ref" : "#/definitions/AuthenticationType"
        }
      }
    },
    "AuthModes" : {
      "description" : "A list of auth modes for the AppSync API.",
      "type" : "array",
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/AuthMode"
      }
    },
    "AuthenticationType" : {
      "description" : "Security configuration for your AppSync API.",
      "type" : "string",
      "enum" : [ "AMAZON_COGNITO_USER_POOLS", "AWS_IAM", "API_KEY", "OPENID_CONNECT", "AWS_LAMBDA" ]
    },
    "OpenIDConnectConfig" : {
      "description" : "The OpenID Connect configuration.",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "ClientId" : {
          "type" : "string"
        },
        "AuthTTL" : {
          "type" : "number"
        },
        "Issuer" : {
          "type" : "string"
        },
        "IatTTL" : {
          "type" : "number"
        }
      },
      "required" : [ "Issuer" ]
    },
    "CognitoConfig" : {
      "description" : "Optional authorization configuration for using Amazon Cognito user pools with your API endpoint.",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "AppIdClientRegex" : {
          "type" : "string"
        },
        "UserPoolId" : {
          "type" : "string"
        },
        "AwsRegion" : {
          "type" : "string"
        }
      },
      "required" : [ "UserPoolId", "AwsRegion" ]
    },
    "LambdaAuthorizerConfig" : {
      "description" : "A LambdaAuthorizerConfig holds configuration on how to authorize AWS AppSync API access when using the AWS_LAMBDA authorizer mode. Be aware that an AWS AppSync API may have only one Lambda authorizer configured at a time.",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "AuthorizerResultTtlInSeconds" : {
          "type" : "integer",
          "minimum" : 0,
          "maximum" : 3600
        },
        "AuthorizerUri" : {
          "type" : "string"
        },
        "IdentityValidationExpression" : {
          "type" : "string"
        }
      },
      "required" : [ "AuthorizerUri" ]
    },
    "AuthProviders" : {
      "description" : "A list of auth providers for the AppSync API.",
      "type" : "array",
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/AuthProvider"
      }
    },
    "AuthProvider" : {
      "description" : "An auth provider for the AppSync API.",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "AuthType" : {
          "$ref" : "#/definitions/AuthenticationType"
        },
        "OpenIDConnectConfig" : {
          "$ref" : "#/definitions/OpenIDConnectConfig"
        },
        "CognitoConfig" : {
          "$ref" : "#/definitions/CognitoConfig"
        },
        "LambdaAuthorizerConfig" : {
          "$ref" : "#/definitions/LambdaAuthorizerConfig"
        }
      },
      "required" : [ "AuthType" ]
    },
    "Tag" : {
      "description" : "An arbitrary set of tags (key-value pairs) for this AppSync API.",
      "type" : "object",
      "properties" : {
        "Key" : {
          "description" : "A string used to identify this tag. You can specify a maximum of 128 characters for a tag key.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 128,
          "pattern" : "^(?!aws:)[ a-zA-Z+-=._:/]+$"
        },
        "Value" : {
          "description" : "A string containing the value for this tag. You can specify a maximum of 256 characters for a tag value.",
          "type" : "string",
          "minLength" : 0,
          "maxLength" : 256,
          "pattern" : "^[\\s\\w+-=\\.:/@]*$"
        }
      },
      "required" : [ "Key", "Value" ],
      "additionalProperties" : false
    },
    "Tags" : {
      "description" : "An arbitrary set of tags (key-value pairs) for this AppSync API.",
      "type" : "array",
      "uniqueItems" : true,
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    },
    "ApiName" : {
      "description" : "The name of the AppSync API.",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 50,
      "pattern" : "[A-Za-z0-9_\\-\\ ]+"
    },
    "OwnerContact" : {
      "description" : "The owner contact information for an API resource.",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 250,
      "pattern" : "[A-Za-z0-9_\\-\\ \\.]+"
    },
    "DnsMap" : {
      "description" : "A map of DNS names for the AppSync API.",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Realtime" : {
          "type" : "string"
        },
        "Http" : {
          "type" : "string"
        }
      }
    },
    "EventLogLevel" : {
      "description" : "Logging level for the AppSync API.",
      "type" : "string",
      "enum" : [ "NONE", "ERROR", "ALL", "INFO", "DEBUG" ]
    },
    "EventLogConfig" : {
      "description" : "The log config for the AppSync API.",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "LogLevel" : {
          "$ref" : "#/definitions/EventLogLevel"
        },
        "CloudWatchLogsRoleArn" : {
          "type" : "string"
        }
      },
      "required" : [ "LogLevel", "CloudWatchLogsRoleArn" ]
    }
  },
  "properties" : {
    "ApiId" : {
      "description" : "The unique identifier for the AppSync Api generated by the service",
      "type" : "string"
    },
    "ApiArn" : {
      "description" : "The Amazon Resource Name (ARN) of the AppSync Api",
      "type" : "string"
    },
    "Name" : {
      "$ref" : "#/definitions/ApiName"
    },
    "OwnerContact" : {
      "$ref" : "#/definitions/OwnerContact"
    },
    "Dns" : {
      "$ref" : "#/definitions/DnsMap"
    },
    "EventConfig" : {
      "$ref" : "#/definitions/EventConfig"
    },
    "Tags" : {
      "$ref" : "#/definitions/Tags"
    }
  },
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "appsync:TagResource", "appsync:UntagResource" ]
  },
  "additionalProperties" : false,
  "required" : [ "Name" ],
  "readOnlyProperties" : [ "/properties/ApiId", "/properties/Dns", "/properties/Dns/Realtime", "/properties/Dns/Http", "/properties/ApiArn" ],
  "primaryIdentifier" : [ "/properties/ApiArn" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "appsync:CreateApi", "appsync:TagResource", "appsync:GetApi", "iam:PassRole" ]
    },
    "read" : {
      "permissions" : [ "appsync:GetApi", "appsync:ListTagsForResource" ]
    },
    "update" : {
      "permissions" : [ "appsync:UpdateApi", "appsync:TagResource", "appsync:UntagResource", "appsync:GetApi", "iam:PassRole" ]
    },
    "delete" : {
      "permissions" : [ "appsync:DeleteApi", "appsync:UntagResource" ]
    },
    "list" : {
      "permissions" : [ "appsync:ListApis" ]
    }
  }
}