examples_test.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package datapipeline_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/datapipeline"
  9. )
  10. var _ time.Duration
  11. var _ bytes.Buffer
  12. func ExampleDataPipeline_ActivatePipeline() {
  13. svc := datapipeline.New(nil)
  14. params := &datapipeline.ActivatePipelineInput{
  15. PipelineId: aws.String("id"), // Required
  16. ParameterValues: []*datapipeline.ParameterValue{
  17. { // Required
  18. Id: aws.String("fieldNameString"), // Required
  19. StringValue: aws.String("fieldStringValue"), // Required
  20. },
  21. // More values...
  22. },
  23. StartTimestamp: aws.Time(time.Now()),
  24. }
  25. resp, err := svc.ActivatePipeline(params)
  26. if err != nil {
  27. // Print the error, cast err to awserr.Error to get the Code and
  28. // Message from an error.
  29. fmt.Println(err.Error())
  30. return
  31. }
  32. // Pretty-print the response data.
  33. fmt.Println(resp)
  34. }
  35. func ExampleDataPipeline_AddTags() {
  36. svc := datapipeline.New(nil)
  37. params := &datapipeline.AddTagsInput{
  38. PipelineId: aws.String("id"), // Required
  39. Tags: []*datapipeline.Tag{ // Required
  40. { // Required
  41. Key: aws.String("tagKey"), // Required
  42. Value: aws.String("tagValue"), // Required
  43. },
  44. // More values...
  45. },
  46. }
  47. resp, err := svc.AddTags(params)
  48. if err != nil {
  49. // Print the error, cast err to awserr.Error to get the Code and
  50. // Message from an error.
  51. fmt.Println(err.Error())
  52. return
  53. }
  54. // Pretty-print the response data.
  55. fmt.Println(resp)
  56. }
  57. func ExampleDataPipeline_CreatePipeline() {
  58. svc := datapipeline.New(nil)
  59. params := &datapipeline.CreatePipelineInput{
  60. Name: aws.String("id"), // Required
  61. UniqueId: aws.String("id"), // Required
  62. Description: aws.String("string"),
  63. Tags: []*datapipeline.Tag{
  64. { // Required
  65. Key: aws.String("tagKey"), // Required
  66. Value: aws.String("tagValue"), // Required
  67. },
  68. // More values...
  69. },
  70. }
  71. resp, err := svc.CreatePipeline(params)
  72. if err != nil {
  73. // Print the error, cast err to awserr.Error to get the Code and
  74. // Message from an error.
  75. fmt.Println(err.Error())
  76. return
  77. }
  78. // Pretty-print the response data.
  79. fmt.Println(resp)
  80. }
  81. func ExampleDataPipeline_DeactivatePipeline() {
  82. svc := datapipeline.New(nil)
  83. params := &datapipeline.DeactivatePipelineInput{
  84. PipelineId: aws.String("id"), // Required
  85. CancelActive: aws.Bool(true),
  86. }
  87. resp, err := svc.DeactivatePipeline(params)
  88. if err != nil {
  89. // Print the error, cast err to awserr.Error to get the Code and
  90. // Message from an error.
  91. fmt.Println(err.Error())
  92. return
  93. }
  94. // Pretty-print the response data.
  95. fmt.Println(resp)
  96. }
  97. func ExampleDataPipeline_DeletePipeline() {
  98. svc := datapipeline.New(nil)
  99. params := &datapipeline.DeletePipelineInput{
  100. PipelineId: aws.String("id"), // Required
  101. }
  102. resp, err := svc.DeletePipeline(params)
  103. if err != nil {
  104. // Print the error, cast err to awserr.Error to get the Code and
  105. // Message from an error.
  106. fmt.Println(err.Error())
  107. return
  108. }
  109. // Pretty-print the response data.
  110. fmt.Println(resp)
  111. }
  112. func ExampleDataPipeline_DescribeObjects() {
  113. svc := datapipeline.New(nil)
  114. params := &datapipeline.DescribeObjectsInput{
  115. ObjectIds: []*string{ // Required
  116. aws.String("id"), // Required
  117. // More values...
  118. },
  119. PipelineId: aws.String("id"), // Required
  120. EvaluateExpressions: aws.Bool(true),
  121. Marker: aws.String("string"),
  122. }
  123. resp, err := svc.DescribeObjects(params)
  124. if err != nil {
  125. // Print the error, cast err to awserr.Error to get the Code and
  126. // Message from an error.
  127. fmt.Println(err.Error())
  128. return
  129. }
  130. // Pretty-print the response data.
  131. fmt.Println(resp)
  132. }
  133. func ExampleDataPipeline_DescribePipelines() {
  134. svc := datapipeline.New(nil)
  135. params := &datapipeline.DescribePipelinesInput{
  136. PipelineIds: []*string{ // Required
  137. aws.String("id"), // Required
  138. // More values...
  139. },
  140. }
  141. resp, err := svc.DescribePipelines(params)
  142. if err != nil {
  143. // Print the error, cast err to awserr.Error to get the Code and
  144. // Message from an error.
  145. fmt.Println(err.Error())
  146. return
  147. }
  148. // Pretty-print the response data.
  149. fmt.Println(resp)
  150. }
  151. func ExampleDataPipeline_EvaluateExpression() {
  152. svc := datapipeline.New(nil)
  153. params := &datapipeline.EvaluateExpressionInput{
  154. Expression: aws.String("longString"), // Required
  155. ObjectId: aws.String("id"), // Required
  156. PipelineId: aws.String("id"), // Required
  157. }
  158. resp, err := svc.EvaluateExpression(params)
  159. if err != nil {
  160. // Print the error, cast err to awserr.Error to get the Code and
  161. // Message from an error.
  162. fmt.Println(err.Error())
  163. return
  164. }
  165. // Pretty-print the response data.
  166. fmt.Println(resp)
  167. }
  168. func ExampleDataPipeline_GetPipelineDefinition() {
  169. svc := datapipeline.New(nil)
  170. params := &datapipeline.GetPipelineDefinitionInput{
  171. PipelineId: aws.String("id"), // Required
  172. Version: aws.String("string"),
  173. }
  174. resp, err := svc.GetPipelineDefinition(params)
  175. if err != nil {
  176. // Print the error, cast err to awserr.Error to get the Code and
  177. // Message from an error.
  178. fmt.Println(err.Error())
  179. return
  180. }
  181. // Pretty-print the response data.
  182. fmt.Println(resp)
  183. }
  184. func ExampleDataPipeline_ListPipelines() {
  185. svc := datapipeline.New(nil)
  186. params := &datapipeline.ListPipelinesInput{
  187. Marker: aws.String("string"),
  188. }
  189. resp, err := svc.ListPipelines(params)
  190. if err != nil {
  191. // Print the error, cast err to awserr.Error to get the Code and
  192. // Message from an error.
  193. fmt.Println(err.Error())
  194. return
  195. }
  196. // Pretty-print the response data.
  197. fmt.Println(resp)
  198. }
  199. func ExampleDataPipeline_PollForTask() {
  200. svc := datapipeline.New(nil)
  201. params := &datapipeline.PollForTaskInput{
  202. WorkerGroup: aws.String("string"), // Required
  203. Hostname: aws.String("id"),
  204. InstanceIdentity: &datapipeline.InstanceIdentity{
  205. Document: aws.String("string"),
  206. Signature: aws.String("string"),
  207. },
  208. }
  209. resp, err := svc.PollForTask(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 ExampleDataPipeline_PutPipelineDefinition() {
  220. svc := datapipeline.New(nil)
  221. params := &datapipeline.PutPipelineDefinitionInput{
  222. PipelineId: aws.String("id"), // Required
  223. PipelineObjects: []*datapipeline.PipelineObject{ // Required
  224. { // Required
  225. Fields: []*datapipeline.Field{ // Required
  226. { // Required
  227. Key: aws.String("fieldNameString"), // Required
  228. RefValue: aws.String("fieldNameString"),
  229. StringValue: aws.String("fieldStringValue"),
  230. },
  231. // More values...
  232. },
  233. Id: aws.String("id"), // Required
  234. Name: aws.String("id"), // Required
  235. },
  236. // More values...
  237. },
  238. ParameterObjects: []*datapipeline.ParameterObject{
  239. { // Required
  240. Attributes: []*datapipeline.ParameterAttribute{ // Required
  241. { // Required
  242. Key: aws.String("attributeNameString"), // Required
  243. StringValue: aws.String("attributeValueString"), // Required
  244. },
  245. // More values...
  246. },
  247. Id: aws.String("fieldNameString"), // Required
  248. },
  249. // More values...
  250. },
  251. ParameterValues: []*datapipeline.ParameterValue{
  252. { // Required
  253. Id: aws.String("fieldNameString"), // Required
  254. StringValue: aws.String("fieldStringValue"), // Required
  255. },
  256. // More values...
  257. },
  258. }
  259. resp, err := svc.PutPipelineDefinition(params)
  260. if err != nil {
  261. // Print the error, cast err to awserr.Error to get the Code and
  262. // Message from an error.
  263. fmt.Println(err.Error())
  264. return
  265. }
  266. // Pretty-print the response data.
  267. fmt.Println(resp)
  268. }
  269. func ExampleDataPipeline_QueryObjects() {
  270. svc := datapipeline.New(nil)
  271. params := &datapipeline.QueryObjectsInput{
  272. PipelineId: aws.String("id"), // Required
  273. Sphere: aws.String("string"), // Required
  274. Limit: aws.Int64(1),
  275. Marker: aws.String("string"),
  276. Query: &datapipeline.Query{
  277. Selectors: []*datapipeline.Selector{
  278. { // Required
  279. FieldName: aws.String("string"),
  280. Operator: &datapipeline.Operator{
  281. Type: aws.String("OperatorType"),
  282. Values: []*string{
  283. aws.String("string"), // Required
  284. // More values...
  285. },
  286. },
  287. },
  288. // More values...
  289. },
  290. },
  291. }
  292. resp, err := svc.QueryObjects(params)
  293. if err != nil {
  294. // Print the error, cast err to awserr.Error to get the Code and
  295. // Message from an error.
  296. fmt.Println(err.Error())
  297. return
  298. }
  299. // Pretty-print the response data.
  300. fmt.Println(resp)
  301. }
  302. func ExampleDataPipeline_RemoveTags() {
  303. svc := datapipeline.New(nil)
  304. params := &datapipeline.RemoveTagsInput{
  305. PipelineId: aws.String("id"), // Required
  306. TagKeys: []*string{ // Required
  307. aws.String("string"), // Required
  308. // More values...
  309. },
  310. }
  311. resp, err := svc.RemoveTags(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 ExampleDataPipeline_ReportTaskProgress() {
  322. svc := datapipeline.New(nil)
  323. params := &datapipeline.ReportTaskProgressInput{
  324. TaskId: aws.String("taskId"), // Required
  325. Fields: []*datapipeline.Field{
  326. { // Required
  327. Key: aws.String("fieldNameString"), // Required
  328. RefValue: aws.String("fieldNameString"),
  329. StringValue: aws.String("fieldStringValue"),
  330. },
  331. // More values...
  332. },
  333. }
  334. resp, err := svc.ReportTaskProgress(params)
  335. if err != nil {
  336. // Print the error, cast err to awserr.Error to get the Code and
  337. // Message from an error.
  338. fmt.Println(err.Error())
  339. return
  340. }
  341. // Pretty-print the response data.
  342. fmt.Println(resp)
  343. }
  344. func ExampleDataPipeline_ReportTaskRunnerHeartbeat() {
  345. svc := datapipeline.New(nil)
  346. params := &datapipeline.ReportTaskRunnerHeartbeatInput{
  347. TaskrunnerId: aws.String("id"), // Required
  348. Hostname: aws.String("id"),
  349. WorkerGroup: aws.String("string"),
  350. }
  351. resp, err := svc.ReportTaskRunnerHeartbeat(params)
  352. if err != nil {
  353. // Print the error, cast err to awserr.Error to get the Code and
  354. // Message from an error.
  355. fmt.Println(err.Error())
  356. return
  357. }
  358. // Pretty-print the response data.
  359. fmt.Println(resp)
  360. }
  361. func ExampleDataPipeline_SetStatus() {
  362. svc := datapipeline.New(nil)
  363. params := &datapipeline.SetStatusInput{
  364. ObjectIds: []*string{ // Required
  365. aws.String("id"), // Required
  366. // More values...
  367. },
  368. PipelineId: aws.String("id"), // Required
  369. Status: aws.String("string"), // Required
  370. }
  371. resp, err := svc.SetStatus(params)
  372. if err != nil {
  373. // Print the error, cast err to awserr.Error to get the Code and
  374. // Message from an error.
  375. fmt.Println(err.Error())
  376. return
  377. }
  378. // Pretty-print the response data.
  379. fmt.Println(resp)
  380. }
  381. func ExampleDataPipeline_SetTaskStatus() {
  382. svc := datapipeline.New(nil)
  383. params := &datapipeline.SetTaskStatusInput{
  384. TaskId: aws.String("taskId"), // Required
  385. TaskStatus: aws.String("TaskStatus"), // Required
  386. ErrorId: aws.String("string"),
  387. ErrorMessage: aws.String("errorMessage"),
  388. ErrorStackTrace: aws.String("string"),
  389. }
  390. resp, err := svc.SetTaskStatus(params)
  391. if err != nil {
  392. // Print the error, cast err to awserr.Error to get the Code and
  393. // Message from an error.
  394. fmt.Println(err.Error())
  395. return
  396. }
  397. // Pretty-print the response data.
  398. fmt.Println(resp)
  399. }
  400. func ExampleDataPipeline_ValidatePipelineDefinition() {
  401. svc := datapipeline.New(nil)
  402. params := &datapipeline.ValidatePipelineDefinitionInput{
  403. PipelineId: aws.String("id"), // Required
  404. PipelineObjects: []*datapipeline.PipelineObject{ // Required
  405. { // Required
  406. Fields: []*datapipeline.Field{ // Required
  407. { // Required
  408. Key: aws.String("fieldNameString"), // Required
  409. RefValue: aws.String("fieldNameString"),
  410. StringValue: aws.String("fieldStringValue"),
  411. },
  412. // More values...
  413. },
  414. Id: aws.String("id"), // Required
  415. Name: aws.String("id"), // Required
  416. },
  417. // More values...
  418. },
  419. ParameterObjects: []*datapipeline.ParameterObject{
  420. { // Required
  421. Attributes: []*datapipeline.ParameterAttribute{ // Required
  422. { // Required
  423. Key: aws.String("attributeNameString"), // Required
  424. StringValue: aws.String("attributeValueString"), // Required
  425. },
  426. // More values...
  427. },
  428. Id: aws.String("fieldNameString"), // Required
  429. },
  430. // More values...
  431. },
  432. ParameterValues: []*datapipeline.ParameterValue{
  433. { // Required
  434. Id: aws.String("fieldNameString"), // Required
  435. StringValue: aws.String("fieldStringValue"), // Required
  436. },
  437. // More values...
  438. },
  439. }
  440. resp, err := svc.ValidatePipelineDefinition(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. }