{
  "typeName" : "AWS::CodePipeline::Webhook",
  "description" : "Resource Type definition for AWS::CodePipeline::Webhook",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-codepipeline-webhook",
  "definitions" : {
    "WebhookFilterRule" : {
      "description" : "A list of rules applied to the body/payload sent in the POST request to a webhook URL. All defined rules must pass for the request to be accepted and the pipeline started.",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "JsonPath" : {
          "description" : "A JsonPath expression that is applied to the body/payload of the webhook. The value selected by the JsonPath expression must match the value specified in the MatchEquals field. Otherwise, the request is ignored.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 150
        },
        "MatchEquals" : {
          "description" : "The value selected by the JsonPath expression must match what is supplied in the MatchEquals field. Otherwise, the request is ignored.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 150
        }
      },
      "required" : [ "JsonPath" ]
    },
    "WebhookAuthConfiguration" : {
      "description" : "Properties that configure the authentication applied to incoming webhook trigger requests",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "AllowedIPRange" : {
          "description" : "The property used to configure acceptance of webhooks in an IP address range. For IP, only the AllowedIPRange property must be set. This property must be set to a valid CIDR range.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 100
        },
        "SecretToken" : {
          "description" : "The property used to configure GitHub authentication. For GITHUB_HMAC, only the SecretToken property must be set.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 100
        }
      }
    }
  },
  "properties" : {
    "AuthenticationConfiguration" : {
      "description" : "Properties that configure the authentication applied to incoming webhook trigger requests",
      "$ref" : "#/definitions/WebhookAuthConfiguration"
    },
    "Filters" : {
      "description" : "A list of rules applied to the body/payload sent in the POST request to a webhook URL",
      "type" : "array",
      "uniqueItems" : false,
      "insertionOrder" : true,
      "items" : {
        "$ref" : "#/definitions/WebhookFilterRule"
      }
    },
    "Authentication" : {
      "description" : "Supported options are GITHUB_HMAC, IP, and UNAUTHENTICATED.",
      "type" : "string",
      "enum" : [ "GITHUB_HMAC", "IP", "UNAUTHENTICATED" ]
    },
    "TargetPipeline" : {
      "description" : "The name of the pipeline you want to connect to the webhook.",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 100,
      "pattern" : "[A-Za-z0-9.@\\-_]+"
    },
    "TargetAction" : {
      "description" : "The name of the action in a pipeline you want to connect to the webhook.",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 100,
      "pattern" : "[A-Za-z0-9.@\\-_]+"
    },
    "Id" : {
      "description" : "logical id of the webhook",
      "type" : "string"
    },
    "Url" : {
      "description" : "The webhook URL generated by AWS CodePipeline",
      "type" : "string"
    },
    "Name" : {
      "description" : "The name of the webhook",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 100,
      "pattern" : "[A-Za-z0-9.@\\-_]+"
    },
    "TargetPipelineVersion" : {
      "description" : "The version number of the pipeline to be connected to the trigger request.",
      "type" : "integer"
    },
    "RegisterWithThirdParty" : {
      "description" : "Configures a connection between the webhook that was created and the external tool with events to be detected.",
      "type" : "boolean"
    }
  },
  "additionalProperties" : false,
  "required" : [ "AuthenticationConfiguration", "Filters", "Authentication", "TargetPipeline", "TargetAction" ],
  "createOnlyProperties" : [ "/properties/Name" ],
  "readOnlyProperties" : [ "/properties/Id", "/properties/Url" ],
  "writeOnlyProperties" : [ "/properties/TargetPipelineVersion", "/properties/RegisterWithThirdParty" ],
  "primaryIdentifier" : [ "/properties/Id" ],
  "tagging" : {
    "taggable" : false
  },
  "handlers" : {
    "create" : {
      "permissions" : [ "codepipeline:ListWebhooks", "codepipeline:RegisterWebhookWithThirdParty", "codepipeline:PutWebhook" ]
    },
    "read" : {
      "permissions" : [ "codepipeline:ListWebhooks" ]
    },
    "update" : {
      "permissions" : [ "codepipeline:ListWebhooks", "codepipeline:RegisterWebhookWithThirdParty", "codepipeline:PutWebhook", "codepipeline:DeregisterWebhookWithThirdParty" ]
    },
    "delete" : {
      "permissions" : [ "codepipeline:ListWebhooks", "codepipeline:DeleteWebhook", "codepipeline:DeregisterWebhookWithThirdParty" ]
    },
    "list" : {
      "permissions" : [ "codepipeline:ListWebhooks" ]
    }
  }
}