|
| 1 | +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"). You |
| 4 | +# may not use this file except in compliance with the License. A copy of |
| 5 | +# the License is located at |
| 6 | +# |
| 7 | +# http://aws.amazon.com/apache2.0/ |
| 8 | +# |
| 9 | +# or in the "license" file accompanying this file. This file is |
| 10 | +# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF |
| 11 | +# ANY KIND, either express or implied. See the License for the specific |
| 12 | +# language governing permissions and limitations under the License. |
| 13 | +"""Feature Store. |
| 14 | +
|
| 15 | +Amazon SageMaker Feature Store is a fully managed, purpose-built repository to store, share, and |
| 16 | +manage features for machine learning (ML) models. |
| 17 | +""" |
| 18 | +from __future__ import absolute_import |
| 19 | + |
| 20 | +import datetime |
| 21 | +from typing import Dict, Any |
| 22 | + |
| 23 | +import attr |
| 24 | + |
| 25 | +from sagemaker import Session |
| 26 | + |
| 27 | + |
| 28 | +@attr.s |
| 29 | +class FeatureStore: |
| 30 | + """FeatureStore definition. |
| 31 | +
|
| 32 | + This class instantiates a FeatureStore object that comprises a SageMaker session instance. |
| 33 | +
|
| 34 | + Attributes: |
| 35 | + sagemaker_session (Session): session instance to perform boto calls. |
| 36 | + """ |
| 37 | + |
| 38 | + sagemaker_session: Session = attr.ib(default=Session) |
| 39 | + |
| 40 | + def list_feature_groups( |
| 41 | + self, |
| 42 | + name_contains: str = None, |
| 43 | + feature_group_status_equals: str = None, |
| 44 | + offline_store_status_equals: str = None, |
| 45 | + creation_time_after: datetime.datetime = None, |
| 46 | + creation_time_before: datetime.datetime = None, |
| 47 | + sort_order: str = None, |
| 48 | + sort_by: str = None, |
| 49 | + max_results: int = None, |
| 50 | + next_token: str = None, |
| 51 | + ) -> Dict[str, Any]: |
| 52 | + """List all FeatureGroups satisfying given filters. |
| 53 | +
|
| 54 | + Args: |
| 55 | + name_contains (str): A string that partially matches one or more FeatureGroups' names. |
| 56 | + Filters FeatureGroups by name. |
| 57 | + feature_group_status_equals (str): A FeatureGroup status. |
| 58 | + Filters FeatureGroups by FeatureGroup status. |
| 59 | + offline_store_status_equals (str): An OfflineStore status. |
| 60 | + Filters FeatureGroups by OfflineStore status. |
| 61 | + creation_time_after (datetime.datetime): Use this parameter to search for FeatureGroups |
| 62 | + created after a specific date and time. |
| 63 | + creation_time_before (datetime.datetime): Use this parameter to search for FeatureGroups |
| 64 | + created before a specific date and time. |
| 65 | + sort_order (str): The order in which FeatureGroups are listed. |
| 66 | + sort_by (str): The value on which the FeatureGroup list is sorted. |
| 67 | + max_results (int): The maximum number of results returned by ListFeatureGroups. |
| 68 | + next_token (str): A token to resume pagination of ListFeatureGroups results. |
| 69 | + Returns: |
| 70 | + Response dict from service. |
| 71 | + """ |
| 72 | + return self.sagemaker_session.list_feature_groups( |
| 73 | + name_contains=name_contains, |
| 74 | + feature_group_status_equals=feature_group_status_equals, |
| 75 | + offline_store_status_equals=offline_store_status_equals, |
| 76 | + creation_time_after=creation_time_after, |
| 77 | + creation_time_before=creation_time_before, |
| 78 | + sort_order=sort_order, |
| 79 | + sort_by=sort_by, |
| 80 | + max_results=max_results, |
| 81 | + next_token=next_token, |
| 82 | + ) |
0 commit comments