# NewConnection

Type: NewConnection

Schema: [NewConnection](https://sourcey-ditto.pages.dev/http-api-doc/models/newconnection.md)

- `name` (optional)
  Type: string
  
  The name of the connection

- `connectionType` (required)
  Reference: [ConnectionType](https://sourcey-ditto.pages.dev/http-api-doc/models/connectiontype.md); Type: ConnectionType
  
  The type of a connection
  
  enum: ["amqp-091","amqp-10","http-push","mqtt","mqtt-5","kafka,","hono"]

- `connectionStatus` (required)
  Reference: [ConnectivityStatus](https://sourcey-ditto.pages.dev/http-api-doc/models/connectivitystatus.md); Type: ConnectivityStatus
  
  The status of a connection or resource
  
  enum: ["open","closed","failed","misconfigured","unknown"]

- `uri` (required)
  Type: string
  
  The URI of the connection

- `sources` (required)
  Reference: [Sources](https://sourcey-ditto.pages.dev/http-api-doc/models/sources.md); Type: Array<Source>
  
  The subscription sources of this connection
  
  uniqueItems: true

- `targets` (required)
  Reference: [Targets](https://sourcey-ditto.pages.dev/http-api-doc/models/targets.md); Type: Array<Target>
  
  The publish targets of this connection
  
  uniqueItems: true

- `specificConfig` (optional)
  Type: object
  
  Configuration which is only applicable for a specific connection type

- `clientCount` (optional)
  Type: number
  
  How many clients on different cluster nodes should establish the connection

- `failoverEnabled` (optional)
  Type: boolean
  
  Whether or not failover is enabled for this connection

- `validateCertificates` (optional)
  Type: boolean
  
  Whether or not to validate server certificates on connection establishment

- `mappingDefinitions` (optional)
  Reference: [PayloadMappingDefinitions](https://sourcey-ditto.pages.dev/http-api-doc/models/payloadmappingdefinitions.md); Type: PayloadMappingDefinitions
  
  List of mapping definitions where the key represents the ID of each mapping that can be used in sources and
  targets to reference a mapping.

- `mappingContext` (optional)
  Reference: [MappingContext](https://sourcey-ditto.pages.dev/http-api-doc/models/mappingcontext.md); Type: MappingContext
  
  MappingContext to apply in this connection containing JavaScript scripts mapping from external messages to
  internal Ditto Protocol messages. Usage of MappingContext is deprecated, use PayloadMappingDefinitions instead.
  
  deprecated: true

- `sshTunnel` (optional)
  Type: object
  
  The configuration of a local SSH port forwarding used to tunnel the connection to the actual endpoint.
  
  - `enabled` (required)
    Type: boolean
    
    Whether the tunnel is enabled
    
    Example:
    
    ```json
    true
    ```
  
  - `uri` (required)
    Type: string
    
    The URI of the SSH host in the format `ssh://[host]:[port]`.
    
    Example:
    
    ```json
    "ssh://some.host:2222"
    ```
  
  - `credentials` (required)
    Type: object
    
    The credentials used to authenticate at the SSH host. Password and public key authentication are supported.
    
    - `type` (required)
      Type: string
      
      The type of credentials used to authenticate. Either `password` or `public-key`.
      
      enum: ["password","public-key"]
      
      Example:
      
      ```json
      "password"
      ```
    
    - `username` (required)
      Type: string
      
      The username used for the authentication.
      
      Example:
      
      ```json
      "user42"
      ```
    
    - `password` (optional)
      Type: string
      
      The password used for authentication when credentials type `password` is used.
      
      Example:
      
      ```json
      "secret!"
      ```
    
    - `publicKey` (optional)
      Type: string
      
      Public key in PEM base64-encoded format using X.509 syntax. This field is required for credentials type
      `public-key`.
      
      Example:
      
      ```json
      "-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----\n"
      ```
    
    - `privateKey` (optional)
      Type: string
      
      Private key in PEM base64-encoded format using PKCS #8 syntax. This field is required for credentials type
      `public-key`.
      
      Example:
      
      ```json
      "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
      ```
  
  - `validateHost` (optional)
    Type: boolean
    
    Whether the SSH host is validated using the provided fingerprints.
    
    Example:
    
    ```json
    true
    ```
  
  - `knownHosts` (optional)
    Type: Array<string>
    
    A list of accepted public key fingerprints. One of these fingerprints must match the fingerprint 
    of the public key the SSH host provides.
    
    Example:
    
    ```json
    [
      "MD5:e0:3a:34:1c:68:ed:c6:bc:7c:ca:a8:67:c7:45:2b:19"
    ]
    ```
    
    Items:
      Type: string
      
      The fingerprint is in the format which the command line tool `ssh-keygen` produces,
      e.g. `MD5:e0:3a:34:1c:68:ed:c6:bc:7c:ca:a8:67:c7:45:2b:19`. The fingerprint is prefixed with the hash algorithm
      used to calculate the fingerprint. Supported algorithms are `MD5`, `SHA1`, `SHA224`, `SHA256`, `SHA384` and `SHA512`.

- `tags` (optional)
  Type: Array<string>
  
  The tags of the connection
  
  Items:
    Type: string