{
  "$schema" : "https://json-schema.org/draft/2020-12/schema",
  "$id" : "https://voltdb.com/voltsp/schemas/resource/http-client",
  "title" : "Http-client Resource Configuration",
  "description" : "The `http-client` configures a client that can connect and exchanges http(s) messages with configured downstream HTTP(s) server over single connection.\nFor protocols HTTP/1.0 and HTTP/1.1 the client represent synchronous communication where requests are processed one-by-one by a server.\nThe client can be shared by multiple workers but each worker must create its own connection.\nIf server doesn't close the connection, it will be reused for subsequent requests.\n\nIf server is not available or connection has been closed, client will re-connect each time new request arrives.\nIn other words, if there are no request in the pipeline, this client will not try to connect.\n",
  "type" : "object",
  "properties" : {
    "http-client" : {
      "type" : "object",
      "properties" : {
        "address" : {
          "type" : "string",
          "description" : "Downstream server's address to connect to.",
          "anyOf" : [ {
            "type" : "string",
            "format" : "hostname"
          }, {
            "type" : "string",
            "format" : "ipv4"
          }, {
            "type" : "string",
            "format" : "ipv6"
          } ]
        },
        "minimalProtocol" : {
          "type" : "string",
          "description" : "Specifies minimal protocol supported by a remote server.",
          "default" : "HTTP_11",
          "enum" : [ "http_10", "http_11", "HTTP_10", "HTTP_11" ]
        },
        "connectTimeout" : {
          "type" : "string",
          "pattern" : "^(\\d+[smhd]|P(T|\\d+[YMD]).*)",
          "description" : "Connection timeout.",
          "default" : "PT20S"
        },
        "requestTimeout" : {
          "type" : "string",
          "pattern" : "^(\\d+[smhd]|P(T|\\d+[YMD]).*)",
          "description" : "Max timeout to wait before marking the request as unsuccessful.",
          "default" : "PT1S"
        },
        "shutdownGracePeriod" : {
          "type" : "string",
          "pattern" : "^(\\d+[smhd]|P(T|\\d+[YMD]).*)",
          "description" : "Client should block and await for all connections to be drained.",
          "default" : "PT5S"
        },
        "ssl" : {
          "type" : "object",
          "description" : "Secure transport configuration.",
          "properties" : {
            "trustStoreFile" : {
              "type" : "string",
              "description" : "Truststore file or trusted CA certificate; supported formats include JKS, PKCS#12, or PEM."
            },
            "trustStorePassword" : {
              "type" : "string",
              "description" : "Truststore password."
            },
            "keyStoreFile" : {
              "type" : "string",
              "description" : "Keystore file; supported formats include JKS, PKCS#12, or PEM"
            },
            "keyStorePassword" : {
              "type" : "string",
              "description" : "Keystore password."
            },
            "keyPassword" : {
              "type" : "string",
              "description" : "Private key password. Optional — if not set, the key store password will be used."
            },
            "insecure" : {
              "type" : "boolean",
              "description" : "If set to true, disables SSL certificate and hostname validation.\nIntended for debugging purposes only. Doesn't work with mTLS.\n"
            },
            "hostnameVerifier" : {
              "type" : "string",
              "description" : "Custom hostname verifier for SSL connections.\nIf not specified and 'insecure' is true, hostname verification will be disabled.\n"
            }
          },
          "additionalProperties" : false
        },
        "socketOptions" : {
          "type" : "object",
          "description" : "Configures operating system options to be applied to the server socket.\nSupported values are:\n  - `SO_SNDBUF`,\n  - `SO_RCVBUF`,\n  - `SO_TIMEOUT`,\n  - `SO_KEEPALIVE`,\n  - `SO_LINGER`,\n  - `SO_BACKLOG`,\n  - `TCP_NODELAY`.\n",
          "additionalProperties" : {
            "type" : "string"
          }
        },
        "maxContentSize" : {
          "description" : "Maximal content size in bytes",
          "default" : "500kb",
          "anyOf" : [ {
            "type" : "integer",
            "minimum" : -9223372036854775808,
            "maximum" : 9223372036854775807
          }, {
            "type" : "string",
            "pattern" : "^\\d+[kmgtpe]?b?$"
          }, {
            "type" : "string",
            "pattern" : "^\\d+.\\d+[kmgtpe]?b?$"
          } ],
          "type" : "object",
          "properties" : {
            "bytes" : {
              "type" : "integer",
              "minimum" : -9223372036854775808,
              "maximum" : 9223372036854775807
            }
          },
          "additionalProperties" : false
        }
      },
      "required" : [ "address" ],
      "additionalProperties" : false
    }
  },
  "required" : [ "http-client" ],
  "additionalProperties" : false
}
