examples_test.go 68 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package iam_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/iam"
  10. )
  11. var _ time.Duration
  12. var _ bytes.Buffer
  13. func ExampleIAM_AddClientIDToOpenIDConnectProvider() {
  14. sess, err := session.NewSession()
  15. if err != nil {
  16. fmt.Println("failed to create session,", err)
  17. return
  18. }
  19. svc := iam.New(sess)
  20. params := &iam.AddClientIDToOpenIDConnectProviderInput{
  21. ClientID: aws.String("clientIDType"), // Required
  22. OpenIDConnectProviderArn: aws.String("arnType"), // Required
  23. }
  24. resp, err := svc.AddClientIDToOpenIDConnectProvider(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 ExampleIAM_AddRoleToInstanceProfile() {
  35. sess, err := session.NewSession()
  36. if err != nil {
  37. fmt.Println("failed to create session,", err)
  38. return
  39. }
  40. svc := iam.New(sess)
  41. params := &iam.AddRoleToInstanceProfileInput{
  42. InstanceProfileName: aws.String("instanceProfileNameType"), // Required
  43. RoleName: aws.String("roleNameType"), // Required
  44. }
  45. resp, err := svc.AddRoleToInstanceProfile(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 ExampleIAM_AddUserToGroup() {
  56. sess, err := session.NewSession()
  57. if err != nil {
  58. fmt.Println("failed to create session,", err)
  59. return
  60. }
  61. svc := iam.New(sess)
  62. params := &iam.AddUserToGroupInput{
  63. GroupName: aws.String("groupNameType"), // Required
  64. UserName: aws.String("existingUserNameType"), // Required
  65. }
  66. resp, err := svc.AddUserToGroup(params)
  67. if err != nil {
  68. // Print the error, cast err to awserr.Error to get the Code and
  69. // Message from an error.
  70. fmt.Println(err.Error())
  71. return
  72. }
  73. // Pretty-print the response data.
  74. fmt.Println(resp)
  75. }
  76. func ExampleIAM_AttachGroupPolicy() {
  77. sess, err := session.NewSession()
  78. if err != nil {
  79. fmt.Println("failed to create session,", err)
  80. return
  81. }
  82. svc := iam.New(sess)
  83. params := &iam.AttachGroupPolicyInput{
  84. GroupName: aws.String("groupNameType"), // Required
  85. PolicyArn: aws.String("arnType"), // Required
  86. }
  87. resp, err := svc.AttachGroupPolicy(params)
  88. if err != nil {
  89. // Print the error, cast err to awserr.Error to get the Code and
  90. // Message from an error.
  91. fmt.Println(err.Error())
  92. return
  93. }
  94. // Pretty-print the response data.
  95. fmt.Println(resp)
  96. }
  97. func ExampleIAM_AttachRolePolicy() {
  98. sess, err := session.NewSession()
  99. if err != nil {
  100. fmt.Println("failed to create session,", err)
  101. return
  102. }
  103. svc := iam.New(sess)
  104. params := &iam.AttachRolePolicyInput{
  105. PolicyArn: aws.String("arnType"), // Required
  106. RoleName: aws.String("roleNameType"), // Required
  107. }
  108. resp, err := svc.AttachRolePolicy(params)
  109. if err != nil {
  110. // Print the error, cast err to awserr.Error to get the Code and
  111. // Message from an error.
  112. fmt.Println(err.Error())
  113. return
  114. }
  115. // Pretty-print the response data.
  116. fmt.Println(resp)
  117. }
  118. func ExampleIAM_AttachUserPolicy() {
  119. sess, err := session.NewSession()
  120. if err != nil {
  121. fmt.Println("failed to create session,", err)
  122. return
  123. }
  124. svc := iam.New(sess)
  125. params := &iam.AttachUserPolicyInput{
  126. PolicyArn: aws.String("arnType"), // Required
  127. UserName: aws.String("userNameType"), // Required
  128. }
  129. resp, err := svc.AttachUserPolicy(params)
  130. if err != nil {
  131. // Print the error, cast err to awserr.Error to get the Code and
  132. // Message from an error.
  133. fmt.Println(err.Error())
  134. return
  135. }
  136. // Pretty-print the response data.
  137. fmt.Println(resp)
  138. }
  139. func ExampleIAM_ChangePassword() {
  140. sess, err := session.NewSession()
  141. if err != nil {
  142. fmt.Println("failed to create session,", err)
  143. return
  144. }
  145. svc := iam.New(sess)
  146. params := &iam.ChangePasswordInput{
  147. NewPassword: aws.String("passwordType"), // Required
  148. OldPassword: aws.String("passwordType"), // Required
  149. }
  150. resp, err := svc.ChangePassword(params)
  151. if err != nil {
  152. // Print the error, cast err to awserr.Error to get the Code and
  153. // Message from an error.
  154. fmt.Println(err.Error())
  155. return
  156. }
  157. // Pretty-print the response data.
  158. fmt.Println(resp)
  159. }
  160. func ExampleIAM_CreateAccessKey() {
  161. sess, err := session.NewSession()
  162. if err != nil {
  163. fmt.Println("failed to create session,", err)
  164. return
  165. }
  166. svc := iam.New(sess)
  167. params := &iam.CreateAccessKeyInput{
  168. UserName: aws.String("existingUserNameType"),
  169. }
  170. resp, err := svc.CreateAccessKey(params)
  171. if err != nil {
  172. // Print the error, cast err to awserr.Error to get the Code and
  173. // Message from an error.
  174. fmt.Println(err.Error())
  175. return
  176. }
  177. // Pretty-print the response data.
  178. fmt.Println(resp)
  179. }
  180. func ExampleIAM_CreateAccountAlias() {
  181. sess, err := session.NewSession()
  182. if err != nil {
  183. fmt.Println("failed to create session,", err)
  184. return
  185. }
  186. svc := iam.New(sess)
  187. params := &iam.CreateAccountAliasInput{
  188. AccountAlias: aws.String("accountAliasType"), // Required
  189. }
  190. resp, err := svc.CreateAccountAlias(params)
  191. if err != nil {
  192. // Print the error, cast err to awserr.Error to get the Code and
  193. // Message from an error.
  194. fmt.Println(err.Error())
  195. return
  196. }
  197. // Pretty-print the response data.
  198. fmt.Println(resp)
  199. }
  200. func ExampleIAM_CreateGroup() {
  201. sess, err := session.NewSession()
  202. if err != nil {
  203. fmt.Println("failed to create session,", err)
  204. return
  205. }
  206. svc := iam.New(sess)
  207. params := &iam.CreateGroupInput{
  208. GroupName: aws.String("groupNameType"), // Required
  209. Path: aws.String("pathType"),
  210. }
  211. resp, err := svc.CreateGroup(params)
  212. if err != nil {
  213. // Print the error, cast err to awserr.Error to get the Code and
  214. // Message from an error.
  215. fmt.Println(err.Error())
  216. return
  217. }
  218. // Pretty-print the response data.
  219. fmt.Println(resp)
  220. }
  221. func ExampleIAM_CreateInstanceProfile() {
  222. sess, err := session.NewSession()
  223. if err != nil {
  224. fmt.Println("failed to create session,", err)
  225. return
  226. }
  227. svc := iam.New(sess)
  228. params := &iam.CreateInstanceProfileInput{
  229. InstanceProfileName: aws.String("instanceProfileNameType"), // Required
  230. Path: aws.String("pathType"),
  231. }
  232. resp, err := svc.CreateInstanceProfile(params)
  233. if err != nil {
  234. // Print the error, cast err to awserr.Error to get the Code and
  235. // Message from an error.
  236. fmt.Println(err.Error())
  237. return
  238. }
  239. // Pretty-print the response data.
  240. fmt.Println(resp)
  241. }
  242. func ExampleIAM_CreateLoginProfile() {
  243. sess, err := session.NewSession()
  244. if err != nil {
  245. fmt.Println("failed to create session,", err)
  246. return
  247. }
  248. svc := iam.New(sess)
  249. params := &iam.CreateLoginProfileInput{
  250. Password: aws.String("passwordType"), // Required
  251. UserName: aws.String("userNameType"), // Required
  252. PasswordResetRequired: aws.Bool(true),
  253. }
  254. resp, err := svc.CreateLoginProfile(params)
  255. if err != nil {
  256. // Print the error, cast err to awserr.Error to get the Code and
  257. // Message from an error.
  258. fmt.Println(err.Error())
  259. return
  260. }
  261. // Pretty-print the response data.
  262. fmt.Println(resp)
  263. }
  264. func ExampleIAM_CreateOpenIDConnectProvider() {
  265. sess, err := session.NewSession()
  266. if err != nil {
  267. fmt.Println("failed to create session,", err)
  268. return
  269. }
  270. svc := iam.New(sess)
  271. params := &iam.CreateOpenIDConnectProviderInput{
  272. ThumbprintList: []*string{ // Required
  273. aws.String("thumbprintType"), // Required
  274. // More values...
  275. },
  276. Url: aws.String("OpenIDConnectProviderUrlType"), // Required
  277. ClientIDList: []*string{
  278. aws.String("clientIDType"), // Required
  279. // More values...
  280. },
  281. }
  282. resp, err := svc.CreateOpenIDConnectProvider(params)
  283. if err != nil {
  284. // Print the error, cast err to awserr.Error to get the Code and
  285. // Message from an error.
  286. fmt.Println(err.Error())
  287. return
  288. }
  289. // Pretty-print the response data.
  290. fmt.Println(resp)
  291. }
  292. func ExampleIAM_CreatePolicy() {
  293. sess, err := session.NewSession()
  294. if err != nil {
  295. fmt.Println("failed to create session,", err)
  296. return
  297. }
  298. svc := iam.New(sess)
  299. params := &iam.CreatePolicyInput{
  300. PolicyDocument: aws.String("policyDocumentType"), // Required
  301. PolicyName: aws.String("policyNameType"), // Required
  302. Description: aws.String("policyDescriptionType"),
  303. Path: aws.String("policyPathType"),
  304. }
  305. resp, err := svc.CreatePolicy(params)
  306. if err != nil {
  307. // Print the error, cast err to awserr.Error to get the Code and
  308. // Message from an error.
  309. fmt.Println(err.Error())
  310. return
  311. }
  312. // Pretty-print the response data.
  313. fmt.Println(resp)
  314. }
  315. func ExampleIAM_CreatePolicyVersion() {
  316. sess, err := session.NewSession()
  317. if err != nil {
  318. fmt.Println("failed to create session,", err)
  319. return
  320. }
  321. svc := iam.New(sess)
  322. params := &iam.CreatePolicyVersionInput{
  323. PolicyArn: aws.String("arnType"), // Required
  324. PolicyDocument: aws.String("policyDocumentType"), // Required
  325. SetAsDefault: aws.Bool(true),
  326. }
  327. resp, err := svc.CreatePolicyVersion(params)
  328. if err != nil {
  329. // Print the error, cast err to awserr.Error to get the Code and
  330. // Message from an error.
  331. fmt.Println(err.Error())
  332. return
  333. }
  334. // Pretty-print the response data.
  335. fmt.Println(resp)
  336. }
  337. func ExampleIAM_CreateRole() {
  338. sess, err := session.NewSession()
  339. if err != nil {
  340. fmt.Println("failed to create session,", err)
  341. return
  342. }
  343. svc := iam.New(sess)
  344. params := &iam.CreateRoleInput{
  345. AssumeRolePolicyDocument: aws.String("policyDocumentType"), // Required
  346. RoleName: aws.String("roleNameType"), // Required
  347. Path: aws.String("pathType"),
  348. }
  349. resp, err := svc.CreateRole(params)
  350. if err != nil {
  351. // Print the error, cast err to awserr.Error to get the Code and
  352. // Message from an error.
  353. fmt.Println(err.Error())
  354. return
  355. }
  356. // Pretty-print the response data.
  357. fmt.Println(resp)
  358. }
  359. func ExampleIAM_CreateSAMLProvider() {
  360. sess, err := session.NewSession()
  361. if err != nil {
  362. fmt.Println("failed to create session,", err)
  363. return
  364. }
  365. svc := iam.New(sess)
  366. params := &iam.CreateSAMLProviderInput{
  367. Name: aws.String("SAMLProviderNameType"), // Required
  368. SAMLMetadataDocument: aws.String("SAMLMetadataDocumentType"), // Required
  369. }
  370. resp, err := svc.CreateSAMLProvider(params)
  371. if err != nil {
  372. // Print the error, cast err to awserr.Error to get the Code and
  373. // Message from an error.
  374. fmt.Println(err.Error())
  375. return
  376. }
  377. // Pretty-print the response data.
  378. fmt.Println(resp)
  379. }
  380. func ExampleIAM_CreateUser() {
  381. sess, err := session.NewSession()
  382. if err != nil {
  383. fmt.Println("failed to create session,", err)
  384. return
  385. }
  386. svc := iam.New(sess)
  387. params := &iam.CreateUserInput{
  388. UserName: aws.String("userNameType"), // Required
  389. Path: aws.String("pathType"),
  390. }
  391. resp, err := svc.CreateUser(params)
  392. if err != nil {
  393. // Print the error, cast err to awserr.Error to get the Code and
  394. // Message from an error.
  395. fmt.Println(err.Error())
  396. return
  397. }
  398. // Pretty-print the response data.
  399. fmt.Println(resp)
  400. }
  401. func ExampleIAM_CreateVirtualMFADevice() {
  402. sess, err := session.NewSession()
  403. if err != nil {
  404. fmt.Println("failed to create session,", err)
  405. return
  406. }
  407. svc := iam.New(sess)
  408. params := &iam.CreateVirtualMFADeviceInput{
  409. VirtualMFADeviceName: aws.String("virtualMFADeviceName"), // Required
  410. Path: aws.String("pathType"),
  411. }
  412. resp, err := svc.CreateVirtualMFADevice(params)
  413. if err != nil {
  414. // Print the error, cast err to awserr.Error to get the Code and
  415. // Message from an error.
  416. fmt.Println(err.Error())
  417. return
  418. }
  419. // Pretty-print the response data.
  420. fmt.Println(resp)
  421. }
  422. func ExampleIAM_DeactivateMFADevice() {
  423. sess, err := session.NewSession()
  424. if err != nil {
  425. fmt.Println("failed to create session,", err)
  426. return
  427. }
  428. svc := iam.New(sess)
  429. params := &iam.DeactivateMFADeviceInput{
  430. SerialNumber: aws.String("serialNumberType"), // Required
  431. UserName: aws.String("existingUserNameType"), // Required
  432. }
  433. resp, err := svc.DeactivateMFADevice(params)
  434. if err != nil {
  435. // Print the error, cast err to awserr.Error to get the Code and
  436. // Message from an error.
  437. fmt.Println(err.Error())
  438. return
  439. }
  440. // Pretty-print the response data.
  441. fmt.Println(resp)
  442. }
  443. func ExampleIAM_DeleteAccessKey() {
  444. sess, err := session.NewSession()
  445. if err != nil {
  446. fmt.Println("failed to create session,", err)
  447. return
  448. }
  449. svc := iam.New(sess)
  450. params := &iam.DeleteAccessKeyInput{
  451. AccessKeyId: aws.String("accessKeyIdType"), // Required
  452. UserName: aws.String("existingUserNameType"),
  453. }
  454. resp, err := svc.DeleteAccessKey(params)
  455. if err != nil {
  456. // Print the error, cast err to awserr.Error to get the Code and
  457. // Message from an error.
  458. fmt.Println(err.Error())
  459. return
  460. }
  461. // Pretty-print the response data.
  462. fmt.Println(resp)
  463. }
  464. func ExampleIAM_DeleteAccountAlias() {
  465. sess, err := session.NewSession()
  466. if err != nil {
  467. fmt.Println("failed to create session,", err)
  468. return
  469. }
  470. svc := iam.New(sess)
  471. params := &iam.DeleteAccountAliasInput{
  472. AccountAlias: aws.String("accountAliasType"), // Required
  473. }
  474. resp, err := svc.DeleteAccountAlias(params)
  475. if err != nil {
  476. // Print the error, cast err to awserr.Error to get the Code and
  477. // Message from an error.
  478. fmt.Println(err.Error())
  479. return
  480. }
  481. // Pretty-print the response data.
  482. fmt.Println(resp)
  483. }
  484. func ExampleIAM_DeleteAccountPasswordPolicy() {
  485. sess, err := session.NewSession()
  486. if err != nil {
  487. fmt.Println("failed to create session,", err)
  488. return
  489. }
  490. svc := iam.New(sess)
  491. var params *iam.DeleteAccountPasswordPolicyInput
  492. resp, err := svc.DeleteAccountPasswordPolicy(params)
  493. if err != nil {
  494. // Print the error, cast err to awserr.Error to get the Code and
  495. // Message from an error.
  496. fmt.Println(err.Error())
  497. return
  498. }
  499. // Pretty-print the response data.
  500. fmt.Println(resp)
  501. }
  502. func ExampleIAM_DeleteGroup() {
  503. sess, err := session.NewSession()
  504. if err != nil {
  505. fmt.Println("failed to create session,", err)
  506. return
  507. }
  508. svc := iam.New(sess)
  509. params := &iam.DeleteGroupInput{
  510. GroupName: aws.String("groupNameType"), // Required
  511. }
  512. resp, err := svc.DeleteGroup(params)
  513. if err != nil {
  514. // Print the error, cast err to awserr.Error to get the Code and
  515. // Message from an error.
  516. fmt.Println(err.Error())
  517. return
  518. }
  519. // Pretty-print the response data.
  520. fmt.Println(resp)
  521. }
  522. func ExampleIAM_DeleteGroupPolicy() {
  523. sess, err := session.NewSession()
  524. if err != nil {
  525. fmt.Println("failed to create session,", err)
  526. return
  527. }
  528. svc := iam.New(sess)
  529. params := &iam.DeleteGroupPolicyInput{
  530. GroupName: aws.String("groupNameType"), // Required
  531. PolicyName: aws.String("policyNameType"), // Required
  532. }
  533. resp, err := svc.DeleteGroupPolicy(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 ExampleIAM_DeleteInstanceProfile() {
  544. sess, err := session.NewSession()
  545. if err != nil {
  546. fmt.Println("failed to create session,", err)
  547. return
  548. }
  549. svc := iam.New(sess)
  550. params := &iam.DeleteInstanceProfileInput{
  551. InstanceProfileName: aws.String("instanceProfileNameType"), // Required
  552. }
  553. resp, err := svc.DeleteInstanceProfile(params)
  554. if err != nil {
  555. // Print the error, cast err to awserr.Error to get the Code and
  556. // Message from an error.
  557. fmt.Println(err.Error())
  558. return
  559. }
  560. // Pretty-print the response data.
  561. fmt.Println(resp)
  562. }
  563. func ExampleIAM_DeleteLoginProfile() {
  564. sess, err := session.NewSession()
  565. if err != nil {
  566. fmt.Println("failed to create session,", err)
  567. return
  568. }
  569. svc := iam.New(sess)
  570. params := &iam.DeleteLoginProfileInput{
  571. UserName: aws.String("userNameType"), // Required
  572. }
  573. resp, err := svc.DeleteLoginProfile(params)
  574. if err != nil {
  575. // Print the error, cast err to awserr.Error to get the Code and
  576. // Message from an error.
  577. fmt.Println(err.Error())
  578. return
  579. }
  580. // Pretty-print the response data.
  581. fmt.Println(resp)
  582. }
  583. func ExampleIAM_DeleteOpenIDConnectProvider() {
  584. sess, err := session.NewSession()
  585. if err != nil {
  586. fmt.Println("failed to create session,", err)
  587. return
  588. }
  589. svc := iam.New(sess)
  590. params := &iam.DeleteOpenIDConnectProviderInput{
  591. OpenIDConnectProviderArn: aws.String("arnType"), // Required
  592. }
  593. resp, err := svc.DeleteOpenIDConnectProvider(params)
  594. if err != nil {
  595. // Print the error, cast err to awserr.Error to get the Code and
  596. // Message from an error.
  597. fmt.Println(err.Error())
  598. return
  599. }
  600. // Pretty-print the response data.
  601. fmt.Println(resp)
  602. }
  603. func ExampleIAM_DeletePolicy() {
  604. sess, err := session.NewSession()
  605. if err != nil {
  606. fmt.Println("failed to create session,", err)
  607. return
  608. }
  609. svc := iam.New(sess)
  610. params := &iam.DeletePolicyInput{
  611. PolicyArn: aws.String("arnType"), // Required
  612. }
  613. resp, err := svc.DeletePolicy(params)
  614. if err != nil {
  615. // Print the error, cast err to awserr.Error to get the Code and
  616. // Message from an error.
  617. fmt.Println(err.Error())
  618. return
  619. }
  620. // Pretty-print the response data.
  621. fmt.Println(resp)
  622. }
  623. func ExampleIAM_DeletePolicyVersion() {
  624. sess, err := session.NewSession()
  625. if err != nil {
  626. fmt.Println("failed to create session,", err)
  627. return
  628. }
  629. svc := iam.New(sess)
  630. params := &iam.DeletePolicyVersionInput{
  631. PolicyArn: aws.String("arnType"), // Required
  632. VersionId: aws.String("policyVersionIdType"), // Required
  633. }
  634. resp, err := svc.DeletePolicyVersion(params)
  635. if err != nil {
  636. // Print the error, cast err to awserr.Error to get the Code and
  637. // Message from an error.
  638. fmt.Println(err.Error())
  639. return
  640. }
  641. // Pretty-print the response data.
  642. fmt.Println(resp)
  643. }
  644. func ExampleIAM_DeleteRole() {
  645. sess, err := session.NewSession()
  646. if err != nil {
  647. fmt.Println("failed to create session,", err)
  648. return
  649. }
  650. svc := iam.New(sess)
  651. params := &iam.DeleteRoleInput{
  652. RoleName: aws.String("roleNameType"), // Required
  653. }
  654. resp, err := svc.DeleteRole(params)
  655. if err != nil {
  656. // Print the error, cast err to awserr.Error to get the Code and
  657. // Message from an error.
  658. fmt.Println(err.Error())
  659. return
  660. }
  661. // Pretty-print the response data.
  662. fmt.Println(resp)
  663. }
  664. func ExampleIAM_DeleteRolePolicy() {
  665. sess, err := session.NewSession()
  666. if err != nil {
  667. fmt.Println("failed to create session,", err)
  668. return
  669. }
  670. svc := iam.New(sess)
  671. params := &iam.DeleteRolePolicyInput{
  672. PolicyName: aws.String("policyNameType"), // Required
  673. RoleName: aws.String("roleNameType"), // Required
  674. }
  675. resp, err := svc.DeleteRolePolicy(params)
  676. if err != nil {
  677. // Print the error, cast err to awserr.Error to get the Code and
  678. // Message from an error.
  679. fmt.Println(err.Error())
  680. return
  681. }
  682. // Pretty-print the response data.
  683. fmt.Println(resp)
  684. }
  685. func ExampleIAM_DeleteSAMLProvider() {
  686. sess, err := session.NewSession()
  687. if err != nil {
  688. fmt.Println("failed to create session,", err)
  689. return
  690. }
  691. svc := iam.New(sess)
  692. params := &iam.DeleteSAMLProviderInput{
  693. SAMLProviderArn: aws.String("arnType"), // Required
  694. }
  695. resp, err := svc.DeleteSAMLProvider(params)
  696. if err != nil {
  697. // Print the error, cast err to awserr.Error to get the Code and
  698. // Message from an error.
  699. fmt.Println(err.Error())
  700. return
  701. }
  702. // Pretty-print the response data.
  703. fmt.Println(resp)
  704. }
  705. func ExampleIAM_DeleteSSHPublicKey() {
  706. sess, err := session.NewSession()
  707. if err != nil {
  708. fmt.Println("failed to create session,", err)
  709. return
  710. }
  711. svc := iam.New(sess)
  712. params := &iam.DeleteSSHPublicKeyInput{
  713. SSHPublicKeyId: aws.String("publicKeyIdType"), // Required
  714. UserName: aws.String("userNameType"), // Required
  715. }
  716. resp, err := svc.DeleteSSHPublicKey(params)
  717. if err != nil {
  718. // Print the error, cast err to awserr.Error to get the Code and
  719. // Message from an error.
  720. fmt.Println(err.Error())
  721. return
  722. }
  723. // Pretty-print the response data.
  724. fmt.Println(resp)
  725. }
  726. func ExampleIAM_DeleteServerCertificate() {
  727. sess, err := session.NewSession()
  728. if err != nil {
  729. fmt.Println("failed to create session,", err)
  730. return
  731. }
  732. svc := iam.New(sess)
  733. params := &iam.DeleteServerCertificateInput{
  734. ServerCertificateName: aws.String("serverCertificateNameType"), // Required
  735. }
  736. resp, err := svc.DeleteServerCertificate(params)
  737. if err != nil {
  738. // Print the error, cast err to awserr.Error to get the Code and
  739. // Message from an error.
  740. fmt.Println(err.Error())
  741. return
  742. }
  743. // Pretty-print the response data.
  744. fmt.Println(resp)
  745. }
  746. func ExampleIAM_DeleteSigningCertificate() {
  747. sess, err := session.NewSession()
  748. if err != nil {
  749. fmt.Println("failed to create session,", err)
  750. return
  751. }
  752. svc := iam.New(sess)
  753. params := &iam.DeleteSigningCertificateInput{
  754. CertificateId: aws.String("certificateIdType"), // Required
  755. UserName: aws.String("existingUserNameType"),
  756. }
  757. resp, err := svc.DeleteSigningCertificate(params)
  758. if err != nil {
  759. // Print the error, cast err to awserr.Error to get the Code and
  760. // Message from an error.
  761. fmt.Println(err.Error())
  762. return
  763. }
  764. // Pretty-print the response data.
  765. fmt.Println(resp)
  766. }
  767. func ExampleIAM_DeleteUser() {
  768. sess, err := session.NewSession()
  769. if err != nil {
  770. fmt.Println("failed to create session,", err)
  771. return
  772. }
  773. svc := iam.New(sess)
  774. params := &iam.DeleteUserInput{
  775. UserName: aws.String("existingUserNameType"), // Required
  776. }
  777. resp, err := svc.DeleteUser(params)
  778. if err != nil {
  779. // Print the error, cast err to awserr.Error to get the Code and
  780. // Message from an error.
  781. fmt.Println(err.Error())
  782. return
  783. }
  784. // Pretty-print the response data.
  785. fmt.Println(resp)
  786. }
  787. func ExampleIAM_DeleteUserPolicy() {
  788. sess, err := session.NewSession()
  789. if err != nil {
  790. fmt.Println("failed to create session,", err)
  791. return
  792. }
  793. svc := iam.New(sess)
  794. params := &iam.DeleteUserPolicyInput{
  795. PolicyName: aws.String("policyNameType"), // Required
  796. UserName: aws.String("existingUserNameType"), // Required
  797. }
  798. resp, err := svc.DeleteUserPolicy(params)
  799. if err != nil {
  800. // Print the error, cast err to awserr.Error to get the Code and
  801. // Message from an error.
  802. fmt.Println(err.Error())
  803. return
  804. }
  805. // Pretty-print the response data.
  806. fmt.Println(resp)
  807. }
  808. func ExampleIAM_DeleteVirtualMFADevice() {
  809. sess, err := session.NewSession()
  810. if err != nil {
  811. fmt.Println("failed to create session,", err)
  812. return
  813. }
  814. svc := iam.New(sess)
  815. params := &iam.DeleteVirtualMFADeviceInput{
  816. SerialNumber: aws.String("serialNumberType"), // Required
  817. }
  818. resp, err := svc.DeleteVirtualMFADevice(params)
  819. if err != nil {
  820. // Print the error, cast err to awserr.Error to get the Code and
  821. // Message from an error.
  822. fmt.Println(err.Error())
  823. return
  824. }
  825. // Pretty-print the response data.
  826. fmt.Println(resp)
  827. }
  828. func ExampleIAM_DetachGroupPolicy() {
  829. sess, err := session.NewSession()
  830. if err != nil {
  831. fmt.Println("failed to create session,", err)
  832. return
  833. }
  834. svc := iam.New(sess)
  835. params := &iam.DetachGroupPolicyInput{
  836. GroupName: aws.String("groupNameType"), // Required
  837. PolicyArn: aws.String("arnType"), // Required
  838. }
  839. resp, err := svc.DetachGroupPolicy(params)
  840. if err != nil {
  841. // Print the error, cast err to awserr.Error to get the Code and
  842. // Message from an error.
  843. fmt.Println(err.Error())
  844. return
  845. }
  846. // Pretty-print the response data.
  847. fmt.Println(resp)
  848. }
  849. func ExampleIAM_DetachRolePolicy() {
  850. sess, err := session.NewSession()
  851. if err != nil {
  852. fmt.Println("failed to create session,", err)
  853. return
  854. }
  855. svc := iam.New(sess)
  856. params := &iam.DetachRolePolicyInput{
  857. PolicyArn: aws.String("arnType"), // Required
  858. RoleName: aws.String("roleNameType"), // Required
  859. }
  860. resp, err := svc.DetachRolePolicy(params)
  861. if err != nil {
  862. // Print the error, cast err to awserr.Error to get the Code and
  863. // Message from an error.
  864. fmt.Println(err.Error())
  865. return
  866. }
  867. // Pretty-print the response data.
  868. fmt.Println(resp)
  869. }
  870. func ExampleIAM_DetachUserPolicy() {
  871. sess, err := session.NewSession()
  872. if err != nil {
  873. fmt.Println("failed to create session,", err)
  874. return
  875. }
  876. svc := iam.New(sess)
  877. params := &iam.DetachUserPolicyInput{
  878. PolicyArn: aws.String("arnType"), // Required
  879. UserName: aws.String("userNameType"), // Required
  880. }
  881. resp, err := svc.DetachUserPolicy(params)
  882. if err != nil {
  883. // Print the error, cast err to awserr.Error to get the Code and
  884. // Message from an error.
  885. fmt.Println(err.Error())
  886. return
  887. }
  888. // Pretty-print the response data.
  889. fmt.Println(resp)
  890. }
  891. func ExampleIAM_EnableMFADevice() {
  892. sess, err := session.NewSession()
  893. if err != nil {
  894. fmt.Println("failed to create session,", err)
  895. return
  896. }
  897. svc := iam.New(sess)
  898. params := &iam.EnableMFADeviceInput{
  899. AuthenticationCode1: aws.String("authenticationCodeType"), // Required
  900. AuthenticationCode2: aws.String("authenticationCodeType"), // Required
  901. SerialNumber: aws.String("serialNumberType"), // Required
  902. UserName: aws.String("existingUserNameType"), // Required
  903. }
  904. resp, err := svc.EnableMFADevice(params)
  905. if err != nil {
  906. // Print the error, cast err to awserr.Error to get the Code and
  907. // Message from an error.
  908. fmt.Println(err.Error())
  909. return
  910. }
  911. // Pretty-print the response data.
  912. fmt.Println(resp)
  913. }
  914. func ExampleIAM_GenerateCredentialReport() {
  915. sess, err := session.NewSession()
  916. if err != nil {
  917. fmt.Println("failed to create session,", err)
  918. return
  919. }
  920. svc := iam.New(sess)
  921. var params *iam.GenerateCredentialReportInput
  922. resp, err := svc.GenerateCredentialReport(params)
  923. if err != nil {
  924. // Print the error, cast err to awserr.Error to get the Code and
  925. // Message from an error.
  926. fmt.Println(err.Error())
  927. return
  928. }
  929. // Pretty-print the response data.
  930. fmt.Println(resp)
  931. }
  932. func ExampleIAM_GetAccessKeyLastUsed() {
  933. sess, err := session.NewSession()
  934. if err != nil {
  935. fmt.Println("failed to create session,", err)
  936. return
  937. }
  938. svc := iam.New(sess)
  939. params := &iam.GetAccessKeyLastUsedInput{
  940. AccessKeyId: aws.String("accessKeyIdType"), // Required
  941. }
  942. resp, err := svc.GetAccessKeyLastUsed(params)
  943. if err != nil {
  944. // Print the error, cast err to awserr.Error to get the Code and
  945. // Message from an error.
  946. fmt.Println(err.Error())
  947. return
  948. }
  949. // Pretty-print the response data.
  950. fmt.Println(resp)
  951. }
  952. func ExampleIAM_GetAccountAuthorizationDetails() {
  953. sess, err := session.NewSession()
  954. if err != nil {
  955. fmt.Println("failed to create session,", err)
  956. return
  957. }
  958. svc := iam.New(sess)
  959. params := &iam.GetAccountAuthorizationDetailsInput{
  960. Filter: []*string{
  961. aws.String("EntityType"), // Required
  962. // More values...
  963. },
  964. Marker: aws.String("markerType"),
  965. MaxItems: aws.Int64(1),
  966. }
  967. resp, err := svc.GetAccountAuthorizationDetails(params)
  968. if err != nil {
  969. // Print the error, cast err to awserr.Error to get the Code and
  970. // Message from an error.
  971. fmt.Println(err.Error())
  972. return
  973. }
  974. // Pretty-print the response data.
  975. fmt.Println(resp)
  976. }
  977. func ExampleIAM_GetAccountPasswordPolicy() {
  978. sess, err := session.NewSession()
  979. if err != nil {
  980. fmt.Println("failed to create session,", err)
  981. return
  982. }
  983. svc := iam.New(sess)
  984. var params *iam.GetAccountPasswordPolicyInput
  985. resp, err := svc.GetAccountPasswordPolicy(params)
  986. if err != nil {
  987. // Print the error, cast err to awserr.Error to get the Code and
  988. // Message from an error.
  989. fmt.Println(err.Error())
  990. return
  991. }
  992. // Pretty-print the response data.
  993. fmt.Println(resp)
  994. }
  995. func ExampleIAM_GetAccountSummary() {
  996. sess, err := session.NewSession()
  997. if err != nil {
  998. fmt.Println("failed to create session,", err)
  999. return
  1000. }
  1001. svc := iam.New(sess)
  1002. var params *iam.GetAccountSummaryInput
  1003. resp, err := svc.GetAccountSummary(params)
  1004. if err != nil {
  1005. // Print the error, cast err to awserr.Error to get the Code and
  1006. // Message from an error.
  1007. fmt.Println(err.Error())
  1008. return
  1009. }
  1010. // Pretty-print the response data.
  1011. fmt.Println(resp)
  1012. }
  1013. func ExampleIAM_GetContextKeysForCustomPolicy() {
  1014. sess, err := session.NewSession()
  1015. if err != nil {
  1016. fmt.Println("failed to create session,", err)
  1017. return
  1018. }
  1019. svc := iam.New(sess)
  1020. params := &iam.GetContextKeysForCustomPolicyInput{
  1021. PolicyInputList: []*string{ // Required
  1022. aws.String("policyDocumentType"), // Required
  1023. // More values...
  1024. },
  1025. }
  1026. resp, err := svc.GetContextKeysForCustomPolicy(params)
  1027. if err != nil {
  1028. // Print the error, cast err to awserr.Error to get the Code and
  1029. // Message from an error.
  1030. fmt.Println(err.Error())
  1031. return
  1032. }
  1033. // Pretty-print the response data.
  1034. fmt.Println(resp)
  1035. }
  1036. func ExampleIAM_GetContextKeysForPrincipalPolicy() {
  1037. sess, err := session.NewSession()
  1038. if err != nil {
  1039. fmt.Println("failed to create session,", err)
  1040. return
  1041. }
  1042. svc := iam.New(sess)
  1043. params := &iam.GetContextKeysForPrincipalPolicyInput{
  1044. PolicySourceArn: aws.String("arnType"), // Required
  1045. PolicyInputList: []*string{
  1046. aws.String("policyDocumentType"), // Required
  1047. // More values...
  1048. },
  1049. }
  1050. resp, err := svc.GetContextKeysForPrincipalPolicy(params)
  1051. if err != nil {
  1052. // Print the error, cast err to awserr.Error to get the Code and
  1053. // Message from an error.
  1054. fmt.Println(err.Error())
  1055. return
  1056. }
  1057. // Pretty-print the response data.
  1058. fmt.Println(resp)
  1059. }
  1060. func ExampleIAM_GetCredentialReport() {
  1061. sess, err := session.NewSession()
  1062. if err != nil {
  1063. fmt.Println("failed to create session,", err)
  1064. return
  1065. }
  1066. svc := iam.New(sess)
  1067. var params *iam.GetCredentialReportInput
  1068. resp, err := svc.GetCredentialReport(params)
  1069. if err != nil {
  1070. // Print the error, cast err to awserr.Error to get the Code and
  1071. // Message from an error.
  1072. fmt.Println(err.Error())
  1073. return
  1074. }
  1075. // Pretty-print the response data.
  1076. fmt.Println(resp)
  1077. }
  1078. func ExampleIAM_GetGroup() {
  1079. sess, err := session.NewSession()
  1080. if err != nil {
  1081. fmt.Println("failed to create session,", err)
  1082. return
  1083. }
  1084. svc := iam.New(sess)
  1085. params := &iam.GetGroupInput{
  1086. GroupName: aws.String("groupNameType"), // Required
  1087. Marker: aws.String("markerType"),
  1088. MaxItems: aws.Int64(1),
  1089. }
  1090. resp, err := svc.GetGroup(params)
  1091. if err != nil {
  1092. // Print the error, cast err to awserr.Error to get the Code and
  1093. // Message from an error.
  1094. fmt.Println(err.Error())
  1095. return
  1096. }
  1097. // Pretty-print the response data.
  1098. fmt.Println(resp)
  1099. }
  1100. func ExampleIAM_GetGroupPolicy() {
  1101. sess, err := session.NewSession()
  1102. if err != nil {
  1103. fmt.Println("failed to create session,", err)
  1104. return
  1105. }
  1106. svc := iam.New(sess)
  1107. params := &iam.GetGroupPolicyInput{
  1108. GroupName: aws.String("groupNameType"), // Required
  1109. PolicyName: aws.String("policyNameType"), // Required
  1110. }
  1111. resp, err := svc.GetGroupPolicy(params)
  1112. if err != nil {
  1113. // Print the error, cast err to awserr.Error to get the Code and
  1114. // Message from an error.
  1115. fmt.Println(err.Error())
  1116. return
  1117. }
  1118. // Pretty-print the response data.
  1119. fmt.Println(resp)
  1120. }
  1121. func ExampleIAM_GetInstanceProfile() {
  1122. sess, err := session.NewSession()
  1123. if err != nil {
  1124. fmt.Println("failed to create session,", err)
  1125. return
  1126. }
  1127. svc := iam.New(sess)
  1128. params := &iam.GetInstanceProfileInput{
  1129. InstanceProfileName: aws.String("instanceProfileNameType"), // Required
  1130. }
  1131. resp, err := svc.GetInstanceProfile(params)
  1132. if err != nil {
  1133. // Print the error, cast err to awserr.Error to get the Code and
  1134. // Message from an error.
  1135. fmt.Println(err.Error())
  1136. return
  1137. }
  1138. // Pretty-print the response data.
  1139. fmt.Println(resp)
  1140. }
  1141. func ExampleIAM_GetLoginProfile() {
  1142. sess, err := session.NewSession()
  1143. if err != nil {
  1144. fmt.Println("failed to create session,", err)
  1145. return
  1146. }
  1147. svc := iam.New(sess)
  1148. params := &iam.GetLoginProfileInput{
  1149. UserName: aws.String("userNameType"), // Required
  1150. }
  1151. resp, err := svc.GetLoginProfile(params)
  1152. if err != nil {
  1153. // Print the error, cast err to awserr.Error to get the Code and
  1154. // Message from an error.
  1155. fmt.Println(err.Error())
  1156. return
  1157. }
  1158. // Pretty-print the response data.
  1159. fmt.Println(resp)
  1160. }
  1161. func ExampleIAM_GetOpenIDConnectProvider() {
  1162. sess, err := session.NewSession()
  1163. if err != nil {
  1164. fmt.Println("failed to create session,", err)
  1165. return
  1166. }
  1167. svc := iam.New(sess)
  1168. params := &iam.GetOpenIDConnectProviderInput{
  1169. OpenIDConnectProviderArn: aws.String("arnType"), // Required
  1170. }
  1171. resp, err := svc.GetOpenIDConnectProvider(params)
  1172. if err != nil {
  1173. // Print the error, cast err to awserr.Error to get the Code and
  1174. // Message from an error.
  1175. fmt.Println(err.Error())
  1176. return
  1177. }
  1178. // Pretty-print the response data.
  1179. fmt.Println(resp)
  1180. }
  1181. func ExampleIAM_GetPolicy() {
  1182. sess, err := session.NewSession()
  1183. if err != nil {
  1184. fmt.Println("failed to create session,", err)
  1185. return
  1186. }
  1187. svc := iam.New(sess)
  1188. params := &iam.GetPolicyInput{
  1189. PolicyArn: aws.String("arnType"), // Required
  1190. }
  1191. resp, err := svc.GetPolicy(params)
  1192. if err != nil {
  1193. // Print the error, cast err to awserr.Error to get the Code and
  1194. // Message from an error.
  1195. fmt.Println(err.Error())
  1196. return
  1197. }
  1198. // Pretty-print the response data.
  1199. fmt.Println(resp)
  1200. }
  1201. func ExampleIAM_GetPolicyVersion() {
  1202. sess, err := session.NewSession()
  1203. if err != nil {
  1204. fmt.Println("failed to create session,", err)
  1205. return
  1206. }
  1207. svc := iam.New(sess)
  1208. params := &iam.GetPolicyVersionInput{
  1209. PolicyArn: aws.String("arnType"), // Required
  1210. VersionId: aws.String("policyVersionIdType"), // Required
  1211. }
  1212. resp, err := svc.GetPolicyVersion(params)
  1213. if err != nil {
  1214. // Print the error, cast err to awserr.Error to get the Code and
  1215. // Message from an error.
  1216. fmt.Println(err.Error())
  1217. return
  1218. }
  1219. // Pretty-print the response data.
  1220. fmt.Println(resp)
  1221. }
  1222. func ExampleIAM_GetRole() {
  1223. sess, err := session.NewSession()
  1224. if err != nil {
  1225. fmt.Println("failed to create session,", err)
  1226. return
  1227. }
  1228. svc := iam.New(sess)
  1229. params := &iam.GetRoleInput{
  1230. RoleName: aws.String("roleNameType"), // Required
  1231. }
  1232. resp, err := svc.GetRole(params)
  1233. if err != nil {
  1234. // Print the error, cast err to awserr.Error to get the Code and
  1235. // Message from an error.
  1236. fmt.Println(err.Error())
  1237. return
  1238. }
  1239. // Pretty-print the response data.
  1240. fmt.Println(resp)
  1241. }
  1242. func ExampleIAM_GetRolePolicy() {
  1243. sess, err := session.NewSession()
  1244. if err != nil {
  1245. fmt.Println("failed to create session,", err)
  1246. return
  1247. }
  1248. svc := iam.New(sess)
  1249. params := &iam.GetRolePolicyInput{
  1250. PolicyName: aws.String("policyNameType"), // Required
  1251. RoleName: aws.String("roleNameType"), // Required
  1252. }
  1253. resp, err := svc.GetRolePolicy(params)
  1254. if err != nil {
  1255. // Print the error, cast err to awserr.Error to get the Code and
  1256. // Message from an error.
  1257. fmt.Println(err.Error())
  1258. return
  1259. }
  1260. // Pretty-print the response data.
  1261. fmt.Println(resp)
  1262. }
  1263. func ExampleIAM_GetSAMLProvider() {
  1264. sess, err := session.NewSession()
  1265. if err != nil {
  1266. fmt.Println("failed to create session,", err)
  1267. return
  1268. }
  1269. svc := iam.New(sess)
  1270. params := &iam.GetSAMLProviderInput{
  1271. SAMLProviderArn: aws.String("arnType"), // Required
  1272. }
  1273. resp, err := svc.GetSAMLProvider(params)
  1274. if err != nil {
  1275. // Print the error, cast err to awserr.Error to get the Code and
  1276. // Message from an error.
  1277. fmt.Println(err.Error())
  1278. return
  1279. }
  1280. // Pretty-print the response data.
  1281. fmt.Println(resp)
  1282. }
  1283. func ExampleIAM_GetSSHPublicKey() {
  1284. sess, err := session.NewSession()
  1285. if err != nil {
  1286. fmt.Println("failed to create session,", err)
  1287. return
  1288. }
  1289. svc := iam.New(sess)
  1290. params := &iam.GetSSHPublicKeyInput{
  1291. Encoding: aws.String("encodingType"), // Required
  1292. SSHPublicKeyId: aws.String("publicKeyIdType"), // Required
  1293. UserName: aws.String("userNameType"), // Required
  1294. }
  1295. resp, err := svc.GetSSHPublicKey(params)
  1296. if err != nil {
  1297. // Print the error, cast err to awserr.Error to get the Code and
  1298. // Message from an error.
  1299. fmt.Println(err.Error())
  1300. return
  1301. }
  1302. // Pretty-print the response data.
  1303. fmt.Println(resp)
  1304. }
  1305. func ExampleIAM_GetServerCertificate() {
  1306. sess, err := session.NewSession()
  1307. if err != nil {
  1308. fmt.Println("failed to create session,", err)
  1309. return
  1310. }
  1311. svc := iam.New(sess)
  1312. params := &iam.GetServerCertificateInput{
  1313. ServerCertificateName: aws.String("serverCertificateNameType"), // Required
  1314. }
  1315. resp, err := svc.GetServerCertificate(params)
  1316. if err != nil {
  1317. // Print the error, cast err to awserr.Error to get the Code and
  1318. // Message from an error.
  1319. fmt.Println(err.Error())
  1320. return
  1321. }
  1322. // Pretty-print the response data.
  1323. fmt.Println(resp)
  1324. }
  1325. func ExampleIAM_GetUser() {
  1326. sess, err := session.NewSession()
  1327. if err != nil {
  1328. fmt.Println("failed to create session,", err)
  1329. return
  1330. }
  1331. svc := iam.New(sess)
  1332. params := &iam.GetUserInput{
  1333. UserName: aws.String("existingUserNameType"),
  1334. }
  1335. resp, err := svc.GetUser(params)
  1336. if err != nil {
  1337. // Print the error, cast err to awserr.Error to get the Code and
  1338. // Message from an error.
  1339. fmt.Println(err.Error())
  1340. return
  1341. }
  1342. // Pretty-print the response data.
  1343. fmt.Println(resp)
  1344. }
  1345. func ExampleIAM_GetUserPolicy() {
  1346. sess, err := session.NewSession()
  1347. if err != nil {
  1348. fmt.Println("failed to create session,", err)
  1349. return
  1350. }
  1351. svc := iam.New(sess)
  1352. params := &iam.GetUserPolicyInput{
  1353. PolicyName: aws.String("policyNameType"), // Required
  1354. UserName: aws.String("existingUserNameType"), // Required
  1355. }
  1356. resp, err := svc.GetUserPolicy(params)
  1357. if err != nil {
  1358. // Print the error, cast err to awserr.Error to get the Code and
  1359. // Message from an error.
  1360. fmt.Println(err.Error())
  1361. return
  1362. }
  1363. // Pretty-print the response data.
  1364. fmt.Println(resp)
  1365. }
  1366. func ExampleIAM_ListAccessKeys() {
  1367. sess, err := session.NewSession()
  1368. if err != nil {
  1369. fmt.Println("failed to create session,", err)
  1370. return
  1371. }
  1372. svc := iam.New(sess)
  1373. params := &iam.ListAccessKeysInput{
  1374. Marker: aws.String("markerType"),
  1375. MaxItems: aws.Int64(1),
  1376. UserName: aws.String("existingUserNameType"),
  1377. }
  1378. resp, err := svc.ListAccessKeys(params)
  1379. if err != nil {
  1380. // Print the error, cast err to awserr.Error to get the Code and
  1381. // Message from an error.
  1382. fmt.Println(err.Error())
  1383. return
  1384. }
  1385. // Pretty-print the response data.
  1386. fmt.Println(resp)
  1387. }
  1388. func ExampleIAM_ListAccountAliases() {
  1389. sess, err := session.NewSession()
  1390. if err != nil {
  1391. fmt.Println("failed to create session,", err)
  1392. return
  1393. }
  1394. svc := iam.New(sess)
  1395. params := &iam.ListAccountAliasesInput{
  1396. Marker: aws.String("markerType"),
  1397. MaxItems: aws.Int64(1),
  1398. }
  1399. resp, err := svc.ListAccountAliases(params)
  1400. if err != nil {
  1401. // Print the error, cast err to awserr.Error to get the Code and
  1402. // Message from an error.
  1403. fmt.Println(err.Error())
  1404. return
  1405. }
  1406. // Pretty-print the response data.
  1407. fmt.Println(resp)
  1408. }
  1409. func ExampleIAM_ListAttachedGroupPolicies() {
  1410. sess, err := session.NewSession()
  1411. if err != nil {
  1412. fmt.Println("failed to create session,", err)
  1413. return
  1414. }
  1415. svc := iam.New(sess)
  1416. params := &iam.ListAttachedGroupPoliciesInput{
  1417. GroupName: aws.String("groupNameType"), // Required
  1418. Marker: aws.String("markerType"),
  1419. MaxItems: aws.Int64(1),
  1420. PathPrefix: aws.String("policyPathType"),
  1421. }
  1422. resp, err := svc.ListAttachedGroupPolicies(params)
  1423. if err != nil {
  1424. // Print the error, cast err to awserr.Error to get the Code and
  1425. // Message from an error.
  1426. fmt.Println(err.Error())
  1427. return
  1428. }
  1429. // Pretty-print the response data.
  1430. fmt.Println(resp)
  1431. }
  1432. func ExampleIAM_ListAttachedRolePolicies() {
  1433. sess, err := session.NewSession()
  1434. if err != nil {
  1435. fmt.Println("failed to create session,", err)
  1436. return
  1437. }
  1438. svc := iam.New(sess)
  1439. params := &iam.ListAttachedRolePoliciesInput{
  1440. RoleName: aws.String("roleNameType"), // Required
  1441. Marker: aws.String("markerType"),
  1442. MaxItems: aws.Int64(1),
  1443. PathPrefix: aws.String("policyPathType"),
  1444. }
  1445. resp, err := svc.ListAttachedRolePolicies(params)
  1446. if err != nil {
  1447. // Print the error, cast err to awserr.Error to get the Code and
  1448. // Message from an error.
  1449. fmt.Println(err.Error())
  1450. return
  1451. }
  1452. // Pretty-print the response data.
  1453. fmt.Println(resp)
  1454. }
  1455. func ExampleIAM_ListAttachedUserPolicies() {
  1456. sess, err := session.NewSession()
  1457. if err != nil {
  1458. fmt.Println("failed to create session,", err)
  1459. return
  1460. }
  1461. svc := iam.New(sess)
  1462. params := &iam.ListAttachedUserPoliciesInput{
  1463. UserName: aws.String("userNameType"), // Required
  1464. Marker: aws.String("markerType"),
  1465. MaxItems: aws.Int64(1),
  1466. PathPrefix: aws.String("policyPathType"),
  1467. }
  1468. resp, err := svc.ListAttachedUserPolicies(params)
  1469. if err != nil {
  1470. // Print the error, cast err to awserr.Error to get the Code and
  1471. // Message from an error.
  1472. fmt.Println(err.Error())
  1473. return
  1474. }
  1475. // Pretty-print the response data.
  1476. fmt.Println(resp)
  1477. }
  1478. func ExampleIAM_ListEntitiesForPolicy() {
  1479. sess, err := session.NewSession()
  1480. if err != nil {
  1481. fmt.Println("failed to create session,", err)
  1482. return
  1483. }
  1484. svc := iam.New(sess)
  1485. params := &iam.ListEntitiesForPolicyInput{
  1486. PolicyArn: aws.String("arnType"), // Required
  1487. EntityFilter: aws.String("EntityType"),
  1488. Marker: aws.String("markerType"),
  1489. MaxItems: aws.Int64(1),
  1490. PathPrefix: aws.String("pathType"),
  1491. }
  1492. resp, err := svc.ListEntitiesForPolicy(params)
  1493. if err != nil {
  1494. // Print the error, cast err to awserr.Error to get the Code and
  1495. // Message from an error.
  1496. fmt.Println(err.Error())
  1497. return
  1498. }
  1499. // Pretty-print the response data.
  1500. fmt.Println(resp)
  1501. }
  1502. func ExampleIAM_ListGroupPolicies() {
  1503. sess, err := session.NewSession()
  1504. if err != nil {
  1505. fmt.Println("failed to create session,", err)
  1506. return
  1507. }
  1508. svc := iam.New(sess)
  1509. params := &iam.ListGroupPoliciesInput{
  1510. GroupName: aws.String("groupNameType"), // Required
  1511. Marker: aws.String("markerType"),
  1512. MaxItems: aws.Int64(1),
  1513. }
  1514. resp, err := svc.ListGroupPolicies(params)
  1515. if err != nil {
  1516. // Print the error, cast err to awserr.Error to get the Code and
  1517. // Message from an error.
  1518. fmt.Println(err.Error())
  1519. return
  1520. }
  1521. // Pretty-print the response data.
  1522. fmt.Println(resp)
  1523. }
  1524. func ExampleIAM_ListGroups() {
  1525. sess, err := session.NewSession()
  1526. if err != nil {
  1527. fmt.Println("failed to create session,", err)
  1528. return
  1529. }
  1530. svc := iam.New(sess)
  1531. params := &iam.ListGroupsInput{
  1532. Marker: aws.String("markerType"),
  1533. MaxItems: aws.Int64(1),
  1534. PathPrefix: aws.String("pathPrefixType"),
  1535. }
  1536. resp, err := svc.ListGroups(params)
  1537. if err != nil {
  1538. // Print the error, cast err to awserr.Error to get the Code and
  1539. // Message from an error.
  1540. fmt.Println(err.Error())
  1541. return
  1542. }
  1543. // Pretty-print the response data.
  1544. fmt.Println(resp)
  1545. }
  1546. func ExampleIAM_ListGroupsForUser() {
  1547. sess, err := session.NewSession()
  1548. if err != nil {
  1549. fmt.Println("failed to create session,", err)
  1550. return
  1551. }
  1552. svc := iam.New(sess)
  1553. params := &iam.ListGroupsForUserInput{
  1554. UserName: aws.String("existingUserNameType"), // Required
  1555. Marker: aws.String("markerType"),
  1556. MaxItems: aws.Int64(1),
  1557. }
  1558. resp, err := svc.ListGroupsForUser(params)
  1559. if err != nil {
  1560. // Print the error, cast err to awserr.Error to get the Code and
  1561. // Message from an error.
  1562. fmt.Println(err.Error())
  1563. return
  1564. }
  1565. // Pretty-print the response data.
  1566. fmt.Println(resp)
  1567. }
  1568. func ExampleIAM_ListInstanceProfiles() {
  1569. sess, err := session.NewSession()
  1570. if err != nil {
  1571. fmt.Println("failed to create session,", err)
  1572. return
  1573. }
  1574. svc := iam.New(sess)
  1575. params := &iam.ListInstanceProfilesInput{
  1576. Marker: aws.String("markerType"),
  1577. MaxItems: aws.Int64(1),
  1578. PathPrefix: aws.String("pathPrefixType"),
  1579. }
  1580. resp, err := svc.ListInstanceProfiles(params)
  1581. if err != nil {
  1582. // Print the error, cast err to awserr.Error to get the Code and
  1583. // Message from an error.
  1584. fmt.Println(err.Error())
  1585. return
  1586. }
  1587. // Pretty-print the response data.
  1588. fmt.Println(resp)
  1589. }
  1590. func ExampleIAM_ListInstanceProfilesForRole() {
  1591. sess, err := session.NewSession()
  1592. if err != nil {
  1593. fmt.Println("failed to create session,", err)
  1594. return
  1595. }
  1596. svc := iam.New(sess)
  1597. params := &iam.ListInstanceProfilesForRoleInput{
  1598. RoleName: aws.String("roleNameType"), // Required
  1599. Marker: aws.String("markerType"),
  1600. MaxItems: aws.Int64(1),
  1601. }
  1602. resp, err := svc.ListInstanceProfilesForRole(params)
  1603. if err != nil {
  1604. // Print the error, cast err to awserr.Error to get the Code and
  1605. // Message from an error.
  1606. fmt.Println(err.Error())
  1607. return
  1608. }
  1609. // Pretty-print the response data.
  1610. fmt.Println(resp)
  1611. }
  1612. func ExampleIAM_ListMFADevices() {
  1613. sess, err := session.NewSession()
  1614. if err != nil {
  1615. fmt.Println("failed to create session,", err)
  1616. return
  1617. }
  1618. svc := iam.New(sess)
  1619. params := &iam.ListMFADevicesInput{
  1620. Marker: aws.String("markerType"),
  1621. MaxItems: aws.Int64(1),
  1622. UserName: aws.String("existingUserNameType"),
  1623. }
  1624. resp, err := svc.ListMFADevices(params)
  1625. if err != nil {
  1626. // Print the error, cast err to awserr.Error to get the Code and
  1627. // Message from an error.
  1628. fmt.Println(err.Error())
  1629. return
  1630. }
  1631. // Pretty-print the response data.
  1632. fmt.Println(resp)
  1633. }
  1634. func ExampleIAM_ListOpenIDConnectProviders() {
  1635. sess, err := session.NewSession()
  1636. if err != nil {
  1637. fmt.Println("failed to create session,", err)
  1638. return
  1639. }
  1640. svc := iam.New(sess)
  1641. var params *iam.ListOpenIDConnectProvidersInput
  1642. resp, err := svc.ListOpenIDConnectProviders(params)
  1643. if err != nil {
  1644. // Print the error, cast err to awserr.Error to get the Code and
  1645. // Message from an error.
  1646. fmt.Println(err.Error())
  1647. return
  1648. }
  1649. // Pretty-print the response data.
  1650. fmt.Println(resp)
  1651. }
  1652. func ExampleIAM_ListPolicies() {
  1653. sess, err := session.NewSession()
  1654. if err != nil {
  1655. fmt.Println("failed to create session,", err)
  1656. return
  1657. }
  1658. svc := iam.New(sess)
  1659. params := &iam.ListPoliciesInput{
  1660. Marker: aws.String("markerType"),
  1661. MaxItems: aws.Int64(1),
  1662. OnlyAttached: aws.Bool(true),
  1663. PathPrefix: aws.String("policyPathType"),
  1664. Scope: aws.String("policyScopeType"),
  1665. }
  1666. resp, err := svc.ListPolicies(params)
  1667. if err != nil {
  1668. // Print the error, cast err to awserr.Error to get the Code and
  1669. // Message from an error.
  1670. fmt.Println(err.Error())
  1671. return
  1672. }
  1673. // Pretty-print the response data.
  1674. fmt.Println(resp)
  1675. }
  1676. func ExampleIAM_ListPolicyVersions() {
  1677. sess, err := session.NewSession()
  1678. if err != nil {
  1679. fmt.Println("failed to create session,", err)
  1680. return
  1681. }
  1682. svc := iam.New(sess)
  1683. params := &iam.ListPolicyVersionsInput{
  1684. PolicyArn: aws.String("arnType"), // Required
  1685. Marker: aws.String("markerType"),
  1686. MaxItems: aws.Int64(1),
  1687. }
  1688. resp, err := svc.ListPolicyVersions(params)
  1689. if err != nil {
  1690. // Print the error, cast err to awserr.Error to get the Code and
  1691. // Message from an error.
  1692. fmt.Println(err.Error())
  1693. return
  1694. }
  1695. // Pretty-print the response data.
  1696. fmt.Println(resp)
  1697. }
  1698. func ExampleIAM_ListRolePolicies() {
  1699. sess, err := session.NewSession()
  1700. if err != nil {
  1701. fmt.Println("failed to create session,", err)
  1702. return
  1703. }
  1704. svc := iam.New(sess)
  1705. params := &iam.ListRolePoliciesInput{
  1706. RoleName: aws.String("roleNameType"), // Required
  1707. Marker: aws.String("markerType"),
  1708. MaxItems: aws.Int64(1),
  1709. }
  1710. resp, err := svc.ListRolePolicies(params)
  1711. if err != nil {
  1712. // Print the error, cast err to awserr.Error to get the Code and
  1713. // Message from an error.
  1714. fmt.Println(err.Error())
  1715. return
  1716. }
  1717. // Pretty-print the response data.
  1718. fmt.Println(resp)
  1719. }
  1720. func ExampleIAM_ListRoles() {
  1721. sess, err := session.NewSession()
  1722. if err != nil {
  1723. fmt.Println("failed to create session,", err)
  1724. return
  1725. }
  1726. svc := iam.New(sess)
  1727. params := &iam.ListRolesInput{
  1728. Marker: aws.String("markerType"),
  1729. MaxItems: aws.Int64(1),
  1730. PathPrefix: aws.String("pathPrefixType"),
  1731. }
  1732. resp, err := svc.ListRoles(params)
  1733. if err != nil {
  1734. // Print the error, cast err to awserr.Error to get the Code and
  1735. // Message from an error.
  1736. fmt.Println(err.Error())
  1737. return
  1738. }
  1739. // Pretty-print the response data.
  1740. fmt.Println(resp)
  1741. }
  1742. func ExampleIAM_ListSAMLProviders() {
  1743. sess, err := session.NewSession()
  1744. if err != nil {
  1745. fmt.Println("failed to create session,", err)
  1746. return
  1747. }
  1748. svc := iam.New(sess)
  1749. var params *iam.ListSAMLProvidersInput
  1750. resp, err := svc.ListSAMLProviders(params)
  1751. if err != nil {
  1752. // Print the error, cast err to awserr.Error to get the Code and
  1753. // Message from an error.
  1754. fmt.Println(err.Error())
  1755. return
  1756. }
  1757. // Pretty-print the response data.
  1758. fmt.Println(resp)
  1759. }
  1760. func ExampleIAM_ListSSHPublicKeys() {
  1761. sess, err := session.NewSession()
  1762. if err != nil {
  1763. fmt.Println("failed to create session,", err)
  1764. return
  1765. }
  1766. svc := iam.New(sess)
  1767. params := &iam.ListSSHPublicKeysInput{
  1768. Marker: aws.String("markerType"),
  1769. MaxItems: aws.Int64(1),
  1770. UserName: aws.String("userNameType"),
  1771. }
  1772. resp, err := svc.ListSSHPublicKeys(params)
  1773. if err != nil {
  1774. // Print the error, cast err to awserr.Error to get the Code and
  1775. // Message from an error.
  1776. fmt.Println(err.Error())
  1777. return
  1778. }
  1779. // Pretty-print the response data.
  1780. fmt.Println(resp)
  1781. }
  1782. func ExampleIAM_ListServerCertificates() {
  1783. sess, err := session.NewSession()
  1784. if err != nil {
  1785. fmt.Println("failed to create session,", err)
  1786. return
  1787. }
  1788. svc := iam.New(sess)
  1789. params := &iam.ListServerCertificatesInput{
  1790. Marker: aws.String("markerType"),
  1791. MaxItems: aws.Int64(1),
  1792. PathPrefix: aws.String("pathPrefixType"),
  1793. }
  1794. resp, err := svc.ListServerCertificates(params)
  1795. if err != nil {
  1796. // Print the error, cast err to awserr.Error to get the Code and
  1797. // Message from an error.
  1798. fmt.Println(err.Error())
  1799. return
  1800. }
  1801. // Pretty-print the response data.
  1802. fmt.Println(resp)
  1803. }
  1804. func ExampleIAM_ListSigningCertificates() {
  1805. sess, err := session.NewSession()
  1806. if err != nil {
  1807. fmt.Println("failed to create session,", err)
  1808. return
  1809. }
  1810. svc := iam.New(sess)
  1811. params := &iam.ListSigningCertificatesInput{
  1812. Marker: aws.String("markerType"),
  1813. MaxItems: aws.Int64(1),
  1814. UserName: aws.String("existingUserNameType"),
  1815. }
  1816. resp, err := svc.ListSigningCertificates(params)
  1817. if err != nil {
  1818. // Print the error, cast err to awserr.Error to get the Code and
  1819. // Message from an error.
  1820. fmt.Println(err.Error())
  1821. return
  1822. }
  1823. // Pretty-print the response data.
  1824. fmt.Println(resp)
  1825. }
  1826. func ExampleIAM_ListUserPolicies() {
  1827. sess, err := session.NewSession()
  1828. if err != nil {
  1829. fmt.Println("failed to create session,", err)
  1830. return
  1831. }
  1832. svc := iam.New(sess)
  1833. params := &iam.ListUserPoliciesInput{
  1834. UserName: aws.String("existingUserNameType"), // Required
  1835. Marker: aws.String("markerType"),
  1836. MaxItems: aws.Int64(1),
  1837. }
  1838. resp, err := svc.ListUserPolicies(params)
  1839. if err != nil {
  1840. // Print the error, cast err to awserr.Error to get the Code and
  1841. // Message from an error.
  1842. fmt.Println(err.Error())
  1843. return
  1844. }
  1845. // Pretty-print the response data.
  1846. fmt.Println(resp)
  1847. }
  1848. func ExampleIAM_ListUsers() {
  1849. sess, err := session.NewSession()
  1850. if err != nil {
  1851. fmt.Println("failed to create session,", err)
  1852. return
  1853. }
  1854. svc := iam.New(sess)
  1855. params := &iam.ListUsersInput{
  1856. Marker: aws.String("markerType"),
  1857. MaxItems: aws.Int64(1),
  1858. PathPrefix: aws.String("pathPrefixType"),
  1859. }
  1860. resp, err := svc.ListUsers(params)
  1861. if err != nil {
  1862. // Print the error, cast err to awserr.Error to get the Code and
  1863. // Message from an error.
  1864. fmt.Println(err.Error())
  1865. return
  1866. }
  1867. // Pretty-print the response data.
  1868. fmt.Println(resp)
  1869. }
  1870. func ExampleIAM_ListVirtualMFADevices() {
  1871. sess, err := session.NewSession()
  1872. if err != nil {
  1873. fmt.Println("failed to create session,", err)
  1874. return
  1875. }
  1876. svc := iam.New(sess)
  1877. params := &iam.ListVirtualMFADevicesInput{
  1878. AssignmentStatus: aws.String("assignmentStatusType"),
  1879. Marker: aws.String("markerType"),
  1880. MaxItems: aws.Int64(1),
  1881. }
  1882. resp, err := svc.ListVirtualMFADevices(params)
  1883. if err != nil {
  1884. // Print the error, cast err to awserr.Error to get the Code and
  1885. // Message from an error.
  1886. fmt.Println(err.Error())
  1887. return
  1888. }
  1889. // Pretty-print the response data.
  1890. fmt.Println(resp)
  1891. }
  1892. func ExampleIAM_PutGroupPolicy() {
  1893. sess, err := session.NewSession()
  1894. if err != nil {
  1895. fmt.Println("failed to create session,", err)
  1896. return
  1897. }
  1898. svc := iam.New(sess)
  1899. params := &iam.PutGroupPolicyInput{
  1900. GroupName: aws.String("groupNameType"), // Required
  1901. PolicyDocument: aws.String("policyDocumentType"), // Required
  1902. PolicyName: aws.String("policyNameType"), // Required
  1903. }
  1904. resp, err := svc.PutGroupPolicy(params)
  1905. if err != nil {
  1906. // Print the error, cast err to awserr.Error to get the Code and
  1907. // Message from an error.
  1908. fmt.Println(err.Error())
  1909. return
  1910. }
  1911. // Pretty-print the response data.
  1912. fmt.Println(resp)
  1913. }
  1914. func ExampleIAM_PutRolePolicy() {
  1915. sess, err := session.NewSession()
  1916. if err != nil {
  1917. fmt.Println("failed to create session,", err)
  1918. return
  1919. }
  1920. svc := iam.New(sess)
  1921. params := &iam.PutRolePolicyInput{
  1922. PolicyDocument: aws.String("policyDocumentType"), // Required
  1923. PolicyName: aws.String("policyNameType"), // Required
  1924. RoleName: aws.String("roleNameType"), // Required
  1925. }
  1926. resp, err := svc.PutRolePolicy(params)
  1927. if err != nil {
  1928. // Print the error, cast err to awserr.Error to get the Code and
  1929. // Message from an error.
  1930. fmt.Println(err.Error())
  1931. return
  1932. }
  1933. // Pretty-print the response data.
  1934. fmt.Println(resp)
  1935. }
  1936. func ExampleIAM_PutUserPolicy() {
  1937. sess, err := session.NewSession()
  1938. if err != nil {
  1939. fmt.Println("failed to create session,", err)
  1940. return
  1941. }
  1942. svc := iam.New(sess)
  1943. params := &iam.PutUserPolicyInput{
  1944. PolicyDocument: aws.String("policyDocumentType"), // Required
  1945. PolicyName: aws.String("policyNameType"), // Required
  1946. UserName: aws.String("existingUserNameType"), // Required
  1947. }
  1948. resp, err := svc.PutUserPolicy(params)
  1949. if err != nil {
  1950. // Print the error, cast err to awserr.Error to get the Code and
  1951. // Message from an error.
  1952. fmt.Println(err.Error())
  1953. return
  1954. }
  1955. // Pretty-print the response data.
  1956. fmt.Println(resp)
  1957. }
  1958. func ExampleIAM_RemoveClientIDFromOpenIDConnectProvider() {
  1959. sess, err := session.NewSession()
  1960. if err != nil {
  1961. fmt.Println("failed to create session,", err)
  1962. return
  1963. }
  1964. svc := iam.New(sess)
  1965. params := &iam.RemoveClientIDFromOpenIDConnectProviderInput{
  1966. ClientID: aws.String("clientIDType"), // Required
  1967. OpenIDConnectProviderArn: aws.String("arnType"), // Required
  1968. }
  1969. resp, err := svc.RemoveClientIDFromOpenIDConnectProvider(params)
  1970. if err != nil {
  1971. // Print the error, cast err to awserr.Error to get the Code and
  1972. // Message from an error.
  1973. fmt.Println(err.Error())
  1974. return
  1975. }
  1976. // Pretty-print the response data.
  1977. fmt.Println(resp)
  1978. }
  1979. func ExampleIAM_RemoveRoleFromInstanceProfile() {
  1980. sess, err := session.NewSession()
  1981. if err != nil {
  1982. fmt.Println("failed to create session,", err)
  1983. return
  1984. }
  1985. svc := iam.New(sess)
  1986. params := &iam.RemoveRoleFromInstanceProfileInput{
  1987. InstanceProfileName: aws.String("instanceProfileNameType"), // Required
  1988. RoleName: aws.String("roleNameType"), // Required
  1989. }
  1990. resp, err := svc.RemoveRoleFromInstanceProfile(params)
  1991. if err != nil {
  1992. // Print the error, cast err to awserr.Error to get the Code and
  1993. // Message from an error.
  1994. fmt.Println(err.Error())
  1995. return
  1996. }
  1997. // Pretty-print the response data.
  1998. fmt.Println(resp)
  1999. }
  2000. func ExampleIAM_RemoveUserFromGroup() {
  2001. sess, err := session.NewSession()
  2002. if err != nil {
  2003. fmt.Println("failed to create session,", err)
  2004. return
  2005. }
  2006. svc := iam.New(sess)
  2007. params := &iam.RemoveUserFromGroupInput{
  2008. GroupName: aws.String("groupNameType"), // Required
  2009. UserName: aws.String("existingUserNameType"), // Required
  2010. }
  2011. resp, err := svc.RemoveUserFromGroup(params)
  2012. if err != nil {
  2013. // Print the error, cast err to awserr.Error to get the Code and
  2014. // Message from an error.
  2015. fmt.Println(err.Error())
  2016. return
  2017. }
  2018. // Pretty-print the response data.
  2019. fmt.Println(resp)
  2020. }
  2021. func ExampleIAM_ResyncMFADevice() {
  2022. sess, err := session.NewSession()
  2023. if err != nil {
  2024. fmt.Println("failed to create session,", err)
  2025. return
  2026. }
  2027. svc := iam.New(sess)
  2028. params := &iam.ResyncMFADeviceInput{
  2029. AuthenticationCode1: aws.String("authenticationCodeType"), // Required
  2030. AuthenticationCode2: aws.String("authenticationCodeType"), // Required
  2031. SerialNumber: aws.String("serialNumberType"), // Required
  2032. UserName: aws.String("existingUserNameType"), // Required
  2033. }
  2034. resp, err := svc.ResyncMFADevice(params)
  2035. if err != nil {
  2036. // Print the error, cast err to awserr.Error to get the Code and
  2037. // Message from an error.
  2038. fmt.Println(err.Error())
  2039. return
  2040. }
  2041. // Pretty-print the response data.
  2042. fmt.Println(resp)
  2043. }
  2044. func ExampleIAM_SetDefaultPolicyVersion() {
  2045. sess, err := session.NewSession()
  2046. if err != nil {
  2047. fmt.Println("failed to create session,", err)
  2048. return
  2049. }
  2050. svc := iam.New(sess)
  2051. params := &iam.SetDefaultPolicyVersionInput{
  2052. PolicyArn: aws.String("arnType"), // Required
  2053. VersionId: aws.String("policyVersionIdType"), // Required
  2054. }
  2055. resp, err := svc.SetDefaultPolicyVersion(params)
  2056. if err != nil {
  2057. // Print the error, cast err to awserr.Error to get the Code and
  2058. // Message from an error.
  2059. fmt.Println(err.Error())
  2060. return
  2061. }
  2062. // Pretty-print the response data.
  2063. fmt.Println(resp)
  2064. }
  2065. func ExampleIAM_SimulateCustomPolicy() {
  2066. sess, err := session.NewSession()
  2067. if err != nil {
  2068. fmt.Println("failed to create session,", err)
  2069. return
  2070. }
  2071. svc := iam.New(sess)
  2072. params := &iam.SimulateCustomPolicyInput{
  2073. ActionNames: []*string{ // Required
  2074. aws.String("ActionNameType"), // Required
  2075. // More values...
  2076. },
  2077. PolicyInputList: []*string{ // Required
  2078. aws.String("policyDocumentType"), // Required
  2079. // More values...
  2080. },
  2081. CallerArn: aws.String("ResourceNameType"),
  2082. ContextEntries: []*iam.ContextEntry{
  2083. { // Required
  2084. ContextKeyName: aws.String("ContextKeyNameType"),
  2085. ContextKeyType: aws.String("ContextKeyTypeEnum"),
  2086. ContextKeyValues: []*string{
  2087. aws.String("ContextKeyValueType"), // Required
  2088. // More values...
  2089. },
  2090. },
  2091. // More values...
  2092. },
  2093. Marker: aws.String("markerType"),
  2094. MaxItems: aws.Int64(1),
  2095. ResourceArns: []*string{
  2096. aws.String("ResourceNameType"), // Required
  2097. // More values...
  2098. },
  2099. ResourceHandlingOption: aws.String("ResourceHandlingOptionType"),
  2100. ResourceOwner: aws.String("ResourceNameType"),
  2101. ResourcePolicy: aws.String("policyDocumentType"),
  2102. }
  2103. resp, err := svc.SimulateCustomPolicy(params)
  2104. if err != nil {
  2105. // Print the error, cast err to awserr.Error to get the Code and
  2106. // Message from an error.
  2107. fmt.Println(err.Error())
  2108. return
  2109. }
  2110. // Pretty-print the response data.
  2111. fmt.Println(resp)
  2112. }
  2113. func ExampleIAM_SimulatePrincipalPolicy() {
  2114. sess, err := session.NewSession()
  2115. if err != nil {
  2116. fmt.Println("failed to create session,", err)
  2117. return
  2118. }
  2119. svc := iam.New(sess)
  2120. params := &iam.SimulatePrincipalPolicyInput{
  2121. ActionNames: []*string{ // Required
  2122. aws.String("ActionNameType"), // Required
  2123. // More values...
  2124. },
  2125. PolicySourceArn: aws.String("arnType"), // Required
  2126. CallerArn: aws.String("ResourceNameType"),
  2127. ContextEntries: []*iam.ContextEntry{
  2128. { // Required
  2129. ContextKeyName: aws.String("ContextKeyNameType"),
  2130. ContextKeyType: aws.String("ContextKeyTypeEnum"),
  2131. ContextKeyValues: []*string{
  2132. aws.String("ContextKeyValueType"), // Required
  2133. // More values...
  2134. },
  2135. },
  2136. // More values...
  2137. },
  2138. Marker: aws.String("markerType"),
  2139. MaxItems: aws.Int64(1),
  2140. PolicyInputList: []*string{
  2141. aws.String("policyDocumentType"), // Required
  2142. // More values...
  2143. },
  2144. ResourceArns: []*string{
  2145. aws.String("ResourceNameType"), // Required
  2146. // More values...
  2147. },
  2148. ResourceHandlingOption: aws.String("ResourceHandlingOptionType"),
  2149. ResourceOwner: aws.String("ResourceNameType"),
  2150. ResourcePolicy: aws.String("policyDocumentType"),
  2151. }
  2152. resp, err := svc.SimulatePrincipalPolicy(params)
  2153. if err != nil {
  2154. // Print the error, cast err to awserr.Error to get the Code and
  2155. // Message from an error.
  2156. fmt.Println(err.Error())
  2157. return
  2158. }
  2159. // Pretty-print the response data.
  2160. fmt.Println(resp)
  2161. }
  2162. func ExampleIAM_UpdateAccessKey() {
  2163. sess, err := session.NewSession()
  2164. if err != nil {
  2165. fmt.Println("failed to create session,", err)
  2166. return
  2167. }
  2168. svc := iam.New(sess)
  2169. params := &iam.UpdateAccessKeyInput{
  2170. AccessKeyId: aws.String("accessKeyIdType"), // Required
  2171. Status: aws.String("statusType"), // Required
  2172. UserName: aws.String("existingUserNameType"),
  2173. }
  2174. resp, err := svc.UpdateAccessKey(params)
  2175. if err != nil {
  2176. // Print the error, cast err to awserr.Error to get the Code and
  2177. // Message from an error.
  2178. fmt.Println(err.Error())
  2179. return
  2180. }
  2181. // Pretty-print the response data.
  2182. fmt.Println(resp)
  2183. }
  2184. func ExampleIAM_UpdateAccountPasswordPolicy() {
  2185. sess, err := session.NewSession()
  2186. if err != nil {
  2187. fmt.Println("failed to create session,", err)
  2188. return
  2189. }
  2190. svc := iam.New(sess)
  2191. params := &iam.UpdateAccountPasswordPolicyInput{
  2192. AllowUsersToChangePassword: aws.Bool(true),
  2193. HardExpiry: aws.Bool(true),
  2194. MaxPasswordAge: aws.Int64(1),
  2195. MinimumPasswordLength: aws.Int64(1),
  2196. PasswordReusePrevention: aws.Int64(1),
  2197. RequireLowercaseCharacters: aws.Bool(true),
  2198. RequireNumbers: aws.Bool(true),
  2199. RequireSymbols: aws.Bool(true),
  2200. RequireUppercaseCharacters: aws.Bool(true),
  2201. }
  2202. resp, err := svc.UpdateAccountPasswordPolicy(params)
  2203. if err != nil {
  2204. // Print the error, cast err to awserr.Error to get the Code and
  2205. // Message from an error.
  2206. fmt.Println(err.Error())
  2207. return
  2208. }
  2209. // Pretty-print the response data.
  2210. fmt.Println(resp)
  2211. }
  2212. func ExampleIAM_UpdateAssumeRolePolicy() {
  2213. sess, err := session.NewSession()
  2214. if err != nil {
  2215. fmt.Println("failed to create session,", err)
  2216. return
  2217. }
  2218. svc := iam.New(sess)
  2219. params := &iam.UpdateAssumeRolePolicyInput{
  2220. PolicyDocument: aws.String("policyDocumentType"), // Required
  2221. RoleName: aws.String("roleNameType"), // Required
  2222. }
  2223. resp, err := svc.UpdateAssumeRolePolicy(params)
  2224. if err != nil {
  2225. // Print the error, cast err to awserr.Error to get the Code and
  2226. // Message from an error.
  2227. fmt.Println(err.Error())
  2228. return
  2229. }
  2230. // Pretty-print the response data.
  2231. fmt.Println(resp)
  2232. }
  2233. func ExampleIAM_UpdateGroup() {
  2234. sess, err := session.NewSession()
  2235. if err != nil {
  2236. fmt.Println("failed to create session,", err)
  2237. return
  2238. }
  2239. svc := iam.New(sess)
  2240. params := &iam.UpdateGroupInput{
  2241. GroupName: aws.String("groupNameType"), // Required
  2242. NewGroupName: aws.String("groupNameType"),
  2243. NewPath: aws.String("pathType"),
  2244. }
  2245. resp, err := svc.UpdateGroup(params)
  2246. if err != nil {
  2247. // Print the error, cast err to awserr.Error to get the Code and
  2248. // Message from an error.
  2249. fmt.Println(err.Error())
  2250. return
  2251. }
  2252. // Pretty-print the response data.
  2253. fmt.Println(resp)
  2254. }
  2255. func ExampleIAM_UpdateLoginProfile() {
  2256. sess, err := session.NewSession()
  2257. if err != nil {
  2258. fmt.Println("failed to create session,", err)
  2259. return
  2260. }
  2261. svc := iam.New(sess)
  2262. params := &iam.UpdateLoginProfileInput{
  2263. UserName: aws.String("userNameType"), // Required
  2264. Password: aws.String("passwordType"),
  2265. PasswordResetRequired: aws.Bool(true),
  2266. }
  2267. resp, err := svc.UpdateLoginProfile(params)
  2268. if err != nil {
  2269. // Print the error, cast err to awserr.Error to get the Code and
  2270. // Message from an error.
  2271. fmt.Println(err.Error())
  2272. return
  2273. }
  2274. // Pretty-print the response data.
  2275. fmt.Println(resp)
  2276. }
  2277. func ExampleIAM_UpdateOpenIDConnectProviderThumbprint() {
  2278. sess, err := session.NewSession()
  2279. if err != nil {
  2280. fmt.Println("failed to create session,", err)
  2281. return
  2282. }
  2283. svc := iam.New(sess)
  2284. params := &iam.UpdateOpenIDConnectProviderThumbprintInput{
  2285. OpenIDConnectProviderArn: aws.String("arnType"), // Required
  2286. ThumbprintList: []*string{ // Required
  2287. aws.String("thumbprintType"), // Required
  2288. // More values...
  2289. },
  2290. }
  2291. resp, err := svc.UpdateOpenIDConnectProviderThumbprint(params)
  2292. if err != nil {
  2293. // Print the error, cast err to awserr.Error to get the Code and
  2294. // Message from an error.
  2295. fmt.Println(err.Error())
  2296. return
  2297. }
  2298. // Pretty-print the response data.
  2299. fmt.Println(resp)
  2300. }
  2301. func ExampleIAM_UpdateSAMLProvider() {
  2302. sess, err := session.NewSession()
  2303. if err != nil {
  2304. fmt.Println("failed to create session,", err)
  2305. return
  2306. }
  2307. svc := iam.New(sess)
  2308. params := &iam.UpdateSAMLProviderInput{
  2309. SAMLMetadataDocument: aws.String("SAMLMetadataDocumentType"), // Required
  2310. SAMLProviderArn: aws.String("arnType"), // Required
  2311. }
  2312. resp, err := svc.UpdateSAMLProvider(params)
  2313. if err != nil {
  2314. // Print the error, cast err to awserr.Error to get the Code and
  2315. // Message from an error.
  2316. fmt.Println(err.Error())
  2317. return
  2318. }
  2319. // Pretty-print the response data.
  2320. fmt.Println(resp)
  2321. }
  2322. func ExampleIAM_UpdateSSHPublicKey() {
  2323. sess, err := session.NewSession()
  2324. if err != nil {
  2325. fmt.Println("failed to create session,", err)
  2326. return
  2327. }
  2328. svc := iam.New(sess)
  2329. params := &iam.UpdateSSHPublicKeyInput{
  2330. SSHPublicKeyId: aws.String("publicKeyIdType"), // Required
  2331. Status: aws.String("statusType"), // Required
  2332. UserName: aws.String("userNameType"), // Required
  2333. }
  2334. resp, err := svc.UpdateSSHPublicKey(params)
  2335. if err != nil {
  2336. // Print the error, cast err to awserr.Error to get the Code and
  2337. // Message from an error.
  2338. fmt.Println(err.Error())
  2339. return
  2340. }
  2341. // Pretty-print the response data.
  2342. fmt.Println(resp)
  2343. }
  2344. func ExampleIAM_UpdateServerCertificate() {
  2345. sess, err := session.NewSession()
  2346. if err != nil {
  2347. fmt.Println("failed to create session,", err)
  2348. return
  2349. }
  2350. svc := iam.New(sess)
  2351. params := &iam.UpdateServerCertificateInput{
  2352. ServerCertificateName: aws.String("serverCertificateNameType"), // Required
  2353. NewPath: aws.String("pathType"),
  2354. NewServerCertificateName: aws.String("serverCertificateNameType"),
  2355. }
  2356. resp, err := svc.UpdateServerCertificate(params)
  2357. if err != nil {
  2358. // Print the error, cast err to awserr.Error to get the Code and
  2359. // Message from an error.
  2360. fmt.Println(err.Error())
  2361. return
  2362. }
  2363. // Pretty-print the response data.
  2364. fmt.Println(resp)
  2365. }
  2366. func ExampleIAM_UpdateSigningCertificate() {
  2367. sess, err := session.NewSession()
  2368. if err != nil {
  2369. fmt.Println("failed to create session,", err)
  2370. return
  2371. }
  2372. svc := iam.New(sess)
  2373. params := &iam.UpdateSigningCertificateInput{
  2374. CertificateId: aws.String("certificateIdType"), // Required
  2375. Status: aws.String("statusType"), // Required
  2376. UserName: aws.String("existingUserNameType"),
  2377. }
  2378. resp, err := svc.UpdateSigningCertificate(params)
  2379. if err != nil {
  2380. // Print the error, cast err to awserr.Error to get the Code and
  2381. // Message from an error.
  2382. fmt.Println(err.Error())
  2383. return
  2384. }
  2385. // Pretty-print the response data.
  2386. fmt.Println(resp)
  2387. }
  2388. func ExampleIAM_UpdateUser() {
  2389. sess, err := session.NewSession()
  2390. if err != nil {
  2391. fmt.Println("failed to create session,", err)
  2392. return
  2393. }
  2394. svc := iam.New(sess)
  2395. params := &iam.UpdateUserInput{
  2396. UserName: aws.String("existingUserNameType"), // Required
  2397. NewPath: aws.String("pathType"),
  2398. NewUserName: aws.String("userNameType"),
  2399. }
  2400. resp, err := svc.UpdateUser(params)
  2401. if err != nil {
  2402. // Print the error, cast err to awserr.Error to get the Code and
  2403. // Message from an error.
  2404. fmt.Println(err.Error())
  2405. return
  2406. }
  2407. // Pretty-print the response data.
  2408. fmt.Println(resp)
  2409. }
  2410. func ExampleIAM_UploadSSHPublicKey() {
  2411. sess, err := session.NewSession()
  2412. if err != nil {
  2413. fmt.Println("failed to create session,", err)
  2414. return
  2415. }
  2416. svc := iam.New(sess)
  2417. params := &iam.UploadSSHPublicKeyInput{
  2418. SSHPublicKeyBody: aws.String("publicKeyMaterialType"), // Required
  2419. UserName: aws.String("userNameType"), // Required
  2420. }
  2421. resp, err := svc.UploadSSHPublicKey(params)
  2422. if err != nil {
  2423. // Print the error, cast err to awserr.Error to get the Code and
  2424. // Message from an error.
  2425. fmt.Println(err.Error())
  2426. return
  2427. }
  2428. // Pretty-print the response data.
  2429. fmt.Println(resp)
  2430. }
  2431. func ExampleIAM_UploadServerCertificate() {
  2432. sess, err := session.NewSession()
  2433. if err != nil {
  2434. fmt.Println("failed to create session,", err)
  2435. return
  2436. }
  2437. svc := iam.New(sess)
  2438. params := &iam.UploadServerCertificateInput{
  2439. CertificateBody: aws.String("certificateBodyType"), // Required
  2440. PrivateKey: aws.String("privateKeyType"), // Required
  2441. ServerCertificateName: aws.String("serverCertificateNameType"), // Required
  2442. CertificateChain: aws.String("certificateChainType"),
  2443. Path: aws.String("pathType"),
  2444. }
  2445. resp, err := svc.UploadServerCertificate(params)
  2446. if err != nil {
  2447. // Print the error, cast err to awserr.Error to get the Code and
  2448. // Message from an error.
  2449. fmt.Println(err.Error())
  2450. return
  2451. }
  2452. // Pretty-print the response data.
  2453. fmt.Println(resp)
  2454. }
  2455. func ExampleIAM_UploadSigningCertificate() {
  2456. sess, err := session.NewSession()
  2457. if err != nil {
  2458. fmt.Println("failed to create session,", err)
  2459. return
  2460. }
  2461. svc := iam.New(sess)
  2462. params := &iam.UploadSigningCertificateInput{
  2463. CertificateBody: aws.String("certificateBodyType"), // Required
  2464. UserName: aws.String("existingUserNameType"),
  2465. }
  2466. resp, err := svc.UploadSigningCertificate(params)
  2467. if err != nil {
  2468. // Print the error, cast err to awserr.Error to get the Code and
  2469. // Message from an error.
  2470. fmt.Println(err.Error())
  2471. return
  2472. }
  2473. // Pretty-print the response data.
  2474. fmt.Println(resp)
  2475. }