examples_test.go 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package directconnect_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/directconnect"
  9. )
  10. var _ time.Duration
  11. var _ bytes.Buffer
  12. func ExampleDirectConnect_AllocateConnectionOnInterconnect() {
  13. svc := directconnect.New(nil)
  14. params := &directconnect.AllocateConnectionOnInterconnectInput{
  15. Bandwidth: aws.String("Bandwidth"), // Required
  16. ConnectionName: aws.String("ConnectionName"), // Required
  17. InterconnectId: aws.String("InterconnectId"), // Required
  18. OwnerAccount: aws.String("OwnerAccount"), // Required
  19. Vlan: aws.Int64(1), // Required
  20. }
  21. resp, err := svc.AllocateConnectionOnInterconnect(params)
  22. if err != nil {
  23. // Print the error, cast err to awserr.Error to get the Code and
  24. // Message from an error.
  25. fmt.Println(err.Error())
  26. return
  27. }
  28. // Pretty-print the response data.
  29. fmt.Println(resp)
  30. }
  31. func ExampleDirectConnect_AllocatePrivateVirtualInterface() {
  32. svc := directconnect.New(nil)
  33. params := &directconnect.AllocatePrivateVirtualInterfaceInput{
  34. ConnectionId: aws.String("ConnectionId"), // Required
  35. NewPrivateVirtualInterfaceAllocation: &directconnect.NewPrivateVirtualInterfaceAllocation{ // Required
  36. Asn: aws.Int64(1), // Required
  37. VirtualInterfaceName: aws.String("VirtualInterfaceName"), // Required
  38. Vlan: aws.Int64(1), // Required
  39. AmazonAddress: aws.String("AmazonAddress"),
  40. AuthKey: aws.String("BGPAuthKey"),
  41. CustomerAddress: aws.String("CustomerAddress"),
  42. },
  43. OwnerAccount: aws.String("OwnerAccount"), // Required
  44. }
  45. resp, err := svc.AllocatePrivateVirtualInterface(params)
  46. if err != nil {
  47. // Print the error, cast err to awserr.Error to get the Code and
  48. // Message from an error.
  49. fmt.Println(err.Error())
  50. return
  51. }
  52. // Pretty-print the response data.
  53. fmt.Println(resp)
  54. }
  55. func ExampleDirectConnect_AllocatePublicVirtualInterface() {
  56. svc := directconnect.New(nil)
  57. params := &directconnect.AllocatePublicVirtualInterfaceInput{
  58. ConnectionId: aws.String("ConnectionId"), // Required
  59. NewPublicVirtualInterfaceAllocation: &directconnect.NewPublicVirtualInterfaceAllocation{ // Required
  60. AmazonAddress: aws.String("AmazonAddress"), // Required
  61. Asn: aws.Int64(1), // Required
  62. CustomerAddress: aws.String("CustomerAddress"), // Required
  63. RouteFilterPrefixes: []*directconnect.RouteFilterPrefix{ // Required
  64. { // Required
  65. Cidr: aws.String("CIDR"),
  66. },
  67. // More values...
  68. },
  69. VirtualInterfaceName: aws.String("VirtualInterfaceName"), // Required
  70. Vlan: aws.Int64(1), // Required
  71. AuthKey: aws.String("BGPAuthKey"),
  72. },
  73. OwnerAccount: aws.String("OwnerAccount"), // Required
  74. }
  75. resp, err := svc.AllocatePublicVirtualInterface(params)
  76. if err != nil {
  77. // Print the error, cast err to awserr.Error to get the Code and
  78. // Message from an error.
  79. fmt.Println(err.Error())
  80. return
  81. }
  82. // Pretty-print the response data.
  83. fmt.Println(resp)
  84. }
  85. func ExampleDirectConnect_ConfirmConnection() {
  86. svc := directconnect.New(nil)
  87. params := &directconnect.ConfirmConnectionInput{
  88. ConnectionId: aws.String("ConnectionId"), // Required
  89. }
  90. resp, err := svc.ConfirmConnection(params)
  91. if err != nil {
  92. // Print the error, cast err to awserr.Error to get the Code and
  93. // Message from an error.
  94. fmt.Println(err.Error())
  95. return
  96. }
  97. // Pretty-print the response data.
  98. fmt.Println(resp)
  99. }
  100. func ExampleDirectConnect_ConfirmPrivateVirtualInterface() {
  101. svc := directconnect.New(nil)
  102. params := &directconnect.ConfirmPrivateVirtualInterfaceInput{
  103. VirtualGatewayId: aws.String("VirtualGatewayId"), // Required
  104. VirtualInterfaceId: aws.String("VirtualInterfaceId"), // Required
  105. }
  106. resp, err := svc.ConfirmPrivateVirtualInterface(params)
  107. if err != nil {
  108. // Print the error, cast err to awserr.Error to get the Code and
  109. // Message from an error.
  110. fmt.Println(err.Error())
  111. return
  112. }
  113. // Pretty-print the response data.
  114. fmt.Println(resp)
  115. }
  116. func ExampleDirectConnect_ConfirmPublicVirtualInterface() {
  117. svc := directconnect.New(nil)
  118. params := &directconnect.ConfirmPublicVirtualInterfaceInput{
  119. VirtualInterfaceId: aws.String("VirtualInterfaceId"), // Required
  120. }
  121. resp, err := svc.ConfirmPublicVirtualInterface(params)
  122. if err != nil {
  123. // Print the error, cast err to awserr.Error to get the Code and
  124. // Message from an error.
  125. fmt.Println(err.Error())
  126. return
  127. }
  128. // Pretty-print the response data.
  129. fmt.Println(resp)
  130. }
  131. func ExampleDirectConnect_CreateConnection() {
  132. svc := directconnect.New(nil)
  133. params := &directconnect.CreateConnectionInput{
  134. Bandwidth: aws.String("Bandwidth"), // Required
  135. ConnectionName: aws.String("ConnectionName"), // Required
  136. Location: aws.String("LocationCode"), // Required
  137. }
  138. resp, err := svc.CreateConnection(params)
  139. if err != nil {
  140. // Print the error, cast err to awserr.Error to get the Code and
  141. // Message from an error.
  142. fmt.Println(err.Error())
  143. return
  144. }
  145. // Pretty-print the response data.
  146. fmt.Println(resp)
  147. }
  148. func ExampleDirectConnect_CreateInterconnect() {
  149. svc := directconnect.New(nil)
  150. params := &directconnect.CreateInterconnectInput{
  151. Bandwidth: aws.String("Bandwidth"), // Required
  152. InterconnectName: aws.String("InterconnectName"), // Required
  153. Location: aws.String("LocationCode"), // Required
  154. }
  155. resp, err := svc.CreateInterconnect(params)
  156. if err != nil {
  157. // Print the error, cast err to awserr.Error to get the Code and
  158. // Message from an error.
  159. fmt.Println(err.Error())
  160. return
  161. }
  162. // Pretty-print the response data.
  163. fmt.Println(resp)
  164. }
  165. func ExampleDirectConnect_CreatePrivateVirtualInterface() {
  166. svc := directconnect.New(nil)
  167. params := &directconnect.CreatePrivateVirtualInterfaceInput{
  168. ConnectionId: aws.String("ConnectionId"), // Required
  169. NewPrivateVirtualInterface: &directconnect.NewPrivateVirtualInterface{ // Required
  170. Asn: aws.Int64(1), // Required
  171. VirtualGatewayId: aws.String("VirtualGatewayId"), // Required
  172. VirtualInterfaceName: aws.String("VirtualInterfaceName"), // Required
  173. Vlan: aws.Int64(1), // Required
  174. AmazonAddress: aws.String("AmazonAddress"),
  175. AuthKey: aws.String("BGPAuthKey"),
  176. CustomerAddress: aws.String("CustomerAddress"),
  177. },
  178. }
  179. resp, err := svc.CreatePrivateVirtualInterface(params)
  180. if err != nil {
  181. // Print the error, cast err to awserr.Error to get the Code and
  182. // Message from an error.
  183. fmt.Println(err.Error())
  184. return
  185. }
  186. // Pretty-print the response data.
  187. fmt.Println(resp)
  188. }
  189. func ExampleDirectConnect_CreatePublicVirtualInterface() {
  190. svc := directconnect.New(nil)
  191. params := &directconnect.CreatePublicVirtualInterfaceInput{
  192. ConnectionId: aws.String("ConnectionId"), // Required
  193. NewPublicVirtualInterface: &directconnect.NewPublicVirtualInterface{ // Required
  194. AmazonAddress: aws.String("AmazonAddress"), // Required
  195. Asn: aws.Int64(1), // Required
  196. CustomerAddress: aws.String("CustomerAddress"), // Required
  197. RouteFilterPrefixes: []*directconnect.RouteFilterPrefix{ // Required
  198. { // Required
  199. Cidr: aws.String("CIDR"),
  200. },
  201. // More values...
  202. },
  203. VirtualInterfaceName: aws.String("VirtualInterfaceName"), // Required
  204. Vlan: aws.Int64(1), // Required
  205. AuthKey: aws.String("BGPAuthKey"),
  206. },
  207. }
  208. resp, err := svc.CreatePublicVirtualInterface(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 ExampleDirectConnect_DeleteConnection() {
  219. svc := directconnect.New(nil)
  220. params := &directconnect.DeleteConnectionInput{
  221. ConnectionId: aws.String("ConnectionId"), // Required
  222. }
  223. resp, err := svc.DeleteConnection(params)
  224. if err != nil {
  225. // Print the error, cast err to awserr.Error to get the Code and
  226. // Message from an error.
  227. fmt.Println(err.Error())
  228. return
  229. }
  230. // Pretty-print the response data.
  231. fmt.Println(resp)
  232. }
  233. func ExampleDirectConnect_DeleteInterconnect() {
  234. svc := directconnect.New(nil)
  235. params := &directconnect.DeleteInterconnectInput{
  236. InterconnectId: aws.String("InterconnectId"), // Required
  237. }
  238. resp, err := svc.DeleteInterconnect(params)
  239. if err != nil {
  240. // Print the error, cast err to awserr.Error to get the Code and
  241. // Message from an error.
  242. fmt.Println(err.Error())
  243. return
  244. }
  245. // Pretty-print the response data.
  246. fmt.Println(resp)
  247. }
  248. func ExampleDirectConnect_DeleteVirtualInterface() {
  249. svc := directconnect.New(nil)
  250. params := &directconnect.DeleteVirtualInterfaceInput{
  251. VirtualInterfaceId: aws.String("VirtualInterfaceId"), // Required
  252. }
  253. resp, err := svc.DeleteVirtualInterface(params)
  254. if err != nil {
  255. // Print the error, cast err to awserr.Error to get the Code and
  256. // Message from an error.
  257. fmt.Println(err.Error())
  258. return
  259. }
  260. // Pretty-print the response data.
  261. fmt.Println(resp)
  262. }
  263. func ExampleDirectConnect_DescribeConnections() {
  264. svc := directconnect.New(nil)
  265. params := &directconnect.DescribeConnectionsInput{
  266. ConnectionId: aws.String("ConnectionId"),
  267. }
  268. resp, err := svc.DescribeConnections(params)
  269. if err != nil {
  270. // Print the error, cast err to awserr.Error to get the Code and
  271. // Message from an error.
  272. fmt.Println(err.Error())
  273. return
  274. }
  275. // Pretty-print the response data.
  276. fmt.Println(resp)
  277. }
  278. func ExampleDirectConnect_DescribeConnectionsOnInterconnect() {
  279. svc := directconnect.New(nil)
  280. params := &directconnect.DescribeConnectionsOnInterconnectInput{
  281. InterconnectId: aws.String("InterconnectId"), // Required
  282. }
  283. resp, err := svc.DescribeConnectionsOnInterconnect(params)
  284. if err != nil {
  285. // Print the error, cast err to awserr.Error to get the Code and
  286. // Message from an error.
  287. fmt.Println(err.Error())
  288. return
  289. }
  290. // Pretty-print the response data.
  291. fmt.Println(resp)
  292. }
  293. func ExampleDirectConnect_DescribeInterconnects() {
  294. svc := directconnect.New(nil)
  295. params := &directconnect.DescribeInterconnectsInput{
  296. InterconnectId: aws.String("InterconnectId"),
  297. }
  298. resp, err := svc.DescribeInterconnects(params)
  299. if err != nil {
  300. // Print the error, cast err to awserr.Error to get the Code and
  301. // Message from an error.
  302. fmt.Println(err.Error())
  303. return
  304. }
  305. // Pretty-print the response data.
  306. fmt.Println(resp)
  307. }
  308. func ExampleDirectConnect_DescribeLocations() {
  309. svc := directconnect.New(nil)
  310. var params *directconnect.DescribeLocationsInput
  311. resp, err := svc.DescribeLocations(params)
  312. if err != nil {
  313. // Print the error, cast err to awserr.Error to get the Code and
  314. // Message from an error.
  315. fmt.Println(err.Error())
  316. return
  317. }
  318. // Pretty-print the response data.
  319. fmt.Println(resp)
  320. }
  321. func ExampleDirectConnect_DescribeVirtualGateways() {
  322. svc := directconnect.New(nil)
  323. var params *directconnect.DescribeVirtualGatewaysInput
  324. resp, err := svc.DescribeVirtualGateways(params)
  325. if err != nil {
  326. // Print the error, cast err to awserr.Error to get the Code and
  327. // Message from an error.
  328. fmt.Println(err.Error())
  329. return
  330. }
  331. // Pretty-print the response data.
  332. fmt.Println(resp)
  333. }
  334. func ExampleDirectConnect_DescribeVirtualInterfaces() {
  335. svc := directconnect.New(nil)
  336. params := &directconnect.DescribeVirtualInterfacesInput{
  337. ConnectionId: aws.String("ConnectionId"),
  338. VirtualInterfaceId: aws.String("VirtualInterfaceId"),
  339. }
  340. resp, err := svc.DescribeVirtualInterfaces(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. }