# coding=utf-8
# *** WARNING: this file was generated by pulumi-language-python. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import builtins as _builtins
import warnings
import sys
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
if sys.version_info >= (3, 11):
    from typing import NotRequired, TypedDict, TypeAlias
else:
    from typing_extensions import NotRequired, TypedDict, TypeAlias
from .. import _utilities
from . import outputs
from ._enums import *

__all__ = [
    'Connection',
    'ProxyConnection',
]

@pulumi.output_type
class Connection(dict):
    """
    Instructions for how to connect to a remote endpoint.
    """
    @staticmethod
    def __key_warning(key: str):
        suggest = None
        if key == "agentSocketPath":
            suggest = "agent_socket_path"
        elif key == "dialErrorLimit":
            suggest = "dial_error_limit"
        elif key == "hostKey":
            suggest = "host_key"
        elif key == "perDialTimeout":
            suggest = "per_dial_timeout"
        elif key == "privateKey":
            suggest = "private_key"
        elif key == "privateKeyPassword":
            suggest = "private_key_password"

        if suggest:
            pulumi.log.warn(f"Key '{key}' not found in Connection. Access the value via the '{suggest}' property getter instead.")

    def __getitem__(self, key: str) -> Any:
        Connection.__key_warning(key)
        return super().__getitem__(key)

    def get(self, key: str, default = None) -> Any:
        Connection.__key_warning(key)
        return super().get(key, default)

    def __init__(__self__, *,
                 host: _builtins.str,
                 agent_socket_path: Optional[_builtins.str] = None,
                 dial_error_limit: Optional[_builtins.int] = None,
                 host_key: Optional[_builtins.str] = None,
                 password: Optional[_builtins.str] = None,
                 per_dial_timeout: Optional[_builtins.int] = None,
                 port: Optional[_builtins.float] = None,
                 private_key: Optional[_builtins.str] = None,
                 private_key_password: Optional[_builtins.str] = None,
                 proxy: Optional['outputs.ProxyConnection'] = None,
                 user: Optional[_builtins.str] = None):
        """
        Instructions for how to connect to a remote endpoint.
        :param _builtins.str host: The address of the resource to connect to.
        :param _builtins.str agent_socket_path: SSH Agent socket path. Default to environment variable SSH_AUTH_SOCK if present.
        :param _builtins.int dial_error_limit: Max allowed errors on trying to dial the remote host. -1 set count to unlimited. Default value is 10.
        :param _builtins.str host_key: The expected host key to verify the server's identity. If not provided, the host key will be ignored.
        :param _builtins.str password: The password we should use for the connection.
        :param _builtins.int per_dial_timeout: Max number of seconds for each dial attempt. 0 implies no maximum. Default value is 15 seconds.
        :param _builtins.float port: The port to connect to. Defaults to 22.
        :param _builtins.str private_key: The contents of an SSH key to use for the connection. This takes preference over the password if provided.
        :param _builtins.str private_key_password: The password to use in case the private key is encrypted.
        :param 'ProxyConnection' proxy: The connection settings for the bastion/proxy host.
        :param _builtins.str user: The user that we should use for the connection.
        """
        pulumi.set(__self__, "host", host)
        if agent_socket_path is not None:
            pulumi.set(__self__, "agent_socket_path", agent_socket_path)
        if dial_error_limit is None:
            dial_error_limit = 10
        if dial_error_limit is not None:
            pulumi.set(__self__, "dial_error_limit", dial_error_limit)
        if host_key is not None:
            pulumi.set(__self__, "host_key", host_key)
        if password is not None:
            pulumi.set(__self__, "password", password)
        if per_dial_timeout is None:
            per_dial_timeout = 15
        if per_dial_timeout is not None:
            pulumi.set(__self__, "per_dial_timeout", per_dial_timeout)
        if port is None:
            port = 22
        if port is not None:
            pulumi.set(__self__, "port", port)
        if private_key is not None:
            pulumi.set(__self__, "private_key", private_key)
        if private_key_password is not None:
            pulumi.set(__self__, "private_key_password", private_key_password)
        if proxy is not None:
            pulumi.set(__self__, "proxy", proxy)
        if user is None:
            user = 'root'
        if user is not None:
            pulumi.set(__self__, "user", user)

    @_builtins.property
    @pulumi.getter
    def host(self) -> _builtins.str:
        """
        The address of the resource to connect to.
        """
        return pulumi.get(self, "host")

    @_builtins.property
    @pulumi.getter(name="agentSocketPath")
    def agent_socket_path(self) -> Optional[_builtins.str]:
        """
        SSH Agent socket path. Default to environment variable SSH_AUTH_SOCK if present.
        """
        return pulumi.get(self, "agent_socket_path")

    @_builtins.property
    @pulumi.getter(name="dialErrorLimit")
    def dial_error_limit(self) -> Optional[_builtins.int]:
        """
        Max allowed errors on trying to dial the remote host. -1 set count to unlimited. Default value is 10.
        """
        return pulumi.get(self, "dial_error_limit")

    @_builtins.property
    @pulumi.getter(name="hostKey")
    def host_key(self) -> Optional[_builtins.str]:
        """
        The expected host key to verify the server's identity. If not provided, the host key will be ignored.
        """
        return pulumi.get(self, "host_key")

    @_builtins.property
    @pulumi.getter
    def password(self) -> Optional[_builtins.str]:
        """
        The password we should use for the connection.
        """
        return pulumi.get(self, "password")

    @_builtins.property
    @pulumi.getter(name="perDialTimeout")
    def per_dial_timeout(self) -> Optional[_builtins.int]:
        """
        Max number of seconds for each dial attempt. 0 implies no maximum. Default value is 15 seconds.
        """
        return pulumi.get(self, "per_dial_timeout")

    @_builtins.property
    @pulumi.getter
    def port(self) -> Optional[_builtins.float]:
        """
        The port to connect to. Defaults to 22.
        """
        return pulumi.get(self, "port")

    @_builtins.property
    @pulumi.getter(name="privateKey")
    def private_key(self) -> Optional[_builtins.str]:
        """
        The contents of an SSH key to use for the connection. This takes preference over the password if provided.
        """
        return pulumi.get(self, "private_key")

    @_builtins.property
    @pulumi.getter(name="privateKeyPassword")
    def private_key_password(self) -> Optional[_builtins.str]:
        """
        The password to use in case the private key is encrypted.
        """
        return pulumi.get(self, "private_key_password")

    @_builtins.property
    @pulumi.getter
    def proxy(self) -> Optional['outputs.ProxyConnection']:
        """
        The connection settings for the bastion/proxy host.
        """
        return pulumi.get(self, "proxy")

    @_builtins.property
    @pulumi.getter
    def user(self) -> Optional[_builtins.str]:
        """
        The user that we should use for the connection.
        """
        return pulumi.get(self, "user")


