def _validate()

in cli/src/pcluster/validators/database_validators.py [0:0]


    def _validate(self, uri: str):
        """Validate database URI."""
        # First, throw error if the URI starts with a "/" (to prevent issues with the
        # manipulation below
        if not self._check_leading_slash(uri):
            return

        uri_parse = urlparse(uri)
        if not uri_parse.netloc:
            # This happens if users provide an URI without explicit scheme followed by ://
            # (for example 'test.example.com:3306' instead of 'mysql://test.example.com:3306`).
            uri_parse = urlparse("//" + uri)

        # The following checks do:
        # - stop the flow in case of parsing exceptions
        # - throw error if the URI contains a scheme
        # - throw error if netloc cannot be parsed from the uri
        # - throw an info if a port has not been provided
        if not (self._check_scheme(uri_parse) and self._check_netloc(uri, uri_parse) and self._check_port(uri_parse)):
            return