api.go 204 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409
  1. // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
  2. package secretsmanager
  3. import (
  4. "fmt"
  5. "time"
  6. "github.com/aws/aws-sdk-go/aws"
  7. "github.com/aws/aws-sdk-go/aws/awsutil"
  8. "github.com/aws/aws-sdk-go/aws/request"
  9. "github.com/aws/aws-sdk-go/private/protocol"
  10. "github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
  11. )
  12. const opCancelRotateSecret = "CancelRotateSecret"
  13. // CancelRotateSecretRequest generates a "aws/request.Request" representing the
  14. // client's request for the CancelRotateSecret operation. The "output" return
  15. // value will be populated with the request's response once the request completes
  16. // successfully.
  17. //
  18. // Use "Send" method on the returned Request to send the API call to the service.
  19. // the "output" return value is not valid until after Send returns without error.
  20. //
  21. // See CancelRotateSecret for more information on using the CancelRotateSecret
  22. // API call, and error handling.
  23. //
  24. // This method is useful when you want to inject custom logic or configuration
  25. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  26. //
  27. //
  28. // // Example sending a request using the CancelRotateSecretRequest method.
  29. // req, resp := client.CancelRotateSecretRequest(params)
  30. //
  31. // err := req.Send()
  32. // if err == nil { // resp is now filled
  33. // fmt.Println(resp)
  34. // }
  35. //
  36. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/CancelRotateSecret
  37. func (c *SecretsManager) CancelRotateSecretRequest(input *CancelRotateSecretInput) (req *request.Request, output *CancelRotateSecretOutput) {
  38. op := &request.Operation{
  39. Name: opCancelRotateSecret,
  40. HTTPMethod: "POST",
  41. HTTPPath: "/",
  42. }
  43. if input == nil {
  44. input = &CancelRotateSecretInput{}
  45. }
  46. output = &CancelRotateSecretOutput{}
  47. req = c.newRequest(op, input, output)
  48. return
  49. }
  50. // CancelRotateSecret API operation for AWS Secrets Manager.
  51. //
  52. // Disables automatic scheduled rotation and cancels the rotation of a secret
  53. // if one is currently in progress.
  54. //
  55. // To re-enable scheduled rotation, call RotateSecret with AutomaticallyRotateAfterDays
  56. // set to a value greater than 0. This will immediately rotate your secret and
  57. // then enable the automatic schedule.
  58. //
  59. // If you cancel a rotation that is in progress, it can leave the VersionStage
  60. // labels in an unexpected state. Depending on what step of the rotation was
  61. // in progress, you might need to remove the staging label AWSPENDING from the
  62. // partially created version, specified by the VersionId response value. You
  63. // should also evaluate the partially rotated new version to see if it should
  64. // be deleted, which you can do by removing all staging labels from the new
  65. // version's VersionStage field.
  66. //
  67. // To successfully start a rotation, the staging label AWSPENDING must be in
  68. // one of the following states:
  69. //
  70. // * Not be attached to any version at all
  71. //
  72. // * Attached to the same version as the staging label AWSCURRENT
  73. //
  74. // If the staging label AWSPENDING is attached to a different version than the
  75. // version with AWSCURRENT then the attempt to rotate fails.
  76. //
  77. // Minimum permissions
  78. //
  79. // To run this command, you must have the following permissions:
  80. //
  81. // * secretsmanager:CancelRotateSecret
  82. //
  83. // Related operations
  84. //
  85. // * To configure rotation for a secret or to manually trigger a rotation,
  86. // use RotateSecret.
  87. //
  88. // * To get the rotation configuration details for a secret, use DescribeSecret.
  89. //
  90. // * To list all of the currently available secrets, use ListSecrets.
  91. //
  92. // * To list all of the versions currently associated with a secret, use
  93. // ListSecretVersionIds.
  94. //
  95. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  96. // with awserr.Error's Code and Message methods to get detailed information about
  97. // the error.
  98. //
  99. // See the AWS API reference guide for AWS Secrets Manager's
  100. // API operation CancelRotateSecret for usage and error information.
  101. //
  102. // Returned Error Codes:
  103. // * ErrCodeResourceNotFoundException "ResourceNotFoundException"
  104. // We can't find the resource that you asked for.
  105. //
  106. // * ErrCodeInvalidParameterException "InvalidParameterException"
  107. // You provided an invalid value for a parameter.
  108. //
  109. // * ErrCodeInternalServiceError "InternalServiceError"
  110. // An error occurred on the server side.
  111. //
  112. // * ErrCodeInvalidRequestException "InvalidRequestException"
  113. // You provided a parameter value that is not valid for the current state of
  114. // the resource.
  115. //
  116. // Possible causes:
  117. //
  118. // * You tried to perform the operation on a secret that's currently marked
  119. // deleted.
  120. //
  121. // * You tried to enable rotation on a secret that doesn't already have a
  122. // Lambda function ARN configured and you didn't include such an ARN as a
  123. // parameter in this call.
  124. //
  125. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/CancelRotateSecret
  126. func (c *SecretsManager) CancelRotateSecret(input *CancelRotateSecretInput) (*CancelRotateSecretOutput, error) {
  127. req, out := c.CancelRotateSecretRequest(input)
  128. return out, req.Send()
  129. }
  130. // CancelRotateSecretWithContext is the same as CancelRotateSecret with the addition of
  131. // the ability to pass a context and additional request options.
  132. //
  133. // See CancelRotateSecret for details on how to use this API operation.
  134. //
  135. // The context must be non-nil and will be used for request cancellation. If
  136. // the context is nil a panic will occur. In the future the SDK may create
  137. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  138. // for more information on using Contexts.
  139. func (c *SecretsManager) CancelRotateSecretWithContext(ctx aws.Context, input *CancelRotateSecretInput, opts ...request.Option) (*CancelRotateSecretOutput, error) {
  140. req, out := c.CancelRotateSecretRequest(input)
  141. req.SetContext(ctx)
  142. req.ApplyOptions(opts...)
  143. return out, req.Send()
  144. }
  145. const opCreateSecret = "CreateSecret"
  146. // CreateSecretRequest generates a "aws/request.Request" representing the
  147. // client's request for the CreateSecret operation. The "output" return
  148. // value will be populated with the request's response once the request completes
  149. // successfully.
  150. //
  151. // Use "Send" method on the returned Request to send the API call to the service.
  152. // the "output" return value is not valid until after Send returns without error.
  153. //
  154. // See CreateSecret for more information on using the CreateSecret
  155. // API call, and error handling.
  156. //
  157. // This method is useful when you want to inject custom logic or configuration
  158. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  159. //
  160. //
  161. // // Example sending a request using the CreateSecretRequest method.
  162. // req, resp := client.CreateSecretRequest(params)
  163. //
  164. // err := req.Send()
  165. // if err == nil { // resp is now filled
  166. // fmt.Println(resp)
  167. // }
  168. //
  169. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/CreateSecret
  170. func (c *SecretsManager) CreateSecretRequest(input *CreateSecretInput) (req *request.Request, output *CreateSecretOutput) {
  171. op := &request.Operation{
  172. Name: opCreateSecret,
  173. HTTPMethod: "POST",
  174. HTTPPath: "/",
  175. }
  176. if input == nil {
  177. input = &CreateSecretInput{}
  178. }
  179. output = &CreateSecretOutput{}
  180. req = c.newRequest(op, input, output)
  181. return
  182. }
  183. // CreateSecret API operation for AWS Secrets Manager.
  184. //
  185. // Creates a new secret. A secret in Secrets Manager consists of both the protected
  186. // secret data and the important information needed to manage the secret.
  187. //
  188. // Secrets Manager stores the encrypted secret data in one of a collection of
  189. // "versions" associated with the secret. Each version contains a copy of the
  190. // encrypted secret data. Each version is associated with one or more "staging
  191. // labels" that identify where the version is in the rotation cycle. The SecretVersionsToStages
  192. // field of the secret contains the mapping of staging labels to the active
  193. // versions of the secret. Versions without a staging label are considered deprecated
  194. // and are not included in the list.
  195. //
  196. // You provide the secret data to be encrypted by putting text in either the
  197. // SecretString parameter or binary data in the SecretBinary parameter, but
  198. // not both. If you include SecretString or SecretBinary then Secrets Manager
  199. // also creates an initial secret version and automatically attaches the staging
  200. // label AWSCURRENT to the new version.
  201. //
  202. // If you call an operation that needs to encrypt or decrypt the SecretString
  203. // or SecretBinary for a secret in the same account as the calling user and
  204. // that secret doesn't specify a AWS KMS encryption key, Secrets Manager uses
  205. // the account's default AWS managed customer master key (CMK) with the alias
  206. // aws/secretsmanager. If this key doesn't already exist in your account then
  207. // Secrets Manager creates it for you automatically. All users and roles in
  208. // the same AWS account automatically have access to use the default CMK. Note
  209. // that if an Secrets Manager API call results in AWS having to create the account's
  210. // AWS-managed CMK, it can result in a one-time significant delay in returning
  211. // the result.
  212. //
  213. // If the secret is in a different AWS account from the credentials calling
  214. // an API that requires encryption or decryption of the secret value then you
  215. // must create and use a custom AWS KMS CMK because you can't access the default
  216. // CMK for the account using credentials from a different AWS account. Store
  217. // the ARN of the CMK in the secret when you create the secret or when you update
  218. // it by including it in the KMSKeyId. If you call an API that must encrypt
  219. // or decrypt SecretString or SecretBinary using credentials from a different
  220. // account then the AWS KMS key policy must grant cross-account access to that
  221. // other account's user or role for both the kms:GenerateDataKey and kms:Decrypt
  222. // operations.
  223. //
  224. // Minimum permissions
  225. //
  226. // To run this command, you must have the following permissions:
  227. //
  228. // * secretsmanager:CreateSecret
  229. //
  230. // * kms:GenerateDataKey - needed only if you use a customer-managed AWS
  231. // KMS key to encrypt the secret. You do not need this permission to use
  232. // the account's default AWS managed CMK for Secrets Manager.
  233. //
  234. // * kms:Decrypt - needed only if you use a customer-managed AWS KMS key
  235. // to encrypt the secret. You do not need this permission to use the account's
  236. // default AWS managed CMK for Secrets Manager.
  237. //
  238. // * secretsmanager:TagResource - needed only if you include the Tags parameter.
  239. //
  240. //
  241. // Related operations
  242. //
  243. // * To delete a secret, use DeleteSecret.
  244. //
  245. // * To modify an existing secret, use UpdateSecret.
  246. //
  247. // * To create a new version of a secret, use PutSecretValue.
  248. //
  249. // * To retrieve the encrypted secure string and secure binary values, use
  250. // GetSecretValue.
  251. //
  252. // * To retrieve all other details for a secret, use DescribeSecret. This
  253. // does not include the encrypted secure string and secure binary values.
  254. //
  255. // * To retrieve the list of secret versions associated with the current
  256. // secret, use DescribeSecret and examine the SecretVersionsToStages response
  257. // value.
  258. //
  259. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  260. // with awserr.Error's Code and Message methods to get detailed information about
  261. // the error.
  262. //
  263. // See the AWS API reference guide for AWS Secrets Manager's
  264. // API operation CreateSecret for usage and error information.
  265. //
  266. // Returned Error Codes:
  267. // * ErrCodeInvalidParameterException "InvalidParameterException"
  268. // You provided an invalid value for a parameter.
  269. //
  270. // * ErrCodeInvalidRequestException "InvalidRequestException"
  271. // You provided a parameter value that is not valid for the current state of
  272. // the resource.
  273. //
  274. // Possible causes:
  275. //
  276. // * You tried to perform the operation on a secret that's currently marked
  277. // deleted.
  278. //
  279. // * You tried to enable rotation on a secret that doesn't already have a
  280. // Lambda function ARN configured and you didn't include such an ARN as a
  281. // parameter in this call.
  282. //
  283. // * ErrCodeLimitExceededException "LimitExceededException"
  284. // The request failed because it would exceed one of the Secrets Manager internal
  285. // limits.
  286. //
  287. // * ErrCodeEncryptionFailure "EncryptionFailure"
  288. // Secrets Manager can't encrypt the protected secret text using the provided
  289. // KMS key. Check that the customer master key (CMK) is available, enabled,
  290. // and not in an invalid state. For more information, see How Key State Affects
  291. // Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html).
  292. //
  293. // * ErrCodeResourceExistsException "ResourceExistsException"
  294. // A resource with the ID you requested already exists.
  295. //
  296. // * ErrCodeResourceNotFoundException "ResourceNotFoundException"
  297. // We can't find the resource that you asked for.
  298. //
  299. // * ErrCodeMalformedPolicyDocumentException "MalformedPolicyDocumentException"
  300. // The policy document that you provided isn't valid.
  301. //
  302. // * ErrCodeInternalServiceError "InternalServiceError"
  303. // An error occurred on the server side.
  304. //
  305. // * ErrCodePreconditionNotMetException "PreconditionNotMetException"
  306. // The request failed because you did not complete all the prerequisite steps.
  307. //
  308. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/CreateSecret
  309. func (c *SecretsManager) CreateSecret(input *CreateSecretInput) (*CreateSecretOutput, error) {
  310. req, out := c.CreateSecretRequest(input)
  311. return out, req.Send()
  312. }
  313. // CreateSecretWithContext is the same as CreateSecret with the addition of
  314. // the ability to pass a context and additional request options.
  315. //
  316. // See CreateSecret for details on how to use this API operation.
  317. //
  318. // The context must be non-nil and will be used for request cancellation. If
  319. // the context is nil a panic will occur. In the future the SDK may create
  320. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  321. // for more information on using Contexts.
  322. func (c *SecretsManager) CreateSecretWithContext(ctx aws.Context, input *CreateSecretInput, opts ...request.Option) (*CreateSecretOutput, error) {
  323. req, out := c.CreateSecretRequest(input)
  324. req.SetContext(ctx)
  325. req.ApplyOptions(opts...)
  326. return out, req.Send()
  327. }
  328. const opDeleteResourcePolicy = "DeleteResourcePolicy"
  329. // DeleteResourcePolicyRequest generates a "aws/request.Request" representing the
  330. // client's request for the DeleteResourcePolicy operation. The "output" return
  331. // value will be populated with the request's response once the request completes
  332. // successfully.
  333. //
  334. // Use "Send" method on the returned Request to send the API call to the service.
  335. // the "output" return value is not valid until after Send returns without error.
  336. //
  337. // See DeleteResourcePolicy for more information on using the DeleteResourcePolicy
  338. // API call, and error handling.
  339. //
  340. // This method is useful when you want to inject custom logic or configuration
  341. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  342. //
  343. //
  344. // // Example sending a request using the DeleteResourcePolicyRequest method.
  345. // req, resp := client.DeleteResourcePolicyRequest(params)
  346. //
  347. // err := req.Send()
  348. // if err == nil { // resp is now filled
  349. // fmt.Println(resp)
  350. // }
  351. //
  352. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/DeleteResourcePolicy
  353. func (c *SecretsManager) DeleteResourcePolicyRequest(input *DeleteResourcePolicyInput) (req *request.Request, output *DeleteResourcePolicyOutput) {
  354. op := &request.Operation{
  355. Name: opDeleteResourcePolicy,
  356. HTTPMethod: "POST",
  357. HTTPPath: "/",
  358. }
  359. if input == nil {
  360. input = &DeleteResourcePolicyInput{}
  361. }
  362. output = &DeleteResourcePolicyOutput{}
  363. req = c.newRequest(op, input, output)
  364. return
  365. }
  366. // DeleteResourcePolicy API operation for AWS Secrets Manager.
  367. //
  368. // Deletes the resource-based permission policy that's attached to the secret.
  369. //
  370. // Minimum permissions
  371. //
  372. // To run this command, you must have the following permissions:
  373. //
  374. // * secretsmanager:DeleteResourcePolicy
  375. //
  376. // Related operations
  377. //
  378. // * To attach a resource policy to a secret, use PutResourcePolicy.
  379. //
  380. // * To retrieve the current resource-based policy that's attached to a secret,
  381. // use GetResourcePolicy.
  382. //
  383. // * To list all of the currently available secrets, use ListSecrets.
  384. //
  385. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  386. // with awserr.Error's Code and Message methods to get detailed information about
  387. // the error.
  388. //
  389. // See the AWS API reference guide for AWS Secrets Manager's
  390. // API operation DeleteResourcePolicy for usage and error information.
  391. //
  392. // Returned Error Codes:
  393. // * ErrCodeResourceNotFoundException "ResourceNotFoundException"
  394. // We can't find the resource that you asked for.
  395. //
  396. // * ErrCodeInternalServiceError "InternalServiceError"
  397. // An error occurred on the server side.
  398. //
  399. // * ErrCodeInvalidRequestException "InvalidRequestException"
  400. // You provided a parameter value that is not valid for the current state of
  401. // the resource.
  402. //
  403. // Possible causes:
  404. //
  405. // * You tried to perform the operation on a secret that's currently marked
  406. // deleted.
  407. //
  408. // * You tried to enable rotation on a secret that doesn't already have a
  409. // Lambda function ARN configured and you didn't include such an ARN as a
  410. // parameter in this call.
  411. //
  412. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/DeleteResourcePolicy
  413. func (c *SecretsManager) DeleteResourcePolicy(input *DeleteResourcePolicyInput) (*DeleteResourcePolicyOutput, error) {
  414. req, out := c.DeleteResourcePolicyRequest(input)
  415. return out, req.Send()
  416. }
  417. // DeleteResourcePolicyWithContext is the same as DeleteResourcePolicy with the addition of
  418. // the ability to pass a context and additional request options.
  419. //
  420. // See DeleteResourcePolicy for details on how to use this API operation.
  421. //
  422. // The context must be non-nil and will be used for request cancellation. If
  423. // the context is nil a panic will occur. In the future the SDK may create
  424. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  425. // for more information on using Contexts.
  426. func (c *SecretsManager) DeleteResourcePolicyWithContext(ctx aws.Context, input *DeleteResourcePolicyInput, opts ...request.Option) (*DeleteResourcePolicyOutput, error) {
  427. req, out := c.DeleteResourcePolicyRequest(input)
  428. req.SetContext(ctx)
  429. req.ApplyOptions(opts...)
  430. return out, req.Send()
  431. }
  432. const opDeleteSecret = "DeleteSecret"
  433. // DeleteSecretRequest generates a "aws/request.Request" representing the
  434. // client's request for the DeleteSecret operation. The "output" return
  435. // value will be populated with the request's response once the request completes
  436. // successfully.
  437. //
  438. // Use "Send" method on the returned Request to send the API call to the service.
  439. // the "output" return value is not valid until after Send returns without error.
  440. //
  441. // See DeleteSecret for more information on using the DeleteSecret
  442. // API call, and error handling.
  443. //
  444. // This method is useful when you want to inject custom logic or configuration
  445. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  446. //
  447. //
  448. // // Example sending a request using the DeleteSecretRequest method.
  449. // req, resp := client.DeleteSecretRequest(params)
  450. //
  451. // err := req.Send()
  452. // if err == nil { // resp is now filled
  453. // fmt.Println(resp)
  454. // }
  455. //
  456. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/DeleteSecret
  457. func (c *SecretsManager) DeleteSecretRequest(input *DeleteSecretInput) (req *request.Request, output *DeleteSecretOutput) {
  458. op := &request.Operation{
  459. Name: opDeleteSecret,
  460. HTTPMethod: "POST",
  461. HTTPPath: "/",
  462. }
  463. if input == nil {
  464. input = &DeleteSecretInput{}
  465. }
  466. output = &DeleteSecretOutput{}
  467. req = c.newRequest(op, input, output)
  468. return
  469. }
  470. // DeleteSecret API operation for AWS Secrets Manager.
  471. //
  472. // Deletes an entire secret and all of its versions. You can optionally include
  473. // a recovery window during which you can restore the secret. If you don't specify
  474. // a recovery window value, the operation defaults to 30 days. Secrets Manager
  475. // attaches a DeletionDate stamp to the secret that specifies the end of the
  476. // recovery window. At the end of the recovery window, Secrets Manager deletes
  477. // the secret permanently.
  478. //
  479. // At any time before recovery window ends, you can use RestoreSecret to remove
  480. // the DeletionDate and cancel the deletion of the secret.
  481. //
  482. // You cannot access the encrypted secret information in any secret that is
  483. // scheduled for deletion. If you need to access that information, you must
  484. // cancel the deletion with RestoreSecret and then retrieve the information.
  485. //
  486. // There is no explicit operation to delete a version of a secret. Instead,
  487. // remove all staging labels from the VersionStage field of a version. That
  488. // marks the version as deprecated and allows Secrets Manager to delete it as
  489. // needed. Versions that do not have any staging labels do not show up in ListSecretVersionIds
  490. // unless you specify IncludeDeprecated.
  491. //
  492. // The permanent secret deletion at the end of the waiting period is performed
  493. // as a background task with low priority. There is no guarantee of a specific
  494. // time after the recovery window for the actual delete operation to occur.
  495. //
  496. // Minimum permissions
  497. //
  498. // To run this command, you must have the following permissions:
  499. //
  500. // * secretsmanager:DeleteSecret
  501. //
  502. // Related operations
  503. //
  504. // * To create a secret, use CreateSecret.
  505. //
  506. // * To cancel deletion of a version of a secret before the recovery window
  507. // has expired, use RestoreSecret.
  508. //
  509. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  510. // with awserr.Error's Code and Message methods to get detailed information about
  511. // the error.
  512. //
  513. // See the AWS API reference guide for AWS Secrets Manager's
  514. // API operation DeleteSecret for usage and error information.
  515. //
  516. // Returned Error Codes:
  517. // * ErrCodeResourceNotFoundException "ResourceNotFoundException"
  518. // We can't find the resource that you asked for.
  519. //
  520. // * ErrCodeInvalidParameterException "InvalidParameterException"
  521. // You provided an invalid value for a parameter.
  522. //
  523. // * ErrCodeInvalidRequestException "InvalidRequestException"
  524. // You provided a parameter value that is not valid for the current state of
  525. // the resource.
  526. //
  527. // Possible causes:
  528. //
  529. // * You tried to perform the operation on a secret that's currently marked
  530. // deleted.
  531. //
  532. // * You tried to enable rotation on a secret that doesn't already have a
  533. // Lambda function ARN configured and you didn't include such an ARN as a
  534. // parameter in this call.
  535. //
  536. // * ErrCodeInternalServiceError "InternalServiceError"
  537. // An error occurred on the server side.
  538. //
  539. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/DeleteSecret
  540. func (c *SecretsManager) DeleteSecret(input *DeleteSecretInput) (*DeleteSecretOutput, error) {
  541. req, out := c.DeleteSecretRequest(input)
  542. return out, req.Send()
  543. }
  544. // DeleteSecretWithContext is the same as DeleteSecret with the addition of
  545. // the ability to pass a context and additional request options.
  546. //
  547. // See DeleteSecret for details on how to use this API operation.
  548. //
  549. // The context must be non-nil and will be used for request cancellation. If
  550. // the context is nil a panic will occur. In the future the SDK may create
  551. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  552. // for more information on using Contexts.
  553. func (c *SecretsManager) DeleteSecretWithContext(ctx aws.Context, input *DeleteSecretInput, opts ...request.Option) (*DeleteSecretOutput, error) {
  554. req, out := c.DeleteSecretRequest(input)
  555. req.SetContext(ctx)
  556. req.ApplyOptions(opts...)
  557. return out, req.Send()
  558. }
  559. const opDescribeSecret = "DescribeSecret"
  560. // DescribeSecretRequest generates a "aws/request.Request" representing the
  561. // client's request for the DescribeSecret operation. The "output" return
  562. // value will be populated with the request's response once the request completes
  563. // successfully.
  564. //
  565. // Use "Send" method on the returned Request to send the API call to the service.
  566. // the "output" return value is not valid until after Send returns without error.
  567. //
  568. // See DescribeSecret for more information on using the DescribeSecret
  569. // API call, and error handling.
  570. //
  571. // This method is useful when you want to inject custom logic or configuration
  572. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  573. //
  574. //
  575. // // Example sending a request using the DescribeSecretRequest method.
  576. // req, resp := client.DescribeSecretRequest(params)
  577. //
  578. // err := req.Send()
  579. // if err == nil { // resp is now filled
  580. // fmt.Println(resp)
  581. // }
  582. //
  583. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/DescribeSecret
  584. func (c *SecretsManager) DescribeSecretRequest(input *DescribeSecretInput) (req *request.Request, output *DescribeSecretOutput) {
  585. op := &request.Operation{
  586. Name: opDescribeSecret,
  587. HTTPMethod: "POST",
  588. HTTPPath: "/",
  589. }
  590. if input == nil {
  591. input = &DescribeSecretInput{}
  592. }
  593. output = &DescribeSecretOutput{}
  594. req = c.newRequest(op, input, output)
  595. return
  596. }
  597. // DescribeSecret API operation for AWS Secrets Manager.
  598. //
  599. // Retrieves the details of a secret. It does not include the encrypted fields.
  600. // Only those fields that are populated with a value are returned in the response.
  601. //
  602. // Minimum permissions
  603. //
  604. // To run this command, you must have the following permissions:
  605. //
  606. // * secretsmanager:DescribeSecret
  607. //
  608. // Related operations
  609. //
  610. // * To create a secret, use CreateSecret.
  611. //
  612. // * To modify a secret, use UpdateSecret.
  613. //
  614. // * To retrieve the encrypted secret information in a version of the secret,
  615. // use GetSecretValue.
  616. //
  617. // * To list all of the secrets in the AWS account, use ListSecrets.
  618. //
  619. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  620. // with awserr.Error's Code and Message methods to get detailed information about
  621. // the error.
  622. //
  623. // See the AWS API reference guide for AWS Secrets Manager's
  624. // API operation DescribeSecret for usage and error information.
  625. //
  626. // Returned Error Codes:
  627. // * ErrCodeResourceNotFoundException "ResourceNotFoundException"
  628. // We can't find the resource that you asked for.
  629. //
  630. // * ErrCodeInternalServiceError "InternalServiceError"
  631. // An error occurred on the server side.
  632. //
  633. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/DescribeSecret
  634. func (c *SecretsManager) DescribeSecret(input *DescribeSecretInput) (*DescribeSecretOutput, error) {
  635. req, out := c.DescribeSecretRequest(input)
  636. return out, req.Send()
  637. }
  638. // DescribeSecretWithContext is the same as DescribeSecret with the addition of
  639. // the ability to pass a context and additional request options.
  640. //
  641. // See DescribeSecret for details on how to use this API operation.
  642. //
  643. // The context must be non-nil and will be used for request cancellation. If
  644. // the context is nil a panic will occur. In the future the SDK may create
  645. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  646. // for more information on using Contexts.
  647. func (c *SecretsManager) DescribeSecretWithContext(ctx aws.Context, input *DescribeSecretInput, opts ...request.Option) (*DescribeSecretOutput, error) {
  648. req, out := c.DescribeSecretRequest(input)
  649. req.SetContext(ctx)
  650. req.ApplyOptions(opts...)
  651. return out, req.Send()
  652. }
  653. const opGetRandomPassword = "GetRandomPassword"
  654. // GetRandomPasswordRequest generates a "aws/request.Request" representing the
  655. // client's request for the GetRandomPassword operation. The "output" return
  656. // value will be populated with the request's response once the request completes
  657. // successfully.
  658. //
  659. // Use "Send" method on the returned Request to send the API call to the service.
  660. // the "output" return value is not valid until after Send returns without error.
  661. //
  662. // See GetRandomPassword for more information on using the GetRandomPassword
  663. // API call, and error handling.
  664. //
  665. // This method is useful when you want to inject custom logic or configuration
  666. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  667. //
  668. //
  669. // // Example sending a request using the GetRandomPasswordRequest method.
  670. // req, resp := client.GetRandomPasswordRequest(params)
  671. //
  672. // err := req.Send()
  673. // if err == nil { // resp is now filled
  674. // fmt.Println(resp)
  675. // }
  676. //
  677. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/GetRandomPassword
  678. func (c *SecretsManager) GetRandomPasswordRequest(input *GetRandomPasswordInput) (req *request.Request, output *GetRandomPasswordOutput) {
  679. op := &request.Operation{
  680. Name: opGetRandomPassword,
  681. HTTPMethod: "POST",
  682. HTTPPath: "/",
  683. }
  684. if input == nil {
  685. input = &GetRandomPasswordInput{}
  686. }
  687. output = &GetRandomPasswordOutput{}
  688. req = c.newRequest(op, input, output)
  689. return
  690. }
  691. // GetRandomPassword API operation for AWS Secrets Manager.
  692. //
  693. // Generates a random password of the specified complexity. This operation is
  694. // intended for use in the Lambda rotation function. Per best practice, we recommend
  695. // that you specify the maximum length and include every character type that
  696. // the system you are generating a password for can support.
  697. //
  698. // Minimum permissions
  699. //
  700. // To run this command, you must have the following permissions:
  701. //
  702. // * secretsmanager:GetRandomPassword
  703. //
  704. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  705. // with awserr.Error's Code and Message methods to get detailed information about
  706. // the error.
  707. //
  708. // See the AWS API reference guide for AWS Secrets Manager's
  709. // API operation GetRandomPassword for usage and error information.
  710. //
  711. // Returned Error Codes:
  712. // * ErrCodeInvalidParameterException "InvalidParameterException"
  713. // You provided an invalid value for a parameter.
  714. //
  715. // * ErrCodeInvalidRequestException "InvalidRequestException"
  716. // You provided a parameter value that is not valid for the current state of
  717. // the resource.
  718. //
  719. // Possible causes:
  720. //
  721. // * You tried to perform the operation on a secret that's currently marked
  722. // deleted.
  723. //
  724. // * You tried to enable rotation on a secret that doesn't already have a
  725. // Lambda function ARN configured and you didn't include such an ARN as a
  726. // parameter in this call.
  727. //
  728. // * ErrCodeInternalServiceError "InternalServiceError"
  729. // An error occurred on the server side.
  730. //
  731. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/GetRandomPassword
  732. func (c *SecretsManager) GetRandomPassword(input *GetRandomPasswordInput) (*GetRandomPasswordOutput, error) {
  733. req, out := c.GetRandomPasswordRequest(input)
  734. return out, req.Send()
  735. }
  736. // GetRandomPasswordWithContext is the same as GetRandomPassword with the addition of
  737. // the ability to pass a context and additional request options.
  738. //
  739. // See GetRandomPassword for details on how to use this API operation.
  740. //
  741. // The context must be non-nil and will be used for request cancellation. If
  742. // the context is nil a panic will occur. In the future the SDK may create
  743. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  744. // for more information on using Contexts.
  745. func (c *SecretsManager) GetRandomPasswordWithContext(ctx aws.Context, input *GetRandomPasswordInput, opts ...request.Option) (*GetRandomPasswordOutput, error) {
  746. req, out := c.GetRandomPasswordRequest(input)
  747. req.SetContext(ctx)
  748. req.ApplyOptions(opts...)
  749. return out, req.Send()
  750. }
  751. const opGetResourcePolicy = "GetResourcePolicy"
  752. // GetResourcePolicyRequest generates a "aws/request.Request" representing the
  753. // client's request for the GetResourcePolicy operation. The "output" return
  754. // value will be populated with the request's response once the request completes
  755. // successfully.
  756. //
  757. // Use "Send" method on the returned Request to send the API call to the service.
  758. // the "output" return value is not valid until after Send returns without error.
  759. //
  760. // See GetResourcePolicy for more information on using the GetResourcePolicy
  761. // API call, and error handling.
  762. //
  763. // This method is useful when you want to inject custom logic or configuration
  764. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  765. //
  766. //
  767. // // Example sending a request using the GetResourcePolicyRequest method.
  768. // req, resp := client.GetResourcePolicyRequest(params)
  769. //
  770. // err := req.Send()
  771. // if err == nil { // resp is now filled
  772. // fmt.Println(resp)
  773. // }
  774. //
  775. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/GetResourcePolicy
  776. func (c *SecretsManager) GetResourcePolicyRequest(input *GetResourcePolicyInput) (req *request.Request, output *GetResourcePolicyOutput) {
  777. op := &request.Operation{
  778. Name: opGetResourcePolicy,
  779. HTTPMethod: "POST",
  780. HTTPPath: "/",
  781. }
  782. if input == nil {
  783. input = &GetResourcePolicyInput{}
  784. }
  785. output = &GetResourcePolicyOutput{}
  786. req = c.newRequest(op, input, output)
  787. return
  788. }
  789. // GetResourcePolicy API operation for AWS Secrets Manager.
  790. //
  791. // Retrieves the JSON text of the resource-based policy document that's attached
  792. // to the specified secret. The JSON request string input and response output
  793. // are shown formatted with white space and line breaks for better readability.
  794. // Submit your input as a single line JSON string.
  795. //
  796. // Minimum permissions
  797. //
  798. // To run this command, you must have the following permissions:
  799. //
  800. // * secretsmanager:GetResourcePolicy
  801. //
  802. // Related operations
  803. //
  804. // * To attach a resource policy to a secret, use PutResourcePolicy.
  805. //
  806. // * To delete the resource-based policy that's attached to a secret, use
  807. // DeleteResourcePolicy.
  808. //
  809. // * To list all of the currently available secrets, use ListSecrets.
  810. //
  811. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  812. // with awserr.Error's Code and Message methods to get detailed information about
  813. // the error.
  814. //
  815. // See the AWS API reference guide for AWS Secrets Manager's
  816. // API operation GetResourcePolicy for usage and error information.
  817. //
  818. // Returned Error Codes:
  819. // * ErrCodeResourceNotFoundException "ResourceNotFoundException"
  820. // We can't find the resource that you asked for.
  821. //
  822. // * ErrCodeInternalServiceError "InternalServiceError"
  823. // An error occurred on the server side.
  824. //
  825. // * ErrCodeInvalidRequestException "InvalidRequestException"
  826. // You provided a parameter value that is not valid for the current state of
  827. // the resource.
  828. //
  829. // Possible causes:
  830. //
  831. // * You tried to perform the operation on a secret that's currently marked
  832. // deleted.
  833. //
  834. // * You tried to enable rotation on a secret that doesn't already have a
  835. // Lambda function ARN configured and you didn't include such an ARN as a
  836. // parameter in this call.
  837. //
  838. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/GetResourcePolicy
  839. func (c *SecretsManager) GetResourcePolicy(input *GetResourcePolicyInput) (*GetResourcePolicyOutput, error) {
  840. req, out := c.GetResourcePolicyRequest(input)
  841. return out, req.Send()
  842. }
  843. // GetResourcePolicyWithContext is the same as GetResourcePolicy with the addition of
  844. // the ability to pass a context and additional request options.
  845. //
  846. // See GetResourcePolicy for details on how to use this API operation.
  847. //
  848. // The context must be non-nil and will be used for request cancellation. If
  849. // the context is nil a panic will occur. In the future the SDK may create
  850. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  851. // for more information on using Contexts.
  852. func (c *SecretsManager) GetResourcePolicyWithContext(ctx aws.Context, input *GetResourcePolicyInput, opts ...request.Option) (*GetResourcePolicyOutput, error) {
  853. req, out := c.GetResourcePolicyRequest(input)
  854. req.SetContext(ctx)
  855. req.ApplyOptions(opts...)
  856. return out, req.Send()
  857. }
  858. const opGetSecretValue = "GetSecretValue"
  859. // GetSecretValueRequest generates a "aws/request.Request" representing the
  860. // client's request for the GetSecretValue operation. The "output" return
  861. // value will be populated with the request's response once the request completes
  862. // successfully.
  863. //
  864. // Use "Send" method on the returned Request to send the API call to the service.
  865. // the "output" return value is not valid until after Send returns without error.
  866. //
  867. // See GetSecretValue for more information on using the GetSecretValue
  868. // API call, and error handling.
  869. //
  870. // This method is useful when you want to inject custom logic or configuration
  871. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  872. //
  873. //
  874. // // Example sending a request using the GetSecretValueRequest method.
  875. // req, resp := client.GetSecretValueRequest(params)
  876. //
  877. // err := req.Send()
  878. // if err == nil { // resp is now filled
  879. // fmt.Println(resp)
  880. // }
  881. //
  882. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/GetSecretValue
  883. func (c *SecretsManager) GetSecretValueRequest(input *GetSecretValueInput) (req *request.Request, output *GetSecretValueOutput) {
  884. op := &request.Operation{
  885. Name: opGetSecretValue,
  886. HTTPMethod: "POST",
  887. HTTPPath: "/",
  888. }
  889. if input == nil {
  890. input = &GetSecretValueInput{}
  891. }
  892. output = &GetSecretValueOutput{}
  893. req = c.newRequest(op, input, output)
  894. return
  895. }
  896. // GetSecretValue API operation for AWS Secrets Manager.
  897. //
  898. // Retrieves the contents of the encrypted fields SecretString or SecretBinary
  899. // from the specified version of a secret, whichever contains content.
  900. //
  901. // Minimum permissions
  902. //
  903. // To run this command, you must have the following permissions:
  904. //
  905. // * secretsmanager:GetSecretValue
  906. //
  907. // * kms:Decrypt - required only if you use a customer-managed AWS KMS key
  908. // to encrypt the secret. You do not need this permission to use the account's
  909. // default AWS managed CMK for Secrets Manager.
  910. //
  911. // Related operations
  912. //
  913. // * To create a new version of the secret with different encrypted information,
  914. // use PutSecretValue.
  915. //
  916. // * To retrieve the non-encrypted details for the secret, use DescribeSecret.
  917. //
  918. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  919. // with awserr.Error's Code and Message methods to get detailed information about
  920. // the error.
  921. //
  922. // See the AWS API reference guide for AWS Secrets Manager's
  923. // API operation GetSecretValue for usage and error information.
  924. //
  925. // Returned Error Codes:
  926. // * ErrCodeResourceNotFoundException "ResourceNotFoundException"
  927. // We can't find the resource that you asked for.
  928. //
  929. // * ErrCodeInvalidParameterException "InvalidParameterException"
  930. // You provided an invalid value for a parameter.
  931. //
  932. // * ErrCodeInvalidRequestException "InvalidRequestException"
  933. // You provided a parameter value that is not valid for the current state of
  934. // the resource.
  935. //
  936. // Possible causes:
  937. //
  938. // * You tried to perform the operation on a secret that's currently marked
  939. // deleted.
  940. //
  941. // * You tried to enable rotation on a secret that doesn't already have a
  942. // Lambda function ARN configured and you didn't include such an ARN as a
  943. // parameter in this call.
  944. //
  945. // * ErrCodeDecryptionFailure "DecryptionFailure"
  946. // Secrets Manager can't decrypt the protected secret text using the provided
  947. // KMS key.
  948. //
  949. // * ErrCodeInternalServiceError "InternalServiceError"
  950. // An error occurred on the server side.
  951. //
  952. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/GetSecretValue
  953. func (c *SecretsManager) GetSecretValue(input *GetSecretValueInput) (*GetSecretValueOutput, error) {
  954. req, out := c.GetSecretValueRequest(input)
  955. return out, req.Send()
  956. }
  957. // GetSecretValueWithContext is the same as GetSecretValue with the addition of
  958. // the ability to pass a context and additional request options.
  959. //
  960. // See GetSecretValue for details on how to use this API operation.
  961. //
  962. // The context must be non-nil and will be used for request cancellation. If
  963. // the context is nil a panic will occur. In the future the SDK may create
  964. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  965. // for more information on using Contexts.
  966. func (c *SecretsManager) GetSecretValueWithContext(ctx aws.Context, input *GetSecretValueInput, opts ...request.Option) (*GetSecretValueOutput, error) {
  967. req, out := c.GetSecretValueRequest(input)
  968. req.SetContext(ctx)
  969. req.ApplyOptions(opts...)
  970. return out, req.Send()
  971. }
  972. const opListSecretVersionIds = "ListSecretVersionIds"
  973. // ListSecretVersionIdsRequest generates a "aws/request.Request" representing the
  974. // client's request for the ListSecretVersionIds operation. The "output" return
  975. // value will be populated with the request's response once the request completes
  976. // successfully.
  977. //
  978. // Use "Send" method on the returned Request to send the API call to the service.
  979. // the "output" return value is not valid until after Send returns without error.
  980. //
  981. // See ListSecretVersionIds for more information on using the ListSecretVersionIds
  982. // API call, and error handling.
  983. //
  984. // This method is useful when you want to inject custom logic or configuration
  985. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  986. //
  987. //
  988. // // Example sending a request using the ListSecretVersionIdsRequest method.
  989. // req, resp := client.ListSecretVersionIdsRequest(params)
  990. //
  991. // err := req.Send()
  992. // if err == nil { // resp is now filled
  993. // fmt.Println(resp)
  994. // }
  995. //
  996. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/ListSecretVersionIds
  997. func (c *SecretsManager) ListSecretVersionIdsRequest(input *ListSecretVersionIdsInput) (req *request.Request, output *ListSecretVersionIdsOutput) {
  998. op := &request.Operation{
  999. Name: opListSecretVersionIds,
  1000. HTTPMethod: "POST",
  1001. HTTPPath: "/",
  1002. Paginator: &request.Paginator{
  1003. InputTokens: []string{"NextToken"},
  1004. OutputTokens: []string{"NextToken"},
  1005. LimitToken: "MaxResults",
  1006. TruncationToken: "",
  1007. },
  1008. }
  1009. if input == nil {
  1010. input = &ListSecretVersionIdsInput{}
  1011. }
  1012. output = &ListSecretVersionIdsOutput{}
  1013. req = c.newRequest(op, input, output)
  1014. return
  1015. }
  1016. // ListSecretVersionIds API operation for AWS Secrets Manager.
  1017. //
  1018. // Lists all of the versions attached to the specified secret. The output does
  1019. // not include the SecretString or SecretBinary fields. By default, the list
  1020. // includes only versions that have at least one staging label in VersionStage
  1021. // attached.
  1022. //
  1023. // Always check the NextToken response parameter when calling any of the List*
  1024. // operations. These operations can occasionally return an empty or shorter
  1025. // than expected list of results even when there are more results available.
  1026. // When this happens, the NextToken response parameter contains a value to pass
  1027. // to the next call to the same API to request the next part of the list.
  1028. //
  1029. // Minimum permissions
  1030. //
  1031. // To run this command, you must have the following permissions:
  1032. //
  1033. // * secretsmanager:ListSecretVersionIds
  1034. //
  1035. // Related operations
  1036. //
  1037. // * To list the secrets in an account, use ListSecrets.
  1038. //
  1039. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  1040. // with awserr.Error's Code and Message methods to get detailed information about
  1041. // the error.
  1042. //
  1043. // See the AWS API reference guide for AWS Secrets Manager's
  1044. // API operation ListSecretVersionIds for usage and error information.
  1045. //
  1046. // Returned Error Codes:
  1047. // * ErrCodeInvalidNextTokenException "InvalidNextTokenException"
  1048. // You provided an invalid NextToken value.
  1049. //
  1050. // * ErrCodeResourceNotFoundException "ResourceNotFoundException"
  1051. // We can't find the resource that you asked for.
  1052. //
  1053. // * ErrCodeInternalServiceError "InternalServiceError"
  1054. // An error occurred on the server side.
  1055. //
  1056. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/ListSecretVersionIds
  1057. func (c *SecretsManager) ListSecretVersionIds(input *ListSecretVersionIdsInput) (*ListSecretVersionIdsOutput, error) {
  1058. req, out := c.ListSecretVersionIdsRequest(input)
  1059. return out, req.Send()
  1060. }
  1061. // ListSecretVersionIdsWithContext is the same as ListSecretVersionIds with the addition of
  1062. // the ability to pass a context and additional request options.
  1063. //
  1064. // See ListSecretVersionIds for details on how to use this API operation.
  1065. //
  1066. // The context must be non-nil and will be used for request cancellation. If
  1067. // the context is nil a panic will occur. In the future the SDK may create
  1068. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1069. // for more information on using Contexts.
  1070. func (c *SecretsManager) ListSecretVersionIdsWithContext(ctx aws.Context, input *ListSecretVersionIdsInput, opts ...request.Option) (*ListSecretVersionIdsOutput, error) {
  1071. req, out := c.ListSecretVersionIdsRequest(input)
  1072. req.SetContext(ctx)
  1073. req.ApplyOptions(opts...)
  1074. return out, req.Send()
  1075. }
  1076. // ListSecretVersionIdsPages iterates over the pages of a ListSecretVersionIds operation,
  1077. // calling the "fn" function with the response data for each page. To stop
  1078. // iterating, return false from the fn function.
  1079. //
  1080. // See ListSecretVersionIds method for more information on how to use this operation.
  1081. //
  1082. // Note: This operation can generate multiple requests to a service.
  1083. //
  1084. // // Example iterating over at most 3 pages of a ListSecretVersionIds operation.
  1085. // pageNum := 0
  1086. // err := client.ListSecretVersionIdsPages(params,
  1087. // func(page *ListSecretVersionIdsOutput, lastPage bool) bool {
  1088. // pageNum++
  1089. // fmt.Println(page)
  1090. // return pageNum <= 3
  1091. // })
  1092. //
  1093. func (c *SecretsManager) ListSecretVersionIdsPages(input *ListSecretVersionIdsInput, fn func(*ListSecretVersionIdsOutput, bool) bool) error {
  1094. return c.ListSecretVersionIdsPagesWithContext(aws.BackgroundContext(), input, fn)
  1095. }
  1096. // ListSecretVersionIdsPagesWithContext same as ListSecretVersionIdsPages except
  1097. // it takes a Context and allows setting request options on the pages.
  1098. //
  1099. // The context must be non-nil and will be used for request cancellation. If
  1100. // the context is nil a panic will occur. In the future the SDK may create
  1101. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1102. // for more information on using Contexts.
  1103. func (c *SecretsManager) ListSecretVersionIdsPagesWithContext(ctx aws.Context, input *ListSecretVersionIdsInput, fn func(*ListSecretVersionIdsOutput, bool) bool, opts ...request.Option) error {
  1104. p := request.Pagination{
  1105. NewRequest: func() (*request.Request, error) {
  1106. var inCpy *ListSecretVersionIdsInput
  1107. if input != nil {
  1108. tmp := *input
  1109. inCpy = &tmp
  1110. }
  1111. req, _ := c.ListSecretVersionIdsRequest(inCpy)
  1112. req.SetContext(ctx)
  1113. req.ApplyOptions(opts...)
  1114. return req, nil
  1115. },
  1116. }
  1117. cont := true
  1118. for p.Next() && cont {
  1119. cont = fn(p.Page().(*ListSecretVersionIdsOutput), !p.HasNextPage())
  1120. }
  1121. return p.Err()
  1122. }
  1123. const opListSecrets = "ListSecrets"
  1124. // ListSecretsRequest generates a "aws/request.Request" representing the
  1125. // client's request for the ListSecrets operation. The "output" return
  1126. // value will be populated with the request's response once the request completes
  1127. // successfully.
  1128. //
  1129. // Use "Send" method on the returned Request to send the API call to the service.
  1130. // the "output" return value is not valid until after Send returns without error.
  1131. //
  1132. // See ListSecrets for more information on using the ListSecrets
  1133. // API call, and error handling.
  1134. //
  1135. // This method is useful when you want to inject custom logic or configuration
  1136. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  1137. //
  1138. //
  1139. // // Example sending a request using the ListSecretsRequest method.
  1140. // req, resp := client.ListSecretsRequest(params)
  1141. //
  1142. // err := req.Send()
  1143. // if err == nil { // resp is now filled
  1144. // fmt.Println(resp)
  1145. // }
  1146. //
  1147. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/ListSecrets
  1148. func (c *SecretsManager) ListSecretsRequest(input *ListSecretsInput) (req *request.Request, output *ListSecretsOutput) {
  1149. op := &request.Operation{
  1150. Name: opListSecrets,
  1151. HTTPMethod: "POST",
  1152. HTTPPath: "/",
  1153. Paginator: &request.Paginator{
  1154. InputTokens: []string{"NextToken"},
  1155. OutputTokens: []string{"NextToken"},
  1156. LimitToken: "MaxResults",
  1157. TruncationToken: "",
  1158. },
  1159. }
  1160. if input == nil {
  1161. input = &ListSecretsInput{}
  1162. }
  1163. output = &ListSecretsOutput{}
  1164. req = c.newRequest(op, input, output)
  1165. return
  1166. }
  1167. // ListSecrets API operation for AWS Secrets Manager.
  1168. //
  1169. // Lists all of the secrets that are stored by Secrets Manager in the AWS account.
  1170. // To list the versions currently stored for a specific secret, use ListSecretVersionIds.
  1171. // The encrypted fields SecretString and SecretBinary are not included in the
  1172. // output. To get that information, call the GetSecretValue operation.
  1173. //
  1174. // Always check the NextToken response parameter when calling any of the List*
  1175. // operations. These operations can occasionally return an empty or shorter
  1176. // than expected list of results even when there are more results available.
  1177. // When this happens, the NextToken response parameter contains a value to pass
  1178. // to the next call to the same API to request the next part of the list.
  1179. //
  1180. // Minimum permissions
  1181. //
  1182. // To run this command, you must have the following permissions:
  1183. //
  1184. // * secretsmanager:ListSecrets
  1185. //
  1186. // Related operations
  1187. //
  1188. // * To list the versions attached to a secret, use ListSecretVersionIds.
  1189. //
  1190. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  1191. // with awserr.Error's Code and Message methods to get detailed information about
  1192. // the error.
  1193. //
  1194. // See the AWS API reference guide for AWS Secrets Manager's
  1195. // API operation ListSecrets for usage and error information.
  1196. //
  1197. // Returned Error Codes:
  1198. // * ErrCodeInvalidParameterException "InvalidParameterException"
  1199. // You provided an invalid value for a parameter.
  1200. //
  1201. // * ErrCodeInvalidNextTokenException "InvalidNextTokenException"
  1202. // You provided an invalid NextToken value.
  1203. //
  1204. // * ErrCodeInternalServiceError "InternalServiceError"
  1205. // An error occurred on the server side.
  1206. //
  1207. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/ListSecrets
  1208. func (c *SecretsManager) ListSecrets(input *ListSecretsInput) (*ListSecretsOutput, error) {
  1209. req, out := c.ListSecretsRequest(input)
  1210. return out, req.Send()
  1211. }
  1212. // ListSecretsWithContext is the same as ListSecrets with the addition of
  1213. // the ability to pass a context and additional request options.
  1214. //
  1215. // See ListSecrets for details on how to use this API operation.
  1216. //
  1217. // The context must be non-nil and will be used for request cancellation. If
  1218. // the context is nil a panic will occur. In the future the SDK may create
  1219. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1220. // for more information on using Contexts.
  1221. func (c *SecretsManager) ListSecretsWithContext(ctx aws.Context, input *ListSecretsInput, opts ...request.Option) (*ListSecretsOutput, error) {
  1222. req, out := c.ListSecretsRequest(input)
  1223. req.SetContext(ctx)
  1224. req.ApplyOptions(opts...)
  1225. return out, req.Send()
  1226. }
  1227. // ListSecretsPages iterates over the pages of a ListSecrets operation,
  1228. // calling the "fn" function with the response data for each page. To stop
  1229. // iterating, return false from the fn function.
  1230. //
  1231. // See ListSecrets method for more information on how to use this operation.
  1232. //
  1233. // Note: This operation can generate multiple requests to a service.
  1234. //
  1235. // // Example iterating over at most 3 pages of a ListSecrets operation.
  1236. // pageNum := 0
  1237. // err := client.ListSecretsPages(params,
  1238. // func(page *ListSecretsOutput, lastPage bool) bool {
  1239. // pageNum++
  1240. // fmt.Println(page)
  1241. // return pageNum <= 3
  1242. // })
  1243. //
  1244. func (c *SecretsManager) ListSecretsPages(input *ListSecretsInput, fn func(*ListSecretsOutput, bool) bool) error {
  1245. return c.ListSecretsPagesWithContext(aws.BackgroundContext(), input, fn)
  1246. }
  1247. // ListSecretsPagesWithContext same as ListSecretsPages except
  1248. // it takes a Context and allows setting request options on the pages.
  1249. //
  1250. // The context must be non-nil and will be used for request cancellation. If
  1251. // the context is nil a panic will occur. In the future the SDK may create
  1252. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1253. // for more information on using Contexts.
  1254. func (c *SecretsManager) ListSecretsPagesWithContext(ctx aws.Context, input *ListSecretsInput, fn func(*ListSecretsOutput, bool) bool, opts ...request.Option) error {
  1255. p := request.Pagination{
  1256. NewRequest: func() (*request.Request, error) {
  1257. var inCpy *ListSecretsInput
  1258. if input != nil {
  1259. tmp := *input
  1260. inCpy = &tmp
  1261. }
  1262. req, _ := c.ListSecretsRequest(inCpy)
  1263. req.SetContext(ctx)
  1264. req.ApplyOptions(opts...)
  1265. return req, nil
  1266. },
  1267. }
  1268. cont := true
  1269. for p.Next() && cont {
  1270. cont = fn(p.Page().(*ListSecretsOutput), !p.HasNextPage())
  1271. }
  1272. return p.Err()
  1273. }
  1274. const opPutResourcePolicy = "PutResourcePolicy"
  1275. // PutResourcePolicyRequest generates a "aws/request.Request" representing the
  1276. // client's request for the PutResourcePolicy operation. The "output" return
  1277. // value will be populated with the request's response once the request completes
  1278. // successfully.
  1279. //
  1280. // Use "Send" method on the returned Request to send the API call to the service.
  1281. // the "output" return value is not valid until after Send returns without error.
  1282. //
  1283. // See PutResourcePolicy for more information on using the PutResourcePolicy
  1284. // API call, and error handling.
  1285. //
  1286. // This method is useful when you want to inject custom logic or configuration
  1287. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  1288. //
  1289. //
  1290. // // Example sending a request using the PutResourcePolicyRequest method.
  1291. // req, resp := client.PutResourcePolicyRequest(params)
  1292. //
  1293. // err := req.Send()
  1294. // if err == nil { // resp is now filled
  1295. // fmt.Println(resp)
  1296. // }
  1297. //
  1298. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/PutResourcePolicy
  1299. func (c *SecretsManager) PutResourcePolicyRequest(input *PutResourcePolicyInput) (req *request.Request, output *PutResourcePolicyOutput) {
  1300. op := &request.Operation{
  1301. Name: opPutResourcePolicy,
  1302. HTTPMethod: "POST",
  1303. HTTPPath: "/",
  1304. }
  1305. if input == nil {
  1306. input = &PutResourcePolicyInput{}
  1307. }
  1308. output = &PutResourcePolicyOutput{}
  1309. req = c.newRequest(op, input, output)
  1310. return
  1311. }
  1312. // PutResourcePolicy API operation for AWS Secrets Manager.
  1313. //
  1314. // Attaches the contents of the specified resource-based permission policy to
  1315. // a secret. A resource-based policy is optional. Alternatively, you can use
  1316. // IAM identity-based policies that specify the secret's Amazon Resource Name
  1317. // (ARN) in the policy statement's Resources element. You can also use a combination
  1318. // of both identity-based and resource-based policies. The affected users and
  1319. // roles receive the permissions that are permitted by all of the relevant policies.
  1320. // For more information, see Using Resource-Based Policies for AWS Secrets Manager
  1321. // (http://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_resource-based-policies.html).
  1322. // For the complete description of the AWS policy syntax and grammar, see IAM
  1323. // JSON Policy Reference (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies.html)
  1324. // in the IAM User Guide.
  1325. //
  1326. // Minimum permissions
  1327. //
  1328. // To run this command, you must have the following permissions:
  1329. //
  1330. // * secretsmanager:PutResourcePolicy
  1331. //
  1332. // Related operations
  1333. //
  1334. // * To retrieve the resource policy that's attached to a secret, use GetResourcePolicy.
  1335. //
  1336. // * To delete the resource-based policy that's attached to a secret, use
  1337. // DeleteResourcePolicy.
  1338. //
  1339. // * To list all of the currently available secrets, use ListSecrets.
  1340. //
  1341. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  1342. // with awserr.Error's Code and Message methods to get detailed information about
  1343. // the error.
  1344. //
  1345. // See the AWS API reference guide for AWS Secrets Manager's
  1346. // API operation PutResourcePolicy for usage and error information.
  1347. //
  1348. // Returned Error Codes:
  1349. // * ErrCodeMalformedPolicyDocumentException "MalformedPolicyDocumentException"
  1350. // The policy document that you provided isn't valid.
  1351. //
  1352. // * ErrCodeResourceNotFoundException "ResourceNotFoundException"
  1353. // We can't find the resource that you asked for.
  1354. //
  1355. // * ErrCodeInvalidParameterException "InvalidParameterException"
  1356. // You provided an invalid value for a parameter.
  1357. //
  1358. // * ErrCodeInternalServiceError "InternalServiceError"
  1359. // An error occurred on the server side.
  1360. //
  1361. // * ErrCodeInvalidRequestException "InvalidRequestException"
  1362. // You provided a parameter value that is not valid for the current state of
  1363. // the resource.
  1364. //
  1365. // Possible causes:
  1366. //
  1367. // * You tried to perform the operation on a secret that's currently marked
  1368. // deleted.
  1369. //
  1370. // * You tried to enable rotation on a secret that doesn't already have a
  1371. // Lambda function ARN configured and you didn't include such an ARN as a
  1372. // parameter in this call.
  1373. //
  1374. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/PutResourcePolicy
  1375. func (c *SecretsManager) PutResourcePolicy(input *PutResourcePolicyInput) (*PutResourcePolicyOutput, error) {
  1376. req, out := c.PutResourcePolicyRequest(input)
  1377. return out, req.Send()
  1378. }
  1379. // PutResourcePolicyWithContext is the same as PutResourcePolicy with the addition of
  1380. // the ability to pass a context and additional request options.
  1381. //
  1382. // See PutResourcePolicy for details on how to use this API operation.
  1383. //
  1384. // The context must be non-nil and will be used for request cancellation. If
  1385. // the context is nil a panic will occur. In the future the SDK may create
  1386. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1387. // for more information on using Contexts.
  1388. func (c *SecretsManager) PutResourcePolicyWithContext(ctx aws.Context, input *PutResourcePolicyInput, opts ...request.Option) (*PutResourcePolicyOutput, error) {
  1389. req, out := c.PutResourcePolicyRequest(input)
  1390. req.SetContext(ctx)
  1391. req.ApplyOptions(opts...)
  1392. return out, req.Send()
  1393. }
  1394. const opPutSecretValue = "PutSecretValue"
  1395. // PutSecretValueRequest generates a "aws/request.Request" representing the
  1396. // client's request for the PutSecretValue operation. The "output" return
  1397. // value will be populated with the request's response once the request completes
  1398. // successfully.
  1399. //
  1400. // Use "Send" method on the returned Request to send the API call to the service.
  1401. // the "output" return value is not valid until after Send returns without error.
  1402. //
  1403. // See PutSecretValue for more information on using the PutSecretValue
  1404. // API call, and error handling.
  1405. //
  1406. // This method is useful when you want to inject custom logic or configuration
  1407. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  1408. //
  1409. //
  1410. // // Example sending a request using the PutSecretValueRequest method.
  1411. // req, resp := client.PutSecretValueRequest(params)
  1412. //
  1413. // err := req.Send()
  1414. // if err == nil { // resp is now filled
  1415. // fmt.Println(resp)
  1416. // }
  1417. //
  1418. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/PutSecretValue
  1419. func (c *SecretsManager) PutSecretValueRequest(input *PutSecretValueInput) (req *request.Request, output *PutSecretValueOutput) {
  1420. op := &request.Operation{
  1421. Name: opPutSecretValue,
  1422. HTTPMethod: "POST",
  1423. HTTPPath: "/",
  1424. }
  1425. if input == nil {
  1426. input = &PutSecretValueInput{}
  1427. }
  1428. output = &PutSecretValueOutput{}
  1429. req = c.newRequest(op, input, output)
  1430. return
  1431. }
  1432. // PutSecretValue API operation for AWS Secrets Manager.
  1433. //
  1434. // Stores a new encrypted secret value in the specified secret. To do this,
  1435. // the operation creates a new version and attaches it to the secret. The version
  1436. // can contain a new SecretString value or a new SecretBinary value. You can
  1437. // also specify the staging labels that are initially attached to the new version.
  1438. //
  1439. // The Secrets Manager console uses only the SecretString field. To add binary
  1440. // data to a secret with the SecretBinary field you must use the AWS CLI or
  1441. // one of the AWS SDKs.
  1442. //
  1443. // * If this operation creates the first version for the secret then Secrets
  1444. // Manager automatically attaches the staging label AWSCURRENT to the new
  1445. // version.
  1446. //
  1447. // * If another version of this secret already exists, then this operation
  1448. // does not automatically move any staging labels other than those that you
  1449. // explicitly specify in the VersionStages parameter.
  1450. //
  1451. // * If this operation moves the staging label AWSCURRENT from another version
  1452. // to this version (because you included it in the StagingLabels parameter)
  1453. // then Secrets Manager also automatically moves the staging label AWSPREVIOUS
  1454. // to the version that AWSCURRENT was removed from.
  1455. //
  1456. // * This operation is idempotent. If a version with a VersionId with the
  1457. // same value as the ClientRequestToken parameter already exists and you
  1458. // specify the same secret data, the operation succeeds but does nothing.
  1459. // However, if the secret data is different, then the operation fails because
  1460. // you cannot modify an existing version; you can only create new ones.
  1461. //
  1462. // If you call an operation that needs to encrypt or decrypt the SecretString
  1463. // or SecretBinary for a secret in the same account as the calling user and
  1464. // that secret doesn't specify a AWS KMS encryption key, Secrets Manager uses
  1465. // the account's default AWS managed customer master key (CMK) with the alias
  1466. // aws/secretsmanager. If this key doesn't already exist in your account then
  1467. // Secrets Manager creates it for you automatically. All users and roles in
  1468. // the same AWS account automatically have access to use the default CMK. Note
  1469. // that if an Secrets Manager API call results in AWS having to create the account's
  1470. // AWS-managed CMK, it can result in a one-time significant delay in returning
  1471. // the result.
  1472. //
  1473. // If the secret is in a different AWS account from the credentials calling
  1474. // an API that requires encryption or decryption of the secret value then you
  1475. // must create and use a custom AWS KMS CMK because you can't access the default
  1476. // CMK for the account using credentials from a different AWS account. Store
  1477. // the ARN of the CMK in the secret when you create the secret or when you update
  1478. // it by including it in the KMSKeyId. If you call an API that must encrypt
  1479. // or decrypt SecretString or SecretBinary using credentials from a different
  1480. // account then the AWS KMS key policy must grant cross-account access to that
  1481. // other account's user or role for both the kms:GenerateDataKey and kms:Decrypt
  1482. // operations.
  1483. //
  1484. // Minimum permissions
  1485. //
  1486. // To run this command, you must have the following permissions:
  1487. //
  1488. // * secretsmanager:PutSecretValue
  1489. //
  1490. // * kms:GenerateDataKey - needed only if you use a customer-managed AWS
  1491. // KMS key to encrypt the secret. You do not need this permission to use
  1492. // the account's default AWS managed CMK for Secrets Manager.
  1493. //
  1494. // Related operations
  1495. //
  1496. // * To retrieve the encrypted value you store in the version of a secret,
  1497. // use GetSecretValue.
  1498. //
  1499. // * To create a secret, use CreateSecret.
  1500. //
  1501. // * To get the details for a secret, use DescribeSecret.
  1502. //
  1503. // * To list the versions attached to a secret, use ListSecretVersionIds.
  1504. //
  1505. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  1506. // with awserr.Error's Code and Message methods to get detailed information about
  1507. // the error.
  1508. //
  1509. // See the AWS API reference guide for AWS Secrets Manager's
  1510. // API operation PutSecretValue for usage and error information.
  1511. //
  1512. // Returned Error Codes:
  1513. // * ErrCodeInvalidParameterException "InvalidParameterException"
  1514. // You provided an invalid value for a parameter.
  1515. //
  1516. // * ErrCodeInvalidRequestException "InvalidRequestException"
  1517. // You provided a parameter value that is not valid for the current state of
  1518. // the resource.
  1519. //
  1520. // Possible causes:
  1521. //
  1522. // * You tried to perform the operation on a secret that's currently marked
  1523. // deleted.
  1524. //
  1525. // * You tried to enable rotation on a secret that doesn't already have a
  1526. // Lambda function ARN configured and you didn't include such an ARN as a
  1527. // parameter in this call.
  1528. //
  1529. // * ErrCodeLimitExceededException "LimitExceededException"
  1530. // The request failed because it would exceed one of the Secrets Manager internal
  1531. // limits.
  1532. //
  1533. // * ErrCodeEncryptionFailure "EncryptionFailure"
  1534. // Secrets Manager can't encrypt the protected secret text using the provided
  1535. // KMS key. Check that the customer master key (CMK) is available, enabled,
  1536. // and not in an invalid state. For more information, see How Key State Affects
  1537. // Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html).
  1538. //
  1539. // * ErrCodeResourceExistsException "ResourceExistsException"
  1540. // A resource with the ID you requested already exists.
  1541. //
  1542. // * ErrCodeResourceNotFoundException "ResourceNotFoundException"
  1543. // We can't find the resource that you asked for.
  1544. //
  1545. // * ErrCodeInternalServiceError "InternalServiceError"
  1546. // An error occurred on the server side.
  1547. //
  1548. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/PutSecretValue
  1549. func (c *SecretsManager) PutSecretValue(input *PutSecretValueInput) (*PutSecretValueOutput, error) {
  1550. req, out := c.PutSecretValueRequest(input)
  1551. return out, req.Send()
  1552. }
  1553. // PutSecretValueWithContext is the same as PutSecretValue with the addition of
  1554. // the ability to pass a context and additional request options.
  1555. //
  1556. // See PutSecretValue for details on how to use this API operation.
  1557. //
  1558. // The context must be non-nil and will be used for request cancellation. If
  1559. // the context is nil a panic will occur. In the future the SDK may create
  1560. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1561. // for more information on using Contexts.
  1562. func (c *SecretsManager) PutSecretValueWithContext(ctx aws.Context, input *PutSecretValueInput, opts ...request.Option) (*PutSecretValueOutput, error) {
  1563. req, out := c.PutSecretValueRequest(input)
  1564. req.SetContext(ctx)
  1565. req.ApplyOptions(opts...)
  1566. return out, req.Send()
  1567. }
  1568. const opRestoreSecret = "RestoreSecret"
  1569. // RestoreSecretRequest generates a "aws/request.Request" representing the
  1570. // client's request for the RestoreSecret operation. The "output" return
  1571. // value will be populated with the request's response once the request completes
  1572. // successfully.
  1573. //
  1574. // Use "Send" method on the returned Request to send the API call to the service.
  1575. // the "output" return value is not valid until after Send returns without error.
  1576. //
  1577. // See RestoreSecret for more information on using the RestoreSecret
  1578. // API call, and error handling.
  1579. //
  1580. // This method is useful when you want to inject custom logic or configuration
  1581. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  1582. //
  1583. //
  1584. // // Example sending a request using the RestoreSecretRequest method.
  1585. // req, resp := client.RestoreSecretRequest(params)
  1586. //
  1587. // err := req.Send()
  1588. // if err == nil { // resp is now filled
  1589. // fmt.Println(resp)
  1590. // }
  1591. //
  1592. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/RestoreSecret
  1593. func (c *SecretsManager) RestoreSecretRequest(input *RestoreSecretInput) (req *request.Request, output *RestoreSecretOutput) {
  1594. op := &request.Operation{
  1595. Name: opRestoreSecret,
  1596. HTTPMethod: "POST",
  1597. HTTPPath: "/",
  1598. }
  1599. if input == nil {
  1600. input = &RestoreSecretInput{}
  1601. }
  1602. output = &RestoreSecretOutput{}
  1603. req = c.newRequest(op, input, output)
  1604. return
  1605. }
  1606. // RestoreSecret API operation for AWS Secrets Manager.
  1607. //
  1608. // Cancels the scheduled deletion of a secret by removing the DeletedDate time
  1609. // stamp. This makes the secret accessible to query once again.
  1610. //
  1611. // Minimum permissions
  1612. //
  1613. // To run this command, you must have the following permissions:
  1614. //
  1615. // * secretsmanager:RestoreSecret
  1616. //
  1617. // Related operations
  1618. //
  1619. // * To delete a secret, use DeleteSecret.
  1620. //
  1621. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  1622. // with awserr.Error's Code and Message methods to get detailed information about
  1623. // the error.
  1624. //
  1625. // See the AWS API reference guide for AWS Secrets Manager's
  1626. // API operation RestoreSecret for usage and error information.
  1627. //
  1628. // Returned Error Codes:
  1629. // * ErrCodeResourceNotFoundException "ResourceNotFoundException"
  1630. // We can't find the resource that you asked for.
  1631. //
  1632. // * ErrCodeInvalidParameterException "InvalidParameterException"
  1633. // You provided an invalid value for a parameter.
  1634. //
  1635. // * ErrCodeInvalidRequestException "InvalidRequestException"
  1636. // You provided a parameter value that is not valid for the current state of
  1637. // the resource.
  1638. //
  1639. // Possible causes:
  1640. //
  1641. // * You tried to perform the operation on a secret that's currently marked
  1642. // deleted.
  1643. //
  1644. // * You tried to enable rotation on a secret that doesn't already have a
  1645. // Lambda function ARN configured and you didn't include such an ARN as a
  1646. // parameter in this call.
  1647. //
  1648. // * ErrCodeInternalServiceError "InternalServiceError"
  1649. // An error occurred on the server side.
  1650. //
  1651. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/RestoreSecret
  1652. func (c *SecretsManager) RestoreSecret(input *RestoreSecretInput) (*RestoreSecretOutput, error) {
  1653. req, out := c.RestoreSecretRequest(input)
  1654. return out, req.Send()
  1655. }
  1656. // RestoreSecretWithContext is the same as RestoreSecret with the addition of
  1657. // the ability to pass a context and additional request options.
  1658. //
  1659. // See RestoreSecret for details on how to use this API operation.
  1660. //
  1661. // The context must be non-nil and will be used for request cancellation. If
  1662. // the context is nil a panic will occur. In the future the SDK may create
  1663. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1664. // for more information on using Contexts.
  1665. func (c *SecretsManager) RestoreSecretWithContext(ctx aws.Context, input *RestoreSecretInput, opts ...request.Option) (*RestoreSecretOutput, error) {
  1666. req, out := c.RestoreSecretRequest(input)
  1667. req.SetContext(ctx)
  1668. req.ApplyOptions(opts...)
  1669. return out, req.Send()
  1670. }
  1671. const opRotateSecret = "RotateSecret"
  1672. // RotateSecretRequest generates a "aws/request.Request" representing the
  1673. // client's request for the RotateSecret operation. The "output" return
  1674. // value will be populated with the request's response once the request completes
  1675. // successfully.
  1676. //
  1677. // Use "Send" method on the returned Request to send the API call to the service.
  1678. // the "output" return value is not valid until after Send returns without error.
  1679. //
  1680. // See RotateSecret for more information on using the RotateSecret
  1681. // API call, and error handling.
  1682. //
  1683. // This method is useful when you want to inject custom logic or configuration
  1684. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  1685. //
  1686. //
  1687. // // Example sending a request using the RotateSecretRequest method.
  1688. // req, resp := client.RotateSecretRequest(params)
  1689. //
  1690. // err := req.Send()
  1691. // if err == nil { // resp is now filled
  1692. // fmt.Println(resp)
  1693. // }
  1694. //
  1695. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/RotateSecret
  1696. func (c *SecretsManager) RotateSecretRequest(input *RotateSecretInput) (req *request.Request, output *RotateSecretOutput) {
  1697. op := &request.Operation{
  1698. Name: opRotateSecret,
  1699. HTTPMethod: "POST",
  1700. HTTPPath: "/",
  1701. }
  1702. if input == nil {
  1703. input = &RotateSecretInput{}
  1704. }
  1705. output = &RotateSecretOutput{}
  1706. req = c.newRequest(op, input, output)
  1707. return
  1708. }
  1709. // RotateSecret API operation for AWS Secrets Manager.
  1710. //
  1711. // Configures and starts the asynchronous process of rotating this secret. If
  1712. // you include the configuration parameters, the operation sets those values
  1713. // for the secret and then immediately starts a rotation. If you do not include
  1714. // the configuration parameters, the operation starts a rotation with the values
  1715. // already stored in the secret. After the rotation completes, the protected
  1716. // service and its clients all use the new version of the secret.
  1717. //
  1718. // This required configuration information includes the ARN of an AWS Lambda
  1719. // function and the time between scheduled rotations. The Lambda rotation function
  1720. // creates a new version of the secret and creates or updates the credentials
  1721. // on the protected service to match. After testing the new credentials, the
  1722. // function marks the new secret with the staging label AWSCURRENT so that your
  1723. // clients all immediately begin to use the new version. For more information
  1724. // about rotating secrets and how to configure a Lambda function to rotate the
  1725. // secrets for your protected service, see Rotating Secrets in AWS Secrets Manager
  1726. // (http://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets.html)
  1727. // in the AWS Secrets Manager User Guide.
  1728. //
  1729. // Secrets Manager schedules the next rotation when the previous one is complete.
  1730. // Secrets Manager schedules the date by adding the rotation interval (number
  1731. // of days) to the actual date of the last rotation. The service chooses the
  1732. // hour within that 24-hour date window randomly. The minute is also chosen
  1733. // somewhat randomly, but weighted towards the top of the hour and influenced
  1734. // by a variety of factors that help distribute load.
  1735. //
  1736. // The rotation function must end with the versions of the secret in one of
  1737. // two states:
  1738. //
  1739. // * The AWSPENDING and AWSCURRENT staging labels are attached to the same
  1740. // version of the secret, or
  1741. //
  1742. // * The AWSPENDING staging label is not attached to any version of the secret.
  1743. //
  1744. // If instead the AWSPENDING staging label is present but is not attached to
  1745. // the same version as AWSCURRENT then any later invocation of RotateSecret
  1746. // assumes that a previous rotation request is still in progress and returns
  1747. // an error.
  1748. //
  1749. // Minimum permissions
  1750. //
  1751. // To run this command, you must have the following permissions:
  1752. //
  1753. // * secretsmanager:RotateSecret
  1754. //
  1755. // * lambda:InvokeFunction (on the function specified in the secret's metadata)
  1756. //
  1757. // Related operations
  1758. //
  1759. // * To list the secrets in your account, use ListSecrets.
  1760. //
  1761. // * To get the details for a version of a secret, use DescribeSecret.
  1762. //
  1763. // * To create a new version of a secret, use CreateSecret.
  1764. //
  1765. // * To attach staging labels to or remove staging labels from a version
  1766. // of a secret, use UpdateSecretVersionStage.
  1767. //
  1768. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  1769. // with awserr.Error's Code and Message methods to get detailed information about
  1770. // the error.
  1771. //
  1772. // See the AWS API reference guide for AWS Secrets Manager's
  1773. // API operation RotateSecret for usage and error information.
  1774. //
  1775. // Returned Error Codes:
  1776. // * ErrCodeResourceNotFoundException "ResourceNotFoundException"
  1777. // We can't find the resource that you asked for.
  1778. //
  1779. // * ErrCodeInvalidParameterException "InvalidParameterException"
  1780. // You provided an invalid value for a parameter.
  1781. //
  1782. // * ErrCodeInternalServiceError "InternalServiceError"
  1783. // An error occurred on the server side.
  1784. //
  1785. // * ErrCodeInvalidRequestException "InvalidRequestException"
  1786. // You provided a parameter value that is not valid for the current state of
  1787. // the resource.
  1788. //
  1789. // Possible causes:
  1790. //
  1791. // * You tried to perform the operation on a secret that's currently marked
  1792. // deleted.
  1793. //
  1794. // * You tried to enable rotation on a secret that doesn't already have a
  1795. // Lambda function ARN configured and you didn't include such an ARN as a
  1796. // parameter in this call.
  1797. //
  1798. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/RotateSecret
  1799. func (c *SecretsManager) RotateSecret(input *RotateSecretInput) (*RotateSecretOutput, error) {
  1800. req, out := c.RotateSecretRequest(input)
  1801. return out, req.Send()
  1802. }
  1803. // RotateSecretWithContext is the same as RotateSecret with the addition of
  1804. // the ability to pass a context and additional request options.
  1805. //
  1806. // See RotateSecret for details on how to use this API operation.
  1807. //
  1808. // The context must be non-nil and will be used for request cancellation. If
  1809. // the context is nil a panic will occur. In the future the SDK may create
  1810. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1811. // for more information on using Contexts.
  1812. func (c *SecretsManager) RotateSecretWithContext(ctx aws.Context, input *RotateSecretInput, opts ...request.Option) (*RotateSecretOutput, error) {
  1813. req, out := c.RotateSecretRequest(input)
  1814. req.SetContext(ctx)
  1815. req.ApplyOptions(opts...)
  1816. return out, req.Send()
  1817. }
  1818. const opTagResource = "TagResource"
  1819. // TagResourceRequest generates a "aws/request.Request" representing the
  1820. // client's request for the TagResource operation. The "output" return
  1821. // value will be populated with the request's response once the request completes
  1822. // successfully.
  1823. //
  1824. // Use "Send" method on the returned Request to send the API call to the service.
  1825. // the "output" return value is not valid until after Send returns without error.
  1826. //
  1827. // See TagResource for more information on using the TagResource
  1828. // API call, and error handling.
  1829. //
  1830. // This method is useful when you want to inject custom logic or configuration
  1831. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  1832. //
  1833. //
  1834. // // Example sending a request using the TagResourceRequest method.
  1835. // req, resp := client.TagResourceRequest(params)
  1836. //
  1837. // err := req.Send()
  1838. // if err == nil { // resp is now filled
  1839. // fmt.Println(resp)
  1840. // }
  1841. //
  1842. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/TagResource
  1843. func (c *SecretsManager) TagResourceRequest(input *TagResourceInput) (req *request.Request, output *TagResourceOutput) {
  1844. op := &request.Operation{
  1845. Name: opTagResource,
  1846. HTTPMethod: "POST",
  1847. HTTPPath: "/",
  1848. }
  1849. if input == nil {
  1850. input = &TagResourceInput{}
  1851. }
  1852. output = &TagResourceOutput{}
  1853. req = c.newRequest(op, input, output)
  1854. req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
  1855. return
  1856. }
  1857. // TagResource API operation for AWS Secrets Manager.
  1858. //
  1859. // Attaches one or more tags, each consisting of a key name and a value, to
  1860. // the specified secret. Tags are part of the secret's overall metadata, and
  1861. // are not associated with any specific version of the secret. This operation
  1862. // only appends tags to the existing list of tags. To remove tags, you must
  1863. // use UntagResource.
  1864. //
  1865. // The following basic restrictions apply to tags:
  1866. //
  1867. // * Maximum number of tags per secret—50
  1868. //
  1869. // * Maximum key length—127 Unicode characters in UTF-8
  1870. //
  1871. // * Maximum value length—255 Unicode characters in UTF-8
  1872. //
  1873. // * Tag keys and values are case sensitive.
  1874. //
  1875. // * Do not use the aws: prefix in your tag names or values because it is
  1876. // reserved for AWS use. You can't edit or delete tag names or values with
  1877. // this prefix. Tags with this prefix do not count against your tags per
  1878. // secret limit.
  1879. //
  1880. // * If your tagging schema will be used across multiple services and resources,
  1881. // remember that other services might have restrictions on allowed characters.
  1882. // Generally allowed characters are: letters, spaces, and numbers representable
  1883. // in UTF-8, plus the following special characters: + - = . _ : / @.
  1884. //
  1885. // If you use tags as part of your security strategy, then adding or removing
  1886. // a tag can change permissions. If successfully completing this operation would
  1887. // result in you losing your permissions for this secret, then the operation
  1888. // is blocked and returns an Access Denied error.
  1889. //
  1890. // Minimum permissions
  1891. //
  1892. // To run this command, you must have the following permissions:
  1893. //
  1894. // * secretsmanager:TagResource
  1895. //
  1896. // Related operations
  1897. //
  1898. // * To remove one or more tags from the collection attached to a secret,
  1899. // use UntagResource.
  1900. //
  1901. // * To view the list of tags attached to a secret, use DescribeSecret.
  1902. //
  1903. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  1904. // with awserr.Error's Code and Message methods to get detailed information about
  1905. // the error.
  1906. //
  1907. // See the AWS API reference guide for AWS Secrets Manager's
  1908. // API operation TagResource for usage and error information.
  1909. //
  1910. // Returned Error Codes:
  1911. // * ErrCodeResourceNotFoundException "ResourceNotFoundException"
  1912. // We can't find the resource that you asked for.
  1913. //
  1914. // * ErrCodeInvalidRequestException "InvalidRequestException"
  1915. // You provided a parameter value that is not valid for the current state of
  1916. // the resource.
  1917. //
  1918. // Possible causes:
  1919. //
  1920. // * You tried to perform the operation on a secret that's currently marked
  1921. // deleted.
  1922. //
  1923. // * You tried to enable rotation on a secret that doesn't already have a
  1924. // Lambda function ARN configured and you didn't include such an ARN as a
  1925. // parameter in this call.
  1926. //
  1927. // * ErrCodeInvalidParameterException "InvalidParameterException"
  1928. // You provided an invalid value for a parameter.
  1929. //
  1930. // * ErrCodeInternalServiceError "InternalServiceError"
  1931. // An error occurred on the server side.
  1932. //
  1933. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/TagResource
  1934. func (c *SecretsManager) TagResource(input *TagResourceInput) (*TagResourceOutput, error) {
  1935. req, out := c.TagResourceRequest(input)
  1936. return out, req.Send()
  1937. }
  1938. // TagResourceWithContext is the same as TagResource with the addition of
  1939. // the ability to pass a context and additional request options.
  1940. //
  1941. // See TagResource for details on how to use this API operation.
  1942. //
  1943. // The context must be non-nil and will be used for request cancellation. If
  1944. // the context is nil a panic will occur. In the future the SDK may create
  1945. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1946. // for more information on using Contexts.
  1947. func (c *SecretsManager) TagResourceWithContext(ctx aws.Context, input *TagResourceInput, opts ...request.Option) (*TagResourceOutput, error) {
  1948. req, out := c.TagResourceRequest(input)
  1949. req.SetContext(ctx)
  1950. req.ApplyOptions(opts...)
  1951. return out, req.Send()
  1952. }
  1953. const opUntagResource = "UntagResource"
  1954. // UntagResourceRequest generates a "aws/request.Request" representing the
  1955. // client's request for the UntagResource operation. The "output" return
  1956. // value will be populated with the request's response once the request completes
  1957. // successfully.
  1958. //
  1959. // Use "Send" method on the returned Request to send the API call to the service.
  1960. // the "output" return value is not valid until after Send returns without error.
  1961. //
  1962. // See UntagResource for more information on using the UntagResource
  1963. // API call, and error handling.
  1964. //
  1965. // This method is useful when you want to inject custom logic or configuration
  1966. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  1967. //
  1968. //
  1969. // // Example sending a request using the UntagResourceRequest method.
  1970. // req, resp := client.UntagResourceRequest(params)
  1971. //
  1972. // err := req.Send()
  1973. // if err == nil { // resp is now filled
  1974. // fmt.Println(resp)
  1975. // }
  1976. //
  1977. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/UntagResource
  1978. func (c *SecretsManager) UntagResourceRequest(input *UntagResourceInput) (req *request.Request, output *UntagResourceOutput) {
  1979. op := &request.Operation{
  1980. Name: opUntagResource,
  1981. HTTPMethod: "POST",
  1982. HTTPPath: "/",
  1983. }
  1984. if input == nil {
  1985. input = &UntagResourceInput{}
  1986. }
  1987. output = &UntagResourceOutput{}
  1988. req = c.newRequest(op, input, output)
  1989. req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
  1990. return
  1991. }
  1992. // UntagResource API operation for AWS Secrets Manager.
  1993. //
  1994. // Removes one or more tags from the specified secret.
  1995. //
  1996. // This operation is idempotent. If a requested tag is not attached to the secret,
  1997. // no error is returned and the secret metadata is unchanged.
  1998. //
  1999. // If you use tags as part of your security strategy, then removing a tag can
  2000. // change permissions. If successfully completing this operation would result
  2001. // in you losing your permissions for this secret, then the operation is blocked
  2002. // and returns an Access Denied error.
  2003. //
  2004. // Minimum permissions
  2005. //
  2006. // To run this command, you must have the following permissions:
  2007. //
  2008. // * secretsmanager:UntagResource
  2009. //
  2010. // Related operations
  2011. //
  2012. // * To add one or more tags to the collection attached to a secret, use
  2013. // TagResource.
  2014. //
  2015. // * To view the list of tags attached to a secret, use DescribeSecret.
  2016. //
  2017. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  2018. // with awserr.Error's Code and Message methods to get detailed information about
  2019. // the error.
  2020. //
  2021. // See the AWS API reference guide for AWS Secrets Manager's
  2022. // API operation UntagResource for usage and error information.
  2023. //
  2024. // Returned Error Codes:
  2025. // * ErrCodeResourceNotFoundException "ResourceNotFoundException"
  2026. // We can't find the resource that you asked for.
  2027. //
  2028. // * ErrCodeInvalidRequestException "InvalidRequestException"
  2029. // You provided a parameter value that is not valid for the current state of
  2030. // the resource.
  2031. //
  2032. // Possible causes:
  2033. //
  2034. // * You tried to perform the operation on a secret that's currently marked
  2035. // deleted.
  2036. //
  2037. // * You tried to enable rotation on a secret that doesn't already have a
  2038. // Lambda function ARN configured and you didn't include such an ARN as a
  2039. // parameter in this call.
  2040. //
  2041. // * ErrCodeInvalidParameterException "InvalidParameterException"
  2042. // You provided an invalid value for a parameter.
  2043. //
  2044. // * ErrCodeInternalServiceError "InternalServiceError"
  2045. // An error occurred on the server side.
  2046. //
  2047. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/UntagResource
  2048. func (c *SecretsManager) UntagResource(input *UntagResourceInput) (*UntagResourceOutput, error) {
  2049. req, out := c.UntagResourceRequest(input)
  2050. return out, req.Send()
  2051. }
  2052. // UntagResourceWithContext is the same as UntagResource with the addition of
  2053. // the ability to pass a context and additional request options.
  2054. //
  2055. // See UntagResource for details on how to use this API operation.
  2056. //
  2057. // The context must be non-nil and will be used for request cancellation. If
  2058. // the context is nil a panic will occur. In the future the SDK may create
  2059. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  2060. // for more information on using Contexts.
  2061. func (c *SecretsManager) UntagResourceWithContext(ctx aws.Context, input *UntagResourceInput, opts ...request.Option) (*UntagResourceOutput, error) {
  2062. req, out := c.UntagResourceRequest(input)
  2063. req.SetContext(ctx)
  2064. req.ApplyOptions(opts...)
  2065. return out, req.Send()
  2066. }
  2067. const opUpdateSecret = "UpdateSecret"
  2068. // UpdateSecretRequest generates a "aws/request.Request" representing the
  2069. // client's request for the UpdateSecret operation. The "output" return
  2070. // value will be populated with the request's response once the request completes
  2071. // successfully.
  2072. //
  2073. // Use "Send" method on the returned Request to send the API call to the service.
  2074. // the "output" return value is not valid until after Send returns without error.
  2075. //
  2076. // See UpdateSecret for more information on using the UpdateSecret
  2077. // API call, and error handling.
  2078. //
  2079. // This method is useful when you want to inject custom logic or configuration
  2080. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  2081. //
  2082. //
  2083. // // Example sending a request using the UpdateSecretRequest method.
  2084. // req, resp := client.UpdateSecretRequest(params)
  2085. //
  2086. // err := req.Send()
  2087. // if err == nil { // resp is now filled
  2088. // fmt.Println(resp)
  2089. // }
  2090. //
  2091. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/UpdateSecret
  2092. func (c *SecretsManager) UpdateSecretRequest(input *UpdateSecretInput) (req *request.Request, output *UpdateSecretOutput) {
  2093. op := &request.Operation{
  2094. Name: opUpdateSecret,
  2095. HTTPMethod: "POST",
  2096. HTTPPath: "/",
  2097. }
  2098. if input == nil {
  2099. input = &UpdateSecretInput{}
  2100. }
  2101. output = &UpdateSecretOutput{}
  2102. req = c.newRequest(op, input, output)
  2103. return
  2104. }
  2105. // UpdateSecret API operation for AWS Secrets Manager.
  2106. //
  2107. // Modifies many of the details of the specified secret. If you include a ClientRequestToken
  2108. // and eitherSecretString or SecretBinary then it also creates a new version
  2109. // attached to the secret.
  2110. //
  2111. // To modify the rotation configuration of a secret, use RotateSecret instead.
  2112. //
  2113. // The Secrets Manager console uses only the SecretString parameter and therefore
  2114. // limits you to encrypting and storing only a text string. To encrypt and store
  2115. // binary data as part of the version of a secret, you must use either the AWS
  2116. // CLI or one of the AWS SDKs.
  2117. //
  2118. // * If a version with a VersionId with the same value as the ClientRequestToken
  2119. // parameter already exists, the operation results in an error. You cannot
  2120. // modify an existing version, you can only create a new version.
  2121. //
  2122. // * If you include SecretString or SecretBinary to create a new secret version,
  2123. // Secrets Manager automatically attaches the staging label AWSCURRENT to
  2124. // the new version.
  2125. //
  2126. // If you call an operation that needs to encrypt or decrypt the SecretString
  2127. // or SecretBinary for a secret in the same account as the calling user and
  2128. // that secret doesn't specify a AWS KMS encryption key, Secrets Manager uses
  2129. // the account's default AWS managed customer master key (CMK) with the alias
  2130. // aws/secretsmanager. If this key doesn't already exist in your account then
  2131. // Secrets Manager creates it for you automatically. All users and roles in
  2132. // the same AWS account automatically have access to use the default CMK. Note
  2133. // that if an Secrets Manager API call results in AWS having to create the account's
  2134. // AWS-managed CMK, it can result in a one-time significant delay in returning
  2135. // the result.
  2136. //
  2137. // If the secret is in a different AWS account from the credentials calling
  2138. // an API that requires encryption or decryption of the secret value then you
  2139. // must create and use a custom AWS KMS CMK because you can't access the default
  2140. // CMK for the account using credentials from a different AWS account. Store
  2141. // the ARN of the CMK in the secret when you create the secret or when you update
  2142. // it by including it in the KMSKeyId. If you call an API that must encrypt
  2143. // or decrypt SecretString or SecretBinary using credentials from a different
  2144. // account then the AWS KMS key policy must grant cross-account access to that
  2145. // other account's user or role for both the kms:GenerateDataKey and kms:Decrypt
  2146. // operations.
  2147. //
  2148. // Minimum permissions
  2149. //
  2150. // To run this command, you must have the following permissions:
  2151. //
  2152. // * secretsmanager:UpdateSecret
  2153. //
  2154. // * kms:GenerateDataKey - needed only if you use a custom AWS KMS key to
  2155. // encrypt the secret. You do not need this permission to use the account's
  2156. // AWS managed CMK for Secrets Manager.
  2157. //
  2158. // * kms:Decrypt - needed only if you use a custom AWS KMS key to encrypt
  2159. // the secret. You do not need this permission to use the account's AWS managed
  2160. // CMK for Secrets Manager.
  2161. //
  2162. // Related operations
  2163. //
  2164. // * To create a new secret, use CreateSecret.
  2165. //
  2166. // * To add only a new version to an existing secret, use PutSecretValue.
  2167. //
  2168. // * To get the details for a secret, use DescribeSecret.
  2169. //
  2170. // * To list the versions contained in a secret, use ListSecretVersionIds.
  2171. //
  2172. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  2173. // with awserr.Error's Code and Message methods to get detailed information about
  2174. // the error.
  2175. //
  2176. // See the AWS API reference guide for AWS Secrets Manager's
  2177. // API operation UpdateSecret for usage and error information.
  2178. //
  2179. // Returned Error Codes:
  2180. // * ErrCodeInvalidParameterException "InvalidParameterException"
  2181. // You provided an invalid value for a parameter.
  2182. //
  2183. // * ErrCodeInvalidRequestException "InvalidRequestException"
  2184. // You provided a parameter value that is not valid for the current state of
  2185. // the resource.
  2186. //
  2187. // Possible causes:
  2188. //
  2189. // * You tried to perform the operation on a secret that's currently marked
  2190. // deleted.
  2191. //
  2192. // * You tried to enable rotation on a secret that doesn't already have a
  2193. // Lambda function ARN configured and you didn't include such an ARN as a
  2194. // parameter in this call.
  2195. //
  2196. // * ErrCodeLimitExceededException "LimitExceededException"
  2197. // The request failed because it would exceed one of the Secrets Manager internal
  2198. // limits.
  2199. //
  2200. // * ErrCodeEncryptionFailure "EncryptionFailure"
  2201. // Secrets Manager can't encrypt the protected secret text using the provided
  2202. // KMS key. Check that the customer master key (CMK) is available, enabled,
  2203. // and not in an invalid state. For more information, see How Key State Affects
  2204. // Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html).
  2205. //
  2206. // * ErrCodeResourceExistsException "ResourceExistsException"
  2207. // A resource with the ID you requested already exists.
  2208. //
  2209. // * ErrCodeResourceNotFoundException "ResourceNotFoundException"
  2210. // We can't find the resource that you asked for.
  2211. //
  2212. // * ErrCodeMalformedPolicyDocumentException "MalformedPolicyDocumentException"
  2213. // The policy document that you provided isn't valid.
  2214. //
  2215. // * ErrCodeInternalServiceError "InternalServiceError"
  2216. // An error occurred on the server side.
  2217. //
  2218. // * ErrCodePreconditionNotMetException "PreconditionNotMetException"
  2219. // The request failed because you did not complete all the prerequisite steps.
  2220. //
  2221. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/UpdateSecret
  2222. func (c *SecretsManager) UpdateSecret(input *UpdateSecretInput) (*UpdateSecretOutput, error) {
  2223. req, out := c.UpdateSecretRequest(input)
  2224. return out, req.Send()
  2225. }
  2226. // UpdateSecretWithContext is the same as UpdateSecret with the addition of
  2227. // the ability to pass a context and additional request options.
  2228. //
  2229. // See UpdateSecret for details on how to use this API operation.
  2230. //
  2231. // The context must be non-nil and will be used for request cancellation. If
  2232. // the context is nil a panic will occur. In the future the SDK may create
  2233. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  2234. // for more information on using Contexts.
  2235. func (c *SecretsManager) UpdateSecretWithContext(ctx aws.Context, input *UpdateSecretInput, opts ...request.Option) (*UpdateSecretOutput, error) {
  2236. req, out := c.UpdateSecretRequest(input)
  2237. req.SetContext(ctx)
  2238. req.ApplyOptions(opts...)
  2239. return out, req.Send()
  2240. }
  2241. const opUpdateSecretVersionStage = "UpdateSecretVersionStage"
  2242. // UpdateSecretVersionStageRequest generates a "aws/request.Request" representing the
  2243. // client's request for the UpdateSecretVersionStage operation. The "output" return
  2244. // value will be populated with the request's response once the request completes
  2245. // successfully.
  2246. //
  2247. // Use "Send" method on the returned Request to send the API call to the service.
  2248. // the "output" return value is not valid until after Send returns without error.
  2249. //
  2250. // See UpdateSecretVersionStage for more information on using the UpdateSecretVersionStage
  2251. // API call, and error handling.
  2252. //
  2253. // This method is useful when you want to inject custom logic or configuration
  2254. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  2255. //
  2256. //
  2257. // // Example sending a request using the UpdateSecretVersionStageRequest method.
  2258. // req, resp := client.UpdateSecretVersionStageRequest(params)
  2259. //
  2260. // err := req.Send()
  2261. // if err == nil { // resp is now filled
  2262. // fmt.Println(resp)
  2263. // }
  2264. //
  2265. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/UpdateSecretVersionStage
  2266. func (c *SecretsManager) UpdateSecretVersionStageRequest(input *UpdateSecretVersionStageInput) (req *request.Request, output *UpdateSecretVersionStageOutput) {
  2267. op := &request.Operation{
  2268. Name: opUpdateSecretVersionStage,
  2269. HTTPMethod: "POST",
  2270. HTTPPath: "/",
  2271. }
  2272. if input == nil {
  2273. input = &UpdateSecretVersionStageInput{}
  2274. }
  2275. output = &UpdateSecretVersionStageOutput{}
  2276. req = c.newRequest(op, input, output)
  2277. return
  2278. }
  2279. // UpdateSecretVersionStage API operation for AWS Secrets Manager.
  2280. //
  2281. // Modifies the staging labels attached to a version of a secret. Staging labels
  2282. // are used to track a version as it progresses through the secret rotation
  2283. // process. You can attach a staging label to only one version of a secret at
  2284. // a time. If a staging label to be added is already attached to another version,
  2285. // then it is moved--removed from the other version first and then attached
  2286. // to this one. For more information about staging labels, see Staging Labels
  2287. // (http://docs.aws.amazon.com/secretsmanager/latest/userguide/terms-concepts.html#term_staging-label)
  2288. // in the AWS Secrets Manager User Guide.
  2289. //
  2290. // The staging labels that you specify in the VersionStage parameter are added
  2291. // to the existing list of staging labels--they don't replace it.
  2292. //
  2293. // You can move the AWSCURRENT staging label to this version by including it
  2294. // in this call.
  2295. //
  2296. // Whenever you move AWSCURRENT, Secrets Manager automatically moves the label
  2297. // AWSPREVIOUS to the version that AWSCURRENT was removed from.
  2298. //
  2299. // If this action results in the last label being removed from a version, then
  2300. // the version is considered to be 'deprecated' and can be deleted by Secrets
  2301. // Manager.
  2302. //
  2303. // Minimum permissions
  2304. //
  2305. // To run this command, you must have the following permissions:
  2306. //
  2307. // * secretsmanager:UpdateSecretVersionStage
  2308. //
  2309. // Related operations
  2310. //
  2311. // * To get the list of staging labels that are currently associated with
  2312. // a version of a secret, use DescribeSecret and examine the SecretVersionsToStages
  2313. // response value.
  2314. //
  2315. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  2316. // with awserr.Error's Code and Message methods to get detailed information about
  2317. // the error.
  2318. //
  2319. // See the AWS API reference guide for AWS Secrets Manager's
  2320. // API operation UpdateSecretVersionStage for usage and error information.
  2321. //
  2322. // Returned Error Codes:
  2323. // * ErrCodeResourceNotFoundException "ResourceNotFoundException"
  2324. // We can't find the resource that you asked for.
  2325. //
  2326. // * ErrCodeInvalidParameterException "InvalidParameterException"
  2327. // You provided an invalid value for a parameter.
  2328. //
  2329. // * ErrCodeInvalidRequestException "InvalidRequestException"
  2330. // You provided a parameter value that is not valid for the current state of
  2331. // the resource.
  2332. //
  2333. // Possible causes:
  2334. //
  2335. // * You tried to perform the operation on a secret that's currently marked
  2336. // deleted.
  2337. //
  2338. // * You tried to enable rotation on a secret that doesn't already have a
  2339. // Lambda function ARN configured and you didn't include such an ARN as a
  2340. // parameter in this call.
  2341. //
  2342. // * ErrCodeLimitExceededException "LimitExceededException"
  2343. // The request failed because it would exceed one of the Secrets Manager internal
  2344. // limits.
  2345. //
  2346. // * ErrCodeInternalServiceError "InternalServiceError"
  2347. // An error occurred on the server side.
  2348. //
  2349. // See also, https://docs.aws.amazon.com/goto/WebAPI/secretsmanager-2017-10-17/UpdateSecretVersionStage
  2350. func (c *SecretsManager) UpdateSecretVersionStage(input *UpdateSecretVersionStageInput) (*UpdateSecretVersionStageOutput, error) {
  2351. req, out := c.UpdateSecretVersionStageRequest(input)
  2352. return out, req.Send()
  2353. }
  2354. // UpdateSecretVersionStageWithContext is the same as UpdateSecretVersionStage with the addition of
  2355. // the ability to pass a context and additional request options.
  2356. //
  2357. // See UpdateSecretVersionStage for details on how to use this API operation.
  2358. //
  2359. // The context must be non-nil and will be used for request cancellation. If
  2360. // the context is nil a panic will occur. In the future the SDK may create
  2361. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  2362. // for more information on using Contexts.
  2363. func (c *SecretsManager) UpdateSecretVersionStageWithContext(ctx aws.Context, input *UpdateSecretVersionStageInput, opts ...request.Option) (*UpdateSecretVersionStageOutput, error) {
  2364. req, out := c.UpdateSecretVersionStageRequest(input)
  2365. req.SetContext(ctx)
  2366. req.ApplyOptions(opts...)
  2367. return out, req.Send()
  2368. }
  2369. type CancelRotateSecretInput struct {
  2370. _ struct{} `type:"structure"`
  2371. // Specifies the secret for which you want to cancel a rotation request. You
  2372. // can specify either the Amazon Resource Name (ARN) or the friendly name of
  2373. // the secret.
  2374. //
  2375. // If you specify an ARN, we generally recommend that you specify a complete
  2376. // ARN. You can specify a partial ARN too—for example, if you don’t include
  2377. // the final hyphen and six random characters that Secrets Manager adds at the
  2378. // end of the ARN when you created the secret. A partial ARN match can work
  2379. // as long as it uniquely matches only one secret. However, if your secret has
  2380. // a name that ends in a hyphen followed by six characters (before Secrets Manager
  2381. // adds the hyphen and six characters to the ARN) and you try to use that as
  2382. // a partial ARN, then those characters cause Secrets Manager to assume that
  2383. // you’re specifying a complete ARN. This confusion can cause unexpected results.
  2384. // To avoid this situation, we recommend that you don’t create secret names
  2385. // that end with a hyphen followed by six characters.
  2386. //
  2387. // SecretId is a required field
  2388. SecretId *string `min:"1" type:"string" required:"true"`
  2389. }
  2390. // String returns the string representation
  2391. func (s CancelRotateSecretInput) String() string {
  2392. return awsutil.Prettify(s)
  2393. }
  2394. // GoString returns the string representation
  2395. func (s CancelRotateSecretInput) GoString() string {
  2396. return s.String()
  2397. }
  2398. // Validate inspects the fields of the type to determine if they are valid.
  2399. func (s *CancelRotateSecretInput) Validate() error {
  2400. invalidParams := request.ErrInvalidParams{Context: "CancelRotateSecretInput"}
  2401. if s.SecretId == nil {
  2402. invalidParams.Add(request.NewErrParamRequired("SecretId"))
  2403. }
  2404. if s.SecretId != nil && len(*s.SecretId) < 1 {
  2405. invalidParams.Add(request.NewErrParamMinLen("SecretId", 1))
  2406. }
  2407. if invalidParams.Len() > 0 {
  2408. return invalidParams
  2409. }
  2410. return nil
  2411. }
  2412. // SetSecretId sets the SecretId field's value.
  2413. func (s *CancelRotateSecretInput) SetSecretId(v string) *CancelRotateSecretInput {
  2414. s.SecretId = &v
  2415. return s
  2416. }
  2417. type CancelRotateSecretOutput struct {
  2418. _ struct{} `type:"structure"`
  2419. // The ARN of the secret for which rotation was canceled.
  2420. ARN *string `min:"20" type:"string"`
  2421. // The friendly name of the secret for which rotation was canceled.
  2422. Name *string `min:"1" type:"string"`
  2423. // The unique identifier of the version of the secret that was created during
  2424. // the rotation. This version might not be complete, and should be evaluated
  2425. // for possible deletion. At the very least, you should remove the VersionStage
  2426. // value AWSPENDING to enable this version to be deleted. Failing to clean up
  2427. // a cancelled rotation can block you from successfully starting future rotations.
  2428. VersionId *string `min:"32" type:"string"`
  2429. }
  2430. // String returns the string representation
  2431. func (s CancelRotateSecretOutput) String() string {
  2432. return awsutil.Prettify(s)
  2433. }
  2434. // GoString returns the string representation
  2435. func (s CancelRotateSecretOutput) GoString() string {
  2436. return s.String()
  2437. }
  2438. // SetARN sets the ARN field's value.
  2439. func (s *CancelRotateSecretOutput) SetARN(v string) *CancelRotateSecretOutput {
  2440. s.ARN = &v
  2441. return s
  2442. }
  2443. // SetName sets the Name field's value.
  2444. func (s *CancelRotateSecretOutput) SetName(v string) *CancelRotateSecretOutput {
  2445. s.Name = &v
  2446. return s
  2447. }
  2448. // SetVersionId sets the VersionId field's value.
  2449. func (s *CancelRotateSecretOutput) SetVersionId(v string) *CancelRotateSecretOutput {
  2450. s.VersionId = &v
  2451. return s
  2452. }
  2453. type CreateSecretInput struct {
  2454. _ struct{} `type:"structure"`
  2455. // (Optional) If you include SecretString or SecretBinary, then an initial version
  2456. // is created as part of the secret, and this parameter specifies a unique identifier
  2457. // for the new version.
  2458. //
  2459. // If you use the AWS CLI or one of the AWS SDK to call this operation, then
  2460. // you can leave this parameter empty. The CLI or SDK generates a random UUID
  2461. // for you and includes it as the value for this parameter in the request. If
  2462. // you don't use the SDK and instead generate a raw HTTP request to the Secrets
  2463. // Manager service endpoint, then you must generate a ClientRequestToken yourself
  2464. // for the new version and include that value in the request.
  2465. //
  2466. // This value helps ensure idempotency. Secrets Manager uses this value to prevent
  2467. // the accidental creation of duplicate versions if there are failures and retries
  2468. // during a rotation. We recommend that you generate a UUID-type (https://wikipedia.org/wiki/Universally_unique_identifier)
  2469. // value to ensure uniqueness of your versions within the specified secret.
  2470. //
  2471. // * If the ClientRequestToken value isn't already associated with a version
  2472. // of the secret then a new version of the secret is created.
  2473. //
  2474. // * If a version with this value already exists and that version's SecretString
  2475. // and SecretBinary values are the same as those in the request, then the
  2476. // request is ignored (the operation is idempotent).
  2477. //
  2478. // * If a version with this value already exists and that version's SecretString
  2479. // and SecretBinary values are different from those in the request then the
  2480. // request fails because you cannot modify an existing version. Instead,
  2481. // use PutSecretValue to create a new version.
  2482. //
  2483. // This value becomes the VersionId of the new version.
  2484. ClientRequestToken *string `min:"32" type:"string" idempotencyToken:"true"`
  2485. // (Optional) Specifies a user-provided description of the secret.
  2486. Description *string `type:"string"`
  2487. // (Optional) Specifies the ARN, Key ID, or alias of the AWS KMS customer master
  2488. // key (CMK) to be used to encrypt the SecretString or SecretBinary values in
  2489. // the versions stored in this secret.
  2490. //
  2491. // You can specify any of the supported ways to identify a AWS KMS key ID. If
  2492. // you need to reference a CMK in a different account, you can use only the
  2493. // key ARN or the alias ARN.
  2494. //
  2495. // If you don't specify this value, then Secrets Manager defaults to using the
  2496. // AWS account's default CMK (the one named aws/secretsmanager). If a AWS KMS
  2497. // CMK with that name doesn't yet exist, then Secrets Manager creates it for
  2498. // you automatically the first time it needs to encrypt a version's SecretString
  2499. // or SecretBinary fields.
  2500. //
  2501. // You can use the account's default CMK to encrypt and decrypt only if you
  2502. // call this operation using credentials from the same account that owns the
  2503. // secret. If the secret is in a different account, then you must create a custom
  2504. // CMK and specify the ARN in this field.
  2505. KmsKeyId *string `type:"string"`
  2506. // Specifies the friendly name of the new secret.
  2507. //
  2508. // The secret name must be ASCII letters, digits, or the following characters
  2509. // : /_+=.@-
  2510. //
  2511. // Don't end your secret name with a hyphen followed by six characters. If you
  2512. // do so, you risk confusion and unexpected results when searching for a secret
  2513. // by partial ARN. This is because Secrets Manager automatically adds a hyphen
  2514. // and six random characters at the end of the ARN.
  2515. //
  2516. // Name is a required field
  2517. Name *string `min:"1" type:"string" required:"true"`
  2518. // (Optional) Specifies binary data that you want to encrypt and store in the
  2519. // new version of the secret. To use this parameter in the command-line tools,
  2520. // we recommend that you store your binary data in a file and then use the appropriate
  2521. // technique for your tool to pass the contents of the file as a parameter.
  2522. //
  2523. // Either SecretString or SecretBinary must have a value, but not both. They
  2524. // cannot both be empty.
  2525. //
  2526. // This parameter is not available using the Secrets Manager console. It can
  2527. // be accessed only by using the AWS CLI or one of the AWS SDKs.
  2528. //
  2529. // SecretBinary is automatically base64 encoded/decoded by the SDK.
  2530. SecretBinary []byte `type:"blob" sensitive:"true"`
  2531. // (Optional) Specifies text data that you want to encrypt and store in this
  2532. // new version of the secret.
  2533. //
  2534. // Either SecretString or SecretBinary must have a value, but not both. They
  2535. // cannot both be empty.
  2536. //
  2537. // If you create a secret by using the Secrets Manager console then Secrets
  2538. // Manager puts the protected secret text in only the SecretString parameter.
  2539. // The Secrets Manager console stores the information as a JSON structure of
  2540. // key/value pairs that the Lambda rotation function knows how to parse.
  2541. //
  2542. // For storing multiple values, we recommend that you use a JSON text string
  2543. // argument and specify key/value pairs. For information on how to format a
  2544. // JSON parameter for the various command line tool environments, see Using
  2545. // JSON for Parameters (http://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json)
  2546. // in the AWS CLI User Guide. For example:
  2547. //
  2548. // [{"username":"bob"},{"password":"abc123xyz456"}]
  2549. //
  2550. // If your command-line tool or SDK requires quotation marks around the parameter,
  2551. // you should use single quotes to avoid confusion with the double quotes required
  2552. // in the JSON text.
  2553. SecretString *string `type:"string" sensitive:"true"`
  2554. // (Optional) Specifies a list of user-defined tags that are attached to the
  2555. // secret. Each tag is a "Key" and "Value" pair of strings. This operation only
  2556. // appends tags to the existing list of tags. To remove tags, you must use UntagResource.
  2557. //
  2558. // Secrets Manager tag key names are case sensitive. A tag with the key "ABC"
  2559. // is a different tag from one with key "abc".
  2560. //
  2561. // If you check tags in IAM policy Condition elements as part of your security
  2562. // strategy, then adding or removing a tag can change permissions. If the successful
  2563. // completion of this operation would result in you losing your permissions
  2564. // for this secret, then this operation is blocked and returns an Access Denied
  2565. // error.
  2566. //
  2567. // This parameter requires a JSON text string argument. For information on how
  2568. // to format a JSON parameter for the various command line tool environments,
  2569. // see Using JSON for Parameters (http://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json)
  2570. // in the AWS CLI User Guide. For example:
  2571. //
  2572. // [{"Key":"CostCenter","Value":"12345"},{"Key":"environment","Value":"production"}]
  2573. //
  2574. // If your command-line tool or SDK requires quotation marks around the parameter,
  2575. // you should use single quotes to avoid confusion with the double quotes required
  2576. // in the JSON text.
  2577. //
  2578. // The following basic restrictions apply to tags:
  2579. //
  2580. // * Maximum number of tags per secret—50
  2581. //
  2582. // * Maximum key length—127 Unicode characters in UTF-8
  2583. //
  2584. // * Maximum value length—255 Unicode characters in UTF-8
  2585. //
  2586. // * Tag keys and values are case sensitive.
  2587. //
  2588. // * Do not use the aws: prefix in your tag names or values because it is
  2589. // reserved for AWS use. You can't edit or delete tag names or values with
  2590. // this prefix. Tags with this prefix do not count against your tags per
  2591. // secret limit.
  2592. //
  2593. // * If your tagging schema will be used across multiple services and resources,
  2594. // remember that other services might have restrictions on allowed characters.
  2595. // Generally allowed characters are: letters, spaces, and numbers representable
  2596. // in UTF-8, plus the following special characters: + - = . _ : / @.
  2597. Tags []*Tag `type:"list"`
  2598. }
  2599. // String returns the string representation
  2600. func (s CreateSecretInput) String() string {
  2601. return awsutil.Prettify(s)
  2602. }
  2603. // GoString returns the string representation
  2604. func (s CreateSecretInput) GoString() string {
  2605. return s.String()
  2606. }
  2607. // Validate inspects the fields of the type to determine if they are valid.
  2608. func (s *CreateSecretInput) Validate() error {
  2609. invalidParams := request.ErrInvalidParams{Context: "CreateSecretInput"}
  2610. if s.ClientRequestToken != nil && len(*s.ClientRequestToken) < 32 {
  2611. invalidParams.Add(request.NewErrParamMinLen("ClientRequestToken", 32))
  2612. }
  2613. if s.Name == nil {
  2614. invalidParams.Add(request.NewErrParamRequired("Name"))
  2615. }
  2616. if s.Name != nil && len(*s.Name) < 1 {
  2617. invalidParams.Add(request.NewErrParamMinLen("Name", 1))
  2618. }
  2619. if s.Tags != nil {
  2620. for i, v := range s.Tags {
  2621. if v == nil {
  2622. continue
  2623. }
  2624. if err := v.Validate(); err != nil {
  2625. invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams))
  2626. }
  2627. }
  2628. }
  2629. if invalidParams.Len() > 0 {
  2630. return invalidParams
  2631. }
  2632. return nil
  2633. }
  2634. // SetClientRequestToken sets the ClientRequestToken field's value.
  2635. func (s *CreateSecretInput) SetClientRequestToken(v string) *CreateSecretInput {
  2636. s.ClientRequestToken = &v
  2637. return s
  2638. }
  2639. // SetDescription sets the Description field's value.
  2640. func (s *CreateSecretInput) SetDescription(v string) *CreateSecretInput {
  2641. s.Description = &v
  2642. return s
  2643. }
  2644. // SetKmsKeyId sets the KmsKeyId field's value.
  2645. func (s *CreateSecretInput) SetKmsKeyId(v string) *CreateSecretInput {
  2646. s.KmsKeyId = &v
  2647. return s
  2648. }
  2649. // SetName sets the Name field's value.
  2650. func (s *CreateSecretInput) SetName(v string) *CreateSecretInput {
  2651. s.Name = &v
  2652. return s
  2653. }
  2654. // SetSecretBinary sets the SecretBinary field's value.
  2655. func (s *CreateSecretInput) SetSecretBinary(v []byte) *CreateSecretInput {
  2656. s.SecretBinary = v
  2657. return s
  2658. }
  2659. // SetSecretString sets the SecretString field's value.
  2660. func (s *CreateSecretInput) SetSecretString(v string) *CreateSecretInput {
  2661. s.SecretString = &v
  2662. return s
  2663. }
  2664. // SetTags sets the Tags field's value.
  2665. func (s *CreateSecretInput) SetTags(v []*Tag) *CreateSecretInput {
  2666. s.Tags = v
  2667. return s
  2668. }
  2669. type CreateSecretOutput struct {
  2670. _ struct{} `type:"structure"`
  2671. // The Amazon Resource Name (ARN) of the secret that you just created.
  2672. //
  2673. // Secrets Manager automatically adds several random characters to the name
  2674. // at the end of the ARN when you initially create a secret. This affects only
  2675. // the ARN and not the actual friendly name. This ensures that if you create
  2676. // a new secret with the same name as an old secret that you previously deleted,
  2677. // then users with access to the old secret don't automatically get access to
  2678. // the new secret because the ARNs are different.
  2679. ARN *string `min:"20" type:"string"`
  2680. // The friendly name of the secret that you just created.
  2681. Name *string `min:"1" type:"string"`
  2682. // The unique identifier that's associated with the version of the secret you
  2683. // just created.
  2684. VersionId *string `min:"32" type:"string"`
  2685. }
  2686. // String returns the string representation
  2687. func (s CreateSecretOutput) String() string {
  2688. return awsutil.Prettify(s)
  2689. }
  2690. // GoString returns the string representation
  2691. func (s CreateSecretOutput) GoString() string {
  2692. return s.String()
  2693. }
  2694. // SetARN sets the ARN field's value.
  2695. func (s *CreateSecretOutput) SetARN(v string) *CreateSecretOutput {
  2696. s.ARN = &v
  2697. return s
  2698. }
  2699. // SetName sets the Name field's value.
  2700. func (s *CreateSecretOutput) SetName(v string) *CreateSecretOutput {
  2701. s.Name = &v
  2702. return s
  2703. }
  2704. // SetVersionId sets the VersionId field's value.
  2705. func (s *CreateSecretOutput) SetVersionId(v string) *CreateSecretOutput {
  2706. s.VersionId = &v
  2707. return s
  2708. }
  2709. type DeleteResourcePolicyInput struct {
  2710. _ struct{} `type:"structure"`
  2711. // Specifies the secret that you want to delete the attached resource-based
  2712. // policy for. You can specify either the Amazon Resource Name (ARN) or the
  2713. // friendly name of the secret.
  2714. //
  2715. // If you specify an ARN, we generally recommend that you specify a complete
  2716. // ARN. You can specify a partial ARN too—for example, if you don’t include
  2717. // the final hyphen and six random characters that Secrets Manager adds at the
  2718. // end of the ARN when you created the secret. A partial ARN match can work
  2719. // as long as it uniquely matches only one secret. However, if your secret has
  2720. // a name that ends in a hyphen followed by six characters (before Secrets Manager
  2721. // adds the hyphen and six characters to the ARN) and you try to use that as
  2722. // a partial ARN, then those characters cause Secrets Manager to assume that
  2723. // you’re specifying a complete ARN. This confusion can cause unexpected results.
  2724. // To avoid this situation, we recommend that you don’t create secret names
  2725. // that end with a hyphen followed by six characters.
  2726. //
  2727. // SecretId is a required field
  2728. SecretId *string `min:"1" type:"string" required:"true"`
  2729. }
  2730. // String returns the string representation
  2731. func (s DeleteResourcePolicyInput) String() string {
  2732. return awsutil.Prettify(s)
  2733. }
  2734. // GoString returns the string representation
  2735. func (s DeleteResourcePolicyInput) GoString() string {
  2736. return s.String()
  2737. }
  2738. // Validate inspects the fields of the type to determine if they are valid.
  2739. func (s *DeleteResourcePolicyInput) Validate() error {
  2740. invalidParams := request.ErrInvalidParams{Context: "DeleteResourcePolicyInput"}
  2741. if s.SecretId == nil {
  2742. invalidParams.Add(request.NewErrParamRequired("SecretId"))
  2743. }
  2744. if s.SecretId != nil && len(*s.SecretId) < 1 {
  2745. invalidParams.Add(request.NewErrParamMinLen("SecretId", 1))
  2746. }
  2747. if invalidParams.Len() > 0 {
  2748. return invalidParams
  2749. }
  2750. return nil
  2751. }
  2752. // SetSecretId sets the SecretId field's value.
  2753. func (s *DeleteResourcePolicyInput) SetSecretId(v string) *DeleteResourcePolicyInput {
  2754. s.SecretId = &v
  2755. return s
  2756. }
  2757. type DeleteResourcePolicyOutput struct {
  2758. _ struct{} `type:"structure"`
  2759. // The ARN of the secret that the resource-based policy was deleted for.
  2760. ARN *string `min:"20" type:"string"`
  2761. // The friendly name of the secret that the resource-based policy was deleted
  2762. // for.
  2763. Name *string `min:"1" type:"string"`
  2764. }
  2765. // String returns the string representation
  2766. func (s DeleteResourcePolicyOutput) String() string {
  2767. return awsutil.Prettify(s)
  2768. }
  2769. // GoString returns the string representation
  2770. func (s DeleteResourcePolicyOutput) GoString() string {
  2771. return s.String()
  2772. }
  2773. // SetARN sets the ARN field's value.
  2774. func (s *DeleteResourcePolicyOutput) SetARN(v string) *DeleteResourcePolicyOutput {
  2775. s.ARN = &v
  2776. return s
  2777. }
  2778. // SetName sets the Name field's value.
  2779. func (s *DeleteResourcePolicyOutput) SetName(v string) *DeleteResourcePolicyOutput {
  2780. s.Name = &v
  2781. return s
  2782. }
  2783. type DeleteSecretInput struct {
  2784. _ struct{} `type:"structure"`
  2785. // (Optional) Specifies that the secret is to be deleted without any recovery
  2786. // window. You can't use both this parameter and the RecoveryWindowInDays parameter
  2787. // in the same API call.
  2788. //
  2789. // An asynchronous background process performs the actual deletion, so there
  2790. // can be a short delay before the operation completes. If you write code to
  2791. // delete and then immediately recreate a secret with the same name, ensure
  2792. // that your code includes appropriate back off and retry logic.
  2793. //
  2794. // Use this parameter with caution. This parameter causes the operation to skip
  2795. // the normal waiting period before the permanent deletion that AWS would normally
  2796. // impose with the RecoveryWindowInDays parameter. If you delete a secret with
  2797. // the ForceDeleteWithouRecovery parameter, then you have no opportunity to
  2798. // recover the secret. It is permanently lost.
  2799. ForceDeleteWithoutRecovery *bool `type:"boolean"`
  2800. // (Optional) Specifies the number of days that Secrets Manager waits before
  2801. // it can delete the secret. You can't use both this parameter and the ForceDeleteWithoutRecovery
  2802. // parameter in the same API call.
  2803. //
  2804. // This value can range from 7 to 30 days. The default value is 30.
  2805. RecoveryWindowInDays *int64 `type:"long"`
  2806. // Specifies the secret that you want to delete. You can specify either the
  2807. // Amazon Resource Name (ARN) or the friendly name of the secret.
  2808. //
  2809. // If you specify an ARN, we generally recommend that you specify a complete
  2810. // ARN. You can specify a partial ARN too—for example, if you don’t include
  2811. // the final hyphen and six random characters that Secrets Manager adds at the
  2812. // end of the ARN when you created the secret. A partial ARN match can work
  2813. // as long as it uniquely matches only one secret. However, if your secret has
  2814. // a name that ends in a hyphen followed by six characters (before Secrets Manager
  2815. // adds the hyphen and six characters to the ARN) and you try to use that as
  2816. // a partial ARN, then those characters cause Secrets Manager to assume that
  2817. // you’re specifying a complete ARN. This confusion can cause unexpected results.
  2818. // To avoid this situation, we recommend that you don’t create secret names
  2819. // that end with a hyphen followed by six characters.
  2820. //
  2821. // SecretId is a required field
  2822. SecretId *string `min:"1" type:"string" required:"true"`
  2823. }
  2824. // String returns the string representation
  2825. func (s DeleteSecretInput) String() string {
  2826. return awsutil.Prettify(s)
  2827. }
  2828. // GoString returns the string representation
  2829. func (s DeleteSecretInput) GoString() string {
  2830. return s.String()
  2831. }
  2832. // Validate inspects the fields of the type to determine if they are valid.
  2833. func (s *DeleteSecretInput) Validate() error {
  2834. invalidParams := request.ErrInvalidParams{Context: "DeleteSecretInput"}
  2835. if s.SecretId == nil {
  2836. invalidParams.Add(request.NewErrParamRequired("SecretId"))
  2837. }
  2838. if s.SecretId != nil && len(*s.SecretId) < 1 {
  2839. invalidParams.Add(request.NewErrParamMinLen("SecretId", 1))
  2840. }
  2841. if invalidParams.Len() > 0 {
  2842. return invalidParams
  2843. }
  2844. return nil
  2845. }
  2846. // SetForceDeleteWithoutRecovery sets the ForceDeleteWithoutRecovery field's value.
  2847. func (s *DeleteSecretInput) SetForceDeleteWithoutRecovery(v bool) *DeleteSecretInput {
  2848. s.ForceDeleteWithoutRecovery = &v
  2849. return s
  2850. }
  2851. // SetRecoveryWindowInDays sets the RecoveryWindowInDays field's value.
  2852. func (s *DeleteSecretInput) SetRecoveryWindowInDays(v int64) *DeleteSecretInput {
  2853. s.RecoveryWindowInDays = &v
  2854. return s
  2855. }
  2856. // SetSecretId sets the SecretId field's value.
  2857. func (s *DeleteSecretInput) SetSecretId(v string) *DeleteSecretInput {
  2858. s.SecretId = &v
  2859. return s
  2860. }
  2861. type DeleteSecretOutput struct {
  2862. _ struct{} `type:"structure"`
  2863. // The ARN of the secret that is now scheduled for deletion.
  2864. ARN *string `min:"20" type:"string"`
  2865. // The date and time after which this secret can be deleted by Secrets Manager
  2866. // and can no longer be restored. This value is the date and time of the delete
  2867. // request plus the number of days specified in RecoveryWindowInDays.
  2868. DeletionDate *time.Time `type:"timestamp"`
  2869. // The friendly name of the secret that is now scheduled for deletion.
  2870. Name *string `min:"1" type:"string"`
  2871. }
  2872. // String returns the string representation
  2873. func (s DeleteSecretOutput) String() string {
  2874. return awsutil.Prettify(s)
  2875. }
  2876. // GoString returns the string representation
  2877. func (s DeleteSecretOutput) GoString() string {
  2878. return s.String()
  2879. }
  2880. // SetARN sets the ARN field's value.
  2881. func (s *DeleteSecretOutput) SetARN(v string) *DeleteSecretOutput {
  2882. s.ARN = &v
  2883. return s
  2884. }
  2885. // SetDeletionDate sets the DeletionDate field's value.
  2886. func (s *DeleteSecretOutput) SetDeletionDate(v time.Time) *DeleteSecretOutput {
  2887. s.DeletionDate = &v
  2888. return s
  2889. }
  2890. // SetName sets the Name field's value.
  2891. func (s *DeleteSecretOutput) SetName(v string) *DeleteSecretOutput {
  2892. s.Name = &v
  2893. return s
  2894. }
  2895. type DescribeSecretInput struct {
  2896. _ struct{} `type:"structure"`
  2897. // The identifier of the secret whose details you want to retrieve. You can
  2898. // specify either the Amazon Resource Name (ARN) or the friendly name of the
  2899. // secret.
  2900. //
  2901. // If you specify an ARN, we generally recommend that you specify a complete
  2902. // ARN. You can specify a partial ARN too—for example, if you don’t include
  2903. // the final hyphen and six random characters that Secrets Manager adds at the
  2904. // end of the ARN when you created the secret. A partial ARN match can work
  2905. // as long as it uniquely matches only one secret. However, if your secret has
  2906. // a name that ends in a hyphen followed by six characters (before Secrets Manager
  2907. // adds the hyphen and six characters to the ARN) and you try to use that as
  2908. // a partial ARN, then those characters cause Secrets Manager to assume that
  2909. // you’re specifying a complete ARN. This confusion can cause unexpected results.
  2910. // To avoid this situation, we recommend that you don’t create secret names
  2911. // that end with a hyphen followed by six characters.
  2912. //
  2913. // SecretId is a required field
  2914. SecretId *string `min:"1" type:"string" required:"true"`
  2915. }
  2916. // String returns the string representation
  2917. func (s DescribeSecretInput) String() string {
  2918. return awsutil.Prettify(s)
  2919. }
  2920. // GoString returns the string representation
  2921. func (s DescribeSecretInput) GoString() string {
  2922. return s.String()
  2923. }
  2924. // Validate inspects the fields of the type to determine if they are valid.
  2925. func (s *DescribeSecretInput) Validate() error {
  2926. invalidParams := request.ErrInvalidParams{Context: "DescribeSecretInput"}
  2927. if s.SecretId == nil {
  2928. invalidParams.Add(request.NewErrParamRequired("SecretId"))
  2929. }
  2930. if s.SecretId != nil && len(*s.SecretId) < 1 {
  2931. invalidParams.Add(request.NewErrParamMinLen("SecretId", 1))
  2932. }
  2933. if invalidParams.Len() > 0 {
  2934. return invalidParams
  2935. }
  2936. return nil
  2937. }
  2938. // SetSecretId sets the SecretId field's value.
  2939. func (s *DescribeSecretInput) SetSecretId(v string) *DescribeSecretInput {
  2940. s.SecretId = &v
  2941. return s
  2942. }
  2943. type DescribeSecretOutput struct {
  2944. _ struct{} `type:"structure"`
  2945. // The ARN of the secret.
  2946. ARN *string `min:"20" type:"string"`
  2947. // This value exists if the secret is scheduled for deletion. Some time after
  2948. // the specified date and time, Secrets Manager deletes the secret and all of
  2949. // its versions.
  2950. //
  2951. // If a secret is scheduled for deletion, then its details, including the encrypted
  2952. // secret information, is not accessible. To cancel a scheduled deletion and
  2953. // restore access, use RestoreSecret.
  2954. DeletedDate *time.Time `type:"timestamp"`
  2955. // The user-provided description of the secret.
  2956. Description *string `type:"string"`
  2957. // The ARN or alias of the AWS KMS customer master key (CMK) that's used to
  2958. // encrypt the SecretString or SecretBinary fields in each version of the secret.
  2959. // If you don't provide a key, then Secrets Manager defaults to encrypting the
  2960. // secret fields with the default AWS KMS CMK (the one named awssecretsmanager)
  2961. // for this account.
  2962. KmsKeyId *string `type:"string"`
  2963. // The last date that this secret was accessed. This value is truncated to midnight
  2964. // of the date and therefore shows only the date, not the time.
  2965. LastAccessedDate *time.Time `type:"timestamp"`
  2966. // The last date and time that this secret was modified in any way.
  2967. LastChangedDate *time.Time `type:"timestamp"`
  2968. // The most recent date and time that the Secrets Manager rotation process was
  2969. // successfully completed. This value is null if the secret has never rotated.
  2970. LastRotatedDate *time.Time `type:"timestamp"`
  2971. // The user-provided friendly name of the secret.
  2972. Name *string `min:"1" type:"string"`
  2973. // Specifies whether automatic rotation is enabled for this secret.
  2974. //
  2975. // To enable rotation, use RotateSecret with AutomaticallyRotateAfterDays set
  2976. // to a value greater than 0. To disable rotation, use CancelRotateSecret.
  2977. RotationEnabled *bool `type:"boolean"`
  2978. // The ARN of a Lambda function that's invoked by Secrets Manager to rotate
  2979. // the secret either automatically per the schedule or manually by a call to
  2980. // RotateSecret.
  2981. RotationLambdaARN *string `type:"string"`
  2982. // A structure that contains the rotation configuration for this secret.
  2983. RotationRules *RotationRulesType `type:"structure"`
  2984. // The list of user-defined tags that are associated with the secret. To add
  2985. // tags to a secret, use TagResource. To remove tags, use UntagResource.
  2986. Tags []*Tag `type:"list"`
  2987. // A list of all of the currently assigned VersionStage staging labels and the
  2988. // VersionId that each is attached to. Staging labels are used to keep track
  2989. // of the different versions during the rotation process.
  2990. //
  2991. // A version that does not have any staging labels attached is considered deprecated
  2992. // and subject to deletion. Such versions are not included in this list.
  2993. VersionIdsToStages map[string][]*string `type:"map"`
  2994. }
  2995. // String returns the string representation
  2996. func (s DescribeSecretOutput) String() string {
  2997. return awsutil.Prettify(s)
  2998. }
  2999. // GoString returns the string representation
  3000. func (s DescribeSecretOutput) GoString() string {
  3001. return s.String()
  3002. }
  3003. // SetARN sets the ARN field's value.
  3004. func (s *DescribeSecretOutput) SetARN(v string) *DescribeSecretOutput {
  3005. s.ARN = &v
  3006. return s
  3007. }
  3008. // SetDeletedDate sets the DeletedDate field's value.
  3009. func (s *DescribeSecretOutput) SetDeletedDate(v time.Time) *DescribeSecretOutput {
  3010. s.DeletedDate = &v
  3011. return s
  3012. }
  3013. // SetDescription sets the Description field's value.
  3014. func (s *DescribeSecretOutput) SetDescription(v string) *DescribeSecretOutput {
  3015. s.Description = &v
  3016. return s
  3017. }
  3018. // SetKmsKeyId sets the KmsKeyId field's value.
  3019. func (s *DescribeSecretOutput) SetKmsKeyId(v string) *DescribeSecretOutput {
  3020. s.KmsKeyId = &v
  3021. return s
  3022. }
  3023. // SetLastAccessedDate sets the LastAccessedDate field's value.
  3024. func (s *DescribeSecretOutput) SetLastAccessedDate(v time.Time) *DescribeSecretOutput {
  3025. s.LastAccessedDate = &v
  3026. return s
  3027. }
  3028. // SetLastChangedDate sets the LastChangedDate field's value.
  3029. func (s *DescribeSecretOutput) SetLastChangedDate(v time.Time) *DescribeSecretOutput {
  3030. s.LastChangedDate = &v
  3031. return s
  3032. }
  3033. // SetLastRotatedDate sets the LastRotatedDate field's value.
  3034. func (s *DescribeSecretOutput) SetLastRotatedDate(v time.Time) *DescribeSecretOutput {
  3035. s.LastRotatedDate = &v
  3036. return s
  3037. }
  3038. // SetName sets the Name field's value.
  3039. func (s *DescribeSecretOutput) SetName(v string) *DescribeSecretOutput {
  3040. s.Name = &v
  3041. return s
  3042. }
  3043. // SetRotationEnabled sets the RotationEnabled field's value.
  3044. func (s *DescribeSecretOutput) SetRotationEnabled(v bool) *DescribeSecretOutput {
  3045. s.RotationEnabled = &v
  3046. return s
  3047. }
  3048. // SetRotationLambdaARN sets the RotationLambdaARN field's value.
  3049. func (s *DescribeSecretOutput) SetRotationLambdaARN(v string) *DescribeSecretOutput {
  3050. s.RotationLambdaARN = &v
  3051. return s
  3052. }
  3053. // SetRotationRules sets the RotationRules field's value.
  3054. func (s *DescribeSecretOutput) SetRotationRules(v *RotationRulesType) *DescribeSecretOutput {
  3055. s.RotationRules = v
  3056. return s
  3057. }
  3058. // SetTags sets the Tags field's value.
  3059. func (s *DescribeSecretOutput) SetTags(v []*Tag) *DescribeSecretOutput {
  3060. s.Tags = v
  3061. return s
  3062. }
  3063. // SetVersionIdsToStages sets the VersionIdsToStages field's value.
  3064. func (s *DescribeSecretOutput) SetVersionIdsToStages(v map[string][]*string) *DescribeSecretOutput {
  3065. s.VersionIdsToStages = v
  3066. return s
  3067. }
  3068. type GetRandomPasswordInput struct {
  3069. _ struct{} `type:"structure"`
  3070. // A string that includes characters that should not be included in the generated
  3071. // password. The default is that all characters from the included sets can be
  3072. // used.
  3073. ExcludeCharacters *string `type:"string"`
  3074. // Specifies that the generated password should not include lowercase letters.
  3075. // The default if you do not include this switch parameter is that lowercase
  3076. // letters can be included.
  3077. ExcludeLowercase *bool `type:"boolean"`
  3078. // Specifies that the generated password should not include digits. The default
  3079. // if you do not include this switch parameter is that digits can be included.
  3080. ExcludeNumbers *bool `type:"boolean"`
  3081. // Specifies that the generated password should not include punctuation characters.
  3082. // The default if you do not include this switch parameter is that punctuation
  3083. // characters can be included.
  3084. //
  3085. // The following are the punctuation characters that can be included in the
  3086. // generated password if you don't explicitly exclude them with ExcludeCharacters
  3087. // or ExcludePunctuation:
  3088. //
  3089. // ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~
  3090. ExcludePunctuation *bool `type:"boolean"`
  3091. // Specifies that the generated password should not include uppercase letters.
  3092. // The default if you do not include this switch parameter is that uppercase
  3093. // letters can be included.
  3094. ExcludeUppercase *bool `type:"boolean"`
  3095. // Specifies that the generated password can include the space character. The
  3096. // default if you do not include this switch parameter is that the space character
  3097. // is not included.
  3098. IncludeSpace *bool `type:"boolean"`
  3099. // The desired length of the generated password. The default value if you do
  3100. // not include this parameter is 32 characters.
  3101. PasswordLength *int64 `min:"1" type:"long"`
  3102. // A boolean value that specifies whether the generated password must include
  3103. // at least one of every allowed character type. The default value is True and
  3104. // the operation requires at least one of every character type.
  3105. RequireEachIncludedType *bool `type:"boolean"`
  3106. }
  3107. // String returns the string representation
  3108. func (s GetRandomPasswordInput) String() string {
  3109. return awsutil.Prettify(s)
  3110. }
  3111. // GoString returns the string representation
  3112. func (s GetRandomPasswordInput) GoString() string {
  3113. return s.String()
  3114. }
  3115. // Validate inspects the fields of the type to determine if they are valid.
  3116. func (s *GetRandomPasswordInput) Validate() error {
  3117. invalidParams := request.ErrInvalidParams{Context: "GetRandomPasswordInput"}
  3118. if s.PasswordLength != nil && *s.PasswordLength < 1 {
  3119. invalidParams.Add(request.NewErrParamMinValue("PasswordLength", 1))
  3120. }
  3121. if invalidParams.Len() > 0 {
  3122. return invalidParams
  3123. }
  3124. return nil
  3125. }
  3126. // SetExcludeCharacters sets the ExcludeCharacters field's value.
  3127. func (s *GetRandomPasswordInput) SetExcludeCharacters(v string) *GetRandomPasswordInput {
  3128. s.ExcludeCharacters = &v
  3129. return s
  3130. }
  3131. // SetExcludeLowercase sets the ExcludeLowercase field's value.
  3132. func (s *GetRandomPasswordInput) SetExcludeLowercase(v bool) *GetRandomPasswordInput {
  3133. s.ExcludeLowercase = &v
  3134. return s
  3135. }
  3136. // SetExcludeNumbers sets the ExcludeNumbers field's value.
  3137. func (s *GetRandomPasswordInput) SetExcludeNumbers(v bool) *GetRandomPasswordInput {
  3138. s.ExcludeNumbers = &v
  3139. return s
  3140. }
  3141. // SetExcludePunctuation sets the ExcludePunctuation field's value.
  3142. func (s *GetRandomPasswordInput) SetExcludePunctuation(v bool) *GetRandomPasswordInput {
  3143. s.ExcludePunctuation = &v
  3144. return s
  3145. }
  3146. // SetExcludeUppercase sets the ExcludeUppercase field's value.
  3147. func (s *GetRandomPasswordInput) SetExcludeUppercase(v bool) *GetRandomPasswordInput {
  3148. s.ExcludeUppercase = &v
  3149. return s
  3150. }
  3151. // SetIncludeSpace sets the IncludeSpace field's value.
  3152. func (s *GetRandomPasswordInput) SetIncludeSpace(v bool) *GetRandomPasswordInput {
  3153. s.IncludeSpace = &v
  3154. return s
  3155. }
  3156. // SetPasswordLength sets the PasswordLength field's value.
  3157. func (s *GetRandomPasswordInput) SetPasswordLength(v int64) *GetRandomPasswordInput {
  3158. s.PasswordLength = &v
  3159. return s
  3160. }
  3161. // SetRequireEachIncludedType sets the RequireEachIncludedType field's value.
  3162. func (s *GetRandomPasswordInput) SetRequireEachIncludedType(v bool) *GetRandomPasswordInput {
  3163. s.RequireEachIncludedType = &v
  3164. return s
  3165. }
  3166. type GetRandomPasswordOutput struct {
  3167. _ struct{} `type:"structure"`
  3168. // A string with the generated password.
  3169. RandomPassword *string `type:"string"`
  3170. }
  3171. // String returns the string representation
  3172. func (s GetRandomPasswordOutput) String() string {
  3173. return awsutil.Prettify(s)
  3174. }
  3175. // GoString returns the string representation
  3176. func (s GetRandomPasswordOutput) GoString() string {
  3177. return s.String()
  3178. }
  3179. // SetRandomPassword sets the RandomPassword field's value.
  3180. func (s *GetRandomPasswordOutput) SetRandomPassword(v string) *GetRandomPasswordOutput {
  3181. s.RandomPassword = &v
  3182. return s
  3183. }
  3184. type GetResourcePolicyInput struct {
  3185. _ struct{} `type:"structure"`
  3186. // Specifies the secret that you want to retrieve the attached resource-based
  3187. // policy for. You can specify either the Amazon Resource Name (ARN) or the
  3188. // friendly name of the secret.
  3189. //
  3190. // If you specify an ARN, we generally recommend that you specify a complete
  3191. // ARN. You can specify a partial ARN too—for example, if you don’t include
  3192. // the final hyphen and six random characters that Secrets Manager adds at the
  3193. // end of the ARN when you created the secret. A partial ARN match can work
  3194. // as long as it uniquely matches only one secret. However, if your secret has
  3195. // a name that ends in a hyphen followed by six characters (before Secrets Manager
  3196. // adds the hyphen and six characters to the ARN) and you try to use that as
  3197. // a partial ARN, then those characters cause Secrets Manager to assume that
  3198. // you’re specifying a complete ARN. This confusion can cause unexpected results.
  3199. // To avoid this situation, we recommend that you don’t create secret names
  3200. // that end with a hyphen followed by six characters.
  3201. //
  3202. // SecretId is a required field
  3203. SecretId *string `min:"1" type:"string" required:"true"`
  3204. }
  3205. // String returns the string representation
  3206. func (s GetResourcePolicyInput) String() string {
  3207. return awsutil.Prettify(s)
  3208. }
  3209. // GoString returns the string representation
  3210. func (s GetResourcePolicyInput) GoString() string {
  3211. return s.String()
  3212. }
  3213. // Validate inspects the fields of the type to determine if they are valid.
  3214. func (s *GetResourcePolicyInput) Validate() error {
  3215. invalidParams := request.ErrInvalidParams{Context: "GetResourcePolicyInput"}
  3216. if s.SecretId == nil {
  3217. invalidParams.Add(request.NewErrParamRequired("SecretId"))
  3218. }
  3219. if s.SecretId != nil && len(*s.SecretId) < 1 {
  3220. invalidParams.Add(request.NewErrParamMinLen("SecretId", 1))
  3221. }
  3222. if invalidParams.Len() > 0 {
  3223. return invalidParams
  3224. }
  3225. return nil
  3226. }
  3227. // SetSecretId sets the SecretId field's value.
  3228. func (s *GetResourcePolicyInput) SetSecretId(v string) *GetResourcePolicyInput {
  3229. s.SecretId = &v
  3230. return s
  3231. }
  3232. type GetResourcePolicyOutput struct {
  3233. _ struct{} `type:"structure"`
  3234. // The ARN of the secret that the resource-based policy was retrieved for.
  3235. ARN *string `min:"20" type:"string"`
  3236. // The friendly name of the secret that the resource-based policy was retrieved
  3237. // for.
  3238. Name *string `min:"1" type:"string"`
  3239. // A JSON-formatted string that describes the permissions that are associated
  3240. // with the attached secret. These permissions are combined with any permissions
  3241. // that are associated with the user or role that attempts to access this secret.
  3242. // The combined permissions specify who can access the secret and what actions
  3243. // they can perform. For more information, see Authentication and Access Control
  3244. // for AWS Secrets Manager (http://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access.html)
  3245. // in the AWS Secrets Manager User Guide.
  3246. ResourcePolicy *string `min:"1" type:"string"`
  3247. }
  3248. // String returns the string representation
  3249. func (s GetResourcePolicyOutput) String() string {
  3250. return awsutil.Prettify(s)
  3251. }
  3252. // GoString returns the string representation
  3253. func (s GetResourcePolicyOutput) GoString() string {
  3254. return s.String()
  3255. }
  3256. // SetARN sets the ARN field's value.
  3257. func (s *GetResourcePolicyOutput) SetARN(v string) *GetResourcePolicyOutput {
  3258. s.ARN = &v
  3259. return s
  3260. }
  3261. // SetName sets the Name field's value.
  3262. func (s *GetResourcePolicyOutput) SetName(v string) *GetResourcePolicyOutput {
  3263. s.Name = &v
  3264. return s
  3265. }
  3266. // SetResourcePolicy sets the ResourcePolicy field's value.
  3267. func (s *GetResourcePolicyOutput) SetResourcePolicy(v string) *GetResourcePolicyOutput {
  3268. s.ResourcePolicy = &v
  3269. return s
  3270. }
  3271. type GetSecretValueInput struct {
  3272. _ struct{} `type:"structure"`
  3273. // Specifies the secret containing the version that you want to retrieve. You
  3274. // can specify either the Amazon Resource Name (ARN) or the friendly name of
  3275. // the secret.
  3276. //
  3277. // If you specify an ARN, we generally recommend that you specify a complete
  3278. // ARN. You can specify a partial ARN too—for example, if you don’t include
  3279. // the final hyphen and six random characters that Secrets Manager adds at the
  3280. // end of the ARN when you created the secret. A partial ARN match can work
  3281. // as long as it uniquely matches only one secret. However, if your secret has
  3282. // a name that ends in a hyphen followed by six characters (before Secrets Manager
  3283. // adds the hyphen and six characters to the ARN) and you try to use that as
  3284. // a partial ARN, then those characters cause Secrets Manager to assume that
  3285. // you’re specifying a complete ARN. This confusion can cause unexpected results.
  3286. // To avoid this situation, we recommend that you don’t create secret names
  3287. // that end with a hyphen followed by six characters.
  3288. //
  3289. // SecretId is a required field
  3290. SecretId *string `min:"1" type:"string" required:"true"`
  3291. // Specifies the unique identifier of the version of the secret that you want
  3292. // to retrieve. If you specify this parameter then don't specify VersionStage.
  3293. // If you don't specify either a VersionStage or VersionId then the default
  3294. // is to perform the operation on the version with the VersionStage value of
  3295. // AWSCURRENT.
  3296. //
  3297. // This value is typically a UUID-type (https://wikipedia.org/wiki/Universally_unique_identifier)
  3298. // value with 32 hexadecimal digits.
  3299. VersionId *string `min:"32" type:"string"`
  3300. // Specifies the secret version that you want to retrieve by the staging label
  3301. // attached to the version.
  3302. //
  3303. // Staging labels are used to keep track of different versions during the rotation
  3304. // process. If you use this parameter then don't specify VersionId. If you don't
  3305. // specify either a VersionStage or VersionId, then the default is to perform
  3306. // the operation on the version with the VersionStage value of AWSCURRENT.
  3307. VersionStage *string `min:"1" type:"string"`
  3308. }
  3309. // String returns the string representation
  3310. func (s GetSecretValueInput) String() string {
  3311. return awsutil.Prettify(s)
  3312. }
  3313. // GoString returns the string representation
  3314. func (s GetSecretValueInput) GoString() string {
  3315. return s.String()
  3316. }
  3317. // Validate inspects the fields of the type to determine if they are valid.
  3318. func (s *GetSecretValueInput) Validate() error {
  3319. invalidParams := request.ErrInvalidParams{Context: "GetSecretValueInput"}
  3320. if s.SecretId == nil {
  3321. invalidParams.Add(request.NewErrParamRequired("SecretId"))
  3322. }
  3323. if s.SecretId != nil && len(*s.SecretId) < 1 {
  3324. invalidParams.Add(request.NewErrParamMinLen("SecretId", 1))
  3325. }
  3326. if s.VersionId != nil && len(*s.VersionId) < 32 {
  3327. invalidParams.Add(request.NewErrParamMinLen("VersionId", 32))
  3328. }
  3329. if s.VersionStage != nil && len(*s.VersionStage) < 1 {
  3330. invalidParams.Add(request.NewErrParamMinLen("VersionStage", 1))
  3331. }
  3332. if invalidParams.Len() > 0 {
  3333. return invalidParams
  3334. }
  3335. return nil
  3336. }
  3337. // SetSecretId sets the SecretId field's value.
  3338. func (s *GetSecretValueInput) SetSecretId(v string) *GetSecretValueInput {
  3339. s.SecretId = &v
  3340. return s
  3341. }
  3342. // SetVersionId sets the VersionId field's value.
  3343. func (s *GetSecretValueInput) SetVersionId(v string) *GetSecretValueInput {
  3344. s.VersionId = &v
  3345. return s
  3346. }
  3347. // SetVersionStage sets the VersionStage field's value.
  3348. func (s *GetSecretValueInput) SetVersionStage(v string) *GetSecretValueInput {
  3349. s.VersionStage = &v
  3350. return s
  3351. }
  3352. type GetSecretValueOutput struct {
  3353. _ struct{} `type:"structure"`
  3354. // The ARN of the secret.
  3355. ARN *string `min:"20" type:"string"`
  3356. // The date and time that this version of the secret was created.
  3357. CreatedDate *time.Time `type:"timestamp"`
  3358. // The friendly name of the secret.
  3359. Name *string `min:"1" type:"string"`
  3360. // The decrypted part of the protected secret information that was originally
  3361. // provided as binary data in the form of a byte array. The response parameter
  3362. // represents the binary data as a base64-encoded (https://tools.ietf.org/html/rfc4648#section-4)
  3363. // string.
  3364. //
  3365. // This parameter is not used if the secret is created by the Secrets Manager
  3366. // console.
  3367. //
  3368. // If you store custom information in this field of the secret, then you must
  3369. // code your Lambda rotation function to parse and interpret whatever you store
  3370. // in the SecretString or SecretBinary fields.
  3371. //
  3372. // SecretBinary is automatically base64 encoded/decoded by the SDK.
  3373. SecretBinary []byte `type:"blob" sensitive:"true"`
  3374. // The decrypted part of the protected secret information that was originally
  3375. // provided as a string.
  3376. //
  3377. // If you create this secret by using the Secrets Manager console then only
  3378. // the SecretString parameter contains data. Secrets Manager stores the information
  3379. // as a JSON structure of key/value pairs that the Lambda rotation function
  3380. // knows how to parse.
  3381. //
  3382. // If you store custom information in the secret by using the CreateSecret,
  3383. // UpdateSecret, or PutSecretValue API operations instead of the Secrets Manager
  3384. // console, or by using the Other secret type in the console, then you must
  3385. // code your Lambda rotation function to parse and interpret those values.
  3386. SecretString *string `type:"string" sensitive:"true"`
  3387. // The unique identifier of this version of the secret.
  3388. VersionId *string `min:"32" type:"string"`
  3389. // A list of all of the staging labels currently attached to this version of
  3390. // the secret.
  3391. VersionStages []*string `min:"1" type:"list"`
  3392. }
  3393. // String returns the string representation
  3394. func (s GetSecretValueOutput) String() string {
  3395. return awsutil.Prettify(s)
  3396. }
  3397. // GoString returns the string representation
  3398. func (s GetSecretValueOutput) GoString() string {
  3399. return s.String()
  3400. }
  3401. // SetARN sets the ARN field's value.
  3402. func (s *GetSecretValueOutput) SetARN(v string) *GetSecretValueOutput {
  3403. s.ARN = &v
  3404. return s
  3405. }
  3406. // SetCreatedDate sets the CreatedDate field's value.
  3407. func (s *GetSecretValueOutput) SetCreatedDate(v time.Time) *GetSecretValueOutput {
  3408. s.CreatedDate = &v
  3409. return s
  3410. }
  3411. // SetName sets the Name field's value.
  3412. func (s *GetSecretValueOutput) SetName(v string) *GetSecretValueOutput {
  3413. s.Name = &v
  3414. return s
  3415. }
  3416. // SetSecretBinary sets the SecretBinary field's value.
  3417. func (s *GetSecretValueOutput) SetSecretBinary(v []byte) *GetSecretValueOutput {
  3418. s.SecretBinary = v
  3419. return s
  3420. }
  3421. // SetSecretString sets the SecretString field's value.
  3422. func (s *GetSecretValueOutput) SetSecretString(v string) *GetSecretValueOutput {
  3423. s.SecretString = &v
  3424. return s
  3425. }
  3426. // SetVersionId sets the VersionId field's value.
  3427. func (s *GetSecretValueOutput) SetVersionId(v string) *GetSecretValueOutput {
  3428. s.VersionId = &v
  3429. return s
  3430. }
  3431. // SetVersionStages sets the VersionStages field's value.
  3432. func (s *GetSecretValueOutput) SetVersionStages(v []*string) *GetSecretValueOutput {
  3433. s.VersionStages = v
  3434. return s
  3435. }
  3436. type ListSecretVersionIdsInput struct {
  3437. _ struct{} `type:"structure"`
  3438. // (Optional) Specifies that you want the results to include versions that do
  3439. // not have any staging labels attached to them. Such versions are considered
  3440. // deprecated and are subject to deletion by Secrets Manager as needed.
  3441. IncludeDeprecated *bool `type:"boolean"`
  3442. // (Optional) Limits the number of results that you want to include in the response.
  3443. // If you don't include this parameter, it defaults to a value that's specific
  3444. // to the operation. If additional items exist beyond the maximum you specify,
  3445. // the NextToken response element is present and has a value (isn't null). Include
  3446. // that value as the NextToken request parameter in the next call to the operation
  3447. // to get the next part of the results. Note that Secrets Manager might return
  3448. // fewer results than the maximum even when there are more results available.
  3449. // You should check NextToken after every operation to ensure that you receive
  3450. // all of the results.
  3451. MaxResults *int64 `min:"1" type:"integer"`
  3452. // (Optional) Use this parameter in a request if you receive a NextToken response
  3453. // in a previous request that indicates that there's more output available.
  3454. // In a subsequent call, set it to the value of the previous call's NextToken
  3455. // response to indicate where the output should continue from.
  3456. NextToken *string `min:"1" type:"string"`
  3457. // The identifier for the secret containing the versions you want to list. You
  3458. // can specify either the Amazon Resource Name (ARN) or the friendly name of
  3459. // the secret.
  3460. //
  3461. // If you specify an ARN, we generally recommend that you specify a complete
  3462. // ARN. You can specify a partial ARN too—for example, if you don’t include
  3463. // the final hyphen and six random characters that Secrets Manager adds at the
  3464. // end of the ARN when you created the secret. A partial ARN match can work
  3465. // as long as it uniquely matches only one secret. However, if your secret has
  3466. // a name that ends in a hyphen followed by six characters (before Secrets Manager
  3467. // adds the hyphen and six characters to the ARN) and you try to use that as
  3468. // a partial ARN, then those characters cause Secrets Manager to assume that
  3469. // you’re specifying a complete ARN. This confusion can cause unexpected results.
  3470. // To avoid this situation, we recommend that you don’t create secret names
  3471. // that end with a hyphen followed by six characters.
  3472. //
  3473. // SecretId is a required field
  3474. SecretId *string `min:"1" type:"string" required:"true"`
  3475. }
  3476. // String returns the string representation
  3477. func (s ListSecretVersionIdsInput) String() string {
  3478. return awsutil.Prettify(s)
  3479. }
  3480. // GoString returns the string representation
  3481. func (s ListSecretVersionIdsInput) GoString() string {
  3482. return s.String()
  3483. }
  3484. // Validate inspects the fields of the type to determine if they are valid.
  3485. func (s *ListSecretVersionIdsInput) Validate() error {
  3486. invalidParams := request.ErrInvalidParams{Context: "ListSecretVersionIdsInput"}
  3487. if s.MaxResults != nil && *s.MaxResults < 1 {
  3488. invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1))
  3489. }
  3490. if s.NextToken != nil && len(*s.NextToken) < 1 {
  3491. invalidParams.Add(request.NewErrParamMinLen("NextToken", 1))
  3492. }
  3493. if s.SecretId == nil {
  3494. invalidParams.Add(request.NewErrParamRequired("SecretId"))
  3495. }
  3496. if s.SecretId != nil && len(*s.SecretId) < 1 {
  3497. invalidParams.Add(request.NewErrParamMinLen("SecretId", 1))
  3498. }
  3499. if invalidParams.Len() > 0 {
  3500. return invalidParams
  3501. }
  3502. return nil
  3503. }
  3504. // SetIncludeDeprecated sets the IncludeDeprecated field's value.
  3505. func (s *ListSecretVersionIdsInput) SetIncludeDeprecated(v bool) *ListSecretVersionIdsInput {
  3506. s.IncludeDeprecated = &v
  3507. return s
  3508. }
  3509. // SetMaxResults sets the MaxResults field's value.
  3510. func (s *ListSecretVersionIdsInput) SetMaxResults(v int64) *ListSecretVersionIdsInput {
  3511. s.MaxResults = &v
  3512. return s
  3513. }
  3514. // SetNextToken sets the NextToken field's value.
  3515. func (s *ListSecretVersionIdsInput) SetNextToken(v string) *ListSecretVersionIdsInput {
  3516. s.NextToken = &v
  3517. return s
  3518. }
  3519. // SetSecretId sets the SecretId field's value.
  3520. func (s *ListSecretVersionIdsInput) SetSecretId(v string) *ListSecretVersionIdsInput {
  3521. s.SecretId = &v
  3522. return s
  3523. }
  3524. type ListSecretVersionIdsOutput struct {
  3525. _ struct{} `type:"structure"`
  3526. // The Amazon Resource Name (ARN) for the secret.
  3527. //
  3528. // Secrets Manager automatically adds several random characters to the name
  3529. // at the end of the ARN when you initially create a secret. This affects only
  3530. // the ARN and not the actual friendly name. This ensures that if you create
  3531. // a new secret with the same name as an old secret that you previously deleted,
  3532. // then users with access to the old secret don't automatically get access to
  3533. // the new secret because the ARNs are different.
  3534. ARN *string `min:"20" type:"string"`
  3535. // The friendly name of the secret.
  3536. Name *string `min:"1" type:"string"`
  3537. // If present in the response, this value indicates that there's more output
  3538. // available than what's included in the current response. This can occur even
  3539. // when the response includes no values at all, such as when you ask for a filtered
  3540. // view of a very long list. Use this value in the NextToken request parameter
  3541. // in a subsequent call to the operation to continue processing and get the
  3542. // next part of the output. You should repeat this until the NextToken response
  3543. // element comes back empty (as null).
  3544. NextToken *string `min:"1" type:"string"`
  3545. // The list of the currently available versions of the specified secret.
  3546. Versions []*SecretVersionsListEntry `type:"list"`
  3547. }
  3548. // String returns the string representation
  3549. func (s ListSecretVersionIdsOutput) String() string {
  3550. return awsutil.Prettify(s)
  3551. }
  3552. // GoString returns the string representation
  3553. func (s ListSecretVersionIdsOutput) GoString() string {
  3554. return s.String()
  3555. }
  3556. // SetARN sets the ARN field's value.
  3557. func (s *ListSecretVersionIdsOutput) SetARN(v string) *ListSecretVersionIdsOutput {
  3558. s.ARN = &v
  3559. return s
  3560. }
  3561. // SetName sets the Name field's value.
  3562. func (s *ListSecretVersionIdsOutput) SetName(v string) *ListSecretVersionIdsOutput {
  3563. s.Name = &v
  3564. return s
  3565. }
  3566. // SetNextToken sets the NextToken field's value.
  3567. func (s *ListSecretVersionIdsOutput) SetNextToken(v string) *ListSecretVersionIdsOutput {
  3568. s.NextToken = &v
  3569. return s
  3570. }
  3571. // SetVersions sets the Versions field's value.
  3572. func (s *ListSecretVersionIdsOutput) SetVersions(v []*SecretVersionsListEntry) *ListSecretVersionIdsOutput {
  3573. s.Versions = v
  3574. return s
  3575. }
  3576. type ListSecretsInput struct {
  3577. _ struct{} `type:"structure"`
  3578. // (Optional) Limits the number of results that you want to include in the response.
  3579. // If you don't include this parameter, it defaults to a value that's specific
  3580. // to the operation. If additional items exist beyond the maximum you specify,
  3581. // the NextToken response element is present and has a value (isn't null). Include
  3582. // that value as the NextToken request parameter in the next call to the operation
  3583. // to get the next part of the results. Note that Secrets Manager might return
  3584. // fewer results than the maximum even when there are more results available.
  3585. // You should check NextToken after every operation to ensure that you receive
  3586. // all of the results.
  3587. MaxResults *int64 `min:"1" type:"integer"`
  3588. // (Optional) Use this parameter in a request if you receive a NextToken response
  3589. // in a previous request that indicates that there's more output available.
  3590. // In a subsequent call, set it to the value of the previous call's NextToken
  3591. // response to indicate where the output should continue from.
  3592. NextToken *string `min:"1" type:"string"`
  3593. }
  3594. // String returns the string representation
  3595. func (s ListSecretsInput) String() string {
  3596. return awsutil.Prettify(s)
  3597. }
  3598. // GoString returns the string representation
  3599. func (s ListSecretsInput) GoString() string {
  3600. return s.String()
  3601. }
  3602. // Validate inspects the fields of the type to determine if they are valid.
  3603. func (s *ListSecretsInput) Validate() error {
  3604. invalidParams := request.ErrInvalidParams{Context: "ListSecretsInput"}
  3605. if s.MaxResults != nil && *s.MaxResults < 1 {
  3606. invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1))
  3607. }
  3608. if s.NextToken != nil && len(*s.NextToken) < 1 {
  3609. invalidParams.Add(request.NewErrParamMinLen("NextToken", 1))
  3610. }
  3611. if invalidParams.Len() > 0 {
  3612. return invalidParams
  3613. }
  3614. return nil
  3615. }
  3616. // SetMaxResults sets the MaxResults field's value.
  3617. func (s *ListSecretsInput) SetMaxResults(v int64) *ListSecretsInput {
  3618. s.MaxResults = &v
  3619. return s
  3620. }
  3621. // SetNextToken sets the NextToken field's value.
  3622. func (s *ListSecretsInput) SetNextToken(v string) *ListSecretsInput {
  3623. s.NextToken = &v
  3624. return s
  3625. }
  3626. type ListSecretsOutput struct {
  3627. _ struct{} `type:"structure"`
  3628. // If present in the response, this value indicates that there's more output
  3629. // available than what's included in the current response. This can occur even
  3630. // when the response includes no values at all, such as when you ask for a filtered
  3631. // view of a very long list. Use this value in the NextToken request parameter
  3632. // in a subsequent call to the operation to continue processing and get the
  3633. // next part of the output. You should repeat this until the NextToken response
  3634. // element comes back empty (as null).
  3635. NextToken *string `min:"1" type:"string"`
  3636. // A list of the secrets in the account.
  3637. SecretList []*SecretListEntry `type:"list"`
  3638. }
  3639. // String returns the string representation
  3640. func (s ListSecretsOutput) String() string {
  3641. return awsutil.Prettify(s)
  3642. }
  3643. // GoString returns the string representation
  3644. func (s ListSecretsOutput) GoString() string {
  3645. return s.String()
  3646. }
  3647. // SetNextToken sets the NextToken field's value.
  3648. func (s *ListSecretsOutput) SetNextToken(v string) *ListSecretsOutput {
  3649. s.NextToken = &v
  3650. return s
  3651. }
  3652. // SetSecretList sets the SecretList field's value.
  3653. func (s *ListSecretsOutput) SetSecretList(v []*SecretListEntry) *ListSecretsOutput {
  3654. s.SecretList = v
  3655. return s
  3656. }
  3657. type PutResourcePolicyInput struct {
  3658. _ struct{} `type:"structure"`
  3659. // A JSON-formatted string that's constructed according to the grammar and syntax
  3660. // for an AWS resource-based policy. The policy in the string identifies who
  3661. // can access or manage this secret and its versions. For information on how
  3662. // to format a JSON parameter for the various command line tool environments,
  3663. // see Using JSON for Parameters (http://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json)
  3664. // in the AWS CLI User Guide.
  3665. //
  3666. // ResourcePolicy is a required field
  3667. ResourcePolicy *string `min:"1" type:"string" required:"true"`
  3668. // Specifies the secret that you want to attach the resource-based policy to.
  3669. // You can specify either the ARN or the friendly name of the secret.
  3670. //
  3671. // If you specify an ARN, we generally recommend that you specify a complete
  3672. // ARN. You can specify a partial ARN too—for example, if you don’t include
  3673. // the final hyphen and six random characters that Secrets Manager adds at the
  3674. // end of the ARN when you created the secret. A partial ARN match can work
  3675. // as long as it uniquely matches only one secret. However, if your secret has
  3676. // a name that ends in a hyphen followed by six characters (before Secrets Manager
  3677. // adds the hyphen and six characters to the ARN) and you try to use that as
  3678. // a partial ARN, then those characters cause Secrets Manager to assume that
  3679. // you’re specifying a complete ARN. This confusion can cause unexpected results.
  3680. // To avoid this situation, we recommend that you don’t create secret names
  3681. // that end with a hyphen followed by six characters.
  3682. //
  3683. // SecretId is a required field
  3684. SecretId *string `min:"1" type:"string" required:"true"`
  3685. }
  3686. // String returns the string representation
  3687. func (s PutResourcePolicyInput) String() string {
  3688. return awsutil.Prettify(s)
  3689. }
  3690. // GoString returns the string representation
  3691. func (s PutResourcePolicyInput) GoString() string {
  3692. return s.String()
  3693. }
  3694. // Validate inspects the fields of the type to determine if they are valid.
  3695. func (s *PutResourcePolicyInput) Validate() error {
  3696. invalidParams := request.ErrInvalidParams{Context: "PutResourcePolicyInput"}
  3697. if s.ResourcePolicy == nil {
  3698. invalidParams.Add(request.NewErrParamRequired("ResourcePolicy"))
  3699. }
  3700. if s.ResourcePolicy != nil && len(*s.ResourcePolicy) < 1 {
  3701. invalidParams.Add(request.NewErrParamMinLen("ResourcePolicy", 1))
  3702. }
  3703. if s.SecretId == nil {
  3704. invalidParams.Add(request.NewErrParamRequired("SecretId"))
  3705. }
  3706. if s.SecretId != nil && len(*s.SecretId) < 1 {
  3707. invalidParams.Add(request.NewErrParamMinLen("SecretId", 1))
  3708. }
  3709. if invalidParams.Len() > 0 {
  3710. return invalidParams
  3711. }
  3712. return nil
  3713. }
  3714. // SetResourcePolicy sets the ResourcePolicy field's value.
  3715. func (s *PutResourcePolicyInput) SetResourcePolicy(v string) *PutResourcePolicyInput {
  3716. s.ResourcePolicy = &v
  3717. return s
  3718. }
  3719. // SetSecretId sets the SecretId field's value.
  3720. func (s *PutResourcePolicyInput) SetSecretId(v string) *PutResourcePolicyInput {
  3721. s.SecretId = &v
  3722. return s
  3723. }
  3724. type PutResourcePolicyOutput struct {
  3725. _ struct{} `type:"structure"`
  3726. // The ARN of the secret that the resource-based policy was retrieved for.
  3727. ARN *string `min:"20" type:"string"`
  3728. // The friendly name of the secret that the resource-based policy was retrieved
  3729. // for.
  3730. Name *string `min:"1" type:"string"`
  3731. }
  3732. // String returns the string representation
  3733. func (s PutResourcePolicyOutput) String() string {
  3734. return awsutil.Prettify(s)
  3735. }
  3736. // GoString returns the string representation
  3737. func (s PutResourcePolicyOutput) GoString() string {
  3738. return s.String()
  3739. }
  3740. // SetARN sets the ARN field's value.
  3741. func (s *PutResourcePolicyOutput) SetARN(v string) *PutResourcePolicyOutput {
  3742. s.ARN = &v
  3743. return s
  3744. }
  3745. // SetName sets the Name field's value.
  3746. func (s *PutResourcePolicyOutput) SetName(v string) *PutResourcePolicyOutput {
  3747. s.Name = &v
  3748. return s
  3749. }
  3750. type PutSecretValueInput struct {
  3751. _ struct{} `type:"structure"`
  3752. // (Optional) Specifies a unique identifier for the new version of the secret.
  3753. //
  3754. // If you use the AWS CLI or one of the AWS SDK to call this operation, then
  3755. // you can leave this parameter empty. The CLI or SDK generates a random UUID
  3756. // for you and includes that in the request. If you don't use the SDK and instead
  3757. // generate a raw HTTP request to the Secrets Manager service endpoint, then
  3758. // you must generate a ClientRequestToken yourself for new versions and include
  3759. // that value in the request.
  3760. //
  3761. // This value helps ensure idempotency. Secrets Manager uses this value to prevent
  3762. // the accidental creation of duplicate versions if there are failures and retries
  3763. // during the Lambda rotation function's processing. We recommend that you generate
  3764. // a UUID-type (https://wikipedia.org/wiki/Universally_unique_identifier) value
  3765. // to ensure uniqueness within the specified secret.
  3766. //
  3767. // * If the ClientRequestToken value isn't already associated with a version
  3768. // of the secret then a new version of the secret is created.
  3769. //
  3770. // * If a version with this value already exists and that version's SecretString
  3771. // or SecretBinary values are the same as those in the request then the request
  3772. // is ignored (the operation is idempotent).
  3773. //
  3774. // * If a version with this value already exists and that version's SecretString
  3775. // and SecretBinary values are different from those in the request then the
  3776. // request fails because you cannot modify an existing secret version. You
  3777. // can only create new versions to store new secret values.
  3778. //
  3779. // This value becomes the VersionId of the new version.
  3780. ClientRequestToken *string `min:"32" type:"string" idempotencyToken:"true"`
  3781. // (Optional) Specifies binary data that you want to encrypt and store in the
  3782. // new version of the secret. To use this parameter in the command-line tools,
  3783. // we recommend that you store your binary data in a file and then use the appropriate
  3784. // technique for your tool to pass the contents of the file as a parameter.
  3785. // Either SecretBinary or SecretString must have a value, but not both. They
  3786. // cannot both be empty.
  3787. //
  3788. // This parameter is not accessible if the secret using the Secrets Manager
  3789. // console.
  3790. //
  3791. // SecretBinary is automatically base64 encoded/decoded by the SDK.
  3792. SecretBinary []byte `type:"blob" sensitive:"true"`
  3793. // Specifies the secret to which you want to add a new version. You can specify
  3794. // either the Amazon Resource Name (ARN) or the friendly name of the secret.
  3795. // The secret must already exist.
  3796. //
  3797. // If you specify an ARN, we generally recommend that you specify a complete
  3798. // ARN. You can specify a partial ARN too—for example, if you don’t include
  3799. // the final hyphen and six random characters that Secrets Manager adds at the
  3800. // end of the ARN when you created the secret. A partial ARN match can work
  3801. // as long as it uniquely matches only one secret. However, if your secret has
  3802. // a name that ends in a hyphen followed by six characters (before Secrets Manager
  3803. // adds the hyphen and six characters to the ARN) and you try to use that as
  3804. // a partial ARN, then those characters cause Secrets Manager to assume that
  3805. // you’re specifying a complete ARN. This confusion can cause unexpected results.
  3806. // To avoid this situation, we recommend that you don’t create secret names
  3807. // that end with a hyphen followed by six characters.
  3808. //
  3809. // SecretId is a required field
  3810. SecretId *string `min:"1" type:"string" required:"true"`
  3811. // (Optional) Specifies text data that you want to encrypt and store in this
  3812. // new version of the secret. Either SecretString or SecretBinary must have
  3813. // a value, but not both. They cannot both be empty.
  3814. //
  3815. // If you create this secret by using the Secrets Manager console then Secrets
  3816. // Manager puts the protected secret text in only the SecretString parameter.
  3817. // The Secrets Manager console stores the information as a JSON structure of
  3818. // key/value pairs that the default Lambda rotation function knows how to parse.
  3819. //
  3820. // For storing multiple values, we recommend that you use a JSON text string
  3821. // argument and specify key/value pairs. For information on how to format a
  3822. // JSON parameter for the various command line tool environments, see Using
  3823. // JSON for Parameters (http://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json)
  3824. // in the AWS CLI User Guide.
  3825. //
  3826. // For example:
  3827. //
  3828. // [{"username":"bob"},{"password":"abc123xyz456"}]
  3829. //
  3830. // If your command-line tool or SDK requires quotation marks around the parameter,
  3831. // you should use single quotes to avoid confusion with the double quotes required
  3832. // in the JSON text.
  3833. SecretString *string `type:"string" sensitive:"true"`
  3834. // (Optional) Specifies a list of staging labels that are attached to this version
  3835. // of the secret. These staging labels are used to track the versions through
  3836. // the rotation process by the Lambda rotation function.
  3837. //
  3838. // A staging label must be unique to a single version of the secret. If you
  3839. // specify a staging label that's already associated with a different version
  3840. // of the same secret then that staging label is automatically removed from
  3841. // the other version and attached to this version.
  3842. //
  3843. // If you do not specify a value for VersionStages then Secrets Manager automatically
  3844. // moves the staging label AWSCURRENT to this new version.
  3845. VersionStages []*string `min:"1" type:"list"`
  3846. }
  3847. // String returns the string representation
  3848. func (s PutSecretValueInput) String() string {
  3849. return awsutil.Prettify(s)
  3850. }
  3851. // GoString returns the string representation
  3852. func (s PutSecretValueInput) GoString() string {
  3853. return s.String()
  3854. }
  3855. // Validate inspects the fields of the type to determine if they are valid.
  3856. func (s *PutSecretValueInput) Validate() error {
  3857. invalidParams := request.ErrInvalidParams{Context: "PutSecretValueInput"}
  3858. if s.ClientRequestToken != nil && len(*s.ClientRequestToken) < 32 {
  3859. invalidParams.Add(request.NewErrParamMinLen("ClientRequestToken", 32))
  3860. }
  3861. if s.SecretId == nil {
  3862. invalidParams.Add(request.NewErrParamRequired("SecretId"))
  3863. }
  3864. if s.SecretId != nil && len(*s.SecretId) < 1 {
  3865. invalidParams.Add(request.NewErrParamMinLen("SecretId", 1))
  3866. }
  3867. if s.VersionStages != nil && len(s.VersionStages) < 1 {
  3868. invalidParams.Add(request.NewErrParamMinLen("VersionStages", 1))
  3869. }
  3870. if invalidParams.Len() > 0 {
  3871. return invalidParams
  3872. }
  3873. return nil
  3874. }
  3875. // SetClientRequestToken sets the ClientRequestToken field's value.
  3876. func (s *PutSecretValueInput) SetClientRequestToken(v string) *PutSecretValueInput {
  3877. s.ClientRequestToken = &v
  3878. return s
  3879. }
  3880. // SetSecretBinary sets the SecretBinary field's value.
  3881. func (s *PutSecretValueInput) SetSecretBinary(v []byte) *PutSecretValueInput {
  3882. s.SecretBinary = v
  3883. return s
  3884. }
  3885. // SetSecretId sets the SecretId field's value.
  3886. func (s *PutSecretValueInput) SetSecretId(v string) *PutSecretValueInput {
  3887. s.SecretId = &v
  3888. return s
  3889. }
  3890. // SetSecretString sets the SecretString field's value.
  3891. func (s *PutSecretValueInput) SetSecretString(v string) *PutSecretValueInput {
  3892. s.SecretString = &v
  3893. return s
  3894. }
  3895. // SetVersionStages sets the VersionStages field's value.
  3896. func (s *PutSecretValueInput) SetVersionStages(v []*string) *PutSecretValueInput {
  3897. s.VersionStages = v
  3898. return s
  3899. }
  3900. type PutSecretValueOutput struct {
  3901. _ struct{} `type:"structure"`
  3902. // The Amazon Resource Name (ARN) for the secret for which you just created
  3903. // a version.
  3904. ARN *string `min:"20" type:"string"`
  3905. // The friendly name of the secret for which you just created or updated a version.
  3906. Name *string `min:"1" type:"string"`
  3907. // The unique identifier of the version of the secret you just created or updated.
  3908. VersionId *string `min:"32" type:"string"`
  3909. // The list of staging labels that are currently attached to this version of
  3910. // the secret. Staging labels are used to track a version as it progresses through
  3911. // the secret rotation process.
  3912. VersionStages []*string `min:"1" type:"list"`
  3913. }
  3914. // String returns the string representation
  3915. func (s PutSecretValueOutput) String() string {
  3916. return awsutil.Prettify(s)
  3917. }
  3918. // GoString returns the string representation
  3919. func (s PutSecretValueOutput) GoString() string {
  3920. return s.String()
  3921. }
  3922. // SetARN sets the ARN field's value.
  3923. func (s *PutSecretValueOutput) SetARN(v string) *PutSecretValueOutput {
  3924. s.ARN = &v
  3925. return s
  3926. }
  3927. // SetName sets the Name field's value.
  3928. func (s *PutSecretValueOutput) SetName(v string) *PutSecretValueOutput {
  3929. s.Name = &v
  3930. return s
  3931. }
  3932. // SetVersionId sets the VersionId field's value.
  3933. func (s *PutSecretValueOutput) SetVersionId(v string) *PutSecretValueOutput {
  3934. s.VersionId = &v
  3935. return s
  3936. }
  3937. // SetVersionStages sets the VersionStages field's value.
  3938. func (s *PutSecretValueOutput) SetVersionStages(v []*string) *PutSecretValueOutput {
  3939. s.VersionStages = v
  3940. return s
  3941. }
  3942. type RestoreSecretInput struct {
  3943. _ struct{} `type:"structure"`
  3944. // Specifies the secret that you want to restore from a previously scheduled
  3945. // deletion. You can specify either the Amazon Resource Name (ARN) or the friendly
  3946. // name of the secret.
  3947. //
  3948. // If you specify an ARN, we generally recommend that you specify a complete
  3949. // ARN. You can specify a partial ARN too—for example, if you don’t include
  3950. // the final hyphen and six random characters that Secrets Manager adds at the
  3951. // end of the ARN when you created the secret. A partial ARN match can work
  3952. // as long as it uniquely matches only one secret. However, if your secret has
  3953. // a name that ends in a hyphen followed by six characters (before Secrets Manager
  3954. // adds the hyphen and six characters to the ARN) and you try to use that as
  3955. // a partial ARN, then those characters cause Secrets Manager to assume that
  3956. // you’re specifying a complete ARN. This confusion can cause unexpected results.
  3957. // To avoid this situation, we recommend that you don’t create secret names
  3958. // that end with a hyphen followed by six characters.
  3959. //
  3960. // SecretId is a required field
  3961. SecretId *string `min:"1" type:"string" required:"true"`
  3962. }
  3963. // String returns the string representation
  3964. func (s RestoreSecretInput) String() string {
  3965. return awsutil.Prettify(s)
  3966. }
  3967. // GoString returns the string representation
  3968. func (s RestoreSecretInput) GoString() string {
  3969. return s.String()
  3970. }
  3971. // Validate inspects the fields of the type to determine if they are valid.
  3972. func (s *RestoreSecretInput) Validate() error {
  3973. invalidParams := request.ErrInvalidParams{Context: "RestoreSecretInput"}
  3974. if s.SecretId == nil {
  3975. invalidParams.Add(request.NewErrParamRequired("SecretId"))
  3976. }
  3977. if s.SecretId != nil && len(*s.SecretId) < 1 {
  3978. invalidParams.Add(request.NewErrParamMinLen("SecretId", 1))
  3979. }
  3980. if invalidParams.Len() > 0 {
  3981. return invalidParams
  3982. }
  3983. return nil
  3984. }
  3985. // SetSecretId sets the SecretId field's value.
  3986. func (s *RestoreSecretInput) SetSecretId(v string) *RestoreSecretInput {
  3987. s.SecretId = &v
  3988. return s
  3989. }
  3990. type RestoreSecretOutput struct {
  3991. _ struct{} `type:"structure"`
  3992. // The ARN of the secret that was restored.
  3993. ARN *string `min:"20" type:"string"`
  3994. // The friendly name of the secret that was restored.
  3995. Name *string `min:"1" type:"string"`
  3996. }
  3997. // String returns the string representation
  3998. func (s RestoreSecretOutput) String() string {
  3999. return awsutil.Prettify(s)
  4000. }
  4001. // GoString returns the string representation
  4002. func (s RestoreSecretOutput) GoString() string {
  4003. return s.String()
  4004. }
  4005. // SetARN sets the ARN field's value.
  4006. func (s *RestoreSecretOutput) SetARN(v string) *RestoreSecretOutput {
  4007. s.ARN = &v
  4008. return s
  4009. }
  4010. // SetName sets the Name field's value.
  4011. func (s *RestoreSecretOutput) SetName(v string) *RestoreSecretOutput {
  4012. s.Name = &v
  4013. return s
  4014. }
  4015. type RotateSecretInput struct {
  4016. _ struct{} `type:"structure"`
  4017. // (Optional) Specifies a unique identifier for the new version of the secret
  4018. // that helps ensure idempotency.
  4019. //
  4020. // If you use the AWS CLI or one of the AWS SDK to call this operation, then
  4021. // you can leave this parameter empty. The CLI or SDK generates a random UUID
  4022. // for you and includes that in the request for this parameter. If you don't
  4023. // use the SDK and instead generate a raw HTTP request to the Secrets Manager
  4024. // service endpoint, then you must generate a ClientRequestToken yourself for
  4025. // new versions and include that value in the request.
  4026. //
  4027. // You only need to specify your own value if you are implementing your own
  4028. // retry logic and want to ensure that a given secret is not created twice.
  4029. // We recommend that you generate a UUID-type (https://wikipedia.org/wiki/Universally_unique_identifier)
  4030. // value to ensure uniqueness within the specified secret.
  4031. //
  4032. // Secrets Manager uses this value to prevent the accidental creation of duplicate
  4033. // versions if there are failures and retries during the function's processing.
  4034. // This value becomes the VersionId of the new version.
  4035. ClientRequestToken *string `min:"32" type:"string" idempotencyToken:"true"`
  4036. // (Optional) Specifies the ARN of the Lambda function that can rotate the secret.
  4037. RotationLambdaARN *string `type:"string"`
  4038. // A structure that defines the rotation configuration for this secret.
  4039. RotationRules *RotationRulesType `type:"structure"`
  4040. // Specifies the secret that you want to rotate. You can specify either the
  4041. // Amazon Resource Name (ARN) or the friendly name of the secret.
  4042. //
  4043. // If you specify an ARN, we generally recommend that you specify a complete
  4044. // ARN. You can specify a partial ARN too—for example, if you don’t include
  4045. // the final hyphen and six random characters that Secrets Manager adds at the
  4046. // end of the ARN when you created the secret. A partial ARN match can work
  4047. // as long as it uniquely matches only one secret. However, if your secret has
  4048. // a name that ends in a hyphen followed by six characters (before Secrets Manager
  4049. // adds the hyphen and six characters to the ARN) and you try to use that as
  4050. // a partial ARN, then those characters cause Secrets Manager to assume that
  4051. // you’re specifying a complete ARN. This confusion can cause unexpected results.
  4052. // To avoid this situation, we recommend that you don’t create secret names
  4053. // that end with a hyphen followed by six characters.
  4054. //
  4055. // SecretId is a required field
  4056. SecretId *string `min:"1" type:"string" required:"true"`
  4057. }
  4058. // String returns the string representation
  4059. func (s RotateSecretInput) String() string {
  4060. return awsutil.Prettify(s)
  4061. }
  4062. // GoString returns the string representation
  4063. func (s RotateSecretInput) GoString() string {
  4064. return s.String()
  4065. }
  4066. // Validate inspects the fields of the type to determine if they are valid.
  4067. func (s *RotateSecretInput) Validate() error {
  4068. invalidParams := request.ErrInvalidParams{Context: "RotateSecretInput"}
  4069. if s.ClientRequestToken != nil && len(*s.ClientRequestToken) < 32 {
  4070. invalidParams.Add(request.NewErrParamMinLen("ClientRequestToken", 32))
  4071. }
  4072. if s.SecretId == nil {
  4073. invalidParams.Add(request.NewErrParamRequired("SecretId"))
  4074. }
  4075. if s.SecretId != nil && len(*s.SecretId) < 1 {
  4076. invalidParams.Add(request.NewErrParamMinLen("SecretId", 1))
  4077. }
  4078. if s.RotationRules != nil {
  4079. if err := s.RotationRules.Validate(); err != nil {
  4080. invalidParams.AddNested("RotationRules", err.(request.ErrInvalidParams))
  4081. }
  4082. }
  4083. if invalidParams.Len() > 0 {
  4084. return invalidParams
  4085. }
  4086. return nil
  4087. }
  4088. // SetClientRequestToken sets the ClientRequestToken field's value.
  4089. func (s *RotateSecretInput) SetClientRequestToken(v string) *RotateSecretInput {
  4090. s.ClientRequestToken = &v
  4091. return s
  4092. }
  4093. // SetRotationLambdaARN sets the RotationLambdaARN field's value.
  4094. func (s *RotateSecretInput) SetRotationLambdaARN(v string) *RotateSecretInput {
  4095. s.RotationLambdaARN = &v
  4096. return s
  4097. }
  4098. // SetRotationRules sets the RotationRules field's value.
  4099. func (s *RotateSecretInput) SetRotationRules(v *RotationRulesType) *RotateSecretInput {
  4100. s.RotationRules = v
  4101. return s
  4102. }
  4103. // SetSecretId sets the SecretId field's value.
  4104. func (s *RotateSecretInput) SetSecretId(v string) *RotateSecretInput {
  4105. s.SecretId = &v
  4106. return s
  4107. }
  4108. type RotateSecretOutput struct {
  4109. _ struct{} `type:"structure"`
  4110. // The ARN of the secret.
  4111. ARN *string `min:"20" type:"string"`
  4112. // The friendly name of the secret.
  4113. Name *string `min:"1" type:"string"`
  4114. // The ID of the new version of the secret created by the rotation started by
  4115. // this request.
  4116. VersionId *string `min:"32" type:"string"`
  4117. }
  4118. // String returns the string representation
  4119. func (s RotateSecretOutput) String() string {
  4120. return awsutil.Prettify(s)
  4121. }
  4122. // GoString returns the string representation
  4123. func (s RotateSecretOutput) GoString() string {
  4124. return s.String()
  4125. }
  4126. // SetARN sets the ARN field's value.
  4127. func (s *RotateSecretOutput) SetARN(v string) *RotateSecretOutput {
  4128. s.ARN = &v
  4129. return s
  4130. }
  4131. // SetName sets the Name field's value.
  4132. func (s *RotateSecretOutput) SetName(v string) *RotateSecretOutput {
  4133. s.Name = &v
  4134. return s
  4135. }
  4136. // SetVersionId sets the VersionId field's value.
  4137. func (s *RotateSecretOutput) SetVersionId(v string) *RotateSecretOutput {
  4138. s.VersionId = &v
  4139. return s
  4140. }
  4141. // A structure that defines the rotation configuration for the secret.
  4142. type RotationRulesType struct {
  4143. _ struct{} `type:"structure"`
  4144. // Specifies the number of days between automatic scheduled rotations of the
  4145. // secret.
  4146. //
  4147. // Secrets Manager schedules the next rotation when the previous one is complete.
  4148. // Secrets Manager schedules the date by adding the rotation interval (number
  4149. // of days) to the actual date of the last rotation. The service chooses the
  4150. // hour within that 24-hour date window randomly. The minute is also chosen
  4151. // somewhat randomly, but weighted towards the top of the hour and influenced
  4152. // by a variety of factors that help distribute load.
  4153. AutomaticallyAfterDays *int64 `min:"1" type:"long"`
  4154. }
  4155. // String returns the string representation
  4156. func (s RotationRulesType) String() string {
  4157. return awsutil.Prettify(s)
  4158. }
  4159. // GoString returns the string representation
  4160. func (s RotationRulesType) GoString() string {
  4161. return s.String()
  4162. }
  4163. // Validate inspects the fields of the type to determine if they are valid.
  4164. func (s *RotationRulesType) Validate() error {
  4165. invalidParams := request.ErrInvalidParams{Context: "RotationRulesType"}
  4166. if s.AutomaticallyAfterDays != nil && *s.AutomaticallyAfterDays < 1 {
  4167. invalidParams.Add(request.NewErrParamMinValue("AutomaticallyAfterDays", 1))
  4168. }
  4169. if invalidParams.Len() > 0 {
  4170. return invalidParams
  4171. }
  4172. return nil
  4173. }
  4174. // SetAutomaticallyAfterDays sets the AutomaticallyAfterDays field's value.
  4175. func (s *RotationRulesType) SetAutomaticallyAfterDays(v int64) *RotationRulesType {
  4176. s.AutomaticallyAfterDays = &v
  4177. return s
  4178. }
  4179. // A structure that contains the details about a secret. It does not include
  4180. // the encrypted SecretString and SecretBinary values. To get those values,
  4181. // use the GetSecretValue operation.
  4182. type SecretListEntry struct {
  4183. _ struct{} `type:"structure"`
  4184. // The Amazon Resource Name (ARN) of the secret.
  4185. //
  4186. // For more information about ARNs in Secrets Manager, see Policy Resources
  4187. // (http://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_iam-permissions.html#iam-resources)
  4188. // in the AWS Secrets Manager User Guide.
  4189. ARN *string `min:"20" type:"string"`
  4190. // The date and time on which this secret was deleted. Not present on active
  4191. // secrets. The secret can be recovered until the number of days in the recovery
  4192. // window has passed, as specified in the RecoveryWindowInDays parameter of
  4193. // the DeleteSecret operation.
  4194. DeletedDate *time.Time `type:"timestamp"`
  4195. // The user-provided description of the secret.
  4196. Description *string `type:"string"`
  4197. // The ARN or alias of the AWS KMS customer master key (CMK) that's used to
  4198. // encrypt the SecretString and SecretBinary fields in each version of the secret.
  4199. // If you don't provide a key, then Secrets Manager defaults to encrypting the
  4200. // secret fields with the default KMS CMK (the one named awssecretsmanager)
  4201. // for this account.
  4202. KmsKeyId *string `type:"string"`
  4203. // The last date that this secret was accessed. This value is truncated to midnight
  4204. // of the date and therefore shows only the date, not the time.
  4205. LastAccessedDate *time.Time `type:"timestamp"`
  4206. // The last date and time that this secret was modified in any way.
  4207. LastChangedDate *time.Time `type:"timestamp"`
  4208. // The last date and time that the rotation process for this secret was invoked.
  4209. LastRotatedDate *time.Time `type:"timestamp"`
  4210. // The friendly name of the secret. You can use forward slashes in the name
  4211. // to represent a path hierarchy. For example, /prod/databases/dbserver1 could
  4212. // represent the secret for a server named dbserver1 in the folder databases
  4213. // in the folder prod.
  4214. Name *string `min:"1" type:"string"`
  4215. // Indicated whether automatic, scheduled rotation is enabled for this secret.
  4216. RotationEnabled *bool `type:"boolean"`
  4217. // The ARN of an AWS Lambda function that's invoked by Secrets Manager to rotate
  4218. // and expire the secret either automatically per the schedule or manually by
  4219. // a call to RotateSecret.
  4220. RotationLambdaARN *string `type:"string"`
  4221. // A structure that defines the rotation configuration for the secret.
  4222. RotationRules *RotationRulesType `type:"structure"`
  4223. // A list of all of the currently assigned SecretVersionStage staging labels
  4224. // and the SecretVersionId that each is attached to. Staging labels are used
  4225. // to keep track of the different versions during the rotation process.
  4226. //
  4227. // A version that does not have any SecretVersionStage is considered deprecated
  4228. // and subject to deletion. Such versions are not included in this list.
  4229. SecretVersionsToStages map[string][]*string `type:"map"`
  4230. // The list of user-defined tags that are associated with the secret. To add
  4231. // tags to a secret, use TagResource. To remove tags, use UntagResource.
  4232. Tags []*Tag `type:"list"`
  4233. }
  4234. // String returns the string representation
  4235. func (s SecretListEntry) String() string {
  4236. return awsutil.Prettify(s)
  4237. }
  4238. // GoString returns the string representation
  4239. func (s SecretListEntry) GoString() string {
  4240. return s.String()
  4241. }
  4242. // SetARN sets the ARN field's value.
  4243. func (s *SecretListEntry) SetARN(v string) *SecretListEntry {
  4244. s.ARN = &v
  4245. return s
  4246. }
  4247. // SetDeletedDate sets the DeletedDate field's value.
  4248. func (s *SecretListEntry) SetDeletedDate(v time.Time) *SecretListEntry {
  4249. s.DeletedDate = &v
  4250. return s
  4251. }
  4252. // SetDescription sets the Description field's value.
  4253. func (s *SecretListEntry) SetDescription(v string) *SecretListEntry {
  4254. s.Description = &v
  4255. return s
  4256. }
  4257. // SetKmsKeyId sets the KmsKeyId field's value.
  4258. func (s *SecretListEntry) SetKmsKeyId(v string) *SecretListEntry {
  4259. s.KmsKeyId = &v
  4260. return s
  4261. }
  4262. // SetLastAccessedDate sets the LastAccessedDate field's value.
  4263. func (s *SecretListEntry) SetLastAccessedDate(v time.Time) *SecretListEntry {
  4264. s.LastAccessedDate = &v
  4265. return s
  4266. }
  4267. // SetLastChangedDate sets the LastChangedDate field's value.
  4268. func (s *SecretListEntry) SetLastChangedDate(v time.Time) *SecretListEntry {
  4269. s.LastChangedDate = &v
  4270. return s
  4271. }
  4272. // SetLastRotatedDate sets the LastRotatedDate field's value.
  4273. func (s *SecretListEntry) SetLastRotatedDate(v time.Time) *SecretListEntry {
  4274. s.LastRotatedDate = &v
  4275. return s
  4276. }
  4277. // SetName sets the Name field's value.
  4278. func (s *SecretListEntry) SetName(v string) *SecretListEntry {
  4279. s.Name = &v
  4280. return s
  4281. }
  4282. // SetRotationEnabled sets the RotationEnabled field's value.
  4283. func (s *SecretListEntry) SetRotationEnabled(v bool) *SecretListEntry {
  4284. s.RotationEnabled = &v
  4285. return s
  4286. }
  4287. // SetRotationLambdaARN sets the RotationLambdaARN field's value.
  4288. func (s *SecretListEntry) SetRotationLambdaARN(v string) *SecretListEntry {
  4289. s.RotationLambdaARN = &v
  4290. return s
  4291. }
  4292. // SetRotationRules sets the RotationRules field's value.
  4293. func (s *SecretListEntry) SetRotationRules(v *RotationRulesType) *SecretListEntry {
  4294. s.RotationRules = v
  4295. return s
  4296. }
  4297. // SetSecretVersionsToStages sets the SecretVersionsToStages field's value.
  4298. func (s *SecretListEntry) SetSecretVersionsToStages(v map[string][]*string) *SecretListEntry {
  4299. s.SecretVersionsToStages = v
  4300. return s
  4301. }
  4302. // SetTags sets the Tags field's value.
  4303. func (s *SecretListEntry) SetTags(v []*Tag) *SecretListEntry {
  4304. s.Tags = v
  4305. return s
  4306. }
  4307. // A structure that contains information about one version of a secret.
  4308. type SecretVersionsListEntry struct {
  4309. _ struct{} `type:"structure"`
  4310. // The date and time this version of the secret was created.
  4311. CreatedDate *time.Time `type:"timestamp"`
  4312. // The date that this version of the secret was last accessed. Note that the
  4313. // resolution of this field is at the date level and does not include the time.
  4314. LastAccessedDate *time.Time `type:"timestamp"`
  4315. // The unique version identifier of this version of the secret.
  4316. VersionId *string `min:"32" type:"string"`
  4317. // An array of staging labels that are currently associated with this version
  4318. // of the secret.
  4319. VersionStages []*string `min:"1" type:"list"`
  4320. }
  4321. // String returns the string representation
  4322. func (s SecretVersionsListEntry) String() string {
  4323. return awsutil.Prettify(s)
  4324. }
  4325. // GoString returns the string representation
  4326. func (s SecretVersionsListEntry) GoString() string {
  4327. return s.String()
  4328. }
  4329. // SetCreatedDate sets the CreatedDate field's value.
  4330. func (s *SecretVersionsListEntry) SetCreatedDate(v time.Time) *SecretVersionsListEntry {
  4331. s.CreatedDate = &v
  4332. return s
  4333. }
  4334. // SetLastAccessedDate sets the LastAccessedDate field's value.
  4335. func (s *SecretVersionsListEntry) SetLastAccessedDate(v time.Time) *SecretVersionsListEntry {
  4336. s.LastAccessedDate = &v
  4337. return s
  4338. }
  4339. // SetVersionId sets the VersionId field's value.
  4340. func (s *SecretVersionsListEntry) SetVersionId(v string) *SecretVersionsListEntry {
  4341. s.VersionId = &v
  4342. return s
  4343. }
  4344. // SetVersionStages sets the VersionStages field's value.
  4345. func (s *SecretVersionsListEntry) SetVersionStages(v []*string) *SecretVersionsListEntry {
  4346. s.VersionStages = v
  4347. return s
  4348. }
  4349. // A structure that contains information about a tag.
  4350. type Tag struct {
  4351. _ struct{} `type:"structure"`
  4352. // The key identifier, or name, of the tag.
  4353. Key *string `min:"1" type:"string"`
  4354. // The string value that's associated with the key of the tag.
  4355. Value *string `type:"string"`
  4356. }
  4357. // String returns the string representation
  4358. func (s Tag) String() string {
  4359. return awsutil.Prettify(s)
  4360. }
  4361. // GoString returns the string representation
  4362. func (s Tag) GoString() string {
  4363. return s.String()
  4364. }
  4365. // Validate inspects the fields of the type to determine if they are valid.
  4366. func (s *Tag) Validate() error {
  4367. invalidParams := request.ErrInvalidParams{Context: "Tag"}
  4368. if s.Key != nil && len(*s.Key) < 1 {
  4369. invalidParams.Add(request.NewErrParamMinLen("Key", 1))
  4370. }
  4371. if invalidParams.Len() > 0 {
  4372. return invalidParams
  4373. }
  4374. return nil
  4375. }
  4376. // SetKey sets the Key field's value.
  4377. func (s *Tag) SetKey(v string) *Tag {
  4378. s.Key = &v
  4379. return s
  4380. }
  4381. // SetValue sets the Value field's value.
  4382. func (s *Tag) SetValue(v string) *Tag {
  4383. s.Value = &v
  4384. return s
  4385. }
  4386. type TagResourceInput struct {
  4387. _ struct{} `type:"structure"`
  4388. // The identifier for the secret that you want to attach tags to. You can specify
  4389. // either the Amazon Resource Name (ARN) or the friendly name of the secret.
  4390. //
  4391. // If you specify an ARN, we generally recommend that you specify a complete
  4392. // ARN. You can specify a partial ARN too—for example, if you don’t include
  4393. // the final hyphen and six random characters that Secrets Manager adds at the
  4394. // end of the ARN when you created the secret. A partial ARN match can work
  4395. // as long as it uniquely matches only one secret. However, if your secret has
  4396. // a name that ends in a hyphen followed by six characters (before Secrets Manager
  4397. // adds the hyphen and six characters to the ARN) and you try to use that as
  4398. // a partial ARN, then those characters cause Secrets Manager to assume that
  4399. // you’re specifying a complete ARN. This confusion can cause unexpected results.
  4400. // To avoid this situation, we recommend that you don’t create secret names
  4401. // that end with a hyphen followed by six characters.
  4402. //
  4403. // SecretId is a required field
  4404. SecretId *string `min:"1" type:"string" required:"true"`
  4405. // The tags to attach to the secret. Each element in the list consists of a
  4406. // Key and a Value.
  4407. //
  4408. // This parameter to the API requires a JSON text string argument. For information
  4409. // on how to format a JSON parameter for the various command line tool environments,
  4410. // see Using JSON for Parameters (http://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json)
  4411. // in the AWS CLI User Guide. For the AWS CLI, you can also use the syntax:
  4412. // --Tags Key="Key1",Value="Value1",Key="Key2",Value="Value2"[,…]
  4413. //
  4414. // Tags is a required field
  4415. Tags []*Tag `type:"list" required:"true"`
  4416. }
  4417. // String returns the string representation
  4418. func (s TagResourceInput) String() string {
  4419. return awsutil.Prettify(s)
  4420. }
  4421. // GoString returns the string representation
  4422. func (s TagResourceInput) GoString() string {
  4423. return s.String()
  4424. }
  4425. // Validate inspects the fields of the type to determine if they are valid.
  4426. func (s *TagResourceInput) Validate() error {
  4427. invalidParams := request.ErrInvalidParams{Context: "TagResourceInput"}
  4428. if s.SecretId == nil {
  4429. invalidParams.Add(request.NewErrParamRequired("SecretId"))
  4430. }
  4431. if s.SecretId != nil && len(*s.SecretId) < 1 {
  4432. invalidParams.Add(request.NewErrParamMinLen("SecretId", 1))
  4433. }
  4434. if s.Tags == nil {
  4435. invalidParams.Add(request.NewErrParamRequired("Tags"))
  4436. }
  4437. if s.Tags != nil {
  4438. for i, v := range s.Tags {
  4439. if v == nil {
  4440. continue
  4441. }
  4442. if err := v.Validate(); err != nil {
  4443. invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams))
  4444. }
  4445. }
  4446. }
  4447. if invalidParams.Len() > 0 {
  4448. return invalidParams
  4449. }
  4450. return nil
  4451. }
  4452. // SetSecretId sets the SecretId field's value.
  4453. func (s *TagResourceInput) SetSecretId(v string) *TagResourceInput {
  4454. s.SecretId = &v
  4455. return s
  4456. }
  4457. // SetTags sets the Tags field's value.
  4458. func (s *TagResourceInput) SetTags(v []*Tag) *TagResourceInput {
  4459. s.Tags = v
  4460. return s
  4461. }
  4462. type TagResourceOutput struct {
  4463. _ struct{} `type:"structure"`
  4464. }
  4465. // String returns the string representation
  4466. func (s TagResourceOutput) String() string {
  4467. return awsutil.Prettify(s)
  4468. }
  4469. // GoString returns the string representation
  4470. func (s TagResourceOutput) GoString() string {
  4471. return s.String()
  4472. }
  4473. type UntagResourceInput struct {
  4474. _ struct{} `type:"structure"`
  4475. // The identifier for the secret that you want to remove tags from. You can
  4476. // specify either the Amazon Resource Name (ARN) or the friendly name of the
  4477. // secret.
  4478. //
  4479. // If you specify an ARN, we generally recommend that you specify a complete
  4480. // ARN. You can specify a partial ARN too—for example, if you don’t include
  4481. // the final hyphen and six random characters that Secrets Manager adds at the
  4482. // end of the ARN when you created the secret. A partial ARN match can work
  4483. // as long as it uniquely matches only one secret. However, if your secret has
  4484. // a name that ends in a hyphen followed by six characters (before Secrets Manager
  4485. // adds the hyphen and six characters to the ARN) and you try to use that as
  4486. // a partial ARN, then those characters cause Secrets Manager to assume that
  4487. // you’re specifying a complete ARN. This confusion can cause unexpected results.
  4488. // To avoid this situation, we recommend that you don’t create secret names
  4489. // that end with a hyphen followed by six characters.
  4490. //
  4491. // SecretId is a required field
  4492. SecretId *string `min:"1" type:"string" required:"true"`
  4493. // A list of tag key names to remove from the secret. You don't specify the
  4494. // value. Both the key and its associated value are removed.
  4495. //
  4496. // This parameter to the API requires a JSON text string argument. For information
  4497. // on how to format a JSON parameter for the various command line tool environments,
  4498. // see Using JSON for Parameters (http://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json)
  4499. // in the AWS CLI User Guide.
  4500. //
  4501. // TagKeys is a required field
  4502. TagKeys []*string `type:"list" required:"true"`
  4503. }
  4504. // String returns the string representation
  4505. func (s UntagResourceInput) String() string {
  4506. return awsutil.Prettify(s)
  4507. }
  4508. // GoString returns the string representation
  4509. func (s UntagResourceInput) GoString() string {
  4510. return s.String()
  4511. }
  4512. // Validate inspects the fields of the type to determine if they are valid.
  4513. func (s *UntagResourceInput) Validate() error {
  4514. invalidParams := request.ErrInvalidParams{Context: "UntagResourceInput"}
  4515. if s.SecretId == nil {
  4516. invalidParams.Add(request.NewErrParamRequired("SecretId"))
  4517. }
  4518. if s.SecretId != nil && len(*s.SecretId) < 1 {
  4519. invalidParams.Add(request.NewErrParamMinLen("SecretId", 1))
  4520. }
  4521. if s.TagKeys == nil {
  4522. invalidParams.Add(request.NewErrParamRequired("TagKeys"))
  4523. }
  4524. if invalidParams.Len() > 0 {
  4525. return invalidParams
  4526. }
  4527. return nil
  4528. }
  4529. // SetSecretId sets the SecretId field's value.
  4530. func (s *UntagResourceInput) SetSecretId(v string) *UntagResourceInput {
  4531. s.SecretId = &v
  4532. return s
  4533. }
  4534. // SetTagKeys sets the TagKeys field's value.
  4535. func (s *UntagResourceInput) SetTagKeys(v []*string) *UntagResourceInput {
  4536. s.TagKeys = v
  4537. return s
  4538. }
  4539. type UntagResourceOutput struct {
  4540. _ struct{} `type:"structure"`
  4541. }
  4542. // String returns the string representation
  4543. func (s UntagResourceOutput) String() string {
  4544. return awsutil.Prettify(s)
  4545. }
  4546. // GoString returns the string representation
  4547. func (s UntagResourceOutput) GoString() string {
  4548. return s.String()
  4549. }
  4550. type UpdateSecretInput struct {
  4551. _ struct{} `type:"structure"`
  4552. // (Optional) If you want to add a new version to the secret, this parameter
  4553. // specifies a unique identifier for the new version that helps ensure idempotency.
  4554. //
  4555. // If you use the AWS CLI or one of the AWS SDK to call this operation, then
  4556. // you can leave this parameter empty. The CLI or SDK generates a random UUID
  4557. // for you and includes that in the request. If you don't use the SDK and instead
  4558. // generate a raw HTTP request to the Secrets Manager service endpoint, then
  4559. // you must generate a ClientRequestToken yourself for new versions and include
  4560. // that value in the request.
  4561. //
  4562. // You typically only need to interact with this value if you implement your
  4563. // own retry logic and want to ensure that a given secret is not created twice.
  4564. // We recommend that you generate a UUID-type (https://wikipedia.org/wiki/Universally_unique_identifier)
  4565. // value to ensure uniqueness within the specified secret.
  4566. //
  4567. // Secrets Manager uses this value to prevent the accidental creation of duplicate
  4568. // versions if there are failures and retries during the Lambda rotation function's
  4569. // processing.
  4570. //
  4571. // * If the ClientRequestToken value isn't already associated with a version
  4572. // of the secret then a new version of the secret is created.
  4573. //
  4574. // * If a version with this value already exists and that version's SecretString
  4575. // and SecretBinary values are the same as those in the request then the
  4576. // request is ignored (the operation is idempotent).
  4577. //
  4578. // * If a version with this value already exists and that version's SecretString
  4579. // and SecretBinary values are different from the request then an error occurs
  4580. // because you cannot modify an existing secret value.
  4581. //
  4582. // This value becomes the VersionId of the new version.
  4583. ClientRequestToken *string `min:"32" type:"string" idempotencyToken:"true"`
  4584. // (Optional) Specifies an updated user-provided description of the secret.
  4585. Description *string `type:"string"`
  4586. // (Optional) Specifies an updated ARN or alias of the AWS KMS customer master
  4587. // key (CMK) to be used to encrypt the protected text in new versions of this
  4588. // secret.
  4589. //
  4590. // You can only use the account's default CMK to encrypt and decrypt if you
  4591. // call this operation using credentials from the same account that owns the
  4592. // secret. If the secret is in a different account, then you must create a custom
  4593. // CMK and provide the ARN of that CMK in this field. The user making the call
  4594. // must have permissions to both the secret and the CMK in their respective
  4595. // accounts.
  4596. KmsKeyId *string `type:"string"`
  4597. // (Optional) Specifies updated binary data that you want to encrypt and store
  4598. // in the new version of the secret. To use this parameter in the command-line
  4599. // tools, we recommend that you store your binary data in a file and then use
  4600. // the appropriate technique for your tool to pass the contents of the file
  4601. // as a parameter. Either SecretBinary or SecretString must have a value, but
  4602. // not both. They cannot both be empty.
  4603. //
  4604. // This parameter is not accessible using the Secrets Manager console.
  4605. //
  4606. // SecretBinary is automatically base64 encoded/decoded by the SDK.
  4607. SecretBinary []byte `type:"blob" sensitive:"true"`
  4608. // Specifies the secret that you want to modify or to which you want to add
  4609. // a new version. You can specify either the Amazon Resource Name (ARN) or the
  4610. // friendly name of the secret.
  4611. //
  4612. // If you specify an ARN, we generally recommend that you specify a complete
  4613. // ARN. You can specify a partial ARN too—for example, if you don’t include
  4614. // the final hyphen and six random characters that Secrets Manager adds at the
  4615. // end of the ARN when you created the secret. A partial ARN match can work
  4616. // as long as it uniquely matches only one secret. However, if your secret has
  4617. // a name that ends in a hyphen followed by six characters (before Secrets Manager
  4618. // adds the hyphen and six characters to the ARN) and you try to use that as
  4619. // a partial ARN, then those characters cause Secrets Manager to assume that
  4620. // you’re specifying a complete ARN. This confusion can cause unexpected results.
  4621. // To avoid this situation, we recommend that you don’t create secret names
  4622. // that end with a hyphen followed by six characters.
  4623. //
  4624. // SecretId is a required field
  4625. SecretId *string `min:"1" type:"string" required:"true"`
  4626. // (Optional) Specifies updated text data that you want to encrypt and store
  4627. // in this new version of the secret. Either SecretBinary or SecretString must
  4628. // have a value, but not both. They cannot both be empty.
  4629. //
  4630. // If you create this secret by using the Secrets Manager console then Secrets
  4631. // Manager puts the protected secret text in only the SecretString parameter.
  4632. // The Secrets Manager console stores the information as a JSON structure of
  4633. // key/value pairs that the default Lambda rotation function knows how to parse.
  4634. //
  4635. // For storing multiple values, we recommend that you use a JSON text string
  4636. // argument and specify key/value pairs. For information on how to format a
  4637. // JSON parameter for the various command line tool environments, see Using
  4638. // JSON for Parameters (http://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json)
  4639. // in the AWS CLI User Guide. For example:
  4640. //
  4641. // [{"username":"bob"},{"password":"abc123xyz456"}]
  4642. //
  4643. // If your command-line tool or SDK requires quotation marks around the parameter,
  4644. // you should use single quotes to avoid confusion with the double quotes required
  4645. // in the JSON text. You can also 'escape' the double quote character in the
  4646. // embedded JSON text by prefacing each with a backslash. For example, the following
  4647. // string is surrounded by double-quotes. All of the embedded double quotes
  4648. // are escaped:
  4649. //
  4650. // "[{\"username\":\"bob\"},{\"password\":\"abc123xyz456\"}]"
  4651. SecretString *string `type:"string" sensitive:"true"`
  4652. }
  4653. // String returns the string representation
  4654. func (s UpdateSecretInput) String() string {
  4655. return awsutil.Prettify(s)
  4656. }
  4657. // GoString returns the string representation
  4658. func (s UpdateSecretInput) GoString() string {
  4659. return s.String()
  4660. }
  4661. // Validate inspects the fields of the type to determine if they are valid.
  4662. func (s *UpdateSecretInput) Validate() error {
  4663. invalidParams := request.ErrInvalidParams{Context: "UpdateSecretInput"}
  4664. if s.ClientRequestToken != nil && len(*s.ClientRequestToken) < 32 {
  4665. invalidParams.Add(request.NewErrParamMinLen("ClientRequestToken", 32))
  4666. }
  4667. if s.SecretId == nil {
  4668. invalidParams.Add(request.NewErrParamRequired("SecretId"))
  4669. }
  4670. if s.SecretId != nil && len(*s.SecretId) < 1 {
  4671. invalidParams.Add(request.NewErrParamMinLen("SecretId", 1))
  4672. }
  4673. if invalidParams.Len() > 0 {
  4674. return invalidParams
  4675. }
  4676. return nil
  4677. }
  4678. // SetClientRequestToken sets the ClientRequestToken field's value.
  4679. func (s *UpdateSecretInput) SetClientRequestToken(v string) *UpdateSecretInput {
  4680. s.ClientRequestToken = &v
  4681. return s
  4682. }
  4683. // SetDescription sets the Description field's value.
  4684. func (s *UpdateSecretInput) SetDescription(v string) *UpdateSecretInput {
  4685. s.Description = &v
  4686. return s
  4687. }
  4688. // SetKmsKeyId sets the KmsKeyId field's value.
  4689. func (s *UpdateSecretInput) SetKmsKeyId(v string) *UpdateSecretInput {
  4690. s.KmsKeyId = &v
  4691. return s
  4692. }
  4693. // SetSecretBinary sets the SecretBinary field's value.
  4694. func (s *UpdateSecretInput) SetSecretBinary(v []byte) *UpdateSecretInput {
  4695. s.SecretBinary = v
  4696. return s
  4697. }
  4698. // SetSecretId sets the SecretId field's value.
  4699. func (s *UpdateSecretInput) SetSecretId(v string) *UpdateSecretInput {
  4700. s.SecretId = &v
  4701. return s
  4702. }
  4703. // SetSecretString sets the SecretString field's value.
  4704. func (s *UpdateSecretInput) SetSecretString(v string) *UpdateSecretInput {
  4705. s.SecretString = &v
  4706. return s
  4707. }
  4708. type UpdateSecretOutput struct {
  4709. _ struct{} `type:"structure"`
  4710. // The ARN of the secret that was updated.
  4711. //
  4712. // Secrets Manager automatically adds several random characters to the name
  4713. // at the end of the ARN when you initially create a secret. This affects only
  4714. // the ARN and not the actual friendly name. This ensures that if you create
  4715. // a new secret with the same name as an old secret that you previously deleted,
  4716. // then users with access to the old secret don't automatically get access to
  4717. // the new secret because the ARNs are different.
  4718. ARN *string `min:"20" type:"string"`
  4719. // The friendly name of the secret that was updated.
  4720. Name *string `min:"1" type:"string"`
  4721. // If a new version of the secret was created by this operation, then VersionId
  4722. // contains the unique identifier of the new version.
  4723. VersionId *string `min:"32" type:"string"`
  4724. }
  4725. // String returns the string representation
  4726. func (s UpdateSecretOutput) String() string {
  4727. return awsutil.Prettify(s)
  4728. }
  4729. // GoString returns the string representation
  4730. func (s UpdateSecretOutput) GoString() string {
  4731. return s.String()
  4732. }
  4733. // SetARN sets the ARN field's value.
  4734. func (s *UpdateSecretOutput) SetARN(v string) *UpdateSecretOutput {
  4735. s.ARN = &v
  4736. return s
  4737. }
  4738. // SetName sets the Name field's value.
  4739. func (s *UpdateSecretOutput) SetName(v string) *UpdateSecretOutput {
  4740. s.Name = &v
  4741. return s
  4742. }
  4743. // SetVersionId sets the VersionId field's value.
  4744. func (s *UpdateSecretOutput) SetVersionId(v string) *UpdateSecretOutput {
  4745. s.VersionId = &v
  4746. return s
  4747. }
  4748. type UpdateSecretVersionStageInput struct {
  4749. _ struct{} `type:"structure"`
  4750. // (Optional) The secret version ID that you want to add the staging label to.
  4751. // If you want to remove a label from a version, then do not specify this parameter.
  4752. //
  4753. // If the staging label is already attached to a different version of the secret,
  4754. // then you must also specify the RemoveFromVersionId parameter.
  4755. MoveToVersionId *string `min:"32" type:"string"`
  4756. // Specifies the secret version ID of the version that the staging label is
  4757. // to be removed from. If the staging label you are trying to attach to one
  4758. // version is already attached to a different version, then you must include
  4759. // this parameter and specify the version that the label is to be removed from.
  4760. // If the label is attached and you either do not specify this parameter, or
  4761. // the version ID does not match, then the operation fails.
  4762. RemoveFromVersionId *string `min:"32" type:"string"`
  4763. // Specifies the secret with the version whose list of staging labels you want
  4764. // to modify. You can specify either the Amazon Resource Name (ARN) or the friendly
  4765. // name of the secret.
  4766. //
  4767. // If you specify an ARN, we generally recommend that you specify a complete
  4768. // ARN. You can specify a partial ARN too—for example, if you don’t include
  4769. // the final hyphen and six random characters that Secrets Manager adds at the
  4770. // end of the ARN when you created the secret. A partial ARN match can work
  4771. // as long as it uniquely matches only one secret. However, if your secret has
  4772. // a name that ends in a hyphen followed by six characters (before Secrets Manager
  4773. // adds the hyphen and six characters to the ARN) and you try to use that as
  4774. // a partial ARN, then those characters cause Secrets Manager to assume that
  4775. // you’re specifying a complete ARN. This confusion can cause unexpected results.
  4776. // To avoid this situation, we recommend that you don’t create secret names
  4777. // that end with a hyphen followed by six characters.
  4778. //
  4779. // SecretId is a required field
  4780. SecretId *string `min:"1" type:"string" required:"true"`
  4781. // The staging label to add to this version.
  4782. //
  4783. // VersionStage is a required field
  4784. VersionStage *string `min:"1" type:"string" required:"true"`
  4785. }
  4786. // String returns the string representation
  4787. func (s UpdateSecretVersionStageInput) String() string {
  4788. return awsutil.Prettify(s)
  4789. }
  4790. // GoString returns the string representation
  4791. func (s UpdateSecretVersionStageInput) GoString() string {
  4792. return s.String()
  4793. }
  4794. // Validate inspects the fields of the type to determine if they are valid.
  4795. func (s *UpdateSecretVersionStageInput) Validate() error {
  4796. invalidParams := request.ErrInvalidParams{Context: "UpdateSecretVersionStageInput"}
  4797. if s.MoveToVersionId != nil && len(*s.MoveToVersionId) < 32 {
  4798. invalidParams.Add(request.NewErrParamMinLen("MoveToVersionId", 32))
  4799. }
  4800. if s.RemoveFromVersionId != nil && len(*s.RemoveFromVersionId) < 32 {
  4801. invalidParams.Add(request.NewErrParamMinLen("RemoveFromVersionId", 32))
  4802. }
  4803. if s.SecretId == nil {
  4804. invalidParams.Add(request.NewErrParamRequired("SecretId"))
  4805. }
  4806. if s.SecretId != nil && len(*s.SecretId) < 1 {
  4807. invalidParams.Add(request.NewErrParamMinLen("SecretId", 1))
  4808. }
  4809. if s.VersionStage == nil {
  4810. invalidParams.Add(request.NewErrParamRequired("VersionStage"))
  4811. }
  4812. if s.VersionStage != nil && len(*s.VersionStage) < 1 {
  4813. invalidParams.Add(request.NewErrParamMinLen("VersionStage", 1))
  4814. }
  4815. if invalidParams.Len() > 0 {
  4816. return invalidParams
  4817. }
  4818. return nil
  4819. }
  4820. // SetMoveToVersionId sets the MoveToVersionId field's value.
  4821. func (s *UpdateSecretVersionStageInput) SetMoveToVersionId(v string) *UpdateSecretVersionStageInput {
  4822. s.MoveToVersionId = &v
  4823. return s
  4824. }
  4825. // SetRemoveFromVersionId sets the RemoveFromVersionId field's value.
  4826. func (s *UpdateSecretVersionStageInput) SetRemoveFromVersionId(v string) *UpdateSecretVersionStageInput {
  4827. s.RemoveFromVersionId = &v
  4828. return s
  4829. }
  4830. // SetSecretId sets the SecretId field's value.
  4831. func (s *UpdateSecretVersionStageInput) SetSecretId(v string) *UpdateSecretVersionStageInput {
  4832. s.SecretId = &v
  4833. return s
  4834. }
  4835. // SetVersionStage sets the VersionStage field's value.
  4836. func (s *UpdateSecretVersionStageInput) SetVersionStage(v string) *UpdateSecretVersionStageInput {
  4837. s.VersionStage = &v
  4838. return s
  4839. }
  4840. type UpdateSecretVersionStageOutput struct {
  4841. _ struct{} `type:"structure"`
  4842. // The ARN of the secret with the staging label that was modified.
  4843. ARN *string `min:"20" type:"string"`
  4844. // The friendly name of the secret with the staging label that was modified.
  4845. Name *string `min:"1" type:"string"`
  4846. }
  4847. // String returns the string representation
  4848. func (s UpdateSecretVersionStageOutput) String() string {
  4849. return awsutil.Prettify(s)
  4850. }
  4851. // GoString returns the string representation
  4852. func (s UpdateSecretVersionStageOutput) GoString() string {
  4853. return s.String()
  4854. }
  4855. // SetARN sets the ARN field's value.
  4856. func (s *UpdateSecretVersionStageOutput) SetARN(v string) *UpdateSecretVersionStageOutput {
  4857. s.ARN = &v
  4858. return s
  4859. }
  4860. // SetName sets the Name field's value.
  4861. func (s *UpdateSecretVersionStageOutput) SetName(v string) *UpdateSecretVersionStageOutput {
  4862. s.Name = &v
  4863. return s
  4864. }