{
  "tagging" : {
    "permissions" : [ "directconnect:TagResource", "directconnect:UntagResource" ],
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "tagProperty" : "/properties/Tags",
    "cloudFormationSystemTags" : true
  },
  "typeName" : "AWS::DirectConnect::PrivateVirtualInterface",
  "readOnlyProperties" : [ "/properties/BgpPeers/*/BgpPeerId", "/properties/VirtualInterfaceArn", "/properties/VirtualInterfaceId" ],
  "description" : "Resource Type definition for AWS::DirectConnect::PrivateVirtualInterface",
  "createOnlyProperties" : [ "/properties/AllocatePrivateVirtualInterfaceRoleArn", "/properties/DirectConnectGatewayId", "/properties/VirtualGatewayId", "/properties/Vlan" ],
  "primaryIdentifier" : [ "/properties/VirtualInterfaceArn" ],
  "required" : [ "BgpPeers", "ConnectionId", "VirtualInterfaceName", "Vlan" ],
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-rpdk.git",
  "propertyTransform" : {
    "/properties/DirectConnectGatewayId" : "$substringAfter(DirectConnectGatewayId, \"/\")",
    "/properties/ConnectionId" : "$lowercase($substringAfter(ConnectionId, \"/\"))",
    "/properties/VirtualGatewayId" : "$lowercase($substringAfter(VirtualGatewayId, \"/\"))"
  },
  "oneOf" : [ {
    "required" : [ "DirectConnectGatewayId" ]
  }, {
    "required" : [ "VirtualGatewayId" ]
  } ],
  "handlers" : {
    "read" : {
      "permissions" : [ "directconnect:DescribeVirtualInterfaces" ]
    },
    "create" : {
      "permissions" : [ "directconnect:ConfirmPrivateVirtualInterface", "directconnect:CreateBGPPeer", "directconnect:CreatePrivateVirtualInterface", "directconnect:DescribeVirtualInterfaces", "directconnect:TagResource", "sts:AssumeRole" ]
    },
    "update" : {
      "permissions" : [ "directconnect:AssociateVirtualInterface", "directconnect:CreateBGPPeer", "directconnect:DeleteBGPPeer", "directconnect:DescribeVirtualInterfaces", "directconnect:TagResource", "directconnect:UntagResource", "directconnect:UpdateVirtualInterfaceAttributes" ]
    },
    "list" : {
      "permissions" : [ "directconnect:DescribeVirtualInterfaces" ]
    },
    "delete" : {
      "permissions" : [ "directconnect:DeleteVirtualInterface", "directconnect:DescribeVirtualInterfaces" ]
    }
  },
  "writeOnlyProperties" : [ "/properties/AllocatePrivateVirtualInterfaceRoleArn" ],
  "additionalIdentifiers" : [ [ "/properties/VirtualInterfaceId" ] ],
  "additionalProperties" : false,
  "definitions" : {
    "BgpPeer" : {
      "description" : "Information about a BGP peer.",
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "BgpPeerId" : {
          "pattern" : "^dxpeer-[a-z0-9]{8}$",
          "type" : "string"
        },
        "AuthKey" : {
          "pattern" : "^[A-Za-z0-9\\\\!\"#$%&'()*+,\\-./:;<=>?@\\[\\]\\^_`{|}~]{6,80}$",
          "description" : "The authentication key for BGP configuration. This string has a minimum length of 6 characters and and a maximum length of 80 characters.",
          "type" : "string"
        },
        "AddressFamily" : {
          "pattern" : "^(ipv4)|(ipv6)$",
          "description" : "The address family for the BGP peer.",
          "type" : "string"
        },
        "AmazonAddress" : {
          "pattern" : "^[0-9a-fA-F:.]+/[0-9]+$",
          "description" : "The IP address assigned to the Amazon interface.",
          "type" : "string"
        },
        "Asn" : {
          "pattern" : "^[1-9][0-9]*$",
          "description" : "The autonomous system (AS) number for Border Gateway Protocol (BGP) configuration.",
          "type" : "string"
        },
        "CustomerAddress" : {
          "pattern" : "^[0-9a-fA-F:.]+/[0-9]+$",
          "description" : "The IP address assigned to the customer interface.",
          "type" : "string"
        }
      },
      "required" : [ "AddressFamily", "Asn" ]
    },
    "Tag" : {
      "description" : "A key-value pair to associate with a resource.",
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "Value" : {
          "minLength" : 0,
          "description" : "The value for the tag. You can specify a value that is 0 to 256 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.",
          "type" : "string",
          "maxLength" : 256
        },
        "Key" : {
          "minLength" : 1,
          "description" : "The key name of the tag. You can specify a value that is 1 to 128 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.",
          "type" : "string",
          "maxLength" : 128
        }
      },
      "required" : [ "Key", "Value" ]
    }
  },
  "replacementStrategy" : "delete_then_create",
  "properties" : {
    "BgpPeers" : {
      "minItems" : 1,
      "maxItems" : 2,
      "uniqueItems" : true,
      "description" : "The BGP peers configured on this virtual interface.",
      "insertionOrder" : false,
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/BgpPeer"
      }
    },
    "ConnectionId" : {
      "pattern" : "^((arn:aws[a-z-]*:directconnect:[a-z0-9-]+:[0-9]{12}:(dxcon/dxcon|dxlag/dxlag))|dx(con|lag))-[a-z0-9A-Z]{8,21}$",
      "description" : "The ID or ARN of the connection or LAG.",
      "anyOf" : [ {
        "relationshipRef" : {
          "typeName" : "AWS::DirectConnect::Connection",
          "propertyPath" : "/properties/ConnectionId"
        }
      }, {
        "relationshipRef" : {
          "typeName" : "AWS::DirectConnect::Connection",
          "propertyPath" : "/properties/ConnectionArn"
        }
      }, {
        "relationshipRef" : {
          "typeName" : "AWS::DirectConnect::Lag",
          "propertyPath" : "/properties/LagId"
        }
      }, {
        "relationshipRef" : {
          "typeName" : "AWS::DirectConnect::Lag",
          "propertyPath" : "/properties/LagArn"
        }
      } ],
      "type" : "string"
    },
    "AllocatePrivateVirtualInterfaceRoleArn" : {
      "pattern" : "^arn:aws[a-z-]*:iam::[0-9]{12}:role/.+$",
      "description" : "The Amazon Resource Name (ARN) of the role to allocate the private virtual interface. Needs directconnect:AllocatePrivateVirtualInterface permissions and tag permissions if applicable.",
      "type" : "string"
    },
    "DirectConnectGatewayId" : {
      "pattern" : "^(arn:aws[a-z-]*:directconnect::[0-9]{12}:dx-gateway/)?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
      "description" : "The ID or ARN of the Direct Connect gateway.",
      "anyOf" : [ {
        "relationshipRef" : {
          "typeName" : "AWS::DirectConnect::DirectConnectGateway",
          "propertyPath" : "/properties/DirectConnectGatewayId"
        }
      }, {
        "relationshipRef" : {
          "typeName" : "AWS::DirectConnect::DirectConnectGateway",
          "propertyPath" : "/properties/DirectConnectGatewayArn"
        }
      } ],
      "type" : "string"
    },
    "EnableSiteLink" : {
      "description" : "Indicates whether to enable or disable SiteLink.",
      "type" : "boolean"
    },
    "VirtualInterfaceId" : {
      "pattern" : "^dxvif-[a-z0-9]{8}$",
      "description" : "The ID of the virtual interface.",
      "type" : "string"
    },
    "VirtualInterfaceName" : {
      "pattern" : "^[\\w \\-_,\\/]{1,100}$",
      "description" : "The name of the virtual interface assigned by the customer network. The name has a maximum of 100 characters. The following are valid characters: a-z, 0-9 and a hyphen (-).",
      "type" : "string"
    },
    "VirtualInterfaceArn" : {
      "pattern" : "^arn:aws[a-z-]*:directconnect:[a-z0-9-]+:[0-9]{12}:dxvif/dxvif-[a-z0-9]{8}$",
      "description" : "The ID of the virtual interface.",
      "type" : "string"
    },
    "Vlan" : {
      "description" : "The ID of the VLAN.",
      "maximum" : 4095,
      "type" : "integer",
      "minimum" : 0
    },
    "VirtualGatewayId" : {
      "pattern" : "^(arn:aws[a-z-]*:ec2:[a-z0-9-]+:[0-9]{12}:vpn-gateway/)?vgw-[a-zA-Z0-9]{8,32}$",
      "description" : "The ID or ARN of the virtual private gateway.",
      "type" : "string"
    },
    "Tags" : {
      "minItems" : 1,
      "uniqueItems" : true,
      "description" : "The tags associated with the private virtual interface.",
      "insertionOrder" : false,
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    },
    "Mtu" : {
      "description" : "The maximum transmission unit (MTU), in bytes. The supported values are 1500 and 9001. The default value is 1500.",
      "type" : "integer"
    }
  }
}