examples_test.go 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package elb_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/elb"
  10. )
  11. var _ time.Duration
  12. var _ bytes.Buffer
  13. func ExampleELB_AddTags() {
  14. sess, err := session.NewSession()
  15. if err != nil {
  16. fmt.Println("failed to create session,", err)
  17. return
  18. }
  19. svc := elb.New(sess)
  20. params := &elb.AddTagsInput{
  21. LoadBalancerNames: []*string{ // Required
  22. aws.String("AccessPointName"), // Required
  23. // More values...
  24. },
  25. Tags: []*elb.Tag{ // Required
  26. { // Required
  27. Key: aws.String("TagKey"), // Required
  28. Value: aws.String("TagValue"),
  29. },
  30. // More values...
  31. },
  32. }
  33. resp, err := svc.AddTags(params)
  34. if err != nil {
  35. // Print the error, cast err to awserr.Error to get the Code and
  36. // Message from an error.
  37. fmt.Println(err.Error())
  38. return
  39. }
  40. // Pretty-print the response data.
  41. fmt.Println(resp)
  42. }
  43. func ExampleELB_ApplySecurityGroupsToLoadBalancer() {
  44. sess, err := session.NewSession()
  45. if err != nil {
  46. fmt.Println("failed to create session,", err)
  47. return
  48. }
  49. svc := elb.New(sess)
  50. params := &elb.ApplySecurityGroupsToLoadBalancerInput{
  51. LoadBalancerName: aws.String("AccessPointName"), // Required
  52. SecurityGroups: []*string{ // Required
  53. aws.String("SecurityGroupId"), // Required
  54. // More values...
  55. },
  56. }
  57. resp, err := svc.ApplySecurityGroupsToLoadBalancer(params)
  58. if err != nil {
  59. // Print the error, cast err to awserr.Error to get the Code and
  60. // Message from an error.
  61. fmt.Println(err.Error())
  62. return
  63. }
  64. // Pretty-print the response data.
  65. fmt.Println(resp)
  66. }
  67. func ExampleELB_AttachLoadBalancerToSubnets() {
  68. sess, err := session.NewSession()
  69. if err != nil {
  70. fmt.Println("failed to create session,", err)
  71. return
  72. }
  73. svc := elb.New(sess)
  74. params := &elb.AttachLoadBalancerToSubnetsInput{
  75. LoadBalancerName: aws.String("AccessPointName"), // Required
  76. Subnets: []*string{ // Required
  77. aws.String("SubnetId"), // Required
  78. // More values...
  79. },
  80. }
  81. resp, err := svc.AttachLoadBalancerToSubnets(params)
  82. if err != nil {
  83. // Print the error, cast err to awserr.Error to get the Code and
  84. // Message from an error.
  85. fmt.Println(err.Error())
  86. return
  87. }
  88. // Pretty-print the response data.
  89. fmt.Println(resp)
  90. }
  91. func ExampleELB_ConfigureHealthCheck() {
  92. sess, err := session.NewSession()
  93. if err != nil {
  94. fmt.Println("failed to create session,", err)
  95. return
  96. }
  97. svc := elb.New(sess)
  98. params := &elb.ConfigureHealthCheckInput{
  99. HealthCheck: &elb.HealthCheck{ // Required
  100. HealthyThreshold: aws.Int64(1), // Required
  101. Interval: aws.Int64(1), // Required
  102. Target: aws.String("HealthCheckTarget"), // Required
  103. Timeout: aws.Int64(1), // Required
  104. UnhealthyThreshold: aws.Int64(1), // Required
  105. },
  106. LoadBalancerName: aws.String("AccessPointName"), // Required
  107. }
  108. resp, err := svc.ConfigureHealthCheck(params)
  109. if err != nil {
  110. // Print the error, cast err to awserr.Error to get the Code and
  111. // Message from an error.
  112. fmt.Println(err.Error())
  113. return
  114. }
  115. // Pretty-print the response data.
  116. fmt.Println(resp)
  117. }
  118. func ExampleELB_CreateAppCookieStickinessPolicy() {
  119. sess, err := session.NewSession()
  120. if err != nil {
  121. fmt.Println("failed to create session,", err)
  122. return
  123. }
  124. svc := elb.New(sess)
  125. params := &elb.CreateAppCookieStickinessPolicyInput{
  126. CookieName: aws.String("CookieName"), // Required
  127. LoadBalancerName: aws.String("AccessPointName"), // Required
  128. PolicyName: aws.String("PolicyName"), // Required
  129. }
  130. resp, err := svc.CreateAppCookieStickinessPolicy(params)
  131. if err != nil {
  132. // Print the error, cast err to awserr.Error to get the Code and
  133. // Message from an error.
  134. fmt.Println(err.Error())
  135. return
  136. }
  137. // Pretty-print the response data.
  138. fmt.Println(resp)
  139. }
  140. func ExampleELB_CreateLBCookieStickinessPolicy() {
  141. sess, err := session.NewSession()
  142. if err != nil {
  143. fmt.Println("failed to create session,", err)
  144. return
  145. }
  146. svc := elb.New(sess)
  147. params := &elb.CreateLBCookieStickinessPolicyInput{
  148. LoadBalancerName: aws.String("AccessPointName"), // Required
  149. PolicyName: aws.String("PolicyName"), // Required
  150. CookieExpirationPeriod: aws.Int64(1),
  151. }
  152. resp, err := svc.CreateLBCookieStickinessPolicy(params)
  153. if err != nil {
  154. // Print the error, cast err to awserr.Error to get the Code and
  155. // Message from an error.
  156. fmt.Println(err.Error())
  157. return
  158. }
  159. // Pretty-print the response data.
  160. fmt.Println(resp)
  161. }
  162. func ExampleELB_CreateLoadBalancer() {
  163. sess, err := session.NewSession()
  164. if err != nil {
  165. fmt.Println("failed to create session,", err)
  166. return
  167. }
  168. svc := elb.New(sess)
  169. params := &elb.CreateLoadBalancerInput{
  170. Listeners: []*elb.Listener{ // Required
  171. { // Required
  172. InstancePort: aws.Int64(1), // Required
  173. LoadBalancerPort: aws.Int64(1), // Required
  174. Protocol: aws.String("Protocol"), // Required
  175. InstanceProtocol: aws.String("Protocol"),
  176. SSLCertificateId: aws.String("SSLCertificateId"),
  177. },
  178. // More values...
  179. },
  180. LoadBalancerName: aws.String("AccessPointName"), // Required
  181. AvailabilityZones: []*string{
  182. aws.String("AvailabilityZone"), // Required
  183. // More values...
  184. },
  185. Scheme: aws.String("LoadBalancerScheme"),
  186. SecurityGroups: []*string{
  187. aws.String("SecurityGroupId"), // Required
  188. // More values...
  189. },
  190. Subnets: []*string{
  191. aws.String("SubnetId"), // Required
  192. // More values...
  193. },
  194. Tags: []*elb.Tag{
  195. { // Required
  196. Key: aws.String("TagKey"), // Required
  197. Value: aws.String("TagValue"),
  198. },
  199. // More values...
  200. },
  201. }
  202. resp, err := svc.CreateLoadBalancer(params)
  203. if err != nil {
  204. // Print the error, cast err to awserr.Error to get the Code and
  205. // Message from an error.
  206. fmt.Println(err.Error())
  207. return
  208. }
  209. // Pretty-print the response data.
  210. fmt.Println(resp)
  211. }
  212. func ExampleELB_CreateLoadBalancerListeners() {
  213. sess, err := session.NewSession()
  214. if err != nil {
  215. fmt.Println("failed to create session,", err)
  216. return
  217. }
  218. svc := elb.New(sess)
  219. params := &elb.CreateLoadBalancerListenersInput{
  220. Listeners: []*elb.Listener{ // Required
  221. { // Required
  222. InstancePort: aws.Int64(1), // Required
  223. LoadBalancerPort: aws.Int64(1), // Required
  224. Protocol: aws.String("Protocol"), // Required
  225. InstanceProtocol: aws.String("Protocol"),
  226. SSLCertificateId: aws.String("SSLCertificateId"),
  227. },
  228. // More values...
  229. },
  230. LoadBalancerName: aws.String("AccessPointName"), // Required
  231. }
  232. resp, err := svc.CreateLoadBalancerListeners(params)
  233. if err != nil {
  234. // Print the error, cast err to awserr.Error to get the Code and
  235. // Message from an error.
  236. fmt.Println(err.Error())
  237. return
  238. }
  239. // Pretty-print the response data.
  240. fmt.Println(resp)
  241. }
  242. func ExampleELB_CreateLoadBalancerPolicy() {
  243. sess, err := session.NewSession()
  244. if err != nil {
  245. fmt.Println("failed to create session,", err)
  246. return
  247. }
  248. svc := elb.New(sess)
  249. params := &elb.CreateLoadBalancerPolicyInput{
  250. LoadBalancerName: aws.String("AccessPointName"), // Required
  251. PolicyName: aws.String("PolicyName"), // Required
  252. PolicyTypeName: aws.String("PolicyTypeName"), // Required
  253. PolicyAttributes: []*elb.PolicyAttribute{
  254. { // Required
  255. AttributeName: aws.String("AttributeName"),
  256. AttributeValue: aws.String("AttributeValue"),
  257. },
  258. // More values...
  259. },
  260. }
  261. resp, err := svc.CreateLoadBalancerPolicy(params)
  262. if err != nil {
  263. // Print the error, cast err to awserr.Error to get the Code and
  264. // Message from an error.
  265. fmt.Println(err.Error())
  266. return
  267. }
  268. // Pretty-print the response data.
  269. fmt.Println(resp)
  270. }
  271. func ExampleELB_DeleteLoadBalancer() {
  272. sess, err := session.NewSession()
  273. if err != nil {
  274. fmt.Println("failed to create session,", err)
  275. return
  276. }
  277. svc := elb.New(sess)
  278. params := &elb.DeleteLoadBalancerInput{
  279. LoadBalancerName: aws.String("AccessPointName"), // Required
  280. }
  281. resp, err := svc.DeleteLoadBalancer(params)
  282. if err != nil {
  283. // Print the error, cast err to awserr.Error to get the Code and
  284. // Message from an error.
  285. fmt.Println(err.Error())
  286. return
  287. }
  288. // Pretty-print the response data.
  289. fmt.Println(resp)
  290. }
  291. func ExampleELB_DeleteLoadBalancerListeners() {
  292. sess, err := session.NewSession()
  293. if err != nil {
  294. fmt.Println("failed to create session,", err)
  295. return
  296. }
  297. svc := elb.New(sess)
  298. params := &elb.DeleteLoadBalancerListenersInput{
  299. LoadBalancerName: aws.String("AccessPointName"), // Required
  300. LoadBalancerPorts: []*int64{ // Required
  301. aws.Int64(1), // Required
  302. // More values...
  303. },
  304. }
  305. resp, err := svc.DeleteLoadBalancerListeners(params)
  306. if err != nil {
  307. // Print the error, cast err to awserr.Error to get the Code and
  308. // Message from an error.
  309. fmt.Println(err.Error())
  310. return
  311. }
  312. // Pretty-print the response data.
  313. fmt.Println(resp)
  314. }
  315. func ExampleELB_DeleteLoadBalancerPolicy() {
  316. sess, err := session.NewSession()
  317. if err != nil {
  318. fmt.Println("failed to create session,", err)
  319. return
  320. }
  321. svc := elb.New(sess)
  322. params := &elb.DeleteLoadBalancerPolicyInput{
  323. LoadBalancerName: aws.String("AccessPointName"), // Required
  324. PolicyName: aws.String("PolicyName"), // Required
  325. }
  326. resp, err := svc.DeleteLoadBalancerPolicy(params)
  327. if err != nil {
  328. // Print the error, cast err to awserr.Error to get the Code and
  329. // Message from an error.
  330. fmt.Println(err.Error())
  331. return
  332. }
  333. // Pretty-print the response data.
  334. fmt.Println(resp)
  335. }
  336. func ExampleELB_DeregisterInstancesFromLoadBalancer() {
  337. sess, err := session.NewSession()
  338. if err != nil {
  339. fmt.Println("failed to create session,", err)
  340. return
  341. }
  342. svc := elb.New(sess)
  343. params := &elb.DeregisterInstancesFromLoadBalancerInput{
  344. Instances: []*elb.Instance{ // Required
  345. { // Required
  346. InstanceId: aws.String("InstanceId"),
  347. },
  348. // More values...
  349. },
  350. LoadBalancerName: aws.String("AccessPointName"), // Required
  351. }
  352. resp, err := svc.DeregisterInstancesFromLoadBalancer(params)
  353. if err != nil {
  354. // Print the error, cast err to awserr.Error to get the Code and
  355. // Message from an error.
  356. fmt.Println(err.Error())
  357. return
  358. }
  359. // Pretty-print the response data.
  360. fmt.Println(resp)
  361. }
  362. func ExampleELB_DescribeInstanceHealth() {
  363. sess, err := session.NewSession()
  364. if err != nil {
  365. fmt.Println("failed to create session,", err)
  366. return
  367. }
  368. svc := elb.New(sess)
  369. params := &elb.DescribeInstanceHealthInput{
  370. LoadBalancerName: aws.String("AccessPointName"), // Required
  371. Instances: []*elb.Instance{
  372. { // Required
  373. InstanceId: aws.String("InstanceId"),
  374. },
  375. // More values...
  376. },
  377. }
  378. resp, err := svc.DescribeInstanceHealth(params)
  379. if err != nil {
  380. // Print the error, cast err to awserr.Error to get the Code and
  381. // Message from an error.
  382. fmt.Println(err.Error())
  383. return
  384. }
  385. // Pretty-print the response data.
  386. fmt.Println(resp)
  387. }
  388. func ExampleELB_DescribeLoadBalancerAttributes() {
  389. sess, err := session.NewSession()
  390. if err != nil {
  391. fmt.Println("failed to create session,", err)
  392. return
  393. }
  394. svc := elb.New(sess)
  395. params := &elb.DescribeLoadBalancerAttributesInput{
  396. LoadBalancerName: aws.String("AccessPointName"), // Required
  397. }
  398. resp, err := svc.DescribeLoadBalancerAttributes(params)
  399. if err != nil {
  400. // Print the error, cast err to awserr.Error to get the Code and
  401. // Message from an error.
  402. fmt.Println(err.Error())
  403. return
  404. }
  405. // Pretty-print the response data.
  406. fmt.Println(resp)
  407. }
  408. func ExampleELB_DescribeLoadBalancerPolicies() {
  409. sess, err := session.NewSession()
  410. if err != nil {
  411. fmt.Println("failed to create session,", err)
  412. return
  413. }
  414. svc := elb.New(sess)
  415. params := &elb.DescribeLoadBalancerPoliciesInput{
  416. LoadBalancerName: aws.String("AccessPointName"),
  417. PolicyNames: []*string{
  418. aws.String("PolicyName"), // Required
  419. // More values...
  420. },
  421. }
  422. resp, err := svc.DescribeLoadBalancerPolicies(params)
  423. if err != nil {
  424. // Print the error, cast err to awserr.Error to get the Code and
  425. // Message from an error.
  426. fmt.Println(err.Error())
  427. return
  428. }
  429. // Pretty-print the response data.
  430. fmt.Println(resp)
  431. }
  432. func ExampleELB_DescribeLoadBalancerPolicyTypes() {
  433. sess, err := session.NewSession()
  434. if err != nil {
  435. fmt.Println("failed to create session,", err)
  436. return
  437. }
  438. svc := elb.New(sess)
  439. params := &elb.DescribeLoadBalancerPolicyTypesInput{
  440. PolicyTypeNames: []*string{
  441. aws.String("PolicyTypeName"), // Required
  442. // More values...
  443. },
  444. }
  445. resp, err := svc.DescribeLoadBalancerPolicyTypes(params)
  446. if err != nil {
  447. // Print the error, cast err to awserr.Error to get the Code and
  448. // Message from an error.
  449. fmt.Println(err.Error())
  450. return
  451. }
  452. // Pretty-print the response data.
  453. fmt.Println(resp)
  454. }
  455. func ExampleELB_DescribeLoadBalancers() {
  456. sess, err := session.NewSession()
  457. if err != nil {
  458. fmt.Println("failed to create session,", err)
  459. return
  460. }
  461. svc := elb.New(sess)
  462. params := &elb.DescribeLoadBalancersInput{
  463. LoadBalancerNames: []*string{
  464. aws.String("AccessPointName"), // Required
  465. // More values...
  466. },
  467. Marker: aws.String("Marker"),
  468. PageSize: aws.Int64(1),
  469. }
  470. resp, err := svc.DescribeLoadBalancers(params)
  471. if err != nil {
  472. // Print the error, cast err to awserr.Error to get the Code and
  473. // Message from an error.
  474. fmt.Println(err.Error())
  475. return
  476. }
  477. // Pretty-print the response data.
  478. fmt.Println(resp)
  479. }
  480. func ExampleELB_DescribeTags() {
  481. sess, err := session.NewSession()
  482. if err != nil {
  483. fmt.Println("failed to create session,", err)
  484. return
  485. }
  486. svc := elb.New(sess)
  487. params := &elb.DescribeTagsInput{
  488. LoadBalancerNames: []*string{ // Required
  489. aws.String("AccessPointName"), // Required
  490. // More values...
  491. },
  492. }
  493. resp, err := svc.DescribeTags(params)
  494. if err != nil {
  495. // Print the error, cast err to awserr.Error to get the Code and
  496. // Message from an error.
  497. fmt.Println(err.Error())
  498. return
  499. }
  500. // Pretty-print the response data.
  501. fmt.Println(resp)
  502. }
  503. func ExampleELB_DetachLoadBalancerFromSubnets() {
  504. sess, err := session.NewSession()
  505. if err != nil {
  506. fmt.Println("failed to create session,", err)
  507. return
  508. }
  509. svc := elb.New(sess)
  510. params := &elb.DetachLoadBalancerFromSubnetsInput{
  511. LoadBalancerName: aws.String("AccessPointName"), // Required
  512. Subnets: []*string{ // Required
  513. aws.String("SubnetId"), // Required
  514. // More values...
  515. },
  516. }
  517. resp, err := svc.DetachLoadBalancerFromSubnets(params)
  518. if err != nil {
  519. // Print the error, cast err to awserr.Error to get the Code and
  520. // Message from an error.
  521. fmt.Println(err.Error())
  522. return
  523. }
  524. // Pretty-print the response data.
  525. fmt.Println(resp)
  526. }
  527. func ExampleELB_DisableAvailabilityZonesForLoadBalancer() {
  528. sess, err := session.NewSession()
  529. if err != nil {
  530. fmt.Println("failed to create session,", err)
  531. return
  532. }
  533. svc := elb.New(sess)
  534. params := &elb.DisableAvailabilityZonesForLoadBalancerInput{
  535. AvailabilityZones: []*string{ // Required
  536. aws.String("AvailabilityZone"), // Required
  537. // More values...
  538. },
  539. LoadBalancerName: aws.String("AccessPointName"), // Required
  540. }
  541. resp, err := svc.DisableAvailabilityZonesForLoadBalancer(params)
  542. if err != nil {
  543. // Print the error, cast err to awserr.Error to get the Code and
  544. // Message from an error.
  545. fmt.Println(err.Error())
  546. return
  547. }
  548. // Pretty-print the response data.
  549. fmt.Println(resp)
  550. }
  551. func ExampleELB_EnableAvailabilityZonesForLoadBalancer() {
  552. sess, err := session.NewSession()
  553. if err != nil {
  554. fmt.Println("failed to create session,", err)
  555. return
  556. }
  557. svc := elb.New(sess)
  558. params := &elb.EnableAvailabilityZonesForLoadBalancerInput{
  559. AvailabilityZones: []*string{ // Required
  560. aws.String("AvailabilityZone"), // Required
  561. // More values...
  562. },
  563. LoadBalancerName: aws.String("AccessPointName"), // Required
  564. }
  565. resp, err := svc.EnableAvailabilityZonesForLoadBalancer(params)
  566. if err != nil {
  567. // Print the error, cast err to awserr.Error to get the Code and
  568. // Message from an error.
  569. fmt.Println(err.Error())
  570. return
  571. }
  572. // Pretty-print the response data.
  573. fmt.Println(resp)
  574. }
  575. func ExampleELB_ModifyLoadBalancerAttributes() {
  576. sess, err := session.NewSession()
  577. if err != nil {
  578. fmt.Println("failed to create session,", err)
  579. return
  580. }
  581. svc := elb.New(sess)
  582. params := &elb.ModifyLoadBalancerAttributesInput{
  583. LoadBalancerAttributes: &elb.LoadBalancerAttributes{ // Required
  584. AccessLog: &elb.AccessLog{
  585. Enabled: aws.Bool(true), // Required
  586. EmitInterval: aws.Int64(1),
  587. S3BucketName: aws.String("S3BucketName"),
  588. S3BucketPrefix: aws.String("AccessLogPrefix"),
  589. },
  590. AdditionalAttributes: []*elb.AdditionalAttribute{
  591. { // Required
  592. Key: aws.String("AdditionalAttributeKey"),
  593. Value: aws.String("AdditionalAttributeValue"),
  594. },
  595. // More values...
  596. },
  597. ConnectionDraining: &elb.ConnectionDraining{
  598. Enabled: aws.Bool(true), // Required
  599. Timeout: aws.Int64(1),
  600. },
  601. ConnectionSettings: &elb.ConnectionSettings{
  602. IdleTimeout: aws.Int64(1), // Required
  603. },
  604. CrossZoneLoadBalancing: &elb.CrossZoneLoadBalancing{
  605. Enabled: aws.Bool(true), // Required
  606. },
  607. },
  608. LoadBalancerName: aws.String("AccessPointName"), // Required
  609. }
  610. resp, err := svc.ModifyLoadBalancerAttributes(params)
  611. if err != nil {
  612. // Print the error, cast err to awserr.Error to get the Code and
  613. // Message from an error.
  614. fmt.Println(err.Error())
  615. return
  616. }
  617. // Pretty-print the response data.
  618. fmt.Println(resp)
  619. }
  620. func ExampleELB_RegisterInstancesWithLoadBalancer() {
  621. sess, err := session.NewSession()
  622. if err != nil {
  623. fmt.Println("failed to create session,", err)
  624. return
  625. }
  626. svc := elb.New(sess)
  627. params := &elb.RegisterInstancesWithLoadBalancerInput{
  628. Instances: []*elb.Instance{ // Required
  629. { // Required
  630. InstanceId: aws.String("InstanceId"),
  631. },
  632. // More values...
  633. },
  634. LoadBalancerName: aws.String("AccessPointName"), // Required
  635. }
  636. resp, err := svc.RegisterInstancesWithLoadBalancer(params)
  637. if err != nil {
  638. // Print the error, cast err to awserr.Error to get the Code and
  639. // Message from an error.
  640. fmt.Println(err.Error())
  641. return
  642. }
  643. // Pretty-print the response data.
  644. fmt.Println(resp)
  645. }
  646. func ExampleELB_RemoveTags() {
  647. sess, err := session.NewSession()
  648. if err != nil {
  649. fmt.Println("failed to create session,", err)
  650. return
  651. }
  652. svc := elb.New(sess)
  653. params := &elb.RemoveTagsInput{
  654. LoadBalancerNames: []*string{ // Required
  655. aws.String("AccessPointName"), // Required
  656. // More values...
  657. },
  658. Tags: []*elb.TagKeyOnly{ // Required
  659. { // Required
  660. Key: aws.String("TagKey"),
  661. },
  662. // More values...
  663. },
  664. }
  665. resp, err := svc.RemoveTags(params)
  666. if err != nil {
  667. // Print the error, cast err to awserr.Error to get the Code and
  668. // Message from an error.
  669. fmt.Println(err.Error())
  670. return
  671. }
  672. // Pretty-print the response data.
  673. fmt.Println(resp)
  674. }
  675. func ExampleELB_SetLoadBalancerListenerSSLCertificate() {
  676. sess, err := session.NewSession()
  677. if err != nil {
  678. fmt.Println("failed to create session,", err)
  679. return
  680. }
  681. svc := elb.New(sess)
  682. params := &elb.SetLoadBalancerListenerSSLCertificateInput{
  683. LoadBalancerName: aws.String("AccessPointName"), // Required
  684. LoadBalancerPort: aws.Int64(1), // Required
  685. SSLCertificateId: aws.String("SSLCertificateId"), // Required
  686. }
  687. resp, err := svc.SetLoadBalancerListenerSSLCertificate(params)
  688. if err != nil {
  689. // Print the error, cast err to awserr.Error to get the Code and
  690. // Message from an error.
  691. fmt.Println(err.Error())
  692. return
  693. }
  694. // Pretty-print the response data.
  695. fmt.Println(resp)
  696. }
  697. func ExampleELB_SetLoadBalancerPoliciesForBackendServer() {
  698. sess, err := session.NewSession()
  699. if err != nil {
  700. fmt.Println("failed to create session,", err)
  701. return
  702. }
  703. svc := elb.New(sess)
  704. params := &elb.SetLoadBalancerPoliciesForBackendServerInput{
  705. InstancePort: aws.Int64(1), // Required
  706. LoadBalancerName: aws.String("AccessPointName"), // Required
  707. PolicyNames: []*string{ // Required
  708. aws.String("PolicyName"), // Required
  709. // More values...
  710. },
  711. }
  712. resp, err := svc.SetLoadBalancerPoliciesForBackendServer(params)
  713. if err != nil {
  714. // Print the error, cast err to awserr.Error to get the Code and
  715. // Message from an error.
  716. fmt.Println(err.Error())
  717. return
  718. }
  719. // Pretty-print the response data.
  720. fmt.Println(resp)
  721. }
  722. func ExampleELB_SetLoadBalancerPoliciesOfListener() {
  723. sess, err := session.NewSession()
  724. if err != nil {
  725. fmt.Println("failed to create session,", err)
  726. return
  727. }
  728. svc := elb.New(sess)
  729. params := &elb.SetLoadBalancerPoliciesOfListenerInput{
  730. LoadBalancerName: aws.String("AccessPointName"), // Required
  731. LoadBalancerPort: aws.Int64(1), // Required
  732. PolicyNames: []*string{ // Required
  733. aws.String("PolicyName"), // Required
  734. // More values...
  735. },
  736. }
  737. resp, err := svc.SetLoadBalancerPoliciesOfListener(params)
  738. if err != nil {
  739. // Print the error, cast err to awserr.Error to get the Code and
  740. // Message from an error.
  741. fmt.Println(err.Error())
  742. return
  743. }
  744. // Pretty-print the response data.
  745. fmt.Println(resp)
  746. }