def validate_ros_template()

in rostran/providers/ros/template.py [0:0]


    def validate_ros_template(source):
        try:
            ros_config = open_api_models.Config(credential=CredClient())
        except CredentialException as e:
            typer.secho(
                f"The Credential is not set, please set credential by:\n"
                f"1. Environment variables (ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET)\n"
                f"2. The ini configuration file defined by the environment variable ALIBABA_CLOUD_CREDENTIALS_FILE\n"
                f"3. Alibaba Cloud SDK Credentials default configuration file where"
                f" located in ~/.alibabacloud/credentials.ini",
                fg="red",
            )
            raise InvalidTemplate(reason=f'{e}')
        ros_client = Client(ros_config)
        request = models.ValidateTemplateRequest(template_body=json.dumps(source))
        try:
            runtime = RuntimeOptions(autoretry=True, max_attempts=3, read_timeout=60000, connect_timeout=60000)
            ros_client.validate_template_with_options(request, runtime=runtime)
        except TeaException as e:
            typer.secho(
                f"ROS template is invalid, please check the template and try again, {e}",
                fg="red",
            )
            raise InvalidTemplate(reason=f'{e}')