github.com/mweagle/Sparta@v1.15.0/aws/step/glue.go (about) 1 package step 2 3 import ( 4 "math/rand" 5 6 gocf "github.com/mweagle/go-cloudformation" 7 ) 8 9 // GlueParameters represents params for Glue step 10 // Ref: https://docs.aws.amazon.com/step-functions/latest/dg/connectors-glue.html 11 type GlueParameters struct { 12 JobName gocf.Stringable `json:",omitempty"` 13 JobRunID string `json:"JobRunId,omitempty"` 14 Arguments map[string]interface{} `json:",omitempty"` 15 AllocatedCapacity *gocf.IntegerExpr `json:",omitempty"` 16 Timeout *gocf.IntegerExpr `json:",omitempty"` 17 SecurityConfiguration gocf.Stringable `json:",omitempty"` 18 NotificationProperty interface{} `json:",omitempty"` 19 } 20 21 // GlueState represents bindings for 22 // https://docs.aws.amazon.com/step-functions/latest/dg/connectors-sns.html 23 type GlueState struct { 24 BaseTask 25 parameters GlueParameters 26 } 27 28 // MarshalJSON for custom marshalling, since this will be stringified and we need it 29 // to turn into a stringified 30 // Ref: https://docs.aws.amazon.com/step-functions/latest/dg/connectors-sns.html 31 func (gs *GlueState) MarshalJSON() ([]byte, error) { 32 return gs.BaseTask.marshalMergedParams("arn:aws:states:::glue:startJobRun.sync", 33 &gs.parameters) 34 } 35 36 // NewGlueState returns an initialized GlueState 37 func NewGlueState(stateName string, 38 parameters GlueParameters) *GlueState { 39 40 sns := &GlueState{ 41 BaseTask: BaseTask{ 42 baseInnerState: baseInnerState{ 43 name: stateName, 44 id: rand.Int63(), 45 }, 46 }, 47 parameters: parameters, 48 } 49 return sns 50 }