examples_test.go 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211
  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. NodeGroupConfiguration: []*elasticache.NodeGroupConfiguration{
  233. { // Required
  234. PrimaryAvailabilityZone: aws.String("String"),
  235. ReplicaAvailabilityZones: []*string{
  236. aws.String("String"), // Required
  237. // More values...
  238. },
  239. ReplicaCount: aws.Int64(1),
  240. Slots: aws.String("String"),
  241. },
  242. // More values...
  243. },
  244. NotificationTopicArn: aws.String("String"),
  245. NumCacheClusters: aws.Int64(1),
  246. NumNodeGroups: aws.Int64(1),
  247. Port: aws.Int64(1),
  248. PreferredCacheClusterAZs: []*string{
  249. aws.String("String"), // Required
  250. // More values...
  251. },
  252. PreferredMaintenanceWindow: aws.String("String"),
  253. PrimaryClusterId: aws.String("String"),
  254. ReplicasPerNodeGroup: aws.Int64(1),
  255. SecurityGroupIds: []*string{
  256. aws.String("String"), // Required
  257. // More values...
  258. },
  259. SnapshotArns: []*string{
  260. aws.String("String"), // Required
  261. // More values...
  262. },
  263. SnapshotName: aws.String("String"),
  264. SnapshotRetentionLimit: aws.Int64(1),
  265. SnapshotWindow: aws.String("String"),
  266. Tags: []*elasticache.Tag{
  267. { // Required
  268. Key: aws.String("String"),
  269. Value: aws.String("String"),
  270. },
  271. // More values...
  272. },
  273. }
  274. resp, err := svc.CreateReplicationGroup(params)
  275. if err != nil {
  276. // Print the error, cast err to awserr.Error to get the Code and
  277. // Message from an error.
  278. fmt.Println(err.Error())
  279. return
  280. }
  281. // Pretty-print the response data.
  282. fmt.Println(resp)
  283. }
  284. func ExampleElastiCache_CreateSnapshot() {
  285. sess, err := session.NewSession()
  286. if err != nil {
  287. fmt.Println("failed to create session,", err)
  288. return
  289. }
  290. svc := elasticache.New(sess)
  291. params := &elasticache.CreateSnapshotInput{
  292. SnapshotName: aws.String("String"), // Required
  293. CacheClusterId: aws.String("String"),
  294. ReplicationGroupId: aws.String("String"),
  295. }
  296. resp, err := svc.CreateSnapshot(params)
  297. if err != nil {
  298. // Print the error, cast err to awserr.Error to get the Code and
  299. // Message from an error.
  300. fmt.Println(err.Error())
  301. return
  302. }
  303. // Pretty-print the response data.
  304. fmt.Println(resp)
  305. }
  306. func ExampleElastiCache_DeleteCacheCluster() {
  307. sess, err := session.NewSession()
  308. if err != nil {
  309. fmt.Println("failed to create session,", err)
  310. return
  311. }
  312. svc := elasticache.New(sess)
  313. params := &elasticache.DeleteCacheClusterInput{
  314. CacheClusterId: aws.String("String"), // Required
  315. FinalSnapshotIdentifier: aws.String("String"),
  316. }
  317. resp, err := svc.DeleteCacheCluster(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 ExampleElastiCache_DeleteCacheParameterGroup() {
  328. sess, err := session.NewSession()
  329. if err != nil {
  330. fmt.Println("failed to create session,", err)
  331. return
  332. }
  333. svc := elasticache.New(sess)
  334. params := &elasticache.DeleteCacheParameterGroupInput{
  335. CacheParameterGroupName: aws.String("String"), // Required
  336. }
  337. resp, err := svc.DeleteCacheParameterGroup(params)
  338. if err != nil {
  339. // Print the error, cast err to awserr.Error to get the Code and
  340. // Message from an error.
  341. fmt.Println(err.Error())
  342. return
  343. }
  344. // Pretty-print the response data.
  345. fmt.Println(resp)
  346. }
  347. func ExampleElastiCache_DeleteCacheSecurityGroup() {
  348. sess, err := session.NewSession()
  349. if err != nil {
  350. fmt.Println("failed to create session,", err)
  351. return
  352. }
  353. svc := elasticache.New(sess)
  354. params := &elasticache.DeleteCacheSecurityGroupInput{
  355. CacheSecurityGroupName: aws.String("String"), // Required
  356. }
  357. resp, err := svc.DeleteCacheSecurityGroup(params)
  358. if err != nil {
  359. // Print the error, cast err to awserr.Error to get the Code and
  360. // Message from an error.
  361. fmt.Println(err.Error())
  362. return
  363. }
  364. // Pretty-print the response data.
  365. fmt.Println(resp)
  366. }
  367. func ExampleElastiCache_DeleteCacheSubnetGroup() {
  368. sess, err := session.NewSession()
  369. if err != nil {
  370. fmt.Println("failed to create session,", err)
  371. return
  372. }
  373. svc := elasticache.New(sess)
  374. params := &elasticache.DeleteCacheSubnetGroupInput{
  375. CacheSubnetGroupName: aws.String("String"), // Required
  376. }
  377. resp, err := svc.DeleteCacheSubnetGroup(params)
  378. if err != nil {
  379. // Print the error, cast err to awserr.Error to get the Code and
  380. // Message from an error.
  381. fmt.Println(err.Error())
  382. return
  383. }
  384. // Pretty-print the response data.
  385. fmt.Println(resp)
  386. }
  387. func ExampleElastiCache_DeleteReplicationGroup() {
  388. sess, err := session.NewSession()
  389. if err != nil {
  390. fmt.Println("failed to create session,", err)
  391. return
  392. }
  393. svc := elasticache.New(sess)
  394. params := &elasticache.DeleteReplicationGroupInput{
  395. ReplicationGroupId: aws.String("String"), // Required
  396. FinalSnapshotIdentifier: aws.String("String"),
  397. RetainPrimaryCluster: aws.Bool(true),
  398. }
  399. resp, err := svc.DeleteReplicationGroup(params)
  400. if err != nil {
  401. // Print the error, cast err to awserr.Error to get the Code and
  402. // Message from an error.
  403. fmt.Println(err.Error())
  404. return
  405. }
  406. // Pretty-print the response data.
  407. fmt.Println(resp)
  408. }
  409. func ExampleElastiCache_DeleteSnapshot() {
  410. sess, err := session.NewSession()
  411. if err != nil {
  412. fmt.Println("failed to create session,", err)
  413. return
  414. }
  415. svc := elasticache.New(sess)
  416. params := &elasticache.DeleteSnapshotInput{
  417. SnapshotName: aws.String("String"), // Required
  418. }
  419. resp, err := svc.DeleteSnapshot(params)
  420. if err != nil {
  421. // Print the error, cast err to awserr.Error to get the Code and
  422. // Message from an error.
  423. fmt.Println(err.Error())
  424. return
  425. }
  426. // Pretty-print the response data.
  427. fmt.Println(resp)
  428. }
  429. func ExampleElastiCache_DescribeCacheClusters() {
  430. sess, err := session.NewSession()
  431. if err != nil {
  432. fmt.Println("failed to create session,", err)
  433. return
  434. }
  435. svc := elasticache.New(sess)
  436. params := &elasticache.DescribeCacheClustersInput{
  437. CacheClusterId: aws.String("String"),
  438. Marker: aws.String("String"),
  439. MaxRecords: aws.Int64(1),
  440. ShowCacheNodeInfo: aws.Bool(true),
  441. }
  442. resp, err := svc.DescribeCacheClusters(params)
  443. if err != nil {
  444. // Print the error, cast err to awserr.Error to get the Code and
  445. // Message from an error.
  446. fmt.Println(err.Error())
  447. return
  448. }
  449. // Pretty-print the response data.
  450. fmt.Println(resp)
  451. }
  452. func ExampleElastiCache_DescribeCacheEngineVersions() {
  453. sess, err := session.NewSession()
  454. if err != nil {
  455. fmt.Println("failed to create session,", err)
  456. return
  457. }
  458. svc := elasticache.New(sess)
  459. params := &elasticache.DescribeCacheEngineVersionsInput{
  460. CacheParameterGroupFamily: aws.String("String"),
  461. DefaultOnly: aws.Bool(true),
  462. Engine: aws.String("String"),
  463. EngineVersion: aws.String("String"),
  464. Marker: aws.String("String"),
  465. MaxRecords: aws.Int64(1),
  466. }
  467. resp, err := svc.DescribeCacheEngineVersions(params)
  468. if err != nil {
  469. // Print the error, cast err to awserr.Error to get the Code and
  470. // Message from an error.
  471. fmt.Println(err.Error())
  472. return
  473. }
  474. // Pretty-print the response data.
  475. fmt.Println(resp)
  476. }
  477. func ExampleElastiCache_DescribeCacheParameterGroups() {
  478. sess, err := session.NewSession()
  479. if err != nil {
  480. fmt.Println("failed to create session,", err)
  481. return
  482. }
  483. svc := elasticache.New(sess)
  484. params := &elasticache.DescribeCacheParameterGroupsInput{
  485. CacheParameterGroupName: aws.String("String"),
  486. Marker: aws.String("String"),
  487. MaxRecords: aws.Int64(1),
  488. }
  489. resp, err := svc.DescribeCacheParameterGroups(params)
  490. if err != nil {
  491. // Print the error, cast err to awserr.Error to get the Code and
  492. // Message from an error.
  493. fmt.Println(err.Error())
  494. return
  495. }
  496. // Pretty-print the response data.
  497. fmt.Println(resp)
  498. }
  499. func ExampleElastiCache_DescribeCacheParameters() {
  500. sess, err := session.NewSession()
  501. if err != nil {
  502. fmt.Println("failed to create session,", err)
  503. return
  504. }
  505. svc := elasticache.New(sess)
  506. params := &elasticache.DescribeCacheParametersInput{
  507. CacheParameterGroupName: aws.String("String"), // Required
  508. Marker: aws.String("String"),
  509. MaxRecords: aws.Int64(1),
  510. Source: aws.String("String"),
  511. }
  512. resp, err := svc.DescribeCacheParameters(params)
  513. if err != nil {
  514. // Print the error, cast err to awserr.Error to get the Code and
  515. // Message from an error.
  516. fmt.Println(err.Error())
  517. return
  518. }
  519. // Pretty-print the response data.
  520. fmt.Println(resp)
  521. }
  522. func ExampleElastiCache_DescribeCacheSecurityGroups() {
  523. sess, err := session.NewSession()
  524. if err != nil {
  525. fmt.Println("failed to create session,", err)
  526. return
  527. }
  528. svc := elasticache.New(sess)
  529. params := &elasticache.DescribeCacheSecurityGroupsInput{
  530. CacheSecurityGroupName: aws.String("String"),
  531. Marker: aws.String("String"),
  532. MaxRecords: aws.Int64(1),
  533. }
  534. resp, err := svc.DescribeCacheSecurityGroups(params)
  535. if err != nil {
  536. // Print the error, cast err to awserr.Error to get the Code and
  537. // Message from an error.
  538. fmt.Println(err.Error())
  539. return
  540. }
  541. // Pretty-print the response data.
  542. fmt.Println(resp)
  543. }
  544. func ExampleElastiCache_DescribeCacheSubnetGroups() {
  545. sess, err := session.NewSession()
  546. if err != nil {
  547. fmt.Println("failed to create session,", err)
  548. return
  549. }
  550. svc := elasticache.New(sess)
  551. params := &elasticache.DescribeCacheSubnetGroupsInput{
  552. CacheSubnetGroupName: aws.String("String"),
  553. Marker: aws.String("String"),
  554. MaxRecords: aws.Int64(1),
  555. }
  556. resp, err := svc.DescribeCacheSubnetGroups(params)
  557. if err != nil {
  558. // Print the error, cast err to awserr.Error to get the Code and
  559. // Message from an error.
  560. fmt.Println(err.Error())
  561. return
  562. }
  563. // Pretty-print the response data.
  564. fmt.Println(resp)
  565. }
  566. func ExampleElastiCache_DescribeEngineDefaultParameters() {
  567. sess, err := session.NewSession()
  568. if err != nil {
  569. fmt.Println("failed to create session,", err)
  570. return
  571. }
  572. svc := elasticache.New(sess)
  573. params := &elasticache.DescribeEngineDefaultParametersInput{
  574. CacheParameterGroupFamily: aws.String("String"), // Required
  575. Marker: aws.String("String"),
  576. MaxRecords: aws.Int64(1),
  577. }
  578. resp, err := svc.DescribeEngineDefaultParameters(params)
  579. if err != nil {
  580. // Print the error, cast err to awserr.Error to get the Code and
  581. // Message from an error.
  582. fmt.Println(err.Error())
  583. return
  584. }
  585. // Pretty-print the response data.
  586. fmt.Println(resp)
  587. }
  588. func ExampleElastiCache_DescribeEvents() {
  589. sess, err := session.NewSession()
  590. if err != nil {
  591. fmt.Println("failed to create session,", err)
  592. return
  593. }
  594. svc := elasticache.New(sess)
  595. params := &elasticache.DescribeEventsInput{
  596. Duration: aws.Int64(1),
  597. EndTime: aws.Time(time.Now()),
  598. Marker: aws.String("String"),
  599. MaxRecords: aws.Int64(1),
  600. SourceIdentifier: aws.String("String"),
  601. SourceType: aws.String("SourceType"),
  602. StartTime: aws.Time(time.Now()),
  603. }
  604. resp, err := svc.DescribeEvents(params)
  605. if err != nil {
  606. // Print the error, cast err to awserr.Error to get the Code and
  607. // Message from an error.
  608. fmt.Println(err.Error())
  609. return
  610. }
  611. // Pretty-print the response data.
  612. fmt.Println(resp)
  613. }
  614. func ExampleElastiCache_DescribeReplicationGroups() {
  615. sess, err := session.NewSession()
  616. if err != nil {
  617. fmt.Println("failed to create session,", err)
  618. return
  619. }
  620. svc := elasticache.New(sess)
  621. params := &elasticache.DescribeReplicationGroupsInput{
  622. Marker: aws.String("String"),
  623. MaxRecords: aws.Int64(1),
  624. ReplicationGroupId: aws.String("String"),
  625. }
  626. resp, err := svc.DescribeReplicationGroups(params)
  627. if err != nil {
  628. // Print the error, cast err to awserr.Error to get the Code and
  629. // Message from an error.
  630. fmt.Println(err.Error())
  631. return
  632. }
  633. // Pretty-print the response data.
  634. fmt.Println(resp)
  635. }
  636. func ExampleElastiCache_DescribeReservedCacheNodes() {
  637. sess, err := session.NewSession()
  638. if err != nil {
  639. fmt.Println("failed to create session,", err)
  640. return
  641. }
  642. svc := elasticache.New(sess)
  643. params := &elasticache.DescribeReservedCacheNodesInput{
  644. CacheNodeType: aws.String("String"),
  645. Duration: aws.String("String"),
  646. Marker: aws.String("String"),
  647. MaxRecords: aws.Int64(1),
  648. OfferingType: aws.String("String"),
  649. ProductDescription: aws.String("String"),
  650. ReservedCacheNodeId: aws.String("String"),
  651. ReservedCacheNodesOfferingId: aws.String("String"),
  652. }
  653. resp, err := svc.DescribeReservedCacheNodes(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 ExampleElastiCache_DescribeReservedCacheNodesOfferings() {
  664. sess, err := session.NewSession()
  665. if err != nil {
  666. fmt.Println("failed to create session,", err)
  667. return
  668. }
  669. svc := elasticache.New(sess)
  670. params := &elasticache.DescribeReservedCacheNodesOfferingsInput{
  671. CacheNodeType: aws.String("String"),
  672. Duration: aws.String("String"),
  673. Marker: aws.String("String"),
  674. MaxRecords: aws.Int64(1),
  675. OfferingType: aws.String("String"),
  676. ProductDescription: aws.String("String"),
  677. ReservedCacheNodesOfferingId: aws.String("String"),
  678. }
  679. resp, err := svc.DescribeReservedCacheNodesOfferings(params)
  680. if err != nil {
  681. // Print the error, cast err to awserr.Error to get the Code and
  682. // Message from an error.
  683. fmt.Println(err.Error())
  684. return
  685. }
  686. // Pretty-print the response data.
  687. fmt.Println(resp)
  688. }
  689. func ExampleElastiCache_DescribeSnapshots() {
  690. sess, err := session.NewSession()
  691. if err != nil {
  692. fmt.Println("failed to create session,", err)
  693. return
  694. }
  695. svc := elasticache.New(sess)
  696. params := &elasticache.DescribeSnapshotsInput{
  697. CacheClusterId: aws.String("String"),
  698. Marker: aws.String("String"),
  699. MaxRecords: aws.Int64(1),
  700. ReplicationGroupId: aws.String("String"),
  701. ShowNodeGroupConfig: aws.Bool(true),
  702. SnapshotName: aws.String("String"),
  703. SnapshotSource: aws.String("String"),
  704. }
  705. resp, err := svc.DescribeSnapshots(params)
  706. if err != nil {
  707. // Print the error, cast err to awserr.Error to get the Code and
  708. // Message from an error.
  709. fmt.Println(err.Error())
  710. return
  711. }
  712. // Pretty-print the response data.
  713. fmt.Println(resp)
  714. }
  715. func ExampleElastiCache_ListAllowedNodeTypeModifications() {
  716. sess, err := session.NewSession()
  717. if err != nil {
  718. fmt.Println("failed to create session,", err)
  719. return
  720. }
  721. svc := elasticache.New(sess)
  722. params := &elasticache.ListAllowedNodeTypeModificationsInput{
  723. CacheClusterId: aws.String("String"),
  724. ReplicationGroupId: aws.String("String"),
  725. }
  726. resp, err := svc.ListAllowedNodeTypeModifications(params)
  727. if err != nil {
  728. // Print the error, cast err to awserr.Error to get the Code and
  729. // Message from an error.
  730. fmt.Println(err.Error())
  731. return
  732. }
  733. // Pretty-print the response data.
  734. fmt.Println(resp)
  735. }
  736. func ExampleElastiCache_ListTagsForResource() {
  737. sess, err := session.NewSession()
  738. if err != nil {
  739. fmt.Println("failed to create session,", err)
  740. return
  741. }
  742. svc := elasticache.New(sess)
  743. params := &elasticache.ListTagsForResourceInput{
  744. ResourceName: aws.String("String"), // Required
  745. }
  746. resp, err := svc.ListTagsForResource(params)
  747. if err != nil {
  748. // Print the error, cast err to awserr.Error to get the Code and
  749. // Message from an error.
  750. fmt.Println(err.Error())
  751. return
  752. }
  753. // Pretty-print the response data.
  754. fmt.Println(resp)
  755. }
  756. func ExampleElastiCache_ModifyCacheCluster() {
  757. sess, err := session.NewSession()
  758. if err != nil {
  759. fmt.Println("failed to create session,", err)
  760. return
  761. }
  762. svc := elasticache.New(sess)
  763. params := &elasticache.ModifyCacheClusterInput{
  764. CacheClusterId: aws.String("String"), // Required
  765. AZMode: aws.String("AZMode"),
  766. ApplyImmediately: aws.Bool(true),
  767. AutoMinorVersionUpgrade: aws.Bool(true),
  768. CacheNodeIdsToRemove: []*string{
  769. aws.String("String"), // Required
  770. // More values...
  771. },
  772. CacheNodeType: aws.String("String"),
  773. CacheParameterGroupName: aws.String("String"),
  774. CacheSecurityGroupNames: []*string{
  775. aws.String("String"), // Required
  776. // More values...
  777. },
  778. EngineVersion: aws.String("String"),
  779. NewAvailabilityZones: []*string{
  780. aws.String("String"), // Required
  781. // More values...
  782. },
  783. NotificationTopicArn: aws.String("String"),
  784. NotificationTopicStatus: aws.String("String"),
  785. NumCacheNodes: aws.Int64(1),
  786. PreferredMaintenanceWindow: aws.String("String"),
  787. SecurityGroupIds: []*string{
  788. aws.String("String"), // Required
  789. // More values...
  790. },
  791. SnapshotRetentionLimit: aws.Int64(1),
  792. SnapshotWindow: aws.String("String"),
  793. }
  794. resp, err := svc.ModifyCacheCluster(params)
  795. if err != nil {
  796. // Print the error, cast err to awserr.Error to get the Code and
  797. // Message from an error.
  798. fmt.Println(err.Error())
  799. return
  800. }
  801. // Pretty-print the response data.
  802. fmt.Println(resp)
  803. }
  804. func ExampleElastiCache_ModifyCacheParameterGroup() {
  805. sess, err := session.NewSession()
  806. if err != nil {
  807. fmt.Println("failed to create session,", err)
  808. return
  809. }
  810. svc := elasticache.New(sess)
  811. params := &elasticache.ModifyCacheParameterGroupInput{
  812. CacheParameterGroupName: aws.String("String"), // Required
  813. ParameterNameValues: []*elasticache.ParameterNameValue{ // Required
  814. { // Required
  815. ParameterName: aws.String("String"),
  816. ParameterValue: aws.String("String"),
  817. },
  818. // More values...
  819. },
  820. }
  821. resp, err := svc.ModifyCacheParameterGroup(params)
  822. if err != nil {
  823. // Print the error, cast err to awserr.Error to get the Code and
  824. // Message from an error.
  825. fmt.Println(err.Error())
  826. return
  827. }
  828. // Pretty-print the response data.
  829. fmt.Println(resp)
  830. }
  831. func ExampleElastiCache_ModifyCacheSubnetGroup() {
  832. sess, err := session.NewSession()
  833. if err != nil {
  834. fmt.Println("failed to create session,", err)
  835. return
  836. }
  837. svc := elasticache.New(sess)
  838. params := &elasticache.ModifyCacheSubnetGroupInput{
  839. CacheSubnetGroupName: aws.String("String"), // Required
  840. CacheSubnetGroupDescription: aws.String("String"),
  841. SubnetIds: []*string{
  842. aws.String("String"), // Required
  843. // More values...
  844. },
  845. }
  846. resp, err := svc.ModifyCacheSubnetGroup(params)
  847. if err != nil {
  848. // Print the error, cast err to awserr.Error to get the Code and
  849. // Message from an error.
  850. fmt.Println(err.Error())
  851. return
  852. }
  853. // Pretty-print the response data.
  854. fmt.Println(resp)
  855. }
  856. func ExampleElastiCache_ModifyReplicationGroup() {
  857. sess, err := session.NewSession()
  858. if err != nil {
  859. fmt.Println("failed to create session,", err)
  860. return
  861. }
  862. svc := elasticache.New(sess)
  863. params := &elasticache.ModifyReplicationGroupInput{
  864. ReplicationGroupId: aws.String("String"), // Required
  865. ApplyImmediately: aws.Bool(true),
  866. AutoMinorVersionUpgrade: aws.Bool(true),
  867. AutomaticFailoverEnabled: aws.Bool(true),
  868. CacheNodeType: aws.String("String"),
  869. CacheParameterGroupName: aws.String("String"),
  870. CacheSecurityGroupNames: []*string{
  871. aws.String("String"), // Required
  872. // More values...
  873. },
  874. EngineVersion: aws.String("String"),
  875. NotificationTopicArn: aws.String("String"),
  876. NotificationTopicStatus: aws.String("String"),
  877. PreferredMaintenanceWindow: aws.String("String"),
  878. PrimaryClusterId: aws.String("String"),
  879. ReplicationGroupDescription: aws.String("String"),
  880. SecurityGroupIds: []*string{
  881. aws.String("String"), // Required
  882. // More values...
  883. },
  884. SnapshotRetentionLimit: aws.Int64(1),
  885. SnapshotWindow: aws.String("String"),
  886. SnapshottingClusterId: aws.String("String"),
  887. }
  888. resp, err := svc.ModifyReplicationGroup(params)
  889. if err != nil {
  890. // Print the error, cast err to awserr.Error to get the Code and
  891. // Message from an error.
  892. fmt.Println(err.Error())
  893. return
  894. }
  895. // Pretty-print the response data.
  896. fmt.Println(resp)
  897. }
  898. func ExampleElastiCache_PurchaseReservedCacheNodesOffering() {
  899. sess, err := session.NewSession()
  900. if err != nil {
  901. fmt.Println("failed to create session,", err)
  902. return
  903. }
  904. svc := elasticache.New(sess)
  905. params := &elasticache.PurchaseReservedCacheNodesOfferingInput{
  906. ReservedCacheNodesOfferingId: aws.String("String"), // Required
  907. CacheNodeCount: aws.Int64(1),
  908. ReservedCacheNodeId: aws.String("String"),
  909. }
  910. resp, err := svc.PurchaseReservedCacheNodesOffering(params)
  911. if err != nil {
  912. // Print the error, cast err to awserr.Error to get the Code and
  913. // Message from an error.
  914. fmt.Println(err.Error())
  915. return
  916. }
  917. // Pretty-print the response data.
  918. fmt.Println(resp)
  919. }
  920. func ExampleElastiCache_RebootCacheCluster() {
  921. sess, err := session.NewSession()
  922. if err != nil {
  923. fmt.Println("failed to create session,", err)
  924. return
  925. }
  926. svc := elasticache.New(sess)
  927. params := &elasticache.RebootCacheClusterInput{
  928. CacheClusterId: aws.String("String"), // Required
  929. CacheNodeIdsToReboot: []*string{ // Required
  930. aws.String("String"), // Required
  931. // More values...
  932. },
  933. }
  934. resp, err := svc.RebootCacheCluster(params)
  935. if err != nil {
  936. // Print the error, cast err to awserr.Error to get the Code and
  937. // Message from an error.
  938. fmt.Println(err.Error())
  939. return
  940. }
  941. // Pretty-print the response data.
  942. fmt.Println(resp)
  943. }
  944. func ExampleElastiCache_RemoveTagsFromResource() {
  945. sess, err := session.NewSession()
  946. if err != nil {
  947. fmt.Println("failed to create session,", err)
  948. return
  949. }
  950. svc := elasticache.New(sess)
  951. params := &elasticache.RemoveTagsFromResourceInput{
  952. ResourceName: aws.String("String"), // Required
  953. TagKeys: []*string{ // Required
  954. aws.String("String"), // Required
  955. // More values...
  956. },
  957. }
  958. resp, err := svc.RemoveTagsFromResource(params)
  959. if err != nil {
  960. // Print the error, cast err to awserr.Error to get the Code and
  961. // Message from an error.
  962. fmt.Println(err.Error())
  963. return
  964. }
  965. // Pretty-print the response data.
  966. fmt.Println(resp)
  967. }
  968. func ExampleElastiCache_ResetCacheParameterGroup() {
  969. sess, err := session.NewSession()
  970. if err != nil {
  971. fmt.Println("failed to create session,", err)
  972. return
  973. }
  974. svc := elasticache.New(sess)
  975. params := &elasticache.ResetCacheParameterGroupInput{
  976. CacheParameterGroupName: aws.String("String"), // Required
  977. ParameterNameValues: []*elasticache.ParameterNameValue{
  978. { // Required
  979. ParameterName: aws.String("String"),
  980. ParameterValue: aws.String("String"),
  981. },
  982. // More values...
  983. },
  984. ResetAllParameters: aws.Bool(true),
  985. }
  986. resp, err := svc.ResetCacheParameterGroup(params)
  987. if err != nil {
  988. // Print the error, cast err to awserr.Error to get the Code and
  989. // Message from an error.
  990. fmt.Println(err.Error())
  991. return
  992. }
  993. // Pretty-print the response data.
  994. fmt.Println(resp)
  995. }
  996. func ExampleElastiCache_RevokeCacheSecurityGroupIngress() {
  997. sess, err := session.NewSession()
  998. if err != nil {
  999. fmt.Println("failed to create session,", err)
  1000. return
  1001. }
  1002. svc := elasticache.New(sess)
  1003. params := &elasticache.RevokeCacheSecurityGroupIngressInput{
  1004. CacheSecurityGroupName: aws.String("String"), // Required
  1005. EC2SecurityGroupName: aws.String("String"), // Required
  1006. EC2SecurityGroupOwnerId: aws.String("String"), // Required
  1007. }
  1008. resp, err := svc.RevokeCacheSecurityGroupIngress(params)
  1009. if err != nil {
  1010. // Print the error, cast err to awserr.Error to get the Code and
  1011. // Message from an error.
  1012. fmt.Println(err.Error())
  1013. return
  1014. }
  1015. // Pretty-print the response data.
  1016. fmt.Println(resp)
  1017. }