examples_test.go 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package cloudsearch_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/cloudsearch"
  9. )
  10. var _ time.Duration
  11. var _ bytes.Buffer
  12. func ExampleCloudSearch_BuildSuggesters() {
  13. svc := cloudsearch.New(nil)
  14. params := &cloudsearch.BuildSuggestersInput{
  15. DomainName: aws.String("DomainName"), // Required
  16. }
  17. resp, err := svc.BuildSuggesters(params)
  18. if err != nil {
  19. // Print the error, cast err to awserr.Error to get the Code and
  20. // Message from an error.
  21. fmt.Println(err.Error())
  22. return
  23. }
  24. // Pretty-print the response data.
  25. fmt.Println(resp)
  26. }
  27. func ExampleCloudSearch_CreateDomain() {
  28. svc := cloudsearch.New(nil)
  29. params := &cloudsearch.CreateDomainInput{
  30. DomainName: aws.String("DomainName"), // Required
  31. }
  32. resp, err := svc.CreateDomain(params)
  33. if err != nil {
  34. // Print the error, cast err to awserr.Error to get the Code and
  35. // Message from an error.
  36. fmt.Println(err.Error())
  37. return
  38. }
  39. // Pretty-print the response data.
  40. fmt.Println(resp)
  41. }
  42. func ExampleCloudSearch_DefineAnalysisScheme() {
  43. svc := cloudsearch.New(nil)
  44. params := &cloudsearch.DefineAnalysisSchemeInput{
  45. AnalysisScheme: &cloudsearch.AnalysisScheme{ // Required
  46. AnalysisSchemeLanguage: aws.String("AnalysisSchemeLanguage"), // Required
  47. AnalysisSchemeName: aws.String("StandardName"), // Required
  48. AnalysisOptions: &cloudsearch.AnalysisOptions{
  49. AlgorithmicStemming: aws.String("AlgorithmicStemming"),
  50. JapaneseTokenizationDictionary: aws.String("String"),
  51. StemmingDictionary: aws.String("String"),
  52. Stopwords: aws.String("String"),
  53. Synonyms: aws.String("String"),
  54. },
  55. },
  56. DomainName: aws.String("DomainName"), // Required
  57. }
  58. resp, err := svc.DefineAnalysisScheme(params)
  59. if err != nil {
  60. // Print the error, cast err to awserr.Error to get the Code and
  61. // Message from an error.
  62. fmt.Println(err.Error())
  63. return
  64. }
  65. // Pretty-print the response data.
  66. fmt.Println(resp)
  67. }
  68. func ExampleCloudSearch_DefineExpression() {
  69. svc := cloudsearch.New(nil)
  70. params := &cloudsearch.DefineExpressionInput{
  71. DomainName: aws.String("DomainName"), // Required
  72. Expression: &cloudsearch.Expression{ // Required
  73. ExpressionName: aws.String("StandardName"), // Required
  74. ExpressionValue: aws.String("ExpressionValue"), // Required
  75. },
  76. }
  77. resp, err := svc.DefineExpression(params)
  78. if err != nil {
  79. // Print the error, cast err to awserr.Error to get the Code and
  80. // Message from an error.
  81. fmt.Println(err.Error())
  82. return
  83. }
  84. // Pretty-print the response data.
  85. fmt.Println(resp)
  86. }
  87. func ExampleCloudSearch_DefineIndexField() {
  88. svc := cloudsearch.New(nil)
  89. params := &cloudsearch.DefineIndexFieldInput{
  90. DomainName: aws.String("DomainName"), // Required
  91. IndexField: &cloudsearch.IndexField{ // Required
  92. IndexFieldName: aws.String("DynamicFieldName"), // Required
  93. IndexFieldType: aws.String("IndexFieldType"), // Required
  94. DateArrayOptions: &cloudsearch.DateArrayOptions{
  95. DefaultValue: aws.String("FieldValue"),
  96. FacetEnabled: aws.Bool(true),
  97. ReturnEnabled: aws.Bool(true),
  98. SearchEnabled: aws.Bool(true),
  99. SourceFields: aws.String("FieldNameCommaList"),
  100. },
  101. DateOptions: &cloudsearch.DateOptions{
  102. DefaultValue: aws.String("FieldValue"),
  103. FacetEnabled: aws.Bool(true),
  104. ReturnEnabled: aws.Bool(true),
  105. SearchEnabled: aws.Bool(true),
  106. SortEnabled: aws.Bool(true),
  107. SourceField: aws.String("FieldName"),
  108. },
  109. DoubleArrayOptions: &cloudsearch.DoubleArrayOptions{
  110. DefaultValue: aws.Float64(1.0),
  111. FacetEnabled: aws.Bool(true),
  112. ReturnEnabled: aws.Bool(true),
  113. SearchEnabled: aws.Bool(true),
  114. SourceFields: aws.String("FieldNameCommaList"),
  115. },
  116. DoubleOptions: &cloudsearch.DoubleOptions{
  117. DefaultValue: aws.Float64(1.0),
  118. FacetEnabled: aws.Bool(true),
  119. ReturnEnabled: aws.Bool(true),
  120. SearchEnabled: aws.Bool(true),
  121. SortEnabled: aws.Bool(true),
  122. SourceField: aws.String("FieldName"),
  123. },
  124. IntArrayOptions: &cloudsearch.IntArrayOptions{
  125. DefaultValue: aws.Int64(1),
  126. FacetEnabled: aws.Bool(true),
  127. ReturnEnabled: aws.Bool(true),
  128. SearchEnabled: aws.Bool(true),
  129. SourceFields: aws.String("FieldNameCommaList"),
  130. },
  131. IntOptions: &cloudsearch.IntOptions{
  132. DefaultValue: aws.Int64(1),
  133. FacetEnabled: aws.Bool(true),
  134. ReturnEnabled: aws.Bool(true),
  135. SearchEnabled: aws.Bool(true),
  136. SortEnabled: aws.Bool(true),
  137. SourceField: aws.String("FieldName"),
  138. },
  139. LatLonOptions: &cloudsearch.LatLonOptions{
  140. DefaultValue: aws.String("FieldValue"),
  141. FacetEnabled: aws.Bool(true),
  142. ReturnEnabled: aws.Bool(true),
  143. SearchEnabled: aws.Bool(true),
  144. SortEnabled: aws.Bool(true),
  145. SourceField: aws.String("FieldName"),
  146. },
  147. LiteralArrayOptions: &cloudsearch.LiteralArrayOptions{
  148. DefaultValue: aws.String("FieldValue"),
  149. FacetEnabled: aws.Bool(true),
  150. ReturnEnabled: aws.Bool(true),
  151. SearchEnabled: aws.Bool(true),
  152. SourceFields: aws.String("FieldNameCommaList"),
  153. },
  154. LiteralOptions: &cloudsearch.LiteralOptions{
  155. DefaultValue: aws.String("FieldValue"),
  156. FacetEnabled: aws.Bool(true),
  157. ReturnEnabled: aws.Bool(true),
  158. SearchEnabled: aws.Bool(true),
  159. SortEnabled: aws.Bool(true),
  160. SourceField: aws.String("FieldName"),
  161. },
  162. TextArrayOptions: &cloudsearch.TextArrayOptions{
  163. AnalysisScheme: aws.String("Word"),
  164. DefaultValue: aws.String("FieldValue"),
  165. HighlightEnabled: aws.Bool(true),
  166. ReturnEnabled: aws.Bool(true),
  167. SourceFields: aws.String("FieldNameCommaList"),
  168. },
  169. TextOptions: &cloudsearch.TextOptions{
  170. AnalysisScheme: aws.String("Word"),
  171. DefaultValue: aws.String("FieldValue"),
  172. HighlightEnabled: aws.Bool(true),
  173. ReturnEnabled: aws.Bool(true),
  174. SortEnabled: aws.Bool(true),
  175. SourceField: aws.String("FieldName"),
  176. },
  177. },
  178. }
  179. resp, err := svc.DefineIndexField(params)
  180. if err != nil {
  181. // Print the error, cast err to awserr.Error to get the Code and
  182. // Message from an error.
  183. fmt.Println(err.Error())
  184. return
  185. }
  186. // Pretty-print the response data.
  187. fmt.Println(resp)
  188. }
  189. func ExampleCloudSearch_DefineSuggester() {
  190. svc := cloudsearch.New(nil)
  191. params := &cloudsearch.DefineSuggesterInput{
  192. DomainName: aws.String("DomainName"), // Required
  193. Suggester: &cloudsearch.Suggester{ // Required
  194. DocumentSuggesterOptions: &cloudsearch.DocumentSuggesterOptions{ // Required
  195. SourceField: aws.String("FieldName"), // Required
  196. FuzzyMatching: aws.String("SuggesterFuzzyMatching"),
  197. SortExpression: aws.String("String"),
  198. },
  199. SuggesterName: aws.String("StandardName"), // Required
  200. },
  201. }
  202. resp, err := svc.DefineSuggester(params)
  203. if err != nil {
  204. // Print the error, cast err to awserr.Error to get the Code and
  205. // Message from an error.
  206. fmt.Println(err.Error())
  207. return
  208. }
  209. // Pretty-print the response data.
  210. fmt.Println(resp)
  211. }
  212. func ExampleCloudSearch_DeleteAnalysisScheme() {
  213. svc := cloudsearch.New(nil)
  214. params := &cloudsearch.DeleteAnalysisSchemeInput{
  215. AnalysisSchemeName: aws.String("StandardName"), // Required
  216. DomainName: aws.String("DomainName"), // Required
  217. }
  218. resp, err := svc.DeleteAnalysisScheme(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 ExampleCloudSearch_DeleteDomain() {
  229. svc := cloudsearch.New(nil)
  230. params := &cloudsearch.DeleteDomainInput{
  231. DomainName: aws.String("DomainName"), // Required
  232. }
  233. resp, err := svc.DeleteDomain(params)
  234. if err != nil {
  235. // Print the error, cast err to awserr.Error to get the Code and
  236. // Message from an error.
  237. fmt.Println(err.Error())
  238. return
  239. }
  240. // Pretty-print the response data.
  241. fmt.Println(resp)
  242. }
  243. func ExampleCloudSearch_DeleteExpression() {
  244. svc := cloudsearch.New(nil)
  245. params := &cloudsearch.DeleteExpressionInput{
  246. DomainName: aws.String("DomainName"), // Required
  247. ExpressionName: aws.String("StandardName"), // Required
  248. }
  249. resp, err := svc.DeleteExpression(params)
  250. if err != nil {
  251. // Print the error, cast err to awserr.Error to get the Code and
  252. // Message from an error.
  253. fmt.Println(err.Error())
  254. return
  255. }
  256. // Pretty-print the response data.
  257. fmt.Println(resp)
  258. }
  259. func ExampleCloudSearch_DeleteIndexField() {
  260. svc := cloudsearch.New(nil)
  261. params := &cloudsearch.DeleteIndexFieldInput{
  262. DomainName: aws.String("DomainName"), // Required
  263. IndexFieldName: aws.String("DynamicFieldName"), // Required
  264. }
  265. resp, err := svc.DeleteIndexField(params)
  266. if err != nil {
  267. // Print the error, cast err to awserr.Error to get the Code and
  268. // Message from an error.
  269. fmt.Println(err.Error())
  270. return
  271. }
  272. // Pretty-print the response data.
  273. fmt.Println(resp)
  274. }
  275. func ExampleCloudSearch_DeleteSuggester() {
  276. svc := cloudsearch.New(nil)
  277. params := &cloudsearch.DeleteSuggesterInput{
  278. DomainName: aws.String("DomainName"), // Required
  279. SuggesterName: aws.String("StandardName"), // Required
  280. }
  281. resp, err := svc.DeleteSuggester(params)
  282. if err != nil {
  283. // Print the error, cast err to awserr.Error to get the Code and
  284. // Message from an error.
  285. fmt.Println(err.Error())
  286. return
  287. }
  288. // Pretty-print the response data.
  289. fmt.Println(resp)
  290. }
  291. func ExampleCloudSearch_DescribeAnalysisSchemes() {
  292. svc := cloudsearch.New(nil)
  293. params := &cloudsearch.DescribeAnalysisSchemesInput{
  294. DomainName: aws.String("DomainName"), // Required
  295. AnalysisSchemeNames: []*string{
  296. aws.String("StandardName"), // Required
  297. // More values...
  298. },
  299. Deployed: aws.Bool(true),
  300. }
  301. resp, err := svc.DescribeAnalysisSchemes(params)
  302. if err != nil {
  303. // Print the error, cast err to awserr.Error to get the Code and
  304. // Message from an error.
  305. fmt.Println(err.Error())
  306. return
  307. }
  308. // Pretty-print the response data.
  309. fmt.Println(resp)
  310. }
  311. func ExampleCloudSearch_DescribeAvailabilityOptions() {
  312. svc := cloudsearch.New(nil)
  313. params := &cloudsearch.DescribeAvailabilityOptionsInput{
  314. DomainName: aws.String("DomainName"), // Required
  315. Deployed: aws.Bool(true),
  316. }
  317. resp, err := svc.DescribeAvailabilityOptions(params)
  318. if err != nil {
  319. // Print the error, cast err to awserr.Error to get the Code and
  320. // Message from an error.
  321. fmt.Println(err.Error())
  322. return
  323. }
  324. // Pretty-print the response data.
  325. fmt.Println(resp)
  326. }
  327. func ExampleCloudSearch_DescribeDomains() {
  328. svc := cloudsearch.New(nil)
  329. params := &cloudsearch.DescribeDomainsInput{
  330. DomainNames: []*string{
  331. aws.String("DomainName"), // Required
  332. // More values...
  333. },
  334. }
  335. resp, err := svc.DescribeDomains(params)
  336. if err != nil {
  337. // Print the error, cast err to awserr.Error to get the Code and
  338. // Message from an error.
  339. fmt.Println(err.Error())
  340. return
  341. }
  342. // Pretty-print the response data.
  343. fmt.Println(resp)
  344. }
  345. func ExampleCloudSearch_DescribeExpressions() {
  346. svc := cloudsearch.New(nil)
  347. params := &cloudsearch.DescribeExpressionsInput{
  348. DomainName: aws.String("DomainName"), // Required
  349. Deployed: aws.Bool(true),
  350. ExpressionNames: []*string{
  351. aws.String("StandardName"), // Required
  352. // More values...
  353. },
  354. }
  355. resp, err := svc.DescribeExpressions(params)
  356. if err != nil {
  357. // Print the error, cast err to awserr.Error to get the Code and
  358. // Message from an error.
  359. fmt.Println(err.Error())
  360. return
  361. }
  362. // Pretty-print the response data.
  363. fmt.Println(resp)
  364. }
  365. func ExampleCloudSearch_DescribeIndexFields() {
  366. svc := cloudsearch.New(nil)
  367. params := &cloudsearch.DescribeIndexFieldsInput{
  368. DomainName: aws.String("DomainName"), // Required
  369. Deployed: aws.Bool(true),
  370. FieldNames: []*string{
  371. aws.String("DynamicFieldName"), // Required
  372. // More values...
  373. },
  374. }
  375. resp, err := svc.DescribeIndexFields(params)
  376. if err != nil {
  377. // Print the error, cast err to awserr.Error to get the Code and
  378. // Message from an error.
  379. fmt.Println(err.Error())
  380. return
  381. }
  382. // Pretty-print the response data.
  383. fmt.Println(resp)
  384. }
  385. func ExampleCloudSearch_DescribeScalingParameters() {
  386. svc := cloudsearch.New(nil)
  387. params := &cloudsearch.DescribeScalingParametersInput{
  388. DomainName: aws.String("DomainName"), // Required
  389. }
  390. resp, err := svc.DescribeScalingParameters(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 ExampleCloudSearch_DescribeServiceAccessPolicies() {
  401. svc := cloudsearch.New(nil)
  402. params := &cloudsearch.DescribeServiceAccessPoliciesInput{
  403. DomainName: aws.String("DomainName"), // Required
  404. Deployed: aws.Bool(true),
  405. }
  406. resp, err := svc.DescribeServiceAccessPolicies(params)
  407. if err != nil {
  408. // Print the error, cast err to awserr.Error to get the Code and
  409. // Message from an error.
  410. fmt.Println(err.Error())
  411. return
  412. }
  413. // Pretty-print the response data.
  414. fmt.Println(resp)
  415. }
  416. func ExampleCloudSearch_DescribeSuggesters() {
  417. svc := cloudsearch.New(nil)
  418. params := &cloudsearch.DescribeSuggestersInput{
  419. DomainName: aws.String("DomainName"), // Required
  420. Deployed: aws.Bool(true),
  421. SuggesterNames: []*string{
  422. aws.String("StandardName"), // Required
  423. // More values...
  424. },
  425. }
  426. resp, err := svc.DescribeSuggesters(params)
  427. if err != nil {
  428. // Print the error, cast err to awserr.Error to get the Code and
  429. // Message from an error.
  430. fmt.Println(err.Error())
  431. return
  432. }
  433. // Pretty-print the response data.
  434. fmt.Println(resp)
  435. }
  436. func ExampleCloudSearch_IndexDocuments() {
  437. svc := cloudsearch.New(nil)
  438. params := &cloudsearch.IndexDocumentsInput{
  439. DomainName: aws.String("DomainName"), // Required
  440. }
  441. resp, err := svc.IndexDocuments(params)
  442. if err != nil {
  443. // Print the error, cast err to awserr.Error to get the Code and
  444. // Message from an error.
  445. fmt.Println(err.Error())
  446. return
  447. }
  448. // Pretty-print the response data.
  449. fmt.Println(resp)
  450. }
  451. func ExampleCloudSearch_ListDomainNames() {
  452. svc := cloudsearch.New(nil)
  453. var params *cloudsearch.ListDomainNamesInput
  454. resp, err := svc.ListDomainNames(params)
  455. if err != nil {
  456. // Print the error, cast err to awserr.Error to get the Code and
  457. // Message from an error.
  458. fmt.Println(err.Error())
  459. return
  460. }
  461. // Pretty-print the response data.
  462. fmt.Println(resp)
  463. }
  464. func ExampleCloudSearch_UpdateAvailabilityOptions() {
  465. svc := cloudsearch.New(nil)
  466. params := &cloudsearch.UpdateAvailabilityOptionsInput{
  467. DomainName: aws.String("DomainName"), // Required
  468. MultiAZ: aws.Bool(true), // Required
  469. }
  470. resp, err := svc.UpdateAvailabilityOptions(params)
  471. if err != nil {
  472. // Print the error, cast err to awserr.Error to get the Code and
  473. // Message from an error.
  474. fmt.Println(err.Error())
  475. return
  476. }
  477. // Pretty-print the response data.
  478. fmt.Println(resp)
  479. }
  480. func ExampleCloudSearch_UpdateScalingParameters() {
  481. svc := cloudsearch.New(nil)
  482. params := &cloudsearch.UpdateScalingParametersInput{
  483. DomainName: aws.String("DomainName"), // Required
  484. ScalingParameters: &cloudsearch.ScalingParameters{ // Required
  485. DesiredInstanceType: aws.String("PartitionInstanceType"),
  486. DesiredPartitionCount: aws.Int64(1),
  487. DesiredReplicationCount: aws.Int64(1),
  488. },
  489. }
  490. resp, err := svc.UpdateScalingParameters(params)
  491. if err != nil {
  492. // Print the error, cast err to awserr.Error to get the Code and
  493. // Message from an error.
  494. fmt.Println(err.Error())
  495. return
  496. }
  497. // Pretty-print the response data.
  498. fmt.Println(resp)
  499. }
  500. func ExampleCloudSearch_UpdateServiceAccessPolicies() {
  501. svc := cloudsearch.New(nil)
  502. params := &cloudsearch.UpdateServiceAccessPoliciesInput{
  503. AccessPolicies: aws.String("PolicyDocument"), // Required
  504. DomainName: aws.String("DomainName"), // Required
  505. }
  506. resp, err := svc.UpdateServiceAccessPolicies(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. }