examples_test.go 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package machinelearning_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/machinelearning"
  10. )
  11. var _ time.Duration
  12. var _ bytes.Buffer
  13. func ExampleMachineLearning_AddTags() {
  14. sess, err := session.NewSession()
  15. if err != nil {
  16. fmt.Println("failed to create session,", err)
  17. return
  18. }
  19. svc := machinelearning.New(sess)
  20. params := &machinelearning.AddTagsInput{
  21. ResourceId: aws.String("EntityId"), // Required
  22. ResourceType: aws.String("TaggableResourceType"), // Required
  23. Tags: []*machinelearning.Tag{ // Required
  24. { // Required
  25. Key: aws.String("TagKey"),
  26. Value: aws.String("TagValue"),
  27. },
  28. // More values...
  29. },
  30. }
  31. resp, err := svc.AddTags(params)
  32. if err != nil {
  33. // Print the error, cast err to awserr.Error to get the Code and
  34. // Message from an error.
  35. fmt.Println(err.Error())
  36. return
  37. }
  38. // Pretty-print the response data.
  39. fmt.Println(resp)
  40. }
  41. func ExampleMachineLearning_CreateBatchPrediction() {
  42. sess, err := session.NewSession()
  43. if err != nil {
  44. fmt.Println("failed to create session,", err)
  45. return
  46. }
  47. svc := machinelearning.New(sess)
  48. params := &machinelearning.CreateBatchPredictionInput{
  49. BatchPredictionDataSourceId: aws.String("EntityId"), // Required
  50. BatchPredictionId: aws.String("EntityId"), // Required
  51. MLModelId: aws.String("EntityId"), // Required
  52. OutputUri: aws.String("S3Url"), // Required
  53. BatchPredictionName: aws.String("EntityName"),
  54. }
  55. resp, err := svc.CreateBatchPrediction(params)
  56. if err != nil {
  57. // Print the error, cast err to awserr.Error to get the Code and
  58. // Message from an error.
  59. fmt.Println(err.Error())
  60. return
  61. }
  62. // Pretty-print the response data.
  63. fmt.Println(resp)
  64. }
  65. func ExampleMachineLearning_CreateDataSourceFromRDS() {
  66. sess, err := session.NewSession()
  67. if err != nil {
  68. fmt.Println("failed to create session,", err)
  69. return
  70. }
  71. svc := machinelearning.New(sess)
  72. params := &machinelearning.CreateDataSourceFromRDSInput{
  73. DataSourceId: aws.String("EntityId"), // Required
  74. RDSData: &machinelearning.RDSDataSpec{ // Required
  75. DatabaseCredentials: &machinelearning.RDSDatabaseCredentials{ // Required
  76. Password: aws.String("RDSDatabasePassword"), // Required
  77. Username: aws.String("RDSDatabaseUsername"), // Required
  78. },
  79. DatabaseInformation: &machinelearning.RDSDatabase{ // Required
  80. DatabaseName: aws.String("RDSDatabaseName"), // Required
  81. InstanceIdentifier: aws.String("RDSInstanceIdentifier"), // Required
  82. },
  83. ResourceRole: aws.String("EDPResourceRole"), // Required
  84. S3StagingLocation: aws.String("S3Url"), // Required
  85. SecurityGroupIds: []*string{ // Required
  86. aws.String("EDPSecurityGroupId"), // Required
  87. // More values...
  88. },
  89. SelectSqlQuery: aws.String("RDSSelectSqlQuery"), // Required
  90. ServiceRole: aws.String("EDPServiceRole"), // Required
  91. SubnetId: aws.String("EDPSubnetId"), // Required
  92. DataRearrangement: aws.String("DataRearrangement"),
  93. DataSchema: aws.String("DataSchema"),
  94. DataSchemaUri: aws.String("S3Url"),
  95. },
  96. RoleARN: aws.String("RoleARN"), // Required
  97. ComputeStatistics: aws.Bool(true),
  98. DataSourceName: aws.String("EntityName"),
  99. }
  100. resp, err := svc.CreateDataSourceFromRDS(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 ExampleMachineLearning_CreateDataSourceFromRedshift() {
  111. sess, err := session.NewSession()
  112. if err != nil {
  113. fmt.Println("failed to create session,", err)
  114. return
  115. }
  116. svc := machinelearning.New(sess)
  117. params := &machinelearning.CreateDataSourceFromRedshiftInput{
  118. DataSourceId: aws.String("EntityId"), // Required
  119. DataSpec: &machinelearning.RedshiftDataSpec{ // Required
  120. DatabaseCredentials: &machinelearning.RedshiftDatabaseCredentials{ // Required
  121. Password: aws.String("RedshiftDatabasePassword"), // Required
  122. Username: aws.String("RedshiftDatabaseUsername"), // Required
  123. },
  124. DatabaseInformation: &machinelearning.RedshiftDatabase{ // Required
  125. ClusterIdentifier: aws.String("RedshiftClusterIdentifier"), // Required
  126. DatabaseName: aws.String("RedshiftDatabaseName"), // Required
  127. },
  128. S3StagingLocation: aws.String("S3Url"), // Required
  129. SelectSqlQuery: aws.String("RedshiftSelectSqlQuery"), // Required
  130. DataRearrangement: aws.String("DataRearrangement"),
  131. DataSchema: aws.String("DataSchema"),
  132. DataSchemaUri: aws.String("S3Url"),
  133. },
  134. RoleARN: aws.String("RoleARN"), // Required
  135. ComputeStatistics: aws.Bool(true),
  136. DataSourceName: aws.String("EntityName"),
  137. }
  138. resp, err := svc.CreateDataSourceFromRedshift(params)
  139. if err != nil {
  140. // Print the error, cast err to awserr.Error to get the Code and
  141. // Message from an error.
  142. fmt.Println(err.Error())
  143. return
  144. }
  145. // Pretty-print the response data.
  146. fmt.Println(resp)
  147. }
  148. func ExampleMachineLearning_CreateDataSourceFromS3() {
  149. sess, err := session.NewSession()
  150. if err != nil {
  151. fmt.Println("failed to create session,", err)
  152. return
  153. }
  154. svc := machinelearning.New(sess)
  155. params := &machinelearning.CreateDataSourceFromS3Input{
  156. DataSourceId: aws.String("EntityId"), // Required
  157. DataSpec: &machinelearning.S3DataSpec{ // Required
  158. DataLocationS3: aws.String("S3Url"), // Required
  159. DataRearrangement: aws.String("DataRearrangement"),
  160. DataSchema: aws.String("DataSchema"),
  161. DataSchemaLocationS3: aws.String("S3Url"),
  162. },
  163. ComputeStatistics: aws.Bool(true),
  164. DataSourceName: aws.String("EntityName"),
  165. }
  166. resp, err := svc.CreateDataSourceFromS3(params)
  167. if err != nil {
  168. // Print the error, cast err to awserr.Error to get the Code and
  169. // Message from an error.
  170. fmt.Println(err.Error())
  171. return
  172. }
  173. // Pretty-print the response data.
  174. fmt.Println(resp)
  175. }
  176. func ExampleMachineLearning_CreateEvaluation() {
  177. sess, err := session.NewSession()
  178. if err != nil {
  179. fmt.Println("failed to create session,", err)
  180. return
  181. }
  182. svc := machinelearning.New(sess)
  183. params := &machinelearning.CreateEvaluationInput{
  184. EvaluationDataSourceId: aws.String("EntityId"), // Required
  185. EvaluationId: aws.String("EntityId"), // Required
  186. MLModelId: aws.String("EntityId"), // Required
  187. EvaluationName: aws.String("EntityName"),
  188. }
  189. resp, err := svc.CreateEvaluation(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 ExampleMachineLearning_CreateMLModel() {
  200. sess, err := session.NewSession()
  201. if err != nil {
  202. fmt.Println("failed to create session,", err)
  203. return
  204. }
  205. svc := machinelearning.New(sess)
  206. params := &machinelearning.CreateMLModelInput{
  207. MLModelId: aws.String("EntityId"), // Required
  208. MLModelType: aws.String("MLModelType"), // Required
  209. TrainingDataSourceId: aws.String("EntityId"), // Required
  210. MLModelName: aws.String("EntityName"),
  211. Parameters: map[string]*string{
  212. "Key": aws.String("StringType"), // Required
  213. // More values...
  214. },
  215. Recipe: aws.String("Recipe"),
  216. RecipeUri: aws.String("S3Url"),
  217. }
  218. resp, err := svc.CreateMLModel(params)
  219. if err != nil {
  220. // Print the error, cast err to awserr.Error to get the Code and
  221. // Message from an error.
  222. fmt.Println(err.Error())
  223. return
  224. }
  225. // Pretty-print the response data.
  226. fmt.Println(resp)
  227. }
  228. func ExampleMachineLearning_CreateRealtimeEndpoint() {
  229. sess, err := session.NewSession()
  230. if err != nil {
  231. fmt.Println("failed to create session,", err)
  232. return
  233. }
  234. svc := machinelearning.New(sess)
  235. params := &machinelearning.CreateRealtimeEndpointInput{
  236. MLModelId: aws.String("EntityId"), // Required
  237. }
  238. resp, err := svc.CreateRealtimeEndpoint(params)
  239. if err != nil {
  240. // Print the error, cast err to awserr.Error to get the Code and
  241. // Message from an error.
  242. fmt.Println(err.Error())
  243. return
  244. }
  245. // Pretty-print the response data.
  246. fmt.Println(resp)
  247. }
  248. func ExampleMachineLearning_DeleteBatchPrediction() {
  249. sess, err := session.NewSession()
  250. if err != nil {
  251. fmt.Println("failed to create session,", err)
  252. return
  253. }
  254. svc := machinelearning.New(sess)
  255. params := &machinelearning.DeleteBatchPredictionInput{
  256. BatchPredictionId: aws.String("EntityId"), // Required
  257. }
  258. resp, err := svc.DeleteBatchPrediction(params)
  259. if err != nil {
  260. // Print the error, cast err to awserr.Error to get the Code and
  261. // Message from an error.
  262. fmt.Println(err.Error())
  263. return
  264. }
  265. // Pretty-print the response data.
  266. fmt.Println(resp)
  267. }
  268. func ExampleMachineLearning_DeleteDataSource() {
  269. sess, err := session.NewSession()
  270. if err != nil {
  271. fmt.Println("failed to create session,", err)
  272. return
  273. }
  274. svc := machinelearning.New(sess)
  275. params := &machinelearning.DeleteDataSourceInput{
  276. DataSourceId: aws.String("EntityId"), // Required
  277. }
  278. resp, err := svc.DeleteDataSource(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 ExampleMachineLearning_DeleteEvaluation() {
  289. sess, err := session.NewSession()
  290. if err != nil {
  291. fmt.Println("failed to create session,", err)
  292. return
  293. }
  294. svc := machinelearning.New(sess)
  295. params := &machinelearning.DeleteEvaluationInput{
  296. EvaluationId: aws.String("EntityId"), // Required
  297. }
  298. resp, err := svc.DeleteEvaluation(params)
  299. if err != nil {
  300. // Print the error, cast err to awserr.Error to get the Code and
  301. // Message from an error.
  302. fmt.Println(err.Error())
  303. return
  304. }
  305. // Pretty-print the response data.
  306. fmt.Println(resp)
  307. }
  308. func ExampleMachineLearning_DeleteMLModel() {
  309. sess, err := session.NewSession()
  310. if err != nil {
  311. fmt.Println("failed to create session,", err)
  312. return
  313. }
  314. svc := machinelearning.New(sess)
  315. params := &machinelearning.DeleteMLModelInput{
  316. MLModelId: aws.String("EntityId"), // Required
  317. }
  318. resp, err := svc.DeleteMLModel(params)
  319. if err != nil {
  320. // Print the error, cast err to awserr.Error to get the Code and
  321. // Message from an error.
  322. fmt.Println(err.Error())
  323. return
  324. }
  325. // Pretty-print the response data.
  326. fmt.Println(resp)
  327. }
  328. func ExampleMachineLearning_DeleteRealtimeEndpoint() {
  329. sess, err := session.NewSession()
  330. if err != nil {
  331. fmt.Println("failed to create session,", err)
  332. return
  333. }
  334. svc := machinelearning.New(sess)
  335. params := &machinelearning.DeleteRealtimeEndpointInput{
  336. MLModelId: aws.String("EntityId"), // Required
  337. }
  338. resp, err := svc.DeleteRealtimeEndpoint(params)
  339. if err != nil {
  340. // Print the error, cast err to awserr.Error to get the Code and
  341. // Message from an error.
  342. fmt.Println(err.Error())
  343. return
  344. }
  345. // Pretty-print the response data.
  346. fmt.Println(resp)
  347. }
  348. func ExampleMachineLearning_DeleteTags() {
  349. sess, err := session.NewSession()
  350. if err != nil {
  351. fmt.Println("failed to create session,", err)
  352. return
  353. }
  354. svc := machinelearning.New(sess)
  355. params := &machinelearning.DeleteTagsInput{
  356. ResourceId: aws.String("EntityId"), // Required
  357. ResourceType: aws.String("TaggableResourceType"), // Required
  358. TagKeys: []*string{ // Required
  359. aws.String("TagKey"), // Required
  360. // More values...
  361. },
  362. }
  363. resp, err := svc.DeleteTags(params)
  364. if err != nil {
  365. // Print the error, cast err to awserr.Error to get the Code and
  366. // Message from an error.
  367. fmt.Println(err.Error())
  368. return
  369. }
  370. // Pretty-print the response data.
  371. fmt.Println(resp)
  372. }
  373. func ExampleMachineLearning_DescribeBatchPredictions() {
  374. sess, err := session.NewSession()
  375. if err != nil {
  376. fmt.Println("failed to create session,", err)
  377. return
  378. }
  379. svc := machinelearning.New(sess)
  380. params := &machinelearning.DescribeBatchPredictionsInput{
  381. EQ: aws.String("ComparatorValue"),
  382. FilterVariable: aws.String("BatchPredictionFilterVariable"),
  383. GE: aws.String("ComparatorValue"),
  384. GT: aws.String("ComparatorValue"),
  385. LE: aws.String("ComparatorValue"),
  386. LT: aws.String("ComparatorValue"),
  387. Limit: aws.Int64(1),
  388. NE: aws.String("ComparatorValue"),
  389. NextToken: aws.String("StringType"),
  390. Prefix: aws.String("ComparatorValue"),
  391. SortOrder: aws.String("SortOrder"),
  392. }
  393. resp, err := svc.DescribeBatchPredictions(params)
  394. if err != nil {
  395. // Print the error, cast err to awserr.Error to get the Code and
  396. // Message from an error.
  397. fmt.Println(err.Error())
  398. return
  399. }
  400. // Pretty-print the response data.
  401. fmt.Println(resp)
  402. }
  403. func ExampleMachineLearning_DescribeDataSources() {
  404. sess, err := session.NewSession()
  405. if err != nil {
  406. fmt.Println("failed to create session,", err)
  407. return
  408. }
  409. svc := machinelearning.New(sess)
  410. params := &machinelearning.DescribeDataSourcesInput{
  411. EQ: aws.String("ComparatorValue"),
  412. FilterVariable: aws.String("DataSourceFilterVariable"),
  413. GE: aws.String("ComparatorValue"),
  414. GT: aws.String("ComparatorValue"),
  415. LE: aws.String("ComparatorValue"),
  416. LT: aws.String("ComparatorValue"),
  417. Limit: aws.Int64(1),
  418. NE: aws.String("ComparatorValue"),
  419. NextToken: aws.String("StringType"),
  420. Prefix: aws.String("ComparatorValue"),
  421. SortOrder: aws.String("SortOrder"),
  422. }
  423. resp, err := svc.DescribeDataSources(params)
  424. if err != nil {
  425. // Print the error, cast err to awserr.Error to get the Code and
  426. // Message from an error.
  427. fmt.Println(err.Error())
  428. return
  429. }
  430. // Pretty-print the response data.
  431. fmt.Println(resp)
  432. }
  433. func ExampleMachineLearning_DescribeEvaluations() {
  434. sess, err := session.NewSession()
  435. if err != nil {
  436. fmt.Println("failed to create session,", err)
  437. return
  438. }
  439. svc := machinelearning.New(sess)
  440. params := &machinelearning.DescribeEvaluationsInput{
  441. EQ: aws.String("ComparatorValue"),
  442. FilterVariable: aws.String("EvaluationFilterVariable"),
  443. GE: aws.String("ComparatorValue"),
  444. GT: aws.String("ComparatorValue"),
  445. LE: aws.String("ComparatorValue"),
  446. LT: aws.String("ComparatorValue"),
  447. Limit: aws.Int64(1),
  448. NE: aws.String("ComparatorValue"),
  449. NextToken: aws.String("StringType"),
  450. Prefix: aws.String("ComparatorValue"),
  451. SortOrder: aws.String("SortOrder"),
  452. }
  453. resp, err := svc.DescribeEvaluations(params)
  454. if err != nil {
  455. // Print the error, cast err to awserr.Error to get the Code and
  456. // Message from an error.
  457. fmt.Println(err.Error())
  458. return
  459. }
  460. // Pretty-print the response data.
  461. fmt.Println(resp)
  462. }
  463. func ExampleMachineLearning_DescribeMLModels() {
  464. sess, err := session.NewSession()
  465. if err != nil {
  466. fmt.Println("failed to create session,", err)
  467. return
  468. }
  469. svc := machinelearning.New(sess)
  470. params := &machinelearning.DescribeMLModelsInput{
  471. EQ: aws.String("ComparatorValue"),
  472. FilterVariable: aws.String("MLModelFilterVariable"),
  473. GE: aws.String("ComparatorValue"),
  474. GT: aws.String("ComparatorValue"),
  475. LE: aws.String("ComparatorValue"),
  476. LT: aws.String("ComparatorValue"),
  477. Limit: aws.Int64(1),
  478. NE: aws.String("ComparatorValue"),
  479. NextToken: aws.String("StringType"),
  480. Prefix: aws.String("ComparatorValue"),
  481. SortOrder: aws.String("SortOrder"),
  482. }
  483. resp, err := svc.DescribeMLModels(params)
  484. if err != nil {
  485. // Print the error, cast err to awserr.Error to get the Code and
  486. // Message from an error.
  487. fmt.Println(err.Error())
  488. return
  489. }
  490. // Pretty-print the response data.
  491. fmt.Println(resp)
  492. }
  493. func ExampleMachineLearning_DescribeTags() {
  494. sess, err := session.NewSession()
  495. if err != nil {
  496. fmt.Println("failed to create session,", err)
  497. return
  498. }
  499. svc := machinelearning.New(sess)
  500. params := &machinelearning.DescribeTagsInput{
  501. ResourceId: aws.String("EntityId"), // Required
  502. ResourceType: aws.String("TaggableResourceType"), // Required
  503. }
  504. resp, err := svc.DescribeTags(params)
  505. if err != nil {
  506. // Print the error, cast err to awserr.Error to get the Code and
  507. // Message from an error.
  508. fmt.Println(err.Error())
  509. return
  510. }
  511. // Pretty-print the response data.
  512. fmt.Println(resp)
  513. }
  514. func ExampleMachineLearning_GetBatchPrediction() {
  515. sess, err := session.NewSession()
  516. if err != nil {
  517. fmt.Println("failed to create session,", err)
  518. return
  519. }
  520. svc := machinelearning.New(sess)
  521. params := &machinelearning.GetBatchPredictionInput{
  522. BatchPredictionId: aws.String("EntityId"), // Required
  523. }
  524. resp, err := svc.GetBatchPrediction(params)
  525. if err != nil {
  526. // Print the error, cast err to awserr.Error to get the Code and
  527. // Message from an error.
  528. fmt.Println(err.Error())
  529. return
  530. }
  531. // Pretty-print the response data.
  532. fmt.Println(resp)
  533. }
  534. func ExampleMachineLearning_GetDataSource() {
  535. sess, err := session.NewSession()
  536. if err != nil {
  537. fmt.Println("failed to create session,", err)
  538. return
  539. }
  540. svc := machinelearning.New(sess)
  541. params := &machinelearning.GetDataSourceInput{
  542. DataSourceId: aws.String("EntityId"), // Required
  543. Verbose: aws.Bool(true),
  544. }
  545. resp, err := svc.GetDataSource(params)
  546. if err != nil {
  547. // Print the error, cast err to awserr.Error to get the Code and
  548. // Message from an error.
  549. fmt.Println(err.Error())
  550. return
  551. }
  552. // Pretty-print the response data.
  553. fmt.Println(resp)
  554. }
  555. func ExampleMachineLearning_GetEvaluation() {
  556. sess, err := session.NewSession()
  557. if err != nil {
  558. fmt.Println("failed to create session,", err)
  559. return
  560. }
  561. svc := machinelearning.New(sess)
  562. params := &machinelearning.GetEvaluationInput{
  563. EvaluationId: aws.String("EntityId"), // Required
  564. }
  565. resp, err := svc.GetEvaluation(params)
  566. if err != nil {
  567. // Print the error, cast err to awserr.Error to get the Code and
  568. // Message from an error.
  569. fmt.Println(err.Error())
  570. return
  571. }
  572. // Pretty-print the response data.
  573. fmt.Println(resp)
  574. }
  575. func ExampleMachineLearning_GetMLModel() {
  576. sess, err := session.NewSession()
  577. if err != nil {
  578. fmt.Println("failed to create session,", err)
  579. return
  580. }
  581. svc := machinelearning.New(sess)
  582. params := &machinelearning.GetMLModelInput{
  583. MLModelId: aws.String("EntityId"), // Required
  584. Verbose: aws.Bool(true),
  585. }
  586. resp, err := svc.GetMLModel(params)
  587. if err != nil {
  588. // Print the error, cast err to awserr.Error to get the Code and
  589. // Message from an error.
  590. fmt.Println(err.Error())
  591. return
  592. }
  593. // Pretty-print the response data.
  594. fmt.Println(resp)
  595. }
  596. func ExampleMachineLearning_Predict() {
  597. sess, err := session.NewSession()
  598. if err != nil {
  599. fmt.Println("failed to create session,", err)
  600. return
  601. }
  602. svc := machinelearning.New(sess)
  603. params := &machinelearning.PredictInput{
  604. MLModelId: aws.String("EntityId"), // Required
  605. PredictEndpoint: aws.String("VipURL"), // Required
  606. Record: map[string]*string{ // Required
  607. "Key": aws.String("VariableValue"), // Required
  608. // More values...
  609. },
  610. }
  611. resp, err := svc.Predict(params)
  612. if err != nil {
  613. // Print the error, cast err to awserr.Error to get the Code and
  614. // Message from an error.
  615. fmt.Println(err.Error())
  616. return
  617. }
  618. // Pretty-print the response data.
  619. fmt.Println(resp)
  620. }
  621. func ExampleMachineLearning_UpdateBatchPrediction() {
  622. sess, err := session.NewSession()
  623. if err != nil {
  624. fmt.Println("failed to create session,", err)
  625. return
  626. }
  627. svc := machinelearning.New(sess)
  628. params := &machinelearning.UpdateBatchPredictionInput{
  629. BatchPredictionId: aws.String("EntityId"), // Required
  630. BatchPredictionName: aws.String("EntityName"), // Required
  631. }
  632. resp, err := svc.UpdateBatchPrediction(params)
  633. if err != nil {
  634. // Print the error, cast err to awserr.Error to get the Code and
  635. // Message from an error.
  636. fmt.Println(err.Error())
  637. return
  638. }
  639. // Pretty-print the response data.
  640. fmt.Println(resp)
  641. }
  642. func ExampleMachineLearning_UpdateDataSource() {
  643. sess, err := session.NewSession()
  644. if err != nil {
  645. fmt.Println("failed to create session,", err)
  646. return
  647. }
  648. svc := machinelearning.New(sess)
  649. params := &machinelearning.UpdateDataSourceInput{
  650. DataSourceId: aws.String("EntityId"), // Required
  651. DataSourceName: aws.String("EntityName"), // Required
  652. }
  653. resp, err := svc.UpdateDataSource(params)
  654. if err != nil {
  655. // Print the error, cast err to awserr.Error to get the Code and
  656. // Message from an error.
  657. fmt.Println(err.Error())
  658. return
  659. }
  660. // Pretty-print the response data.
  661. fmt.Println(resp)
  662. }
  663. func ExampleMachineLearning_UpdateEvaluation() {
  664. sess, err := session.NewSession()
  665. if err != nil {
  666. fmt.Println("failed to create session,", err)
  667. return
  668. }
  669. svc := machinelearning.New(sess)
  670. params := &machinelearning.UpdateEvaluationInput{
  671. EvaluationId: aws.String("EntityId"), // Required
  672. EvaluationName: aws.String("EntityName"), // Required
  673. }
  674. resp, err := svc.UpdateEvaluation(params)
  675. if err != nil {
  676. // Print the error, cast err to awserr.Error to get the Code and
  677. // Message from an error.
  678. fmt.Println(err.Error())
  679. return
  680. }
  681. // Pretty-print the response data.
  682. fmt.Println(resp)
  683. }
  684. func ExampleMachineLearning_UpdateMLModel() {
  685. sess, err := session.NewSession()
  686. if err != nil {
  687. fmt.Println("failed to create session,", err)
  688. return
  689. }
  690. svc := machinelearning.New(sess)
  691. params := &machinelearning.UpdateMLModelInput{
  692. MLModelId: aws.String("EntityId"), // Required
  693. MLModelName: aws.String("EntityName"),
  694. ScoreThreshold: aws.Float64(1.0),
  695. }
  696. resp, err := svc.UpdateMLModel(params)
  697. if err != nil {
  698. // Print the error, cast err to awserr.Error to get the Code and
  699. // Message from an error.
  700. fmt.Println(err.Error())
  701. return
  702. }
  703. // Pretty-print the response data.
  704. fmt.Println(resp)
  705. }