examples_test.go 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package elasticache_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/elasticache"
  10. )
  11. var _ time.Duration
  12. var _ bytes.Buffer
  13. func ExampleElastiCache_AddTagsToResource() {
  14. sess, err := session.NewSession()
  15. if err != nil {
  16. fmt.Println("failed to create session,", err)
  17. return
  18. }
  19. svc := elasticache.New(sess)
  20. params := &elasticache.AddTagsToResourceInput{
  21. ResourceName: aws.String("String"), // Required
  22. Tags: []*elasticache.Tag{ // Required
  23. { // Required
  24. Key: aws.String("String"),
  25. Value: aws.String("String"),
  26. },
  27. // More values...
  28. },
  29. }
  30. resp, err := svc.AddTagsToResource(params)
  31. if err != nil {
  32. // Print the error, cast err to awserr.Error to get the Code and
  33. // Message from an error.
  34. fmt.Println(err.Error())
  35. return
  36. }
  37. // Pretty-print the response data.
  38. fmt.Println(resp)
  39. }
  40. func ExampleElastiCache_AuthorizeCacheSecurityGroupIngress() {
  41. sess, err := session.NewSession()
  42. if err != nil {
  43. fmt.Println("failed to create session,", err)
  44. return
  45. }
  46. svc := elasticache.New(sess)
  47. params := &elasticache.AuthorizeCacheSecurityGroupIngressInput{
  48. CacheSecurityGroupName: aws.String("String"), // Required
  49. EC2SecurityGroupName: aws.String("String"), // Required
  50. EC2SecurityGroupOwnerId: aws.String("String"), // Required
  51. }
  52. resp, err := svc.AuthorizeCacheSecurityGroupIngress(params)
  53. if err != nil {
  54. // Print the error, cast err to awserr.Error to get the Code and
  55. // Message from an error.
  56. fmt.Println(err.Error())
  57. return
  58. }
  59. // Pretty-print the response data.
  60. fmt.Println(resp)
  61. }
  62. func ExampleElastiCache_CopySnapshot() {
  63. sess, err := session.NewSession()
  64. if err != nil {
  65. fmt.Println("failed to create session,", err)
  66. return
  67. }
  68. svc := elasticache.New(sess)
  69. params := &elasticache.CopySnapshotInput{
  70. SourceSnapshotName: aws.String("String"), // Required
  71. TargetSnapshotName: aws.String("String"), // Required
  72. TargetBucket: aws.String("String"),
  73. }
  74. resp, err := svc.CopySnapshot(params)
  75. if err != nil {
  76. // Print the error, cast err to awserr.Error to get the Code and
  77. // Message from an error.
  78. fmt.Println(err.Error())
  79. return
  80. }
  81. // Pretty-print the response data.
  82. fmt.Println(resp)
  83. }
  84. func ExampleElastiCache_CreateCacheCluster() {
  85. sess, err := session.NewSession()
  86. if err != nil {
  87. fmt.Println("failed to create session,", err)
  88. return
  89. }
  90. svc := elasticache.New(sess)
  91. params := &elasticache.CreateCacheClusterInput{
  92. CacheClusterId: aws.String("String"), // Required
  93. AZMode: aws.String("AZMode"),
  94. AutoMinorVersionUpgrade: aws.Bool(true),
  95. CacheNodeType: aws.String("String"),
  96. CacheParameterGroupName: aws.String("String"),
  97. CacheSecurityGroupNames: []*string{
  98. aws.String("String"), // Required
  99. // More values...
  100. },
  101. CacheSubnetGroupName: aws.String("String"),
  102. Engine: aws.String("String"),
  103. EngineVersion: aws.String("String"),
  104. NotificationTopicArn: aws.String("String"),
  105. NumCacheNodes: aws.Int64(1),
  106. Port: aws.Int64(1),
  107. PreferredAvailabilityZone: aws.String("String"),
  108. PreferredAvailabilityZones: []*string{
  109. aws.String("String"), // Required
  110. // More values...
  111. },
  112. PreferredMaintenanceWindow: aws.String("String"),
  113. ReplicationGroupId: aws.String("String"),
  114. SecurityGroupIds: []*string{
  115. aws.String("String"), // Required
  116. // More values...
  117. },
  118. SnapshotArns: []*string{
  119. aws.String("String"), // Required
  120. // More values...
  121. },
  122. SnapshotName: aws.String("String"),
  123. SnapshotRetentionLimit: aws.Int64(1),
  124. SnapshotWindow: aws.String("String"),
  125. Tags: []*elasticache.Tag{
  126. { // Required
  127. Key: aws.String("String"),
  128. Value: aws.String("String"),
  129. },
  130. // More values...
  131. },
  132. }
  133. resp, err := svc.CreateCacheCluster(params)
  134. if err != nil {
  135. // Print the error, cast err to awserr.Error to get the Code and
  136. // Message from an error.
  137. fmt.Println(err.Error())
  138. return
  139. }
  140. // Pretty-print the response data.
  141. fmt.Println(resp)
  142. }
  143. func ExampleElastiCache_CreateCacheParameterGroup() {
  144. sess, err := session.NewSession()
  145. if err != nil {
  146. fmt.Println("failed to create session,", err)
  147. return
  148. }
  149. svc := elasticache.New(sess)
  150. params := &elasticache.CreateCacheParameterGroupInput{
  151. CacheParameterGroupFamily: aws.String("String"), // Required
  152. CacheParameterGroupName: aws.String("String"), // Required
  153. Description: aws.String("String"), // Required
  154. }
  155. resp, err := svc.CreateCacheParameterGroup(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 ExampleElastiCache_CreateCacheSecurityGroup() {
  166. sess, err := session.NewSession()
  167. if err != nil {
  168. fmt.Println("failed to create session,", err)
  169. return
  170. }
  171. svc := elasticache.New(sess)
  172. params := &elasticache.CreateCacheSecurityGroupInput{
  173. CacheSecurityGroupName: aws.String("String"), // Required
  174. Description: aws.String("String"), // Required
  175. }
  176. resp, err := svc.CreateCacheSecurityGroup(params)
  177. if err != nil {
  178. // Print the error, cast err to awserr.Error to get the Code and
  179. // Message from an error.
  180. fmt.Println(err.Error())
  181. return
  182. }
  183. // Pretty-print the response data.
  184. fmt.Println(resp)
  185. }
  186. func ExampleElastiCache_CreateCacheSubnetGroup() {
  187. sess, err := session.NewSession()
  188. if err != nil {
  189. fmt.Println("failed to create session,", err)
  190. return
  191. }
  192. svc := elasticache.New(sess)
  193. params := &elasticache.CreateCacheSubnetGroupInput{
  194. CacheSubnetGroupDescription: aws.String("String"), // Required
  195. CacheSubnetGroupName: aws.String("String"), // Required
  196. SubnetIds: []*string{ // Required
  197. aws.String("String"), // Required
  198. // More values...
  199. },
  200. }
  201. resp, err := svc.CreateCacheSubnetGroup(params)
  202. if err != nil {
  203. // Print the error, cast err to awserr.Error to get the Code and
  204. // Message from an error.
  205. fmt.Println(err.Error())
  206. return
  207. }
  208. // Pretty-print the response data.
  209. fmt.Println(resp)
  210. }
  211. func ExampleElastiCache_CreateReplicationGroup() {
  212. sess, err := session.NewSession()
  213. if err != nil {
  214. fmt.Println("failed to create session,", err)
  215. return
  216. }
  217. svc := elasticache.New(sess)
  218. params := &elasticache.CreateReplicationGroupInput{
  219. ReplicationGroupDescription: aws.String("String"), // Required
  220. ReplicationGroupId: aws.String("String"), // Required
  221. AutoMinorVersionUpgrade: aws.Bool(true),
  222. AutomaticFailoverEnabled: aws.Bool(true),
  223. CacheNodeType: aws.String("String"),
  224. CacheParameterGroupName: aws.String("String"),
  225. CacheSecurityGroupNames: []*string{
  226. aws.String("String"), // Required
  227. // More values...
  228. },
  229. CacheSubnetGroupName: aws.String("String"),
  230. Engine: aws.String("String"),
  231. EngineVersion: aws.String("String"),
  232. NotificationTopicArn: aws.String("String"),
  233. NumCacheClusters: aws.Int64(1),
  234. Port: aws.Int64(1),
  235. PreferredCacheClusterAZs: []*string{
  236. aws.String("String"), // Required
  237. // More values...
  238. },
  239. PreferredMaintenanceWindow: aws.String("String"),
  240. PrimaryClusterId: aws.String("String"),
  241. SecurityGroupIds: []*string{
  242. aws.String("String"), // Required
  243. // More values...
  244. },
  245. SnapshotArns: []*string{
  246. aws.String("String"), // Required
  247. // More values...
  248. },
  249. SnapshotName: aws.String("String"),
  250. SnapshotRetentionLimit: aws.Int64(1),
  251. SnapshotWindow: aws.String("String"),
  252. Tags: []*elasticache.Tag{
  253. { // Required
  254. Key: aws.String("String"),
  255. Value: aws.String("String"),
  256. },
  257. // More values...
  258. },
  259. }
  260. resp, err := svc.CreateReplicationGroup(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 ExampleElastiCache_CreateSnapshot() {
  271. sess, err := session.NewSession()
  272. if err != nil {
  273. fmt.Println("failed to create session,", err)
  274. return
  275. }
  276. svc := elasticache.New(sess)
  277. params := &elasticache.CreateSnapshotInput{
  278. CacheClusterId: aws.String("String"), // Required
  279. SnapshotName: aws.String("String"), // Required
  280. }
  281. resp, err := svc.CreateSnapshot(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 ExampleElastiCache_DeleteCacheCluster() {
  292. sess, err := session.NewSession()
  293. if err != nil {
  294. fmt.Println("failed to create session,", err)
  295. return
  296. }
  297. svc := elasticache.New(sess)
  298. params := &elasticache.DeleteCacheClusterInput{
  299. CacheClusterId: aws.String("String"), // Required
  300. FinalSnapshotIdentifier: aws.String("String"),
  301. }
  302. resp, err := svc.DeleteCacheCluster(params)
  303. if err != nil {
  304. // Print the error, cast err to awserr.Error to get the Code and
  305. // Message from an error.
  306. fmt.Println(err.Error())
  307. return
  308. }
  309. // Pretty-print the response data.
  310. fmt.Println(resp)
  311. }
  312. func ExampleElastiCache_DeleteCacheParameterGroup() {
  313. sess, err := session.NewSession()
  314. if err != nil {
  315. fmt.Println("failed to create session,", err)
  316. return
  317. }
  318. svc := elasticache.New(sess)
  319. params := &elasticache.DeleteCacheParameterGroupInput{
  320. CacheParameterGroupName: aws.String("String"), // Required
  321. }
  322. resp, err := svc.DeleteCacheParameterGroup(params)
  323. if err != nil {
  324. // Print the error, cast err to awserr.Error to get the Code and
  325. // Message from an error.
  326. fmt.Println(err.Error())
  327. return
  328. }
  329. // Pretty-print the response data.
  330. fmt.Println(resp)
  331. }
  332. func ExampleElastiCache_DeleteCacheSecurityGroup() {
  333. sess, err := session.NewSession()
  334. if err != nil {
  335. fmt.Println("failed to create session,", err)
  336. return
  337. }
  338. svc := elasticache.New(sess)
  339. params := &elasticache.DeleteCacheSecurityGroupInput{
  340. CacheSecurityGroupName: aws.String("String"), // Required
  341. }
  342. resp, err := svc.DeleteCacheSecurityGroup(params)
  343. if err != nil {
  344. // Print the error, cast err to awserr.Error to get the Code and
  345. // Message from an error.
  346. fmt.Println(err.Error())
  347. return
  348. }
  349. // Pretty-print the response data.
  350. fmt.Println(resp)
  351. }
  352. func ExampleElastiCache_DeleteCacheSubnetGroup() {
  353. sess, err := session.NewSession()
  354. if err != nil {
  355. fmt.Println("failed to create session,", err)
  356. return
  357. }
  358. svc := elasticache.New(sess)
  359. params := &elasticache.DeleteCacheSubnetGroupInput{
  360. CacheSubnetGroupName: aws.String("String"), // Required
  361. }
  362. resp, err := svc.DeleteCacheSubnetGroup(params)
  363. if err != nil {
  364. // Print the error, cast err to awserr.Error to get the Code and
  365. // Message from an error.
  366. fmt.Println(err.Error())
  367. return
  368. }
  369. // Pretty-print the response data.
  370. fmt.Println(resp)
  371. }
  372. func ExampleElastiCache_DeleteReplicationGroup() {
  373. sess, err := session.NewSession()
  374. if err != nil {
  375. fmt.Println("failed to create session,", err)
  376. return
  377. }
  378. svc := elasticache.New(sess)
  379. params := &elasticache.DeleteReplicationGroupInput{
  380. ReplicationGroupId: aws.String("String"), // Required
  381. FinalSnapshotIdentifier: aws.String("String"),
  382. RetainPrimaryCluster: aws.Bool(true),
  383. }
  384. resp, err := svc.DeleteReplicationGroup(params)
  385. if err != nil {
  386. // Print the error, cast err to awserr.Error to get the Code and
  387. // Message from an error.
  388. fmt.Println(err.Error())
  389. return
  390. }
  391. // Pretty-print the response data.
  392. fmt.Println(resp)
  393. }
  394. func ExampleElastiCache_DeleteSnapshot() {
  395. sess, err := session.NewSession()
  396. if err != nil {
  397. fmt.Println("failed to create session,", err)
  398. return
  399. }
  400. svc := elasticache.New(sess)
  401. params := &elasticache.DeleteSnapshotInput{
  402. SnapshotName: aws.String("String"), // Required
  403. }
  404. resp, err := svc.DeleteSnapshot(params)
  405. if err != nil {
  406. // Print the error, cast err to awserr.Error to get the Code and
  407. // Message from an error.
  408. fmt.Println(err.Error())
  409. return
  410. }
  411. // Pretty-print the response data.
  412. fmt.Println(resp)
  413. }
  414. func ExampleElastiCache_DescribeCacheClusters() {
  415. sess, err := session.NewSession()
  416. if err != nil {
  417. fmt.Println("failed to create session,", err)
  418. return
  419. }
  420. svc := elasticache.New(sess)
  421. params := &elasticache.DescribeCacheClustersInput{
  422. CacheClusterId: aws.String("String"),
  423. Marker: aws.String("String"),
  424. MaxRecords: aws.Int64(1),
  425. ShowCacheNodeInfo: aws.Bool(true),
  426. }
  427. resp, err := svc.DescribeCacheClusters(params)
  428. if err != nil {
  429. // Print the error, cast err to awserr.Error to get the Code and
  430. // Message from an error.
  431. fmt.Println(err.Error())
  432. return
  433. }
  434. // Pretty-print the response data.
  435. fmt.Println(resp)
  436. }
  437. func ExampleElastiCache_DescribeCacheEngineVersions() {
  438. sess, err := session.NewSession()
  439. if err != nil {
  440. fmt.Println("failed to create session,", err)
  441. return
  442. }
  443. svc := elasticache.New(sess)
  444. params := &elasticache.DescribeCacheEngineVersionsInput{
  445. CacheParameterGroupFamily: aws.String("String"),
  446. DefaultOnly: aws.Bool(true),
  447. Engine: aws.String("String"),
  448. EngineVersion: aws.String("String"),
  449. Marker: aws.String("String"),
  450. MaxRecords: aws.Int64(1),
  451. }
  452. resp, err := svc.DescribeCacheEngineVersions(params)
  453. if err != nil {
  454. // Print the error, cast err to awserr.Error to get the Code and
  455. // Message from an error.
  456. fmt.Println(err.Error())
  457. return
  458. }
  459. // Pretty-print the response data.
  460. fmt.Println(resp)
  461. }
  462. func ExampleElastiCache_DescribeCacheParameterGroups() {
  463. sess, err := session.NewSession()
  464. if err != nil {
  465. fmt.Println("failed to create session,", err)
  466. return
  467. }
  468. svc := elasticache.New(sess)
  469. params := &elasticache.DescribeCacheParameterGroupsInput{
  470. CacheParameterGroupName: aws.String("String"),
  471. Marker: aws.String("String"),
  472. MaxRecords: aws.Int64(1),
  473. }
  474. resp, err := svc.DescribeCacheParameterGroups(params)
  475. if err != nil {
  476. // Print the error, cast err to awserr.Error to get the Code and
  477. // Message from an error.
  478. fmt.Println(err.Error())
  479. return
  480. }
  481. // Pretty-print the response data.
  482. fmt.Println(resp)
  483. }
  484. func ExampleElastiCache_DescribeCacheParameters() {
  485. sess, err := session.NewSession()
  486. if err != nil {
  487. fmt.Println("failed to create session,", err)
  488. return
  489. }
  490. svc := elasticache.New(sess)
  491. params := &elasticache.DescribeCacheParametersInput{
  492. CacheParameterGroupName: aws.String("String"), // Required
  493. Marker: aws.String("String"),
  494. MaxRecords: aws.Int64(1),
  495. Source: aws.String("String"),
  496. }
  497. resp, err := svc.DescribeCacheParameters(params)
  498. if err != nil {
  499. // Print the error, cast err to awserr.Error to get the Code and
  500. // Message from an error.
  501. fmt.Println(err.Error())
  502. return
  503. }
  504. // Pretty-print the response data.
  505. fmt.Println(resp)
  506. }
  507. func ExampleElastiCache_DescribeCacheSecurityGroups() {
  508. sess, err := session.NewSession()
  509. if err != nil {
  510. fmt.Println("failed to create session,", err)
  511. return
  512. }
  513. svc := elasticache.New(sess)
  514. params := &elasticache.DescribeCacheSecurityGroupsInput{
  515. CacheSecurityGroupName: aws.String("String"),
  516. Marker: aws.String("String"),
  517. MaxRecords: aws.Int64(1),
  518. }
  519. resp, err := svc.DescribeCacheSecurityGroups(params)
  520. if err != nil {
  521. // Print the error, cast err to awserr.Error to get the Code and
  522. // Message from an error.
  523. fmt.Println(err.Error())
  524. return
  525. }
  526. // Pretty-print the response data.
  527. fmt.Println(resp)
  528. }
  529. func ExampleElastiCache_DescribeCacheSubnetGroups() {
  530. sess, err := session.NewSession()
  531. if err != nil {
  532. fmt.Println("failed to create session,", err)
  533. return
  534. }
  535. svc := elasticache.New(sess)
  536. params := &elasticache.DescribeCacheSubnetGroupsInput{
  537. CacheSubnetGroupName: aws.String("String"),
  538. Marker: aws.String("String"),
  539. MaxRecords: aws.Int64(1),
  540. }
  541. resp, err := svc.DescribeCacheSubnetGroups(params)
  542. if err != nil {
  543. // Print the error, cast err to awserr.Error to get the Code and
  544. // Message from an error.
  545. fmt.Println(err.Error())
  546. return
  547. }
  548. // Pretty-print the response data.
  549. fmt.Println(resp)
  550. }
  551. func ExampleElastiCache_DescribeEngineDefaultParameters() {
  552. sess, err := session.NewSession()
  553. if err != nil {
  554. fmt.Println("failed to create session,", err)
  555. return
  556. }
  557. svc := elasticache.New(sess)
  558. params := &elasticache.DescribeEngineDefaultParametersInput{
  559. CacheParameterGroupFamily: aws.String("String"), // Required
  560. Marker: aws.String("String"),
  561. MaxRecords: aws.Int64(1),
  562. }
  563. resp, err := svc.DescribeEngineDefaultParameters(params)
  564. if err != nil {
  565. // Print the error, cast err to awserr.Error to get the Code and
  566. // Message from an error.
  567. fmt.Println(err.Error())
  568. return
  569. }
  570. // Pretty-print the response data.
  571. fmt.Println(resp)
  572. }
  573. func ExampleElastiCache_DescribeEvents() {
  574. sess, err := session.NewSession()
  575. if err != nil {
  576. fmt.Println("failed to create session,", err)
  577. return
  578. }
  579. svc := elasticache.New(sess)
  580. params := &elasticache.DescribeEventsInput{
  581. Duration: aws.Int64(1),
  582. EndTime: aws.Time(time.Now()),
  583. Marker: aws.String("String"),
  584. MaxRecords: aws.Int64(1),
  585. SourceIdentifier: aws.String("String"),
  586. SourceType: aws.String("SourceType"),
  587. StartTime: aws.Time(time.Now()),
  588. }
  589. resp, err := svc.DescribeEvents(params)
  590. if err != nil {
  591. // Print the error, cast err to awserr.Error to get the Code and
  592. // Message from an error.
  593. fmt.Println(err.Error())
  594. return
  595. }
  596. // Pretty-print the response data.
  597. fmt.Println(resp)
  598. }
  599. func ExampleElastiCache_DescribeReplicationGroups() {
  600. sess, err := session.NewSession()
  601. if err != nil {
  602. fmt.Println("failed to create session,", err)
  603. return
  604. }
  605. svc := elasticache.New(sess)
  606. params := &elasticache.DescribeReplicationGroupsInput{
  607. Marker: aws.String("String"),
  608. MaxRecords: aws.Int64(1),
  609. ReplicationGroupId: aws.String("String"),
  610. }
  611. resp, err := svc.DescribeReplicationGroups(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 ExampleElastiCache_DescribeReservedCacheNodes() {
  622. sess, err := session.NewSession()
  623. if err != nil {
  624. fmt.Println("failed to create session,", err)
  625. return
  626. }
  627. svc := elasticache.New(sess)
  628. params := &elasticache.DescribeReservedCacheNodesInput{
  629. CacheNodeType: aws.String("String"),
  630. Duration: aws.String("String"),
  631. Marker: aws.String("String"),
  632. MaxRecords: aws.Int64(1),
  633. OfferingType: aws.String("String"),
  634. ProductDescription: aws.String("String"),
  635. ReservedCacheNodeId: aws.String("String"),
  636. ReservedCacheNodesOfferingId: aws.String("String"),
  637. }
  638. resp, err := svc.DescribeReservedCacheNodes(params)
  639. if err != nil {
  640. // Print the error, cast err to awserr.Error to get the Code and
  641. // Message from an error.
  642. fmt.Println(err.Error())
  643. return
  644. }
  645. // Pretty-print the response data.
  646. fmt.Println(resp)
  647. }
  648. func ExampleElastiCache_DescribeReservedCacheNodesOfferings() {
  649. sess, err := session.NewSession()
  650. if err != nil {
  651. fmt.Println("failed to create session,", err)
  652. return
  653. }
  654. svc := elasticache.New(sess)
  655. params := &elasticache.DescribeReservedCacheNodesOfferingsInput{
  656. CacheNodeType: aws.String("String"),
  657. Duration: aws.String("String"),
  658. Marker: aws.String("String"),
  659. MaxRecords: aws.Int64(1),
  660. OfferingType: aws.String("String"),
  661. ProductDescription: aws.String("String"),
  662. ReservedCacheNodesOfferingId: aws.String("String"),
  663. }
  664. resp, err := svc.DescribeReservedCacheNodesOfferings(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 ExampleElastiCache_DescribeSnapshots() {
  675. sess, err := session.NewSession()
  676. if err != nil {
  677. fmt.Println("failed to create session,", err)
  678. return
  679. }
  680. svc := elasticache.New(sess)
  681. params := &elasticache.DescribeSnapshotsInput{
  682. CacheClusterId: aws.String("String"),
  683. Marker: aws.String("String"),
  684. MaxRecords: aws.Int64(1),
  685. SnapshotName: aws.String("String"),
  686. SnapshotSource: aws.String("String"),
  687. }
  688. resp, err := svc.DescribeSnapshots(params)
  689. if err != nil {
  690. // Print the error, cast err to awserr.Error to get the Code and
  691. // Message from an error.
  692. fmt.Println(err.Error())
  693. return
  694. }
  695. // Pretty-print the response data.
  696. fmt.Println(resp)
  697. }
  698. func ExampleElastiCache_ListAllowedNodeTypeModifications() {
  699. sess, err := session.NewSession()
  700. if err != nil {
  701. fmt.Println("failed to create session,", err)
  702. return
  703. }
  704. svc := elasticache.New(sess)
  705. params := &elasticache.ListAllowedNodeTypeModificationsInput{
  706. CacheClusterId: aws.String("String"),
  707. ReplicationGroupId: aws.String("String"),
  708. }
  709. resp, err := svc.ListAllowedNodeTypeModifications(params)
  710. if err != nil {
  711. // Print the error, cast err to awserr.Error to get the Code and
  712. // Message from an error.
  713. fmt.Println(err.Error())
  714. return
  715. }
  716. // Pretty-print the response data.
  717. fmt.Println(resp)
  718. }
  719. func ExampleElastiCache_ListTagsForResource() {
  720. sess, err := session.NewSession()
  721. if err != nil {
  722. fmt.Println("failed to create session,", err)
  723. return
  724. }
  725. svc := elasticache.New(sess)
  726. params := &elasticache.ListTagsForResourceInput{
  727. ResourceName: aws.String("String"), // Required
  728. }
  729. resp, err := svc.ListTagsForResource(params)
  730. if err != nil {
  731. // Print the error, cast err to awserr.Error to get the Code and
  732. // Message from an error.
  733. fmt.Println(err.Error())
  734. return
  735. }
  736. // Pretty-print the response data.
  737. fmt.Println(resp)
  738. }
  739. func ExampleElastiCache_ModifyCacheCluster() {
  740. sess, err := session.NewSession()
  741. if err != nil {
  742. fmt.Println("failed to create session,", err)
  743. return
  744. }
  745. svc := elasticache.New(sess)
  746. params := &elasticache.ModifyCacheClusterInput{
  747. CacheClusterId: aws.String("String"), // Required
  748. AZMode: aws.String("AZMode"),
  749. ApplyImmediately: aws.Bool(true),
  750. AutoMinorVersionUpgrade: aws.Bool(true),
  751. CacheNodeIdsToRemove: []*string{
  752. aws.String("String"), // Required
  753. // More values...
  754. },
  755. CacheNodeType: aws.String("String"),
  756. CacheParameterGroupName: aws.String("String"),
  757. CacheSecurityGroupNames: []*string{
  758. aws.String("String"), // Required
  759. // More values...
  760. },
  761. EngineVersion: aws.String("String"),
  762. NewAvailabilityZones: []*string{
  763. aws.String("String"), // Required
  764. // More values...
  765. },
  766. NotificationTopicArn: aws.String("String"),
  767. NotificationTopicStatus: aws.String("String"),
  768. NumCacheNodes: aws.Int64(1),
  769. PreferredMaintenanceWindow: aws.String("String"),
  770. SecurityGroupIds: []*string{
  771. aws.String("String"), // Required
  772. // More values...
  773. },
  774. SnapshotRetentionLimit: aws.Int64(1),
  775. SnapshotWindow: aws.String("String"),
  776. }
  777. resp, err := svc.ModifyCacheCluster(params)
  778. if err != nil {
  779. // Print the error, cast err to awserr.Error to get the Code and
  780. // Message from an error.
  781. fmt.Println(err.Error())
  782. return
  783. }
  784. // Pretty-print the response data.
  785. fmt.Println(resp)
  786. }
  787. func ExampleElastiCache_ModifyCacheParameterGroup() {
  788. sess, err := session.NewSession()
  789. if err != nil {
  790. fmt.Println("failed to create session,", err)
  791. return
  792. }
  793. svc := elasticache.New(sess)
  794. params := &elasticache.ModifyCacheParameterGroupInput{
  795. CacheParameterGroupName: aws.String("String"), // Required
  796. ParameterNameValues: []*elasticache.ParameterNameValue{ // Required
  797. { // Required
  798. ParameterName: aws.String("String"),
  799. ParameterValue: aws.String("String"),
  800. },
  801. // More values...
  802. },
  803. }
  804. resp, err := svc.ModifyCacheParameterGroup(params)
  805. if err != nil {
  806. // Print the error, cast err to awserr.Error to get the Code and
  807. // Message from an error.
  808. fmt.Println(err.Error())
  809. return
  810. }
  811. // Pretty-print the response data.
  812. fmt.Println(resp)
  813. }
  814. func ExampleElastiCache_ModifyCacheSubnetGroup() {
  815. sess, err := session.NewSession()
  816. if err != nil {
  817. fmt.Println("failed to create session,", err)
  818. return
  819. }
  820. svc := elasticache.New(sess)
  821. params := &elasticache.ModifyCacheSubnetGroupInput{
  822. CacheSubnetGroupName: aws.String("String"), // Required
  823. CacheSubnetGroupDescription: aws.String("String"),
  824. SubnetIds: []*string{
  825. aws.String("String"), // Required
  826. // More values...
  827. },
  828. }
  829. resp, err := svc.ModifyCacheSubnetGroup(params)
  830. if err != nil {
  831. // Print the error, cast err to awserr.Error to get the Code and
  832. // Message from an error.
  833. fmt.Println(err.Error())
  834. return
  835. }
  836. // Pretty-print the response data.
  837. fmt.Println(resp)
  838. }
  839. func ExampleElastiCache_ModifyReplicationGroup() {
  840. sess, err := session.NewSession()
  841. if err != nil {
  842. fmt.Println("failed to create session,", err)
  843. return
  844. }
  845. svc := elasticache.New(sess)
  846. params := &elasticache.ModifyReplicationGroupInput{
  847. ReplicationGroupId: aws.String("String"), // Required
  848. ApplyImmediately: aws.Bool(true),
  849. AutoMinorVersionUpgrade: aws.Bool(true),
  850. AutomaticFailoverEnabled: aws.Bool(true),
  851. CacheNodeType: aws.String("String"),
  852. CacheParameterGroupName: aws.String("String"),
  853. CacheSecurityGroupNames: []*string{
  854. aws.String("String"), // Required
  855. // More values...
  856. },
  857. EngineVersion: aws.String("String"),
  858. NotificationTopicArn: aws.String("String"),
  859. NotificationTopicStatus: aws.String("String"),
  860. PreferredMaintenanceWindow: aws.String("String"),
  861. PrimaryClusterId: aws.String("String"),
  862. ReplicationGroupDescription: aws.String("String"),
  863. SecurityGroupIds: []*string{
  864. aws.String("String"), // Required
  865. // More values...
  866. },
  867. SnapshotRetentionLimit: aws.Int64(1),
  868. SnapshotWindow: aws.String("String"),
  869. SnapshottingClusterId: aws.String("String"),
  870. }
  871. resp, err := svc.ModifyReplicationGroup(params)
  872. if err != nil {
  873. // Print the error, cast err to awserr.Error to get the Code and
  874. // Message from an error.
  875. fmt.Println(err.Error())
  876. return
  877. }
  878. // Pretty-print the response data.
  879. fmt.Println(resp)
  880. }
  881. func ExampleElastiCache_PurchaseReservedCacheNodesOffering() {
  882. sess, err := session.NewSession()
  883. if err != nil {
  884. fmt.Println("failed to create session,", err)
  885. return
  886. }
  887. svc := elasticache.New(sess)
  888. params := &elasticache.PurchaseReservedCacheNodesOfferingInput{
  889. ReservedCacheNodesOfferingId: aws.String("String"), // Required
  890. CacheNodeCount: aws.Int64(1),
  891. ReservedCacheNodeId: aws.String("String"),
  892. }
  893. resp, err := svc.PurchaseReservedCacheNodesOffering(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 ExampleElastiCache_RebootCacheCluster() {
  904. sess, err := session.NewSession()
  905. if err != nil {
  906. fmt.Println("failed to create session,", err)
  907. return
  908. }
  909. svc := elasticache.New(sess)
  910. params := &elasticache.RebootCacheClusterInput{
  911. CacheClusterId: aws.String("String"), // Required
  912. CacheNodeIdsToReboot: []*string{ // Required
  913. aws.String("String"), // Required
  914. // More values...
  915. },
  916. }
  917. resp, err := svc.RebootCacheCluster(params)
  918. if err != nil {
  919. // Print the error, cast err to awserr.Error to get the Code and
  920. // Message from an error.
  921. fmt.Println(err.Error())
  922. return
  923. }
  924. // Pretty-print the response data.
  925. fmt.Println(resp)
  926. }
  927. func ExampleElastiCache_RemoveTagsFromResource() {
  928. sess, err := session.NewSession()
  929. if err != nil {
  930. fmt.Println("failed to create session,", err)
  931. return
  932. }
  933. svc := elasticache.New(sess)
  934. params := &elasticache.RemoveTagsFromResourceInput{
  935. ResourceName: aws.String("String"), // Required
  936. TagKeys: []*string{ // Required
  937. aws.String("String"), // Required
  938. // More values...
  939. },
  940. }
  941. resp, err := svc.RemoveTagsFromResource(params)
  942. if err != nil {
  943. // Print the error, cast err to awserr.Error to get the Code and
  944. // Message from an error.
  945. fmt.Println(err.Error())
  946. return
  947. }
  948. // Pretty-print the response data.
  949. fmt.Println(resp)
  950. }
  951. func ExampleElastiCache_ResetCacheParameterGroup() {
  952. sess, err := session.NewSession()
  953. if err != nil {
  954. fmt.Println("failed to create session,", err)
  955. return
  956. }
  957. svc := elasticache.New(sess)
  958. params := &elasticache.ResetCacheParameterGroupInput{
  959. CacheParameterGroupName: aws.String("String"), // Required
  960. ParameterNameValues: []*elasticache.ParameterNameValue{
  961. { // Required
  962. ParameterName: aws.String("String"),
  963. ParameterValue: aws.String("String"),
  964. },
  965. // More values...
  966. },
  967. ResetAllParameters: aws.Bool(true),
  968. }
  969. resp, err := svc.ResetCacheParameterGroup(params)
  970. if err != nil {
  971. // Print the error, cast err to awserr.Error to get the Code and
  972. // Message from an error.
  973. fmt.Println(err.Error())
  974. return
  975. }
  976. // Pretty-print the response data.
  977. fmt.Println(resp)
  978. }
  979. func ExampleElastiCache_RevokeCacheSecurityGroupIngress() {
  980. sess, err := session.NewSession()
  981. if err != nil {
  982. fmt.Println("failed to create session,", err)
  983. return
  984. }
  985. svc := elasticache.New(sess)
  986. params := &elasticache.RevokeCacheSecurityGroupIngressInput{
  987. CacheSecurityGroupName: aws.String("String"), // Required
  988. EC2SecurityGroupName: aws.String("String"), // Required
  989. EC2SecurityGroupOwnerId: aws.String("String"), // Required
  990. }
  991. resp, err := svc.RevokeCacheSecurityGroupIngress(params)
  992. if err != nil {
  993. // Print the error, cast err to awserr.Error to get the Code and
  994. // Message from an error.
  995. fmt.Println(err.Error())
  996. return
  997. }
  998. // Pretty-print the response data.
  999. fmt.Println(resp)
  1000. }