@pulumi.output_type
class ProxyConnection(dict):
    """
    Instructions for how to connect to a remote endpoint via a bastion host.
    """
    @staticmethod
    def __key_warning(key: str):
        suggest = None
        if key == "agentSocketPath":
            suggest = "agent_socket_path"
        elif key == "dialErrorLimit":
            suggest = "dial_error_limit"
        elif key == "hostKey":
            suggest = "host_key"
        elif key == "perDialTimeout":
            suggest = "per_dial_timeout"
        elif key == "privateKey":
            suggest = "private_key"
        elif key == "privateKeyPassword":
            suggest = "private_key_password"

        if suggest:
            pulumi.log.warn(f"Key '{key}' not found in ProxyConnection. Access the value via the '{suggest}' property getter instead.")

    def __getitem__(self, key: str) -> Any:
        ProxyConnection.__key_warning(key)
        return super().__getitem__(key)

    def get(self, key: str, default = None) -> Any:
        ProxyConnection.__key_warning(key)
        return super().get(key, default)

    def __init__(__self__, *,
                 host: _builtins.str,
                 agent_socket_path: Optional[_builtins.str] = None,
                 dial_error_limit: Optional[_builtins.int] = None,
                 host_key: Optional[_builtins.str] = None,
                 password: Optional[_builtins.str] = None,
                 per_dial_timeout: Optional[_builtins.int] = None,
                 port: Optional[_builtins.float] = None,
                 private_key: Optional[_builtins.str] = None,
                 private_key_password: Optional[_builtins.str] = None,
                 user: Optional[_builtins.str] = None):
        """
        Instructions for how to connect to a remote endpoint via a bastion host.
        :param _builtins.str host: The address of the bastion host to connect to.
        :param _builtins.str agent_socket_path: SSH Agent socket path. Default to environment variable SSH_AUTH_SOCK if present.
        :param _builtins.int dial_error_limit: Max allowed errors on trying to dial the remote host. -1 set count to unlimited. Default value is 10.
        :param _builtins.str host_key: The expected host key to verify the server's identity. If not provided, the host key will be ignored.
        :param _builtins.str password: The password we should use for the connection to the bastion host.
        :param _builtins.int per_dial_timeout: Max number of seconds for each dial attempt. 0 implies no maximum. Default value is 15 seconds.
        :param _builtins.float port: The port of the bastion host to connect to.
        :param _builtins.str private_key: The contents of an SSH key to use for the connection. This takes preference over the password if provided.
        :param _builtins.str private_key_password: The password to use in case the private key is encrypted.
        :param _builtins.str user: The user that we should use for the connection to the bastion host.
        """
        pulumi.set(__self__, "host", host)
        if agent_socket_path is not None:
            pulumi.set(__self__, "agent_socket_path", agent_socket_path)
        if dial_error_limit is None:
            dial_error_limit = 10
        if dial_error_limit is not None:
            pulumi.set(__self__, "dial_error_limit", dial_error_limit)
        if host_key is not None:
            pulumi.set(__self__, "host_key", host_key)
        if password is not None:
            pulumi.set(__self__, "password", password)
        if per_dial_timeout is None:
            per_dial_timeout = 15
        if per_dial_timeout is not None:
            pulumi.set(__self__, "per_dial_timeout", per_dial_timeout)
        if port is None:
            port = 22
        if port is not None:
            pulumi.set(__self__, "port", port)
        if private_key is not None:
            pulumi.set(__self__, "private_key", private_key)
        if private_key_password is not None:
            pulumi.set(__self__, "private_key_password", private_key_password)
        if user is None:
            user = 'root'
        if user is not None:
            pulumi.set(__self__, "user", user)

    @_builtins.property
    @pulumi.getter
    def host(self) -> _builtins.str:
        """
        The address of the bastion host to connect to.
        """
        return pulumi.get(self, "host")

    @_builtins.property
    @pulumi.getter(name="agentSocketPath")
    def agent_socket_path(self) -> Optional[_builtins.str]:
        """
        SSH Agent socket path. Default to environment variable SSH_AUTH_SOCK if present.
        """
        return pulumi.get(self, "agent_socket_path")

    @_builtins.property
    @pulumi.getter(name="dialErrorLimit")
    def dial_error_limit(self) -> Optional[_builtins.int]:
        """
        Max allowed errors on trying to dial the remote host. -1 set count to unlimited. Default value is 10.
        """
        return pulumi.get(self, "dial_error_limit")

    @_builtins.property
    @pulumi.getter(name="hostKey")
    def host_key(self) -> Optional[_builtins.str]:
        """
        The expected host key to verify the server's identity. If not provided, the host key will be ignored.
        """
        return pulumi.get(self, "host_key")

    @_builtins.property
    @pulumi.getter
    def password(self) -> Optional[_builtins.str]:
        """
        The password we should use for the connection to the bastion host.
        """
        return pulumi.get(self, "password")

    @_builtins.property
    @pulumi.getter(name="perDialTimeout")
    def per_dial_timeout(self) -> Optional[_builtins.int]:
        """
        Max number of seconds for each dial attempt. 0 implies no maximum. Default value is 15 seconds.
        """
        return pulumi.get(self, "per_dial_timeout")

    @_builtins.property
    @pulumi.getter
    def port(self) -> Optional[_builtins.float]:
        """
        The port of the bastion host to connect to.
        """
        return pulumi.get(self, "port")

    @_builtins.property
    @pulumi.getter(name="privateKey")
    def private_key(self) -> Optional[_builtins.str]:
        """
        The contents of an SSH key to use for the connection. This takes preference over the password if provided.
        """
        return pulumi.get(self, "private_key")

    @_builtins.property
    @pulumi.getter(name="privateKeyPassword")
    def private_key_password(self) -> Optional[_builtins.str]:
        """
        The password to use in case the private key is encrypted.
        """
        return pulumi.get(self, "private_key_password")

    @_builtins.property
    @pulumi.getter
    def user(self) -> Optional[_builtins.str]:
        """
        The user that we should use for the connection to the bastion host.
        """
        return pulumi.get(self, "user")


