{
 "additionalProperties": false,
 "createOnlyProperties": [
  "/properties/Source"
 ],
 "definitions": {
  "CloudWatchLogDestination": {
   "additionalProperties": false,
   "properties": {
    "LogGroupArn": {
     "maxLength": 512,
     "minLength": 0,
     "type": "string"
    }
   },
   "type": "object"
  },
  "ComponentConfig": {
   "additionalProperties": false,
   "properties": {
    "Options": {
     "additionalProperties": false,
     "patternProperties": {
      "^[A-Za-z0-9]+$": {
       "type": "string"
      }
     },
     "type": "object"
    }
   },
   "type": "object"
  },
  "Destination": {
   "additionalProperties": false,
   "oneOf": [
    {
     "required": [
      "AmpConfiguration"
     ]
    }
   ],
   "properties": {
    "AmpConfiguration": {
     "additionalProperties": false,
     "properties": {
      "WorkspaceArn": {
       "pattern": "^arn:aws[-a-z]*:aps:[-a-z0-9]+:[0-9]{12}:workspace/.+$",
       "type": "string"
      }
     },
     "required": [
      "WorkspaceArn"
     ],
     "type": "object"
    }
   },
   "type": "object"
  },
  "RoleConfiguration": {
   "additionalProperties": false,
   "properties": {
    "SourceRoleArn": {
     "format": "AWS::IAM::Role.Arn",
     "type": "string"
    },
    "TargetRoleArn": {
     "format": "AWS::IAM::Role.Arn",
     "type": "string"
    }
   },
   "type": "object"
  },
  "ScrapeConfiguration": {
   "additionalProperties": false,
   "oneOf": [
    {
     "required": [
      "ConfigurationBlob"
     ]
    }
   ],
   "properties": {
    "ConfigurationBlob": {
     "type": "string"
    }
   },
   "type": "object"
  },
  "ScraperComponent": {
   "additionalProperties": false,
   "properties": {
    "Config": {
     "$ref": "#/definitions/ComponentConfig"
    },
    "Type": {
     "$ref": "#/definitions/ScraperComponentType"
    }
   },
   "required": [
    "Type"
   ],
   "type": "object"
  },
  "ScraperComponentType": {
   "enum": [
    "SERVICE_DISCOVERY",
    "COLLECTOR",
    "EXPORTER"
   ],
   "type": "string"
  },
  "ScraperLoggingConfiguration": {
   "additionalProperties": false,
   "properties": {
    "LoggingDestination": {
     "$ref": "#/definitions/ScraperLoggingDestination"
    },
    "ScraperComponents": {
     "items": {
      "$ref": "#/definitions/ScraperComponent"
     },
     "minItems": 1,
     "type": "array",
     "uniqueItems": true
    }
   },
   "required": [
    "ScraperComponents",
    "LoggingDestination"
   ],
   "type": "object"
  },
  "ScraperLoggingDestination": {
   "additionalProperties": false,
   "properties": {
    "CloudWatchLogs": {
     "$ref": "#/definitions/CloudWatchLogDestination"
    }
   },
   "type": "object"
  },
  "SecurityGroupId": {
   "format": "AWS::EC2::SecurityGroup.Id",
   "pattern": "^sg-[0-9a-z]+$",
   "type": "string"
  },
  "Source": {
   "additionalProperties": false,
   "oneOf": [
    {
     "required": [
      "EksConfiguration"
     ]
    },
    {
     "required": [
      "VpcConfiguration"
     ]
    }
   ],
   "properties": {
    "EksConfiguration": {
     "additionalProperties": false,
     "properties": {
      "ClusterArn": {
       "pattern": "^arn:aws[-a-z]*:eks:[-a-z0-9]+:[0-9]{12}:cluster/.+$",
       "type": "string"
      },
      "SecurityGroupIds": {
       "format": "AWS::EC2::SecurityGroup.Ids",
       "insertionOrder": false,
       "items": {
        "$ref": "#/definitions/SecurityGroupId"
       },
       "type": "array"
      },
      "SubnetIds": {
       "insertionOrder": false,
       "items": {
        "$ref": "#/definitions/SubnetId"
       },
       "type": "array"
      }
     },
     "required": [
      "ClusterArn",
      "SubnetIds"
     ],
     "type": "object"
    },
    "VpcConfiguration": {
     "additionalProperties": false,
     "properties": {
      "SecurityGroupIds": {
       "format": "AWS::EC2::SecurityGroup.Ids",
       "insertionOrder": false,
       "items": {
        "$ref": "#/definitions/SecurityGroupId"
       },
       "type": "array"
      },
      "SubnetIds": {
       "insertionOrder": false,
       "items": {
        "$ref": "#/definitions/SubnetId"
       },
       "type": "array"
      }
     },
     "required": [
      "SecurityGroupIds",
      "SubnetIds"
     ],
     "type": "object"
    }
   },
   "type": "object"
  },
  "SubnetId": {
   "pattern": "^subnet-[0-9a-z]+$",
   "type": "string"
  },
  "Tag": {
   "additionalProperties": false,
   "properties": {
    "Key": {
     "maxLength": 128,
     "minLength": 1,
     "type": "string"
    },
    "Value": {
     "maxLength": 256,
     "minLength": 0,
     "type": "string"
    }
   },
   "required": [
    "Key",
    "Value"
   ],
   "type": "object"
  }
 },
 "primaryIdentifier": [
  "/properties/Arn"
 ],
 "properties": {
  "Alias": {
   "maxLength": 100,
   "minLength": 1,
   "pattern": "^[0-9A-Za-z][-.0-9A-Z_a-z]*$",
   "type": "string"
  },
  "Arn": {
   "pattern": "^arn:(aws|aws-us-gov|aws-cn):aps:[a-z0-9-]+:[0-9]+:scraper/s-[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$",
   "type": "string"
  },
  "Destination": {
   "$ref": "#/definitions/Destination"
  },
  "RoleArn": {
   "format": "AWS::IAM::Role.Arn",
   "maxLength": 2048,
   "minLength": 20,
   "pattern": "^arn:(aws|aws-us-gov|aws-cn):iam::[0-9]{12}:role/[a-zA-Z0-9-]+$",
   "type": "string"
  },
  "RoleConfiguration": {
   "$ref": "#/definitions/RoleConfiguration"
  },
  "ScrapeConfiguration": {
   "$ref": "#/definitions/ScrapeConfiguration"
  },
  "ScraperId": {
   "maxLength": 64,
   "minLength": 1,
   "pattern": "^s-[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$",
   "type": "string"
  },
  "ScraperLoggingConfiguration": {
   "$ref": "#/definitions/ScraperLoggingConfiguration"
  },
  "Source": {
   "$ref": "#/definitions/Source"
  },
  "Tags": {
   "insertionOrder": false,
   "items": {
    "$ref": "#/definitions/Tag"
   },
   "type": "array",
   "uniqueItems": true
  }
 },
 "readOnlyProperties": [
  "/properties/ScraperId",
  "/properties/Arn",
  "/properties/RoleArn"
 ],
 "required": [
  "ScrapeConfiguration",
  "Source",
  "Destination"
 ],
 "sourceUrl": "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-aps",
 "tagging": {
  "cloudFormationSystemTags": true,
  "tagOnCreate": true,
  "tagProperty": "/properties/Tags",
  "tagUpdatable": true,
  "taggable": true
 },
 "typeName": "AWS::APS::Scraper"
}
