examples_test.go 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package cloudfront_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/cloudfront"
  10. )
  11. var _ time.Duration
  12. var _ bytes.Buffer
  13. func ExampleCloudFront_CreateCloudFrontOriginAccessIdentity() {
  14. sess, err := session.NewSession()
  15. if err != nil {
  16. fmt.Println("failed to create session,", err)
  17. return
  18. }
  19. svc := cloudfront.New(sess)
  20. params := &cloudfront.CreateCloudFrontOriginAccessIdentityInput{
  21. CloudFrontOriginAccessIdentityConfig: &cloudfront.OriginAccessIdentityConfig{ // Required
  22. CallerReference: aws.String("string"), // Required
  23. Comment: aws.String("string"), // Required
  24. },
  25. }
  26. resp, err := svc.CreateCloudFrontOriginAccessIdentity(params)
  27. if err != nil {
  28. // Print the error, cast err to awserr.Error to get the Code and
  29. // Message from an error.
  30. fmt.Println(err.Error())
  31. return
  32. }
  33. // Pretty-print the response data.
  34. fmt.Println(resp)
  35. }
  36. func ExampleCloudFront_CreateDistribution() {
  37. sess, err := session.NewSession()
  38. if err != nil {
  39. fmt.Println("failed to create session,", err)
  40. return
  41. }
  42. svc := cloudfront.New(sess)
  43. params := &cloudfront.CreateDistributionInput{
  44. DistributionConfig: &cloudfront.DistributionConfig{ // Required
  45. CallerReference: aws.String("string"), // Required
  46. Comment: aws.String("string"), // Required
  47. DefaultCacheBehavior: &cloudfront.DefaultCacheBehavior{ // Required
  48. ForwardedValues: &cloudfront.ForwardedValues{ // Required
  49. Cookies: &cloudfront.CookiePreference{ // Required
  50. Forward: aws.String("ItemSelection"), // Required
  51. WhitelistedNames: &cloudfront.CookieNames{
  52. Quantity: aws.Int64(1), // Required
  53. Items: []*string{
  54. aws.String("string"), // Required
  55. // More values...
  56. },
  57. },
  58. },
  59. QueryString: aws.Bool(true), // Required
  60. Headers: &cloudfront.Headers{
  61. Quantity: aws.Int64(1), // Required
  62. Items: []*string{
  63. aws.String("string"), // Required
  64. // More values...
  65. },
  66. },
  67. QueryStringCacheKeys: &cloudfront.QueryStringCacheKeys{
  68. Quantity: aws.Int64(1), // Required
  69. Items: []*string{
  70. aws.String("string"), // Required
  71. // More values...
  72. },
  73. },
  74. },
  75. MinTTL: aws.Int64(1), // Required
  76. TargetOriginId: aws.String("string"), // Required
  77. TrustedSigners: &cloudfront.TrustedSigners{ // Required
  78. Enabled: aws.Bool(true), // Required
  79. Quantity: aws.Int64(1), // Required
  80. Items: []*string{
  81. aws.String("string"), // Required
  82. // More values...
  83. },
  84. },
  85. ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required
  86. AllowedMethods: &cloudfront.AllowedMethods{
  87. Items: []*string{ // Required
  88. aws.String("Method"), // Required
  89. // More values...
  90. },
  91. Quantity: aws.Int64(1), // Required
  92. CachedMethods: &cloudfront.CachedMethods{
  93. Items: []*string{ // Required
  94. aws.String("Method"), // Required
  95. // More values...
  96. },
  97. Quantity: aws.Int64(1), // Required
  98. },
  99. },
  100. Compress: aws.Bool(true),
  101. DefaultTTL: aws.Int64(1),
  102. MaxTTL: aws.Int64(1),
  103. SmoothStreaming: aws.Bool(true),
  104. },
  105. Enabled: aws.Bool(true), // Required
  106. Origins: &cloudfront.Origins{ // Required
  107. Quantity: aws.Int64(1), // Required
  108. Items: []*cloudfront.Origin{
  109. { // Required
  110. DomainName: aws.String("string"), // Required
  111. Id: aws.String("string"), // Required
  112. CustomHeaders: &cloudfront.CustomHeaders{
  113. Quantity: aws.Int64(1), // Required
  114. Items: []*cloudfront.OriginCustomHeader{
  115. { // Required
  116. HeaderName: aws.String("string"), // Required
  117. HeaderValue: aws.String("string"), // Required
  118. },
  119. // More values...
  120. },
  121. },
  122. CustomOriginConfig: &cloudfront.CustomOriginConfig{
  123. HTTPPort: aws.Int64(1), // Required
  124. HTTPSPort: aws.Int64(1), // Required
  125. OriginProtocolPolicy: aws.String("OriginProtocolPolicy"), // Required
  126. OriginSslProtocols: &cloudfront.OriginSslProtocols{
  127. Items: []*string{ // Required
  128. aws.String("SslProtocol"), // Required
  129. // More values...
  130. },
  131. Quantity: aws.Int64(1), // Required
  132. },
  133. },
  134. OriginPath: aws.String("string"),
  135. S3OriginConfig: &cloudfront.S3OriginConfig{
  136. OriginAccessIdentity: aws.String("string"), // Required
  137. },
  138. },
  139. // More values...
  140. },
  141. },
  142. Aliases: &cloudfront.Aliases{
  143. Quantity: aws.Int64(1), // Required
  144. Items: []*string{
  145. aws.String("string"), // Required
  146. // More values...
  147. },
  148. },
  149. CacheBehaviors: &cloudfront.CacheBehaviors{
  150. Quantity: aws.Int64(1), // Required
  151. Items: []*cloudfront.CacheBehavior{
  152. { // Required
  153. ForwardedValues: &cloudfront.ForwardedValues{ // Required
  154. Cookies: &cloudfront.CookiePreference{ // Required
  155. Forward: aws.String("ItemSelection"), // Required
  156. WhitelistedNames: &cloudfront.CookieNames{
  157. Quantity: aws.Int64(1), // Required
  158. Items: []*string{
  159. aws.String("string"), // Required
  160. // More values...
  161. },
  162. },
  163. },
  164. QueryString: aws.Bool(true), // Required
  165. Headers: &cloudfront.Headers{
  166. Quantity: aws.Int64(1), // Required
  167. Items: []*string{
  168. aws.String("string"), // Required
  169. // More values...
  170. },
  171. },
  172. QueryStringCacheKeys: &cloudfront.QueryStringCacheKeys{
  173. Quantity: aws.Int64(1), // Required
  174. Items: []*string{
  175. aws.String("string"), // Required
  176. // More values...
  177. },
  178. },
  179. },
  180. MinTTL: aws.Int64(1), // Required
  181. PathPattern: aws.String("string"), // Required
  182. TargetOriginId: aws.String("string"), // Required
  183. TrustedSigners: &cloudfront.TrustedSigners{ // Required
  184. Enabled: aws.Bool(true), // Required
  185. Quantity: aws.Int64(1), // Required
  186. Items: []*string{
  187. aws.String("string"), // Required
  188. // More values...
  189. },
  190. },
  191. ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required
  192. AllowedMethods: &cloudfront.AllowedMethods{
  193. Items: []*string{ // Required
  194. aws.String("Method"), // Required
  195. // More values...
  196. },
  197. Quantity: aws.Int64(1), // Required
  198. CachedMethods: &cloudfront.CachedMethods{
  199. Items: []*string{ // Required
  200. aws.String("Method"), // Required
  201. // More values...
  202. },
  203. Quantity: aws.Int64(1), // Required
  204. },
  205. },
  206. Compress: aws.Bool(true),
  207. DefaultTTL: aws.Int64(1),
  208. MaxTTL: aws.Int64(1),
  209. SmoothStreaming: aws.Bool(true),
  210. },
  211. // More values...
  212. },
  213. },
  214. CustomErrorResponses: &cloudfront.CustomErrorResponses{
  215. Quantity: aws.Int64(1), // Required
  216. Items: []*cloudfront.CustomErrorResponse{
  217. { // Required
  218. ErrorCode: aws.Int64(1), // Required
  219. ErrorCachingMinTTL: aws.Int64(1),
  220. ResponseCode: aws.String("string"),
  221. ResponsePagePath: aws.String("string"),
  222. },
  223. // More values...
  224. },
  225. },
  226. DefaultRootObject: aws.String("string"),
  227. HttpVersion: aws.String("HttpVersion"),
  228. IsIPV6Enabled: aws.Bool(true),
  229. Logging: &cloudfront.LoggingConfig{
  230. Bucket: aws.String("string"), // Required
  231. Enabled: aws.Bool(true), // Required
  232. IncludeCookies: aws.Bool(true), // Required
  233. Prefix: aws.String("string"), // Required
  234. },
  235. PriceClass: aws.String("PriceClass"),
  236. Restrictions: &cloudfront.Restrictions{
  237. GeoRestriction: &cloudfront.GeoRestriction{ // Required
  238. Quantity: aws.Int64(1), // Required
  239. RestrictionType: aws.String("GeoRestrictionType"), // Required
  240. Items: []*string{
  241. aws.String("string"), // Required
  242. // More values...
  243. },
  244. },
  245. },
  246. ViewerCertificate: &cloudfront.ViewerCertificate{
  247. ACMCertificateArn: aws.String("string"),
  248. Certificate: aws.String("string"),
  249. CertificateSource: aws.String("CertificateSource"),
  250. CloudFrontDefaultCertificate: aws.Bool(true),
  251. IAMCertificateId: aws.String("string"),
  252. MinimumProtocolVersion: aws.String("MinimumProtocolVersion"),
  253. SSLSupportMethod: aws.String("SSLSupportMethod"),
  254. },
  255. WebACLId: aws.String("string"),
  256. },
  257. }
  258. resp, err := svc.CreateDistribution(params)
  259. if err != nil {
  260. // Print the error, cast err to awserr.Error to get the Code and
  261. // Message from an error.
  262. fmt.Println(err.Error())
  263. return
  264. }
  265. // Pretty-print the response data.
  266. fmt.Println(resp)
  267. }
  268. func ExampleCloudFront_CreateDistributionWithTags() {
  269. sess, err := session.NewSession()
  270. if err != nil {
  271. fmt.Println("failed to create session,", err)
  272. return
  273. }
  274. svc := cloudfront.New(sess)
  275. params := &cloudfront.CreateDistributionWithTagsInput{
  276. DistributionConfigWithTags: &cloudfront.DistributionConfigWithTags{ // Required
  277. DistributionConfig: &cloudfront.DistributionConfig{ // Required
  278. CallerReference: aws.String("string"), // Required
  279. Comment: aws.String("string"), // Required
  280. DefaultCacheBehavior: &cloudfront.DefaultCacheBehavior{ // Required
  281. ForwardedValues: &cloudfront.ForwardedValues{ // Required
  282. Cookies: &cloudfront.CookiePreference{ // Required
  283. Forward: aws.String("ItemSelection"), // Required
  284. WhitelistedNames: &cloudfront.CookieNames{
  285. Quantity: aws.Int64(1), // Required
  286. Items: []*string{
  287. aws.String("string"), // Required
  288. // More values...
  289. },
  290. },
  291. },
  292. QueryString: aws.Bool(true), // Required
  293. Headers: &cloudfront.Headers{
  294. Quantity: aws.Int64(1), // Required
  295. Items: []*string{
  296. aws.String("string"), // Required
  297. // More values...
  298. },
  299. },
  300. QueryStringCacheKeys: &cloudfront.QueryStringCacheKeys{
  301. Quantity: aws.Int64(1), // Required
  302. Items: []*string{
  303. aws.String("string"), // Required
  304. // More values...
  305. },
  306. },
  307. },
  308. MinTTL: aws.Int64(1), // Required
  309. TargetOriginId: aws.String("string"), // Required
  310. TrustedSigners: &cloudfront.TrustedSigners{ // Required
  311. Enabled: aws.Bool(true), // Required
  312. Quantity: aws.Int64(1), // Required
  313. Items: []*string{
  314. aws.String("string"), // Required
  315. // More values...
  316. },
  317. },
  318. ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required
  319. AllowedMethods: &cloudfront.AllowedMethods{
  320. Items: []*string{ // Required
  321. aws.String("Method"), // Required
  322. // More values...
  323. },
  324. Quantity: aws.Int64(1), // Required
  325. CachedMethods: &cloudfront.CachedMethods{
  326. Items: []*string{ // Required
  327. aws.String("Method"), // Required
  328. // More values...
  329. },
  330. Quantity: aws.Int64(1), // Required
  331. },
  332. },
  333. Compress: aws.Bool(true),
  334. DefaultTTL: aws.Int64(1),
  335. MaxTTL: aws.Int64(1),
  336. SmoothStreaming: aws.Bool(true),
  337. },
  338. Enabled: aws.Bool(true), // Required
  339. Origins: &cloudfront.Origins{ // Required
  340. Quantity: aws.Int64(1), // Required
  341. Items: []*cloudfront.Origin{
  342. { // Required
  343. DomainName: aws.String("string"), // Required
  344. Id: aws.String("string"), // Required
  345. CustomHeaders: &cloudfront.CustomHeaders{
  346. Quantity: aws.Int64(1), // Required
  347. Items: []*cloudfront.OriginCustomHeader{
  348. { // Required
  349. HeaderName: aws.String("string"), // Required
  350. HeaderValue: aws.String("string"), // Required
  351. },
  352. // More values...
  353. },
  354. },
  355. CustomOriginConfig: &cloudfront.CustomOriginConfig{
  356. HTTPPort: aws.Int64(1), // Required
  357. HTTPSPort: aws.Int64(1), // Required
  358. OriginProtocolPolicy: aws.String("OriginProtocolPolicy"), // Required
  359. OriginSslProtocols: &cloudfront.OriginSslProtocols{
  360. Items: []*string{ // Required
  361. aws.String("SslProtocol"), // Required
  362. // More values...
  363. },
  364. Quantity: aws.Int64(1), // Required
  365. },
  366. },
  367. OriginPath: aws.String("string"),
  368. S3OriginConfig: &cloudfront.S3OriginConfig{
  369. OriginAccessIdentity: aws.String("string"), // Required
  370. },
  371. },
  372. // More values...
  373. },
  374. },
  375. Aliases: &cloudfront.Aliases{
  376. Quantity: aws.Int64(1), // Required
  377. Items: []*string{
  378. aws.String("string"), // Required
  379. // More values...
  380. },
  381. },
  382. CacheBehaviors: &cloudfront.CacheBehaviors{
  383. Quantity: aws.Int64(1), // Required
  384. Items: []*cloudfront.CacheBehavior{
  385. { // Required
  386. ForwardedValues: &cloudfront.ForwardedValues{ // Required
  387. Cookies: &cloudfront.CookiePreference{ // Required
  388. Forward: aws.String("ItemSelection"), // Required
  389. WhitelistedNames: &cloudfront.CookieNames{
  390. Quantity: aws.Int64(1), // Required
  391. Items: []*string{
  392. aws.String("string"), // Required
  393. // More values...
  394. },
  395. },
  396. },
  397. QueryString: aws.Bool(true), // Required
  398. Headers: &cloudfront.Headers{
  399. Quantity: aws.Int64(1), // Required
  400. Items: []*string{
  401. aws.String("string"), // Required
  402. // More values...
  403. },
  404. },
  405. QueryStringCacheKeys: &cloudfront.QueryStringCacheKeys{
  406. Quantity: aws.Int64(1), // Required
  407. Items: []*string{
  408. aws.String("string"), // Required
  409. // More values...
  410. },
  411. },
  412. },
  413. MinTTL: aws.Int64(1), // Required
  414. PathPattern: aws.String("string"), // Required
  415. TargetOriginId: aws.String("string"), // Required
  416. TrustedSigners: &cloudfront.TrustedSigners{ // Required
  417. Enabled: aws.Bool(true), // Required
  418. Quantity: aws.Int64(1), // Required
  419. Items: []*string{
  420. aws.String("string"), // Required
  421. // More values...
  422. },
  423. },
  424. ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required
  425. AllowedMethods: &cloudfront.AllowedMethods{
  426. Items: []*string{ // Required
  427. aws.String("Method"), // Required
  428. // More values...
  429. },
  430. Quantity: aws.Int64(1), // Required
  431. CachedMethods: &cloudfront.CachedMethods{
  432. Items: []*string{ // Required
  433. aws.String("Method"), // Required
  434. // More values...
  435. },
  436. Quantity: aws.Int64(1), // Required
  437. },
  438. },
  439. Compress: aws.Bool(true),
  440. DefaultTTL: aws.Int64(1),
  441. MaxTTL: aws.Int64(1),
  442. SmoothStreaming: aws.Bool(true),
  443. },
  444. // More values...
  445. },
  446. },
  447. CustomErrorResponses: &cloudfront.CustomErrorResponses{
  448. Quantity: aws.Int64(1), // Required
  449. Items: []*cloudfront.CustomErrorResponse{
  450. { // Required
  451. ErrorCode: aws.Int64(1), // Required
  452. ErrorCachingMinTTL: aws.Int64(1),
  453. ResponseCode: aws.String("string"),
  454. ResponsePagePath: aws.String("string"),
  455. },
  456. // More values...
  457. },
  458. },
  459. DefaultRootObject: aws.String("string"),
  460. HttpVersion: aws.String("HttpVersion"),
  461. IsIPV6Enabled: aws.Bool(true),
  462. Logging: &cloudfront.LoggingConfig{
  463. Bucket: aws.String("string"), // Required
  464. Enabled: aws.Bool(true), // Required
  465. IncludeCookies: aws.Bool(true), // Required
  466. Prefix: aws.String("string"), // Required
  467. },
  468. PriceClass: aws.String("PriceClass"),
  469. Restrictions: &cloudfront.Restrictions{
  470. GeoRestriction: &cloudfront.GeoRestriction{ // Required
  471. Quantity: aws.Int64(1), // Required
  472. RestrictionType: aws.String("GeoRestrictionType"), // Required
  473. Items: []*string{
  474. aws.String("string"), // Required
  475. // More values...
  476. },
  477. },
  478. },
  479. ViewerCertificate: &cloudfront.ViewerCertificate{
  480. ACMCertificateArn: aws.String("string"),
  481. Certificate: aws.String("string"),
  482. CertificateSource: aws.String("CertificateSource"),
  483. CloudFrontDefaultCertificate: aws.Bool(true),
  484. IAMCertificateId: aws.String("string"),
  485. MinimumProtocolVersion: aws.String("MinimumProtocolVersion"),
  486. SSLSupportMethod: aws.String("SSLSupportMethod"),
  487. },
  488. WebACLId: aws.String("string"),
  489. },
  490. Tags: &cloudfront.Tags{ // Required
  491. Items: []*cloudfront.Tag{
  492. { // Required
  493. Key: aws.String("TagKey"), // Required
  494. Value: aws.String("TagValue"),
  495. },
  496. // More values...
  497. },
  498. },
  499. },
  500. }
  501. resp, err := svc.CreateDistributionWithTags(params)
  502. if err != nil {
  503. // Print the error, cast err to awserr.Error to get the Code and
  504. // Message from an error.
  505. fmt.Println(err.Error())
  506. return
  507. }
  508. // Pretty-print the response data.
  509. fmt.Println(resp)
  510. }
  511. func ExampleCloudFront_CreateInvalidation() {
  512. sess, err := session.NewSession()
  513. if err != nil {
  514. fmt.Println("failed to create session,", err)
  515. return
  516. }
  517. svc := cloudfront.New(sess)
  518. params := &cloudfront.CreateInvalidationInput{
  519. DistributionId: aws.String("string"), // Required
  520. InvalidationBatch: &cloudfront.InvalidationBatch{ // Required
  521. CallerReference: aws.String("string"), // Required
  522. Paths: &cloudfront.Paths{ // Required
  523. Quantity: aws.Int64(1), // Required
  524. Items: []*string{
  525. aws.String("string"), // Required
  526. // More values...
  527. },
  528. },
  529. },
  530. }
  531. resp, err := svc.CreateInvalidation(params)
  532. if err != nil {
  533. // Print the error, cast err to awserr.Error to get the Code and
  534. // Message from an error.
  535. fmt.Println(err.Error())
  536. return
  537. }
  538. // Pretty-print the response data.
  539. fmt.Println(resp)
  540. }
  541. func ExampleCloudFront_CreateStreamingDistribution() {
  542. sess, err := session.NewSession()
  543. if err != nil {
  544. fmt.Println("failed to create session,", err)
  545. return
  546. }
  547. svc := cloudfront.New(sess)
  548. params := &cloudfront.CreateStreamingDistributionInput{
  549. StreamingDistributionConfig: &cloudfront.StreamingDistributionConfig{ // Required
  550. CallerReference: aws.String("string"), // Required
  551. Comment: aws.String("string"), // Required
  552. Enabled: aws.Bool(true), // Required
  553. S3Origin: &cloudfront.S3Origin{ // Required
  554. DomainName: aws.String("string"), // Required
  555. OriginAccessIdentity: aws.String("string"), // Required
  556. },
  557. TrustedSigners: &cloudfront.TrustedSigners{ // Required
  558. Enabled: aws.Bool(true), // Required
  559. Quantity: aws.Int64(1), // Required
  560. Items: []*string{
  561. aws.String("string"), // Required
  562. // More values...
  563. },
  564. },
  565. Aliases: &cloudfront.Aliases{
  566. Quantity: aws.Int64(1), // Required
  567. Items: []*string{
  568. aws.String("string"), // Required
  569. // More values...
  570. },
  571. },
  572. Logging: &cloudfront.StreamingLoggingConfig{
  573. Bucket: aws.String("string"), // Required
  574. Enabled: aws.Bool(true), // Required
  575. Prefix: aws.String("string"), // Required
  576. },
  577. PriceClass: aws.String("PriceClass"),
  578. },
  579. }
  580. resp, err := svc.CreateStreamingDistribution(params)
  581. if err != nil {
  582. // Print the error, cast err to awserr.Error to get the Code and
  583. // Message from an error.
  584. fmt.Println(err.Error())
  585. return
  586. }
  587. // Pretty-print the response data.
  588. fmt.Println(resp)
  589. }
  590. func ExampleCloudFront_CreateStreamingDistributionWithTags() {
  591. sess, err := session.NewSession()
  592. if err != nil {
  593. fmt.Println("failed to create session,", err)
  594. return
  595. }
  596. svc := cloudfront.New(sess)
  597. params := &cloudfront.CreateStreamingDistributionWithTagsInput{
  598. StreamingDistributionConfigWithTags: &cloudfront.StreamingDistributionConfigWithTags{ // Required
  599. StreamingDistributionConfig: &cloudfront.StreamingDistributionConfig{ // Required
  600. CallerReference: aws.String("string"), // Required
  601. Comment: aws.String("string"), // Required
  602. Enabled: aws.Bool(true), // Required
  603. S3Origin: &cloudfront.S3Origin{ // Required
  604. DomainName: aws.String("string"), // Required
  605. OriginAccessIdentity: aws.String("string"), // Required
  606. },
  607. TrustedSigners: &cloudfront.TrustedSigners{ // Required
  608. Enabled: aws.Bool(true), // Required
  609. Quantity: aws.Int64(1), // Required
  610. Items: []*string{
  611. aws.String("string"), // Required
  612. // More values...
  613. },
  614. },
  615. Aliases: &cloudfront.Aliases{
  616. Quantity: aws.Int64(1), // Required
  617. Items: []*string{
  618. aws.String("string"), // Required
  619. // More values...
  620. },
  621. },
  622. Logging: &cloudfront.StreamingLoggingConfig{
  623. Bucket: aws.String("string"), // Required
  624. Enabled: aws.Bool(true), // Required
  625. Prefix: aws.String("string"), // Required
  626. },
  627. PriceClass: aws.String("PriceClass"),
  628. },
  629. Tags: &cloudfront.Tags{ // Required
  630. Items: []*cloudfront.Tag{
  631. { // Required
  632. Key: aws.String("TagKey"), // Required
  633. Value: aws.String("TagValue"),
  634. },
  635. // More values...
  636. },
  637. },
  638. },
  639. }
  640. resp, err := svc.CreateStreamingDistributionWithTags(params)
  641. if err != nil {
  642. // Print the error, cast err to awserr.Error to get the Code and
  643. // Message from an error.
  644. fmt.Println(err.Error())
  645. return
  646. }
  647. // Pretty-print the response data.
  648. fmt.Println(resp)
  649. }
  650. func ExampleCloudFront_DeleteCloudFrontOriginAccessIdentity() {
  651. sess, err := session.NewSession()
  652. if err != nil {
  653. fmt.Println("failed to create session,", err)
  654. return
  655. }
  656. svc := cloudfront.New(sess)
  657. params := &cloudfront.DeleteCloudFrontOriginAccessIdentityInput{
  658. Id: aws.String("string"), // Required
  659. IfMatch: aws.String("string"),
  660. }
  661. resp, err := svc.DeleteCloudFrontOriginAccessIdentity(params)
  662. if err != nil {
  663. // Print the error, cast err to awserr.Error to get the Code and
  664. // Message from an error.
  665. fmt.Println(err.Error())
  666. return
  667. }
  668. // Pretty-print the response data.
  669. fmt.Println(resp)
  670. }
  671. func ExampleCloudFront_DeleteDistribution() {
  672. sess, err := session.NewSession()
  673. if err != nil {
  674. fmt.Println("failed to create session,", err)
  675. return
  676. }
  677. svc := cloudfront.New(sess)
  678. params := &cloudfront.DeleteDistributionInput{
  679. Id: aws.String("string"), // Required
  680. IfMatch: aws.String("string"),
  681. }
  682. resp, err := svc.DeleteDistribution(params)
  683. if err != nil {
  684. // Print the error, cast err to awserr.Error to get the Code and
  685. // Message from an error.
  686. fmt.Println(err.Error())
  687. return
  688. }
  689. // Pretty-print the response data.
  690. fmt.Println(resp)
  691. }
  692. func ExampleCloudFront_DeleteStreamingDistribution() {
  693. sess, err := session.NewSession()
  694. if err != nil {
  695. fmt.Println("failed to create session,", err)
  696. return
  697. }
  698. svc := cloudfront.New(sess)
  699. params := &cloudfront.DeleteStreamingDistributionInput{
  700. Id: aws.String("string"), // Required
  701. IfMatch: aws.String("string"),
  702. }
  703. resp, err := svc.DeleteStreamingDistribution(params)
  704. if err != nil {
  705. // Print the error, cast err to awserr.Error to get the Code and
  706. // Message from an error.
  707. fmt.Println(err.Error())
  708. return
  709. }
  710. // Pretty-print the response data.
  711. fmt.Println(resp)
  712. }
  713. func ExampleCloudFront_GetCloudFrontOriginAccessIdentity() {
  714. sess, err := session.NewSession()
  715. if err != nil {
  716. fmt.Println("failed to create session,", err)
  717. return
  718. }
  719. svc := cloudfront.New(sess)
  720. params := &cloudfront.GetCloudFrontOriginAccessIdentityInput{
  721. Id: aws.String("string"), // Required
  722. }
  723. resp, err := svc.GetCloudFrontOriginAccessIdentity(params)
  724. if err != nil {
  725. // Print the error, cast err to awserr.Error to get the Code and
  726. // Message from an error.
  727. fmt.Println(err.Error())
  728. return
  729. }
  730. // Pretty-print the response data.
  731. fmt.Println(resp)
  732. }
  733. func ExampleCloudFront_GetCloudFrontOriginAccessIdentityConfig() {
  734. sess, err := session.NewSession()
  735. if err != nil {
  736. fmt.Println("failed to create session,", err)
  737. return
  738. }
  739. svc := cloudfront.New(sess)
  740. params := &cloudfront.GetCloudFrontOriginAccessIdentityConfigInput{
  741. Id: aws.String("string"), // Required
  742. }
  743. resp, err := svc.GetCloudFrontOriginAccessIdentityConfig(params)
  744. if err != nil {
  745. // Print the error, cast err to awserr.Error to get the Code and
  746. // Message from an error.
  747. fmt.Println(err.Error())
  748. return
  749. }
  750. // Pretty-print the response data.
  751. fmt.Println(resp)
  752. }
  753. func ExampleCloudFront_GetDistribution() {
  754. sess, err := session.NewSession()
  755. if err != nil {
  756. fmt.Println("failed to create session,", err)
  757. return
  758. }
  759. svc := cloudfront.New(sess)
  760. params := &cloudfront.GetDistributionInput{
  761. Id: aws.String("string"), // Required
  762. }
  763. resp, err := svc.GetDistribution(params)
  764. if err != nil {
  765. // Print the error, cast err to awserr.Error to get the Code and
  766. // Message from an error.
  767. fmt.Println(err.Error())
  768. return
  769. }
  770. // Pretty-print the response data.
  771. fmt.Println(resp)
  772. }
  773. func ExampleCloudFront_GetDistributionConfig() {
  774. sess, err := session.NewSession()
  775. if err != nil {
  776. fmt.Println("failed to create session,", err)
  777. return
  778. }
  779. svc := cloudfront.New(sess)
  780. params := &cloudfront.GetDistributionConfigInput{
  781. Id: aws.String("string"), // Required
  782. }
  783. resp, err := svc.GetDistributionConfig(params)
  784. if err != nil {
  785. // Print the error, cast err to awserr.Error to get the Code and
  786. // Message from an error.
  787. fmt.Println(err.Error())
  788. return
  789. }
  790. // Pretty-print the response data.
  791. fmt.Println(resp)
  792. }
  793. func ExampleCloudFront_GetInvalidation() {
  794. sess, err := session.NewSession()
  795. if err != nil {
  796. fmt.Println("failed to create session,", err)
  797. return
  798. }
  799. svc := cloudfront.New(sess)
  800. params := &cloudfront.GetInvalidationInput{
  801. DistributionId: aws.String("string"), // Required
  802. Id: aws.String("string"), // Required
  803. }
  804. resp, err := svc.GetInvalidation(params)
  805. if err != nil {
  806. // Print the error, cast err to awserr.Error to get the Code and
  807. // Message from an error.
  808. fmt.Println(err.Error())
  809. return
  810. }
  811. // Pretty-print the response data.
  812. fmt.Println(resp)
  813. }
  814. func ExampleCloudFront_GetStreamingDistribution() {
  815. sess, err := session.NewSession()
  816. if err != nil {
  817. fmt.Println("failed to create session,", err)
  818. return
  819. }
  820. svc := cloudfront.New(sess)
  821. params := &cloudfront.GetStreamingDistributionInput{
  822. Id: aws.String("string"), // Required
  823. }
  824. resp, err := svc.GetStreamingDistribution(params)
  825. if err != nil {
  826. // Print the error, cast err to awserr.Error to get the Code and
  827. // Message from an error.
  828. fmt.Println(err.Error())
  829. return
  830. }
  831. // Pretty-print the response data.
  832. fmt.Println(resp)
  833. }
  834. func ExampleCloudFront_GetStreamingDistributionConfig() {
  835. sess, err := session.NewSession()
  836. if err != nil {
  837. fmt.Println("failed to create session,", err)
  838. return
  839. }
  840. svc := cloudfront.New(sess)
  841. params := &cloudfront.GetStreamingDistributionConfigInput{
  842. Id: aws.String("string"), // Required
  843. }
  844. resp, err := svc.GetStreamingDistributionConfig(params)
  845. if err != nil {
  846. // Print the error, cast err to awserr.Error to get the Code and
  847. // Message from an error.
  848. fmt.Println(err.Error())
  849. return
  850. }
  851. // Pretty-print the response data.
  852. fmt.Println(resp)
  853. }
  854. func ExampleCloudFront_ListCloudFrontOriginAccessIdentities() {
  855. sess, err := session.NewSession()
  856. if err != nil {
  857. fmt.Println("failed to create session,", err)
  858. return
  859. }
  860. svc := cloudfront.New(sess)
  861. params := &cloudfront.ListCloudFrontOriginAccessIdentitiesInput{
  862. Marker: aws.String("string"),
  863. MaxItems: aws.Int64(1),
  864. }
  865. resp, err := svc.ListCloudFrontOriginAccessIdentities(params)
  866. if err != nil {
  867. // Print the error, cast err to awserr.Error to get the Code and
  868. // Message from an error.
  869. fmt.Println(err.Error())
  870. return
  871. }
  872. // Pretty-print the response data.
  873. fmt.Println(resp)
  874. }
  875. func ExampleCloudFront_ListDistributions() {
  876. sess, err := session.NewSession()
  877. if err != nil {
  878. fmt.Println("failed to create session,", err)
  879. return
  880. }
  881. svc := cloudfront.New(sess)
  882. params := &cloudfront.ListDistributionsInput{
  883. Marker: aws.String("string"),
  884. MaxItems: aws.Int64(1),
  885. }
  886. resp, err := svc.ListDistributions(params)
  887. if err != nil {
  888. // Print the error, cast err to awserr.Error to get the Code and
  889. // Message from an error.
  890. fmt.Println(err.Error())
  891. return
  892. }
  893. // Pretty-print the response data.
  894. fmt.Println(resp)
  895. }
  896. func ExampleCloudFront_ListDistributionsByWebACLId() {
  897. sess, err := session.NewSession()
  898. if err != nil {
  899. fmt.Println("failed to create session,", err)
  900. return
  901. }
  902. svc := cloudfront.New(sess)
  903. params := &cloudfront.ListDistributionsByWebACLIdInput{
  904. WebACLId: aws.String("string"), // Required
  905. Marker: aws.String("string"),
  906. MaxItems: aws.Int64(1),
  907. }
  908. resp, err := svc.ListDistributionsByWebACLId(params)
  909. if err != nil {
  910. // Print the error, cast err to awserr.Error to get the Code and
  911. // Message from an error.
  912. fmt.Println(err.Error())
  913. return
  914. }
  915. // Pretty-print the response data.
  916. fmt.Println(resp)
  917. }
  918. func ExampleCloudFront_ListInvalidations() {
  919. sess, err := session.NewSession()
  920. if err != nil {
  921. fmt.Println("failed to create session,", err)
  922. return
  923. }
  924. svc := cloudfront.New(sess)
  925. params := &cloudfront.ListInvalidationsInput{
  926. DistributionId: aws.String("string"), // Required
  927. Marker: aws.String("string"),
  928. MaxItems: aws.Int64(1),
  929. }
  930. resp, err := svc.ListInvalidations(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 ExampleCloudFront_ListStreamingDistributions() {
  941. sess, err := session.NewSession()
  942. if err != nil {
  943. fmt.Println("failed to create session,", err)
  944. return
  945. }
  946. svc := cloudfront.New(sess)
  947. params := &cloudfront.ListStreamingDistributionsInput{
  948. Marker: aws.String("string"),
  949. MaxItems: aws.Int64(1),
  950. }
  951. resp, err := svc.ListStreamingDistributions(params)
  952. if err != nil {
  953. // Print the error, cast err to awserr.Error to get the Code and
  954. // Message from an error.
  955. fmt.Println(err.Error())
  956. return
  957. }
  958. // Pretty-print the response data.
  959. fmt.Println(resp)
  960. }
  961. func ExampleCloudFront_ListTagsForResource() {
  962. sess, err := session.NewSession()
  963. if err != nil {
  964. fmt.Println("failed to create session,", err)
  965. return
  966. }
  967. svc := cloudfront.New(sess)
  968. params := &cloudfront.ListTagsForResourceInput{
  969. Resource: aws.String("ResourceARN"), // Required
  970. }
  971. resp, err := svc.ListTagsForResource(params)
  972. if err != nil {
  973. // Print the error, cast err to awserr.Error to get the Code and
  974. // Message from an error.
  975. fmt.Println(err.Error())
  976. return
  977. }
  978. // Pretty-print the response data.
  979. fmt.Println(resp)
  980. }
  981. func ExampleCloudFront_TagResource() {
  982. sess, err := session.NewSession()
  983. if err != nil {
  984. fmt.Println("failed to create session,", err)
  985. return
  986. }
  987. svc := cloudfront.New(sess)
  988. params := &cloudfront.TagResourceInput{
  989. Resource: aws.String("ResourceARN"), // Required
  990. Tags: &cloudfront.Tags{ // Required
  991. Items: []*cloudfront.Tag{
  992. { // Required
  993. Key: aws.String("TagKey"), // Required
  994. Value: aws.String("TagValue"),
  995. },
  996. // More values...
  997. },
  998. },
  999. }
  1000. resp, err := svc.TagResource(params)
  1001. if err != nil {
  1002. // Print the error, cast err to awserr.Error to get the Code and
  1003. // Message from an error.
  1004. fmt.Println(err.Error())
  1005. return
  1006. }
  1007. // Pretty-print the response data.
  1008. fmt.Println(resp)
  1009. }
  1010. func ExampleCloudFront_UntagResource() {
  1011. sess, err := session.NewSession()
  1012. if err != nil {
  1013. fmt.Println("failed to create session,", err)
  1014. return
  1015. }
  1016. svc := cloudfront.New(sess)
  1017. params := &cloudfront.UntagResourceInput{
  1018. Resource: aws.String("ResourceARN"), // Required
  1019. TagKeys: &cloudfront.TagKeys{ // Required
  1020. Items: []*string{
  1021. aws.String("TagKey"), // Required
  1022. // More values...
  1023. },
  1024. },
  1025. }
  1026. resp, err := svc.UntagResource(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 ExampleCloudFront_UpdateCloudFrontOriginAccessIdentity() {
  1037. sess, err := session.NewSession()
  1038. if err != nil {
  1039. fmt.Println("failed to create session,", err)
  1040. return
  1041. }
  1042. svc := cloudfront.New(sess)
  1043. params := &cloudfront.UpdateCloudFrontOriginAccessIdentityInput{
  1044. CloudFrontOriginAccessIdentityConfig: &cloudfront.OriginAccessIdentityConfig{ // Required
  1045. CallerReference: aws.String("string"), // Required
  1046. Comment: aws.String("string"), // Required
  1047. },
  1048. Id: aws.String("string"), // Required
  1049. IfMatch: aws.String("string"),
  1050. }
  1051. resp, err := svc.UpdateCloudFrontOriginAccessIdentity(params)
  1052. if err != nil {
  1053. // Print the error, cast err to awserr.Error to get the Code and
  1054. // Message from an error.
  1055. fmt.Println(err.Error())
  1056. return
  1057. }
  1058. // Pretty-print the response data.
  1059. fmt.Println(resp)
  1060. }
  1061. func ExampleCloudFront_UpdateDistribution() {
  1062. sess, err := session.NewSession()
  1063. if err != nil {
  1064. fmt.Println("failed to create session,", err)
  1065. return
  1066. }
  1067. svc := cloudfront.New(sess)
  1068. params := &cloudfront.UpdateDistributionInput{
  1069. DistributionConfig: &cloudfront.DistributionConfig{ // Required
  1070. CallerReference: aws.String("string"), // Required
  1071. Comment: aws.String("string"), // Required
  1072. DefaultCacheBehavior: &cloudfront.DefaultCacheBehavior{ // Required
  1073. ForwardedValues: &cloudfront.ForwardedValues{ // Required
  1074. Cookies: &cloudfront.CookiePreference{ // Required
  1075. Forward: aws.String("ItemSelection"), // Required
  1076. WhitelistedNames: &cloudfront.CookieNames{
  1077. Quantity: aws.Int64(1), // Required
  1078. Items: []*string{
  1079. aws.String("string"), // Required
  1080. // More values...
  1081. },
  1082. },
  1083. },
  1084. QueryString: aws.Bool(true), // Required
  1085. Headers: &cloudfront.Headers{
  1086. Quantity: aws.Int64(1), // Required
  1087. Items: []*string{
  1088. aws.String("string"), // Required
  1089. // More values...
  1090. },
  1091. },
  1092. QueryStringCacheKeys: &cloudfront.QueryStringCacheKeys{
  1093. Quantity: aws.Int64(1), // Required
  1094. Items: []*string{
  1095. aws.String("string"), // Required
  1096. // More values...
  1097. },
  1098. },
  1099. },
  1100. MinTTL: aws.Int64(1), // Required
  1101. TargetOriginId: aws.String("string"), // Required
  1102. TrustedSigners: &cloudfront.TrustedSigners{ // Required
  1103. Enabled: aws.Bool(true), // Required
  1104. Quantity: aws.Int64(1), // Required
  1105. Items: []*string{
  1106. aws.String("string"), // Required
  1107. // More values...
  1108. },
  1109. },
  1110. ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required
  1111. AllowedMethods: &cloudfront.AllowedMethods{
  1112. Items: []*string{ // Required
  1113. aws.String("Method"), // Required
  1114. // More values...
  1115. },
  1116. Quantity: aws.Int64(1), // Required
  1117. CachedMethods: &cloudfront.CachedMethods{
  1118. Items: []*string{ // Required
  1119. aws.String("Method"), // Required
  1120. // More values...
  1121. },
  1122. Quantity: aws.Int64(1), // Required
  1123. },
  1124. },
  1125. Compress: aws.Bool(true),
  1126. DefaultTTL: aws.Int64(1),
  1127. MaxTTL: aws.Int64(1),
  1128. SmoothStreaming: aws.Bool(true),
  1129. },
  1130. Enabled: aws.Bool(true), // Required
  1131. Origins: &cloudfront.Origins{ // Required
  1132. Quantity: aws.Int64(1), // Required
  1133. Items: []*cloudfront.Origin{
  1134. { // Required
  1135. DomainName: aws.String("string"), // Required
  1136. Id: aws.String("string"), // Required
  1137. CustomHeaders: &cloudfront.CustomHeaders{
  1138. Quantity: aws.Int64(1), // Required
  1139. Items: []*cloudfront.OriginCustomHeader{
  1140. { // Required
  1141. HeaderName: aws.String("string"), // Required
  1142. HeaderValue: aws.String("string"), // Required
  1143. },
  1144. // More values...
  1145. },
  1146. },
  1147. CustomOriginConfig: &cloudfront.CustomOriginConfig{
  1148. HTTPPort: aws.Int64(1), // Required
  1149. HTTPSPort: aws.Int64(1), // Required
  1150. OriginProtocolPolicy: aws.String("OriginProtocolPolicy"), // Required
  1151. OriginSslProtocols: &cloudfront.OriginSslProtocols{
  1152. Items: []*string{ // Required
  1153. aws.String("SslProtocol"), // Required
  1154. // More values...
  1155. },
  1156. Quantity: aws.Int64(1), // Required
  1157. },
  1158. },
  1159. OriginPath: aws.String("string"),
  1160. S3OriginConfig: &cloudfront.S3OriginConfig{
  1161. OriginAccessIdentity: aws.String("string"), // Required
  1162. },
  1163. },
  1164. // More values...
  1165. },
  1166. },
  1167. Aliases: &cloudfront.Aliases{
  1168. Quantity: aws.Int64(1), // Required
  1169. Items: []*string{
  1170. aws.String("string"), // Required
  1171. // More values...
  1172. },
  1173. },
  1174. CacheBehaviors: &cloudfront.CacheBehaviors{
  1175. Quantity: aws.Int64(1), // Required
  1176. Items: []*cloudfront.CacheBehavior{
  1177. { // Required
  1178. ForwardedValues: &cloudfront.ForwardedValues{ // Required
  1179. Cookies: &cloudfront.CookiePreference{ // Required
  1180. Forward: aws.String("ItemSelection"), // Required
  1181. WhitelistedNames: &cloudfront.CookieNames{
  1182. Quantity: aws.Int64(1), // Required
  1183. Items: []*string{
  1184. aws.String("string"), // Required
  1185. // More values...
  1186. },
  1187. },
  1188. },
  1189. QueryString: aws.Bool(true), // Required
  1190. Headers: &cloudfront.Headers{
  1191. Quantity: aws.Int64(1), // Required
  1192. Items: []*string{
  1193. aws.String("string"), // Required
  1194. // More values...
  1195. },
  1196. },
  1197. QueryStringCacheKeys: &cloudfront.QueryStringCacheKeys{
  1198. Quantity: aws.Int64(1), // Required
  1199. Items: []*string{
  1200. aws.String("string"), // Required
  1201. // More values...
  1202. },
  1203. },
  1204. },
  1205. MinTTL: aws.Int64(1), // Required
  1206. PathPattern: aws.String("string"), // Required
  1207. TargetOriginId: aws.String("string"), // Required
  1208. TrustedSigners: &cloudfront.TrustedSigners{ // Required
  1209. Enabled: aws.Bool(true), // Required
  1210. Quantity: aws.Int64(1), // Required
  1211. Items: []*string{
  1212. aws.String("string"), // Required
  1213. // More values...
  1214. },
  1215. },
  1216. ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required
  1217. AllowedMethods: &cloudfront.AllowedMethods{
  1218. Items: []*string{ // Required
  1219. aws.String("Method"), // Required
  1220. // More values...
  1221. },
  1222. Quantity: aws.Int64(1), // Required
  1223. CachedMethods: &cloudfront.CachedMethods{
  1224. Items: []*string{ // Required
  1225. aws.String("Method"), // Required
  1226. // More values...
  1227. },
  1228. Quantity: aws.Int64(1), // Required
  1229. },
  1230. },
  1231. Compress: aws.Bool(true),
  1232. DefaultTTL: aws.Int64(1),
  1233. MaxTTL: aws.Int64(1),
  1234. SmoothStreaming: aws.Bool(true),
  1235. },
  1236. // More values...
  1237. },
  1238. },
  1239. CustomErrorResponses: &cloudfront.CustomErrorResponses{
  1240. Quantity: aws.Int64(1), // Required
  1241. Items: []*cloudfront.CustomErrorResponse{
  1242. { // Required
  1243. ErrorCode: aws.Int64(1), // Required
  1244. ErrorCachingMinTTL: aws.Int64(1),
  1245. ResponseCode: aws.String("string"),
  1246. ResponsePagePath: aws.String("string"),
  1247. },
  1248. // More values...
  1249. },
  1250. },
  1251. DefaultRootObject: aws.String("string"),
  1252. HttpVersion: aws.String("HttpVersion"),
  1253. IsIPV6Enabled: aws.Bool(true),
  1254. Logging: &cloudfront.LoggingConfig{
  1255. Bucket: aws.String("string"), // Required
  1256. Enabled: aws.Bool(true), // Required
  1257. IncludeCookies: aws.Bool(true), // Required
  1258. Prefix: aws.String("string"), // Required
  1259. },
  1260. PriceClass: aws.String("PriceClass"),
  1261. Restrictions: &cloudfront.Restrictions{
  1262. GeoRestriction: &cloudfront.GeoRestriction{ // Required
  1263. Quantity: aws.Int64(1), // Required
  1264. RestrictionType: aws.String("GeoRestrictionType"), // Required
  1265. Items: []*string{
  1266. aws.String("string"), // Required
  1267. // More values...
  1268. },
  1269. },
  1270. },
  1271. ViewerCertificate: &cloudfront.ViewerCertificate{
  1272. ACMCertificateArn: aws.String("string"),
  1273. Certificate: aws.String("string"),
  1274. CertificateSource: aws.String("CertificateSource"),
  1275. CloudFrontDefaultCertificate: aws.Bool(true),
  1276. IAMCertificateId: aws.String("string"),
  1277. MinimumProtocolVersion: aws.String("MinimumProtocolVersion"),
  1278. SSLSupportMethod: aws.String("SSLSupportMethod"),
  1279. },
  1280. WebACLId: aws.String("string"),
  1281. },
  1282. Id: aws.String("string"), // Required
  1283. IfMatch: aws.String("string"),
  1284. }
  1285. resp, err := svc.UpdateDistribution(params)
  1286. if err != nil {
  1287. // Print the error, cast err to awserr.Error to get the Code and
  1288. // Message from an error.
  1289. fmt.Println(err.Error())
  1290. return
  1291. }
  1292. // Pretty-print the response data.
  1293. fmt.Println(resp)
  1294. }
  1295. func ExampleCloudFront_UpdateStreamingDistribution() {
  1296. sess, err := session.NewSession()
  1297. if err != nil {
  1298. fmt.Println("failed to create session,", err)
  1299. return
  1300. }
  1301. svc := cloudfront.New(sess)
  1302. params := &cloudfront.UpdateStreamingDistributionInput{
  1303. Id: aws.String("string"), // Required
  1304. StreamingDistributionConfig: &cloudfront.StreamingDistributionConfig{ // Required
  1305. CallerReference: aws.String("string"), // Required
  1306. Comment: aws.String("string"), // Required
  1307. Enabled: aws.Bool(true), // Required
  1308. S3Origin: &cloudfront.S3Origin{ // Required
  1309. DomainName: aws.String("string"), // Required
  1310. OriginAccessIdentity: aws.String("string"), // Required
  1311. },
  1312. TrustedSigners: &cloudfront.TrustedSigners{ // Required
  1313. Enabled: aws.Bool(true), // Required
  1314. Quantity: aws.Int64(1), // Required
  1315. Items: []*string{
  1316. aws.String("string"), // Required
  1317. // More values...
  1318. },
  1319. },
  1320. Aliases: &cloudfront.Aliases{
  1321. Quantity: aws.Int64(1), // Required
  1322. Items: []*string{
  1323. aws.String("string"), // Required
  1324. // More values...
  1325. },
  1326. },
  1327. Logging: &cloudfront.StreamingLoggingConfig{
  1328. Bucket: aws.String("string"), // Required
  1329. Enabled: aws.Bool(true), // Required
  1330. Prefix: aws.String("string"), // Required
  1331. },
  1332. PriceClass: aws.String("PriceClass"),
  1333. },
  1334. IfMatch: aws.String("string"),
  1335. }
  1336. resp, err := svc.UpdateStreamingDistribution(params)
  1337. if err != nil {
  1338. // Print the error, cast err to awserr.Error to get the Code and
  1339. // Message from an error.
  1340. fmt.Println(err.Error())
  1341. return
  1342. }
  1343. // Pretty-print the response data.
  1344. fmt.Println(resp)
  1345. }