Skip to content

Commit 6d91964

Browse files
committed
Support additional search method
1 parent b1551ea commit 6d91964

File tree

5 files changed

+110
-3
lines changed

5 files changed

+110
-3
lines changed

resource_plan.csv

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ EndpointConfig,resource,"['create', 'get', 'get_all']","['delete', 'refresh']",[
2424
Experiment,resource,"['create', 'get', 'get_all']","['delete', 'refresh', 'update']",[],[],"['CreateExperiment', 'DeleteExperiment', 'DescribeExperiment', 'ListExperiments', 'UpdateExperiment']",[],[]
2525
FeatureGroup,resource,"['create', 'get', 'get_all']","['delete', 'refresh', 'update', 'wait_for_delete', 'wait_for_status']",[],[],"['CreateFeatureGroup', 'DeleteFeatureGroup', 'DescribeFeatureGroup', 'ListFeatureGroups', 'UpdateFeatureGroup']","[{'name': 'FeatureGroupStatus', 'shape_name': 'FeatureGroupStatus'}]","['Creating', 'Created', 'CreateFailed', 'Deleting', 'DeleteFailed']"
2626
FeatureMetadata,resource,['get'],"['refresh', 'update']",[],[],"['DescribeFeatureMetadata', 'UpdateFeatureMetadata']",[],[]
27+
FeatureStore,resource,[],[],[],[],[],[],[]
2728
FlowDefinition,resource,"['create', 'get', 'get_all']","['delete', 'refresh', 'wait_for_delete', 'wait_for_status']",[],[],"['CreateFlowDefinition', 'DeleteFlowDefinition', 'DescribeFlowDefinition', 'ListFlowDefinitions']","[{'name': 'FlowDefinitionStatus', 'shape_name': 'FlowDefinitionStatus'}]","['Initializing', 'Active', 'Failed', 'Deleting']"
2829
Hub,resource,"['create', 'get', 'get_all']","['delete', 'refresh', 'update', 'wait_for_delete', 'wait_for_status']",[],[],"['CreateHub', 'DeleteHub', 'DescribeHub', 'ListHubs', 'UpdateHub']","[{'name': 'HubStatus', 'shape_name': 'HubStatus'}]","['InService', 'Creating', 'Updating', 'Deleting', 'CreateFailed', 'UpdateFailed', 'DeleteFailed']"
2930
HubContent,resource,"['get', 'get_all', 'import']","['delete', 'refresh', 'update', 'wait_for_status']",[],[],"['DeleteHubContent', 'DescribeHubContent', 'ImportHubContent', 'ListHubContents', 'UpdateHubContent']","[{'name': 'SupportStatus', 'shape_name': 'HubContentSupportStatus'}]","['Supported', 'Deprecated', 'Restricted']"
31+
HubContentPresignedUrls,resource,['create'],[],"['Hub', 'HubContent']",[],['CreateHubContentPresignedUrls'],[],[]
3032
HubContentReference,resource,['create'],"['delete', 'update']","['Hub', 'HubContent']",[],"['CreateHubContentReference', 'DeleteHubContentReference', 'UpdateHubContentReference']",[],[]
3133
HumanTaskUi,resource,"['create', 'get', 'get_all']","['delete', 'refresh', 'wait_for_delete', 'wait_for_status']",[],[],"['CreateHumanTaskUi', 'DeleteHumanTaskUi', 'DescribeHumanTaskUi', 'ListHumanTaskUis']","[{'name': 'HumanTaskUiStatus', 'shape_name': 'HumanTaskUiStatus'}]","['Active', 'Deleting']"
3234
HyperParameterTuningJob,resource,"['create', 'get', 'get_all']","['delete', 'refresh', 'stop', 'wait', 'wait_for_delete']",[],[],"['CreateHyperParameterTuningJob', 'DeleteHyperParameterTuningJob', 'DescribeHyperParameterTuningJob', 'ListHyperParameterTuningJobs', 'StopHyperParameterTuningJob']","[{'name': 'HyperParameterTuningJobStatus', 'shape_name': 'HyperParameterTuningJobStatus'}]","['Completed', 'InProgress', 'Failed', 'Stopped', 'Stopping', 'Deleting', 'DeleteFailed']"
@@ -37,6 +39,7 @@ InferenceExperiment,resource,"['create', 'get', 'get_all', 'start']","['delete',
3739
InferenceRecommendationsJob,resource,"['create', 'get', 'get_all']","['refresh', 'stop', 'wait', 'wait_for_delete']",[],[],"['CreateInferenceRecommendationsJob', 'DescribeInferenceRecommendationsJob', 'ListInferenceRecommendationsJobs', 'StopInferenceRecommendationsJob']","[{'name': 'Status', 'shape_name': 'RecommendationJobStatus'}]","['PENDING', 'IN_PROGRESS', 'COMPLETED', 'FAILED', 'STOPPING', 'STOPPED', 'DELETING', 'DELETED']"
3840
LabelingJob,resource,"['create', 'get', 'get_all']","['refresh', 'stop', 'wait']",[],[],"['CreateLabelingJob', 'DescribeLabelingJob', 'ListLabelingJobs', 'StopLabelingJob']","[{'name': 'LabelingJobStatus', 'shape_name': 'LabelingJobStatus'}]","['Initializing', 'InProgress', 'Completed', 'Failed', 'Stopping', 'Stopped']"
3941
LineageGroup,resource,"['get', 'get_all']",['refresh'],[],[],"['DescribeLineageGroup', 'ListLineageGroups']",[],[]
42+
MlflowApp,resource,"['create', 'get', 'get_all']","['delete', 'refresh', 'update', 'wait_for_delete', 'wait_for_status']",[],[],"['CreateMlflowApp', 'DeleteMlflowApp', 'DescribeMlflowApp', 'ListMlflowApps', 'UpdateMlflowApp']","[{'name': 'Status', 'shape_name': 'MlflowAppStatus'}]","['Creating', 'Created', 'CreateFailed', 'Updating', 'Updated', 'UpdateFailed', 'Deleting', 'DeleteFailed', 'Deleted']"
4043
MlflowTrackingServer,resource,"['create', 'get', 'get_all', 'start']","['delete', 'refresh', 'stop', 'update', 'wait_for_delete', 'wait_for_status']",[],[],"['CreateMlflowTrackingServer', 'DeleteMlflowTrackingServer', 'DescribeMlflowTrackingServer', 'ListMlflowTrackingServers', 'StartMlflowTrackingServer', 'StopMlflowTrackingServer', 'UpdateMlflowTrackingServer']","[{'name': 'TrackingServerStatus', 'shape_name': 'TrackingServerStatus'}]","['Creating', 'Created', 'CreateFailed', 'Updating', 'Updated', 'UpdateFailed', 'Deleting', 'DeleteFailed', 'Stopping', 'Stopped', 'StopFailed', 'Starting', 'Started', 'StartFailed', 'MaintenanceInProgress', 'MaintenanceComplete', 'MaintenanceFailed']"
4144
Model,resource,"['create', 'get', 'get_all']","['delete', 'refresh']",[],[],"['CreateModel', 'DeleteModel', 'DescribeModel', 'ListModels']",[],[]
4245
ModelBiasJobDefinition,resource,"['create', 'get', 'get_all']","['delete', 'refresh']",[],[],"['CreateModelBiasJobDefinition', 'DeleteModelBiasJobDefinition', 'DescribeModelBiasJobDefinition', 'ListModelBiasJobDefinitions']",[],[]
@@ -57,17 +60,19 @@ PartnerAppPresignedUrl,resource,['create'],[],[],[],['CreatePartnerAppPresignedU
5760
Pipeline,resource,"['create', 'get', 'get_all']","['delete', 'refresh', 'update', 'wait_for_delete', 'wait_for_status']",[],[],"['CreatePipeline', 'DeletePipeline', 'DescribePipeline', 'ListPipelines', 'UpdatePipeline']","[{'name': 'PipelineStatus', 'shape_name': 'PipelineStatus'}]","['Active', 'Deleting']"
5861
PipelineExecution,resource,"['get', 'get_all', 'start']","['refresh', 'stop', 'update', 'wait_for_status']",[],[],"['DescribePipelineExecution', 'ListPipelineExecutions', 'StartPipelineExecution', 'StopPipelineExecution', 'UpdatePipelineExecution']","[{'name': 'PipelineExecutionStatus', 'shape_name': 'PipelineExecutionStatus'}]","['Executing', 'Stopping', 'Stopped', 'Failed', 'Succeeded']"
5962
PresignedDomainUrl,resource,['create'],[],"['Space', 'UserProfile']",[],['CreatePresignedDomainUrl'],[],[]
63+
PresignedMlflowAppUrl,resource,['create'],[],[],[],['CreatePresignedMlflowAppUrl'],[],[]
6064
PresignedMlflowTrackingServerUrl,resource,['create'],[],[],[],['CreatePresignedMlflowTrackingServerUrl'],[],[]
6165
PresignedNotebookInstanceUrl,resource,['create'],[],['NotebookInstance'],[],['CreatePresignedNotebookInstanceUrl'],[],[]
62-
ProcessingJob,resource,"['create', 'get', 'get_all']","['refresh', 'stop', 'wait']",[],[],"['CreateProcessingJob', 'DescribeProcessingJob', 'ListProcessingJobs', 'StopProcessingJob']","[{'name': 'ProcessingJobStatus', 'shape_name': 'ProcessingJobStatus'}]","['InProgress', 'Completed', 'Failed', 'Stopping', 'Stopped']"
66+
ProcessingJob,resource,"['create', 'get', 'get_all']","['delete', 'refresh', 'stop', 'wait']",[],[],"['CreateProcessingJob', 'DeleteProcessingJob', 'DescribeProcessingJob', 'ListProcessingJobs', 'StopProcessingJob']","[{'name': 'ProcessingJobStatus', 'shape_name': 'ProcessingJobStatus'}]","['InProgress', 'Completed', 'Failed', 'Stopping', 'Stopped']"
6367
Project,resource,"['create', 'get', 'get_all']","['delete', 'refresh', 'update', 'wait_for_status']",[],[],"['CreateProject', 'DeleteProject', 'DescribeProject', 'ListProjects', 'UpdateProject']","[{'name': 'ProjectStatus', 'shape_name': 'ProjectStatus'}]","['Pending', 'CreateInProgress', 'CreateCompleted', 'CreateFailed', 'DeleteInProgress', 'DeleteFailed', 'DeleteCompleted', 'UpdateInProgress', 'UpdateCompleted', 'UpdateFailed']"
6468
ResourceCatalog,resource,['get_all'],[],[],[],['ListResourceCatalogs'],[],[]
6569
SagemakerServicecatalogPortfolio,resource,[],[],[],[],[],[],[]
70+
Session,resource,['start'],[],[],[],['StartSession'],[],[]
6671
Space,resource,"['create', 'get', 'get_all']","['delete', 'refresh', 'update', 'wait_for_delete', 'wait_for_status']",[],[],"['CreateSpace', 'DeleteSpace', 'DescribeSpace', 'ListSpaces', 'UpdateSpace']","[{'name': 'Status', 'shape_name': 'SpaceStatus'}]","['Deleting', 'Failed', 'InService', 'Pending', 'Updating', 'Update_Failed', 'Delete_Failed']"
6772
StudioLifecycleConfig,resource,"['create', 'get', 'get_all']","['delete', 'refresh']",[],[],"['CreateStudioLifecycleConfig', 'DeleteStudioLifecycleConfig', 'DescribeStudioLifecycleConfig', 'ListStudioLifecycleConfigs']",[],[]
6873
SubscribedWorkteam,resource,"['get', 'get_all']",['refresh'],[],[],"['DescribeSubscribedWorkteam', 'ListSubscribedWorkteams']",[],[]
6974
Tag,resource,['get_all'],[],[],[],['ListTags'],[],[]
70-
TrainingJob,resource,"['create', 'get', 'get_all']","['refresh', 'stop', 'update', 'wait']",[],[],"['CreateTrainingJob', 'DescribeTrainingJob', 'ListTrainingJobs', 'StopTrainingJob', 'UpdateTrainingJob']","[{'name': 'TrainingJobStatus', 'shape_name': 'TrainingJobStatus'}]","['InProgress', 'Completed', 'Failed', 'Stopping', 'Stopped']"
75+
TrainingJob,resource,"['create', 'get', 'get_all']","['delete', 'refresh', 'stop', 'update', 'wait', 'wait_for_delete']",[],[],"['CreateTrainingJob', 'DeleteTrainingJob', 'DescribeTrainingJob', 'ListTrainingJobs', 'StopTrainingJob', 'UpdateTrainingJob']","[{'name': 'TrainingJobStatus', 'shape_name': 'TrainingJobStatus'}]","['InProgress', 'Completed', 'Failed', 'Stopping', 'Stopped', 'Deleting']"
7176
TrainingPlan,resource,"['create', 'get', 'get_all']","['refresh', 'wait_for_status']",[],[],"['CreateTrainingPlan', 'DescribeTrainingPlan', 'ListTrainingPlans']","[{'name': 'Status', 'shape_name': 'TrainingPlanStatus'}]","['Pending', 'Active', 'Scheduled', 'Expired', 'Failed']"
7277
TransformJob,resource,"['create', 'get', 'get_all']","['refresh', 'stop', 'wait']",['Model'],[],"['CreateTransformJob', 'DescribeTransformJob', 'ListTransformJobs', 'StopTransformJob']","[{'name': 'TransformJobStatus', 'shape_name': 'TransformJobStatus'}]","['InProgress', 'Completed', 'Failed', 'Stopping', 'Stopped']"
7378
Trial,resource,"['create', 'get', 'get_all']","['delete', 'refresh', 'update']",['Experiment'],[],"['CreateTrial', 'DeleteTrial', 'DescribeTrial', 'ListTrials', 'UpdateTrial']",[],[]

src/sagemaker_core/main/resources.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11326,6 +11326,82 @@ def update(
1132611326
return self
1132711327

1132811328

11329+
class FeatureStore(Base):
11330+
"""
11331+
Class representing resource FeatureStore
11332+
11333+
"""
11334+
11335+
@staticmethod
11336+
@Base.add_validate_call
11337+
def search(
11338+
resource: str,
11339+
search_expression: Optional[shapes.SearchExpression] = Unassigned(),
11340+
sort_by: Optional[str] = Unassigned(),
11341+
sort_order: Optional[str] = Unassigned(),
11342+
next_token: Optional[str] = Unassigned(),
11343+
max_results: Optional[int] = Unassigned(),
11344+
cross_account_filter_option: Optional[str] = Unassigned(),
11345+
visibility_conditions: Optional[List[shapes.VisibilityConditions]] = Unassigned(),
11346+
session: Optional[Session] = None,
11347+
region: Optional[str] = None,
11348+
) -> Optional[shapes.SearchResponse]:
11349+
"""
11350+
Finds SageMaker resources that match a search query.
11351+
11352+
Parameters:
11353+
resource: The name of the SageMaker resource to search for.
11354+
search_expression: A Boolean conditional statement. Resources must satisfy this condition to be included in search results. You must provide at least one subexpression, filter, or nested filter. The maximum number of recursive SubExpressions, NestedFilters, and Filters that can be included in a SearchExpression object is 50.
11355+
sort_by: The name of the resource property used to sort the SearchResults. The default is LastModifiedTime.
11356+
sort_order: How SearchResults are ordered. Valid values are Ascending or Descending. The default is Descending.
11357+
next_token: If more than MaxResults resources match the specified SearchExpression, the response includes a NextToken. The NextToken can be passed to the next SearchRequest to continue retrieving results.
11358+
max_results: The maximum number of results to return.
11359+
cross_account_filter_option: A cross account filter option. When the value is "CrossAccount" the search results will only include resources made discoverable to you from other accounts. When the value is "SameAccount" or null the search results will only include resources from your account. Default is null. For more information on searching for resources made discoverable to your account, see Search discoverable resources in the SageMaker Developer Guide. The maximum number of ResourceCatalogs viewable is 1000.
11360+
visibility_conditions: Limits the results of your search request to the resources that you can access.
11361+
session: Boto3 session.
11362+
region: Region name.
11363+
11364+
Returns:
11365+
shapes.SearchResponse
11366+
11367+
Raises:
11368+
botocore.exceptions.ClientError: This exception is raised for AWS service related errors.
11369+
The error message and error code can be parsed from the exception as follows:
11370+
```
11371+
try:
11372+
# AWS service call here
11373+
except botocore.exceptions.ClientError as e:
11374+
error_message = e.response['Error']['Message']
11375+
error_code = e.response['Error']['Code']
11376+
```
11377+
"""
11378+
11379+
operation_input_args = {
11380+
"Resource": resource,
11381+
"SearchExpression": search_expression,
11382+
"SortBy": sort_by,
11383+
"SortOrder": sort_order,
11384+
"NextToken": next_token,
11385+
"MaxResults": max_results,
11386+
"CrossAccountFilterOption": cross_account_filter_option,
11387+
"VisibilityConditions": visibility_conditions,
11388+
}
11389+
# serialize the input request
11390+
operation_input_args = serialize(operation_input_args)
11391+
logger.debug(f"Serialized input request: {operation_input_args}")
11392+
11393+
client = Base.get_sagemaker_client(
11394+
session=session, region_name=region, service_name="sagemaker"
11395+
)
11396+
11397+
logger.debug(f"Calling search API")
11398+
response = client.search(**operation_input_args)
11399+
logger.debug(f"Response: {response}")
11400+
11401+
transformed_response = transform(response, "SearchResponse")
11402+
return shapes.SearchResponse(**transformed_response)
11403+
11404+
1132911405
class FlowDefinition(Base):
1133011406
"""
1133111407
Class representing resource FlowDefinition

src/sagemaker_core/main/shapes.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14233,6 +14233,22 @@ class TotalHits(Base):
1423314233
relation: Optional[str] = Unassigned()
1423414234

1423514235

14236+
class SearchResponse(Base):
14237+
"""
14238+
SearchResponse
14239+
14240+
Attributes
14241+
----------------------
14242+
results: A list of SearchRecord objects.
14243+
next_token: If the result of the previous Search request was truncated, the response includes a NextToken. To retrieve the next set of results, use the token in the next request.
14244+
total_hits: The total number of matching results.
14245+
"""
14246+
14247+
results: Optional[List[SearchRecord]] = Unassigned()
14248+
next_token: Optional[str] = Unassigned()
14249+
total_hits: Optional[TotalHits] = Unassigned()
14250+
14251+
1423614252
class TrainingPlanOffering(Base):
1423714253
"""
1423814254
TrainingPlanOffering

src/sagemaker_core/tools/additional_operations.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
{
2+
"FeatureStore": {
3+
"Search": {
4+
"operation_name": "Search",
5+
"resource_name": "FeatureStore",
6+
"method_name": "search",
7+
"return_type": "SearchResponse",
8+
"method_type": "static",
9+
"service_name": "sagemaker"
10+
}
11+
},
212
"Cluster": {
313
"DescribeClusterNode": {
414
"operation_name": "DescribeClusterNode",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"SupportedAPIs": 371, "UnsupportedAPIs": 17}
1+
{"SupportedAPIs": 372, "UnsupportedAPIs": 16}

0 commit comments

Comments
 (0)