Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c81ee56

Browse files
Adding eks:call and eks:runJob steps
1 parent 52db3de commit c81ee56

File tree

4 files changed

+330
-22
lines changed

4 files changed

+330
-22
lines changed

‎doc/services.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ Amazon DynamoDB
3434

3535
Amazon EKS
3636
----------
37+
.. autoclass:: stepfunctions.steps.service.EksCallStep
38+
3739
.. autoclass:: stepfunctions.steps.service.EksCreateClusterStep
3840

3941
.. autoclass:: stepfunctions.steps.service.EksCreateFargateProfileStep
@@ -44,7 +46,10 @@ Amazon EKS
4446

4547
.. autoclass:: stepfunctions.steps.service.EksDeleteFargateProfileStep
4648

47-
.. autoclass:: stepfunctions.steps.service.EksDeleteNodeGroupStep
49+
.. autoclass:: stepfunctions.steps.service.EksDeleteNodegroupStep
50+
51+
.. autoclass:: stepfunctions.steps.service.EksRunJobStep
52+
4853

4954
Amazon EMR
5055
-----------

‎src/stepfunctions/steps/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@
2121
from stepfunctions.steps.service import DynamoDBGetItemStep, DynamoDBPutItemStep, DynamoDBUpdateItemStep, DynamoDBDeleteItemStep
2222

2323
from stepfunctions.steps.service import (
24+
EksCallStep,
2425
EksCreateClusterStep,
2526
EksCreateFargateProfileStep,
2627
EksCreateNodeGroupStep,
2728
EksDeleteClusterStep,
2829
EksDeleteFargateProfileStep,
29-
EksDeleteNodeGroupStep,
30+
EksDeleteNodegroupStep,
31+
EksRunJobStep,
3032
)
3133
from stepfunctions.steps.service import EmrCreateClusterStep, EmrTerminateClusterStep, EmrAddStepStep, EmrCancelStepStep, EmrSetClusterTerminationProtectionStep, EmrModifyInstanceFleetByNameStep, EmrModifyInstanceGroupByNameStep
3234
from stepfunctions.steps.service import EventBridgePutEventsStep

‎src/stepfunctions/steps/service.py

Lines changed: 97 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,22 @@
2626
SQS_SERVICE_NAME = "sqs"
2727

2828

29-
3029
class DynamoDBApi(Enum):
3130
GetItem = "getItem"
3231
PutItem = "putItem"
3332
DeleteItem = "deleteItem"
3433
UpdateItem = "updateItem"
3534

36-
class EKSApi(Enum):
35+
36+
class EksApi(Enum):
3737
CreateCluster = "createCluster"
3838
DeleteCluster = "deleteCluster"
3939
CreateFargateProfile = "createFargateProfile"
4040
DeleteFargateProfile = "deleteFargateProfile"
4141
CreateNodegroup = "createNodegroup"
4242
DeleteNodegroup = "deleteNodegroup"
43+
RunJob = "runJob"
44+
Call = "call"
4345

4446

4547
class ElasticMapReduceApi(Enum):
@@ -229,7 +231,7 @@ def __init__(self, state_id, **kwargs):
229231

230232
class EksCreateClusterStep(Task):
231233
"""
232-
Creates a Task state that creates an Amazon EKS cluster. Call Amazon EKS with Step Functions <https://docs.aws.amazon.com/step-functions/latest/dg/connect-eks.html>`_ for more details.
234+
Creates a Task state that creates an Amazon EKS cluster. See `Call Amazon EKS with Step Functions <https://docs.aws.amazon.com/step-functions/latest/dg/connect-eks.html>`_ for more details.
233235
"""
234236

235237
def __init__(self, state_id, wait_for_completion=True, **kwargs):
@@ -253,15 +255,15 @@ def __init__(self, state_id, wait_for_completion=True, **kwargs):
253255
"""
254256

255257
kwargs[Field.Resource.value] = get_service_integration_arn(EKS_SERVICES_NAME,
256-
EKSApi.CreateCluster,
258+
EksApi.CreateCluster,
257259
IntegrationPattern.WaitForCompletion)
258260
else:
259261
"""
260262
Example resource arn: arn:aws:states:::eks:createCluster
261263
"""
262264

263265
kwargs[Field.Resource.value] = get_service_integration_arn(EKS_SERVICES_NAME,
264-
EKSApi.CreateCluster)
266+
EksApi.CreateCluster)
265267

266268
super(EksCreateClusterStep, self).__init__(state_id, **kwargs)
267269

@@ -292,15 +294,15 @@ def __init__(self, state_id, wait_for_completion=True, **kwargs):
292294
"""
293295

294296
kwargs[Field.Resource.value] = get_service_integration_arn(EKS_SERVICES_NAME,
295-
EKSApi.CreateFargateProfile,
297+
EksApi.CreateFargateProfile,
296298
IntegrationPattern.WaitForCompletion)
297299
else:
298300
"""
299301
Example resource arn: arn:aws:states:::eks:createFargateProfile
300302
"""
301303

