examples_test.go 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package swf_test
  3. import (
  4. "bytes"
  5. "fmt"
  6. "time"
  7. "github.com/aws/aws-sdk-go/aws"
  8. "github.com/aws/aws-sdk-go/service/swf"
  9. )
  10. var _ time.Duration
  11. var _ bytes.Buffer
  12. func ExampleSWF_CountClosedWorkflowExecutions() {
  13. svc := swf.New(nil)
  14. params := &swf.CountClosedWorkflowExecutionsInput{
  15. Domain: aws.String("DomainName"), // Required
  16. CloseStatusFilter: &swf.CloseStatusFilter{
  17. Status: aws.String("CloseStatus"), // Required
  18. },
  19. CloseTimeFilter: &swf.ExecutionTimeFilter{
  20. OldestDate: aws.Time(time.Now()), // Required
  21. LatestDate: aws.Time(time.Now()),
  22. },
  23. ExecutionFilter: &swf.WorkflowExecutionFilter{
  24. WorkflowId: aws.String("WorkflowId"), // Required
  25. },
  26. StartTimeFilter: &swf.ExecutionTimeFilter{
  27. OldestDate: aws.Time(time.Now()), // Required
  28. LatestDate: aws.Time(time.Now()),
  29. },
  30. TagFilter: &swf.TagFilter{
  31. Tag: aws.String("Tag"), // Required
  32. },
  33. TypeFilter: &swf.WorkflowTypeFilter{
  34. Name: aws.String("Name"), // Required
  35. Version: aws.String("VersionOptional"),
  36. },
  37. }
  38. resp, err := svc.CountClosedWorkflowExecutions(params)
  39. if err != nil {
  40. // Print the error, cast err to awserr.Error to get the Code and
  41. // Message from an error.
  42. fmt.Println(err.Error())
  43. return
  44. }
  45. // Pretty-print the response data.
  46. fmt.Println(resp)
  47. }
  48. func ExampleSWF_CountOpenWorkflowExecutions() {
  49. svc := swf.New(nil)
  50. params := &swf.CountOpenWorkflowExecutionsInput{
  51. Domain: aws.String("DomainName"), // Required
  52. StartTimeFilter: &swf.ExecutionTimeFilter{ // Required
  53. OldestDate: aws.Time(time.Now()), // Required
  54. LatestDate: aws.Time(time.Now()),
  55. },
  56. ExecutionFilter: &swf.WorkflowExecutionFilter{
  57. WorkflowId: aws.String("WorkflowId"), // Required
  58. },
  59. TagFilter: &swf.TagFilter{
  60. Tag: aws.String("Tag"), // Required
  61. },
  62. TypeFilter: &swf.WorkflowTypeFilter{
  63. Name: aws.String("Name"), // Required
  64. Version: aws.String("VersionOptional"),
  65. },
  66. }
  67. resp, err := svc.CountOpenWorkflowExecutions(params)
  68. if err != nil {
  69. // Print the error, cast err to awserr.Error to get the Code and
  70. // Message from an error.
  71. fmt.Println(err.Error())
  72. return
  73. }
  74. // Pretty-print the response data.
  75. fmt.Println(resp)
  76. }
  77. func ExampleSWF_CountPendingActivityTasks() {
  78. svc := swf.New(nil)
  79. params := &swf.CountPendingActivityTasksInput{
  80. Domain: aws.String("DomainName"), // Required
  81. TaskList: &swf.TaskList{ // Required
  82. Name: aws.String("Name"), // Required
  83. },
  84. }
  85. resp, err := svc.CountPendingActivityTasks(params)
  86. if err != nil {
  87. // Print the error, cast err to awserr.Error to get the Code and
  88. // Message from an error.
  89. fmt.Println(err.Error())
  90. return
  91. }
  92. // Pretty-print the response data.
  93. fmt.Println(resp)
  94. }
  95. func ExampleSWF_CountPendingDecisionTasks() {
  96. svc := swf.New(nil)
  97. params := &swf.CountPendingDecisionTasksInput{
  98. Domain: aws.String("DomainName"), // Required
  99. TaskList: &swf.TaskList{ // Required
  100. Name: aws.String("Name"), // Required
  101. },
  102. }
  103. resp, err := svc.CountPendingDecisionTasks(params)
  104. if err != nil {
  105. // Print the error, cast err to awserr.Error to get the Code and
  106. // Message from an error.
  107. fmt.Println(err.Error())
  108. return
  109. }
  110. // Pretty-print the response data.
  111. fmt.Println(resp)
  112. }
  113. func ExampleSWF_DeprecateActivityType() {
  114. svc := swf.New(nil)
  115. params := &swf.DeprecateActivityTypeInput{
  116. ActivityType: &swf.ActivityType{ // Required
  117. Name: aws.String("Name"), // Required
  118. Version: aws.String("Version"), // Required
  119. },
  120. Domain: aws.String("DomainName"), // Required
  121. }
  122. resp, err := svc.DeprecateActivityType(params)
  123. if err != nil {
  124. // Print the error, cast err to awserr.Error to get the Code and
  125. // Message from an error.
  126. fmt.Println(err.Error())
  127. return
  128. }
  129. // Pretty-print the response data.
  130. fmt.Println(resp)
  131. }
  132. func ExampleSWF_DeprecateDomain() {
  133. svc := swf.New(nil)
  134. params := &swf.DeprecateDomainInput{
  135. Name: aws.String("DomainName"), // Required
  136. }
  137. resp, err := svc.DeprecateDomain(params)
  138. if err != nil {
  139. // Print the error, cast err to awserr.Error to get the Code and
  140. // Message from an error.
  141. fmt.Println(err.Error())
  142. return
  143. }
  144. // Pretty-print the response data.
  145. fmt.Println(resp)
  146. }
  147. func ExampleSWF_DeprecateWorkflowType() {
  148. svc := swf.New(nil)
  149. params := &swf.DeprecateWorkflowTypeInput{
  150. Domain: aws.String("DomainName"), // Required
  151. WorkflowType: &swf.WorkflowType{ // Required
  152. Name: aws.String("Name"), // Required
  153. Version: aws.String("Version"), // Required
  154. },
  155. }
  156. resp, err := svc.DeprecateWorkflowType(params)
  157. if err != nil {
  158. // Print the error, cast err to awserr.Error to get the Code and
  159. // Message from an error.
  160. fmt.Println(err.Error())
  161. return
  162. }
  163. // Pretty-print the response data.
  164. fmt.Println(resp)
  165. }
  166. func ExampleSWF_DescribeActivityType() {
  167. svc := swf.New(nil)
  168. params := &swf.DescribeActivityTypeInput{
  169. ActivityType: &swf.ActivityType{ // Required
  170. Name: aws.String("Name"), // Required
  171. Version: aws.String("Version"), // Required
  172. },
  173. Domain: aws.String("DomainName"), // Required
  174. }
  175. resp, err := svc.DescribeActivityType(params)
  176. if err != nil {
  177. // Print the error, cast err to awserr.Error to get the Code and
  178. // Message from an error.
  179. fmt.Println(err.Error())
  180. return
  181. }
  182. // Pretty-print the response data.
  183. fmt.Println(resp)
  184. }
  185. func ExampleSWF_DescribeDomain() {
  186. svc := swf.New(nil)
  187. params := &swf.DescribeDomainInput{
  188. Name: aws.String("DomainName"), // Required
  189. }
  190. resp, err := svc.DescribeDomain(params)
  191. if err != nil {
  192. // Print the error, cast err to awserr.Error to get the Code and
  193. // Message from an error.
  194. fmt.Println(err.Error())
  195. return
  196. }
  197. // Pretty-print the response data.
  198. fmt.Println(resp)
  199. }
  200. func ExampleSWF_DescribeWorkflowExecution() {
  201. svc := swf.New(nil)
  202. params := &swf.DescribeWorkflowExecutionInput{
  203. Domain: aws.String("DomainName"), // Required
  204. Execution: &swf.WorkflowExecution{ // Required
  205. RunId: aws.String("RunId"), // Required
  206. WorkflowId: aws.String("WorkflowId"), // Required
  207. },
  208. }
  209. resp, err := svc.DescribeWorkflowExecution(params)
  210. if err != nil {
  211. // Print the error, cast err to awserr.Error to get the Code and
  212. // Message from an error.
  213. fmt.Println(err.Error())
  214. return
  215. }
  216. // Pretty-print the response data.
  217. fmt.Println(resp)
  218. }
  219. func ExampleSWF_DescribeWorkflowType() {
  220. svc := swf.New(nil)
  221. params := &swf.DescribeWorkflowTypeInput{
  222. Domain: aws.String("DomainName"), // Required
  223. WorkflowType: &swf.WorkflowType{ // Required
  224. Name: aws.String("Name"), // Required
  225. Version: aws.String("Version"), // Required
  226. },
  227. }
  228. resp, err := svc.DescribeWorkflowType(params)
  229. if err != nil {
  230. // Print the error, cast err to awserr.Error to get the Code and
  231. // Message from an error.
  232. fmt.Println(err.Error())
  233. return
  234. }
  235. // Pretty-print the response data.
  236. fmt.Println(resp)
  237. }
  238. func ExampleSWF_GetWorkflowExecutionHistory() {
  239. svc := swf.New(nil)
  240. params := &swf.GetWorkflowExecutionHistoryInput{
  241. Domain: aws.String("DomainName"), // Required
  242. Execution: &swf.WorkflowExecution{ // Required
  243. RunId: aws.String("RunId"), // Required
  244. WorkflowId: aws.String("WorkflowId"), // Required
  245. },
  246. MaximumPageSize: aws.Int64(1),
  247. NextPageToken: aws.String("PageToken"),
  248. ReverseOrder: aws.Bool(true),
  249. }
  250. resp, err := svc.GetWorkflowExecutionHistory(params)
  251. if err != nil {
  252. // Print the error, cast err to awserr.Error to get the Code and
  253. // Message from an error.
  254. fmt.Println(err.Error())
  255. return
  256. }
  257. // Pretty-print the response data.
  258. fmt.Println(resp)
  259. }
  260. func ExampleSWF_ListActivityTypes() {
  261. svc := swf.New(nil)
  262. params := &swf.ListActivityTypesInput{
  263. Domain: aws.String("DomainName"), // Required
  264. RegistrationStatus: aws.String("RegistrationStatus"), // Required
  265. MaximumPageSize: aws.Int64(1),
  266. Name: aws.String("Name"),
  267. NextPageToken: aws.String("PageToken"),
  268. ReverseOrder: aws.Bool(true),
  269. }
  270. resp, err := svc.ListActivityTypes(params)
  271. if err != nil {
  272. // Print the error, cast err to awserr.Error to get the Code and
  273. // Message from an error.
  274. fmt.Println(err.Error())
  275. return
  276. }
  277. // Pretty-print the response data.
  278. fmt.Println(resp)
  279. }
  280. func ExampleSWF_ListClosedWorkflowExecutions() {
  281. svc := swf.New(nil)
  282. params := &swf.ListClosedWorkflowExecutionsInput{
  283. Domain: aws.String("DomainName"), // Required
  284. CloseStatusFilter: &swf.CloseStatusFilter{
  285. Status: aws.String("CloseStatus"), // Required
  286. },
  287. CloseTimeFilter: &swf.ExecutionTimeFilter{
  288. OldestDate: aws.Time(time.Now()), // Required
  289. LatestDate: aws.Time(time.Now()),
  290. },
  291. ExecutionFilter: &swf.WorkflowExecutionFilter{
  292. WorkflowId: aws.String("WorkflowId"), // Required
  293. },
  294. MaximumPageSize: aws.Int64(1),
  295. NextPageToken: aws.String("PageToken"),
  296. ReverseOrder: aws.Bool(true),
  297. StartTimeFilter: &swf.ExecutionTimeFilter{
  298. OldestDate: aws.Time(time.Now()), // Required
  299. LatestDate: aws.Time(time.Now()),
  300. },
  301. TagFilter: &swf.TagFilter{
  302. Tag: aws.String("Tag"), // Required
  303. },
  304. TypeFilter: &swf.WorkflowTypeFilter{
  305. Name: aws.String("Name"), // Required
  306. Version: aws.String("VersionOptional"),
  307. },
  308. }
  309. resp, err := svc.ListClosedWorkflowExecutions(params)
  310. if err != nil {
  311. // Print the error, cast err to awserr.Error to get the Code and
  312. // Message from an error.
  313. fmt.Println(err.Error())
  314. return
  315. }
  316. // Pretty-print the response data.
  317. fmt.Println(resp)
  318. }
  319. func ExampleSWF_ListDomains() {
  320. svc := swf.New(nil)
  321. params := &swf.ListDomainsInput{
  322. RegistrationStatus: aws.String("RegistrationStatus"), // Required
  323. MaximumPageSize: aws.Int64(1),
  324. NextPageToken: aws.String("PageToken"),
  325. ReverseOrder: aws.Bool(true),
  326. }
  327. resp, err := svc.ListDomains(params)
  328. if err != nil {
  329. // Print the error, cast err to awserr.Error to get the Code and
  330. // Message from an error.
  331. fmt.Println(err.Error())
  332. return
  333. }
  334. // Pretty-print the response data.
  335. fmt.Println(resp)
  336. }
  337. func ExampleSWF_ListOpenWorkflowExecutions() {
  338. svc := swf.New(nil)
  339. params := &swf.ListOpenWorkflowExecutionsInput{
  340. Domain: aws.String("DomainName"), // Required
  341. StartTimeFilter: &swf.ExecutionTimeFilter{ // Required
  342. OldestDate: aws.Time(time.Now()), // Required
  343. LatestDate: aws.Time(time.Now()),
  344. },
  345. ExecutionFilter: &swf.WorkflowExecutionFilter{
  346. WorkflowId: aws.String("WorkflowId"), // Required
  347. },
  348. MaximumPageSize: aws.Int64(1),
  349. NextPageToken: aws.String("PageToken"),
  350. ReverseOrder: aws.Bool(true),
  351. TagFilter: &swf.TagFilter{
  352. Tag: aws.String("Tag"), // Required
  353. },
  354. TypeFilter: &swf.WorkflowTypeFilter{
  355. Name: aws.String("Name"), // Required
  356. Version: aws.String("VersionOptional"),
  357. },
  358. }
  359. resp, err := svc.ListOpenWorkflowExecutions(params)
  360. if err != nil {
  361. // Print the error, cast err to awserr.Error to get the Code and
  362. // Message from an error.
  363. fmt.Println(err.Error())
  364. return
  365. }
  366. // Pretty-print the response data.
  367. fmt.Println(resp)
  368. }
  369. func ExampleSWF_ListWorkflowTypes() {
  370. svc := swf.New(nil)
  371. params := &swf.ListWorkflowTypesInput{
  372. Domain: aws.String("DomainName"), // Required
  373. RegistrationStatus: aws.String("RegistrationStatus"), // Required
  374. MaximumPageSize: aws.Int64(1),
  375. Name: aws.String("Name"),
  376. NextPageToken: aws.String("PageToken"),
  377. ReverseOrder: aws.Bool(true),
  378. }
  379. resp, err := svc.ListWorkflowTypes(params)
  380. if err != nil {
  381. // Print the error, cast err to awserr.Error to get the Code and
  382. // Message from an error.
  383. fmt.Println(err.Error())
  384. return
  385. }
  386. // Pretty-print the response data.
  387. fmt.Println(resp)
  388. }
  389. func ExampleSWF_PollForActivityTask() {
  390. svc := swf.New(nil)
  391. params := &swf.PollForActivityTaskInput{
  392. Domain: aws.String("DomainName"), // Required
  393. TaskList: &swf.TaskList{ // Required
  394. Name: aws.String("Name"), // Required
  395. },
  396. Identity: aws.String("Identity"),
  397. }
  398. resp, err := svc.PollForActivityTask(params)
  399. if err != nil {
  400. // Print the error, cast err to awserr.Error to get the Code and
  401. // Message from an error.
  402. fmt.Println(err.Error())
  403. return
  404. }
  405. // Pretty-print the response data.
  406. fmt.Println(resp)
  407. }
  408. func ExampleSWF_PollForDecisionTask() {
  409. svc := swf.New(nil)
  410. params := &swf.PollForDecisionTaskInput{
  411. Domain: aws.String("DomainName"), // Required
  412. TaskList: &swf.TaskList{ // Required
  413. Name: aws.String("Name"), // Required
  414. },
  415. Identity: aws.String("Identity"),
  416. MaximumPageSize: aws.Int64(1),
  417. NextPageToken: aws.String("PageToken"),
  418. ReverseOrder: aws.Bool(true),
  419. }
  420. resp, err := svc.PollForDecisionTask(params)
  421. if err != nil {
  422. // Print the error, cast err to awserr.Error to get the Code and
  423. // Message from an error.
  424. fmt.Println(err.Error())
  425. return
  426. }
  427. // Pretty-print the response data.
  428. fmt.Println(resp)
  429. }
  430. func ExampleSWF_RecordActivityTaskHeartbeat() {
  431. svc := swf.New(nil)
  432. params := &swf.RecordActivityTaskHeartbeatInput{
  433. TaskToken: aws.String("TaskToken"), // Required
  434. Details: aws.String("LimitedData"),
  435. }
  436. resp, err := svc.RecordActivityTaskHeartbeat(params)
  437. if err != nil {
  438. // Print the error, cast err to awserr.Error to get the Code and
  439. // Message from an error.
  440. fmt.Println(err.Error())
  441. return
  442. }
  443. // Pretty-print the response data.
  444. fmt.Println(resp)
  445. }
  446. func ExampleSWF_RegisterActivityType() {
  447. svc := swf.New(nil)
  448. params := &swf.RegisterActivityTypeInput{
  449. Domain: aws.String("DomainName"), // Required
  450. Name: aws.String("Name"), // Required
  451. Version: aws.String("Version"), // Required
  452. DefaultTaskHeartbeatTimeout: aws.String("DurationInSecondsOptional"),
  453. DefaultTaskList: &swf.TaskList{
  454. Name: aws.String("Name"), // Required
  455. },
  456. DefaultTaskPriority: aws.String("TaskPriority"),
  457. DefaultTaskScheduleToCloseTimeout: aws.String("DurationInSecondsOptional"),
  458. DefaultTaskScheduleToStartTimeout: aws.String("DurationInSecondsOptional"),
  459. DefaultTaskStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
  460. Description: aws.String("Description"),
  461. }
  462. resp, err := svc.RegisterActivityType(params)
  463. if err != nil {
  464. // Print the error, cast err to awserr.Error to get the Code and
  465. // Message from an error.
  466. fmt.Println(err.Error())
  467. return
  468. }
  469. // Pretty-print the response data.
  470. fmt.Println(resp)
  471. }
  472. func ExampleSWF_RegisterDomain() {
  473. svc := swf.New(nil)
  474. params := &swf.RegisterDomainInput{
  475. Name: aws.String("DomainName"), // Required
  476. WorkflowExecutionRetentionPeriodInDays: aws.String("DurationInDays"), // Required
  477. Description: aws.String("Description"),
  478. }
  479. resp, err := svc.RegisterDomain(params)
  480. if err != nil {
  481. // Print the error, cast err to awserr.Error to get the Code and
  482. // Message from an error.
  483. fmt.Println(err.Error())
  484. return
  485. }
  486. // Pretty-print the response data.
  487. fmt.Println(resp)
  488. }
  489. func ExampleSWF_RegisterWorkflowType() {
  490. svc := swf.New(nil)
  491. params := &swf.RegisterWorkflowTypeInput{
  492. Domain: aws.String("DomainName"), // Required
  493. Name: aws.String("Name"), // Required
  494. Version: aws.String("Version"), // Required
  495. DefaultChildPolicy: aws.String("ChildPolicy"),
  496. DefaultExecutionStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
  497. DefaultLambdaRole: aws.String("Arn"),
  498. DefaultTaskList: &swf.TaskList{
  499. Name: aws.String("Name"), // Required
  500. },
  501. DefaultTaskPriority: aws.String("TaskPriority"),
  502. DefaultTaskStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
  503. Description: aws.String("Description"),
  504. }
  505. resp, err := svc.RegisterWorkflowType(params)
  506. if err != nil {
  507. // Print the error, cast err to awserr.Error to get the Code and
  508. // Message from an error.
  509. fmt.Println(err.Error())
  510. return
  511. }
  512. // Pretty-print the response data.
  513. fmt.Println(resp)
  514. }
  515. func ExampleSWF_RequestCancelWorkflowExecution() {
  516. svc := swf.New(nil)
  517. params := &swf.RequestCancelWorkflowExecutionInput{
  518. Domain: aws.String("DomainName"), // Required
  519. WorkflowId: aws.String("WorkflowId"), // Required
  520. RunId: aws.String("RunIdOptional"),
  521. }
  522. resp, err := svc.RequestCancelWorkflowExecution(params)
  523. if err != nil {
  524. // Print the error, cast err to awserr.Error to get the Code and
  525. // Message from an error.
  526. fmt.Println(err.Error())
  527. return
  528. }
  529. // Pretty-print the response data.
  530. fmt.Println(resp)
  531. }
  532. func ExampleSWF_RespondActivityTaskCanceled() {
  533. svc := swf.New(nil)
  534. params := &swf.RespondActivityTaskCanceledInput{
  535. TaskToken: aws.String("TaskToken"), // Required
  536. Details: aws.String("Data"),
  537. }
  538. resp, err := svc.RespondActivityTaskCanceled(params)
  539. if err != nil {
  540. // Print the error, cast err to awserr.Error to get the Code and
  541. // Message from an error.
  542. fmt.Println(err.Error())
  543. return
  544. }
  545. // Pretty-print the response data.
  546. fmt.Println(resp)
  547. }
  548. func ExampleSWF_RespondActivityTaskCompleted() {
  549. svc := swf.New(nil)
  550. params := &swf.RespondActivityTaskCompletedInput{
  551. TaskToken: aws.String("TaskToken"), // Required
  552. Result: aws.String("Data"),
  553. }
  554. resp, err := svc.RespondActivityTaskCompleted(params)
  555. if err != nil {
  556. // Print the error, cast err to awserr.Error to get the Code and
  557. // Message from an error.
  558. fmt.Println(err.Error())
  559. return
  560. }
  561. // Pretty-print the response data.
  562. fmt.Println(resp)
  563. }
  564. func ExampleSWF_RespondActivityTaskFailed() {
  565. svc := swf.New(nil)
  566. params := &swf.RespondActivityTaskFailedInput{
  567. TaskToken: aws.String("TaskToken"), // Required
  568. Details: aws.String("Data"),
  569. Reason: aws.String("FailureReason"),
  570. }
  571. resp, err := svc.RespondActivityTaskFailed(params)
  572. if err != nil {
  573. // Print the error, cast err to awserr.Error to get the Code and
  574. // Message from an error.
  575. fmt.Println(err.Error())
  576. return
  577. }
  578. // Pretty-print the response data.
  579. fmt.Println(resp)
  580. }
  581. func ExampleSWF_RespondDecisionTaskCompleted() {
  582. svc := swf.New(nil)
  583. params := &swf.RespondDecisionTaskCompletedInput{
  584. TaskToken: aws.String("TaskToken"), // Required
  585. Decisions: []*swf.Decision{
  586. { // Required
  587. DecisionType: aws.String("DecisionType"), // Required
  588. CancelTimerDecisionAttributes: &swf.CancelTimerDecisionAttributes{
  589. TimerId: aws.String("TimerId"), // Required
  590. },
  591. CancelWorkflowExecutionDecisionAttributes: &swf.CancelWorkflowExecutionDecisionAttributes{
  592. Details: aws.String("Data"),
  593. },
  594. CompleteWorkflowExecutionDecisionAttributes: &swf.CompleteWorkflowExecutionDecisionAttributes{
  595. Result: aws.String("Data"),
  596. },
  597. ContinueAsNewWorkflowExecutionDecisionAttributes: &swf.ContinueAsNewWorkflowExecutionDecisionAttributes{
  598. ChildPolicy: aws.String("ChildPolicy"),
  599. ExecutionStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
  600. Input: aws.String("Data"),
  601. LambdaRole: aws.String("Arn"),
  602. TagList: []*string{
  603. aws.String("Tag"), // Required
  604. // More values...
  605. },
  606. TaskList: &swf.TaskList{
  607. Name: aws.String("Name"), // Required
  608. },
  609. TaskPriority: aws.String("TaskPriority"),
  610. TaskStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
  611. WorkflowTypeVersion: aws.String("Version"),
  612. },
  613. FailWorkflowExecutionDecisionAttributes: &swf.FailWorkflowExecutionDecisionAttributes{
  614. Details: aws.String("Data"),
  615. Reason: aws.String("FailureReason"),
  616. },
  617. RecordMarkerDecisionAttributes: &swf.RecordMarkerDecisionAttributes{
  618. MarkerName: aws.String("MarkerName"), // Required
  619. Details: aws.String("Data"),
  620. },
  621. RequestCancelActivityTaskDecisionAttributes: &swf.RequestCancelActivityTaskDecisionAttributes{
  622. ActivityId: aws.String("ActivityId"), // Required
  623. },
  624. RequestCancelExternalWorkflowExecutionDecisionAttributes: &swf.RequestCancelExternalWorkflowExecutionDecisionAttributes{
  625. WorkflowId: aws.String("WorkflowId"), // Required
  626. Control: aws.String("Data"),
  627. RunId: aws.String("RunIdOptional"),
  628. },
  629. ScheduleActivityTaskDecisionAttributes: &swf.ScheduleActivityTaskDecisionAttributes{
  630. ActivityId: aws.String("ActivityId"), // Required
  631. ActivityType: &swf.ActivityType{ // Required
  632. Name: aws.String("Name"), // Required
  633. Version: aws.String("Version"), // Required
  634. },
  635. Control: aws.String("Data"),
  636. HeartbeatTimeout: aws.String("DurationInSecondsOptional"),
  637. Input: aws.String("Data"),
  638. ScheduleToCloseTimeout: aws.String("DurationInSecondsOptional"),
  639. ScheduleToStartTimeout: aws.String("DurationInSecondsOptional"),
  640. StartToCloseTimeout: aws.String("DurationInSecondsOptional"),
  641. TaskList: &swf.TaskList{
  642. Name: aws.String("Name"), // Required
  643. },
  644. TaskPriority: aws.String("TaskPriority"),
  645. },
  646. ScheduleLambdaFunctionDecisionAttributes: &swf.ScheduleLambdaFunctionDecisionAttributes{
  647. Id: aws.String("FunctionId"), // Required
  648. Name: aws.String("FunctionName"), // Required
  649. Input: aws.String("FunctionInput"),
  650. StartToCloseTimeout: aws.String("DurationInSecondsOptional"),
  651. },
  652. SignalExternalWorkflowExecutionDecisionAttributes: &swf.SignalExternalWorkflowExecutionDecisionAttributes{
  653. SignalName: aws.String("SignalName"), // Required
  654. WorkflowId: aws.String("WorkflowId"), // Required
  655. Control: aws.String("Data"),
  656. Input: aws.String("Data"),
  657. RunId: aws.String("RunIdOptional"),
  658. },
  659. StartChildWorkflowExecutionDecisionAttributes: &swf.StartChildWorkflowExecutionDecisionAttributes{
  660. WorkflowId: aws.String("WorkflowId"), // Required
  661. WorkflowType: &swf.WorkflowType{ // Required
  662. Name: aws.String("Name"), // Required
  663. Version: aws.String("Version"), // Required
  664. },
  665. ChildPolicy: aws.String("ChildPolicy"),
  666. Control: aws.String("Data"),
  667. ExecutionStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
  668. Input: aws.String("Data"),
  669. LambdaRole: aws.String("Arn"),
  670. TagList: []*string{
  671. aws.String("Tag"), // Required
  672. // More values...
  673. },
  674. TaskList: &swf.TaskList{
  675. Name: aws.String("Name"), // Required
  676. },
  677. TaskPriority: aws.String("TaskPriority"),
  678. TaskStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
  679. },
  680. StartTimerDecisionAttributes: &swf.StartTimerDecisionAttributes{
  681. StartToFireTimeout: aws.String("DurationInSeconds"), // Required
  682. TimerId: aws.String("TimerId"), // Required
  683. Control: aws.String("Data"),
  684. },
  685. },
  686. // More values...
  687. },
  688. ExecutionContext: aws.String("Data"),
  689. }
  690. resp, err := svc.RespondDecisionTaskCompleted(params)
  691. if err != nil {
  692. // Print the error, cast err to awserr.Error to get the Code and
  693. // Message from an error.
  694. fmt.Println(err.Error())
  695. return
  696. }
  697. // Pretty-print the response data.
  698. fmt.Println(resp)
  699. }
  700. func ExampleSWF_SignalWorkflowExecution() {
  701. svc := swf.New(nil)
  702. params := &swf.SignalWorkflowExecutionInput{
  703. Domain: aws.String("DomainName"), // Required
  704. SignalName: aws.String("SignalName"), // Required
  705. WorkflowId: aws.String("WorkflowId"), // Required
  706. Input: aws.String("Data"),
  707. RunId: aws.String("RunIdOptional"),
  708. }
  709. resp, err := svc.SignalWorkflowExecution(params)
  710. if err != nil {
  711. // Print the error, cast err to awserr.Error to get the Code and
  712. // Message from an error.
  713. fmt.Println(err.Error())
  714. return
  715. }
  716. // Pretty-print the response data.
  717. fmt.Println(resp)
  718. }
  719. func ExampleSWF_StartWorkflowExecution() {
  720. svc := swf.New(nil)
  721. params := &swf.StartWorkflowExecutionInput{
  722. Domain: aws.String("DomainName"), // Required
  723. WorkflowId: aws.String("WorkflowId"), // Required
  724. WorkflowType: &swf.WorkflowType{ // Required
  725. Name: aws.String("Name"), // Required
  726. Version: aws.String("Version"), // Required
  727. },
  728. ChildPolicy: aws.String("ChildPolicy"),
  729. ExecutionStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
  730. Input: aws.String("Data"),
  731. LambdaRole: aws.String("Arn"),
  732. TagList: []*string{
  733. aws.String("Tag"), // Required
  734. // More values...
  735. },
  736. TaskList: &swf.TaskList{
  737. Name: aws.String("Name"), // Required
  738. },
  739. TaskPriority: aws.String("TaskPriority"),
  740. TaskStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
  741. }
  742. resp, err := svc.StartWorkflowExecution(params)
  743. if err != nil {
  744. // Print the error, cast err to awserr.Error to get the Code and
  745. // Message from an error.
  746. fmt.Println(err.Error())
  747. return
  748. }
  749. // Pretty-print the response data.
  750. fmt.Println(resp)
  751. }
  752. func ExampleSWF_TerminateWorkflowExecution() {
  753. svc := swf.New(nil)
  754. params := &swf.TerminateWorkflowExecutionInput{
  755. Domain: aws.String("DomainName"), // Required
  756. WorkflowId: aws.String("WorkflowId"), // Required
  757. ChildPolicy: aws.String("ChildPolicy"),
  758. Details: aws.String("Data"),
  759. Reason: aws.String("TerminateReason"),
  760. RunId: aws.String("RunIdOptional"),
  761. }
  762. resp, err := svc.TerminateWorkflowExecution(params)
  763. if err != nil {
  764. // Print the error, cast err to awserr.Error to get the Code and
  765. // Message from an error.
  766. fmt.Println(err.Error())
  767. return
  768. }
  769. // Pretty-print the response data.
  770. fmt.Println(resp)
  771. }