examples_test.go 28 KB

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