examples_test.go 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849
  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/service/cloudfront"
  9. )
  10. var _ time.Duration
  11. var _ bytes.Buffer
  12. func ExampleCloudFront_CreateCloudFrontOriginAccessIdentity() {
  13. svc := cloudfront.New(nil)
  14. params := &cloudfront.CreateCloudFrontOriginAccessIdentityInput{
  15. CloudFrontOriginAccessIdentityConfig: &cloudfront.OriginAccessIdentityConfig{ // Required
  16. CallerReference: aws.String("string"), // Required
  17. Comment: aws.String("string"), // Required
  18. },
  19. }
  20. resp, err := svc.CreateCloudFrontOriginAccessIdentity(params)
  21. if err != nil {
  22. // Print the error, cast err to awserr.Error to get the Code and
  23. // Message from an error.
  24. fmt.Println(err.Error())
  25. return
  26. }
  27. // Pretty-print the response data.
  28. fmt.Println(resp)
  29. }
  30. func ExampleCloudFront_CreateDistribution() {
  31. svc := cloudfront.New(nil)
  32. params := &cloudfront.CreateDistributionInput{
  33. DistributionConfig: &cloudfront.DistributionConfig{ // Required
  34. CallerReference: aws.String("string"), // Required
  35. Comment: aws.String("string"), // Required
  36. DefaultCacheBehavior: &cloudfront.DefaultCacheBehavior{ // Required
  37. ForwardedValues: &cloudfront.ForwardedValues{ // Required
  38. Cookies: &cloudfront.CookiePreference{ // Required
  39. Forward: aws.String("ItemSelection"), // Required
  40. WhitelistedNames: &cloudfront.CookieNames{
  41. Quantity: aws.Int64(1), // Required
  42. Items: []*string{
  43. aws.String("string"), // Required
  44. // More values...
  45. },
  46. },
  47. },
  48. QueryString: aws.Bool(true), // Required
  49. Headers: &cloudfront.Headers{
  50. Quantity: aws.Int64(1), // Required
  51. Items: []*string{
  52. aws.String("string"), // Required
  53. // More values...
  54. },
  55. },
  56. },
  57. MinTTL: aws.Int64(1), // Required
  58. TargetOriginId: aws.String("string"), // Required
  59. TrustedSigners: &cloudfront.TrustedSigners{ // Required
  60. Enabled: aws.Bool(true), // Required
  61. Quantity: aws.Int64(1), // Required
  62. Items: []*string{
  63. aws.String("string"), // Required
  64. // More values...
  65. },
  66. },
  67. ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required
  68. AllowedMethods: &cloudfront.AllowedMethods{
  69. Items: []*string{ // Required
  70. aws.String("Method"), // Required
  71. // More values...
  72. },
  73. Quantity: aws.Int64(1), // Required
  74. CachedMethods: &cloudfront.CachedMethods{
  75. Items: []*string{ // Required
  76. aws.String("Method"), // Required
  77. // More values...
  78. },
  79. Quantity: aws.Int64(1), // Required
  80. },
  81. },
  82. DefaultTTL: aws.Int64(1),
  83. MaxTTL: aws.Int64(1),
  84. SmoothStreaming: aws.Bool(true),
  85. },
  86. Enabled: aws.Bool(true), // Required
  87. Origins: &cloudfront.Origins{ // Required
  88. Quantity: aws.Int64(1), // Required
  89. Items: []*cloudfront.Origin{
  90. { // Required
  91. DomainName: aws.String("string"), // Required
  92. Id: aws.String("string"), // Required
  93. CustomOriginConfig: &cloudfront.CustomOriginConfig{
  94. HTTPPort: aws.Int64(1), // Required
  95. HTTPSPort: aws.Int64(1), // Required
  96. OriginProtocolPolicy: aws.String("OriginProtocolPolicy"), // Required
  97. },
  98. OriginPath: aws.String("string"),
  99. S3OriginConfig: &cloudfront.S3OriginConfig{
  100. OriginAccessIdentity: aws.String("string"), // Required
  101. },
  102. },
  103. // More values...
  104. },
  105. },
  106. Aliases: &cloudfront.Aliases{
  107. Quantity: aws.Int64(1), // Required
  108. Items: []*string{
  109. aws.String("string"), // Required
  110. // More values...
  111. },
  112. },
  113. CacheBehaviors: &cloudfront.CacheBehaviors{
  114. Quantity: aws.Int64(1), // Required
  115. Items: []*cloudfront.CacheBehavior{
  116. { // Required
  117. ForwardedValues: &cloudfront.ForwardedValues{ // Required
  118. Cookies: &cloudfront.CookiePreference{ // Required
  119. Forward: aws.String("ItemSelection"), // Required
  120. WhitelistedNames: &cloudfront.CookieNames{
  121. Quantity: aws.Int64(1), // Required
  122. Items: []*string{
  123. aws.String("string"), // Required
  124. // More values...
  125. },
  126. },
  127. },
  128. QueryString: aws.Bool(true), // Required
  129. Headers: &cloudfront.Headers{
  130. Quantity: aws.Int64(1), // Required
  131. Items: []*string{
  132. aws.String("string"), // Required
  133. // More values...
  134. },
  135. },
  136. },
  137. MinTTL: aws.Int64(1), // Required
  138. PathPattern: aws.String("string"), // Required
  139. TargetOriginId: aws.String("string"), // Required
  140. TrustedSigners: &cloudfront.TrustedSigners{ // Required
  141. Enabled: aws.Bool(true), // Required
  142. Quantity: aws.Int64(1), // Required
  143. Items: []*string{
  144. aws.String("string"), // Required
  145. // More values...
  146. },
  147. },
  148. ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required
  149. AllowedMethods: &cloudfront.AllowedMethods{
  150. Items: []*string{ // Required
  151. aws.String("Method"), // Required
  152. // More values...
  153. },
  154. Quantity: aws.Int64(1), // Required
  155. CachedMethods: &cloudfront.CachedMethods{
  156. Items: []*string{ // Required
  157. aws.String("Method"), // Required
  158. // More values...
  159. },
  160. Quantity: aws.Int64(1), // Required
  161. },
  162. },
  163. DefaultTTL: aws.Int64(1),
  164. MaxTTL: aws.Int64(1),
  165. SmoothStreaming: aws.Bool(true),
  166. },
  167. // More values...
  168. },
  169. },
  170. CustomErrorResponses: &cloudfront.CustomErrorResponses{
  171. Quantity: aws.Int64(1), // Required
  172. Items: []*cloudfront.CustomErrorResponse{
  173. { // Required
  174. ErrorCode: aws.Int64(1), // Required
  175. ErrorCachingMinTTL: aws.Int64(1),
  176. ResponseCode: aws.String("string"),
  177. ResponsePagePath: aws.String("string"),
  178. },
  179. // More values...
  180. },
  181. },
  182. DefaultRootObject: aws.String("string"),
  183. Logging: &cloudfront.LoggingConfig{
  184. Bucket: aws.String("string"), // Required
  185. Enabled: aws.Bool(true), // Required
  186. IncludeCookies: aws.Bool(true), // Required
  187. Prefix: aws.String("string"), // Required
  188. },
  189. PriceClass: aws.String("PriceClass"),
  190. Restrictions: &cloudfront.Restrictions{
  191. GeoRestriction: &cloudfront.GeoRestriction{ // Required
  192. Quantity: aws.Int64(1), // Required
  193. RestrictionType: aws.String("GeoRestrictionType"), // Required
  194. Items: []*string{
  195. aws.String("string"), // Required
  196. // More values...
  197. },
  198. },
  199. },
  200. ViewerCertificate: &cloudfront.ViewerCertificate{
  201. CloudFrontDefaultCertificate: aws.Bool(true),
  202. IAMCertificateId: aws.String("string"),
  203. MinimumProtocolVersion: aws.String("MinimumProtocolVersion"),
  204. SSLSupportMethod: aws.String("SSLSupportMethod"),
  205. },
  206. },
  207. }
  208. resp, err := svc.CreateDistribution(params)
  209. if err != nil {
  210. // Print the error, cast err to awserr.Error to get the Code and
  211. // Message from an error.
  212. fmt.Println(err.Error())
  213. return
  214. }
  215. // Pretty-print the response data.
  216. fmt.Println(resp)
  217. }
  218. func ExampleCloudFront_CreateInvalidation() {
  219. svc := cloudfront.New(nil)
  220. params := &cloudfront.CreateInvalidationInput{
  221. DistributionId: aws.String("string"), // Required
  222. InvalidationBatch: &cloudfront.InvalidationBatch{ // Required
  223. CallerReference: aws.String("string"), // Required
  224. Paths: &cloudfront.Paths{ // Required
  225. Quantity: aws.Int64(1), // Required
  226. Items: []*string{
  227. aws.String("string"), // Required
  228. // More values...
  229. },
  230. },
  231. },
  232. }
  233. resp, err := svc.CreateInvalidation(params)
  234. if err != nil {
  235. // Print the error, cast err to awserr.Error to get the Code and
  236. // Message from an error.
  237. fmt.Println(err.Error())
  238. return
  239. }
  240. // Pretty-print the response data.
  241. fmt.Println(resp)
  242. }
  243. func ExampleCloudFront_CreateStreamingDistribution() {
  244. svc := cloudfront.New(nil)
  245. params := &cloudfront.CreateStreamingDistributionInput{
  246. StreamingDistributionConfig: &cloudfront.StreamingDistributionConfig{ // Required
  247. CallerReference: aws.String("string"), // Required
  248. Comment: aws.String("string"), // Required
  249. Enabled: aws.Bool(true), // Required
  250. S3Origin: &cloudfront.S3Origin{ // Required
  251. DomainName: aws.String("string"), // Required
  252. OriginAccessIdentity: aws.String("string"), // Required
  253. },
  254. TrustedSigners: &cloudfront.TrustedSigners{ // Required
  255. Enabled: aws.Bool(true), // Required
  256. Quantity: aws.Int64(1), // Required
  257. Items: []*string{
  258. aws.String("string"), // Required
  259. // More values...
  260. },
  261. },
  262. Aliases: &cloudfront.Aliases{
  263. Quantity: aws.Int64(1), // Required
  264. Items: []*string{
  265. aws.String("string"), // Required
  266. // More values...
  267. },
  268. },
  269. Logging: &cloudfront.StreamingLoggingConfig{
  270. Bucket: aws.String("string"), // Required
  271. Enabled: aws.Bool(true), // Required
  272. Prefix: aws.String("string"), // Required
  273. },
  274. PriceClass: aws.String("PriceClass"),
  275. },
  276. }
  277. resp, err := svc.CreateStreamingDistribution(params)
  278. if err != nil {
  279. // Print the error, cast err to awserr.Error to get the Code and
  280. // Message from an error.
  281. fmt.Println(err.Error())
  282. return
  283. }
  284. // Pretty-print the response data.
  285. fmt.Println(resp)
  286. }
  287. func ExampleCloudFront_DeleteCloudFrontOriginAccessIdentity() {
  288. svc := cloudfront.New(nil)
  289. params := &cloudfront.DeleteCloudFrontOriginAccessIdentityInput{
  290. Id: aws.String("string"), // Required
  291. IfMatch: aws.String("string"),
  292. }
  293. resp, err := svc.DeleteCloudFrontOriginAccessIdentity(params)
  294. if err != nil {
  295. // Print the error, cast err to awserr.Error to get the Code and
  296. // Message from an error.
  297. fmt.Println(err.Error())
  298. return
  299. }
  300. // Pretty-print the response data.
  301. fmt.Println(resp)
  302. }
  303. func ExampleCloudFront_DeleteDistribution() {
  304. svc := cloudfront.New(nil)
  305. params := &cloudfront.DeleteDistributionInput{
  306. Id: aws.String("string"), // Required
  307. IfMatch: aws.String("string"),
  308. }
  309. resp, err := svc.DeleteDistribution(params)
  310. if err != nil {
  311. // Print the error, cast err to awserr.Error to get the Code and
  312. // Message from an error.
  313. fmt.Println(err.Error())
  314. return
  315. }
  316. // Pretty-print the response data.
  317. fmt.Println(resp)
  318. }
  319. func ExampleCloudFront_DeleteStreamingDistribution() {
  320. svc := cloudfront.New(nil)
  321. params := &cloudfront.DeleteStreamingDistributionInput{
  322. Id: aws.String("string"), // Required
  323. IfMatch: aws.String("string"),
  324. }
  325. resp, err := svc.DeleteStreamingDistribution(params)
  326. if err != nil {
  327. // Print the error, cast err to awserr.Error to get the Code and
  328. // Message from an error.
  329. fmt.Println(err.Error())
  330. return
  331. }
  332. // Pretty-print the response data.
  333. fmt.Println(resp)
  334. }
  335. func ExampleCloudFront_GetCloudFrontOriginAccessIdentity() {
  336. svc := cloudfront.New(nil)
  337. params := &cloudfront.GetCloudFrontOriginAccessIdentityInput{
  338. Id: aws.String("string"), // Required
  339. }
  340. resp, err := svc.GetCloudFrontOriginAccessIdentity(params)
  341. if err != nil {
  342. // Print the error, cast err to awserr.Error to get the Code and
  343. // Message from an error.
  344. fmt.Println(err.Error())
  345. return
  346. }
  347. // Pretty-print the response data.
  348. fmt.Println(resp)
  349. }
  350. func ExampleCloudFront_GetCloudFrontOriginAccessIdentityConfig() {
  351. svc := cloudfront.New(nil)
  352. params := &cloudfront.GetCloudFrontOriginAccessIdentityConfigInput{
  353. Id: aws.String("string"), // Required
  354. }
  355. resp, err := svc.GetCloudFrontOriginAccessIdentityConfig(params)
  356. if err != nil {
  357. // Print the error, cast err to awserr.Error to get the Code and
  358. // Message from an error.
  359. fmt.Println(err.Error())
  360. return
  361. }
  362. // Pretty-print the response data.
  363. fmt.Println(resp)
  364. }
  365. func ExampleCloudFront_GetDistribution() {
  366. svc := cloudfront.New(nil)
  367. params := &cloudfront.GetDistributionInput{
  368. Id: aws.String("string"), // Required
  369. }
  370. resp, err := svc.GetDistribution(params)
  371. if err != nil {
  372. // Print the error, cast err to awserr.Error to get the Code and
  373. // Message from an error.
  374. fmt.Println(err.Error())
  375. return
  376. }
  377. // Pretty-print the response data.
  378. fmt.Println(resp)
  379. }
  380. func ExampleCloudFront_GetDistributionConfig() {
  381. svc := cloudfront.New(nil)
  382. params := &cloudfront.GetDistributionConfigInput{
  383. Id: aws.String("string"), // Required
  384. }
  385. resp, err := svc.GetDistributionConfig(params)
  386. if err != nil {
  387. // Print the error, cast err to awserr.Error to get the Code and
  388. // Message from an error.
  389. fmt.Println(err.Error())
  390. return
  391. }
  392. // Pretty-print the response data.
  393. fmt.Println(resp)
  394. }
  395. func ExampleCloudFront_GetInvalidation() {
  396. svc := cloudfront.New(nil)
  397. params := &cloudfront.GetInvalidationInput{
  398. DistributionId: aws.String("string"), // Required
  399. Id: aws.String("string"), // Required
  400. }
  401. resp, err := svc.GetInvalidation(params)
  402. if err != nil {
  403. // Print the error, cast err to awserr.Error to get the Code and
  404. // Message from an error.
  405. fmt.Println(err.Error())
  406. return
  407. }
  408. // Pretty-print the response data.
  409. fmt.Println(resp)
  410. }
  411. func ExampleCloudFront_GetStreamingDistribution() {
  412. svc := cloudfront.New(nil)
  413. params := &cloudfront.GetStreamingDistributionInput{
  414. Id: aws.String("string"), // Required
  415. }
  416. resp, err := svc.GetStreamingDistribution(params)
  417. if err != nil {
  418. // Print the error, cast err to awserr.Error to get the Code and
  419. // Message from an error.
  420. fmt.Println(err.Error())
  421. return
  422. }
  423. // Pretty-print the response data.
  424. fmt.Println(resp)
  425. }
  426. func ExampleCloudFront_GetStreamingDistributionConfig() {
  427. svc := cloudfront.New(nil)
  428. params := &cloudfront.GetStreamingDistributionConfigInput{
  429. Id: aws.String("string"), // Required
  430. }
  431. resp, err := svc.GetStreamingDistributionConfig(params)
  432. if err != nil {
  433. // Print the error, cast err to awserr.Error to get the Code and
  434. // Message from an error.
  435. fmt.Println(err.Error())
  436. return
  437. }
  438. // Pretty-print the response data.
  439. fmt.Println(resp)
  440. }
  441. func ExampleCloudFront_ListCloudFrontOriginAccessIdentities() {
  442. svc := cloudfront.New(nil)
  443. params := &cloudfront.ListCloudFrontOriginAccessIdentitiesInput{
  444. Marker: aws.String("string"),
  445. MaxItems: aws.Int64(1),
  446. }
  447. resp, err := svc.ListCloudFrontOriginAccessIdentities(params)
  448. if err != nil {
  449. // Print the error, cast err to awserr.Error to get the Code and
  450. // Message from an error.
  451. fmt.Println(err.Error())
  452. return
  453. }
  454. // Pretty-print the response data.
  455. fmt.Println(resp)
  456. }
  457. func ExampleCloudFront_ListDistributions() {
  458. svc := cloudfront.New(nil)
  459. params := &cloudfront.ListDistributionsInput{
  460. Marker: aws.String("string"),
  461. MaxItems: aws.Int64(1),
  462. }
  463. resp, err := svc.ListDistributions(params)
  464. if err != nil {
  465. // Print the error, cast err to awserr.Error to get the Code and
  466. // Message from an error.
  467. fmt.Println(err.Error())
  468. return
  469. }
  470. // Pretty-print the response data.
  471. fmt.Println(resp)
  472. }
  473. func ExampleCloudFront_ListInvalidations() {
  474. svc := cloudfront.New(nil)
  475. params := &cloudfront.ListInvalidationsInput{
  476. DistributionId: aws.String("string"), // Required
  477. Marker: aws.String("string"),
  478. MaxItems: aws.Int64(1),
  479. }
  480. resp, err := svc.ListInvalidations(params)
  481. if err != nil {
  482. // Print the error, cast err to awserr.Error to get the Code and
  483. // Message from an error.
  484. fmt.Println(err.Error())
  485. return
  486. }
  487. // Pretty-print the response data.
  488. fmt.Println(resp)
  489. }
  490. func ExampleCloudFront_ListStreamingDistributions() {
  491. svc := cloudfront.New(nil)
  492. params := &cloudfront.ListStreamingDistributionsInput{
  493. Marker: aws.String("string"),
  494. MaxItems: aws.Int64(1),
  495. }
  496. resp, err := svc.ListStreamingDistributions(params)
  497. if err != nil {
  498. // Print the error, cast err to awserr.Error to get the Code and
  499. // Message from an error.
  500. fmt.Println(err.Error())
  501. return
  502. }
  503. // Pretty-print the response data.
  504. fmt.Println(resp)
  505. }
  506. func ExampleCloudFront_UpdateCloudFrontOriginAccessIdentity() {
  507. svc := cloudfront.New(nil)
  508. params := &cloudfront.UpdateCloudFrontOriginAccessIdentityInput{
  509. CloudFrontOriginAccessIdentityConfig: &cloudfront.OriginAccessIdentityConfig{ // Required
  510. CallerReference: aws.String("string"), // Required
  511. Comment: aws.String("string"), // Required
  512. },
  513. Id: aws.String("string"), // Required
  514. IfMatch: aws.String("string"),
  515. }
  516. resp, err := svc.UpdateCloudFrontOriginAccessIdentity(params)
  517. if err != nil {
  518. // Print the error, cast err to awserr.Error to get the Code and
  519. // Message from an error.
  520. fmt.Println(err.Error())
  521. return
  522. }
  523. // Pretty-print the response data.
  524. fmt.Println(resp)
  525. }
  526. func ExampleCloudFront_UpdateDistribution() {
  527. svc := cloudfront.New(nil)
  528. params := &cloudfront.UpdateDistributionInput{
  529. DistributionConfig: &cloudfront.DistributionConfig{ // Required
  530. CallerReference: aws.String("string"), // Required
  531. Comment: aws.String("string"), // Required
  532. DefaultCacheBehavior: &cloudfront.DefaultCacheBehavior{ // Required
  533. ForwardedValues: &cloudfront.ForwardedValues{ // Required
  534. Cookies: &cloudfront.CookiePreference{ // Required
  535. Forward: aws.String("ItemSelection"), // Required
  536. WhitelistedNames: &cloudfront.CookieNames{
  537. Quantity: aws.Int64(1), // Required
  538. Items: []*string{
  539. aws.String("string"), // Required
  540. // More values...
  541. },
  542. },
  543. },
  544. QueryString: aws.Bool(true), // Required
  545. Headers: &cloudfront.Headers{
  546. Quantity: aws.Int64(1), // Required
  547. Items: []*string{
  548. aws.String("string"), // Required
  549. // More values...
  550. },
  551. },
  552. },
  553. MinTTL: aws.Int64(1), // Required
  554. TargetOriginId: aws.String("string"), // Required
  555. TrustedSigners: &cloudfront.TrustedSigners{ // Required
  556. Enabled: aws.Bool(true), // Required
  557. Quantity: aws.Int64(1), // Required
  558. Items: []*string{
  559. aws.String("string"), // Required
  560. // More values...
  561. },
  562. },
  563. ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required
  564. AllowedMethods: &cloudfront.AllowedMethods{
  565. Items: []*string{ // Required
  566. aws.String("Method"), // Required
  567. // More values...
  568. },
  569. Quantity: aws.Int64(1), // Required
  570. CachedMethods: &cloudfront.CachedMethods{
  571. Items: []*string{ // Required
  572. aws.String("Method"), // Required
  573. // More values...
  574. },
  575. Quantity: aws.Int64(1), // Required
  576. },
  577. },
  578. DefaultTTL: aws.Int64(1),
  579. MaxTTL: aws.Int64(1),
  580. SmoothStreaming: aws.Bool(true),
  581. },
  582. Enabled: aws.Bool(true), // Required
  583. Origins: &cloudfront.Origins{ // Required
  584. Quantity: aws.Int64(1), // Required
  585. Items: []*cloudfront.Origin{
  586. { // Required
  587. DomainName: aws.String("string"), // Required
  588. Id: aws.String("string"), // Required
  589. CustomOriginConfig: &cloudfront.CustomOriginConfig{
  590. HTTPPort: aws.Int64(1), // Required
  591. HTTPSPort: aws.Int64(1), // Required
  592. OriginProtocolPolicy: aws.String("OriginProtocolPolicy"), // Required
  593. },
  594. OriginPath: aws.String("string"),
  595. S3OriginConfig: &cloudfront.S3OriginConfig{
  596. OriginAccessIdentity: aws.String("string"), // Required
  597. },
  598. },
  599. // More values...
  600. },
  601. },
  602. Aliases: &cloudfront.Aliases{
  603. Quantity: aws.Int64(1), // Required
  604. Items: []*string{
  605. aws.String("string"), // Required
  606. // More values...
  607. },
  608. },
  609. CacheBehaviors: &cloudfront.CacheBehaviors{
  610. Quantity: aws.Int64(1), // Required
  611. Items: []*cloudfront.CacheBehavior{
  612. { // Required
  613. ForwardedValues: &cloudfront.ForwardedValues{ // Required
  614. Cookies: &cloudfront.CookiePreference{ // Required
  615. Forward: aws.String("ItemSelection"), // Required
  616. WhitelistedNames: &cloudfront.CookieNames{
  617. Quantity: aws.Int64(1), // Required
  618. Items: []*string{
  619. aws.String("string"), // Required
  620. // More values...
  621. },
  622. },
  623. },
  624. QueryString: aws.Bool(true), // Required
  625. Headers: &cloudfront.Headers{
  626. Quantity: aws.Int64(1), // Required
  627. Items: []*string{
  628. aws.String("string"), // Required
  629. // More values...
  630. },
  631. },
  632. },
  633. MinTTL: aws.Int64(1), // Required
  634. PathPattern: aws.String("string"), // Required
  635. TargetOriginId: aws.String("string"), // Required
  636. TrustedSigners: &cloudfront.TrustedSigners{ // Required
  637. Enabled: aws.Bool(true), // Required
  638. Quantity: aws.Int64(1), // Required
  639. Items: []*string{
  640. aws.String("string"), // Required
  641. // More values...
  642. },
  643. },
  644. ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required
  645. AllowedMethods: &cloudfront.AllowedMethods{
  646. Items: []*string{ // Required
  647. aws.String("Method"), // Required
  648. // More values...
  649. },
  650. Quantity: aws.Int64(1), // Required
  651. CachedMethods: &cloudfront.CachedMethods{
  652. Items: []*string{ // Required
  653. aws.String("Method"), // Required
  654. // More values...
  655. },
  656. Quantity: aws.Int64(1), // Required
  657. },
  658. },
  659. DefaultTTL: aws.Int64(1),
  660. MaxTTL: aws.Int64(1),
  661. SmoothStreaming: aws.Bool(true),
  662. },
  663. // More values...
  664. },
  665. },
  666. CustomErrorResponses: &cloudfront.CustomErrorResponses{
  667. Quantity: aws.Int64(1), // Required
  668. Items: []*cloudfront.CustomErrorResponse{
  669. { // Required
  670. ErrorCode: aws.Int64(1), // Required
  671. ErrorCachingMinTTL: aws.Int64(1),
  672. ResponseCode: aws.String("string"),
  673. ResponsePagePath: aws.String("string"),
  674. },
  675. // More values...
  676. },
  677. },
  678. DefaultRootObject: aws.String("string"),
  679. Logging: &cloudfront.LoggingConfig{
  680. Bucket: aws.String("string"), // Required
  681. Enabled: aws.Bool(true), // Required
  682. IncludeCookies: aws.Bool(true), // Required
  683. Prefix: aws.String("string"), // Required
  684. },
  685. PriceClass: aws.String("PriceClass"),
  686. Restrictions: &cloudfront.Restrictions{
  687. GeoRestriction: &cloudfront.GeoRestriction{ // Required
  688. Quantity: aws.Int64(1), // Required
  689. RestrictionType: aws.String("GeoRestrictionType"), // Required
  690. Items: []*string{
  691. aws.String("string"), // Required
  692. // More values...
  693. },
  694. },
  695. },
  696. ViewerCertificate: &cloudfront.ViewerCertificate{
  697. CloudFrontDefaultCertificate: aws.Bool(true),
  698. IAMCertificateId: aws.String("string"),
  699. MinimumProtocolVersion: aws.String("MinimumProtocolVersion"),
  700. SSLSupportMethod: aws.String("SSLSupportMethod"),
  701. },
  702. },
  703. Id: aws.String("string"), // Required
  704. IfMatch: aws.String("string"),
  705. }
  706. resp, err := svc.UpdateDistribution(params)
  707. if err != nil {
  708. // Print the error, cast err to awserr.Error to get the Code and
  709. // Message from an error.
  710. fmt.Println(err.Error())
  711. return
  712. }
  713. // Pretty-print the response data.
  714. fmt.Println(resp)
  715. }
  716. func ExampleCloudFront_UpdateStreamingDistribution() {
  717. svc := cloudfront.New(nil)
  718. params := &cloudfront.UpdateStreamingDistributionInput{
  719. Id: aws.String("string"), // Required
  720. StreamingDistributionConfig: &cloudfront.StreamingDistributionConfig{ // Required
  721. CallerReference: aws.String("string"), // Required
  722. Comment: aws.String("string"), // Required
  723. Enabled: aws.Bool(true), // Required
  724. S3Origin: &cloudfront.S3Origin{ // Required
  725. DomainName: aws.String("string"), // Required
  726. OriginAccessIdentity: aws.String("string"), // Required
  727. },
  728. TrustedSigners: &cloudfront.TrustedSigners{ // Required
  729. Enabled: aws.Bool(true), // Required
  730. Quantity: aws.Int64(1), // Required
  731. Items: []*string{
  732. aws.String("string"), // Required
  733. // More values...
  734. },
  735. },
  736. Aliases: &cloudfront.Aliases{
  737. Quantity: aws.Int64(1), // Required
  738. Items: []*string{
  739. aws.String("string"), // Required
  740. // More values...
  741. },
  742. },
  743. Logging: &cloudfront.StreamingLoggingConfig{
  744. Bucket: aws.String("string"), // Required
  745. Enabled: aws.Bool(true), // Required
  746. Prefix: aws.String("string"), // Required
  747. },
  748. PriceClass: aws.String("PriceClass"),
  749. },
  750. IfMatch: aws.String("string"),
  751. }
  752. resp, err := svc.UpdateStreamingDistribution(params)
  753. if err != nil {
  754. // Print the error, cast err to awserr.Error to get the Code and
  755. // Message from an error.
  756. fmt.Println(err.Error())
  757. return
  758. }
  759. // Pretty-print the response data.
  760. fmt.Println(resp)
  761. }