examples_test.go 99 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075
  1. // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
  2. package rds_test
  3. import (
  4. "fmt"
  5. "strings"
  6. "time"
  7. "github.com/aws/aws-sdk-go/aws"
  8. "github.com/aws/aws-sdk-go/aws/awserr"
  9. "github.com/aws/aws-sdk-go/aws/session"
  10. "github.com/aws/aws-sdk-go/service/rds"
  11. )
  12. var _ time.Duration
  13. var _ strings.Reader
  14. var _ aws.Config
  15. func parseTime(layout, value string) *time.Time {
  16. t, err := time.Parse(layout, value)
  17. if err != nil {
  18. panic(err)
  19. }
  20. return &t
  21. }
  22. // To add a source identifier to an event notification subscription
  23. //
  24. // This example add a source identifier to an event notification subscription.
  25. func ExampleRDS_AddSourceIdentifierToSubscription_shared00() {
  26. svc := rds.New(session.New())
  27. input := &rds.AddSourceIdentifierToSubscriptionInput{
  28. SourceIdentifier: aws.String("mymysqlinstance"),
  29. SubscriptionName: aws.String("mymysqleventsubscription"),
  30. }
  31. result, err := svc.AddSourceIdentifierToSubscription(input)
  32. if err != nil {
  33. if aerr, ok := err.(awserr.Error); ok {
  34. switch aerr.Code() {
  35. case rds.ErrCodeSubscriptionNotFoundFault:
  36. fmt.Println(rds.ErrCodeSubscriptionNotFoundFault, aerr.Error())
  37. case rds.ErrCodeSourceNotFoundFault:
  38. fmt.Println(rds.ErrCodeSourceNotFoundFault, aerr.Error())
  39. default:
  40. fmt.Println(aerr.Error())
  41. }
  42. } else {
  43. // Print the error, cast err to awserr.Error to get the Code and
  44. // Message from an error.
  45. fmt.Println(err.Error())
  46. }
  47. return
  48. }
  49. fmt.Println(result)
  50. }
  51. // To add tags to a resource
  52. //
  53. // This example adds a tag to an option group.
  54. func ExampleRDS_AddTagsToResource_shared00() {
  55. svc := rds.New(session.New())
  56. input := &rds.AddTagsToResourceInput{
  57. ResourceName: aws.String("arn:aws:rds:us-east-1:992648334831:og:mymysqloptiongroup"),
  58. Tags: []*rds.Tag{
  59. {
  60. Key: aws.String("Staging"),
  61. Value: aws.String("LocationDB"),
  62. },
  63. },
  64. }
  65. result, err := svc.AddTagsToResource(input)
  66. if err != nil {
  67. if aerr, ok := err.(awserr.Error); ok {
  68. switch aerr.Code() {
  69. case rds.ErrCodeDBInstanceNotFoundFault:
  70. fmt.Println(rds.ErrCodeDBInstanceNotFoundFault, aerr.Error())
  71. case rds.ErrCodeDBSnapshotNotFoundFault:
  72. fmt.Println(rds.ErrCodeDBSnapshotNotFoundFault, aerr.Error())
  73. case rds.ErrCodeDBClusterNotFoundFault:
  74. fmt.Println(rds.ErrCodeDBClusterNotFoundFault, aerr.Error())
  75. default:
  76. fmt.Println(aerr.Error())
  77. }
  78. } else {
  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. }
  83. return
  84. }
  85. fmt.Println(result)
  86. }
  87. // To apply a pending maintenance action
  88. //
  89. // This example immediately applies a pending system update to a DB instance.
  90. func ExampleRDS_ApplyPendingMaintenanceAction_shared00() {
  91. svc := rds.New(session.New())
  92. input := &rds.ApplyPendingMaintenanceActionInput{
  93. ApplyAction: aws.String("system-update"),
  94. OptInType: aws.String("immediate"),
  95. ResourceIdentifier: aws.String("arn:aws:rds:us-east-1:992648334831:db:mymysqlinstance"),
  96. }
  97. result, err := svc.ApplyPendingMaintenanceAction(input)
  98. if err != nil {
  99. if aerr, ok := err.(awserr.Error); ok {
  100. switch aerr.Code() {
  101. case rds.ErrCodeResourceNotFoundFault:
  102. fmt.Println(rds.ErrCodeResourceNotFoundFault, aerr.Error())
  103. case rds.ErrCodeInvalidDBClusterStateFault:
  104. fmt.Println(rds.ErrCodeInvalidDBClusterStateFault, aerr.Error())
  105. case rds.ErrCodeInvalidDBInstanceStateFault:
  106. fmt.Println(rds.ErrCodeInvalidDBInstanceStateFault, aerr.Error())
  107. default:
  108. fmt.Println(aerr.Error())
  109. }
  110. } else {
  111. // Print the error, cast err to awserr.Error to get the Code and
  112. // Message from an error.
  113. fmt.Println(err.Error())
  114. }
  115. return
  116. }
  117. fmt.Println(result)
  118. }
  119. // To authorize DB security group integress
  120. //
  121. // This example authorizes access to the specified security group by the specified CIDR
  122. // block.
  123. func ExampleRDS_AuthorizeDBSecurityGroupIngress_shared00() {
  124. svc := rds.New(session.New())
  125. input := &rds.AuthorizeDBSecurityGroupIngressInput{
  126. CIDRIP: aws.String("203.0.113.5/32"),
  127. DBSecurityGroupName: aws.String("mydbsecuritygroup"),
  128. }
  129. result, err := svc.AuthorizeDBSecurityGroupIngress(input)
  130. if err != nil {
  131. if aerr, ok := err.(awserr.Error); ok {
  132. switch aerr.Code() {
  133. case rds.ErrCodeDBSecurityGroupNotFoundFault:
  134. fmt.Println(rds.ErrCodeDBSecurityGroupNotFoundFault, aerr.Error())
  135. case rds.ErrCodeInvalidDBSecurityGroupStateFault:
  136. fmt.Println(rds.ErrCodeInvalidDBSecurityGroupStateFault, aerr.Error())
  137. case rds.ErrCodeAuthorizationAlreadyExistsFault:
  138. fmt.Println(rds.ErrCodeAuthorizationAlreadyExistsFault, aerr.Error())
  139. case rds.ErrCodeAuthorizationQuotaExceededFault:
  140. fmt.Println(rds.ErrCodeAuthorizationQuotaExceededFault, aerr.Error())
  141. default:
  142. fmt.Println(aerr.Error())
  143. }
  144. } else {
  145. // Print the error, cast err to awserr.Error to get the Code and
  146. // Message from an error.
  147. fmt.Println(err.Error())
  148. }
  149. return
  150. }
  151. fmt.Println(result)
  152. }
  153. // To copy a DB cluster parameter group
  154. //
  155. // This example copies a DB cluster parameter group.
  156. func ExampleRDS_CopyDBClusterParameterGroup_shared00() {
  157. svc := rds.New(session.New())
  158. input := &rds.CopyDBClusterParameterGroupInput{
  159. SourceDBClusterParameterGroupIdentifier: aws.String("mydbclusterparametergroup"),
  160. TargetDBClusterParameterGroupDescription: aws.String("My DB cluster parameter group copy"),
  161. TargetDBClusterParameterGroupIdentifier: aws.String("mydbclusterparametergroup-copy"),
  162. }
  163. result, err := svc.CopyDBClusterParameterGroup(input)
  164. if err != nil {
  165. if aerr, ok := err.(awserr.Error); ok {
  166. switch aerr.Code() {
  167. case rds.ErrCodeDBParameterGroupNotFoundFault:
  168. fmt.Println(rds.ErrCodeDBParameterGroupNotFoundFault, aerr.Error())
  169. case rds.ErrCodeDBParameterGroupQuotaExceededFault:
  170. fmt.Println(rds.ErrCodeDBParameterGroupQuotaExceededFault, aerr.Error())
  171. case rds.ErrCodeDBParameterGroupAlreadyExistsFault:
  172. fmt.Println(rds.ErrCodeDBParameterGroupAlreadyExistsFault, aerr.Error())
  173. default:
  174. fmt.Println(aerr.Error())
  175. }
  176. } else {
  177. // Print the error, cast err to awserr.Error to get the Code and
  178. // Message from an error.
  179. fmt.Println(err.Error())
  180. }
  181. return
  182. }
  183. fmt.Println(result)
  184. }
  185. // To copy a DB cluster snapshot
  186. //
  187. // The following example copies an automated snapshot of a DB cluster to a new DB cluster
  188. // snapshot.
  189. func ExampleRDS_CopyDBClusterSnapshot_shared00() {
  190. svc := rds.New(session.New())
  191. input := &rds.CopyDBClusterSnapshotInput{
  192. SourceDBClusterSnapshotIdentifier: aws.String("rds:sample-cluster-2016-09-14-10-38"),
  193. TargetDBClusterSnapshotIdentifier: aws.String("cluster-snapshot-copy-1"),
  194. }
  195. result, err := svc.CopyDBClusterSnapshot(input)
  196. if err != nil {
  197. if aerr, ok := err.(awserr.Error); ok {
  198. switch aerr.Code() {
  199. case rds.ErrCodeDBClusterSnapshotAlreadyExistsFault:
  200. fmt.Println(rds.ErrCodeDBClusterSnapshotAlreadyExistsFault, aerr.Error())
  201. case rds.ErrCodeDBClusterSnapshotNotFoundFault:
  202. fmt.Println(rds.ErrCodeDBClusterSnapshotNotFoundFault, aerr.Error())
  203. case rds.ErrCodeInvalidDBClusterStateFault:
  204. fmt.Println(rds.ErrCodeInvalidDBClusterStateFault, aerr.Error())
  205. case rds.ErrCodeInvalidDBClusterSnapshotStateFault:
  206. fmt.Println(rds.ErrCodeInvalidDBClusterSnapshotStateFault, aerr.Error())
  207. case rds.ErrCodeSnapshotQuotaExceededFault:
  208. fmt.Println(rds.ErrCodeSnapshotQuotaExceededFault, aerr.Error())
  209. case rds.ErrCodeKMSKeyNotAccessibleFault:
  210. fmt.Println(rds.ErrCodeKMSKeyNotAccessibleFault, aerr.Error())
  211. default:
  212. fmt.Println(aerr.Error())
  213. }
  214. } else {
  215. // Print the error, cast err to awserr.Error to get the Code and
  216. // Message from an error.
  217. fmt.Println(err.Error())
  218. }
  219. return
  220. }
  221. fmt.Println(result)
  222. }
  223. // To copy a DB parameter group
  224. //
  225. // This example copies a DB parameter group.
  226. func ExampleRDS_CopyDBParameterGroup_shared00() {
  227. svc := rds.New(session.New())
  228. input := &rds.CopyDBParameterGroupInput{
  229. SourceDBParameterGroupIdentifier: aws.String("mymysqlparametergroup"),
  230. TargetDBParameterGroupDescription: aws.String("My MySQL parameter group copy"),
  231. TargetDBParameterGroupIdentifier: aws.String("mymysqlparametergroup-copy"),
  232. }
  233. result, err := svc.CopyDBParameterGroup(input)
  234. if err != nil {
  235. if aerr, ok := err.(awserr.Error); ok {
  236. switch aerr.Code() {
  237. case rds.ErrCodeDBParameterGroupNotFoundFault:
  238. fmt.Println(rds.ErrCodeDBParameterGroupNotFoundFault, aerr.Error())
  239. case rds.ErrCodeDBParameterGroupAlreadyExistsFault:
  240. fmt.Println(rds.ErrCodeDBParameterGroupAlreadyExistsFault, aerr.Error())
  241. case rds.ErrCodeDBParameterGroupQuotaExceededFault:
  242. fmt.Println(rds.ErrCodeDBParameterGroupQuotaExceededFault, aerr.Error())
  243. default:
  244. fmt.Println(aerr.Error())
  245. }
  246. } else {
  247. // Print the error, cast err to awserr.Error to get the Code and
  248. // Message from an error.
  249. fmt.Println(err.Error())
  250. }
  251. return
  252. }
  253. fmt.Println(result)
  254. }
  255. // To copy a DB snapshot
  256. //
  257. // This example copies a DB snapshot.
  258. func ExampleRDS_CopyDBSnapshot_shared00() {
  259. svc := rds.New(session.New())
  260. input := &rds.CopyDBSnapshotInput{
  261. SourceDBSnapshotIdentifier: aws.String("mydbsnapshot"),
  262. TargetDBSnapshotIdentifier: aws.String("mydbsnapshot-copy"),
  263. }
  264. result, err := svc.CopyDBSnapshot(input)
  265. if err != nil {
  266. if aerr, ok := err.(awserr.Error); ok {
  267. switch aerr.Code() {
  268. case rds.ErrCodeDBSnapshotAlreadyExistsFault:
  269. fmt.Println(rds.ErrCodeDBSnapshotAlreadyExistsFault, aerr.Error())
  270. case rds.ErrCodeDBSnapshotNotFoundFault:
  271. fmt.Println(rds.ErrCodeDBSnapshotNotFoundFault, aerr.Error())
  272. case rds.ErrCodeInvalidDBSnapshotStateFault:
  273. fmt.Println(rds.ErrCodeInvalidDBSnapshotStateFault, aerr.Error())
  274. case rds.ErrCodeSnapshotQuotaExceededFault:
  275. fmt.Println(rds.ErrCodeSnapshotQuotaExceededFault, aerr.Error())
  276. case rds.ErrCodeKMSKeyNotAccessibleFault:
  277. fmt.Println(rds.ErrCodeKMSKeyNotAccessibleFault, aerr.Error())
  278. default:
  279. fmt.Println(aerr.Error())
  280. }
  281. } else {
  282. // Print the error, cast err to awserr.Error to get the Code and
  283. // Message from an error.
  284. fmt.Println(err.Error())
  285. }
  286. return
  287. }
  288. fmt.Println(result)
  289. }
  290. // To copy an option group
  291. //
  292. // This example copies an option group.
  293. func ExampleRDS_CopyOptionGroup_shared00() {
  294. svc := rds.New(session.New())
  295. input := &rds.CopyOptionGroupInput{
  296. SourceOptionGroupIdentifier: aws.String("mymysqloptiongroup"),
  297. TargetOptionGroupDescription: aws.String("My MySQL option group copy"),
  298. TargetOptionGroupIdentifier: aws.String("mymysqloptiongroup-copy"),
  299. }
  300. result, err := svc.CopyOptionGroup(input)
  301. if err != nil {
  302. if aerr, ok := err.(awserr.Error); ok {
  303. switch aerr.Code() {
  304. case rds.ErrCodeOptionGroupAlreadyExistsFault:
  305. fmt.Println(rds.ErrCodeOptionGroupAlreadyExistsFault, aerr.Error())
  306. case rds.ErrCodeOptionGroupNotFoundFault:
  307. fmt.Println(rds.ErrCodeOptionGroupNotFoundFault, aerr.Error())
  308. case rds.ErrCodeOptionGroupQuotaExceededFault:
  309. fmt.Println(rds.ErrCodeOptionGroupQuotaExceededFault, aerr.Error())
  310. default:
  311. fmt.Println(aerr.Error())
  312. }
  313. } else {
  314. // Print the error, cast err to awserr.Error to get the Code and
  315. // Message from an error.
  316. fmt.Println(err.Error())
  317. }
  318. return
  319. }
  320. fmt.Println(result)
  321. }
  322. // To create a DB cluster
  323. //
  324. // This example creates a DB cluster.
  325. func ExampleRDS_CreateDBCluster_shared00() {
  326. svc := rds.New(session.New())
  327. input := &rds.CreateDBClusterInput{
  328. AvailabilityZones: []*string{
  329. aws.String("us-east-1a"),
  330. },
  331. BackupRetentionPeriod: aws.Int64(1),
  332. DBClusterIdentifier: aws.String("mydbcluster"),
  333. DBClusterParameterGroupName: aws.String("mydbclusterparametergroup"),
  334. DatabaseName: aws.String("myauroradb"),
  335. Engine: aws.String("aurora"),
  336. EngineVersion: aws.String("5.6.10a"),
  337. MasterUserPassword: aws.String("mypassword"),
  338. MasterUsername: aws.String("myuser"),
  339. Port: aws.Int64(3306),
  340. StorageEncrypted: aws.Bool(true),
  341. }
  342. result, err := svc.CreateDBCluster(input)
  343. if err != nil {
  344. if aerr, ok := err.(awserr.Error); ok {
  345. switch aerr.Code() {
  346. case rds.ErrCodeDBClusterAlreadyExistsFault:
  347. fmt.Println(rds.ErrCodeDBClusterAlreadyExistsFault, aerr.Error())
  348. case rds.ErrCodeInsufficientStorageClusterCapacityFault:
  349. fmt.Println(rds.ErrCodeInsufficientStorageClusterCapacityFault, aerr.Error())
  350. case rds.ErrCodeDBClusterQuotaExceededFault:
  351. fmt.Println(rds.ErrCodeDBClusterQuotaExceededFault, aerr.Error())
  352. case rds.ErrCodeStorageQuotaExceededFault:
  353. fmt.Println(rds.ErrCodeStorageQuotaExceededFault, aerr.Error())
  354. case rds.ErrCodeDBSubnetGroupNotFoundFault:
  355. fmt.Println(rds.ErrCodeDBSubnetGroupNotFoundFault, aerr.Error())
  356. case rds.ErrCodeInvalidVPCNetworkStateFault:
  357. fmt.Println(rds.ErrCodeInvalidVPCNetworkStateFault, aerr.Error())
  358. case rds.ErrCodeInvalidDBClusterStateFault:
  359. fmt.Println(rds.ErrCodeInvalidDBClusterStateFault, aerr.Error())
  360. case rds.ErrCodeInvalidDBSubnetGroupStateFault:
  361. fmt.Println(rds.ErrCodeInvalidDBSubnetGroupStateFault, aerr.Error())
  362. case rds.ErrCodeInvalidSubnet:
  363. fmt.Println(rds.ErrCodeInvalidSubnet, aerr.Error())
  364. case rds.ErrCodeInvalidDBInstanceStateFault:
  365. fmt.Println(rds.ErrCodeInvalidDBInstanceStateFault, aerr.Error())
  366. case rds.ErrCodeDBClusterParameterGroupNotFoundFault:
  367. fmt.Println(rds.ErrCodeDBClusterParameterGroupNotFoundFault, aerr.Error())
  368. case rds.ErrCodeKMSKeyNotAccessibleFault:
  369. fmt.Println(rds.ErrCodeKMSKeyNotAccessibleFault, aerr.Error())
  370. case rds.ErrCodeDBClusterNotFoundFault:
  371. fmt.Println(rds.ErrCodeDBClusterNotFoundFault, aerr.Error())
  372. case rds.ErrCodeDBInstanceNotFoundFault:
  373. fmt.Println(rds.ErrCodeDBInstanceNotFoundFault, aerr.Error())
  374. case rds.ErrCodeDBSubnetGroupDoesNotCoverEnoughAZs:
  375. fmt.Println(rds.ErrCodeDBSubnetGroupDoesNotCoverEnoughAZs, aerr.Error())
  376. case rds.ErrCodeGlobalClusterNotFoundFault:
  377. fmt.Println(rds.ErrCodeGlobalClusterNotFoundFault, aerr.Error())
  378. case rds.ErrCodeInvalidGlobalClusterStateFault:
  379. fmt.Println(rds.ErrCodeInvalidGlobalClusterStateFault, aerr.Error())
  380. default:
  381. fmt.Println(aerr.Error())
  382. }
  383. } else {
  384. // Print the error, cast err to awserr.Error to get the Code and
  385. // Message from an error.
  386. fmt.Println(err.Error())
  387. }
  388. return
  389. }
  390. fmt.Println(result)
  391. }
  392. // To create a DB cluster parameter group
  393. //
  394. // This example creates a DB cluster parameter group.
  395. func ExampleRDS_CreateDBClusterParameterGroup_shared00() {
  396. svc := rds.New(session.New())
  397. input := &rds.CreateDBClusterParameterGroupInput{
  398. DBClusterParameterGroupName: aws.String("mydbclusterparametergroup"),
  399. DBParameterGroupFamily: aws.String("aurora5.6"),
  400. Description: aws.String("My DB cluster parameter group"),
  401. }
  402. result, err := svc.CreateDBClusterParameterGroup(input)
  403. if err != nil {
  404. if aerr, ok := err.(awserr.Error); ok {
  405. switch aerr.Code() {
  406. case rds.ErrCodeDBParameterGroupQuotaExceededFault:
  407. fmt.Println(rds.ErrCodeDBParameterGroupQuotaExceededFault, aerr.Error())
  408. case rds.ErrCodeDBParameterGroupAlreadyExistsFault:
  409. fmt.Println(rds.ErrCodeDBParameterGroupAlreadyExistsFault, aerr.Error())
  410. default:
  411. fmt.Println(aerr.Error())
  412. }
  413. } else {
  414. // Print the error, cast err to awserr.Error to get the Code and
  415. // Message from an error.
  416. fmt.Println(err.Error())
  417. }
  418. return
  419. }
  420. fmt.Println(result)
  421. }
  422. // To create a DB cluster snapshot
  423. //
  424. // This example creates a DB cluster snapshot.
  425. func ExampleRDS_CreateDBClusterSnapshot_shared00() {
  426. svc := rds.New(session.New())
  427. input := &rds.CreateDBClusterSnapshotInput{
  428. DBClusterIdentifier: aws.String("mydbcluster"),
  429. DBClusterSnapshotIdentifier: aws.String("mydbclustersnapshot"),
  430. }
  431. result, err := svc.CreateDBClusterSnapshot(input)
  432. if err != nil {
  433. if aerr, ok := err.(awserr.Error); ok {
  434. switch aerr.Code() {
  435. case rds.ErrCodeDBClusterSnapshotAlreadyExistsFault:
  436. fmt.Println(rds.ErrCodeDBClusterSnapshotAlreadyExistsFault, aerr.Error())
  437. case rds.ErrCodeInvalidDBClusterStateFault:
  438. fmt.Println(rds.ErrCodeInvalidDBClusterStateFault, aerr.Error())
  439. case rds.ErrCodeDBClusterNotFoundFault:
  440. fmt.Println(rds.ErrCodeDBClusterNotFoundFault, aerr.Error())
  441. case rds.ErrCodeSnapshotQuotaExceededFault:
  442. fmt.Println(rds.ErrCodeSnapshotQuotaExceededFault, aerr.Error())
  443. case rds.ErrCodeInvalidDBClusterSnapshotStateFault:
  444. fmt.Println(rds.ErrCodeInvalidDBClusterSnapshotStateFault, aerr.Error())
  445. default:
  446. fmt.Println(aerr.Error())
  447. }
  448. } else {
  449. // Print the error, cast err to awserr.Error to get the Code and
  450. // Message from an error.
  451. fmt.Println(err.Error())
  452. }
  453. return
  454. }
  455. fmt.Println(result)
  456. }
  457. // To create a DB instance.
  458. //
  459. // This example creates a DB instance.
  460. func ExampleRDS_CreateDBInstance_shared00() {
  461. svc := rds.New(session.New())
  462. input := &rds.CreateDBInstanceInput{
  463. AllocatedStorage: aws.Int64(5),
  464. DBInstanceClass: aws.String("db.t2.micro"),
  465. DBInstanceIdentifier: aws.String("mymysqlinstance"),
  466. Engine: aws.String("MySQL"),
  467. MasterUserPassword: aws.String("MyPassword"),
  468. MasterUsername: aws.String("MyUser"),
  469. }
  470. result, err := svc.CreateDBInstance(input)
  471. if err != nil {
  472. if aerr, ok := err.(awserr.Error); ok {
  473. switch aerr.Code() {
  474. case rds.ErrCodeDBInstanceAlreadyExistsFault:
  475. fmt.Println(rds.ErrCodeDBInstanceAlreadyExistsFault, aerr.Error())
  476. case rds.ErrCodeInsufficientDBInstanceCapacityFault:
  477. fmt.Println(rds.ErrCodeInsufficientDBInstanceCapacityFault, aerr.Error())
  478. case rds.ErrCodeDBParameterGroupNotFoundFault:
  479. fmt.Println(rds.ErrCodeDBParameterGroupNotFoundFault, aerr.Error())
  480. case rds.ErrCodeDBSecurityGroupNotFoundFault:
  481. fmt.Println(rds.ErrCodeDBSecurityGroupNotFoundFault, aerr.Error())
  482. case rds.ErrCodeInstanceQuotaExceededFault:
  483. fmt.Println(rds.ErrCodeInstanceQuotaExceededFault, aerr.Error())
  484. case rds.ErrCodeStorageQuotaExceededFault:
  485. fmt.Println(rds.ErrCodeStorageQuotaExceededFault, aerr.Error())
  486. case rds.ErrCodeDBSubnetGroupNotFoundFault:
  487. fmt.Println(rds.ErrCodeDBSubnetGroupNotFoundFault, aerr.Error())
  488. case rds.ErrCodeDBSubnetGroupDoesNotCoverEnoughAZs:
  489. fmt.Println(rds.ErrCodeDBSubnetGroupDoesNotCoverEnoughAZs, aerr.Error())
  490. case rds.ErrCodeInvalidDBClusterStateFault:
  491. fmt.Println(rds.ErrCodeInvalidDBClusterStateFault, aerr.Error())
  492. case rds.ErrCodeInvalidSubnet:
  493. fmt.Println(rds.ErrCodeInvalidSubnet, aerr.Error())
  494. case rds.ErrCodeInvalidVPCNetworkStateFault:
  495. fmt.Println(rds.ErrCodeInvalidVPCNetworkStateFault, aerr.Error())
  496. case rds.ErrCodeProvisionedIopsNotAvailableInAZFault:
  497. fmt.Println(rds.ErrCodeProvisionedIopsNotAvailableInAZFault, aerr.Error())
  498. case rds.ErrCodeOptionGroupNotFoundFault:
  499. fmt.Println(rds.ErrCodeOptionGroupNotFoundFault, aerr.Error())
  500. case rds.ErrCodeDBClusterNotFoundFault:
  501. fmt.Println(rds.ErrCodeDBClusterNotFoundFault, aerr.Error())
  502. case rds.ErrCodeStorageTypeNotSupportedFault:
  503. fmt.Println(rds.ErrCodeStorageTypeNotSupportedFault, aerr.Error())
  504. case rds.ErrCodeAuthorizationNotFoundFault:
  505. fmt.Println(rds.ErrCodeAuthorizationNotFoundFault, aerr.Error())
  506. case rds.ErrCodeKMSKeyNotAccessibleFault:
  507. fmt.Println(rds.ErrCodeKMSKeyNotAccessibleFault, aerr.Error())
  508. case rds.ErrCodeDomainNotFoundFault:
  509. fmt.Println(rds.ErrCodeDomainNotFoundFault, aerr.Error())
  510. case rds.ErrCodeBackupPolicyNotFoundFault:
  511. fmt.Println(rds.ErrCodeBackupPolicyNotFoundFault, aerr.Error())
  512. default:
  513. fmt.Println(aerr.Error())
  514. }
  515. } else {
  516. // Print the error, cast err to awserr.Error to get the Code and
  517. // Message from an error.
  518. fmt.Println(err.Error())
  519. }
  520. return
  521. }
  522. fmt.Println(result)
  523. }
  524. // To create a DB instance read replica.
  525. //
  526. // This example creates a DB instance read replica.
  527. func ExampleRDS_CreateDBInstanceReadReplica_shared00() {
  528. svc := rds.New(session.New())
  529. input := &rds.CreateDBInstanceReadReplicaInput{
  530. AvailabilityZone: aws.String("us-east-1a"),
  531. CopyTagsToSnapshot: aws.Bool(true),
  532. DBInstanceClass: aws.String("db.t2.micro"),
  533. DBInstanceIdentifier: aws.String("mydbreadreplica"),
  534. PubliclyAccessible: aws.Bool(true),
  535. SourceDBInstanceIdentifier: aws.String("mymysqlinstance"),
  536. StorageType: aws.String("gp2"),
  537. Tags: []*rds.Tag{
  538. {
  539. Key: aws.String("mydbreadreplicakey"),
  540. Value: aws.String("mydbreadreplicavalue"),
  541. },
  542. },
  543. }
  544. result, err := svc.CreateDBInstanceReadReplica(input)
  545. if err != nil {
  546. if aerr, ok := err.(awserr.Error); ok {
  547. switch aerr.Code() {
  548. case rds.ErrCodeDBInstanceAlreadyExistsFault:
  549. fmt.Println(rds.ErrCodeDBInstanceAlreadyExistsFault, aerr.Error())
  550. case rds.ErrCodeInsufficientDBInstanceCapacityFault:
  551. fmt.Println(rds.ErrCodeInsufficientDBInstanceCapacityFault, aerr.Error())
  552. case rds.ErrCodeDBParameterGroupNotFoundFault:
  553. fmt.Println(rds.ErrCodeDBParameterGroupNotFoundFault, aerr.Error())
  554. case rds.ErrCodeDBSecurityGroupNotFoundFault:
  555. fmt.Println(rds.ErrCodeDBSecurityGroupNotFoundFault, aerr.Error())
  556. case rds.ErrCodeInstanceQuotaExceededFault:
  557. fmt.Println(rds.ErrCodeInstanceQuotaExceededFault, aerr.Error())
  558. case rds.ErrCodeStorageQuotaExceededFault:
  559. fmt.Println(rds.ErrCodeStorageQuotaExceededFault, aerr.Error())
  560. case rds.ErrCodeDBInstanceNotFoundFault:
  561. fmt.Println(rds.ErrCodeDBInstanceNotFoundFault, aerr.Error())
  562. case rds.ErrCodeInvalidDBInstanceStateFault:
  563. fmt.Println(rds.ErrCodeInvalidDBInstanceStateFault, aerr.Error())
  564. case rds.ErrCodeDBSubnetGroupNotFoundFault:
  565. fmt.Println(rds.ErrCodeDBSubnetGroupNotFoundFault, aerr.Error())
  566. case rds.ErrCodeDBSubnetGroupDoesNotCoverEnoughAZs:
  567. fmt.Println(rds.ErrCodeDBSubnetGroupDoesNotCoverEnoughAZs, aerr.Error())
  568. case rds.ErrCodeInvalidSubnet:
  569. fmt.Println(rds.ErrCodeInvalidSubnet, aerr.Error())
  570. case rds.ErrCodeInvalidVPCNetworkStateFault:
  571. fmt.Println(rds.ErrCodeInvalidVPCNetworkStateFault, aerr.Error())
  572. case rds.ErrCodeProvisionedIopsNotAvailableInAZFault:
  573. fmt.Println(rds.ErrCodeProvisionedIopsNotAvailableInAZFault, aerr.Error())
  574. case rds.ErrCodeOptionGroupNotFoundFault:
  575. fmt.Println(rds.ErrCodeOptionGroupNotFoundFault, aerr.Error())
  576. case rds.ErrCodeDBSubnetGroupNotAllowedFault:
  577. fmt.Println(rds.ErrCodeDBSubnetGroupNotAllowedFault, aerr.Error())
  578. case rds.ErrCodeInvalidDBSubnetGroupFault:
  579. fmt.Println(rds.ErrCodeInvalidDBSubnetGroupFault, aerr.Error())
  580. case rds.ErrCodeStorageTypeNotSupportedFault:
  581. fmt.Println(rds.ErrCodeStorageTypeNotSupportedFault, aerr.Error())
  582. case rds.ErrCodeKMSKeyNotAccessibleFault:
  583. fmt.Println(rds.ErrCodeKMSKeyNotAccessibleFault, aerr.Error())
  584. default:
  585. fmt.Println(aerr.Error())
  586. }
  587. } else {
  588. // Print the error, cast err to awserr.Error to get the Code and
  589. // Message from an error.
  590. fmt.Println(err.Error())
  591. }
  592. return
  593. }
  594. fmt.Println(result)
  595. }
  596. // To create a DB parameter group.
  597. //
  598. // This example creates a DB parameter group.
  599. func ExampleRDS_CreateDBParameterGroup_shared00() {
  600. svc := rds.New(session.New())
  601. input := &rds.CreateDBParameterGroupInput{
  602. DBParameterGroupFamily: aws.String("mysql5.6"),
  603. DBParameterGroupName: aws.String("mymysqlparametergroup"),
  604. Description: aws.String("My MySQL parameter group"),
  605. }
  606. result, err := svc.CreateDBParameterGroup(input)
  607. if err != nil {
  608. if aerr, ok := err.(awserr.Error); ok {
  609. switch aerr.Code() {
  610. case rds.ErrCodeDBParameterGroupQuotaExceededFault:
  611. fmt.Println(rds.ErrCodeDBParameterGroupQuotaExceededFault, aerr.Error())
  612. case rds.ErrCodeDBParameterGroupAlreadyExistsFault:
  613. fmt.Println(rds.ErrCodeDBParameterGroupAlreadyExistsFault, aerr.Error())
  614. default:
  615. fmt.Println(aerr.Error())
  616. }
  617. } else {
  618. // Print the error, cast err to awserr.Error to get the Code and
  619. // Message from an error.
  620. fmt.Println(err.Error())
  621. }
  622. return
  623. }
  624. fmt.Println(result)
  625. }
  626. // To create a DB security group.
  627. //
  628. // This example creates a DB security group.
  629. func ExampleRDS_CreateDBSecurityGroup_shared00() {
  630. svc := rds.New(session.New())
  631. input := &rds.CreateDBSecurityGroupInput{
  632. DBSecurityGroupDescription: aws.String("My DB security group"),
  633. DBSecurityGroupName: aws.String("mydbsecuritygroup"),
  634. }
  635. result, err := svc.CreateDBSecurityGroup(input)
  636. if err != nil {
  637. if aerr, ok := err.(awserr.Error); ok {
  638. switch aerr.Code() {
  639. case rds.ErrCodeDBSecurityGroupAlreadyExistsFault:
  640. fmt.Println(rds.ErrCodeDBSecurityGroupAlreadyExistsFault, aerr.Error())
  641. case rds.ErrCodeDBSecurityGroupQuotaExceededFault:
  642. fmt.Println(rds.ErrCodeDBSecurityGroupQuotaExceededFault, aerr.Error())
  643. case rds.ErrCodeDBSecurityGroupNotSupportedFault:
  644. fmt.Println(rds.ErrCodeDBSecurityGroupNotSupportedFault, aerr.Error())
  645. default:
  646. fmt.Println(aerr.Error())
  647. }
  648. } else {
  649. // Print the error, cast err to awserr.Error to get the Code and
  650. // Message from an error.
  651. fmt.Println(err.Error())
  652. }
  653. return
  654. }
  655. fmt.Println(result)
  656. }
  657. // To create a DB snapshot.
  658. //
  659. // This example creates a DB snapshot.
  660. func ExampleRDS_CreateDBSnapshot_shared00() {
  661. svc := rds.New(session.New())
  662. input := &rds.CreateDBSnapshotInput{
  663. DBInstanceIdentifier: aws.String("mymysqlinstance"),
  664. DBSnapshotIdentifier: aws.String("mydbsnapshot"),
  665. }
  666. result, err := svc.CreateDBSnapshot(input)
  667. if err != nil {
  668. if aerr, ok := err.(awserr.Error); ok {
  669. switch aerr.Code() {
  670. case rds.ErrCodeDBSnapshotAlreadyExistsFault:
  671. fmt.Println(rds.ErrCodeDBSnapshotAlreadyExistsFault, aerr.Error())
  672. case rds.ErrCodeInvalidDBInstanceStateFault:
  673. fmt.Println(rds.ErrCodeInvalidDBInstanceStateFault, aerr.Error())
  674. case rds.ErrCodeDBInstanceNotFoundFault:
  675. fmt.Println(rds.ErrCodeDBInstanceNotFoundFault, aerr.Error())
  676. case rds.ErrCodeSnapshotQuotaExceededFault:
  677. fmt.Println(rds.ErrCodeSnapshotQuotaExceededFault, aerr.Error())
  678. default:
  679. fmt.Println(aerr.Error())
  680. }
  681. } else {
  682. // Print the error, cast err to awserr.Error to get the Code and
  683. // Message from an error.
  684. fmt.Println(err.Error())
  685. }
  686. return
  687. }
  688. fmt.Println(result)
  689. }
  690. // To create a DB subnet group.
  691. //
  692. // This example creates a DB subnet group.
  693. func ExampleRDS_CreateDBSubnetGroup_shared00() {
  694. svc := rds.New(session.New())
  695. input := &rds.CreateDBSubnetGroupInput{
  696. DBSubnetGroupDescription: aws.String("My DB subnet group"),
  697. DBSubnetGroupName: aws.String("mydbsubnetgroup"),
  698. SubnetIds: []*string{
  699. aws.String("subnet-1fab8a69"),
  700. aws.String("subnet-d43a468c"),
  701. },
  702. }
  703. result, err := svc.CreateDBSubnetGroup(input)
  704. if err != nil {
  705. if aerr, ok := err.(awserr.Error); ok {
  706. switch aerr.Code() {
  707. case rds.ErrCodeDBSubnetGroupAlreadyExistsFault:
  708. fmt.Println(rds.ErrCodeDBSubnetGroupAlreadyExistsFault, aerr.Error())
  709. case rds.ErrCodeDBSubnetGroupQuotaExceededFault:
  710. fmt.Println(rds.ErrCodeDBSubnetGroupQuotaExceededFault, aerr.Error())
  711. case rds.ErrCodeDBSubnetQuotaExceededFault:
  712. fmt.Println(rds.ErrCodeDBSubnetQuotaExceededFault, aerr.Error())
  713. case rds.ErrCodeDBSubnetGroupDoesNotCoverEnoughAZs:
  714. fmt.Println(rds.ErrCodeDBSubnetGroupDoesNotCoverEnoughAZs, aerr.Error())
  715. case rds.ErrCodeInvalidSubnet:
  716. fmt.Println(rds.ErrCodeInvalidSubnet, aerr.Error())
  717. default:
  718. fmt.Println(aerr.Error())
  719. }
  720. } else {
  721. // Print the error, cast err to awserr.Error to get the Code and
  722. // Message from an error.
  723. fmt.Println(err.Error())
  724. }
  725. return
  726. }
  727. fmt.Println(result)
  728. }
  729. // To create an event notification subscription
  730. //
  731. // This example creates an event notification subscription.
  732. func ExampleRDS_CreateEventSubscription_shared00() {
  733. svc := rds.New(session.New())
  734. input := &rds.CreateEventSubscriptionInput{
  735. Enabled: aws.Bool(true),
  736. EventCategories: []*string{
  737. aws.String("availability"),
  738. },
  739. SnsTopicArn: aws.String("arn:aws:sns:us-east-1:992648334831:MyDemoSNSTopic"),
  740. SourceIds: []*string{
  741. aws.String("mymysqlinstance"),
  742. },
  743. SourceType: aws.String("db-instance"),
  744. SubscriptionName: aws.String("mymysqleventsubscription"),
  745. }
  746. result, err := svc.CreateEventSubscription(input)
  747. if err != nil {
  748. if aerr, ok := err.(awserr.Error); ok {
  749. switch aerr.Code() {
  750. case rds.ErrCodeEventSubscriptionQuotaExceededFault:
  751. fmt.Println(rds.ErrCodeEventSubscriptionQuotaExceededFault, aerr.Error())
  752. case rds.ErrCodeSubscriptionAlreadyExistFault:
  753. fmt.Println(rds.ErrCodeSubscriptionAlreadyExistFault, aerr.Error())
  754. case rds.ErrCodeSNSInvalidTopicFault:
  755. fmt.Println(rds.ErrCodeSNSInvalidTopicFault, aerr.Error())
  756. case rds.ErrCodeSNSNoAuthorizationFault:
  757. fmt.Println(rds.ErrCodeSNSNoAuthorizationFault, aerr.Error())
  758. case rds.ErrCodeSNSTopicArnNotFoundFault:
  759. fmt.Println(rds.ErrCodeSNSTopicArnNotFoundFault, aerr.Error())
  760. case rds.ErrCodeSubscriptionCategoryNotFoundFault:
  761. fmt.Println(rds.ErrCodeSubscriptionCategoryNotFoundFault, aerr.Error())
  762. case rds.ErrCodeSourceNotFoundFault:
  763. fmt.Println(rds.ErrCodeSourceNotFoundFault, aerr.Error())
  764. default:
  765. fmt.Println(aerr.Error())
  766. }
  767. } else {
  768. // Print the error, cast err to awserr.Error to get the Code and
  769. // Message from an error.
  770. fmt.Println(err.Error())
  771. }
  772. return
  773. }
  774. fmt.Println(result)
  775. }
  776. // To create an option group
  777. //
  778. // This example creates an option group.
  779. func ExampleRDS_CreateOptionGroup_shared00() {
  780. svc := rds.New(session.New())
  781. input := &rds.CreateOptionGroupInput{
  782. EngineName: aws.String("MySQL"),
  783. MajorEngineVersion: aws.String("5.6"),
  784. OptionGroupDescription: aws.String("My MySQL 5.6 option group"),
  785. OptionGroupName: aws.String("mymysqloptiongroup"),
  786. }
  787. result, err := svc.CreateOptionGroup(input)
  788. if err != nil {
  789. if aerr, ok := err.(awserr.Error); ok {
  790. switch aerr.Code() {
  791. case rds.ErrCodeOptionGroupAlreadyExistsFault:
  792. fmt.Println(rds.ErrCodeOptionGroupAlreadyExistsFault, aerr.Error())
  793. case rds.ErrCodeOptionGroupQuotaExceededFault:
  794. fmt.Println(rds.ErrCodeOptionGroupQuotaExceededFault, aerr.Error())
  795. default:
  796. fmt.Println(aerr.Error())
  797. }
  798. } else {
  799. // Print the error, cast err to awserr.Error to get the Code and
  800. // Message from an error.
  801. fmt.Println(err.Error())
  802. }
  803. return
  804. }
  805. fmt.Println(result)
  806. }
  807. // To delete a DB cluster.
  808. //
  809. // This example deletes the specified DB cluster.
  810. func ExampleRDS_DeleteDBCluster_shared00() {
  811. svc := rds.New(session.New())
  812. input := &rds.DeleteDBClusterInput{
  813. DBClusterIdentifier: aws.String("mydbcluster"),
  814. SkipFinalSnapshot: aws.Bool(true),
  815. }
  816. result, err := svc.DeleteDBCluster(input)
  817. if err != nil {
  818. if aerr, ok := err.(awserr.Error); ok {
  819. switch aerr.Code() {
  820. case rds.ErrCodeDBClusterNotFoundFault:
  821. fmt.Println(rds.ErrCodeDBClusterNotFoundFault, aerr.Error())
  822. case rds.ErrCodeInvalidDBClusterStateFault:
  823. fmt.Println(rds.ErrCodeInvalidDBClusterStateFault, aerr.Error())
  824. case rds.ErrCodeDBClusterSnapshotAlreadyExistsFault:
  825. fmt.Println(rds.ErrCodeDBClusterSnapshotAlreadyExistsFault, aerr.Error())
  826. case rds.ErrCodeSnapshotQuotaExceededFault:
  827. fmt.Println(rds.ErrCodeSnapshotQuotaExceededFault, aerr.Error())
  828. case rds.ErrCodeInvalidDBClusterSnapshotStateFault:
  829. fmt.Println(rds.ErrCodeInvalidDBClusterSnapshotStateFault, aerr.Error())
  830. default:
  831. fmt.Println(aerr.Error())
  832. }
  833. } else {
  834. // Print the error, cast err to awserr.Error to get the Code and
  835. // Message from an error.
  836. fmt.Println(err.Error())
  837. }
  838. return
  839. }
  840. fmt.Println(result)
  841. }
  842. // To delete a DB cluster parameter group.
  843. //
  844. // This example deletes the specified DB cluster parameter group.
  845. func ExampleRDS_DeleteDBClusterParameterGroup_shared00() {
  846. svc := rds.New(session.New())
  847. input := &rds.DeleteDBClusterParameterGroupInput{
  848. DBClusterParameterGroupName: aws.String("mydbclusterparametergroup"),
  849. }
  850. result, err := svc.DeleteDBClusterParameterGroup(input)
  851. if err != nil {
  852. if aerr, ok := err.(awserr.Error); ok {
  853. switch aerr.Code() {
  854. case rds.ErrCodeInvalidDBParameterGroupStateFault:
  855. fmt.Println(rds.ErrCodeInvalidDBParameterGroupStateFault, aerr.Error())
  856. case rds.ErrCodeDBParameterGroupNotFoundFault:
  857. fmt.Println(rds.ErrCodeDBParameterGroupNotFoundFault, aerr.Error())
  858. default:
  859. fmt.Println(aerr.Error())
  860. }
  861. } else {
  862. // Print the error, cast err to awserr.Error to get the Code and
  863. // Message from an error.
  864. fmt.Println(err.Error())
  865. }
  866. return
  867. }
  868. fmt.Println(result)
  869. }
  870. // To delete a DB cluster snapshot.
  871. //
  872. // This example deletes the specified DB cluster snapshot.
  873. func ExampleRDS_DeleteDBClusterSnapshot_shared00() {
  874. svc := rds.New(session.New())
  875. input := &rds.DeleteDBClusterSnapshotInput{
  876. DBClusterSnapshotIdentifier: aws.String("mydbclustersnapshot"),
  877. }
  878. result, err := svc.DeleteDBClusterSnapshot(input)
  879. if err != nil {
  880. if aerr, ok := err.(awserr.Error); ok {
  881. switch aerr.Code() {
  882. case rds.ErrCodeInvalidDBClusterSnapshotStateFault:
  883. fmt.Println(rds.ErrCodeInvalidDBClusterSnapshotStateFault, aerr.Error())
  884. case rds.ErrCodeDBClusterSnapshotNotFoundFault:
  885. fmt.Println(rds.ErrCodeDBClusterSnapshotNotFoundFault, aerr.Error())
  886. default:
  887. fmt.Println(aerr.Error())
  888. }
  889. } else {
  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. }
  894. return
  895. }
  896. fmt.Println(result)
  897. }
  898. // To delete a DB instance.
  899. //
  900. // This example deletes the specified DB instance.
  901. func ExampleRDS_DeleteDBInstance_shared00() {
  902. svc := rds.New(session.New())
  903. input := &rds.DeleteDBInstanceInput{
  904. DBInstanceIdentifier: aws.String("mymysqlinstance"),
  905. SkipFinalSnapshot: aws.Bool(true),
  906. }
  907. result, err := svc.DeleteDBInstance(input)
  908. if err != nil {
  909. if aerr, ok := err.(awserr.Error); ok {
  910. switch aerr.Code() {
  911. case rds.ErrCodeDBInstanceNotFoundFault:
  912. fmt.Println(rds.ErrCodeDBInstanceNotFoundFault, aerr.Error())
  913. case rds.ErrCodeInvalidDBInstanceStateFault:
  914. fmt.Println(rds.ErrCodeInvalidDBInstanceStateFault, aerr.Error())
  915. case rds.ErrCodeDBSnapshotAlreadyExistsFault:
  916. fmt.Println(rds.ErrCodeDBSnapshotAlreadyExistsFault, aerr.Error())
  917. case rds.ErrCodeSnapshotQuotaExceededFault:
  918. fmt.Println(rds.ErrCodeSnapshotQuotaExceededFault, aerr.Error())
  919. case rds.ErrCodeInvalidDBClusterStateFault:
  920. fmt.Println(rds.ErrCodeInvalidDBClusterStateFault, aerr.Error())
  921. case rds.ErrCodeDBInstanceAutomatedBackupQuotaExceededFault:
  922. fmt.Println(rds.ErrCodeDBInstanceAutomatedBackupQuotaExceededFault, aerr.Error())
  923. default:
  924. fmt.Println(aerr.Error())
  925. }
  926. } else {
  927. // Print the error, cast err to awserr.Error to get the Code and
  928. // Message from an error.
  929. fmt.Println(err.Error())
  930. }
  931. return
  932. }
  933. fmt.Println(result)
  934. }
  935. // To delete a DB parameter group
  936. //
  937. // The following example deletes a DB parameter group.
  938. func ExampleRDS_DeleteDBParameterGroup_shared00() {
  939. svc := rds.New(session.New())
  940. input := &rds.DeleteDBParameterGroupInput{
  941. DBParameterGroupName: aws.String("mydbparamgroup3"),
  942. }
  943. result, err := svc.DeleteDBParameterGroup(input)
  944. if err != nil {
  945. if aerr, ok := err.(awserr.Error); ok {
  946. switch aerr.Code() {
  947. case rds.ErrCodeInvalidDBParameterGroupStateFault:
  948. fmt.Println(rds.ErrCodeInvalidDBParameterGroupStateFault, aerr.Error())
  949. case rds.ErrCodeDBParameterGroupNotFoundFault:
  950. fmt.Println(rds.ErrCodeDBParameterGroupNotFoundFault, aerr.Error())
  951. default:
  952. fmt.Println(aerr.Error())
  953. }
  954. } else {
  955. // Print the error, cast err to awserr.Error to get the Code and
  956. // Message from an error.
  957. fmt.Println(err.Error())
  958. }
  959. return
  960. }
  961. fmt.Println(result)
  962. }
  963. // To delete a DB security group
  964. //
  965. // The following example deletes a DB security group.
  966. func ExampleRDS_DeleteDBSecurityGroup_shared00() {
  967. svc := rds.New(session.New())
  968. input := &rds.DeleteDBSecurityGroupInput{
  969. DBSecurityGroupName: aws.String("mysecgroup"),
  970. }
  971. result, err := svc.DeleteDBSecurityGroup(input)
  972. if err != nil {
  973. if aerr, ok := err.(awserr.Error); ok {
  974. switch aerr.Code() {
  975. case rds.ErrCodeInvalidDBSecurityGroupStateFault:
  976. fmt.Println(rds.ErrCodeInvalidDBSecurityGroupStateFault, aerr.Error())
  977. case rds.ErrCodeDBSecurityGroupNotFoundFault:
  978. fmt.Println(rds.ErrCodeDBSecurityGroupNotFoundFault, aerr.Error())
  979. default:
  980. fmt.Println(aerr.Error())
  981. }
  982. } else {
  983. // Print the error, cast err to awserr.Error to get the Code and
  984. // Message from an error.
  985. fmt.Println(err.Error())
  986. }
  987. return
  988. }
  989. fmt.Println(result)
  990. }
  991. // To delete a DB cluster snapshot.
  992. //
  993. // This example deletes the specified DB snapshot.
  994. func ExampleRDS_DeleteDBSnapshot_shared00() {
  995. svc := rds.New(session.New())
  996. input := &rds.DeleteDBSnapshotInput{
  997. DBSnapshotIdentifier: aws.String("mydbsnapshot"),
  998. }
  999. result, err := svc.DeleteDBSnapshot(input)
  1000. if err != nil {
  1001. if aerr, ok := err.(awserr.Error); ok {
  1002. switch aerr.Code() {
  1003. case rds.ErrCodeInvalidDBSnapshotStateFault:
  1004. fmt.Println(rds.ErrCodeInvalidDBSnapshotStateFault, aerr.Error())
  1005. case rds.ErrCodeDBSnapshotNotFoundFault:
  1006. fmt.Println(rds.ErrCodeDBSnapshotNotFoundFault, aerr.Error())
  1007. default:
  1008. fmt.Println(aerr.Error())
  1009. }
  1010. } else {
  1011. // Print the error, cast err to awserr.Error to get the Code and
  1012. // Message from an error.
  1013. fmt.Println(err.Error())
  1014. }
  1015. return
  1016. }
  1017. fmt.Println(result)
  1018. }
  1019. // To delete a DB subnet group.
  1020. //
  1021. // This example deletes the specified DB subnetgroup.
  1022. func ExampleRDS_DeleteDBSubnetGroup_shared00() {
  1023. svc := rds.New(session.New())
  1024. input := &rds.DeleteDBSubnetGroupInput{
  1025. DBSubnetGroupName: aws.String("mydbsubnetgroup"),
  1026. }
  1027. result, err := svc.DeleteDBSubnetGroup(input)
  1028. if err != nil {
  1029. if aerr, ok := err.(awserr.Error); ok {
  1030. switch aerr.Code() {
  1031. case rds.ErrCodeInvalidDBSubnetGroupStateFault:
  1032. fmt.Println(rds.ErrCodeInvalidDBSubnetGroupStateFault, aerr.Error())
  1033. case rds.ErrCodeInvalidDBSubnetStateFault:
  1034. fmt.Println(rds.ErrCodeInvalidDBSubnetStateFault, aerr.Error())
  1035. case rds.ErrCodeDBSubnetGroupNotFoundFault:
  1036. fmt.Println(rds.ErrCodeDBSubnetGroupNotFoundFault, aerr.Error())
  1037. default:
  1038. fmt.Println(aerr.Error())
  1039. }
  1040. } else {
  1041. // Print the error, cast err to awserr.Error to get the Code and
  1042. // Message from an error.
  1043. fmt.Println(err.Error())
  1044. }
  1045. return
  1046. }
  1047. fmt.Println(result)
  1048. }
  1049. // To delete a DB event subscription.
  1050. //
  1051. // This example deletes the specified DB event subscription.
  1052. func ExampleRDS_DeleteEventSubscription_shared00() {
  1053. svc := rds.New(session.New())
  1054. input := &rds.DeleteEventSubscriptionInput{
  1055. SubscriptionName: aws.String("myeventsubscription"),
  1056. }
  1057. result, err := svc.DeleteEventSubscription(input)
  1058. if err != nil {
  1059. if aerr, ok := err.(awserr.Error); ok {
  1060. switch aerr.Code() {
  1061. case rds.ErrCodeSubscriptionNotFoundFault:
  1062. fmt.Println(rds.ErrCodeSubscriptionNotFoundFault, aerr.Error())
  1063. case rds.ErrCodeInvalidEventSubscriptionStateFault:
  1064. fmt.Println(rds.ErrCodeInvalidEventSubscriptionStateFault, aerr.Error())
  1065. default:
  1066. fmt.Println(aerr.Error())
  1067. }
  1068. } else {
  1069. // Print the error, cast err to awserr.Error to get the Code and
  1070. // Message from an error.
  1071. fmt.Println(err.Error())
  1072. }
  1073. return
  1074. }
  1075. fmt.Println(result)
  1076. }
  1077. // To delete an option group.
  1078. //
  1079. // This example deletes the specified option group.
  1080. func ExampleRDS_DeleteOptionGroup_shared00() {
  1081. svc := rds.New(session.New())
  1082. input := &rds.DeleteOptionGroupInput{
  1083. OptionGroupName: aws.String("mydboptiongroup"),
  1084. }
  1085. result, err := svc.DeleteOptionGroup(input)
  1086. if err != nil {
  1087. if aerr, ok := err.(awserr.Error); ok {
  1088. switch aerr.Code() {
  1089. case rds.ErrCodeOptionGroupNotFoundFault:
  1090. fmt.Println(rds.ErrCodeOptionGroupNotFoundFault, aerr.Error())
  1091. case rds.ErrCodeInvalidOptionGroupStateFault:
  1092. fmt.Println(rds.ErrCodeInvalidOptionGroupStateFault, aerr.Error())
  1093. default:
  1094. fmt.Println(aerr.Error())
  1095. }
  1096. } else {
  1097. // Print the error, cast err to awserr.Error to get the Code and
  1098. // Message from an error.
  1099. fmt.Println(err.Error())
  1100. }
  1101. return
  1102. }
  1103. fmt.Println(result)
  1104. }
  1105. // To list account attributes
  1106. //
  1107. // This example lists account attributes.
  1108. func ExampleRDS_DescribeAccountAttributes_shared00() {
  1109. svc := rds.New(session.New())
  1110. input := &rds.DescribeAccountAttributesInput{}
  1111. result, err := svc.DescribeAccountAttributes(input)
  1112. if err != nil {
  1113. if aerr, ok := err.(awserr.Error); ok {
  1114. switch aerr.Code() {
  1115. default:
  1116. fmt.Println(aerr.Error())
  1117. }
  1118. } else {
  1119. // Print the error, cast err to awserr.Error to get the Code and
  1120. // Message from an error.
  1121. fmt.Println(err.Error())
  1122. }
  1123. return
  1124. }
  1125. fmt.Println(result)
  1126. }
  1127. // To list certificates
  1128. //
  1129. // This example lists up to 20 certificates for the specified certificate identifier.
  1130. func ExampleRDS_DescribeCertificates_shared00() {
  1131. svc := rds.New(session.New())
  1132. input := &rds.DescribeCertificatesInput{
  1133. CertificateIdentifier: aws.String("rds-ca-2015"),
  1134. MaxRecords: aws.Int64(20),
  1135. }
  1136. result, err := svc.DescribeCertificates(input)
  1137. if err != nil {
  1138. if aerr, ok := err.(awserr.Error); ok {
  1139. switch aerr.Code() {
  1140. case rds.ErrCodeCertificateNotFoundFault:
  1141. fmt.Println(rds.ErrCodeCertificateNotFoundFault, aerr.Error())
  1142. default:
  1143. fmt.Println(aerr.Error())
  1144. }
  1145. } else {
  1146. // Print the error, cast err to awserr.Error to get the Code and
  1147. // Message from an error.
  1148. fmt.Println(err.Error())
  1149. }
  1150. return
  1151. }
  1152. fmt.Println(result)
  1153. }
  1154. // To list DB cluster parameter group settings
  1155. //
  1156. // This example lists settings for the specified DB cluster parameter group.
  1157. func ExampleRDS_DescribeDBClusterParameterGroups_shared00() {
  1158. svc := rds.New(session.New())
  1159. input := &rds.DescribeDBClusterParameterGroupsInput{
  1160. DBClusterParameterGroupName: aws.String("mydbclusterparametergroup"),
  1161. }
  1162. result, err := svc.DescribeDBClusterParameterGroups(input)
  1163. if err != nil {
  1164. if aerr, ok := err.(awserr.Error); ok {
  1165. switch aerr.Code() {
  1166. case rds.ErrCodeDBParameterGroupNotFoundFault:
  1167. fmt.Println(rds.ErrCodeDBParameterGroupNotFoundFault, aerr.Error())
  1168. default:
  1169. fmt.Println(aerr.Error())
  1170. }
  1171. } else {
  1172. // Print the error, cast err to awserr.Error to get the Code and
  1173. // Message from an error.
  1174. fmt.Println(err.Error())
  1175. }
  1176. return
  1177. }
  1178. fmt.Println(result)
  1179. }
  1180. // To list DB cluster parameters
  1181. //
  1182. // This example lists system parameters for the specified DB cluster parameter group.
  1183. func ExampleRDS_DescribeDBClusterParameters_shared00() {
  1184. svc := rds.New(session.New())
  1185. input := &rds.DescribeDBClusterParametersInput{
  1186. DBClusterParameterGroupName: aws.String("mydbclusterparametergroup"),
  1187. Source: aws.String("system"),
  1188. }
  1189. result, err := svc.DescribeDBClusterParameters(input)
  1190. if err != nil {
  1191. if aerr, ok := err.(awserr.Error); ok {
  1192. switch aerr.Code() {
  1193. case rds.ErrCodeDBParameterGroupNotFoundFault:
  1194. fmt.Println(rds.ErrCodeDBParameterGroupNotFoundFault, aerr.Error())
  1195. default:
  1196. fmt.Println(aerr.Error())
  1197. }
  1198. } else {
  1199. // Print the error, cast err to awserr.Error to get the Code and
  1200. // Message from an error.
  1201. fmt.Println(err.Error())
  1202. }
  1203. return
  1204. }
  1205. fmt.Println(result)
  1206. }
  1207. // To list DB cluster snapshot attributes
  1208. //
  1209. // This example lists attributes for the specified DB cluster snapshot.
  1210. func ExampleRDS_DescribeDBClusterSnapshotAttributes_shared00() {
  1211. svc := rds.New(session.New())
  1212. input := &rds.DescribeDBClusterSnapshotAttributesInput{
  1213. DBClusterSnapshotIdentifier: aws.String("mydbclustersnapshot"),
  1214. }
  1215. result, err := svc.DescribeDBClusterSnapshotAttributes(input)
  1216. if err != nil {
  1217. if aerr, ok := err.(awserr.Error); ok {
  1218. switch aerr.Code() {
  1219. case rds.ErrCodeDBClusterSnapshotNotFoundFault:
  1220. fmt.Println(rds.ErrCodeDBClusterSnapshotNotFoundFault, aerr.Error())
  1221. default:
  1222. fmt.Println(aerr.Error())
  1223. }
  1224. } else {
  1225. // Print the error, cast err to awserr.Error to get the Code and
  1226. // Message from an error.
  1227. fmt.Println(err.Error())
  1228. }
  1229. return
  1230. }
  1231. fmt.Println(result)
  1232. }
  1233. // To list DB cluster snapshots
  1234. //
  1235. // This example lists settings for the specified, manually-created cluster snapshot.
  1236. func ExampleRDS_DescribeDBClusterSnapshots_shared00() {
  1237. svc := rds.New(session.New())
  1238. input := &rds.DescribeDBClusterSnapshotsInput{
  1239. DBClusterSnapshotIdentifier: aws.String("mydbclustersnapshot"),
  1240. SnapshotType: aws.String("manual"),
  1241. }
  1242. result, err := svc.DescribeDBClusterSnapshots(input)
  1243. if err != nil {
  1244. if aerr, ok := err.(awserr.Error); ok {
  1245. switch aerr.Code() {
  1246. case rds.ErrCodeDBClusterSnapshotNotFoundFault:
  1247. fmt.Println(rds.ErrCodeDBClusterSnapshotNotFoundFault, aerr.Error())
  1248. default:
  1249. fmt.Println(aerr.Error())
  1250. }
  1251. } else {
  1252. // Print the error, cast err to awserr.Error to get the Code and
  1253. // Message from an error.
  1254. fmt.Println(err.Error())
  1255. }
  1256. return
  1257. }
  1258. fmt.Println(result)
  1259. }
  1260. // To list DB clusters
  1261. //
  1262. // This example lists settings for the specified DB cluster.
  1263. func ExampleRDS_DescribeDBClusters_shared00() {
  1264. svc := rds.New(session.New())
  1265. input := &rds.DescribeDBClustersInput{
  1266. DBClusterIdentifier: aws.String("mynewdbcluster"),
  1267. }
  1268. result, err := svc.DescribeDBClusters(input)
  1269. if err != nil {
  1270. if aerr, ok := err.(awserr.Error); ok {
  1271. switch aerr.Code() {
  1272. case rds.ErrCodeDBClusterNotFoundFault:
  1273. fmt.Println(rds.ErrCodeDBClusterNotFoundFault, aerr.Error())
  1274. default:
  1275. fmt.Println(aerr.Error())
  1276. }
  1277. } else {
  1278. // Print the error, cast err to awserr.Error to get the Code and
  1279. // Message from an error.
  1280. fmt.Println(err.Error())
  1281. }
  1282. return
  1283. }
  1284. fmt.Println(result)
  1285. }
  1286. // To list DB engine version settings
  1287. //
  1288. // This example lists settings for the specified DB engine version.
  1289. func ExampleRDS_DescribeDBEngineVersions_shared00() {
  1290. svc := rds.New(session.New())
  1291. input := &rds.DescribeDBEngineVersionsInput{
  1292. DBParameterGroupFamily: aws.String("mysql5.6"),
  1293. DefaultOnly: aws.Bool(true),
  1294. Engine: aws.String("mysql"),
  1295. EngineVersion: aws.String("5.6"),
  1296. ListSupportedCharacterSets: aws.Bool(true),
  1297. }
  1298. result, err := svc.DescribeDBEngineVersions(input)
  1299. if err != nil {
  1300. if aerr, ok := err.(awserr.Error); ok {
  1301. switch aerr.Code() {
  1302. default:
  1303. fmt.Println(aerr.Error())
  1304. }
  1305. } else {
  1306. // Print the error, cast err to awserr.Error to get the Code and
  1307. // Message from an error.
  1308. fmt.Println(err.Error())
  1309. }
  1310. return
  1311. }
  1312. fmt.Println(result)
  1313. }
  1314. // To list DB instance settings
  1315. //
  1316. // This example lists settings for the specified DB instance.
  1317. func ExampleRDS_DescribeDBInstances_shared00() {
  1318. svc := rds.New(session.New())
  1319. input := &rds.DescribeDBInstancesInput{
  1320. DBInstanceIdentifier: aws.String("mymysqlinstance"),
  1321. }
  1322. result, err := svc.DescribeDBInstances(input)
  1323. if err != nil {
  1324. if aerr, ok := err.(awserr.Error); ok {
  1325. switch aerr.Code() {
  1326. case rds.ErrCodeDBInstanceNotFoundFault:
  1327. fmt.Println(rds.ErrCodeDBInstanceNotFoundFault, aerr.Error())
  1328. default:
  1329. fmt.Println(aerr.Error())
  1330. }
  1331. } else {
  1332. // Print the error, cast err to awserr.Error to get the Code and
  1333. // Message from an error.
  1334. fmt.Println(err.Error())
  1335. }
  1336. return
  1337. }
  1338. fmt.Println(result)
  1339. }
  1340. // To list DB log file names
  1341. //
  1342. // This example lists matching log file names for the specified DB instance, file name
  1343. // pattern, last write date in POSIX time with milleseconds, and minimum file size.
  1344. func ExampleRDS_DescribeDBLogFiles_shared00() {
  1345. svc := rds.New(session.New())
  1346. input := &rds.DescribeDBLogFilesInput{
  1347. DBInstanceIdentifier: aws.String("mymysqlinstance"),
  1348. FileLastWritten: aws.Int64(1470873600000),
  1349. FileSize: aws.Int64(0),
  1350. FilenameContains: aws.String("error"),
  1351. }
  1352. result, err := svc.DescribeDBLogFiles(input)
  1353. if err != nil {
  1354. if aerr, ok := err.(awserr.Error); ok {
  1355. switch aerr.Code() {
  1356. case rds.ErrCodeDBInstanceNotFoundFault:
  1357. fmt.Println(rds.ErrCodeDBInstanceNotFoundFault, aerr.Error())
  1358. default:
  1359. fmt.Println(aerr.Error())
  1360. }
  1361. } else {
  1362. // Print the error, cast err to awserr.Error to get the Code and
  1363. // Message from an error.
  1364. fmt.Println(err.Error())
  1365. }
  1366. return
  1367. }
  1368. fmt.Println(result)
  1369. }
  1370. // To list information about DB parameter groups
  1371. //
  1372. // This example lists information about the specified DB parameter group.
  1373. func ExampleRDS_DescribeDBParameterGroups_shared00() {
  1374. svc := rds.New(session.New())
  1375. input := &rds.DescribeDBParameterGroupsInput{
  1376. DBParameterGroupName: aws.String("mymysqlparametergroup"),
  1377. }
  1378. result, err := svc.DescribeDBParameterGroups(input)
  1379. if err != nil {
  1380. if aerr, ok := err.(awserr.Error); ok {
  1381. switch aerr.Code() {
  1382. case rds.ErrCodeDBParameterGroupNotFoundFault:
  1383. fmt.Println(rds.ErrCodeDBParameterGroupNotFoundFault, aerr.Error())
  1384. default:
  1385. fmt.Println(aerr.Error())
  1386. }
  1387. } else {
  1388. // Print the error, cast err to awserr.Error to get the Code and
  1389. // Message from an error.
  1390. fmt.Println(err.Error())
  1391. }
  1392. return
  1393. }
  1394. fmt.Println(result)
  1395. }
  1396. // To list information about DB parameters
  1397. //
  1398. // This example lists information for up to the first 20 system parameters for the specified
  1399. // DB parameter group.
  1400. func ExampleRDS_DescribeDBParameters_shared00() {
  1401. svc := rds.New(session.New())
  1402. input := &rds.DescribeDBParametersInput{
  1403. DBParameterGroupName: aws.String("mymysqlparametergroup"),
  1404. MaxRecords: aws.Int64(20),
  1405. Source: aws.String("system"),
  1406. }
  1407. result, err := svc.DescribeDBParameters(input)
  1408. if err != nil {
  1409. if aerr, ok := err.(awserr.Error); ok {
  1410. switch aerr.Code() {
  1411. case rds.ErrCodeDBParameterGroupNotFoundFault:
  1412. fmt.Println(rds.ErrCodeDBParameterGroupNotFoundFault, aerr.Error())
  1413. default:
  1414. fmt.Println(aerr.Error())
  1415. }
  1416. } else {
  1417. // Print the error, cast err to awserr.Error to get the Code and
  1418. // Message from an error.
  1419. fmt.Println(err.Error())
  1420. }
  1421. return
  1422. }
  1423. fmt.Println(result)
  1424. }
  1425. // To list DB security group settings
  1426. //
  1427. // This example lists settings for the specified security group.
  1428. func ExampleRDS_DescribeDBSecurityGroups_shared00() {
  1429. svc := rds.New(session.New())
  1430. input := &rds.DescribeDBSecurityGroupsInput{
  1431. DBSecurityGroupName: aws.String("mydbsecuritygroup"),
  1432. }
  1433. result, err := svc.DescribeDBSecurityGroups(input)
  1434. if err != nil {
  1435. if aerr, ok := err.(awserr.Error); ok {
  1436. switch aerr.Code() {
  1437. case rds.ErrCodeDBSecurityGroupNotFoundFault:
  1438. fmt.Println(rds.ErrCodeDBSecurityGroupNotFoundFault, aerr.Error())
  1439. default:
  1440. fmt.Println(aerr.Error())
  1441. }
  1442. } else {
  1443. // Print the error, cast err to awserr.Error to get the Code and
  1444. // Message from an error.
  1445. fmt.Println(err.Error())
  1446. }
  1447. return
  1448. }
  1449. fmt.Println(result)
  1450. }
  1451. // To list DB snapshot attributes
  1452. //
  1453. // This example lists attributes for the specified DB snapshot.
  1454. func ExampleRDS_DescribeDBSnapshotAttributes_shared00() {
  1455. svc := rds.New(session.New())
  1456. input := &rds.DescribeDBSnapshotAttributesInput{
  1457. DBSnapshotIdentifier: aws.String("mydbsnapshot"),
  1458. }
  1459. result, err := svc.DescribeDBSnapshotAttributes(input)
  1460. if err != nil {
  1461. if aerr, ok := err.(awserr.Error); ok {
  1462. switch aerr.Code() {
  1463. case rds.ErrCodeDBSnapshotNotFoundFault:
  1464. fmt.Println(rds.ErrCodeDBSnapshotNotFoundFault, aerr.Error())
  1465. default:
  1466. fmt.Println(aerr.Error())
  1467. }
  1468. } else {
  1469. // Print the error, cast err to awserr.Error to get the Code and
  1470. // Message from an error.
  1471. fmt.Println(err.Error())
  1472. }
  1473. return
  1474. }
  1475. fmt.Println(result)
  1476. }
  1477. // To list DB snapshot attributes
  1478. //
  1479. // This example lists all manually-created, shared snapshots for the specified DB instance.
  1480. func ExampleRDS_DescribeDBSnapshots_shared00() {
  1481. svc := rds.New(session.New())
  1482. input := &rds.DescribeDBSnapshotsInput{
  1483. DBInstanceIdentifier: aws.String("mymysqlinstance"),
  1484. IncludePublic: aws.Bool(false),
  1485. IncludeShared: aws.Bool(true),
  1486. SnapshotType: aws.String("manual"),
  1487. }
  1488. result, err := svc.DescribeDBSnapshots(input)
  1489. if err != nil {
  1490. if aerr, ok := err.(awserr.Error); ok {
  1491. switch aerr.Code() {
  1492. case rds.ErrCodeDBSnapshotNotFoundFault:
  1493. fmt.Println(rds.ErrCodeDBSnapshotNotFoundFault, aerr.Error())
  1494. default:
  1495. fmt.Println(aerr.Error())
  1496. }
  1497. } else {
  1498. // Print the error, cast err to awserr.Error to get the Code and
  1499. // Message from an error.
  1500. fmt.Println(err.Error())
  1501. }
  1502. return
  1503. }
  1504. fmt.Println(result)
  1505. }
  1506. // To list information about DB subnet groups
  1507. //
  1508. // This example lists information about the specified DB subnet group.
  1509. func ExampleRDS_DescribeDBSubnetGroups_shared00() {
  1510. svc := rds.New(session.New())
  1511. input := &rds.DescribeDBSubnetGroupsInput{
  1512. DBSubnetGroupName: aws.String("mydbsubnetgroup"),
  1513. }
  1514. result, err := svc.DescribeDBSubnetGroups(input)
  1515. if err != nil {
  1516. if aerr, ok := err.(awserr.Error); ok {
  1517. switch aerr.Code() {
  1518. case rds.ErrCodeDBSubnetGroupNotFoundFault:
  1519. fmt.Println(rds.ErrCodeDBSubnetGroupNotFoundFault, aerr.Error())
  1520. default:
  1521. fmt.Println(aerr.Error())
  1522. }
  1523. } else {
  1524. // Print the error, cast err to awserr.Error to get the Code and
  1525. // Message from an error.
  1526. fmt.Println(err.Error())
  1527. }
  1528. return
  1529. }
  1530. fmt.Println(result)
  1531. }
  1532. // To list default parameters for a DB cluster engine
  1533. //
  1534. // This example lists default parameters for the specified DB cluster engine.
  1535. func ExampleRDS_DescribeEngineDefaultClusterParameters_shared00() {
  1536. svc := rds.New(session.New())
  1537. input := &rds.DescribeEngineDefaultClusterParametersInput{
  1538. DBParameterGroupFamily: aws.String("aurora5.6"),
  1539. }
  1540. result, err := svc.DescribeEngineDefaultClusterParameters(input)
  1541. if err != nil {
  1542. if aerr, ok := err.(awserr.Error); ok {
  1543. switch aerr.Code() {
  1544. default:
  1545. fmt.Println(aerr.Error())
  1546. }
  1547. } else {
  1548. // Print the error, cast err to awserr.Error to get the Code and
  1549. // Message from an error.
  1550. fmt.Println(err.Error())
  1551. }
  1552. return
  1553. }
  1554. fmt.Println(result)
  1555. }
  1556. // To list default parameters for a DB engine
  1557. //
  1558. // This example lists default parameters for the specified DB engine.
  1559. func ExampleRDS_DescribeEngineDefaultParameters_shared00() {
  1560. svc := rds.New(session.New())
  1561. input := &rds.DescribeEngineDefaultParametersInput{
  1562. DBParameterGroupFamily: aws.String("mysql5.6"),
  1563. }
  1564. result, err := svc.DescribeEngineDefaultParameters(input)
  1565. if err != nil {
  1566. if aerr, ok := err.(awserr.Error); ok {
  1567. switch aerr.Code() {
  1568. default:
  1569. fmt.Println(aerr.Error())
  1570. }
  1571. } else {
  1572. // Print the error, cast err to awserr.Error to get the Code and
  1573. // Message from an error.
  1574. fmt.Println(err.Error())
  1575. }
  1576. return
  1577. }
  1578. fmt.Println(result)
  1579. }
  1580. // To list event categories.
  1581. //
  1582. // This example lists all DB instance event categories.
  1583. func ExampleRDS_DescribeEventCategories_shared00() {
  1584. svc := rds.New(session.New())
  1585. input := &rds.DescribeEventCategoriesInput{
  1586. SourceType: aws.String("db-instance"),
  1587. }
  1588. result, err := svc.DescribeEventCategories(input)
  1589. if err != nil {
  1590. if aerr, ok := err.(awserr.Error); ok {
  1591. switch aerr.Code() {
  1592. default:
  1593. fmt.Println(aerr.Error())
  1594. }
  1595. } else {
  1596. // Print the error, cast err to awserr.Error to get the Code and
  1597. // Message from an error.
  1598. fmt.Println(err.Error())
  1599. }
  1600. return
  1601. }
  1602. fmt.Println(result)
  1603. }
  1604. // To list information about DB event notification subscriptions
  1605. //
  1606. // This example lists information for the specified DB event notification subscription.
  1607. func ExampleRDS_DescribeEventSubscriptions_shared00() {
  1608. svc := rds.New(session.New())
  1609. input := &rds.DescribeEventSubscriptionsInput{
  1610. SubscriptionName: aws.String("mymysqleventsubscription"),
  1611. }
  1612. result, err := svc.DescribeEventSubscriptions(input)
  1613. if err != nil {
  1614. if aerr, ok := err.(awserr.Error); ok {
  1615. switch aerr.Code() {
  1616. case rds.ErrCodeSubscriptionNotFoundFault:
  1617. fmt.Println(rds.ErrCodeSubscriptionNotFoundFault, aerr.Error())
  1618. default:
  1619. fmt.Println(aerr.Error())
  1620. }
  1621. } else {
  1622. // Print the error, cast err to awserr.Error to get the Code and
  1623. // Message from an error.
  1624. fmt.Println(err.Error())
  1625. }
  1626. return
  1627. }
  1628. fmt.Println(result)
  1629. }
  1630. // To list information about events
  1631. //
  1632. // This example lists information for all backup-related events for the specified DB
  1633. // instance for the past 7 days (7 days * 24 hours * 60 minutes = 10,080 minutes).
  1634. func ExampleRDS_DescribeEvents_shared00() {
  1635. svc := rds.New(session.New())
  1636. input := &rds.DescribeEventsInput{
  1637. Duration: aws.Int64(10080),
  1638. EventCategories: []*string{
  1639. aws.String("backup"),
  1640. },
  1641. SourceIdentifier: aws.String("mymysqlinstance"),
  1642. SourceType: aws.String("db-instance"),
  1643. }
  1644. result, err := svc.DescribeEvents(input)
  1645. if err != nil {
  1646. if aerr, ok := err.(awserr.Error); ok {
  1647. switch aerr.Code() {
  1648. default:
  1649. fmt.Println(aerr.Error())
  1650. }
  1651. } else {
  1652. // Print the error, cast err to awserr.Error to get the Code and
  1653. // Message from an error.
  1654. fmt.Println(err.Error())
  1655. }
  1656. return
  1657. }
  1658. fmt.Println(result)
  1659. }
  1660. // To list information about DB option group options
  1661. //
  1662. // This example lists information for all option group options for the specified DB
  1663. // engine.
  1664. func ExampleRDS_DescribeOptionGroupOptions_shared00() {
  1665. svc := rds.New(session.New())
  1666. input := &rds.DescribeOptionGroupOptionsInput{
  1667. EngineName: aws.String("mysql"),
  1668. MajorEngineVersion: aws.String("5.6"),
  1669. }
  1670. result, err := svc.DescribeOptionGroupOptions(input)
  1671. if err != nil {
  1672. if aerr, ok := err.(awserr.Error); ok {
  1673. switch aerr.Code() {
  1674. default:
  1675. fmt.Println(aerr.Error())
  1676. }
  1677. } else {
  1678. // Print the error, cast err to awserr.Error to get the Code and
  1679. // Message from an error.
  1680. fmt.Println(err.Error())
  1681. }
  1682. return
  1683. }
  1684. fmt.Println(result)
  1685. }
  1686. // To list information about DB option groups
  1687. //
  1688. // This example lists information for all option groups for the specified DB engine.
  1689. func ExampleRDS_DescribeOptionGroups_shared00() {
  1690. svc := rds.New(session.New())
  1691. input := &rds.DescribeOptionGroupsInput{
  1692. EngineName: aws.String("mysql"),
  1693. MajorEngineVersion: aws.String("5.6"),
  1694. }
  1695. result, err := svc.DescribeOptionGroups(input)
  1696. if err != nil {
  1697. if aerr, ok := err.(awserr.Error); ok {
  1698. switch aerr.Code() {
  1699. case rds.ErrCodeOptionGroupNotFoundFault:
  1700. fmt.Println(rds.ErrCodeOptionGroupNotFoundFault, aerr.Error())
  1701. default:
  1702. fmt.Println(aerr.Error())
  1703. }
  1704. } else {
  1705. // Print the error, cast err to awserr.Error to get the Code and
  1706. // Message from an error.
  1707. fmt.Println(err.Error())
  1708. }
  1709. return
  1710. }
  1711. fmt.Println(result)
  1712. }
  1713. // To list information about orderable DB instance options
  1714. //
  1715. // This example lists information for all orderable DB instance options for the specified
  1716. // DB engine, engine version, DB instance class, license model, and VPC settings.
  1717. func ExampleRDS_DescribeOrderableDBInstanceOptions_shared00() {
  1718. svc := rds.New(session.New())
  1719. input := &rds.DescribeOrderableDBInstanceOptionsInput{
  1720. DBInstanceClass: aws.String("db.t2.micro"),
  1721. Engine: aws.String("mysql"),
  1722. EngineVersion: aws.String("5.6.27"),
  1723. LicenseModel: aws.String("general-public-license"),
  1724. Vpc: aws.Bool(true),
  1725. }
  1726. result, err := svc.DescribeOrderableDBInstanceOptions(input)
  1727. if err != nil {
  1728. if aerr, ok := err.(awserr.Error); ok {
  1729. switch aerr.Code() {
  1730. default:
  1731. fmt.Println(aerr.Error())
  1732. }
  1733. } else {
  1734. // Print the error, cast err to awserr.Error to get the Code and
  1735. // Message from an error.
  1736. fmt.Println(err.Error())
  1737. }
  1738. return
  1739. }
  1740. fmt.Println(result)
  1741. }
  1742. // To list information about pending maintenance actions
  1743. //
  1744. // This example lists information for all pending maintenance actions for the specified
  1745. // DB instance.
  1746. func ExampleRDS_DescribePendingMaintenanceActions_shared00() {
  1747. svc := rds.New(session.New())
  1748. input := &rds.DescribePendingMaintenanceActionsInput{
  1749. ResourceIdentifier: aws.String("arn:aws:rds:us-east-1:992648334831:db:mymysqlinstance"),
  1750. }
  1751. result, err := svc.DescribePendingMaintenanceActions(input)
  1752. if err != nil {
  1753. if aerr, ok := err.(awserr.Error); ok {
  1754. switch aerr.Code() {
  1755. case rds.ErrCodeResourceNotFoundFault:
  1756. fmt.Println(rds.ErrCodeResourceNotFoundFault, aerr.Error())
  1757. default:
  1758. fmt.Println(aerr.Error())
  1759. }
  1760. } else {
  1761. // Print the error, cast err to awserr.Error to get the Code and
  1762. // Message from an error.
  1763. fmt.Println(err.Error())
  1764. }
  1765. return
  1766. }
  1767. fmt.Println(result)
  1768. }
  1769. // To list information about reserved DB instances
  1770. //
  1771. // This example lists information for all reserved DB instances for the specified DB
  1772. // instance class, duration, product, offering type, and availability zone settings.
  1773. func ExampleRDS_DescribeReservedDBInstances_shared00() {
  1774. svc := rds.New(session.New())
  1775. input := &rds.DescribeReservedDBInstancesInput{
  1776. DBInstanceClass: aws.String("db.t2.micro"),
  1777. Duration: aws.String("1y"),
  1778. MultiAZ: aws.Bool(false),
  1779. OfferingType: aws.String("No Upfront"),
  1780. ProductDescription: aws.String("mysql"),
  1781. }
  1782. result, err := svc.DescribeReservedDBInstances(input)
  1783. if err != nil {
  1784. if aerr, ok := err.(awserr.Error); ok {
  1785. switch aerr.Code() {
  1786. case rds.ErrCodeReservedDBInstanceNotFoundFault:
  1787. fmt.Println(rds.ErrCodeReservedDBInstanceNotFoundFault, aerr.Error())
  1788. default:
  1789. fmt.Println(aerr.Error())
  1790. }
  1791. } else {
  1792. // Print the error, cast err to awserr.Error to get the Code and
  1793. // Message from an error.
  1794. fmt.Println(err.Error())
  1795. }
  1796. return
  1797. }
  1798. fmt.Println(result)
  1799. }
  1800. // To list information about reserved DB instance offerings
  1801. //
  1802. // This example lists information for all reserved DB instance offerings for the specified
  1803. // DB instance class, duration, product, offering type, and availability zone settings.
  1804. func ExampleRDS_DescribeReservedDBInstancesOfferings_shared00() {
  1805. svc := rds.New(session.New())
  1806. input := &rds.DescribeReservedDBInstancesOfferingsInput{
  1807. DBInstanceClass: aws.String("db.t2.micro"),
  1808. Duration: aws.String("1y"),
  1809. MultiAZ: aws.Bool(false),
  1810. OfferingType: aws.String("No Upfront"),
  1811. ProductDescription: aws.String("mysql"),
  1812. }
  1813. result, err := svc.DescribeReservedDBInstancesOfferings(input)
  1814. if err != nil {
  1815. if aerr, ok := err.(awserr.Error); ok {
  1816. switch aerr.Code() {
  1817. case rds.ErrCodeReservedDBInstancesOfferingNotFoundFault:
  1818. fmt.Println(rds.ErrCodeReservedDBInstancesOfferingNotFoundFault, aerr.Error())
  1819. default:
  1820. fmt.Println(aerr.Error())
  1821. }
  1822. } else {
  1823. // Print the error, cast err to awserr.Error to get the Code and
  1824. // Message from an error.
  1825. fmt.Println(err.Error())
  1826. }
  1827. return
  1828. }
  1829. fmt.Println(result)
  1830. }
  1831. // To describe source regions
  1832. //
  1833. // To list the AWS regions where a Read Replica can be created.
  1834. func ExampleRDS_DescribeSourceRegions_shared00() {
  1835. svc := rds.New(session.New())
  1836. input := &rds.DescribeSourceRegionsInput{}
  1837. result, err := svc.DescribeSourceRegions(input)
  1838. if err != nil {
  1839. if aerr, ok := err.(awserr.Error); ok {
  1840. switch aerr.Code() {
  1841. default:
  1842. fmt.Println(aerr.Error())
  1843. }
  1844. } else {
  1845. // Print the error, cast err to awserr.Error to get the Code and
  1846. // Message from an error.
  1847. fmt.Println(err.Error())
  1848. }
  1849. return
  1850. }
  1851. fmt.Println(result)
  1852. }
  1853. // To list information about DB log files
  1854. //
  1855. // This example lists information for the specified log file for the specified DB instance.
  1856. func ExampleRDS_DownloadDBLogFilePortion_shared00() {
  1857. svc := rds.New(session.New())
  1858. input := &rds.DownloadDBLogFilePortionInput{
  1859. DBInstanceIdentifier: aws.String("mymysqlinstance"),
  1860. LogFileName: aws.String("mysqlUpgrade"),
  1861. }
  1862. result, err := svc.DownloadDBLogFilePortion(input)
  1863. if err != nil {
  1864. if aerr, ok := err.(awserr.Error); ok {
  1865. switch aerr.Code() {
  1866. case rds.ErrCodeDBInstanceNotFoundFault:
  1867. fmt.Println(rds.ErrCodeDBInstanceNotFoundFault, aerr.Error())
  1868. case rds.ErrCodeDBLogFileNotFoundFault:
  1869. fmt.Println(rds.ErrCodeDBLogFileNotFoundFault, aerr.Error())
  1870. default:
  1871. fmt.Println(aerr.Error())
  1872. }
  1873. } else {
  1874. // Print the error, cast err to awserr.Error to get the Code and
  1875. // Message from an error.
  1876. fmt.Println(err.Error())
  1877. }
  1878. return
  1879. }
  1880. fmt.Println(result)
  1881. }
  1882. // To perform a failover for a DB cluster
  1883. //
  1884. // This example performs a failover for the specified DB cluster to the specified DB
  1885. // instance.
  1886. func ExampleRDS_FailoverDBCluster_shared00() {
  1887. svc := rds.New(session.New())
  1888. input := &rds.FailoverDBClusterInput{
  1889. DBClusterIdentifier: aws.String("myaurorainstance-cluster"),
  1890. TargetDBInstanceIdentifier: aws.String("myaurorareplica"),
  1891. }
  1892. result, err := svc.FailoverDBCluster(input)
  1893. if err != nil {
  1894. if aerr, ok := err.(awserr.Error); ok {
  1895. switch aerr.Code() {
  1896. case rds.ErrCodeDBClusterNotFoundFault:
  1897. fmt.Println(rds.ErrCodeDBClusterNotFoundFault, aerr.Error())
  1898. case rds.ErrCodeInvalidDBClusterStateFault:
  1899. fmt.Println(rds.ErrCodeInvalidDBClusterStateFault, aerr.Error())
  1900. case rds.ErrCodeInvalidDBInstanceStateFault:
  1901. fmt.Println(rds.ErrCodeInvalidDBInstanceStateFault, aerr.Error())
  1902. default:
  1903. fmt.Println(aerr.Error())
  1904. }
  1905. } else {
  1906. // Print the error, cast err to awserr.Error to get the Code and
  1907. // Message from an error.
  1908. fmt.Println(err.Error())
  1909. }
  1910. return
  1911. }
  1912. fmt.Println(result)
  1913. }
  1914. // To list information about tags associated with a resource
  1915. //
  1916. // This example lists information about all tags associated with the specified DB option
  1917. // group.
  1918. func ExampleRDS_ListTagsForResource_shared00() {
  1919. svc := rds.New(session.New())
  1920. input := &rds.ListTagsForResourceInput{
  1921. ResourceName: aws.String("arn:aws:rds:us-east-1:992648334831:og:mymysqloptiongroup"),
  1922. }
  1923. result, err := svc.ListTagsForResource(input)
  1924. if err != nil {
  1925. if aerr, ok := err.(awserr.Error); ok {
  1926. switch aerr.Code() {
  1927. case rds.ErrCodeDBInstanceNotFoundFault:
  1928. fmt.Println(rds.ErrCodeDBInstanceNotFoundFault, aerr.Error())
  1929. case rds.ErrCodeDBSnapshotNotFoundFault:
  1930. fmt.Println(rds.ErrCodeDBSnapshotNotFoundFault, aerr.Error())
  1931. case rds.ErrCodeDBClusterNotFoundFault:
  1932. fmt.Println(rds.ErrCodeDBClusterNotFoundFault, aerr.Error())
  1933. default:
  1934. fmt.Println(aerr.Error())
  1935. }
  1936. } else {
  1937. // Print the error, cast err to awserr.Error to get the Code and
  1938. // Message from an error.
  1939. fmt.Println(err.Error())
  1940. }
  1941. return
  1942. }
  1943. fmt.Println(result)
  1944. }
  1945. // To change DB cluster settings
  1946. //
  1947. // This example changes the specified settings for the specified DB cluster.
  1948. func ExampleRDS_ModifyDBCluster_shared00() {
  1949. svc := rds.New(session.New())
  1950. input := &rds.ModifyDBClusterInput{
  1951. ApplyImmediately: aws.Bool(true),
  1952. DBClusterIdentifier: aws.String("mydbcluster"),
  1953. MasterUserPassword: aws.String("mynewpassword"),
  1954. NewDBClusterIdentifier: aws.String("mynewdbcluster"),
  1955. PreferredBackupWindow: aws.String("04:00-04:30"),
  1956. PreferredMaintenanceWindow: aws.String("Tue:05:00-Tue:05:30"),
  1957. }
  1958. result, err := svc.ModifyDBCluster(input)
  1959. if err != nil {
  1960. if aerr, ok := err.(awserr.Error); ok {
  1961. switch aerr.Code() {
  1962. case rds.ErrCodeDBClusterNotFoundFault:
  1963. fmt.Println(rds.ErrCodeDBClusterNotFoundFault, aerr.Error())
  1964. case rds.ErrCodeInvalidDBClusterStateFault:
  1965. fmt.Println(rds.ErrCodeInvalidDBClusterStateFault, aerr.Error())
  1966. case rds.ErrCodeStorageQuotaExceededFault:
  1967. fmt.Println(rds.ErrCodeStorageQuotaExceededFault, aerr.Error())
  1968. case rds.ErrCodeDBSubnetGroupNotFoundFault:
  1969. fmt.Println(rds.ErrCodeDBSubnetGroupNotFoundFault, aerr.Error())
  1970. case rds.ErrCodeInvalidVPCNetworkStateFault:
  1971. fmt.Println(rds.ErrCodeInvalidVPCNetworkStateFault, aerr.Error())
  1972. case rds.ErrCodeInvalidDBSubnetGroupStateFault:
  1973. fmt.Println(rds.ErrCodeInvalidDBSubnetGroupStateFault, aerr.Error())
  1974. case rds.ErrCodeInvalidSubnet:
  1975. fmt.Println(rds.ErrCodeInvalidSubnet, aerr.Error())
  1976. case rds.ErrCodeDBClusterParameterGroupNotFoundFault:
  1977. fmt.Println(rds.ErrCodeDBClusterParameterGroupNotFoundFault, aerr.Error())
  1978. case rds.ErrCodeInvalidDBSecurityGroupStateFault:
  1979. fmt.Println(rds.ErrCodeInvalidDBSecurityGroupStateFault, aerr.Error())
  1980. case rds.ErrCodeInvalidDBInstanceStateFault:
  1981. fmt.Println(rds.ErrCodeInvalidDBInstanceStateFault, aerr.Error())
  1982. case rds.ErrCodeDBClusterAlreadyExistsFault:
  1983. fmt.Println(rds.ErrCodeDBClusterAlreadyExistsFault, aerr.Error())
  1984. default:
  1985. fmt.Println(aerr.Error())
  1986. }
  1987. } else {
  1988. // Print the error, cast err to awserr.Error to get the Code and
  1989. // Message from an error.
  1990. fmt.Println(err.Error())
  1991. }
  1992. return
  1993. }
  1994. fmt.Println(result)
  1995. }
  1996. // To change DB cluster parameter group settings
  1997. //
  1998. // This example immediately changes the specified setting for the specified DB cluster
  1999. // parameter group.
  2000. func ExampleRDS_ModifyDBClusterParameterGroup_shared00() {
  2001. svc := rds.New(session.New())
  2002. input := &rds.ModifyDBClusterParameterGroupInput{
  2003. DBClusterParameterGroupName: aws.String("mydbclusterparametergroup"),
  2004. Parameters: []*rds.Parameter{
  2005. {
  2006. ApplyMethod: aws.String("immediate"),
  2007. ParameterName: aws.String("time_zone"),
  2008. ParameterValue: aws.String("America/Phoenix"),
  2009. },
  2010. },
  2011. }
  2012. result, err := svc.ModifyDBClusterParameterGroup(input)
  2013. if err != nil {
  2014. if aerr, ok := err.(awserr.Error); ok {
  2015. switch aerr.Code() {
  2016. case rds.ErrCodeDBParameterGroupNotFoundFault:
  2017. fmt.Println(rds.ErrCodeDBParameterGroupNotFoundFault, aerr.Error())
  2018. case rds.ErrCodeInvalidDBParameterGroupStateFault:
  2019. fmt.Println(rds.ErrCodeInvalidDBParameterGroupStateFault, aerr.Error())
  2020. default:
  2021. fmt.Println(aerr.Error())
  2022. }
  2023. } else {
  2024. // Print the error, cast err to awserr.Error to get the Code and
  2025. // Message from an error.
  2026. fmt.Println(err.Error())
  2027. }
  2028. return
  2029. }
  2030. fmt.Println(result)
  2031. }
  2032. // To add or remove access to a manual DB cluster snapshot
  2033. //
  2034. // The following example gives two AWS accounts access to a manual DB cluster snapshot
  2035. // and ensures that the DB cluster snapshot is private by removing the value "all".
  2036. func ExampleRDS_ModifyDBClusterSnapshotAttribute_shared00() {
  2037. svc := rds.New(session.New())
  2038. input := &rds.ModifyDBClusterSnapshotAttributeInput{
  2039. AttributeName: aws.String("restore"),
  2040. DBClusterSnapshotIdentifier: aws.String("manual-cluster-snapshot1"),
  2041. ValuesToAdd: []*string{
  2042. aws.String("123451234512"),
  2043. aws.String("123456789012"),
  2044. },
  2045. ValuesToRemove: []*string{
  2046. aws.String("all"),
  2047. },
  2048. }
  2049. result, err := svc.ModifyDBClusterSnapshotAttribute(input)
  2050. if err != nil {
  2051. if aerr, ok := err.(awserr.Error); ok {
  2052. switch aerr.Code() {
  2053. case rds.ErrCodeDBClusterSnapshotNotFoundFault:
  2054. fmt.Println(rds.ErrCodeDBClusterSnapshotNotFoundFault, aerr.Error())
  2055. case rds.ErrCodeInvalidDBClusterSnapshotStateFault:
  2056. fmt.Println(rds.ErrCodeInvalidDBClusterSnapshotStateFault, aerr.Error())
  2057. case rds.ErrCodeSharedSnapshotQuotaExceededFault:
  2058. fmt.Println(rds.ErrCodeSharedSnapshotQuotaExceededFault, aerr.Error())
  2059. default:
  2060. fmt.Println(aerr.Error())
  2061. }
  2062. } else {
  2063. // Print the error, cast err to awserr.Error to get the Code and
  2064. // Message from an error.
  2065. fmt.Println(err.Error())
  2066. }
  2067. return
  2068. }
  2069. fmt.Println(result)
  2070. }
  2071. // To change DB instance settings
  2072. //
  2073. // This example immediately changes the specified settings for the specified DB instance.
  2074. func ExampleRDS_ModifyDBInstance_shared00() {
  2075. svc := rds.New(session.New())
  2076. input := &rds.ModifyDBInstanceInput{
  2077. AllocatedStorage: aws.Int64(10),
  2078. ApplyImmediately: aws.Bool(true),
  2079. BackupRetentionPeriod: aws.Int64(1),
  2080. DBInstanceClass: aws.String("db.t2.small"),
  2081. DBInstanceIdentifier: aws.String("mymysqlinstance"),
  2082. MasterUserPassword: aws.String("mynewpassword"),
  2083. PreferredBackupWindow: aws.String("04:00-04:30"),
  2084. PreferredMaintenanceWindow: aws.String("Tue:05:00-Tue:05:30"),
  2085. }
  2086. result, err := svc.ModifyDBInstance(input)
  2087. if err != nil {
  2088. if aerr, ok := err.(awserr.Error); ok {
  2089. switch aerr.Code() {
  2090. case rds.ErrCodeInvalidDBInstanceStateFault:
  2091. fmt.Println(rds.ErrCodeInvalidDBInstanceStateFault, aerr.Error())
  2092. case rds.ErrCodeInvalidDBSecurityGroupStateFault:
  2093. fmt.Println(rds.ErrCodeInvalidDBSecurityGroupStateFault, aerr.Error())
  2094. case rds.ErrCodeDBInstanceAlreadyExistsFault:
  2095. fmt.Println(rds.ErrCodeDBInstanceAlreadyExistsFault, aerr.Error())
  2096. case rds.ErrCodeDBInstanceNotFoundFault:
  2097. fmt.Println(rds.ErrCodeDBInstanceNotFoundFault, aerr.Error())
  2098. case rds.ErrCodeDBSecurityGroupNotFoundFault:
  2099. fmt.Println(rds.ErrCodeDBSecurityGroupNotFoundFault, aerr.Error())
  2100. case rds.ErrCodeDBParameterGroupNotFoundFault:
  2101. fmt.Println(rds.ErrCodeDBParameterGroupNotFoundFault, aerr.Error())
  2102. case rds.ErrCodeInsufficientDBInstanceCapacityFault:
  2103. fmt.Println(rds.ErrCodeInsufficientDBInstanceCapacityFault, aerr.Error())
  2104. case rds.ErrCodeStorageQuotaExceededFault:
  2105. fmt.Println(rds.ErrCodeStorageQuotaExceededFault, aerr.Error())
  2106. case rds.ErrCodeInvalidVPCNetworkStateFault:
  2107. fmt.Println(rds.ErrCodeInvalidVPCNetworkStateFault, aerr.Error())
  2108. case rds.ErrCodeProvisionedIopsNotAvailableInAZFault:
  2109. fmt.Println(rds.ErrCodeProvisionedIopsNotAvailableInAZFault, aerr.Error())
  2110. case rds.ErrCodeOptionGroupNotFoundFault:
  2111. fmt.Println(rds.ErrCodeOptionGroupNotFoundFault, aerr.Error())
  2112. case rds.ErrCodeDBUpgradeDependencyFailureFault:
  2113. fmt.Println(rds.ErrCodeDBUpgradeDependencyFailureFault, aerr.Error())
  2114. case rds.ErrCodeStorageTypeNotSupportedFault:
  2115. fmt.Println(rds.ErrCodeStorageTypeNotSupportedFault, aerr.Error())
  2116. case rds.ErrCodeAuthorizationNotFoundFault:
  2117. fmt.Println(rds.ErrCodeAuthorizationNotFoundFault, aerr.Error())
  2118. case rds.ErrCodeCertificateNotFoundFault:
  2119. fmt.Println(rds.ErrCodeCertificateNotFoundFault, aerr.Error())
  2120. case rds.ErrCodeDomainNotFoundFault:
  2121. fmt.Println(rds.ErrCodeDomainNotFoundFault, aerr.Error())
  2122. case rds.ErrCodeBackupPolicyNotFoundFault:
  2123. fmt.Println(rds.ErrCodeBackupPolicyNotFoundFault, aerr.Error())
  2124. default:
  2125. fmt.Println(aerr.Error())
  2126. }
  2127. } else {
  2128. // Print the error, cast err to awserr.Error to get the Code and
  2129. // Message from an error.
  2130. fmt.Println(err.Error())
  2131. }
  2132. return
  2133. }
  2134. fmt.Println(result)
  2135. }
  2136. // To change DB parameter group settings
  2137. //
  2138. // This example immediately changes the specified setting for the specified DB parameter
  2139. // group.
  2140. func ExampleRDS_ModifyDBParameterGroup_shared00() {
  2141. svc := rds.New(session.New())
  2142. input := &rds.ModifyDBParameterGroupInput{
  2143. DBParameterGroupName: aws.String("mymysqlparametergroup"),
  2144. Parameters: []*rds.Parameter{
  2145. {
  2146. ApplyMethod: aws.String("immediate"),
  2147. ParameterName: aws.String("time_zone"),
  2148. ParameterValue: aws.String("America/Phoenix"),
  2149. },
  2150. },
  2151. }
  2152. result, err := svc.ModifyDBParameterGroup(input)
  2153. if err != nil {
  2154. if aerr, ok := err.(awserr.Error); ok {
  2155. switch aerr.Code() {
  2156. case rds.ErrCodeDBParameterGroupNotFoundFault:
  2157. fmt.Println(rds.ErrCodeDBParameterGroupNotFoundFault, aerr.Error())
  2158. case rds.ErrCodeInvalidDBParameterGroupStateFault:
  2159. fmt.Println(rds.ErrCodeInvalidDBParameterGroupStateFault, aerr.Error())
  2160. default:
  2161. fmt.Println(aerr.Error())
  2162. }
  2163. } else {
  2164. // Print the error, cast err to awserr.Error to get the Code and
  2165. // Message from an error.
  2166. fmt.Println(err.Error())
  2167. }
  2168. return
  2169. }
  2170. fmt.Println(result)
  2171. }
  2172. // To change DB snapshot attributes
  2173. //
  2174. // This example adds the specified attribute for the specified DB snapshot.
  2175. func ExampleRDS_ModifyDBSnapshotAttribute_shared00() {
  2176. svc := rds.New(session.New())
  2177. input := &rds.ModifyDBSnapshotAttributeInput{
  2178. AttributeName: aws.String("restore"),
  2179. DBSnapshotIdentifier: aws.String("mydbsnapshot"),
  2180. ValuesToAdd: []*string{
  2181. aws.String("all"),
  2182. },
  2183. }
  2184. result, err := svc.ModifyDBSnapshotAttribute(input)
  2185. if err != nil {
  2186. if aerr, ok := err.(awserr.Error); ok {
  2187. switch aerr.Code() {
  2188. case rds.ErrCodeDBSnapshotNotFoundFault:
  2189. fmt.Println(rds.ErrCodeDBSnapshotNotFoundFault, aerr.Error())
  2190. case rds.ErrCodeInvalidDBSnapshotStateFault:
  2191. fmt.Println(rds.ErrCodeInvalidDBSnapshotStateFault, aerr.Error())
  2192. case rds.ErrCodeSharedSnapshotQuotaExceededFault:
  2193. fmt.Println(rds.ErrCodeSharedSnapshotQuotaExceededFault, aerr.Error())
  2194. default:
  2195. fmt.Println(aerr.Error())
  2196. }
  2197. } else {
  2198. // Print the error, cast err to awserr.Error to get the Code and
  2199. // Message from an error.
  2200. fmt.Println(err.Error())
  2201. }
  2202. return
  2203. }
  2204. fmt.Println(result)
  2205. }
  2206. // To change DB subnet group settings
  2207. //
  2208. // This example changes the specified setting for the specified DB subnet group.
  2209. func ExampleRDS_ModifyDBSubnetGroup_shared00() {
  2210. svc := rds.New(session.New())
  2211. input := &rds.ModifyDBSubnetGroupInput{
  2212. DBSubnetGroupName: aws.String("mydbsubnetgroup"),
  2213. SubnetIds: []*string{
  2214. aws.String("subnet-70e1975a"),
  2215. aws.String("subnet-747a5c49"),
  2216. },
  2217. }
  2218. result, err := svc.ModifyDBSubnetGroup(input)
  2219. if err != nil {
  2220. if aerr, ok := err.(awserr.Error); ok {
  2221. switch aerr.Code() {
  2222. case rds.ErrCodeDBSubnetGroupNotFoundFault:
  2223. fmt.Println(rds.ErrCodeDBSubnetGroupNotFoundFault, aerr.Error())
  2224. case rds.ErrCodeDBSubnetQuotaExceededFault:
  2225. fmt.Println(rds.ErrCodeDBSubnetQuotaExceededFault, aerr.Error())
  2226. case rds.ErrCodeSubnetAlreadyInUse:
  2227. fmt.Println(rds.ErrCodeSubnetAlreadyInUse, aerr.Error())
  2228. case rds.ErrCodeDBSubnetGroupDoesNotCoverEnoughAZs:
  2229. fmt.Println(rds.ErrCodeDBSubnetGroupDoesNotCoverEnoughAZs, aerr.Error())
  2230. case rds.ErrCodeInvalidSubnet:
  2231. fmt.Println(rds.ErrCodeInvalidSubnet, aerr.Error())
  2232. default:
  2233. fmt.Println(aerr.Error())
  2234. }
  2235. } else {
  2236. // Print the error, cast err to awserr.Error to get the Code and
  2237. // Message from an error.
  2238. fmt.Println(err.Error())
  2239. }
  2240. return
  2241. }
  2242. fmt.Println(result)
  2243. }
  2244. // To change event notification subscription settings
  2245. //
  2246. // This example changes the specified setting for the specified event notification subscription.
  2247. func ExampleRDS_ModifyEventSubscription_shared00() {
  2248. svc := rds.New(session.New())
  2249. input := &rds.ModifyEventSubscriptionInput{
  2250. Enabled: aws.Bool(true),
  2251. EventCategories: []*string{
  2252. aws.String("deletion"),
  2253. aws.String("low storage"),
  2254. },
  2255. SourceType: aws.String("db-instance"),
  2256. SubscriptionName: aws.String("mymysqleventsubscription"),
  2257. }
  2258. result, err := svc.ModifyEventSubscription(input)
  2259. if err != nil {
  2260. if aerr, ok := err.(awserr.Error); ok {
  2261. switch aerr.Code() {
  2262. case rds.ErrCodeEventSubscriptionQuotaExceededFault:
  2263. fmt.Println(rds.ErrCodeEventSubscriptionQuotaExceededFault, aerr.Error())
  2264. case rds.ErrCodeSubscriptionNotFoundFault:
  2265. fmt.Println(rds.ErrCodeSubscriptionNotFoundFault, aerr.Error())
  2266. case rds.ErrCodeSNSInvalidTopicFault:
  2267. fmt.Println(rds.ErrCodeSNSInvalidTopicFault, aerr.Error())
  2268. case rds.ErrCodeSNSNoAuthorizationFault:
  2269. fmt.Println(rds.ErrCodeSNSNoAuthorizationFault, aerr.Error())
  2270. case rds.ErrCodeSNSTopicArnNotFoundFault:
  2271. fmt.Println(rds.ErrCodeSNSTopicArnNotFoundFault, aerr.Error())
  2272. case rds.ErrCodeSubscriptionCategoryNotFoundFault:
  2273. fmt.Println(rds.ErrCodeSubscriptionCategoryNotFoundFault, aerr.Error())
  2274. default:
  2275. fmt.Println(aerr.Error())
  2276. }
  2277. } else {
  2278. // Print the error, cast err to awserr.Error to get the Code and
  2279. // Message from an error.
  2280. fmt.Println(err.Error())
  2281. }
  2282. return
  2283. }
  2284. fmt.Println(result)
  2285. }
  2286. // To modify an option group
  2287. //
  2288. // The following example adds an option to an option group.
  2289. func ExampleRDS_ModifyOptionGroup_shared00() {
  2290. svc := rds.New(session.New())
  2291. input := &rds.ModifyOptionGroupInput{
  2292. ApplyImmediately: aws.Bool(true),
  2293. OptionGroupName: aws.String("myawsuser-og02"),
  2294. OptionsToInclude: []*rds.OptionConfiguration{
  2295. {
  2296. DBSecurityGroupMemberships: []*string{
  2297. aws.String("default"),
  2298. },
  2299. OptionName: aws.String("MEMCACHED"),
  2300. },
  2301. },
  2302. }
  2303. result, err := svc.ModifyOptionGroup(input)
  2304. if err != nil {
  2305. if aerr, ok := err.(awserr.Error); ok {
  2306. switch aerr.Code() {
  2307. case rds.ErrCodeInvalidOptionGroupStateFault:
  2308. fmt.Println(rds.ErrCodeInvalidOptionGroupStateFault, aerr.Error())
  2309. case rds.ErrCodeOptionGroupNotFoundFault:
  2310. fmt.Println(rds.ErrCodeOptionGroupNotFoundFault, aerr.Error())
  2311. default:
  2312. fmt.Println(aerr.Error())
  2313. }
  2314. } else {
  2315. // Print the error, cast err to awserr.Error to get the Code and
  2316. // Message from an error.
  2317. fmt.Println(err.Error())
  2318. }
  2319. return
  2320. }
  2321. fmt.Println(result)
  2322. }
  2323. // To promote a read replica
  2324. //
  2325. // This example promotes the specified read replica and sets its backup retention period
  2326. // and preferred backup window.
  2327. func ExampleRDS_PromoteReadReplica_shared00() {
  2328. svc := rds.New(session.New())
  2329. input := &rds.PromoteReadReplicaInput{
  2330. BackupRetentionPeriod: aws.Int64(1),
  2331. DBInstanceIdentifier: aws.String("mydbreadreplica"),
  2332. PreferredBackupWindow: aws.String("03:30-04:00"),
  2333. }
  2334. result, err := svc.PromoteReadReplica(input)
  2335. if err != nil {
  2336. if aerr, ok := err.(awserr.Error); ok {
  2337. switch aerr.Code() {
  2338. case rds.ErrCodeInvalidDBInstanceStateFault:
  2339. fmt.Println(rds.ErrCodeInvalidDBInstanceStateFault, aerr.Error())
  2340. case rds.ErrCodeDBInstanceNotFoundFault:
  2341. fmt.Println(rds.ErrCodeDBInstanceNotFoundFault, aerr.Error())
  2342. default:
  2343. fmt.Println(aerr.Error())
  2344. }
  2345. } else {
  2346. // Print the error, cast err to awserr.Error to get the Code and
  2347. // Message from an error.
  2348. fmt.Println(err.Error())
  2349. }
  2350. return
  2351. }
  2352. fmt.Println(result)
  2353. }
  2354. // To purchase a reserved DB instance offering
  2355. //
  2356. // This example purchases a reserved DB instance offering that matches the specified
  2357. // settings.
  2358. func ExampleRDS_PurchaseReservedDBInstancesOffering_shared00() {
  2359. svc := rds.New(session.New())
  2360. input := &rds.PurchaseReservedDBInstancesOfferingInput{
  2361. ReservedDBInstanceId: aws.String("myreservationid"),
  2362. ReservedDBInstancesOfferingId: aws.String("fb29428a-646d-4390-850e-5fe89926e727"),
  2363. }
  2364. result, err := svc.PurchaseReservedDBInstancesOffering(input)
  2365. if err != nil {
  2366. if aerr, ok := err.(awserr.Error); ok {
  2367. switch aerr.Code() {
  2368. case rds.ErrCodeReservedDBInstancesOfferingNotFoundFault:
  2369. fmt.Println(rds.ErrCodeReservedDBInstancesOfferingNotFoundFault, aerr.Error())
  2370. case rds.ErrCodeReservedDBInstanceAlreadyExistsFault:
  2371. fmt.Println(rds.ErrCodeReservedDBInstanceAlreadyExistsFault, aerr.Error())
  2372. case rds.ErrCodeReservedDBInstanceQuotaExceededFault:
  2373. fmt.Println(rds.ErrCodeReservedDBInstanceQuotaExceededFault, aerr.Error())
  2374. default:
  2375. fmt.Println(aerr.Error())
  2376. }
  2377. } else {
  2378. // Print the error, cast err to awserr.Error to get the Code and
  2379. // Message from an error.
  2380. fmt.Println(err.Error())
  2381. }
  2382. return
  2383. }
  2384. fmt.Println(result)
  2385. }
  2386. // To reboot a DB instance
  2387. //
  2388. // This example reboots the specified DB instance without forcing a failover.
  2389. func ExampleRDS_RebootDBInstance_shared00() {
  2390. svc := rds.New(session.New())
  2391. input := &rds.RebootDBInstanceInput{
  2392. DBInstanceIdentifier: aws.String("mymysqlinstance"),
  2393. ForceFailover: aws.Bool(false),
  2394. }
  2395. result, err := svc.RebootDBInstance(input)
  2396. if err != nil {
  2397. if aerr, ok := err.(awserr.Error); ok {
  2398. switch aerr.Code() {
  2399. case rds.ErrCodeInvalidDBInstanceStateFault:
  2400. fmt.Println(rds.ErrCodeInvalidDBInstanceStateFault, aerr.Error())
  2401. case rds.ErrCodeDBInstanceNotFoundFault:
  2402. fmt.Println(rds.ErrCodeDBInstanceNotFoundFault, aerr.Error())
  2403. default:
  2404. fmt.Println(aerr.Error())
  2405. }
  2406. } else {
  2407. // Print the error, cast err to awserr.Error to get the Code and
  2408. // Message from an error.
  2409. fmt.Println(err.Error())
  2410. }
  2411. return
  2412. }
  2413. fmt.Println(result)
  2414. }
  2415. // To remove a source identifier from a DB event subscription
  2416. //
  2417. // This example removes the specified source identifier from the specified DB event
  2418. // subscription.
  2419. func ExampleRDS_RemoveSourceIdentifierFromSubscription_shared00() {
  2420. svc := rds.New(session.New())
  2421. input := &rds.RemoveSourceIdentifierFromSubscriptionInput{
  2422. SourceIdentifier: aws.String("mymysqlinstance"),
  2423. SubscriptionName: aws.String("myeventsubscription"),
  2424. }
  2425. result, err := svc.RemoveSourceIdentifierFromSubscription(input)
  2426. if err != nil {
  2427. if aerr, ok := err.(awserr.Error); ok {
  2428. switch aerr.Code() {
  2429. case rds.ErrCodeSubscriptionNotFoundFault:
  2430. fmt.Println(rds.ErrCodeSubscriptionNotFoundFault, aerr.Error())
  2431. case rds.ErrCodeSourceNotFoundFault:
  2432. fmt.Println(rds.ErrCodeSourceNotFoundFault, aerr.Error())
  2433. default:
  2434. fmt.Println(aerr.Error())
  2435. }
  2436. } else {
  2437. // Print the error, cast err to awserr.Error to get the Code and
  2438. // Message from an error.
  2439. fmt.Println(err.Error())
  2440. }
  2441. return
  2442. }
  2443. fmt.Println(result)
  2444. }
  2445. // To remove tags from a resource
  2446. //
  2447. // This example removes the specified tag associated with the specified DB option group.
  2448. func ExampleRDS_RemoveTagsFromResource_shared00() {
  2449. svc := rds.New(session.New())
  2450. input := &rds.RemoveTagsFromResourceInput{
  2451. ResourceName: aws.String("arn:aws:rds:us-east-1:992648334831:og:mydboptiongroup"),
  2452. TagKeys: []*string{
  2453. aws.String("MyKey"),
  2454. },
  2455. }
  2456. result, err := svc.RemoveTagsFromResource(input)
  2457. if err != nil {
  2458. if aerr, ok := err.(awserr.Error); ok {
  2459. switch aerr.Code() {
  2460. case rds.ErrCodeDBInstanceNotFoundFault:
  2461. fmt.Println(rds.ErrCodeDBInstanceNotFoundFault, aerr.Error())
  2462. case rds.ErrCodeDBSnapshotNotFoundFault:
  2463. fmt.Println(rds.ErrCodeDBSnapshotNotFoundFault, aerr.Error())
  2464. case rds.ErrCodeDBClusterNotFoundFault:
  2465. fmt.Println(rds.ErrCodeDBClusterNotFoundFault, aerr.Error())
  2466. default:
  2467. fmt.Println(aerr.Error())
  2468. }
  2469. } else {
  2470. // Print the error, cast err to awserr.Error to get the Code and
  2471. // Message from an error.
  2472. fmt.Println(err.Error())
  2473. }
  2474. return
  2475. }
  2476. fmt.Println(result)
  2477. }
  2478. // To reset the values of a DB cluster parameter group
  2479. //
  2480. // This example resets all parameters for the specified DB cluster parameter group to
  2481. // their default values.
  2482. func ExampleRDS_ResetDBClusterParameterGroup_shared00() {
  2483. svc := rds.New(session.New())
  2484. input := &rds.ResetDBClusterParameterGroupInput{
  2485. DBClusterParameterGroupName: aws.String("mydbclusterparametergroup"),
  2486. ResetAllParameters: aws.Bool(true),
  2487. }
  2488. result, err := svc.ResetDBClusterParameterGroup(input)
  2489. if err != nil {
  2490. if aerr, ok := err.(awserr.Error); ok {
  2491. switch aerr.Code() {
  2492. case rds.ErrCodeInvalidDBParameterGroupStateFault:
  2493. fmt.Println(rds.ErrCodeInvalidDBParameterGroupStateFault, aerr.Error())
  2494. case rds.ErrCodeDBParameterGroupNotFoundFault:
  2495. fmt.Println(rds.ErrCodeDBParameterGroupNotFoundFault, aerr.Error())
  2496. default:
  2497. fmt.Println(aerr.Error())
  2498. }
  2499. } else {
  2500. // Print the error, cast err to awserr.Error to get the Code and
  2501. // Message from an error.
  2502. fmt.Println(err.Error())
  2503. }
  2504. return
  2505. }
  2506. fmt.Println(result)
  2507. }
  2508. // To reset the values of a DB parameter group
  2509. //
  2510. // This example resets all parameters for the specified DB parameter group to their
  2511. // default values.
  2512. func ExampleRDS_ResetDBParameterGroup_shared00() {
  2513. svc := rds.New(session.New())
  2514. input := &rds.ResetDBParameterGroupInput{
  2515. DBParameterGroupName: aws.String("mydbparametergroup"),
  2516. ResetAllParameters: aws.Bool(true),
  2517. }
  2518. result, err := svc.ResetDBParameterGroup(input)
  2519. if err != nil {
  2520. if aerr, ok := err.(awserr.Error); ok {
  2521. switch aerr.Code() {
  2522. case rds.ErrCodeInvalidDBParameterGroupStateFault:
  2523. fmt.Println(rds.ErrCodeInvalidDBParameterGroupStateFault, aerr.Error())
  2524. case rds.ErrCodeDBParameterGroupNotFoundFault:
  2525. fmt.Println(rds.ErrCodeDBParameterGroupNotFoundFault, aerr.Error())
  2526. default:
  2527. fmt.Println(aerr.Error())
  2528. }
  2529. } else {
  2530. // Print the error, cast err to awserr.Error to get the Code and
  2531. // Message from an error.
  2532. fmt.Println(err.Error())
  2533. }
  2534. return
  2535. }
  2536. fmt.Println(result)
  2537. }
  2538. // To restore an Amazon Aurora DB cluster from a DB cluster snapshot
  2539. //
  2540. // The following example restores an Amazon Aurora DB cluster from a DB cluster snapshot.
  2541. func ExampleRDS_RestoreDBClusterFromSnapshot_shared00() {
  2542. svc := rds.New(session.New())
  2543. input := &rds.RestoreDBClusterFromSnapshotInput{
  2544. DBClusterIdentifier: aws.String("restored-cluster1"),
  2545. Engine: aws.String("aurora"),
  2546. SnapshotIdentifier: aws.String("sample-cluster-snapshot1"),
  2547. }
  2548. result, err := svc.RestoreDBClusterFromSnapshot(input)
  2549. if err != nil {
  2550. if aerr, ok := err.(awserr.Error); ok {
  2551. switch aerr.Code() {
  2552. case rds.ErrCodeDBClusterAlreadyExistsFault:
  2553. fmt.Println(rds.ErrCodeDBClusterAlreadyExistsFault, aerr.Error())
  2554. case rds.ErrCodeDBClusterQuotaExceededFault:
  2555. fmt.Println(rds.ErrCodeDBClusterQuotaExceededFault, aerr.Error())
  2556. case rds.ErrCodeStorageQuotaExceededFault:
  2557. fmt.Println(rds.ErrCodeStorageQuotaExceededFault, aerr.Error())
  2558. case rds.ErrCodeDBSubnetGroupNotFoundFault:
  2559. fmt.Println(rds.ErrCodeDBSubnetGroupNotFoundFault, aerr.Error())
  2560. case rds.ErrCodeDBSnapshotNotFoundFault:
  2561. fmt.Println(rds.ErrCodeDBSnapshotNotFoundFault, aerr.Error())
  2562. case rds.ErrCodeDBClusterSnapshotNotFoundFault:
  2563. fmt.Println(rds.ErrCodeDBClusterSnapshotNotFoundFault, aerr.Error())
  2564. case rds.ErrCodeInsufficientDBClusterCapacityFault:
  2565. fmt.Println(rds.ErrCodeInsufficientDBClusterCapacityFault, aerr.Error())
  2566. case rds.ErrCodeInsufficientStorageClusterCapacityFault:
  2567. fmt.Println(rds.ErrCodeInsufficientStorageClusterCapacityFault, aerr.Error())
  2568. case rds.ErrCodeInvalidDBSnapshotStateFault:
  2569. fmt.Println(rds.ErrCodeInvalidDBSnapshotStateFault, aerr.Error())
  2570. case rds.ErrCodeInvalidDBClusterSnapshotStateFault:
  2571. fmt.Println(rds.ErrCodeInvalidDBClusterSnapshotStateFault, aerr.Error())
  2572. case rds.ErrCodeInvalidVPCNetworkStateFault:
  2573. fmt.Println(rds.ErrCodeInvalidVPCNetworkStateFault, aerr.Error())
  2574. case rds.ErrCodeInvalidRestoreFault:
  2575. fmt.Println(rds.ErrCodeInvalidRestoreFault, aerr.Error())
  2576. case rds.ErrCodeInvalidSubnet:
  2577. fmt.Println(rds.ErrCodeInvalidSubnet, aerr.Error())
  2578. case rds.ErrCodeOptionGroupNotFoundFault:
  2579. fmt.Println(rds.ErrCodeOptionGroupNotFoundFault, aerr.Error())
  2580. case rds.ErrCodeKMSKeyNotAccessibleFault:
  2581. fmt.Println(rds.ErrCodeKMSKeyNotAccessibleFault, aerr.Error())
  2582. case rds.ErrCodeDBClusterParameterGroupNotFoundFault:
  2583. fmt.Println(rds.ErrCodeDBClusterParameterGroupNotFoundFault, aerr.Error())
  2584. default:
  2585. fmt.Println(aerr.Error())
  2586. }
  2587. } else {
  2588. // Print the error, cast err to awserr.Error to get the Code and
  2589. // Message from an error.
  2590. fmt.Println(err.Error())
  2591. }
  2592. return
  2593. }
  2594. fmt.Println(result)
  2595. }
  2596. // To restore a DB cluster to a point in time.
  2597. //
  2598. // The following example restores a DB cluster to a new DB cluster at a point in time
  2599. // from the source DB cluster.
  2600. func ExampleRDS_RestoreDBClusterToPointInTime_shared00() {
  2601. svc := rds.New(session.New())
  2602. input := &rds.RestoreDBClusterToPointInTimeInput{
  2603. DBClusterIdentifier: aws.String("sample-restored-cluster1"),
  2604. RestoreToTime: parseTime("2006-01-02T15:04:05Z", "2016-09-13T18:45:00Z"),
  2605. SourceDBClusterIdentifier: aws.String("sample-cluster1"),
  2606. }
  2607. result, err := svc.RestoreDBClusterToPointInTime(input)
  2608. if err != nil {
  2609. if aerr, ok := err.(awserr.Error); ok {
  2610. switch aerr.Code() {
  2611. case rds.ErrCodeDBClusterAlreadyExistsFault:
  2612. fmt.Println(rds.ErrCodeDBClusterAlreadyExistsFault, aerr.Error())
  2613. case rds.ErrCodeDBClusterNotFoundFault:
  2614. fmt.Println(rds.ErrCodeDBClusterNotFoundFault, aerr.Error())
  2615. case rds.ErrCodeDBClusterQuotaExceededFault:
  2616. fmt.Println(rds.ErrCodeDBClusterQuotaExceededFault, aerr.Error())
  2617. case rds.ErrCodeDBClusterSnapshotNotFoundFault:
  2618. fmt.Println(rds.ErrCodeDBClusterSnapshotNotFoundFault, aerr.Error())
  2619. case rds.ErrCodeDBSubnetGroupNotFoundFault:
  2620. fmt.Println(rds.ErrCodeDBSubnetGroupNotFoundFault, aerr.Error())
  2621. case rds.ErrCodeInsufficientDBClusterCapacityFault:
  2622. fmt.Println(rds.ErrCodeInsufficientDBClusterCapacityFault, aerr.Error())
  2623. case rds.ErrCodeInsufficientStorageClusterCapacityFault:
  2624. fmt.Println(rds.ErrCodeInsufficientStorageClusterCapacityFault, aerr.Error())
  2625. case rds.ErrCodeInvalidDBClusterSnapshotStateFault:
  2626. fmt.Println(rds.ErrCodeInvalidDBClusterSnapshotStateFault, aerr.Error())
  2627. case rds.ErrCodeInvalidDBClusterStateFault:
  2628. fmt.Println(rds.ErrCodeInvalidDBClusterStateFault, aerr.Error())
  2629. case rds.ErrCodeInvalidDBSnapshotStateFault:
  2630. fmt.Println(rds.ErrCodeInvalidDBSnapshotStateFault, aerr.Error())
  2631. case rds.ErrCodeInvalidRestoreFault:
  2632. fmt.Println(rds.ErrCodeInvalidRestoreFault, aerr.Error())
  2633. case rds.ErrCodeInvalidSubnet:
  2634. fmt.Println(rds.ErrCodeInvalidSubnet, aerr.Error())
  2635. case rds.ErrCodeInvalidVPCNetworkStateFault:
  2636. fmt.Println(rds.ErrCodeInvalidVPCNetworkStateFault, aerr.Error())
  2637. case rds.ErrCodeKMSKeyNotAccessibleFault:
  2638. fmt.Println(rds.ErrCodeKMSKeyNotAccessibleFault, aerr.Error())
  2639. case rds.ErrCodeOptionGroupNotFoundFault:
  2640. fmt.Println(rds.ErrCodeOptionGroupNotFoundFault, aerr.Error())
  2641. case rds.ErrCodeStorageQuotaExceededFault:
  2642. fmt.Println(rds.ErrCodeStorageQuotaExceededFault, aerr.Error())
  2643. case rds.ErrCodeDBClusterParameterGroupNotFoundFault:
  2644. fmt.Println(rds.ErrCodeDBClusterParameterGroupNotFoundFault, aerr.Error())
  2645. default:
  2646. fmt.Println(aerr.Error())
  2647. }
  2648. } else {
  2649. // Print the error, cast err to awserr.Error to get the Code and
  2650. // Message from an error.
  2651. fmt.Println(err.Error())
  2652. }
  2653. return
  2654. }
  2655. fmt.Println(result)
  2656. }
  2657. // To restore a DB instance from a DB snapshot.
  2658. //
  2659. // The following example restores a DB instance from a DB snapshot.
  2660. func ExampleRDS_RestoreDBInstanceFromDBSnapshot_shared00() {
  2661. svc := rds.New(session.New())
  2662. input := &rds.RestoreDBInstanceFromDBSnapshotInput{
  2663. DBInstanceIdentifier: aws.String("mysqldb-restored"),
  2664. DBSnapshotIdentifier: aws.String("rds:mysqldb-2014-04-22-08-15"),
  2665. }
  2666. result, err := svc.RestoreDBInstanceFromDBSnapshot(input)
  2667. if err != nil {
  2668. if aerr, ok := err.(awserr.Error); ok {
  2669. switch aerr.Code() {
  2670. case rds.ErrCodeDBInstanceAlreadyExistsFault:
  2671. fmt.Println(rds.ErrCodeDBInstanceAlreadyExistsFault, aerr.Error())
  2672. case rds.ErrCodeDBSnapshotNotFoundFault:
  2673. fmt.Println(rds.ErrCodeDBSnapshotNotFoundFault, aerr.Error())
  2674. case rds.ErrCodeInstanceQuotaExceededFault:
  2675. fmt.Println(rds.ErrCodeInstanceQuotaExceededFault, aerr.Error())
  2676. case rds.ErrCodeInsufficientDBInstanceCapacityFault:
  2677. fmt.Println(rds.ErrCodeInsufficientDBInstanceCapacityFault, aerr.Error())
  2678. case rds.ErrCodeInvalidDBSnapshotStateFault:
  2679. fmt.Println(rds.ErrCodeInvalidDBSnapshotStateFault, aerr.Error())
  2680. case rds.ErrCodeStorageQuotaExceededFault:
  2681. fmt.Println(rds.ErrCodeStorageQuotaExceededFault, aerr.Error())
  2682. case rds.ErrCodeInvalidVPCNetworkStateFault:
  2683. fmt.Println(rds.ErrCodeInvalidVPCNetworkStateFault, aerr.Error())
  2684. case rds.ErrCodeInvalidRestoreFault:
  2685. fmt.Println(rds.ErrCodeInvalidRestoreFault, aerr.Error())
  2686. case rds.ErrCodeDBSubnetGroupNotFoundFault:
  2687. fmt.Println(rds.ErrCodeDBSubnetGroupNotFoundFault, aerr.Error())
  2688. case rds.ErrCodeDBSubnetGroupDoesNotCoverEnoughAZs:
  2689. fmt.Println(rds.ErrCodeDBSubnetGroupDoesNotCoverEnoughAZs, aerr.Error())
  2690. case rds.ErrCodeInvalidSubnet:
  2691. fmt.Println(rds.ErrCodeInvalidSubnet, aerr.Error())
  2692. case rds.ErrCodeProvisionedIopsNotAvailableInAZFault:
  2693. fmt.Println(rds.ErrCodeProvisionedIopsNotAvailableInAZFault, aerr.Error())
  2694. case rds.ErrCodeOptionGroupNotFoundFault:
  2695. fmt.Println(rds.ErrCodeOptionGroupNotFoundFault, aerr.Error())
  2696. case rds.ErrCodeStorageTypeNotSupportedFault:
  2697. fmt.Println(rds.ErrCodeStorageTypeNotSupportedFault, aerr.Error())
  2698. case rds.ErrCodeAuthorizationNotFoundFault:
  2699. fmt.Println(rds.ErrCodeAuthorizationNotFoundFault, aerr.Error())
  2700. case rds.ErrCodeKMSKeyNotAccessibleFault:
  2701. fmt.Println(rds.ErrCodeKMSKeyNotAccessibleFault, aerr.Error())
  2702. case rds.ErrCodeDBSecurityGroupNotFoundFault:
  2703. fmt.Println(rds.ErrCodeDBSecurityGroupNotFoundFault, aerr.Error())
  2704. case rds.ErrCodeDomainNotFoundFault:
  2705. fmt.Println(rds.ErrCodeDomainNotFoundFault, aerr.Error())
  2706. case rds.ErrCodeDBParameterGroupNotFoundFault:
  2707. fmt.Println(rds.ErrCodeDBParameterGroupNotFoundFault, aerr.Error())
  2708. case rds.ErrCodeBackupPolicyNotFoundFault:
  2709. fmt.Println(rds.ErrCodeBackupPolicyNotFoundFault, aerr.Error())
  2710. default:
  2711. fmt.Println(aerr.Error())
  2712. }
  2713. } else {
  2714. // Print the error, cast err to awserr.Error to get the Code and
  2715. // Message from an error.
  2716. fmt.Println(err.Error())
  2717. }
  2718. return
  2719. }
  2720. fmt.Println(result)
  2721. }
  2722. // To restore a DB instance to a point in time.
  2723. //
  2724. // The following example restores a DB instance to a new DB instance at a point in time
  2725. // from the source DB instance.
  2726. func ExampleRDS_RestoreDBInstanceToPointInTime_shared00() {
  2727. svc := rds.New(session.New())
  2728. input := &rds.RestoreDBInstanceToPointInTimeInput{
  2729. RestoreTime: parseTime("2006-01-02T15:04:05Z", "2016-09-13T18:45:00Z"),
  2730. SourceDBInstanceIdentifier: aws.String("mysql-sample"),
  2731. TargetDBInstanceIdentifier: aws.String("mysql-sample-restored"),
  2732. }
  2733. result, err := svc.RestoreDBInstanceToPointInTime(input)
  2734. if err != nil {
  2735. if aerr, ok := err.(awserr.Error); ok {
  2736. switch aerr.Code() {
  2737. case rds.ErrCodeDBInstanceAlreadyExistsFault:
  2738. fmt.Println(rds.ErrCodeDBInstanceAlreadyExistsFault, aerr.Error())
  2739. case rds.ErrCodeDBInstanceNotFoundFault:
  2740. fmt.Println(rds.ErrCodeDBInstanceNotFoundFault, aerr.Error())
  2741. case rds.ErrCodeInstanceQuotaExceededFault:
  2742. fmt.Println(rds.ErrCodeInstanceQuotaExceededFault, aerr.Error())
  2743. case rds.ErrCodeInsufficientDBInstanceCapacityFault:
  2744. fmt.Println(rds.ErrCodeInsufficientDBInstanceCapacityFault, aerr.Error())
  2745. case rds.ErrCodeInvalidDBInstanceStateFault:
  2746. fmt.Println(rds.ErrCodeInvalidDBInstanceStateFault, aerr.Error())
  2747. case rds.ErrCodePointInTimeRestoreNotEnabledFault:
  2748. fmt.Println(rds.ErrCodePointInTimeRestoreNotEnabledFault, aerr.Error())
  2749. case rds.ErrCodeStorageQuotaExceededFault:
  2750. fmt.Println(rds.ErrCodeStorageQuotaExceededFault, aerr.Error())
  2751. case rds.ErrCodeInvalidVPCNetworkStateFault:
  2752. fmt.Println(rds.ErrCodeInvalidVPCNetworkStateFault, aerr.Error())
  2753. case rds.ErrCodeInvalidRestoreFault:
  2754. fmt.Println(rds.ErrCodeInvalidRestoreFault, aerr.Error())
  2755. case rds.ErrCodeDBSubnetGroupNotFoundFault:
  2756. fmt.Println(rds.ErrCodeDBSubnetGroupNotFoundFault, aerr.Error())
  2757. case rds.ErrCodeDBSubnetGroupDoesNotCoverEnoughAZs:
  2758. fmt.Println(rds.ErrCodeDBSubnetGroupDoesNotCoverEnoughAZs, aerr.Error())
  2759. case rds.ErrCodeInvalidSubnet:
  2760. fmt.Println(rds.ErrCodeInvalidSubnet, aerr.Error())
  2761. case rds.ErrCodeProvisionedIopsNotAvailableInAZFault:
  2762. fmt.Println(rds.ErrCodeProvisionedIopsNotAvailableInAZFault, aerr.Error())
  2763. case rds.ErrCodeOptionGroupNotFoundFault:
  2764. fmt.Println(rds.ErrCodeOptionGroupNotFoundFault, aerr.Error())
  2765. case rds.ErrCodeStorageTypeNotSupportedFault:
  2766. fmt.Println(rds.ErrCodeStorageTypeNotSupportedFault, aerr.Error())
  2767. case rds.ErrCodeAuthorizationNotFoundFault:
  2768. fmt.Println(rds.ErrCodeAuthorizationNotFoundFault, aerr.Error())
  2769. case rds.ErrCodeKMSKeyNotAccessibleFault:
  2770. fmt.Println(rds.ErrCodeKMSKeyNotAccessibleFault, aerr.Error())
  2771. case rds.ErrCodeDBSecurityGroupNotFoundFault:
  2772. fmt.Println(rds.ErrCodeDBSecurityGroupNotFoundFault, aerr.Error())
  2773. case rds.ErrCodeDomainNotFoundFault:
  2774. fmt.Println(rds.ErrCodeDomainNotFoundFault, aerr.Error())
  2775. case rds.ErrCodeBackupPolicyNotFoundFault:
  2776. fmt.Println(rds.ErrCodeBackupPolicyNotFoundFault, aerr.Error())
  2777. case rds.ErrCodeDBParameterGroupNotFoundFault:
  2778. fmt.Println(rds.ErrCodeDBParameterGroupNotFoundFault, aerr.Error())
  2779. case rds.ErrCodeDBInstanceAutomatedBackupNotFoundFault:
  2780. fmt.Println(rds.ErrCodeDBInstanceAutomatedBackupNotFoundFault, aerr.Error())
  2781. default:
  2782. fmt.Println(aerr.Error())
  2783. }
  2784. } else {
  2785. // Print the error, cast err to awserr.Error to get the Code and
  2786. // Message from an error.
  2787. fmt.Println(err.Error())
  2788. }
  2789. return
  2790. }
  2791. fmt.Println(result)
  2792. }
  2793. // To revoke ingress for a DB security group
  2794. //
  2795. // This example revokes ingress for the specified CIDR block associated with the specified
  2796. // DB security group.
  2797. func ExampleRDS_RevokeDBSecurityGroupIngress_shared00() {
  2798. svc := rds.New(session.New())
  2799. input := &rds.RevokeDBSecurityGroupIngressInput{
  2800. CIDRIP: aws.String("203.0.113.5/32"),
  2801. DBSecurityGroupName: aws.String("mydbsecuritygroup"),
  2802. }
  2803. result, err := svc.RevokeDBSecurityGroupIngress(input)
  2804. if err != nil {
  2805. if aerr, ok := err.(awserr.Error); ok {
  2806. switch aerr.Code() {
  2807. case rds.ErrCodeDBSecurityGroupNotFoundFault:
  2808. fmt.Println(rds.ErrCodeDBSecurityGroupNotFoundFault, aerr.Error())
  2809. case rds.ErrCodeAuthorizationNotFoundFault:
  2810. fmt.Println(rds.ErrCodeAuthorizationNotFoundFault, aerr.Error())
  2811. case rds.ErrCodeInvalidDBSecurityGroupStateFault:
  2812. fmt.Println(rds.ErrCodeInvalidDBSecurityGroupStateFault, aerr.Error())
  2813. default:
  2814. fmt.Println(aerr.Error())
  2815. }
  2816. } else {
  2817. // Print the error, cast err to awserr.Error to get the Code and
  2818. // Message from an error.
  2819. fmt.Println(err.Error())
  2820. }
  2821. return
  2822. }
  2823. fmt.Println(result)
  2824. }