{
  "typeName" : "AWS::XRay::SamplingRule",
  "description" : "This schema provides construct and validation rules for AWS-XRay SamplingRule resource parameters.",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-rpdk.git",
  "properties" : {
    "SamplingRule" : {
      "$ref" : "#/definitions/SamplingRule"
    },
    "SamplingRuleRecord" : {
      "$ref" : "#/definitions/SamplingRuleRecord"
    },
    "SamplingRuleUpdate" : {
      "$ref" : "#/definitions/SamplingRuleUpdate"
    },
    "RuleARN" : {
      "$ref" : "#/definitions/RuleARN"
    },
    "RuleName" : {
      "$ref" : "#/definitions/RuleName"
    },
    "Tags" : {
      "$ref" : "#/definitions/Tags"
    }
  },
  "definitions" : {
    "SamplingRule" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Attributes" : {
          "$comment" : "String to string map",
          "description" : "Matches attributes derived from the request.",
          "type" : "object",
          "patternProperties" : {
            ".{1,}" : {
              "type" : "string"
            }
          },
          "additionalProperties" : false
        },
        "FixedRate" : {
          "description" : "The percentage of matching requests to instrument, after the reservoir is exhausted.",
          "type" : "number",
          "minimum" : 0,
          "maximum" : 1
        },
        "Host" : {
          "description" : "Matches the hostname from a request URL.",
          "type" : "string",
          "maxLength" : 64
        },
        "HTTPMethod" : {
          "description" : "Matches the HTTP method from a request URL.",
          "type" : "string",
          "maxLength" : 10
        },
        "Priority" : {
          "description" : "The priority of the sampling rule.",
          "type" : "integer",
          "minimum" : 1,
          "maximum" : 9999
        },
        "ReservoirSize" : {
          "description" : "A fixed number of matching requests to instrument per second, prior to applying the fixed rate. The reservoir is not used directly by services, but applies to all services using the rule collectively.",
          "type" : "integer",
          "minimum" : 0
        },
        "ResourceARN" : {
          "description" : "Matches the ARN of the AWS resource on which the service runs.",
          "type" : "string",
          "maxLength" : 500
        },
        "RuleARN" : {
          "$ref" : "#/definitions/RuleARN"
        },
        "RuleName" : {
          "$ref" : "#/definitions/RuleName"
        },
        "ServiceName" : {
          "description" : "Matches the name that the service uses to identify itself in segments.",
          "type" : "string",
          "maxLength" : 64
        },
        "ServiceType" : {
          "description" : "Matches the origin that the service uses to identify its type in segments.",
          "type" : "string",
          "maxLength" : 64
        },
        "URLPath" : {
          "description" : "Matches the path from a request URL.",
          "type" : "string",
          "maxLength" : 128
        },
        "Version" : {
          "description" : "The version of the sampling rule format (1)",
          "type" : "integer",
          "minimum" : 1
        },
        "SamplingRateBoost" : {
          "$ref" : "#/definitions/SamplingRateBoost"
        }
      },
      "required" : [ "FixedRate", "Host", "HTTPMethod", "Priority", "ReservoirSize", "ResourceARN", "ServiceName", "ServiceType", "URLPath" ]
    },
    "SamplingRuleRecord" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "CreatedAt" : {
          "description" : "When the rule was created, in Unix time seconds.",
          "type" : "string"
        },
        "ModifiedAt" : {
          "description" : "When the rule was modified, in Unix time seconds.",
          "type" : "string"
        },
        "SamplingRule" : {
          "$ref" : "#/definitions/SamplingRule"
        }
      }
    },
    "SamplingRuleUpdate" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Attributes" : {
          "$comment" : "String to string map",
          "description" : "Matches attributes derived from the request.",
          "type" : "object",
          "patternProperties" : {
            ".{1,}" : {
              "type" : "string"
            }
          },
          "additionalProperties" : false
        },
        "FixedRate" : {
          "description" : "The percentage of matching requests to instrument, after the reservoir is exhausted.",
          "type" : "number",
          "minimum" : 0,
          "maximum" : 1
        },
        "Host" : {
          "description" : "Matches the hostname from a request URL.",
          "type" : "string",
          "maxLength" : 64
        },
        "HTTPMethod" : {
          "description" : "Matches the HTTP method from a request URL.",
          "type" : "string",
          "maxLength" : 10
        },
        "Priority" : {
          "description" : "The priority of the sampling rule.",
          "type" : "integer",
          "minimum" : 1,
          "maximum" : 9999
        },
        "ReservoirSize" : {
          "description" : "A fixed number of matching requests to instrument per second, prior to applying the fixed rate. The reservoir is not used directly by services, but applies to all services using the rule collectively.",
          "type" : "integer",
          "minimum" : 0
        },
        "ResourceARN" : {
          "description" : "Matches the ARN of the AWS resource on which the service runs.",
          "type" : "string",
          "maxLength" : 500
        },
        "RuleARN" : {
          "$ref" : "#/definitions/RuleARN"
        },
        "RuleName" : {
          "$ref" : "#/definitions/RuleName"
        },
        "ServiceName" : {
          "description" : "Matches the name that the service uses to identify itself in segments.",
          "type" : "string",
          "maxLength" : 64
        },
        "ServiceType" : {
          "description" : "Matches the origin that the service uses to identify its type in segments.",
          "type" : "string",
          "maxLength" : 64
        },
        "URLPath" : {
          "description" : "Matches the path from a request URL.",
          "type" : "string",
          "maxLength" : 128
        },
        "SamplingRateBoost" : {
          "$ref" : "#/definitions/SamplingRateBoost"
        }
      }
    },
    "SamplingRateBoost" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "MaxRate" : {
          "description" : "The maximum sampling rate X-Ray will apply when it detects anomalies. X-Ray determines the appropriate rate between your baseline and the maximum, depending on anomaly activity.",
          "type" : "number",
          "minimum" : 0,
          "maximum" : 1
        },
        "CooldownWindowMinutes" : {
          "description" : "Time window (in minutes) in which only one sampling rate boost can be triggered. After a boost occurs, no further boosts are allowed until the next window.",
          "type" : "integer",
          "minimum" : 1
        }
      },
      "required" : [ "MaxRate", "CooldownWindowMinutes" ]
    },
    "RuleName" : {
      "description" : "The ARN of the sampling rule. Specify a rule by either name or ARN, but not both.",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 32
    },
    "RuleARN" : {
      "description" : "The ARN of the sampling rule. Specify a rule by either name or ARN, but not both.",
      "type" : "string"
    },
    "Tag" : {
      "type" : "object",
      "properties" : {
        "Key" : {
          "type" : "string",
          "description" : "The key name of the tag."
        },
        "Value" : {
          "type" : "string",
          "description" : "The value for the tag."
        }
      },
      "required" : [ "Key", "Value" ],
      "additionalProperties" : false
    },
    "Tags" : {
      "type" : "array",
      "insertionOrder" : false,
      "description" : "An array of key-value pairs to apply to this resource.",
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    }
  },
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "xray:TagResource", "xray:UntagResource", "xray:ListTagsForResource" ]
  },
  "handlers" : {
    "create" : {
      "permissions" : [ "xray:CreateSamplingRule", "xray:TagResource", "xray:ListTagsForResource" ]
    },
    "read" : {
      "permissions" : [ "xray:GetSamplingRules", "xray:ListTagsForResource" ]
    },
    "update" : {
      "permissions" : [ "xray:UpdateSamplingRule", "xray:TagResource", "xray:UntagResource", "xray:ListTagsForResource" ]
    },
    "delete" : {
      "permissions" : [ "xray:DeleteSamplingRule" ]
    },
    "list" : {
      "permissions" : [ "xray:GetSamplingRules", "xray:ListTagsForResource" ]
    }
  },
  "additionalProperties" : false,
  "primaryIdentifier" : [ "/properties/RuleARN" ],
  "createOnlyProperties" : [ "/properties/SamplingRule/Version" ],
  "readOnlyProperties" : [ "/properties/RuleARN" ],
  "deprecatedProperties" : [ "/properties/RuleName", "/properties/SamplingRuleRecord", "/properties/SamplingRuleUpdate" ]
}