13
13
"""This module contains code to create and manage SageMaker ``Actions``."""
14
14
from __future__ import absolute_import
15
15
16
+ from typing import Optional , Iterator
17
+ from datetime import datetime
18
+
19
+ from sagemaker import Session
16
20
from sagemaker .apiutils import _base_types
17
21
from sagemaker .lineage import _api_types , _utils
22
+ from sagemaker .lineage ._api_types import ActionSource , ActionSummary
18
23
19
24
20
25
class Action (_base_types .Record ):
@@ -53,24 +58,24 @@ class Action(_base_types.Record):
53
58
last_modified_by (obj): Contextual info on which account created the action.
54
59
"""
55
60
56
- action_arn = None
57
- action_name = None
58
- action_type = None
59
- description = None
60
- status = None
61
- source = None
62
- properties = None
63
- properties_to_remove = None
64
- tags = None
65
- creation_time = None
66
- created_by = None
67
- last_modified_time = None
68
- last_modified_by = None
69
-
70
- _boto_create_method = "create_action"
71
- _boto_load_method = "describe_action"
72
- _boto_update_method = "update_action"
73
- _boto_delete_method = "delete_action"
61
+ action_arn : str = None
62
+ action_name : str = None
63
+ action_type : str = None
64
+ description : str = None
65
+ status : str = None
66
+ source : ActionSource = None
67
+ properties : dict = None
68
+ properties_to_remove : list = None
69
+ tags : list = None
70
+ creation_time : datetime = None
71
+ created_by : str = None
72
+ last_modified_time : datetime = None
73
+ last_modified_by : str = None
74
+
75
+ _boto_create_method : str = "create_action"
76
+ _boto_load_method : str = "describe_action"
77
+ _boto_update_method : str = "update_action"
78
+ _boto_delete_method : str = "delete_action"
74
79
75
80
_boto_update_members = [
76
81
"action_name" ,
@@ -84,15 +89,15 @@ class Action(_base_types.Record):
84
89
85
90
_custom_boto_types = {"source" : (_api_types .ActionSource , False )}
86
91
87
- def save (self ):
92
+ def save (self ) -> "Action" :
88
93
"""Save the state of this Action to SageMaker.
89
94
90
95
Returns:
91
96
Action: A SageMaker ``Action``object.
92
97
"""
93
98
return self ._invoke_api (self ._boto_update_method , self ._boto_update_members )
94
99
95
- def delete (self , disassociate = False ):
100
+ def delete (self , disassociate : bool = False ):
96
101
"""Delete the action.
97
102
98
103
Args:
@@ -104,13 +109,14 @@ def delete(self, disassociate=False):
104
109
source_arn = self .action_arn , sagemaker_session = self .sagemaker_session
105
110
)
106
111
_utils ._disassociate (
107
- destination_arn = self .action_arn , sagemaker_session = self .sagemaker_session
112
+ destination_arn = self .action_arn ,
113
+ sagemaker_session = self .sagemaker_session ,
108
114
)
109
115
110
116
self ._invoke_api (self ._boto_delete_method , self ._boto_delete_members )
111
117
112
118
@classmethod
113
- def load (cls , action_name , sagemaker_session = None ):
119
+ def load (cls , action_name : str , sagemaker_session : Session = None ) -> "Action" :
114
120
"""Load an existing action and return an ``Action`` object representing it.
115
121
116
122
Args:
@@ -154,16 +160,16 @@ def set_tags(self, tags=None):
154
160
@classmethod
155
161
def create (
156
162
cls ,
157
- action_name = None ,
158
- source_uri = None ,
159
- source_type = None ,
160
- action_type = None ,
161
- description = None ,
162
- status = None ,
163
- properties = None ,
164
- tags = None ,
165
- sagemaker_session = None ,
166
- ):
163
+ action_name : str = None ,
164
+ source_uri : str = None ,
165
+ source_type : str = None ,
166
+ action_type : str = None ,
167
+ description : str = None ,
168
+ status : str = None ,
169
+ properties : dict = None ,
170
+ tags : dict = None ,
171
+ sagemaker_session : Session = None ,
172
+ ) -> "Action" :
167
173
"""Create an action and return an ``Action`` object representing it.
168
174
169
175
Args:
@@ -198,16 +204,16 @@ def create(
198
204
@classmethod
199
205
def list (
200
206
cls ,
201
- source_uri = None ,
202
- action_type = None ,
203
- created_after = None ,
204
- created_before = None ,
205
- sort_by = None ,
206
- sort_order = None ,
207
- sagemaker_session = None ,
208
- max_results = None ,
209
- next_token = None ,
210
- ):
207
+ source_uri : Optional [ str ] = None ,
208
+ action_type : Optional [ str ] = None ,
209
+ created_after : Optional [ datetime ] = None ,
210
+ created_before : Optional [ datetime ] = None ,
211
+ sort_by : Optional [ str ] = None ,
212
+ sort_order : Optional [ str ] = None ,
213
+ sagemaker_session : Session = None ,
214
+ max_results : Optional [ int ] = None ,
215
+ next_token : Optional [ str ] = None ,
216
+ ) -> Iterator [ ActionSummary ] :
211
217
"""Return a list of action summaries.
212
218
213
219
Args:
0 commit comments