{
  "typeName" : "AWS::Events::Connection",
  "description" : "Resource Type definition for AWS::Events::Connection.",
  "definitions" : {
    "AuthParameters" : {
      "type" : "object",
      "minProperties" : 1,
      "maxProperties" : 2,
      "properties" : {
        "ApiKeyAuthParameters" : {
          "$ref" : "#/definitions/ApiKeyAuthParameters"
        },
        "BasicAuthParameters" : {
          "$ref" : "#/definitions/BasicAuthParameters"
        },
        "OAuthParameters" : {
          "$ref" : "#/definitions/OAuthParameters"
        },
        "InvocationHttpParameters" : {
          "$ref" : "#/definitions/ConnectionHttpParameters"
        },
        "ConnectivityParameters" : {
          "$ref" : "#/definitions/ConnectivityParameters"
        }
      },
      "oneOf" : [ {
        "required" : [ "BasicAuthParameters" ]
      }, {
        "required" : [ "OAuthParameters" ]
      }, {
        "required" : [ "ApiKeyAuthParameters" ]
      } ],
      "additionalProperties" : false
    },
    "BasicAuthParameters" : {
      "type" : "object",
      "properties" : {
        "Username" : {
          "type" : "string",
          "pattern" : "^[ \\t]*[^\\x00-\\x1F\\x7F]+([ \\t]+[^\\x00-\\x1F\\x7F]+)*[ \\t]*$"
        },
        "Password" : {
          "type" : "string",
          "pattern" : "^[ \\t]*[^\\x00-\\x1F\\x7F]+([ \\t]+[^\\x00-\\x1F\\x7F]+)*[ \\t]*$"
        }
      },
      "required" : [ "Username", "Password" ],
      "additionalProperties" : false
    },
    "OAuthParameters" : {
      "type" : "object",
      "properties" : {
        "ClientParameters" : {
          "$ref" : "#/definitions/ClientParameters"
        },
        "AuthorizationEndpoint" : {
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 2048,
          "pattern" : "^((%[0-9A-Fa-f]{2}|[-()_.!~*';/?:@\\x26=+$,A-Za-z0-9])+)([).!';/?:,])?$"
        },
        "HttpMethod" : {
          "type" : "string",
          "enum" : [ "GET", "POST", "PUT" ]
        },
        "OAuthHttpParameters" : {
          "$ref" : "#/definitions/ConnectionHttpParameters"
        }
      },
      "required" : [ "ClientParameters", "AuthorizationEndpoint", "HttpMethod" ],
      "additionalProperties" : false
    },
    "ApiKeyAuthParameters" : {
      "type" : "object",
      "properties" : {
        "ApiKeyName" : {
          "type" : "string",
          "pattern" : "^[ \\t]*[^\\x00-\\x1F\\x7F]+([ \\t]+[^\\x00-\\x1F\\x7F]+)*[ \\t]*$"
        },
        "ApiKeyValue" : {
          "type" : "string",
          "pattern" : "^[ \\t]*[^\\x00-\\x1F\\x7F]+([ \\t]+[^\\x00-\\x1F\\x7F]+)*[ \\t]*$"
        }
      },
      "required" : [ "ApiKeyName", "ApiKeyValue" ],
      "additionalProperties" : false
    },
    "ClientParameters" : {
      "type" : "object",
      "properties" : {
        "ClientID" : {
          "type" : "string",
          "pattern" : "^[ \\t]*[^\\x00-\\x1F\\x7F]+([ \\t]+[^\\x00-\\x1F\\x7F]+)*[ \\t]*$"
        },
        "ClientSecret" : {
          "type" : "string",
          "pattern" : "^[ \\t]*[^\\x00-\\x1F\\x7F]+([ \\t]+[^\\x00-\\x1F\\x7F]+)*[ \\t]*$"
        }
      },
      "required" : [ "ClientID", "ClientSecret" ],
      "additionalProperties" : false
    },
    "ConnectionHttpParameters" : {
      "type" : "object",
      "properties" : {
        "HeaderParameters" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/Parameter"
          }
        },
        "QueryStringParameters" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/Parameter"
          }
        },
        "BodyParameters" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/Parameter"
          }
        }
      },
      "additionalProperties" : false
    },
    "ConnectivityParameters" : {
      "type" : "object",
      "properties" : {
        "ResourceParameters" : {
          "$ref" : "#/definitions/ResourceParameters"
        }
      },
      "required" : [ "ResourceParameters" ],
      "additionalProperties" : false
    },
    "ResourceParameters" : {
      "type" : "object",
      "properties" : {
        "ResourceConfigurationArn" : {
          "type" : "string",
          "maxLength" : 2048,
          "pattern" : "^arn:[a-z0-9f\\-]+:vpc-lattice:[a-zA-Z0-9\\-]+:\\d{12}:resourceconfiguration/rcfg-[0-9a-z]{17}$"
        },
        "ResourceAssociationArn" : {
          "type" : "string",
          "minLength" : 20,
          "maxLength" : 2048,
          "pattern" : "^arn:[a-z0-9\\-]+:vpc-lattice:[a-zA-Z0-9\\-]+:\\d{12}:servicenetworkresourceassociation/snra-[0-9a-z]{17}$"
        }
      },
      "required" : [ "ResourceConfigurationArn" ],
      "additionalProperties" : false
    },
    "Parameter" : {
      "type" : "object",
      "properties" : {
        "Key" : {
          "type" : "string"
        },
        "Value" : {
          "type" : "string"
        },
        "IsValueSecret" : {
          "type" : "boolean",
          "default" : true
        }
      },
      "required" : [ "Key", "Value" ],
      "additionalProperties" : false
    }
  },
  "properties" : {
    "Name" : {
      "description" : "Name of the connection.",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 64,
      "pattern" : "[\\.\\-_A-Za-z0-9]+"
    },
    "Arn" : {
      "description" : "The arn of the connection resource.",
      "type" : "string",
      "pattern" : "^arn:aws([a-z]|\\-)*:events:([a-z]|\\d|\\-)*:([0-9]{12})?:connection\\/[\\.\\-_A-Za-z0-9]+\\/[\\-A-Za-z0-9]+$"
    },
    "ArnForPolicy" : {
      "description" : "The arn of the connection resource to be used in IAM policies.",
      "type" : "string",
      "pattern" : "^arn:aws([a-z]|\\-)*:events:([a-z]|\\d|\\-)*:([0-9]{12})?:connection\\/[\\.\\-_A-Za-z0-9]+$"
    },
    "SecretArn" : {
      "description" : "The arn of the secrets manager secret created in the customer account.",
      "type" : "string",
      "pattern" : "^arn:aws([a-z]|\\-)*:secretsmanager:([a-z]|\\d|\\-)*:([0-9]{12})?:secret:([a-z]|\\d|\\-)*(!)*[\\/_+=\\.@\\-A-Za-z0-9]+$"
    },
    "Description" : {
      "description" : "Description of the connection.",
      "type" : "string",
      "maxLength" : 512
    },
    "AuthorizationType" : {
      "type" : "string",
      "enum" : [ "API_KEY", "BASIC", "OAUTH_CLIENT_CREDENTIALS" ]
    },
    "AuthParameters" : {
      "$ref" : "#/definitions/AuthParameters"
    },
    "InvocationConnectivityParameters" : {
      "description" : "The private resource the HTTP request will be sent to.",
      "type" : "object",
      "properties" : {
        "ResourceParameters" : {
          "$ref" : "#/definitions/ResourceParameters"
        }
      },
      "required" : [ "ResourceParameters" ],
      "additionalProperties" : false
    },
    "KmsKeyIdentifier" : {
      "type" : "string",
      "maxLength" : 2048,
      "pattern" : "^[a-zA-Z0-9_\\-/:]*$"
    }
  },
  "additionalProperties" : false,
  "createOnlyProperties" : [ "/properties/Name" ],
  "readOnlyProperties" : [ "/properties/Arn", "/properties/ArnForPolicy", "/properties/SecretArn", "/properties/AuthParameters/ConnectivityParameters/ResourceParameters/ResourceAssociationArn", "/properties/InvocationConnectivityParameters/ResourceParameters/ResourceAssociationArn" ],
  "writeOnlyProperties" : [ "/properties/AuthParameters/BasicAuthParameters/Password", "/properties/AuthParameters/ApiKeyAuthParameters/ApiKeyValue", "/properties/AuthParameters/OAuthParameters/ClientParameters/ClientSecret", "/properties/AuthParameters/OAuthParameters/OAuthHttpParameters/HeaderParameters", "/properties/AuthParameters/OAuthParameters/OAuthHttpParameters/QueryStringParameters", "/properties/AuthParameters/OAuthParameters/OAuthHttpParameters/BodyParameters", "/properties/AuthParameters/InvocationHttpParameters" ],
  "primaryIdentifier" : [ "/properties/Name" ],
  "tagging" : {
    "taggable" : false,
    "tagOnCreate" : false,
    "tagUpdatable" : false,
    "cloudFormationSystemTags" : false
  },
  "handlers" : {
    "create" : {
      "permissions" : [ "events:CreateConnection", "events:DescribeConnection", "secretsmanager:CreateSecret", "secretsmanager:GetSecretValue", "secretsmanager:PutSecretValue", "iam:CreateServiceLinkedRole", "kms:DescribeKey", "kms:GenerateDataKey" ]
    },
    "read" : {
      "permissions" : [ "events:DescribeConnection", "kms:Decrypt" ]
    },
    "update" : {
      "permissions" : [ "events:UpdateConnection", "events:DescribeConnection", "secretsmanager:CreateSecret", "secretsmanager:UpdateSecret", "secretsmanager:GetSecretValue", "secretsmanager:PutSecretValue", "kms:Decrypt", "kms:DescribeKey", "kms:Encrypt", "kms:GenerateDataKey" ]
    },
    "delete" : {
      "permissions" : [ "events:DeleteConnection", "events:DescribeConnection" ]
    },
    "list" : {
      "permissions" : [ "events:ListConnections" ]
    }
  }
}