302304
kwargs[Field.Resource.value] = get_service_integration_arn(EKS_SERVICES_NAME,
303-
EKSApi.CreateFargateProfile)
305+
EksApi.CreateFargateProfile)
304306

305307
super(EksCreateFargateProfileStep, self).__init__(state_id, **kwargs)
306308

@@ -331,15 +333,15 @@ def __init__(self, state_id, wait_for_completion=True, **kwargs):
331333
"""
332334

333335
kwargs[Field.Resource.value] = get_service_integration_arn(EKS_SERVICES_NAME,
334-
EKSApi.DeleteFargateProfile,
336+
EksApi.DeleteFargateProfile,
335337
IntegrationPattern.WaitForCompletion)
336338
else:
337339
"""
338340
Example resource arn: arn:aws:states:::eks:deleteFargateProfile
339341
"""
340342

341343
kwargs[Field.Resource.value] = get_service_integration_arn(EKS_SERVICES_NAME,
342-
EKSApi.DeleteFargateProfile)
344+
EksApi.DeleteFargateProfile)
343345

344346
super(EksDeleteFargateProfileStep, self).__init__(state_id, **kwargs)
345347

@@ -370,20 +372,20 @@ def __init__(self, state_id, wait_for_completion=True, **kwargs):
370372
"""
371373

372374
kwargs[Field.Resource.value] = get_service_integration_arn(EKS_SERVICES_NAME,
373-
EKSApi.CreateNodegroup,
375+
EksApi.CreateNodegroup,
374376
IntegrationPattern.WaitForCompletion)
375377
else:
376378
"""
377379
Example resource arn: arn:aws:states:::eks:createNodegroup
378380
"""
379381

380382
kwargs[Field.Resource.value] = get_service_integration_arn(EKS_SERVICES_NAME,
381-
EKSApi.CreateNodegroup)
383+
EksApi.CreateNodegroup)
382384

383385
super(EksCreateNodeGroupStep, self).__init__(state_id, **kwargs)
384386

385387

386-
class EksDeleteNodeGroupStep(Task):
388+
class EksDeleteNodegroupStep(Task):
387389
"""
388390
Creates a Task state that deletes a node group. See `Call Amazon EKS with Step Functions <https://docs.aws.amazon.com/step-functions/latest/dg/connect-eks.html>`_ for more details.
389391
"""
@@ -409,17 +411,17 @@ def __init__(self, state_id, wait_for_completion=True, **kwargs):
409411
"""
410412

411413
kwargs[Field.Resource.value] = get_service_integration_arn(EKS_SERVICES_NAME,
412-
EKSApi.DeleteNodegroup,
414+
EksApi.DeleteNodegroup,
413415
IntegrationPattern.WaitForCompletion)
414416
else:
415417
"""
416418
Example resource arn: arn:aws:states:::eks:deleteNodegroup
417419
"""
418420

419421
kwargs[Field.Resource.value] = get_service_integration_arn(EKS_SERVICES_NAME,
420-
EKSApi.DeleteNodegroup)
422+
EksApi.DeleteNodegroup)
421423

422-
super(EksDeleteNodeGroupStep, self).__init__(state_id, **kwargs)
424+
super(EksDeleteNodegroupStep, self).__init__(state_id, **kwargs)
423425

424426

425427
class EksDeleteClusterStep(Task):
@@ -448,19 +450,97 @@ def __init__(self, state_id, wait_for_completion=True, **kwargs):
448450
"""
449451

450452
kwargs[Field.Resource.value] = get_service_integration_arn(EKS_SERVICES_NAME,
451-
EKSApi.DeleteCluster,
453+
EksApi.DeleteCluster,
452454
IntegrationPattern.WaitForCompletion)
453455
else:
454456
"""
455457
Example resource arn: arn:aws:states:::eks:deleteCluster
456458
"""
457459

458460
kwargs[Field.Resource.value] = get_service_integration_arn(EKS_SERVICES_NAME,
459-
EKSApi.DeleteCluster)
461+
EksApi.DeleteCluster)
460462

461463
super(EksDeleteClusterStep, self).__init__(state_id, **kwargs)
462464

463465

