examples_test.go 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package directoryservice_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/directoryservice"
  9. )
  10. var _ time.Duration
  11. var _ bytes.Buffer
  12. func ExampleDirectoryService_ConnectDirectory() {
  13. svc := directoryservice.New(nil)
  14. params := &directoryservice.ConnectDirectoryInput{
  15. ConnectSettings: &directoryservice.DirectoryConnectSettings{ // Required
  16. CustomerDnsIps: []*string{ // Required
  17. aws.String("IpAddr"), // Required
  18. // More values...
  19. },
  20. CustomerUserName: aws.String("UserName"), // Required
  21. SubnetIds: []*string{ // Required
  22. aws.String("SubnetId"), // Required
  23. // More values...
  24. },
  25. VpcId: aws.String("VpcId"), // Required
  26. },
  27. Name: aws.String("DirectoryName"), // Required
  28. Password: aws.String("ConnectPassword"), // Required
  29. Size: aws.String("DirectorySize"), // Required
  30. Description: aws.String("Description"),
  31. ShortName: aws.String("DirectoryShortName"),
  32. }
  33. resp, err := svc.ConnectDirectory(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 ExampleDirectoryService_CreateAlias() {
  44. svc := directoryservice.New(nil)
  45. params := &directoryservice.CreateAliasInput{
  46. Alias: aws.String("AliasName"), // Required
  47. DirectoryId: aws.String("DirectoryId"), // Required
  48. }
  49. resp, err := svc.CreateAlias(params)
  50. if err != nil {
  51. // Print the error, cast err to awserr.Error to get the Code and
  52. // Message from an error.
  53. fmt.Println(err.Error())
  54. return
  55. }
  56. // Pretty-print the response data.
  57. fmt.Println(resp)
  58. }
  59. func ExampleDirectoryService_CreateComputer() {
  60. svc := directoryservice.New(nil)
  61. params := &directoryservice.CreateComputerInput{
  62. ComputerName: aws.String("ComputerName"), // Required
  63. DirectoryId: aws.String("DirectoryId"), // Required
  64. Password: aws.String("ComputerPassword"), // Required
  65. ComputerAttributes: []*directoryservice.Attribute{
  66. { // Required
  67. Name: aws.String("AttributeName"),
  68. Value: aws.String("AttributeValue"),
  69. },
  70. // More values...
  71. },
  72. OrganizationalUnitDistinguishedName: aws.String("OrganizationalUnitDN"),
  73. }
  74. resp, err := svc.CreateComputer(params)
  75. if err != nil {
  76. // Print the error, cast err to awserr.Error to get the Code and
  77. // Message from an error.
  78. fmt.Println(err.Error())
  79. return
  80. }
  81. // Pretty-print the response data.
  82. fmt.Println(resp)
  83. }
  84. func ExampleDirectoryService_CreateDirectory() {
  85. svc := directoryservice.New(nil)
  86. params := &directoryservice.CreateDirectoryInput{
  87. Name: aws.String("DirectoryName"), // Required
  88. Password: aws.String("Password"), // Required
  89. Size: aws.String("DirectorySize"), // Required
  90. Description: aws.String("Description"),
  91. ShortName: aws.String("DirectoryShortName"),
  92. VpcSettings: &directoryservice.DirectoryVpcSettings{
  93. SubnetIds: []*string{ // Required
  94. aws.String("SubnetId"), // Required
  95. // More values...
  96. },
  97. VpcId: aws.String("VpcId"), // Required
  98. },
  99. }
  100. resp, err := svc.CreateDirectory(params)
  101. if err != nil {
  102. // Print the error, cast err to awserr.Error to get the Code and
  103. // Message from an error.
  104. fmt.Println(err.Error())
  105. return
  106. }
  107. // Pretty-print the response data.
  108. fmt.Println(resp)
  109. }
  110. func ExampleDirectoryService_CreateSnapshot() {
  111. svc := directoryservice.New(nil)
  112. params := &directoryservice.CreateSnapshotInput{
  113. DirectoryId: aws.String("DirectoryId"), // Required
  114. Name: aws.String("SnapshotName"),
  115. }
  116. resp, err := svc.CreateSnapshot(params)
  117. if err != nil {
  118. // Print the error, cast err to awserr.Error to get the Code and
  119. // Message from an error.
  120. fmt.Println(err.Error())
  121. return
  122. }
  123. // Pretty-print the response data.
  124. fmt.Println(resp)
  125. }
  126. func ExampleDirectoryService_DeleteDirectory() {
  127. svc := directoryservice.New(nil)
  128. params := &directoryservice.DeleteDirectoryInput{
  129. DirectoryId: aws.String("DirectoryId"), // Required
  130. }
  131. resp, err := svc.DeleteDirectory(params)
  132. if err != nil {
  133. // Print the error, cast err to awserr.Error to get the Code and
  134. // Message from an error.
  135. fmt.Println(err.Error())
  136. return
  137. }
  138. // Pretty-print the response data.
  139. fmt.Println(resp)
  140. }
  141. func ExampleDirectoryService_DeleteSnapshot() {
  142. svc := directoryservice.New(nil)
  143. params := &directoryservice.DeleteSnapshotInput{
  144. SnapshotId: aws.String("SnapshotId"), // Required
  145. }
  146. resp, err := svc.DeleteSnapshot(params)
  147. if err != nil {
  148. // Print the error, cast err to awserr.Error to get the Code and
  149. // Message from an error.
  150. fmt.Println(err.Error())
  151. return
  152. }
  153. // Pretty-print the response data.
  154. fmt.Println(resp)
  155. }
  156. func ExampleDirectoryService_DescribeDirectories() {
  157. svc := directoryservice.New(nil)
  158. params := &directoryservice.DescribeDirectoriesInput{
  159. DirectoryIds: []*string{
  160. aws.String("DirectoryId"), // Required
  161. // More values...
  162. },
  163. Limit: aws.Int64(1),
  164. NextToken: aws.String("NextToken"),
  165. }
  166. resp, err := svc.DescribeDirectories(params)
  167. if err != nil {
  168. // Print the error, cast err to awserr.Error to get the Code and
  169. // Message from an error.
  170. fmt.Println(err.Error())
  171. return
  172. }
  173. // Pretty-print the response data.
  174. fmt.Println(resp)
  175. }
  176. func ExampleDirectoryService_DescribeSnapshots() {
  177. svc := directoryservice.New(nil)
  178. params := &directoryservice.DescribeSnapshotsInput{
  179. DirectoryId: aws.String("DirectoryId"),
  180. Limit: aws.Int64(1),
  181. NextToken: aws.String("NextToken"),
  182. SnapshotIds: []*string{
  183. aws.String("SnapshotId"), // Required
  184. // More values...
  185. },
  186. }
  187. resp, err := svc.DescribeSnapshots(params)
  188. if err != nil {
  189. // Print the error, cast err to awserr.Error to get the Code and
  190. // Message from an error.
  191. fmt.Println(err.Error())
  192. return
  193. }
  194. // Pretty-print the response data.
  195. fmt.Println(resp)
  196. }
  197. func ExampleDirectoryService_DisableRadius() {
  198. svc := directoryservice.New(nil)
  199. params := &directoryservice.DisableRadiusInput{
  200. DirectoryId: aws.String("DirectoryId"), // Required
  201. }
  202. resp, err := svc.DisableRadius(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 ExampleDirectoryService_DisableSso() {
  213. svc := directoryservice.New(nil)
  214. params := &directoryservice.DisableSsoInput{
  215. DirectoryId: aws.String("DirectoryId"), // Required
  216. Password: aws.String("ConnectPassword"),
  217. UserName: aws.String("UserName"),
  218. }
  219. resp, err := svc.DisableSso(params)
  220. if err != nil {
  221. // Print the error, cast err to awserr.Error to get the Code and
  222. // Message from an error.
  223. fmt.Println(err.Error())
  224. return
  225. }
  226. // Pretty-print the response data.
  227. fmt.Println(resp)
  228. }
  229. func ExampleDirectoryService_EnableRadius() {
  230. svc := directoryservice.New(nil)
  231. params := &directoryservice.EnableRadiusInput{
  232. DirectoryId: aws.String("DirectoryId"), // Required
  233. RadiusSettings: &directoryservice.RadiusSettings{ // Required
  234. AuthenticationProtocol: aws.String("RadiusAuthenticationProtocol"),
  235. DisplayLabel: aws.String("RadiusDisplayLabel"),
  236. RadiusPort: aws.Int64(1),
  237. RadiusRetries: aws.Int64(1),
  238. RadiusServers: []*string{
  239. aws.String("Server"), // Required
  240. // More values...
  241. },
  242. RadiusTimeout: aws.Int64(1),
  243. SharedSecret: aws.String("RadiusSharedSecret"),
  244. UseSameUsername: aws.Bool(true),
  245. },
  246. }
  247. resp, err := svc.EnableRadius(params)
  248. if err != nil {
  249. // Print the error, cast err to awserr.Error to get the Code and
  250. // Message from an error.
  251. fmt.Println(err.Error())
  252. return
  253. }
  254. // Pretty-print the response data.
  255. fmt.Println(resp)
  256. }
  257. func ExampleDirectoryService_EnableSso() {
  258. svc := directoryservice.New(nil)
  259. params := &directoryservice.EnableSsoInput{
  260. DirectoryId: aws.String("DirectoryId"), // Required
  261. Password: aws.String("ConnectPassword"),
  262. UserName: aws.String("UserName"),
  263. }
  264. resp, err := svc.EnableSso(params)
  265. if err != nil {
  266. // Print the error, cast err to awserr.Error to get the Code and
  267. // Message from an error.
  268. fmt.Println(err.Error())
  269. return
  270. }
  271. // Pretty-print the response data.
  272. fmt.Println(resp)
  273. }
  274. func ExampleDirectoryService_GetDirectoryLimits() {
  275. svc := directoryservice.New(nil)
  276. var params *directoryservice.GetDirectoryLimitsInput
  277. resp, err := svc.GetDirectoryLimits(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 ExampleDirectoryService_GetSnapshotLimits() {
  288. svc := directoryservice.New(nil)
  289. params := &directoryservice.GetSnapshotLimitsInput{
  290. DirectoryId: aws.String("DirectoryId"), // Required
  291. }
  292. resp, err := svc.GetSnapshotLimits(params)
  293. if err != nil {
  294. // Print the error, cast err to awserr.Error to get the Code and
  295. // Message from an error.
  296. fmt.Println(err.Error())
  297. return
  298. }
  299. // Pretty-print the response data.
  300. fmt.Println(resp)
  301. }
  302. func ExampleDirectoryService_RestoreFromSnapshot() {
  303. svc := directoryservice.New(nil)
  304. params := &directoryservice.RestoreFromSnapshotInput{
  305. SnapshotId: aws.String("SnapshotId"), // Required
  306. }
  307. resp, err := svc.RestoreFromSnapshot(params)
  308. if err != nil {
  309. // Print the error, cast err to awserr.Error to get the Code and
  310. // Message from an error.
  311. fmt.Println(err.Error())
  312. return
  313. }
  314. // Pretty-print the response data.
  315. fmt.Println(resp)
  316. }
  317. func ExampleDirectoryService_UpdateRadius() {
  318. svc := directoryservice.New(nil)
  319. params := &directoryservice.UpdateRadiusInput{
  320. DirectoryId: aws.String("DirectoryId"), // Required
  321. RadiusSettings: &directoryservice.RadiusSettings{ // Required
  322. AuthenticationProtocol: aws.String("RadiusAuthenticationProtocol"),
  323. DisplayLabel: aws.String("RadiusDisplayLabel"),
  324. RadiusPort: aws.Int64(1),
  325. RadiusRetries: aws.Int64(1),
  326. RadiusServers: []*string{
  327. aws.String("Server"), // Required
  328. // More values...
  329. },
  330. RadiusTimeout: aws.Int64(1),
  331. SharedSecret: aws.String("RadiusSharedSecret"),
  332. UseSameUsername: aws.Bool(true),
  333. },
  334. }
  335. resp, err := svc.UpdateRadius(params)
  336. if err != nil {
  337. // Print the error, cast err to awserr.Error to get the Code and
  338. // Message from an error.
  339. fmt.Println(err.Error())
  340. return
  341. }
  342. // Pretty-print the response data.
  343. fmt.Println(resp)
  344. }