examples_test.go 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package emr_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/emr"
  9. )
  10. var _ time.Duration
  11. var _ bytes.Buffer
  12. func ExampleEMR_AddInstanceGroups() {
  13. svc := emr.New(nil)
  14. params := &emr.AddInstanceGroupsInput{
  15. InstanceGroups: []*emr.InstanceGroupConfig{ // Required
  16. { // Required
  17. InstanceCount: aws.Int64(1), // Required
  18. InstanceRole: aws.String("InstanceRoleType"), // Required
  19. InstanceType: aws.String("InstanceType"), // Required
  20. BidPrice: aws.String("XmlStringMaxLen256"),
  21. Configurations: []*emr.Configuration{
  22. { // Required
  23. Classification: aws.String("String"),
  24. Configurations: []*emr.Configuration{
  25. // Recursive values...
  26. },
  27. Properties: map[string]*string{
  28. "Key": aws.String("String"), // Required
  29. // More values...
  30. },
  31. },
  32. // More values...
  33. },
  34. Market: aws.String("MarketType"),
  35. Name: aws.String("XmlStringMaxLen256"),
  36. },
  37. // More values...
  38. },
  39. JobFlowId: aws.String("XmlStringMaxLen256"), // Required
  40. }
  41. resp, err := svc.AddInstanceGroups(params)
  42. if err != nil {
  43. // Print the error, cast err to awserr.Error to get the Code and
  44. // Message from an error.
  45. fmt.Println(err.Error())
  46. return
  47. }
  48. // Pretty-print the response data.
  49. fmt.Println(resp)
  50. }
  51. func ExampleEMR_AddJobFlowSteps() {
  52. svc := emr.New(nil)
  53. params := &emr.AddJobFlowStepsInput{
  54. JobFlowId: aws.String("XmlStringMaxLen256"), // Required
  55. Steps: []*emr.StepConfig{ // Required
  56. { // Required
  57. HadoopJarStep: &emr.HadoopJarStepConfig{ // Required
  58. Jar: aws.String("XmlString"), // Required
  59. Args: []*string{
  60. aws.String("XmlString"), // Required
  61. // More values...
  62. },
  63. MainClass: aws.String("XmlString"),
  64. Properties: []*emr.KeyValue{
  65. { // Required
  66. Key: aws.String("XmlString"),
  67. Value: aws.String("XmlString"),
  68. },
  69. // More values...
  70. },
  71. },
  72. Name: aws.String("XmlStringMaxLen256"), // Required
  73. ActionOnFailure: aws.String("ActionOnFailure"),
  74. },
  75. // More values...
  76. },
  77. }
  78. resp, err := svc.AddJobFlowSteps(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 ExampleEMR_AddTags() {
  89. svc := emr.New(nil)
  90. params := &emr.AddTagsInput{
  91. ResourceId: aws.String("ResourceId"), // Required
  92. Tags: []*emr.Tag{ // Required
  93. { // Required
  94. Key: aws.String("String"),
  95. Value: aws.String("String"),
  96. },
  97. // More values...
  98. },
  99. }
  100. resp, err := svc.AddTags(params)
  101. if err != nil {
  102. // Print the error, cast err to awserr.Error to get the Code and
  103. // Message from an error.
  104. fmt.Println(err.Error())
  105. return
  106. }
  107. // Pretty-print the response data.
  108. fmt.Println(resp)
  109. }
  110. func ExampleEMR_DescribeCluster() {
  111. svc := emr.New(nil)
  112. params := &emr.DescribeClusterInput{
  113. ClusterId: aws.String("ClusterId"), // Required
  114. }
  115. resp, err := svc.DescribeCluster(params)
  116. if err != nil {
  117. // Print the error, cast err to awserr.Error to get the Code and
  118. // Message from an error.
  119. fmt.Println(err.Error())
  120. return
  121. }
  122. // Pretty-print the response data.
  123. fmt.Println(resp)
  124. }
  125. func ExampleEMR_DescribeJobFlows() {
  126. svc := emr.New(nil)
  127. params := &emr.DescribeJobFlowsInput{
  128. CreatedAfter: aws.Time(time.Now()),
  129. CreatedBefore: aws.Time(time.Now()),
  130. JobFlowIds: []*string{
  131. aws.String("XmlString"), // Required
  132. // More values...
  133. },
  134. JobFlowStates: []*string{
  135. aws.String("JobFlowExecutionState"), // Required
  136. // More values...
  137. },
  138. }
  139. resp, err := svc.DescribeJobFlows(params)
  140. if err != nil {
  141. // Print the error, cast err to awserr.Error to get the Code and
  142. // Message from an error.
  143. fmt.Println(err.Error())
  144. return
  145. }
  146. // Pretty-print the response data.
  147. fmt.Println(resp)
  148. }
  149. func ExampleEMR_DescribeStep() {
  150. svc := emr.New(nil)
  151. params := &emr.DescribeStepInput{
  152. ClusterId: aws.String("ClusterId"), // Required
  153. StepId: aws.String("StepId"), // Required
  154. }
  155. resp, err := svc.DescribeStep(params)
  156. if err != nil {
  157. // Print the error, cast err to awserr.Error to get the Code and
  158. // Message from an error.
  159. fmt.Println(err.Error())
  160. return
  161. }
  162. // Pretty-print the response data.
  163. fmt.Println(resp)
  164. }
  165. func ExampleEMR_ListBootstrapActions() {
  166. svc := emr.New(nil)
  167. params := &emr.ListBootstrapActionsInput{
  168. ClusterId: aws.String("ClusterId"), // Required
  169. Marker: aws.String("Marker"),
  170. }
  171. resp, err := svc.ListBootstrapActions(params)
  172. if err != nil {
  173. // Print the error, cast err to awserr.Error to get the Code and
  174. // Message from an error.
  175. fmt.Println(err.Error())
  176. return
  177. }
  178. // Pretty-print the response data.
  179. fmt.Println(resp)
  180. }
  181. func ExampleEMR_ListClusters() {
  182. svc := emr.New(nil)
  183. params := &emr.ListClustersInput{
  184. ClusterStates: []*string{
  185. aws.String("ClusterState"), // Required
  186. // More values...
  187. },
  188. CreatedAfter: aws.Time(time.Now()),
  189. CreatedBefore: aws.Time(time.Now()),
  190. Marker: aws.String("Marker"),
  191. }
  192. resp, err := svc.ListClusters(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 ExampleEMR_ListInstanceGroups() {
  203. svc := emr.New(nil)
  204. params := &emr.ListInstanceGroupsInput{
  205. ClusterId: aws.String("ClusterId"), // Required
  206. Marker: aws.String("Marker"),
  207. }
  208. resp, err := svc.ListInstanceGroups(params)
  209. if err != nil {
  210. // Print the error, cast err to awserr.Error to get the Code and
  211. // Message from an error.
  212. fmt.Println(err.Error())
  213. return
  214. }
  215. // Pretty-print the response data.
  216. fmt.Println(resp)
  217. }
  218. func ExampleEMR_ListInstances() {
  219. svc := emr.New(nil)
  220. params := &emr.ListInstancesInput{
  221. ClusterId: aws.String("ClusterId"), // Required
  222. InstanceGroupId: aws.String("InstanceGroupId"),
  223. InstanceGroupTypes: []*string{
  224. aws.String("InstanceGroupType"), // Required
  225. // More values...
  226. },
  227. Marker: aws.String("Marker"),
  228. }
  229. resp, err := svc.ListInstances(params)
  230. if err != nil {
  231. // Print the error, cast err to awserr.Error to get the Code and
  232. // Message from an error.
  233. fmt.Println(err.Error())
  234. return
  235. }
  236. // Pretty-print the response data.
  237. fmt.Println(resp)
  238. }
  239. func ExampleEMR_ListSteps() {
  240. svc := emr.New(nil)
  241. params := &emr.ListStepsInput{
  242. ClusterId: aws.String("ClusterId"), // Required
  243. Marker: aws.String("Marker"),
  244. StepIds: []*string{
  245. aws.String("XmlString"), // Required
  246. // More values...
  247. },
  248. StepStates: []*string{
  249. aws.String("StepState"), // Required
  250. // More values...
  251. },
  252. }
  253. resp, err := svc.ListSteps(params)
  254. if err != nil {
  255. // Print the error, cast err to awserr.Error to get the Code and
  256. // Message from an error.
  257. fmt.Println(err.Error())
  258. return
  259. }
  260. // Pretty-print the response data.
  261. fmt.Println(resp)
  262. }
  263. func ExampleEMR_ModifyInstanceGroups() {
  264. svc := emr.New(nil)
  265. params := &emr.ModifyInstanceGroupsInput{
  266. InstanceGroups: []*emr.InstanceGroupModifyConfig{
  267. { // Required
  268. InstanceGroupId: aws.String("XmlStringMaxLen256"), // Required
  269. EC2InstanceIdsToTerminate: []*string{
  270. aws.String("InstanceId"), // Required
  271. // More values...
  272. },
  273. InstanceCount: aws.Int64(1),
  274. },
  275. // More values...
  276. },
  277. }
  278. resp, err := svc.ModifyInstanceGroups(params)
  279. if err != nil {
  280. // Print the error, cast err to awserr.Error to get the Code and
  281. // Message from an error.
  282. fmt.Println(err.Error())
  283. return
  284. }
  285. // Pretty-print the response data.
  286. fmt.Println(resp)
  287. }
  288. func ExampleEMR_RemoveTags() {
  289. svc := emr.New(nil)
  290. params := &emr.RemoveTagsInput{
  291. ResourceId: aws.String("ResourceId"), // Required
  292. TagKeys: []*string{ // Required
  293. aws.String("String"), // Required
  294. // More values...
  295. },
  296. }
  297. resp, err := svc.RemoveTags(params)
  298. if err != nil {
  299. // Print the error, cast err to awserr.Error to get the Code and
  300. // Message from an error.
  301. fmt.Println(err.Error())
  302. return
  303. }
  304. // Pretty-print the response data.
  305. fmt.Println(resp)
  306. }
  307. func ExampleEMR_RunJobFlow() {
  308. svc := emr.New(nil)
  309. params := &emr.RunJobFlowInput{
  310. Instances: &emr.JobFlowInstancesConfig{ // Required
  311. AdditionalMasterSecurityGroups: []*string{
  312. aws.String("XmlStringMaxLen256"), // Required
  313. // More values...
  314. },
  315. AdditionalSlaveSecurityGroups: []*string{
  316. aws.String("XmlStringMaxLen256"), // Required
  317. // More values...
  318. },
  319. Ec2KeyName: aws.String("XmlStringMaxLen256"),
  320. Ec2SubnetId: aws.String("XmlStringMaxLen256"),
  321. EmrManagedMasterSecurityGroup: aws.String("XmlStringMaxLen256"),
  322. EmrManagedSlaveSecurityGroup: aws.String("XmlStringMaxLen256"),
  323. HadoopVersion: aws.String("XmlStringMaxLen256"),
  324. InstanceCount: aws.Int64(1),
  325. InstanceGroups: []*emr.InstanceGroupConfig{
  326. { // Required
  327. InstanceCount: aws.Int64(1), // Required
  328. InstanceRole: aws.String("InstanceRoleType"), // Required
  329. InstanceType: aws.String("InstanceType"), // Required
  330. BidPrice: aws.String("XmlStringMaxLen256"),
  331. Configurations: []*emr.Configuration{
  332. { // Required
  333. Classification: aws.String("String"),
  334. Configurations: []*emr.Configuration{
  335. // Recursive values...
  336. },
  337. Properties: map[string]*string{
  338. "Key": aws.String("String"), // Required
  339. // More values...
  340. },
  341. },
  342. // More values...
  343. },
  344. Market: aws.String("MarketType"),
  345. Name: aws.String("XmlStringMaxLen256"),
  346. },
  347. // More values...
  348. },
  349. KeepJobFlowAliveWhenNoSteps: aws.Bool(true),
  350. MasterInstanceType: aws.String("InstanceType"),
  351. Placement: &emr.PlacementType{
  352. AvailabilityZone: aws.String("XmlString"), // Required
  353. },
  354. SlaveInstanceType: aws.String("InstanceType"),
  355. TerminationProtected: aws.Bool(true),
  356. },
  357. Name: aws.String("XmlStringMaxLen256"), // Required
  358. AdditionalInfo: aws.String("XmlString"),
  359. AmiVersion: aws.String("XmlStringMaxLen256"),
  360. Applications: []*emr.Application{
  361. { // Required
  362. AdditionalInfo: map[string]*string{
  363. "Key": aws.String("String"), // Required
  364. // More values...
  365. },
  366. Args: []*string{
  367. aws.String("String"), // Required
  368. // More values...
  369. },
  370. Name: aws.String("String"),
  371. Version: aws.String("String"),
  372. },
  373. // More values...
  374. },
  375. BootstrapActions: []*emr.BootstrapActionConfig{
  376. { // Required
  377. Name: aws.String("XmlStringMaxLen256"), // Required
  378. ScriptBootstrapAction: &emr.ScriptBootstrapActionConfig{ // Required
  379. Path: aws.String("XmlString"), // Required
  380. Args: []*string{
  381. aws.String("XmlString"), // Required
  382. // More values...
  383. },
  384. },
  385. },
  386. // More values...
  387. },
  388. Configurations: []*emr.Configuration{
  389. { // Required
  390. Classification: aws.String("String"),
  391. Configurations: []*emr.Configuration{
  392. // Recursive values...
  393. },
  394. Properties: map[string]*string{
  395. "Key": aws.String("String"), // Required
  396. // More values...
  397. },
  398. },
  399. // More values...
  400. },
  401. JobFlowRole: aws.String("XmlString"),
  402. LogUri: aws.String("XmlString"),
  403. NewSupportedProducts: []*emr.SupportedProductConfig{
  404. { // Required
  405. Args: []*string{
  406. aws.String("XmlString"), // Required
  407. // More values...
  408. },
  409. Name: aws.String("XmlStringMaxLen256"),
  410. },
  411. // More values...
  412. },
  413. ReleaseLabel: aws.String("XmlStringMaxLen256"),
  414. ServiceRole: aws.String("XmlString"),
  415. Steps: []*emr.StepConfig{
  416. { // Required
  417. HadoopJarStep: &emr.HadoopJarStepConfig{ // Required
  418. Jar: aws.String("XmlString"), // Required
  419. Args: []*string{
  420. aws.String("XmlString"), // Required
  421. // More values...
  422. },
  423. MainClass: aws.String("XmlString"),
  424. Properties: []*emr.KeyValue{
  425. { // Required
  426. Key: aws.String("XmlString"),
  427. Value: aws.String("XmlString"),
  428. },
  429. // More values...
  430. },
  431. },
  432. Name: aws.String("XmlStringMaxLen256"), // Required
  433. ActionOnFailure: aws.String("ActionOnFailure"),
  434. },
  435. // More values...
  436. },
  437. SupportedProducts: []*string{
  438. aws.String("XmlStringMaxLen256"), // Required
  439. // More values...
  440. },
  441. Tags: []*emr.Tag{
  442. { // Required
  443. Key: aws.String("String"),
  444. Value: aws.String("String"),
  445. },
  446. // More values...
  447. },
  448. VisibleToAllUsers: aws.Bool(true),
  449. }
  450. resp, err := svc.RunJobFlow(params)
  451. if err != nil {
  452. // Print the error, cast err to awserr.Error to get the Code and
  453. // Message from an error.
  454. fmt.Println(err.Error())
  455. return
  456. }
  457. // Pretty-print the response data.
  458. fmt.Println(resp)
  459. }
  460. func ExampleEMR_SetTerminationProtection() {
  461. svc := emr.New(nil)
  462. params := &emr.SetTerminationProtectionInput{
  463. JobFlowIds: []*string{ // Required
  464. aws.String("XmlString"), // Required
  465. // More values...
  466. },
  467. TerminationProtected: aws.Bool(true), // Required
  468. }
  469. resp, err := svc.SetTerminationProtection(params)
  470. if err != nil {
  471. // Print the error, cast err to awserr.Error to get the Code and
  472. // Message from an error.
  473. fmt.Println(err.Error())
  474. return
  475. }
  476. // Pretty-print the response data.
  477. fmt.Println(resp)
  478. }
  479. func ExampleEMR_SetVisibleToAllUsers() {
  480. svc := emr.New(nil)
  481. params := &emr.SetVisibleToAllUsersInput{
  482. JobFlowIds: []*string{ // Required
  483. aws.String("XmlString"), // Required
  484. // More values...
  485. },
  486. VisibleToAllUsers: aws.Bool(true), // Required
  487. }
  488. resp, err := svc.SetVisibleToAllUsers(params)
  489. if err != nil {
  490. // Print the error, cast err to awserr.Error to get the Code and
  491. // Message from an error.
  492. fmt.Println(err.Error())
  493. return
  494. }
  495. // Pretty-print the response data.
  496. fmt.Println(resp)
  497. }
  498. func ExampleEMR_TerminateJobFlows() {
  499. svc := emr.New(nil)
  500. params := &emr.TerminateJobFlowsInput{
  501. JobFlowIds: []*string{ // Required
  502. aws.String("XmlString"), // Required
  503. // More values...
  504. },
  505. }
  506. resp, err := svc.TerminateJobFlows(params)
  507. if err != nil {
  508. // Print the error, cast err to awserr.Error to get the Code and
  509. // Message from an error.
  510. fmt.Println(err.Error())
  511. return
  512. }
  513. // Pretty-print the response data.
  514. fmt.Println(resp)
  515. }