api.go 379 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217
  1. // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
  2. package kms
  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 opCancelKeyDeletion = "CancelKeyDeletion"
  13. // CancelKeyDeletionRequest generates a "aws/request.Request" representing the
  14. // client's request for the CancelKeyDeletion 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 CancelKeyDeletion for more information on using the CancelKeyDeletion
  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 CancelKeyDeletionRequest method.
  29. // req, resp := client.CancelKeyDeletionRequest(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/kms-2014-11-01/CancelKeyDeletion
  37. func (c *KMS) CancelKeyDeletionRequest(input *CancelKeyDeletionInput) (req *request.Request, output *CancelKeyDeletionOutput) {
  38. op := &request.Operation{
  39. Name: opCancelKeyDeletion,
  40. HTTPMethod: "POST",
  41. HTTPPath: "/",
  42. }
  43. if input == nil {
  44. input = &CancelKeyDeletionInput{}
  45. }
  46. output = &CancelKeyDeletionOutput{}
  47. req = c.newRequest(op, input, output)
  48. return
  49. }
  50. // CancelKeyDeletion API operation for AWS Key Management Service.
  51. //
  52. // Cancels the deletion of a customer master key (CMK). When this operation
  53. // is successful, the CMK is set to the Disabled state. To enable a CMK, use
  54. // EnableKey. You cannot perform this operation on a CMK in a different AWS
  55. // account.
  56. //
  57. // For more information about scheduling and canceling deletion of a CMK, see
  58. // Deleting Customer Master Keys (http://docs.aws.amazon.com/kms/latest/developerguide/deleting-keys.html)
  59. // in the AWS Key Management Service Developer Guide.
  60. //
  61. // The result of this operation varies with the key state of the CMK. For details,
  62. // see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  63. // in the AWS Key Management Service Developer Guide.
  64. //
  65. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  66. // with awserr.Error's Code and Message methods to get detailed information about
  67. // the error.
  68. //
  69. // See the AWS API reference guide for AWS Key Management Service's
  70. // API operation CancelKeyDeletion for usage and error information.
  71. //
  72. // Returned Error Codes:
  73. // * ErrCodeNotFoundException "NotFoundException"
  74. // The request was rejected because the specified entity or resource could not
  75. // be found.
  76. //
  77. // * ErrCodeInvalidArnException "InvalidArnException"
  78. // The request was rejected because a specified ARN was not valid.
  79. //
  80. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  81. // The system timed out while trying to fulfill the request. The request can
  82. // be retried.
  83. //
  84. // * ErrCodeInternalException "KMSInternalException"
  85. // The request was rejected because an internal exception occurred. The request
  86. // can be retried.
  87. //
  88. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  89. // The request was rejected because the state of the specified resource is not
  90. // valid for this request.
  91. //
  92. // For more information about how key state affects the use of a CMK, see How
  93. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  94. // in the AWS Key Management Service Developer Guide.
  95. //
  96. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CancelKeyDeletion
  97. func (c *KMS) CancelKeyDeletion(input *CancelKeyDeletionInput) (*CancelKeyDeletionOutput, error) {
  98. req, out := c.CancelKeyDeletionRequest(input)
  99. return out, req.Send()
  100. }
  101. // CancelKeyDeletionWithContext is the same as CancelKeyDeletion with the addition of
  102. // the ability to pass a context and additional request options.
  103. //
  104. // See CancelKeyDeletion for details on how to use this API operation.
  105. //
  106. // The context must be non-nil and will be used for request cancellation. If
  107. // the context is nil a panic will occur. In the future the SDK may create
  108. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  109. // for more information on using Contexts.
  110. func (c *KMS) CancelKeyDeletionWithContext(ctx aws.Context, input *CancelKeyDeletionInput, opts ...request.Option) (*CancelKeyDeletionOutput, error) {
  111. req, out := c.CancelKeyDeletionRequest(input)
  112. req.SetContext(ctx)
  113. req.ApplyOptions(opts...)
  114. return out, req.Send()
  115. }
  116. const opConnectCustomKeyStore = "ConnectCustomKeyStore"
  117. // ConnectCustomKeyStoreRequest generates a "aws/request.Request" representing the
  118. // client's request for the ConnectCustomKeyStore operation. The "output" return
  119. // value will be populated with the request's response once the request completes
  120. // successfully.
  121. //
  122. // Use "Send" method on the returned Request to send the API call to the service.
  123. // the "output" return value is not valid until after Send returns without error.
  124. //
  125. // See ConnectCustomKeyStore for more information on using the ConnectCustomKeyStore
  126. // API call, and error handling.
  127. //
  128. // This method is useful when you want to inject custom logic or configuration
  129. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  130. //
  131. //
  132. // // Example sending a request using the ConnectCustomKeyStoreRequest method.
  133. // req, resp := client.ConnectCustomKeyStoreRequest(params)
  134. //
  135. // err := req.Send()
  136. // if err == nil { // resp is now filled
  137. // fmt.Println(resp)
  138. // }
  139. //
  140. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ConnectCustomKeyStore
  141. func (c *KMS) ConnectCustomKeyStoreRequest(input *ConnectCustomKeyStoreInput) (req *request.Request, output *ConnectCustomKeyStoreOutput) {
  142. op := &request.Operation{
  143. Name: opConnectCustomKeyStore,
  144. HTTPMethod: "POST",
  145. HTTPPath: "/",
  146. }
  147. if input == nil {
  148. input = &ConnectCustomKeyStoreInput{}
  149. }
  150. output = &ConnectCustomKeyStoreOutput{}
  151. req = c.newRequest(op, input, output)
  152. req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
  153. return
  154. }
  155. // ConnectCustomKeyStore API operation for AWS Key Management Service.
  156. //
  157. // Connects or reconnects a custom key store (http://docs.aws.amazon.com/kms/latest/developerguide/key-store-overview.html)
  158. // to its associated AWS CloudHSM cluster.
  159. //
  160. // The custom key store must be connected before you can create customer master
  161. // keys (CMKs) in the key store or use the CMKs it contains. You can disconnect
  162. // and reconnect a custom key store at any time.
  163. //
  164. // To connect a custom key store, its associated AWS CloudHSM cluster must have
  165. // at least one active HSM. To get the number of active HSMs in a cluster, use
  166. // the DescribeClusters (http://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters)
  167. // operation. To add HSMs to the cluster, use the CreateHsm (http://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_CreateHsm)
  168. // operation.
  169. //
  170. // The connection process can take an extended amount of time to complete; up
  171. // to 20 minutes. This operation starts the connection process, but it does
  172. // not wait for it to complete. When it succeeds, this operation quickly returns
  173. // an HTTP 200 response and a JSON object with no properties. However, this
  174. // response does not indicate that the custom key store is connected. To get
  175. // the connection state of the custom key store, use the DescribeCustomKeyStores
  176. // operation.
  177. //
  178. // During the connection process, AWS KMS finds the AWS CloudHSM cluster that
  179. // is associated with the custom key store, creates the connection infrastructure,
  180. // connects to the cluster, logs into the AWS CloudHSM client as the kmsuser
  181. // (http://docs.aws.amazon.com/kms/latest/developerguide/key-store-concepts.html#concept-kmsuser)
  182. // crypto user (CU), and rotates its password.
  183. //
  184. // The ConnectCustomKeyStore operation might fail for various reasons. To find
  185. // the reason, use the DescribeCustomKeyStores operation and see the ConnectionErrorCode
  186. // in the response. For help interpreting the ConnectionErrorCode, see CustomKeyStoresListEntry.
  187. //
  188. // To fix the failure, use the DisconnectCustomKeyStore operation to disconnect
  189. // the custom key store, correct the error, use the UpdateCustomKeyStore operation
  190. // if necessary, and then use ConnectCustomKeyStore again.
  191. //
  192. // If you are having trouble connecting or disconnecting a custom key store,
  193. // see Troubleshooting a Custom Key Store (http://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html)
  194. // in the AWS Key Management Service Developer Guide.
  195. //
  196. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  197. // with awserr.Error's Code and Message methods to get detailed information about
  198. // the error.
  199. //
  200. // See the AWS API reference guide for AWS Key Management Service's
  201. // API operation ConnectCustomKeyStore for usage and error information.
  202. //
  203. // Returned Error Codes:
  204. // * ErrCodeCloudHsmClusterNotActiveException "CloudHsmClusterNotActiveException"
  205. // The request was rejected because the AWS CloudHSM cluster that is associated
  206. // with the custom key store is not active. Initialize and activate the cluster
  207. // and try the command again. For detailed instructions, see Getting Started
  208. // (http://docs.aws.amazon.com/cloudhsm/latest/userguide/getting-started.html)
  209. // in the AWS CloudHSM User Guide.
  210. //
  211. // * ErrCodeCustomKeyStoreInvalidStateException "CustomKeyStoreInvalidStateException"
  212. // The request was rejected because of the ConnectionState of the custom key
  213. // store. To get the ConnectionState of a custom key store, use the DescribeCustomKeyStores
  214. // operation.
  215. //
  216. // This exception is thrown under the following conditions:
  217. //
  218. // * You requested the CreateKey or GenerateRandom operation in a custom
  219. // key store that is not connected. These operations are valid only when
  220. // the custom key store ConnectionState is CONNECTED.
  221. //
  222. // * You requested the UpdateCustomKeyStore or DeleteCustomKeyStore operation
  223. // on a custom key store that is not disconnected. This operation is valid
  224. // only when the custom key store ConnectionState is DISCONNECTED.
  225. //
  226. // * You requested the ConnectCustomKeyStore operation on a custom key store
  227. // with a ConnectionState of DISCONNECTING or FAILED. This operation is valid
  228. // for all other ConnectionState values.
  229. //
  230. // * ErrCodeCustomKeyStoreNotFoundException "CustomKeyStoreNotFoundException"
  231. // The request was rejected because AWS KMS cannot find a custom key store with
  232. // the specified key store name or ID.
  233. //
  234. // * ErrCodeInternalException "KMSInternalException"
  235. // The request was rejected because an internal exception occurred. The request
  236. // can be retried.
  237. //
  238. // * ErrCodeCloudHsmClusterInvalidConfigurationException "CloudHsmClusterInvalidConfigurationException"
  239. // The request was rejected because the associated AWS CloudHSM cluster did
  240. // not meet the configuration requirements for a custom key store. The cluster
  241. // must be configured with private subnets in at least two different Availability
  242. // Zones in the Region. Also, it must contain at least as many HSMs as the operation
  243. // requires.
  244. //
  245. // For the CreateCustomKeyStore, UpdateCustomKeyStore, and CreateKey operations,
  246. // the AWS CloudHSM cluster must have at least two active HSMs, each in a different
  247. // Availability Zone. For the ConnectCustomKeyStore operation, the AWS CloudHSM
  248. // must contain at least one active HSM.
  249. //
  250. // For information about creating a private subnet for a AWS CloudHSM cluster,
  251. // see Create a Private Subnet (http://docs.aws.amazon.com/cloudhsm/latest/userguide/create-subnets.html)
  252. // in the AWS CloudHSM User Guide. To add HSMs, use the AWS CloudHSM CreateHsm
  253. // (http://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_CreateHsm.html)
  254. // operation.
  255. //
  256. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ConnectCustomKeyStore
  257. func (c *KMS) ConnectCustomKeyStore(input *ConnectCustomKeyStoreInput) (*ConnectCustomKeyStoreOutput, error) {
  258. req, out := c.ConnectCustomKeyStoreRequest(input)
  259. return out, req.Send()
  260. }
  261. // ConnectCustomKeyStoreWithContext is the same as ConnectCustomKeyStore with the addition of
  262. // the ability to pass a context and additional request options.
  263. //
  264. // See ConnectCustomKeyStore for details on how to use this API operation.
  265. //
  266. // The context must be non-nil and will be used for request cancellation. If
  267. // the context is nil a panic will occur. In the future the SDK may create
  268. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  269. // for more information on using Contexts.
  270. func (c *KMS) ConnectCustomKeyStoreWithContext(ctx aws.Context, input *ConnectCustomKeyStoreInput, opts ...request.Option) (*ConnectCustomKeyStoreOutput, error) {
  271. req, out := c.ConnectCustomKeyStoreRequest(input)
  272. req.SetContext(ctx)
  273. req.ApplyOptions(opts...)
  274. return out, req.Send()
  275. }
  276. const opCreateAlias = "CreateAlias"
  277. // CreateAliasRequest generates a "aws/request.Request" representing the
  278. // client's request for the CreateAlias operation. The "output" return
  279. // value will be populated with the request's response once the request completes
  280. // successfully.
  281. //
  282. // Use "Send" method on the returned Request to send the API call to the service.
  283. // the "output" return value is not valid until after Send returns without error.
  284. //
  285. // See CreateAlias for more information on using the CreateAlias
  286. // API call, and error handling.
  287. //
  288. // This method is useful when you want to inject custom logic or configuration
  289. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  290. //
  291. //
  292. // // Example sending a request using the CreateAliasRequest method.
  293. // req, resp := client.CreateAliasRequest(params)
  294. //
  295. // err := req.Send()
  296. // if err == nil { // resp is now filled
  297. // fmt.Println(resp)
  298. // }
  299. //
  300. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateAlias
  301. func (c *KMS) CreateAliasRequest(input *CreateAliasInput) (req *request.Request, output *CreateAliasOutput) {
  302. op := &request.Operation{
  303. Name: opCreateAlias,
  304. HTTPMethod: "POST",
  305. HTTPPath: "/",
  306. }
  307. if input == nil {
  308. input = &CreateAliasInput{}
  309. }
  310. output = &CreateAliasOutput{}
  311. req = c.newRequest(op, input, output)
  312. req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
  313. return
  314. }
  315. // CreateAlias API operation for AWS Key Management Service.
  316. //
  317. // Creates a display name for a customer master key (CMK). You can use an alias
  318. // to identify a CMK in selected operations, such as Encrypt and GenerateDataKey.
  319. //
  320. // Each CMK can have multiple aliases, but each alias points to only one CMK.
  321. // The alias name must be unique in the AWS account and region. To simplify
  322. // code that runs in multiple regions, use the same alias name, but point it
  323. // to a different CMK in each region.
  324. //
  325. // Because an alias is not a property of a CMK, you can delete and change the
  326. // aliases of a CMK without affecting the CMK. Also, aliases do not appear in
  327. // the response from the DescribeKey operation. To get the aliases of all CMKs,
  328. // use the ListAliases operation.
  329. //
  330. // An alias must start with the word alias followed by a forward slash (alias/).
  331. // The alias name can contain only alphanumeric characters, forward slashes
  332. // (/), underscores (_), and dashes (-). Alias names cannot begin with aws;
  333. // that alias name prefix is reserved by Amazon Web Services (AWS).
  334. //
  335. // The alias and the CMK it is mapped to must be in the same AWS account and
  336. // the same region. You cannot perform this operation on an alias in a different
  337. // AWS account.
  338. //
  339. // To map an existing alias to a different CMK, call UpdateAlias.
  340. //
  341. // The result of this operation varies with the key state of the CMK. For details,
  342. // see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  343. // in the AWS Key Management Service Developer Guide.
  344. //
  345. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  346. // with awserr.Error's Code and Message methods to get detailed information about
  347. // the error.
  348. //
  349. // See the AWS API reference guide for AWS Key Management Service's
  350. // API operation CreateAlias for usage and error information.
  351. //
  352. // Returned Error Codes:
  353. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  354. // The system timed out while trying to fulfill the request. The request can
  355. // be retried.
  356. //
  357. // * ErrCodeAlreadyExistsException "AlreadyExistsException"
  358. // The request was rejected because it attempted to create a resource that already
  359. // exists.
  360. //
  361. // * ErrCodeNotFoundException "NotFoundException"
  362. // The request was rejected because the specified entity or resource could not
  363. // be found.
  364. //
  365. // * ErrCodeInvalidAliasNameException "InvalidAliasNameException"
  366. // The request was rejected because the specified alias name is not valid.
  367. //
  368. // * ErrCodeInternalException "KMSInternalException"
  369. // The request was rejected because an internal exception occurred. The request
  370. // can be retried.
  371. //
  372. // * ErrCodeLimitExceededException "LimitExceededException"
  373. // The request was rejected because a limit was exceeded. For more information,
  374. // see Limits (http://docs.aws.amazon.com/kms/latest/developerguide/limits.html)
  375. // in the AWS Key Management Service Developer Guide.
  376. //
  377. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  378. // The request was rejected because the state of the specified resource is not
  379. // valid for this request.
  380. //
  381. // For more information about how key state affects the use of a CMK, see How
  382. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  383. // in the AWS Key Management Service Developer Guide.
  384. //
  385. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateAlias
  386. func (c *KMS) CreateAlias(input *CreateAliasInput) (*CreateAliasOutput, error) {
  387. req, out := c.CreateAliasRequest(input)
  388. return out, req.Send()
  389. }
  390. // CreateAliasWithContext is the same as CreateAlias with the addition of
  391. // the ability to pass a context and additional request options.
  392. //
  393. // See CreateAlias for details on how to use this API operation.
  394. //
  395. // The context must be non-nil and will be used for request cancellation. If
  396. // the context is nil a panic will occur. In the future the SDK may create
  397. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  398. // for more information on using Contexts.
  399. func (c *KMS) CreateAliasWithContext(ctx aws.Context, input *CreateAliasInput, opts ...request.Option) (*CreateAliasOutput, error) {
  400. req, out := c.CreateAliasRequest(input)
  401. req.SetContext(ctx)
  402. req.ApplyOptions(opts...)
  403. return out, req.Send()
  404. }
  405. const opCreateCustomKeyStore = "CreateCustomKeyStore"
  406. // CreateCustomKeyStoreRequest generates a "aws/request.Request" representing the
  407. // client's request for the CreateCustomKeyStore operation. The "output" return
  408. // value will be populated with the request's response once the request completes
  409. // successfully.
  410. //
  411. // Use "Send" method on the returned Request to send the API call to the service.
  412. // the "output" return value is not valid until after Send returns without error.
  413. //
  414. // See CreateCustomKeyStore for more information on using the CreateCustomKeyStore
  415. // API call, and error handling.
  416. //
  417. // This method is useful when you want to inject custom logic or configuration
  418. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  419. //
  420. //
  421. // // Example sending a request using the CreateCustomKeyStoreRequest method.
  422. // req, resp := client.CreateCustomKeyStoreRequest(params)
  423. //
  424. // err := req.Send()
  425. // if err == nil { // resp is now filled
  426. // fmt.Println(resp)
  427. // }
  428. //
  429. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateCustomKeyStore
  430. func (c *KMS) CreateCustomKeyStoreRequest(input *CreateCustomKeyStoreInput) (req *request.Request, output *CreateCustomKeyStoreOutput) {
  431. op := &request.Operation{
  432. Name: opCreateCustomKeyStore,
  433. HTTPMethod: "POST",
  434. HTTPPath: "/",
  435. }
  436. if input == nil {
  437. input = &CreateCustomKeyStoreInput{}
  438. }
  439. output = &CreateCustomKeyStoreOutput{}
  440. req = c.newRequest(op, input, output)
  441. return
  442. }
  443. // CreateCustomKeyStore API operation for AWS Key Management Service.
  444. //
  445. // Creates a custom key store (http://docs.aws.amazon.com/kms/latest/developerguide/key-store-overview.html)
  446. // that is associated with an AWS CloudHSM cluster (http://docs.aws.amazon.com/cloudhsm/latest/userguide/clusters.html)
  447. // that you own and manage.
  448. //
  449. // This operation is part of the Custom Key Store feature (http://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html)
  450. // feature in AWS KMS, which combines the convenience and extensive integration
  451. // of AWS KMS with the isolation and control of a single-tenant key store.
  452. //
  453. // When the operation completes successfully, it returns the ID of the new custom
  454. // key store. Before you can use your new custom key store, you need to use
  455. // the ConnectCustomKeyStore operation to connect the new key store to its AWS
  456. // CloudHSM cluster.
  457. //
  458. // The CreateCustomKeyStore operation requires the following elements.
  459. //
  460. // * You must specify an active AWS CloudHSM cluster in the same account
  461. // and AWS Region as the custom key store. You can use an existing cluster
  462. // or create and activate a new AWS CloudHSM cluster (http://docs.aws.amazon.com/cloudhsm/latest/userguide/create-cluster.html)
  463. // for the key store. AWS KMS does not require exclusive use of the cluster.
  464. //
  465. // * You must include the content of the trust anchor certificate for the
  466. // cluster. You created this certificate, and saved it in the customerCA.crt
  467. // file, when you initialized the cluster (http://docs.aws.amazon.com/cloudhsm/latest/userguide/initialize-cluster.html#sign-csr).
  468. //
  469. // * You must provide the password of the dedicated kmsuser (http://docs.aws.amazon.com/kms/latest/developerguide/key-store-concepts.html#concept-kmsuser)
  470. // crypto user (CU) account in the cluster.
  471. //
  472. // Before you create the custom key store, use the createUser (http://docs.aws.amazon.com/cloudhsm/latest/userguide/cloudhsm_mgmt_util-createUser.html)
  473. // command in cloudhsm_mgmt_util to create a crypto user (CU) named (http://docs.aws.amazon.com/kms/latest/developerguide/key-store-concepts.html#concept-kmsuser)kmsuserin
  474. // specified AWS CloudHSM cluster. AWS KMS uses the kmsuser CU account to
  475. // create and manage key material on your behalf. For instructions, see Create
  476. // the kmsuser Crypto User (http://docs.aws.amazon.com/kms/latest/developerguide/create-keystore.html#before-keystore)
  477. // in the AWS Key Management Service Developer Guide.
  478. //
  479. // The AWS CloudHSM cluster that you specify must meet the following requirements.
  480. //
  481. // * The cluster must be active and be in the same AWS account and Region
  482. // as the custom key store.
  483. //
  484. // * Each custom key store must be associated with a different AWS CloudHSM
  485. // cluster. The cluster cannot be associated with another custom key store
  486. // or have the same cluster certificate as a cluster that is associated with
  487. // another custom key store. To view the cluster certificate, use the AWS
  488. // CloudHSM DescribeClusters (http://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html)
  489. // operation. Clusters that share a backup history have the same cluster
  490. // certificate.
  491. //
  492. // * The cluster must be configured with subnets in at least two different
  493. // Availability Zones in the Region. Because AWS CloudHSM is not supported
  494. // in all Availability Zones, we recommend that the cluster have subnets
  495. // in all Availability Zones in the Region.
  496. //
  497. // * The cluster must contain at least two active HSMs, each in a different
  498. // Availability Zone.
  499. //
  500. // New custom key stores are not automatically connected. After you create your
  501. // custom key store, use the ConnectCustomKeyStore operation to connect the
  502. // custom key store to its associated AWS CloudHSM cluster. Even if you are
  503. // not going to use your custom key store immediately, you might want to connect
  504. // it to verify that all settings are correct and then disconnect it until you
  505. // are ready to use it.
  506. //
  507. // If this operation succeeds, it returns the ID of the new custom key store.
  508. // For help with failures, see Troubleshoot a Custom Key Store (http://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html)
  509. // in the AWS KMS Developer Guide.
  510. //
  511. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  512. // with awserr.Error's Code and Message methods to get detailed information about
  513. // the error.
  514. //
  515. // See the AWS API reference guide for AWS Key Management Service's
  516. // API operation CreateCustomKeyStore for usage and error information.
  517. //
  518. // Returned Error Codes:
  519. // * ErrCodeCloudHsmClusterInUseException "CloudHsmClusterInUseException"
  520. // The request was rejected because the specified AWS CloudHSM cluster is already
  521. // associated with a custom key store or it shares a backup history with a cluster
  522. // that is associated with a custom key store. Each custom key store must be
  523. // associated with a different AWS CloudHSM cluster.
  524. //
  525. // Clusters that share a backup history have the same cluster certificate. To
  526. // view the cluster certificate of a cluster, use the DescribeClusters (http://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html)
  527. // operation.
  528. //
  529. // * ErrCodeCustomKeyStoreNameInUseException "CustomKeyStoreNameInUseException"
  530. // The request was rejected because the specified custom key store name is already
  531. // assigned to another custom key store in the account. Try again with a custom
  532. // key store name that is unique in the account.
  533. //
  534. // * ErrCodeCloudHsmClusterNotFoundException "CloudHsmClusterNotFoundException"
  535. // The request was rejected because AWS KMS cannot find the AWS CloudHSM cluster
  536. // with the specified cluster ID. Retry the request with a different cluster
  537. // ID.
  538. //
  539. // * ErrCodeInternalException "KMSInternalException"
  540. // The request was rejected because an internal exception occurred. The request
  541. // can be retried.
  542. //
  543. // * ErrCodeCloudHsmClusterNotActiveException "CloudHsmClusterNotActiveException"
  544. // The request was rejected because the AWS CloudHSM cluster that is associated
  545. // with the custom key store is not active. Initialize and activate the cluster
  546. // and try the command again. For detailed instructions, see Getting Started
  547. // (http://docs.aws.amazon.com/cloudhsm/latest/userguide/getting-started.html)
  548. // in the AWS CloudHSM User Guide.
  549. //
  550. // * ErrCodeIncorrectTrustAnchorException "IncorrectTrustAnchorException"
  551. // The request was rejected because the trust anchor certificate in the request
  552. // is not the trust anchor certificate for the specified AWS CloudHSM cluster.
  553. //
  554. // When you initialize the cluster (http://docs.aws.amazon.com/cloudhsm/latest/userguide/initialize-cluster.html#sign-csr),
  555. // you create the trust anchor certificate and save it in the customerCA.crt
  556. // file.
  557. //
  558. // * ErrCodeCloudHsmClusterInvalidConfigurationException "CloudHsmClusterInvalidConfigurationException"
  559. // The request was rejected because the associated AWS CloudHSM cluster did
  560. // not meet the configuration requirements for a custom key store. The cluster
  561. // must be configured with private subnets in at least two different Availability
  562. // Zones in the Region. Also, it must contain at least as many HSMs as the operation
  563. // requires.
  564. //
  565. // For the CreateCustomKeyStore, UpdateCustomKeyStore, and CreateKey operations,
  566. // the AWS CloudHSM cluster must have at least two active HSMs, each in a different
  567. // Availability Zone. For the ConnectCustomKeyStore operation, the AWS CloudHSM
  568. // must contain at least one active HSM.
  569. //
  570. // For information about creating a private subnet for a AWS CloudHSM cluster,
  571. // see Create a Private Subnet (http://docs.aws.amazon.com/cloudhsm/latest/userguide/create-subnets.html)
  572. // in the AWS CloudHSM User Guide. To add HSMs, use the AWS CloudHSM CreateHsm
  573. // (http://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_CreateHsm.html)
  574. // operation.
  575. //
  576. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateCustomKeyStore
  577. func (c *KMS) CreateCustomKeyStore(input *CreateCustomKeyStoreInput) (*CreateCustomKeyStoreOutput, error) {
  578. req, out := c.CreateCustomKeyStoreRequest(input)
  579. return out, req.Send()
  580. }
  581. // CreateCustomKeyStoreWithContext is the same as CreateCustomKeyStore with the addition of
  582. // the ability to pass a context and additional request options.
  583. //
  584. // See CreateCustomKeyStore for details on how to use this API operation.
  585. //
  586. // The context must be non-nil and will be used for request cancellation. If
  587. // the context is nil a panic will occur. In the future the SDK may create
  588. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  589. // for more information on using Contexts.
  590. func (c *KMS) CreateCustomKeyStoreWithContext(ctx aws.Context, input *CreateCustomKeyStoreInput, opts ...request.Option) (*CreateCustomKeyStoreOutput, error) {
  591. req, out := c.CreateCustomKeyStoreRequest(input)
  592. req.SetContext(ctx)
  593. req.ApplyOptions(opts...)
  594. return out, req.Send()
  595. }
  596. const opCreateGrant = "CreateGrant"
  597. // CreateGrantRequest generates a "aws/request.Request" representing the
  598. // client's request for the CreateGrant operation. The "output" return
  599. // value will be populated with the request's response once the request completes
  600. // successfully.
  601. //
  602. // Use "Send" method on the returned Request to send the API call to the service.
  603. // the "output" return value is not valid until after Send returns without error.
  604. //
  605. // See CreateGrant for more information on using the CreateGrant
  606. // API call, and error handling.
  607. //
  608. // This method is useful when you want to inject custom logic or configuration
  609. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  610. //
  611. //
  612. // // Example sending a request using the CreateGrantRequest method.
  613. // req, resp := client.CreateGrantRequest(params)
  614. //
  615. // err := req.Send()
  616. // if err == nil { // resp is now filled
  617. // fmt.Println(resp)
  618. // }
  619. //
  620. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateGrant
  621. func (c *KMS) CreateGrantRequest(input *CreateGrantInput) (req *request.Request, output *CreateGrantOutput) {
  622. op := &request.Operation{
  623. Name: opCreateGrant,
  624. HTTPMethod: "POST",
  625. HTTPPath: "/",
  626. }
  627. if input == nil {
  628. input = &CreateGrantInput{}
  629. }
  630. output = &CreateGrantOutput{}
  631. req = c.newRequest(op, input, output)
  632. return
  633. }
  634. // CreateGrant API operation for AWS Key Management Service.
  635. //
  636. // Adds a grant to a customer master key (CMK). The grant specifies who can
  637. // use the CMK and under what conditions. When setting permissions, grants are
  638. // an alternative to key policies.
  639. //
  640. // To perform this operation on a CMK in a different AWS account, specify the
  641. // key ARN in the value of the KeyId parameter. For more information about grants,
  642. // see Grants (http://docs.aws.amazon.com/kms/latest/developerguide/grants.html)
  643. // in the AWS Key Management Service Developer Guide.
  644. //
  645. // The result of this operation varies with the key state of the CMK. For details,
  646. // see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  647. // in the AWS Key Management Service Developer Guide.
  648. //
  649. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  650. // with awserr.Error's Code and Message methods to get detailed information about
  651. // the error.
  652. //
  653. // See the AWS API reference guide for AWS Key Management Service's
  654. // API operation CreateGrant for usage and error information.
  655. //
  656. // Returned Error Codes:
  657. // * ErrCodeNotFoundException "NotFoundException"
  658. // The request was rejected because the specified entity or resource could not
  659. // be found.
  660. //
  661. // * ErrCodeDisabledException "DisabledException"
  662. // The request was rejected because the specified CMK is not enabled.
  663. //
  664. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  665. // The system timed out while trying to fulfill the request. The request can
  666. // be retried.
  667. //
  668. // * ErrCodeInvalidArnException "InvalidArnException"
  669. // The request was rejected because a specified ARN was not valid.
  670. //
  671. // * ErrCodeInternalException "KMSInternalException"
  672. // The request was rejected because an internal exception occurred. The request
  673. // can be retried.
  674. //
  675. // * ErrCodeInvalidGrantTokenException "InvalidGrantTokenException"
  676. // The request was rejected because the specified grant token is not valid.
  677. //
  678. // * ErrCodeLimitExceededException "LimitExceededException"
  679. // The request was rejected because a limit was exceeded. For more information,
  680. // see Limits (http://docs.aws.amazon.com/kms/latest/developerguide/limits.html)
  681. // in the AWS Key Management Service Developer Guide.
  682. //
  683. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  684. // The request was rejected because the state of the specified resource is not
  685. // valid for this request.
  686. //
  687. // For more information about how key state affects the use of a CMK, see How
  688. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  689. // in the AWS Key Management Service Developer Guide.
  690. //
  691. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateGrant
  692. func (c *KMS) CreateGrant(input *CreateGrantInput) (*CreateGrantOutput, error) {
  693. req, out := c.CreateGrantRequest(input)
  694. return out, req.Send()
  695. }
  696. // CreateGrantWithContext is the same as CreateGrant with the addition of
  697. // the ability to pass a context and additional request options.
  698. //
  699. // See CreateGrant for details on how to use this API operation.
  700. //
  701. // The context must be non-nil and will be used for request cancellation. If
  702. // the context is nil a panic will occur. In the future the SDK may create
  703. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  704. // for more information on using Contexts.
  705. func (c *KMS) CreateGrantWithContext(ctx aws.Context, input *CreateGrantInput, opts ...request.Option) (*CreateGrantOutput, error) {
  706. req, out := c.CreateGrantRequest(input)
  707. req.SetContext(ctx)
  708. req.ApplyOptions(opts...)
  709. return out, req.Send()
  710. }
  711. const opCreateKey = "CreateKey"
  712. // CreateKeyRequest generates a "aws/request.Request" representing the
  713. // client's request for the CreateKey operation. The "output" return
  714. // value will be populated with the request's response once the request completes
  715. // successfully.
  716. //
  717. // Use "Send" method on the returned Request to send the API call to the service.
  718. // the "output" return value is not valid until after Send returns without error.
  719. //
  720. // See CreateKey for more information on using the CreateKey
  721. // API call, and error handling.
  722. //
  723. // This method is useful when you want to inject custom logic or configuration
  724. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  725. //
  726. //
  727. // // Example sending a request using the CreateKeyRequest method.
  728. // req, resp := client.CreateKeyRequest(params)
  729. //
  730. // err := req.Send()
  731. // if err == nil { // resp is now filled
  732. // fmt.Println(resp)
  733. // }
  734. //
  735. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateKey
  736. func (c *KMS) CreateKeyRequest(input *CreateKeyInput) (req *request.Request, output *CreateKeyOutput) {
  737. op := &request.Operation{
  738. Name: opCreateKey,
  739. HTTPMethod: "POST",
  740. HTTPPath: "/",
  741. }
  742. if input == nil {
  743. input = &CreateKeyInput{}
  744. }
  745. output = &CreateKeyOutput{}
  746. req = c.newRequest(op, input, output)
  747. return
  748. }
  749. // CreateKey API operation for AWS Key Management Service.
  750. //
  751. // Creates a customer master key (CMK) in the caller's AWS account.
  752. //
  753. // You can use a CMK to encrypt small amounts of data (4 KiB or less) directly,
  754. // but CMKs are more commonly used to encrypt data keys, which are used to encrypt
  755. // raw data. For more information about data keys and the difference between
  756. // CMKs and data keys, see the following:
  757. //
  758. // * The GenerateDataKey operation
  759. //
  760. // * AWS Key Management Service Concepts (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html)
  761. // in the AWS Key Management Service Developer Guide
  762. //
  763. // If you plan to import key material (http://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html),
  764. // use the Origin parameter with a value of EXTERNAL to create a CMK with no
  765. // key material.
  766. //
  767. // To create a CMK in a custom key store (http://docs.aws.amazon.com/kms/latest/developerguide/key-store-overview.html),
  768. // use CustomKeyStoreId parameter to specify the custom key store. You must
  769. // also use the Origin parameter with a value of AWS_CLOUDHSM. The AWS CloudHSM
  770. // cluster that is associated with the custom key store must have at least two
  771. // active HSMs, each in a different Availability Zone in the Region.
  772. //
  773. // You cannot use this operation to create a CMK in a different AWS account.
  774. //
  775. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  776. // with awserr.Error's Code and Message methods to get detailed information about
  777. // the error.
  778. //
  779. // See the AWS API reference guide for AWS Key Management Service's
  780. // API operation CreateKey for usage and error information.
  781. //
  782. // Returned Error Codes:
  783. // * ErrCodeMalformedPolicyDocumentException "MalformedPolicyDocumentException"
  784. // The request was rejected because the specified policy is not syntactically
  785. // or semantically correct.
  786. //
  787. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  788. // The system timed out while trying to fulfill the request. The request can
  789. // be retried.
  790. //
  791. // * ErrCodeInvalidArnException "InvalidArnException"
  792. // The request was rejected because a specified ARN was not valid.
  793. //
  794. // * ErrCodeUnsupportedOperationException "UnsupportedOperationException"
  795. // The request was rejected because a specified parameter is not supported or
  796. // a specified resource is not valid for this operation.
  797. //
  798. // * ErrCodeInternalException "KMSInternalException"
  799. // The request was rejected because an internal exception occurred. The request
  800. // can be retried.
  801. //
  802. // * ErrCodeLimitExceededException "LimitExceededException"
  803. // The request was rejected because a limit was exceeded. For more information,
  804. // see Limits (http://docs.aws.amazon.com/kms/latest/developerguide/limits.html)
  805. // in the AWS Key Management Service Developer Guide.
  806. //
  807. // * ErrCodeTagException "TagException"
  808. // The request was rejected because one or more tags are not valid.
  809. //
  810. // * ErrCodeCustomKeyStoreNotFoundException "CustomKeyStoreNotFoundException"
  811. // The request was rejected because AWS KMS cannot find a custom key store with
  812. // the specified key store name or ID.
  813. //
  814. // * ErrCodeCustomKeyStoreInvalidStateException "CustomKeyStoreInvalidStateException"
  815. // The request was rejected because of the ConnectionState of the custom key
  816. // store. To get the ConnectionState of a custom key store, use the DescribeCustomKeyStores
  817. // operation.
  818. //
  819. // This exception is thrown under the following conditions:
  820. //
  821. // * You requested the CreateKey or GenerateRandom operation in a custom
  822. // key store that is not connected. These operations are valid only when
  823. // the custom key store ConnectionState is CONNECTED.
  824. //
  825. // * You requested the UpdateCustomKeyStore or DeleteCustomKeyStore operation
  826. // on a custom key store that is not disconnected. This operation is valid
  827. // only when the custom key store ConnectionState is DISCONNECTED.
  828. //
  829. // * You requested the ConnectCustomKeyStore operation on a custom key store
  830. // with a ConnectionState of DISCONNECTING or FAILED. This operation is valid
  831. // for all other ConnectionState values.
  832. //
  833. // * ErrCodeCloudHsmClusterInvalidConfigurationException "CloudHsmClusterInvalidConfigurationException"
  834. // The request was rejected because the associated AWS CloudHSM cluster did
  835. // not meet the configuration requirements for a custom key store. The cluster
  836. // must be configured with private subnets in at least two different Availability
  837. // Zones in the Region. Also, it must contain at least as many HSMs as the operation
  838. // requires.
  839. //
  840. // For the CreateCustomKeyStore, UpdateCustomKeyStore, and CreateKey operations,
  841. // the AWS CloudHSM cluster must have at least two active HSMs, each in a different
  842. // Availability Zone. For the ConnectCustomKeyStore operation, the AWS CloudHSM
  843. // must contain at least one active HSM.
  844. //
  845. // For information about creating a private subnet for a AWS CloudHSM cluster,
  846. // see Create a Private Subnet (http://docs.aws.amazon.com/cloudhsm/latest/userguide/create-subnets.html)
  847. // in the AWS CloudHSM User Guide. To add HSMs, use the AWS CloudHSM CreateHsm
  848. // (http://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_CreateHsm.html)
  849. // operation.
  850. //
  851. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/CreateKey
  852. func (c *KMS) CreateKey(input *CreateKeyInput) (*CreateKeyOutput, error) {
  853. req, out := c.CreateKeyRequest(input)
  854. return out, req.Send()
  855. }
  856. // CreateKeyWithContext is the same as CreateKey with the addition of
  857. // the ability to pass a context and additional request options.
  858. //
  859. // See CreateKey for details on how to use this API operation.
  860. //
  861. // The context must be non-nil and will be used for request cancellation. If
  862. // the context is nil a panic will occur. In the future the SDK may create
  863. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  864. // for more information on using Contexts.
  865. func (c *KMS) CreateKeyWithContext(ctx aws.Context, input *CreateKeyInput, opts ...request.Option) (*CreateKeyOutput, error) {
  866. req, out := c.CreateKeyRequest(input)
  867. req.SetContext(ctx)
  868. req.ApplyOptions(opts...)
  869. return out, req.Send()
  870. }
  871. const opDecrypt = "Decrypt"
  872. // DecryptRequest generates a "aws/request.Request" representing the
  873. // client's request for the Decrypt operation. The "output" return
  874. // value will be populated with the request's response once the request completes
  875. // successfully.
  876. //
  877. // Use "Send" method on the returned Request to send the API call to the service.
  878. // the "output" return value is not valid until after Send returns without error.
  879. //
  880. // See Decrypt for more information on using the Decrypt
  881. // API call, and error handling.
  882. //
  883. // This method is useful when you want to inject custom logic or configuration
  884. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  885. //
  886. //
  887. // // Example sending a request using the DecryptRequest method.
  888. // req, resp := client.DecryptRequest(params)
  889. //
  890. // err := req.Send()
  891. // if err == nil { // resp is now filled
  892. // fmt.Println(resp)
  893. // }
  894. //
  895. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/Decrypt
  896. func (c *KMS) DecryptRequest(input *DecryptInput) (req *request.Request, output *DecryptOutput) {
  897. op := &request.Operation{
  898. Name: opDecrypt,
  899. HTTPMethod: "POST",
  900. HTTPPath: "/",
  901. }
  902. if input == nil {
  903. input = &DecryptInput{}
  904. }
  905. output = &DecryptOutput{}
  906. req = c.newRequest(op, input, output)
  907. return
  908. }
  909. // Decrypt API operation for AWS Key Management Service.
  910. //
  911. // Decrypts ciphertext. Ciphertext is plaintext that has been previously encrypted
  912. // by using any of the following operations:
  913. //
  914. // * GenerateDataKey
  915. //
  916. // * GenerateDataKeyWithoutPlaintext
  917. //
  918. // * Encrypt
  919. //
  920. // Note that if a caller has been granted access permissions to all keys (through,
  921. // for example, IAM user policies that grant Decrypt permission on all resources),
  922. // then ciphertext encrypted by using keys in other accounts where the key grants
  923. // access to the caller can be decrypted. To remedy this, we recommend that
  924. // you do not grant Decrypt access in an IAM user policy. Instead grant Decrypt
  925. // access only in key policies. If you must grant Decrypt access in an IAM user
  926. // policy, you should scope the resource to specific keys or to specific trusted
  927. // accounts.
  928. //
  929. // The result of this operation varies with the key state of the CMK. For details,
  930. // see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  931. // in the AWS Key Management Service Developer Guide.
  932. //
  933. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  934. // with awserr.Error's Code and Message methods to get detailed information about
  935. // the error.
  936. //
  937. // See the AWS API reference guide for AWS Key Management Service's
  938. // API operation Decrypt for usage and error information.
  939. //
  940. // Returned Error Codes:
  941. // * ErrCodeNotFoundException "NotFoundException"
  942. // The request was rejected because the specified entity or resource could not
  943. // be found.
  944. //
  945. // * ErrCodeDisabledException "DisabledException"
  946. // The request was rejected because the specified CMK is not enabled.
  947. //
  948. // * ErrCodeInvalidCiphertextException "InvalidCiphertextException"
  949. // The request was rejected because the specified ciphertext, or additional
  950. // authenticated data incorporated into the ciphertext, such as the encryption
  951. // context, is corrupted, missing, or otherwise invalid.
  952. //
  953. // * ErrCodeKeyUnavailableException "KeyUnavailableException"
  954. // The request was rejected because the specified CMK was not available. The
  955. // request can be retried.
  956. //
  957. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  958. // The system timed out while trying to fulfill the request. The request can
  959. // be retried.
  960. //
  961. // * ErrCodeInvalidGrantTokenException "InvalidGrantTokenException"
  962. // The request was rejected because the specified grant token is not valid.
  963. //
  964. // * ErrCodeInternalException "KMSInternalException"
  965. // The request was rejected because an internal exception occurred. The request
  966. // can be retried.
  967. //
  968. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  969. // The request was rejected because the state of the specified resource is not
  970. // valid for this request.
  971. //
  972. // For more information about how key state affects the use of a CMK, see How
  973. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  974. // in the AWS Key Management Service Developer Guide.
  975. //
  976. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/Decrypt
  977. func (c *KMS) Decrypt(input *DecryptInput) (*DecryptOutput, error) {
  978. req, out := c.DecryptRequest(input)
  979. return out, req.Send()
  980. }
  981. // DecryptWithContext is the same as Decrypt with the addition of
  982. // the ability to pass a context and additional request options.
  983. //
  984. // See Decrypt for details on how to use this API operation.
  985. //
  986. // The context must be non-nil and will be used for request cancellation. If
  987. // the context is nil a panic will occur. In the future the SDK may create
  988. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  989. // for more information on using Contexts.
  990. func (c *KMS) DecryptWithContext(ctx aws.Context, input *DecryptInput, opts ...request.Option) (*DecryptOutput, error) {
  991. req, out := c.DecryptRequest(input)
  992. req.SetContext(ctx)
  993. req.ApplyOptions(opts...)
  994. return out, req.Send()
  995. }
  996. const opDeleteAlias = "DeleteAlias"
  997. // DeleteAliasRequest generates a "aws/request.Request" representing the
  998. // client's request for the DeleteAlias operation. The "output" return
  999. // value will be populated with the request's response once the request completes
  1000. // successfully.
  1001. //
  1002. // Use "Send" method on the returned Request to send the API call to the service.
  1003. // the "output" return value is not valid until after Send returns without error.
  1004. //
  1005. // See DeleteAlias for more information on using the DeleteAlias
  1006. // API call, and error handling.
  1007. //
  1008. // This method is useful when you want to inject custom logic or configuration
  1009. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  1010. //
  1011. //
  1012. // // Example sending a request using the DeleteAliasRequest method.
  1013. // req, resp := client.DeleteAliasRequest(params)
  1014. //
  1015. // err := req.Send()
  1016. // if err == nil { // resp is now filled
  1017. // fmt.Println(resp)
  1018. // }
  1019. //
  1020. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DeleteAlias
  1021. func (c *KMS) DeleteAliasRequest(input *DeleteAliasInput) (req *request.Request, output *DeleteAliasOutput) {
  1022. op := &request.Operation{
  1023. Name: opDeleteAlias,
  1024. HTTPMethod: "POST",
  1025. HTTPPath: "/",
  1026. }
  1027. if input == nil {
  1028. input = &DeleteAliasInput{}
  1029. }
  1030. output = &DeleteAliasOutput{}
  1031. req = c.newRequest(op, input, output)
  1032. req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
  1033. return
  1034. }
  1035. // DeleteAlias API operation for AWS Key Management Service.
  1036. //
  1037. // Deletes the specified alias. You cannot perform this operation on an alias
  1038. // in a different AWS account.
  1039. //
  1040. // Because an alias is not a property of a CMK, you can delete and change the
  1041. // aliases of a CMK without affecting the CMK. Also, aliases do not appear in
  1042. // the response from the DescribeKey operation. To get the aliases of all CMKs,
  1043. // use the ListAliases operation.
  1044. //
  1045. // Each CMK can have multiple aliases. To change the alias of a CMK, use DeleteAlias
  1046. // to delete the current alias and CreateAlias to create a new alias. To associate
  1047. // an existing alias with a different customer master key (CMK), call UpdateAlias.
  1048. //
  1049. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  1050. // with awserr.Error's Code and Message methods to get detailed information about
  1051. // the error.
  1052. //
  1053. // See the AWS API reference guide for AWS Key Management Service's
  1054. // API operation DeleteAlias for usage and error information.
  1055. //
  1056. // Returned Error Codes:
  1057. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  1058. // The system timed out while trying to fulfill the request. The request can
  1059. // be retried.
  1060. //
  1061. // * ErrCodeNotFoundException "NotFoundException"
  1062. // The request was rejected because the specified entity or resource could not
  1063. // be found.
  1064. //
  1065. // * ErrCodeInternalException "KMSInternalException"
  1066. // The request was rejected because an internal exception occurred. The request
  1067. // can be retried.
  1068. //
  1069. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  1070. // The request was rejected because the state of the specified resource is not
  1071. // valid for this request.
  1072. //
  1073. // For more information about how key state affects the use of a CMK, see How
  1074. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  1075. // in the AWS Key Management Service Developer Guide.
  1076. //
  1077. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DeleteAlias
  1078. func (c *KMS) DeleteAlias(input *DeleteAliasInput) (*DeleteAliasOutput, error) {
  1079. req, out := c.DeleteAliasRequest(input)
  1080. return out, req.Send()
  1081. }
  1082. // DeleteAliasWithContext is the same as DeleteAlias with the addition of
  1083. // the ability to pass a context and additional request options.
  1084. //
  1085. // See DeleteAlias for details on how to use this API operation.
  1086. //
  1087. // The context must be non-nil and will be used for request cancellation. If
  1088. // the context is nil a panic will occur. In the future the SDK may create
  1089. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1090. // for more information on using Contexts.
  1091. func (c *KMS) DeleteAliasWithContext(ctx aws.Context, input *DeleteAliasInput, opts ...request.Option) (*DeleteAliasOutput, error) {
  1092. req, out := c.DeleteAliasRequest(input)
  1093. req.SetContext(ctx)
  1094. req.ApplyOptions(opts...)
  1095. return out, req.Send()
  1096. }
  1097. const opDeleteCustomKeyStore = "DeleteCustomKeyStore"
  1098. // DeleteCustomKeyStoreRequest generates a "aws/request.Request" representing the
  1099. // client's request for the DeleteCustomKeyStore operation. The "output" return
  1100. // value will be populated with the request's response once the request completes
  1101. // successfully.
  1102. //
  1103. // Use "Send" method on the returned Request to send the API call to the service.
  1104. // the "output" return value is not valid until after Send returns without error.
  1105. //
  1106. // See DeleteCustomKeyStore for more information on using the DeleteCustomKeyStore
  1107. // API call, and error handling.
  1108. //
  1109. // This method is useful when you want to inject custom logic or configuration
  1110. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  1111. //
  1112. //
  1113. // // Example sending a request using the DeleteCustomKeyStoreRequest method.
  1114. // req, resp := client.DeleteCustomKeyStoreRequest(params)
  1115. //
  1116. // err := req.Send()
  1117. // if err == nil { // resp is now filled
  1118. // fmt.Println(resp)
  1119. // }
  1120. //
  1121. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DeleteCustomKeyStore
  1122. func (c *KMS) DeleteCustomKeyStoreRequest(input *DeleteCustomKeyStoreInput) (req *request.Request, output *DeleteCustomKeyStoreOutput) {
  1123. op := &request.Operation{
  1124. Name: opDeleteCustomKeyStore,
  1125. HTTPMethod: "POST",
  1126. HTTPPath: "/",
  1127. }
  1128. if input == nil {
  1129. input = &DeleteCustomKeyStoreInput{}
  1130. }
  1131. output = &DeleteCustomKeyStoreOutput{}
  1132. req = c.newRequest(op, input, output)
  1133. req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
  1134. return
  1135. }
  1136. // DeleteCustomKeyStore API operation for AWS Key Management Service.
  1137. //
  1138. // Deletes a custom key store (http://docs.aws.amazon.com/kms/latest/developerguide/key-store-overview.html).
  1139. // This operation does not delete the AWS CloudHSM cluster that is associated
  1140. // with the custom key store, or affect any users or keys in the cluster.
  1141. //
  1142. // The custom key store that you delete cannot contain any AWS KMS customer
  1143. // master keys (CMKs) (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#master_keys).
  1144. // Before deleting the key store, verify that you will never need to use any
  1145. // of the CMKs in the key store for any cryptographic operations. Then, use
  1146. // ScheduleKeyDeletion to delete the AWS KMS customer master keys (CMKs) from
  1147. // the key store. When the scheduled waiting period expires, the ScheduleKeyDeletion
  1148. // operation deletes the CMKs. Then it makes a best effort to delete the key
  1149. // material from the associated cluster. However, you might need to manually
  1150. // delete the orphaned key material (http://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html#fix-keystore-orphaned-key)
  1151. // from the cluster and its backups.
  1152. //
  1153. // After all CMKs are deleted from AWS KMS, use DisconnectCustomKeyStore to
  1154. // disconnect the key store from AWS KMS. Then, you can delete the custom key
  1155. // store.
  1156. //
  1157. // Instead of deleting the custom key store, consider using DisconnectCustomKeyStore
  1158. // to disconnect it from AWS KMS. While the key store is disconnected, you cannot
  1159. // create or use the CMKs in the key store. But, you do not need to delete CMKs
  1160. // and you can reconnect a disconnected custom key store at any time.
  1161. //
  1162. // If the operation succeeds, it returns a JSON object with no properties.
  1163. //
  1164. // This operation is part of the Custom Key Store feature (http://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html)
  1165. // feature in AWS KMS, which combines the convenience and extensive integration
  1166. // of AWS KMS with the isolation and control of a single-tenant key store.
  1167. //
  1168. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  1169. // with awserr.Error's Code and Message methods to get detailed information about
  1170. // the error.
  1171. //
  1172. // See the AWS API reference guide for AWS Key Management Service's
  1173. // API operation DeleteCustomKeyStore for usage and error information.
  1174. //
  1175. // Returned Error Codes:
  1176. // * ErrCodeCustomKeyStoreHasCMKsException "CustomKeyStoreHasCMKsException"
  1177. // The request was rejected because the custom key store contains AWS KMS customer
  1178. // master keys (CMKs). After verifying that you do not need to use the CMKs,
  1179. // use the ScheduleKeyDeletion operation to delete the CMKs. After they are
  1180. // deleted, you can delete the custom key store.
  1181. //
  1182. // * ErrCodeCustomKeyStoreInvalidStateException "CustomKeyStoreInvalidStateException"
  1183. // The request was rejected because of the ConnectionState of the custom key
  1184. // store. To get the ConnectionState of a custom key store, use the DescribeCustomKeyStores
  1185. // operation.
  1186. //
  1187. // This exception is thrown under the following conditions:
  1188. //
  1189. // * You requested the CreateKey or GenerateRandom operation in a custom
  1190. // key store that is not connected. These operations are valid only when
  1191. // the custom key store ConnectionState is CONNECTED.
  1192. //
  1193. // * You requested the UpdateCustomKeyStore or DeleteCustomKeyStore operation
  1194. // on a custom key store that is not disconnected. This operation is valid
  1195. // only when the custom key store ConnectionState is DISCONNECTED.
  1196. //
  1197. // * You requested the ConnectCustomKeyStore operation on a custom key store
  1198. // with a ConnectionState of DISCONNECTING or FAILED. This operation is valid
  1199. // for all other ConnectionState values.
  1200. //
  1201. // * ErrCodeCustomKeyStoreNotFoundException "CustomKeyStoreNotFoundException"
  1202. // The request was rejected because AWS KMS cannot find a custom key store with
  1203. // the specified key store name or ID.
  1204. //
  1205. // * ErrCodeInternalException "KMSInternalException"
  1206. // The request was rejected because an internal exception occurred. The request
  1207. // can be retried.
  1208. //
  1209. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DeleteCustomKeyStore
  1210. func (c *KMS) DeleteCustomKeyStore(input *DeleteCustomKeyStoreInput) (*DeleteCustomKeyStoreOutput, error) {
  1211. req, out := c.DeleteCustomKeyStoreRequest(input)
  1212. return out, req.Send()
  1213. }
  1214. // DeleteCustomKeyStoreWithContext is the same as DeleteCustomKeyStore with the addition of
  1215. // the ability to pass a context and additional request options.
  1216. //
  1217. // See DeleteCustomKeyStore for details on how to use this API operation.
  1218. //
  1219. // The context must be non-nil and will be used for request cancellation. If
  1220. // the context is nil a panic will occur. In the future the SDK may create
  1221. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1222. // for more information on using Contexts.
  1223. func (c *KMS) DeleteCustomKeyStoreWithContext(ctx aws.Context, input *DeleteCustomKeyStoreInput, opts ...request.Option) (*DeleteCustomKeyStoreOutput, error) {
  1224. req, out := c.DeleteCustomKeyStoreRequest(input)
  1225. req.SetContext(ctx)
  1226. req.ApplyOptions(opts...)
  1227. return out, req.Send()
  1228. }
  1229. const opDeleteImportedKeyMaterial = "DeleteImportedKeyMaterial"
  1230. // DeleteImportedKeyMaterialRequest generates a "aws/request.Request" representing the
  1231. // client's request for the DeleteImportedKeyMaterial operation. The "output" return
  1232. // value will be populated with the request's response once the request completes
  1233. // successfully.
  1234. //
  1235. // Use "Send" method on the returned Request to send the API call to the service.
  1236. // the "output" return value is not valid until after Send returns without error.
  1237. //
  1238. // See DeleteImportedKeyMaterial for more information on using the DeleteImportedKeyMaterial
  1239. // API call, and error handling.
  1240. //
  1241. // This method is useful when you want to inject custom logic or configuration
  1242. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  1243. //
  1244. //
  1245. // // Example sending a request using the DeleteImportedKeyMaterialRequest method.
  1246. // req, resp := client.DeleteImportedKeyMaterialRequest(params)
  1247. //
  1248. // err := req.Send()
  1249. // if err == nil { // resp is now filled
  1250. // fmt.Println(resp)
  1251. // }
  1252. //
  1253. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DeleteImportedKeyMaterial
  1254. func (c *KMS) DeleteImportedKeyMaterialRequest(input *DeleteImportedKeyMaterialInput) (req *request.Request, output *DeleteImportedKeyMaterialOutput) {
  1255. op := &request.Operation{
  1256. Name: opDeleteImportedKeyMaterial,
  1257. HTTPMethod: "POST",
  1258. HTTPPath: "/",
  1259. }
  1260. if input == nil {
  1261. input = &DeleteImportedKeyMaterialInput{}
  1262. }
  1263. output = &DeleteImportedKeyMaterialOutput{}
  1264. req = c.newRequest(op, input, output)
  1265. req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
  1266. return
  1267. }
  1268. // DeleteImportedKeyMaterial API operation for AWS Key Management Service.
  1269. //
  1270. // Deletes key material that you previously imported. This operation makes the
  1271. // specified customer master key (CMK) unusable. For more information about
  1272. // importing key material into AWS KMS, see Importing Key Material (http://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html)
  1273. // in the AWS Key Management Service Developer Guide. You cannot perform this
  1274. // operation on a CMK in a different AWS account.
  1275. //
  1276. // When the specified CMK is in the PendingDeletion state, this operation does
  1277. // not change the CMK's state. Otherwise, it changes the CMK's state to PendingImport.
  1278. //
  1279. // After you delete key material, you can use ImportKeyMaterial to reimport
  1280. // the same key material into the CMK.
  1281. //
  1282. // The result of this operation varies with the key state of the CMK. For details,
  1283. // see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  1284. // in the AWS Key Management Service Developer Guide.
  1285. //
  1286. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  1287. // with awserr.Error's Code and Message methods to get detailed information about
  1288. // the error.
  1289. //
  1290. // See the AWS API reference guide for AWS Key Management Service's
  1291. // API operation DeleteImportedKeyMaterial for usage and error information.
  1292. //
  1293. // Returned Error Codes:
  1294. // * ErrCodeInvalidArnException "InvalidArnException"
  1295. // The request was rejected because a specified ARN was not valid.
  1296. //
  1297. // * ErrCodeUnsupportedOperationException "UnsupportedOperationException"
  1298. // The request was rejected because a specified parameter is not supported or
  1299. // a specified resource is not valid for this operation.
  1300. //
  1301. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  1302. // The system timed out while trying to fulfill the request. The request can
  1303. // be retried.
  1304. //
  1305. // * ErrCodeNotFoundException "NotFoundException"
  1306. // The request was rejected because the specified entity or resource could not
  1307. // be found.
  1308. //
  1309. // * ErrCodeInternalException "KMSInternalException"
  1310. // The request was rejected because an internal exception occurred. The request
  1311. // can be retried.
  1312. //
  1313. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  1314. // The request was rejected because the state of the specified resource is not
  1315. // valid for this request.
  1316. //
  1317. // For more information about how key state affects the use of a CMK, see How
  1318. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  1319. // in the AWS Key Management Service Developer Guide.
  1320. //
  1321. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DeleteImportedKeyMaterial
  1322. func (c *KMS) DeleteImportedKeyMaterial(input *DeleteImportedKeyMaterialInput) (*DeleteImportedKeyMaterialOutput, error) {
  1323. req, out := c.DeleteImportedKeyMaterialRequest(input)
  1324. return out, req.Send()
  1325. }
  1326. // DeleteImportedKeyMaterialWithContext is the same as DeleteImportedKeyMaterial with the addition of
  1327. // the ability to pass a context and additional request options.
  1328. //
  1329. // See DeleteImportedKeyMaterial for details on how to use this API operation.
  1330. //
  1331. // The context must be non-nil and will be used for request cancellation. If
  1332. // the context is nil a panic will occur. In the future the SDK may create
  1333. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1334. // for more information on using Contexts.
  1335. func (c *KMS) DeleteImportedKeyMaterialWithContext(ctx aws.Context, input *DeleteImportedKeyMaterialInput, opts ...request.Option) (*DeleteImportedKeyMaterialOutput, error) {
  1336. req, out := c.DeleteImportedKeyMaterialRequest(input)
  1337. req.SetContext(ctx)
  1338. req.ApplyOptions(opts...)
  1339. return out, req.Send()
  1340. }
  1341. const opDescribeCustomKeyStores = "DescribeCustomKeyStores"
  1342. // DescribeCustomKeyStoresRequest generates a "aws/request.Request" representing the
  1343. // client's request for the DescribeCustomKeyStores operation. The "output" return
  1344. // value will be populated with the request's response once the request completes
  1345. // successfully.
  1346. //
  1347. // Use "Send" method on the returned Request to send the API call to the service.
  1348. // the "output" return value is not valid until after Send returns without error.
  1349. //
  1350. // See DescribeCustomKeyStores for more information on using the DescribeCustomKeyStores
  1351. // API call, and error handling.
  1352. //
  1353. // This method is useful when you want to inject custom logic or configuration
  1354. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  1355. //
  1356. //
  1357. // // Example sending a request using the DescribeCustomKeyStoresRequest method.
  1358. // req, resp := client.DescribeCustomKeyStoresRequest(params)
  1359. //
  1360. // err := req.Send()
  1361. // if err == nil { // resp is now filled
  1362. // fmt.Println(resp)
  1363. // }
  1364. //
  1365. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DescribeCustomKeyStores
  1366. func (c *KMS) DescribeCustomKeyStoresRequest(input *DescribeCustomKeyStoresInput) (req *request.Request, output *DescribeCustomKeyStoresOutput) {
  1367. op := &request.Operation{
  1368. Name: opDescribeCustomKeyStores,
  1369. HTTPMethod: "POST",
  1370. HTTPPath: "/",
  1371. }
  1372. if input == nil {
  1373. input = &DescribeCustomKeyStoresInput{}
  1374. }
  1375. output = &DescribeCustomKeyStoresOutput{}
  1376. req = c.newRequest(op, input, output)
  1377. return
  1378. }
  1379. // DescribeCustomKeyStores API operation for AWS Key Management Service.
  1380. //
  1381. // Gets information about custom key stores (http://docs.aws.amazon.com/kms/latest/developerguide/key-store-overview.html)
  1382. // in the account and region.
  1383. //
  1384. // This operation is part of the Custom Key Store feature (http://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html)
  1385. // feature in AWS KMS, which combines the convenience and extensive integration
  1386. // of AWS KMS with the isolation and control of a single-tenant key store.
  1387. //
  1388. // By default, this operation returns information about all custom key stores
  1389. // in the account and region. To get only information about a particular custom
  1390. // key store, use either the CustomKeyStoreName or CustomKeyStoreId parameter
  1391. // (but not both).
  1392. //
  1393. // To determine whether the custom key store is connected to its AWS CloudHSM
  1394. // cluster, use the ConnectionState element in the response. If an attempt to
  1395. // connect the custom key store failed, the ConnectionState value is FAILED
  1396. // and the ConnectionErrorCode element in the response indicates the cause of
  1397. // the failure. For help interpreting the ConnectionErrorCode, see CustomKeyStoresListEntry.
  1398. //
  1399. // Custom key stores have a DISCONNECTED connection state if the key store has
  1400. // never been connected or you use the DisconnectCustomKeyStore operation to
  1401. // disconnect it. If your custom key store state is CONNECTED but you are having
  1402. // trouble using it, make sure that its associated AWS CloudHSM cluster is active
  1403. // and contains the minimum number of HSMs required for the operation, if any.
  1404. //
  1405. // For help repairing your custom key store, see the Troubleshooting Custom
  1406. // Key Stores (http://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore-html)
  1407. // topic in the AWS Key Management Service Developer Guide.
  1408. //
  1409. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  1410. // with awserr.Error's Code and Message methods to get detailed information about
  1411. // the error.
  1412. //
  1413. // See the AWS API reference guide for AWS Key Management Service's
  1414. // API operation DescribeCustomKeyStores for usage and error information.
  1415. //
  1416. // Returned Error Codes:
  1417. // * ErrCodeCustomKeyStoreNotFoundException "CustomKeyStoreNotFoundException"
  1418. // The request was rejected because AWS KMS cannot find a custom key store with
  1419. // the specified key store name or ID.
  1420. //
  1421. // * ErrCodeInternalException "KMSInternalException"
  1422. // The request was rejected because an internal exception occurred. The request
  1423. // can be retried.
  1424. //
  1425. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DescribeCustomKeyStores
  1426. func (c *KMS) DescribeCustomKeyStores(input *DescribeCustomKeyStoresInput) (*DescribeCustomKeyStoresOutput, error) {
  1427. req, out := c.DescribeCustomKeyStoresRequest(input)
  1428. return out, req.Send()
  1429. }
  1430. // DescribeCustomKeyStoresWithContext is the same as DescribeCustomKeyStores with the addition of
  1431. // the ability to pass a context and additional request options.
  1432. //
  1433. // See DescribeCustomKeyStores for details on how to use this API operation.
  1434. //
  1435. // The context must be non-nil and will be used for request cancellation. If
  1436. // the context is nil a panic will occur. In the future the SDK may create
  1437. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1438. // for more information on using Contexts.
  1439. func (c *KMS) DescribeCustomKeyStoresWithContext(ctx aws.Context, input *DescribeCustomKeyStoresInput, opts ...request.Option) (*DescribeCustomKeyStoresOutput, error) {
  1440. req, out := c.DescribeCustomKeyStoresRequest(input)
  1441. req.SetContext(ctx)
  1442. req.ApplyOptions(opts...)
  1443. return out, req.Send()
  1444. }
  1445. const opDescribeKey = "DescribeKey"
  1446. // DescribeKeyRequest generates a "aws/request.Request" representing the
  1447. // client's request for the DescribeKey operation. The "output" return
  1448. // value will be populated with the request's response once the request completes
  1449. // successfully.
  1450. //
  1451. // Use "Send" method on the returned Request to send the API call to the service.
  1452. // the "output" return value is not valid until after Send returns without error.
  1453. //
  1454. // See DescribeKey for more information on using the DescribeKey
  1455. // API call, and error handling.
  1456. //
  1457. // This method is useful when you want to inject custom logic or configuration
  1458. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  1459. //
  1460. //
  1461. // // Example sending a request using the DescribeKeyRequest method.
  1462. // req, resp := client.DescribeKeyRequest(params)
  1463. //
  1464. // err := req.Send()
  1465. // if err == nil { // resp is now filled
  1466. // fmt.Println(resp)
  1467. // }
  1468. //
  1469. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DescribeKey
  1470. func (c *KMS) DescribeKeyRequest(input *DescribeKeyInput) (req *request.Request, output *DescribeKeyOutput) {
  1471. op := &request.Operation{
  1472. Name: opDescribeKey,
  1473. HTTPMethod: "POST",
  1474. HTTPPath: "/",
  1475. }
  1476. if input == nil {
  1477. input = &DescribeKeyInput{}
  1478. }
  1479. output = &DescribeKeyOutput{}
  1480. req = c.newRequest(op, input, output)
  1481. return
  1482. }
  1483. // DescribeKey API operation for AWS Key Management Service.
  1484. //
  1485. // Provides detailed information about the specified customer master key (CMK).
  1486. //
  1487. // If you use DescribeKey on a predefined AWS alias, that is, an AWS alias with
  1488. // no key ID, AWS KMS associates the alias with an AWS managed CMK (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#master_keys)
  1489. // and returns its KeyId and Arn in the response.
  1490. //
  1491. // To perform this operation on a CMK in a different AWS account, specify the
  1492. // key ARN or alias ARN in the value of the KeyId parameter.
  1493. //
  1494. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  1495. // with awserr.Error's Code and Message methods to get detailed information about
  1496. // the error.
  1497. //
  1498. // See the AWS API reference guide for AWS Key Management Service's
  1499. // API operation DescribeKey for usage and error information.
  1500. //
  1501. // Returned Error Codes:
  1502. // * ErrCodeNotFoundException "NotFoundException"
  1503. // The request was rejected because the specified entity or resource could not
  1504. // be found.
  1505. //
  1506. // * ErrCodeInvalidArnException "InvalidArnException"
  1507. // The request was rejected because a specified ARN was not valid.
  1508. //
  1509. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  1510. // The system timed out while trying to fulfill the request. The request can
  1511. // be retried.
  1512. //
  1513. // * ErrCodeInternalException "KMSInternalException"
  1514. // The request was rejected because an internal exception occurred. The request
  1515. // can be retried.
  1516. //
  1517. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DescribeKey
  1518. func (c *KMS) DescribeKey(input *DescribeKeyInput) (*DescribeKeyOutput, error) {
  1519. req, out := c.DescribeKeyRequest(input)
  1520. return out, req.Send()
  1521. }
  1522. // DescribeKeyWithContext is the same as DescribeKey with the addition of
  1523. // the ability to pass a context and additional request options.
  1524. //
  1525. // See DescribeKey for details on how to use this API operation.
  1526. //
  1527. // The context must be non-nil and will be used for request cancellation. If
  1528. // the context is nil a panic will occur. In the future the SDK may create
  1529. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1530. // for more information on using Contexts.
  1531. func (c *KMS) DescribeKeyWithContext(ctx aws.Context, input *DescribeKeyInput, opts ...request.Option) (*DescribeKeyOutput, error) {
  1532. req, out := c.DescribeKeyRequest(input)
  1533. req.SetContext(ctx)
  1534. req.ApplyOptions(opts...)
  1535. return out, req.Send()
  1536. }
  1537. const opDisableKey = "DisableKey"
  1538. // DisableKeyRequest generates a "aws/request.Request" representing the
  1539. // client's request for the DisableKey operation. The "output" return
  1540. // value will be populated with the request's response once the request completes
  1541. // successfully.
  1542. //
  1543. // Use "Send" method on the returned Request to send the API call to the service.
  1544. // the "output" return value is not valid until after Send returns without error.
  1545. //
  1546. // See DisableKey for more information on using the DisableKey
  1547. // API call, and error handling.
  1548. //
  1549. // This method is useful when you want to inject custom logic or configuration
  1550. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  1551. //
  1552. //
  1553. // // Example sending a request using the DisableKeyRequest method.
  1554. // req, resp := client.DisableKeyRequest(params)
  1555. //
  1556. // err := req.Send()
  1557. // if err == nil { // resp is now filled
  1558. // fmt.Println(resp)
  1559. // }
  1560. //
  1561. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DisableKey
  1562. func (c *KMS) DisableKeyRequest(input *DisableKeyInput) (req *request.Request, output *DisableKeyOutput) {
  1563. op := &request.Operation{
  1564. Name: opDisableKey,
  1565. HTTPMethod: "POST",
  1566. HTTPPath: "/",
  1567. }
  1568. if input == nil {
  1569. input = &DisableKeyInput{}
  1570. }
  1571. output = &DisableKeyOutput{}
  1572. req = c.newRequest(op, input, output)
  1573. req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
  1574. return
  1575. }
  1576. // DisableKey API operation for AWS Key Management Service.
  1577. //
  1578. // Sets the state of a customer master key (CMK) to disabled, thereby preventing
  1579. // its use for cryptographic operations. You cannot perform this operation on
  1580. // a CMK in a different AWS account.
  1581. //
  1582. // For more information about how key state affects the use of a CMK, see How
  1583. // Key State Affects the Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  1584. // in the AWS Key Management Service Developer Guide.
  1585. //
  1586. // The result of this operation varies with the key state of the CMK. For details,
  1587. // see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  1588. // in the AWS Key Management Service Developer Guide.
  1589. //
  1590. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  1591. // with awserr.Error's Code and Message methods to get detailed information about
  1592. // the error.
  1593. //
  1594. // See the AWS API reference guide for AWS Key Management Service's
  1595. // API operation DisableKey for usage and error information.
  1596. //
  1597. // Returned Error Codes:
  1598. // * ErrCodeNotFoundException "NotFoundException"
  1599. // The request was rejected because the specified entity or resource could not
  1600. // be found.
  1601. //
  1602. // * ErrCodeInvalidArnException "InvalidArnException"
  1603. // The request was rejected because a specified ARN was not valid.
  1604. //
  1605. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  1606. // The system timed out while trying to fulfill the request. The request can
  1607. // be retried.
  1608. //
  1609. // * ErrCodeInternalException "KMSInternalException"
  1610. // The request was rejected because an internal exception occurred. The request
  1611. // can be retried.
  1612. //
  1613. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  1614. // The request was rejected because the state of the specified resource is not
  1615. // valid for this request.
  1616. //
  1617. // For more information about how key state affects the use of a CMK, see How
  1618. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  1619. // in the AWS Key Management Service Developer Guide.
  1620. //
  1621. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DisableKey
  1622. func (c *KMS) DisableKey(input *DisableKeyInput) (*DisableKeyOutput, error) {
  1623. req, out := c.DisableKeyRequest(input)
  1624. return out, req.Send()
  1625. }
  1626. // DisableKeyWithContext is the same as DisableKey with the addition of
  1627. // the ability to pass a context and additional request options.
  1628. //
  1629. // See DisableKey for details on how to use this API operation.
  1630. //
  1631. // The context must be non-nil and will be used for request cancellation. If
  1632. // the context is nil a panic will occur. In the future the SDK may create
  1633. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1634. // for more information on using Contexts.
  1635. func (c *KMS) DisableKeyWithContext(ctx aws.Context, input *DisableKeyInput, opts ...request.Option) (*DisableKeyOutput, error) {
  1636. req, out := c.DisableKeyRequest(input)
  1637. req.SetContext(ctx)
  1638. req.ApplyOptions(opts...)
  1639. return out, req.Send()
  1640. }
  1641. const opDisableKeyRotation = "DisableKeyRotation"
  1642. // DisableKeyRotationRequest generates a "aws/request.Request" representing the
  1643. // client's request for the DisableKeyRotation operation. The "output" return
  1644. // value will be populated with the request's response once the request completes
  1645. // successfully.
  1646. //
  1647. // Use "Send" method on the returned Request to send the API call to the service.
  1648. // the "output" return value is not valid until after Send returns without error.
  1649. //
  1650. // See DisableKeyRotation for more information on using the DisableKeyRotation
  1651. // API call, and error handling.
  1652. //
  1653. // This method is useful when you want to inject custom logic or configuration
  1654. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  1655. //
  1656. //
  1657. // // Example sending a request using the DisableKeyRotationRequest method.
  1658. // req, resp := client.DisableKeyRotationRequest(params)
  1659. //
  1660. // err := req.Send()
  1661. // if err == nil { // resp is now filled
  1662. // fmt.Println(resp)
  1663. // }
  1664. //
  1665. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DisableKeyRotation
  1666. func (c *KMS) DisableKeyRotationRequest(input *DisableKeyRotationInput) (req *request.Request, output *DisableKeyRotationOutput) {
  1667. op := &request.Operation{
  1668. Name: opDisableKeyRotation,
  1669. HTTPMethod: "POST",
  1670. HTTPPath: "/",
  1671. }
  1672. if input == nil {
  1673. input = &DisableKeyRotationInput{}
  1674. }
  1675. output = &DisableKeyRotationOutput{}
  1676. req = c.newRequest(op, input, output)
  1677. req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
  1678. return
  1679. }
  1680. // DisableKeyRotation API operation for AWS Key Management Service.
  1681. //
  1682. // Disables automatic rotation of the key material (http://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html)
  1683. // for the specified customer master key (CMK). You cannot perform this operation
  1684. // on a CMK in a different AWS account.
  1685. //
  1686. // The result of this operation varies with the key state of the CMK. For details,
  1687. // see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  1688. // in the AWS Key Management Service Developer Guide.
  1689. //
  1690. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  1691. // with awserr.Error's Code and Message methods to get detailed information about
  1692. // the error.
  1693. //
  1694. // See the AWS API reference guide for AWS Key Management Service's
  1695. // API operation DisableKeyRotation for usage and error information.
  1696. //
  1697. // Returned Error Codes:
  1698. // * ErrCodeNotFoundException "NotFoundException"
  1699. // The request was rejected because the specified entity or resource could not
  1700. // be found.
  1701. //
  1702. // * ErrCodeDisabledException "DisabledException"
  1703. // The request was rejected because the specified CMK is not enabled.
  1704. //
  1705. // * ErrCodeInvalidArnException "InvalidArnException"
  1706. // The request was rejected because a specified ARN was not valid.
  1707. //
  1708. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  1709. // The system timed out while trying to fulfill the request. The request can
  1710. // be retried.
  1711. //
  1712. // * ErrCodeInternalException "KMSInternalException"
  1713. // The request was rejected because an internal exception occurred. The request
  1714. // can be retried.
  1715. //
  1716. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  1717. // The request was rejected because the state of the specified resource is not
  1718. // valid for this request.
  1719. //
  1720. // For more information about how key state affects the use of a CMK, see How
  1721. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  1722. // in the AWS Key Management Service Developer Guide.
  1723. //
  1724. // * ErrCodeUnsupportedOperationException "UnsupportedOperationException"
  1725. // The request was rejected because a specified parameter is not supported or
  1726. // a specified resource is not valid for this operation.
  1727. //
  1728. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DisableKeyRotation
  1729. func (c *KMS) DisableKeyRotation(input *DisableKeyRotationInput) (*DisableKeyRotationOutput, error) {
  1730. req, out := c.DisableKeyRotationRequest(input)
  1731. return out, req.Send()
  1732. }
  1733. // DisableKeyRotationWithContext is the same as DisableKeyRotation with the addition of
  1734. // the ability to pass a context and additional request options.
  1735. //
  1736. // See DisableKeyRotation for details on how to use this API operation.
  1737. //
  1738. // The context must be non-nil and will be used for request cancellation. If
  1739. // the context is nil a panic will occur. In the future the SDK may create
  1740. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1741. // for more information on using Contexts.
  1742. func (c *KMS) DisableKeyRotationWithContext(ctx aws.Context, input *DisableKeyRotationInput, opts ...request.Option) (*DisableKeyRotationOutput, error) {
  1743. req, out := c.DisableKeyRotationRequest(input)
  1744. req.SetContext(ctx)
  1745. req.ApplyOptions(opts...)
  1746. return out, req.Send()
  1747. }
  1748. const opDisconnectCustomKeyStore = "DisconnectCustomKeyStore"
  1749. // DisconnectCustomKeyStoreRequest generates a "aws/request.Request" representing the
  1750. // client's request for the DisconnectCustomKeyStore operation. The "output" return
  1751. // value will be populated with the request's response once the request completes
  1752. // successfully.
  1753. //
  1754. // Use "Send" method on the returned Request to send the API call to the service.
  1755. // the "output" return value is not valid until after Send returns without error.
  1756. //
  1757. // See DisconnectCustomKeyStore for more information on using the DisconnectCustomKeyStore
  1758. // API call, and error handling.
  1759. //
  1760. // This method is useful when you want to inject custom logic or configuration
  1761. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  1762. //
  1763. //
  1764. // // Example sending a request using the DisconnectCustomKeyStoreRequest method.
  1765. // req, resp := client.DisconnectCustomKeyStoreRequest(params)
  1766. //
  1767. // err := req.Send()
  1768. // if err == nil { // resp is now filled
  1769. // fmt.Println(resp)
  1770. // }
  1771. //
  1772. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DisconnectCustomKeyStore
  1773. func (c *KMS) DisconnectCustomKeyStoreRequest(input *DisconnectCustomKeyStoreInput) (req *request.Request, output *DisconnectCustomKeyStoreOutput) {
  1774. op := &request.Operation{
  1775. Name: opDisconnectCustomKeyStore,
  1776. HTTPMethod: "POST",
  1777. HTTPPath: "/",
  1778. }
  1779. if input == nil {
  1780. input = &DisconnectCustomKeyStoreInput{}
  1781. }
  1782. output = &DisconnectCustomKeyStoreOutput{}
  1783. req = c.newRequest(op, input, output)
  1784. req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
  1785. return
  1786. }
  1787. // DisconnectCustomKeyStore API operation for AWS Key Management Service.
  1788. //
  1789. // Disconnects the custom key store (http://docs.aws.amazon.com/kms/latest/developerguide/key-store-overview.html)
  1790. // from its associated AWS CloudHSM cluster. While a custom key store is disconnected,
  1791. // you can manage the custom key store and its customer master keys (CMKs),
  1792. // but you cannot create or use CMKs in the custom key store. You can reconnect
  1793. // the custom key store at any time.
  1794. //
  1795. // While a custom key store is disconnected, all attempts to create customer
  1796. // master keys (CMKs) in the custom key store or to use existing CMKs in cryptographic
  1797. // operations will fail. This action can prevent users from storing and accessing
  1798. // sensitive data.
  1799. //
  1800. // To find the connection state of a custom key store, use the DescribeCustomKeyStoresoperation. To reconnect a custom key store, use the ConnectCustomKeyStoreoperation.
  1801. //
  1802. // If the operation succeeds, it returns a JSON object with no properties.
  1803. //
  1804. // This operation is part of the Custom Key Store feature (http://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html)
  1805. //
  1806. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  1807. // with awserr.Error's Code and Message methods to get detailed information about
  1808. // the error.
  1809. //
  1810. // See the AWS API reference guide for AWS Key Management Service's
  1811. // API operation DisconnectCustomKeyStore for usage and error information.
  1812. //
  1813. // Returned Error Codes:
  1814. // * ErrCodeCustomKeyStoreInvalidStateException "CustomKeyStoreInvalidStateException"
  1815. // The request was rejected because of the ConnectionState of the custom key
  1816. // store. To get the ConnectionState of a custom key store, use the DescribeCustomKeyStores
  1817. // operation.
  1818. //
  1819. // This exception is thrown under the following conditions:
  1820. //
  1821. // * You requested the CreateKey or GenerateRandom operation in a custom
  1822. // key store that is not connected. These operations are valid only when
  1823. // the custom key store ConnectionState is CONNECTED.
  1824. //
  1825. // * You requested the UpdateCustomKeyStore or DeleteCustomKeyStore operation
  1826. // on a custom key store that is not disconnected. This operation is valid
  1827. // only when the custom key store ConnectionState is DISCONNECTED.
  1828. //
  1829. // * You requested the ConnectCustomKeyStore operation on a custom key store
  1830. // with a ConnectionState of DISCONNECTING or FAILED. This operation is valid
  1831. // for all other ConnectionState values.
  1832. //
  1833. // * ErrCodeCustomKeyStoreNotFoundException "CustomKeyStoreNotFoundException"
  1834. // The request was rejected because AWS KMS cannot find a custom key store with
  1835. // the specified key store name or ID.
  1836. //
  1837. // * ErrCodeInternalException "KMSInternalException"
  1838. // The request was rejected because an internal exception occurred. The request
  1839. // can be retried.
  1840. //
  1841. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/DisconnectCustomKeyStore
  1842. func (c *KMS) DisconnectCustomKeyStore(input *DisconnectCustomKeyStoreInput) (*DisconnectCustomKeyStoreOutput, error) {
  1843. req, out := c.DisconnectCustomKeyStoreRequest(input)
  1844. return out, req.Send()
  1845. }
  1846. // DisconnectCustomKeyStoreWithContext is the same as DisconnectCustomKeyStore with the addition of
  1847. // the ability to pass a context and additional request options.
  1848. //
  1849. // See DisconnectCustomKeyStore for details on how to use this API operation.
  1850. //
  1851. // The context must be non-nil and will be used for request cancellation. If
  1852. // the context is nil a panic will occur. In the future the SDK may create
  1853. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1854. // for more information on using Contexts.
  1855. func (c *KMS) DisconnectCustomKeyStoreWithContext(ctx aws.Context, input *DisconnectCustomKeyStoreInput, opts ...request.Option) (*DisconnectCustomKeyStoreOutput, error) {
  1856. req, out := c.DisconnectCustomKeyStoreRequest(input)
  1857. req.SetContext(ctx)
  1858. req.ApplyOptions(opts...)
  1859. return out, req.Send()
  1860. }
  1861. const opEnableKey = "EnableKey"
  1862. // EnableKeyRequest generates a "aws/request.Request" representing the
  1863. // client's request for the EnableKey operation. The "output" return
  1864. // value will be populated with the request's response once the request completes
  1865. // successfully.
  1866. //
  1867. // Use "Send" method on the returned Request to send the API call to the service.
  1868. // the "output" return value is not valid until after Send returns without error.
  1869. //
  1870. // See EnableKey for more information on using the EnableKey
  1871. // API call, and error handling.
  1872. //
  1873. // This method is useful when you want to inject custom logic or configuration
  1874. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  1875. //
  1876. //
  1877. // // Example sending a request using the EnableKeyRequest method.
  1878. // req, resp := client.EnableKeyRequest(params)
  1879. //
  1880. // err := req.Send()
  1881. // if err == nil { // resp is now filled
  1882. // fmt.Println(resp)
  1883. // }
  1884. //
  1885. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/EnableKey
  1886. func (c *KMS) EnableKeyRequest(input *EnableKeyInput) (req *request.Request, output *EnableKeyOutput) {
  1887. op := &request.Operation{
  1888. Name: opEnableKey,
  1889. HTTPMethod: "POST",
  1890. HTTPPath: "/",
  1891. }
  1892. if input == nil {
  1893. input = &EnableKeyInput{}
  1894. }
  1895. output = &EnableKeyOutput{}
  1896. req = c.newRequest(op, input, output)
  1897. req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
  1898. return
  1899. }
  1900. // EnableKey API operation for AWS Key Management Service.
  1901. //
  1902. // Sets the key state of a customer master key (CMK) to enabled. This allows
  1903. // you to use the CMK for cryptographic operations. You cannot perform this
  1904. // operation on a CMK in a different AWS account.
  1905. //
  1906. // The result of this operation varies with the key state of the CMK. For details,
  1907. // see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  1908. // in the AWS Key Management Service Developer Guide.
  1909. //
  1910. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  1911. // with awserr.Error's Code and Message methods to get detailed information about
  1912. // the error.
  1913. //
  1914. // See the AWS API reference guide for AWS Key Management Service's
  1915. // API operation EnableKey for usage and error information.
  1916. //
  1917. // Returned Error Codes:
  1918. // * ErrCodeNotFoundException "NotFoundException"
  1919. // The request was rejected because the specified entity or resource could not
  1920. // be found.
  1921. //
  1922. // * ErrCodeInvalidArnException "InvalidArnException"
  1923. // The request was rejected because a specified ARN was not valid.
  1924. //
  1925. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  1926. // The system timed out while trying to fulfill the request. The request can
  1927. // be retried.
  1928. //
  1929. // * ErrCodeInternalException "KMSInternalException"
  1930. // The request was rejected because an internal exception occurred. The request
  1931. // can be retried.
  1932. //
  1933. // * ErrCodeLimitExceededException "LimitExceededException"
  1934. // The request was rejected because a limit was exceeded. For more information,
  1935. // see Limits (http://docs.aws.amazon.com/kms/latest/developerguide/limits.html)
  1936. // in the AWS Key Management Service Developer Guide.
  1937. //
  1938. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  1939. // The request was rejected because the state of the specified resource is not
  1940. // valid for this request.
  1941. //
  1942. // For more information about how key state affects the use of a CMK, see How
  1943. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  1944. // in the AWS Key Management Service Developer Guide.
  1945. //
  1946. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/EnableKey
  1947. func (c *KMS) EnableKey(input *EnableKeyInput) (*EnableKeyOutput, error) {
  1948. req, out := c.EnableKeyRequest(input)
  1949. return out, req.Send()
  1950. }
  1951. // EnableKeyWithContext is the same as EnableKey with the addition of
  1952. // the ability to pass a context and additional request options.
  1953. //
  1954. // See EnableKey for details on how to use this API operation.
  1955. //
  1956. // The context must be non-nil and will be used for request cancellation. If
  1957. // the context is nil a panic will occur. In the future the SDK may create
  1958. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1959. // for more information on using Contexts.
  1960. func (c *KMS) EnableKeyWithContext(ctx aws.Context, input *EnableKeyInput, opts ...request.Option) (*EnableKeyOutput, error) {
  1961. req, out := c.EnableKeyRequest(input)
  1962. req.SetContext(ctx)
  1963. req.ApplyOptions(opts...)
  1964. return out, req.Send()
  1965. }
  1966. const opEnableKeyRotation = "EnableKeyRotation"
  1967. // EnableKeyRotationRequest generates a "aws/request.Request" representing the
  1968. // client's request for the EnableKeyRotation operation. The "output" return
  1969. // value will be populated with the request's response once the request completes
  1970. // successfully.
  1971. //
  1972. // Use "Send" method on the returned Request to send the API call to the service.
  1973. // the "output" return value is not valid until after Send returns without error.
  1974. //
  1975. // See EnableKeyRotation for more information on using the EnableKeyRotation
  1976. // API call, and error handling.
  1977. //
  1978. // This method is useful when you want to inject custom logic or configuration
  1979. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  1980. //
  1981. //
  1982. // // Example sending a request using the EnableKeyRotationRequest method.
  1983. // req, resp := client.EnableKeyRotationRequest(params)
  1984. //
  1985. // err := req.Send()
  1986. // if err == nil { // resp is now filled
  1987. // fmt.Println(resp)
  1988. // }
  1989. //
  1990. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/EnableKeyRotation
  1991. func (c *KMS) EnableKeyRotationRequest(input *EnableKeyRotationInput) (req *request.Request, output *EnableKeyRotationOutput) {
  1992. op := &request.Operation{
  1993. Name: opEnableKeyRotation,
  1994. HTTPMethod: "POST",
  1995. HTTPPath: "/",
  1996. }
  1997. if input == nil {
  1998. input = &EnableKeyRotationInput{}
  1999. }
  2000. output = &EnableKeyRotationOutput{}
  2001. req = c.newRequest(op, input, output)
  2002. req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
  2003. return
  2004. }
  2005. // EnableKeyRotation API operation for AWS Key Management Service.
  2006. //
  2007. // Enables automatic rotation of the key material (http://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html)
  2008. // for the specified customer master key (CMK). You cannot perform this operation
  2009. // on a CMK in a different AWS account.
  2010. //
  2011. // You cannot enable automatic rotation of CMKs with imported key material or
  2012. // CMKs in a custom key store (http://docs.aws.amazon.com/kms/latest/developerguide/key-store-overview.html).
  2013. //
  2014. // The result of this operation varies with the key state of the CMK. For details,
  2015. // see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  2016. // in the AWS Key Management Service Developer Guide.
  2017. //
  2018. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  2019. // with awserr.Error's Code and Message methods to get detailed information about
  2020. // the error.
  2021. //
  2022. // See the AWS API reference guide for AWS Key Management Service's
  2023. // API operation EnableKeyRotation for usage and error information.
  2024. //
  2025. // Returned Error Codes:
  2026. // * ErrCodeNotFoundException "NotFoundException"
  2027. // The request was rejected because the specified entity or resource could not
  2028. // be found.
  2029. //
  2030. // * ErrCodeDisabledException "DisabledException"
  2031. // The request was rejected because the specified CMK is not enabled.
  2032. //
  2033. // * ErrCodeInvalidArnException "InvalidArnException"
  2034. // The request was rejected because a specified ARN was not valid.
  2035. //
  2036. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  2037. // The system timed out while trying to fulfill the request. The request can
  2038. // be retried.
  2039. //
  2040. // * ErrCodeInternalException "KMSInternalException"
  2041. // The request was rejected because an internal exception occurred. The request
  2042. // can be retried.
  2043. //
  2044. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  2045. // The request was rejected because the state of the specified resource is not
  2046. // valid for this request.
  2047. //
  2048. // For more information about how key state affects the use of a CMK, see How
  2049. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  2050. // in the AWS Key Management Service Developer Guide.
  2051. //
  2052. // * ErrCodeUnsupportedOperationException "UnsupportedOperationException"
  2053. // The request was rejected because a specified parameter is not supported or
  2054. // a specified resource is not valid for this operation.
  2055. //
  2056. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/EnableKeyRotation
  2057. func (c *KMS) EnableKeyRotation(input *EnableKeyRotationInput) (*EnableKeyRotationOutput, error) {
  2058. req, out := c.EnableKeyRotationRequest(input)
  2059. return out, req.Send()
  2060. }
  2061. // EnableKeyRotationWithContext is the same as EnableKeyRotation with the addition of
  2062. // the ability to pass a context and additional request options.
  2063. //
  2064. // See EnableKeyRotation for details on how to use this API operation.
  2065. //
  2066. // The context must be non-nil and will be used for request cancellation. If
  2067. // the context is nil a panic will occur. In the future the SDK may create
  2068. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  2069. // for more information on using Contexts.
  2070. func (c *KMS) EnableKeyRotationWithContext(ctx aws.Context, input *EnableKeyRotationInput, opts ...request.Option) (*EnableKeyRotationOutput, error) {
  2071. req, out := c.EnableKeyRotationRequest(input)
  2072. req.SetContext(ctx)
  2073. req.ApplyOptions(opts...)
  2074. return out, req.Send()
  2075. }
  2076. const opEncrypt = "Encrypt"
  2077. // EncryptRequest generates a "aws/request.Request" representing the
  2078. // client's request for the Encrypt operation. The "output" return
  2079. // value will be populated with the request's response once the request completes
  2080. // successfully.
  2081. //
  2082. // Use "Send" method on the returned Request to send the API call to the service.
  2083. // the "output" return value is not valid until after Send returns without error.
  2084. //
  2085. // See Encrypt for more information on using the Encrypt
  2086. // API call, and error handling.
  2087. //
  2088. // This method is useful when you want to inject custom logic or configuration
  2089. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  2090. //
  2091. //
  2092. // // Example sending a request using the EncryptRequest method.
  2093. // req, resp := client.EncryptRequest(params)
  2094. //
  2095. // err := req.Send()
  2096. // if err == nil { // resp is now filled
  2097. // fmt.Println(resp)
  2098. // }
  2099. //
  2100. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/Encrypt
  2101. func (c *KMS) EncryptRequest(input *EncryptInput) (req *request.Request, output *EncryptOutput) {
  2102. op := &request.Operation{
  2103. Name: opEncrypt,
  2104. HTTPMethod: "POST",
  2105. HTTPPath: "/",
  2106. }
  2107. if input == nil {
  2108. input = &EncryptInput{}
  2109. }
  2110. output = &EncryptOutput{}
  2111. req = c.newRequest(op, input, output)
  2112. return
  2113. }
  2114. // Encrypt API operation for AWS Key Management Service.
  2115. //
  2116. // Encrypts plaintext into ciphertext by using a customer master key (CMK).
  2117. // The Encrypt operation has two primary use cases:
  2118. //
  2119. // * You can encrypt up to 4 kilobytes (4096 bytes) of arbitrary data such
  2120. // as an RSA key, a database password, or other sensitive information.
  2121. //
  2122. // * To move encrypted data from one AWS region to another, you can use this
  2123. // operation to encrypt in the new region the plaintext data key that was
  2124. // used to encrypt the data in the original region. This provides you with
  2125. // an encrypted copy of the data key that can be decrypted in the new region
  2126. // and used there to decrypt the encrypted data.
  2127. //
  2128. // To perform this operation on a CMK in a different AWS account, specify the
  2129. // key ARN or alias ARN in the value of the KeyId parameter.
  2130. //
  2131. // Unless you are moving encrypted data from one region to another, you don't
  2132. // use this operation to encrypt a generated data key within a region. To get
  2133. // data keys that are already encrypted, call the GenerateDataKey or GenerateDataKeyWithoutPlaintext
  2134. // operation. Data keys don't need to be encrypted again by calling Encrypt.
  2135. //
  2136. // To encrypt data locally in your application, use the GenerateDataKey operation
  2137. // to return a plaintext data encryption key and a copy of the key encrypted
  2138. // under the CMK of your choosing.
  2139. //
  2140. // The result of this operation varies with the key state of the CMK. For details,
  2141. // see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  2142. // in the AWS Key Management Service Developer Guide.
  2143. //
  2144. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  2145. // with awserr.Error's Code and Message methods to get detailed information about
  2146. // the error.
  2147. //
  2148. // See the AWS API reference guide for AWS Key Management Service's
  2149. // API operation Encrypt for usage and error information.
  2150. //
  2151. // Returned Error Codes:
  2152. // * ErrCodeNotFoundException "NotFoundException"
  2153. // The request was rejected because the specified entity or resource could not
  2154. // be found.
  2155. //
  2156. // * ErrCodeDisabledException "DisabledException"
  2157. // The request was rejected because the specified CMK is not enabled.
  2158. //
  2159. // * ErrCodeKeyUnavailableException "KeyUnavailableException"
  2160. // The request was rejected because the specified CMK was not available. The
  2161. // request can be retried.
  2162. //
  2163. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  2164. // The system timed out while trying to fulfill the request. The request can
  2165. // be retried.
  2166. //
  2167. // * ErrCodeInvalidKeyUsageException "InvalidKeyUsageException"
  2168. // The request was rejected because the specified KeySpec value is not valid.
  2169. //
  2170. // * ErrCodeInvalidGrantTokenException "InvalidGrantTokenException"
  2171. // The request was rejected because the specified grant token is not valid.
  2172. //
  2173. // * ErrCodeInternalException "KMSInternalException"
  2174. // The request was rejected because an internal exception occurred. The request
  2175. // can be retried.
  2176. //
  2177. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  2178. // The request was rejected because the state of the specified resource is not
  2179. // valid for this request.
  2180. //
  2181. // For more information about how key state affects the use of a CMK, see How
  2182. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  2183. // in the AWS Key Management Service Developer Guide.
  2184. //
  2185. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/Encrypt
  2186. func (c *KMS) Encrypt(input *EncryptInput) (*EncryptOutput, error) {
  2187. req, out := c.EncryptRequest(input)
  2188. return out, req.Send()
  2189. }
  2190. // EncryptWithContext is the same as Encrypt with the addition of
  2191. // the ability to pass a context and additional request options.
  2192. //
  2193. // See Encrypt for details on how to use this API operation.
  2194. //
  2195. // The context must be non-nil and will be used for request cancellation. If
  2196. // the context is nil a panic will occur. In the future the SDK may create
  2197. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  2198. // for more information on using Contexts.
  2199. func (c *KMS) EncryptWithContext(ctx aws.Context, input *EncryptInput, opts ...request.Option) (*EncryptOutput, error) {
  2200. req, out := c.EncryptRequest(input)
  2201. req.SetContext(ctx)
  2202. req.ApplyOptions(opts...)
  2203. return out, req.Send()
  2204. }
  2205. const opGenerateDataKey = "GenerateDataKey"
  2206. // GenerateDataKeyRequest generates a "aws/request.Request" representing the
  2207. // client's request for the GenerateDataKey operation. The "output" return
  2208. // value will be populated with the request's response once the request completes
  2209. // successfully.
  2210. //
  2211. // Use "Send" method on the returned Request to send the API call to the service.
  2212. // the "output" return value is not valid until after Send returns without error.
  2213. //
  2214. // See GenerateDataKey for more information on using the GenerateDataKey
  2215. // API call, and error handling.
  2216. //
  2217. // This method is useful when you want to inject custom logic or configuration
  2218. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  2219. //
  2220. //
  2221. // // Example sending a request using the GenerateDataKeyRequest method.
  2222. // req, resp := client.GenerateDataKeyRequest(params)
  2223. //
  2224. // err := req.Send()
  2225. // if err == nil { // resp is now filled
  2226. // fmt.Println(resp)
  2227. // }
  2228. //
  2229. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateDataKey
  2230. func (c *KMS) GenerateDataKeyRequest(input *GenerateDataKeyInput) (req *request.Request, output *GenerateDataKeyOutput) {
  2231. op := &request.Operation{
  2232. Name: opGenerateDataKey,
  2233. HTTPMethod: "POST",
  2234. HTTPPath: "/",
  2235. }
  2236. if input == nil {
  2237. input = &GenerateDataKeyInput{}
  2238. }
  2239. output = &GenerateDataKeyOutput{}
  2240. req = c.newRequest(op, input, output)
  2241. return
  2242. }
  2243. // GenerateDataKey API operation for AWS Key Management Service.
  2244. //
  2245. // Returns a data encryption key that you can use in your application to encrypt
  2246. // data locally.
  2247. //
  2248. // You must specify the customer master key (CMK) under which to generate the
  2249. // data key. You must also specify the length of the data key using either the
  2250. // KeySpec or NumberOfBytes field. You must specify one field or the other,
  2251. // but not both. For common key lengths (128-bit and 256-bit symmetric keys),
  2252. // we recommend that you use KeySpec. To perform this operation on a CMK in
  2253. // a different AWS account, specify the key ARN or alias ARN in the value of
  2254. // the KeyId parameter.
  2255. //
  2256. // This operation returns a plaintext copy of the data key in the Plaintext
  2257. // field of the response, and an encrypted copy of the data key in the CiphertextBlob
  2258. // field. The data key is encrypted under the CMK specified in the KeyId field
  2259. // of the request.
  2260. //
  2261. // We recommend that you use the following pattern to encrypt data locally in
  2262. // your application:
  2263. //
  2264. // Use this operation (GenerateDataKey) to get a data encryption key.
  2265. //
  2266. // Use the plaintext data encryption key (returned in the Plaintext field of
  2267. // the response) to encrypt data locally, then erase the plaintext data key
  2268. // from memory.
  2269. //
  2270. // Store the encrypted data key (returned in the CiphertextBlob field of the
  2271. // response) alongside the locally encrypted data.
  2272. //
  2273. // To decrypt data locally:
  2274. //
  2275. // Use the Decrypt operation to decrypt the encrypted data key into a plaintext
  2276. // copy of the data key.
  2277. //
  2278. // Use the plaintext data key to decrypt data locally, then erase the plaintext
  2279. // data key from memory.
  2280. //
  2281. // To return only an encrypted copy of the data key, use GenerateDataKeyWithoutPlaintext.
  2282. // To return a random byte string that is cryptographically secure, use GenerateRandom.
  2283. //
  2284. // If you use the optional EncryptionContext field, you must store at least
  2285. // enough information to be able to reconstruct the full encryption context
  2286. // when you later send the ciphertext to the Decrypt operation. It is a good
  2287. // practice to choose an encryption context that you can reconstruct on the
  2288. // fly to better secure the ciphertext. For more information, see Encryption
  2289. // Context (http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html)
  2290. // in the AWS Key Management Service Developer Guide.
  2291. //
  2292. // The result of this operation varies with the key state of the CMK. For details,
  2293. // see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  2294. // in the AWS Key Management Service Developer Guide.
  2295. //
  2296. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  2297. // with awserr.Error's Code and Message methods to get detailed information about
  2298. // the error.
  2299. //
  2300. // See the AWS API reference guide for AWS Key Management Service's
  2301. // API operation GenerateDataKey for usage and error information.
  2302. //
  2303. // Returned Error Codes:
  2304. // * ErrCodeNotFoundException "NotFoundException"
  2305. // The request was rejected because the specified entity or resource could not
  2306. // be found.
  2307. //
  2308. // * ErrCodeDisabledException "DisabledException"
  2309. // The request was rejected because the specified CMK is not enabled.
  2310. //
  2311. // * ErrCodeKeyUnavailableException "KeyUnavailableException"
  2312. // The request was rejected because the specified CMK was not available. The
  2313. // request can be retried.
  2314. //
  2315. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  2316. // The system timed out while trying to fulfill the request. The request can
  2317. // be retried.
  2318. //
  2319. // * ErrCodeInvalidKeyUsageException "InvalidKeyUsageException"
  2320. // The request was rejected because the specified KeySpec value is not valid.
  2321. //
  2322. // * ErrCodeInvalidGrantTokenException "InvalidGrantTokenException"
  2323. // The request was rejected because the specified grant token is not valid.
  2324. //
  2325. // * ErrCodeInternalException "KMSInternalException"
  2326. // The request was rejected because an internal exception occurred. The request
  2327. // can be retried.
  2328. //
  2329. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  2330. // The request was rejected because the state of the specified resource is not
  2331. // valid for this request.
  2332. //
  2333. // For more information about how key state affects the use of a CMK, see How
  2334. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  2335. // in the AWS Key Management Service Developer Guide.
  2336. //
  2337. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateDataKey
  2338. func (c *KMS) GenerateDataKey(input *GenerateDataKeyInput) (*GenerateDataKeyOutput, error) {
  2339. req, out := c.GenerateDataKeyRequest(input)
  2340. return out, req.Send()
  2341. }
  2342. // GenerateDataKeyWithContext is the same as GenerateDataKey with the addition of
  2343. // the ability to pass a context and additional request options.
  2344. //
  2345. // See GenerateDataKey for details on how to use this API operation.
  2346. //
  2347. // The context must be non-nil and will be used for request cancellation. If
  2348. // the context is nil a panic will occur. In the future the SDK may create
  2349. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  2350. // for more information on using Contexts.
  2351. func (c *KMS) GenerateDataKeyWithContext(ctx aws.Context, input *GenerateDataKeyInput, opts ...request.Option) (*GenerateDataKeyOutput, error) {
  2352. req, out := c.GenerateDataKeyRequest(input)
  2353. req.SetContext(ctx)
  2354. req.ApplyOptions(opts...)
  2355. return out, req.Send()
  2356. }
  2357. const opGenerateDataKeyWithoutPlaintext = "GenerateDataKeyWithoutPlaintext"
  2358. // GenerateDataKeyWithoutPlaintextRequest generates a "aws/request.Request" representing the
  2359. // client's request for the GenerateDataKeyWithoutPlaintext operation. The "output" return
  2360. // value will be populated with the request's response once the request completes
  2361. // successfully.
  2362. //
  2363. // Use "Send" method on the returned Request to send the API call to the service.
  2364. // the "output" return value is not valid until after Send returns without error.
  2365. //
  2366. // See GenerateDataKeyWithoutPlaintext for more information on using the GenerateDataKeyWithoutPlaintext
  2367. // API call, and error handling.
  2368. //
  2369. // This method is useful when you want to inject custom logic or configuration
  2370. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  2371. //
  2372. //
  2373. // // Example sending a request using the GenerateDataKeyWithoutPlaintextRequest method.
  2374. // req, resp := client.GenerateDataKeyWithoutPlaintextRequest(params)
  2375. //
  2376. // err := req.Send()
  2377. // if err == nil { // resp is now filled
  2378. // fmt.Println(resp)
  2379. // }
  2380. //
  2381. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateDataKeyWithoutPlaintext
  2382. func (c *KMS) GenerateDataKeyWithoutPlaintextRequest(input *GenerateDataKeyWithoutPlaintextInput) (req *request.Request, output *GenerateDataKeyWithoutPlaintextOutput) {
  2383. op := &request.Operation{
  2384. Name: opGenerateDataKeyWithoutPlaintext,
  2385. HTTPMethod: "POST",
  2386. HTTPPath: "/",
  2387. }
  2388. if input == nil {
  2389. input = &GenerateDataKeyWithoutPlaintextInput{}
  2390. }
  2391. output = &GenerateDataKeyWithoutPlaintextOutput{}
  2392. req = c.newRequest(op, input, output)
  2393. return
  2394. }
  2395. // GenerateDataKeyWithoutPlaintext API operation for AWS Key Management Service.
  2396. //
  2397. // Returns a data encryption key encrypted under a customer master key (CMK).
  2398. // This operation is identical to GenerateDataKey but returns only the encrypted
  2399. // copy of the data key.
  2400. //
  2401. // To perform this operation on a CMK in a different AWS account, specify the
  2402. // key ARN or alias ARN in the value of the KeyId parameter.
  2403. //
  2404. // This operation is useful in a system that has multiple components with different
  2405. // degrees of trust. For example, consider a system that stores encrypted data
  2406. // in containers. Each container stores the encrypted data and an encrypted
  2407. // copy of the data key. One component of the system, called the control plane,
  2408. // creates new containers. When it creates a new container, it uses this operation
  2409. // (GenerateDataKeyWithoutPlaintext) to get an encrypted data key and then stores
  2410. // it in the container. Later, a different component of the system, called the
  2411. // data plane, puts encrypted data into the containers. To do this, it passes
  2412. // the encrypted data key to the Decrypt operation, then uses the returned plaintext
  2413. // data key to encrypt data, and finally stores the encrypted data in the container.
  2414. // In this system, the control plane never sees the plaintext data key.
  2415. //
  2416. // The result of this operation varies with the key state of the CMK. For details,
  2417. // see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  2418. // in the AWS Key Management Service Developer Guide.
  2419. //
  2420. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  2421. // with awserr.Error's Code and Message methods to get detailed information about
  2422. // the error.
  2423. //
  2424. // See the AWS API reference guide for AWS Key Management Service's
  2425. // API operation GenerateDataKeyWithoutPlaintext for usage and error information.
  2426. //
  2427. // Returned Error Codes:
  2428. // * ErrCodeNotFoundException "NotFoundException"
  2429. // The request was rejected because the specified entity or resource could not
  2430. // be found.
  2431. //
  2432. // * ErrCodeDisabledException "DisabledException"
  2433. // The request was rejected because the specified CMK is not enabled.
  2434. //
  2435. // * ErrCodeKeyUnavailableException "KeyUnavailableException"
  2436. // The request was rejected because the specified CMK was not available. The
  2437. // request can be retried.
  2438. //
  2439. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  2440. // The system timed out while trying to fulfill the request. The request can
  2441. // be retried.
  2442. //
  2443. // * ErrCodeInvalidKeyUsageException "InvalidKeyUsageException"
  2444. // The request was rejected because the specified KeySpec value is not valid.
  2445. //
  2446. // * ErrCodeInvalidGrantTokenException "InvalidGrantTokenException"
  2447. // The request was rejected because the specified grant token is not valid.
  2448. //
  2449. // * ErrCodeInternalException "KMSInternalException"
  2450. // The request was rejected because an internal exception occurred. The request
  2451. // can be retried.
  2452. //
  2453. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  2454. // The request was rejected because the state of the specified resource is not
  2455. // valid for this request.
  2456. //
  2457. // For more information about how key state affects the use of a CMK, see How
  2458. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  2459. // in the AWS Key Management Service Developer Guide.
  2460. //
  2461. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateDataKeyWithoutPlaintext
  2462. func (c *KMS) GenerateDataKeyWithoutPlaintext(input *GenerateDataKeyWithoutPlaintextInput) (*GenerateDataKeyWithoutPlaintextOutput, error) {
  2463. req, out := c.GenerateDataKeyWithoutPlaintextRequest(input)
  2464. return out, req.Send()
  2465. }
  2466. // GenerateDataKeyWithoutPlaintextWithContext is the same as GenerateDataKeyWithoutPlaintext with the addition of
  2467. // the ability to pass a context and additional request options.
  2468. //
  2469. // See GenerateDataKeyWithoutPlaintext for details on how to use this API operation.
  2470. //
  2471. // The context must be non-nil and will be used for request cancellation. If
  2472. // the context is nil a panic will occur. In the future the SDK may create
  2473. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  2474. // for more information on using Contexts.
  2475. func (c *KMS) GenerateDataKeyWithoutPlaintextWithContext(ctx aws.Context, input *GenerateDataKeyWithoutPlaintextInput, opts ...request.Option) (*GenerateDataKeyWithoutPlaintextOutput, error) {
  2476. req, out := c.GenerateDataKeyWithoutPlaintextRequest(input)
  2477. req.SetContext(ctx)
  2478. req.ApplyOptions(opts...)
  2479. return out, req.Send()
  2480. }
  2481. const opGenerateRandom = "GenerateRandom"
  2482. // GenerateRandomRequest generates a "aws/request.Request" representing the
  2483. // client's request for the GenerateRandom operation. The "output" return
  2484. // value will be populated with the request's response once the request completes
  2485. // successfully.
  2486. //
  2487. // Use "Send" method on the returned Request to send the API call to the service.
  2488. // the "output" return value is not valid until after Send returns without error.
  2489. //
  2490. // See GenerateRandom for more information on using the GenerateRandom
  2491. // API call, and error handling.
  2492. //
  2493. // This method is useful when you want to inject custom logic or configuration
  2494. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  2495. //
  2496. //
  2497. // // Example sending a request using the GenerateRandomRequest method.
  2498. // req, resp := client.GenerateRandomRequest(params)
  2499. //
  2500. // err := req.Send()
  2501. // if err == nil { // resp is now filled
  2502. // fmt.Println(resp)
  2503. // }
  2504. //
  2505. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateRandom
  2506. func (c *KMS) GenerateRandomRequest(input *GenerateRandomInput) (req *request.Request, output *GenerateRandomOutput) {
  2507. op := &request.Operation{
  2508. Name: opGenerateRandom,
  2509. HTTPMethod: "POST",
  2510. HTTPPath: "/",
  2511. }
  2512. if input == nil {
  2513. input = &GenerateRandomInput{}
  2514. }
  2515. output = &GenerateRandomOutput{}
  2516. req = c.newRequest(op, input, output)
  2517. return
  2518. }
  2519. // GenerateRandom API operation for AWS Key Management Service.
  2520. //
  2521. // Returns a random byte string that is cryptographically secure.
  2522. //
  2523. // By default, the random byte string is generated in AWS KMS. To generate the
  2524. // byte string in the AWS CloudHSM cluster that is associated with a custom
  2525. // key store (http://docs.aws.amazon.com/kms/latest/developerguide/key-store-overview.html),
  2526. // specify the custom key store ID.
  2527. //
  2528. // For more information about entropy and random number generation, see the
  2529. // AWS Key Management Service Cryptographic Details (https://d0.awsstatic.com/whitepapers/KMS-Cryptographic-Details.pdf)
  2530. // whitepaper.
  2531. //
  2532. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  2533. // with awserr.Error's Code and Message methods to get detailed information about
  2534. // the error.
  2535. //
  2536. // See the AWS API reference guide for AWS Key Management Service's
  2537. // API operation GenerateRandom for usage and error information.
  2538. //
  2539. // Returned Error Codes:
  2540. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  2541. // The system timed out while trying to fulfill the request. The request can
  2542. // be retried.
  2543. //
  2544. // * ErrCodeInternalException "KMSInternalException"
  2545. // The request was rejected because an internal exception occurred. The request
  2546. // can be retried.
  2547. //
  2548. // * ErrCodeCustomKeyStoreNotFoundException "CustomKeyStoreNotFoundException"
  2549. // The request was rejected because AWS KMS cannot find a custom key store with
  2550. // the specified key store name or ID.
  2551. //
  2552. // * ErrCodeCustomKeyStoreInvalidStateException "CustomKeyStoreInvalidStateException"
  2553. // The request was rejected because of the ConnectionState of the custom key
  2554. // store. To get the ConnectionState of a custom key store, use the DescribeCustomKeyStores
  2555. // operation.
  2556. //
  2557. // This exception is thrown under the following conditions:
  2558. //
  2559. // * You requested the CreateKey or GenerateRandom operation in a custom
  2560. // key store that is not connected. These operations are valid only when
  2561. // the custom key store ConnectionState is CONNECTED.
  2562. //
  2563. // * You requested the UpdateCustomKeyStore or DeleteCustomKeyStore operation
  2564. // on a custom key store that is not disconnected. This operation is valid
  2565. // only when the custom key store ConnectionState is DISCONNECTED.
  2566. //
  2567. // * You requested the ConnectCustomKeyStore operation on a custom key store
  2568. // with a ConnectionState of DISCONNECTING or FAILED. This operation is valid
  2569. // for all other ConnectionState values.
  2570. //
  2571. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GenerateRandom
  2572. func (c *KMS) GenerateRandom(input *GenerateRandomInput) (*GenerateRandomOutput, error) {
  2573. req, out := c.GenerateRandomRequest(input)
  2574. return out, req.Send()
  2575. }
  2576. // GenerateRandomWithContext is the same as GenerateRandom with the addition of
  2577. // the ability to pass a context and additional request options.
  2578. //
  2579. // See GenerateRandom for details on how to use this API operation.
  2580. //
  2581. // The context must be non-nil and will be used for request cancellation. If
  2582. // the context is nil a panic will occur. In the future the SDK may create
  2583. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  2584. // for more information on using Contexts.
  2585. func (c *KMS) GenerateRandomWithContext(ctx aws.Context, input *GenerateRandomInput, opts ...request.Option) (*GenerateRandomOutput, error) {
  2586. req, out := c.GenerateRandomRequest(input)
  2587. req.SetContext(ctx)
  2588. req.ApplyOptions(opts...)
  2589. return out, req.Send()
  2590. }
  2591. const opGetKeyPolicy = "GetKeyPolicy"
  2592. // GetKeyPolicyRequest generates a "aws/request.Request" representing the
  2593. // client's request for the GetKeyPolicy operation. The "output" return
  2594. // value will be populated with the request's response once the request completes
  2595. // successfully.
  2596. //
  2597. // Use "Send" method on the returned Request to send the API call to the service.
  2598. // the "output" return value is not valid until after Send returns without error.
  2599. //
  2600. // See GetKeyPolicy for more information on using the GetKeyPolicy
  2601. // API call, and error handling.
  2602. //
  2603. // This method is useful when you want to inject custom logic or configuration
  2604. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  2605. //
  2606. //
  2607. // // Example sending a request using the GetKeyPolicyRequest method.
  2608. // req, resp := client.GetKeyPolicyRequest(params)
  2609. //
  2610. // err := req.Send()
  2611. // if err == nil { // resp is now filled
  2612. // fmt.Println(resp)
  2613. // }
  2614. //
  2615. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GetKeyPolicy
  2616. func (c *KMS) GetKeyPolicyRequest(input *GetKeyPolicyInput) (req *request.Request, output *GetKeyPolicyOutput) {
  2617. op := &request.Operation{
  2618. Name: opGetKeyPolicy,
  2619. HTTPMethod: "POST",
  2620. HTTPPath: "/",
  2621. }
  2622. if input == nil {
  2623. input = &GetKeyPolicyInput{}
  2624. }
  2625. output = &GetKeyPolicyOutput{}
  2626. req = c.newRequest(op, input, output)
  2627. return
  2628. }
  2629. // GetKeyPolicy API operation for AWS Key Management Service.
  2630. //
  2631. // Gets a key policy attached to the specified customer master key (CMK). You
  2632. // cannot perform this operation on a CMK in a different AWS account.
  2633. //
  2634. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  2635. // with awserr.Error's Code and Message methods to get detailed information about
  2636. // the error.
  2637. //
  2638. // See the AWS API reference guide for AWS Key Management Service's
  2639. // API operation GetKeyPolicy for usage and error information.
  2640. //
  2641. // Returned Error Codes:
  2642. // * ErrCodeNotFoundException "NotFoundException"
  2643. // The request was rejected because the specified entity or resource could not
  2644. // be found.
  2645. //
  2646. // * ErrCodeInvalidArnException "InvalidArnException"
  2647. // The request was rejected because a specified ARN was not valid.
  2648. //
  2649. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  2650. // The system timed out while trying to fulfill the request. The request can
  2651. // be retried.
  2652. //
  2653. // * ErrCodeInternalException "KMSInternalException"
  2654. // The request was rejected because an internal exception occurred. The request
  2655. // can be retried.
  2656. //
  2657. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  2658. // The request was rejected because the state of the specified resource is not
  2659. // valid for this request.
  2660. //
  2661. // For more information about how key state affects the use of a CMK, see How
  2662. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  2663. // in the AWS Key Management Service Developer Guide.
  2664. //
  2665. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GetKeyPolicy
  2666. func (c *KMS) GetKeyPolicy(input *GetKeyPolicyInput) (*GetKeyPolicyOutput, error) {
  2667. req, out := c.GetKeyPolicyRequest(input)
  2668. return out, req.Send()
  2669. }
  2670. // GetKeyPolicyWithContext is the same as GetKeyPolicy with the addition of
  2671. // the ability to pass a context and additional request options.
  2672. //
  2673. // See GetKeyPolicy for details on how to use this API operation.
  2674. //
  2675. // The context must be non-nil and will be used for request cancellation. If
  2676. // the context is nil a panic will occur. In the future the SDK may create
  2677. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  2678. // for more information on using Contexts.
  2679. func (c *KMS) GetKeyPolicyWithContext(ctx aws.Context, input *GetKeyPolicyInput, opts ...request.Option) (*GetKeyPolicyOutput, error) {
  2680. req, out := c.GetKeyPolicyRequest(input)
  2681. req.SetContext(ctx)
  2682. req.ApplyOptions(opts...)
  2683. return out, req.Send()
  2684. }
  2685. const opGetKeyRotationStatus = "GetKeyRotationStatus"
  2686. // GetKeyRotationStatusRequest generates a "aws/request.Request" representing the
  2687. // client's request for the GetKeyRotationStatus operation. The "output" return
  2688. // value will be populated with the request's response once the request completes
  2689. // successfully.
  2690. //
  2691. // Use "Send" method on the returned Request to send the API call to the service.
  2692. // the "output" return value is not valid until after Send returns without error.
  2693. //
  2694. // See GetKeyRotationStatus for more information on using the GetKeyRotationStatus
  2695. // API call, and error handling.
  2696. //
  2697. // This method is useful when you want to inject custom logic or configuration
  2698. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  2699. //
  2700. //
  2701. // // Example sending a request using the GetKeyRotationStatusRequest method.
  2702. // req, resp := client.GetKeyRotationStatusRequest(params)
  2703. //
  2704. // err := req.Send()
  2705. // if err == nil { // resp is now filled
  2706. // fmt.Println(resp)
  2707. // }
  2708. //
  2709. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GetKeyRotationStatus
  2710. func (c *KMS) GetKeyRotationStatusRequest(input *GetKeyRotationStatusInput) (req *request.Request, output *GetKeyRotationStatusOutput) {
  2711. op := &request.Operation{
  2712. Name: opGetKeyRotationStatus,
  2713. HTTPMethod: "POST",
  2714. HTTPPath: "/",
  2715. }
  2716. if input == nil {
  2717. input = &GetKeyRotationStatusInput{}
  2718. }
  2719. output = &GetKeyRotationStatusOutput{}
  2720. req = c.newRequest(op, input, output)
  2721. return
  2722. }
  2723. // GetKeyRotationStatus API operation for AWS Key Management Service.
  2724. //
  2725. // Gets a Boolean value that indicates whether automatic rotation of the key
  2726. // material (http://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html)
  2727. // is enabled for the specified customer master key (CMK).
  2728. //
  2729. // The result of this operation varies with the key state of the CMK. For details,
  2730. // see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  2731. // in the AWS Key Management Service Developer Guide.
  2732. //
  2733. // * Disabled: The key rotation status does not change when you disable a
  2734. // CMK. However, while the CMK is disabled, AWS KMS does not rotate the backing
  2735. // key.
  2736. //
  2737. // * Pending deletion: While a CMK is pending deletion, its key rotation
  2738. // status is false and AWS KMS does not rotate the backing key. If you cancel
  2739. // the deletion, the original key rotation status is restored.
  2740. //
  2741. // To perform this operation on a CMK in a different AWS account, specify the
  2742. // key ARN in the value of the KeyId parameter.
  2743. //
  2744. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  2745. // with awserr.Error's Code and Message methods to get detailed information about
  2746. // the error.
  2747. //
  2748. // See the AWS API reference guide for AWS Key Management Service's
  2749. // API operation GetKeyRotationStatus for usage and error information.
  2750. //
  2751. // Returned Error Codes:
  2752. // * ErrCodeNotFoundException "NotFoundException"
  2753. // The request was rejected because the specified entity or resource could not
  2754. // be found.
  2755. //
  2756. // * ErrCodeInvalidArnException "InvalidArnException"
  2757. // The request was rejected because a specified ARN was not valid.
  2758. //
  2759. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  2760. // The system timed out while trying to fulfill the request. The request can
  2761. // be retried.
  2762. //
  2763. // * ErrCodeInternalException "KMSInternalException"
  2764. // The request was rejected because an internal exception occurred. The request
  2765. // can be retried.
  2766. //
  2767. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  2768. // The request was rejected because the state of the specified resource is not
  2769. // valid for this request.
  2770. //
  2771. // For more information about how key state affects the use of a CMK, see How
  2772. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  2773. // in the AWS Key Management Service Developer Guide.
  2774. //
  2775. // * ErrCodeUnsupportedOperationException "UnsupportedOperationException"
  2776. // The request was rejected because a specified parameter is not supported or
  2777. // a specified resource is not valid for this operation.
  2778. //
  2779. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GetKeyRotationStatus
  2780. func (c *KMS) GetKeyRotationStatus(input *GetKeyRotationStatusInput) (*GetKeyRotationStatusOutput, error) {
  2781. req, out := c.GetKeyRotationStatusRequest(input)
  2782. return out, req.Send()
  2783. }
  2784. // GetKeyRotationStatusWithContext is the same as GetKeyRotationStatus with the addition of
  2785. // the ability to pass a context and additional request options.
  2786. //
  2787. // See GetKeyRotationStatus for details on how to use this API operation.
  2788. //
  2789. // The context must be non-nil and will be used for request cancellation. If
  2790. // the context is nil a panic will occur. In the future the SDK may create
  2791. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  2792. // for more information on using Contexts.
  2793. func (c *KMS) GetKeyRotationStatusWithContext(ctx aws.Context, input *GetKeyRotationStatusInput, opts ...request.Option) (*GetKeyRotationStatusOutput, error) {
  2794. req, out := c.GetKeyRotationStatusRequest(input)
  2795. req.SetContext(ctx)
  2796. req.ApplyOptions(opts...)
  2797. return out, req.Send()
  2798. }
  2799. const opGetParametersForImport = "GetParametersForImport"
  2800. // GetParametersForImportRequest generates a "aws/request.Request" representing the
  2801. // client's request for the GetParametersForImport operation. The "output" return
  2802. // value will be populated with the request's response once the request completes
  2803. // successfully.
  2804. //
  2805. // Use "Send" method on the returned Request to send the API call to the service.
  2806. // the "output" return value is not valid until after Send returns without error.
  2807. //
  2808. // See GetParametersForImport for more information on using the GetParametersForImport
  2809. // API call, and error handling.
  2810. //
  2811. // This method is useful when you want to inject custom logic or configuration
  2812. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  2813. //
  2814. //
  2815. // // Example sending a request using the GetParametersForImportRequest method.
  2816. // req, resp := client.GetParametersForImportRequest(params)
  2817. //
  2818. // err := req.Send()
  2819. // if err == nil { // resp is now filled
  2820. // fmt.Println(resp)
  2821. // }
  2822. //
  2823. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GetParametersForImport
  2824. func (c *KMS) GetParametersForImportRequest(input *GetParametersForImportInput) (req *request.Request, output *GetParametersForImportOutput) {
  2825. op := &request.Operation{
  2826. Name: opGetParametersForImport,
  2827. HTTPMethod: "POST",
  2828. HTTPPath: "/",
  2829. }
  2830. if input == nil {
  2831. input = &GetParametersForImportInput{}
  2832. }
  2833. output = &GetParametersForImportOutput{}
  2834. req = c.newRequest(op, input, output)
  2835. return
  2836. }
  2837. // GetParametersForImport API operation for AWS Key Management Service.
  2838. //
  2839. // Returns the items you need in order to import key material into AWS KMS from
  2840. // your existing key management infrastructure. For more information about importing
  2841. // key material into AWS KMS, see Importing Key Material (http://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html)
  2842. // in the AWS Key Management Service Developer Guide.
  2843. //
  2844. // You must specify the key ID of the customer master key (CMK) into which you
  2845. // will import key material. This CMK's Origin must be EXTERNAL. You must also
  2846. // specify the wrapping algorithm and type of wrapping key (public key) that
  2847. // you will use to encrypt the key material. You cannot perform this operation
  2848. // on a CMK in a different AWS account.
  2849. //
  2850. // This operation returns a public key and an import token. Use the public key
  2851. // to encrypt the key material. Store the import token to send with a subsequent
  2852. // ImportKeyMaterial request. The public key and import token from the same
  2853. // response must be used together. These items are valid for 24 hours. When
  2854. // they expire, they cannot be used for a subsequent ImportKeyMaterial request.
  2855. // To get new ones, send another GetParametersForImport request.
  2856. //
  2857. // The result of this operation varies with the key state of the CMK. For details,
  2858. // see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  2859. // in the AWS Key Management Service Developer Guide.
  2860. //
  2861. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  2862. // with awserr.Error's Code and Message methods to get detailed information about
  2863. // the error.
  2864. //
  2865. // See the AWS API reference guide for AWS Key Management Service's
  2866. // API operation GetParametersForImport for usage and error information.
  2867. //
  2868. // Returned Error Codes:
  2869. // * ErrCodeInvalidArnException "InvalidArnException"
  2870. // The request was rejected because a specified ARN was not valid.
  2871. //
  2872. // * ErrCodeUnsupportedOperationException "UnsupportedOperationException"
  2873. // The request was rejected because a specified parameter is not supported or
  2874. // a specified resource is not valid for this operation.
  2875. //
  2876. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  2877. // The system timed out while trying to fulfill the request. The request can
  2878. // be retried.
  2879. //
  2880. // * ErrCodeNotFoundException "NotFoundException"
  2881. // The request was rejected because the specified entity or resource could not
  2882. // be found.
  2883. //
  2884. // * ErrCodeInternalException "KMSInternalException"
  2885. // The request was rejected because an internal exception occurred. The request
  2886. // can be retried.
  2887. //
  2888. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  2889. // The request was rejected because the state of the specified resource is not
  2890. // valid for this request.
  2891. //
  2892. // For more information about how key state affects the use of a CMK, see How
  2893. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  2894. // in the AWS Key Management Service Developer Guide.
  2895. //
  2896. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/GetParametersForImport
  2897. func (c *KMS) GetParametersForImport(input *GetParametersForImportInput) (*GetParametersForImportOutput, error) {
  2898. req, out := c.GetParametersForImportRequest(input)
  2899. return out, req.Send()
  2900. }
  2901. // GetParametersForImportWithContext is the same as GetParametersForImport with the addition of
  2902. // the ability to pass a context and additional request options.
  2903. //
  2904. // See GetParametersForImport for details on how to use this API operation.
  2905. //
  2906. // The context must be non-nil and will be used for request cancellation. If
  2907. // the context is nil a panic will occur. In the future the SDK may create
  2908. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  2909. // for more information on using Contexts.
  2910. func (c *KMS) GetParametersForImportWithContext(ctx aws.Context, input *GetParametersForImportInput, opts ...request.Option) (*GetParametersForImportOutput, error) {
  2911. req, out := c.GetParametersForImportRequest(input)
  2912. req.SetContext(ctx)
  2913. req.ApplyOptions(opts...)
  2914. return out, req.Send()
  2915. }
  2916. const opImportKeyMaterial = "ImportKeyMaterial"
  2917. // ImportKeyMaterialRequest generates a "aws/request.Request" representing the
  2918. // client's request for the ImportKeyMaterial operation. The "output" return
  2919. // value will be populated with the request's response once the request completes
  2920. // successfully.
  2921. //
  2922. // Use "Send" method on the returned Request to send the API call to the service.
  2923. // the "output" return value is not valid until after Send returns without error.
  2924. //
  2925. // See ImportKeyMaterial for more information on using the ImportKeyMaterial
  2926. // API call, and error handling.
  2927. //
  2928. // This method is useful when you want to inject custom logic or configuration
  2929. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  2930. //
  2931. //
  2932. // // Example sending a request using the ImportKeyMaterialRequest method.
  2933. // req, resp := client.ImportKeyMaterialRequest(params)
  2934. //
  2935. // err := req.Send()
  2936. // if err == nil { // resp is now filled
  2937. // fmt.Println(resp)
  2938. // }
  2939. //
  2940. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ImportKeyMaterial
  2941. func (c *KMS) ImportKeyMaterialRequest(input *ImportKeyMaterialInput) (req *request.Request, output *ImportKeyMaterialOutput) {
  2942. op := &request.Operation{
  2943. Name: opImportKeyMaterial,
  2944. HTTPMethod: "POST",
  2945. HTTPPath: "/",
  2946. }
  2947. if input == nil {
  2948. input = &ImportKeyMaterialInput{}
  2949. }
  2950. output = &ImportKeyMaterialOutput{}
  2951. req = c.newRequest(op, input, output)
  2952. req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
  2953. return
  2954. }
  2955. // ImportKeyMaterial API operation for AWS Key Management Service.
  2956. //
  2957. // Imports key material into an existing AWS KMS customer master key (CMK) that
  2958. // was created without key material. You cannot perform this operation on a
  2959. // CMK in a different AWS account. For more information about creating CMKs
  2960. // with no key material and then importing key material, see Importing Key Material
  2961. // (http://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html)
  2962. // in the AWS Key Management Service Developer Guide.
  2963. //
  2964. // Before using this operation, call GetParametersForImport. Its response includes
  2965. // a public key and an import token. Use the public key to encrypt the key material.
  2966. // Then, submit the import token from the same GetParametersForImport response.
  2967. //
  2968. // When calling this operation, you must specify the following values:
  2969. //
  2970. // * The key ID or key ARN of a CMK with no key material. Its Origin must
  2971. // be EXTERNAL.
  2972. //
  2973. // To create a CMK with no key material, call CreateKey and set the value of
  2974. // its Origin parameter to EXTERNAL. To get the Origin of a CMK, call DescribeKey.)
  2975. //
  2976. // * The encrypted key material. To get the public key to encrypt the key
  2977. // material, call GetParametersForImport.
  2978. //
  2979. // * The import token that GetParametersForImport returned. This token and
  2980. // the public key used to encrypt the key material must have come from the
  2981. // same response.
  2982. //
  2983. // * Whether the key material expires and if so, when. If you set an expiration
  2984. // date, you can change it only by reimporting the same key material and
  2985. // specifying a new expiration date. If the key material expires, AWS KMS
  2986. // deletes the key material and the CMK becomes unusable. To use the CMK
  2987. // again, you must reimport the same key material.
  2988. //
  2989. // When this operation is successful, the key state of the CMK changes from
  2990. // PendingImport to Enabled, and you can use the CMK. After you successfully
  2991. // import key material into a CMK, you can reimport the same key material into
  2992. // that CMK, but you cannot import different key material.
  2993. //
  2994. // The result of this operation varies with the key state of the CMK. For details,
  2995. // see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  2996. // in the AWS Key Management Service Developer Guide.
  2997. //
  2998. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  2999. // with awserr.Error's Code and Message methods to get detailed information about
  3000. // the error.
  3001. //
  3002. // See the AWS API reference guide for AWS Key Management Service's
  3003. // API operation ImportKeyMaterial for usage and error information.
  3004. //
  3005. // Returned Error Codes:
  3006. // * ErrCodeInvalidArnException "InvalidArnException"
  3007. // The request was rejected because a specified ARN was not valid.
  3008. //
  3009. // * ErrCodeUnsupportedOperationException "UnsupportedOperationException"
  3010. // The request was rejected because a specified parameter is not supported or
  3011. // a specified resource is not valid for this operation.
  3012. //
  3013. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  3014. // The system timed out while trying to fulfill the request. The request can
  3015. // be retried.
  3016. //
  3017. // * ErrCodeNotFoundException "NotFoundException"
  3018. // The request was rejected because the specified entity or resource could not
  3019. // be found.
  3020. //
  3021. // * ErrCodeInternalException "KMSInternalException"
  3022. // The request was rejected because an internal exception occurred. The request
  3023. // can be retried.
  3024. //
  3025. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  3026. // The request was rejected because the state of the specified resource is not
  3027. // valid for this request.
  3028. //
  3029. // For more information about how key state affects the use of a CMK, see How
  3030. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  3031. // in the AWS Key Management Service Developer Guide.
  3032. //
  3033. // * ErrCodeInvalidCiphertextException "InvalidCiphertextException"
  3034. // The request was rejected because the specified ciphertext, or additional
  3035. // authenticated data incorporated into the ciphertext, such as the encryption
  3036. // context, is corrupted, missing, or otherwise invalid.
  3037. //
  3038. // * ErrCodeIncorrectKeyMaterialException "IncorrectKeyMaterialException"
  3039. // The request was rejected because the provided key material is invalid or
  3040. // is not the same key material that was previously imported into this customer
  3041. // master key (CMK).
  3042. //
  3043. // * ErrCodeExpiredImportTokenException "ExpiredImportTokenException"
  3044. // The request was rejected because the provided import token is expired. Use
  3045. // GetParametersForImport to get a new import token and public key, use the
  3046. // new public key to encrypt the key material, and then try the request again.
  3047. //
  3048. // * ErrCodeInvalidImportTokenException "InvalidImportTokenException"
  3049. // The request was rejected because the provided import token is invalid or
  3050. // is associated with a different customer master key (CMK).
  3051. //
  3052. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ImportKeyMaterial
  3053. func (c *KMS) ImportKeyMaterial(input *ImportKeyMaterialInput) (*ImportKeyMaterialOutput, error) {
  3054. req, out := c.ImportKeyMaterialRequest(input)
  3055. return out, req.Send()
  3056. }
  3057. // ImportKeyMaterialWithContext is the same as ImportKeyMaterial with the addition of
  3058. // the ability to pass a context and additional request options.
  3059. //
  3060. // See ImportKeyMaterial for details on how to use this API operation.
  3061. //
  3062. // The context must be non-nil and will be used for request cancellation. If
  3063. // the context is nil a panic will occur. In the future the SDK may create
  3064. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  3065. // for more information on using Contexts.
  3066. func (c *KMS) ImportKeyMaterialWithContext(ctx aws.Context, input *ImportKeyMaterialInput, opts ...request.Option) (*ImportKeyMaterialOutput, error) {
  3067. req, out := c.ImportKeyMaterialRequest(input)
  3068. req.SetContext(ctx)
  3069. req.ApplyOptions(opts...)
  3070. return out, req.Send()
  3071. }
  3072. const opListAliases = "ListAliases"
  3073. // ListAliasesRequest generates a "aws/request.Request" representing the
  3074. // client's request for the ListAliases operation. The "output" return
  3075. // value will be populated with the request's response once the request completes
  3076. // successfully.
  3077. //
  3078. // Use "Send" method on the returned Request to send the API call to the service.
  3079. // the "output" return value is not valid until after Send returns without error.
  3080. //
  3081. // See ListAliases for more information on using the ListAliases
  3082. // API call, and error handling.
  3083. //
  3084. // This method is useful when you want to inject custom logic or configuration
  3085. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  3086. //
  3087. //
  3088. // // Example sending a request using the ListAliasesRequest method.
  3089. // req, resp := client.ListAliasesRequest(params)
  3090. //
  3091. // err := req.Send()
  3092. // if err == nil { // resp is now filled
  3093. // fmt.Println(resp)
  3094. // }
  3095. //
  3096. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListAliases
  3097. func (c *KMS) ListAliasesRequest(input *ListAliasesInput) (req *request.Request, output *ListAliasesOutput) {
  3098. op := &request.Operation{
  3099. Name: opListAliases,
  3100. HTTPMethod: "POST",
  3101. HTTPPath: "/",
  3102. Paginator: &request.Paginator{
  3103. InputTokens: []string{"Marker"},
  3104. OutputTokens: []string{"NextMarker"},
  3105. LimitToken: "Limit",
  3106. TruncationToken: "Truncated",
  3107. },
  3108. }
  3109. if input == nil {
  3110. input = &ListAliasesInput{}
  3111. }
  3112. output = &ListAliasesOutput{}
  3113. req = c.newRequest(op, input, output)
  3114. return
  3115. }
  3116. // ListAliases API operation for AWS Key Management Service.
  3117. //
  3118. // Gets a list of all aliases in the caller's AWS account and region. You cannot
  3119. // list aliases in other accounts. For more information about aliases, see CreateAlias.
  3120. //
  3121. // By default, the ListAliases command returns all aliases in the account and
  3122. // region. To get only the aliases that point to a particular customer master
  3123. // key (CMK), use the KeyId parameter.
  3124. //
  3125. // The ListAliases response might include several aliases have no TargetKeyId
  3126. // field. These are predefined aliases that AWS has created but has not yet
  3127. // associated with a CMK. Aliases that AWS creates in your account, including
  3128. // predefined aliases, do not count against your AWS KMS aliases limit (http://docs.aws.amazon.com/kms/latest/developerguide/limits.html#aliases-limit).
  3129. //
  3130. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  3131. // with awserr.Error's Code and Message methods to get detailed information about
  3132. // the error.
  3133. //
  3134. // See the AWS API reference guide for AWS Key Management Service's
  3135. // API operation ListAliases for usage and error information.
  3136. //
  3137. // Returned Error Codes:
  3138. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  3139. // The system timed out while trying to fulfill the request. The request can
  3140. // be retried.
  3141. //
  3142. // * ErrCodeInvalidMarkerException "InvalidMarkerException"
  3143. // The request was rejected because the marker that specifies where pagination
  3144. // should next begin is not valid.
  3145. //
  3146. // * ErrCodeInternalException "KMSInternalException"
  3147. // The request was rejected because an internal exception occurred. The request
  3148. // can be retried.
  3149. //
  3150. // * ErrCodeInvalidArnException "InvalidArnException"
  3151. // The request was rejected because a specified ARN was not valid.
  3152. //
  3153. // * ErrCodeNotFoundException "NotFoundException"
  3154. // The request was rejected because the specified entity or resource could not
  3155. // be found.
  3156. //
  3157. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListAliases
  3158. func (c *KMS) ListAliases(input *ListAliasesInput) (*ListAliasesOutput, error) {
  3159. req, out := c.ListAliasesRequest(input)
  3160. return out, req.Send()
  3161. }
  3162. // ListAliasesWithContext is the same as ListAliases with the addition of
  3163. // the ability to pass a context and additional request options.
  3164. //
  3165. // See ListAliases for details on how to use this API operation.
  3166. //
  3167. // The context must be non-nil and will be used for request cancellation. If
  3168. // the context is nil a panic will occur. In the future the SDK may create
  3169. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  3170. // for more information on using Contexts.
  3171. func (c *KMS) ListAliasesWithContext(ctx aws.Context, input *ListAliasesInput, opts ...request.Option) (*ListAliasesOutput, error) {
  3172. req, out := c.ListAliasesRequest(input)
  3173. req.SetContext(ctx)
  3174. req.ApplyOptions(opts...)
  3175. return out, req.Send()
  3176. }
  3177. // ListAliasesPages iterates over the pages of a ListAliases operation,
  3178. // calling the "fn" function with the response data for each page. To stop
  3179. // iterating, return false from the fn function.
  3180. //
  3181. // See ListAliases method for more information on how to use this operation.
  3182. //
  3183. // Note: This operation can generate multiple requests to a service.
  3184. //
  3185. // // Example iterating over at most 3 pages of a ListAliases operation.
  3186. // pageNum := 0
  3187. // err := client.ListAliasesPages(params,
  3188. // func(page *ListAliasesOutput, lastPage bool) bool {
  3189. // pageNum++
  3190. // fmt.Println(page)
  3191. // return pageNum <= 3
  3192. // })
  3193. //
  3194. func (c *KMS) ListAliasesPages(input *ListAliasesInput, fn func(*ListAliasesOutput, bool) bool) error {
  3195. return c.ListAliasesPagesWithContext(aws.BackgroundContext(), input, fn)
  3196. }
  3197. // ListAliasesPagesWithContext same as ListAliasesPages except
  3198. // it takes a Context and allows setting request options on the pages.
  3199. //
  3200. // The context must be non-nil and will be used for request cancellation. If
  3201. // the context is nil a panic will occur. In the future the SDK may create
  3202. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  3203. // for more information on using Contexts.
  3204. func (c *KMS) ListAliasesPagesWithContext(ctx aws.Context, input *ListAliasesInput, fn func(*ListAliasesOutput, bool) bool, opts ...request.Option) error {
  3205. p := request.Pagination{
  3206. NewRequest: func() (*request.Request, error) {
  3207. var inCpy *ListAliasesInput
  3208. if input != nil {
  3209. tmp := *input
  3210. inCpy = &tmp
  3211. }
  3212. req, _ := c.ListAliasesRequest(inCpy)
  3213. req.SetContext(ctx)
  3214. req.ApplyOptions(opts...)
  3215. return req, nil
  3216. },
  3217. }
  3218. cont := true
  3219. for p.Next() && cont {
  3220. cont = fn(p.Page().(*ListAliasesOutput), !p.HasNextPage())
  3221. }
  3222. return p.Err()
  3223. }
  3224. const opListGrants = "ListGrants"
  3225. // ListGrantsRequest generates a "aws/request.Request" representing the
  3226. // client's request for the ListGrants operation. The "output" return
  3227. // value will be populated with the request's response once the request completes
  3228. // successfully.
  3229. //
  3230. // Use "Send" method on the returned Request to send the API call to the service.
  3231. // the "output" return value is not valid until after Send returns without error.
  3232. //
  3233. // See ListGrants for more information on using the ListGrants
  3234. // API call, and error handling.
  3235. //
  3236. // This method is useful when you want to inject custom logic or configuration
  3237. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  3238. //
  3239. //
  3240. // // Example sending a request using the ListGrantsRequest method.
  3241. // req, resp := client.ListGrantsRequest(params)
  3242. //
  3243. // err := req.Send()
  3244. // if err == nil { // resp is now filled
  3245. // fmt.Println(resp)
  3246. // }
  3247. //
  3248. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListGrants
  3249. func (c *KMS) ListGrantsRequest(input *ListGrantsInput) (req *request.Request, output *ListGrantsResponse) {
  3250. op := &request.Operation{
  3251. Name: opListGrants,
  3252. HTTPMethod: "POST",
  3253. HTTPPath: "/",
  3254. Paginator: &request.Paginator{
  3255. InputTokens: []string{"Marker"},
  3256. OutputTokens: []string{"NextMarker"},
  3257. LimitToken: "Limit",
  3258. TruncationToken: "Truncated",
  3259. },
  3260. }
  3261. if input == nil {
  3262. input = &ListGrantsInput{}
  3263. }
  3264. output = &ListGrantsResponse{}
  3265. req = c.newRequest(op, input, output)
  3266. return
  3267. }
  3268. // ListGrants API operation for AWS Key Management Service.
  3269. //
  3270. // Gets a list of all grants for the specified customer master key (CMK).
  3271. //
  3272. // To perform this operation on a CMK in a different AWS account, specify the
  3273. // key ARN in the value of the KeyId parameter.
  3274. //
  3275. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  3276. // with awserr.Error's Code and Message methods to get detailed information about
  3277. // the error.
  3278. //
  3279. // See the AWS API reference guide for AWS Key Management Service's
  3280. // API operation ListGrants for usage and error information.
  3281. //
  3282. // Returned Error Codes:
  3283. // * ErrCodeNotFoundException "NotFoundException"
  3284. // The request was rejected because the specified entity or resource could not
  3285. // be found.
  3286. //
  3287. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  3288. // The system timed out while trying to fulfill the request. The request can
  3289. // be retried.
  3290. //
  3291. // * ErrCodeInvalidMarkerException "InvalidMarkerException"
  3292. // The request was rejected because the marker that specifies where pagination
  3293. // should next begin is not valid.
  3294. //
  3295. // * ErrCodeInvalidArnException "InvalidArnException"
  3296. // The request was rejected because a specified ARN was not valid.
  3297. //
  3298. // * ErrCodeInternalException "KMSInternalException"
  3299. // The request was rejected because an internal exception occurred. The request
  3300. // can be retried.
  3301. //
  3302. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  3303. // The request was rejected because the state of the specified resource is not
  3304. // valid for this request.
  3305. //
  3306. // For more information about how key state affects the use of a CMK, see How
  3307. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  3308. // in the AWS Key Management Service Developer Guide.
  3309. //
  3310. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListGrants
  3311. func (c *KMS) ListGrants(input *ListGrantsInput) (*ListGrantsResponse, error) {
  3312. req, out := c.ListGrantsRequest(input)
  3313. return out, req.Send()
  3314. }
  3315. // ListGrantsWithContext is the same as ListGrants with the addition of
  3316. // the ability to pass a context and additional request options.
  3317. //
  3318. // See ListGrants for details on how to use this API operation.
  3319. //
  3320. // The context must be non-nil and will be used for request cancellation. If
  3321. // the context is nil a panic will occur. In the future the SDK may create
  3322. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  3323. // for more information on using Contexts.
  3324. func (c *KMS) ListGrantsWithContext(ctx aws.Context, input *ListGrantsInput, opts ...request.Option) (*ListGrantsResponse, error) {
  3325. req, out := c.ListGrantsRequest(input)
  3326. req.SetContext(ctx)
  3327. req.ApplyOptions(opts...)
  3328. return out, req.Send()
  3329. }
  3330. // ListGrantsPages iterates over the pages of a ListGrants operation,
  3331. // calling the "fn" function with the response data for each page. To stop
  3332. // iterating, return false from the fn function.
  3333. //
  3334. // See ListGrants method for more information on how to use this operation.
  3335. //
  3336. // Note: This operation can generate multiple requests to a service.
  3337. //
  3338. // // Example iterating over at most 3 pages of a ListGrants operation.
  3339. // pageNum := 0
  3340. // err := client.ListGrantsPages(params,
  3341. // func(page *ListGrantsResponse, lastPage bool) bool {
  3342. // pageNum++
  3343. // fmt.Println(page)
  3344. // return pageNum <= 3
  3345. // })
  3346. //
  3347. func (c *KMS) ListGrantsPages(input *ListGrantsInput, fn func(*ListGrantsResponse, bool) bool) error {
  3348. return c.ListGrantsPagesWithContext(aws.BackgroundContext(), input, fn)
  3349. }
  3350. // ListGrantsPagesWithContext same as ListGrantsPages except
  3351. // it takes a Context and allows setting request options on the pages.
  3352. //
  3353. // The context must be non-nil and will be used for request cancellation. If
  3354. // the context is nil a panic will occur. In the future the SDK may create
  3355. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  3356. // for more information on using Contexts.
  3357. func (c *KMS) ListGrantsPagesWithContext(ctx aws.Context, input *ListGrantsInput, fn func(*ListGrantsResponse, bool) bool, opts ...request.Option) error {
  3358. p := request.Pagination{
  3359. NewRequest: func() (*request.Request, error) {
  3360. var inCpy *ListGrantsInput
  3361. if input != nil {
  3362. tmp := *input
  3363. inCpy = &tmp
  3364. }
  3365. req, _ := c.ListGrantsRequest(inCpy)
  3366. req.SetContext(ctx)
  3367. req.ApplyOptions(opts...)
  3368. return req, nil
  3369. },
  3370. }
  3371. cont := true
  3372. for p.Next() && cont {
  3373. cont = fn(p.Page().(*ListGrantsResponse), !p.HasNextPage())
  3374. }
  3375. return p.Err()
  3376. }
  3377. const opListKeyPolicies = "ListKeyPolicies"
  3378. // ListKeyPoliciesRequest generates a "aws/request.Request" representing the
  3379. // client's request for the ListKeyPolicies operation. The "output" return
  3380. // value will be populated with the request's response once the request completes
  3381. // successfully.
  3382. //
  3383. // Use "Send" method on the returned Request to send the API call to the service.
  3384. // the "output" return value is not valid until after Send returns without error.
  3385. //
  3386. // See ListKeyPolicies for more information on using the ListKeyPolicies
  3387. // API call, and error handling.
  3388. //
  3389. // This method is useful when you want to inject custom logic or configuration
  3390. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  3391. //
  3392. //
  3393. // // Example sending a request using the ListKeyPoliciesRequest method.
  3394. // req, resp := client.ListKeyPoliciesRequest(params)
  3395. //
  3396. // err := req.Send()
  3397. // if err == nil { // resp is now filled
  3398. // fmt.Println(resp)
  3399. // }
  3400. //
  3401. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListKeyPolicies
  3402. func (c *KMS) ListKeyPoliciesRequest(input *ListKeyPoliciesInput) (req *request.Request, output *ListKeyPoliciesOutput) {
  3403. op := &request.Operation{
  3404. Name: opListKeyPolicies,
  3405. HTTPMethod: "POST",
  3406. HTTPPath: "/",
  3407. Paginator: &request.Paginator{
  3408. InputTokens: []string{"Marker"},
  3409. OutputTokens: []string{"NextMarker"},
  3410. LimitToken: "Limit",
  3411. TruncationToken: "Truncated",
  3412. },
  3413. }
  3414. if input == nil {
  3415. input = &ListKeyPoliciesInput{}
  3416. }
  3417. output = &ListKeyPoliciesOutput{}
  3418. req = c.newRequest(op, input, output)
  3419. return
  3420. }
  3421. // ListKeyPolicies API operation for AWS Key Management Service.
  3422. //
  3423. // Gets the names of the key policies that are attached to a customer master
  3424. // key (CMK). This operation is designed to get policy names that you can use
  3425. // in a GetKeyPolicy operation. However, the only valid policy name is default.
  3426. // You cannot perform this operation on a CMK in a different AWS account.
  3427. //
  3428. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  3429. // with awserr.Error's Code and Message methods to get detailed information about
  3430. // the error.
  3431. //
  3432. // See the AWS API reference guide for AWS Key Management Service's
  3433. // API operation ListKeyPolicies for usage and error information.
  3434. //
  3435. // Returned Error Codes:
  3436. // * ErrCodeNotFoundException "NotFoundException"
  3437. // The request was rejected because the specified entity or resource could not
  3438. // be found.
  3439. //
  3440. // * ErrCodeInvalidArnException "InvalidArnException"
  3441. // The request was rejected because a specified ARN was not valid.
  3442. //
  3443. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  3444. // The system timed out while trying to fulfill the request. The request can
  3445. // be retried.
  3446. //
  3447. // * ErrCodeInternalException "KMSInternalException"
  3448. // The request was rejected because an internal exception occurred. The request
  3449. // can be retried.
  3450. //
  3451. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  3452. // The request was rejected because the state of the specified resource is not
  3453. // valid for this request.
  3454. //
  3455. // For more information about how key state affects the use of a CMK, see How
  3456. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  3457. // in the AWS Key Management Service Developer Guide.
  3458. //
  3459. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListKeyPolicies
  3460. func (c *KMS) ListKeyPolicies(input *ListKeyPoliciesInput) (*ListKeyPoliciesOutput, error) {
  3461. req, out := c.ListKeyPoliciesRequest(input)
  3462. return out, req.Send()
  3463. }
  3464. // ListKeyPoliciesWithContext is the same as ListKeyPolicies with the addition of
  3465. // the ability to pass a context and additional request options.
  3466. //
  3467. // See ListKeyPolicies for details on how to use this API operation.
  3468. //
  3469. // The context must be non-nil and will be used for request cancellation. If
  3470. // the context is nil a panic will occur. In the future the SDK may create
  3471. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  3472. // for more information on using Contexts.
  3473. func (c *KMS) ListKeyPoliciesWithContext(ctx aws.Context, input *ListKeyPoliciesInput, opts ...request.Option) (*ListKeyPoliciesOutput, error) {
  3474. req, out := c.ListKeyPoliciesRequest(input)
  3475. req.SetContext(ctx)
  3476. req.ApplyOptions(opts...)
  3477. return out, req.Send()
  3478. }
  3479. // ListKeyPoliciesPages iterates over the pages of a ListKeyPolicies operation,
  3480. // calling the "fn" function with the response data for each page. To stop
  3481. // iterating, return false from the fn function.
  3482. //
  3483. // See ListKeyPolicies method for more information on how to use this operation.
  3484. //
  3485. // Note: This operation can generate multiple requests to a service.
  3486. //
  3487. // // Example iterating over at most 3 pages of a ListKeyPolicies operation.
  3488. // pageNum := 0
  3489. // err := client.ListKeyPoliciesPages(params,
  3490. // func(page *ListKeyPoliciesOutput, lastPage bool) bool {
  3491. // pageNum++
  3492. // fmt.Println(page)
  3493. // return pageNum <= 3
  3494. // })
  3495. //
  3496. func (c *KMS) ListKeyPoliciesPages(input *ListKeyPoliciesInput, fn func(*ListKeyPoliciesOutput, bool) bool) error {
  3497. return c.ListKeyPoliciesPagesWithContext(aws.BackgroundContext(), input, fn)
  3498. }
  3499. // ListKeyPoliciesPagesWithContext same as ListKeyPoliciesPages except
  3500. // it takes a Context and allows setting request options on the pages.
  3501. //
  3502. // The context must be non-nil and will be used for request cancellation. If
  3503. // the context is nil a panic will occur. In the future the SDK may create
  3504. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  3505. // for more information on using Contexts.
  3506. func (c *KMS) ListKeyPoliciesPagesWithContext(ctx aws.Context, input *ListKeyPoliciesInput, fn func(*ListKeyPoliciesOutput, bool) bool, opts ...request.Option) error {
  3507. p := request.Pagination{
  3508. NewRequest: func() (*request.Request, error) {
  3509. var inCpy *ListKeyPoliciesInput
  3510. if input != nil {
  3511. tmp := *input
  3512. inCpy = &tmp
  3513. }
  3514. req, _ := c.ListKeyPoliciesRequest(inCpy)
  3515. req.SetContext(ctx)
  3516. req.ApplyOptions(opts...)
  3517. return req, nil
  3518. },
  3519. }
  3520. cont := true
  3521. for p.Next() && cont {
  3522. cont = fn(p.Page().(*ListKeyPoliciesOutput), !p.HasNextPage())
  3523. }
  3524. return p.Err()
  3525. }
  3526. const opListKeys = "ListKeys"
  3527. // ListKeysRequest generates a "aws/request.Request" representing the
  3528. // client's request for the ListKeys operation. The "output" return
  3529. // value will be populated with the request's response once the request completes
  3530. // successfully.
  3531. //
  3532. // Use "Send" method on the returned Request to send the API call to the service.
  3533. // the "output" return value is not valid until after Send returns without error.
  3534. //
  3535. // See ListKeys for more information on using the ListKeys
  3536. // API call, and error handling.
  3537. //
  3538. // This method is useful when you want to inject custom logic or configuration
  3539. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  3540. //
  3541. //
  3542. // // Example sending a request using the ListKeysRequest method.
  3543. // req, resp := client.ListKeysRequest(params)
  3544. //
  3545. // err := req.Send()
  3546. // if err == nil { // resp is now filled
  3547. // fmt.Println(resp)
  3548. // }
  3549. //
  3550. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListKeys
  3551. func (c *KMS) ListKeysRequest(input *ListKeysInput) (req *request.Request, output *ListKeysOutput) {
  3552. op := &request.Operation{
  3553. Name: opListKeys,
  3554. HTTPMethod: "POST",
  3555. HTTPPath: "/",
  3556. Paginator: &request.Paginator{
  3557. InputTokens: []string{"Marker"},
  3558. OutputTokens: []string{"NextMarker"},
  3559. LimitToken: "Limit",
  3560. TruncationToken: "Truncated",
  3561. },
  3562. }
  3563. if input == nil {
  3564. input = &ListKeysInput{}
  3565. }
  3566. output = &ListKeysOutput{}
  3567. req = c.newRequest(op, input, output)
  3568. return
  3569. }
  3570. // ListKeys API operation for AWS Key Management Service.
  3571. //
  3572. // Gets a list of all customer master keys (CMKs) in the caller's AWS account
  3573. // and region.
  3574. //
  3575. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  3576. // with awserr.Error's Code and Message methods to get detailed information about
  3577. // the error.
  3578. //
  3579. // See the AWS API reference guide for AWS Key Management Service's
  3580. // API operation ListKeys for usage and error information.
  3581. //
  3582. // Returned Error Codes:
  3583. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  3584. // The system timed out while trying to fulfill the request. The request can
  3585. // be retried.
  3586. //
  3587. // * ErrCodeInternalException "KMSInternalException"
  3588. // The request was rejected because an internal exception occurred. The request
  3589. // can be retried.
  3590. //
  3591. // * ErrCodeInvalidMarkerException "InvalidMarkerException"
  3592. // The request was rejected because the marker that specifies where pagination
  3593. // should next begin is not valid.
  3594. //
  3595. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListKeys
  3596. func (c *KMS) ListKeys(input *ListKeysInput) (*ListKeysOutput, error) {
  3597. req, out := c.ListKeysRequest(input)
  3598. return out, req.Send()
  3599. }
  3600. // ListKeysWithContext is the same as ListKeys with the addition of
  3601. // the ability to pass a context and additional request options.
  3602. //
  3603. // See ListKeys for details on how to use this API operation.
  3604. //
  3605. // The context must be non-nil and will be used for request cancellation. If
  3606. // the context is nil a panic will occur. In the future the SDK may create
  3607. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  3608. // for more information on using Contexts.
  3609. func (c *KMS) ListKeysWithContext(ctx aws.Context, input *ListKeysInput, opts ...request.Option) (*ListKeysOutput, error) {
  3610. req, out := c.ListKeysRequest(input)
  3611. req.SetContext(ctx)
  3612. req.ApplyOptions(opts...)
  3613. return out, req.Send()
  3614. }
  3615. // ListKeysPages iterates over the pages of a ListKeys operation,
  3616. // calling the "fn" function with the response data for each page. To stop
  3617. // iterating, return false from the fn function.
  3618. //
  3619. // See ListKeys method for more information on how to use this operation.
  3620. //
  3621. // Note: This operation can generate multiple requests to a service.
  3622. //
  3623. // // Example iterating over at most 3 pages of a ListKeys operation.
  3624. // pageNum := 0
  3625. // err := client.ListKeysPages(params,
  3626. // func(page *ListKeysOutput, lastPage bool) bool {
  3627. // pageNum++
  3628. // fmt.Println(page)
  3629. // return pageNum <= 3
  3630. // })
  3631. //
  3632. func (c *KMS) ListKeysPages(input *ListKeysInput, fn func(*ListKeysOutput, bool) bool) error {
  3633. return c.ListKeysPagesWithContext(aws.BackgroundContext(), input, fn)
  3634. }
  3635. // ListKeysPagesWithContext same as ListKeysPages except
  3636. // it takes a Context and allows setting request options on the pages.
  3637. //
  3638. // The context must be non-nil and will be used for request cancellation. If
  3639. // the context is nil a panic will occur. In the future the SDK may create
  3640. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  3641. // for more information on using Contexts.
  3642. func (c *KMS) ListKeysPagesWithContext(ctx aws.Context, input *ListKeysInput, fn func(*ListKeysOutput, bool) bool, opts ...request.Option) error {
  3643. p := request.Pagination{
  3644. NewRequest: func() (*request.Request, error) {
  3645. var inCpy *ListKeysInput
  3646. if input != nil {
  3647. tmp := *input
  3648. inCpy = &tmp
  3649. }
  3650. req, _ := c.ListKeysRequest(inCpy)
  3651. req.SetContext(ctx)
  3652. req.ApplyOptions(opts...)
  3653. return req, nil
  3654. },
  3655. }
  3656. cont := true
  3657. for p.Next() && cont {
  3658. cont = fn(p.Page().(*ListKeysOutput), !p.HasNextPage())
  3659. }
  3660. return p.Err()
  3661. }
  3662. const opListResourceTags = "ListResourceTags"
  3663. // ListResourceTagsRequest generates a "aws/request.Request" representing the
  3664. // client's request for the ListResourceTags operation. The "output" return
  3665. // value will be populated with the request's response once the request completes
  3666. // successfully.
  3667. //
  3668. // Use "Send" method on the returned Request to send the API call to the service.
  3669. // the "output" return value is not valid until after Send returns without error.
  3670. //
  3671. // See ListResourceTags for more information on using the ListResourceTags
  3672. // API call, and error handling.
  3673. //
  3674. // This method is useful when you want to inject custom logic or configuration
  3675. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  3676. //
  3677. //
  3678. // // Example sending a request using the ListResourceTagsRequest method.
  3679. // req, resp := client.ListResourceTagsRequest(params)
  3680. //
  3681. // err := req.Send()
  3682. // if err == nil { // resp is now filled
  3683. // fmt.Println(resp)
  3684. // }
  3685. //
  3686. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListResourceTags
  3687. func (c *KMS) ListResourceTagsRequest(input *ListResourceTagsInput) (req *request.Request, output *ListResourceTagsOutput) {
  3688. op := &request.Operation{
  3689. Name: opListResourceTags,
  3690. HTTPMethod: "POST",
  3691. HTTPPath: "/",
  3692. }
  3693. if input == nil {
  3694. input = &ListResourceTagsInput{}
  3695. }
  3696. output = &ListResourceTagsOutput{}
  3697. req = c.newRequest(op, input, output)
  3698. return
  3699. }
  3700. // ListResourceTags API operation for AWS Key Management Service.
  3701. //
  3702. // Returns a list of all tags for the specified customer master key (CMK).
  3703. //
  3704. // You cannot perform this operation on a CMK in a different AWS account.
  3705. //
  3706. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  3707. // with awserr.Error's Code and Message methods to get detailed information about
  3708. // the error.
  3709. //
  3710. // See the AWS API reference guide for AWS Key Management Service's
  3711. // API operation ListResourceTags for usage and error information.
  3712. //
  3713. // Returned Error Codes:
  3714. // * ErrCodeInternalException "KMSInternalException"
  3715. // The request was rejected because an internal exception occurred. The request
  3716. // can be retried.
  3717. //
  3718. // * ErrCodeNotFoundException "NotFoundException"
  3719. // The request was rejected because the specified entity or resource could not
  3720. // be found.
  3721. //
  3722. // * ErrCodeInvalidArnException "InvalidArnException"
  3723. // The request was rejected because a specified ARN was not valid.
  3724. //
  3725. // * ErrCodeInvalidMarkerException "InvalidMarkerException"
  3726. // The request was rejected because the marker that specifies where pagination
  3727. // should next begin is not valid.
  3728. //
  3729. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListResourceTags
  3730. func (c *KMS) ListResourceTags(input *ListResourceTagsInput) (*ListResourceTagsOutput, error) {
  3731. req, out := c.ListResourceTagsRequest(input)
  3732. return out, req.Send()
  3733. }
  3734. // ListResourceTagsWithContext is the same as ListResourceTags with the addition of
  3735. // the ability to pass a context and additional request options.
  3736. //
  3737. // See ListResourceTags for details on how to use this API operation.
  3738. //
  3739. // The context must be non-nil and will be used for request cancellation. If
  3740. // the context is nil a panic will occur. In the future the SDK may create
  3741. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  3742. // for more information on using Contexts.
  3743. func (c *KMS) ListResourceTagsWithContext(ctx aws.Context, input *ListResourceTagsInput, opts ...request.Option) (*ListResourceTagsOutput, error) {
  3744. req, out := c.ListResourceTagsRequest(input)
  3745. req.SetContext(ctx)
  3746. req.ApplyOptions(opts...)
  3747. return out, req.Send()
  3748. }
  3749. const opListRetirableGrants = "ListRetirableGrants"
  3750. // ListRetirableGrantsRequest generates a "aws/request.Request" representing the
  3751. // client's request for the ListRetirableGrants operation. The "output" return
  3752. // value will be populated with the request's response once the request completes
  3753. // successfully.
  3754. //
  3755. // Use "Send" method on the returned Request to send the API call to the service.
  3756. // the "output" return value is not valid until after Send returns without error.
  3757. //
  3758. // See ListRetirableGrants for more information on using the ListRetirableGrants
  3759. // API call, and error handling.
  3760. //
  3761. // This method is useful when you want to inject custom logic or configuration
  3762. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  3763. //
  3764. //
  3765. // // Example sending a request using the ListRetirableGrantsRequest method.
  3766. // req, resp := client.ListRetirableGrantsRequest(params)
  3767. //
  3768. // err := req.Send()
  3769. // if err == nil { // resp is now filled
  3770. // fmt.Println(resp)
  3771. // }
  3772. //
  3773. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListRetirableGrants
  3774. func (c *KMS) ListRetirableGrantsRequest(input *ListRetirableGrantsInput) (req *request.Request, output *ListGrantsResponse) {
  3775. op := &request.Operation{
  3776. Name: opListRetirableGrants,
  3777. HTTPMethod: "POST",
  3778. HTTPPath: "/",
  3779. }
  3780. if input == nil {
  3781. input = &ListRetirableGrantsInput{}
  3782. }
  3783. output = &ListGrantsResponse{}
  3784. req = c.newRequest(op, input, output)
  3785. return
  3786. }
  3787. // ListRetirableGrants API operation for AWS Key Management Service.
  3788. //
  3789. // Returns a list of all grants for which the grant's RetiringPrincipal matches
  3790. // the one specified.
  3791. //
  3792. // A typical use is to list all grants that you are able to retire. To retire
  3793. // a grant, use RetireGrant.
  3794. //
  3795. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  3796. // with awserr.Error's Code and Message methods to get detailed information about
  3797. // the error.
  3798. //
  3799. // See the AWS API reference guide for AWS Key Management Service's
  3800. // API operation ListRetirableGrants for usage and error information.
  3801. //
  3802. // Returned Error Codes:
  3803. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  3804. // The system timed out while trying to fulfill the request. The request can
  3805. // be retried.
  3806. //
  3807. // * ErrCodeInvalidMarkerException "InvalidMarkerException"
  3808. // The request was rejected because the marker that specifies where pagination
  3809. // should next begin is not valid.
  3810. //
  3811. // * ErrCodeInvalidArnException "InvalidArnException"
  3812. // The request was rejected because a specified ARN was not valid.
  3813. //
  3814. // * ErrCodeNotFoundException "NotFoundException"
  3815. // The request was rejected because the specified entity or resource could not
  3816. // be found.
  3817. //
  3818. // * ErrCodeInternalException "KMSInternalException"
  3819. // The request was rejected because an internal exception occurred. The request
  3820. // can be retried.
  3821. //
  3822. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ListRetirableGrants
  3823. func (c *KMS) ListRetirableGrants(input *ListRetirableGrantsInput) (*ListGrantsResponse, error) {
  3824. req, out := c.ListRetirableGrantsRequest(input)
  3825. return out, req.Send()
  3826. }
  3827. // ListRetirableGrantsWithContext is the same as ListRetirableGrants with the addition of
  3828. // the ability to pass a context and additional request options.
  3829. //
  3830. // See ListRetirableGrants for details on how to use this API operation.
  3831. //
  3832. // The context must be non-nil and will be used for request cancellation. If
  3833. // the context is nil a panic will occur. In the future the SDK may create
  3834. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  3835. // for more information on using Contexts.
  3836. func (c *KMS) ListRetirableGrantsWithContext(ctx aws.Context, input *ListRetirableGrantsInput, opts ...request.Option) (*ListGrantsResponse, error) {
  3837. req, out := c.ListRetirableGrantsRequest(input)
  3838. req.SetContext(ctx)
  3839. req.ApplyOptions(opts...)
  3840. return out, req.Send()
  3841. }
  3842. const opPutKeyPolicy = "PutKeyPolicy"
  3843. // PutKeyPolicyRequest generates a "aws/request.Request" representing the
  3844. // client's request for the PutKeyPolicy operation. The "output" return
  3845. // value will be populated with the request's response once the request completes
  3846. // successfully.
  3847. //
  3848. // Use "Send" method on the returned Request to send the API call to the service.
  3849. // the "output" return value is not valid until after Send returns without error.
  3850. //
  3851. // See PutKeyPolicy for more information on using the PutKeyPolicy
  3852. // API call, and error handling.
  3853. //
  3854. // This method is useful when you want to inject custom logic or configuration
  3855. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  3856. //
  3857. //
  3858. // // Example sending a request using the PutKeyPolicyRequest method.
  3859. // req, resp := client.PutKeyPolicyRequest(params)
  3860. //
  3861. // err := req.Send()
  3862. // if err == nil { // resp is now filled
  3863. // fmt.Println(resp)
  3864. // }
  3865. //
  3866. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/PutKeyPolicy
  3867. func (c *KMS) PutKeyPolicyRequest(input *PutKeyPolicyInput) (req *request.Request, output *PutKeyPolicyOutput) {
  3868. op := &request.Operation{
  3869. Name: opPutKeyPolicy,
  3870. HTTPMethod: "POST",
  3871. HTTPPath: "/",
  3872. }
  3873. if input == nil {
  3874. input = &PutKeyPolicyInput{}
  3875. }
  3876. output = &PutKeyPolicyOutput{}
  3877. req = c.newRequest(op, input, output)
  3878. req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
  3879. return
  3880. }
  3881. // PutKeyPolicy API operation for AWS Key Management Service.
  3882. //
  3883. // Attaches a key policy to the specified customer master key (CMK). You cannot
  3884. // perform this operation on a CMK in a different AWS account.
  3885. //
  3886. // For more information about key policies, see Key Policies (http://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html)
  3887. // in the AWS Key Management Service Developer Guide.
  3888. //
  3889. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  3890. // with awserr.Error's Code and Message methods to get detailed information about
  3891. // the error.
  3892. //
  3893. // See the AWS API reference guide for AWS Key Management Service's
  3894. // API operation PutKeyPolicy for usage and error information.
  3895. //
  3896. // Returned Error Codes:
  3897. // * ErrCodeNotFoundException "NotFoundException"
  3898. // The request was rejected because the specified entity or resource could not
  3899. // be found.
  3900. //
  3901. // * ErrCodeInvalidArnException "InvalidArnException"
  3902. // The request was rejected because a specified ARN was not valid.
  3903. //
  3904. // * ErrCodeMalformedPolicyDocumentException "MalformedPolicyDocumentException"
  3905. // The request was rejected because the specified policy is not syntactically
  3906. // or semantically correct.
  3907. //
  3908. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  3909. // The system timed out while trying to fulfill the request. The request can
  3910. // be retried.
  3911. //
  3912. // * ErrCodeUnsupportedOperationException "UnsupportedOperationException"
  3913. // The request was rejected because a specified parameter is not supported or
  3914. // a specified resource is not valid for this operation.
  3915. //
  3916. // * ErrCodeInternalException "KMSInternalException"
  3917. // The request was rejected because an internal exception occurred. The request
  3918. // can be retried.
  3919. //
  3920. // * ErrCodeLimitExceededException "LimitExceededException"
  3921. // The request was rejected because a limit was exceeded. For more information,
  3922. // see Limits (http://docs.aws.amazon.com/kms/latest/developerguide/limits.html)
  3923. // in the AWS Key Management Service Developer Guide.
  3924. //
  3925. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  3926. // The request was rejected because the state of the specified resource is not
  3927. // valid for this request.
  3928. //
  3929. // For more information about how key state affects the use of a CMK, see How
  3930. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  3931. // in the AWS Key Management Service Developer Guide.
  3932. //
  3933. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/PutKeyPolicy
  3934. func (c *KMS) PutKeyPolicy(input *PutKeyPolicyInput) (*PutKeyPolicyOutput, error) {
  3935. req, out := c.PutKeyPolicyRequest(input)
  3936. return out, req.Send()
  3937. }
  3938. // PutKeyPolicyWithContext is the same as PutKeyPolicy with the addition of
  3939. // the ability to pass a context and additional request options.
  3940. //
  3941. // See PutKeyPolicy for details on how to use this API operation.
  3942. //
  3943. // The context must be non-nil and will be used for request cancellation. If
  3944. // the context is nil a panic will occur. In the future the SDK may create
  3945. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  3946. // for more information on using Contexts.
  3947. func (c *KMS) PutKeyPolicyWithContext(ctx aws.Context, input *PutKeyPolicyInput, opts ...request.Option) (*PutKeyPolicyOutput, error) {
  3948. req, out := c.PutKeyPolicyRequest(input)
  3949. req.SetContext(ctx)
  3950. req.ApplyOptions(opts...)
  3951. return out, req.Send()
  3952. }
  3953. const opReEncrypt = "ReEncrypt"
  3954. // ReEncryptRequest generates a "aws/request.Request" representing the
  3955. // client's request for the ReEncrypt operation. The "output" return
  3956. // value will be populated with the request's response once the request completes
  3957. // successfully.
  3958. //
  3959. // Use "Send" method on the returned Request to send the API call to the service.
  3960. // the "output" return value is not valid until after Send returns without error.
  3961. //
  3962. // See ReEncrypt for more information on using the ReEncrypt
  3963. // API call, and error handling.
  3964. //
  3965. // This method is useful when you want to inject custom logic or configuration
  3966. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  3967. //
  3968. //
  3969. // // Example sending a request using the ReEncryptRequest method.
  3970. // req, resp := client.ReEncryptRequest(params)
  3971. //
  3972. // err := req.Send()
  3973. // if err == nil { // resp is now filled
  3974. // fmt.Println(resp)
  3975. // }
  3976. //
  3977. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ReEncrypt
  3978. func (c *KMS) ReEncryptRequest(input *ReEncryptInput) (req *request.Request, output *ReEncryptOutput) {
  3979. op := &request.Operation{
  3980. Name: opReEncrypt,
  3981. HTTPMethod: "POST",
  3982. HTTPPath: "/",
  3983. }
  3984. if input == nil {
  3985. input = &ReEncryptInput{}
  3986. }
  3987. output = &ReEncryptOutput{}
  3988. req = c.newRequest(op, input, output)
  3989. return
  3990. }
  3991. // ReEncrypt API operation for AWS Key Management Service.
  3992. //
  3993. // Encrypts data on the server side with a new customer master key (CMK) without
  3994. // exposing the plaintext of the data on the client side. The data is first
  3995. // decrypted and then reencrypted. You can also use this operation to change
  3996. // the encryption context of a ciphertext.
  3997. //
  3998. // You can reencrypt data using CMKs in different AWS accounts.
  3999. //
  4000. // Unlike other operations, ReEncrypt is authorized twice, once as ReEncryptFrom
  4001. // on the source CMK and once as ReEncryptTo on the destination CMK. We recommend
  4002. // that you include the "kms:ReEncrypt*" permission in your key policies (http://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html)
  4003. // to permit reencryption from or to the CMK. This permission is automatically
  4004. // included in the key policy when you create a CMK through the console, but
  4005. // you must include it manually when you create a CMK programmatically or when
  4006. // you set a key policy with the PutKeyPolicy operation.
  4007. //
  4008. // The result of this operation varies with the key state of the CMK. For details,
  4009. // see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  4010. // in the AWS Key Management Service Developer Guide.
  4011. //
  4012. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  4013. // with awserr.Error's Code and Message methods to get detailed information about
  4014. // the error.
  4015. //
  4016. // See the AWS API reference guide for AWS Key Management Service's
  4017. // API operation ReEncrypt for usage and error information.
  4018. //
  4019. // Returned Error Codes:
  4020. // * ErrCodeNotFoundException "NotFoundException"
  4021. // The request was rejected because the specified entity or resource could not
  4022. // be found.
  4023. //
  4024. // * ErrCodeDisabledException "DisabledException"
  4025. // The request was rejected because the specified CMK is not enabled.
  4026. //
  4027. // * ErrCodeInvalidCiphertextException "InvalidCiphertextException"
  4028. // The request was rejected because the specified ciphertext, or additional
  4029. // authenticated data incorporated into the ciphertext, such as the encryption
  4030. // context, is corrupted, missing, or otherwise invalid.
  4031. //
  4032. // * ErrCodeKeyUnavailableException "KeyUnavailableException"
  4033. // The request was rejected because the specified CMK was not available. The
  4034. // request can be retried.
  4035. //
  4036. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  4037. // The system timed out while trying to fulfill the request. The request can
  4038. // be retried.
  4039. //
  4040. // * ErrCodeInvalidKeyUsageException "InvalidKeyUsageException"
  4041. // The request was rejected because the specified KeySpec value is not valid.
  4042. //
  4043. // * ErrCodeInvalidGrantTokenException "InvalidGrantTokenException"
  4044. // The request was rejected because the specified grant token is not valid.
  4045. //
  4046. // * ErrCodeInternalException "KMSInternalException"
  4047. // The request was rejected because an internal exception occurred. The request
  4048. // can be retried.
  4049. //
  4050. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  4051. // The request was rejected because the state of the specified resource is not
  4052. // valid for this request.
  4053. //
  4054. // For more information about how key state affects the use of a CMK, see How
  4055. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  4056. // in the AWS Key Management Service Developer Guide.
  4057. //
  4058. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ReEncrypt
  4059. func (c *KMS) ReEncrypt(input *ReEncryptInput) (*ReEncryptOutput, error) {
  4060. req, out := c.ReEncryptRequest(input)
  4061. return out, req.Send()
  4062. }
  4063. // ReEncryptWithContext is the same as ReEncrypt with the addition of
  4064. // the ability to pass a context and additional request options.
  4065. //
  4066. // See ReEncrypt for details on how to use this API operation.
  4067. //
  4068. // The context must be non-nil and will be used for request cancellation. If
  4069. // the context is nil a panic will occur. In the future the SDK may create
  4070. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  4071. // for more information on using Contexts.
  4072. func (c *KMS) ReEncryptWithContext(ctx aws.Context, input *ReEncryptInput, opts ...request.Option) (*ReEncryptOutput, error) {
  4073. req, out := c.ReEncryptRequest(input)
  4074. req.SetContext(ctx)
  4075. req.ApplyOptions(opts...)
  4076. return out, req.Send()
  4077. }
  4078. const opRetireGrant = "RetireGrant"
  4079. // RetireGrantRequest generates a "aws/request.Request" representing the
  4080. // client's request for the RetireGrant operation. The "output" return
  4081. // value will be populated with the request's response once the request completes
  4082. // successfully.
  4083. //
  4084. // Use "Send" method on the returned Request to send the API call to the service.
  4085. // the "output" return value is not valid until after Send returns without error.
  4086. //
  4087. // See RetireGrant for more information on using the RetireGrant
  4088. // API call, and error handling.
  4089. //
  4090. // This method is useful when you want to inject custom logic or configuration
  4091. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  4092. //
  4093. //
  4094. // // Example sending a request using the RetireGrantRequest method.
  4095. // req, resp := client.RetireGrantRequest(params)
  4096. //
  4097. // err := req.Send()
  4098. // if err == nil { // resp is now filled
  4099. // fmt.Println(resp)
  4100. // }
  4101. //
  4102. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/RetireGrant
  4103. func (c *KMS) RetireGrantRequest(input *RetireGrantInput) (req *request.Request, output *RetireGrantOutput) {
  4104. op := &request.Operation{
  4105. Name: opRetireGrant,
  4106. HTTPMethod: "POST",
  4107. HTTPPath: "/",
  4108. }
  4109. if input == nil {
  4110. input = &RetireGrantInput{}
  4111. }
  4112. output = &RetireGrantOutput{}
  4113. req = c.newRequest(op, input, output)
  4114. req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
  4115. return
  4116. }
  4117. // RetireGrant API operation for AWS Key Management Service.
  4118. //
  4119. // Retires a grant. To clean up, you can retire a grant when you're done using
  4120. // it. You should revoke a grant when you intend to actively deny operations
  4121. // that depend on it. The following are permitted to call this API:
  4122. //
  4123. // * The AWS account (root user) under which the grant was created
  4124. //
  4125. // * The RetiringPrincipal, if present in the grant
  4126. //
  4127. // * The GranteePrincipal, if RetireGrant is an operation specified in the
  4128. // grant
  4129. //
  4130. // You must identify the grant to retire by its grant token or by a combination
  4131. // of the grant ID and the Amazon Resource Name (ARN) of the customer master
  4132. // key (CMK). A grant token is a unique variable-length base64-encoded string.
  4133. // A grant ID is a 64 character unique identifier of a grant. The CreateGrant
  4134. // operation returns both.
  4135. //
  4136. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  4137. // with awserr.Error's Code and Message methods to get detailed information about
  4138. // the error.
  4139. //
  4140. // See the AWS API reference guide for AWS Key Management Service's
  4141. // API operation RetireGrant for usage and error information.
  4142. //
  4143. // Returned Error Codes:
  4144. // * ErrCodeInvalidArnException "InvalidArnException"
  4145. // The request was rejected because a specified ARN was not valid.
  4146. //
  4147. // * ErrCodeInvalidGrantTokenException "InvalidGrantTokenException"
  4148. // The request was rejected because the specified grant token is not valid.
  4149. //
  4150. // * ErrCodeInvalidGrantIdException "InvalidGrantIdException"
  4151. // The request was rejected because the specified GrantId is not valid.
  4152. //
  4153. // * ErrCodeNotFoundException "NotFoundException"
  4154. // The request was rejected because the specified entity or resource could not
  4155. // be found.
  4156. //
  4157. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  4158. // The system timed out while trying to fulfill the request. The request can
  4159. // be retried.
  4160. //
  4161. // * ErrCodeInternalException "KMSInternalException"
  4162. // The request was rejected because an internal exception occurred. The request
  4163. // can be retried.
  4164. //
  4165. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  4166. // The request was rejected because the state of the specified resource is not
  4167. // valid for this request.
  4168. //
  4169. // For more information about how key state affects the use of a CMK, see How
  4170. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  4171. // in the AWS Key Management Service Developer Guide.
  4172. //
  4173. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/RetireGrant
  4174. func (c *KMS) RetireGrant(input *RetireGrantInput) (*RetireGrantOutput, error) {
  4175. req, out := c.RetireGrantRequest(input)
  4176. return out, req.Send()
  4177. }
  4178. // RetireGrantWithContext is the same as RetireGrant with the addition of
  4179. // the ability to pass a context and additional request options.
  4180. //
  4181. // See RetireGrant for details on how to use this API operation.
  4182. //
  4183. // The context must be non-nil and will be used for request cancellation. If
  4184. // the context is nil a panic will occur. In the future the SDK may create
  4185. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  4186. // for more information on using Contexts.
  4187. func (c *KMS) RetireGrantWithContext(ctx aws.Context, input *RetireGrantInput, opts ...request.Option) (*RetireGrantOutput, error) {
  4188. req, out := c.RetireGrantRequest(input)
  4189. req.SetContext(ctx)
  4190. req.ApplyOptions(opts...)
  4191. return out, req.Send()
  4192. }
  4193. const opRevokeGrant = "RevokeGrant"
  4194. // RevokeGrantRequest generates a "aws/request.Request" representing the
  4195. // client's request for the RevokeGrant operation. The "output" return
  4196. // value will be populated with the request's response once the request completes
  4197. // successfully.
  4198. //
  4199. // Use "Send" method on the returned Request to send the API call to the service.
  4200. // the "output" return value is not valid until after Send returns without error.
  4201. //
  4202. // See RevokeGrant for more information on using the RevokeGrant
  4203. // API call, and error handling.
  4204. //
  4205. // This method is useful when you want to inject custom logic or configuration
  4206. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  4207. //
  4208. //
  4209. // // Example sending a request using the RevokeGrantRequest method.
  4210. // req, resp := client.RevokeGrantRequest(params)
  4211. //
  4212. // err := req.Send()
  4213. // if err == nil { // resp is now filled
  4214. // fmt.Println(resp)
  4215. // }
  4216. //
  4217. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/RevokeGrant
  4218. func (c *KMS) RevokeGrantRequest(input *RevokeGrantInput) (req *request.Request, output *RevokeGrantOutput) {
  4219. op := &request.Operation{
  4220. Name: opRevokeGrant,
  4221. HTTPMethod: "POST",
  4222. HTTPPath: "/",
  4223. }
  4224. if input == nil {
  4225. input = &RevokeGrantInput{}
  4226. }
  4227. output = &RevokeGrantOutput{}
  4228. req = c.newRequest(op, input, output)
  4229. req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
  4230. return
  4231. }
  4232. // RevokeGrant API operation for AWS Key Management Service.
  4233. //
  4234. // Revokes the specified grant for the specified customer master key (CMK).
  4235. // You can revoke a grant to actively deny operations that depend on it.
  4236. //
  4237. // To perform this operation on a CMK in a different AWS account, specify the
  4238. // key ARN in the value of the KeyId parameter.
  4239. //
  4240. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  4241. // with awserr.Error's Code and Message methods to get detailed information about
  4242. // the error.
  4243. //
  4244. // See the AWS API reference guide for AWS Key Management Service's
  4245. // API operation RevokeGrant for usage and error information.
  4246. //
  4247. // Returned Error Codes:
  4248. // * ErrCodeNotFoundException "NotFoundException"
  4249. // The request was rejected because the specified entity or resource could not
  4250. // be found.
  4251. //
  4252. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  4253. // The system timed out while trying to fulfill the request. The request can
  4254. // be retried.
  4255. //
  4256. // * ErrCodeInvalidArnException "InvalidArnException"
  4257. // The request was rejected because a specified ARN was not valid.
  4258. //
  4259. // * ErrCodeInvalidGrantIdException "InvalidGrantIdException"
  4260. // The request was rejected because the specified GrantId is not valid.
  4261. //
  4262. // * ErrCodeInternalException "KMSInternalException"
  4263. // The request was rejected because an internal exception occurred. The request
  4264. // can be retried.
  4265. //
  4266. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  4267. // The request was rejected because the state of the specified resource is not
  4268. // valid for this request.
  4269. //
  4270. // For more information about how key state affects the use of a CMK, see How
  4271. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  4272. // in the AWS Key Management Service Developer Guide.
  4273. //
  4274. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/RevokeGrant
  4275. func (c *KMS) RevokeGrant(input *RevokeGrantInput) (*RevokeGrantOutput, error) {
  4276. req, out := c.RevokeGrantRequest(input)
  4277. return out, req.Send()
  4278. }
  4279. // RevokeGrantWithContext is the same as RevokeGrant with the addition of
  4280. // the ability to pass a context and additional request options.
  4281. //
  4282. // See RevokeGrant for details on how to use this API operation.
  4283. //
  4284. // The context must be non-nil and will be used for request cancellation. If
  4285. // the context is nil a panic will occur. In the future the SDK may create
  4286. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  4287. // for more information on using Contexts.
  4288. func (c *KMS) RevokeGrantWithContext(ctx aws.Context, input *RevokeGrantInput, opts ...request.Option) (*RevokeGrantOutput, error) {
  4289. req, out := c.RevokeGrantRequest(input)
  4290. req.SetContext(ctx)
  4291. req.ApplyOptions(opts...)
  4292. return out, req.Send()
  4293. }
  4294. const opScheduleKeyDeletion = "ScheduleKeyDeletion"
  4295. // ScheduleKeyDeletionRequest generates a "aws/request.Request" representing the
  4296. // client's request for the ScheduleKeyDeletion operation. The "output" return
  4297. // value will be populated with the request's response once the request completes
  4298. // successfully.
  4299. //
  4300. // Use "Send" method on the returned Request to send the API call to the service.
  4301. // the "output" return value is not valid until after Send returns without error.
  4302. //
  4303. // See ScheduleKeyDeletion for more information on using the ScheduleKeyDeletion
  4304. // API call, and error handling.
  4305. //
  4306. // This method is useful when you want to inject custom logic or configuration
  4307. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  4308. //
  4309. //
  4310. // // Example sending a request using the ScheduleKeyDeletionRequest method.
  4311. // req, resp := client.ScheduleKeyDeletionRequest(params)
  4312. //
  4313. // err := req.Send()
  4314. // if err == nil { // resp is now filled
  4315. // fmt.Println(resp)
  4316. // }
  4317. //
  4318. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ScheduleKeyDeletion
  4319. func (c *KMS) ScheduleKeyDeletionRequest(input *ScheduleKeyDeletionInput) (req *request.Request, output *ScheduleKeyDeletionOutput) {
  4320. op := &request.Operation{
  4321. Name: opScheduleKeyDeletion,
  4322. HTTPMethod: "POST",
  4323. HTTPPath: "/",
  4324. }
  4325. if input == nil {
  4326. input = &ScheduleKeyDeletionInput{}
  4327. }
  4328. output = &ScheduleKeyDeletionOutput{}
  4329. req = c.newRequest(op, input, output)
  4330. return
  4331. }
  4332. // ScheduleKeyDeletion API operation for AWS Key Management Service.
  4333. //
  4334. // Schedules the deletion of a customer master key (CMK). You may provide a
  4335. // waiting period, specified in days, before deletion occurs. If you do not
  4336. // provide a waiting period, the default period of 30 days is used. When this
  4337. // operation is successful, the key state of the CMK changes to PendingDeletion.
  4338. // Before the waiting period ends, you can use CancelKeyDeletion to cancel the
  4339. // deletion of the CMK. After the waiting period ends, AWS KMS deletes the CMK
  4340. // and all AWS KMS data associated with it, including all aliases that refer
  4341. // to it.
  4342. //
  4343. // Deleting a CMK is a destructive and potentially dangerous operation. When
  4344. // a CMK is deleted, all data that was encrypted under the CMK is unrecoverable.
  4345. // To prevent the use of a CMK without deleting it, use DisableKey.
  4346. //
  4347. // If you schedule deletion of a CMK from a custom key store (http://docs.aws.amazon.com/kms/latest/developerguide/key-store-overview.html),
  4348. // when the waiting period expires, ScheduleKeyDeletion deletes the CMK from
  4349. // AWS KMS. Then AWS KMS makes a best effort to delete the key material from
  4350. // the associated AWS CloudHSM cluster. However, you might need to manually
  4351. // delete the orphaned key material (http://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html#fix-keystore-orphaned-key)
  4352. // from the cluster and its backups.
  4353. //
  4354. // You cannot perform this operation on a CMK in a different AWS account.
  4355. //
  4356. // For more information about scheduling a CMK for deletion, see Deleting Customer
  4357. // Master Keys (http://docs.aws.amazon.com/kms/latest/developerguide/deleting-keys.html)
  4358. // in the AWS Key Management Service Developer Guide.
  4359. //
  4360. // The result of this operation varies with the key state of the CMK. For details,
  4361. // see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  4362. // in the AWS Key Management Service Developer Guide.
  4363. //
  4364. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  4365. // with awserr.Error's Code and Message methods to get detailed information about
  4366. // the error.
  4367. //
  4368. // See the AWS API reference guide for AWS Key Management Service's
  4369. // API operation ScheduleKeyDeletion for usage and error information.
  4370. //
  4371. // Returned Error Codes:
  4372. // * ErrCodeNotFoundException "NotFoundException"
  4373. // The request was rejected because the specified entity or resource could not
  4374. // be found.
  4375. //
  4376. // * ErrCodeInvalidArnException "InvalidArnException"
  4377. // The request was rejected because a specified ARN was not valid.
  4378. //
  4379. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  4380. // The system timed out while trying to fulfill the request. The request can
  4381. // be retried.
  4382. //
  4383. // * ErrCodeInternalException "KMSInternalException"
  4384. // The request was rejected because an internal exception occurred. The request
  4385. // can be retried.
  4386. //
  4387. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  4388. // The request was rejected because the state of the specified resource is not
  4389. // valid for this request.
  4390. //
  4391. // For more information about how key state affects the use of a CMK, see How
  4392. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  4393. // in the AWS Key Management Service Developer Guide.
  4394. //
  4395. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/ScheduleKeyDeletion
  4396. func (c *KMS) ScheduleKeyDeletion(input *ScheduleKeyDeletionInput) (*ScheduleKeyDeletionOutput, error) {
  4397. req, out := c.ScheduleKeyDeletionRequest(input)
  4398. return out, req.Send()
  4399. }
  4400. // ScheduleKeyDeletionWithContext is the same as ScheduleKeyDeletion with the addition of
  4401. // the ability to pass a context and additional request options.
  4402. //
  4403. // See ScheduleKeyDeletion for details on how to use this API operation.
  4404. //
  4405. // The context must be non-nil and will be used for request cancellation. If
  4406. // the context is nil a panic will occur. In the future the SDK may create
  4407. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  4408. // for more information on using Contexts.
  4409. func (c *KMS) ScheduleKeyDeletionWithContext(ctx aws.Context, input *ScheduleKeyDeletionInput, opts ...request.Option) (*ScheduleKeyDeletionOutput, error) {
  4410. req, out := c.ScheduleKeyDeletionRequest(input)
  4411. req.SetContext(ctx)
  4412. req.ApplyOptions(opts...)
  4413. return out, req.Send()
  4414. }
  4415. const opTagResource = "TagResource"
  4416. // TagResourceRequest generates a "aws/request.Request" representing the
  4417. // client's request for the TagResource operation. The "output" return
  4418. // value will be populated with the request's response once the request completes
  4419. // successfully.
  4420. //
  4421. // Use "Send" method on the returned Request to send the API call to the service.
  4422. // the "output" return value is not valid until after Send returns without error.
  4423. //
  4424. // See TagResource for more information on using the TagResource
  4425. // API call, and error handling.
  4426. //
  4427. // This method is useful when you want to inject custom logic or configuration
  4428. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  4429. //
  4430. //
  4431. // // Example sending a request using the TagResourceRequest method.
  4432. // req, resp := client.TagResourceRequest(params)
  4433. //
  4434. // err := req.Send()
  4435. // if err == nil { // resp is now filled
  4436. // fmt.Println(resp)
  4437. // }
  4438. //
  4439. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/TagResource
  4440. func (c *KMS) TagResourceRequest(input *TagResourceInput) (req *request.Request, output *TagResourceOutput) {
  4441. op := &request.Operation{
  4442. Name: opTagResource,
  4443. HTTPMethod: "POST",
  4444. HTTPPath: "/",
  4445. }
  4446. if input == nil {
  4447. input = &TagResourceInput{}
  4448. }
  4449. output = &TagResourceOutput{}
  4450. req = c.newRequest(op, input, output)
  4451. req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
  4452. return
  4453. }
  4454. // TagResource API operation for AWS Key Management Service.
  4455. //
  4456. // Adds or edits tags for a customer master key (CMK). You cannot perform this
  4457. // operation on a CMK in a different AWS account.
  4458. //
  4459. // Each tag consists of a tag key and a tag value. Tag keys and tag values are
  4460. // both required, but tag values can be empty (null) strings.
  4461. //
  4462. // You can only use a tag key once for each CMK. If you use the tag key again,
  4463. // AWS KMS replaces the current tag value with the specified value.
  4464. //
  4465. // For information about the rules that apply to tag keys and tag values, see
  4466. // User-Defined Tag Restrictions (http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/allocation-tag-restrictions.html)
  4467. // in the AWS Billing and Cost Management User Guide.
  4468. //
  4469. // The result of this operation varies with the key state of the CMK. For details,
  4470. // see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  4471. // in the AWS Key Management Service Developer Guide.
  4472. //
  4473. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  4474. // with awserr.Error's Code and Message methods to get detailed information about
  4475. // the error.
  4476. //
  4477. // See the AWS API reference guide for AWS Key Management Service's
  4478. // API operation TagResource for usage and error information.
  4479. //
  4480. // Returned Error Codes:
  4481. // * ErrCodeInternalException "KMSInternalException"
  4482. // The request was rejected because an internal exception occurred. The request
  4483. // can be retried.
  4484. //
  4485. // * ErrCodeNotFoundException "NotFoundException"
  4486. // The request was rejected because the specified entity or resource could not
  4487. // be found.
  4488. //
  4489. // * ErrCodeInvalidArnException "InvalidArnException"
  4490. // The request was rejected because a specified ARN was not valid.
  4491. //
  4492. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  4493. // The request was rejected because the state of the specified resource is not
  4494. // valid for this request.
  4495. //
  4496. // For more information about how key state affects the use of a CMK, see How
  4497. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  4498. // in the AWS Key Management Service Developer Guide.
  4499. //
  4500. // * ErrCodeLimitExceededException "LimitExceededException"
  4501. // The request was rejected because a limit was exceeded. For more information,
  4502. // see Limits (http://docs.aws.amazon.com/kms/latest/developerguide/limits.html)
  4503. // in the AWS Key Management Service Developer Guide.
  4504. //
  4505. // * ErrCodeTagException "TagException"
  4506. // The request was rejected because one or more tags are not valid.
  4507. //
  4508. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/TagResource
  4509. func (c *KMS) TagResource(input *TagResourceInput) (*TagResourceOutput, error) {
  4510. req, out := c.TagResourceRequest(input)
  4511. return out, req.Send()
  4512. }
  4513. // TagResourceWithContext is the same as TagResource with the addition of
  4514. // the ability to pass a context and additional request options.
  4515. //
  4516. // See TagResource for details on how to use this API operation.
  4517. //
  4518. // The context must be non-nil and will be used for request cancellation. If
  4519. // the context is nil a panic will occur. In the future the SDK may create
  4520. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  4521. // for more information on using Contexts.
  4522. func (c *KMS) TagResourceWithContext(ctx aws.Context, input *TagResourceInput, opts ...request.Option) (*TagResourceOutput, error) {
  4523. req, out := c.TagResourceRequest(input)
  4524. req.SetContext(ctx)
  4525. req.ApplyOptions(opts...)
  4526. return out, req.Send()
  4527. }
  4528. const opUntagResource = "UntagResource"
  4529. // UntagResourceRequest generates a "aws/request.Request" representing the
  4530. // client's request for the UntagResource operation. The "output" return
  4531. // value will be populated with the request's response once the request completes
  4532. // successfully.
  4533. //
  4534. // Use "Send" method on the returned Request to send the API call to the service.
  4535. // the "output" return value is not valid until after Send returns without error.
  4536. //
  4537. // See UntagResource for more information on using the UntagResource
  4538. // API call, and error handling.
  4539. //
  4540. // This method is useful when you want to inject custom logic or configuration
  4541. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  4542. //
  4543. //
  4544. // // Example sending a request using the UntagResourceRequest method.
  4545. // req, resp := client.UntagResourceRequest(params)
  4546. //
  4547. // err := req.Send()
  4548. // if err == nil { // resp is now filled
  4549. // fmt.Println(resp)
  4550. // }
  4551. //
  4552. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/UntagResource
  4553. func (c *KMS) UntagResourceRequest(input *UntagResourceInput) (req *request.Request, output *UntagResourceOutput) {
  4554. op := &request.Operation{
  4555. Name: opUntagResource,
  4556. HTTPMethod: "POST",
  4557. HTTPPath: "/",
  4558. }
  4559. if input == nil {
  4560. input = &UntagResourceInput{}
  4561. }
  4562. output = &UntagResourceOutput{}
  4563. req = c.newRequest(op, input, output)
  4564. req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
  4565. return
  4566. }
  4567. // UntagResource API operation for AWS Key Management Service.
  4568. //
  4569. // Removes the specified tags from the specified customer master key (CMK).
  4570. // You cannot perform this operation on a CMK in a different AWS account.
  4571. //
  4572. // To remove a tag, specify the tag key. To change the tag value of an existing
  4573. // tag key, use TagResource.
  4574. //
  4575. // The result of this operation varies with the key state of the CMK. For details,
  4576. // see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  4577. // in the AWS Key Management Service Developer Guide.
  4578. //
  4579. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  4580. // with awserr.Error's Code and Message methods to get detailed information about
  4581. // the error.
  4582. //
  4583. // See the AWS API reference guide for AWS Key Management Service's
  4584. // API operation UntagResource for usage and error information.
  4585. //
  4586. // Returned Error Codes:
  4587. // * ErrCodeInternalException "KMSInternalException"
  4588. // The request was rejected because an internal exception occurred. The request
  4589. // can be retried.
  4590. //
  4591. // * ErrCodeNotFoundException "NotFoundException"
  4592. // The request was rejected because the specified entity or resource could not
  4593. // be found.
  4594. //
  4595. // * ErrCodeInvalidArnException "InvalidArnException"
  4596. // The request was rejected because a specified ARN was not valid.
  4597. //
  4598. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  4599. // The request was rejected because the state of the specified resource is not
  4600. // valid for this request.
  4601. //
  4602. // For more information about how key state affects the use of a CMK, see How
  4603. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  4604. // in the AWS Key Management Service Developer Guide.
  4605. //
  4606. // * ErrCodeTagException "TagException"
  4607. // The request was rejected because one or more tags are not valid.
  4608. //
  4609. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/UntagResource
  4610. func (c *KMS) UntagResource(input *UntagResourceInput) (*UntagResourceOutput, error) {
  4611. req, out := c.UntagResourceRequest(input)
  4612. return out, req.Send()
  4613. }
  4614. // UntagResourceWithContext is the same as UntagResource with the addition of
  4615. // the ability to pass a context and additional request options.
  4616. //
  4617. // See UntagResource for details on how to use this API operation.
  4618. //
  4619. // The context must be non-nil and will be used for request cancellation. If
  4620. // the context is nil a panic will occur. In the future the SDK may create
  4621. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  4622. // for more information on using Contexts.
  4623. func (c *KMS) UntagResourceWithContext(ctx aws.Context, input *UntagResourceInput, opts ...request.Option) (*UntagResourceOutput, error) {
  4624. req, out := c.UntagResourceRequest(input)
  4625. req.SetContext(ctx)
  4626. req.ApplyOptions(opts...)
  4627. return out, req.Send()
  4628. }
  4629. const opUpdateAlias = "UpdateAlias"
  4630. // UpdateAliasRequest generates a "aws/request.Request" representing the
  4631. // client's request for the UpdateAlias operation. The "output" return
  4632. // value will be populated with the request's response once the request completes
  4633. // successfully.
  4634. //
  4635. // Use "Send" method on the returned Request to send the API call to the service.
  4636. // the "output" return value is not valid until after Send returns without error.
  4637. //
  4638. // See UpdateAlias for more information on using the UpdateAlias
  4639. // API call, and error handling.
  4640. //
  4641. // This method is useful when you want to inject custom logic or configuration
  4642. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  4643. //
  4644. //
  4645. // // Example sending a request using the UpdateAliasRequest method.
  4646. // req, resp := client.UpdateAliasRequest(params)
  4647. //
  4648. // err := req.Send()
  4649. // if err == nil { // resp is now filled
  4650. // fmt.Println(resp)
  4651. // }
  4652. //
  4653. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/UpdateAlias
  4654. func (c *KMS) UpdateAliasRequest(input *UpdateAliasInput) (req *request.Request, output *UpdateAliasOutput) {
  4655. op := &request.Operation{
  4656. Name: opUpdateAlias,
  4657. HTTPMethod: "POST",
  4658. HTTPPath: "/",
  4659. }
  4660. if input == nil {
  4661. input = &UpdateAliasInput{}
  4662. }
  4663. output = &UpdateAliasOutput{}
  4664. req = c.newRequest(op, input, output)
  4665. req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
  4666. return
  4667. }
  4668. // UpdateAlias API operation for AWS Key Management Service.
  4669. //
  4670. // Associates an existing alias with a different customer master key (CMK).
  4671. // Each CMK can have multiple aliases, but the aliases must be unique within
  4672. // the account and region. You cannot perform this operation on an alias in
  4673. // a different AWS account.
  4674. //
  4675. // This operation works only on existing aliases. To change the alias of a CMK
  4676. // to a new value, use CreateAlias to create a new alias and DeleteAlias to
  4677. // delete the old alias.
  4678. //
  4679. // Because an alias is not a property of a CMK, you can create, update, and
  4680. // delete the aliases of a CMK without affecting the CMK. Also, aliases do not
  4681. // appear in the response from the DescribeKey operation. To get the aliases
  4682. // of all CMKs in the account, use the ListAliases operation.
  4683. //
  4684. // An alias name can contain only alphanumeric characters, forward slashes (/),
  4685. // underscores (_), and dashes (-). An alias must start with the word alias
  4686. // followed by a forward slash (alias/). The alias name can contain only alphanumeric
  4687. // characters, forward slashes (/), underscores (_), and dashes (-). Alias names
  4688. // cannot begin with aws; that alias name prefix is reserved by Amazon Web Services
  4689. // (AWS).
  4690. //
  4691. // The result of this operation varies with the key state of the CMK. For details,
  4692. // see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  4693. // in the AWS Key Management Service Developer Guide.
  4694. //
  4695. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  4696. // with awserr.Error's Code and Message methods to get detailed information about
  4697. // the error.
  4698. //
  4699. // See the AWS API reference guide for AWS Key Management Service's
  4700. // API operation UpdateAlias for usage and error information.
  4701. //
  4702. // Returned Error Codes:
  4703. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  4704. // The system timed out while trying to fulfill the request. The request can
  4705. // be retried.
  4706. //
  4707. // * ErrCodeNotFoundException "NotFoundException"
  4708. // The request was rejected because the specified entity or resource could not
  4709. // be found.
  4710. //
  4711. // * ErrCodeInternalException "KMSInternalException"
  4712. // The request was rejected because an internal exception occurred. The request
  4713. // can be retried.
  4714. //
  4715. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  4716. // The request was rejected because the state of the specified resource is not
  4717. // valid for this request.
  4718. //
  4719. // For more information about how key state affects the use of a CMK, see How
  4720. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  4721. // in the AWS Key Management Service Developer Guide.
  4722. //
  4723. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/UpdateAlias
  4724. func (c *KMS) UpdateAlias(input *UpdateAliasInput) (*UpdateAliasOutput, error) {
  4725. req, out := c.UpdateAliasRequest(input)
  4726. return out, req.Send()
  4727. }
  4728. // UpdateAliasWithContext is the same as UpdateAlias with the addition of
  4729. // the ability to pass a context and additional request options.
  4730. //
  4731. // See UpdateAlias for details on how to use this API operation.
  4732. //
  4733. // The context must be non-nil and will be used for request cancellation. If
  4734. // the context is nil a panic will occur. In the future the SDK may create
  4735. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  4736. // for more information on using Contexts.
  4737. func (c *KMS) UpdateAliasWithContext(ctx aws.Context, input *UpdateAliasInput, opts ...request.Option) (*UpdateAliasOutput, error) {
  4738. req, out := c.UpdateAliasRequest(input)
  4739. req.SetContext(ctx)
  4740. req.ApplyOptions(opts...)
  4741. return out, req.Send()
  4742. }
  4743. const opUpdateCustomKeyStore = "UpdateCustomKeyStore"
  4744. // UpdateCustomKeyStoreRequest generates a "aws/request.Request" representing the
  4745. // client's request for the UpdateCustomKeyStore operation. The "output" return
  4746. // value will be populated with the request's response once the request completes
  4747. // successfully.
  4748. //
  4749. // Use "Send" method on the returned Request to send the API call to the service.
  4750. // the "output" return value is not valid until after Send returns without error.
  4751. //
  4752. // See UpdateCustomKeyStore for more information on using the UpdateCustomKeyStore
  4753. // API call, and error handling.
  4754. //
  4755. // This method is useful when you want to inject custom logic or configuration
  4756. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  4757. //
  4758. //
  4759. // // Example sending a request using the UpdateCustomKeyStoreRequest method.
  4760. // req, resp := client.UpdateCustomKeyStoreRequest(params)
  4761. //
  4762. // err := req.Send()
  4763. // if err == nil { // resp is now filled
  4764. // fmt.Println(resp)
  4765. // }
  4766. //
  4767. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/UpdateCustomKeyStore
  4768. func (c *KMS) UpdateCustomKeyStoreRequest(input *UpdateCustomKeyStoreInput) (req *request.Request, output *UpdateCustomKeyStoreOutput) {
  4769. op := &request.Operation{
  4770. Name: opUpdateCustomKeyStore,
  4771. HTTPMethod: "POST",
  4772. HTTPPath: "/",
  4773. }
  4774. if input == nil {
  4775. input = &UpdateCustomKeyStoreInput{}
  4776. }
  4777. output = &UpdateCustomKeyStoreOutput{}
  4778. req = c.newRequest(op, input, output)
  4779. req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
  4780. return
  4781. }
  4782. // UpdateCustomKeyStore API operation for AWS Key Management Service.
  4783. //
  4784. // Changes the properties of a custom key store. Use the CustomKeyStoreId parameter
  4785. // to identify the custom key store you want to edit. Use the remaining parameters
  4786. // to change the properties of the custom key store.
  4787. //
  4788. // You can only update a custom key store that is disconnected. To disconnect
  4789. // the custom key store, use DisconnectCustomKeyStore. To reconnect the custom
  4790. // key store after the update completes, use ConnectCustomKeyStore. To find
  4791. // the connection state of a custom key store, use the DescribeCustomKeyStores
  4792. // operation.
  4793. //
  4794. // Use the NewCustomKeyStoreName parameter to change the friendly name of the
  4795. // custom key store to the value that you specify.
  4796. //
  4797. // Use the KeyStorePassword parameter tell AWS KMS the current password of the
  4798. // kmsuser (http://docs.aws.amazon.com/kms/latest/developerguide/key-store-concepts.html#concept-kmsuser)
  4799. // crypto user (CU) in the associated AWS CloudHSM cluster. You can use this
  4800. // parameter to fix connection failures that occur when AWS KMS cannot log into
  4801. // the associated cluster because the kmsuser password has changed. This value
  4802. // does not change the password in the AWS CloudHSM cluster.
  4803. //
  4804. // Use the CloudHsmClusterId parameter to associate the custom key store with
  4805. // a related AWS CloudHSM cluster, that is, a cluster that shares a backup history
  4806. // with the original cluster. You can use this parameter to repair a custom
  4807. // key store if its AWS CloudHSM cluster becomes corrupted or is deleted, or
  4808. // when you need to create or restore a cluster from a backup.
  4809. //
  4810. // The cluster ID must identify a AWS CloudHSM cluster with the following requirements.
  4811. //
  4812. // * The cluster must be active and be in the same AWS account and Region
  4813. // as the custom key store.
  4814. //
  4815. // * The cluster must have the same cluster certificate as the original cluster.
  4816. // You cannot use this parameter to associate the custom key store with an
  4817. // unrelated cluster. To view the cluster certificate, use the AWS CloudHSM
  4818. // DescribeClusters (http://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html)
  4819. // operation. Clusters that share a backup history have the same cluster
  4820. // certificate.
  4821. //
  4822. // * The cluster must be configured with subnets in at least two different
  4823. // Availability Zones in the Region. Because AWS CloudHSM is not supported
  4824. // in all Availability Zones, we recommend that the cluster have subnets
  4825. // in all Availability Zones in the Region.
  4826. //
  4827. // * The cluster must contain at least two active HSMs, each in a different
  4828. // Availability Zone.
  4829. //
  4830. // If the operation succeeds, it returns a JSON object with no properties.
  4831. //
  4832. // This operation is part of the Custom Key Store feature (http://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html)
  4833. // feature in AWS KMS, which combines the convenience and extensive integration
  4834. // of AWS KMS with the isolation and control of a single-tenant key store.
  4835. //
  4836. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  4837. // with awserr.Error's Code and Message methods to get detailed information about
  4838. // the error.
  4839. //
  4840. // See the AWS API reference guide for AWS Key Management Service's
  4841. // API operation UpdateCustomKeyStore for usage and error information.
  4842. //
  4843. // Returned Error Codes:
  4844. // * ErrCodeCustomKeyStoreNotFoundException "CustomKeyStoreNotFoundException"
  4845. // The request was rejected because AWS KMS cannot find a custom key store with
  4846. // the specified key store name or ID.
  4847. //
  4848. // * ErrCodeCloudHsmClusterNotFoundException "CloudHsmClusterNotFoundException"
  4849. // The request was rejected because AWS KMS cannot find the AWS CloudHSM cluster
  4850. // with the specified cluster ID. Retry the request with a different cluster
  4851. // ID.
  4852. //
  4853. // * ErrCodeCloudHsmClusterNotRelatedException "CloudHsmClusterNotRelatedException"
  4854. // The request was rejected because the specified AWS CloudHSM cluster has a
  4855. // different cluster certificate than the original cluster. You cannot use the
  4856. // operation to specify an unrelated cluster.
  4857. //
  4858. // Specify a cluster that shares a backup history with the original cluster.
  4859. // This includes clusters that were created from a backup of the current cluster,
  4860. // and clusters that were created from the same backup that produced the current
  4861. // cluster.
  4862. //
  4863. // Clusters that share a backup history have the same cluster certificate. To
  4864. // view the cluster certificate of a cluster, use the DescribeClusters (http://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html)
  4865. // operation.
  4866. //
  4867. // * ErrCodeCustomKeyStoreInvalidStateException "CustomKeyStoreInvalidStateException"
  4868. // The request was rejected because of the ConnectionState of the custom key
  4869. // store. To get the ConnectionState of a custom key store, use the DescribeCustomKeyStores
  4870. // operation.
  4871. //
  4872. // This exception is thrown under the following conditions:
  4873. //
  4874. // * You requested the CreateKey or GenerateRandom operation in a custom
  4875. // key store that is not connected. These operations are valid only when
  4876. // the custom key store ConnectionState is CONNECTED.
  4877. //
  4878. // * You requested the UpdateCustomKeyStore or DeleteCustomKeyStore operation
  4879. // on a custom key store that is not disconnected. This operation is valid
  4880. // only when the custom key store ConnectionState is DISCONNECTED.
  4881. //
  4882. // * You requested the ConnectCustomKeyStore operation on a custom key store
  4883. // with a ConnectionState of DISCONNECTING or FAILED. This operation is valid
  4884. // for all other ConnectionState values.
  4885. //
  4886. // * ErrCodeInternalException "KMSInternalException"
  4887. // The request was rejected because an internal exception occurred. The request
  4888. // can be retried.
  4889. //
  4890. // * ErrCodeCloudHsmClusterNotActiveException "CloudHsmClusterNotActiveException"
  4891. // The request was rejected because the AWS CloudHSM cluster that is associated
  4892. // with the custom key store is not active. Initialize and activate the cluster
  4893. // and try the command again. For detailed instructions, see Getting Started
  4894. // (http://docs.aws.amazon.com/cloudhsm/latest/userguide/getting-started.html)
  4895. // in the AWS CloudHSM User Guide.
  4896. //
  4897. // * ErrCodeCloudHsmClusterInvalidConfigurationException "CloudHsmClusterInvalidConfigurationException"
  4898. // The request was rejected because the associated AWS CloudHSM cluster did
  4899. // not meet the configuration requirements for a custom key store. The cluster
  4900. // must be configured with private subnets in at least two different Availability
  4901. // Zones in the Region. Also, it must contain at least as many HSMs as the operation
  4902. // requires.
  4903. //
  4904. // For the CreateCustomKeyStore, UpdateCustomKeyStore, and CreateKey operations,
  4905. // the AWS CloudHSM cluster must have at least two active HSMs, each in a different
  4906. // Availability Zone. For the ConnectCustomKeyStore operation, the AWS CloudHSM
  4907. // must contain at least one active HSM.
  4908. //
  4909. // For information about creating a private subnet for a AWS CloudHSM cluster,
  4910. // see Create a Private Subnet (http://docs.aws.amazon.com/cloudhsm/latest/userguide/create-subnets.html)
  4911. // in the AWS CloudHSM User Guide. To add HSMs, use the AWS CloudHSM CreateHsm
  4912. // (http://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_CreateHsm.html)
  4913. // operation.
  4914. //
  4915. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/UpdateCustomKeyStore
  4916. func (c *KMS) UpdateCustomKeyStore(input *UpdateCustomKeyStoreInput) (*UpdateCustomKeyStoreOutput, error) {
  4917. req, out := c.UpdateCustomKeyStoreRequest(input)
  4918. return out, req.Send()
  4919. }
  4920. // UpdateCustomKeyStoreWithContext is the same as UpdateCustomKeyStore with the addition of
  4921. // the ability to pass a context and additional request options.
  4922. //
  4923. // See UpdateCustomKeyStore for details on how to use this API operation.
  4924. //
  4925. // The context must be non-nil and will be used for request cancellation. If
  4926. // the context is nil a panic will occur. In the future the SDK may create
  4927. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  4928. // for more information on using Contexts.
  4929. func (c *KMS) UpdateCustomKeyStoreWithContext(ctx aws.Context, input *UpdateCustomKeyStoreInput, opts ...request.Option) (*UpdateCustomKeyStoreOutput, error) {
  4930. req, out := c.UpdateCustomKeyStoreRequest(input)
  4931. req.SetContext(ctx)
  4932. req.ApplyOptions(opts...)
  4933. return out, req.Send()
  4934. }
  4935. const opUpdateKeyDescription = "UpdateKeyDescription"
  4936. // UpdateKeyDescriptionRequest generates a "aws/request.Request" representing the
  4937. // client's request for the UpdateKeyDescription operation. The "output" return
  4938. // value will be populated with the request's response once the request completes
  4939. // successfully.
  4940. //
  4941. // Use "Send" method on the returned Request to send the API call to the service.
  4942. // the "output" return value is not valid until after Send returns without error.
  4943. //
  4944. // See UpdateKeyDescription for more information on using the UpdateKeyDescription
  4945. // API call, and error handling.
  4946. //
  4947. // This method is useful when you want to inject custom logic or configuration
  4948. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  4949. //
  4950. //
  4951. // // Example sending a request using the UpdateKeyDescriptionRequest method.
  4952. // req, resp := client.UpdateKeyDescriptionRequest(params)
  4953. //
  4954. // err := req.Send()
  4955. // if err == nil { // resp is now filled
  4956. // fmt.Println(resp)
  4957. // }
  4958. //
  4959. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/UpdateKeyDescription
  4960. func (c *KMS) UpdateKeyDescriptionRequest(input *UpdateKeyDescriptionInput) (req *request.Request, output *UpdateKeyDescriptionOutput) {
  4961. op := &request.Operation{
  4962. Name: opUpdateKeyDescription,
  4963. HTTPMethod: "POST",
  4964. HTTPPath: "/",
  4965. }
  4966. if input == nil {
  4967. input = &UpdateKeyDescriptionInput{}
  4968. }
  4969. output = &UpdateKeyDescriptionOutput{}
  4970. req = c.newRequest(op, input, output)
  4971. req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
  4972. return
  4973. }
  4974. // UpdateKeyDescription API operation for AWS Key Management Service.
  4975. //
  4976. // Updates the description of a customer master key (CMK). To see the decription
  4977. // of a CMK, use DescribeKey.
  4978. //
  4979. // You cannot perform this operation on a CMK in a different AWS account.
  4980. //
  4981. // The result of this operation varies with the key state of the CMK. For details,
  4982. // see How Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  4983. // in the AWS Key Management Service Developer Guide.
  4984. //
  4985. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  4986. // with awserr.Error's Code and Message methods to get detailed information about
  4987. // the error.
  4988. //
  4989. // See the AWS API reference guide for AWS Key Management Service's
  4990. // API operation UpdateKeyDescription for usage and error information.
  4991. //
  4992. // Returned Error Codes:
  4993. // * ErrCodeNotFoundException "NotFoundException"
  4994. // The request was rejected because the specified entity or resource could not
  4995. // be found.
  4996. //
  4997. // * ErrCodeInvalidArnException "InvalidArnException"
  4998. // The request was rejected because a specified ARN was not valid.
  4999. //
  5000. // * ErrCodeDependencyTimeoutException "DependencyTimeoutException"
  5001. // The system timed out while trying to fulfill the request. The request can
  5002. // be retried.
  5003. //
  5004. // * ErrCodeInternalException "KMSInternalException"
  5005. // The request was rejected because an internal exception occurred. The request
  5006. // can be retried.
  5007. //
  5008. // * ErrCodeInvalidStateException "KMSInvalidStateException"
  5009. // The request was rejected because the state of the specified resource is not
  5010. // valid for this request.
  5011. //
  5012. // For more information about how key state affects the use of a CMK, see How
  5013. // Key State Affects Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  5014. // in the AWS Key Management Service Developer Guide.
  5015. //
  5016. // See also, https://docs.aws.amazon.com/goto/WebAPI/kms-2014-11-01/UpdateKeyDescription
  5017. func (c *KMS) UpdateKeyDescription(input *UpdateKeyDescriptionInput) (*UpdateKeyDescriptionOutput, error) {
  5018. req, out := c.UpdateKeyDescriptionRequest(input)
  5019. return out, req.Send()
  5020. }
  5021. // UpdateKeyDescriptionWithContext is the same as UpdateKeyDescription with the addition of
  5022. // the ability to pass a context and additional request options.
  5023. //
  5024. // See UpdateKeyDescription for details on how to use this API operation.
  5025. //
  5026. // The context must be non-nil and will be used for request cancellation. If
  5027. // the context is nil a panic will occur. In the future the SDK may create
  5028. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  5029. // for more information on using Contexts.
  5030. func (c *KMS) UpdateKeyDescriptionWithContext(ctx aws.Context, input *UpdateKeyDescriptionInput, opts ...request.Option) (*UpdateKeyDescriptionOutput, error) {
  5031. req, out := c.UpdateKeyDescriptionRequest(input)
  5032. req.SetContext(ctx)
  5033. req.ApplyOptions(opts...)
  5034. return out, req.Send()
  5035. }
  5036. // Contains information about an alias.
  5037. type AliasListEntry struct {
  5038. _ struct{} `type:"structure"`
  5039. // String that contains the key ARN.
  5040. AliasArn *string `min:"20" type:"string"`
  5041. // String that contains the alias.
  5042. AliasName *string `min:"1" type:"string"`
  5043. // String that contains the key identifier referred to by the alias.
  5044. TargetKeyId *string `min:"1" type:"string"`
  5045. }
  5046. // String returns the string representation
  5047. func (s AliasListEntry) String() string {
  5048. return awsutil.Prettify(s)
  5049. }
  5050. // GoString returns the string representation
  5051. func (s AliasListEntry) GoString() string {
  5052. return s.String()
  5053. }
  5054. // SetAliasArn sets the AliasArn field's value.
  5055. func (s *AliasListEntry) SetAliasArn(v string) *AliasListEntry {
  5056. s.AliasArn = &v
  5057. return s
  5058. }
  5059. // SetAliasName sets the AliasName field's value.
  5060. func (s *AliasListEntry) SetAliasName(v string) *AliasListEntry {
  5061. s.AliasName = &v
  5062. return s
  5063. }
  5064. // SetTargetKeyId sets the TargetKeyId field's value.
  5065. func (s *AliasListEntry) SetTargetKeyId(v string) *AliasListEntry {
  5066. s.TargetKeyId = &v
  5067. return s
  5068. }
  5069. type CancelKeyDeletionInput struct {
  5070. _ struct{} `type:"structure"`
  5071. // The unique identifier for the customer master key (CMK) for which to cancel
  5072. // deletion.
  5073. //
  5074. // Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
  5075. //
  5076. // For example:
  5077. //
  5078. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  5079. //
  5080. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  5081. //
  5082. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
  5083. //
  5084. // KeyId is a required field
  5085. KeyId *string `min:"1" type:"string" required:"true"`
  5086. }
  5087. // String returns the string representation
  5088. func (s CancelKeyDeletionInput) String() string {
  5089. return awsutil.Prettify(s)
  5090. }
  5091. // GoString returns the string representation
  5092. func (s CancelKeyDeletionInput) GoString() string {
  5093. return s.String()
  5094. }
  5095. // Validate inspects the fields of the type to determine if they are valid.
  5096. func (s *CancelKeyDeletionInput) Validate() error {
  5097. invalidParams := request.ErrInvalidParams{Context: "CancelKeyDeletionInput"}
  5098. if s.KeyId == nil {
  5099. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  5100. }
  5101. if s.KeyId != nil && len(*s.KeyId) < 1 {
  5102. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  5103. }
  5104. if invalidParams.Len() > 0 {
  5105. return invalidParams
  5106. }
  5107. return nil
  5108. }
  5109. // SetKeyId sets the KeyId field's value.
  5110. func (s *CancelKeyDeletionInput) SetKeyId(v string) *CancelKeyDeletionInput {
  5111. s.KeyId = &v
  5112. return s
  5113. }
  5114. type CancelKeyDeletionOutput struct {
  5115. _ struct{} `type:"structure"`
  5116. // The unique identifier of the master key for which deletion is canceled.
  5117. KeyId *string `min:"1" type:"string"`
  5118. }
  5119. // String returns the string representation
  5120. func (s CancelKeyDeletionOutput) String() string {
  5121. return awsutil.Prettify(s)
  5122. }
  5123. // GoString returns the string representation
  5124. func (s CancelKeyDeletionOutput) GoString() string {
  5125. return s.String()
  5126. }
  5127. // SetKeyId sets the KeyId field's value.
  5128. func (s *CancelKeyDeletionOutput) SetKeyId(v string) *CancelKeyDeletionOutput {
  5129. s.KeyId = &v
  5130. return s
  5131. }
  5132. type ConnectCustomKeyStoreInput struct {
  5133. _ struct{} `type:"structure"`
  5134. // Enter the key store ID of the custom key store that you want to connect.
  5135. // To find the ID of a custom key store, use the DescribeCustomKeyStores operation.
  5136. //
  5137. // CustomKeyStoreId is a required field
  5138. CustomKeyStoreId *string `min:"1" type:"string" required:"true"`
  5139. }
  5140. // String returns the string representation
  5141. func (s ConnectCustomKeyStoreInput) String() string {
  5142. return awsutil.Prettify(s)
  5143. }
  5144. // GoString returns the string representation
  5145. func (s ConnectCustomKeyStoreInput) GoString() string {
  5146. return s.String()
  5147. }
  5148. // Validate inspects the fields of the type to determine if they are valid.
  5149. func (s *ConnectCustomKeyStoreInput) Validate() error {
  5150. invalidParams := request.ErrInvalidParams{Context: "ConnectCustomKeyStoreInput"}
  5151. if s.CustomKeyStoreId == nil {
  5152. invalidParams.Add(request.NewErrParamRequired("CustomKeyStoreId"))
  5153. }
  5154. if s.CustomKeyStoreId != nil && len(*s.CustomKeyStoreId) < 1 {
  5155. invalidParams.Add(request.NewErrParamMinLen("CustomKeyStoreId", 1))
  5156. }
  5157. if invalidParams.Len() > 0 {
  5158. return invalidParams
  5159. }
  5160. return nil
  5161. }
  5162. // SetCustomKeyStoreId sets the CustomKeyStoreId field's value.
  5163. func (s *ConnectCustomKeyStoreInput) SetCustomKeyStoreId(v string) *ConnectCustomKeyStoreInput {
  5164. s.CustomKeyStoreId = &v
  5165. return s
  5166. }
  5167. type ConnectCustomKeyStoreOutput struct {
  5168. _ struct{} `type:"structure"`
  5169. }
  5170. // String returns the string representation
  5171. func (s ConnectCustomKeyStoreOutput) String() string {
  5172. return awsutil.Prettify(s)
  5173. }
  5174. // GoString returns the string representation
  5175. func (s ConnectCustomKeyStoreOutput) GoString() string {
  5176. return s.String()
  5177. }
  5178. type CreateAliasInput struct {
  5179. _ struct{} `type:"structure"`
  5180. // String that contains the display name. The name must start with the word
  5181. // "alias" followed by a forward slash (alias/). Aliases that begin with "alias/AWS"
  5182. // are reserved.
  5183. //
  5184. // AliasName is a required field
  5185. AliasName *string `min:"1" type:"string" required:"true"`
  5186. // Identifies the CMK for which you are creating the alias. This value cannot
  5187. // be an alias.
  5188. //
  5189. // Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
  5190. //
  5191. // For example:
  5192. //
  5193. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  5194. //
  5195. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  5196. //
  5197. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
  5198. //
  5199. // TargetKeyId is a required field
  5200. TargetKeyId *string `min:"1" type:"string" required:"true"`
  5201. }
  5202. // String returns the string representation
  5203. func (s CreateAliasInput) String() string {
  5204. return awsutil.Prettify(s)
  5205. }
  5206. // GoString returns the string representation
  5207. func (s CreateAliasInput) GoString() string {
  5208. return s.String()
  5209. }
  5210. // Validate inspects the fields of the type to determine if they are valid.
  5211. func (s *CreateAliasInput) Validate() error {
  5212. invalidParams := request.ErrInvalidParams{Context: "CreateAliasInput"}
  5213. if s.AliasName == nil {
  5214. invalidParams.Add(request.NewErrParamRequired("AliasName"))
  5215. }
  5216. if s.AliasName != nil && len(*s.AliasName) < 1 {
  5217. invalidParams.Add(request.NewErrParamMinLen("AliasName", 1))
  5218. }
  5219. if s.TargetKeyId == nil {
  5220. invalidParams.Add(request.NewErrParamRequired("TargetKeyId"))
  5221. }
  5222. if s.TargetKeyId != nil && len(*s.TargetKeyId) < 1 {
  5223. invalidParams.Add(request.NewErrParamMinLen("TargetKeyId", 1))
  5224. }
  5225. if invalidParams.Len() > 0 {
  5226. return invalidParams
  5227. }
  5228. return nil
  5229. }
  5230. // SetAliasName sets the AliasName field's value.
  5231. func (s *CreateAliasInput) SetAliasName(v string) *CreateAliasInput {
  5232. s.AliasName = &v
  5233. return s
  5234. }
  5235. // SetTargetKeyId sets the TargetKeyId field's value.
  5236. func (s *CreateAliasInput) SetTargetKeyId(v string) *CreateAliasInput {
  5237. s.TargetKeyId = &v
  5238. return s
  5239. }
  5240. type CreateAliasOutput struct {
  5241. _ struct{} `type:"structure"`
  5242. }
  5243. // String returns the string representation
  5244. func (s CreateAliasOutput) String() string {
  5245. return awsutil.Prettify(s)
  5246. }
  5247. // GoString returns the string representation
  5248. func (s CreateAliasOutput) GoString() string {
  5249. return s.String()
  5250. }
  5251. type CreateCustomKeyStoreInput struct {
  5252. _ struct{} `type:"structure"`
  5253. // Identifies the AWS CloudHSM cluster for the custom key store. Enter the cluster
  5254. // ID of any active AWS CloudHSM cluster that is not already associated with
  5255. // a custom key store. To find the cluster ID, use the DescribeClusters (http://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html)
  5256. // operation.
  5257. //
  5258. // CloudHsmClusterId is a required field
  5259. CloudHsmClusterId *string `min:"19" type:"string" required:"true"`
  5260. // Specifies a friendly name for the custom key store. The name must be unique
  5261. // in your AWS account.
  5262. //
  5263. // CustomKeyStoreName is a required field
  5264. CustomKeyStoreName *string `min:"1" type:"string" required:"true"`
  5265. // Enter the password of the kmsuser (http://docs.aws.amazon.com/kms/latest/developerguide/key-store-concepts.html#concept-kmsuser)
  5266. // crypto user (CU) account in the specified AWS CloudHSM cluster. AWS KMS logs
  5267. // into the cluster as this user to manage key material on your behalf.
  5268. //
  5269. // This parameter tells AWS KMS the kmsuser account password; it does not change
  5270. // the password in the AWS CloudHSM cluster.
  5271. //
  5272. // KeyStorePassword is a required field
  5273. KeyStorePassword *string `min:"1" type:"string" required:"true" sensitive:"true"`
  5274. // Enter the content of the trust anchor certificate for the cluster. This is
  5275. // the content of the customerCA.crt file that you created when you initialized
  5276. // the cluster (http://docs.aws.amazon.com/cloudhsm/latest/userguide/initialize-cluster.html).
  5277. //
  5278. // TrustAnchorCertificate is a required field
  5279. TrustAnchorCertificate *string `min:"1" type:"string" required:"true"`
  5280. }
  5281. // String returns the string representation
  5282. func (s CreateCustomKeyStoreInput) String() string {
  5283. return awsutil.Prettify(s)
  5284. }
  5285. // GoString returns the string representation
  5286. func (s CreateCustomKeyStoreInput) GoString() string {
  5287. return s.String()
  5288. }
  5289. // Validate inspects the fields of the type to determine if they are valid.
  5290. func (s *CreateCustomKeyStoreInput) Validate() error {
  5291. invalidParams := request.ErrInvalidParams{Context: "CreateCustomKeyStoreInput"}
  5292. if s.CloudHsmClusterId == nil {
  5293. invalidParams.Add(request.NewErrParamRequired("CloudHsmClusterId"))
  5294. }
  5295. if s.CloudHsmClusterId != nil && len(*s.CloudHsmClusterId) < 19 {
  5296. invalidParams.Add(request.NewErrParamMinLen("CloudHsmClusterId", 19))
  5297. }
  5298. if s.CustomKeyStoreName == nil {
  5299. invalidParams.Add(request.NewErrParamRequired("CustomKeyStoreName"))
  5300. }
  5301. if s.CustomKeyStoreName != nil && len(*s.CustomKeyStoreName) < 1 {
  5302. invalidParams.Add(request.NewErrParamMinLen("CustomKeyStoreName", 1))
  5303. }
  5304. if s.KeyStorePassword == nil {
  5305. invalidParams.Add(request.NewErrParamRequired("KeyStorePassword"))
  5306. }
  5307. if s.KeyStorePassword != nil && len(*s.KeyStorePassword) < 1 {
  5308. invalidParams.Add(request.NewErrParamMinLen("KeyStorePassword", 1))
  5309. }
  5310. if s.TrustAnchorCertificate == nil {
  5311. invalidParams.Add(request.NewErrParamRequired("TrustAnchorCertificate"))
  5312. }
  5313. if s.TrustAnchorCertificate != nil && len(*s.TrustAnchorCertificate) < 1 {
  5314. invalidParams.Add(request.NewErrParamMinLen("TrustAnchorCertificate", 1))
  5315. }
  5316. if invalidParams.Len() > 0 {
  5317. return invalidParams
  5318. }
  5319. return nil
  5320. }
  5321. // SetCloudHsmClusterId sets the CloudHsmClusterId field's value.
  5322. func (s *CreateCustomKeyStoreInput) SetCloudHsmClusterId(v string) *CreateCustomKeyStoreInput {
  5323. s.CloudHsmClusterId = &v
  5324. return s
  5325. }
  5326. // SetCustomKeyStoreName sets the CustomKeyStoreName field's value.
  5327. func (s *CreateCustomKeyStoreInput) SetCustomKeyStoreName(v string) *CreateCustomKeyStoreInput {
  5328. s.CustomKeyStoreName = &v
  5329. return s
  5330. }
  5331. // SetKeyStorePassword sets the KeyStorePassword field's value.
  5332. func (s *CreateCustomKeyStoreInput) SetKeyStorePassword(v string) *CreateCustomKeyStoreInput {
  5333. s.KeyStorePassword = &v
  5334. return s
  5335. }
  5336. // SetTrustAnchorCertificate sets the TrustAnchorCertificate field's value.
  5337. func (s *CreateCustomKeyStoreInput) SetTrustAnchorCertificate(v string) *CreateCustomKeyStoreInput {
  5338. s.TrustAnchorCertificate = &v
  5339. return s
  5340. }
  5341. type CreateCustomKeyStoreOutput struct {
  5342. _ struct{} `type:"structure"`
  5343. // A unique identifier for the new custom key store.
  5344. CustomKeyStoreId *string `min:"1" type:"string"`
  5345. }
  5346. // String returns the string representation
  5347. func (s CreateCustomKeyStoreOutput) String() string {
  5348. return awsutil.Prettify(s)
  5349. }
  5350. // GoString returns the string representation
  5351. func (s CreateCustomKeyStoreOutput) GoString() string {
  5352. return s.String()
  5353. }
  5354. // SetCustomKeyStoreId sets the CustomKeyStoreId field's value.
  5355. func (s *CreateCustomKeyStoreOutput) SetCustomKeyStoreId(v string) *CreateCustomKeyStoreOutput {
  5356. s.CustomKeyStoreId = &v
  5357. return s
  5358. }
  5359. type CreateGrantInput struct {
  5360. _ struct{} `type:"structure"`
  5361. // A structure that you can use to allow certain operations in the grant only
  5362. // when the desired encryption context is present. For more information about
  5363. // encryption context, see Encryption Context (http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html)
  5364. // in the AWS Key Management Service Developer Guide.
  5365. Constraints *GrantConstraints `type:"structure"`
  5366. // A list of grant tokens.
  5367. //
  5368. // For more information, see Grant Tokens (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token)
  5369. // in the AWS Key Management Service Developer Guide.
  5370. GrantTokens []*string `type:"list"`
  5371. // The principal that is given permission to perform the operations that the
  5372. // grant permits.
  5373. //
  5374. // To specify the principal, use the Amazon Resource Name (ARN) (http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
  5375. // of an AWS principal. Valid AWS principals include AWS accounts (root), IAM
  5376. // users, IAM roles, federated users, and assumed role users. For examples of
  5377. // the ARN syntax to use for specifying a principal, see AWS Identity and Access
  5378. // Management (IAM) (http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-iam)
  5379. // in the Example ARNs section of the AWS General Reference.
  5380. //
  5381. // GranteePrincipal is a required field
  5382. GranteePrincipal *string `min:"1" type:"string" required:"true"`
  5383. // The unique identifier for the customer master key (CMK) that the grant applies
  5384. // to.
  5385. //
  5386. // Specify the key ID or the Amazon Resource Name (ARN) of the CMK. To specify
  5387. // a CMK in a different AWS account, you must use the key ARN.
  5388. //
  5389. // For example:
  5390. //
  5391. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  5392. //
  5393. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  5394. //
  5395. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
  5396. //
  5397. // KeyId is a required field
  5398. KeyId *string `min:"1" type:"string" required:"true"`
  5399. // A friendly name for identifying the grant. Use this value to prevent unintended
  5400. // creation of duplicate grants when retrying this request.
  5401. //
  5402. // When this value is absent, all CreateGrant requests result in a new grant
  5403. // with a unique GrantId even if all the supplied parameters are identical.
  5404. // This can result in unintended duplicates when you retry the CreateGrant request.
  5405. //
  5406. // When this value is present, you can retry a CreateGrant request with identical
  5407. // parameters; if the grant already exists, the original GrantId is returned
  5408. // without creating a new grant. Note that the returned grant token is unique
  5409. // with every CreateGrant request, even when a duplicate GrantId is returned.
  5410. // All grant tokens obtained in this way can be used interchangeably.
  5411. Name *string `min:"1" type:"string"`
  5412. // A list of operations that the grant permits.
  5413. //
  5414. // Operations is a required field
  5415. Operations []*string `type:"list" required:"true"`
  5416. // The principal that is given permission to retire the grant by using RetireGrant
  5417. // operation.
  5418. //
  5419. // To specify the principal, use the Amazon Resource Name (ARN) (http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
  5420. // of an AWS principal. Valid AWS principals include AWS accounts (root), IAM
  5421. // users, federated users, and assumed role users. For examples of the ARN syntax
  5422. // to use for specifying a principal, see AWS Identity and Access Management
  5423. // (IAM) (http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-iam)
  5424. // in the Example ARNs section of the AWS General Reference.
  5425. RetiringPrincipal *string `min:"1" type:"string"`
  5426. }
  5427. // String returns the string representation
  5428. func (s CreateGrantInput) String() string {
  5429. return awsutil.Prettify(s)
  5430. }
  5431. // GoString returns the string representation
  5432. func (s CreateGrantInput) GoString() string {
  5433. return s.String()
  5434. }
  5435. // Validate inspects the fields of the type to determine if they are valid.
  5436. func (s *CreateGrantInput) Validate() error {
  5437. invalidParams := request.ErrInvalidParams{Context: "CreateGrantInput"}
  5438. if s.GranteePrincipal == nil {
  5439. invalidParams.Add(request.NewErrParamRequired("GranteePrincipal"))
  5440. }
  5441. if s.GranteePrincipal != nil && len(*s.GranteePrincipal) < 1 {
  5442. invalidParams.Add(request.NewErrParamMinLen("GranteePrincipal", 1))
  5443. }
  5444. if s.KeyId == nil {
  5445. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  5446. }
  5447. if s.KeyId != nil && len(*s.KeyId) < 1 {
  5448. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  5449. }
  5450. if s.Name != nil && len(*s.Name) < 1 {
  5451. invalidParams.Add(request.NewErrParamMinLen("Name", 1))
  5452. }
  5453. if s.Operations == nil {
  5454. invalidParams.Add(request.NewErrParamRequired("Operations"))
  5455. }
  5456. if s.RetiringPrincipal != nil && len(*s.RetiringPrincipal) < 1 {
  5457. invalidParams.Add(request.NewErrParamMinLen("RetiringPrincipal", 1))
  5458. }
  5459. if invalidParams.Len() > 0 {
  5460. return invalidParams
  5461. }
  5462. return nil
  5463. }
  5464. // SetConstraints sets the Constraints field's value.
  5465. func (s *CreateGrantInput) SetConstraints(v *GrantConstraints) *CreateGrantInput {
  5466. s.Constraints = v
  5467. return s
  5468. }
  5469. // SetGrantTokens sets the GrantTokens field's value.
  5470. func (s *CreateGrantInput) SetGrantTokens(v []*string) *CreateGrantInput {
  5471. s.GrantTokens = v
  5472. return s
  5473. }
  5474. // SetGranteePrincipal sets the GranteePrincipal field's value.
  5475. func (s *CreateGrantInput) SetGranteePrincipal(v string) *CreateGrantInput {
  5476. s.GranteePrincipal = &v
  5477. return s
  5478. }
  5479. // SetKeyId sets the KeyId field's value.
  5480. func (s *CreateGrantInput) SetKeyId(v string) *CreateGrantInput {
  5481. s.KeyId = &v
  5482. return s
  5483. }
  5484. // SetName sets the Name field's value.
  5485. func (s *CreateGrantInput) SetName(v string) *CreateGrantInput {
  5486. s.Name = &v
  5487. return s
  5488. }
  5489. // SetOperations sets the Operations field's value.
  5490. func (s *CreateGrantInput) SetOperations(v []*string) *CreateGrantInput {
  5491. s.Operations = v
  5492. return s
  5493. }
  5494. // SetRetiringPrincipal sets the RetiringPrincipal field's value.
  5495. func (s *CreateGrantInput) SetRetiringPrincipal(v string) *CreateGrantInput {
  5496. s.RetiringPrincipal = &v
  5497. return s
  5498. }
  5499. type CreateGrantOutput struct {
  5500. _ struct{} `type:"structure"`
  5501. // The unique identifier for the grant.
  5502. //
  5503. // You can use the GrantId in a subsequent RetireGrant or RevokeGrant operation.
  5504. GrantId *string `min:"1" type:"string"`
  5505. // The grant token.
  5506. //
  5507. // For more information, see Grant Tokens (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token)
  5508. // in the AWS Key Management Service Developer Guide.
  5509. GrantToken *string `min:"1" type:"string"`
  5510. }
  5511. // String returns the string representation
  5512. func (s CreateGrantOutput) String() string {
  5513. return awsutil.Prettify(s)
  5514. }
  5515. // GoString returns the string representation
  5516. func (s CreateGrantOutput) GoString() string {
  5517. return s.String()
  5518. }
  5519. // SetGrantId sets the GrantId field's value.
  5520. func (s *CreateGrantOutput) SetGrantId(v string) *CreateGrantOutput {
  5521. s.GrantId = &v
  5522. return s
  5523. }
  5524. // SetGrantToken sets the GrantToken field's value.
  5525. func (s *CreateGrantOutput) SetGrantToken(v string) *CreateGrantOutput {
  5526. s.GrantToken = &v
  5527. return s
  5528. }
  5529. type CreateKeyInput struct {
  5530. _ struct{} `type:"structure"`
  5531. // A flag to indicate whether to bypass the key policy lockout safety check.
  5532. //
  5533. // Setting this value to true increases the risk that the CMK becomes unmanageable.
  5534. // Do not set this value to true indiscriminately.
  5535. //
  5536. // For more information, refer to the scenario in the Default Key Policy (http://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam)
  5537. // section in the AWS Key Management Service Developer Guide.
  5538. //
  5539. // Use this parameter only when you include a policy in the request and you
  5540. // intend to prevent the principal that is making the request from making a
  5541. // subsequent PutKeyPolicy request on the CMK.
  5542. //
  5543. // The default value is false.
  5544. BypassPolicyLockoutSafetyCheck *bool `type:"boolean"`
  5545. // Creates the CMK in the specified custom key store (http://docs.aws.amazon.com/kms/latest/developerguide/key-store-overview.html)
  5546. // and the key material in its associated AWS CloudHSM cluster. To create a
  5547. // CMK in a custom key store, you must also specify the Origin parameter with
  5548. // a value of AWS_CLOUDHSM. The AWS CloudHSM cluster that is associated with
  5549. // the custom key store must have at least two active HSMs, each in a different
  5550. // Availability Zone in the Region.
  5551. //
  5552. // To find the ID of a custom key store, use the DescribeCustomKeyStores operation.
  5553. //
  5554. // The response includes the custom key store ID and the ID of the AWS CloudHSM
  5555. // cluster.
  5556. //
  5557. // This operation is part of the Custom Key Store feature (http://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html)
  5558. // feature in AWS KMS, which combines the convenience and extensive integration
  5559. // of AWS KMS with the isolation and control of a single-tenant key store.
  5560. CustomKeyStoreId *string `min:"1" type:"string"`
  5561. // A description of the CMK.
  5562. //
  5563. // Use a description that helps you decide whether the CMK is appropriate for
  5564. // a task.
  5565. Description *string `type:"string"`
  5566. // The intended use of the CMK.
  5567. //
  5568. // You can use CMKs only for symmetric encryption and decryption.
  5569. KeyUsage *string `type:"string" enum:"KeyUsageType"`
  5570. // The source of the CMK's key material. You cannot change the origin after
  5571. // you create the CMK.
  5572. //
  5573. // The default is AWS_KMS, which means AWS KMS creates the key material in its
  5574. // own key store.
  5575. //
  5576. // When the parameter value is EXTERNAL, AWS KMS creates a CMK without key material
  5577. // so that you can import key material from your existing key management infrastructure.
  5578. // For more information about importing key material into AWS KMS, see Importing
  5579. // Key Material (http://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html)
  5580. // in the AWS Key Management Service Developer Guide.
  5581. //
  5582. // When the parameter value is AWS_CLOUDHSM, AWS KMS creates the CMK in a AWS
  5583. // KMS custom key store (http://docs.aws.amazon.com/kms/latest/developerguide/key-store-overview.html)
  5584. // and creates its key material in the associated AWS CloudHSM cluster. You
  5585. // must also use the CustomKeyStoreId parameter to identify the custom key store.
  5586. Origin *string `type:"string" enum:"OriginType"`
  5587. // The key policy to attach to the CMK.
  5588. //
  5589. // If you provide a key policy, it must meet the following criteria:
  5590. //
  5591. // * If you don't set BypassPolicyLockoutSafetyCheck to true, the key policy
  5592. // must allow the principal that is making the CreateKey request to make
  5593. // a subsequent PutKeyPolicy request on the CMK. This reduces the risk that
  5594. // the CMK becomes unmanageable. For more information, refer to the scenario
  5595. // in the Default Key Policy (http://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam)
  5596. // section of the AWS Key Management Service Developer Guide.
  5597. //
  5598. // * Each statement in the key policy must contain one or more principals.
  5599. // The principals in the key policy must exist and be visible to AWS KMS.
  5600. // When you create a new AWS principal (for example, an IAM user or role),
  5601. // you might need to enforce a delay before including the new principal in
  5602. // a key policy because the new principal might not be immediately visible
  5603. // to AWS KMS. For more information, see Changes that I make are not always
  5604. // immediately visible (http://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency)
  5605. // in the AWS Identity and Access Management User Guide.
  5606. //
  5607. // If you do not provide a key policy, AWS KMS attaches a default key policy
  5608. // to the CMK. For more information, see Default Key Policy (http://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default)
  5609. // in the AWS Key Management Service Developer Guide.
  5610. //
  5611. // The key policy size limit is 32 kilobytes (32768 bytes).
  5612. Policy *string `min:"1" type:"string"`
  5613. // One or more tags. Each tag consists of a tag key and a tag value. Tag keys
  5614. // and tag values are both required, but tag values can be empty (null) strings.
  5615. //
  5616. // Use this parameter to tag the CMK when it is created. Alternately, you can
  5617. // omit this parameter and instead tag the CMK after it is created using TagResource.
  5618. Tags []*Tag `type:"list"`
  5619. }
  5620. // String returns the string representation
  5621. func (s CreateKeyInput) String() string {
  5622. return awsutil.Prettify(s)
  5623. }
  5624. // GoString returns the string representation
  5625. func (s CreateKeyInput) GoString() string {
  5626. return s.String()
  5627. }
  5628. // Validate inspects the fields of the type to determine if they are valid.
  5629. func (s *CreateKeyInput) Validate() error {
  5630. invalidParams := request.ErrInvalidParams{Context: "CreateKeyInput"}
  5631. if s.CustomKeyStoreId != nil && len(*s.CustomKeyStoreId) < 1 {
  5632. invalidParams.Add(request.NewErrParamMinLen("CustomKeyStoreId", 1))
  5633. }
  5634. if s.Policy != nil && len(*s.Policy) < 1 {
  5635. invalidParams.Add(request.NewErrParamMinLen("Policy", 1))
  5636. }
  5637. if s.Tags != nil {
  5638. for i, v := range s.Tags {
  5639. if v == nil {
  5640. continue
  5641. }
  5642. if err := v.Validate(); err != nil {
  5643. invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams))
  5644. }
  5645. }
  5646. }
  5647. if invalidParams.Len() > 0 {
  5648. return invalidParams
  5649. }
  5650. return nil
  5651. }
  5652. // SetBypassPolicyLockoutSafetyCheck sets the BypassPolicyLockoutSafetyCheck field's value.
  5653. func (s *CreateKeyInput) SetBypassPolicyLockoutSafetyCheck(v bool) *CreateKeyInput {
  5654. s.BypassPolicyLockoutSafetyCheck = &v
  5655. return s
  5656. }
  5657. // SetCustomKeyStoreId sets the CustomKeyStoreId field's value.
  5658. func (s *CreateKeyInput) SetCustomKeyStoreId(v string) *CreateKeyInput {
  5659. s.CustomKeyStoreId = &v
  5660. return s
  5661. }
  5662. // SetDescription sets the Description field's value.
  5663. func (s *CreateKeyInput) SetDescription(v string) *CreateKeyInput {
  5664. s.Description = &v
  5665. return s
  5666. }
  5667. // SetKeyUsage sets the KeyUsage field's value.
  5668. func (s *CreateKeyInput) SetKeyUsage(v string) *CreateKeyInput {
  5669. s.KeyUsage = &v
  5670. return s
  5671. }
  5672. // SetOrigin sets the Origin field's value.
  5673. func (s *CreateKeyInput) SetOrigin(v string) *CreateKeyInput {
  5674. s.Origin = &v
  5675. return s
  5676. }
  5677. // SetPolicy sets the Policy field's value.
  5678. func (s *CreateKeyInput) SetPolicy(v string) *CreateKeyInput {
  5679. s.Policy = &v
  5680. return s
  5681. }
  5682. // SetTags sets the Tags field's value.
  5683. func (s *CreateKeyInput) SetTags(v []*Tag) *CreateKeyInput {
  5684. s.Tags = v
  5685. return s
  5686. }
  5687. type CreateKeyOutput struct {
  5688. _ struct{} `type:"structure"`
  5689. // Metadata associated with the CMK.
  5690. KeyMetadata *KeyMetadata `type:"structure"`
  5691. }
  5692. // String returns the string representation
  5693. func (s CreateKeyOutput) String() string {
  5694. return awsutil.Prettify(s)
  5695. }
  5696. // GoString returns the string representation
  5697. func (s CreateKeyOutput) GoString() string {
  5698. return s.String()
  5699. }
  5700. // SetKeyMetadata sets the KeyMetadata field's value.
  5701. func (s *CreateKeyOutput) SetKeyMetadata(v *KeyMetadata) *CreateKeyOutput {
  5702. s.KeyMetadata = v
  5703. return s
  5704. }
  5705. // Contains information about each custom key store in the custom key store
  5706. // list.
  5707. type CustomKeyStoresListEntry struct {
  5708. _ struct{} `type:"structure"`
  5709. // A unique identifier for the AWS CloudHSM cluster that is associated with
  5710. // the custom key store.
  5711. CloudHsmClusterId *string `min:"19" type:"string"`
  5712. // Describes the connection error. Valid values are:
  5713. //
  5714. // * CLUSTER_NOT_FOUND - AWS KMS cannot find the AWS CloudHSM cluster with
  5715. // the specified cluster ID.
  5716. //
  5717. // * INSUFFICIENT_CLOUDHSM_HSMS - The associated AWS CloudHSM cluster does
  5718. // not contain any active HSMs. To connect a custom key store to its AWS
  5719. // CloudHSM cluster, the cluster must contain at least one active HSM.
  5720. //
  5721. // * INVALID_CREDENTIALS - AWS KMS does not have the correct password for
  5722. // the kmsuser crypto user in the AWS CloudHSM cluster.
  5723. //
  5724. // * NETWORK_ERRORS - Network errors are preventing AWS KMS from connecting
  5725. // to the custom key store.
  5726. //
  5727. // * USER_LOCKED_OUT - The kmsuser CU account is locked out of the associated
  5728. // AWS CloudHSM cluster due to too many failed password attempts. Before
  5729. // you can connect your custom key store to its AWS CloudHSM cluster, you
  5730. // must change the kmsuser account password and update the password value
  5731. // for the custom key store.
  5732. //
  5733. // For help with connection failures, see Troubleshooting Custom Key Stores
  5734. // (http://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html)
  5735. // in the AWS Key Management Service Developer Guide.
  5736. ConnectionErrorCode *string `type:"string" enum:"ConnectionErrorCodeType"`
  5737. // Indicates whether the custom key store is connected to its AWS CloudHSM cluster.
  5738. //
  5739. // You can create and use CMKs in your custom key stores only when its connection
  5740. // state is CONNECTED.
  5741. //
  5742. // The value is DISCONNECTED if the key store has never been connected or you
  5743. // use the DisconnectCustomKeyStore operation to disconnect it. If the value
  5744. // is CONNECTED but you are having trouble using the custom key store, make
  5745. // sure that its associated AWS CloudHSM cluster is active and contains at least
  5746. // one active HSM.
  5747. //
  5748. // A value of FAILED indicates that an attempt to connect was unsuccessful.
  5749. // For help resolving a connection failure, see Troubleshooting a Custom Key
  5750. // Store (http://docs.aws.amazon.com/kms/latest/developerguide/fix-keystore.html)
  5751. // in the AWS Key Management Service Developer Guide.
  5752. ConnectionState *string `type:"string" enum:"ConnectionStateType"`
  5753. // The date and time when the custom key store was created.
  5754. CreationDate *time.Time `type:"timestamp"`
  5755. // A unique identifier for the custom key store.
  5756. CustomKeyStoreId *string `min:"1" type:"string"`
  5757. // The user-specified friendly name for the custom key store.
  5758. CustomKeyStoreName *string `min:"1" type:"string"`
  5759. // The trust anchor certificate of the associated AWS CloudHSM cluster. When
  5760. // you initialize the cluster (http://docs.aws.amazon.com/cloudhsm/latest/userguide/initialize-cluster.html#sign-csr),
  5761. // you create this certificate and save it in the customerCA.crt file.
  5762. TrustAnchorCertificate *string `min:"1" type:"string"`
  5763. }
  5764. // String returns the string representation
  5765. func (s CustomKeyStoresListEntry) String() string {
  5766. return awsutil.Prettify(s)
  5767. }
  5768. // GoString returns the string representation
  5769. func (s CustomKeyStoresListEntry) GoString() string {
  5770. return s.String()
  5771. }
  5772. // SetCloudHsmClusterId sets the CloudHsmClusterId field's value.
  5773. func (s *CustomKeyStoresListEntry) SetCloudHsmClusterId(v string) *CustomKeyStoresListEntry {
  5774. s.CloudHsmClusterId = &v
  5775. return s
  5776. }
  5777. // SetConnectionErrorCode sets the ConnectionErrorCode field's value.
  5778. func (s *CustomKeyStoresListEntry) SetConnectionErrorCode(v string) *CustomKeyStoresListEntry {
  5779. s.ConnectionErrorCode = &v
  5780. return s
  5781. }
  5782. // SetConnectionState sets the ConnectionState field's value.
  5783. func (s *CustomKeyStoresListEntry) SetConnectionState(v string) *CustomKeyStoresListEntry {
  5784. s.ConnectionState = &v
  5785. return s
  5786. }
  5787. // SetCreationDate sets the CreationDate field's value.
  5788. func (s *CustomKeyStoresListEntry) SetCreationDate(v time.Time) *CustomKeyStoresListEntry {
  5789. s.CreationDate = &v
  5790. return s
  5791. }
  5792. // SetCustomKeyStoreId sets the CustomKeyStoreId field's value.
  5793. func (s *CustomKeyStoresListEntry) SetCustomKeyStoreId(v string) *CustomKeyStoresListEntry {
  5794. s.CustomKeyStoreId = &v
  5795. return s
  5796. }
  5797. // SetCustomKeyStoreName sets the CustomKeyStoreName field's value.
  5798. func (s *CustomKeyStoresListEntry) SetCustomKeyStoreName(v string) *CustomKeyStoresListEntry {
  5799. s.CustomKeyStoreName = &v
  5800. return s
  5801. }
  5802. // SetTrustAnchorCertificate sets the TrustAnchorCertificate field's value.
  5803. func (s *CustomKeyStoresListEntry) SetTrustAnchorCertificate(v string) *CustomKeyStoresListEntry {
  5804. s.TrustAnchorCertificate = &v
  5805. return s
  5806. }
  5807. type DecryptInput struct {
  5808. _ struct{} `type:"structure"`
  5809. // Ciphertext to be decrypted. The blob includes metadata.
  5810. //
  5811. // CiphertextBlob is automatically base64 encoded/decoded by the SDK.
  5812. //
  5813. // CiphertextBlob is a required field
  5814. CiphertextBlob []byte `min:"1" type:"blob" required:"true"`
  5815. // The encryption context. If this was specified in the Encrypt function, it
  5816. // must be specified here or the decryption operation will fail. For more information,
  5817. // see Encryption Context (http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html).
  5818. EncryptionContext map[string]*string `type:"map"`
  5819. // A list of grant tokens.
  5820. //
  5821. // For more information, see Grant Tokens (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token)
  5822. // in the AWS Key Management Service Developer Guide.
  5823. GrantTokens []*string `type:"list"`
  5824. }
  5825. // String returns the string representation
  5826. func (s DecryptInput) String() string {
  5827. return awsutil.Prettify(s)
  5828. }
  5829. // GoString returns the string representation
  5830. func (s DecryptInput) GoString() string {
  5831. return s.String()
  5832. }
  5833. // Validate inspects the fields of the type to determine if they are valid.
  5834. func (s *DecryptInput) Validate() error {
  5835. invalidParams := request.ErrInvalidParams{Context: "DecryptInput"}
  5836. if s.CiphertextBlob == nil {
  5837. invalidParams.Add(request.NewErrParamRequired("CiphertextBlob"))
  5838. }
  5839. if s.CiphertextBlob != nil && len(s.CiphertextBlob) < 1 {
  5840. invalidParams.Add(request.NewErrParamMinLen("CiphertextBlob", 1))
  5841. }
  5842. if invalidParams.Len() > 0 {
  5843. return invalidParams
  5844. }
  5845. return nil
  5846. }
  5847. // SetCiphertextBlob sets the CiphertextBlob field's value.
  5848. func (s *DecryptInput) SetCiphertextBlob(v []byte) *DecryptInput {
  5849. s.CiphertextBlob = v
  5850. return s
  5851. }
  5852. // SetEncryptionContext sets the EncryptionContext field's value.
  5853. func (s *DecryptInput) SetEncryptionContext(v map[string]*string) *DecryptInput {
  5854. s.EncryptionContext = v
  5855. return s
  5856. }
  5857. // SetGrantTokens sets the GrantTokens field's value.
  5858. func (s *DecryptInput) SetGrantTokens(v []*string) *DecryptInput {
  5859. s.GrantTokens = v
  5860. return s
  5861. }
  5862. type DecryptOutput struct {
  5863. _ struct{} `type:"structure"`
  5864. // ARN of the key used to perform the decryption. This value is returned if
  5865. // no errors are encountered during the operation.
  5866. KeyId *string `min:"1" type:"string"`
  5867. // Decrypted plaintext data. When you use the HTTP API or the AWS CLI, the value
  5868. // is Base64-encdoded. Otherwise, it is not encoded.
  5869. //
  5870. // Plaintext is automatically base64 encoded/decoded by the SDK.
  5871. Plaintext []byte `min:"1" type:"blob" sensitive:"true"`
  5872. }
  5873. // String returns the string representation
  5874. func (s DecryptOutput) String() string {
  5875. return awsutil.Prettify(s)
  5876. }
  5877. // GoString returns the string representation
  5878. func (s DecryptOutput) GoString() string {
  5879. return s.String()
  5880. }
  5881. // SetKeyId sets the KeyId field's value.
  5882. func (s *DecryptOutput) SetKeyId(v string) *DecryptOutput {
  5883. s.KeyId = &v
  5884. return s
  5885. }
  5886. // SetPlaintext sets the Plaintext field's value.
  5887. func (s *DecryptOutput) SetPlaintext(v []byte) *DecryptOutput {
  5888. s.Plaintext = v
  5889. return s
  5890. }
  5891. type DeleteAliasInput struct {
  5892. _ struct{} `type:"structure"`
  5893. // The alias to be deleted. The name must start with the word "alias" followed
  5894. // by a forward slash (alias/). Aliases that begin with "alias/aws" are reserved.
  5895. //
  5896. // AliasName is a required field
  5897. AliasName *string `min:"1" type:"string" required:"true"`
  5898. }
  5899. // String returns the string representation
  5900. func (s DeleteAliasInput) String() string {
  5901. return awsutil.Prettify(s)
  5902. }
  5903. // GoString returns the string representation
  5904. func (s DeleteAliasInput) GoString() string {
  5905. return s.String()
  5906. }
  5907. // Validate inspects the fields of the type to determine if they are valid.
  5908. func (s *DeleteAliasInput) Validate() error {
  5909. invalidParams := request.ErrInvalidParams{Context: "DeleteAliasInput"}
  5910. if s.AliasName == nil {
  5911. invalidParams.Add(request.NewErrParamRequired("AliasName"))
  5912. }
  5913. if s.AliasName != nil && len(*s.AliasName) < 1 {
  5914. invalidParams.Add(request.NewErrParamMinLen("AliasName", 1))
  5915. }
  5916. if invalidParams.Len() > 0 {
  5917. return invalidParams
  5918. }
  5919. return nil
  5920. }
  5921. // SetAliasName sets the AliasName field's value.
  5922. func (s *DeleteAliasInput) SetAliasName(v string) *DeleteAliasInput {
  5923. s.AliasName = &v
  5924. return s
  5925. }
  5926. type DeleteAliasOutput struct {
  5927. _ struct{} `type:"structure"`
  5928. }
  5929. // String returns the string representation
  5930. func (s DeleteAliasOutput) String() string {
  5931. return awsutil.Prettify(s)
  5932. }
  5933. // GoString returns the string representation
  5934. func (s DeleteAliasOutput) GoString() string {
  5935. return s.String()
  5936. }
  5937. type DeleteCustomKeyStoreInput struct {
  5938. _ struct{} `type:"structure"`
  5939. // Enter the ID of the custom key store you want to delete. To find the ID of
  5940. // a custom key store, use the DescribeCustomKeyStores operation.
  5941. //
  5942. // CustomKeyStoreId is a required field
  5943. CustomKeyStoreId *string `min:"1" type:"string" required:"true"`
  5944. }
  5945. // String returns the string representation
  5946. func (s DeleteCustomKeyStoreInput) String() string {
  5947. return awsutil.Prettify(s)
  5948. }
  5949. // GoString returns the string representation
  5950. func (s DeleteCustomKeyStoreInput) GoString() string {
  5951. return s.String()
  5952. }
  5953. // Validate inspects the fields of the type to determine if they are valid.
  5954. func (s *DeleteCustomKeyStoreInput) Validate() error {
  5955. invalidParams := request.ErrInvalidParams{Context: "DeleteCustomKeyStoreInput"}
  5956. if s.CustomKeyStoreId == nil {
  5957. invalidParams.Add(request.NewErrParamRequired("CustomKeyStoreId"))
  5958. }
  5959. if s.CustomKeyStoreId != nil && len(*s.CustomKeyStoreId) < 1 {
  5960. invalidParams.Add(request.NewErrParamMinLen("CustomKeyStoreId", 1))
  5961. }
  5962. if invalidParams.Len() > 0 {
  5963. return invalidParams
  5964. }
  5965. return nil
  5966. }
  5967. // SetCustomKeyStoreId sets the CustomKeyStoreId field's value.
  5968. func (s *DeleteCustomKeyStoreInput) SetCustomKeyStoreId(v string) *DeleteCustomKeyStoreInput {
  5969. s.CustomKeyStoreId = &v
  5970. return s
  5971. }
  5972. type DeleteCustomKeyStoreOutput struct {
  5973. _ struct{} `type:"structure"`
  5974. }
  5975. // String returns the string representation
  5976. func (s DeleteCustomKeyStoreOutput) String() string {
  5977. return awsutil.Prettify(s)
  5978. }
  5979. // GoString returns the string representation
  5980. func (s DeleteCustomKeyStoreOutput) GoString() string {
  5981. return s.String()
  5982. }
  5983. type DeleteImportedKeyMaterialInput struct {
  5984. _ struct{} `type:"structure"`
  5985. // The identifier of the CMK whose key material to delete. The CMK's Origin
  5986. // must be EXTERNAL.
  5987. //
  5988. // Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
  5989. //
  5990. // For example:
  5991. //
  5992. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  5993. //
  5994. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  5995. //
  5996. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
  5997. //
  5998. // KeyId is a required field
  5999. KeyId *string `min:"1" type:"string" required:"true"`
  6000. }
  6001. // String returns the string representation
  6002. func (s DeleteImportedKeyMaterialInput) String() string {
  6003. return awsutil.Prettify(s)
  6004. }
  6005. // GoString returns the string representation
  6006. func (s DeleteImportedKeyMaterialInput) GoString() string {
  6007. return s.String()
  6008. }
  6009. // Validate inspects the fields of the type to determine if they are valid.
  6010. func (s *DeleteImportedKeyMaterialInput) Validate() error {
  6011. invalidParams := request.ErrInvalidParams{Context: "DeleteImportedKeyMaterialInput"}
  6012. if s.KeyId == nil {
  6013. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  6014. }
  6015. if s.KeyId != nil && len(*s.KeyId) < 1 {
  6016. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  6017. }
  6018. if invalidParams.Len() > 0 {
  6019. return invalidParams
  6020. }
  6021. return nil
  6022. }
  6023. // SetKeyId sets the KeyId field's value.
  6024. func (s *DeleteImportedKeyMaterialInput) SetKeyId(v string) *DeleteImportedKeyMaterialInput {
  6025. s.KeyId = &v
  6026. return s
  6027. }
  6028. type DeleteImportedKeyMaterialOutput struct {
  6029. _ struct{} `type:"structure"`
  6030. }
  6031. // String returns the string representation
  6032. func (s DeleteImportedKeyMaterialOutput) String() string {
  6033. return awsutil.Prettify(s)
  6034. }
  6035. // GoString returns the string representation
  6036. func (s DeleteImportedKeyMaterialOutput) GoString() string {
  6037. return s.String()
  6038. }
  6039. type DescribeCustomKeyStoresInput struct {
  6040. _ struct{} `type:"structure"`
  6041. // Gets only information about the specified custom key store. Enter the key
  6042. // store ID.
  6043. //
  6044. // By default, this operation gets information about all custom key stores in
  6045. // the account and region. To limit the output to a particular custom key store,
  6046. // you can use either the CustomKeyStoreId or CustomKeyStoreName parameter,
  6047. // but not both.
  6048. CustomKeyStoreId *string `min:"1" type:"string"`
  6049. // Gets only information about the specified custom key store. Enter the friendly
  6050. // name of the custom key store.
  6051. //
  6052. // By default, this operation gets information about all custom key stores in
  6053. // the account and region. To limit the output to a particular custom key store,
  6054. // you can use either the CustomKeyStoreId or CustomKeyStoreName parameter,
  6055. // but not both.
  6056. CustomKeyStoreName *string `min:"1" type:"string"`
  6057. // Use this parameter to specify the maximum number of items to return. When
  6058. // this value is present, AWS KMS does not return more than the specified number
  6059. // of items, but it might return fewer.
  6060. Limit *int64 `min:"1" type:"integer"`
  6061. // Use this parameter in a subsequent request after you receive a response with
  6062. // truncated results. Set it to the value of NextMarker from the truncated response
  6063. // you just received.
  6064. Marker *string `min:"1" type:"string"`
  6065. }
  6066. // String returns the string representation
  6067. func (s DescribeCustomKeyStoresInput) String() string {
  6068. return awsutil.Prettify(s)
  6069. }
  6070. // GoString returns the string representation
  6071. func (s DescribeCustomKeyStoresInput) GoString() string {
  6072. return s.String()
  6073. }
  6074. // Validate inspects the fields of the type to determine if they are valid.
  6075. func (s *DescribeCustomKeyStoresInput) Validate() error {
  6076. invalidParams := request.ErrInvalidParams{Context: "DescribeCustomKeyStoresInput"}
  6077. if s.CustomKeyStoreId != nil && len(*s.CustomKeyStoreId) < 1 {
  6078. invalidParams.Add(request.NewErrParamMinLen("CustomKeyStoreId", 1))
  6079. }
  6080. if s.CustomKeyStoreName != nil && len(*s.CustomKeyStoreName) < 1 {
  6081. invalidParams.Add(request.NewErrParamMinLen("CustomKeyStoreName", 1))
  6082. }
  6083. if s.Limit != nil && *s.Limit < 1 {
  6084. invalidParams.Add(request.NewErrParamMinValue("Limit", 1))
  6085. }
  6086. if s.Marker != nil && len(*s.Marker) < 1 {
  6087. invalidParams.Add(request.NewErrParamMinLen("Marker", 1))
  6088. }
  6089. if invalidParams.Len() > 0 {
  6090. return invalidParams
  6091. }
  6092. return nil
  6093. }
  6094. // SetCustomKeyStoreId sets the CustomKeyStoreId field's value.
  6095. func (s *DescribeCustomKeyStoresInput) SetCustomKeyStoreId(v string) *DescribeCustomKeyStoresInput {
  6096. s.CustomKeyStoreId = &v
  6097. return s
  6098. }
  6099. // SetCustomKeyStoreName sets the CustomKeyStoreName field's value.
  6100. func (s *DescribeCustomKeyStoresInput) SetCustomKeyStoreName(v string) *DescribeCustomKeyStoresInput {
  6101. s.CustomKeyStoreName = &v
  6102. return s
  6103. }
  6104. // SetLimit sets the Limit field's value.
  6105. func (s *DescribeCustomKeyStoresInput) SetLimit(v int64) *DescribeCustomKeyStoresInput {
  6106. s.Limit = &v
  6107. return s
  6108. }
  6109. // SetMarker sets the Marker field's value.
  6110. func (s *DescribeCustomKeyStoresInput) SetMarker(v string) *DescribeCustomKeyStoresInput {
  6111. s.Marker = &v
  6112. return s
  6113. }
  6114. type DescribeCustomKeyStoresOutput struct {
  6115. _ struct{} `type:"structure"`
  6116. // Contains metadata about each custom key store.
  6117. CustomKeyStores []*CustomKeyStoresListEntry `type:"list"`
  6118. // When Truncated is true, this element is present and contains the value to
  6119. // use for the Marker parameter in a subsequent request.
  6120. NextMarker *string `min:"1" type:"string"`
  6121. // A flag that indicates whether there are more items in the list. When this
  6122. // value is true, the list in this response is truncated. To get more items,
  6123. // pass the value of the NextMarker element in this response to the Marker parameter
  6124. // in a subsequent request.
  6125. Truncated *bool `type:"boolean"`
  6126. }
  6127. // String returns the string representation
  6128. func (s DescribeCustomKeyStoresOutput) String() string {
  6129. return awsutil.Prettify(s)
  6130. }
  6131. // GoString returns the string representation
  6132. func (s DescribeCustomKeyStoresOutput) GoString() string {
  6133. return s.String()
  6134. }
  6135. // SetCustomKeyStores sets the CustomKeyStores field's value.
  6136. func (s *DescribeCustomKeyStoresOutput) SetCustomKeyStores(v []*CustomKeyStoresListEntry) *DescribeCustomKeyStoresOutput {
  6137. s.CustomKeyStores = v
  6138. return s
  6139. }
  6140. // SetNextMarker sets the NextMarker field's value.
  6141. func (s *DescribeCustomKeyStoresOutput) SetNextMarker(v string) *DescribeCustomKeyStoresOutput {
  6142. s.NextMarker = &v
  6143. return s
  6144. }
  6145. // SetTruncated sets the Truncated field's value.
  6146. func (s *DescribeCustomKeyStoresOutput) SetTruncated(v bool) *DescribeCustomKeyStoresOutput {
  6147. s.Truncated = &v
  6148. return s
  6149. }
  6150. type DescribeKeyInput struct {
  6151. _ struct{} `type:"structure"`
  6152. // A list of grant tokens.
  6153. //
  6154. // For more information, see Grant Tokens (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token)
  6155. // in the AWS Key Management Service Developer Guide.
  6156. GrantTokens []*string `type:"list"`
  6157. // Describes the specified customer master key (CMK).
  6158. //
  6159. // If you specify a predefined AWS alias (an AWS alias with no key ID), KMS
  6160. // associates the alias with an AWS managed CMK (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#master_keys)
  6161. // and returns its KeyId and Arn in the response.
  6162. //
  6163. // To specify a CMK, use its key ID, Amazon Resource Name (ARN), alias name,
  6164. // or alias ARN. When using an alias name, prefix it with "alias/". To specify
  6165. // a CMK in a different AWS account, you must use the key ARN or alias ARN.
  6166. //
  6167. // For example:
  6168. //
  6169. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  6170. //
  6171. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  6172. //
  6173. // * Alias name: alias/ExampleAlias
  6174. //
  6175. // * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias
  6176. //
  6177. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey. To
  6178. // get the alias name and alias ARN, use ListAliases.
  6179. //
  6180. // KeyId is a required field
  6181. KeyId *string `min:"1" type:"string" required:"true"`
  6182. }
  6183. // String returns the string representation
  6184. func (s DescribeKeyInput) String() string {
  6185. return awsutil.Prettify(s)
  6186. }
  6187. // GoString returns the string representation
  6188. func (s DescribeKeyInput) GoString() string {
  6189. return s.String()
  6190. }
  6191. // Validate inspects the fields of the type to determine if they are valid.
  6192. func (s *DescribeKeyInput) Validate() error {
  6193. invalidParams := request.ErrInvalidParams{Context: "DescribeKeyInput"}
  6194. if s.KeyId == nil {
  6195. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  6196. }
  6197. if s.KeyId != nil && len(*s.KeyId) < 1 {
  6198. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  6199. }
  6200. if invalidParams.Len() > 0 {
  6201. return invalidParams
  6202. }
  6203. return nil
  6204. }
  6205. // SetGrantTokens sets the GrantTokens field's value.
  6206. func (s *DescribeKeyInput) SetGrantTokens(v []*string) *DescribeKeyInput {
  6207. s.GrantTokens = v
  6208. return s
  6209. }
  6210. // SetKeyId sets the KeyId field's value.
  6211. func (s *DescribeKeyInput) SetKeyId(v string) *DescribeKeyInput {
  6212. s.KeyId = &v
  6213. return s
  6214. }
  6215. type DescribeKeyOutput struct {
  6216. _ struct{} `type:"structure"`
  6217. // Metadata associated with the key.
  6218. KeyMetadata *KeyMetadata `type:"structure"`
  6219. }
  6220. // String returns the string representation
  6221. func (s DescribeKeyOutput) String() string {
  6222. return awsutil.Prettify(s)
  6223. }
  6224. // GoString returns the string representation
  6225. func (s DescribeKeyOutput) GoString() string {
  6226. return s.String()
  6227. }
  6228. // SetKeyMetadata sets the KeyMetadata field's value.
  6229. func (s *DescribeKeyOutput) SetKeyMetadata(v *KeyMetadata) *DescribeKeyOutput {
  6230. s.KeyMetadata = v
  6231. return s
  6232. }
  6233. type DisableKeyInput struct {
  6234. _ struct{} `type:"structure"`
  6235. // A unique identifier for the customer master key (CMK).
  6236. //
  6237. // Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
  6238. //
  6239. // For example:
  6240. //
  6241. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  6242. //
  6243. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  6244. //
  6245. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
  6246. //
  6247. // KeyId is a required field
  6248. KeyId *string `min:"1" type:"string" required:"true"`
  6249. }
  6250. // String returns the string representation
  6251. func (s DisableKeyInput) String() string {
  6252. return awsutil.Prettify(s)
  6253. }
  6254. // GoString returns the string representation
  6255. func (s DisableKeyInput) GoString() string {
  6256. return s.String()
  6257. }
  6258. // Validate inspects the fields of the type to determine if they are valid.
  6259. func (s *DisableKeyInput) Validate() error {
  6260. invalidParams := request.ErrInvalidParams{Context: "DisableKeyInput"}
  6261. if s.KeyId == nil {
  6262. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  6263. }
  6264. if s.KeyId != nil && len(*s.KeyId) < 1 {
  6265. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  6266. }
  6267. if invalidParams.Len() > 0 {
  6268. return invalidParams
  6269. }
  6270. return nil
  6271. }
  6272. // SetKeyId sets the KeyId field's value.
  6273. func (s *DisableKeyInput) SetKeyId(v string) *DisableKeyInput {
  6274. s.KeyId = &v
  6275. return s
  6276. }
  6277. type DisableKeyOutput struct {
  6278. _ struct{} `type:"structure"`
  6279. }
  6280. // String returns the string representation
  6281. func (s DisableKeyOutput) String() string {
  6282. return awsutil.Prettify(s)
  6283. }
  6284. // GoString returns the string representation
  6285. func (s DisableKeyOutput) GoString() string {
  6286. return s.String()
  6287. }
  6288. type DisableKeyRotationInput struct {
  6289. _ struct{} `type:"structure"`
  6290. // A unique identifier for the customer master key (CMK).
  6291. //
  6292. // Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
  6293. //
  6294. // For example:
  6295. //
  6296. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  6297. //
  6298. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  6299. //
  6300. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
  6301. //
  6302. // KeyId is a required field
  6303. KeyId *string `min:"1" type:"string" required:"true"`
  6304. }
  6305. // String returns the string representation
  6306. func (s DisableKeyRotationInput) String() string {
  6307. return awsutil.Prettify(s)
  6308. }
  6309. // GoString returns the string representation
  6310. func (s DisableKeyRotationInput) GoString() string {
  6311. return s.String()
  6312. }
  6313. // Validate inspects the fields of the type to determine if they are valid.
  6314. func (s *DisableKeyRotationInput) Validate() error {
  6315. invalidParams := request.ErrInvalidParams{Context: "DisableKeyRotationInput"}
  6316. if s.KeyId == nil {
  6317. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  6318. }
  6319. if s.KeyId != nil && len(*s.KeyId) < 1 {
  6320. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  6321. }
  6322. if invalidParams.Len() > 0 {
  6323. return invalidParams
  6324. }
  6325. return nil
  6326. }
  6327. // SetKeyId sets the KeyId field's value.
  6328. func (s *DisableKeyRotationInput) SetKeyId(v string) *DisableKeyRotationInput {
  6329. s.KeyId = &v
  6330. return s
  6331. }
  6332. type DisableKeyRotationOutput struct {
  6333. _ struct{} `type:"structure"`
  6334. }
  6335. // String returns the string representation
  6336. func (s DisableKeyRotationOutput) String() string {
  6337. return awsutil.Prettify(s)
  6338. }
  6339. // GoString returns the string representation
  6340. func (s DisableKeyRotationOutput) GoString() string {
  6341. return s.String()
  6342. }
  6343. type DisconnectCustomKeyStoreInput struct {
  6344. _ struct{} `type:"structure"`
  6345. // Enter the ID of the custom key store you want to disconnect. To find the
  6346. // ID of a custom key store, use the DescribeCustomKeyStores operation.
  6347. //
  6348. // CustomKeyStoreId is a required field
  6349. CustomKeyStoreId *string `min:"1" type:"string" required:"true"`
  6350. }
  6351. // String returns the string representation
  6352. func (s DisconnectCustomKeyStoreInput) String() string {
  6353. return awsutil.Prettify(s)
  6354. }
  6355. // GoString returns the string representation
  6356. func (s DisconnectCustomKeyStoreInput) GoString() string {
  6357. return s.String()
  6358. }
  6359. // Validate inspects the fields of the type to determine if they are valid.
  6360. func (s *DisconnectCustomKeyStoreInput) Validate() error {
  6361. invalidParams := request.ErrInvalidParams{Context: "DisconnectCustomKeyStoreInput"}
  6362. if s.CustomKeyStoreId == nil {
  6363. invalidParams.Add(request.NewErrParamRequired("CustomKeyStoreId"))
  6364. }
  6365. if s.CustomKeyStoreId != nil && len(*s.CustomKeyStoreId) < 1 {
  6366. invalidParams.Add(request.NewErrParamMinLen("CustomKeyStoreId", 1))
  6367. }
  6368. if invalidParams.Len() > 0 {
  6369. return invalidParams
  6370. }
  6371. return nil
  6372. }
  6373. // SetCustomKeyStoreId sets the CustomKeyStoreId field's value.
  6374. func (s *DisconnectCustomKeyStoreInput) SetCustomKeyStoreId(v string) *DisconnectCustomKeyStoreInput {
  6375. s.CustomKeyStoreId = &v
  6376. return s
  6377. }
  6378. type DisconnectCustomKeyStoreOutput struct {
  6379. _ struct{} `type:"structure"`
  6380. }
  6381. // String returns the string representation
  6382. func (s DisconnectCustomKeyStoreOutput) String() string {
  6383. return awsutil.Prettify(s)
  6384. }
  6385. // GoString returns the string representation
  6386. func (s DisconnectCustomKeyStoreOutput) GoString() string {
  6387. return s.String()
  6388. }
  6389. type EnableKeyInput struct {
  6390. _ struct{} `type:"structure"`
  6391. // A unique identifier for the customer master key (CMK).
  6392. //
  6393. // Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
  6394. //
  6395. // For example:
  6396. //
  6397. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  6398. //
  6399. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  6400. //
  6401. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
  6402. //
  6403. // KeyId is a required field
  6404. KeyId *string `min:"1" type:"string" required:"true"`
  6405. }
  6406. // String returns the string representation
  6407. func (s EnableKeyInput) String() string {
  6408. return awsutil.Prettify(s)
  6409. }
  6410. // GoString returns the string representation
  6411. func (s EnableKeyInput) GoString() string {
  6412. return s.String()
  6413. }
  6414. // Validate inspects the fields of the type to determine if they are valid.
  6415. func (s *EnableKeyInput) Validate() error {
  6416. invalidParams := request.ErrInvalidParams{Context: "EnableKeyInput"}
  6417. if s.KeyId == nil {
  6418. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  6419. }
  6420. if s.KeyId != nil && len(*s.KeyId) < 1 {
  6421. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  6422. }
  6423. if invalidParams.Len() > 0 {
  6424. return invalidParams
  6425. }
  6426. return nil
  6427. }
  6428. // SetKeyId sets the KeyId field's value.
  6429. func (s *EnableKeyInput) SetKeyId(v string) *EnableKeyInput {
  6430. s.KeyId = &v
  6431. return s
  6432. }
  6433. type EnableKeyOutput struct {
  6434. _ struct{} `type:"structure"`
  6435. }
  6436. // String returns the string representation
  6437. func (s EnableKeyOutput) String() string {
  6438. return awsutil.Prettify(s)
  6439. }
  6440. // GoString returns the string representation
  6441. func (s EnableKeyOutput) GoString() string {
  6442. return s.String()
  6443. }
  6444. type EnableKeyRotationInput struct {
  6445. _ struct{} `type:"structure"`
  6446. // A unique identifier for the customer master key (CMK).
  6447. //
  6448. // Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
  6449. //
  6450. // For example:
  6451. //
  6452. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  6453. //
  6454. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  6455. //
  6456. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
  6457. //
  6458. // KeyId is a required field
  6459. KeyId *string `min:"1" type:"string" required:"true"`
  6460. }
  6461. // String returns the string representation
  6462. func (s EnableKeyRotationInput) String() string {
  6463. return awsutil.Prettify(s)
  6464. }
  6465. // GoString returns the string representation
  6466. func (s EnableKeyRotationInput) GoString() string {
  6467. return s.String()
  6468. }
  6469. // Validate inspects the fields of the type to determine if they are valid.
  6470. func (s *EnableKeyRotationInput) Validate() error {
  6471. invalidParams := request.ErrInvalidParams{Context: "EnableKeyRotationInput"}
  6472. if s.KeyId == nil {
  6473. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  6474. }
  6475. if s.KeyId != nil && len(*s.KeyId) < 1 {
  6476. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  6477. }
  6478. if invalidParams.Len() > 0 {
  6479. return invalidParams
  6480. }
  6481. return nil
  6482. }
  6483. // SetKeyId sets the KeyId field's value.
  6484. func (s *EnableKeyRotationInput) SetKeyId(v string) *EnableKeyRotationInput {
  6485. s.KeyId = &v
  6486. return s
  6487. }
  6488. type EnableKeyRotationOutput struct {
  6489. _ struct{} `type:"structure"`
  6490. }
  6491. // String returns the string representation
  6492. func (s EnableKeyRotationOutput) String() string {
  6493. return awsutil.Prettify(s)
  6494. }
  6495. // GoString returns the string representation
  6496. func (s EnableKeyRotationOutput) GoString() string {
  6497. return s.String()
  6498. }
  6499. type EncryptInput struct {
  6500. _ struct{} `type:"structure"`
  6501. // Name-value pair that specifies the encryption context to be used for authenticated
  6502. // encryption. If used here, the same value must be supplied to the Decrypt
  6503. // API or decryption will fail. For more information, see Encryption Context
  6504. // (http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html).
  6505. EncryptionContext map[string]*string `type:"map"`
  6506. // A list of grant tokens.
  6507. //
  6508. // For more information, see Grant Tokens (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token)
  6509. // in the AWS Key Management Service Developer Guide.
  6510. GrantTokens []*string `type:"list"`
  6511. // A unique identifier for the customer master key (CMK).
  6512. //
  6513. // To specify a CMK, use its key ID, Amazon Resource Name (ARN), alias name,
  6514. // or alias ARN. When using an alias name, prefix it with "alias/". To specify
  6515. // a CMK in a different AWS account, you must use the key ARN or alias ARN.
  6516. //
  6517. // For example:
  6518. //
  6519. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  6520. //
  6521. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  6522. //
  6523. // * Alias name: alias/ExampleAlias
  6524. //
  6525. // * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias
  6526. //
  6527. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey. To
  6528. // get the alias name and alias ARN, use ListAliases.
  6529. //
  6530. // KeyId is a required field
  6531. KeyId *string `min:"1" type:"string" required:"true"`
  6532. // Data to be encrypted.
  6533. //
  6534. // Plaintext is automatically base64 encoded/decoded by the SDK.
  6535. //
  6536. // Plaintext is a required field
  6537. Plaintext []byte `min:"1" type:"blob" required:"true" sensitive:"true"`
  6538. }
  6539. // String returns the string representation
  6540. func (s EncryptInput) String() string {
  6541. return awsutil.Prettify(s)
  6542. }
  6543. // GoString returns the string representation
  6544. func (s EncryptInput) GoString() string {
  6545. return s.String()
  6546. }
  6547. // Validate inspects the fields of the type to determine if they are valid.
  6548. func (s *EncryptInput) Validate() error {
  6549. invalidParams := request.ErrInvalidParams{Context: "EncryptInput"}
  6550. if s.KeyId == nil {
  6551. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  6552. }
  6553. if s.KeyId != nil && len(*s.KeyId) < 1 {
  6554. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  6555. }
  6556. if s.Plaintext == nil {
  6557. invalidParams.Add(request.NewErrParamRequired("Plaintext"))
  6558. }
  6559. if s.Plaintext != nil && len(s.Plaintext) < 1 {
  6560. invalidParams.Add(request.NewErrParamMinLen("Plaintext", 1))
  6561. }
  6562. if invalidParams.Len() > 0 {
  6563. return invalidParams
  6564. }
  6565. return nil
  6566. }
  6567. // SetEncryptionContext sets the EncryptionContext field's value.
  6568. func (s *EncryptInput) SetEncryptionContext(v map[string]*string) *EncryptInput {
  6569. s.EncryptionContext = v
  6570. return s
  6571. }
  6572. // SetGrantTokens sets the GrantTokens field's value.
  6573. func (s *EncryptInput) SetGrantTokens(v []*string) *EncryptInput {
  6574. s.GrantTokens = v
  6575. return s
  6576. }
  6577. // SetKeyId sets the KeyId field's value.
  6578. func (s *EncryptInput) SetKeyId(v string) *EncryptInput {
  6579. s.KeyId = &v
  6580. return s
  6581. }
  6582. // SetPlaintext sets the Plaintext field's value.
  6583. func (s *EncryptInput) SetPlaintext(v []byte) *EncryptInput {
  6584. s.Plaintext = v
  6585. return s
  6586. }
  6587. type EncryptOutput struct {
  6588. _ struct{} `type:"structure"`
  6589. // The encrypted plaintext. When you use the HTTP API or the AWS CLI, the value
  6590. // is Base64-encdoded. Otherwise, it is not encoded.
  6591. //
  6592. // CiphertextBlob is automatically base64 encoded/decoded by the SDK.
  6593. CiphertextBlob []byte `min:"1" type:"blob"`
  6594. // The ID of the key used during encryption.
  6595. KeyId *string `min:"1" type:"string"`
  6596. }
  6597. // String returns the string representation
  6598. func (s EncryptOutput) String() string {
  6599. return awsutil.Prettify(s)
  6600. }
  6601. // GoString returns the string representation
  6602. func (s EncryptOutput) GoString() string {
  6603. return s.String()
  6604. }
  6605. // SetCiphertextBlob sets the CiphertextBlob field's value.
  6606. func (s *EncryptOutput) SetCiphertextBlob(v []byte) *EncryptOutput {
  6607. s.CiphertextBlob = v
  6608. return s
  6609. }
  6610. // SetKeyId sets the KeyId field's value.
  6611. func (s *EncryptOutput) SetKeyId(v string) *EncryptOutput {
  6612. s.KeyId = &v
  6613. return s
  6614. }
  6615. type GenerateDataKeyInput struct {
  6616. _ struct{} `type:"structure"`
  6617. // A set of key-value pairs that represents additional authenticated data.
  6618. //
  6619. // For more information, see Encryption Context (http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html)
  6620. // in the AWS Key Management Service Developer Guide.
  6621. EncryptionContext map[string]*string `type:"map"`
  6622. // A list of grant tokens.
  6623. //
  6624. // For more information, see Grant Tokens (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token)
  6625. // in the AWS Key Management Service Developer Guide.
  6626. GrantTokens []*string `type:"list"`
  6627. // The identifier of the CMK under which to generate and encrypt the data encryption
  6628. // key.
  6629. //
  6630. // To specify a CMK, use its key ID, Amazon Resource Name (ARN), alias name,
  6631. // or alias ARN. When using an alias name, prefix it with "alias/". To specify
  6632. // a CMK in a different AWS account, you must use the key ARN or alias ARN.
  6633. //
  6634. // For example:
  6635. //
  6636. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  6637. //
  6638. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  6639. //
  6640. // * Alias name: alias/ExampleAlias
  6641. //
  6642. // * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias
  6643. //
  6644. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey. To
  6645. // get the alias name and alias ARN, use ListAliases.
  6646. //
  6647. // KeyId is a required field
  6648. KeyId *string `min:"1" type:"string" required:"true"`
  6649. // The length of the data encryption key. Use AES_128 to generate a 128-bit
  6650. // symmetric key, or AES_256 to generate a 256-bit symmetric key.
  6651. KeySpec *string `type:"string" enum:"DataKeySpec"`
  6652. // The length of the data encryption key in bytes. For example, use the value
  6653. // 64 to generate a 512-bit data key (64 bytes is 512 bits). For common key
  6654. // lengths (128-bit and 256-bit symmetric keys), we recommend that you use the
  6655. // KeySpec field instead of this one.
  6656. NumberOfBytes *int64 `min:"1" type:"integer"`
  6657. }
  6658. // String returns the string representation
  6659. func (s GenerateDataKeyInput) String() string {
  6660. return awsutil.Prettify(s)
  6661. }
  6662. // GoString returns the string representation
  6663. func (s GenerateDataKeyInput) GoString() string {
  6664. return s.String()
  6665. }
  6666. // Validate inspects the fields of the type to determine if they are valid.
  6667. func (s *GenerateDataKeyInput) Validate() error {
  6668. invalidParams := request.ErrInvalidParams{Context: "GenerateDataKeyInput"}
  6669. if s.KeyId == nil {
  6670. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  6671. }
  6672. if s.KeyId != nil && len(*s.KeyId) < 1 {
  6673. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  6674. }
  6675. if s.NumberOfBytes != nil && *s.NumberOfBytes < 1 {
  6676. invalidParams.Add(request.NewErrParamMinValue("NumberOfBytes", 1))
  6677. }
  6678. if invalidParams.Len() > 0 {
  6679. return invalidParams
  6680. }
  6681. return nil
  6682. }
  6683. // SetEncryptionContext sets the EncryptionContext field's value.
  6684. func (s *GenerateDataKeyInput) SetEncryptionContext(v map[string]*string) *GenerateDataKeyInput {
  6685. s.EncryptionContext = v
  6686. return s
  6687. }
  6688. // SetGrantTokens sets the GrantTokens field's value.
  6689. func (s *GenerateDataKeyInput) SetGrantTokens(v []*string) *GenerateDataKeyInput {
  6690. s.GrantTokens = v
  6691. return s
  6692. }
  6693. // SetKeyId sets the KeyId field's value.
  6694. func (s *GenerateDataKeyInput) SetKeyId(v string) *GenerateDataKeyInput {
  6695. s.KeyId = &v
  6696. return s
  6697. }
  6698. // SetKeySpec sets the KeySpec field's value.
  6699. func (s *GenerateDataKeyInput) SetKeySpec(v string) *GenerateDataKeyInput {
  6700. s.KeySpec = &v
  6701. return s
  6702. }
  6703. // SetNumberOfBytes sets the NumberOfBytes field's value.
  6704. func (s *GenerateDataKeyInput) SetNumberOfBytes(v int64) *GenerateDataKeyInput {
  6705. s.NumberOfBytes = &v
  6706. return s
  6707. }
  6708. type GenerateDataKeyOutput struct {
  6709. _ struct{} `type:"structure"`
  6710. // The encrypted data encryption key. When you use the HTTP API or the AWS CLI,
  6711. // the value is Base64-encdoded. Otherwise, it is not encoded.
  6712. //
  6713. // CiphertextBlob is automatically base64 encoded/decoded by the SDK.
  6714. CiphertextBlob []byte `min:"1" type:"blob"`
  6715. // The identifier of the CMK under which the data encryption key was generated
  6716. // and encrypted.
  6717. KeyId *string `min:"1" type:"string"`
  6718. // The data encryption key. When you use the HTTP API or the AWS CLI, the value
  6719. // is Base64-encdoded. Otherwise, it is not encoded. Use this data key for local
  6720. // encryption and decryption, then remove it from memory as soon as possible.
  6721. //
  6722. // Plaintext is automatically base64 encoded/decoded by the SDK.
  6723. Plaintext []byte `min:"1" type:"blob" sensitive:"true"`
  6724. }
  6725. // String returns the string representation
  6726. func (s GenerateDataKeyOutput) String() string {
  6727. return awsutil.Prettify(s)
  6728. }
  6729. // GoString returns the string representation
  6730. func (s GenerateDataKeyOutput) GoString() string {
  6731. return s.String()
  6732. }
  6733. // SetCiphertextBlob sets the CiphertextBlob field's value.
  6734. func (s *GenerateDataKeyOutput) SetCiphertextBlob(v []byte) *GenerateDataKeyOutput {
  6735. s.CiphertextBlob = v
  6736. return s
  6737. }
  6738. // SetKeyId sets the KeyId field's value.
  6739. func (s *GenerateDataKeyOutput) SetKeyId(v string) *GenerateDataKeyOutput {
  6740. s.KeyId = &v
  6741. return s
  6742. }
  6743. // SetPlaintext sets the Plaintext field's value.
  6744. func (s *GenerateDataKeyOutput) SetPlaintext(v []byte) *GenerateDataKeyOutput {
  6745. s.Plaintext = v
  6746. return s
  6747. }
  6748. type GenerateDataKeyWithoutPlaintextInput struct {
  6749. _ struct{} `type:"structure"`
  6750. // A set of key-value pairs that represents additional authenticated data.
  6751. //
  6752. // For more information, see Encryption Context (http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html)
  6753. // in the AWS Key Management Service Developer Guide.
  6754. EncryptionContext map[string]*string `type:"map"`
  6755. // A list of grant tokens.
  6756. //
  6757. // For more information, see Grant Tokens (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token)
  6758. // in the AWS Key Management Service Developer Guide.
  6759. GrantTokens []*string `type:"list"`
  6760. // The identifier of the customer master key (CMK) under which to generate and
  6761. // encrypt the data encryption key.
  6762. //
  6763. // To specify a CMK, use its key ID, Amazon Resource Name (ARN), alias name,
  6764. // or alias ARN. When using an alias name, prefix it with "alias/". To specify
  6765. // a CMK in a different AWS account, you must use the key ARN or alias ARN.
  6766. //
  6767. // For example:
  6768. //
  6769. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  6770. //
  6771. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  6772. //
  6773. // * Alias name: alias/ExampleAlias
  6774. //
  6775. // * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias
  6776. //
  6777. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey. To
  6778. // get the alias name and alias ARN, use ListAliases.
  6779. //
  6780. // KeyId is a required field
  6781. KeyId *string `min:"1" type:"string" required:"true"`
  6782. // The length of the data encryption key. Use AES_128 to generate a 128-bit
  6783. // symmetric key, or AES_256 to generate a 256-bit symmetric key.
  6784. KeySpec *string `type:"string" enum:"DataKeySpec"`
  6785. // The length of the data encryption key in bytes. For example, use the value
  6786. // 64 to generate a 512-bit data key (64 bytes is 512 bits). For common key
  6787. // lengths (128-bit and 256-bit symmetric keys), we recommend that you use the
  6788. // KeySpec field instead of this one.
  6789. NumberOfBytes *int64 `min:"1" type:"integer"`
  6790. }
  6791. // String returns the string representation
  6792. func (s GenerateDataKeyWithoutPlaintextInput) String() string {
  6793. return awsutil.Prettify(s)
  6794. }
  6795. // GoString returns the string representation
  6796. func (s GenerateDataKeyWithoutPlaintextInput) GoString() string {
  6797. return s.String()
  6798. }
  6799. // Validate inspects the fields of the type to determine if they are valid.
  6800. func (s *GenerateDataKeyWithoutPlaintextInput) Validate() error {
  6801. invalidParams := request.ErrInvalidParams{Context: "GenerateDataKeyWithoutPlaintextInput"}
  6802. if s.KeyId == nil {
  6803. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  6804. }
  6805. if s.KeyId != nil && len(*s.KeyId) < 1 {
  6806. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  6807. }
  6808. if s.NumberOfBytes != nil && *s.NumberOfBytes < 1 {
  6809. invalidParams.Add(request.NewErrParamMinValue("NumberOfBytes", 1))
  6810. }
  6811. if invalidParams.Len() > 0 {
  6812. return invalidParams
  6813. }
  6814. return nil
  6815. }
  6816. // SetEncryptionContext sets the EncryptionContext field's value.
  6817. func (s *GenerateDataKeyWithoutPlaintextInput) SetEncryptionContext(v map[string]*string) *GenerateDataKeyWithoutPlaintextInput {
  6818. s.EncryptionContext = v
  6819. return s
  6820. }
  6821. // SetGrantTokens sets the GrantTokens field's value.
  6822. func (s *GenerateDataKeyWithoutPlaintextInput) SetGrantTokens(v []*string) *GenerateDataKeyWithoutPlaintextInput {
  6823. s.GrantTokens = v
  6824. return s
  6825. }
  6826. // SetKeyId sets the KeyId field's value.
  6827. func (s *GenerateDataKeyWithoutPlaintextInput) SetKeyId(v string) *GenerateDataKeyWithoutPlaintextInput {
  6828. s.KeyId = &v
  6829. return s
  6830. }
  6831. // SetKeySpec sets the KeySpec field's value.
  6832. func (s *GenerateDataKeyWithoutPlaintextInput) SetKeySpec(v string) *GenerateDataKeyWithoutPlaintextInput {
  6833. s.KeySpec = &v
  6834. return s
  6835. }
  6836. // SetNumberOfBytes sets the NumberOfBytes field's value.
  6837. func (s *GenerateDataKeyWithoutPlaintextInput) SetNumberOfBytes(v int64) *GenerateDataKeyWithoutPlaintextInput {
  6838. s.NumberOfBytes = &v
  6839. return s
  6840. }
  6841. type GenerateDataKeyWithoutPlaintextOutput struct {
  6842. _ struct{} `type:"structure"`
  6843. // The encrypted data encryption key. When you use the HTTP API or the AWS CLI,
  6844. // the value is Base64-encdoded. Otherwise, it is not encoded.
  6845. //
  6846. // CiphertextBlob is automatically base64 encoded/decoded by the SDK.
  6847. CiphertextBlob []byte `min:"1" type:"blob"`
  6848. // The identifier of the CMK under which the data encryption key was generated
  6849. // and encrypted.
  6850. KeyId *string `min:"1" type:"string"`
  6851. }
  6852. // String returns the string representation
  6853. func (s GenerateDataKeyWithoutPlaintextOutput) String() string {
  6854. return awsutil.Prettify(s)
  6855. }
  6856. // GoString returns the string representation
  6857. func (s GenerateDataKeyWithoutPlaintextOutput) GoString() string {
  6858. return s.String()
  6859. }
  6860. // SetCiphertextBlob sets the CiphertextBlob field's value.
  6861. func (s *GenerateDataKeyWithoutPlaintextOutput) SetCiphertextBlob(v []byte) *GenerateDataKeyWithoutPlaintextOutput {
  6862. s.CiphertextBlob = v
  6863. return s
  6864. }
  6865. // SetKeyId sets the KeyId field's value.
  6866. func (s *GenerateDataKeyWithoutPlaintextOutput) SetKeyId(v string) *GenerateDataKeyWithoutPlaintextOutput {
  6867. s.KeyId = &v
  6868. return s
  6869. }
  6870. type GenerateRandomInput struct {
  6871. _ struct{} `type:"structure"`
  6872. // Generates the random byte string in the AWS CloudHSM cluster that is associated
  6873. // with the specified custom key store (http://docs.aws.amazon.com/kms/latest/developerguide/key-store-overview.html).
  6874. // To find the ID of a custom key store, use the DescribeCustomKeyStores operation.
  6875. CustomKeyStoreId *string `min:"1" type:"string"`
  6876. // The length of the byte string.
  6877. NumberOfBytes *int64 `min:"1" type:"integer"`
  6878. }
  6879. // String returns the string representation
  6880. func (s GenerateRandomInput) String() string {
  6881. return awsutil.Prettify(s)
  6882. }
  6883. // GoString returns the string representation
  6884. func (s GenerateRandomInput) GoString() string {
  6885. return s.String()
  6886. }
  6887. // Validate inspects the fields of the type to determine if they are valid.
  6888. func (s *GenerateRandomInput) Validate() error {
  6889. invalidParams := request.ErrInvalidParams{Context: "GenerateRandomInput"}
  6890. if s.CustomKeyStoreId != nil && len(*s.CustomKeyStoreId) < 1 {
  6891. invalidParams.Add(request.NewErrParamMinLen("CustomKeyStoreId", 1))
  6892. }
  6893. if s.NumberOfBytes != nil && *s.NumberOfBytes < 1 {
  6894. invalidParams.Add(request.NewErrParamMinValue("NumberOfBytes", 1))
  6895. }
  6896. if invalidParams.Len() > 0 {
  6897. return invalidParams
  6898. }
  6899. return nil
  6900. }
  6901. // SetCustomKeyStoreId sets the CustomKeyStoreId field's value.
  6902. func (s *GenerateRandomInput) SetCustomKeyStoreId(v string) *GenerateRandomInput {
  6903. s.CustomKeyStoreId = &v
  6904. return s
  6905. }
  6906. // SetNumberOfBytes sets the NumberOfBytes field's value.
  6907. func (s *GenerateRandomInput) SetNumberOfBytes(v int64) *GenerateRandomInput {
  6908. s.NumberOfBytes = &v
  6909. return s
  6910. }
  6911. type GenerateRandomOutput struct {
  6912. _ struct{} `type:"structure"`
  6913. // The random byte string. When you use the HTTP API or the AWS CLI, the value
  6914. // is Base64-encdoded. Otherwise, it is not encoded.
  6915. //
  6916. // Plaintext is automatically base64 encoded/decoded by the SDK.
  6917. Plaintext []byte `min:"1" type:"blob" sensitive:"true"`
  6918. }
  6919. // String returns the string representation
  6920. func (s GenerateRandomOutput) String() string {
  6921. return awsutil.Prettify(s)
  6922. }
  6923. // GoString returns the string representation
  6924. func (s GenerateRandomOutput) GoString() string {
  6925. return s.String()
  6926. }
  6927. // SetPlaintext sets the Plaintext field's value.
  6928. func (s *GenerateRandomOutput) SetPlaintext(v []byte) *GenerateRandomOutput {
  6929. s.Plaintext = v
  6930. return s
  6931. }
  6932. type GetKeyPolicyInput struct {
  6933. _ struct{} `type:"structure"`
  6934. // A unique identifier for the customer master key (CMK).
  6935. //
  6936. // Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
  6937. //
  6938. // For example:
  6939. //
  6940. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  6941. //
  6942. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  6943. //
  6944. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
  6945. //
  6946. // KeyId is a required field
  6947. KeyId *string `min:"1" type:"string" required:"true"`
  6948. // Specifies the name of the key policy. The only valid name is default. To
  6949. // get the names of key policies, use ListKeyPolicies.
  6950. //
  6951. // PolicyName is a required field
  6952. PolicyName *string `min:"1" type:"string" required:"true"`
  6953. }
  6954. // String returns the string representation
  6955. func (s GetKeyPolicyInput) String() string {
  6956. return awsutil.Prettify(s)
  6957. }
  6958. // GoString returns the string representation
  6959. func (s GetKeyPolicyInput) GoString() string {
  6960. return s.String()
  6961. }
  6962. // Validate inspects the fields of the type to determine if they are valid.
  6963. func (s *GetKeyPolicyInput) Validate() error {
  6964. invalidParams := request.ErrInvalidParams{Context: "GetKeyPolicyInput"}
  6965. if s.KeyId == nil {
  6966. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  6967. }
  6968. if s.KeyId != nil && len(*s.KeyId) < 1 {
  6969. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  6970. }
  6971. if s.PolicyName == nil {
  6972. invalidParams.Add(request.NewErrParamRequired("PolicyName"))
  6973. }
  6974. if s.PolicyName != nil && len(*s.PolicyName) < 1 {
  6975. invalidParams.Add(request.NewErrParamMinLen("PolicyName", 1))
  6976. }
  6977. if invalidParams.Len() > 0 {
  6978. return invalidParams
  6979. }
  6980. return nil
  6981. }
  6982. // SetKeyId sets the KeyId field's value.
  6983. func (s *GetKeyPolicyInput) SetKeyId(v string) *GetKeyPolicyInput {
  6984. s.KeyId = &v
  6985. return s
  6986. }
  6987. // SetPolicyName sets the PolicyName field's value.
  6988. func (s *GetKeyPolicyInput) SetPolicyName(v string) *GetKeyPolicyInput {
  6989. s.PolicyName = &v
  6990. return s
  6991. }
  6992. type GetKeyPolicyOutput struct {
  6993. _ struct{} `type:"structure"`
  6994. // A key policy document in JSON format.
  6995. Policy *string `min:"1" type:"string"`
  6996. }
  6997. // String returns the string representation
  6998. func (s GetKeyPolicyOutput) String() string {
  6999. return awsutil.Prettify(s)
  7000. }
  7001. // GoString returns the string representation
  7002. func (s GetKeyPolicyOutput) GoString() string {
  7003. return s.String()
  7004. }
  7005. // SetPolicy sets the Policy field's value.
  7006. func (s *GetKeyPolicyOutput) SetPolicy(v string) *GetKeyPolicyOutput {
  7007. s.Policy = &v
  7008. return s
  7009. }
  7010. type GetKeyRotationStatusInput struct {
  7011. _ struct{} `type:"structure"`
  7012. // A unique identifier for the customer master key (CMK).
  7013. //
  7014. // Specify the key ID or the Amazon Resource Name (ARN) of the CMK. To specify
  7015. // a CMK in a different AWS account, you must use the key ARN.
  7016. //
  7017. // For example:
  7018. //
  7019. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  7020. //
  7021. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  7022. //
  7023. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
  7024. //
  7025. // KeyId is a required field
  7026. KeyId *string `min:"1" type:"string" required:"true"`
  7027. }
  7028. // String returns the string representation
  7029. func (s GetKeyRotationStatusInput) String() string {
  7030. return awsutil.Prettify(s)
  7031. }
  7032. // GoString returns the string representation
  7033. func (s GetKeyRotationStatusInput) GoString() string {
  7034. return s.String()
  7035. }
  7036. // Validate inspects the fields of the type to determine if they are valid.
  7037. func (s *GetKeyRotationStatusInput) Validate() error {
  7038. invalidParams := request.ErrInvalidParams{Context: "GetKeyRotationStatusInput"}
  7039. if s.KeyId == nil {
  7040. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  7041. }
  7042. if s.KeyId != nil && len(*s.KeyId) < 1 {
  7043. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  7044. }
  7045. if invalidParams.Len() > 0 {
  7046. return invalidParams
  7047. }
  7048. return nil
  7049. }
  7050. // SetKeyId sets the KeyId field's value.
  7051. func (s *GetKeyRotationStatusInput) SetKeyId(v string) *GetKeyRotationStatusInput {
  7052. s.KeyId = &v
  7053. return s
  7054. }
  7055. type GetKeyRotationStatusOutput struct {
  7056. _ struct{} `type:"structure"`
  7057. // A Boolean value that specifies whether key rotation is enabled.
  7058. KeyRotationEnabled *bool `type:"boolean"`
  7059. }
  7060. // String returns the string representation
  7061. func (s GetKeyRotationStatusOutput) String() string {
  7062. return awsutil.Prettify(s)
  7063. }
  7064. // GoString returns the string representation
  7065. func (s GetKeyRotationStatusOutput) GoString() string {
  7066. return s.String()
  7067. }
  7068. // SetKeyRotationEnabled sets the KeyRotationEnabled field's value.
  7069. func (s *GetKeyRotationStatusOutput) SetKeyRotationEnabled(v bool) *GetKeyRotationStatusOutput {
  7070. s.KeyRotationEnabled = &v
  7071. return s
  7072. }
  7073. type GetParametersForImportInput struct {
  7074. _ struct{} `type:"structure"`
  7075. // The identifier of the CMK into which you will import key material. The CMK's
  7076. // Origin must be EXTERNAL.
  7077. //
  7078. // Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
  7079. //
  7080. // For example:
  7081. //
  7082. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  7083. //
  7084. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  7085. //
  7086. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
  7087. //
  7088. // KeyId is a required field
  7089. KeyId *string `min:"1" type:"string" required:"true"`
  7090. // The algorithm you will use to encrypt the key material before importing it
  7091. // with ImportKeyMaterial. For more information, see Encrypt the Key Material
  7092. // (http://docs.aws.amazon.com/kms/latest/developerguide/importing-keys-encrypt-key-material.html)
  7093. // in the AWS Key Management Service Developer Guide.
  7094. //
  7095. // WrappingAlgorithm is a required field
  7096. WrappingAlgorithm *string `type:"string" required:"true" enum:"AlgorithmSpec"`
  7097. // The type of wrapping key (public key) to return in the response. Only 2048-bit
  7098. // RSA public keys are supported.
  7099. //
  7100. // WrappingKeySpec is a required field
  7101. WrappingKeySpec *string `type:"string" required:"true" enum:"WrappingKeySpec"`
  7102. }
  7103. // String returns the string representation
  7104. func (s GetParametersForImportInput) String() string {
  7105. return awsutil.Prettify(s)
  7106. }
  7107. // GoString returns the string representation
  7108. func (s GetParametersForImportInput) GoString() string {
  7109. return s.String()
  7110. }
  7111. // Validate inspects the fields of the type to determine if they are valid.
  7112. func (s *GetParametersForImportInput) Validate() error {
  7113. invalidParams := request.ErrInvalidParams{Context: "GetParametersForImportInput"}
  7114. if s.KeyId == nil {
  7115. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  7116. }
  7117. if s.KeyId != nil && len(*s.KeyId) < 1 {
  7118. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  7119. }
  7120. if s.WrappingAlgorithm == nil {
  7121. invalidParams.Add(request.NewErrParamRequired("WrappingAlgorithm"))
  7122. }
  7123. if s.WrappingKeySpec == nil {
  7124. invalidParams.Add(request.NewErrParamRequired("WrappingKeySpec"))
  7125. }
  7126. if invalidParams.Len() > 0 {
  7127. return invalidParams
  7128. }
  7129. return nil
  7130. }
  7131. // SetKeyId sets the KeyId field's value.
  7132. func (s *GetParametersForImportInput) SetKeyId(v string) *GetParametersForImportInput {
  7133. s.KeyId = &v
  7134. return s
  7135. }
  7136. // SetWrappingAlgorithm sets the WrappingAlgorithm field's value.
  7137. func (s *GetParametersForImportInput) SetWrappingAlgorithm(v string) *GetParametersForImportInput {
  7138. s.WrappingAlgorithm = &v
  7139. return s
  7140. }
  7141. // SetWrappingKeySpec sets the WrappingKeySpec field's value.
  7142. func (s *GetParametersForImportInput) SetWrappingKeySpec(v string) *GetParametersForImportInput {
  7143. s.WrappingKeySpec = &v
  7144. return s
  7145. }
  7146. type GetParametersForImportOutput struct {
  7147. _ struct{} `type:"structure"`
  7148. // The import token to send in a subsequent ImportKeyMaterial request.
  7149. //
  7150. // ImportToken is automatically base64 encoded/decoded by the SDK.
  7151. ImportToken []byte `min:"1" type:"blob"`
  7152. // The identifier of the CMK to use in a subsequent ImportKeyMaterial request.
  7153. // This is the same CMK specified in the GetParametersForImport request.
  7154. KeyId *string `min:"1" type:"string"`
  7155. // The time at which the import token and public key are no longer valid. After
  7156. // this time, you cannot use them to make an ImportKeyMaterial request and you
  7157. // must send another GetParametersForImport request to get new ones.
  7158. ParametersValidTo *time.Time `type:"timestamp"`
  7159. // The public key to use to encrypt the key material before importing it with
  7160. // ImportKeyMaterial.
  7161. //
  7162. // PublicKey is automatically base64 encoded/decoded by the SDK.
  7163. PublicKey []byte `min:"1" type:"blob" sensitive:"true"`
  7164. }
  7165. // String returns the string representation
  7166. func (s GetParametersForImportOutput) String() string {
  7167. return awsutil.Prettify(s)
  7168. }
  7169. // GoString returns the string representation
  7170. func (s GetParametersForImportOutput) GoString() string {
  7171. return s.String()
  7172. }
  7173. // SetImportToken sets the ImportToken field's value.
  7174. func (s *GetParametersForImportOutput) SetImportToken(v []byte) *GetParametersForImportOutput {
  7175. s.ImportToken = v
  7176. return s
  7177. }
  7178. // SetKeyId sets the KeyId field's value.
  7179. func (s *GetParametersForImportOutput) SetKeyId(v string) *GetParametersForImportOutput {
  7180. s.KeyId = &v
  7181. return s
  7182. }
  7183. // SetParametersValidTo sets the ParametersValidTo field's value.
  7184. func (s *GetParametersForImportOutput) SetParametersValidTo(v time.Time) *GetParametersForImportOutput {
  7185. s.ParametersValidTo = &v
  7186. return s
  7187. }
  7188. // SetPublicKey sets the PublicKey field's value.
  7189. func (s *GetParametersForImportOutput) SetPublicKey(v []byte) *GetParametersForImportOutput {
  7190. s.PublicKey = v
  7191. return s
  7192. }
  7193. // A structure that you can use to allow certain operations in the grant only
  7194. // when the desired encryption context is present. For more information about
  7195. // encryption context, see Encryption Context (http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html)
  7196. // in the AWS Key Management Service Developer Guide.
  7197. //
  7198. // Grant constraints apply only to operations that accept encryption context
  7199. // as input. For example, the DescribeKey operation does not accept encryption
  7200. // context as input. A grant that allows the DescribeKey operation does so regardless
  7201. // of the grant constraints. In constrast, the Encrypt operation accepts encryption
  7202. // context as input. A grant that allows the Encrypt operation does so only
  7203. // when the encryption context of the Encrypt operation satisfies the grant
  7204. // constraints.
  7205. type GrantConstraints struct {
  7206. _ struct{} `type:"structure"`
  7207. // A list of key-value pairs that must be present in the encryption context
  7208. // of certain subsequent operations that the grant allows. When certain subsequent
  7209. // operations allowed by the grant include encryption context that matches this
  7210. // list, the grant allows the operation. Otherwise, the grant does not allow
  7211. // the operation.
  7212. EncryptionContextEquals map[string]*string `type:"map"`
  7213. // A list of key-value pairs, all of which must be present in the encryption
  7214. // context of certain subsequent operations that the grant allows. When certain
  7215. // subsequent operations allowed by the grant include encryption context that
  7216. // matches this list or is a superset of this list, the grant allows the operation.
  7217. // Otherwise, the grant does not allow the operation.
  7218. EncryptionContextSubset map[string]*string `type:"map"`
  7219. }
  7220. // String returns the string representation
  7221. func (s GrantConstraints) String() string {
  7222. return awsutil.Prettify(s)
  7223. }
  7224. // GoString returns the string representation
  7225. func (s GrantConstraints) GoString() string {
  7226. return s.String()
  7227. }
  7228. // SetEncryptionContextEquals sets the EncryptionContextEquals field's value.
  7229. func (s *GrantConstraints) SetEncryptionContextEquals(v map[string]*string) *GrantConstraints {
  7230. s.EncryptionContextEquals = v
  7231. return s
  7232. }
  7233. // SetEncryptionContextSubset sets the EncryptionContextSubset field's value.
  7234. func (s *GrantConstraints) SetEncryptionContextSubset(v map[string]*string) *GrantConstraints {
  7235. s.EncryptionContextSubset = v
  7236. return s
  7237. }
  7238. // Contains information about an entry in a list of grants.
  7239. type GrantListEntry struct {
  7240. _ struct{} `type:"structure"`
  7241. // A list of key-value pairs that must be present in the encryption context
  7242. // of certain subsequent operations that the grant allows.
  7243. Constraints *GrantConstraints `type:"structure"`
  7244. // The date and time when the grant was created.
  7245. CreationDate *time.Time `type:"timestamp"`
  7246. // The unique identifier for the grant.
  7247. GrantId *string `min:"1" type:"string"`
  7248. // The principal that receives the grant's permissions.
  7249. GranteePrincipal *string `min:"1" type:"string"`
  7250. // The AWS account under which the grant was issued.
  7251. IssuingAccount *string `min:"1" type:"string"`
  7252. // The unique identifier for the customer master key (CMK) to which the grant
  7253. // applies.
  7254. KeyId *string `min:"1" type:"string"`
  7255. // The friendly name that identifies the grant. If a name was provided in the
  7256. // CreateGrant request, that name is returned. Otherwise this value is null.
  7257. Name *string `min:"1" type:"string"`
  7258. // The list of operations permitted by the grant.
  7259. Operations []*string `type:"list"`
  7260. // The principal that can retire the grant.
  7261. RetiringPrincipal *string `min:"1" type:"string"`
  7262. }
  7263. // String returns the string representation
  7264. func (s GrantListEntry) String() string {
  7265. return awsutil.Prettify(s)
  7266. }
  7267. // GoString returns the string representation
  7268. func (s GrantListEntry) GoString() string {
  7269. return s.String()
  7270. }
  7271. // SetConstraints sets the Constraints field's value.
  7272. func (s *GrantListEntry) SetConstraints(v *GrantConstraints) *GrantListEntry {
  7273. s.Constraints = v
  7274. return s
  7275. }
  7276. // SetCreationDate sets the CreationDate field's value.
  7277. func (s *GrantListEntry) SetCreationDate(v time.Time) *GrantListEntry {
  7278. s.CreationDate = &v
  7279. return s
  7280. }
  7281. // SetGrantId sets the GrantId field's value.
  7282. func (s *GrantListEntry) SetGrantId(v string) *GrantListEntry {
  7283. s.GrantId = &v
  7284. return s
  7285. }
  7286. // SetGranteePrincipal sets the GranteePrincipal field's value.
  7287. func (s *GrantListEntry) SetGranteePrincipal(v string) *GrantListEntry {
  7288. s.GranteePrincipal = &v
  7289. return s
  7290. }
  7291. // SetIssuingAccount sets the IssuingAccount field's value.
  7292. func (s *GrantListEntry) SetIssuingAccount(v string) *GrantListEntry {
  7293. s.IssuingAccount = &v
  7294. return s
  7295. }
  7296. // SetKeyId sets the KeyId field's value.
  7297. func (s *GrantListEntry) SetKeyId(v string) *GrantListEntry {
  7298. s.KeyId = &v
  7299. return s
  7300. }
  7301. // SetName sets the Name field's value.
  7302. func (s *GrantListEntry) SetName(v string) *GrantListEntry {
  7303. s.Name = &v
  7304. return s
  7305. }
  7306. // SetOperations sets the Operations field's value.
  7307. func (s *GrantListEntry) SetOperations(v []*string) *GrantListEntry {
  7308. s.Operations = v
  7309. return s
  7310. }
  7311. // SetRetiringPrincipal sets the RetiringPrincipal field's value.
  7312. func (s *GrantListEntry) SetRetiringPrincipal(v string) *GrantListEntry {
  7313. s.RetiringPrincipal = &v
  7314. return s
  7315. }
  7316. type ImportKeyMaterialInput struct {
  7317. _ struct{} `type:"structure"`
  7318. // The encrypted key material to import. It must be encrypted with the public
  7319. // key that you received in the response to a previous GetParametersForImport
  7320. // request, using the wrapping algorithm that you specified in that request.
  7321. //
  7322. // EncryptedKeyMaterial is automatically base64 encoded/decoded by the SDK.
  7323. //
  7324. // EncryptedKeyMaterial is a required field
  7325. EncryptedKeyMaterial []byte `min:"1" type:"blob" required:"true"`
  7326. // Specifies whether the key material expires. The default is KEY_MATERIAL_EXPIRES,
  7327. // in which case you must include the ValidTo parameter. When this parameter
  7328. // is set to KEY_MATERIAL_DOES_NOT_EXPIRE, you must omit the ValidTo parameter.
  7329. ExpirationModel *string `type:"string" enum:"ExpirationModelType"`
  7330. // The import token that you received in the response to a previous GetParametersForImport
  7331. // request. It must be from the same response that contained the public key
  7332. // that you used to encrypt the key material.
  7333. //
  7334. // ImportToken is automatically base64 encoded/decoded by the SDK.
  7335. //
  7336. // ImportToken is a required field
  7337. ImportToken []byte `min:"1" type:"blob" required:"true"`
  7338. // The identifier of the CMK to import the key material into. The CMK's Origin
  7339. // must be EXTERNAL.
  7340. //
  7341. // Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
  7342. //
  7343. // For example:
  7344. //
  7345. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  7346. //
  7347. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  7348. //
  7349. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
  7350. //
  7351. // KeyId is a required field
  7352. KeyId *string `min:"1" type:"string" required:"true"`
  7353. // The time at which the imported key material expires. When the key material
  7354. // expires, AWS KMS deletes the key material and the CMK becomes unusable. You
  7355. // must omit this parameter when the ExpirationModel parameter is set to KEY_MATERIAL_DOES_NOT_EXPIRE.
  7356. // Otherwise it is required.
  7357. ValidTo *time.Time `type:"timestamp"`
  7358. }
  7359. // String returns the string representation
  7360. func (s ImportKeyMaterialInput) String() string {
  7361. return awsutil.Prettify(s)
  7362. }
  7363. // GoString returns the string representation
  7364. func (s ImportKeyMaterialInput) GoString() string {
  7365. return s.String()
  7366. }
  7367. // Validate inspects the fields of the type to determine if they are valid.
  7368. func (s *ImportKeyMaterialInput) Validate() error {
  7369. invalidParams := request.ErrInvalidParams{Context: "ImportKeyMaterialInput"}
  7370. if s.EncryptedKeyMaterial == nil {
  7371. invalidParams.Add(request.NewErrParamRequired("EncryptedKeyMaterial"))
  7372. }
  7373. if s.EncryptedKeyMaterial != nil && len(s.EncryptedKeyMaterial) < 1 {
  7374. invalidParams.Add(request.NewErrParamMinLen("EncryptedKeyMaterial", 1))
  7375. }
  7376. if s.ImportToken == nil {
  7377. invalidParams.Add(request.NewErrParamRequired("ImportToken"))
  7378. }
  7379. if s.ImportToken != nil && len(s.ImportToken) < 1 {
  7380. invalidParams.Add(request.NewErrParamMinLen("ImportToken", 1))
  7381. }
  7382. if s.KeyId == nil {
  7383. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  7384. }
  7385. if s.KeyId != nil && len(*s.KeyId) < 1 {
  7386. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  7387. }
  7388. if invalidParams.Len() > 0 {
  7389. return invalidParams
  7390. }
  7391. return nil
  7392. }
  7393. // SetEncryptedKeyMaterial sets the EncryptedKeyMaterial field's value.
  7394. func (s *ImportKeyMaterialInput) SetEncryptedKeyMaterial(v []byte) *ImportKeyMaterialInput {
  7395. s.EncryptedKeyMaterial = v
  7396. return s
  7397. }
  7398. // SetExpirationModel sets the ExpirationModel field's value.
  7399. func (s *ImportKeyMaterialInput) SetExpirationModel(v string) *ImportKeyMaterialInput {
  7400. s.ExpirationModel = &v
  7401. return s
  7402. }
  7403. // SetImportToken sets the ImportToken field's value.
  7404. func (s *ImportKeyMaterialInput) SetImportToken(v []byte) *ImportKeyMaterialInput {
  7405. s.ImportToken = v
  7406. return s
  7407. }
  7408. // SetKeyId sets the KeyId field's value.
  7409. func (s *ImportKeyMaterialInput) SetKeyId(v string) *ImportKeyMaterialInput {
  7410. s.KeyId = &v
  7411. return s
  7412. }
  7413. // SetValidTo sets the ValidTo field's value.
  7414. func (s *ImportKeyMaterialInput) SetValidTo(v time.Time) *ImportKeyMaterialInput {
  7415. s.ValidTo = &v
  7416. return s
  7417. }
  7418. type ImportKeyMaterialOutput struct {
  7419. _ struct{} `type:"structure"`
  7420. }
  7421. // String returns the string representation
  7422. func (s ImportKeyMaterialOutput) String() string {
  7423. return awsutil.Prettify(s)
  7424. }
  7425. // GoString returns the string representation
  7426. func (s ImportKeyMaterialOutput) GoString() string {
  7427. return s.String()
  7428. }
  7429. // Contains information about each entry in the key list.
  7430. type KeyListEntry struct {
  7431. _ struct{} `type:"structure"`
  7432. // ARN of the key.
  7433. KeyArn *string `min:"20" type:"string"`
  7434. // Unique identifier of the key.
  7435. KeyId *string `min:"1" type:"string"`
  7436. }
  7437. // String returns the string representation
  7438. func (s KeyListEntry) String() string {
  7439. return awsutil.Prettify(s)
  7440. }
  7441. // GoString returns the string representation
  7442. func (s KeyListEntry) GoString() string {
  7443. return s.String()
  7444. }
  7445. // SetKeyArn sets the KeyArn field's value.
  7446. func (s *KeyListEntry) SetKeyArn(v string) *KeyListEntry {
  7447. s.KeyArn = &v
  7448. return s
  7449. }
  7450. // SetKeyId sets the KeyId field's value.
  7451. func (s *KeyListEntry) SetKeyId(v string) *KeyListEntry {
  7452. s.KeyId = &v
  7453. return s
  7454. }
  7455. // Contains metadata about a customer master key (CMK).
  7456. //
  7457. // This data type is used as a response element for the CreateKey and DescribeKey
  7458. // operations.
  7459. type KeyMetadata struct {
  7460. _ struct{} `type:"structure"`
  7461. // The twelve-digit account ID of the AWS account that owns the CMK.
  7462. AWSAccountId *string `type:"string"`
  7463. // The Amazon Resource Name (ARN) of the CMK. For examples, see AWS Key Management
  7464. // Service (AWS KMS) (http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-kms)
  7465. // in the Example ARNs section of the AWS General Reference.
  7466. Arn *string `min:"20" type:"string"`
  7467. // The cluster ID of the AWS CloudHSM cluster that contains the key material
  7468. // for the CMK. When you create a CMK in a custom key store (http://docs.aws.amazon.com/kms/latest/developerguide/key-store-overview.html),
  7469. // AWS KMS creates the key material for the CMK in the associated AWS CloudHSM
  7470. // cluster. This value is present only when the CMK is created in a custom key
  7471. // store.
  7472. CloudHsmClusterId *string `min:"19" type:"string"`
  7473. // The date and time when the CMK was created.
  7474. CreationDate *time.Time `type:"timestamp"`
  7475. // A unique identifier for the custom key store (http://docs.aws.amazon.com/kms/latest/developerguide/key-store-overview.html)
  7476. // that contains the CMK. This value is present only when the CMK is created
  7477. // in a custom key store.
  7478. CustomKeyStoreId *string `min:"1" type:"string"`
  7479. // The date and time after which AWS KMS deletes the CMK. This value is present
  7480. // only when KeyState is PendingDeletion.
  7481. DeletionDate *time.Time `type:"timestamp"`
  7482. // The description of the CMK.
  7483. Description *string `type:"string"`
  7484. // Specifies whether the CMK is enabled. When KeyState is Enabled this value
  7485. // is true, otherwise it is false.
  7486. Enabled *bool `type:"boolean"`
  7487. // Specifies whether the CMK's key material expires. This value is present only
  7488. // when Origin is EXTERNAL, otherwise this value is omitted.
  7489. ExpirationModel *string `type:"string" enum:"ExpirationModelType"`
  7490. // The globally unique identifier for the CMK.
  7491. //
  7492. // KeyId is a required field
  7493. KeyId *string `min:"1" type:"string" required:"true"`
  7494. // The CMK's manager. CMKs are either customer-managed or AWS-managed. For more
  7495. // information about the difference, see Customer Master Keys (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#master_keys)
  7496. // in the AWS Key Management Service Developer Guide.
  7497. KeyManager *string `type:"string" enum:"KeyManagerType"`
  7498. // The state of the CMK.
  7499. //
  7500. // For more information about how key state affects the use of a CMK, see How
  7501. // Key State Affects the Use of a Customer Master Key (http://docs.aws.amazon.com/kms/latest/developerguide/key-state.html)
  7502. // in the AWS Key Management Service Developer Guide.
  7503. KeyState *string `type:"string" enum:"KeyState"`
  7504. // The cryptographic operations for which you can use the CMK. Currently the
  7505. // only allowed value is ENCRYPT_DECRYPT, which means you can use the CMK for
  7506. // the Encrypt and Decrypt operations.
  7507. KeyUsage *string `type:"string" enum:"KeyUsageType"`
  7508. // The source of the CMK's key material. When this value is AWS_KMS, AWS KMS
  7509. // created the key material. When this value is EXTERNAL, the key material was
  7510. // imported from your existing key management infrastructure or the CMK lacks
  7511. // key material. When this value is AWS_CLOUDHSM, the key material was created
  7512. // in the AWS CloudHSM cluster associated with a custom key store.
  7513. Origin *string `type:"string" enum:"OriginType"`
  7514. // The time at which the imported key material expires. When the key material
  7515. // expires, AWS KMS deletes the key material and the CMK becomes unusable. This
  7516. // value is present only for CMKs whose Origin is EXTERNAL and whose ExpirationModel
  7517. // is KEY_MATERIAL_EXPIRES, otherwise this value is omitted.
  7518. ValidTo *time.Time `type:"timestamp"`
  7519. }
  7520. // String returns the string representation
  7521. func (s KeyMetadata) String() string {
  7522. return awsutil.Prettify(s)
  7523. }
  7524. // GoString returns the string representation
  7525. func (s KeyMetadata) GoString() string {
  7526. return s.String()
  7527. }
  7528. // SetAWSAccountId sets the AWSAccountId field's value.
  7529. func (s *KeyMetadata) SetAWSAccountId(v string) *KeyMetadata {
  7530. s.AWSAccountId = &v
  7531. return s
  7532. }
  7533. // SetArn sets the Arn field's value.
  7534. func (s *KeyMetadata) SetArn(v string) *KeyMetadata {
  7535. s.Arn = &v
  7536. return s
  7537. }
  7538. // SetCloudHsmClusterId sets the CloudHsmClusterId field's value.
  7539. func (s *KeyMetadata) SetCloudHsmClusterId(v string) *KeyMetadata {
  7540. s.CloudHsmClusterId = &v
  7541. return s
  7542. }
  7543. // SetCreationDate sets the CreationDate field's value.
  7544. func (s *KeyMetadata) SetCreationDate(v time.Time) *KeyMetadata {
  7545. s.CreationDate = &v
  7546. return s
  7547. }
  7548. // SetCustomKeyStoreId sets the CustomKeyStoreId field's value.
  7549. func (s *KeyMetadata) SetCustomKeyStoreId(v string) *KeyMetadata {
  7550. s.CustomKeyStoreId = &v
  7551. return s
  7552. }
  7553. // SetDeletionDate sets the DeletionDate field's value.
  7554. func (s *KeyMetadata) SetDeletionDate(v time.Time) *KeyMetadata {
  7555. s.DeletionDate = &v
  7556. return s
  7557. }
  7558. // SetDescription sets the Description field's value.
  7559. func (s *KeyMetadata) SetDescription(v string) *KeyMetadata {
  7560. s.Description = &v
  7561. return s
  7562. }
  7563. // SetEnabled sets the Enabled field's value.
  7564. func (s *KeyMetadata) SetEnabled(v bool) *KeyMetadata {
  7565. s.Enabled = &v
  7566. return s
  7567. }
  7568. // SetExpirationModel sets the ExpirationModel field's value.
  7569. func (s *KeyMetadata) SetExpirationModel(v string) *KeyMetadata {
  7570. s.ExpirationModel = &v
  7571. return s
  7572. }
  7573. // SetKeyId sets the KeyId field's value.
  7574. func (s *KeyMetadata) SetKeyId(v string) *KeyMetadata {
  7575. s.KeyId = &v
  7576. return s
  7577. }
  7578. // SetKeyManager sets the KeyManager field's value.
  7579. func (s *KeyMetadata) SetKeyManager(v string) *KeyMetadata {
  7580. s.KeyManager = &v
  7581. return s
  7582. }
  7583. // SetKeyState sets the KeyState field's value.
  7584. func (s *KeyMetadata) SetKeyState(v string) *KeyMetadata {
  7585. s.KeyState = &v
  7586. return s
  7587. }
  7588. // SetKeyUsage sets the KeyUsage field's value.
  7589. func (s *KeyMetadata) SetKeyUsage(v string) *KeyMetadata {
  7590. s.KeyUsage = &v
  7591. return s
  7592. }
  7593. // SetOrigin sets the Origin field's value.
  7594. func (s *KeyMetadata) SetOrigin(v string) *KeyMetadata {
  7595. s.Origin = &v
  7596. return s
  7597. }
  7598. // SetValidTo sets the ValidTo field's value.
  7599. func (s *KeyMetadata) SetValidTo(v time.Time) *KeyMetadata {
  7600. s.ValidTo = &v
  7601. return s
  7602. }
  7603. type ListAliasesInput struct {
  7604. _ struct{} `type:"structure"`
  7605. // Lists only aliases that refer to the specified CMK. The value of this parameter
  7606. // can be the ID or Amazon Resource Name (ARN) of a CMK in the caller's account
  7607. // and region. You cannot use an alias name or alias ARN in this value.
  7608. //
  7609. // This parameter is optional. If you omit it, ListAliases returns all aliases
  7610. // in the account and region.
  7611. KeyId *string `min:"1" type:"string"`
  7612. // Use this parameter to specify the maximum number of items to return. When
  7613. // this value is present, AWS KMS does not return more than the specified number
  7614. // of items, but it might return fewer.
  7615. //
  7616. // This value is optional. If you include a value, it must be between 1 and
  7617. // 100, inclusive. If you do not include a value, it defaults to 50.
  7618. Limit *int64 `min:"1" type:"integer"`
  7619. // Use this parameter in a subsequent request after you receive a response with
  7620. // truncated results. Set it to the value of NextMarker from the truncated response
  7621. // you just received.
  7622. Marker *string `min:"1" type:"string"`
  7623. }
  7624. // String returns the string representation
  7625. func (s ListAliasesInput) String() string {
  7626. return awsutil.Prettify(s)
  7627. }
  7628. // GoString returns the string representation
  7629. func (s ListAliasesInput) GoString() string {
  7630. return s.String()
  7631. }
  7632. // Validate inspects the fields of the type to determine if they are valid.
  7633. func (s *ListAliasesInput) Validate() error {
  7634. invalidParams := request.ErrInvalidParams{Context: "ListAliasesInput"}
  7635. if s.KeyId != nil && len(*s.KeyId) < 1 {
  7636. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  7637. }
  7638. if s.Limit != nil && *s.Limit < 1 {
  7639. invalidParams.Add(request.NewErrParamMinValue("Limit", 1))
  7640. }
  7641. if s.Marker != nil && len(*s.Marker) < 1 {
  7642. invalidParams.Add(request.NewErrParamMinLen("Marker", 1))
  7643. }
  7644. if invalidParams.Len() > 0 {
  7645. return invalidParams
  7646. }
  7647. return nil
  7648. }
  7649. // SetKeyId sets the KeyId field's value.
  7650. func (s *ListAliasesInput) SetKeyId(v string) *ListAliasesInput {
  7651. s.KeyId = &v
  7652. return s
  7653. }
  7654. // SetLimit sets the Limit field's value.
  7655. func (s *ListAliasesInput) SetLimit(v int64) *ListAliasesInput {
  7656. s.Limit = &v
  7657. return s
  7658. }
  7659. // SetMarker sets the Marker field's value.
  7660. func (s *ListAliasesInput) SetMarker(v string) *ListAliasesInput {
  7661. s.Marker = &v
  7662. return s
  7663. }
  7664. type ListAliasesOutput struct {
  7665. _ struct{} `type:"structure"`
  7666. // A list of aliases.
  7667. Aliases []*AliasListEntry `type:"list"`
  7668. // When Truncated is true, this element is present and contains the value to
  7669. // use for the Marker parameter in a subsequent request.
  7670. NextMarker *string `min:"1" type:"string"`
  7671. // A flag that indicates whether there are more items in the list. When this
  7672. // value is true, the list in this response is truncated. To get more items,
  7673. // pass the value of the NextMarker element in this response to the Marker parameter
  7674. // in a subsequent request.
  7675. Truncated *bool `type:"boolean"`
  7676. }
  7677. // String returns the string representation
  7678. func (s ListAliasesOutput) String() string {
  7679. return awsutil.Prettify(s)
  7680. }
  7681. // GoString returns the string representation
  7682. func (s ListAliasesOutput) GoString() string {
  7683. return s.String()
  7684. }
  7685. // SetAliases sets the Aliases field's value.
  7686. func (s *ListAliasesOutput) SetAliases(v []*AliasListEntry) *ListAliasesOutput {
  7687. s.Aliases = v
  7688. return s
  7689. }
  7690. // SetNextMarker sets the NextMarker field's value.
  7691. func (s *ListAliasesOutput) SetNextMarker(v string) *ListAliasesOutput {
  7692. s.NextMarker = &v
  7693. return s
  7694. }
  7695. // SetTruncated sets the Truncated field's value.
  7696. func (s *ListAliasesOutput) SetTruncated(v bool) *ListAliasesOutput {
  7697. s.Truncated = &v
  7698. return s
  7699. }
  7700. type ListGrantsInput struct {
  7701. _ struct{} `type:"structure"`
  7702. // A unique identifier for the customer master key (CMK).
  7703. //
  7704. // Specify the key ID or the Amazon Resource Name (ARN) of the CMK. To specify
  7705. // a CMK in a different AWS account, you must use the key ARN.
  7706. //
  7707. // For example:
  7708. //
  7709. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  7710. //
  7711. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  7712. //
  7713. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
  7714. //
  7715. // KeyId is a required field
  7716. KeyId *string `min:"1" type:"string" required:"true"`
  7717. // Use this parameter to specify the maximum number of items to return. When
  7718. // this value is present, AWS KMS does not return more than the specified number
  7719. // of items, but it might return fewer.
  7720. //
  7721. // This value is optional. If you include a value, it must be between 1 and
  7722. // 100, inclusive. If you do not include a value, it defaults to 50.
  7723. Limit *int64 `min:"1" type:"integer"`
  7724. // Use this parameter in a subsequent request after you receive a response with
  7725. // truncated results. Set it to the value of NextMarker from the truncated response
  7726. // you just received.
  7727. Marker *string `min:"1" type:"string"`
  7728. }
  7729. // String returns the string representation
  7730. func (s ListGrantsInput) String() string {
  7731. return awsutil.Prettify(s)
  7732. }
  7733. // GoString returns the string representation
  7734. func (s ListGrantsInput) GoString() string {
  7735. return s.String()
  7736. }
  7737. // Validate inspects the fields of the type to determine if they are valid.
  7738. func (s *ListGrantsInput) Validate() error {
  7739. invalidParams := request.ErrInvalidParams{Context: "ListGrantsInput"}
  7740. if s.KeyId == nil {
  7741. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  7742. }
  7743. if s.KeyId != nil && len(*s.KeyId) < 1 {
  7744. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  7745. }
  7746. if s.Limit != nil && *s.Limit < 1 {
  7747. invalidParams.Add(request.NewErrParamMinValue("Limit", 1))
  7748. }
  7749. if s.Marker != nil && len(*s.Marker) < 1 {
  7750. invalidParams.Add(request.NewErrParamMinLen("Marker", 1))
  7751. }
  7752. if invalidParams.Len() > 0 {
  7753. return invalidParams
  7754. }
  7755. return nil
  7756. }
  7757. // SetKeyId sets the KeyId field's value.
  7758. func (s *ListGrantsInput) SetKeyId(v string) *ListGrantsInput {
  7759. s.KeyId = &v
  7760. return s
  7761. }
  7762. // SetLimit sets the Limit field's value.
  7763. func (s *ListGrantsInput) SetLimit(v int64) *ListGrantsInput {
  7764. s.Limit = &v
  7765. return s
  7766. }
  7767. // SetMarker sets the Marker field's value.
  7768. func (s *ListGrantsInput) SetMarker(v string) *ListGrantsInput {
  7769. s.Marker = &v
  7770. return s
  7771. }
  7772. type ListGrantsResponse struct {
  7773. _ struct{} `type:"structure"`
  7774. // A list of grants.
  7775. Grants []*GrantListEntry `type:"list"`
  7776. // When Truncated is true, this element is present and contains the value to
  7777. // use for the Marker parameter in a subsequent request.
  7778. NextMarker *string `min:"1" type:"string"`
  7779. // A flag that indicates whether there are more items in the list. When this
  7780. // value is true, the list in this response is truncated. To get more items,
  7781. // pass the value of the NextMarker element in this response to the Marker parameter
  7782. // in a subsequent request.
  7783. Truncated *bool `type:"boolean"`
  7784. }
  7785. // String returns the string representation
  7786. func (s ListGrantsResponse) String() string {
  7787. return awsutil.Prettify(s)
  7788. }
  7789. // GoString returns the string representation
  7790. func (s ListGrantsResponse) GoString() string {
  7791. return s.String()
  7792. }
  7793. // SetGrants sets the Grants field's value.
  7794. func (s *ListGrantsResponse) SetGrants(v []*GrantListEntry) *ListGrantsResponse {
  7795. s.Grants = v
  7796. return s
  7797. }
  7798. // SetNextMarker sets the NextMarker field's value.
  7799. func (s *ListGrantsResponse) SetNextMarker(v string) *ListGrantsResponse {
  7800. s.NextMarker = &v
  7801. return s
  7802. }
  7803. // SetTruncated sets the Truncated field's value.
  7804. func (s *ListGrantsResponse) SetTruncated(v bool) *ListGrantsResponse {
  7805. s.Truncated = &v
  7806. return s
  7807. }
  7808. type ListKeyPoliciesInput struct {
  7809. _ struct{} `type:"structure"`
  7810. // A unique identifier for the customer master key (CMK).
  7811. //
  7812. // Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
  7813. //
  7814. // For example:
  7815. //
  7816. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  7817. //
  7818. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  7819. //
  7820. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
  7821. //
  7822. // KeyId is a required field
  7823. KeyId *string `min:"1" type:"string" required:"true"`
  7824. // Use this parameter to specify the maximum number of items to return. When
  7825. // this value is present, AWS KMS does not return more than the specified number
  7826. // of items, but it might return fewer.
  7827. //
  7828. // This value is optional. If you include a value, it must be between 1 and
  7829. // 1000, inclusive. If you do not include a value, it defaults to 100.
  7830. //
  7831. // Currently only 1 policy can be attached to a key.
  7832. Limit *int64 `min:"1" type:"integer"`
  7833. // Use this parameter in a subsequent request after you receive a response with
  7834. // truncated results. Set it to the value of NextMarker from the truncated response
  7835. // you just received.
  7836. Marker *string `min:"1" type:"string"`
  7837. }
  7838. // String returns the string representation
  7839. func (s ListKeyPoliciesInput) String() string {
  7840. return awsutil.Prettify(s)
  7841. }
  7842. // GoString returns the string representation
  7843. func (s ListKeyPoliciesInput) GoString() string {
  7844. return s.String()
  7845. }
  7846. // Validate inspects the fields of the type to determine if they are valid.
  7847. func (s *ListKeyPoliciesInput) Validate() error {
  7848. invalidParams := request.ErrInvalidParams{Context: "ListKeyPoliciesInput"}
  7849. if s.KeyId == nil {
  7850. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  7851. }
  7852. if s.KeyId != nil && len(*s.KeyId) < 1 {
  7853. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  7854. }
  7855. if s.Limit != nil && *s.Limit < 1 {
  7856. invalidParams.Add(request.NewErrParamMinValue("Limit", 1))
  7857. }
  7858. if s.Marker != nil && len(*s.Marker) < 1 {
  7859. invalidParams.Add(request.NewErrParamMinLen("Marker", 1))
  7860. }
  7861. if invalidParams.Len() > 0 {
  7862. return invalidParams
  7863. }
  7864. return nil
  7865. }
  7866. // SetKeyId sets the KeyId field's value.
  7867. func (s *ListKeyPoliciesInput) SetKeyId(v string) *ListKeyPoliciesInput {
  7868. s.KeyId = &v
  7869. return s
  7870. }
  7871. // SetLimit sets the Limit field's value.
  7872. func (s *ListKeyPoliciesInput) SetLimit(v int64) *ListKeyPoliciesInput {
  7873. s.Limit = &v
  7874. return s
  7875. }
  7876. // SetMarker sets the Marker field's value.
  7877. func (s *ListKeyPoliciesInput) SetMarker(v string) *ListKeyPoliciesInput {
  7878. s.Marker = &v
  7879. return s
  7880. }
  7881. type ListKeyPoliciesOutput struct {
  7882. _ struct{} `type:"structure"`
  7883. // When Truncated is true, this element is present and contains the value to
  7884. // use for the Marker parameter in a subsequent request.
  7885. NextMarker *string `min:"1" type:"string"`
  7886. // A list of key policy names. Currently, there is only one key policy per CMK
  7887. // and it is always named default.
  7888. PolicyNames []*string `type:"list"`
  7889. // A flag that indicates whether there are more items in the list. When this
  7890. // value is true, the list in this response is truncated. To get more items,
  7891. // pass the value of the NextMarker element in this response to the Marker parameter
  7892. // in a subsequent request.
  7893. Truncated *bool `type:"boolean"`
  7894. }
  7895. // String returns the string representation
  7896. func (s ListKeyPoliciesOutput) String() string {
  7897. return awsutil.Prettify(s)
  7898. }
  7899. // GoString returns the string representation
  7900. func (s ListKeyPoliciesOutput) GoString() string {
  7901. return s.String()
  7902. }
  7903. // SetNextMarker sets the NextMarker field's value.
  7904. func (s *ListKeyPoliciesOutput) SetNextMarker(v string) *ListKeyPoliciesOutput {
  7905. s.NextMarker = &v
  7906. return s
  7907. }
  7908. // SetPolicyNames sets the PolicyNames field's value.
  7909. func (s *ListKeyPoliciesOutput) SetPolicyNames(v []*string) *ListKeyPoliciesOutput {
  7910. s.PolicyNames = v
  7911. return s
  7912. }
  7913. // SetTruncated sets the Truncated field's value.
  7914. func (s *ListKeyPoliciesOutput) SetTruncated(v bool) *ListKeyPoliciesOutput {
  7915. s.Truncated = &v
  7916. return s
  7917. }
  7918. type ListKeysInput struct {
  7919. _ struct{} `type:"structure"`
  7920. // Use this parameter to specify the maximum number of items to return. When
  7921. // this value is present, AWS KMS does not return more than the specified number
  7922. // of items, but it might return fewer.
  7923. //
  7924. // This value is optional. If you include a value, it must be between 1 and
  7925. // 1000, inclusive. If you do not include a value, it defaults to 100.
  7926. Limit *int64 `min:"1" type:"integer"`
  7927. // Use this parameter in a subsequent request after you receive a response with
  7928. // truncated results. Set it to the value of NextMarker from the truncated response
  7929. // you just received.
  7930. Marker *string `min:"1" type:"string"`
  7931. }
  7932. // String returns the string representation
  7933. func (s ListKeysInput) String() string {
  7934. return awsutil.Prettify(s)
  7935. }
  7936. // GoString returns the string representation
  7937. func (s ListKeysInput) GoString() string {
  7938. return s.String()
  7939. }
  7940. // Validate inspects the fields of the type to determine if they are valid.
  7941. func (s *ListKeysInput) Validate() error {
  7942. invalidParams := request.ErrInvalidParams{Context: "ListKeysInput"}
  7943. if s.Limit != nil && *s.Limit < 1 {
  7944. invalidParams.Add(request.NewErrParamMinValue("Limit", 1))
  7945. }
  7946. if s.Marker != nil && len(*s.Marker) < 1 {
  7947. invalidParams.Add(request.NewErrParamMinLen("Marker", 1))
  7948. }
  7949. if invalidParams.Len() > 0 {
  7950. return invalidParams
  7951. }
  7952. return nil
  7953. }
  7954. // SetLimit sets the Limit field's value.
  7955. func (s *ListKeysInput) SetLimit(v int64) *ListKeysInput {
  7956. s.Limit = &v
  7957. return s
  7958. }
  7959. // SetMarker sets the Marker field's value.
  7960. func (s *ListKeysInput) SetMarker(v string) *ListKeysInput {
  7961. s.Marker = &v
  7962. return s
  7963. }
  7964. type ListKeysOutput struct {
  7965. _ struct{} `type:"structure"`
  7966. // A list of customer master keys (CMKs).
  7967. Keys []*KeyListEntry `type:"list"`
  7968. // When Truncated is true, this element is present and contains the value to
  7969. // use for the Marker parameter in a subsequent request.
  7970. NextMarker *string `min:"1" type:"string"`
  7971. // A flag that indicates whether there are more items in the list. When this
  7972. // value is true, the list in this response is truncated. To get more items,
  7973. // pass the value of the NextMarker element in this response to the Marker parameter
  7974. // in a subsequent request.
  7975. Truncated *bool `type:"boolean"`
  7976. }
  7977. // String returns the string representation
  7978. func (s ListKeysOutput) String() string {
  7979. return awsutil.Prettify(s)
  7980. }
  7981. // GoString returns the string representation
  7982. func (s ListKeysOutput) GoString() string {
  7983. return s.String()
  7984. }
  7985. // SetKeys sets the Keys field's value.
  7986. func (s *ListKeysOutput) SetKeys(v []*KeyListEntry) *ListKeysOutput {
  7987. s.Keys = v
  7988. return s
  7989. }
  7990. // SetNextMarker sets the NextMarker field's value.
  7991. func (s *ListKeysOutput) SetNextMarker(v string) *ListKeysOutput {
  7992. s.NextMarker = &v
  7993. return s
  7994. }
  7995. // SetTruncated sets the Truncated field's value.
  7996. func (s *ListKeysOutput) SetTruncated(v bool) *ListKeysOutput {
  7997. s.Truncated = &v
  7998. return s
  7999. }
  8000. type ListResourceTagsInput struct {
  8001. _ struct{} `type:"structure"`
  8002. // A unique identifier for the customer master key (CMK).
  8003. //
  8004. // Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
  8005. //
  8006. // For example:
  8007. //
  8008. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  8009. //
  8010. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  8011. //
  8012. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
  8013. //
  8014. // KeyId is a required field
  8015. KeyId *string `min:"1" type:"string" required:"true"`
  8016. // Use this parameter to specify the maximum number of items to return. When
  8017. // this value is present, AWS KMS does not return more than the specified number
  8018. // of items, but it might return fewer.
  8019. //
  8020. // This value is optional. If you include a value, it must be between 1 and
  8021. // 50, inclusive. If you do not include a value, it defaults to 50.
  8022. Limit *int64 `min:"1" type:"integer"`
  8023. // Use this parameter in a subsequent request after you receive a response with
  8024. // truncated results. Set it to the value of NextMarker from the truncated response
  8025. // you just received.
  8026. //
  8027. // Do not attempt to construct this value. Use only the value of NextMarker
  8028. // from the truncated response you just received.
  8029. Marker *string `min:"1" type:"string"`
  8030. }
  8031. // String returns the string representation
  8032. func (s ListResourceTagsInput) String() string {
  8033. return awsutil.Prettify(s)
  8034. }
  8035. // GoString returns the string representation
  8036. func (s ListResourceTagsInput) GoString() string {
  8037. return s.String()
  8038. }
  8039. // Validate inspects the fields of the type to determine if they are valid.
  8040. func (s *ListResourceTagsInput) Validate() error {
  8041. invalidParams := request.ErrInvalidParams{Context: "ListResourceTagsInput"}
  8042. if s.KeyId == nil {
  8043. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  8044. }
  8045. if s.KeyId != nil && len(*s.KeyId) < 1 {
  8046. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  8047. }
  8048. if s.Limit != nil && *s.Limit < 1 {
  8049. invalidParams.Add(request.NewErrParamMinValue("Limit", 1))
  8050. }
  8051. if s.Marker != nil && len(*s.Marker) < 1 {
  8052. invalidParams.Add(request.NewErrParamMinLen("Marker", 1))
  8053. }
  8054. if invalidParams.Len() > 0 {
  8055. return invalidParams
  8056. }
  8057. return nil
  8058. }
  8059. // SetKeyId sets the KeyId field's value.
  8060. func (s *ListResourceTagsInput) SetKeyId(v string) *ListResourceTagsInput {
  8061. s.KeyId = &v
  8062. return s
  8063. }
  8064. // SetLimit sets the Limit field's value.
  8065. func (s *ListResourceTagsInput) SetLimit(v int64) *ListResourceTagsInput {
  8066. s.Limit = &v
  8067. return s
  8068. }
  8069. // SetMarker sets the Marker field's value.
  8070. func (s *ListResourceTagsInput) SetMarker(v string) *ListResourceTagsInput {
  8071. s.Marker = &v
  8072. return s
  8073. }
  8074. type ListResourceTagsOutput struct {
  8075. _ struct{} `type:"structure"`
  8076. // When Truncated is true, this element is present and contains the value to
  8077. // use for the Marker parameter in a subsequent request.
  8078. //
  8079. // Do not assume or infer any information from this value.
  8080. NextMarker *string `min:"1" type:"string"`
  8081. // A list of tags. Each tag consists of a tag key and a tag value.
  8082. Tags []*Tag `type:"list"`
  8083. // A flag that indicates whether there are more items in the list. When this
  8084. // value is true, the list in this response is truncated. To get more items,
  8085. // pass the value of the NextMarker element in this response to the Marker parameter
  8086. // in a subsequent request.
  8087. Truncated *bool `type:"boolean"`
  8088. }
  8089. // String returns the string representation
  8090. func (s ListResourceTagsOutput) String() string {
  8091. return awsutil.Prettify(s)
  8092. }
  8093. // GoString returns the string representation
  8094. func (s ListResourceTagsOutput) GoString() string {
  8095. return s.String()
  8096. }
  8097. // SetNextMarker sets the NextMarker field's value.
  8098. func (s *ListResourceTagsOutput) SetNextMarker(v string) *ListResourceTagsOutput {
  8099. s.NextMarker = &v
  8100. return s
  8101. }
  8102. // SetTags sets the Tags field's value.
  8103. func (s *ListResourceTagsOutput) SetTags(v []*Tag) *ListResourceTagsOutput {
  8104. s.Tags = v
  8105. return s
  8106. }
  8107. // SetTruncated sets the Truncated field's value.
  8108. func (s *ListResourceTagsOutput) SetTruncated(v bool) *ListResourceTagsOutput {
  8109. s.Truncated = &v
  8110. return s
  8111. }
  8112. type ListRetirableGrantsInput struct {
  8113. _ struct{} `type:"structure"`
  8114. // Use this parameter to specify the maximum number of items to return. When
  8115. // this value is present, AWS KMS does not return more than the specified number
  8116. // of items, but it might return fewer.
  8117. //
  8118. // This value is optional. If you include a value, it must be between 1 and
  8119. // 100, inclusive. If you do not include a value, it defaults to 50.
  8120. Limit *int64 `min:"1" type:"integer"`
  8121. // Use this parameter in a subsequent request after you receive a response with
  8122. // truncated results. Set it to the value of NextMarker from the truncated response
  8123. // you just received.
  8124. Marker *string `min:"1" type:"string"`
  8125. // The retiring principal for which to list grants.
  8126. //
  8127. // To specify the retiring principal, use the Amazon Resource Name (ARN) (http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
  8128. // of an AWS principal. Valid AWS principals include AWS accounts (root), IAM
  8129. // users, federated users, and assumed role users. For examples of the ARN syntax
  8130. // for specifying a principal, see AWS Identity and Access Management (IAM)
  8131. // (http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-iam)
  8132. // in the Example ARNs section of the Amazon Web Services General Reference.
  8133. //
  8134. // RetiringPrincipal is a required field
  8135. RetiringPrincipal *string `min:"1" type:"string" required:"true"`
  8136. }
  8137. // String returns the string representation
  8138. func (s ListRetirableGrantsInput) String() string {
  8139. return awsutil.Prettify(s)
  8140. }
  8141. // GoString returns the string representation
  8142. func (s ListRetirableGrantsInput) GoString() string {
  8143. return s.String()
  8144. }
  8145. // Validate inspects the fields of the type to determine if they are valid.
  8146. func (s *ListRetirableGrantsInput) Validate() error {
  8147. invalidParams := request.ErrInvalidParams{Context: "ListRetirableGrantsInput"}
  8148. if s.Limit != nil && *s.Limit < 1 {
  8149. invalidParams.Add(request.NewErrParamMinValue("Limit", 1))
  8150. }
  8151. if s.Marker != nil && len(*s.Marker) < 1 {
  8152. invalidParams.Add(request.NewErrParamMinLen("Marker", 1))
  8153. }
  8154. if s.RetiringPrincipal == nil {
  8155. invalidParams.Add(request.NewErrParamRequired("RetiringPrincipal"))
  8156. }
  8157. if s.RetiringPrincipal != nil && len(*s.RetiringPrincipal) < 1 {
  8158. invalidParams.Add(request.NewErrParamMinLen("RetiringPrincipal", 1))
  8159. }
  8160. if invalidParams.Len() > 0 {
  8161. return invalidParams
  8162. }
  8163. return nil
  8164. }
  8165. // SetLimit sets the Limit field's value.
  8166. func (s *ListRetirableGrantsInput) SetLimit(v int64) *ListRetirableGrantsInput {
  8167. s.Limit = &v
  8168. return s
  8169. }
  8170. // SetMarker sets the Marker field's value.
  8171. func (s *ListRetirableGrantsInput) SetMarker(v string) *ListRetirableGrantsInput {
  8172. s.Marker = &v
  8173. return s
  8174. }
  8175. // SetRetiringPrincipal sets the RetiringPrincipal field's value.
  8176. func (s *ListRetirableGrantsInput) SetRetiringPrincipal(v string) *ListRetirableGrantsInput {
  8177. s.RetiringPrincipal = &v
  8178. return s
  8179. }
  8180. type PutKeyPolicyInput struct {
  8181. _ struct{} `type:"structure"`
  8182. // A flag to indicate whether to bypass the key policy lockout safety check.
  8183. //
  8184. // Setting this value to true increases the risk that the CMK becomes unmanageable.
  8185. // Do not set this value to true indiscriminately.
  8186. //
  8187. // For more information, refer to the scenario in the Default Key Policy (http://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam)
  8188. // section in the AWS Key Management Service Developer Guide.
  8189. //
  8190. // Use this parameter only when you intend to prevent the principal that is
  8191. // making the request from making a subsequent PutKeyPolicy request on the CMK.
  8192. //
  8193. // The default value is false.
  8194. BypassPolicyLockoutSafetyCheck *bool `type:"boolean"`
  8195. // A unique identifier for the customer master key (CMK).
  8196. //
  8197. // Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
  8198. //
  8199. // For example:
  8200. //
  8201. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  8202. //
  8203. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  8204. //
  8205. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
  8206. //
  8207. // KeyId is a required field
  8208. KeyId *string `min:"1" type:"string" required:"true"`
  8209. // The key policy to attach to the CMK.
  8210. //
  8211. // The key policy must meet the following criteria:
  8212. //
  8213. // * If you don't set BypassPolicyLockoutSafetyCheck to true, the key policy
  8214. // must allow the principal that is making the PutKeyPolicy request to make
  8215. // a subsequent PutKeyPolicy request on the CMK. This reduces the risk that
  8216. // the CMK becomes unmanageable. For more information, refer to the scenario
  8217. // in the Default Key Policy (http://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam)
  8218. // section of the AWS Key Management Service Developer Guide.
  8219. //
  8220. // * Each statement in the key policy must contain one or more principals.
  8221. // The principals in the key policy must exist and be visible to AWS KMS.
  8222. // When you create a new AWS principal (for example, an IAM user or role),
  8223. // you might need to enforce a delay before including the new principal in
  8224. // a key policy because the new principal might not be immediately visible
  8225. // to AWS KMS. For more information, see Changes that I make are not always
  8226. // immediately visible (http://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency)
  8227. // in the AWS Identity and Access Management User Guide.
  8228. //
  8229. // The key policy size limit is 32 kilobytes (32768 bytes).
  8230. //
  8231. // Policy is a required field
  8232. Policy *string `min:"1" type:"string" required:"true"`
  8233. // The name of the key policy. The only valid value is default.
  8234. //
  8235. // PolicyName is a required field
  8236. PolicyName *string `min:"1" type:"string" required:"true"`
  8237. }
  8238. // String returns the string representation
  8239. func (s PutKeyPolicyInput) String() string {
  8240. return awsutil.Prettify(s)
  8241. }
  8242. // GoString returns the string representation
  8243. func (s PutKeyPolicyInput) GoString() string {
  8244. return s.String()
  8245. }
  8246. // Validate inspects the fields of the type to determine if they are valid.
  8247. func (s *PutKeyPolicyInput) Validate() error {
  8248. invalidParams := request.ErrInvalidParams{Context: "PutKeyPolicyInput"}
  8249. if s.KeyId == nil {
  8250. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  8251. }
  8252. if s.KeyId != nil && len(*s.KeyId) < 1 {
  8253. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  8254. }
  8255. if s.Policy == nil {
  8256. invalidParams.Add(request.NewErrParamRequired("Policy"))
  8257. }
  8258. if s.Policy != nil && len(*s.Policy) < 1 {
  8259. invalidParams.Add(request.NewErrParamMinLen("Policy", 1))
  8260. }
  8261. if s.PolicyName == nil {
  8262. invalidParams.Add(request.NewErrParamRequired("PolicyName"))
  8263. }
  8264. if s.PolicyName != nil && len(*s.PolicyName) < 1 {
  8265. invalidParams.Add(request.NewErrParamMinLen("PolicyName", 1))
  8266. }
  8267. if invalidParams.Len() > 0 {
  8268. return invalidParams
  8269. }
  8270. return nil
  8271. }
  8272. // SetBypassPolicyLockoutSafetyCheck sets the BypassPolicyLockoutSafetyCheck field's value.
  8273. func (s *PutKeyPolicyInput) SetBypassPolicyLockoutSafetyCheck(v bool) *PutKeyPolicyInput {
  8274. s.BypassPolicyLockoutSafetyCheck = &v
  8275. return s
  8276. }
  8277. // SetKeyId sets the KeyId field's value.
  8278. func (s *PutKeyPolicyInput) SetKeyId(v string) *PutKeyPolicyInput {
  8279. s.KeyId = &v
  8280. return s
  8281. }
  8282. // SetPolicy sets the Policy field's value.
  8283. func (s *PutKeyPolicyInput) SetPolicy(v string) *PutKeyPolicyInput {
  8284. s.Policy = &v
  8285. return s
  8286. }
  8287. // SetPolicyName sets the PolicyName field's value.
  8288. func (s *PutKeyPolicyInput) SetPolicyName(v string) *PutKeyPolicyInput {
  8289. s.PolicyName = &v
  8290. return s
  8291. }
  8292. type PutKeyPolicyOutput struct {
  8293. _ struct{} `type:"structure"`
  8294. }
  8295. // String returns the string representation
  8296. func (s PutKeyPolicyOutput) String() string {
  8297. return awsutil.Prettify(s)
  8298. }
  8299. // GoString returns the string representation
  8300. func (s PutKeyPolicyOutput) GoString() string {
  8301. return s.String()
  8302. }
  8303. type ReEncryptInput struct {
  8304. _ struct{} `type:"structure"`
  8305. // Ciphertext of the data to reencrypt.
  8306. //
  8307. // CiphertextBlob is automatically base64 encoded/decoded by the SDK.
  8308. //
  8309. // CiphertextBlob is a required field
  8310. CiphertextBlob []byte `min:"1" type:"blob" required:"true"`
  8311. // Encryption context to use when the data is reencrypted.
  8312. DestinationEncryptionContext map[string]*string `type:"map"`
  8313. // A unique identifier for the CMK that is used to reencrypt the data.
  8314. //
  8315. // To specify a CMK, use its key ID, Amazon Resource Name (ARN), alias name,
  8316. // or alias ARN. When using an alias name, prefix it with "alias/". To specify
  8317. // a CMK in a different AWS account, you must use the key ARN or alias ARN.
  8318. //
  8319. // For example:
  8320. //
  8321. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  8322. //
  8323. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  8324. //
  8325. // * Alias name: alias/ExampleAlias
  8326. //
  8327. // * Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias
  8328. //
  8329. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey. To
  8330. // get the alias name and alias ARN, use ListAliases.
  8331. //
  8332. // DestinationKeyId is a required field
  8333. DestinationKeyId *string `min:"1" type:"string" required:"true"`
  8334. // A list of grant tokens.
  8335. //
  8336. // For more information, see Grant Tokens (http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token)
  8337. // in the AWS Key Management Service Developer Guide.
  8338. GrantTokens []*string `type:"list"`
  8339. // Encryption context used to encrypt and decrypt the data specified in the
  8340. // CiphertextBlob parameter.
  8341. SourceEncryptionContext map[string]*string `type:"map"`
  8342. }
  8343. // String returns the string representation
  8344. func (s ReEncryptInput) String() string {
  8345. return awsutil.Prettify(s)
  8346. }
  8347. // GoString returns the string representation
  8348. func (s ReEncryptInput) GoString() string {
  8349. return s.String()
  8350. }
  8351. // Validate inspects the fields of the type to determine if they are valid.
  8352. func (s *ReEncryptInput) Validate() error {
  8353. invalidParams := request.ErrInvalidParams{Context: "ReEncryptInput"}
  8354. if s.CiphertextBlob == nil {
  8355. invalidParams.Add(request.NewErrParamRequired("CiphertextBlob"))
  8356. }
  8357. if s.CiphertextBlob != nil && len(s.CiphertextBlob) < 1 {
  8358. invalidParams.Add(request.NewErrParamMinLen("CiphertextBlob", 1))
  8359. }
  8360. if s.DestinationKeyId == nil {
  8361. invalidParams.Add(request.NewErrParamRequired("DestinationKeyId"))
  8362. }
  8363. if s.DestinationKeyId != nil && len(*s.DestinationKeyId) < 1 {
  8364. invalidParams.Add(request.NewErrParamMinLen("DestinationKeyId", 1))
  8365. }
  8366. if invalidParams.Len() > 0 {
  8367. return invalidParams
  8368. }
  8369. return nil
  8370. }
  8371. // SetCiphertextBlob sets the CiphertextBlob field's value.
  8372. func (s *ReEncryptInput) SetCiphertextBlob(v []byte) *ReEncryptInput {
  8373. s.CiphertextBlob = v
  8374. return s
  8375. }
  8376. // SetDestinationEncryptionContext sets the DestinationEncryptionContext field's value.
  8377. func (s *ReEncryptInput) SetDestinationEncryptionContext(v map[string]*string) *ReEncryptInput {
  8378. s.DestinationEncryptionContext = v
  8379. return s
  8380. }
  8381. // SetDestinationKeyId sets the DestinationKeyId field's value.
  8382. func (s *ReEncryptInput) SetDestinationKeyId(v string) *ReEncryptInput {
  8383. s.DestinationKeyId = &v
  8384. return s
  8385. }
  8386. // SetGrantTokens sets the GrantTokens field's value.
  8387. func (s *ReEncryptInput) SetGrantTokens(v []*string) *ReEncryptInput {
  8388. s.GrantTokens = v
  8389. return s
  8390. }
  8391. // SetSourceEncryptionContext sets the SourceEncryptionContext field's value.
  8392. func (s *ReEncryptInput) SetSourceEncryptionContext(v map[string]*string) *ReEncryptInput {
  8393. s.SourceEncryptionContext = v
  8394. return s
  8395. }
  8396. type ReEncryptOutput struct {
  8397. _ struct{} `type:"structure"`
  8398. // The reencrypted data. When you use the HTTP API or the AWS CLI, the value
  8399. // is Base64-encdoded. Otherwise, it is not encoded.
  8400. //
  8401. // CiphertextBlob is automatically base64 encoded/decoded by the SDK.
  8402. CiphertextBlob []byte `min:"1" type:"blob"`
  8403. // Unique identifier of the CMK used to reencrypt the data.
  8404. KeyId *string `min:"1" type:"string"`
  8405. // Unique identifier of the CMK used to originally encrypt the data.
  8406. SourceKeyId *string `min:"1" type:"string"`
  8407. }
  8408. // String returns the string representation
  8409. func (s ReEncryptOutput) String() string {
  8410. return awsutil.Prettify(s)
  8411. }
  8412. // GoString returns the string representation
  8413. func (s ReEncryptOutput) GoString() string {
  8414. return s.String()
  8415. }
  8416. // SetCiphertextBlob sets the CiphertextBlob field's value.
  8417. func (s *ReEncryptOutput) SetCiphertextBlob(v []byte) *ReEncryptOutput {
  8418. s.CiphertextBlob = v
  8419. return s
  8420. }
  8421. // SetKeyId sets the KeyId field's value.
  8422. func (s *ReEncryptOutput) SetKeyId(v string) *ReEncryptOutput {
  8423. s.KeyId = &v
  8424. return s
  8425. }
  8426. // SetSourceKeyId sets the SourceKeyId field's value.
  8427. func (s *ReEncryptOutput) SetSourceKeyId(v string) *ReEncryptOutput {
  8428. s.SourceKeyId = &v
  8429. return s
  8430. }
  8431. type RetireGrantInput struct {
  8432. _ struct{} `type:"structure"`
  8433. // Unique identifier of the grant to retire. The grant ID is returned in the
  8434. // response to a CreateGrant operation.
  8435. //
  8436. // * Grant ID Example - 0123456789012345678901234567890123456789012345678901234567890123
  8437. GrantId *string `min:"1" type:"string"`
  8438. // Token that identifies the grant to be retired.
  8439. GrantToken *string `min:"1" type:"string"`
  8440. // The Amazon Resource Name (ARN) of the CMK associated with the grant.
  8441. //
  8442. // For example: arn:aws:kms:us-east-2:444455556666:key/1234abcd-12ab-34cd-56ef-1234567890ab
  8443. KeyId *string `min:"1" type:"string"`
  8444. }
  8445. // String returns the string representation
  8446. func (s RetireGrantInput) String() string {
  8447. return awsutil.Prettify(s)
  8448. }
  8449. // GoString returns the string representation
  8450. func (s RetireGrantInput) GoString() string {
  8451. return s.String()
  8452. }
  8453. // Validate inspects the fields of the type to determine if they are valid.
  8454. func (s *RetireGrantInput) Validate() error {
  8455. invalidParams := request.ErrInvalidParams{Context: "RetireGrantInput"}
  8456. if s.GrantId != nil && len(*s.GrantId) < 1 {
  8457. invalidParams.Add(request.NewErrParamMinLen("GrantId", 1))
  8458. }
  8459. if s.GrantToken != nil && len(*s.GrantToken) < 1 {
  8460. invalidParams.Add(request.NewErrParamMinLen("GrantToken", 1))
  8461. }
  8462. if s.KeyId != nil && len(*s.KeyId) < 1 {
  8463. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  8464. }
  8465. if invalidParams.Len() > 0 {
  8466. return invalidParams
  8467. }
  8468. return nil
  8469. }
  8470. // SetGrantId sets the GrantId field's value.
  8471. func (s *RetireGrantInput) SetGrantId(v string) *RetireGrantInput {
  8472. s.GrantId = &v
  8473. return s
  8474. }
  8475. // SetGrantToken sets the GrantToken field's value.
  8476. func (s *RetireGrantInput) SetGrantToken(v string) *RetireGrantInput {
  8477. s.GrantToken = &v
  8478. return s
  8479. }
  8480. // SetKeyId sets the KeyId field's value.
  8481. func (s *RetireGrantInput) SetKeyId(v string) *RetireGrantInput {
  8482. s.KeyId = &v
  8483. return s
  8484. }
  8485. type RetireGrantOutput struct {
  8486. _ struct{} `type:"structure"`
  8487. }
  8488. // String returns the string representation
  8489. func (s RetireGrantOutput) String() string {
  8490. return awsutil.Prettify(s)
  8491. }
  8492. // GoString returns the string representation
  8493. func (s RetireGrantOutput) GoString() string {
  8494. return s.String()
  8495. }
  8496. type RevokeGrantInput struct {
  8497. _ struct{} `type:"structure"`
  8498. // Identifier of the grant to be revoked.
  8499. //
  8500. // GrantId is a required field
  8501. GrantId *string `min:"1" type:"string" required:"true"`
  8502. // A unique identifier for the customer master key associated with the grant.
  8503. //
  8504. // Specify the key ID or the Amazon Resource Name (ARN) of the CMK. To specify
  8505. // a CMK in a different AWS account, you must use the key ARN.
  8506. //
  8507. // For example:
  8508. //
  8509. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  8510. //
  8511. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  8512. //
  8513. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
  8514. //
  8515. // KeyId is a required field
  8516. KeyId *string `min:"1" type:"string" required:"true"`
  8517. }
  8518. // String returns the string representation
  8519. func (s RevokeGrantInput) String() string {
  8520. return awsutil.Prettify(s)
  8521. }
  8522. // GoString returns the string representation
  8523. func (s RevokeGrantInput) GoString() string {
  8524. return s.String()
  8525. }
  8526. // Validate inspects the fields of the type to determine if they are valid.
  8527. func (s *RevokeGrantInput) Validate() error {
  8528. invalidParams := request.ErrInvalidParams{Context: "RevokeGrantInput"}
  8529. if s.GrantId == nil {
  8530. invalidParams.Add(request.NewErrParamRequired("GrantId"))
  8531. }
  8532. if s.GrantId != nil && len(*s.GrantId) < 1 {
  8533. invalidParams.Add(request.NewErrParamMinLen("GrantId", 1))
  8534. }
  8535. if s.KeyId == nil {
  8536. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  8537. }
  8538. if s.KeyId != nil && len(*s.KeyId) < 1 {
  8539. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  8540. }
  8541. if invalidParams.Len() > 0 {
  8542. return invalidParams
  8543. }
  8544. return nil
  8545. }
  8546. // SetGrantId sets the GrantId field's value.
  8547. func (s *RevokeGrantInput) SetGrantId(v string) *RevokeGrantInput {
  8548. s.GrantId = &v
  8549. return s
  8550. }
  8551. // SetKeyId sets the KeyId field's value.
  8552. func (s *RevokeGrantInput) SetKeyId(v string) *RevokeGrantInput {
  8553. s.KeyId = &v
  8554. return s
  8555. }
  8556. type RevokeGrantOutput struct {
  8557. _ struct{} `type:"structure"`
  8558. }
  8559. // String returns the string representation
  8560. func (s RevokeGrantOutput) String() string {
  8561. return awsutil.Prettify(s)
  8562. }
  8563. // GoString returns the string representation
  8564. func (s RevokeGrantOutput) GoString() string {
  8565. return s.String()
  8566. }
  8567. type ScheduleKeyDeletionInput struct {
  8568. _ struct{} `type:"structure"`
  8569. // The unique identifier of the customer master key (CMK) to delete.
  8570. //
  8571. // Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
  8572. //
  8573. // For example:
  8574. //
  8575. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  8576. //
  8577. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  8578. //
  8579. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
  8580. //
  8581. // KeyId is a required field
  8582. KeyId *string `min:"1" type:"string" required:"true"`
  8583. // The waiting period, specified in number of days. After the waiting period
  8584. // ends, AWS KMS deletes the customer master key (CMK).
  8585. //
  8586. // This value is optional. If you include a value, it must be between 7 and
  8587. // 30, inclusive. If you do not include a value, it defaults to 30.
  8588. PendingWindowInDays *int64 `min:"1" type:"integer"`
  8589. }
  8590. // String returns the string representation
  8591. func (s ScheduleKeyDeletionInput) String() string {
  8592. return awsutil.Prettify(s)
  8593. }
  8594. // GoString returns the string representation
  8595. func (s ScheduleKeyDeletionInput) GoString() string {
  8596. return s.String()
  8597. }
  8598. // Validate inspects the fields of the type to determine if they are valid.
  8599. func (s *ScheduleKeyDeletionInput) Validate() error {
  8600. invalidParams := request.ErrInvalidParams{Context: "ScheduleKeyDeletionInput"}
  8601. if s.KeyId == nil {
  8602. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  8603. }
  8604. if s.KeyId != nil && len(*s.KeyId) < 1 {
  8605. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  8606. }
  8607. if s.PendingWindowInDays != nil && *s.PendingWindowInDays < 1 {
  8608. invalidParams.Add(request.NewErrParamMinValue("PendingWindowInDays", 1))
  8609. }
  8610. if invalidParams.Len() > 0 {
  8611. return invalidParams
  8612. }
  8613. return nil
  8614. }
  8615. // SetKeyId sets the KeyId field's value.
  8616. func (s *ScheduleKeyDeletionInput) SetKeyId(v string) *ScheduleKeyDeletionInput {
  8617. s.KeyId = &v
  8618. return s
  8619. }
  8620. // SetPendingWindowInDays sets the PendingWindowInDays field's value.
  8621. func (s *ScheduleKeyDeletionInput) SetPendingWindowInDays(v int64) *ScheduleKeyDeletionInput {
  8622. s.PendingWindowInDays = &v
  8623. return s
  8624. }
  8625. type ScheduleKeyDeletionOutput struct {
  8626. _ struct{} `type:"structure"`
  8627. // The date and time after which AWS KMS deletes the customer master key (CMK).
  8628. DeletionDate *time.Time `type:"timestamp"`
  8629. // The unique identifier of the customer master key (CMK) for which deletion
  8630. // is scheduled.
  8631. KeyId *string `min:"1" type:"string"`
  8632. }
  8633. // String returns the string representation
  8634. func (s ScheduleKeyDeletionOutput) String() string {
  8635. return awsutil.Prettify(s)
  8636. }
  8637. // GoString returns the string representation
  8638. func (s ScheduleKeyDeletionOutput) GoString() string {
  8639. return s.String()
  8640. }
  8641. // SetDeletionDate sets the DeletionDate field's value.
  8642. func (s *ScheduleKeyDeletionOutput) SetDeletionDate(v time.Time) *ScheduleKeyDeletionOutput {
  8643. s.DeletionDate = &v
  8644. return s
  8645. }
  8646. // SetKeyId sets the KeyId field's value.
  8647. func (s *ScheduleKeyDeletionOutput) SetKeyId(v string) *ScheduleKeyDeletionOutput {
  8648. s.KeyId = &v
  8649. return s
  8650. }
  8651. // A key-value pair. A tag consists of a tag key and a tag value. Tag keys and
  8652. // tag values are both required, but tag values can be empty (null) strings.
  8653. //
  8654. // For information about the rules that apply to tag keys and tag values, see
  8655. // User-Defined Tag Restrictions (http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/allocation-tag-restrictions.html)
  8656. // in the AWS Billing and Cost Management User Guide.
  8657. type Tag struct {
  8658. _ struct{} `type:"structure"`
  8659. // The key of the tag.
  8660. //
  8661. // TagKey is a required field
  8662. TagKey *string `min:"1" type:"string" required:"true"`
  8663. // The value of the tag.
  8664. //
  8665. // TagValue is a required field
  8666. TagValue *string `type:"string" required:"true"`
  8667. }
  8668. // String returns the string representation
  8669. func (s Tag) String() string {
  8670. return awsutil.Prettify(s)
  8671. }
  8672. // GoString returns the string representation
  8673. func (s Tag) GoString() string {
  8674. return s.String()
  8675. }
  8676. // Validate inspects the fields of the type to determine if they are valid.
  8677. func (s *Tag) Validate() error {
  8678. invalidParams := request.ErrInvalidParams{Context: "Tag"}
  8679. if s.TagKey == nil {
  8680. invalidParams.Add(request.NewErrParamRequired("TagKey"))
  8681. }
  8682. if s.TagKey != nil && len(*s.TagKey) < 1 {
  8683. invalidParams.Add(request.NewErrParamMinLen("TagKey", 1))
  8684. }
  8685. if s.TagValue == nil {
  8686. invalidParams.Add(request.NewErrParamRequired("TagValue"))
  8687. }
  8688. if invalidParams.Len() > 0 {
  8689. return invalidParams
  8690. }
  8691. return nil
  8692. }
  8693. // SetTagKey sets the TagKey field's value.
  8694. func (s *Tag) SetTagKey(v string) *Tag {
  8695. s.TagKey = &v
  8696. return s
  8697. }
  8698. // SetTagValue sets the TagValue field's value.
  8699. func (s *Tag) SetTagValue(v string) *Tag {
  8700. s.TagValue = &v
  8701. return s
  8702. }
  8703. type TagResourceInput struct {
  8704. _ struct{} `type:"structure"`
  8705. // A unique identifier for the CMK you are tagging.
  8706. //
  8707. // Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
  8708. //
  8709. // For example:
  8710. //
  8711. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  8712. //
  8713. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  8714. //
  8715. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
  8716. //
  8717. // KeyId is a required field
  8718. KeyId *string `min:"1" type:"string" required:"true"`
  8719. // One or more tags. Each tag consists of a tag key and a tag value.
  8720. //
  8721. // Tags is a required field
  8722. Tags []*Tag `type:"list" required:"true"`
  8723. }
  8724. // String returns the string representation
  8725. func (s TagResourceInput) String() string {
  8726. return awsutil.Prettify(s)
  8727. }
  8728. // GoString returns the string representation
  8729. func (s TagResourceInput) GoString() string {
  8730. return s.String()
  8731. }
  8732. // Validate inspects the fields of the type to determine if they are valid.
  8733. func (s *TagResourceInput) Validate() error {
  8734. invalidParams := request.ErrInvalidParams{Context: "TagResourceInput"}
  8735. if s.KeyId == nil {
  8736. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  8737. }
  8738. if s.KeyId != nil && len(*s.KeyId) < 1 {
  8739. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  8740. }
  8741. if s.Tags == nil {
  8742. invalidParams.Add(request.NewErrParamRequired("Tags"))
  8743. }
  8744. if s.Tags != nil {
  8745. for i, v := range s.Tags {
  8746. if v == nil {
  8747. continue
  8748. }
  8749. if err := v.Validate(); err != nil {
  8750. invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams))
  8751. }
  8752. }
  8753. }
  8754. if invalidParams.Len() > 0 {
  8755. return invalidParams
  8756. }
  8757. return nil
  8758. }
  8759. // SetKeyId sets the KeyId field's value.
  8760. func (s *TagResourceInput) SetKeyId(v string) *TagResourceInput {
  8761. s.KeyId = &v
  8762. return s
  8763. }
  8764. // SetTags sets the Tags field's value.
  8765. func (s *TagResourceInput) SetTags(v []*Tag) *TagResourceInput {
  8766. s.Tags = v
  8767. return s
  8768. }
  8769. type TagResourceOutput struct {
  8770. _ struct{} `type:"structure"`
  8771. }
  8772. // String returns the string representation
  8773. func (s TagResourceOutput) String() string {
  8774. return awsutil.Prettify(s)
  8775. }
  8776. // GoString returns the string representation
  8777. func (s TagResourceOutput) GoString() string {
  8778. return s.String()
  8779. }
  8780. type UntagResourceInput struct {
  8781. _ struct{} `type:"structure"`
  8782. // A unique identifier for the CMK from which you are removing tags.
  8783. //
  8784. // Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
  8785. //
  8786. // For example:
  8787. //
  8788. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  8789. //
  8790. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  8791. //
  8792. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
  8793. //
  8794. // KeyId is a required field
  8795. KeyId *string `min:"1" type:"string" required:"true"`
  8796. // One or more tag keys. Specify only the tag keys, not the tag values.
  8797. //
  8798. // TagKeys is a required field
  8799. TagKeys []*string `type:"list" required:"true"`
  8800. }
  8801. // String returns the string representation
  8802. func (s UntagResourceInput) String() string {
  8803. return awsutil.Prettify(s)
  8804. }
  8805. // GoString returns the string representation
  8806. func (s UntagResourceInput) GoString() string {
  8807. return s.String()
  8808. }
  8809. // Validate inspects the fields of the type to determine if they are valid.
  8810. func (s *UntagResourceInput) Validate() error {
  8811. invalidParams := request.ErrInvalidParams{Context: "UntagResourceInput"}
  8812. if s.KeyId == nil {
  8813. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  8814. }
  8815. if s.KeyId != nil && len(*s.KeyId) < 1 {
  8816. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  8817. }
  8818. if s.TagKeys == nil {
  8819. invalidParams.Add(request.NewErrParamRequired("TagKeys"))
  8820. }
  8821. if invalidParams.Len() > 0 {
  8822. return invalidParams
  8823. }
  8824. return nil
  8825. }
  8826. // SetKeyId sets the KeyId field's value.
  8827. func (s *UntagResourceInput) SetKeyId(v string) *UntagResourceInput {
  8828. s.KeyId = &v
  8829. return s
  8830. }
  8831. // SetTagKeys sets the TagKeys field's value.
  8832. func (s *UntagResourceInput) SetTagKeys(v []*string) *UntagResourceInput {
  8833. s.TagKeys = v
  8834. return s
  8835. }
  8836. type UntagResourceOutput struct {
  8837. _ struct{} `type:"structure"`
  8838. }
  8839. // String returns the string representation
  8840. func (s UntagResourceOutput) String() string {
  8841. return awsutil.Prettify(s)
  8842. }
  8843. // GoString returns the string representation
  8844. func (s UntagResourceOutput) GoString() string {
  8845. return s.String()
  8846. }
  8847. type UpdateAliasInput struct {
  8848. _ struct{} `type:"structure"`
  8849. // String that contains the name of the alias to be modified. The name must
  8850. // start with the word "alias" followed by a forward slash (alias/). Aliases
  8851. // that begin with "alias/aws" are reserved.
  8852. //
  8853. // AliasName is a required field
  8854. AliasName *string `min:"1" type:"string" required:"true"`
  8855. // Unique identifier of the customer master key to be mapped to the alias.
  8856. //
  8857. // Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
  8858. //
  8859. // For example:
  8860. //
  8861. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  8862. //
  8863. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  8864. //
  8865. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
  8866. //
  8867. // To verify that the alias is mapped to the correct CMK, use ListAliases.
  8868. //
  8869. // TargetKeyId is a required field
  8870. TargetKeyId *string `min:"1" type:"string" required:"true"`
  8871. }
  8872. // String returns the string representation
  8873. func (s UpdateAliasInput) String() string {
  8874. return awsutil.Prettify(s)
  8875. }
  8876. // GoString returns the string representation
  8877. func (s UpdateAliasInput) GoString() string {
  8878. return s.String()
  8879. }
  8880. // Validate inspects the fields of the type to determine if they are valid.
  8881. func (s *UpdateAliasInput) Validate() error {
  8882. invalidParams := request.ErrInvalidParams{Context: "UpdateAliasInput"}
  8883. if s.AliasName == nil {
  8884. invalidParams.Add(request.NewErrParamRequired("AliasName"))
  8885. }
  8886. if s.AliasName != nil && len(*s.AliasName) < 1 {
  8887. invalidParams.Add(request.NewErrParamMinLen("AliasName", 1))
  8888. }
  8889. if s.TargetKeyId == nil {
  8890. invalidParams.Add(request.NewErrParamRequired("TargetKeyId"))
  8891. }
  8892. if s.TargetKeyId != nil && len(*s.TargetKeyId) < 1 {
  8893. invalidParams.Add(request.NewErrParamMinLen("TargetKeyId", 1))
  8894. }
  8895. if invalidParams.Len() > 0 {
  8896. return invalidParams
  8897. }
  8898. return nil
  8899. }
  8900. // SetAliasName sets the AliasName field's value.
  8901. func (s *UpdateAliasInput) SetAliasName(v string) *UpdateAliasInput {
  8902. s.AliasName = &v
  8903. return s
  8904. }
  8905. // SetTargetKeyId sets the TargetKeyId field's value.
  8906. func (s *UpdateAliasInput) SetTargetKeyId(v string) *UpdateAliasInput {
  8907. s.TargetKeyId = &v
  8908. return s
  8909. }
  8910. type UpdateAliasOutput struct {
  8911. _ struct{} `type:"structure"`
  8912. }
  8913. // String returns the string representation
  8914. func (s UpdateAliasOutput) String() string {
  8915. return awsutil.Prettify(s)
  8916. }
  8917. // GoString returns the string representation
  8918. func (s UpdateAliasOutput) GoString() string {
  8919. return s.String()
  8920. }
  8921. type UpdateCustomKeyStoreInput struct {
  8922. _ struct{} `type:"structure"`
  8923. // Associates the custom key store with a related AWS CloudHSM cluster.
  8924. //
  8925. // Enter the cluster ID of the cluster that you used to create the custom key
  8926. // store or a cluster that shares a backup history with the original cluster.
  8927. // You cannot use this parameter to associate a custom key store with a different
  8928. // cluster.
  8929. //
  8930. // Clusters that share a backup history have the same cluster certificate. To
  8931. // view the cluster certificate of a cluster, use the DescribeClusters (http://docs.aws.amazon.com/cloudhsm/latest/APIReference/API_DescribeClusters.html)
  8932. // operation.
  8933. CloudHsmClusterId *string `min:"19" type:"string"`
  8934. // Identifies the custom key store that you want to update. Enter the ID of
  8935. // the custom key store. To find the ID of a custom key store, use the DescribeCustomKeyStores
  8936. // operation.
  8937. //
  8938. // CustomKeyStoreId is a required field
  8939. CustomKeyStoreId *string `min:"1" type:"string" required:"true"`
  8940. // Enter the current password of the kmsuser crypto user (CU) in the AWS CloudHSM
  8941. // cluster that is associated with the custom key store.
  8942. //
  8943. // This parameter tells AWS KMS the current password of the kmsuser crypto user
  8944. // (CU). It does not set or change the password of any users in the AWS CloudHSM
  8945. // cluster.
  8946. KeyStorePassword *string `min:"1" type:"string" sensitive:"true"`
  8947. // Changes the friendly name of the custom key store to the value that you specify.
  8948. // The custom key store name must be unique in the AWS account.
  8949. NewCustomKeyStoreName *string `min:"1" type:"string"`
  8950. }
  8951. // String returns the string representation
  8952. func (s UpdateCustomKeyStoreInput) String() string {
  8953. return awsutil.Prettify(s)
  8954. }
  8955. // GoString returns the string representation
  8956. func (s UpdateCustomKeyStoreInput) GoString() string {
  8957. return s.String()
  8958. }
  8959. // Validate inspects the fields of the type to determine if they are valid.
  8960. func (s *UpdateCustomKeyStoreInput) Validate() error {
  8961. invalidParams := request.ErrInvalidParams{Context: "UpdateCustomKeyStoreInput"}
  8962. if s.CloudHsmClusterId != nil && len(*s.CloudHsmClusterId) < 19 {
  8963. invalidParams.Add(request.NewErrParamMinLen("CloudHsmClusterId", 19))
  8964. }
  8965. if s.CustomKeyStoreId == nil {
  8966. invalidParams.Add(request.NewErrParamRequired("CustomKeyStoreId"))
  8967. }
  8968. if s.CustomKeyStoreId != nil && len(*s.CustomKeyStoreId) < 1 {
  8969. invalidParams.Add(request.NewErrParamMinLen("CustomKeyStoreId", 1))
  8970. }
  8971. if s.KeyStorePassword != nil && len(*s.KeyStorePassword) < 1 {
  8972. invalidParams.Add(request.NewErrParamMinLen("KeyStorePassword", 1))
  8973. }
  8974. if s.NewCustomKeyStoreName != nil && len(*s.NewCustomKeyStoreName) < 1 {
  8975. invalidParams.Add(request.NewErrParamMinLen("NewCustomKeyStoreName", 1))
  8976. }
  8977. if invalidParams.Len() > 0 {
  8978. return invalidParams
  8979. }
  8980. return nil
  8981. }
  8982. // SetCloudHsmClusterId sets the CloudHsmClusterId field's value.
  8983. func (s *UpdateCustomKeyStoreInput) SetCloudHsmClusterId(v string) *UpdateCustomKeyStoreInput {
  8984. s.CloudHsmClusterId = &v
  8985. return s
  8986. }
  8987. // SetCustomKeyStoreId sets the CustomKeyStoreId field's value.
  8988. func (s *UpdateCustomKeyStoreInput) SetCustomKeyStoreId(v string) *UpdateCustomKeyStoreInput {
  8989. s.CustomKeyStoreId = &v
  8990. return s
  8991. }
  8992. // SetKeyStorePassword sets the KeyStorePassword field's value.
  8993. func (s *UpdateCustomKeyStoreInput) SetKeyStorePassword(v string) *UpdateCustomKeyStoreInput {
  8994. s.KeyStorePassword = &v
  8995. return s
  8996. }
  8997. // SetNewCustomKeyStoreName sets the NewCustomKeyStoreName field's value.
  8998. func (s *UpdateCustomKeyStoreInput) SetNewCustomKeyStoreName(v string) *UpdateCustomKeyStoreInput {
  8999. s.NewCustomKeyStoreName = &v
  9000. return s
  9001. }
  9002. type UpdateCustomKeyStoreOutput struct {
  9003. _ struct{} `type:"structure"`
  9004. }
  9005. // String returns the string representation
  9006. func (s UpdateCustomKeyStoreOutput) String() string {
  9007. return awsutil.Prettify(s)
  9008. }
  9009. // GoString returns the string representation
  9010. func (s UpdateCustomKeyStoreOutput) GoString() string {
  9011. return s.String()
  9012. }
  9013. type UpdateKeyDescriptionInput struct {
  9014. _ struct{} `type:"structure"`
  9015. // New description for the CMK.
  9016. //
  9017. // Description is a required field
  9018. Description *string `type:"string" required:"true"`
  9019. // A unique identifier for the customer master key (CMK).
  9020. //
  9021. // Specify the key ID or the Amazon Resource Name (ARN) of the CMK.
  9022. //
  9023. // For example:
  9024. //
  9025. // * Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab
  9026. //
  9027. // * Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab
  9028. //
  9029. // To get the key ID and key ARN for a CMK, use ListKeys or DescribeKey.
  9030. //
  9031. // KeyId is a required field
  9032. KeyId *string `min:"1" type:"string" required:"true"`
  9033. }
  9034. // String returns the string representation
  9035. func (s UpdateKeyDescriptionInput) String() string {
  9036. return awsutil.Prettify(s)
  9037. }
  9038. // GoString returns the string representation
  9039. func (s UpdateKeyDescriptionInput) GoString() string {
  9040. return s.String()
  9041. }
  9042. // Validate inspects the fields of the type to determine if they are valid.
  9043. func (s *UpdateKeyDescriptionInput) Validate() error {
  9044. invalidParams := request.ErrInvalidParams{Context: "UpdateKeyDescriptionInput"}
  9045. if s.Description == nil {
  9046. invalidParams.Add(request.NewErrParamRequired("Description"))
  9047. }
  9048. if s.KeyId == nil {
  9049. invalidParams.Add(request.NewErrParamRequired("KeyId"))
  9050. }
  9051. if s.KeyId != nil && len(*s.KeyId) < 1 {
  9052. invalidParams.Add(request.NewErrParamMinLen("KeyId", 1))
  9053. }
  9054. if invalidParams.Len() > 0 {
  9055. return invalidParams
  9056. }
  9057. return nil
  9058. }
  9059. // SetDescription sets the Description field's value.
  9060. func (s *UpdateKeyDescriptionInput) SetDescription(v string) *UpdateKeyDescriptionInput {
  9061. s.Description = &v
  9062. return s
  9063. }
  9064. // SetKeyId sets the KeyId field's value.
  9065. func (s *UpdateKeyDescriptionInput) SetKeyId(v string) *UpdateKeyDescriptionInput {
  9066. s.KeyId = &v
  9067. return s
  9068. }
  9069. type UpdateKeyDescriptionOutput struct {
  9070. _ struct{} `type:"structure"`
  9071. }
  9072. // String returns the string representation
  9073. func (s UpdateKeyDescriptionOutput) String() string {
  9074. return awsutil.Prettify(s)
  9075. }
  9076. // GoString returns the string representation
  9077. func (s UpdateKeyDescriptionOutput) GoString() string {
  9078. return s.String()
  9079. }
  9080. const (
  9081. // AlgorithmSpecRsaesPkcs1V15 is a AlgorithmSpec enum value
  9082. AlgorithmSpecRsaesPkcs1V15 = "RSAES_PKCS1_V1_5"
  9083. // AlgorithmSpecRsaesOaepSha1 is a AlgorithmSpec enum value
  9084. AlgorithmSpecRsaesOaepSha1 = "RSAES_OAEP_SHA_1"
  9085. // AlgorithmSpecRsaesOaepSha256 is a AlgorithmSpec enum value
  9086. AlgorithmSpecRsaesOaepSha256 = "RSAES_OAEP_SHA_256"
  9087. )
  9088. const (
  9089. // ConnectionErrorCodeTypeInvalidCredentials is a ConnectionErrorCodeType enum value
  9090. ConnectionErrorCodeTypeInvalidCredentials = "INVALID_CREDENTIALS"
  9091. // ConnectionErrorCodeTypeClusterNotFound is a ConnectionErrorCodeType enum value
  9092. ConnectionErrorCodeTypeClusterNotFound = "CLUSTER_NOT_FOUND"
  9093. // ConnectionErrorCodeTypeNetworkErrors is a ConnectionErrorCodeType enum value
  9094. ConnectionErrorCodeTypeNetworkErrors = "NETWORK_ERRORS"
  9095. // ConnectionErrorCodeTypeInsufficientCloudhsmHsms is a ConnectionErrorCodeType enum value
  9096. ConnectionErrorCodeTypeInsufficientCloudhsmHsms = "INSUFFICIENT_CLOUDHSM_HSMS"
  9097. // ConnectionErrorCodeTypeUserLockedOut is a ConnectionErrorCodeType enum value
  9098. ConnectionErrorCodeTypeUserLockedOut = "USER_LOCKED_OUT"
  9099. )
  9100. const (
  9101. // ConnectionStateTypeConnected is a ConnectionStateType enum value
  9102. ConnectionStateTypeConnected = "CONNECTED"
  9103. // ConnectionStateTypeConnecting is a ConnectionStateType enum value
  9104. ConnectionStateTypeConnecting = "CONNECTING"
  9105. // ConnectionStateTypeFailed is a ConnectionStateType enum value
  9106. ConnectionStateTypeFailed = "FAILED"
  9107. // ConnectionStateTypeDisconnected is a ConnectionStateType enum value
  9108. ConnectionStateTypeDisconnected = "DISCONNECTED"
  9109. // ConnectionStateTypeDisconnecting is a ConnectionStateType enum value
  9110. ConnectionStateTypeDisconnecting = "DISCONNECTING"
  9111. )
  9112. const (
  9113. // DataKeySpecAes256 is a DataKeySpec enum value
  9114. DataKeySpecAes256 = "AES_256"
  9115. // DataKeySpecAes128 is a DataKeySpec enum value
  9116. DataKeySpecAes128 = "AES_128"
  9117. )
  9118. const (
  9119. // ExpirationModelTypeKeyMaterialExpires is a ExpirationModelType enum value
  9120. ExpirationModelTypeKeyMaterialExpires = "KEY_MATERIAL_EXPIRES"
  9121. // ExpirationModelTypeKeyMaterialDoesNotExpire is a ExpirationModelType enum value
  9122. ExpirationModelTypeKeyMaterialDoesNotExpire = "KEY_MATERIAL_DOES_NOT_EXPIRE"
  9123. )
  9124. const (
  9125. // GrantOperationDecrypt is a GrantOperation enum value
  9126. GrantOperationDecrypt = "Decrypt"
  9127. // GrantOperationEncrypt is a GrantOperation enum value
  9128. GrantOperationEncrypt = "Encrypt"
  9129. // GrantOperationGenerateDataKey is a GrantOperation enum value
  9130. GrantOperationGenerateDataKey = "GenerateDataKey"
  9131. // GrantOperationGenerateDataKeyWithoutPlaintext is a GrantOperation enum value
  9132. GrantOperationGenerateDataKeyWithoutPlaintext = "GenerateDataKeyWithoutPlaintext"
  9133. // GrantOperationReEncryptFrom is a GrantOperation enum value
  9134. GrantOperationReEncryptFrom = "ReEncryptFrom"
  9135. // GrantOperationReEncryptTo is a GrantOperation enum value
  9136. GrantOperationReEncryptTo = "ReEncryptTo"
  9137. // GrantOperationCreateGrant is a GrantOperation enum value
  9138. GrantOperationCreateGrant = "CreateGrant"
  9139. // GrantOperationRetireGrant is a GrantOperation enum value
  9140. GrantOperationRetireGrant = "RetireGrant"
  9141. // GrantOperationDescribeKey is a GrantOperation enum value
  9142. GrantOperationDescribeKey = "DescribeKey"
  9143. )
  9144. const (
  9145. // KeyManagerTypeAws is a KeyManagerType enum value
  9146. KeyManagerTypeAws = "AWS"
  9147. // KeyManagerTypeCustomer is a KeyManagerType enum value
  9148. KeyManagerTypeCustomer = "CUSTOMER"
  9149. )
  9150. const (
  9151. // KeyStateEnabled is a KeyState enum value
  9152. KeyStateEnabled = "Enabled"
  9153. // KeyStateDisabled is a KeyState enum value
  9154. KeyStateDisabled = "Disabled"
  9155. // KeyStatePendingDeletion is a KeyState enum value
  9156. KeyStatePendingDeletion = "PendingDeletion"
  9157. // KeyStatePendingImport is a KeyState enum value
  9158. KeyStatePendingImport = "PendingImport"
  9159. // KeyStateUnavailable is a KeyState enum value
  9160. KeyStateUnavailable = "Unavailable"
  9161. )
  9162. const (
  9163. // KeyUsageTypeEncryptDecrypt is a KeyUsageType enum value
  9164. KeyUsageTypeEncryptDecrypt = "ENCRYPT_DECRYPT"
  9165. )
  9166. const (
  9167. // OriginTypeAwsKms is a OriginType enum value
  9168. OriginTypeAwsKms = "AWS_KMS"
  9169. // OriginTypeExternal is a OriginType enum value
  9170. OriginTypeExternal = "EXTERNAL"
  9171. // OriginTypeAwsCloudhsm is a OriginType enum value
  9172. OriginTypeAwsCloudhsm = "AWS_CLOUDHSM"
  9173. )
  9174. const (
  9175. // WrappingKeySpecRsa2048 is a WrappingKeySpec enum value
  9176. WrappingKeySpecRsa2048 = "RSA_2048"
  9177. )