466+
class EksRunJobStep(Task):
467+
"""
468+
Creates a Task state that allows you to run a job on your Amazon EKS cluster. See `Call Amazon EKS with Step Functions <https://docs.aws.amazon.com/step-functions/latest/dg/connect-eks.html>`_ for more details.
469+
"""
470+
471+
def __init__(self, state_id, wait_for_completion=True, **kwargs):
472+
"""
473+
Args:
474+
state_id (str): State name whose length **must be** less than or equal to 128 unicode characters. State names **must be** unique within the scope of the whole state machine.
475+
comment (str, optional): Human-readable comment or description. (default: None)
476+
timeout_seconds (int, optional): Positive integer specifying timeout for the state in seconds. If the state runs longer than the specified timeout, then the interpreter fails the state with a `States.Timeout` Error Name. (default: 60)
477+
timeout_seconds_path (str, optional): Path specifying the state's timeout value in seconds from the state input. When resolved, the path must select a field whose value is a positive integer.
478+
heartbeat_seconds (int, optional): Positive integer specifying heartbeat timeout for the state in seconds. This value should be lower than the one specified for `timeout_seconds`. If more time than the specified heartbeat elapses between heartbeats from the task, then the interpreter fails the state with a `States.Timeout` Error Name.
479+
heartbeat_seconds_path (str, optional): Path specifying the state's heartbeat value in seconds from the state input. When resolved, the path must select a field whose value is a positive integer.
480+
input_path (str, optional): Path applied to the state’s raw input to select some or all of it; that selection is used by the state. (default: '$')
481+
parameters (dict, optional): The value of this field becomes the effective input for the state.
482+
result_path (str, optional): Path specifying the raw input’s combination with or replacement by the state’s result. (default: '$')
483+
output_path (str, optional): Path applied to the state’s output after the application of `result_path`, producing the effective output which serves as the raw input for the next state. (default: '$')
484+
wait_for_completion (bool, optional): Boolean value set to `True` if the Task state should wait to complete before proceeding to the next step in the workflow. (default: True)
485+
"""
486+
if wait_for_completion:
487+
"""
488+
Example resource arn: arn:aws:states:::eks:createCluster.sync
489+
"""
490+
491+
kwargs[Field.Resource.value] = get_service_integration_arn(EKS_SERVICES_NAME,
492+
EksApi.RunJob,
493+
IntegrationPattern.WaitForCompletion)
494+
else:
495+
"""
496+
Example resource arn: arn:aws:states:::eks:createCluster
497+
"""
498+
499+
kwargs[Field.Resource.value] = get_service_integration_arn(EKS_SERVICES_NAME,
500+
EksApi.RunJob)
501+
502+
super(EksRunJobStep, self).__init__(state_id, **kwargs)
503+
504+
505+
class EksCallStep(Task):
506+
"""
507+
Creates a Task state that allows you to use the Kubernetes API to read and write Kubernetes resource objects via a Kubernetes API endpoint. See `Call Amazon EKS with Step Functions <https://docs.aws.amazon.com/step-functions/latest/dg/connect-eks.html>`_ for more details.
508+
"""
509+
510+
def __init__(self, state_id, wait_for_completion=True, **kwargs):
511+
"""
512+
Args:
513+
state_id (str): State name whose length **must be** less than or equal to 128 unicode characters. State names **must be** unique within the scope of the whole state machine.
514+
comment (str, optional): Human-readable comment or description. (default: None)
515+
timeout_seconds (int, optional): Positive integer specifying timeout for the state in seconds. If the state runs longer than the specified timeout, then the interpreter fails the state with a `States.Timeout` Error Name. (default: 60)
516+
timeout_seconds_path (str, optional): Path specifying the state's timeout value in seconds from the state input. When resolved, the path must select a field whose value is a positive integer.
517+
heartbeat_seconds (int, optional): Positive integer specifying heartbeat timeout for the state in seconds. This value should be lower than the one specified for `timeout_seconds`. If more time than the specified heartbeat elapses between heartbeats from the task, then the interpreter fails the state with a `States.Timeout` Error Name.
518+
heartbeat_seconds_path (str, optional): Path specifying the state's heartbeat value in seconds from the state input. When resolved, the path must select a field whose value is a positive integer.
519+
input_path (str, optional): Path applied to the state’s raw input to select some or all of it; that selection is used by the state. (default: '$')
520+
parameters (dict, optional): The value of this field becomes the effective input for the state.
521+
result_path (str, optional): Path specifying the raw input’s combination with or replacement by the state’s result. (default: '$')
522+
output_path (str, optional): Path applied to the state’s output after the application of `result_path`, producing the effective output which serves as the raw input for the next state. (default: '$')
523+
wait_for_completion (bool, optional): Boolean value set to `True` if the Task state should wait to complete before proceeding to the next step in the workflow. (default: True)
524+
"""
525+
if wait_for_completion:
526+
"""
527+
Example resource arn: arn:aws:states:::eks:createCluster.sync
528+
"""
529+
530+
kwargs[Field.Resource.value] = get_service_integration_arn(EKS_SERVICES_NAME,
531+
EksApi.Call,
532+
IntegrationPattern.WaitForCompletion)
533+
else:
534+
"""
535+
Example resource arn: arn:aws:states:::eks:createCluster
536+
"""
537+
538+
kwargs[Field.Resource.value] = get_service_integration_arn(EKS_SERVICES_NAME,
539+
EksApi.Call)
540+
541+
super(EksCallStep, self).__init__(state_id, **kwargs)
542+
543+
464544
class GlueDataBrewStartJobRunStep(Task):
465545

466546
"""

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /