sagemaker.core.tools.resources_extractor#

A class for extracting resource information from a service JSON.

Module Attributes

log

This class is used to extract the resources and its actions from the service-2.json file.

Classes

ResourcesExtractor([combined_shapes, ...])

A class for extracting resource information from a service JSON.

class sagemaker.core.tools.resources_extractor.ResourcesExtractor(combined_shapes: dict | None = None, combined_operations: dict | None = None)[source]#

Bases: object

A class for extracting resource information from a service JSON.

Parameters:

service_json (dict) – The Botocore service.json containing the shape definitions.

service_json#

The service JSON containing operations and shapes.

Type:

dict

operations#

The operations defined in the service JSON.

Type:

dict

shapes#

The shapes defined in the service JSON.

Type:

dict

resource_actions#

A dictionary mapping resources to their associated actions.

Type:

dict

actions_under_resource#

A set of actions that are performed on resources.

Type:

set

create_resources#

A set of resources that can be created.

Type:

set

add_resources#

A set of resources that can be added.

Type:

set

start_resources#

A set of resources that can be started.

Type:

set

register_resources#

A set of resources that can be registered.

Type:

set

import_resources#

A set of resources that can be imported.

Type:

set

resources#

A set of all resources.

Type:

set

df#

A DataFrame containing resource information.

Type:

DataFrame

_filter_actions_for_resources(resources)[source]#

Filters actions based on the given resources.

_extract_resources_plan()[source]#

Extracts the resource plan from the service JSON.

_get_status_chain_and_states(shape_name, status_chain)[source]#

Recursively extracts the status chain and states for a given shape.

_extract_resource_plan_as_dataframe()[source]#

Builds a DataFrame containing resource information.

get_resource_plan()[source]#

Returns the resource plan DataFrame.

RESOURCE_TO_ADDITIONAL_METHODS = {'Cluster': ['DescribeClusterNode', 'ListClusterNodes']}#
get_resource_methods()[source]#

Returns the resource methods dict.

Returns:

The resource methods dict.

Return type:

resource_methods (dict)

get_resource_plan()[source]#

Returns the resource plan DataFrame.

Returns:

The resource plan DataFrame.

Return type:

df (DataFrame)

get_status_chain_and_states(resource_name)[source]#

Extract the status chain and states for a given resource.

Parameters:

resource_name (str) – The name of the resource

Returns:

The status chain for the resource. resource_states (list): The states associated with the resource.

Return type:

status_chain (list)

sagemaker.core.tools.resources_extractor.log = <Logger sagemaker.core.tools.resources_extractor (INFO)>[source]#

This class is used to extract the resources and its actions from the service-2.json file.