def generate_get_method()

in src/sagemaker_core/tools/resources_codegen.py [0:0]


    def generate_get_method(self, resource_name: str) -> str:
        """
        Auto-generate the GET method (describe API) for a resource.

        Args:
            resource_name (str): The resource name.

        Returns:
            str: The formatted Get Method template.

        """
        operation_name = "Describe" + resource_name
        operation_metadata = self.operations[operation_name]
        resource_operation_input_shape_name = operation_metadata["input"]["shape"]
        resource_operation_output_shape_name = operation_metadata["output"]["shape"]

        operation_input_args = self._generate_operation_input_args(
            operation_metadata, is_class_method=True
        )

        # Generate the arguments for the 'update' method
        describe_args = self._generate_method_args(resource_operation_input_shape_name)

        resource_lower = convert_to_snake_case(resource_name)

        operation = convert_to_snake_case(operation_name)

        # generate docstring
        docstring = self._generate_docstring(
            title=f"Get a {resource_name} resource",
            operation_name=operation_name,
            resource_name=resource_name,
            operation_input_shape_name=resource_operation_input_shape_name,
            include_session_region=True,
            include_return_resource_docstring=True,
        )

        formatted_method = GET_METHOD_TEMPLATE.format(
            docstring=docstring,
            resource_name=resource_name,
            # TODO: change service name based on the service - runtime, sagemaker, etc.
            service_name="sagemaker",
            describe_args=describe_args,
            resource_lower=resource_lower,
            operation_input_args=operation_input_args,
            operation=operation,
            describe_operation_output_shape=resource_operation_output_shape_name,
        )
        return formatted_method