{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "title": "sdu_service_deployment_deploy_command",
  "description": "SDU service deployment deploy command",
  "additionalProperties": false,
  "required": [
    "request_id",
    "tenant_id",
    "environment_id",
    "service_definition_id",
    "service_deployment_id",
    "service_id",
    "owned_by_axinom",
    "mosaic_service_config",
    "k8s_config"
  ],
  "properties": {
    "request_id": {
      "type": "string",
      "minLength": 32,
      "maxLength": 36,
      "format": "uuid",
      "description": "A UUID."
    },
    "tenant_id": {
      "type": "string",
      "minLength": 32,
      "maxLength": 36,
      "format": "uuid",
      "description": "A UUID."
    },
    "environment_id": {
      "type": "string",
      "minLength": 32,
      "maxLength": 36,
      "format": "uuid",
      "description": "A UUID."
    },
    "service_definition_id": {
      "type": "string",
      "minLength": 32,
      "maxLength": 36,
      "format": "uuid",
      "description": "A UUID."
    },
    "service_deployment_id": {
      "type": "string",
      "minLength": 32,
      "maxLength": 36,
      "format": "uuid",
      "description": "A UUID."
    },
    "service_id": {
      "type": "string",
      "description": "A human readable ID for the service (i.e. media-service)"
    },
    "mosaic_service_config": {
      "type": "object",
      "title": "mosaic_service_config",
      "description": "Properties that describe Mosaic service specific deployment parameters.",
      "additionalProperties": false,
      "required": [
        "owned_by_axinom",
        "environment_variables"
      ],
      "properties": {
        "owned_by_axinom": {
          "type": "boolean",
          "description": "A boolean indicating if the service-definition is owned by Axinom"
        },
        "environment_variables": {
          "type": "object",
          "title": "environment_variables",
          "description": "Environment variables to be used for the service-deployment",
          "additionalProperties": {
            "type": [
              "boolean",
              "number",
              "string"
            ]
          }
        }
      }
    },
    "k8s_config": {
      "type": "object",
      "title": "k8s_config",
      "description": "Properties that describe parameters for the K8s deployment.",
      "additionalProperties": false,
      "required": [
        "container_image",
        "fqdn_port_mappings",
        "vm_spec_id"
      ],
      "properties": {
        "container_image": {
          "type": "string",
          "description": "The fully qualified container image to be deployed (i.e. registry.axinom.com/navycms/media-service:20220627.3)"
        },
        "fqdn_port_mappings": {
          "type": "array",
          "description": "An array of an object containing the FQDN to Port number mappings used to configure the ingress rules of the service-deployment",
          "uniqueItems": true,
          "additionalItems": false,
          "items": {
            "type": "object",
            "title": "fqdn_port_mapping",
            "description": "The FQDN mapped to a specific port number of the service",
            "additionalProperties": false,
            "required": [
              "fqdn",
              "port",
              "name"
            ],
            "properties": {
              "fqdn": {
                "type": "string",
                "description": "Fully qualified domain name"
              },
              "port": {
                "type": "integer",
                "description": "Port number"
              },
              "name": {
                "type": "string",
                "description": "Short name to identify the port uniquely"
              }
            }
          }
        },
        "vm_spec_id": {
          "type": "string",
          "description": "The VM Spec Type, which is taken as the nodeSelectorLabel"
        },
        "replicas": {
          "type": "integer",
          "description": "Number of pod replicas for the service"
        },
        "resource_requests": {
          "type": "object",
          "title": "k8s_resource_config",
          "description": "Resource requests and limits object to specify CPU and Memory constraints for a pod",
          "additionalProperties": false,
          "properties": {
            "cpu": {
              "type": "string",
              "description": "CPU size"
            },
            "memory": {
              "type": "string",
              "description": "Memory size"
            }
          }
        },
        "resource_limits": {
          "type": "object",
          "title": "k8s_resource_config",
          "description": "Resource requests and limits object to specify CPU and Memory constraints for a pod",
          "additionalProperties": false,
          "properties": {
            "cpu": {
              "type": "string",
              "description": "CPU size"
            },
            "memory": {
              "type": "string",
              "description": "Memory size"
            }
          }
        },
        "custom_object_definitions": {
          "type": "array",
          "additionalItems": false,
          "description": "An array of custom object definitions to be created along with the service deployment",
          "items": {
            "type": "object",
            "description": "A custom object definition to be created"
          }
        }
      }
    }
  },
  "definitions": {
    "k8s_resource_config": {
      "type": "object",
      "title": "k8s_resource_config",
      "description": "Resource requests and limits object to specify CPU and Memory constraints for a pod",
      "additionalProperties": false,
      "properties": {
        "cpu": {
          "type": "string",
          "description": "CPU size"
        },
        "memory": {
          "type": "string",
          "description": "Memory size"
        }
      }
    }
  }
}