examples_test.go 160 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package ec2_test
  3. import (
  4. "bytes"
  5. "fmt"
  6. "time"
  7. "github.com/aws/aws-sdk-go/aws"
  8. "github.com/aws/aws-sdk-go/aws/session"
  9. "github.com/aws/aws-sdk-go/service/ec2"
  10. )
  11. var _ time.Duration
  12. var _ bytes.Buffer
  13. func ExampleEC2_AcceptVpcPeeringConnection() {
  14. sess, err := session.NewSession()
  15. if err != nil {
  16. fmt.Println("failed to create session,", err)
  17. return
  18. }
  19. svc := ec2.New(sess)
  20. params := &ec2.AcceptVpcPeeringConnectionInput{
  21. DryRun: aws.Bool(true),
  22. VpcPeeringConnectionId: aws.String("String"),
  23. }
  24. resp, err := svc.AcceptVpcPeeringConnection(params)
  25. if err != nil {
  26. // Print the error, cast err to awserr.Error to get the Code and
  27. // Message from an error.
  28. fmt.Println(err.Error())
  29. return
  30. }
  31. // Pretty-print the response data.
  32. fmt.Println(resp)
  33. }
  34. func ExampleEC2_AllocateAddress() {
  35. sess, err := session.NewSession()
  36. if err != nil {
  37. fmt.Println("failed to create session,", err)
  38. return
  39. }
  40. svc := ec2.New(sess)
  41. params := &ec2.AllocateAddressInput{
  42. Domain: aws.String("DomainType"),
  43. DryRun: aws.Bool(true),
  44. }
  45. resp, err := svc.AllocateAddress(params)
  46. if err != nil {
  47. // Print the error, cast err to awserr.Error to get the Code and
  48. // Message from an error.
  49. fmt.Println(err.Error())
  50. return
  51. }
  52. // Pretty-print the response data.
  53. fmt.Println(resp)
  54. }
  55. func ExampleEC2_AllocateHosts() {
  56. sess, err := session.NewSession()
  57. if err != nil {
  58. fmt.Println("failed to create session,", err)
  59. return
  60. }
  61. svc := ec2.New(sess)
  62. params := &ec2.AllocateHostsInput{
  63. AvailabilityZone: aws.String("String"), // Required
  64. InstanceType: aws.String("String"), // Required
  65. Quantity: aws.Int64(1), // Required
  66. AutoPlacement: aws.String("AutoPlacement"),
  67. ClientToken: aws.String("String"),
  68. }
  69. resp, err := svc.AllocateHosts(params)
  70. if err != nil {
  71. // Print the error, cast err to awserr.Error to get the Code and
  72. // Message from an error.
  73. fmt.Println(err.Error())
  74. return
  75. }
  76. // Pretty-print the response data.
  77. fmt.Println(resp)
  78. }
  79. func ExampleEC2_AssignPrivateIpAddresses() {
  80. sess, err := session.NewSession()
  81. if err != nil {
  82. fmt.Println("failed to create session,", err)
  83. return
  84. }
  85. svc := ec2.New(sess)
  86. params := &ec2.AssignPrivateIpAddressesInput{
  87. NetworkInterfaceId: aws.String("String"), // Required
  88. AllowReassignment: aws.Bool(true),
  89. PrivateIpAddresses: []*string{
  90. aws.String("String"), // Required
  91. // More values...
  92. },
  93. SecondaryPrivateIpAddressCount: aws.Int64(1),
  94. }
  95. resp, err := svc.AssignPrivateIpAddresses(params)
  96. if err != nil {
  97. // Print the error, cast err to awserr.Error to get the Code and
  98. // Message from an error.
  99. fmt.Println(err.Error())
  100. return
  101. }
  102. // Pretty-print the response data.
  103. fmt.Println(resp)
  104. }
  105. func ExampleEC2_AssociateAddress() {
  106. sess, err := session.NewSession()
  107. if err != nil {
  108. fmt.Println("failed to create session,", err)
  109. return
  110. }
  111. svc := ec2.New(sess)
  112. params := &ec2.AssociateAddressInput{
  113. AllocationId: aws.String("String"),
  114. AllowReassociation: aws.Bool(true),
  115. DryRun: aws.Bool(true),
  116. InstanceId: aws.String("String"),
  117. NetworkInterfaceId: aws.String("String"),
  118. PrivateIpAddress: aws.String("String"),
  119. PublicIp: aws.String("String"),
  120. }
  121. resp, err := svc.AssociateAddress(params)
  122. if err != nil {
  123. // Print the error, cast err to awserr.Error to get the Code and
  124. // Message from an error.
  125. fmt.Println(err.Error())
  126. return
  127. }
  128. // Pretty-print the response data.
  129. fmt.Println(resp)
  130. }
  131. func ExampleEC2_AssociateDhcpOptions() {
  132. sess, err := session.NewSession()
  133. if err != nil {
  134. fmt.Println("failed to create session,", err)
  135. return
  136. }
  137. svc := ec2.New(sess)
  138. params := &ec2.AssociateDhcpOptionsInput{
  139. DhcpOptionsId: aws.String("String"), // Required
  140. VpcId: aws.String("String"), // Required
  141. DryRun: aws.Bool(true),
  142. }
  143. resp, err := svc.AssociateDhcpOptions(params)
  144. if err != nil {
  145. // Print the error, cast err to awserr.Error to get the Code and
  146. // Message from an error.
  147. fmt.Println(err.Error())
  148. return
  149. }
  150. // Pretty-print the response data.
  151. fmt.Println(resp)
  152. }
  153. func ExampleEC2_AssociateRouteTable() {
  154. sess, err := session.NewSession()
  155. if err != nil {
  156. fmt.Println("failed to create session,", err)
  157. return
  158. }
  159. svc := ec2.New(sess)
  160. params := &ec2.AssociateRouteTableInput{
  161. RouteTableId: aws.String("String"), // Required
  162. SubnetId: aws.String("String"), // Required
  163. DryRun: aws.Bool(true),
  164. }
  165. resp, err := svc.AssociateRouteTable(params)
  166. if err != nil {
  167. // Print the error, cast err to awserr.Error to get the Code and
  168. // Message from an error.
  169. fmt.Println(err.Error())
  170. return
  171. }
  172. // Pretty-print the response data.
  173. fmt.Println(resp)
  174. }
  175. func ExampleEC2_AttachClassicLinkVpc() {
  176. sess, err := session.NewSession()
  177. if err != nil {
  178. fmt.Println("failed to create session,", err)
  179. return
  180. }
  181. svc := ec2.New(sess)
  182. params := &ec2.AttachClassicLinkVpcInput{
  183. Groups: []*string{ // Required
  184. aws.String("String"), // Required
  185. // More values...
  186. },
  187. InstanceId: aws.String("String"), // Required
  188. VpcId: aws.String("String"), // Required
  189. DryRun: aws.Bool(true),
  190. }
  191. resp, err := svc.AttachClassicLinkVpc(params)
  192. if err != nil {
  193. // Print the error, cast err to awserr.Error to get the Code and
  194. // Message from an error.
  195. fmt.Println(err.Error())
  196. return
  197. }
  198. // Pretty-print the response data.
  199. fmt.Println(resp)
  200. }
  201. func ExampleEC2_AttachInternetGateway() {
  202. sess, err := session.NewSession()
  203. if err != nil {
  204. fmt.Println("failed to create session,", err)
  205. return
  206. }
  207. svc := ec2.New(sess)
  208. params := &ec2.AttachInternetGatewayInput{
  209. InternetGatewayId: aws.String("String"), // Required
  210. VpcId: aws.String("String"), // Required
  211. DryRun: aws.Bool(true),
  212. }
  213. resp, err := svc.AttachInternetGateway(params)
  214. if err != nil {
  215. // Print the error, cast err to awserr.Error to get the Code and
  216. // Message from an error.
  217. fmt.Println(err.Error())
  218. return
  219. }
  220. // Pretty-print the response data.
  221. fmt.Println(resp)
  222. }
  223. func ExampleEC2_AttachNetworkInterface() {
  224. sess, err := session.NewSession()
  225. if err != nil {
  226. fmt.Println("failed to create session,", err)
  227. return
  228. }
  229. svc := ec2.New(sess)
  230. params := &ec2.AttachNetworkInterfaceInput{
  231. DeviceIndex: aws.Int64(1), // Required
  232. InstanceId: aws.String("String"), // Required
  233. NetworkInterfaceId: aws.String("String"), // Required
  234. DryRun: aws.Bool(true),
  235. }
  236. resp, err := svc.AttachNetworkInterface(params)
  237. if err != nil {
  238. // Print the error, cast err to awserr.Error to get the Code and
  239. // Message from an error.
  240. fmt.Println(err.Error())
  241. return
  242. }
  243. // Pretty-print the response data.
  244. fmt.Println(resp)
  245. }
  246. func ExampleEC2_AttachVolume() {
  247. sess, err := session.NewSession()
  248. if err != nil {
  249. fmt.Println("failed to create session,", err)
  250. return
  251. }
  252. svc := ec2.New(sess)
  253. params := &ec2.AttachVolumeInput{
  254. Device: aws.String("String"), // Required
  255. InstanceId: aws.String("String"), // Required
  256. VolumeId: aws.String("String"), // Required
  257. DryRun: aws.Bool(true),
  258. }
  259. resp, err := svc.AttachVolume(params)
  260. if err != nil {
  261. // Print the error, cast err to awserr.Error to get the Code and
  262. // Message from an error.
  263. fmt.Println(err.Error())
  264. return
  265. }
  266. // Pretty-print the response data.
  267. fmt.Println(resp)
  268. }
  269. func ExampleEC2_AttachVpnGateway() {
  270. sess, err := session.NewSession()
  271. if err != nil {
  272. fmt.Println("failed to create session,", err)
  273. return
  274. }
  275. svc := ec2.New(sess)
  276. params := &ec2.AttachVpnGatewayInput{
  277. VpcId: aws.String("String"), // Required
  278. VpnGatewayId: aws.String("String"), // Required
  279. DryRun: aws.Bool(true),
  280. }
  281. resp, err := svc.AttachVpnGateway(params)
  282. if err != nil {
  283. // Print the error, cast err to awserr.Error to get the Code and
  284. // Message from an error.
  285. fmt.Println(err.Error())
  286. return
  287. }
  288. // Pretty-print the response data.
  289. fmt.Println(resp)
  290. }
  291. func ExampleEC2_AuthorizeSecurityGroupEgress() {
  292. sess, err := session.NewSession()
  293. if err != nil {
  294. fmt.Println("failed to create session,", err)
  295. return
  296. }
  297. svc := ec2.New(sess)
  298. params := &ec2.AuthorizeSecurityGroupEgressInput{
  299. GroupId: aws.String("String"), // Required
  300. CidrIp: aws.String("String"),
  301. DryRun: aws.Bool(true),
  302. FromPort: aws.Int64(1),
  303. IpPermissions: []*ec2.IpPermission{
  304. { // Required
  305. FromPort: aws.Int64(1),
  306. IpProtocol: aws.String("String"),
  307. IpRanges: []*ec2.IpRange{
  308. { // Required
  309. CidrIp: aws.String("String"),
  310. },
  311. // More values...
  312. },
  313. PrefixListIds: []*ec2.PrefixListId{
  314. { // Required
  315. PrefixListId: aws.String("String"),
  316. },
  317. // More values...
  318. },
  319. ToPort: aws.Int64(1),
  320. UserIdGroupPairs: []*ec2.UserIdGroupPair{
  321. { // Required
  322. GroupId: aws.String("String"),
  323. GroupName: aws.String("String"),
  324. PeeringStatus: aws.String("String"),
  325. UserId: aws.String("String"),
  326. VpcId: aws.String("String"),
  327. VpcPeeringConnectionId: aws.String("String"),
  328. },
  329. // More values...
  330. },
  331. },
  332. // More values...
  333. },
  334. IpProtocol: aws.String("String"),
  335. SourceSecurityGroupName: aws.String("String"),
  336. SourceSecurityGroupOwnerId: aws.String("String"),
  337. ToPort: aws.Int64(1),
  338. }
  339. resp, err := svc.AuthorizeSecurityGroupEgress(params)
  340. if err != nil {
  341. // Print the error, cast err to awserr.Error to get the Code and
  342. // Message from an error.
  343. fmt.Println(err.Error())
  344. return
  345. }
  346. // Pretty-print the response data.
  347. fmt.Println(resp)
  348. }
  349. func ExampleEC2_AuthorizeSecurityGroupIngress() {
  350. sess, err := session.NewSession()
  351. if err != nil {
  352. fmt.Println("failed to create session,", err)
  353. return
  354. }
  355. svc := ec2.New(sess)
  356. params := &ec2.AuthorizeSecurityGroupIngressInput{
  357. CidrIp: aws.String("String"),
  358. DryRun: aws.Bool(true),
  359. FromPort: aws.Int64(1),
  360. GroupId: aws.String("String"),
  361. GroupName: aws.String("String"),
  362. IpPermissions: []*ec2.IpPermission{
  363. { // Required
  364. FromPort: aws.Int64(1),
  365. IpProtocol: aws.String("String"),
  366. IpRanges: []*ec2.IpRange{
  367. { // Required
  368. CidrIp: aws.String("String"),
  369. },
  370. // More values...
  371. },
  372. PrefixListIds: []*ec2.PrefixListId{
  373. { // Required
  374. PrefixListId: aws.String("String"),
  375. },
  376. // More values...
  377. },
  378. ToPort: aws.Int64(1),
  379. UserIdGroupPairs: []*ec2.UserIdGroupPair{
  380. { // Required
  381. GroupId: aws.String("String"),
  382. GroupName: aws.String("String"),
  383. PeeringStatus: aws.String("String"),
  384. UserId: aws.String("String"),
  385. VpcId: aws.String("String"),
  386. VpcPeeringConnectionId: aws.String("String"),
  387. },
  388. // More values...
  389. },
  390. },
  391. // More values...
  392. },
  393. IpProtocol: aws.String("String"),
  394. SourceSecurityGroupName: aws.String("String"),
  395. SourceSecurityGroupOwnerId: aws.String("String"),
  396. ToPort: aws.Int64(1),
  397. }
  398. resp, err := svc.AuthorizeSecurityGroupIngress(params)
  399. if err != nil {
  400. // Print the error, cast err to awserr.Error to get the Code and
  401. // Message from an error.
  402. fmt.Println(err.Error())
  403. return
  404. }
  405. // Pretty-print the response data.
  406. fmt.Println(resp)
  407. }
  408. func ExampleEC2_BundleInstance() {
  409. sess, err := session.NewSession()
  410. if err != nil {
  411. fmt.Println("failed to create session,", err)
  412. return
  413. }
  414. svc := ec2.New(sess)
  415. params := &ec2.BundleInstanceInput{
  416. InstanceId: aws.String("String"), // Required
  417. Storage: &ec2.Storage{ // Required
  418. S3: &ec2.S3Storage{
  419. AWSAccessKeyId: aws.String("String"),
  420. Bucket: aws.String("String"),
  421. Prefix: aws.String("String"),
  422. UploadPolicy: []byte("PAYLOAD"),
  423. UploadPolicySignature: aws.String("String"),
  424. },
  425. },
  426. DryRun: aws.Bool(true),
  427. }
  428. resp, err := svc.BundleInstance(params)
  429. if err != nil {
  430. // Print the error, cast err to awserr.Error to get the Code and
  431. // Message from an error.
  432. fmt.Println(err.Error())
  433. return
  434. }
  435. // Pretty-print the response data.
  436. fmt.Println(resp)
  437. }
  438. func ExampleEC2_CancelBundleTask() {
  439. sess, err := session.NewSession()
  440. if err != nil {
  441. fmt.Println("failed to create session,", err)
  442. return
  443. }
  444. svc := ec2.New(sess)
  445. params := &ec2.CancelBundleTaskInput{
  446. BundleId: aws.String("String"), // Required
  447. DryRun: aws.Bool(true),
  448. }
  449. resp, err := svc.CancelBundleTask(params)
  450. if err != nil {
  451. // Print the error, cast err to awserr.Error to get the Code and
  452. // Message from an error.
  453. fmt.Println(err.Error())
  454. return
  455. }
  456. // Pretty-print the response data.
  457. fmt.Println(resp)
  458. }
  459. func ExampleEC2_CancelConversionTask() {
  460. sess, err := session.NewSession()
  461. if err != nil {
  462. fmt.Println("failed to create session,", err)
  463. return
  464. }
  465. svc := ec2.New(sess)
  466. params := &ec2.CancelConversionTaskInput{
  467. ConversionTaskId: aws.String("String"), // Required
  468. DryRun: aws.Bool(true),
  469. ReasonMessage: aws.String("String"),
  470. }
  471. resp, err := svc.CancelConversionTask(params)
  472. if err != nil {
  473. // Print the error, cast err to awserr.Error to get the Code and
  474. // Message from an error.
  475. fmt.Println(err.Error())
  476. return
  477. }
  478. // Pretty-print the response data.
  479. fmt.Println(resp)
  480. }
  481. func ExampleEC2_CancelExportTask() {
  482. sess, err := session.NewSession()
  483. if err != nil {
  484. fmt.Println("failed to create session,", err)
  485. return
  486. }
  487. svc := ec2.New(sess)
  488. params := &ec2.CancelExportTaskInput{
  489. ExportTaskId: aws.String("String"), // Required
  490. }
  491. resp, err := svc.CancelExportTask(params)
  492. if err != nil {
  493. // Print the error, cast err to awserr.Error to get the Code and
  494. // Message from an error.
  495. fmt.Println(err.Error())
  496. return
  497. }
  498. // Pretty-print the response data.
  499. fmt.Println(resp)
  500. }
  501. func ExampleEC2_CancelImportTask() {
  502. sess, err := session.NewSession()
  503. if err != nil {
  504. fmt.Println("failed to create session,", err)
  505. return
  506. }
  507. svc := ec2.New(sess)
  508. params := &ec2.CancelImportTaskInput{
  509. CancelReason: aws.String("String"),
  510. DryRun: aws.Bool(true),
  511. ImportTaskId: aws.String("String"),
  512. }
  513. resp, err := svc.CancelImportTask(params)
  514. if err != nil {
  515. // Print the error, cast err to awserr.Error to get the Code and
  516. // Message from an error.
  517. fmt.Println(err.Error())
  518. return
  519. }
  520. // Pretty-print the response data.
  521. fmt.Println(resp)
  522. }
  523. func ExampleEC2_CancelReservedInstancesListing() {
  524. sess, err := session.NewSession()
  525. if err != nil {
  526. fmt.Println("failed to create session,", err)
  527. return
  528. }
  529. svc := ec2.New(sess)
  530. params := &ec2.CancelReservedInstancesListingInput{
  531. ReservedInstancesListingId: aws.String("String"), // Required
  532. }
  533. resp, err := svc.CancelReservedInstancesListing(params)
  534. if err != nil {
  535. // Print the error, cast err to awserr.Error to get the Code and
  536. // Message from an error.
  537. fmt.Println(err.Error())
  538. return
  539. }
  540. // Pretty-print the response data.
  541. fmt.Println(resp)
  542. }
  543. func ExampleEC2_CancelSpotFleetRequests() {
  544. sess, err := session.NewSession()
  545. if err != nil {
  546. fmt.Println("failed to create session,", err)
  547. return
  548. }
  549. svc := ec2.New(sess)
  550. params := &ec2.CancelSpotFleetRequestsInput{
  551. SpotFleetRequestIds: []*string{ // Required
  552. aws.String("String"), // Required
  553. // More values...
  554. },
  555. TerminateInstances: aws.Bool(true), // Required
  556. DryRun: aws.Bool(true),
  557. }
  558. resp, err := svc.CancelSpotFleetRequests(params)
  559. if err != nil {
  560. // Print the error, cast err to awserr.Error to get the Code and
  561. // Message from an error.
  562. fmt.Println(err.Error())
  563. return
  564. }
  565. // Pretty-print the response data.
  566. fmt.Println(resp)
  567. }
  568. func ExampleEC2_CancelSpotInstanceRequests() {
  569. sess, err := session.NewSession()
  570. if err != nil {
  571. fmt.Println("failed to create session,", err)
  572. return
  573. }
  574. svc := ec2.New(sess)
  575. params := &ec2.CancelSpotInstanceRequestsInput{
  576. SpotInstanceRequestIds: []*string{ // Required
  577. aws.String("String"), // Required
  578. // More values...
  579. },
  580. DryRun: aws.Bool(true),
  581. }
  582. resp, err := svc.CancelSpotInstanceRequests(params)
  583. if err != nil {
  584. // Print the error, cast err to awserr.Error to get the Code and
  585. // Message from an error.
  586. fmt.Println(err.Error())
  587. return
  588. }
  589. // Pretty-print the response data.
  590. fmt.Println(resp)
  591. }
  592. func ExampleEC2_ConfirmProductInstance() {
  593. sess, err := session.NewSession()
  594. if err != nil {
  595. fmt.Println("failed to create session,", err)
  596. return
  597. }
  598. svc := ec2.New(sess)
  599. params := &ec2.ConfirmProductInstanceInput{
  600. InstanceId: aws.String("String"), // Required
  601. ProductCode: aws.String("String"), // Required
  602. DryRun: aws.Bool(true),
  603. }
  604. resp, err := svc.ConfirmProductInstance(params)
  605. if err != nil {
  606. // Print the error, cast err to awserr.Error to get the Code and
  607. // Message from an error.
  608. fmt.Println(err.Error())
  609. return
  610. }
  611. // Pretty-print the response data.
  612. fmt.Println(resp)
  613. }
  614. func ExampleEC2_CopyImage() {
  615. sess, err := session.NewSession()
  616. if err != nil {
  617. fmt.Println("failed to create session,", err)
  618. return
  619. }
  620. svc := ec2.New(sess)
  621. params := &ec2.CopyImageInput{
  622. Name: aws.String("String"), // Required
  623. SourceImageId: aws.String("String"), // Required
  624. SourceRegion: aws.String("String"), // Required
  625. ClientToken: aws.String("String"),
  626. Description: aws.String("String"),
  627. DryRun: aws.Bool(true),
  628. Encrypted: aws.Bool(true),
  629. KmsKeyId: aws.String("String"),
  630. }
  631. resp, err := svc.CopyImage(params)
  632. if err != nil {
  633. // Print the error, cast err to awserr.Error to get the Code and
  634. // Message from an error.
  635. fmt.Println(err.Error())
  636. return
  637. }
  638. // Pretty-print the response data.
  639. fmt.Println(resp)
  640. }
  641. func ExampleEC2_CopySnapshot() {
  642. sess, err := session.NewSession()
  643. if err != nil {
  644. fmt.Println("failed to create session,", err)
  645. return
  646. }
  647. svc := ec2.New(sess)
  648. params := &ec2.CopySnapshotInput{
  649. SourceRegion: aws.String("String"), // Required
  650. SourceSnapshotId: aws.String("String"), // Required
  651. Description: aws.String("String"),
  652. DestinationRegion: aws.String("String"),
  653. DryRun: aws.Bool(true),
  654. Encrypted: aws.Bool(true),
  655. KmsKeyId: aws.String("String"),
  656. PresignedUrl: aws.String("String"),
  657. }
  658. resp, err := svc.CopySnapshot(params)
  659. if err != nil {
  660. // Print the error, cast err to awserr.Error to get the Code and
  661. // Message from an error.
  662. fmt.Println(err.Error())
  663. return
  664. }
  665. // Pretty-print the response data.
  666. fmt.Println(resp)
  667. }
  668. func ExampleEC2_CreateCustomerGateway() {
  669. sess, err := session.NewSession()
  670. if err != nil {
  671. fmt.Println("failed to create session,", err)
  672. return
  673. }
  674. svc := ec2.New(sess)
  675. params := &ec2.CreateCustomerGatewayInput{
  676. BgpAsn: aws.Int64(1), // Required
  677. PublicIp: aws.String("String"), // Required
  678. Type: aws.String("GatewayType"), // Required
  679. DryRun: aws.Bool(true),
  680. }
  681. resp, err := svc.CreateCustomerGateway(params)
  682. if err != nil {
  683. // Print the error, cast err to awserr.Error to get the Code and
  684. // Message from an error.
  685. fmt.Println(err.Error())
  686. return
  687. }
  688. // Pretty-print the response data.
  689. fmt.Println(resp)
  690. }
  691. func ExampleEC2_CreateDhcpOptions() {
  692. sess, err := session.NewSession()
  693. if err != nil {
  694. fmt.Println("failed to create session,", err)
  695. return
  696. }
  697. svc := ec2.New(sess)
  698. params := &ec2.CreateDhcpOptionsInput{
  699. DhcpConfigurations: []*ec2.NewDhcpConfiguration{ // Required
  700. { // Required
  701. Key: aws.String("String"),
  702. Values: []*string{
  703. aws.String("String"), // Required
  704. // More values...
  705. },
  706. },
  707. // More values...
  708. },
  709. DryRun: aws.Bool(true),
  710. }
  711. resp, err := svc.CreateDhcpOptions(params)
  712. if err != nil {
  713. // Print the error, cast err to awserr.Error to get the Code and
  714. // Message from an error.
  715. fmt.Println(err.Error())
  716. return
  717. }
  718. // Pretty-print the response data.
  719. fmt.Println(resp)
  720. }
  721. func ExampleEC2_CreateFlowLogs() {
  722. sess, err := session.NewSession()
  723. if err != nil {
  724. fmt.Println("failed to create session,", err)
  725. return
  726. }
  727. svc := ec2.New(sess)
  728. params := &ec2.CreateFlowLogsInput{
  729. DeliverLogsPermissionArn: aws.String("String"), // Required
  730. LogGroupName: aws.String("String"), // Required
  731. ResourceIds: []*string{ // Required
  732. aws.String("String"), // Required
  733. // More values...
  734. },
  735. ResourceType: aws.String("FlowLogsResourceType"), // Required
  736. TrafficType: aws.String("TrafficType"), // Required
  737. ClientToken: aws.String("String"),
  738. }
  739. resp, err := svc.CreateFlowLogs(params)
  740. if err != nil {
  741. // Print the error, cast err to awserr.Error to get the Code and
  742. // Message from an error.
  743. fmt.Println(err.Error())
  744. return
  745. }
  746. // Pretty-print the response data.
  747. fmt.Println(resp)
  748. }
  749. func ExampleEC2_CreateImage() {
  750. sess, err := session.NewSession()
  751. if err != nil {
  752. fmt.Println("failed to create session,", err)
  753. return
  754. }
  755. svc := ec2.New(sess)
  756. params := &ec2.CreateImageInput{
  757. InstanceId: aws.String("String"), // Required
  758. Name: aws.String("String"), // Required
  759. BlockDeviceMappings: []*ec2.BlockDeviceMapping{
  760. { // Required
  761. DeviceName: aws.String("String"),
  762. Ebs: &ec2.EbsBlockDevice{
  763. DeleteOnTermination: aws.Bool(true),
  764. Encrypted: aws.Bool(true),
  765. Iops: aws.Int64(1),
  766. SnapshotId: aws.String("String"),
  767. VolumeSize: aws.Int64(1),
  768. VolumeType: aws.String("VolumeType"),
  769. },
  770. NoDevice: aws.String("String"),
  771. VirtualName: aws.String("String"),
  772. },
  773. // More values...
  774. },
  775. Description: aws.String("String"),
  776. DryRun: aws.Bool(true),
  777. NoReboot: aws.Bool(true),
  778. }
  779. resp, err := svc.CreateImage(params)
  780. if err != nil {
  781. // Print the error, cast err to awserr.Error to get the Code and
  782. // Message from an error.
  783. fmt.Println(err.Error())
  784. return
  785. }
  786. // Pretty-print the response data.
  787. fmt.Println(resp)
  788. }
  789. func ExampleEC2_CreateInstanceExportTask() {
  790. sess, err := session.NewSession()
  791. if err != nil {
  792. fmt.Println("failed to create session,", err)
  793. return
  794. }
  795. svc := ec2.New(sess)
  796. params := &ec2.CreateInstanceExportTaskInput{
  797. InstanceId: aws.String("String"), // Required
  798. Description: aws.String("String"),
  799. ExportToS3Task: &ec2.ExportToS3TaskSpecification{
  800. ContainerFormat: aws.String("ContainerFormat"),
  801. DiskImageFormat: aws.String("DiskImageFormat"),
  802. S3Bucket: aws.String("String"),
  803. S3Prefix: aws.String("String"),
  804. },
  805. TargetEnvironment: aws.String("ExportEnvironment"),
  806. }
  807. resp, err := svc.CreateInstanceExportTask(params)
  808. if err != nil {
  809. // Print the error, cast err to awserr.Error to get the Code and
  810. // Message from an error.
  811. fmt.Println(err.Error())
  812. return
  813. }
  814. // Pretty-print the response data.
  815. fmt.Println(resp)
  816. }
  817. func ExampleEC2_CreateInternetGateway() {
  818. sess, err := session.NewSession()
  819. if err != nil {
  820. fmt.Println("failed to create session,", err)
  821. return
  822. }
  823. svc := ec2.New(sess)
  824. params := &ec2.CreateInternetGatewayInput{
  825. DryRun: aws.Bool(true),
  826. }
  827. resp, err := svc.CreateInternetGateway(params)
  828. if err != nil {
  829. // Print the error, cast err to awserr.Error to get the Code and
  830. // Message from an error.
  831. fmt.Println(err.Error())
  832. return
  833. }
  834. // Pretty-print the response data.
  835. fmt.Println(resp)
  836. }
  837. func ExampleEC2_CreateKeyPair() {
  838. sess, err := session.NewSession()
  839. if err != nil {
  840. fmt.Println("failed to create session,", err)
  841. return
  842. }
  843. svc := ec2.New(sess)
  844. params := &ec2.CreateKeyPairInput{
  845. KeyName: aws.String("String"), // Required
  846. DryRun: aws.Bool(true),
  847. }
  848. resp, err := svc.CreateKeyPair(params)
  849. if err != nil {
  850. // Print the error, cast err to awserr.Error to get the Code and
  851. // Message from an error.
  852. fmt.Println(err.Error())
  853. return
  854. }
  855. // Pretty-print the response data.
  856. fmt.Println(resp)
  857. }
  858. func ExampleEC2_CreateNatGateway() {
  859. sess, err := session.NewSession()
  860. if err != nil {
  861. fmt.Println("failed to create session,", err)
  862. return
  863. }
  864. svc := ec2.New(sess)
  865. params := &ec2.CreateNatGatewayInput{
  866. AllocationId: aws.String("String"), // Required
  867. SubnetId: aws.String("String"), // Required
  868. ClientToken: aws.String("String"),
  869. }
  870. resp, err := svc.CreateNatGateway(params)
  871. if err != nil {
  872. // Print the error, cast err to awserr.Error to get the Code and
  873. // Message from an error.
  874. fmt.Println(err.Error())
  875. return
  876. }
  877. // Pretty-print the response data.
  878. fmt.Println(resp)
  879. }
  880. func ExampleEC2_CreateNetworkAcl() {
  881. sess, err := session.NewSession()
  882. if err != nil {
  883. fmt.Println("failed to create session,", err)
  884. return
  885. }
  886. svc := ec2.New(sess)
  887. params := &ec2.CreateNetworkAclInput{
  888. VpcId: aws.String("String"), // Required
  889. DryRun: aws.Bool(true),
  890. }
  891. resp, err := svc.CreateNetworkAcl(params)
  892. if err != nil {
  893. // Print the error, cast err to awserr.Error to get the Code and
  894. // Message from an error.
  895. fmt.Println(err.Error())
  896. return
  897. }
  898. // Pretty-print the response data.
  899. fmt.Println(resp)
  900. }
  901. func ExampleEC2_CreateNetworkAclEntry() {
  902. sess, err := session.NewSession()
  903. if err != nil {
  904. fmt.Println("failed to create session,", err)
  905. return
  906. }
  907. svc := ec2.New(sess)
  908. params := &ec2.CreateNetworkAclEntryInput{
  909. CidrBlock: aws.String("String"), // Required
  910. Egress: aws.Bool(true), // Required
  911. NetworkAclId: aws.String("String"), // Required
  912. Protocol: aws.String("String"), // Required
  913. RuleAction: aws.String("RuleAction"), // Required
  914. RuleNumber: aws.Int64(1), // Required
  915. DryRun: aws.Bool(true),
  916. IcmpTypeCode: &ec2.IcmpTypeCode{
  917. Code: aws.Int64(1),
  918. Type: aws.Int64(1),
  919. },
  920. PortRange: &ec2.PortRange{
  921. From: aws.Int64(1),
  922. To: aws.Int64(1),
  923. },
  924. }
  925. resp, err := svc.CreateNetworkAclEntry(params)
  926. if err != nil {
  927. // Print the error, cast err to awserr.Error to get the Code and
  928. // Message from an error.
  929. fmt.Println(err.Error())
  930. return
  931. }
  932. // Pretty-print the response data.
  933. fmt.Println(resp)
  934. }
  935. func ExampleEC2_CreateNetworkInterface() {
  936. sess, err := session.NewSession()
  937. if err != nil {
  938. fmt.Println("failed to create session,", err)
  939. return
  940. }
  941. svc := ec2.New(sess)
  942. params := &ec2.CreateNetworkInterfaceInput{
  943. SubnetId: aws.String("String"), // Required
  944. Description: aws.String("String"),
  945. DryRun: aws.Bool(true),
  946. Groups: []*string{
  947. aws.String("String"), // Required
  948. // More values...
  949. },
  950. PrivateIpAddress: aws.String("String"),
  951. PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{
  952. { // Required
  953. PrivateIpAddress: aws.String("String"), // Required
  954. Primary: aws.Bool(true),
  955. },
  956. // More values...
  957. },
  958. SecondaryPrivateIpAddressCount: aws.Int64(1),
  959. }
  960. resp, err := svc.CreateNetworkInterface(params)
  961. if err != nil {
  962. // Print the error, cast err to awserr.Error to get the Code and
  963. // Message from an error.
  964. fmt.Println(err.Error())
  965. return
  966. }
  967. // Pretty-print the response data.
  968. fmt.Println(resp)
  969. }
  970. func ExampleEC2_CreatePlacementGroup() {
  971. sess, err := session.NewSession()
  972. if err != nil {
  973. fmt.Println("failed to create session,", err)
  974. return
  975. }
  976. svc := ec2.New(sess)
  977. params := &ec2.CreatePlacementGroupInput{
  978. GroupName: aws.String("String"), // Required
  979. Strategy: aws.String("PlacementStrategy"), // Required
  980. DryRun: aws.Bool(true),
  981. }
  982. resp, err := svc.CreatePlacementGroup(params)
  983. if err != nil {
  984. // Print the error, cast err to awserr.Error to get the Code and
  985. // Message from an error.
  986. fmt.Println(err.Error())
  987. return
  988. }
  989. // Pretty-print the response data.
  990. fmt.Println(resp)
  991. }
  992. func ExampleEC2_CreateReservedInstancesListing() {
  993. sess, err := session.NewSession()
  994. if err != nil {
  995. fmt.Println("failed to create session,", err)
  996. return
  997. }
  998. svc := ec2.New(sess)
  999. params := &ec2.CreateReservedInstancesListingInput{
  1000. ClientToken: aws.String("String"), // Required
  1001. InstanceCount: aws.Int64(1), // Required
  1002. PriceSchedules: []*ec2.PriceScheduleSpecification{ // Required
  1003. { // Required
  1004. CurrencyCode: aws.String("CurrencyCodeValues"),
  1005. Price: aws.Float64(1.0),
  1006. Term: aws.Int64(1),
  1007. },
  1008. // More values...
  1009. },
  1010. ReservedInstancesId: aws.String("String"), // Required
  1011. }
  1012. resp, err := svc.CreateReservedInstancesListing(params)
  1013. if err != nil {
  1014. // Print the error, cast err to awserr.Error to get the Code and
  1015. // Message from an error.
  1016. fmt.Println(err.Error())
  1017. return
  1018. }
  1019. // Pretty-print the response data.
  1020. fmt.Println(resp)
  1021. }
  1022. func ExampleEC2_CreateRoute() {
  1023. sess, err := session.NewSession()
  1024. if err != nil {
  1025. fmt.Println("failed to create session,", err)
  1026. return
  1027. }
  1028. svc := ec2.New(sess)
  1029. params := &ec2.CreateRouteInput{
  1030. DestinationCidrBlock: aws.String("String"), // Required
  1031. RouteTableId: aws.String("String"), // Required
  1032. DryRun: aws.Bool(true),
  1033. GatewayId: aws.String("String"),
  1034. InstanceId: aws.String("String"),
  1035. NatGatewayId: aws.String("String"),
  1036. NetworkInterfaceId: aws.String("String"),
  1037. VpcPeeringConnectionId: aws.String("String"),
  1038. }
  1039. resp, err := svc.CreateRoute(params)
  1040. if err != nil {
  1041. // Print the error, cast err to awserr.Error to get the Code and
  1042. // Message from an error.
  1043. fmt.Println(err.Error())
  1044. return
  1045. }
  1046. // Pretty-print the response data.
  1047. fmt.Println(resp)
  1048. }
  1049. func ExampleEC2_CreateRouteTable() {
  1050. sess, err := session.NewSession()
  1051. if err != nil {
  1052. fmt.Println("failed to create session,", err)
  1053. return
  1054. }
  1055. svc := ec2.New(sess)
  1056. params := &ec2.CreateRouteTableInput{
  1057. VpcId: aws.String("String"), // Required
  1058. DryRun: aws.Bool(true),
  1059. }
  1060. resp, err := svc.CreateRouteTable(params)
  1061. if err != nil {
  1062. // Print the error, cast err to awserr.Error to get the Code and
  1063. // Message from an error.
  1064. fmt.Println(err.Error())
  1065. return
  1066. }
  1067. // Pretty-print the response data.
  1068. fmt.Println(resp)
  1069. }
  1070. func ExampleEC2_CreateSecurityGroup() {
  1071. sess, err := session.NewSession()
  1072. if err != nil {
  1073. fmt.Println("failed to create session,", err)
  1074. return
  1075. }
  1076. svc := ec2.New(sess)
  1077. params := &ec2.CreateSecurityGroupInput{
  1078. Description: aws.String("String"), // Required
  1079. GroupName: aws.String("String"), // Required
  1080. DryRun: aws.Bool(true),
  1081. VpcId: aws.String("String"),
  1082. }
  1083. resp, err := svc.CreateSecurityGroup(params)
  1084. if err != nil {
  1085. // Print the error, cast err to awserr.Error to get the Code and
  1086. // Message from an error.
  1087. fmt.Println(err.Error())
  1088. return
  1089. }
  1090. // Pretty-print the response data.
  1091. fmt.Println(resp)
  1092. }
  1093. func ExampleEC2_CreateSnapshot() {
  1094. sess, err := session.NewSession()
  1095. if err != nil {
  1096. fmt.Println("failed to create session,", err)
  1097. return
  1098. }
  1099. svc := ec2.New(sess)
  1100. params := &ec2.CreateSnapshotInput{
  1101. VolumeId: aws.String("String"), // Required
  1102. Description: aws.String("String"),
  1103. DryRun: aws.Bool(true),
  1104. }
  1105. resp, err := svc.CreateSnapshot(params)
  1106. if err != nil {
  1107. // Print the error, cast err to awserr.Error to get the Code and
  1108. // Message from an error.
  1109. fmt.Println(err.Error())
  1110. return
  1111. }
  1112. // Pretty-print the response data.
  1113. fmt.Println(resp)
  1114. }
  1115. func ExampleEC2_CreateSpotDatafeedSubscription() {
  1116. sess, err := session.NewSession()
  1117. if err != nil {
  1118. fmt.Println("failed to create session,", err)
  1119. return
  1120. }
  1121. svc := ec2.New(sess)
  1122. params := &ec2.CreateSpotDatafeedSubscriptionInput{
  1123. Bucket: aws.String("String"), // Required
  1124. DryRun: aws.Bool(true),
  1125. Prefix: aws.String("String"),
  1126. }
  1127. resp, err := svc.CreateSpotDatafeedSubscription(params)
  1128. if err != nil {
  1129. // Print the error, cast err to awserr.Error to get the Code and
  1130. // Message from an error.
  1131. fmt.Println(err.Error())
  1132. return
  1133. }
  1134. // Pretty-print the response data.
  1135. fmt.Println(resp)
  1136. }
  1137. func ExampleEC2_CreateSubnet() {
  1138. sess, err := session.NewSession()
  1139. if err != nil {
  1140. fmt.Println("failed to create session,", err)
  1141. return
  1142. }
  1143. svc := ec2.New(sess)
  1144. params := &ec2.CreateSubnetInput{
  1145. CidrBlock: aws.String("String"), // Required
  1146. VpcId: aws.String("String"), // Required
  1147. AvailabilityZone: aws.String("String"),
  1148. DryRun: aws.Bool(true),
  1149. }
  1150. resp, err := svc.CreateSubnet(params)
  1151. if err != nil {
  1152. // Print the error, cast err to awserr.Error to get the Code and
  1153. // Message from an error.
  1154. fmt.Println(err.Error())
  1155. return
  1156. }
  1157. // Pretty-print the response data.
  1158. fmt.Println(resp)
  1159. }
  1160. func ExampleEC2_CreateTags() {
  1161. sess, err := session.NewSession()
  1162. if err != nil {
  1163. fmt.Println("failed to create session,", err)
  1164. return
  1165. }
  1166. svc := ec2.New(sess)
  1167. params := &ec2.CreateTagsInput{
  1168. Resources: []*string{ // Required
  1169. aws.String("String"), // Required
  1170. // More values...
  1171. },
  1172. Tags: []*ec2.Tag{ // Required
  1173. { // Required
  1174. Key: aws.String("String"),
  1175. Value: aws.String("String"),
  1176. },
  1177. // More values...
  1178. },
  1179. DryRun: aws.Bool(true),
  1180. }
  1181. resp, err := svc.CreateTags(params)
  1182. if err != nil {
  1183. // Print the error, cast err to awserr.Error to get the Code and
  1184. // Message from an error.
  1185. fmt.Println(err.Error())
  1186. return
  1187. }
  1188. // Pretty-print the response data.
  1189. fmt.Println(resp)
  1190. }
  1191. func ExampleEC2_CreateVolume() {
  1192. sess, err := session.NewSession()
  1193. if err != nil {
  1194. fmt.Println("failed to create session,", err)
  1195. return
  1196. }
  1197. svc := ec2.New(sess)
  1198. params := &ec2.CreateVolumeInput{
  1199. AvailabilityZone: aws.String("String"), // Required
  1200. DryRun: aws.Bool(true),
  1201. Encrypted: aws.Bool(true),
  1202. Iops: aws.Int64(1),
  1203. KmsKeyId: aws.String("String"),
  1204. Size: aws.Int64(1),
  1205. SnapshotId: aws.String("String"),
  1206. VolumeType: aws.String("VolumeType"),
  1207. }
  1208. resp, err := svc.CreateVolume(params)
  1209. if err != nil {
  1210. // Print the error, cast err to awserr.Error to get the Code and
  1211. // Message from an error.
  1212. fmt.Println(err.Error())
  1213. return
  1214. }
  1215. // Pretty-print the response data.
  1216. fmt.Println(resp)
  1217. }
  1218. func ExampleEC2_CreateVpc() {
  1219. sess, err := session.NewSession()
  1220. if err != nil {
  1221. fmt.Println("failed to create session,", err)
  1222. return
  1223. }
  1224. svc := ec2.New(sess)
  1225. params := &ec2.CreateVpcInput{
  1226. CidrBlock: aws.String("String"), // Required
  1227. DryRun: aws.Bool(true),
  1228. InstanceTenancy: aws.String("Tenancy"),
  1229. }
  1230. resp, err := svc.CreateVpc(params)
  1231. if err != nil {
  1232. // Print the error, cast err to awserr.Error to get the Code and
  1233. // Message from an error.
  1234. fmt.Println(err.Error())
  1235. return
  1236. }
  1237. // Pretty-print the response data.
  1238. fmt.Println(resp)
  1239. }
  1240. func ExampleEC2_CreateVpcEndpoint() {
  1241. sess, err := session.NewSession()
  1242. if err != nil {
  1243. fmt.Println("failed to create session,", err)
  1244. return
  1245. }
  1246. svc := ec2.New(sess)
  1247. params := &ec2.CreateVpcEndpointInput{
  1248. ServiceName: aws.String("String"), // Required
  1249. VpcId: aws.String("String"), // Required
  1250. ClientToken: aws.String("String"),
  1251. DryRun: aws.Bool(true),
  1252. PolicyDocument: aws.String("String"),
  1253. RouteTableIds: []*string{
  1254. aws.String("String"), // Required
  1255. // More values...
  1256. },
  1257. }
  1258. resp, err := svc.CreateVpcEndpoint(params)
  1259. if err != nil {
  1260. // Print the error, cast err to awserr.Error to get the Code and
  1261. // Message from an error.
  1262. fmt.Println(err.Error())
  1263. return
  1264. }
  1265. // Pretty-print the response data.
  1266. fmt.Println(resp)
  1267. }
  1268. func ExampleEC2_CreateVpcPeeringConnection() {
  1269. sess, err := session.NewSession()
  1270. if err != nil {
  1271. fmt.Println("failed to create session,", err)
  1272. return
  1273. }
  1274. svc := ec2.New(sess)
  1275. params := &ec2.CreateVpcPeeringConnectionInput{
  1276. DryRun: aws.Bool(true),
  1277. PeerOwnerId: aws.String("String"),
  1278. PeerVpcId: aws.String("String"),
  1279. VpcId: aws.String("String"),
  1280. }
  1281. resp, err := svc.CreateVpcPeeringConnection(params)
  1282. if err != nil {
  1283. // Print the error, cast err to awserr.Error to get the Code and
  1284. // Message from an error.
  1285. fmt.Println(err.Error())
  1286. return
  1287. }
  1288. // Pretty-print the response data.
  1289. fmt.Println(resp)
  1290. }
  1291. func ExampleEC2_CreateVpnConnection() {
  1292. sess, err := session.NewSession()
  1293. if err != nil {
  1294. fmt.Println("failed to create session,", err)
  1295. return
  1296. }
  1297. svc := ec2.New(sess)
  1298. params := &ec2.CreateVpnConnectionInput{
  1299. CustomerGatewayId: aws.String("String"), // Required
  1300. Type: aws.String("String"), // Required
  1301. VpnGatewayId: aws.String("String"), // Required
  1302. DryRun: aws.Bool(true),
  1303. Options: &ec2.VpnConnectionOptionsSpecification{
  1304. StaticRoutesOnly: aws.Bool(true),
  1305. },
  1306. }
  1307. resp, err := svc.CreateVpnConnection(params)
  1308. if err != nil {
  1309. // Print the error, cast err to awserr.Error to get the Code and
  1310. // Message from an error.
  1311. fmt.Println(err.Error())
  1312. return
  1313. }
  1314. // Pretty-print the response data.
  1315. fmt.Println(resp)
  1316. }
  1317. func ExampleEC2_CreateVpnConnectionRoute() {
  1318. sess, err := session.NewSession()
  1319. if err != nil {
  1320. fmt.Println("failed to create session,", err)
  1321. return
  1322. }
  1323. svc := ec2.New(sess)
  1324. params := &ec2.CreateVpnConnectionRouteInput{
  1325. DestinationCidrBlock: aws.String("String"), // Required
  1326. VpnConnectionId: aws.String("String"), // Required
  1327. }
  1328. resp, err := svc.CreateVpnConnectionRoute(params)
  1329. if err != nil {
  1330. // Print the error, cast err to awserr.Error to get the Code and
  1331. // Message from an error.
  1332. fmt.Println(err.Error())
  1333. return
  1334. }
  1335. // Pretty-print the response data.
  1336. fmt.Println(resp)
  1337. }
  1338. func ExampleEC2_CreateVpnGateway() {
  1339. sess, err := session.NewSession()
  1340. if err != nil {
  1341. fmt.Println("failed to create session,", err)
  1342. return
  1343. }
  1344. svc := ec2.New(sess)
  1345. params := &ec2.CreateVpnGatewayInput{
  1346. Type: aws.String("GatewayType"), // Required
  1347. AvailabilityZone: aws.String("String"),
  1348. DryRun: aws.Bool(true),
  1349. }
  1350. resp, err := svc.CreateVpnGateway(params)
  1351. if err != nil {
  1352. // Print the error, cast err to awserr.Error to get the Code and
  1353. // Message from an error.
  1354. fmt.Println(err.Error())
  1355. return
  1356. }
  1357. // Pretty-print the response data.
  1358. fmt.Println(resp)
  1359. }
  1360. func ExampleEC2_DeleteCustomerGateway() {
  1361. sess, err := session.NewSession()
  1362. if err != nil {
  1363. fmt.Println("failed to create session,", err)
  1364. return
  1365. }
  1366. svc := ec2.New(sess)
  1367. params := &ec2.DeleteCustomerGatewayInput{
  1368. CustomerGatewayId: aws.String("String"), // Required
  1369. DryRun: aws.Bool(true),
  1370. }
  1371. resp, err := svc.DeleteCustomerGateway(params)
  1372. if err != nil {
  1373. // Print the error, cast err to awserr.Error to get the Code and
  1374. // Message from an error.
  1375. fmt.Println(err.Error())
  1376. return
  1377. }
  1378. // Pretty-print the response data.
  1379. fmt.Println(resp)
  1380. }
  1381. func ExampleEC2_DeleteDhcpOptions() {
  1382. sess, err := session.NewSession()
  1383. if err != nil {
  1384. fmt.Println("failed to create session,", err)
  1385. return
  1386. }
  1387. svc := ec2.New(sess)
  1388. params := &ec2.DeleteDhcpOptionsInput{
  1389. DhcpOptionsId: aws.String("String"), // Required
  1390. DryRun: aws.Bool(true),
  1391. }
  1392. resp, err := svc.DeleteDhcpOptions(params)
  1393. if err != nil {
  1394. // Print the error, cast err to awserr.Error to get the Code and
  1395. // Message from an error.
  1396. fmt.Println(err.Error())
  1397. return
  1398. }
  1399. // Pretty-print the response data.
  1400. fmt.Println(resp)
  1401. }
  1402. func ExampleEC2_DeleteFlowLogs() {
  1403. sess, err := session.NewSession()
  1404. if err != nil {
  1405. fmt.Println("failed to create session,", err)
  1406. return
  1407. }
  1408. svc := ec2.New(sess)
  1409. params := &ec2.DeleteFlowLogsInput{
  1410. FlowLogIds: []*string{ // Required
  1411. aws.String("String"), // Required
  1412. // More values...
  1413. },
  1414. }
  1415. resp, err := svc.DeleteFlowLogs(params)
  1416. if err != nil {
  1417. // Print the error, cast err to awserr.Error to get the Code and
  1418. // Message from an error.
  1419. fmt.Println(err.Error())
  1420. return
  1421. }
  1422. // Pretty-print the response data.
  1423. fmt.Println(resp)
  1424. }
  1425. func ExampleEC2_DeleteInternetGateway() {
  1426. sess, err := session.NewSession()
  1427. if err != nil {
  1428. fmt.Println("failed to create session,", err)
  1429. return
  1430. }
  1431. svc := ec2.New(sess)
  1432. params := &ec2.DeleteInternetGatewayInput{
  1433. InternetGatewayId: aws.String("String"), // Required
  1434. DryRun: aws.Bool(true),
  1435. }
  1436. resp, err := svc.DeleteInternetGateway(params)
  1437. if err != nil {
  1438. // Print the error, cast err to awserr.Error to get the Code and
  1439. // Message from an error.
  1440. fmt.Println(err.Error())
  1441. return
  1442. }
  1443. // Pretty-print the response data.
  1444. fmt.Println(resp)
  1445. }
  1446. func ExampleEC2_DeleteKeyPair() {
  1447. sess, err := session.NewSession()
  1448. if err != nil {
  1449. fmt.Println("failed to create session,", err)
  1450. return
  1451. }
  1452. svc := ec2.New(sess)
  1453. params := &ec2.DeleteKeyPairInput{
  1454. KeyName: aws.String("String"), // Required
  1455. DryRun: aws.Bool(true),
  1456. }
  1457. resp, err := svc.DeleteKeyPair(params)
  1458. if err != nil {
  1459. // Print the error, cast err to awserr.Error to get the Code and
  1460. // Message from an error.
  1461. fmt.Println(err.Error())
  1462. return
  1463. }
  1464. // Pretty-print the response data.
  1465. fmt.Println(resp)
  1466. }
  1467. func ExampleEC2_DeleteNatGateway() {
  1468. sess, err := session.NewSession()
  1469. if err != nil {
  1470. fmt.Println("failed to create session,", err)
  1471. return
  1472. }
  1473. svc := ec2.New(sess)
  1474. params := &ec2.DeleteNatGatewayInput{
  1475. NatGatewayId: aws.String("String"), // Required
  1476. }
  1477. resp, err := svc.DeleteNatGateway(params)
  1478. if err != nil {
  1479. // Print the error, cast err to awserr.Error to get the Code and
  1480. // Message from an error.
  1481. fmt.Println(err.Error())
  1482. return
  1483. }
  1484. // Pretty-print the response data.
  1485. fmt.Println(resp)
  1486. }
  1487. func ExampleEC2_DeleteNetworkAcl() {
  1488. sess, err := session.NewSession()
  1489. if err != nil {
  1490. fmt.Println("failed to create session,", err)
  1491. return
  1492. }
  1493. svc := ec2.New(sess)
  1494. params := &ec2.DeleteNetworkAclInput{
  1495. NetworkAclId: aws.String("String"), // Required
  1496. DryRun: aws.Bool(true),
  1497. }
  1498. resp, err := svc.DeleteNetworkAcl(params)
  1499. if err != nil {
  1500. // Print the error, cast err to awserr.Error to get the Code and
  1501. // Message from an error.
  1502. fmt.Println(err.Error())
  1503. return
  1504. }
  1505. // Pretty-print the response data.
  1506. fmt.Println(resp)
  1507. }
  1508. func ExampleEC2_DeleteNetworkAclEntry() {
  1509. sess, err := session.NewSession()
  1510. if err != nil {
  1511. fmt.Println("failed to create session,", err)
  1512. return
  1513. }
  1514. svc := ec2.New(sess)
  1515. params := &ec2.DeleteNetworkAclEntryInput{
  1516. Egress: aws.Bool(true), // Required
  1517. NetworkAclId: aws.String("String"), // Required
  1518. RuleNumber: aws.Int64(1), // Required
  1519. DryRun: aws.Bool(true),
  1520. }
  1521. resp, err := svc.DeleteNetworkAclEntry(params)
  1522. if err != nil {
  1523. // Print the error, cast err to awserr.Error to get the Code and
  1524. // Message from an error.
  1525. fmt.Println(err.Error())
  1526. return
  1527. }
  1528. // Pretty-print the response data.
  1529. fmt.Println(resp)
  1530. }
  1531. func ExampleEC2_DeleteNetworkInterface() {
  1532. sess, err := session.NewSession()
  1533. if err != nil {
  1534. fmt.Println("failed to create session,", err)
  1535. return
  1536. }
  1537. svc := ec2.New(sess)
  1538. params := &ec2.DeleteNetworkInterfaceInput{
  1539. NetworkInterfaceId: aws.String("String"), // Required
  1540. DryRun: aws.Bool(true),
  1541. }
  1542. resp, err := svc.DeleteNetworkInterface(params)
  1543. if err != nil {
  1544. // Print the error, cast err to awserr.Error to get the Code and
  1545. // Message from an error.
  1546. fmt.Println(err.Error())
  1547. return
  1548. }
  1549. // Pretty-print the response data.
  1550. fmt.Println(resp)
  1551. }
  1552. func ExampleEC2_DeletePlacementGroup() {
  1553. sess, err := session.NewSession()
  1554. if err != nil {
  1555. fmt.Println("failed to create session,", err)
  1556. return
  1557. }
  1558. svc := ec2.New(sess)
  1559. params := &ec2.DeletePlacementGroupInput{
  1560. GroupName: aws.String("String"), // Required
  1561. DryRun: aws.Bool(true),
  1562. }
  1563. resp, err := svc.DeletePlacementGroup(params)
  1564. if err != nil {
  1565. // Print the error, cast err to awserr.Error to get the Code and
  1566. // Message from an error.
  1567. fmt.Println(err.Error())
  1568. return
  1569. }
  1570. // Pretty-print the response data.
  1571. fmt.Println(resp)
  1572. }
  1573. func ExampleEC2_DeleteRoute() {
  1574. sess, err := session.NewSession()
  1575. if err != nil {
  1576. fmt.Println("failed to create session,", err)
  1577. return
  1578. }
  1579. svc := ec2.New(sess)
  1580. params := &ec2.DeleteRouteInput{
  1581. DestinationCidrBlock: aws.String("String"), // Required
  1582. RouteTableId: aws.String("String"), // Required
  1583. DryRun: aws.Bool(true),
  1584. }
  1585. resp, err := svc.DeleteRoute(params)
  1586. if err != nil {
  1587. // Print the error, cast err to awserr.Error to get the Code and
  1588. // Message from an error.
  1589. fmt.Println(err.Error())
  1590. return
  1591. }
  1592. // Pretty-print the response data.
  1593. fmt.Println(resp)
  1594. }
  1595. func ExampleEC2_DeleteRouteTable() {
  1596. sess, err := session.NewSession()
  1597. if err != nil {
  1598. fmt.Println("failed to create session,", err)
  1599. return
  1600. }
  1601. svc := ec2.New(sess)
  1602. params := &ec2.DeleteRouteTableInput{
  1603. RouteTableId: aws.String("String"), // Required
  1604. DryRun: aws.Bool(true),
  1605. }
  1606. resp, err := svc.DeleteRouteTable(params)
  1607. if err != nil {
  1608. // Print the error, cast err to awserr.Error to get the Code and
  1609. // Message from an error.
  1610. fmt.Println(err.Error())
  1611. return
  1612. }
  1613. // Pretty-print the response data.
  1614. fmt.Println(resp)
  1615. }
  1616. func ExampleEC2_DeleteSecurityGroup() {
  1617. sess, err := session.NewSession()
  1618. if err != nil {
  1619. fmt.Println("failed to create session,", err)
  1620. return
  1621. }
  1622. svc := ec2.New(sess)
  1623. params := &ec2.DeleteSecurityGroupInput{
  1624. DryRun: aws.Bool(true),
  1625. GroupId: aws.String("String"),
  1626. GroupName: aws.String("String"),
  1627. }
  1628. resp, err := svc.DeleteSecurityGroup(params)
  1629. if err != nil {
  1630. // Print the error, cast err to awserr.Error to get the Code and
  1631. // Message from an error.
  1632. fmt.Println(err.Error())
  1633. return
  1634. }
  1635. // Pretty-print the response data.
  1636. fmt.Println(resp)
  1637. }
  1638. func ExampleEC2_DeleteSnapshot() {
  1639. sess, err := session.NewSession()
  1640. if err != nil {
  1641. fmt.Println("failed to create session,", err)
  1642. return
  1643. }
  1644. svc := ec2.New(sess)
  1645. params := &ec2.DeleteSnapshotInput{
  1646. SnapshotId: aws.String("String"), // Required
  1647. DryRun: aws.Bool(true),
  1648. }
  1649. resp, err := svc.DeleteSnapshot(params)
  1650. if err != nil {
  1651. // Print the error, cast err to awserr.Error to get the Code and
  1652. // Message from an error.
  1653. fmt.Println(err.Error())
  1654. return
  1655. }
  1656. // Pretty-print the response data.
  1657. fmt.Println(resp)
  1658. }
  1659. func ExampleEC2_DeleteSpotDatafeedSubscription() {
  1660. sess, err := session.NewSession()
  1661. if err != nil {
  1662. fmt.Println("failed to create session,", err)
  1663. return
  1664. }
  1665. svc := ec2.New(sess)
  1666. params := &ec2.DeleteSpotDatafeedSubscriptionInput{
  1667. DryRun: aws.Bool(true),
  1668. }
  1669. resp, err := svc.DeleteSpotDatafeedSubscription(params)
  1670. if err != nil {
  1671. // Print the error, cast err to awserr.Error to get the Code and
  1672. // Message from an error.
  1673. fmt.Println(err.Error())
  1674. return
  1675. }
  1676. // Pretty-print the response data.
  1677. fmt.Println(resp)
  1678. }
  1679. func ExampleEC2_DeleteSubnet() {
  1680. sess, err := session.NewSession()
  1681. if err != nil {
  1682. fmt.Println("failed to create session,", err)
  1683. return
  1684. }
  1685. svc := ec2.New(sess)
  1686. params := &ec2.DeleteSubnetInput{
  1687. SubnetId: aws.String("String"), // Required
  1688. DryRun: aws.Bool(true),
  1689. }
  1690. resp, err := svc.DeleteSubnet(params)
  1691. if err != nil {
  1692. // Print the error, cast err to awserr.Error to get the Code and
  1693. // Message from an error.
  1694. fmt.Println(err.Error())
  1695. return
  1696. }
  1697. // Pretty-print the response data.
  1698. fmt.Println(resp)
  1699. }
  1700. func ExampleEC2_DeleteTags() {
  1701. sess, err := session.NewSession()
  1702. if err != nil {
  1703. fmt.Println("failed to create session,", err)
  1704. return
  1705. }
  1706. svc := ec2.New(sess)
  1707. params := &ec2.DeleteTagsInput{
  1708. Resources: []*string{ // Required
  1709. aws.String("String"), // Required
  1710. // More values...
  1711. },
  1712. DryRun: aws.Bool(true),
  1713. Tags: []*ec2.Tag{
  1714. { // Required
  1715. Key: aws.String("String"),
  1716. Value: aws.String("String"),
  1717. },
  1718. // More values...
  1719. },
  1720. }
  1721. resp, err := svc.DeleteTags(params)
  1722. if err != nil {
  1723. // Print the error, cast err to awserr.Error to get the Code and
  1724. // Message from an error.
  1725. fmt.Println(err.Error())
  1726. return
  1727. }
  1728. // Pretty-print the response data.
  1729. fmt.Println(resp)
  1730. }
  1731. func ExampleEC2_DeleteVolume() {
  1732. sess, err := session.NewSession()
  1733. if err != nil {
  1734. fmt.Println("failed to create session,", err)
  1735. return
  1736. }
  1737. svc := ec2.New(sess)
  1738. params := &ec2.DeleteVolumeInput{
  1739. VolumeId: aws.String("String"), // Required
  1740. DryRun: aws.Bool(true),
  1741. }
  1742. resp, err := svc.DeleteVolume(params)
  1743. if err != nil {
  1744. // Print the error, cast err to awserr.Error to get the Code and
  1745. // Message from an error.
  1746. fmt.Println(err.Error())
  1747. return
  1748. }
  1749. // Pretty-print the response data.
  1750. fmt.Println(resp)
  1751. }
  1752. func ExampleEC2_DeleteVpc() {
  1753. sess, err := session.NewSession()
  1754. if err != nil {
  1755. fmt.Println("failed to create session,", err)
  1756. return
  1757. }
  1758. svc := ec2.New(sess)
  1759. params := &ec2.DeleteVpcInput{
  1760. VpcId: aws.String("String"), // Required
  1761. DryRun: aws.Bool(true),
  1762. }
  1763. resp, err := svc.DeleteVpc(params)
  1764. if err != nil {
  1765. // Print the error, cast err to awserr.Error to get the Code and
  1766. // Message from an error.
  1767. fmt.Println(err.Error())
  1768. return
  1769. }
  1770. // Pretty-print the response data.
  1771. fmt.Println(resp)
  1772. }
  1773. func ExampleEC2_DeleteVpcEndpoints() {
  1774. sess, err := session.NewSession()
  1775. if err != nil {
  1776. fmt.Println("failed to create session,", err)
  1777. return
  1778. }
  1779. svc := ec2.New(sess)
  1780. params := &ec2.DeleteVpcEndpointsInput{
  1781. VpcEndpointIds: []*string{ // Required
  1782. aws.String("String"), // Required
  1783. // More values...
  1784. },
  1785. DryRun: aws.Bool(true),
  1786. }
  1787. resp, err := svc.DeleteVpcEndpoints(params)
  1788. if err != nil {
  1789. // Print the error, cast err to awserr.Error to get the Code and
  1790. // Message from an error.
  1791. fmt.Println(err.Error())
  1792. return
  1793. }
  1794. // Pretty-print the response data.
  1795. fmt.Println(resp)
  1796. }
  1797. func ExampleEC2_DeleteVpcPeeringConnection() {
  1798. sess, err := session.NewSession()
  1799. if err != nil {
  1800. fmt.Println("failed to create session,", err)
  1801. return
  1802. }
  1803. svc := ec2.New(sess)
  1804. params := &ec2.DeleteVpcPeeringConnectionInput{
  1805. VpcPeeringConnectionId: aws.String("String"), // Required
  1806. DryRun: aws.Bool(true),
  1807. }
  1808. resp, err := svc.DeleteVpcPeeringConnection(params)
  1809. if err != nil {
  1810. // Print the error, cast err to awserr.Error to get the Code and
  1811. // Message from an error.
  1812. fmt.Println(err.Error())
  1813. return
  1814. }
  1815. // Pretty-print the response data.
  1816. fmt.Println(resp)
  1817. }
  1818. func ExampleEC2_DeleteVpnConnection() {
  1819. sess, err := session.NewSession()
  1820. if err != nil {
  1821. fmt.Println("failed to create session,", err)
  1822. return
  1823. }
  1824. svc := ec2.New(sess)
  1825. params := &ec2.DeleteVpnConnectionInput{
  1826. VpnConnectionId: aws.String("String"), // Required
  1827. DryRun: aws.Bool(true),
  1828. }
  1829. resp, err := svc.DeleteVpnConnection(params)
  1830. if err != nil {
  1831. // Print the error, cast err to awserr.Error to get the Code and
  1832. // Message from an error.
  1833. fmt.Println(err.Error())
  1834. return
  1835. }
  1836. // Pretty-print the response data.
  1837. fmt.Println(resp)
  1838. }
  1839. func ExampleEC2_DeleteVpnConnectionRoute() {
  1840. sess, err := session.NewSession()
  1841. if err != nil {
  1842. fmt.Println("failed to create session,", err)
  1843. return
  1844. }
  1845. svc := ec2.New(sess)
  1846. params := &ec2.DeleteVpnConnectionRouteInput{
  1847. DestinationCidrBlock: aws.String("String"), // Required
  1848. VpnConnectionId: aws.String("String"), // Required
  1849. }
  1850. resp, err := svc.DeleteVpnConnectionRoute(params)
  1851. if err != nil {
  1852. // Print the error, cast err to awserr.Error to get the Code and
  1853. // Message from an error.
  1854. fmt.Println(err.Error())
  1855. return
  1856. }
  1857. // Pretty-print the response data.
  1858. fmt.Println(resp)
  1859. }
  1860. func ExampleEC2_DeleteVpnGateway() {
  1861. sess, err := session.NewSession()
  1862. if err != nil {
  1863. fmt.Println("failed to create session,", err)
  1864. return
  1865. }
  1866. svc := ec2.New(sess)
  1867. params := &ec2.DeleteVpnGatewayInput{
  1868. VpnGatewayId: aws.String("String"), // Required
  1869. DryRun: aws.Bool(true),
  1870. }
  1871. resp, err := svc.DeleteVpnGateway(params)
  1872. if err != nil {
  1873. // Print the error, cast err to awserr.Error to get the Code and
  1874. // Message from an error.
  1875. fmt.Println(err.Error())
  1876. return
  1877. }
  1878. // Pretty-print the response data.
  1879. fmt.Println(resp)
  1880. }
  1881. func ExampleEC2_DeregisterImage() {
  1882. sess, err := session.NewSession()
  1883. if err != nil {
  1884. fmt.Println("failed to create session,", err)
  1885. return
  1886. }
  1887. svc := ec2.New(sess)
  1888. params := &ec2.DeregisterImageInput{
  1889. ImageId: aws.String("String"), // Required
  1890. DryRun: aws.Bool(true),
  1891. }
  1892. resp, err := svc.DeregisterImage(params)
  1893. if err != nil {
  1894. // Print the error, cast err to awserr.Error to get the Code and
  1895. // Message from an error.
  1896. fmt.Println(err.Error())
  1897. return
  1898. }
  1899. // Pretty-print the response data.
  1900. fmt.Println(resp)
  1901. }
  1902. func ExampleEC2_DescribeAccountAttributes() {
  1903. sess, err := session.NewSession()
  1904. if err != nil {
  1905. fmt.Println("failed to create session,", err)
  1906. return
  1907. }
  1908. svc := ec2.New(sess)
  1909. params := &ec2.DescribeAccountAttributesInput{
  1910. AttributeNames: []*string{
  1911. aws.String("AccountAttributeName"), // Required
  1912. // More values...
  1913. },
  1914. DryRun: aws.Bool(true),
  1915. }
  1916. resp, err := svc.DescribeAccountAttributes(params)
  1917. if err != nil {
  1918. // Print the error, cast err to awserr.Error to get the Code and
  1919. // Message from an error.
  1920. fmt.Println(err.Error())
  1921. return
  1922. }
  1923. // Pretty-print the response data.
  1924. fmt.Println(resp)
  1925. }
  1926. func ExampleEC2_DescribeAddresses() {
  1927. sess, err := session.NewSession()
  1928. if err != nil {
  1929. fmt.Println("failed to create session,", err)
  1930. return
  1931. }
  1932. svc := ec2.New(sess)
  1933. params := &ec2.DescribeAddressesInput{
  1934. AllocationIds: []*string{
  1935. aws.String("String"), // Required
  1936. // More values...
  1937. },
  1938. DryRun: aws.Bool(true),
  1939. Filters: []*ec2.Filter{
  1940. { // Required
  1941. Name: aws.String("String"),
  1942. Values: []*string{
  1943. aws.String("String"), // Required
  1944. // More values...
  1945. },
  1946. },
  1947. // More values...
  1948. },
  1949. PublicIps: []*string{
  1950. aws.String("String"), // Required
  1951. // More values...
  1952. },
  1953. }
  1954. resp, err := svc.DescribeAddresses(params)
  1955. if err != nil {
  1956. // Print the error, cast err to awserr.Error to get the Code and
  1957. // Message from an error.
  1958. fmt.Println(err.Error())
  1959. return
  1960. }
  1961. // Pretty-print the response data.
  1962. fmt.Println(resp)
  1963. }
  1964. func ExampleEC2_DescribeAvailabilityZones() {
  1965. sess, err := session.NewSession()
  1966. if err != nil {
  1967. fmt.Println("failed to create session,", err)
  1968. return
  1969. }
  1970. svc := ec2.New(sess)
  1971. params := &ec2.DescribeAvailabilityZonesInput{
  1972. DryRun: aws.Bool(true),
  1973. Filters: []*ec2.Filter{
  1974. { // Required
  1975. Name: aws.String("String"),
  1976. Values: []*string{
  1977. aws.String("String"), // Required
  1978. // More values...
  1979. },
  1980. },
  1981. // More values...
  1982. },
  1983. ZoneNames: []*string{
  1984. aws.String("String"), // Required
  1985. // More values...
  1986. },
  1987. }
  1988. resp, err := svc.DescribeAvailabilityZones(params)
  1989. if err != nil {
  1990. // Print the error, cast err to awserr.Error to get the Code and
  1991. // Message from an error.
  1992. fmt.Println(err.Error())
  1993. return
  1994. }
  1995. // Pretty-print the response data.
  1996. fmt.Println(resp)
  1997. }
  1998. func ExampleEC2_DescribeBundleTasks() {
  1999. sess, err := session.NewSession()
  2000. if err != nil {
  2001. fmt.Println("failed to create session,", err)
  2002. return
  2003. }
  2004. svc := ec2.New(sess)
  2005. params := &ec2.DescribeBundleTasksInput{
  2006. BundleIds: []*string{
  2007. aws.String("String"), // Required
  2008. // More values...
  2009. },
  2010. DryRun: aws.Bool(true),
  2011. Filters: []*ec2.Filter{
  2012. { // Required
  2013. Name: aws.String("String"),
  2014. Values: []*string{
  2015. aws.String("String"), // Required
  2016. // More values...
  2017. },
  2018. },
  2019. // More values...
  2020. },
  2021. }
  2022. resp, err := svc.DescribeBundleTasks(params)
  2023. if err != nil {
  2024. // Print the error, cast err to awserr.Error to get the Code and
  2025. // Message from an error.
  2026. fmt.Println(err.Error())
  2027. return
  2028. }
  2029. // Pretty-print the response data.
  2030. fmt.Println(resp)
  2031. }
  2032. func ExampleEC2_DescribeClassicLinkInstances() {
  2033. sess, err := session.NewSession()
  2034. if err != nil {
  2035. fmt.Println("failed to create session,", err)
  2036. return
  2037. }
  2038. svc := ec2.New(sess)
  2039. params := &ec2.DescribeClassicLinkInstancesInput{
  2040. DryRun: aws.Bool(true),
  2041. Filters: []*ec2.Filter{
  2042. { // Required
  2043. Name: aws.String("String"),
  2044. Values: []*string{
  2045. aws.String("String"), // Required
  2046. // More values...
  2047. },
  2048. },
  2049. // More values...
  2050. },
  2051. InstanceIds: []*string{
  2052. aws.String("String"), // Required
  2053. // More values...
  2054. },
  2055. MaxResults: aws.Int64(1),
  2056. NextToken: aws.String("String"),
  2057. }
  2058. resp, err := svc.DescribeClassicLinkInstances(params)
  2059. if err != nil {
  2060. // Print the error, cast err to awserr.Error to get the Code and
  2061. // Message from an error.
  2062. fmt.Println(err.Error())
  2063. return
  2064. }
  2065. // Pretty-print the response data.
  2066. fmt.Println(resp)
  2067. }
  2068. func ExampleEC2_DescribeConversionTasks() {
  2069. sess, err := session.NewSession()
  2070. if err != nil {
  2071. fmt.Println("failed to create session,", err)
  2072. return
  2073. }
  2074. svc := ec2.New(sess)
  2075. params := &ec2.DescribeConversionTasksInput{
  2076. ConversionTaskIds: []*string{
  2077. aws.String("String"), // Required
  2078. // More values...
  2079. },
  2080. DryRun: aws.Bool(true),
  2081. Filters: []*ec2.Filter{
  2082. { // Required
  2083. Name: aws.String("String"),
  2084. Values: []*string{
  2085. aws.String("String"), // Required
  2086. // More values...
  2087. },
  2088. },
  2089. // More values...
  2090. },
  2091. }
  2092. resp, err := svc.DescribeConversionTasks(params)
  2093. if err != nil {
  2094. // Print the error, cast err to awserr.Error to get the Code and
  2095. // Message from an error.
  2096. fmt.Println(err.Error())
  2097. return
  2098. }
  2099. // Pretty-print the response data.
  2100. fmt.Println(resp)
  2101. }
  2102. func ExampleEC2_DescribeCustomerGateways() {
  2103. sess, err := session.NewSession()
  2104. if err != nil {
  2105. fmt.Println("failed to create session,", err)
  2106. return
  2107. }
  2108. svc := ec2.New(sess)
  2109. params := &ec2.DescribeCustomerGatewaysInput{
  2110. CustomerGatewayIds: []*string{
  2111. aws.String("String"), // Required
  2112. // More values...
  2113. },
  2114. DryRun: aws.Bool(true),
  2115. Filters: []*ec2.Filter{
  2116. { // Required
  2117. Name: aws.String("String"),
  2118. Values: []*string{
  2119. aws.String("String"), // Required
  2120. // More values...
  2121. },
  2122. },
  2123. // More values...
  2124. },
  2125. }
  2126. resp, err := svc.DescribeCustomerGateways(params)
  2127. if err != nil {
  2128. // Print the error, cast err to awserr.Error to get the Code and
  2129. // Message from an error.
  2130. fmt.Println(err.Error())
  2131. return
  2132. }
  2133. // Pretty-print the response data.
  2134. fmt.Println(resp)
  2135. }
  2136. func ExampleEC2_DescribeDhcpOptions() {
  2137. sess, err := session.NewSession()
  2138. if err != nil {
  2139. fmt.Println("failed to create session,", err)
  2140. return
  2141. }
  2142. svc := ec2.New(sess)
  2143. params := &ec2.DescribeDhcpOptionsInput{
  2144. DhcpOptionsIds: []*string{
  2145. aws.String("String"), // Required
  2146. // More values...
  2147. },
  2148. DryRun: aws.Bool(true),
  2149. Filters: []*ec2.Filter{
  2150. { // Required
  2151. Name: aws.String("String"),
  2152. Values: []*string{
  2153. aws.String("String"), // Required
  2154. // More values...
  2155. },
  2156. },
  2157. // More values...
  2158. },
  2159. }
  2160. resp, err := svc.DescribeDhcpOptions(params)
  2161. if err != nil {
  2162. // Print the error, cast err to awserr.Error to get the Code and
  2163. // Message from an error.
  2164. fmt.Println(err.Error())
  2165. return
  2166. }
  2167. // Pretty-print the response data.
  2168. fmt.Println(resp)
  2169. }
  2170. func ExampleEC2_DescribeExportTasks() {
  2171. sess, err := session.NewSession()
  2172. if err != nil {
  2173. fmt.Println("failed to create session,", err)
  2174. return
  2175. }
  2176. svc := ec2.New(sess)
  2177. params := &ec2.DescribeExportTasksInput{
  2178. ExportTaskIds: []*string{
  2179. aws.String("String"), // Required
  2180. // More values...
  2181. },
  2182. }
  2183. resp, err := svc.DescribeExportTasks(params)
  2184. if err != nil {
  2185. // Print the error, cast err to awserr.Error to get the Code and
  2186. // Message from an error.
  2187. fmt.Println(err.Error())
  2188. return
  2189. }
  2190. // Pretty-print the response data.
  2191. fmt.Println(resp)
  2192. }
  2193. func ExampleEC2_DescribeFlowLogs() {
  2194. sess, err := session.NewSession()
  2195. if err != nil {
  2196. fmt.Println("failed to create session,", err)
  2197. return
  2198. }
  2199. svc := ec2.New(sess)
  2200. params := &ec2.DescribeFlowLogsInput{
  2201. Filter: []*ec2.Filter{
  2202. { // Required
  2203. Name: aws.String("String"),
  2204. Values: []*string{
  2205. aws.String("String"), // Required
  2206. // More values...
  2207. },
  2208. },
  2209. // More values...
  2210. },
  2211. FlowLogIds: []*string{
  2212. aws.String("String"), // Required
  2213. // More values...
  2214. },
  2215. MaxResults: aws.Int64(1),
  2216. NextToken: aws.String("String"),
  2217. }
  2218. resp, err := svc.DescribeFlowLogs(params)
  2219. if err != nil {
  2220. // Print the error, cast err to awserr.Error to get the Code and
  2221. // Message from an error.
  2222. fmt.Println(err.Error())
  2223. return
  2224. }
  2225. // Pretty-print the response data.
  2226. fmt.Println(resp)
  2227. }
  2228. func ExampleEC2_DescribeHosts() {
  2229. sess, err := session.NewSession()
  2230. if err != nil {
  2231. fmt.Println("failed to create session,", err)
  2232. return
  2233. }
  2234. svc := ec2.New(sess)
  2235. params := &ec2.DescribeHostsInput{
  2236. Filter: []*ec2.Filter{
  2237. { // Required
  2238. Name: aws.String("String"),
  2239. Values: []*string{
  2240. aws.String("String"), // Required
  2241. // More values...
  2242. },
  2243. },
  2244. // More values...
  2245. },
  2246. HostIds: []*string{
  2247. aws.String("String"), // Required
  2248. // More values...
  2249. },
  2250. MaxResults: aws.Int64(1),
  2251. NextToken: aws.String("String"),
  2252. }
  2253. resp, err := svc.DescribeHosts(params)
  2254. if err != nil {
  2255. // Print the error, cast err to awserr.Error to get the Code and
  2256. // Message from an error.
  2257. fmt.Println(err.Error())
  2258. return
  2259. }
  2260. // Pretty-print the response data.
  2261. fmt.Println(resp)
  2262. }
  2263. func ExampleEC2_DescribeIdFormat() {
  2264. sess, err := session.NewSession()
  2265. if err != nil {
  2266. fmt.Println("failed to create session,", err)
  2267. return
  2268. }
  2269. svc := ec2.New(sess)
  2270. params := &ec2.DescribeIdFormatInput{
  2271. Resource: aws.String("String"),
  2272. }
  2273. resp, err := svc.DescribeIdFormat(params)
  2274. if err != nil {
  2275. // Print the error, cast err to awserr.Error to get the Code and
  2276. // Message from an error.
  2277. fmt.Println(err.Error())
  2278. return
  2279. }
  2280. // Pretty-print the response data.
  2281. fmt.Println(resp)
  2282. }
  2283. func ExampleEC2_DescribeIdentityIdFormat() {
  2284. sess, err := session.NewSession()
  2285. if err != nil {
  2286. fmt.Println("failed to create session,", err)
  2287. return
  2288. }
  2289. svc := ec2.New(sess)
  2290. params := &ec2.DescribeIdentityIdFormatInput{
  2291. PrincipalArn: aws.String("String"), // Required
  2292. Resource: aws.String("String"),
  2293. }
  2294. resp, err := svc.DescribeIdentityIdFormat(params)
  2295. if err != nil {
  2296. // Print the error, cast err to awserr.Error to get the Code and
  2297. // Message from an error.
  2298. fmt.Println(err.Error())
  2299. return
  2300. }
  2301. // Pretty-print the response data.
  2302. fmt.Println(resp)
  2303. }
  2304. func ExampleEC2_DescribeImageAttribute() {
  2305. sess, err := session.NewSession()
  2306. if err != nil {
  2307. fmt.Println("failed to create session,", err)
  2308. return
  2309. }
  2310. svc := ec2.New(sess)
  2311. params := &ec2.DescribeImageAttributeInput{
  2312. Attribute: aws.String("ImageAttributeName"), // Required
  2313. ImageId: aws.String("String"), // Required
  2314. DryRun: aws.Bool(true),
  2315. }
  2316. resp, err := svc.DescribeImageAttribute(params)
  2317. if err != nil {
  2318. // Print the error, cast err to awserr.Error to get the Code and
  2319. // Message from an error.
  2320. fmt.Println(err.Error())
  2321. return
  2322. }
  2323. // Pretty-print the response data.
  2324. fmt.Println(resp)
  2325. }
  2326. func ExampleEC2_DescribeImages() {
  2327. sess, err := session.NewSession()
  2328. if err != nil {
  2329. fmt.Println("failed to create session,", err)
  2330. return
  2331. }
  2332. svc := ec2.New(sess)
  2333. params := &ec2.DescribeImagesInput{
  2334. DryRun: aws.Bool(true),
  2335. ExecutableUsers: []*string{
  2336. aws.String("String"), // Required
  2337. // More values...
  2338. },
  2339. Filters: []*ec2.Filter{
  2340. { // Required
  2341. Name: aws.String("String"),
  2342. Values: []*string{
  2343. aws.String("String"), // Required
  2344. // More values...
  2345. },
  2346. },
  2347. // More values...
  2348. },
  2349. ImageIds: []*string{
  2350. aws.String("String"), // Required
  2351. // More values...
  2352. },
  2353. Owners: []*string{
  2354. aws.String("String"), // Required
  2355. // More values...
  2356. },
  2357. }
  2358. resp, err := svc.DescribeImages(params)
  2359. if err != nil {
  2360. // Print the error, cast err to awserr.Error to get the Code and
  2361. // Message from an error.
  2362. fmt.Println(err.Error())
  2363. return
  2364. }
  2365. // Pretty-print the response data.
  2366. fmt.Println(resp)
  2367. }
  2368. func ExampleEC2_DescribeImportImageTasks() {
  2369. sess, err := session.NewSession()
  2370. if err != nil {
  2371. fmt.Println("failed to create session,", err)
  2372. return
  2373. }
  2374. svc := ec2.New(sess)
  2375. params := &ec2.DescribeImportImageTasksInput{
  2376. DryRun: aws.Bool(true),
  2377. Filters: []*ec2.Filter{
  2378. { // Required
  2379. Name: aws.String("String"),
  2380. Values: []*string{
  2381. aws.String("String"), // Required
  2382. // More values...
  2383. },
  2384. },
  2385. // More values...
  2386. },
  2387. ImportTaskIds: []*string{
  2388. aws.String("String"), // Required
  2389. // More values...
  2390. },
  2391. MaxResults: aws.Int64(1),
  2392. NextToken: aws.String("String"),
  2393. }
  2394. resp, err := svc.DescribeImportImageTasks(params)
  2395. if err != nil {
  2396. // Print the error, cast err to awserr.Error to get the Code and
  2397. // Message from an error.
  2398. fmt.Println(err.Error())
  2399. return
  2400. }
  2401. // Pretty-print the response data.
  2402. fmt.Println(resp)
  2403. }
  2404. func ExampleEC2_DescribeImportSnapshotTasks() {
  2405. sess, err := session.NewSession()
  2406. if err != nil {
  2407. fmt.Println("failed to create session,", err)
  2408. return
  2409. }
  2410. svc := ec2.New(sess)
  2411. params := &ec2.DescribeImportSnapshotTasksInput{
  2412. DryRun: aws.Bool(true),
  2413. Filters: []*ec2.Filter{
  2414. { // Required
  2415. Name: aws.String("String"),
  2416. Values: []*string{
  2417. aws.String("String"), // Required
  2418. // More values...
  2419. },
  2420. },
  2421. // More values...
  2422. },
  2423. ImportTaskIds: []*string{
  2424. aws.String("String"), // Required
  2425. // More values...
  2426. },
  2427. MaxResults: aws.Int64(1),
  2428. NextToken: aws.String("String"),
  2429. }
  2430. resp, err := svc.DescribeImportSnapshotTasks(params)
  2431. if err != nil {
  2432. // Print the error, cast err to awserr.Error to get the Code and
  2433. // Message from an error.
  2434. fmt.Println(err.Error())
  2435. return
  2436. }
  2437. // Pretty-print the response data.
  2438. fmt.Println(resp)
  2439. }
  2440. func ExampleEC2_DescribeInstanceAttribute() {
  2441. sess, err := session.NewSession()
  2442. if err != nil {
  2443. fmt.Println("failed to create session,", err)
  2444. return
  2445. }
  2446. svc := ec2.New(sess)
  2447. params := &ec2.DescribeInstanceAttributeInput{
  2448. Attribute: aws.String("InstanceAttributeName"), // Required
  2449. InstanceId: aws.String("String"), // Required
  2450. DryRun: aws.Bool(true),
  2451. }
  2452. resp, err := svc.DescribeInstanceAttribute(params)
  2453. if err != nil {
  2454. // Print the error, cast err to awserr.Error to get the Code and
  2455. // Message from an error.
  2456. fmt.Println(err.Error())
  2457. return
  2458. }
  2459. // Pretty-print the response data.
  2460. fmt.Println(resp)
  2461. }
  2462. func ExampleEC2_DescribeInstanceStatus() {
  2463. sess, err := session.NewSession()
  2464. if err != nil {
  2465. fmt.Println("failed to create session,", err)
  2466. return
  2467. }
  2468. svc := ec2.New(sess)
  2469. params := &ec2.DescribeInstanceStatusInput{
  2470. DryRun: aws.Bool(true),
  2471. Filters: []*ec2.Filter{
  2472. { // Required
  2473. Name: aws.String("String"),
  2474. Values: []*string{
  2475. aws.String("String"), // Required
  2476. // More values...
  2477. },
  2478. },
  2479. // More values...
  2480. },
  2481. IncludeAllInstances: aws.Bool(true),
  2482. InstanceIds: []*string{
  2483. aws.String("String"), // Required
  2484. // More values...
  2485. },
  2486. MaxResults: aws.Int64(1),
  2487. NextToken: aws.String("String"),
  2488. }
  2489. resp, err := svc.DescribeInstanceStatus(params)
  2490. if err != nil {
  2491. // Print the error, cast err to awserr.Error to get the Code and
  2492. // Message from an error.
  2493. fmt.Println(err.Error())
  2494. return
  2495. }
  2496. // Pretty-print the response data.
  2497. fmt.Println(resp)
  2498. }
  2499. func ExampleEC2_DescribeInstances() {
  2500. sess, err := session.NewSession()
  2501. if err != nil {
  2502. fmt.Println("failed to create session,", err)
  2503. return
  2504. }
  2505. svc := ec2.New(sess)
  2506. params := &ec2.DescribeInstancesInput{
  2507. DryRun: aws.Bool(true),
  2508. Filters: []*ec2.Filter{
  2509. { // Required
  2510. Name: aws.String("String"),
  2511. Values: []*string{
  2512. aws.String("String"), // Required
  2513. // More values...
  2514. },
  2515. },
  2516. // More values...
  2517. },
  2518. InstanceIds: []*string{
  2519. aws.String("String"), // Required
  2520. // More values...
  2521. },
  2522. MaxResults: aws.Int64(1),
  2523. NextToken: aws.String("String"),
  2524. }
  2525. resp, err := svc.DescribeInstances(params)
  2526. if err != nil {
  2527. // Print the error, cast err to awserr.Error to get the Code and
  2528. // Message from an error.
  2529. fmt.Println(err.Error())
  2530. return
  2531. }
  2532. // Pretty-print the response data.
  2533. fmt.Println(resp)
  2534. }
  2535. func ExampleEC2_DescribeInternetGateways() {
  2536. sess, err := session.NewSession()
  2537. if err != nil {
  2538. fmt.Println("failed to create session,", err)
  2539. return
  2540. }
  2541. svc := ec2.New(sess)
  2542. params := &ec2.DescribeInternetGatewaysInput{
  2543. DryRun: aws.Bool(true),
  2544. Filters: []*ec2.Filter{
  2545. { // Required
  2546. Name: aws.String("String"),
  2547. Values: []*string{
  2548. aws.String("String"), // Required
  2549. // More values...
  2550. },
  2551. },
  2552. // More values...
  2553. },
  2554. InternetGatewayIds: []*string{
  2555. aws.String("String"), // Required
  2556. // More values...
  2557. },
  2558. }
  2559. resp, err := svc.DescribeInternetGateways(params)
  2560. if err != nil {
  2561. // Print the error, cast err to awserr.Error to get the Code and
  2562. // Message from an error.
  2563. fmt.Println(err.Error())
  2564. return
  2565. }
  2566. // Pretty-print the response data.
  2567. fmt.Println(resp)
  2568. }
  2569. func ExampleEC2_DescribeKeyPairs() {
  2570. sess, err := session.NewSession()
  2571. if err != nil {
  2572. fmt.Println("failed to create session,", err)
  2573. return
  2574. }
  2575. svc := ec2.New(sess)
  2576. params := &ec2.DescribeKeyPairsInput{
  2577. DryRun: aws.Bool(true),
  2578. Filters: []*ec2.Filter{
  2579. { // Required
  2580. Name: aws.String("String"),
  2581. Values: []*string{
  2582. aws.String("String"), // Required
  2583. // More values...
  2584. },
  2585. },
  2586. // More values...
  2587. },
  2588. KeyNames: []*string{
  2589. aws.String("String"), // Required
  2590. // More values...
  2591. },
  2592. }
  2593. resp, err := svc.DescribeKeyPairs(params)
  2594. if err != nil {
  2595. // Print the error, cast err to awserr.Error to get the Code and
  2596. // Message from an error.
  2597. fmt.Println(err.Error())
  2598. return
  2599. }
  2600. // Pretty-print the response data.
  2601. fmt.Println(resp)
  2602. }
  2603. func ExampleEC2_DescribeMovingAddresses() {
  2604. sess, err := session.NewSession()
  2605. if err != nil {
  2606. fmt.Println("failed to create session,", err)
  2607. return
  2608. }
  2609. svc := ec2.New(sess)
  2610. params := &ec2.DescribeMovingAddressesInput{
  2611. DryRun: aws.Bool(true),
  2612. Filters: []*ec2.Filter{
  2613. { // Required
  2614. Name: aws.String("String"),
  2615. Values: []*string{
  2616. aws.String("String"), // Required
  2617. // More values...
  2618. },
  2619. },
  2620. // More values...
  2621. },
  2622. MaxResults: aws.Int64(1),
  2623. NextToken: aws.String("String"),
  2624. PublicIps: []*string{
  2625. aws.String("String"), // Required
  2626. // More values...
  2627. },
  2628. }
  2629. resp, err := svc.DescribeMovingAddresses(params)
  2630. if err != nil {
  2631. // Print the error, cast err to awserr.Error to get the Code and
  2632. // Message from an error.
  2633. fmt.Println(err.Error())
  2634. return
  2635. }
  2636. // Pretty-print the response data.
  2637. fmt.Println(resp)
  2638. }
  2639. func ExampleEC2_DescribeNatGateways() {
  2640. sess, err := session.NewSession()
  2641. if err != nil {
  2642. fmt.Println("failed to create session,", err)
  2643. return
  2644. }
  2645. svc := ec2.New(sess)
  2646. params := &ec2.DescribeNatGatewaysInput{
  2647. Filter: []*ec2.Filter{
  2648. { // Required
  2649. Name: aws.String("String"),
  2650. Values: []*string{
  2651. aws.String("String"), // Required
  2652. // More values...
  2653. },
  2654. },
  2655. // More values...
  2656. },
  2657. MaxResults: aws.Int64(1),
  2658. NatGatewayIds: []*string{
  2659. aws.String("String"), // Required
  2660. // More values...
  2661. },
  2662. NextToken: aws.String("String"),
  2663. }
  2664. resp, err := svc.DescribeNatGateways(params)
  2665. if err != nil {
  2666. // Print the error, cast err to awserr.Error to get the Code and
  2667. // Message from an error.
  2668. fmt.Println(err.Error())
  2669. return
  2670. }
  2671. // Pretty-print the response data.
  2672. fmt.Println(resp)
  2673. }
  2674. func ExampleEC2_DescribeNetworkAcls() {
  2675. sess, err := session.NewSession()
  2676. if err != nil {
  2677. fmt.Println("failed to create session,", err)
  2678. return
  2679. }
  2680. svc := ec2.New(sess)
  2681. params := &ec2.DescribeNetworkAclsInput{
  2682. DryRun: aws.Bool(true),
  2683. Filters: []*ec2.Filter{
  2684. { // Required
  2685. Name: aws.String("String"),
  2686. Values: []*string{
  2687. aws.String("String"), // Required
  2688. // More values...
  2689. },
  2690. },
  2691. // More values...
  2692. },
  2693. NetworkAclIds: []*string{
  2694. aws.String("String"), // Required
  2695. // More values...
  2696. },
  2697. }
  2698. resp, err := svc.DescribeNetworkAcls(params)
  2699. if err != nil {
  2700. // Print the error, cast err to awserr.Error to get the Code and
  2701. // Message from an error.
  2702. fmt.Println(err.Error())
  2703. return
  2704. }
  2705. // Pretty-print the response data.
  2706. fmt.Println(resp)
  2707. }
  2708. func ExampleEC2_DescribeNetworkInterfaceAttribute() {
  2709. sess, err := session.NewSession()
  2710. if err != nil {
  2711. fmt.Println("failed to create session,", err)
  2712. return
  2713. }
  2714. svc := ec2.New(sess)
  2715. params := &ec2.DescribeNetworkInterfaceAttributeInput{
  2716. NetworkInterfaceId: aws.String("String"), // Required
  2717. Attribute: aws.String("NetworkInterfaceAttribute"),
  2718. DryRun: aws.Bool(true),
  2719. }
  2720. resp, err := svc.DescribeNetworkInterfaceAttribute(params)
  2721. if err != nil {
  2722. // Print the error, cast err to awserr.Error to get the Code and
  2723. // Message from an error.
  2724. fmt.Println(err.Error())
  2725. return
  2726. }
  2727. // Pretty-print the response data.
  2728. fmt.Println(resp)
  2729. }
  2730. func ExampleEC2_DescribeNetworkInterfaces() {
  2731. sess, err := session.NewSession()
  2732. if err != nil {
  2733. fmt.Println("failed to create session,", err)
  2734. return
  2735. }
  2736. svc := ec2.New(sess)
  2737. params := &ec2.DescribeNetworkInterfacesInput{
  2738. DryRun: aws.Bool(true),
  2739. Filters: []*ec2.Filter{
  2740. { // Required
  2741. Name: aws.String("String"),
  2742. Values: []*string{
  2743. aws.String("String"), // Required
  2744. // More values...
  2745. },
  2746. },
  2747. // More values...
  2748. },
  2749. NetworkInterfaceIds: []*string{
  2750. aws.String("String"), // Required
  2751. // More values...
  2752. },
  2753. }
  2754. resp, err := svc.DescribeNetworkInterfaces(params)
  2755. if err != nil {
  2756. // Print the error, cast err to awserr.Error to get the Code and
  2757. // Message from an error.
  2758. fmt.Println(err.Error())
  2759. return
  2760. }
  2761. // Pretty-print the response data.
  2762. fmt.Println(resp)
  2763. }
  2764. func ExampleEC2_DescribePlacementGroups() {
  2765. sess, err := session.NewSession()
  2766. if err != nil {
  2767. fmt.Println("failed to create session,", err)
  2768. return
  2769. }
  2770. svc := ec2.New(sess)
  2771. params := &ec2.DescribePlacementGroupsInput{
  2772. DryRun: aws.Bool(true),
  2773. Filters: []*ec2.Filter{
  2774. { // Required
  2775. Name: aws.String("String"),
  2776. Values: []*string{
  2777. aws.String("String"), // Required
  2778. // More values...
  2779. },
  2780. },
  2781. // More values...
  2782. },
  2783. GroupNames: []*string{
  2784. aws.String("String"), // Required
  2785. // More values...
  2786. },
  2787. }
  2788. resp, err := svc.DescribePlacementGroups(params)
  2789. if err != nil {
  2790. // Print the error, cast err to awserr.Error to get the Code and
  2791. // Message from an error.
  2792. fmt.Println(err.Error())
  2793. return
  2794. }
  2795. // Pretty-print the response data.
  2796. fmt.Println(resp)
  2797. }
  2798. func ExampleEC2_DescribePrefixLists() {
  2799. sess, err := session.NewSession()
  2800. if err != nil {
  2801. fmt.Println("failed to create session,", err)
  2802. return
  2803. }
  2804. svc := ec2.New(sess)
  2805. params := &ec2.DescribePrefixListsInput{
  2806. DryRun: aws.Bool(true),
  2807. Filters: []*ec2.Filter{
  2808. { // Required
  2809. Name: aws.String("String"),
  2810. Values: []*string{
  2811. aws.String("String"), // Required
  2812. // More values...
  2813. },
  2814. },
  2815. // More values...
  2816. },
  2817. MaxResults: aws.Int64(1),
  2818. NextToken: aws.String("String"),
  2819. PrefixListIds: []*string{
  2820. aws.String("String"), // Required
  2821. // More values...
  2822. },
  2823. }
  2824. resp, err := svc.DescribePrefixLists(params)
  2825. if err != nil {
  2826. // Print the error, cast err to awserr.Error to get the Code and
  2827. // Message from an error.
  2828. fmt.Println(err.Error())
  2829. return
  2830. }
  2831. // Pretty-print the response data.
  2832. fmt.Println(resp)
  2833. }
  2834. func ExampleEC2_DescribeRegions() {
  2835. sess, err := session.NewSession()
  2836. if err != nil {
  2837. fmt.Println("failed to create session,", err)
  2838. return
  2839. }
  2840. svc := ec2.New(sess)
  2841. params := &ec2.DescribeRegionsInput{
  2842. DryRun: aws.Bool(true),
  2843. Filters: []*ec2.Filter{
  2844. { // Required
  2845. Name: aws.String("String"),
  2846. Values: []*string{
  2847. aws.String("String"), // Required
  2848. // More values...
  2849. },
  2850. },
  2851. // More values...
  2852. },
  2853. RegionNames: []*string{
  2854. aws.String("String"), // Required
  2855. // More values...
  2856. },
  2857. }
  2858. resp, err := svc.DescribeRegions(params)
  2859. if err != nil {
  2860. // Print the error, cast err to awserr.Error to get the Code and
  2861. // Message from an error.
  2862. fmt.Println(err.Error())
  2863. return
  2864. }
  2865. // Pretty-print the response data.
  2866. fmt.Println(resp)
  2867. }
  2868. func ExampleEC2_DescribeReservedInstances() {
  2869. sess, err := session.NewSession()
  2870. if err != nil {
  2871. fmt.Println("failed to create session,", err)
  2872. return
  2873. }
  2874. svc := ec2.New(sess)
  2875. params := &ec2.DescribeReservedInstancesInput{
  2876. DryRun: aws.Bool(true),
  2877. Filters: []*ec2.Filter{
  2878. { // Required
  2879. Name: aws.String("String"),
  2880. Values: []*string{
  2881. aws.String("String"), // Required
  2882. // More values...
  2883. },
  2884. },
  2885. // More values...
  2886. },
  2887. OfferingType: aws.String("OfferingTypeValues"),
  2888. ReservedInstancesIds: []*string{
  2889. aws.String("String"), // Required
  2890. // More values...
  2891. },
  2892. }
  2893. resp, err := svc.DescribeReservedInstances(params)
  2894. if err != nil {
  2895. // Print the error, cast err to awserr.Error to get the Code and
  2896. // Message from an error.
  2897. fmt.Println(err.Error())
  2898. return
  2899. }
  2900. // Pretty-print the response data.
  2901. fmt.Println(resp)
  2902. }
  2903. func ExampleEC2_DescribeReservedInstancesListings() {
  2904. sess, err := session.NewSession()
  2905. if err != nil {
  2906. fmt.Println("failed to create session,", err)
  2907. return
  2908. }
  2909. svc := ec2.New(sess)
  2910. params := &ec2.DescribeReservedInstancesListingsInput{
  2911. Filters: []*ec2.Filter{
  2912. { // Required
  2913. Name: aws.String("String"),
  2914. Values: []*string{
  2915. aws.String("String"), // Required
  2916. // More values...
  2917. },
  2918. },
  2919. // More values...
  2920. },
  2921. ReservedInstancesId: aws.String("String"),
  2922. ReservedInstancesListingId: aws.String("String"),
  2923. }
  2924. resp, err := svc.DescribeReservedInstancesListings(params)
  2925. if err != nil {
  2926. // Print the error, cast err to awserr.Error to get the Code and
  2927. // Message from an error.
  2928. fmt.Println(err.Error())
  2929. return
  2930. }
  2931. // Pretty-print the response data.
  2932. fmt.Println(resp)
  2933. }
  2934. func ExampleEC2_DescribeReservedInstancesModifications() {
  2935. sess, err := session.NewSession()
  2936. if err != nil {
  2937. fmt.Println("failed to create session,", err)
  2938. return
  2939. }
  2940. svc := ec2.New(sess)
  2941. params := &ec2.DescribeReservedInstancesModificationsInput{
  2942. Filters: []*ec2.Filter{
  2943. { // Required
  2944. Name: aws.String("String"),
  2945. Values: []*string{
  2946. aws.String("String"), // Required
  2947. // More values...
  2948. },
  2949. },
  2950. // More values...
  2951. },
  2952. NextToken: aws.String("String"),
  2953. ReservedInstancesModificationIds: []*string{
  2954. aws.String("String"), // Required
  2955. // More values...
  2956. },
  2957. }
  2958. resp, err := svc.DescribeReservedInstancesModifications(params)
  2959. if err != nil {
  2960. // Print the error, cast err to awserr.Error to get the Code and
  2961. // Message from an error.
  2962. fmt.Println(err.Error())
  2963. return
  2964. }
  2965. // Pretty-print the response data.
  2966. fmt.Println(resp)
  2967. }
  2968. func ExampleEC2_DescribeReservedInstancesOfferings() {
  2969. sess, err := session.NewSession()
  2970. if err != nil {
  2971. fmt.Println("failed to create session,", err)
  2972. return
  2973. }
  2974. svc := ec2.New(sess)
  2975. params := &ec2.DescribeReservedInstancesOfferingsInput{
  2976. AvailabilityZone: aws.String("String"),
  2977. DryRun: aws.Bool(true),
  2978. Filters: []*ec2.Filter{
  2979. { // Required
  2980. Name: aws.String("String"),
  2981. Values: []*string{
  2982. aws.String("String"), // Required
  2983. // More values...
  2984. },
  2985. },
  2986. // More values...
  2987. },
  2988. IncludeMarketplace: aws.Bool(true),
  2989. InstanceTenancy: aws.String("Tenancy"),
  2990. InstanceType: aws.String("InstanceType"),
  2991. MaxDuration: aws.Int64(1),
  2992. MaxInstanceCount: aws.Int64(1),
  2993. MaxResults: aws.Int64(1),
  2994. MinDuration: aws.Int64(1),
  2995. NextToken: aws.String("String"),
  2996. OfferingType: aws.String("OfferingTypeValues"),
  2997. ProductDescription: aws.String("RIProductDescription"),
  2998. ReservedInstancesOfferingIds: []*string{
  2999. aws.String("String"), // Required
  3000. // More values...
  3001. },
  3002. }
  3003. resp, err := svc.DescribeReservedInstancesOfferings(params)
  3004. if err != nil {
  3005. // Print the error, cast err to awserr.Error to get the Code and
  3006. // Message from an error.
  3007. fmt.Println(err.Error())
  3008. return
  3009. }
  3010. // Pretty-print the response data.
  3011. fmt.Println(resp)
  3012. }
  3013. func ExampleEC2_DescribeRouteTables() {
  3014. sess, err := session.NewSession()
  3015. if err != nil {
  3016. fmt.Println("failed to create session,", err)
  3017. return
  3018. }
  3019. svc := ec2.New(sess)
  3020. params := &ec2.DescribeRouteTablesInput{
  3021. DryRun: aws.Bool(true),
  3022. Filters: []*ec2.Filter{
  3023. { // Required
  3024. Name: aws.String("String"),
  3025. Values: []*string{
  3026. aws.String("String"), // Required
  3027. // More values...
  3028. },
  3029. },
  3030. // More values...
  3031. },
  3032. RouteTableIds: []*string{
  3033. aws.String("String"), // Required
  3034. // More values...
  3035. },
  3036. }
  3037. resp, err := svc.DescribeRouteTables(params)
  3038. if err != nil {
  3039. // Print the error, cast err to awserr.Error to get the Code and
  3040. // Message from an error.
  3041. fmt.Println(err.Error())
  3042. return
  3043. }
  3044. // Pretty-print the response data.
  3045. fmt.Println(resp)
  3046. }
  3047. func ExampleEC2_DescribeScheduledInstanceAvailability() {
  3048. sess, err := session.NewSession()
  3049. if err != nil {
  3050. fmt.Println("failed to create session,", err)
  3051. return
  3052. }
  3053. svc := ec2.New(sess)
  3054. params := &ec2.DescribeScheduledInstanceAvailabilityInput{
  3055. FirstSlotStartTimeRange: &ec2.SlotDateTimeRangeRequest{ // Required
  3056. EarliestTime: aws.Time(time.Now()), // Required
  3057. LatestTime: aws.Time(time.Now()), // Required
  3058. },
  3059. Recurrence: &ec2.ScheduledInstanceRecurrenceRequest{ // Required
  3060. Frequency: aws.String("String"),
  3061. Interval: aws.Int64(1),
  3062. OccurrenceDays: []*int64{
  3063. aws.Int64(1), // Required
  3064. // More values...
  3065. },
  3066. OccurrenceRelativeToEnd: aws.Bool(true),
  3067. OccurrenceUnit: aws.String("String"),
  3068. },
  3069. DryRun: aws.Bool(true),
  3070. Filters: []*ec2.Filter{
  3071. { // Required
  3072. Name: aws.String("String"),
  3073. Values: []*string{
  3074. aws.String("String"), // Required
  3075. // More values...
  3076. },
  3077. },
  3078. // More values...
  3079. },
  3080. MaxResults: aws.Int64(1),
  3081. MaxSlotDurationInHours: aws.Int64(1),
  3082. MinSlotDurationInHours: aws.Int64(1),
  3083. NextToken: aws.String("String"),
  3084. }
  3085. resp, err := svc.DescribeScheduledInstanceAvailability(params)
  3086. if err != nil {
  3087. // Print the error, cast err to awserr.Error to get the Code and
  3088. // Message from an error.
  3089. fmt.Println(err.Error())
  3090. return
  3091. }
  3092. // Pretty-print the response data.
  3093. fmt.Println(resp)
  3094. }
  3095. func ExampleEC2_DescribeScheduledInstances() {
  3096. sess, err := session.NewSession()
  3097. if err != nil {
  3098. fmt.Println("failed to create session,", err)
  3099. return
  3100. }
  3101. svc := ec2.New(sess)
  3102. params := &ec2.DescribeScheduledInstancesInput{
  3103. DryRun: aws.Bool(true),
  3104. Filters: []*ec2.Filter{
  3105. { // Required
  3106. Name: aws.String("String"),
  3107. Values: []*string{
  3108. aws.String("String"), // Required
  3109. // More values...
  3110. },
  3111. },
  3112. // More values...
  3113. },
  3114. MaxResults: aws.Int64(1),
  3115. NextToken: aws.String("String"),
  3116. ScheduledInstanceIds: []*string{
  3117. aws.String("String"), // Required
  3118. // More values...
  3119. },
  3120. SlotStartTimeRange: &ec2.SlotStartTimeRangeRequest{
  3121. EarliestTime: aws.Time(time.Now()),
  3122. LatestTime: aws.Time(time.Now()),
  3123. },
  3124. }
  3125. resp, err := svc.DescribeScheduledInstances(params)
  3126. if err != nil {
  3127. // Print the error, cast err to awserr.Error to get the Code and
  3128. // Message from an error.
  3129. fmt.Println(err.Error())
  3130. return
  3131. }
  3132. // Pretty-print the response data.
  3133. fmt.Println(resp)
  3134. }
  3135. func ExampleEC2_DescribeSecurityGroupReferences() {
  3136. sess, err := session.NewSession()
  3137. if err != nil {
  3138. fmt.Println("failed to create session,", err)
  3139. return
  3140. }
  3141. svc := ec2.New(sess)
  3142. params := &ec2.DescribeSecurityGroupReferencesInput{
  3143. GroupId: []*string{ // Required
  3144. aws.String("String"), // Required
  3145. // More values...
  3146. },
  3147. DryRun: aws.Bool(true),
  3148. }
  3149. resp, err := svc.DescribeSecurityGroupReferences(params)
  3150. if err != nil {
  3151. // Print the error, cast err to awserr.Error to get the Code and
  3152. // Message from an error.
  3153. fmt.Println(err.Error())
  3154. return
  3155. }
  3156. // Pretty-print the response data.
  3157. fmt.Println(resp)
  3158. }
  3159. func ExampleEC2_DescribeSecurityGroups() {
  3160. sess, err := session.NewSession()
  3161. if err != nil {
  3162. fmt.Println("failed to create session,", err)
  3163. return
  3164. }
  3165. svc := ec2.New(sess)
  3166. params := &ec2.DescribeSecurityGroupsInput{
  3167. DryRun: aws.Bool(true),
  3168. Filters: []*ec2.Filter{
  3169. { // Required
  3170. Name: aws.String("String"),
  3171. Values: []*string{
  3172. aws.String("String"), // Required
  3173. // More values...
  3174. },
  3175. },
  3176. // More values...
  3177. },
  3178. GroupIds: []*string{
  3179. aws.String("String"), // Required
  3180. // More values...
  3181. },
  3182. GroupNames: []*string{
  3183. aws.String("String"), // Required
  3184. // More values...
  3185. },
  3186. }
  3187. resp, err := svc.DescribeSecurityGroups(params)
  3188. if err != nil {
  3189. // Print the error, cast err to awserr.Error to get the Code and
  3190. // Message from an error.
  3191. fmt.Println(err.Error())
  3192. return
  3193. }
  3194. // Pretty-print the response data.
  3195. fmt.Println(resp)
  3196. }
  3197. func ExampleEC2_DescribeSnapshotAttribute() {
  3198. sess, err := session.NewSession()
  3199. if err != nil {
  3200. fmt.Println("failed to create session,", err)
  3201. return
  3202. }
  3203. svc := ec2.New(sess)
  3204. params := &ec2.DescribeSnapshotAttributeInput{
  3205. Attribute: aws.String("SnapshotAttributeName"), // Required
  3206. SnapshotId: aws.String("String"), // Required
  3207. DryRun: aws.Bool(true),
  3208. }
  3209. resp, err := svc.DescribeSnapshotAttribute(params)
  3210. if err != nil {
  3211. // Print the error, cast err to awserr.Error to get the Code and
  3212. // Message from an error.
  3213. fmt.Println(err.Error())
  3214. return
  3215. }
  3216. // Pretty-print the response data.
  3217. fmt.Println(resp)
  3218. }
  3219. func ExampleEC2_DescribeSnapshots() {
  3220. sess, err := session.NewSession()
  3221. if err != nil {
  3222. fmt.Println("failed to create session,", err)
  3223. return
  3224. }
  3225. svc := ec2.New(sess)
  3226. params := &ec2.DescribeSnapshotsInput{
  3227. DryRun: aws.Bool(true),
  3228. Filters: []*ec2.Filter{
  3229. { // Required
  3230. Name: aws.String("String"),
  3231. Values: []*string{
  3232. aws.String("String"), // Required
  3233. // More values...
  3234. },
  3235. },
  3236. // More values...
  3237. },
  3238. MaxResults: aws.Int64(1),
  3239. NextToken: aws.String("String"),
  3240. OwnerIds: []*string{
  3241. aws.String("String"), // Required
  3242. // More values...
  3243. },
  3244. RestorableByUserIds: []*string{
  3245. aws.String("String"), // Required
  3246. // More values...
  3247. },
  3248. SnapshotIds: []*string{
  3249. aws.String("String"), // Required
  3250. // More values...
  3251. },
  3252. }
  3253. resp, err := svc.DescribeSnapshots(params)
  3254. if err != nil {
  3255. // Print the error, cast err to awserr.Error to get the Code and
  3256. // Message from an error.
  3257. fmt.Println(err.Error())
  3258. return
  3259. }
  3260. // Pretty-print the response data.
  3261. fmt.Println(resp)
  3262. }
  3263. func ExampleEC2_DescribeSpotDatafeedSubscription() {
  3264. sess, err := session.NewSession()
  3265. if err != nil {
  3266. fmt.Println("failed to create session,", err)
  3267. return
  3268. }
  3269. svc := ec2.New(sess)
  3270. params := &ec2.DescribeSpotDatafeedSubscriptionInput{
  3271. DryRun: aws.Bool(true),
  3272. }
  3273. resp, err := svc.DescribeSpotDatafeedSubscription(params)
  3274. if err != nil {
  3275. // Print the error, cast err to awserr.Error to get the Code and
  3276. // Message from an error.
  3277. fmt.Println(err.Error())
  3278. return
  3279. }
  3280. // Pretty-print the response data.
  3281. fmt.Println(resp)
  3282. }
  3283. func ExampleEC2_DescribeSpotFleetInstances() {
  3284. sess, err := session.NewSession()
  3285. if err != nil {
  3286. fmt.Println("failed to create session,", err)
  3287. return
  3288. }
  3289. svc := ec2.New(sess)
  3290. params := &ec2.DescribeSpotFleetInstancesInput{
  3291. SpotFleetRequestId: aws.String("String"), // Required
  3292. DryRun: aws.Bool(true),
  3293. MaxResults: aws.Int64(1),
  3294. NextToken: aws.String("String"),
  3295. }
  3296. resp, err := svc.DescribeSpotFleetInstances(params)
  3297. if err != nil {
  3298. // Print the error, cast err to awserr.Error to get the Code and
  3299. // Message from an error.
  3300. fmt.Println(err.Error())
  3301. return
  3302. }
  3303. // Pretty-print the response data.
  3304. fmt.Println(resp)
  3305. }
  3306. func ExampleEC2_DescribeSpotFleetRequestHistory() {
  3307. sess, err := session.NewSession()
  3308. if err != nil {
  3309. fmt.Println("failed to create session,", err)
  3310. return
  3311. }
  3312. svc := ec2.New(sess)
  3313. params := &ec2.DescribeSpotFleetRequestHistoryInput{
  3314. SpotFleetRequestId: aws.String("String"), // Required
  3315. StartTime: aws.Time(time.Now()), // Required
  3316. DryRun: aws.Bool(true),
  3317. EventType: aws.String("EventType"),
  3318. MaxResults: aws.Int64(1),
  3319. NextToken: aws.String("String"),
  3320. }
  3321. resp, err := svc.DescribeSpotFleetRequestHistory(params)
  3322. if err != nil {
  3323. // Print the error, cast err to awserr.Error to get the Code and
  3324. // Message from an error.
  3325. fmt.Println(err.Error())
  3326. return
  3327. }
  3328. // Pretty-print the response data.
  3329. fmt.Println(resp)
  3330. }
  3331. func ExampleEC2_DescribeSpotFleetRequests() {
  3332. sess, err := session.NewSession()
  3333. if err != nil {
  3334. fmt.Println("failed to create session,", err)
  3335. return
  3336. }
  3337. svc := ec2.New(sess)
  3338. params := &ec2.DescribeSpotFleetRequestsInput{
  3339. DryRun: aws.Bool(true),
  3340. MaxResults: aws.Int64(1),
  3341. NextToken: aws.String("String"),
  3342. SpotFleetRequestIds: []*string{
  3343. aws.String("String"), // Required
  3344. // More values...
  3345. },
  3346. }
  3347. resp, err := svc.DescribeSpotFleetRequests(params)
  3348. if err != nil {
  3349. // Print the error, cast err to awserr.Error to get the Code and
  3350. // Message from an error.
  3351. fmt.Println(err.Error())
  3352. return
  3353. }
  3354. // Pretty-print the response data.
  3355. fmt.Println(resp)
  3356. }
  3357. func ExampleEC2_DescribeSpotInstanceRequests() {
  3358. sess, err := session.NewSession()
  3359. if err != nil {
  3360. fmt.Println("failed to create session,", err)
  3361. return
  3362. }
  3363. svc := ec2.New(sess)
  3364. params := &ec2.DescribeSpotInstanceRequestsInput{
  3365. DryRun: aws.Bool(true),
  3366. Filters: []*ec2.Filter{
  3367. { // Required
  3368. Name: aws.String("String"),
  3369. Values: []*string{
  3370. aws.String("String"), // Required
  3371. // More values...
  3372. },
  3373. },
  3374. // More values...
  3375. },
  3376. SpotInstanceRequestIds: []*string{
  3377. aws.String("String"), // Required
  3378. // More values...
  3379. },
  3380. }
  3381. resp, err := svc.DescribeSpotInstanceRequests(params)
  3382. if err != nil {
  3383. // Print the error, cast err to awserr.Error to get the Code and
  3384. // Message from an error.
  3385. fmt.Println(err.Error())
  3386. return
  3387. }
  3388. // Pretty-print the response data.
  3389. fmt.Println(resp)
  3390. }
  3391. func ExampleEC2_DescribeSpotPriceHistory() {
  3392. sess, err := session.NewSession()
  3393. if err != nil {
  3394. fmt.Println("failed to create session,", err)
  3395. return
  3396. }
  3397. svc := ec2.New(sess)
  3398. params := &ec2.DescribeSpotPriceHistoryInput{
  3399. AvailabilityZone: aws.String("String"),
  3400. DryRun: aws.Bool(true),
  3401. EndTime: aws.Time(time.Now()),
  3402. Filters: []*ec2.Filter{
  3403. { // Required
  3404. Name: aws.String("String"),
  3405. Values: []*string{
  3406. aws.String("String"), // Required
  3407. // More values...
  3408. },
  3409. },
  3410. // More values...
  3411. },
  3412. InstanceTypes: []*string{
  3413. aws.String("InstanceType"), // Required
  3414. // More values...
  3415. },
  3416. MaxResults: aws.Int64(1),
  3417. NextToken: aws.String("String"),
  3418. ProductDescriptions: []*string{
  3419. aws.String("String"), // Required
  3420. // More values...
  3421. },
  3422. StartTime: aws.Time(time.Now()),
  3423. }
  3424. resp, err := svc.DescribeSpotPriceHistory(params)
  3425. if err != nil {
  3426. // Print the error, cast err to awserr.Error to get the Code and
  3427. // Message from an error.
  3428. fmt.Println(err.Error())
  3429. return
  3430. }
  3431. // Pretty-print the response data.
  3432. fmt.Println(resp)
  3433. }
  3434. func ExampleEC2_DescribeStaleSecurityGroups() {
  3435. sess, err := session.NewSession()
  3436. if err != nil {
  3437. fmt.Println("failed to create session,", err)
  3438. return
  3439. }
  3440. svc := ec2.New(sess)
  3441. params := &ec2.DescribeStaleSecurityGroupsInput{
  3442. VpcId: aws.String("String"), // Required
  3443. DryRun: aws.Bool(true),
  3444. MaxResults: aws.Int64(1),
  3445. NextToken: aws.String("NextToken"),
  3446. }
  3447. resp, err := svc.DescribeStaleSecurityGroups(params)
  3448. if err != nil {
  3449. // Print the error, cast err to awserr.Error to get the Code and
  3450. // Message from an error.
  3451. fmt.Println(err.Error())
  3452. return
  3453. }
  3454. // Pretty-print the response data.
  3455. fmt.Println(resp)
  3456. }
  3457. func ExampleEC2_DescribeSubnets() {
  3458. sess, err := session.NewSession()
  3459. if err != nil {
  3460. fmt.Println("failed to create session,", err)
  3461. return
  3462. }
  3463. svc := ec2.New(sess)
  3464. params := &ec2.DescribeSubnetsInput{
  3465. DryRun: aws.Bool(true),
  3466. Filters: []*ec2.Filter{
  3467. { // Required
  3468. Name: aws.String("String"),
  3469. Values: []*string{
  3470. aws.String("String"), // Required
  3471. // More values...
  3472. },
  3473. },
  3474. // More values...
  3475. },
  3476. SubnetIds: []*string{
  3477. aws.String("String"), // Required
  3478. // More values...
  3479. },
  3480. }
  3481. resp, err := svc.DescribeSubnets(params)
  3482. if err != nil {
  3483. // Print the error, cast err to awserr.Error to get the Code and
  3484. // Message from an error.
  3485. fmt.Println(err.Error())
  3486. return
  3487. }
  3488. // Pretty-print the response data.
  3489. fmt.Println(resp)
  3490. }
  3491. func ExampleEC2_DescribeTags() {
  3492. sess, err := session.NewSession()
  3493. if err != nil {
  3494. fmt.Println("failed to create session,", err)
  3495. return
  3496. }
  3497. svc := ec2.New(sess)
  3498. params := &ec2.DescribeTagsInput{
  3499. DryRun: aws.Bool(true),
  3500. Filters: []*ec2.Filter{
  3501. { // Required
  3502. Name: aws.String("String"),
  3503. Values: []*string{
  3504. aws.String("String"), // Required
  3505. // More values...
  3506. },
  3507. },
  3508. // More values...
  3509. },
  3510. MaxResults: aws.Int64(1),
  3511. NextToken: aws.String("String"),
  3512. }
  3513. resp, err := svc.DescribeTags(params)
  3514. if err != nil {
  3515. // Print the error, cast err to awserr.Error to get the Code and
  3516. // Message from an error.
  3517. fmt.Println(err.Error())
  3518. return
  3519. }
  3520. // Pretty-print the response data.
  3521. fmt.Println(resp)
  3522. }
  3523. func ExampleEC2_DescribeVolumeAttribute() {
  3524. sess, err := session.NewSession()
  3525. if err != nil {
  3526. fmt.Println("failed to create session,", err)
  3527. return
  3528. }
  3529. svc := ec2.New(sess)
  3530. params := &ec2.DescribeVolumeAttributeInput{
  3531. VolumeId: aws.String("String"), // Required
  3532. Attribute: aws.String("VolumeAttributeName"),
  3533. DryRun: aws.Bool(true),
  3534. }
  3535. resp, err := svc.DescribeVolumeAttribute(params)
  3536. if err != nil {
  3537. // Print the error, cast err to awserr.Error to get the Code and
  3538. // Message from an error.
  3539. fmt.Println(err.Error())
  3540. return
  3541. }
  3542. // Pretty-print the response data.
  3543. fmt.Println(resp)
  3544. }
  3545. func ExampleEC2_DescribeVolumeStatus() {
  3546. sess, err := session.NewSession()
  3547. if err != nil {
  3548. fmt.Println("failed to create session,", err)
  3549. return
  3550. }
  3551. svc := ec2.New(sess)
  3552. params := &ec2.DescribeVolumeStatusInput{
  3553. DryRun: aws.Bool(true),
  3554. Filters: []*ec2.Filter{
  3555. { // Required
  3556. Name: aws.String("String"),
  3557. Values: []*string{
  3558. aws.String("String"), // Required
  3559. // More values...
  3560. },
  3561. },
  3562. // More values...
  3563. },
  3564. MaxResults: aws.Int64(1),
  3565. NextToken: aws.String("String"),
  3566. VolumeIds: []*string{
  3567. aws.String("String"), // Required
  3568. // More values...
  3569. },
  3570. }
  3571. resp, err := svc.DescribeVolumeStatus(params)
  3572. if err != nil {
  3573. // Print the error, cast err to awserr.Error to get the Code and
  3574. // Message from an error.
  3575. fmt.Println(err.Error())
  3576. return
  3577. }
  3578. // Pretty-print the response data.
  3579. fmt.Println(resp)
  3580. }
  3581. func ExampleEC2_DescribeVolumes() {
  3582. sess, err := session.NewSession()
  3583. if err != nil {
  3584. fmt.Println("failed to create session,", err)
  3585. return
  3586. }
  3587. svc := ec2.New(sess)
  3588. params := &ec2.DescribeVolumesInput{
  3589. DryRun: aws.Bool(true),
  3590. Filters: []*ec2.Filter{
  3591. { // Required
  3592. Name: aws.String("String"),
  3593. Values: []*string{
  3594. aws.String("String"), // Required
  3595. // More values...
  3596. },
  3597. },
  3598. // More values...
  3599. },
  3600. MaxResults: aws.Int64(1),
  3601. NextToken: aws.String("String"),
  3602. VolumeIds: []*string{
  3603. aws.String("String"), // Required
  3604. // More values...
  3605. },
  3606. }
  3607. resp, err := svc.DescribeVolumes(params)
  3608. if err != nil {
  3609. // Print the error, cast err to awserr.Error to get the Code and
  3610. // Message from an error.
  3611. fmt.Println(err.Error())
  3612. return
  3613. }
  3614. // Pretty-print the response data.
  3615. fmt.Println(resp)
  3616. }
  3617. func ExampleEC2_DescribeVpcAttribute() {
  3618. sess, err := session.NewSession()
  3619. if err != nil {
  3620. fmt.Println("failed to create session,", err)
  3621. return
  3622. }
  3623. svc := ec2.New(sess)
  3624. params := &ec2.DescribeVpcAttributeInput{
  3625. Attribute: aws.String("VpcAttributeName"), // Required
  3626. VpcId: aws.String("String"), // Required
  3627. DryRun: aws.Bool(true),
  3628. }
  3629. resp, err := svc.DescribeVpcAttribute(params)
  3630. if err != nil {
  3631. // Print the error, cast err to awserr.Error to get the Code and
  3632. // Message from an error.
  3633. fmt.Println(err.Error())
  3634. return
  3635. }
  3636. // Pretty-print the response data.
  3637. fmt.Println(resp)
  3638. }
  3639. func ExampleEC2_DescribeVpcClassicLink() {
  3640. sess, err := session.NewSession()
  3641. if err != nil {
  3642. fmt.Println("failed to create session,", err)
  3643. return
  3644. }
  3645. svc := ec2.New(sess)
  3646. params := &ec2.DescribeVpcClassicLinkInput{
  3647. DryRun: aws.Bool(true),
  3648. Filters: []*ec2.Filter{
  3649. { // Required
  3650. Name: aws.String("String"),
  3651. Values: []*string{
  3652. aws.String("String"), // Required
  3653. // More values...
  3654. },
  3655. },
  3656. // More values...
  3657. },
  3658. VpcIds: []*string{
  3659. aws.String("String"), // Required
  3660. // More values...
  3661. },
  3662. }
  3663. resp, err := svc.DescribeVpcClassicLink(params)
  3664. if err != nil {
  3665. // Print the error, cast err to awserr.Error to get the Code and
  3666. // Message from an error.
  3667. fmt.Println(err.Error())
  3668. return
  3669. }
  3670. // Pretty-print the response data.
  3671. fmt.Println(resp)
  3672. }
  3673. func ExampleEC2_DescribeVpcClassicLinkDnsSupport() {
  3674. sess, err := session.NewSession()
  3675. if err != nil {
  3676. fmt.Println("failed to create session,", err)
  3677. return
  3678. }
  3679. svc := ec2.New(sess)
  3680. params := &ec2.DescribeVpcClassicLinkDnsSupportInput{
  3681. MaxResults: aws.Int64(1),
  3682. NextToken: aws.String("NextToken"),
  3683. VpcIds: []*string{
  3684. aws.String("String"), // Required
  3685. // More values...
  3686. },
  3687. }
  3688. resp, err := svc.DescribeVpcClassicLinkDnsSupport(params)
  3689. if err != nil {
  3690. // Print the error, cast err to awserr.Error to get the Code and
  3691. // Message from an error.
  3692. fmt.Println(err.Error())
  3693. return
  3694. }
  3695. // Pretty-print the response data.
  3696. fmt.Println(resp)
  3697. }
  3698. func ExampleEC2_DescribeVpcEndpointServices() {
  3699. sess, err := session.NewSession()
  3700. if err != nil {
  3701. fmt.Println("failed to create session,", err)
  3702. return
  3703. }
  3704. svc := ec2.New(sess)
  3705. params := &ec2.DescribeVpcEndpointServicesInput{
  3706. DryRun: aws.Bool(true),
  3707. MaxResults: aws.Int64(1),
  3708. NextToken: aws.String("String"),
  3709. }
  3710. resp, err := svc.DescribeVpcEndpointServices(params)
  3711. if err != nil {
  3712. // Print the error, cast err to awserr.Error to get the Code and
  3713. // Message from an error.
  3714. fmt.Println(err.Error())
  3715. return
  3716. }
  3717. // Pretty-print the response data.
  3718. fmt.Println(resp)
  3719. }
  3720. func ExampleEC2_DescribeVpcEndpoints() {
  3721. sess, err := session.NewSession()
  3722. if err != nil {
  3723. fmt.Println("failed to create session,", err)
  3724. return
  3725. }
  3726. svc := ec2.New(sess)
  3727. params := &ec2.DescribeVpcEndpointsInput{
  3728. DryRun: aws.Bool(true),
  3729. Filters: []*ec2.Filter{
  3730. { // Required
  3731. Name: aws.String("String"),
  3732. Values: []*string{
  3733. aws.String("String"), // Required
  3734. // More values...
  3735. },
  3736. },
  3737. // More values...
  3738. },
  3739. MaxResults: aws.Int64(1),
  3740. NextToken: aws.String("String"),
  3741. VpcEndpointIds: []*string{
  3742. aws.String("String"), // Required
  3743. // More values...
  3744. },
  3745. }
  3746. resp, err := svc.DescribeVpcEndpoints(params)
  3747. if err != nil {
  3748. // Print the error, cast err to awserr.Error to get the Code and
  3749. // Message from an error.
  3750. fmt.Println(err.Error())
  3751. return
  3752. }
  3753. // Pretty-print the response data.
  3754. fmt.Println(resp)
  3755. }
  3756. func ExampleEC2_DescribeVpcPeeringConnections() {
  3757. sess, err := session.NewSession()
  3758. if err != nil {
  3759. fmt.Println("failed to create session,", err)
  3760. return
  3761. }
  3762. svc := ec2.New(sess)
  3763. params := &ec2.DescribeVpcPeeringConnectionsInput{
  3764. DryRun: aws.Bool(true),
  3765. Filters: []*ec2.Filter{
  3766. { // Required
  3767. Name: aws.String("String"),
  3768. Values: []*string{
  3769. aws.String("String"), // Required
  3770. // More values...
  3771. },
  3772. },
  3773. // More values...
  3774. },
  3775. VpcPeeringConnectionIds: []*string{
  3776. aws.String("String"), // Required
  3777. // More values...
  3778. },
  3779. }
  3780. resp, err := svc.DescribeVpcPeeringConnections(params)
  3781. if err != nil {
  3782. // Print the error, cast err to awserr.Error to get the Code and
  3783. // Message from an error.
  3784. fmt.Println(err.Error())
  3785. return
  3786. }
  3787. // Pretty-print the response data.
  3788. fmt.Println(resp)
  3789. }
  3790. func ExampleEC2_DescribeVpcs() {
  3791. sess, err := session.NewSession()
  3792. if err != nil {
  3793. fmt.Println("failed to create session,", err)
  3794. return
  3795. }
  3796. svc := ec2.New(sess)
  3797. params := &ec2.DescribeVpcsInput{
  3798. DryRun: aws.Bool(true),
  3799. Filters: []*ec2.Filter{
  3800. { // Required
  3801. Name: aws.String("String"),
  3802. Values: []*string{
  3803. aws.String("String"), // Required
  3804. // More values...
  3805. },
  3806. },
  3807. // More values...
  3808. },
  3809. VpcIds: []*string{
  3810. aws.String("String"), // Required
  3811. // More values...
  3812. },
  3813. }
  3814. resp, err := svc.DescribeVpcs(params)
  3815. if err != nil {
  3816. // Print the error, cast err to awserr.Error to get the Code and
  3817. // Message from an error.
  3818. fmt.Println(err.Error())
  3819. return
  3820. }
  3821. // Pretty-print the response data.
  3822. fmt.Println(resp)
  3823. }
  3824. func ExampleEC2_DescribeVpnConnections() {
  3825. sess, err := session.NewSession()
  3826. if err != nil {
  3827. fmt.Println("failed to create session,", err)
  3828. return
  3829. }
  3830. svc := ec2.New(sess)
  3831. params := &ec2.DescribeVpnConnectionsInput{
  3832. DryRun: aws.Bool(true),
  3833. Filters: []*ec2.Filter{
  3834. { // Required
  3835. Name: aws.String("String"),
  3836. Values: []*string{
  3837. aws.String("String"), // Required
  3838. // More values...
  3839. },
  3840. },
  3841. // More values...
  3842. },
  3843. VpnConnectionIds: []*string{
  3844. aws.String("String"), // Required
  3845. // More values...
  3846. },
  3847. }
  3848. resp, err := svc.DescribeVpnConnections(params)
  3849. if err != nil {
  3850. // Print the error, cast err to awserr.Error to get the Code and
  3851. // Message from an error.
  3852. fmt.Println(err.Error())
  3853. return
  3854. }
  3855. // Pretty-print the response data.
  3856. fmt.Println(resp)
  3857. }
  3858. func ExampleEC2_DescribeVpnGateways() {
  3859. sess, err := session.NewSession()
  3860. if err != nil {
  3861. fmt.Println("failed to create session,", err)
  3862. return
  3863. }
  3864. svc := ec2.New(sess)
  3865. params := &ec2.DescribeVpnGatewaysInput{
  3866. DryRun: aws.Bool(true),
  3867. Filters: []*ec2.Filter{
  3868. { // Required
  3869. Name: aws.String("String"),
  3870. Values: []*string{
  3871. aws.String("String"), // Required
  3872. // More values...
  3873. },
  3874. },
  3875. // More values...
  3876. },
  3877. VpnGatewayIds: []*string{
  3878. aws.String("String"), // Required
  3879. // More values...
  3880. },
  3881. }
  3882. resp, err := svc.DescribeVpnGateways(params)
  3883. if err != nil {
  3884. // Print the error, cast err to awserr.Error to get the Code and
  3885. // Message from an error.
  3886. fmt.Println(err.Error())
  3887. return
  3888. }
  3889. // Pretty-print the response data.
  3890. fmt.Println(resp)
  3891. }
  3892. func ExampleEC2_DetachClassicLinkVpc() {
  3893. sess, err := session.NewSession()
  3894. if err != nil {
  3895. fmt.Println("failed to create session,", err)
  3896. return
  3897. }
  3898. svc := ec2.New(sess)
  3899. params := &ec2.DetachClassicLinkVpcInput{
  3900. InstanceId: aws.String("String"), // Required
  3901. VpcId: aws.String("String"), // Required
  3902. DryRun: aws.Bool(true),
  3903. }
  3904. resp, err := svc.DetachClassicLinkVpc(params)
  3905. if err != nil {
  3906. // Print the error, cast err to awserr.Error to get the Code and
  3907. // Message from an error.
  3908. fmt.Println(err.Error())
  3909. return
  3910. }
  3911. // Pretty-print the response data.
  3912. fmt.Println(resp)
  3913. }
  3914. func ExampleEC2_DetachInternetGateway() {
  3915. sess, err := session.NewSession()
  3916. if err != nil {
  3917. fmt.Println("failed to create session,", err)
  3918. return
  3919. }
  3920. svc := ec2.New(sess)
  3921. params := &ec2.DetachInternetGatewayInput{
  3922. InternetGatewayId: aws.String("String"), // Required
  3923. VpcId: aws.String("String"), // Required
  3924. DryRun: aws.Bool(true),
  3925. }
  3926. resp, err := svc.DetachInternetGateway(params)
  3927. if err != nil {
  3928. // Print the error, cast err to awserr.Error to get the Code and
  3929. // Message from an error.
  3930. fmt.Println(err.Error())
  3931. return
  3932. }
  3933. // Pretty-print the response data.
  3934. fmt.Println(resp)
  3935. }
  3936. func ExampleEC2_DetachNetworkInterface() {
  3937. sess, err := session.NewSession()
  3938. if err != nil {
  3939. fmt.Println("failed to create session,", err)
  3940. return
  3941. }
  3942. svc := ec2.New(sess)
  3943. params := &ec2.DetachNetworkInterfaceInput{
  3944. AttachmentId: aws.String("String"), // Required
  3945. DryRun: aws.Bool(true),
  3946. Force: aws.Bool(true),
  3947. }
  3948. resp, err := svc.DetachNetworkInterface(params)
  3949. if err != nil {
  3950. // Print the error, cast err to awserr.Error to get the Code and
  3951. // Message from an error.
  3952. fmt.Println(err.Error())
  3953. return
  3954. }
  3955. // Pretty-print the response data.
  3956. fmt.Println(resp)
  3957. }
  3958. func ExampleEC2_DetachVolume() {
  3959. sess, err := session.NewSession()
  3960. if err != nil {
  3961. fmt.Println("failed to create session,", err)
  3962. return
  3963. }
  3964. svc := ec2.New(sess)
  3965. params := &ec2.DetachVolumeInput{
  3966. VolumeId: aws.String("String"), // Required
  3967. Device: aws.String("String"),
  3968. DryRun: aws.Bool(true),
  3969. Force: aws.Bool(true),
  3970. InstanceId: aws.String("String"),
  3971. }
  3972. resp, err := svc.DetachVolume(params)
  3973. if err != nil {
  3974. // Print the error, cast err to awserr.Error to get the Code and
  3975. // Message from an error.
  3976. fmt.Println(err.Error())
  3977. return
  3978. }
  3979. // Pretty-print the response data.
  3980. fmt.Println(resp)
  3981. }
  3982. func ExampleEC2_DetachVpnGateway() {
  3983. sess, err := session.NewSession()
  3984. if err != nil {
  3985. fmt.Println("failed to create session,", err)
  3986. return
  3987. }
  3988. svc := ec2.New(sess)
  3989. params := &ec2.DetachVpnGatewayInput{
  3990. VpcId: aws.String("String"), // Required
  3991. VpnGatewayId: aws.String("String"), // Required
  3992. DryRun: aws.Bool(true),
  3993. }
  3994. resp, err := svc.DetachVpnGateway(params)
  3995. if err != nil {
  3996. // Print the error, cast err to awserr.Error to get the Code and
  3997. // Message from an error.
  3998. fmt.Println(err.Error())
  3999. return
  4000. }
  4001. // Pretty-print the response data.
  4002. fmt.Println(resp)
  4003. }
  4004. func ExampleEC2_DisableVgwRoutePropagation() {
  4005. sess, err := session.NewSession()
  4006. if err != nil {
  4007. fmt.Println("failed to create session,", err)
  4008. return
  4009. }
  4010. svc := ec2.New(sess)
  4011. params := &ec2.DisableVgwRoutePropagationInput{
  4012. GatewayId: aws.String("String"), // Required
  4013. RouteTableId: aws.String("String"), // Required
  4014. }
  4015. resp, err := svc.DisableVgwRoutePropagation(params)
  4016. if err != nil {
  4017. // Print the error, cast err to awserr.Error to get the Code and
  4018. // Message from an error.
  4019. fmt.Println(err.Error())
  4020. return
  4021. }
  4022. // Pretty-print the response data.
  4023. fmt.Println(resp)
  4024. }
  4025. func ExampleEC2_DisableVpcClassicLink() {
  4026. sess, err := session.NewSession()
  4027. if err != nil {
  4028. fmt.Println("failed to create session,", err)
  4029. return
  4030. }
  4031. svc := ec2.New(sess)
  4032. params := &ec2.DisableVpcClassicLinkInput{
  4033. VpcId: aws.String("String"), // Required
  4034. DryRun: aws.Bool(true),
  4035. }
  4036. resp, err := svc.DisableVpcClassicLink(params)
  4037. if err != nil {
  4038. // Print the error, cast err to awserr.Error to get the Code and
  4039. // Message from an error.
  4040. fmt.Println(err.Error())
  4041. return
  4042. }
  4043. // Pretty-print the response data.
  4044. fmt.Println(resp)
  4045. }
  4046. func ExampleEC2_DisableVpcClassicLinkDnsSupport() {
  4047. sess, err := session.NewSession()
  4048. if err != nil {
  4049. fmt.Println("failed to create session,", err)
  4050. return
  4051. }
  4052. svc := ec2.New(sess)
  4053. params := &ec2.DisableVpcClassicLinkDnsSupportInput{
  4054. VpcId: aws.String("String"),
  4055. }
  4056. resp, err := svc.DisableVpcClassicLinkDnsSupport(params)
  4057. if err != nil {
  4058. // Print the error, cast err to awserr.Error to get the Code and
  4059. // Message from an error.
  4060. fmt.Println(err.Error())
  4061. return
  4062. }
  4063. // Pretty-print the response data.
  4064. fmt.Println(resp)
  4065. }
  4066. func ExampleEC2_DisassociateAddress() {
  4067. sess, err := session.NewSession()
  4068. if err != nil {
  4069. fmt.Println("failed to create session,", err)
  4070. return
  4071. }
  4072. svc := ec2.New(sess)
  4073. params := &ec2.DisassociateAddressInput{
  4074. AssociationId: aws.String("String"),
  4075. DryRun: aws.Bool(true),
  4076. PublicIp: aws.String("String"),
  4077. }
  4078. resp, err := svc.DisassociateAddress(params)
  4079. if err != nil {
  4080. // Print the error, cast err to awserr.Error to get the Code and
  4081. // Message from an error.
  4082. fmt.Println(err.Error())
  4083. return
  4084. }
  4085. // Pretty-print the response data.
  4086. fmt.Println(resp)
  4087. }
  4088. func ExampleEC2_DisassociateRouteTable() {
  4089. sess, err := session.NewSession()
  4090. if err != nil {
  4091. fmt.Println("failed to create session,", err)
  4092. return
  4093. }
  4094. svc := ec2.New(sess)
  4095. params := &ec2.DisassociateRouteTableInput{
  4096. AssociationId: aws.String("String"), // Required
  4097. DryRun: aws.Bool(true),
  4098. }
  4099. resp, err := svc.DisassociateRouteTable(params)
  4100. if err != nil {
  4101. // Print the error, cast err to awserr.Error to get the Code and
  4102. // Message from an error.
  4103. fmt.Println(err.Error())
  4104. return
  4105. }
  4106. // Pretty-print the response data.
  4107. fmt.Println(resp)
  4108. }
  4109. func ExampleEC2_EnableVgwRoutePropagation() {
  4110. sess, err := session.NewSession()
  4111. if err != nil {
  4112. fmt.Println("failed to create session,", err)
  4113. return
  4114. }
  4115. svc := ec2.New(sess)
  4116. params := &ec2.EnableVgwRoutePropagationInput{
  4117. GatewayId: aws.String("String"), // Required
  4118. RouteTableId: aws.String("String"), // Required
  4119. }
  4120. resp, err := svc.EnableVgwRoutePropagation(params)
  4121. if err != nil {
  4122. // Print the error, cast err to awserr.Error to get the Code and
  4123. // Message from an error.
  4124. fmt.Println(err.Error())
  4125. return
  4126. }
  4127. // Pretty-print the response data.
  4128. fmt.Println(resp)
  4129. }
  4130. func ExampleEC2_EnableVolumeIO() {
  4131. sess, err := session.NewSession()
  4132. if err != nil {
  4133. fmt.Println("failed to create session,", err)
  4134. return
  4135. }
  4136. svc := ec2.New(sess)
  4137. params := &ec2.EnableVolumeIOInput{
  4138. VolumeId: aws.String("String"), // Required
  4139. DryRun: aws.Bool(true),
  4140. }
  4141. resp, err := svc.EnableVolumeIO(params)
  4142. if err != nil {
  4143. // Print the error, cast err to awserr.Error to get the Code and
  4144. // Message from an error.
  4145. fmt.Println(err.Error())
  4146. return
  4147. }
  4148. // Pretty-print the response data.
  4149. fmt.Println(resp)
  4150. }
  4151. func ExampleEC2_EnableVpcClassicLink() {
  4152. sess, err := session.NewSession()
  4153. if err != nil {
  4154. fmt.Println("failed to create session,", err)
  4155. return
  4156. }
  4157. svc := ec2.New(sess)
  4158. params := &ec2.EnableVpcClassicLinkInput{
  4159. VpcId: aws.String("String"), // Required
  4160. DryRun: aws.Bool(true),
  4161. }
  4162. resp, err := svc.EnableVpcClassicLink(params)
  4163. if err != nil {
  4164. // Print the error, cast err to awserr.Error to get the Code and
  4165. // Message from an error.
  4166. fmt.Println(err.Error())
  4167. return
  4168. }
  4169. // Pretty-print the response data.
  4170. fmt.Println(resp)
  4171. }
  4172. func ExampleEC2_EnableVpcClassicLinkDnsSupport() {
  4173. sess, err := session.NewSession()
  4174. if err != nil {
  4175. fmt.Println("failed to create session,", err)
  4176. return
  4177. }
  4178. svc := ec2.New(sess)
  4179. params := &ec2.EnableVpcClassicLinkDnsSupportInput{
  4180. VpcId: aws.String("String"),
  4181. }
  4182. resp, err := svc.EnableVpcClassicLinkDnsSupport(params)
  4183. if err != nil {
  4184. // Print the error, cast err to awserr.Error to get the Code and
  4185. // Message from an error.
  4186. fmt.Println(err.Error())
  4187. return
  4188. }
  4189. // Pretty-print the response data.
  4190. fmt.Println(resp)
  4191. }
  4192. func ExampleEC2_GetConsoleOutput() {
  4193. sess, err := session.NewSession()
  4194. if err != nil {
  4195. fmt.Println("failed to create session,", err)
  4196. return
  4197. }
  4198. svc := ec2.New(sess)
  4199. params := &ec2.GetConsoleOutputInput{
  4200. InstanceId: aws.String("String"), // Required
  4201. DryRun: aws.Bool(true),
  4202. }
  4203. resp, err := svc.GetConsoleOutput(params)
  4204. if err != nil {
  4205. // Print the error, cast err to awserr.Error to get the Code and
  4206. // Message from an error.
  4207. fmt.Println(err.Error())
  4208. return
  4209. }
  4210. // Pretty-print the response data.
  4211. fmt.Println(resp)
  4212. }
  4213. func ExampleEC2_GetConsoleScreenshot() {
  4214. sess, err := session.NewSession()
  4215. if err != nil {
  4216. fmt.Println("failed to create session,", err)
  4217. return
  4218. }
  4219. svc := ec2.New(sess)
  4220. params := &ec2.GetConsoleScreenshotInput{
  4221. InstanceId: aws.String("String"), // Required
  4222. DryRun: aws.Bool(true),
  4223. WakeUp: aws.Bool(true),
  4224. }
  4225. resp, err := svc.GetConsoleScreenshot(params)
  4226. if err != nil {
  4227. // Print the error, cast err to awserr.Error to get the Code and
  4228. // Message from an error.
  4229. fmt.Println(err.Error())
  4230. return
  4231. }
  4232. // Pretty-print the response data.
  4233. fmt.Println(resp)
  4234. }
  4235. func ExampleEC2_GetPasswordData() {
  4236. sess, err := session.NewSession()
  4237. if err != nil {
  4238. fmt.Println("failed to create session,", err)
  4239. return
  4240. }
  4241. svc := ec2.New(sess)
  4242. params := &ec2.GetPasswordDataInput{
  4243. InstanceId: aws.String("String"), // Required
  4244. DryRun: aws.Bool(true),
  4245. }
  4246. resp, err := svc.GetPasswordData(params)
  4247. if err != nil {
  4248. // Print the error, cast err to awserr.Error to get the Code and
  4249. // Message from an error.
  4250. fmt.Println(err.Error())
  4251. return
  4252. }
  4253. // Pretty-print the response data.
  4254. fmt.Println(resp)
  4255. }
  4256. func ExampleEC2_ImportImage() {
  4257. sess, err := session.NewSession()
  4258. if err != nil {
  4259. fmt.Println("failed to create session,", err)
  4260. return
  4261. }
  4262. svc := ec2.New(sess)
  4263. params := &ec2.ImportImageInput{
  4264. Architecture: aws.String("String"),
  4265. ClientData: &ec2.ClientData{
  4266. Comment: aws.String("String"),
  4267. UploadEnd: aws.Time(time.Now()),
  4268. UploadSize: aws.Float64(1.0),
  4269. UploadStart: aws.Time(time.Now()),
  4270. },
  4271. ClientToken: aws.String("String"),
  4272. Description: aws.String("String"),
  4273. DiskContainers: []*ec2.ImageDiskContainer{
  4274. { // Required
  4275. Description: aws.String("String"),
  4276. DeviceName: aws.String("String"),
  4277. Format: aws.String("String"),
  4278. SnapshotId: aws.String("String"),
  4279. Url: aws.String("String"),
  4280. UserBucket: &ec2.UserBucket{
  4281. S3Bucket: aws.String("String"),
  4282. S3Key: aws.String("String"),
  4283. },
  4284. },
  4285. // More values...
  4286. },
  4287. DryRun: aws.Bool(true),
  4288. Hypervisor: aws.String("String"),
  4289. LicenseType: aws.String("String"),
  4290. Platform: aws.String("String"),
  4291. RoleName: aws.String("String"),
  4292. }
  4293. resp, err := svc.ImportImage(params)
  4294. if err != nil {
  4295. // Print the error, cast err to awserr.Error to get the Code and
  4296. // Message from an error.
  4297. fmt.Println(err.Error())
  4298. return
  4299. }
  4300. // Pretty-print the response data.
  4301. fmt.Println(resp)
  4302. }
  4303. func ExampleEC2_ImportInstance() {
  4304. sess, err := session.NewSession()
  4305. if err != nil {
  4306. fmt.Println("failed to create session,", err)
  4307. return
  4308. }
  4309. svc := ec2.New(sess)
  4310. params := &ec2.ImportInstanceInput{
  4311. Platform: aws.String("PlatformValues"), // Required
  4312. Description: aws.String("String"),
  4313. DiskImages: []*ec2.DiskImage{
  4314. { // Required
  4315. Description: aws.String("String"),
  4316. Image: &ec2.DiskImageDetail{
  4317. Bytes: aws.Int64(1), // Required
  4318. Format: aws.String("DiskImageFormat"), // Required
  4319. ImportManifestUrl: aws.String("String"), // Required
  4320. },
  4321. Volume: &ec2.VolumeDetail{
  4322. Size: aws.Int64(1), // Required
  4323. },
  4324. },
  4325. // More values...
  4326. },
  4327. DryRun: aws.Bool(true),
  4328. LaunchSpecification: &ec2.ImportInstanceLaunchSpecification{
  4329. AdditionalInfo: aws.String("String"),
  4330. Architecture: aws.String("ArchitectureValues"),
  4331. GroupIds: []*string{
  4332. aws.String("String"), // Required
  4333. // More values...
  4334. },
  4335. GroupNames: []*string{
  4336. aws.String("String"), // Required
  4337. // More values...
  4338. },
  4339. InstanceInitiatedShutdownBehavior: aws.String("ShutdownBehavior"),
  4340. InstanceType: aws.String("InstanceType"),
  4341. Monitoring: aws.Bool(true),
  4342. Placement: &ec2.Placement{
  4343. Affinity: aws.String("String"),
  4344. AvailabilityZone: aws.String("String"),
  4345. GroupName: aws.String("String"),
  4346. HostId: aws.String("String"),
  4347. Tenancy: aws.String("Tenancy"),
  4348. },
  4349. PrivateIpAddress: aws.String("String"),
  4350. SubnetId: aws.String("String"),
  4351. UserData: &ec2.UserData{
  4352. Data: aws.String("String"),
  4353. },
  4354. },
  4355. }
  4356. resp, err := svc.ImportInstance(params)
  4357. if err != nil {
  4358. // Print the error, cast err to awserr.Error to get the Code and
  4359. // Message from an error.
  4360. fmt.Println(err.Error())
  4361. return
  4362. }
  4363. // Pretty-print the response data.
  4364. fmt.Println(resp)
  4365. }
  4366. func ExampleEC2_ImportKeyPair() {
  4367. sess, err := session.NewSession()
  4368. if err != nil {
  4369. fmt.Println("failed to create session,", err)
  4370. return
  4371. }
  4372. svc := ec2.New(sess)
  4373. params := &ec2.ImportKeyPairInput{
  4374. KeyName: aws.String("String"), // Required
  4375. PublicKeyMaterial: []byte("PAYLOAD"), // Required
  4376. DryRun: aws.Bool(true),
  4377. }
  4378. resp, err := svc.ImportKeyPair(params)
  4379. if err != nil {
  4380. // Print the error, cast err to awserr.Error to get the Code and
  4381. // Message from an error.
  4382. fmt.Println(err.Error())
  4383. return
  4384. }
  4385. // Pretty-print the response data.
  4386. fmt.Println(resp)
  4387. }
  4388. func ExampleEC2_ImportSnapshot() {
  4389. sess, err := session.NewSession()
  4390. if err != nil {
  4391. fmt.Println("failed to create session,", err)
  4392. return
  4393. }
  4394. svc := ec2.New(sess)
  4395. params := &ec2.ImportSnapshotInput{
  4396. ClientData: &ec2.ClientData{
  4397. Comment: aws.String("String"),
  4398. UploadEnd: aws.Time(time.Now()),
  4399. UploadSize: aws.Float64(1.0),
  4400. UploadStart: aws.Time(time.Now()),
  4401. },
  4402. ClientToken: aws.String("String"),
  4403. Description: aws.String("String"),
  4404. DiskContainer: &ec2.SnapshotDiskContainer{
  4405. Description: aws.String("String"),
  4406. Format: aws.String("String"),
  4407. Url: aws.String("String"),
  4408. UserBucket: &ec2.UserBucket{
  4409. S3Bucket: aws.String("String"),
  4410. S3Key: aws.String("String"),
  4411. },
  4412. },
  4413. DryRun: aws.Bool(true),
  4414. RoleName: aws.String("String"),
  4415. }
  4416. resp, err := svc.ImportSnapshot(params)
  4417. if err != nil {
  4418. // Print the error, cast err to awserr.Error to get the Code and
  4419. // Message from an error.
  4420. fmt.Println(err.Error())
  4421. return
  4422. }
  4423. // Pretty-print the response data.
  4424. fmt.Println(resp)
  4425. }
  4426. func ExampleEC2_ImportVolume() {
  4427. sess, err := session.NewSession()
  4428. if err != nil {
  4429. fmt.Println("failed to create session,", err)
  4430. return
  4431. }
  4432. svc := ec2.New(sess)
  4433. params := &ec2.ImportVolumeInput{
  4434. AvailabilityZone: aws.String("String"), // Required
  4435. Image: &ec2.DiskImageDetail{ // Required
  4436. Bytes: aws.Int64(1), // Required
  4437. Format: aws.String("DiskImageFormat"), // Required
  4438. ImportManifestUrl: aws.String("String"), // Required
  4439. },
  4440. Volume: &ec2.VolumeDetail{ // Required
  4441. Size: aws.Int64(1), // Required
  4442. },
  4443. Description: aws.String("String"),
  4444. DryRun: aws.Bool(true),
  4445. }
  4446. resp, err := svc.ImportVolume(params)
  4447. if err != nil {
  4448. // Print the error, cast err to awserr.Error to get the Code and
  4449. // Message from an error.
  4450. fmt.Println(err.Error())
  4451. return
  4452. }
  4453. // Pretty-print the response data.
  4454. fmt.Println(resp)
  4455. }
  4456. func ExampleEC2_ModifyHosts() {
  4457. sess, err := session.NewSession()
  4458. if err != nil {
  4459. fmt.Println("failed to create session,", err)
  4460. return
  4461. }
  4462. svc := ec2.New(sess)
  4463. params := &ec2.ModifyHostsInput{
  4464. AutoPlacement: aws.String("AutoPlacement"), // Required
  4465. HostIds: []*string{ // Required
  4466. aws.String("String"), // Required
  4467. // More values...
  4468. },
  4469. }
  4470. resp, err := svc.ModifyHosts(params)
  4471. if err != nil {
  4472. // Print the error, cast err to awserr.Error to get the Code and
  4473. // Message from an error.
  4474. fmt.Println(err.Error())
  4475. return
  4476. }
  4477. // Pretty-print the response data.
  4478. fmt.Println(resp)
  4479. }
  4480. func ExampleEC2_ModifyIdFormat() {
  4481. sess, err := session.NewSession()
  4482. if err != nil {
  4483. fmt.Println("failed to create session,", err)
  4484. return
  4485. }
  4486. svc := ec2.New(sess)
  4487. params := &ec2.ModifyIdFormatInput{
  4488. Resource: aws.String("String"), // Required
  4489. UseLongIds: aws.Bool(true), // Required
  4490. }
  4491. resp, err := svc.ModifyIdFormat(params)
  4492. if err != nil {
  4493. // Print the error, cast err to awserr.Error to get the Code and
  4494. // Message from an error.
  4495. fmt.Println(err.Error())
  4496. return
  4497. }
  4498. // Pretty-print the response data.
  4499. fmt.Println(resp)
  4500. }
  4501. func ExampleEC2_ModifyIdentityIdFormat() {
  4502. sess, err := session.NewSession()
  4503. if err != nil {
  4504. fmt.Println("failed to create session,", err)
  4505. return
  4506. }
  4507. svc := ec2.New(sess)
  4508. params := &ec2.ModifyIdentityIdFormatInput{
  4509. PrincipalArn: aws.String("String"), // Required
  4510. Resource: aws.String("String"), // Required
  4511. UseLongIds: aws.Bool(true), // Required
  4512. }
  4513. resp, err := svc.ModifyIdentityIdFormat(params)
  4514. if err != nil {
  4515. // Print the error, cast err to awserr.Error to get the Code and
  4516. // Message from an error.
  4517. fmt.Println(err.Error())
  4518. return
  4519. }
  4520. // Pretty-print the response data.
  4521. fmt.Println(resp)
  4522. }
  4523. func ExampleEC2_ModifyImageAttribute() {
  4524. sess, err := session.NewSession()
  4525. if err != nil {
  4526. fmt.Println("failed to create session,", err)
  4527. return
  4528. }
  4529. svc := ec2.New(sess)
  4530. params := &ec2.ModifyImageAttributeInput{
  4531. ImageId: aws.String("String"), // Required
  4532. Attribute: aws.String("String"),
  4533. Description: &ec2.AttributeValue{
  4534. Value: aws.String("String"),
  4535. },
  4536. DryRun: aws.Bool(true),
  4537. LaunchPermission: &ec2.LaunchPermissionModifications{
  4538. Add: []*ec2.LaunchPermission{
  4539. { // Required
  4540. Group: aws.String("PermissionGroup"),
  4541. UserId: aws.String("String"),
  4542. },
  4543. // More values...
  4544. },
  4545. Remove: []*ec2.LaunchPermission{
  4546. { // Required
  4547. Group: aws.String("PermissionGroup"),
  4548. UserId: aws.String("String"),
  4549. },
  4550. // More values...
  4551. },
  4552. },
  4553. OperationType: aws.String("OperationType"),
  4554. ProductCodes: []*string{
  4555. aws.String("String"), // Required
  4556. // More values...
  4557. },
  4558. UserGroups: []*string{
  4559. aws.String("String"), // Required
  4560. // More values...
  4561. },
  4562. UserIds: []*string{
  4563. aws.String("String"), // Required
  4564. // More values...
  4565. },
  4566. Value: aws.String("String"),
  4567. }
  4568. resp, err := svc.ModifyImageAttribute(params)
  4569. if err != nil {
  4570. // Print the error, cast err to awserr.Error to get the Code and
  4571. // Message from an error.
  4572. fmt.Println(err.Error())
  4573. return
  4574. }
  4575. // Pretty-print the response data.
  4576. fmt.Println(resp)
  4577. }
  4578. func ExampleEC2_ModifyInstanceAttribute() {
  4579. sess, err := session.NewSession()
  4580. if err != nil {
  4581. fmt.Println("failed to create session,", err)
  4582. return
  4583. }
  4584. svc := ec2.New(sess)
  4585. params := &ec2.ModifyInstanceAttributeInput{
  4586. InstanceId: aws.String("String"), // Required
  4587. Attribute: aws.String("InstanceAttributeName"),
  4588. BlockDeviceMappings: []*ec2.InstanceBlockDeviceMappingSpecification{
  4589. { // Required
  4590. DeviceName: aws.String("String"),
  4591. Ebs: &ec2.EbsInstanceBlockDeviceSpecification{
  4592. DeleteOnTermination: aws.Bool(true),
  4593. VolumeId: aws.String("String"),
  4594. },
  4595. NoDevice: aws.String("String"),
  4596. VirtualName: aws.String("String"),
  4597. },
  4598. // More values...
  4599. },
  4600. DisableApiTermination: &ec2.AttributeBooleanValue{
  4601. Value: aws.Bool(true),
  4602. },
  4603. DryRun: aws.Bool(true),
  4604. EbsOptimized: &ec2.AttributeBooleanValue{
  4605. Value: aws.Bool(true),
  4606. },
  4607. EnaSupport: &ec2.AttributeBooleanValue{
  4608. Value: aws.Bool(true),
  4609. },
  4610. Groups: []*string{
  4611. aws.String("String"), // Required
  4612. // More values...
  4613. },
  4614. InstanceInitiatedShutdownBehavior: &ec2.AttributeValue{
  4615. Value: aws.String("String"),
  4616. },
  4617. InstanceType: &ec2.AttributeValue{
  4618. Value: aws.String("String"),
  4619. },
  4620. Kernel: &ec2.AttributeValue{
  4621. Value: aws.String("String"),
  4622. },
  4623. Ramdisk: &ec2.AttributeValue{
  4624. Value: aws.String("String"),
  4625. },
  4626. SourceDestCheck: &ec2.AttributeBooleanValue{
  4627. Value: aws.Bool(true),
  4628. },
  4629. SriovNetSupport: &ec2.AttributeValue{
  4630. Value: aws.String("String"),
  4631. },
  4632. UserData: &ec2.BlobAttributeValue{
  4633. Value: []byte("PAYLOAD"),
  4634. },
  4635. Value: aws.String("String"),
  4636. }
  4637. resp, err := svc.ModifyInstanceAttribute(params)
  4638. if err != nil {
  4639. // Print the error, cast err to awserr.Error to get the Code and
  4640. // Message from an error.
  4641. fmt.Println(err.Error())
  4642. return
  4643. }
  4644. // Pretty-print the response data.
  4645. fmt.Println(resp)
  4646. }
  4647. func ExampleEC2_ModifyInstancePlacement() {
  4648. sess, err := session.NewSession()
  4649. if err != nil {
  4650. fmt.Println("failed to create session,", err)
  4651. return
  4652. }
  4653. svc := ec2.New(sess)
  4654. params := &ec2.ModifyInstancePlacementInput{
  4655. InstanceId: aws.String("String"), // Required
  4656. Affinity: aws.String("Affinity"),
  4657. HostId: aws.String("String"),
  4658. Tenancy: aws.String("HostTenancy"),
  4659. }
  4660. resp, err := svc.ModifyInstancePlacement(params)
  4661. if err != nil {
  4662. // Print the error, cast err to awserr.Error to get the Code and
  4663. // Message from an error.
  4664. fmt.Println(err.Error())
  4665. return
  4666. }
  4667. // Pretty-print the response data.
  4668. fmt.Println(resp)
  4669. }
  4670. func ExampleEC2_ModifyNetworkInterfaceAttribute() {
  4671. sess, err := session.NewSession()
  4672. if err != nil {
  4673. fmt.Println("failed to create session,", err)
  4674. return
  4675. }
  4676. svc := ec2.New(sess)
  4677. params := &ec2.ModifyNetworkInterfaceAttributeInput{
  4678. NetworkInterfaceId: aws.String("String"), // Required
  4679. Attachment: &ec2.NetworkInterfaceAttachmentChanges{
  4680. AttachmentId: aws.String("String"),
  4681. DeleteOnTermination: aws.Bool(true),
  4682. },
  4683. Description: &ec2.AttributeValue{
  4684. Value: aws.String("String"),
  4685. },
  4686. DryRun: aws.Bool(true),
  4687. Groups: []*string{
  4688. aws.String("String"), // Required
  4689. // More values...
  4690. },
  4691. SourceDestCheck: &ec2.AttributeBooleanValue{
  4692. Value: aws.Bool(true),
  4693. },
  4694. }
  4695. resp, err := svc.ModifyNetworkInterfaceAttribute(params)
  4696. if err != nil {
  4697. // Print the error, cast err to awserr.Error to get the Code and
  4698. // Message from an error.
  4699. fmt.Println(err.Error())
  4700. return
  4701. }
  4702. // Pretty-print the response data.
  4703. fmt.Println(resp)
  4704. }
  4705. func ExampleEC2_ModifyReservedInstances() {
  4706. sess, err := session.NewSession()
  4707. if err != nil {
  4708. fmt.Println("failed to create session,", err)
  4709. return
  4710. }
  4711. svc := ec2.New(sess)
  4712. params := &ec2.ModifyReservedInstancesInput{
  4713. ReservedInstancesIds: []*string{ // Required
  4714. aws.String("String"), // Required
  4715. // More values...
  4716. },
  4717. TargetConfigurations: []*ec2.ReservedInstancesConfiguration{ // Required
  4718. { // Required
  4719. AvailabilityZone: aws.String("String"),
  4720. InstanceCount: aws.Int64(1),
  4721. InstanceType: aws.String("InstanceType"),
  4722. Platform: aws.String("String"),
  4723. },
  4724. // More values...
  4725. },
  4726. ClientToken: aws.String("String"),
  4727. }
  4728. resp, err := svc.ModifyReservedInstances(params)
  4729. if err != nil {
  4730. // Print the error, cast err to awserr.Error to get the Code and
  4731. // Message from an error.
  4732. fmt.Println(err.Error())
  4733. return
  4734. }
  4735. // Pretty-print the response data.
  4736. fmt.Println(resp)
  4737. }
  4738. func ExampleEC2_ModifySnapshotAttribute() {
  4739. sess, err := session.NewSession()
  4740. if err != nil {
  4741. fmt.Println("failed to create session,", err)
  4742. return
  4743. }
  4744. svc := ec2.New(sess)
  4745. params := &ec2.ModifySnapshotAttributeInput{
  4746. SnapshotId: aws.String("String"), // Required
  4747. Attribute: aws.String("SnapshotAttributeName"),
  4748. CreateVolumePermission: &ec2.CreateVolumePermissionModifications{
  4749. Add: []*ec2.CreateVolumePermission{
  4750. { // Required
  4751. Group: aws.String("PermissionGroup"),
  4752. UserId: aws.String("String"),
  4753. },
  4754. // More values...
  4755. },
  4756. Remove: []*ec2.CreateVolumePermission{
  4757. { // Required
  4758. Group: aws.String("PermissionGroup"),
  4759. UserId: aws.String("String"),
  4760. },
  4761. // More values...
  4762. },
  4763. },
  4764. DryRun: aws.Bool(true),
  4765. GroupNames: []*string{
  4766. aws.String("String"), // Required
  4767. // More values...
  4768. },
  4769. OperationType: aws.String("OperationType"),
  4770. UserIds: []*string{
  4771. aws.String("String"), // Required
  4772. // More values...
  4773. },
  4774. }
  4775. resp, err := svc.ModifySnapshotAttribute(params)
  4776. if err != nil {
  4777. // Print the error, cast err to awserr.Error to get the Code and
  4778. // Message from an error.
  4779. fmt.Println(err.Error())
  4780. return
  4781. }
  4782. // Pretty-print the response data.
  4783. fmt.Println(resp)
  4784. }
  4785. func ExampleEC2_ModifySpotFleetRequest() {
  4786. sess, err := session.NewSession()
  4787. if err != nil {
  4788. fmt.Println("failed to create session,", err)
  4789. return
  4790. }
  4791. svc := ec2.New(sess)
  4792. params := &ec2.ModifySpotFleetRequestInput{
  4793. SpotFleetRequestId: aws.String("String"), // Required
  4794. ExcessCapacityTerminationPolicy: aws.String("ExcessCapacityTerminationPolicy"),
  4795. TargetCapacity: aws.Int64(1),
  4796. }
  4797. resp, err := svc.ModifySpotFleetRequest(params)
  4798. if err != nil {
  4799. // Print the error, cast err to awserr.Error to get the Code and
  4800. // Message from an error.
  4801. fmt.Println(err.Error())
  4802. return
  4803. }
  4804. // Pretty-print the response data.
  4805. fmt.Println(resp)
  4806. }
  4807. func ExampleEC2_ModifySubnetAttribute() {
  4808. sess, err := session.NewSession()
  4809. if err != nil {
  4810. fmt.Println("failed to create session,", err)
  4811. return
  4812. }
  4813. svc := ec2.New(sess)
  4814. params := &ec2.ModifySubnetAttributeInput{
  4815. SubnetId: aws.String("String"), // Required
  4816. MapPublicIpOnLaunch: &ec2.AttributeBooleanValue{
  4817. Value: aws.Bool(true),
  4818. },
  4819. }
  4820. resp, err := svc.ModifySubnetAttribute(params)
  4821. if err != nil {
  4822. // Print the error, cast err to awserr.Error to get the Code and
  4823. // Message from an error.
  4824. fmt.Println(err.Error())
  4825. return
  4826. }
  4827. // Pretty-print the response data.
  4828. fmt.Println(resp)
  4829. }
  4830. func ExampleEC2_ModifyVolumeAttribute() {
  4831. sess, err := session.NewSession()
  4832. if err != nil {
  4833. fmt.Println("failed to create session,", err)
  4834. return
  4835. }
  4836. svc := ec2.New(sess)
  4837. params := &ec2.ModifyVolumeAttributeInput{
  4838. VolumeId: aws.String("String"), // Required
  4839. AutoEnableIO: &ec2.AttributeBooleanValue{
  4840. Value: aws.Bool(true),
  4841. },
  4842. DryRun: aws.Bool(true),
  4843. }
  4844. resp, err := svc.ModifyVolumeAttribute(params)
  4845. if err != nil {
  4846. // Print the error, cast err to awserr.Error to get the Code and
  4847. // Message from an error.
  4848. fmt.Println(err.Error())
  4849. return
  4850. }
  4851. // Pretty-print the response data.
  4852. fmt.Println(resp)
  4853. }
  4854. func ExampleEC2_ModifyVpcAttribute() {
  4855. sess, err := session.NewSession()
  4856. if err != nil {
  4857. fmt.Println("failed to create session,", err)
  4858. return
  4859. }
  4860. svc := ec2.New(sess)
  4861. params := &ec2.ModifyVpcAttributeInput{
  4862. VpcId: aws.String("String"), // Required
  4863. EnableDnsHostnames: &ec2.AttributeBooleanValue{
  4864. Value: aws.Bool(true),
  4865. },
  4866. EnableDnsSupport: &ec2.AttributeBooleanValue{
  4867. Value: aws.Bool(true),
  4868. },
  4869. }
  4870. resp, err := svc.ModifyVpcAttribute(params)
  4871. if err != nil {
  4872. // Print the error, cast err to awserr.Error to get the Code and
  4873. // Message from an error.
  4874. fmt.Println(err.Error())
  4875. return
  4876. }
  4877. // Pretty-print the response data.
  4878. fmt.Println(resp)
  4879. }
  4880. func ExampleEC2_ModifyVpcEndpoint() {
  4881. sess, err := session.NewSession()
  4882. if err != nil {
  4883. fmt.Println("failed to create session,", err)
  4884. return
  4885. }
  4886. svc := ec2.New(sess)
  4887. params := &ec2.ModifyVpcEndpointInput{
  4888. VpcEndpointId: aws.String("String"), // Required
  4889. AddRouteTableIds: []*string{
  4890. aws.String("String"), // Required
  4891. // More values...
  4892. },
  4893. DryRun: aws.Bool(true),
  4894. PolicyDocument: aws.String("String"),
  4895. RemoveRouteTableIds: []*string{
  4896. aws.String("String"), // Required
  4897. // More values...
  4898. },
  4899. ResetPolicy: aws.Bool(true),
  4900. }
  4901. resp, err := svc.ModifyVpcEndpoint(params)
  4902. if err != nil {
  4903. // Print the error, cast err to awserr.Error to get the Code and
  4904. // Message from an error.
  4905. fmt.Println(err.Error())
  4906. return
  4907. }
  4908. // Pretty-print the response data.
  4909. fmt.Println(resp)
  4910. }
  4911. func ExampleEC2_ModifyVpcPeeringConnectionOptions() {
  4912. sess, err := session.NewSession()
  4913. if err != nil {
  4914. fmt.Println("failed to create session,", err)
  4915. return
  4916. }
  4917. svc := ec2.New(sess)
  4918. params := &ec2.ModifyVpcPeeringConnectionOptionsInput{
  4919. VpcPeeringConnectionId: aws.String("String"), // Required
  4920. AccepterPeeringConnectionOptions: &ec2.PeeringConnectionOptionsRequest{
  4921. AllowDnsResolutionFromRemoteVpc: aws.Bool(true),
  4922. AllowEgressFromLocalClassicLinkToRemoteVpc: aws.Bool(true),
  4923. AllowEgressFromLocalVpcToRemoteClassicLink: aws.Bool(true),
  4924. },
  4925. DryRun: aws.Bool(true),
  4926. RequesterPeeringConnectionOptions: &ec2.PeeringConnectionOptionsRequest{
  4927. AllowDnsResolutionFromRemoteVpc: aws.Bool(true),
  4928. AllowEgressFromLocalClassicLinkToRemoteVpc: aws.Bool(true),
  4929. AllowEgressFromLocalVpcToRemoteClassicLink: aws.Bool(true),
  4930. },
  4931. }
  4932. resp, err := svc.ModifyVpcPeeringConnectionOptions(params)
  4933. if err != nil {
  4934. // Print the error, cast err to awserr.Error to get the Code and
  4935. // Message from an error.
  4936. fmt.Println(err.Error())
  4937. return
  4938. }
  4939. // Pretty-print the response data.
  4940. fmt.Println(resp)
  4941. }
  4942. func ExampleEC2_MonitorInstances() {
  4943. sess, err := session.NewSession()
  4944. if err != nil {
  4945. fmt.Println("failed to create session,", err)
  4946. return
  4947. }
  4948. svc := ec2.New(sess)
  4949. params := &ec2.MonitorInstancesInput{
  4950. InstanceIds: []*string{ // Required
  4951. aws.String("String"), // Required
  4952. // More values...
  4953. },
  4954. DryRun: aws.Bool(true),
  4955. }
  4956. resp, err := svc.MonitorInstances(params)
  4957. if err != nil {
  4958. // Print the error, cast err to awserr.Error to get the Code and
  4959. // Message from an error.
  4960. fmt.Println(err.Error())
  4961. return
  4962. }
  4963. // Pretty-print the response data.
  4964. fmt.Println(resp)
  4965. }
  4966. func ExampleEC2_MoveAddressToVpc() {
  4967. sess, err := session.NewSession()
  4968. if err != nil {
  4969. fmt.Println("failed to create session,", err)
  4970. return
  4971. }
  4972. svc := ec2.New(sess)
  4973. params := &ec2.MoveAddressToVpcInput{
  4974. PublicIp: aws.String("String"), // Required
  4975. DryRun: aws.Bool(true),
  4976. }
  4977. resp, err := svc.MoveAddressToVpc(params)
  4978. if err != nil {
  4979. // Print the error, cast err to awserr.Error to get the Code and
  4980. // Message from an error.
  4981. fmt.Println(err.Error())
  4982. return
  4983. }
  4984. // Pretty-print the response data.
  4985. fmt.Println(resp)
  4986. }
  4987. func ExampleEC2_PurchaseReservedInstancesOffering() {
  4988. sess, err := session.NewSession()
  4989. if err != nil {
  4990. fmt.Println("failed to create session,", err)
  4991. return
  4992. }
  4993. svc := ec2.New(sess)
  4994. params := &ec2.PurchaseReservedInstancesOfferingInput{
  4995. InstanceCount: aws.Int64(1), // Required
  4996. ReservedInstancesOfferingId: aws.String("String"), // Required
  4997. DryRun: aws.Bool(true),
  4998. LimitPrice: &ec2.ReservedInstanceLimitPrice{
  4999. Amount: aws.Float64(1.0),
  5000. CurrencyCode: aws.String("CurrencyCodeValues"),
  5001. },
  5002. }
  5003. resp, err := svc.PurchaseReservedInstancesOffering(params)
  5004. if err != nil {
  5005. // Print the error, cast err to awserr.Error to get the Code and
  5006. // Message from an error.
  5007. fmt.Println(err.Error())
  5008. return
  5009. }
  5010. // Pretty-print the response data.
  5011. fmt.Println(resp)
  5012. }
  5013. func ExampleEC2_PurchaseScheduledInstances() {
  5014. sess, err := session.NewSession()
  5015. if err != nil {
  5016. fmt.Println("failed to create session,", err)
  5017. return
  5018. }
  5019. svc := ec2.New(sess)
  5020. params := &ec2.PurchaseScheduledInstancesInput{
  5021. PurchaseRequests: []*ec2.PurchaseRequest{ // Required
  5022. { // Required
  5023. InstanceCount: aws.Int64(1), // Required
  5024. PurchaseToken: aws.String("String"), // Required
  5025. },
  5026. // More values...
  5027. },
  5028. ClientToken: aws.String("String"),
  5029. DryRun: aws.Bool(true),
  5030. }
  5031. resp, err := svc.PurchaseScheduledInstances(params)
  5032. if err != nil {
  5033. // Print the error, cast err to awserr.Error to get the Code and
  5034. // Message from an error.
  5035. fmt.Println(err.Error())
  5036. return
  5037. }
  5038. // Pretty-print the response data.
  5039. fmt.Println(resp)
  5040. }
  5041. func ExampleEC2_RebootInstances() {
  5042. sess, err := session.NewSession()
  5043. if err != nil {
  5044. fmt.Println("failed to create session,", err)
  5045. return
  5046. }
  5047. svc := ec2.New(sess)
  5048. params := &ec2.RebootInstancesInput{
  5049. InstanceIds: []*string{ // Required
  5050. aws.String("String"), // Required
  5051. // More values...
  5052. },
  5053. DryRun: aws.Bool(true),
  5054. }
  5055. resp, err := svc.RebootInstances(params)
  5056. if err != nil {
  5057. // Print the error, cast err to awserr.Error to get the Code and
  5058. // Message from an error.
  5059. fmt.Println(err.Error())
  5060. return
  5061. }
  5062. // Pretty-print the response data.
  5063. fmt.Println(resp)
  5064. }
  5065. func ExampleEC2_RegisterImage() {
  5066. sess, err := session.NewSession()
  5067. if err != nil {
  5068. fmt.Println("failed to create session,", err)
  5069. return
  5070. }
  5071. svc := ec2.New(sess)
  5072. params := &ec2.RegisterImageInput{
  5073. Name: aws.String("String"), // Required
  5074. Architecture: aws.String("ArchitectureValues"),
  5075. BlockDeviceMappings: []*ec2.BlockDeviceMapping{
  5076. { // Required
  5077. DeviceName: aws.String("String"),
  5078. Ebs: &ec2.EbsBlockDevice{
  5079. DeleteOnTermination: aws.Bool(true),
  5080. Encrypted: aws.Bool(true),
  5081. Iops: aws.Int64(1),
  5082. SnapshotId: aws.String("String"),
  5083. VolumeSize: aws.Int64(1),
  5084. VolumeType: aws.String("VolumeType"),
  5085. },
  5086. NoDevice: aws.String("String"),
  5087. VirtualName: aws.String("String"),
  5088. },
  5089. // More values...
  5090. },
  5091. Description: aws.String("String"),
  5092. DryRun: aws.Bool(true),
  5093. EnaSupport: aws.Bool(true),
  5094. ImageLocation: aws.String("String"),
  5095. KernelId: aws.String("String"),
  5096. RamdiskId: aws.String("String"),
  5097. RootDeviceName: aws.String("String"),
  5098. SriovNetSupport: aws.String("String"),
  5099. VirtualizationType: aws.String("String"),
  5100. }
  5101. resp, err := svc.RegisterImage(params)
  5102. if err != nil {
  5103. // Print the error, cast err to awserr.Error to get the Code and
  5104. // Message from an error.
  5105. fmt.Println(err.Error())
  5106. return
  5107. }
  5108. // Pretty-print the response data.
  5109. fmt.Println(resp)
  5110. }
  5111. func ExampleEC2_RejectVpcPeeringConnection() {
  5112. sess, err := session.NewSession()
  5113. if err != nil {
  5114. fmt.Println("failed to create session,", err)
  5115. return
  5116. }
  5117. svc := ec2.New(sess)
  5118. params := &ec2.RejectVpcPeeringConnectionInput{
  5119. VpcPeeringConnectionId: aws.String("String"), // Required
  5120. DryRun: aws.Bool(true),
  5121. }
  5122. resp, err := svc.RejectVpcPeeringConnection(params)
  5123. if err != nil {
  5124. // Print the error, cast err to awserr.Error to get the Code and
  5125. // Message from an error.
  5126. fmt.Println(err.Error())
  5127. return
  5128. }
  5129. // Pretty-print the response data.
  5130. fmt.Println(resp)
  5131. }
  5132. func ExampleEC2_ReleaseAddress() {
  5133. sess, err := session.NewSession()
  5134. if err != nil {
  5135. fmt.Println("failed to create session,", err)
  5136. return
  5137. }
  5138. svc := ec2.New(sess)
  5139. params := &ec2.ReleaseAddressInput{
  5140. AllocationId: aws.String("String"),
  5141. DryRun: aws.Bool(true),
  5142. PublicIp: aws.String("String"),
  5143. }
  5144. resp, err := svc.ReleaseAddress(params)
  5145. if err != nil {
  5146. // Print the error, cast err to awserr.Error to get the Code and
  5147. // Message from an error.
  5148. fmt.Println(err.Error())
  5149. return
  5150. }
  5151. // Pretty-print the response data.
  5152. fmt.Println(resp)
  5153. }
  5154. func ExampleEC2_ReleaseHosts() {
  5155. sess, err := session.NewSession()
  5156. if err != nil {
  5157. fmt.Println("failed to create session,", err)
  5158. return
  5159. }
  5160. svc := ec2.New(sess)
  5161. params := &ec2.ReleaseHostsInput{
  5162. HostIds: []*string{ // Required
  5163. aws.String("String"), // Required
  5164. // More values...
  5165. },
  5166. }
  5167. resp, err := svc.ReleaseHosts(params)
  5168. if err != nil {
  5169. // Print the error, cast err to awserr.Error to get the Code and
  5170. // Message from an error.
  5171. fmt.Println(err.Error())
  5172. return
  5173. }
  5174. // Pretty-print the response data.
  5175. fmt.Println(resp)
  5176. }
  5177. func ExampleEC2_ReplaceNetworkAclAssociation() {
  5178. sess, err := session.NewSession()
  5179. if err != nil {
  5180. fmt.Println("failed to create session,", err)
  5181. return
  5182. }
  5183. svc := ec2.New(sess)
  5184. params := &ec2.ReplaceNetworkAclAssociationInput{
  5185. AssociationId: aws.String("String"), // Required
  5186. NetworkAclId: aws.String("String"), // Required
  5187. DryRun: aws.Bool(true),
  5188. }
  5189. resp, err := svc.ReplaceNetworkAclAssociation(params)
  5190. if err != nil {
  5191. // Print the error, cast err to awserr.Error to get the Code and
  5192. // Message from an error.
  5193. fmt.Println(err.Error())
  5194. return
  5195. }
  5196. // Pretty-print the response data.
  5197. fmt.Println(resp)
  5198. }
  5199. func ExampleEC2_ReplaceNetworkAclEntry() {
  5200. sess, err := session.NewSession()
  5201. if err != nil {
  5202. fmt.Println("failed to create session,", err)
  5203. return
  5204. }
  5205. svc := ec2.New(sess)
  5206. params := &ec2.ReplaceNetworkAclEntryInput{
  5207. CidrBlock: aws.String("String"), // Required
  5208. Egress: aws.Bool(true), // Required
  5209. NetworkAclId: aws.String("String"), // Required
  5210. Protocol: aws.String("String"), // Required
  5211. RuleAction: aws.String("RuleAction"), // Required
  5212. RuleNumber: aws.Int64(1), // Required
  5213. DryRun: aws.Bool(true),
  5214. IcmpTypeCode: &ec2.IcmpTypeCode{
  5215. Code: aws.Int64(1),
  5216. Type: aws.Int64(1),
  5217. },
  5218. PortRange: &ec2.PortRange{
  5219. From: aws.Int64(1),
  5220. To: aws.Int64(1),
  5221. },
  5222. }
  5223. resp, err := svc.ReplaceNetworkAclEntry(params)
  5224. if err != nil {
  5225. // Print the error, cast err to awserr.Error to get the Code and
  5226. // Message from an error.
  5227. fmt.Println(err.Error())
  5228. return
  5229. }
  5230. // Pretty-print the response data.
  5231. fmt.Println(resp)
  5232. }
  5233. func ExampleEC2_ReplaceRoute() {
  5234. sess, err := session.NewSession()
  5235. if err != nil {
  5236. fmt.Println("failed to create session,", err)
  5237. return
  5238. }
  5239. svc := ec2.New(sess)
  5240. params := &ec2.ReplaceRouteInput{
  5241. DestinationCidrBlock: aws.String("String"), // Required
  5242. RouteTableId: aws.String("String"), // Required
  5243. DryRun: aws.Bool(true),
  5244. GatewayId: aws.String("String"),
  5245. InstanceId: aws.String("String"),
  5246. NatGatewayId: aws.String("String"),
  5247. NetworkInterfaceId: aws.String("String"),
  5248. VpcPeeringConnectionId: aws.String("String"),
  5249. }
  5250. resp, err := svc.ReplaceRoute(params)
  5251. if err != nil {
  5252. // Print the error, cast err to awserr.Error to get the Code and
  5253. // Message from an error.
  5254. fmt.Println(err.Error())
  5255. return
  5256. }
  5257. // Pretty-print the response data.
  5258. fmt.Println(resp)
  5259. }
  5260. func ExampleEC2_ReplaceRouteTableAssociation() {
  5261. sess, err := session.NewSession()
  5262. if err != nil {
  5263. fmt.Println("failed to create session,", err)
  5264. return
  5265. }
  5266. svc := ec2.New(sess)
  5267. params := &ec2.ReplaceRouteTableAssociationInput{
  5268. AssociationId: aws.String("String"), // Required
  5269. RouteTableId: aws.String("String"), // Required
  5270. DryRun: aws.Bool(true),
  5271. }
  5272. resp, err := svc.ReplaceRouteTableAssociation(params)
  5273. if err != nil {
  5274. // Print the error, cast err to awserr.Error to get the Code and
  5275. // Message from an error.
  5276. fmt.Println(err.Error())
  5277. return
  5278. }
  5279. // Pretty-print the response data.
  5280. fmt.Println(resp)
  5281. }
  5282. func ExampleEC2_ReportInstanceStatus() {
  5283. sess, err := session.NewSession()
  5284. if err != nil {
  5285. fmt.Println("failed to create session,", err)
  5286. return
  5287. }
  5288. svc := ec2.New(sess)
  5289. params := &ec2.ReportInstanceStatusInput{
  5290. Instances: []*string{ // Required
  5291. aws.String("String"), // Required
  5292. // More values...
  5293. },
  5294. ReasonCodes: []*string{ // Required
  5295. aws.String("ReportInstanceReasonCodes"), // Required
  5296. // More values...
  5297. },
  5298. Status: aws.String("ReportStatusType"), // Required
  5299. Description: aws.String("String"),
  5300. DryRun: aws.Bool(true),
  5301. EndTime: aws.Time(time.Now()),
  5302. StartTime: aws.Time(time.Now()),
  5303. }
  5304. resp, err := svc.ReportInstanceStatus(params)
  5305. if err != nil {
  5306. // Print the error, cast err to awserr.Error to get the Code and
  5307. // Message from an error.
  5308. fmt.Println(err.Error())
  5309. return
  5310. }
  5311. // Pretty-print the response data.
  5312. fmt.Println(resp)
  5313. }
  5314. func ExampleEC2_RequestSpotFleet() {
  5315. sess, err := session.NewSession()
  5316. if err != nil {
  5317. fmt.Println("failed to create session,", err)
  5318. return
  5319. }
  5320. svc := ec2.New(sess)
  5321. params := &ec2.RequestSpotFleetInput{
  5322. SpotFleetRequestConfig: &ec2.SpotFleetRequestConfigData{ // Required
  5323. IamFleetRole: aws.String("String"), // Required
  5324. LaunchSpecifications: []*ec2.SpotFleetLaunchSpecification{ // Required
  5325. { // Required
  5326. AddressingType: aws.String("String"),
  5327. BlockDeviceMappings: []*ec2.BlockDeviceMapping{
  5328. { // Required
  5329. DeviceName: aws.String("String"),
  5330. Ebs: &ec2.EbsBlockDevice{
  5331. DeleteOnTermination: aws.Bool(true),
  5332. Encrypted: aws.Bool(true),
  5333. Iops: aws.Int64(1),
  5334. SnapshotId: aws.String("String"),
  5335. VolumeSize: aws.Int64(1),
  5336. VolumeType: aws.String("VolumeType"),
  5337. },
  5338. NoDevice: aws.String("String"),
  5339. VirtualName: aws.String("String"),
  5340. },
  5341. // More values...
  5342. },
  5343. EbsOptimized: aws.Bool(true),
  5344. IamInstanceProfile: &ec2.IamInstanceProfileSpecification{
  5345. Arn: aws.String("String"),
  5346. Name: aws.String("String"),
  5347. },
  5348. ImageId: aws.String("String"),
  5349. InstanceType: aws.String("InstanceType"),
  5350. KernelId: aws.String("String"),
  5351. KeyName: aws.String("String"),
  5352. Monitoring: &ec2.SpotFleetMonitoring{
  5353. Enabled: aws.Bool(true),
  5354. },
  5355. NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{
  5356. { // Required
  5357. AssociatePublicIpAddress: aws.Bool(true),
  5358. DeleteOnTermination: aws.Bool(true),
  5359. Description: aws.String("String"),
  5360. DeviceIndex: aws.Int64(1),
  5361. Groups: []*string{
  5362. aws.String("String"), // Required
  5363. // More values...
  5364. },
  5365. NetworkInterfaceId: aws.String("String"),
  5366. PrivateIpAddress: aws.String("String"),
  5367. PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{
  5368. { // Required
  5369. PrivateIpAddress: aws.String("String"), // Required
  5370. Primary: aws.Bool(true),
  5371. },
  5372. // More values...
  5373. },
  5374. SecondaryPrivateIpAddressCount: aws.Int64(1),
  5375. SubnetId: aws.String("String"),
  5376. },
  5377. // More values...
  5378. },
  5379. Placement: &ec2.SpotPlacement{
  5380. AvailabilityZone: aws.String("String"),
  5381. GroupName: aws.String("String"),
  5382. },
  5383. RamdiskId: aws.String("String"),
  5384. SecurityGroups: []*ec2.GroupIdentifier{
  5385. { // Required
  5386. GroupId: aws.String("String"),
  5387. GroupName: aws.String("String"),
  5388. },
  5389. // More values...
  5390. },
  5391. SpotPrice: aws.String("String"),
  5392. SubnetId: aws.String("String"),
  5393. UserData: aws.String("String"),
  5394. WeightedCapacity: aws.Float64(1.0),
  5395. },
  5396. // More values...
  5397. },
  5398. SpotPrice: aws.String("String"), // Required
  5399. TargetCapacity: aws.Int64(1), // Required
  5400. AllocationStrategy: aws.String("AllocationStrategy"),
  5401. ClientToken: aws.String("String"),
  5402. ExcessCapacityTerminationPolicy: aws.String("ExcessCapacityTerminationPolicy"),
  5403. FulfilledCapacity: aws.Float64(1.0),
  5404. TerminateInstancesWithExpiration: aws.Bool(true),
  5405. Type: aws.String("FleetType"),
  5406. ValidFrom: aws.Time(time.Now()),
  5407. ValidUntil: aws.Time(time.Now()),
  5408. },
  5409. DryRun: aws.Bool(true),
  5410. }
  5411. resp, err := svc.RequestSpotFleet(params)
  5412. if err != nil {
  5413. // Print the error, cast err to awserr.Error to get the Code and
  5414. // Message from an error.
  5415. fmt.Println(err.Error())
  5416. return
  5417. }
  5418. // Pretty-print the response data.
  5419. fmt.Println(resp)
  5420. }
  5421. func ExampleEC2_RequestSpotInstances() {
  5422. sess, err := session.NewSession()
  5423. if err != nil {
  5424. fmt.Println("failed to create session,", err)
  5425. return
  5426. }
  5427. svc := ec2.New(sess)
  5428. params := &ec2.RequestSpotInstancesInput{
  5429. SpotPrice: aws.String("String"), // Required
  5430. AvailabilityZoneGroup: aws.String("String"),
  5431. BlockDurationMinutes: aws.Int64(1),
  5432. ClientToken: aws.String("String"),
  5433. DryRun: aws.Bool(true),
  5434. InstanceCount: aws.Int64(1),
  5435. LaunchGroup: aws.String("String"),
  5436. LaunchSpecification: &ec2.RequestSpotLaunchSpecification{
  5437. AddressingType: aws.String("String"),
  5438. BlockDeviceMappings: []*ec2.BlockDeviceMapping{
  5439. { // Required
  5440. DeviceName: aws.String("String"),
  5441. Ebs: &ec2.EbsBlockDevice{
  5442. DeleteOnTermination: aws.Bool(true),
  5443. Encrypted: aws.Bool(true),
  5444. Iops: aws.Int64(1),
  5445. SnapshotId: aws.String("String"),
  5446. VolumeSize: aws.Int64(1),
  5447. VolumeType: aws.String("VolumeType"),
  5448. },
  5449. NoDevice: aws.String("String"),
  5450. VirtualName: aws.String("String"),
  5451. },
  5452. // More values...
  5453. },
  5454. EbsOptimized: aws.Bool(true),
  5455. IamInstanceProfile: &ec2.IamInstanceProfileSpecification{
  5456. Arn: aws.String("String"),
  5457. Name: aws.String("String"),
  5458. },
  5459. ImageId: aws.String("String"),
  5460. InstanceType: aws.String("InstanceType"),
  5461. KernelId: aws.String("String"),
  5462. KeyName: aws.String("String"),
  5463. Monitoring: &ec2.RunInstancesMonitoringEnabled{
  5464. Enabled: aws.Bool(true), // Required
  5465. },
  5466. NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{
  5467. { // Required
  5468. AssociatePublicIpAddress: aws.Bool(true),
  5469. DeleteOnTermination: aws.Bool(true),
  5470. Description: aws.String("String"),
  5471. DeviceIndex: aws.Int64(1),
  5472. Groups: []*string{
  5473. aws.String("String"), // Required
  5474. // More values...
  5475. },
  5476. NetworkInterfaceId: aws.String("String"),
  5477. PrivateIpAddress: aws.String("String"),
  5478. PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{
  5479. { // Required
  5480. PrivateIpAddress: aws.String("String"), // Required
  5481. Primary: aws.Bool(true),
  5482. },
  5483. // More values...
  5484. },
  5485. SecondaryPrivateIpAddressCount: aws.Int64(1),
  5486. SubnetId: aws.String("String"),
  5487. },
  5488. // More values...
  5489. },
  5490. Placement: &ec2.SpotPlacement{
  5491. AvailabilityZone: aws.String("String"),
  5492. GroupName: aws.String("String"),
  5493. },
  5494. RamdiskId: aws.String("String"),
  5495. SecurityGroupIds: []*string{
  5496. aws.String("String"), // Required
  5497. // More values...
  5498. },
  5499. SecurityGroups: []*string{
  5500. aws.String("String"), // Required
  5501. // More values...
  5502. },
  5503. SubnetId: aws.String("String"),
  5504. UserData: aws.String("String"),
  5505. },
  5506. Type: aws.String("SpotInstanceType"),
  5507. ValidFrom: aws.Time(time.Now()),
  5508. ValidUntil: aws.Time(time.Now()),
  5509. }
  5510. resp, err := svc.RequestSpotInstances(params)
  5511. if err != nil {
  5512. // Print the error, cast err to awserr.Error to get the Code and
  5513. // Message from an error.
  5514. fmt.Println(err.Error())
  5515. return
  5516. }
  5517. // Pretty-print the response data.
  5518. fmt.Println(resp)
  5519. }
  5520. func ExampleEC2_ResetImageAttribute() {
  5521. sess, err := session.NewSession()
  5522. if err != nil {
  5523. fmt.Println("failed to create session,", err)
  5524. return
  5525. }
  5526. svc := ec2.New(sess)
  5527. params := &ec2.ResetImageAttributeInput{
  5528. Attribute: aws.String("ResetImageAttributeName"), // Required
  5529. ImageId: aws.String("String"), // Required
  5530. DryRun: aws.Bool(true),
  5531. }
  5532. resp, err := svc.ResetImageAttribute(params)
  5533. if err != nil {
  5534. // Print the error, cast err to awserr.Error to get the Code and
  5535. // Message from an error.
  5536. fmt.Println(err.Error())
  5537. return
  5538. }
  5539. // Pretty-print the response data.
  5540. fmt.Println(resp)
  5541. }
  5542. func ExampleEC2_ResetInstanceAttribute() {
  5543. sess, err := session.NewSession()
  5544. if err != nil {
  5545. fmt.Println("failed to create session,", err)
  5546. return
  5547. }
  5548. svc := ec2.New(sess)
  5549. params := &ec2.ResetInstanceAttributeInput{
  5550. Attribute: aws.String("InstanceAttributeName"), // Required
  5551. InstanceId: aws.String("String"), // Required
  5552. DryRun: aws.Bool(true),
  5553. }
  5554. resp, err := svc.ResetInstanceAttribute(params)
  5555. if err != nil {
  5556. // Print the error, cast err to awserr.Error to get the Code and
  5557. // Message from an error.
  5558. fmt.Println(err.Error())
  5559. return
  5560. }
  5561. // Pretty-print the response data.
  5562. fmt.Println(resp)
  5563. }
  5564. func ExampleEC2_ResetNetworkInterfaceAttribute() {
  5565. sess, err := session.NewSession()
  5566. if err != nil {
  5567. fmt.Println("failed to create session,", err)
  5568. return
  5569. }
  5570. svc := ec2.New(sess)
  5571. params := &ec2.ResetNetworkInterfaceAttributeInput{
  5572. NetworkInterfaceId: aws.String("String"), // Required
  5573. DryRun: aws.Bool(true),
  5574. SourceDestCheck: aws.String("String"),
  5575. }
  5576. resp, err := svc.ResetNetworkInterfaceAttribute(params)
  5577. if err != nil {
  5578. // Print the error, cast err to awserr.Error to get the Code and
  5579. // Message from an error.
  5580. fmt.Println(err.Error())
  5581. return
  5582. }
  5583. // Pretty-print the response data.
  5584. fmt.Println(resp)
  5585. }
  5586. func ExampleEC2_ResetSnapshotAttribute() {
  5587. sess, err := session.NewSession()
  5588. if err != nil {
  5589. fmt.Println("failed to create session,", err)
  5590. return
  5591. }
  5592. svc := ec2.New(sess)
  5593. params := &ec2.ResetSnapshotAttributeInput{
  5594. Attribute: aws.String("SnapshotAttributeName"), // Required
  5595. SnapshotId: aws.String("String"), // Required
  5596. DryRun: aws.Bool(true),
  5597. }
  5598. resp, err := svc.ResetSnapshotAttribute(params)
  5599. if err != nil {
  5600. // Print the error, cast err to awserr.Error to get the Code and
  5601. // Message from an error.
  5602. fmt.Println(err.Error())
  5603. return
  5604. }
  5605. // Pretty-print the response data.
  5606. fmt.Println(resp)
  5607. }
  5608. func ExampleEC2_RestoreAddressToClassic() {
  5609. sess, err := session.NewSession()
  5610. if err != nil {
  5611. fmt.Println("failed to create session,", err)
  5612. return
  5613. }
  5614. svc := ec2.New(sess)
  5615. params := &ec2.RestoreAddressToClassicInput{
  5616. PublicIp: aws.String("String"), // Required
  5617. DryRun: aws.Bool(true),
  5618. }
  5619. resp, err := svc.RestoreAddressToClassic(params)
  5620. if err != nil {
  5621. // Print the error, cast err to awserr.Error to get the Code and
  5622. // Message from an error.
  5623. fmt.Println(err.Error())
  5624. return
  5625. }
  5626. // Pretty-print the response data.
  5627. fmt.Println(resp)
  5628. }
  5629. func ExampleEC2_RevokeSecurityGroupEgress() {
  5630. sess, err := session.NewSession()
  5631. if err != nil {
  5632. fmt.Println("failed to create session,", err)
  5633. return
  5634. }
  5635. svc := ec2.New(sess)
  5636. params := &ec2.RevokeSecurityGroupEgressInput{
  5637. GroupId: aws.String("String"), // Required
  5638. CidrIp: aws.String("String"),
  5639. DryRun: aws.Bool(true),
  5640. FromPort: aws.Int64(1),
  5641. IpPermissions: []*ec2.IpPermission{
  5642. { // Required
  5643. FromPort: aws.Int64(1),
  5644. IpProtocol: aws.String("String"),
  5645. IpRanges: []*ec2.IpRange{
  5646. { // Required
  5647. CidrIp: aws.String("String"),
  5648. },
  5649. // More values...
  5650. },
  5651. PrefixListIds: []*ec2.PrefixListId{
  5652. { // Required
  5653. PrefixListId: aws.String("String"),
  5654. },
  5655. // More values...
  5656. },
  5657. ToPort: aws.Int64(1),
  5658. UserIdGroupPairs: []*ec2.UserIdGroupPair{
  5659. { // Required
  5660. GroupId: aws.String("String"),
  5661. GroupName: aws.String("String"),
  5662. PeeringStatus: aws.String("String"),
  5663. UserId: aws.String("String"),
  5664. VpcId: aws.String("String"),
  5665. VpcPeeringConnectionId: aws.String("String"),
  5666. },
  5667. // More values...
  5668. },
  5669. },
  5670. // More values...
  5671. },
  5672. IpProtocol: aws.String("String"),
  5673. SourceSecurityGroupName: aws.String("String"),
  5674. SourceSecurityGroupOwnerId: aws.String("String"),
  5675. ToPort: aws.Int64(1),
  5676. }
  5677. resp, err := svc.RevokeSecurityGroupEgress(params)
  5678. if err != nil {
  5679. // Print the error, cast err to awserr.Error to get the Code and
  5680. // Message from an error.
  5681. fmt.Println(err.Error())
  5682. return
  5683. }
  5684. // Pretty-print the response data.
  5685. fmt.Println(resp)
  5686. }
  5687. func ExampleEC2_RevokeSecurityGroupIngress() {
  5688. sess, err := session.NewSession()
  5689. if err != nil {
  5690. fmt.Println("failed to create session,", err)
  5691. return
  5692. }
  5693. svc := ec2.New(sess)
  5694. params := &ec2.RevokeSecurityGroupIngressInput{
  5695. CidrIp: aws.String("String"),
  5696. DryRun: aws.Bool(true),
  5697. FromPort: aws.Int64(1),
  5698. GroupId: aws.String("String"),
  5699. GroupName: aws.String("String"),
  5700. IpPermissions: []*ec2.IpPermission{
  5701. { // Required
  5702. FromPort: aws.Int64(1),
  5703. IpProtocol: aws.String("String"),
  5704. IpRanges: []*ec2.IpRange{
  5705. { // Required
  5706. CidrIp: aws.String("String"),
  5707. },
  5708. // More values...
  5709. },
  5710. PrefixListIds: []*ec2.PrefixListId{
  5711. { // Required
  5712. PrefixListId: aws.String("String"),
  5713. },
  5714. // More values...
  5715. },
  5716. ToPort: aws.Int64(1),
  5717. UserIdGroupPairs: []*ec2.UserIdGroupPair{
  5718. { // Required
  5719. GroupId: aws.String("String"),
  5720. GroupName: aws.String("String"),
  5721. PeeringStatus: aws.String("String"),
  5722. UserId: aws.String("String"),
  5723. VpcId: aws.String("String"),
  5724. VpcPeeringConnectionId: aws.String("String"),
  5725. },
  5726. // More values...
  5727. },
  5728. },
  5729. // More values...
  5730. },
  5731. IpProtocol: aws.String("String"),
  5732. SourceSecurityGroupName: aws.String("String"),
  5733. SourceSecurityGroupOwnerId: aws.String("String"),
  5734. ToPort: aws.Int64(1),
  5735. }
  5736. resp, err := svc.RevokeSecurityGroupIngress(params)
  5737. if err != nil {
  5738. // Print the error, cast err to awserr.Error to get the Code and
  5739. // Message from an error.
  5740. fmt.Println(err.Error())
  5741. return
  5742. }
  5743. // Pretty-print the response data.
  5744. fmt.Println(resp)
  5745. }
  5746. func ExampleEC2_RunInstances() {
  5747. sess, err := session.NewSession()
  5748. if err != nil {
  5749. fmt.Println("failed to create session,", err)
  5750. return
  5751. }
  5752. svc := ec2.New(sess)
  5753. params := &ec2.RunInstancesInput{
  5754. ImageId: aws.String("String"), // Required
  5755. MaxCount: aws.Int64(1), // Required
  5756. MinCount: aws.Int64(1), // Required
  5757. AdditionalInfo: aws.String("String"),
  5758. BlockDeviceMappings: []*ec2.BlockDeviceMapping{
  5759. { // Required
  5760. DeviceName: aws.String("String"),
  5761. Ebs: &ec2.EbsBlockDevice{
  5762. DeleteOnTermination: aws.Bool(true),
  5763. Encrypted: aws.Bool(true),
  5764. Iops: aws.Int64(1),
  5765. SnapshotId: aws.String("String"),
  5766. VolumeSize: aws.Int64(1),
  5767. VolumeType: aws.String("VolumeType"),
  5768. },
  5769. NoDevice: aws.String("String"),
  5770. VirtualName: aws.String("String"),
  5771. },
  5772. // More values...
  5773. },
  5774. ClientToken: aws.String("String"),
  5775. DisableApiTermination: aws.Bool(true),
  5776. DryRun: aws.Bool(true),
  5777. EbsOptimized: aws.Bool(true),
  5778. IamInstanceProfile: &ec2.IamInstanceProfileSpecification{
  5779. Arn: aws.String("String"),
  5780. Name: aws.String("String"),
  5781. },
  5782. InstanceInitiatedShutdownBehavior: aws.String("ShutdownBehavior"),
  5783. InstanceType: aws.String("InstanceType"),
  5784. KernelId: aws.String("String"),
  5785. KeyName: aws.String("String"),
  5786. Monitoring: &ec2.RunInstancesMonitoringEnabled{
  5787. Enabled: aws.Bool(true), // Required
  5788. },
  5789. NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{
  5790. { // Required
  5791. AssociatePublicIpAddress: aws.Bool(true),
  5792. DeleteOnTermination: aws.Bool(true),
  5793. Description: aws.String("String"),
  5794. DeviceIndex: aws.Int64(1),
  5795. Groups: []*string{
  5796. aws.String("String"), // Required
  5797. // More values...
  5798. },
  5799. NetworkInterfaceId: aws.String("String"),
  5800. PrivateIpAddress: aws.String("String"),
  5801. PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{
  5802. { // Required
  5803. PrivateIpAddress: aws.String("String"), // Required
  5804. Primary: aws.Bool(true),
  5805. },
  5806. // More values...
  5807. },
  5808. SecondaryPrivateIpAddressCount: aws.Int64(1),
  5809. SubnetId: aws.String("String"),
  5810. },
  5811. // More values...
  5812. },
  5813. Placement: &ec2.Placement{
  5814. Affinity: aws.String("String"),
  5815. AvailabilityZone: aws.String("String"),
  5816. GroupName: aws.String("String"),
  5817. HostId: aws.String("String"),
  5818. Tenancy: aws.String("Tenancy"),
  5819. },
  5820. PrivateIpAddress: aws.String("String"),
  5821. RamdiskId: aws.String("String"),
  5822. SecurityGroupIds: []*string{
  5823. aws.String("String"), // Required
  5824. // More values...
  5825. },
  5826. SecurityGroups: []*string{
  5827. aws.String("String"), // Required
  5828. // More values...
  5829. },
  5830. SubnetId: aws.String("String"),
  5831. UserData: aws.String("String"),
  5832. }
  5833. resp, err := svc.RunInstances(params)
  5834. if err != nil {
  5835. // Print the error, cast err to awserr.Error to get the Code and
  5836. // Message from an error.
  5837. fmt.Println(err.Error())
  5838. return
  5839. }
  5840. // Pretty-print the response data.
  5841. fmt.Println(resp)
  5842. }
  5843. func ExampleEC2_RunScheduledInstances() {
  5844. sess, err := session.NewSession()
  5845. if err != nil {
  5846. fmt.Println("failed to create session,", err)
  5847. return
  5848. }
  5849. svc := ec2.New(sess)
  5850. params := &ec2.RunScheduledInstancesInput{
  5851. LaunchSpecification: &ec2.ScheduledInstancesLaunchSpecification{ // Required
  5852. ImageId: aws.String("String"), // Required
  5853. BlockDeviceMappings: []*ec2.ScheduledInstancesBlockDeviceMapping{
  5854. { // Required
  5855. DeviceName: aws.String("String"),
  5856. Ebs: &ec2.ScheduledInstancesEbs{
  5857. DeleteOnTermination: aws.Bool(true),
  5858. Encrypted: aws.Bool(true),
  5859. Iops: aws.Int64(1),
  5860. SnapshotId: aws.String("String"),
  5861. VolumeSize: aws.Int64(1),
  5862. VolumeType: aws.String("String"),
  5863. },
  5864. NoDevice: aws.String("String"),
  5865. VirtualName: aws.String("String"),
  5866. },
  5867. // More values...
  5868. },
  5869. EbsOptimized: aws.Bool(true),
  5870. IamInstanceProfile: &ec2.ScheduledInstancesIamInstanceProfile{
  5871. Arn: aws.String("String"),
  5872. Name: aws.String("String"),
  5873. },
  5874. InstanceType: aws.String("String"),
  5875. KernelId: aws.String("String"),
  5876. KeyName: aws.String("String"),
  5877. Monitoring: &ec2.ScheduledInstancesMonitoring{
  5878. Enabled: aws.Bool(true),
  5879. },
  5880. NetworkInterfaces: []*ec2.ScheduledInstancesNetworkInterface{
  5881. { // Required
  5882. AssociatePublicIpAddress: aws.Bool(true),
  5883. DeleteOnTermination: aws.Bool(true),
  5884. Description: aws.String("String"),
  5885. DeviceIndex: aws.Int64(1),
  5886. Groups: []*string{
  5887. aws.String("String"), // Required
  5888. // More values...
  5889. },
  5890. NetworkInterfaceId: aws.String("String"),
  5891. PrivateIpAddress: aws.String("String"),
  5892. PrivateIpAddressConfigs: []*ec2.ScheduledInstancesPrivateIpAddressConfig{
  5893. { // Required
  5894. Primary: aws.Bool(true),
  5895. PrivateIpAddress: aws.String("String"),
  5896. },
  5897. // More values...
  5898. },
  5899. SecondaryPrivateIpAddressCount: aws.Int64(1),
  5900. SubnetId: aws.String("String"),
  5901. },
  5902. // More values...
  5903. },
  5904. Placement: &ec2.ScheduledInstancesPlacement{
  5905. AvailabilityZone: aws.String("String"),
  5906. GroupName: aws.String("String"),
  5907. },
  5908. RamdiskId: aws.String("String"),
  5909. SecurityGroupIds: []*string{
  5910. aws.String("String"), // Required
  5911. // More values...
  5912. },
  5913. SubnetId: aws.String("String"),
  5914. UserData: aws.String("String"),
  5915. },
  5916. ScheduledInstanceId: aws.String("String"), // Required
  5917. ClientToken: aws.String("String"),
  5918. DryRun: aws.Bool(true),
  5919. InstanceCount: aws.Int64(1),
  5920. }
  5921. resp, err := svc.RunScheduledInstances(params)
  5922. if err != nil {
  5923. // Print the error, cast err to awserr.Error to get the Code and
  5924. // Message from an error.
  5925. fmt.Println(err.Error())
  5926. return
  5927. }
  5928. // Pretty-print the response data.
  5929. fmt.Println(resp)
  5930. }
  5931. func ExampleEC2_StartInstances() {
  5932. sess, err := session.NewSession()
  5933. if err != nil {
  5934. fmt.Println("failed to create session,", err)
  5935. return
  5936. }
  5937. svc := ec2.New(sess)
  5938. params := &ec2.StartInstancesInput{
  5939. InstanceIds: []*string{ // Required
  5940. aws.String("String"), // Required
  5941. // More values...
  5942. },
  5943. AdditionalInfo: aws.String("String"),
  5944. DryRun: aws.Bool(true),
  5945. }
  5946. resp, err := svc.StartInstances(params)
  5947. if err != nil {
  5948. // Print the error, cast err to awserr.Error to get the Code and
  5949. // Message from an error.
  5950. fmt.Println(err.Error())
  5951. return
  5952. }
  5953. // Pretty-print the response data.
  5954. fmt.Println(resp)
  5955. }
  5956. func ExampleEC2_StopInstances() {
  5957. sess, err := session.NewSession()
  5958. if err != nil {
  5959. fmt.Println("failed to create session,", err)
  5960. return
  5961. }
  5962. svc := ec2.New(sess)
  5963. params := &ec2.StopInstancesInput{
  5964. InstanceIds: []*string{ // Required
  5965. aws.String("String"), // Required
  5966. // More values...
  5967. },
  5968. DryRun: aws.Bool(true),
  5969. Force: aws.Bool(true),
  5970. }
  5971. resp, err := svc.StopInstances(params)
  5972. if err != nil {
  5973. // Print the error, cast err to awserr.Error to get the Code and
  5974. // Message from an error.
  5975. fmt.Println(err.Error())
  5976. return
  5977. }
  5978. // Pretty-print the response data.
  5979. fmt.Println(resp)
  5980. }
  5981. func ExampleEC2_TerminateInstances() {
  5982. sess, err := session.NewSession()
  5983. if err != nil {
  5984. fmt.Println("failed to create session,", err)
  5985. return
  5986. }
  5987. svc := ec2.New(sess)
  5988. params := &ec2.TerminateInstancesInput{
  5989. InstanceIds: []*string{ // Required
  5990. aws.String("String"), // Required
  5991. // More values...
  5992. },
  5993. DryRun: aws.Bool(true),
  5994. }
  5995. resp, err := svc.TerminateInstances(params)
  5996. if err != nil {
  5997. // Print the error, cast err to awserr.Error to get the Code and
  5998. // Message from an error.
  5999. fmt.Println(err.Error())
  6000. return
  6001. }
  6002. // Pretty-print the response data.
  6003. fmt.Println(resp)
  6004. }
  6005. func ExampleEC2_UnassignPrivateIpAddresses() {
  6006. sess, err := session.NewSession()
  6007. if err != nil {
  6008. fmt.Println("failed to create session,", err)
  6009. return
  6010. }
  6011. svc := ec2.New(sess)
  6012. params := &ec2.UnassignPrivateIpAddressesInput{
  6013. NetworkInterfaceId: aws.String("String"), // Required
  6014. PrivateIpAddresses: []*string{ // Required
  6015. aws.String("String"), // Required
  6016. // More values...
  6017. },
  6018. }
  6019. resp, err := svc.UnassignPrivateIpAddresses(params)
  6020. if err != nil {
  6021. // Print the error, cast err to awserr.Error to get the Code and
  6022. // Message from an error.
  6023. fmt.Println(err.Error())
  6024. return
  6025. }
  6026. // Pretty-print the response data.
  6027. fmt.Println(resp)
  6028. }
  6029. func ExampleEC2_UnmonitorInstances() {
  6030. sess, err := session.NewSession()
  6031. if err != nil {
  6032. fmt.Println("failed to create session,", err)
  6033. return
  6034. }
  6035. svc := ec2.New(sess)
  6036. params := &ec2.UnmonitorInstancesInput{
  6037. InstanceIds: []*string{ // Required
  6038. aws.String("String"), // Required
  6039. // More values...
  6040. },
  6041. DryRun: aws.Bool(true),
  6042. }
  6043. resp, err := svc.UnmonitorInstances(params)
  6044. if err != nil {
  6045. // Print the error, cast err to awserr.Error to get the Code and
  6046. // Message from an error.
  6047. fmt.Println(err.Error())
  6048. return
  6049. }
  6050. // Pretty-print the response data.
  6051. fmt.Println(resp)
  6052. }