{
  "description": "AtlasThirdPartyIntegration is the Schema for the atlas 3rd party integrations API.",
  "properties": {
    "apiVersion": {
      "description": "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
      "type": "string"
    },
    "kind": {
      "description": "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
      "type": "string"
    },
    "metadata": {
      "type": "object"
    },
    "spec": {
      "description": "AtlasThirdPartyIntegrationSpec contains the expected configuration for an integration",
      "properties": {
        "connectionSecret": {
          "description": "Name of the secret containing Atlas API private and public keys.",
          "properties": {
            "name": {
              "description": "Name of the resource being referred to\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
              "type": "string"
            }
          },
          "required": [
            "name"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "datadog": {
          "description": "Datadog contains the config fields for Datadog's Integration.",
          "properties": {
            "apiKeySecretRef": {
              "description": "APIKeySecretRef holds the name of a secret containing the Datadog API key.",
              "properties": {
                "name": {
                  "description": "Name of the resource being referred to\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
                  "type": "string"
                }
              },
              "required": [
                "name"
              ],
              "type": "object",
              "additionalProperties": false
            },
            "region": {
              "description": "Region is the Datadog region",
              "type": "string"
            },
            "sendCollectionLatencyMetrics": {
              "default": "disabled",
              "description": "SendCollectionLatencyMetrics toggles sending collection latency metrics.",
              "enum": [
                "enabled",
                "disabled"
              ],
              "type": "string"
            },
            "sendDatabaseMetrics": {
              "default": "disabled",
              "description": "SendDatabaseMetrics toggles sending database metrics,\nincluding database and collection names",
              "enum": [
                "enabled",
                "disabled"
              ],
              "type": "string"
            }
          },
          "required": [
            "apiKeySecretRef",
            "region"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "externalProjectRef": {
          "description": "externalProjectRef holds the parent Atlas project ID.\nMutually exclusive with the \"projectRef\" field.",
          "properties": {
            "id": {
              "description": "ID is the Atlas project ID.",
              "type": "string"
            }
          },
          "required": [
            "id"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "microsoftTeams": {
          "description": "MicrosoftTeams contains the config fields for Microsoft Teams's Integration.",
          "properties": {
            "urlSecretRef": {
              "description": "URLSecretRef holds the name of a secret containing the Microsoft Teams secret URL.",
              "properties": {
                "name": {
                  "description": "Name of the resource being referred to\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
                  "type": "string"
                }
              },
              "required": [
                "name"
              ],
              "type": "object",
              "additionalProperties": false
            }
          },
          "required": [
            "urlSecretRef"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "newRelic": {
          "description": "NewRelic contains the config fields for New Relic's Integration.",
          "properties": {
            "credentialsSecretRef": {
              "description": "CredentialsSecretRef holds the name of a secret containing new relic's credentials:\naccount id, license key, read and write tokens.",
              "properties": {
                "name": {
                  "description": "Name of the resource being referred to\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
                  "type": "string"
                }
              },
              "required": [
                "name"
              ],
              "type": "object",
              "additionalProperties": false
            }
          },
          "required": [
            "credentialsSecretRef"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "opsGenie": {
          "description": "OpsGenie contains the config fields for Ops Genie's Integration.",
          "properties": {
            "apiKeySecretRef": {
              "description": "APIKeySecretRef holds the name of a secret containing Ops Genie's API key.",
              "properties": {
                "name": {
                  "description": "Name of the resource being referred to\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
                  "type": "string"
                }
              },
              "required": [
                "name"
              ],
              "type": "object",
              "additionalProperties": false
            },
            "region": {
              "description": "Region is the Ops Genie region.",
              "type": "string"
            }
          },
          "required": [
            "apiKeySecretRef",
            "region"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "pagerDuty": {
          "description": "PagerDuty contains the config fields for PagerDuty's Integration.",
          "properties": {
            "region": {
              "description": "Region is the Pager Duty region.",
              "type": "string"
            },
            "serviceKeySecretRef": {
              "description": "ServiceKeySecretRef holds the name of a secret containing Pager Duty service key.",
              "properties": {
                "name": {
                  "description": "Name of the resource being referred to\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
                  "type": "string"
                }
              },
              "required": [
                "name"
              ],
              "type": "object",
              "additionalProperties": false
            }
          },
          "required": [
            "region",
            "serviceKeySecretRef"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "projectRef": {
          "description": "projectRef is a reference to the parent AtlasProject resource.\nMutually exclusive with the \"externalProjectRef\" field.",
          "properties": {
            "name": {
              "description": "Name of the Kubernetes Resource",
              "type": "string"
            },
            "namespace": {
              "description": "Namespace of the Kubernetes Resource",
              "type": "string"
            }
          },
          "required": [
            "name"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "prometheus": {
          "description": "Prometheus contains the config fields for Prometheus's Integration.",
          "properties": {
            "enabled": {
              "description": "Enabled is true when Prometheus integration is enabled.",
              "type": "string"
            },
            "prometheusCredentialsSecretRef": {
              "description": "PrometheusCredentialsSecretRef holds the name of a secret containing the Prometheus.\nusername & password",
              "properties": {
                "name": {
                  "description": "Name of the resource being referred to\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
                  "type": "string"
                }
              },
              "required": [
                "name"
              ],
              "type": "object",
              "additionalProperties": false
            },
            "serviceDiscovery": {
              "description": "ServiceDiscovery to be used by Prometheus.",
              "enum": [
                "file",
                "http"
              ],
              "type": "string"
            }
          },
          "required": [
            "enabled",
            "prometheusCredentialsSecretRef",
            "serviceDiscovery"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "slack": {
          "description": "Slack contains the config fields for Slack's Integration.",
          "properties": {
            "apiTokenSecretRef": {
              "description": "APITokenSecretRef holds the name of a secret containing the Slack API token.",
              "properties": {
                "name": {
                  "description": "Name of the resource being referred to\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
                  "type": "string"
                }
              },
              "required": [
                "name"
              ],
              "type": "object",
              "additionalProperties": false
            },
            "channelName": {
              "description": "ChannelName to be used by Prometheus.",
              "type": "string"
            },
            "teamName": {
              "description": "TeamName flags whether Prometheus integration is enabled.",
              "type": "string"
            }
          },
          "required": [
            "apiTokenSecretRef",
            "channelName",
            "teamName"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "type": {
          "description": "Type of the integration.",
          "enum": [
            "DATADOG",
            "MICROSOFT_TEAMS",
            "NEW_RELIC",
            "OPS_GENIE",
            "PAGER_DUTY",
            "PROMETHEUS",
            "SLACK",
            "VICTOR_OPS",
            "WEBHOOK"
          ],
          "type": "string"
        },
        "victorOps": {
          "description": "VictorOps contains the config fields for VictorOps's Integration.",
          "properties": {
            "apiKeySecretRef": {
              "description": "APIKeySecretRef is the name of a secret containing Victor Ops API key.",
              "properties": {
                "name": {
                  "description": "Name of the resource being referred to\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
                  "type": "string"
                }
              },
              "required": [
                "name"
              ],
              "type": "object",
              "additionalProperties": false
            },
            "routingKey": {
              "description": "RoutingKey holds VictorOps routing key.",
              "type": "string"
            }
          },
          "required": [
            "apiKeySecretRef",
            "routingKey"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "webhook": {
          "description": "Webhook contains the config fields for Webhook's Integration.",
          "properties": {
            "urlSecretRef": {
              "description": "URLSecretRef holds the name of a secret containing Webhook URL and secret.",
              "properties": {
                "name": {
                  "description": "Name of the resource being referred to\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
                  "type": "string"
                }
              },
              "required": [
                "name"
              ],
              "type": "object",
              "additionalProperties": false
            }
          },
          "required": [
            "urlSecretRef"
          ],
          "type": "object",
          "additionalProperties": false
        }
      },
      "required": [
        "type"
      ],
      "type": "object",
      "x-kubernetes-validations": [
        {
          "message": "must define only one project reference through externalProjectRef or projectRef",
          "rule": "(has(self.externalProjectRef) && !has(self.projectRef)) || (!has(self.externalProjectRef) && has(self.projectRef))"
        },
        {
          "message": "must define a local connection secret when referencing an external project",
          "rule": "(has(self.externalProjectRef) && has(self.connectionSecret)) || !has(self.externalProjectRef)"
        },
        {
          "message": "must define a type of integration",
          "rule": "has(self.type) && self.type.size() != 0"
        },
        {
          "message": "only DATADOG type may set datadog fields",
          "rule": "!has(self.datadog) || (self.type == 'DATADOG' && has(self.datadog))"
        },
        {
          "message": "only MICROSOFT_TEAMS type may set microsoftTeams fields",
          "rule": "!has(self.microsoftTeams) || (self.type == 'MICROSOFT_TEAMS' && has(self.microsoftTeams))"
        },
        {
          "message": "only NEW_RELIC type may set newRelic fields",
          "rule": "!has(self.newRelic) || (self.type == 'NEW_RELIC' && has(self.newRelic))"
        },
        {
          "message": "only OPS_GENIE type may set opsGenie fields",
          "rule": "!has(self.opsGenie) || (self.type == 'OPS_GENIE' && has(self.opsGenie))"
        },
        {
          "message": "only PROMETHEUS type may set prometheus fields",
          "rule": "!has(self.prometheus) || (self.type == 'PROMETHEUS' && has(self.prometheus))"
        },
        {
          "message": "only PAGER_DUTY type may set pagerDuty fields",
          "rule": "!has(self.pagerDuty) || (self.type == 'PAGER_DUTY' && has(self.pagerDuty))"
        },
        {
          "message": "only SLACK type may set slack fields",
          "rule": "!has(self.slack) || (self.type == 'SLACK' && has(self.slack))"
        },
        {
          "message": "only VICTOR_OPS type may set victorOps fields",
          "rule": "!has(self.victorOps) || (self.type == 'VICTOR_OPS' && has(self.victorOps))"
        },
        {
          "message": "only WEBHOOK type may set webhook fields",
          "rule": "!has(self.webhook) || (self.type == 'WEBHOOK' && has(self.webhook))"
        }
      ],
      "additionalProperties": false
    },
    "status": {
      "description": "AtlasThirdPartyIntegrationStatus holds the status of an integration",
      "properties": {
        "conditions": {
          "description": "Conditions holding the status details",
          "items": {
            "description": "Condition contains details for one aspect of the current state of this API Resource.",
            "properties": {
              "lastTransitionTime": {
                "description": "lastTransitionTime is the last time the condition transitioned from one status to another.\nThis should be when the underlying condition changed.  If that is not known, then using the time when the API field changed is acceptable.",
                "format": "date-time",
                "type": "string"
              },
              "message": {
                "description": "message is a human readable message indicating details about the transition.\nThis may be an empty string.",
                "maxLength": 32768,
                "type": "string"
              },
              "observedGeneration": {
                "description": "observedGeneration represents the .metadata.generation that the condition was set based upon.\nFor instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date\nwith respect to the current state of the instance.",
                "format": "int64",
                "minimum": 0,
                "type": "integer"
              },
              "reason": {
                "description": "reason contains a programmatic identifier indicating the reason for the condition's last transition.\nProducers of specific condition types may define expected values and meanings for this field,\nand whether the values are considered a guaranteed API.\nThe value should be a CamelCase string.\nThis field may not be empty.",
                "maxLength": 1024,
                "minLength": 1,
                "pattern": "^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$",
                "type": "string"
              },
              "status": {
                "description": "status of the condition, one of True, False, Unknown.",
                "enum": [
                  "True",
                  "False",
                  "Unknown"
                ],
                "type": "string"
              },
              "type": {
                "description": "type of condition in CamelCase or in foo.example.com/CamelCase.",
                "maxLength": 316,
                "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$",
                "type": "string"
              }
            },
            "required": [
              "lastTransitionTime",
              "message",
              "reason",
              "status",
              "type"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "type": "array"
        },
        "id": {
          "description": "ID of the third party integration resource in Atlas",
          "type": "string"
        }
      },
      "type": "object",
      "additionalProperties": false
    }
  },
  "type": "object"
}
