in src/sagemaker_core/tools/resources_codegen.py [0:0]
def generate_refresh_method(self, resource_name: str, **kwargs) -> str:
"""Auto-Generate 'refresh' object Method [describe API] for a resource.
Args:
resource_name (str): The resource name.
Returns:
str: The formatted refresh 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"]
# Generate the arguments for the 'refresh' method
refresh_args = self._generate_method_args(
resource_operation_input_shape_name, kwargs["resource_attributes"]
)
operation_input_args = self._generate_operation_input_necessary_args(
operation_metadata, kwargs["resource_attributes"]
)
operation = convert_to_snake_case(operation_name)
# generate docstring
docstring = self._generate_docstring(
title=f"Refresh a {resource_name} resource",
operation_name=operation_name,
resource_name=resource_name,
include_session_region=False,
include_return_resource_docstring=True,
)
formatted_method = REFRESH_METHOD_TEMPLATE.format(
docstring=docstring,
resource_name=resource_name,
operation_input_args=operation_input_args,
refresh_args=refresh_args,
operation=operation,
describe_operation_output_shape=resource_operation_output_shape_name,
)
return formatted_method