examples_test.go 41 KB

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