examples_test.go 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225
  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/service/iam"
  9. )
  10. var _ time.Duration
  11. var _ bytes.Buffer
  12. func ExampleIAM_AddClientIDToOpenIDConnectProvider() {
  13. svc := iam.New(nil)
  14. params := &iam.AddClientIDToOpenIDConnectProviderInput{
  15. ClientID: aws.String("clientIDType"), // Required
  16. OpenIDConnectProviderArn: aws.String("arnType"), // Required
  17. }
  18. resp, err := svc.AddClientIDToOpenIDConnectProvider(params)
  19. if err != nil {
  20. // Print the error, cast err to awserr.Error to get the Code and
  21. // Message from an error.
  22. fmt.Println(err.Error())
  23. return
  24. }
  25. // Pretty-print the response data.
  26. fmt.Println(resp)
  27. }
  28. func ExampleIAM_AddRoleToInstanceProfile() {
  29. svc := iam.New(nil)
  30. params := &iam.AddRoleToInstanceProfileInput{
  31. InstanceProfileName: aws.String("instanceProfileNameType"), // Required
  32. RoleName: aws.String("roleNameType"), // Required
  33. }
  34. resp, err := svc.AddRoleToInstanceProfile(params)
  35. if err != nil {
  36. // Print the error, cast err to awserr.Error to get the Code and
  37. // Message from an error.
  38. fmt.Println(err.Error())
  39. return
  40. }
  41. // Pretty-print the response data.
  42. fmt.Println(resp)
  43. }
  44. func ExampleIAM_AddUserToGroup() {
  45. svc := iam.New(nil)
  46. params := &iam.AddUserToGroupInput{
  47. GroupName: aws.String("groupNameType"), // Required
  48. UserName: aws.String("existingUserNameType"), // Required
  49. }
  50. resp, err := svc.AddUserToGroup(params)
  51. if err != nil {
  52. // Print the error, cast err to awserr.Error to get the Code and
  53. // Message from an error.
  54. fmt.Println(err.Error())
  55. return
  56. }
  57. // Pretty-print the response data.
  58. fmt.Println(resp)
  59. }
  60. func ExampleIAM_AttachGroupPolicy() {
  61. svc := iam.New(nil)
  62. params := &iam.AttachGroupPolicyInput{
  63. GroupName: aws.String("groupNameType"), // Required
  64. PolicyArn: aws.String("arnType"), // Required
  65. }
  66. resp, err := svc.AttachGroupPolicy(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_AttachRolePolicy() {
  77. svc := iam.New(nil)
  78. params := &iam.AttachRolePolicyInput{
  79. PolicyArn: aws.String("arnType"), // Required
  80. RoleName: aws.String("roleNameType"), // Required
  81. }
  82. resp, err := svc.AttachRolePolicy(params)
  83. if err != nil {
  84. // Print the error, cast err to awserr.Error to get the Code and
  85. // Message from an error.
  86. fmt.Println(err.Error())
  87. return
  88. }
  89. // Pretty-print the response data.
  90. fmt.Println(resp)
  91. }
  92. func ExampleIAM_AttachUserPolicy() {
  93. svc := iam.New(nil)
  94. params := &iam.AttachUserPolicyInput{
  95. PolicyArn: aws.String("arnType"), // Required
  96. UserName: aws.String("userNameType"), // Required
  97. }
  98. resp, err := svc.AttachUserPolicy(params)
  99. if err != nil {
  100. // Print the error, cast err to awserr.Error to get the Code and
  101. // Message from an error.
  102. fmt.Println(err.Error())
  103. return
  104. }
  105. // Pretty-print the response data.
  106. fmt.Println(resp)
  107. }
  108. func ExampleIAM_ChangePassword() {
  109. svc := iam.New(nil)
  110. params := &iam.ChangePasswordInput{
  111. NewPassword: aws.String("passwordType"), // Required
  112. OldPassword: aws.String("passwordType"), // Required
  113. }
  114. resp, err := svc.ChangePassword(params)
  115. if err != nil {
  116. // Print the error, cast err to awserr.Error to get the Code and
  117. // Message from an error.
  118. fmt.Println(err.Error())
  119. return
  120. }
  121. // Pretty-print the response data.
  122. fmt.Println(resp)
  123. }
  124. func ExampleIAM_CreateAccessKey() {
  125. svc := iam.New(nil)
  126. params := &iam.CreateAccessKeyInput{
  127. UserName: aws.String("existingUserNameType"),
  128. }
  129. resp, err := svc.CreateAccessKey(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_CreateAccountAlias() {
  140. svc := iam.New(nil)
  141. params := &iam.CreateAccountAliasInput{
  142. AccountAlias: aws.String("accountAliasType"), // Required
  143. }
  144. resp, err := svc.CreateAccountAlias(params)
  145. if err != nil {
  146. // Print the error, cast err to awserr.Error to get the Code and
  147. // Message from an error.
  148. fmt.Println(err.Error())
  149. return
  150. }
  151. // Pretty-print the response data.
  152. fmt.Println(resp)
  153. }
  154. func ExampleIAM_CreateGroup() {
  155. svc := iam.New(nil)
  156. params := &iam.CreateGroupInput{
  157. GroupName: aws.String("groupNameType"), // Required
  158. Path: aws.String("pathType"),
  159. }
  160. resp, err := svc.CreateGroup(params)
  161. if err != nil {
  162. // Print the error, cast err to awserr.Error to get the Code and
  163. // Message from an error.
  164. fmt.Println(err.Error())
  165. return
  166. }
  167. // Pretty-print the response data.
  168. fmt.Println(resp)
  169. }
  170. func ExampleIAM_CreateInstanceProfile() {
  171. svc := iam.New(nil)
  172. params := &iam.CreateInstanceProfileInput{
  173. InstanceProfileName: aws.String("instanceProfileNameType"), // Required
  174. Path: aws.String("pathType"),
  175. }
  176. resp, err := svc.CreateInstanceProfile(params)
  177. if err != nil {
  178. // Print the error, cast err to awserr.Error to get the Code and
  179. // Message from an error.
  180. fmt.Println(err.Error())
  181. return
  182. }
  183. // Pretty-print the response data.
  184. fmt.Println(resp)
  185. }
  186. func ExampleIAM_CreateLoginProfile() {
  187. svc := iam.New(nil)
  188. params := &iam.CreateLoginProfileInput{
  189. Password: aws.String("passwordType"), // Required
  190. UserName: aws.String("userNameType"), // Required
  191. PasswordResetRequired: aws.Bool(true),
  192. }
  193. resp, err := svc.CreateLoginProfile(params)
  194. if err != nil {
  195. // Print the error, cast err to awserr.Error to get the Code and
  196. // Message from an error.
  197. fmt.Println(err.Error())
  198. return
  199. }
  200. // Pretty-print the response data.
  201. fmt.Println(resp)
  202. }
  203. func ExampleIAM_CreateOpenIDConnectProvider() {
  204. svc := iam.New(nil)
  205. params := &iam.CreateOpenIDConnectProviderInput{
  206. ThumbprintList: []*string{ // Required
  207. aws.String("thumbprintType"), // Required
  208. // More values...
  209. },
  210. Url: aws.String("OpenIDConnectProviderUrlType"), // Required
  211. ClientIDList: []*string{
  212. aws.String("clientIDType"), // Required
  213. // More values...
  214. },
  215. }
  216. resp, err := svc.CreateOpenIDConnectProvider(params)
  217. if err != nil {
  218. // Print the error, cast err to awserr.Error to get the Code and
  219. // Message from an error.
  220. fmt.Println(err.Error())
  221. return
  222. }
  223. // Pretty-print the response data.
  224. fmt.Println(resp)
  225. }
  226. func ExampleIAM_CreatePolicy() {
  227. svc := iam.New(nil)
  228. params := &iam.CreatePolicyInput{
  229. PolicyDocument: aws.String("policyDocumentType"), // Required
  230. PolicyName: aws.String("policyNameType"), // Required
  231. Description: aws.String("policyDescriptionType"),
  232. Path: aws.String("policyPathType"),
  233. }
  234. resp, err := svc.CreatePolicy(params)
  235. if err != nil {
  236. // Print the error, cast err to awserr.Error to get the Code and
  237. // Message from an error.
  238. fmt.Println(err.Error())
  239. return
  240. }
  241. // Pretty-print the response data.
  242. fmt.Println(resp)
  243. }
  244. func ExampleIAM_CreatePolicyVersion() {
  245. svc := iam.New(nil)
  246. params := &iam.CreatePolicyVersionInput{
  247. PolicyArn: aws.String("arnType"), // Required
  248. PolicyDocument: aws.String("policyDocumentType"), // Required
  249. SetAsDefault: aws.Bool(true),
  250. }
  251. resp, err := svc.CreatePolicyVersion(params)
  252. if err != nil {
  253. // Print the error, cast err to awserr.Error to get the Code and
  254. // Message from an error.
  255. fmt.Println(err.Error())
  256. return
  257. }
  258. // Pretty-print the response data.
  259. fmt.Println(resp)
  260. }
  261. func ExampleIAM_CreateRole() {
  262. svc := iam.New(nil)
  263. params := &iam.CreateRoleInput{
  264. AssumeRolePolicyDocument: aws.String("policyDocumentType"), // Required
  265. RoleName: aws.String("roleNameType"), // Required
  266. Path: aws.String("pathType"),
  267. }
  268. resp, err := svc.CreateRole(params)
  269. if err != nil {
  270. // Print the error, cast err to awserr.Error to get the Code and
  271. // Message from an error.
  272. fmt.Println(err.Error())
  273. return
  274. }
  275. // Pretty-print the response data.
  276. fmt.Println(resp)
  277. }
  278. func ExampleIAM_CreateSAMLProvider() {
  279. svc := iam.New(nil)
  280. params := &iam.CreateSAMLProviderInput{
  281. Name: aws.String("SAMLProviderNameType"), // Required
  282. SAMLMetadataDocument: aws.String("SAMLMetadataDocumentType"), // Required
  283. }
  284. resp, err := svc.CreateSAMLProvider(params)
  285. if err != nil {
  286. // Print the error, cast err to awserr.Error to get the Code and
  287. // Message from an error.
  288. fmt.Println(err.Error())
  289. return
  290. }
  291. // Pretty-print the response data.
  292. fmt.Println(resp)
  293. }
  294. func ExampleIAM_CreateUser() {
  295. svc := iam.New(nil)
  296. params := &iam.CreateUserInput{
  297. UserName: aws.String("userNameType"), // Required
  298. Path: aws.String("pathType"),
  299. }
  300. resp, err := svc.CreateUser(params)
  301. if err != nil {
  302. // Print the error, cast err to awserr.Error to get the Code and
  303. // Message from an error.
  304. fmt.Println(err.Error())
  305. return
  306. }
  307. // Pretty-print the response data.
  308. fmt.Println(resp)
  309. }
  310. func ExampleIAM_CreateVirtualMFADevice() {
  311. svc := iam.New(nil)
  312. params := &iam.CreateVirtualMFADeviceInput{
  313. VirtualMFADeviceName: aws.String("virtualMFADeviceName"), // Required
  314. Path: aws.String("pathType"),
  315. }
  316. resp, err := svc.CreateVirtualMFADevice(params)
  317. if err != nil {
  318. // Print the error, cast err to awserr.Error to get the Code and
  319. // Message from an error.
  320. fmt.Println(err.Error())
  321. return
  322. }
  323. // Pretty-print the response data.
  324. fmt.Println(resp)
  325. }
  326. func ExampleIAM_DeactivateMFADevice() {
  327. svc := iam.New(nil)
  328. params := &iam.DeactivateMFADeviceInput{
  329. SerialNumber: aws.String("serialNumberType"), // Required
  330. UserName: aws.String("existingUserNameType"), // Required
  331. }
  332. resp, err := svc.DeactivateMFADevice(params)
  333. if err != nil {
  334. // Print the error, cast err to awserr.Error to get the Code and
  335. // Message from an error.
  336. fmt.Println(err.Error())
  337. return
  338. }
  339. // Pretty-print the response data.
  340. fmt.Println(resp)
  341. }
  342. func ExampleIAM_DeleteAccessKey() {
  343. svc := iam.New(nil)
  344. params := &iam.DeleteAccessKeyInput{
  345. AccessKeyId: aws.String("accessKeyIdType"), // Required
  346. UserName: aws.String("existingUserNameType"),
  347. }
  348. resp, err := svc.DeleteAccessKey(params)
  349. if err != nil {
  350. // Print the error, cast err to awserr.Error to get the Code and
  351. // Message from an error.
  352. fmt.Println(err.Error())
  353. return
  354. }
  355. // Pretty-print the response data.
  356. fmt.Println(resp)
  357. }
  358. func ExampleIAM_DeleteAccountAlias() {
  359. svc := iam.New(nil)
  360. params := &iam.DeleteAccountAliasInput{
  361. AccountAlias: aws.String("accountAliasType"), // Required
  362. }
  363. resp, err := svc.DeleteAccountAlias(params)
  364. if err != nil {
  365. // Print the error, cast err to awserr.Error to get the Code and
  366. // Message from an error.
  367. fmt.Println(err.Error())
  368. return
  369. }
  370. // Pretty-print the response data.
  371. fmt.Println(resp)
  372. }
  373. func ExampleIAM_DeleteAccountPasswordPolicy() {
  374. svc := iam.New(nil)
  375. var params *iam.DeleteAccountPasswordPolicyInput
  376. resp, err := svc.DeleteAccountPasswordPolicy(params)
  377. if err != nil {
  378. // Print the error, cast err to awserr.Error to get the Code and
  379. // Message from an error.
  380. fmt.Println(err.Error())
  381. return
  382. }
  383. // Pretty-print the response data.
  384. fmt.Println(resp)
  385. }
  386. func ExampleIAM_DeleteGroup() {
  387. svc := iam.New(nil)
  388. params := &iam.DeleteGroupInput{
  389. GroupName: aws.String("groupNameType"), // Required
  390. }
  391. resp, err := svc.DeleteGroup(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_DeleteGroupPolicy() {
  402. svc := iam.New(nil)
  403. params := &iam.DeleteGroupPolicyInput{
  404. GroupName: aws.String("groupNameType"), // Required
  405. PolicyName: aws.String("policyNameType"), // Required
  406. }
  407. resp, err := svc.DeleteGroupPolicy(params)
  408. if err != nil {
  409. // Print the error, cast err to awserr.Error to get the Code and
  410. // Message from an error.
  411. fmt.Println(err.Error())
  412. return
  413. }
  414. // Pretty-print the response data.
  415. fmt.Println(resp)
  416. }
  417. func ExampleIAM_DeleteInstanceProfile() {
  418. svc := iam.New(nil)
  419. params := &iam.DeleteInstanceProfileInput{
  420. InstanceProfileName: aws.String("instanceProfileNameType"), // Required
  421. }
  422. resp, err := svc.DeleteInstanceProfile(params)
  423. if err != nil {
  424. // Print the error, cast err to awserr.Error to get the Code and
  425. // Message from an error.
  426. fmt.Println(err.Error())
  427. return
  428. }
  429. // Pretty-print the response data.
  430. fmt.Println(resp)
  431. }
  432. func ExampleIAM_DeleteLoginProfile() {
  433. svc := iam.New(nil)
  434. params := &iam.DeleteLoginProfileInput{
  435. UserName: aws.String("userNameType"), // Required
  436. }
  437. resp, err := svc.DeleteLoginProfile(params)
  438. if err != nil {
  439. // Print the error, cast err to awserr.Error to get the Code and
  440. // Message from an error.
  441. fmt.Println(err.Error())
  442. return
  443. }
  444. // Pretty-print the response data.
  445. fmt.Println(resp)
  446. }
  447. func ExampleIAM_DeleteOpenIDConnectProvider() {
  448. svc := iam.New(nil)
  449. params := &iam.DeleteOpenIDConnectProviderInput{
  450. OpenIDConnectProviderArn: aws.String("arnType"), // Required
  451. }
  452. resp, err := svc.DeleteOpenIDConnectProvider(params)
  453. if err != nil {
  454. // Print the error, cast err to awserr.Error to get the Code and
  455. // Message from an error.
  456. fmt.Println(err.Error())
  457. return
  458. }
  459. // Pretty-print the response data.
  460. fmt.Println(resp)
  461. }
  462. func ExampleIAM_DeletePolicy() {
  463. svc := iam.New(nil)
  464. params := &iam.DeletePolicyInput{
  465. PolicyArn: aws.String("arnType"), // Required
  466. }
  467. resp, err := svc.DeletePolicy(params)
  468. if err != nil {
  469. // Print the error, cast err to awserr.Error to get the Code and
  470. // Message from an error.
  471. fmt.Println(err.Error())
  472. return
  473. }
  474. // Pretty-print the response data.
  475. fmt.Println(resp)
  476. }
  477. func ExampleIAM_DeletePolicyVersion() {
  478. svc := iam.New(nil)
  479. params := &iam.DeletePolicyVersionInput{
  480. PolicyArn: aws.String("arnType"), // Required
  481. VersionId: aws.String("policyVersionIdType"), // Required
  482. }
  483. resp, err := svc.DeletePolicyVersion(params)
  484. if err != nil {
  485. // Print the error, cast err to awserr.Error to get the Code and
  486. // Message from an error.
  487. fmt.Println(err.Error())
  488. return
  489. }
  490. // Pretty-print the response data.
  491. fmt.Println(resp)
  492. }
  493. func ExampleIAM_DeleteRole() {
  494. svc := iam.New(nil)
  495. params := &iam.DeleteRoleInput{
  496. RoleName: aws.String("roleNameType"), // Required
  497. }
  498. resp, err := svc.DeleteRole(params)
  499. if err != nil {
  500. // Print the error, cast err to awserr.Error to get the Code and
  501. // Message from an error.
  502. fmt.Println(err.Error())
  503. return
  504. }
  505. // Pretty-print the response data.
  506. fmt.Println(resp)
  507. }
  508. func ExampleIAM_DeleteRolePolicy() {
  509. svc := iam.New(nil)
  510. params := &iam.DeleteRolePolicyInput{
  511. PolicyName: aws.String("policyNameType"), // Required
  512. RoleName: aws.String("roleNameType"), // Required
  513. }
  514. resp, err := svc.DeleteRolePolicy(params)
  515. if err != nil {
  516. // Print the error, cast err to awserr.Error to get the Code and
  517. // Message from an error.
  518. fmt.Println(err.Error())
  519. return
  520. }
  521. // Pretty-print the response data.
  522. fmt.Println(resp)
  523. }
  524. func ExampleIAM_DeleteSAMLProvider() {
  525. svc := iam.New(nil)
  526. params := &iam.DeleteSAMLProviderInput{
  527. SAMLProviderArn: aws.String("arnType"), // Required
  528. }
  529. resp, err := svc.DeleteSAMLProvider(params)
  530. if err != nil {
  531. // Print the error, cast err to awserr.Error to get the Code and
  532. // Message from an error.
  533. fmt.Println(err.Error())
  534. return
  535. }
  536. // Pretty-print the response data.
  537. fmt.Println(resp)
  538. }
  539. func ExampleIAM_DeleteSSHPublicKey() {
  540. svc := iam.New(nil)
  541. params := &iam.DeleteSSHPublicKeyInput{
  542. SSHPublicKeyId: aws.String("publicKeyIdType"), // Required
  543. UserName: aws.String("userNameType"), // Required
  544. }
  545. resp, err := svc.DeleteSSHPublicKey(params)
  546. if err != nil {
  547. // Print the error, cast err to awserr.Error to get the Code and
  548. // Message from an error.
  549. fmt.Println(err.Error())
  550. return
  551. }
  552. // Pretty-print the response data.
  553. fmt.Println(resp)
  554. }
  555. func ExampleIAM_DeleteServerCertificate() {
  556. svc := iam.New(nil)
  557. params := &iam.DeleteServerCertificateInput{
  558. ServerCertificateName: aws.String("serverCertificateNameType"), // Required
  559. }
  560. resp, err := svc.DeleteServerCertificate(params)
  561. if err != nil {
  562. // Print the error, cast err to awserr.Error to get the Code and
  563. // Message from an error.
  564. fmt.Println(err.Error())
  565. return
  566. }
  567. // Pretty-print the response data.
  568. fmt.Println(resp)
  569. }
  570. func ExampleIAM_DeleteSigningCertificate() {
  571. svc := iam.New(nil)
  572. params := &iam.DeleteSigningCertificateInput{
  573. CertificateId: aws.String("certificateIdType"), // Required
  574. UserName: aws.String("existingUserNameType"),
  575. }
  576. resp, err := svc.DeleteSigningCertificate(params)
  577. if err != nil {
  578. // Print the error, cast err to awserr.Error to get the Code and
  579. // Message from an error.
  580. fmt.Println(err.Error())
  581. return
  582. }
  583. // Pretty-print the response data.
  584. fmt.Println(resp)
  585. }
  586. func ExampleIAM_DeleteUser() {
  587. svc := iam.New(nil)
  588. params := &iam.DeleteUserInput{
  589. UserName: aws.String("existingUserNameType"), // Required
  590. }
  591. resp, err := svc.DeleteUser(params)
  592. if err != nil {
  593. // Print the error, cast err to awserr.Error to get the Code and
  594. // Message from an error.
  595. fmt.Println(err.Error())
  596. return
  597. }
  598. // Pretty-print the response data.
  599. fmt.Println(resp)
  600. }
  601. func ExampleIAM_DeleteUserPolicy() {
  602. svc := iam.New(nil)
  603. params := &iam.DeleteUserPolicyInput{
  604. PolicyName: aws.String("policyNameType"), // Required
  605. UserName: aws.String("existingUserNameType"), // Required
  606. }
  607. resp, err := svc.DeleteUserPolicy(params)
  608. if err != nil {
  609. // Print the error, cast err to awserr.Error to get the Code and
  610. // Message from an error.
  611. fmt.Println(err.Error())
  612. return
  613. }
  614. // Pretty-print the response data.
  615. fmt.Println(resp)
  616. }
  617. func ExampleIAM_DeleteVirtualMFADevice() {
  618. svc := iam.New(nil)
  619. params := &iam.DeleteVirtualMFADeviceInput{
  620. SerialNumber: aws.String("serialNumberType"), // Required
  621. }
  622. resp, err := svc.DeleteVirtualMFADevice(params)
  623. if err != nil {
  624. // Print the error, cast err to awserr.Error to get the Code and
  625. // Message from an error.
  626. fmt.Println(err.Error())
  627. return
  628. }
  629. // Pretty-print the response data.
  630. fmt.Println(resp)
  631. }
  632. func ExampleIAM_DetachGroupPolicy() {
  633. svc := iam.New(nil)
  634. params := &iam.DetachGroupPolicyInput{
  635. GroupName: aws.String("groupNameType"), // Required
  636. PolicyArn: aws.String("arnType"), // Required
  637. }
  638. resp, err := svc.DetachGroupPolicy(params)
  639. if err != nil {
  640. // Print the error, cast err to awserr.Error to get the Code and
  641. // Message from an error.
  642. fmt.Println(err.Error())
  643. return
  644. }
  645. // Pretty-print the response data.
  646. fmt.Println(resp)
  647. }
  648. func ExampleIAM_DetachRolePolicy() {
  649. svc := iam.New(nil)
  650. params := &iam.DetachRolePolicyInput{
  651. PolicyArn: aws.String("arnType"), // Required
  652. RoleName: aws.String("roleNameType"), // Required
  653. }
  654. resp, err := svc.DetachRolePolicy(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_DetachUserPolicy() {
  665. svc := iam.New(nil)
  666. params := &iam.DetachUserPolicyInput{
  667. PolicyArn: aws.String("arnType"), // Required
  668. UserName: aws.String("userNameType"), // Required
  669. }
  670. resp, err := svc.DetachUserPolicy(params)
  671. if err != nil {
  672. // Print the error, cast err to awserr.Error to get the Code and
  673. // Message from an error.
  674. fmt.Println(err.Error())
  675. return
  676. }
  677. // Pretty-print the response data.
  678. fmt.Println(resp)
  679. }
  680. func ExampleIAM_EnableMFADevice() {
  681. svc := iam.New(nil)
  682. params := &iam.EnableMFADeviceInput{
  683. AuthenticationCode1: aws.String("authenticationCodeType"), // Required
  684. AuthenticationCode2: aws.String("authenticationCodeType"), // Required
  685. SerialNumber: aws.String("serialNumberType"), // Required
  686. UserName: aws.String("existingUserNameType"), // Required
  687. }
  688. resp, err := svc.EnableMFADevice(params)
  689. if err != nil {
  690. // Print the error, cast err to awserr.Error to get the Code and
  691. // Message from an error.
  692. fmt.Println(err.Error())
  693. return
  694. }
  695. // Pretty-print the response data.
  696. fmt.Println(resp)
  697. }
  698. func ExampleIAM_GenerateCredentialReport() {
  699. svc := iam.New(nil)
  700. var params *iam.GenerateCredentialReportInput
  701. resp, err := svc.GenerateCredentialReport(params)
  702. if err != nil {
  703. // Print the error, cast err to awserr.Error to get the Code and
  704. // Message from an error.
  705. fmt.Println(err.Error())
  706. return
  707. }
  708. // Pretty-print the response data.
  709. fmt.Println(resp)
  710. }
  711. func ExampleIAM_GetAccessKeyLastUsed() {
  712. svc := iam.New(nil)
  713. params := &iam.GetAccessKeyLastUsedInput{
  714. AccessKeyId: aws.String("accessKeyIdType"), // Required
  715. }
  716. resp, err := svc.GetAccessKeyLastUsed(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_GetAccountAuthorizationDetails() {
  727. svc := iam.New(nil)
  728. params := &iam.GetAccountAuthorizationDetailsInput{
  729. Filter: []*string{
  730. aws.String("EntityType"), // Required
  731. // More values...
  732. },
  733. Marker: aws.String("markerType"),
  734. MaxItems: aws.Int64(1),
  735. }
  736. resp, err := svc.GetAccountAuthorizationDetails(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_GetAccountPasswordPolicy() {
  747. svc := iam.New(nil)
  748. var params *iam.GetAccountPasswordPolicyInput
  749. resp, err := svc.GetAccountPasswordPolicy(params)
  750. if err != nil {
  751. // Print the error, cast err to awserr.Error to get the Code and
  752. // Message from an error.
  753. fmt.Println(err.Error())
  754. return
  755. }
  756. // Pretty-print the response data.
  757. fmt.Println(resp)
  758. }
  759. func ExampleIAM_GetAccountSummary() {
  760. svc := iam.New(nil)
  761. var params *iam.GetAccountSummaryInput
  762. resp, err := svc.GetAccountSummary(params)
  763. if err != nil {
  764. // Print the error, cast err to awserr.Error to get the Code and
  765. // Message from an error.
  766. fmt.Println(err.Error())
  767. return
  768. }
  769. // Pretty-print the response data.
  770. fmt.Println(resp)
  771. }
  772. func ExampleIAM_GetCredentialReport() {
  773. svc := iam.New(nil)
  774. var params *iam.GetCredentialReportInput
  775. resp, err := svc.GetCredentialReport(params)
  776. if err != nil {
  777. // Print the error, cast err to awserr.Error to get the Code and
  778. // Message from an error.
  779. fmt.Println(err.Error())
  780. return
  781. }
  782. // Pretty-print the response data.
  783. fmt.Println(resp)
  784. }
  785. func ExampleIAM_GetGroup() {
  786. svc := iam.New(nil)
  787. params := &iam.GetGroupInput{
  788. GroupName: aws.String("groupNameType"), // Required
  789. Marker: aws.String("markerType"),
  790. MaxItems: aws.Int64(1),
  791. }
  792. resp, err := svc.GetGroup(params)
  793. if err != nil {
  794. // Print the error, cast err to awserr.Error to get the Code and
  795. // Message from an error.
  796. fmt.Println(err.Error())
  797. return
  798. }
  799. // Pretty-print the response data.
  800. fmt.Println(resp)
  801. }
  802. func ExampleIAM_GetGroupPolicy() {
  803. svc := iam.New(nil)
  804. params := &iam.GetGroupPolicyInput{
  805. GroupName: aws.String("groupNameType"), // Required
  806. PolicyName: aws.String("policyNameType"), // Required
  807. }
  808. resp, err := svc.GetGroupPolicy(params)
  809. if err != nil {
  810. // Print the error, cast err to awserr.Error to get the Code and
  811. // Message from an error.
  812. fmt.Println(err.Error())
  813. return
  814. }
  815. // Pretty-print the response data.
  816. fmt.Println(resp)
  817. }
  818. func ExampleIAM_GetInstanceProfile() {
  819. svc := iam.New(nil)
  820. params := &iam.GetInstanceProfileInput{
  821. InstanceProfileName: aws.String("instanceProfileNameType"), // Required
  822. }
  823. resp, err := svc.GetInstanceProfile(params)
  824. if err != nil {
  825. // Print the error, cast err to awserr.Error to get the Code and
  826. // Message from an error.
  827. fmt.Println(err.Error())
  828. return
  829. }
  830. // Pretty-print the response data.
  831. fmt.Println(resp)
  832. }
  833. func ExampleIAM_GetLoginProfile() {
  834. svc := iam.New(nil)
  835. params := &iam.GetLoginProfileInput{
  836. UserName: aws.String("userNameType"), // Required
  837. }
  838. resp, err := svc.GetLoginProfile(params)
  839. if err != nil {
  840. // Print the error, cast err to awserr.Error to get the Code and
  841. // Message from an error.
  842. fmt.Println(err.Error())
  843. return
  844. }
  845. // Pretty-print the response data.
  846. fmt.Println(resp)
  847. }
  848. func ExampleIAM_GetOpenIDConnectProvider() {
  849. svc := iam.New(nil)
  850. params := &iam.GetOpenIDConnectProviderInput{
  851. OpenIDConnectProviderArn: aws.String("arnType"), // Required
  852. }
  853. resp, err := svc.GetOpenIDConnectProvider(params)
  854. if err != nil {
  855. // Print the error, cast err to awserr.Error to get the Code and
  856. // Message from an error.
  857. fmt.Println(err.Error())
  858. return
  859. }
  860. // Pretty-print the response data.
  861. fmt.Println(resp)
  862. }
  863. func ExampleIAM_GetPolicy() {
  864. svc := iam.New(nil)
  865. params := &iam.GetPolicyInput{
  866. PolicyArn: aws.String("arnType"), // Required
  867. }
  868. resp, err := svc.GetPolicy(params)
  869. if err != nil {
  870. // Print the error, cast err to awserr.Error to get the Code and
  871. // Message from an error.
  872. fmt.Println(err.Error())
  873. return
  874. }
  875. // Pretty-print the response data.
  876. fmt.Println(resp)
  877. }
  878. func ExampleIAM_GetPolicyVersion() {
  879. svc := iam.New(nil)
  880. params := &iam.GetPolicyVersionInput{
  881. PolicyArn: aws.String("arnType"), // Required
  882. VersionId: aws.String("policyVersionIdType"), // Required
  883. }
  884. resp, err := svc.GetPolicyVersion(params)
  885. if err != nil {
  886. // Print the error, cast err to awserr.Error to get the Code and
  887. // Message from an error.
  888. fmt.Println(err.Error())
  889. return
  890. }
  891. // Pretty-print the response data.
  892. fmt.Println(resp)
  893. }
  894. func ExampleIAM_GetRole() {
  895. svc := iam.New(nil)
  896. params := &iam.GetRoleInput{
  897. RoleName: aws.String("roleNameType"), // Required
  898. }
  899. resp, err := svc.GetRole(params)
  900. if err != nil {
  901. // Print the error, cast err to awserr.Error to get the Code and
  902. // Message from an error.
  903. fmt.Println(err.Error())
  904. return
  905. }
  906. // Pretty-print the response data.
  907. fmt.Println(resp)
  908. }
  909. func ExampleIAM_GetRolePolicy() {
  910. svc := iam.New(nil)
  911. params := &iam.GetRolePolicyInput{
  912. PolicyName: aws.String("policyNameType"), // Required
  913. RoleName: aws.String("roleNameType"), // Required
  914. }
  915. resp, err := svc.GetRolePolicy(params)
  916. if err != nil {
  917. // Print the error, cast err to awserr.Error to get the Code and
  918. // Message from an error.
  919. fmt.Println(err.Error())
  920. return
  921. }
  922. // Pretty-print the response data.
  923. fmt.Println(resp)
  924. }
  925. func ExampleIAM_GetSAMLProvider() {
  926. svc := iam.New(nil)
  927. params := &iam.GetSAMLProviderInput{
  928. SAMLProviderArn: aws.String("arnType"), // Required
  929. }
  930. resp, err := svc.GetSAMLProvider(params)
  931. if err != nil {
  932. // Print the error, cast err to awserr.Error to get the Code and
  933. // Message from an error.
  934. fmt.Println(err.Error())
  935. return
  936. }
  937. // Pretty-print the response data.
  938. fmt.Println(resp)
  939. }
  940. func ExampleIAM_GetSSHPublicKey() {
  941. svc := iam.New(nil)
  942. params := &iam.GetSSHPublicKeyInput{
  943. Encoding: aws.String("encodingType"), // Required
  944. SSHPublicKeyId: aws.String("publicKeyIdType"), // Required
  945. UserName: aws.String("userNameType"), // Required
  946. }
  947. resp, err := svc.GetSSHPublicKey(params)
  948. if err != nil {
  949. // Print the error, cast err to awserr.Error to get the Code and
  950. // Message from an error.
  951. fmt.Println(err.Error())
  952. return
  953. }
  954. // Pretty-print the response data.
  955. fmt.Println(resp)
  956. }
  957. func ExampleIAM_GetServerCertificate() {
  958. svc := iam.New(nil)
  959. params := &iam.GetServerCertificateInput{
  960. ServerCertificateName: aws.String("serverCertificateNameType"), // Required
  961. }
  962. resp, err := svc.GetServerCertificate(params)
  963. if err != nil {
  964. // Print the error, cast err to awserr.Error to get the Code and
  965. // Message from an error.
  966. fmt.Println(err.Error())
  967. return
  968. }
  969. // Pretty-print the response data.
  970. fmt.Println(resp)
  971. }
  972. func ExampleIAM_GetUser() {
  973. svc := iam.New(nil)
  974. params := &iam.GetUserInput{
  975. UserName: aws.String("existingUserNameType"),
  976. }
  977. resp, err := svc.GetUser(params)
  978. if err != nil {
  979. // Print the error, cast err to awserr.Error to get the Code and
  980. // Message from an error.
  981. fmt.Println(err.Error())
  982. return
  983. }
  984. // Pretty-print the response data.
  985. fmt.Println(resp)
  986. }
  987. func ExampleIAM_GetUserPolicy() {
  988. svc := iam.New(nil)
  989. params := &iam.GetUserPolicyInput{
  990. PolicyName: aws.String("policyNameType"), // Required
  991. UserName: aws.String("existingUserNameType"), // Required
  992. }
  993. resp, err := svc.GetUserPolicy(params)
  994. if err != nil {
  995. // Print the error, cast err to awserr.Error to get the Code and
  996. // Message from an error.
  997. fmt.Println(err.Error())
  998. return
  999. }
  1000. // Pretty-print the response data.
  1001. fmt.Println(resp)
  1002. }
  1003. func ExampleIAM_ListAccessKeys() {
  1004. svc := iam.New(nil)
  1005. params := &iam.ListAccessKeysInput{
  1006. Marker: aws.String("markerType"),
  1007. MaxItems: aws.Int64(1),
  1008. UserName: aws.String("existingUserNameType"),
  1009. }
  1010. resp, err := svc.ListAccessKeys(params)
  1011. if err != nil {
  1012. // Print the error, cast err to awserr.Error to get the Code and
  1013. // Message from an error.
  1014. fmt.Println(err.Error())
  1015. return
  1016. }
  1017. // Pretty-print the response data.
  1018. fmt.Println(resp)
  1019. }
  1020. func ExampleIAM_ListAccountAliases() {
  1021. svc := iam.New(nil)
  1022. params := &iam.ListAccountAliasesInput{
  1023. Marker: aws.String("markerType"),
  1024. MaxItems: aws.Int64(1),
  1025. }
  1026. resp, err := svc.ListAccountAliases(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_ListAttachedGroupPolicies() {
  1037. svc := iam.New(nil)
  1038. params := &iam.ListAttachedGroupPoliciesInput{
  1039. GroupName: aws.String("groupNameType"), // Required
  1040. Marker: aws.String("markerType"),
  1041. MaxItems: aws.Int64(1),
  1042. PathPrefix: aws.String("policyPathType"),
  1043. }
  1044. resp, err := svc.ListAttachedGroupPolicies(params)
  1045. if err != nil {
  1046. // Print the error, cast err to awserr.Error to get the Code and
  1047. // Message from an error.
  1048. fmt.Println(err.Error())
  1049. return
  1050. }
  1051. // Pretty-print the response data.
  1052. fmt.Println(resp)
  1053. }
  1054. func ExampleIAM_ListAttachedRolePolicies() {
  1055. svc := iam.New(nil)
  1056. params := &iam.ListAttachedRolePoliciesInput{
  1057. RoleName: aws.String("roleNameType"), // Required
  1058. Marker: aws.String("markerType"),
  1059. MaxItems: aws.Int64(1),
  1060. PathPrefix: aws.String("policyPathType"),
  1061. }
  1062. resp, err := svc.ListAttachedRolePolicies(params)
  1063. if err != nil {
  1064. // Print the error, cast err to awserr.Error to get the Code and
  1065. // Message from an error.
  1066. fmt.Println(err.Error())
  1067. return
  1068. }
  1069. // Pretty-print the response data.
  1070. fmt.Println(resp)
  1071. }
  1072. func ExampleIAM_ListAttachedUserPolicies() {
  1073. svc := iam.New(nil)
  1074. params := &iam.ListAttachedUserPoliciesInput{
  1075. UserName: aws.String("userNameType"), // Required
  1076. Marker: aws.String("markerType"),
  1077. MaxItems: aws.Int64(1),
  1078. PathPrefix: aws.String("policyPathType"),
  1079. }
  1080. resp, err := svc.ListAttachedUserPolicies(params)
  1081. if err != nil {
  1082. // Print the error, cast err to awserr.Error to get the Code and
  1083. // Message from an error.
  1084. fmt.Println(err.Error())
  1085. return
  1086. }
  1087. // Pretty-print the response data.
  1088. fmt.Println(resp)
  1089. }
  1090. func ExampleIAM_ListEntitiesForPolicy() {
  1091. svc := iam.New(nil)
  1092. params := &iam.ListEntitiesForPolicyInput{
  1093. PolicyArn: aws.String("arnType"), // Required
  1094. EntityFilter: aws.String("EntityType"),
  1095. Marker: aws.String("markerType"),
  1096. MaxItems: aws.Int64(1),
  1097. PathPrefix: aws.String("pathType"),
  1098. }
  1099. resp, err := svc.ListEntitiesForPolicy(params)
  1100. if err != nil {
  1101. // Print the error, cast err to awserr.Error to get the Code and
  1102. // Message from an error.
  1103. fmt.Println(err.Error())
  1104. return
  1105. }
  1106. // Pretty-print the response data.
  1107. fmt.Println(resp)
  1108. }
  1109. func ExampleIAM_ListGroupPolicies() {
  1110. svc := iam.New(nil)
  1111. params := &iam.ListGroupPoliciesInput{
  1112. GroupName: aws.String("groupNameType"), // Required
  1113. Marker: aws.String("markerType"),
  1114. MaxItems: aws.Int64(1),
  1115. }
  1116. resp, err := svc.ListGroupPolicies(params)
  1117. if err != nil {
  1118. // Print the error, cast err to awserr.Error to get the Code and
  1119. // Message from an error.
  1120. fmt.Println(err.Error())
  1121. return
  1122. }
  1123. // Pretty-print the response data.
  1124. fmt.Println(resp)
  1125. }
  1126. func ExampleIAM_ListGroups() {
  1127. svc := iam.New(nil)
  1128. params := &iam.ListGroupsInput{
  1129. Marker: aws.String("markerType"),
  1130. MaxItems: aws.Int64(1),
  1131. PathPrefix: aws.String("pathPrefixType"),
  1132. }
  1133. resp, err := svc.ListGroups(params)
  1134. if err != nil {
  1135. // Print the error, cast err to awserr.Error to get the Code and
  1136. // Message from an error.
  1137. fmt.Println(err.Error())
  1138. return
  1139. }
  1140. // Pretty-print the response data.
  1141. fmt.Println(resp)
  1142. }
  1143. func ExampleIAM_ListGroupsForUser() {
  1144. svc := iam.New(nil)
  1145. params := &iam.ListGroupsForUserInput{
  1146. UserName: aws.String("existingUserNameType"), // Required
  1147. Marker: aws.String("markerType"),
  1148. MaxItems: aws.Int64(1),
  1149. }
  1150. resp, err := svc.ListGroupsForUser(params)
  1151. if err != nil {
  1152. // Print the error, cast err to awserr.Error to get the Code and
  1153. // Message from an error.
  1154. fmt.Println(err.Error())
  1155. return
  1156. }
  1157. // Pretty-print the response data.
  1158. fmt.Println(resp)
  1159. }
  1160. func ExampleIAM_ListInstanceProfiles() {
  1161. svc := iam.New(nil)
  1162. params := &iam.ListInstanceProfilesInput{
  1163. Marker: aws.String("markerType"),
  1164. MaxItems: aws.Int64(1),
  1165. PathPrefix: aws.String("pathPrefixType"),
  1166. }
  1167. resp, err := svc.ListInstanceProfiles(params)
  1168. if err != nil {
  1169. // Print the error, cast err to awserr.Error to get the Code and
  1170. // Message from an error.
  1171. fmt.Println(err.Error())
  1172. return
  1173. }
  1174. // Pretty-print the response data.
  1175. fmt.Println(resp)
  1176. }
  1177. func ExampleIAM_ListInstanceProfilesForRole() {
  1178. svc := iam.New(nil)
  1179. params := &iam.ListInstanceProfilesForRoleInput{
  1180. RoleName: aws.String("roleNameType"), // Required
  1181. Marker: aws.String("markerType"),
  1182. MaxItems: aws.Int64(1),
  1183. }
  1184. resp, err := svc.ListInstanceProfilesForRole(params)
  1185. if err != nil {
  1186. // Print the error, cast err to awserr.Error to get the Code and
  1187. // Message from an error.
  1188. fmt.Println(err.Error())
  1189. return
  1190. }
  1191. // Pretty-print the response data.
  1192. fmt.Println(resp)
  1193. }
  1194. func ExampleIAM_ListMFADevices() {
  1195. svc := iam.New(nil)
  1196. params := &iam.ListMFADevicesInput{
  1197. Marker: aws.String("markerType"),
  1198. MaxItems: aws.Int64(1),
  1199. UserName: aws.String("existingUserNameType"),
  1200. }
  1201. resp, err := svc.ListMFADevices(params)
  1202. if err != nil {
  1203. // Print the error, cast err to awserr.Error to get the Code and
  1204. // Message from an error.
  1205. fmt.Println(err.Error())
  1206. return
  1207. }
  1208. // Pretty-print the response data.
  1209. fmt.Println(resp)
  1210. }
  1211. func ExampleIAM_ListOpenIDConnectProviders() {
  1212. svc := iam.New(nil)
  1213. var params *iam.ListOpenIDConnectProvidersInput
  1214. resp, err := svc.ListOpenIDConnectProviders(params)
  1215. if err != nil {
  1216. // Print the error, cast err to awserr.Error to get the Code and
  1217. // Message from an error.
  1218. fmt.Println(err.Error())
  1219. return
  1220. }
  1221. // Pretty-print the response data.
  1222. fmt.Println(resp)
  1223. }
  1224. func ExampleIAM_ListPolicies() {
  1225. svc := iam.New(nil)
  1226. params := &iam.ListPoliciesInput{
  1227. Marker: aws.String("markerType"),
  1228. MaxItems: aws.Int64(1),
  1229. OnlyAttached: aws.Bool(true),
  1230. PathPrefix: aws.String("policyPathType"),
  1231. Scope: aws.String("policyScopeType"),
  1232. }
  1233. resp, err := svc.ListPolicies(params)
  1234. if err != nil {
  1235. // Print the error, cast err to awserr.Error to get the Code and
  1236. // Message from an error.
  1237. fmt.Println(err.Error())
  1238. return
  1239. }
  1240. // Pretty-print the response data.
  1241. fmt.Println(resp)
  1242. }
  1243. func ExampleIAM_ListPolicyVersions() {
  1244. svc := iam.New(nil)
  1245. params := &iam.ListPolicyVersionsInput{
  1246. PolicyArn: aws.String("arnType"), // Required
  1247. Marker: aws.String("markerType"),
  1248. MaxItems: aws.Int64(1),
  1249. }
  1250. resp, err := svc.ListPolicyVersions(params)
  1251. if err != nil {
  1252. // Print the error, cast err to awserr.Error to get the Code and
  1253. // Message from an error.
  1254. fmt.Println(err.Error())
  1255. return
  1256. }
  1257. // Pretty-print the response data.
  1258. fmt.Println(resp)
  1259. }
  1260. func ExampleIAM_ListRolePolicies() {
  1261. svc := iam.New(nil)
  1262. params := &iam.ListRolePoliciesInput{
  1263. RoleName: aws.String("roleNameType"), // Required
  1264. Marker: aws.String("markerType"),
  1265. MaxItems: aws.Int64(1),
  1266. }
  1267. resp, err := svc.ListRolePolicies(params)
  1268. if err != nil {
  1269. // Print the error, cast err to awserr.Error to get the Code and
  1270. // Message from an error.
  1271. fmt.Println(err.Error())
  1272. return
  1273. }
  1274. // Pretty-print the response data.
  1275. fmt.Println(resp)
  1276. }
  1277. func ExampleIAM_ListRoles() {
  1278. svc := iam.New(nil)
  1279. params := &iam.ListRolesInput{
  1280. Marker: aws.String("markerType"),
  1281. MaxItems: aws.Int64(1),
  1282. PathPrefix: aws.String("pathPrefixType"),
  1283. }
  1284. resp, err := svc.ListRoles(params)
  1285. if err != nil {
  1286. // Print the error, cast err to awserr.Error to get the Code and
  1287. // Message from an error.
  1288. fmt.Println(err.Error())
  1289. return
  1290. }
  1291. // Pretty-print the response data.
  1292. fmt.Println(resp)
  1293. }
  1294. func ExampleIAM_ListSAMLProviders() {
  1295. svc := iam.New(nil)
  1296. var params *iam.ListSAMLProvidersInput
  1297. resp, err := svc.ListSAMLProviders(params)
  1298. if err != nil {
  1299. // Print the error, cast err to awserr.Error to get the Code and
  1300. // Message from an error.
  1301. fmt.Println(err.Error())
  1302. return
  1303. }
  1304. // Pretty-print the response data.
  1305. fmt.Println(resp)
  1306. }
  1307. func ExampleIAM_ListSSHPublicKeys() {
  1308. svc := iam.New(nil)
  1309. params := &iam.ListSSHPublicKeysInput{
  1310. Marker: aws.String("markerType"),
  1311. MaxItems: aws.Int64(1),
  1312. UserName: aws.String("userNameType"),
  1313. }
  1314. resp, err := svc.ListSSHPublicKeys(params)
  1315. if err != nil {
  1316. // Print the error, cast err to awserr.Error to get the Code and
  1317. // Message from an error.
  1318. fmt.Println(err.Error())
  1319. return
  1320. }
  1321. // Pretty-print the response data.
  1322. fmt.Println(resp)
  1323. }
  1324. func ExampleIAM_ListServerCertificates() {
  1325. svc := iam.New(nil)
  1326. params := &iam.ListServerCertificatesInput{
  1327. Marker: aws.String("markerType"),
  1328. MaxItems: aws.Int64(1),
  1329. PathPrefix: aws.String("pathPrefixType"),
  1330. }
  1331. resp, err := svc.ListServerCertificates(params)
  1332. if err != nil {
  1333. // Print the error, cast err to awserr.Error to get the Code and
  1334. // Message from an error.
  1335. fmt.Println(err.Error())
  1336. return
  1337. }
  1338. // Pretty-print the response data.
  1339. fmt.Println(resp)
  1340. }
  1341. func ExampleIAM_ListSigningCertificates() {
  1342. svc := iam.New(nil)
  1343. params := &iam.ListSigningCertificatesInput{
  1344. Marker: aws.String("markerType"),
  1345. MaxItems: aws.Int64(1),
  1346. UserName: aws.String("existingUserNameType"),
  1347. }
  1348. resp, err := svc.ListSigningCertificates(params)
  1349. if err != nil {
  1350. // Print the error, cast err to awserr.Error to get the Code and
  1351. // Message from an error.
  1352. fmt.Println(err.Error())
  1353. return
  1354. }
  1355. // Pretty-print the response data.
  1356. fmt.Println(resp)
  1357. }
  1358. func ExampleIAM_ListUserPolicies() {
  1359. svc := iam.New(nil)
  1360. params := &iam.ListUserPoliciesInput{
  1361. UserName: aws.String("existingUserNameType"), // Required
  1362. Marker: aws.String("markerType"),
  1363. MaxItems: aws.Int64(1),
  1364. }
  1365. resp, err := svc.ListUserPolicies(params)
  1366. if err != nil {
  1367. // Print the error, cast err to awserr.Error to get the Code and
  1368. // Message from an error.
  1369. fmt.Println(err.Error())
  1370. return
  1371. }
  1372. // Pretty-print the response data.
  1373. fmt.Println(resp)
  1374. }
  1375. func ExampleIAM_ListUsers() {
  1376. svc := iam.New(nil)
  1377. params := &iam.ListUsersInput{
  1378. Marker: aws.String("markerType"),
  1379. MaxItems: aws.Int64(1),
  1380. PathPrefix: aws.String("pathPrefixType"),
  1381. }
  1382. resp, err := svc.ListUsers(params)
  1383. if err != nil {
  1384. // Print the error, cast err to awserr.Error to get the Code and
  1385. // Message from an error.
  1386. fmt.Println(err.Error())
  1387. return
  1388. }
  1389. // Pretty-print the response data.
  1390. fmt.Println(resp)
  1391. }
  1392. func ExampleIAM_ListVirtualMFADevices() {
  1393. svc := iam.New(nil)
  1394. params := &iam.ListVirtualMFADevicesInput{
  1395. AssignmentStatus: aws.String("assignmentStatusType"),
  1396. Marker: aws.String("markerType"),
  1397. MaxItems: aws.Int64(1),
  1398. }
  1399. resp, err := svc.ListVirtualMFADevices(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_PutGroupPolicy() {
  1410. svc := iam.New(nil)
  1411. params := &iam.PutGroupPolicyInput{
  1412. GroupName: aws.String("groupNameType"), // Required
  1413. PolicyDocument: aws.String("policyDocumentType"), // Required
  1414. PolicyName: aws.String("policyNameType"), // Required
  1415. }
  1416. resp, err := svc.PutGroupPolicy(params)
  1417. if err != nil {
  1418. // Print the error, cast err to awserr.Error to get the Code and
  1419. // Message from an error.
  1420. fmt.Println(err.Error())
  1421. return
  1422. }
  1423. // Pretty-print the response data.
  1424. fmt.Println(resp)
  1425. }
  1426. func ExampleIAM_PutRolePolicy() {
  1427. svc := iam.New(nil)
  1428. params := &iam.PutRolePolicyInput{
  1429. PolicyDocument: aws.String("policyDocumentType"), // Required
  1430. PolicyName: aws.String("policyNameType"), // Required
  1431. RoleName: aws.String("roleNameType"), // Required
  1432. }
  1433. resp, err := svc.PutRolePolicy(params)
  1434. if err != nil {
  1435. // Print the error, cast err to awserr.Error to get the Code and
  1436. // Message from an error.
  1437. fmt.Println(err.Error())
  1438. return
  1439. }
  1440. // Pretty-print the response data.
  1441. fmt.Println(resp)
  1442. }
  1443. func ExampleIAM_PutUserPolicy() {
  1444. svc := iam.New(nil)
  1445. params := &iam.PutUserPolicyInput{
  1446. PolicyDocument: aws.String("policyDocumentType"), // Required
  1447. PolicyName: aws.String("policyNameType"), // Required
  1448. UserName: aws.String("existingUserNameType"), // Required
  1449. }
  1450. resp, err := svc.PutUserPolicy(params)
  1451. if err != nil {
  1452. // Print the error, cast err to awserr.Error to get the Code and
  1453. // Message from an error.
  1454. fmt.Println(err.Error())
  1455. return
  1456. }
  1457. // Pretty-print the response data.
  1458. fmt.Println(resp)
  1459. }
  1460. func ExampleIAM_RemoveClientIDFromOpenIDConnectProvider() {
  1461. svc := iam.New(nil)
  1462. params := &iam.RemoveClientIDFromOpenIDConnectProviderInput{
  1463. ClientID: aws.String("clientIDType"), // Required
  1464. OpenIDConnectProviderArn: aws.String("arnType"), // Required
  1465. }
  1466. resp, err := svc.RemoveClientIDFromOpenIDConnectProvider(params)
  1467. if err != nil {
  1468. // Print the error, cast err to awserr.Error to get the Code and
  1469. // Message from an error.
  1470. fmt.Println(err.Error())
  1471. return
  1472. }
  1473. // Pretty-print the response data.
  1474. fmt.Println(resp)
  1475. }
  1476. func ExampleIAM_RemoveRoleFromInstanceProfile() {
  1477. svc := iam.New(nil)
  1478. params := &iam.RemoveRoleFromInstanceProfileInput{
  1479. InstanceProfileName: aws.String("instanceProfileNameType"), // Required
  1480. RoleName: aws.String("roleNameType"), // Required
  1481. }
  1482. resp, err := svc.RemoveRoleFromInstanceProfile(params)
  1483. if err != nil {
  1484. // Print the error, cast err to awserr.Error to get the Code and
  1485. // Message from an error.
  1486. fmt.Println(err.Error())
  1487. return
  1488. }
  1489. // Pretty-print the response data.
  1490. fmt.Println(resp)
  1491. }
  1492. func ExampleIAM_RemoveUserFromGroup() {
  1493. svc := iam.New(nil)
  1494. params := &iam.RemoveUserFromGroupInput{
  1495. GroupName: aws.String("groupNameType"), // Required
  1496. UserName: aws.String("existingUserNameType"), // Required
  1497. }
  1498. resp, err := svc.RemoveUserFromGroup(params)
  1499. if err != nil {
  1500. // Print the error, cast err to awserr.Error to get the Code and
  1501. // Message from an error.
  1502. fmt.Println(err.Error())
  1503. return
  1504. }
  1505. // Pretty-print the response data.
  1506. fmt.Println(resp)
  1507. }
  1508. func ExampleIAM_ResyncMFADevice() {
  1509. svc := iam.New(nil)
  1510. params := &iam.ResyncMFADeviceInput{
  1511. AuthenticationCode1: aws.String("authenticationCodeType"), // Required
  1512. AuthenticationCode2: aws.String("authenticationCodeType"), // Required
  1513. SerialNumber: aws.String("serialNumberType"), // Required
  1514. UserName: aws.String("existingUserNameType"), // Required
  1515. }
  1516. resp, err := svc.ResyncMFADevice(params)
  1517. if err != nil {
  1518. // Print the error, cast err to awserr.Error to get the Code and
  1519. // Message from an error.
  1520. fmt.Println(err.Error())
  1521. return
  1522. }
  1523. // Pretty-print the response data.
  1524. fmt.Println(resp)
  1525. }
  1526. func ExampleIAM_SetDefaultPolicyVersion() {
  1527. svc := iam.New(nil)
  1528. params := &iam.SetDefaultPolicyVersionInput{
  1529. PolicyArn: aws.String("arnType"), // Required
  1530. VersionId: aws.String("policyVersionIdType"), // Required
  1531. }
  1532. resp, err := svc.SetDefaultPolicyVersion(params)
  1533. if err != nil {
  1534. // Print the error, cast err to awserr.Error to get the Code and
  1535. // Message from an error.
  1536. fmt.Println(err.Error())
  1537. return
  1538. }
  1539. // Pretty-print the response data.
  1540. fmt.Println(resp)
  1541. }
  1542. func ExampleIAM_UpdateAccessKey() {
  1543. svc := iam.New(nil)
  1544. params := &iam.UpdateAccessKeyInput{
  1545. AccessKeyId: aws.String("accessKeyIdType"), // Required
  1546. Status: aws.String("statusType"), // Required
  1547. UserName: aws.String("existingUserNameType"),
  1548. }
  1549. resp, err := svc.UpdateAccessKey(params)
  1550. if err != nil {
  1551. // Print the error, cast err to awserr.Error to get the Code and
  1552. // Message from an error.
  1553. fmt.Println(err.Error())
  1554. return
  1555. }
  1556. // Pretty-print the response data.
  1557. fmt.Println(resp)
  1558. }
  1559. func ExampleIAM_UpdateAccountPasswordPolicy() {
  1560. svc := iam.New(nil)
  1561. params := &iam.UpdateAccountPasswordPolicyInput{
  1562. AllowUsersToChangePassword: aws.Bool(true),
  1563. HardExpiry: aws.Bool(true),
  1564. MaxPasswordAge: aws.Int64(1),
  1565. MinimumPasswordLength: aws.Int64(1),
  1566. PasswordReusePrevention: aws.Int64(1),
  1567. RequireLowercaseCharacters: aws.Bool(true),
  1568. RequireNumbers: aws.Bool(true),
  1569. RequireSymbols: aws.Bool(true),
  1570. RequireUppercaseCharacters: aws.Bool(true),
  1571. }
  1572. resp, err := svc.UpdateAccountPasswordPolicy(params)
  1573. if err != nil {
  1574. // Print the error, cast err to awserr.Error to get the Code and
  1575. // Message from an error.
  1576. fmt.Println(err.Error())
  1577. return
  1578. }
  1579. // Pretty-print the response data.
  1580. fmt.Println(resp)
  1581. }
  1582. func ExampleIAM_UpdateAssumeRolePolicy() {
  1583. svc := iam.New(nil)
  1584. params := &iam.UpdateAssumeRolePolicyInput{
  1585. PolicyDocument: aws.String("policyDocumentType"), // Required
  1586. RoleName: aws.String("roleNameType"), // Required
  1587. }
  1588. resp, err := svc.UpdateAssumeRolePolicy(params)
  1589. if err != nil {
  1590. // Print the error, cast err to awserr.Error to get the Code and
  1591. // Message from an error.
  1592. fmt.Println(err.Error())
  1593. return
  1594. }
  1595. // Pretty-print the response data.
  1596. fmt.Println(resp)
  1597. }
  1598. func ExampleIAM_UpdateGroup() {
  1599. svc := iam.New(nil)
  1600. params := &iam.UpdateGroupInput{
  1601. GroupName: aws.String("groupNameType"), // Required
  1602. NewGroupName: aws.String("groupNameType"),
  1603. NewPath: aws.String("pathType"),
  1604. }
  1605. resp, err := svc.UpdateGroup(params)
  1606. if err != nil {
  1607. // Print the error, cast err to awserr.Error to get the Code and
  1608. // Message from an error.
  1609. fmt.Println(err.Error())
  1610. return
  1611. }
  1612. // Pretty-print the response data.
  1613. fmt.Println(resp)
  1614. }
  1615. func ExampleIAM_UpdateLoginProfile() {
  1616. svc := iam.New(nil)
  1617. params := &iam.UpdateLoginProfileInput{
  1618. UserName: aws.String("userNameType"), // Required
  1619. Password: aws.String("passwordType"),
  1620. PasswordResetRequired: aws.Bool(true),
  1621. }
  1622. resp, err := svc.UpdateLoginProfile(params)
  1623. if err != nil {
  1624. // Print the error, cast err to awserr.Error to get the Code and
  1625. // Message from an error.
  1626. fmt.Println(err.Error())
  1627. return
  1628. }
  1629. // Pretty-print the response data.
  1630. fmt.Println(resp)
  1631. }
  1632. func ExampleIAM_UpdateOpenIDConnectProviderThumbprint() {
  1633. svc := iam.New(nil)
  1634. params := &iam.UpdateOpenIDConnectProviderThumbprintInput{
  1635. OpenIDConnectProviderArn: aws.String("arnType"), // Required
  1636. ThumbprintList: []*string{ // Required
  1637. aws.String("thumbprintType"), // Required
  1638. // More values...
  1639. },
  1640. }
  1641. resp, err := svc.UpdateOpenIDConnectProviderThumbprint(params)
  1642. if err != nil {
  1643. // Print the error, cast err to awserr.Error to get the Code and
  1644. // Message from an error.
  1645. fmt.Println(err.Error())
  1646. return
  1647. }
  1648. // Pretty-print the response data.
  1649. fmt.Println(resp)
  1650. }
  1651. func ExampleIAM_UpdateSAMLProvider() {
  1652. svc := iam.New(nil)
  1653. params := &iam.UpdateSAMLProviderInput{
  1654. SAMLMetadataDocument: aws.String("SAMLMetadataDocumentType"), // Required
  1655. SAMLProviderArn: aws.String("arnType"), // Required
  1656. }
  1657. resp, err := svc.UpdateSAMLProvider(params)
  1658. if err != nil {
  1659. // Print the error, cast err to awserr.Error to get the Code and
  1660. // Message from an error.
  1661. fmt.Println(err.Error())
  1662. return
  1663. }
  1664. // Pretty-print the response data.
  1665. fmt.Println(resp)
  1666. }
  1667. func ExampleIAM_UpdateSSHPublicKey() {
  1668. svc := iam.New(nil)
  1669. params := &iam.UpdateSSHPublicKeyInput{
  1670. SSHPublicKeyId: aws.String("publicKeyIdType"), // Required
  1671. Status: aws.String("statusType"), // Required
  1672. UserName: aws.String("userNameType"), // Required
  1673. }
  1674. resp, err := svc.UpdateSSHPublicKey(params)
  1675. if err != nil {
  1676. // Print the error, cast err to awserr.Error to get the Code and
  1677. // Message from an error.
  1678. fmt.Println(err.Error())
  1679. return
  1680. }
  1681. // Pretty-print the response data.
  1682. fmt.Println(resp)
  1683. }
  1684. func ExampleIAM_UpdateServerCertificate() {
  1685. svc := iam.New(nil)
  1686. params := &iam.UpdateServerCertificateInput{
  1687. ServerCertificateName: aws.String("serverCertificateNameType"), // Required
  1688. NewPath: aws.String("pathType"),
  1689. NewServerCertificateName: aws.String("serverCertificateNameType"),
  1690. }
  1691. resp, err := svc.UpdateServerCertificate(params)
  1692. if err != nil {
  1693. // Print the error, cast err to awserr.Error to get the Code and
  1694. // Message from an error.
  1695. fmt.Println(err.Error())
  1696. return
  1697. }
  1698. // Pretty-print the response data.
  1699. fmt.Println(resp)
  1700. }
  1701. func ExampleIAM_UpdateSigningCertificate() {
  1702. svc := iam.New(nil)
  1703. params := &iam.UpdateSigningCertificateInput{
  1704. CertificateId: aws.String("certificateIdType"), // Required
  1705. Status: aws.String("statusType"), // Required
  1706. UserName: aws.String("existingUserNameType"),
  1707. }
  1708. resp, err := svc.UpdateSigningCertificate(params)
  1709. if err != nil {
  1710. // Print the error, cast err to awserr.Error to get the Code and
  1711. // Message from an error.
  1712. fmt.Println(err.Error())
  1713. return
  1714. }
  1715. // Pretty-print the response data.
  1716. fmt.Println(resp)
  1717. }
  1718. func ExampleIAM_UpdateUser() {
  1719. svc := iam.New(nil)
  1720. params := &iam.UpdateUserInput{
  1721. UserName: aws.String("existingUserNameType"), // Required
  1722. NewPath: aws.String("pathType"),
  1723. NewUserName: aws.String("userNameType"),
  1724. }
  1725. resp, err := svc.UpdateUser(params)
  1726. if err != nil {
  1727. // Print the error, cast err to awserr.Error to get the Code and
  1728. // Message from an error.
  1729. fmt.Println(err.Error())
  1730. return
  1731. }
  1732. // Pretty-print the response data.
  1733. fmt.Println(resp)
  1734. }
  1735. func ExampleIAM_UploadSSHPublicKey() {
  1736. svc := iam.New(nil)
  1737. params := &iam.UploadSSHPublicKeyInput{
  1738. SSHPublicKeyBody: aws.String("publicKeyMaterialType"), // Required
  1739. UserName: aws.String("userNameType"), // Required
  1740. }
  1741. resp, err := svc.UploadSSHPublicKey(params)
  1742. if err != nil {
  1743. // Print the error, cast err to awserr.Error to get the Code and
  1744. // Message from an error.
  1745. fmt.Println(err.Error())
  1746. return
  1747. }
  1748. // Pretty-print the response data.
  1749. fmt.Println(resp)
  1750. }
  1751. func ExampleIAM_UploadServerCertificate() {
  1752. svc := iam.New(nil)
  1753. params := &iam.UploadServerCertificateInput{
  1754. CertificateBody: aws.String("certificateBodyType"), // Required
  1755. PrivateKey: aws.String("privateKeyType"), // Required
  1756. ServerCertificateName: aws.String("serverCertificateNameType"), // Required
  1757. CertificateChain: aws.String("certificateChainType"),
  1758. Path: aws.String("pathType"),
  1759. }
  1760. resp, err := svc.UploadServerCertificate(params)
  1761. if err != nil {
  1762. // Print the error, cast err to awserr.Error to get the Code and
  1763. // Message from an error.
  1764. fmt.Println(err.Error())
  1765. return
  1766. }
  1767. // Pretty-print the response data.
  1768. fmt.Println(resp)
  1769. }
  1770. func ExampleIAM_UploadSigningCertificate() {
  1771. svc := iam.New(nil)
  1772. params := &iam.UploadSigningCertificateInput{
  1773. CertificateBody: aws.String("certificateBodyType"), // Required
  1774. UserName: aws.String("existingUserNameType"),
  1775. }
  1776. resp, err := svc.UploadSigningCertificate(params)
  1777. if err != nil {
  1778. // Print the error, cast err to awserr.Error to get the Code and
  1779. // Message from an error.
  1780. fmt.Println(err.Error())
  1781. return
  1782. }
  1783. // Pretty-print the response data.
  1784. fmt.Println(resp)
  1785. }