examples_test.go 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package simpledb_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/simpledb"
  10. )
  11. var _ time.Duration
  12. var _ bytes.Buffer
  13. func ExampleSimpleDB_BatchDeleteAttributes() {
  14. sess, err := session.NewSession()
  15. if err != nil {
  16. fmt.Println("failed to create session,", err)
  17. return
  18. }
  19. svc := simpledb.New(sess)
  20. params := &simpledb.BatchDeleteAttributesInput{
  21. DomainName: aws.String("String"), // Required
  22. Items: []*simpledb.DeletableItem{ // Required
  23. { // Required
  24. Name: aws.String("String"), // Required
  25. Attributes: []*simpledb.DeletableAttribute{
  26. { // Required
  27. Name: aws.String("String"), // Required
  28. Value: aws.String("String"),
  29. },
  30. // More values...
  31. },
  32. },
  33. // More values...
  34. },
  35. }
  36. resp, err := svc.BatchDeleteAttributes(params)
  37. if err != nil {
  38. // Print the error, cast err to awserr.Error to get the Code and
  39. // Message from an error.
  40. fmt.Println(err.Error())
  41. return
  42. }
  43. // Pretty-print the response data.
  44. fmt.Println(resp)
  45. }
  46. func ExampleSimpleDB_BatchPutAttributes() {
  47. sess, err := session.NewSession()
  48. if err != nil {
  49. fmt.Println("failed to create session,", err)
  50. return
  51. }
  52. svc := simpledb.New(sess)
  53. params := &simpledb.BatchPutAttributesInput{
  54. DomainName: aws.String("String"), // Required
  55. Items: []*simpledb.ReplaceableItem{ // Required
  56. { // Required
  57. Attributes: []*simpledb.ReplaceableAttribute{ // Required
  58. { // Required
  59. Name: aws.String("String"), // Required
  60. Value: aws.String("String"), // Required
  61. Replace: aws.Bool(true),
  62. },
  63. // More values...
  64. },
  65. Name: aws.String("String"), // Required
  66. },
  67. // More values...
  68. },
  69. }
  70. resp, err := svc.BatchPutAttributes(params)
  71. if err != nil {
  72. // Print the error, cast err to awserr.Error to get the Code and
  73. // Message from an error.
  74. fmt.Println(err.Error())
  75. return
  76. }
  77. // Pretty-print the response data.
  78. fmt.Println(resp)
  79. }
  80. func ExampleSimpleDB_CreateDomain() {
  81. sess, err := session.NewSession()
  82. if err != nil {
  83. fmt.Println("failed to create session,", err)
  84. return
  85. }
  86. svc := simpledb.New(sess)
  87. params := &simpledb.CreateDomainInput{
  88. DomainName: aws.String("String"), // Required
  89. }
  90. resp, err := svc.CreateDomain(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 ExampleSimpleDB_DeleteAttributes() {
  101. sess, err := session.NewSession()
  102. if err != nil {
  103. fmt.Println("failed to create session,", err)
  104. return
  105. }
  106. svc := simpledb.New(sess)
  107. params := &simpledb.DeleteAttributesInput{
  108. DomainName: aws.String("String"), // Required
  109. ItemName: aws.String("String"), // Required
  110. Attributes: []*simpledb.DeletableAttribute{
  111. { // Required
  112. Name: aws.String("String"), // Required
  113. Value: aws.String("String"),
  114. },
  115. // More values...
  116. },
  117. Expected: &simpledb.UpdateCondition{
  118. Exists: aws.Bool(true),
  119. Name: aws.String("String"),
  120. Value: aws.String("String"),
  121. },
  122. }
  123. resp, err := svc.DeleteAttributes(params)
  124. if err != nil {
  125. // Print the error, cast err to awserr.Error to get the Code and
  126. // Message from an error.
  127. fmt.Println(err.Error())
  128. return
  129. }
  130. // Pretty-print the response data.
  131. fmt.Println(resp)
  132. }
  133. func ExampleSimpleDB_DeleteDomain() {
  134. sess, err := session.NewSession()
  135. if err != nil {
  136. fmt.Println("failed to create session,", err)
  137. return
  138. }
  139. svc := simpledb.New(sess)
  140. params := &simpledb.DeleteDomainInput{
  141. DomainName: aws.String("String"), // Required
  142. }
  143. resp, err := svc.DeleteDomain(params)
  144. if err != nil {
  145. // Print the error, cast err to awserr.Error to get the Code and
  146. // Message from an error.
  147. fmt.Println(err.Error())
  148. return
  149. }
  150. // Pretty-print the response data.
  151. fmt.Println(resp)
  152. }
  153. func ExampleSimpleDB_DomainMetadata() {
  154. sess, err := session.NewSession()
  155. if err != nil {
  156. fmt.Println("failed to create session,", err)
  157. return
  158. }
  159. svc := simpledb.New(sess)
  160. params := &simpledb.DomainMetadataInput{
  161. DomainName: aws.String("String"), // Required
  162. }
  163. resp, err := svc.DomainMetadata(params)
  164. if err != nil {
  165. // Print the error, cast err to awserr.Error to get the Code and
  166. // Message from an error.
  167. fmt.Println(err.Error())
  168. return
  169. }
  170. // Pretty-print the response data.
  171. fmt.Println(resp)
  172. }
  173. func ExampleSimpleDB_GetAttributes() {
  174. sess, err := session.NewSession()
  175. if err != nil {
  176. fmt.Println("failed to create session,", err)
  177. return
  178. }
  179. svc := simpledb.New(sess)
  180. params := &simpledb.GetAttributesInput{
  181. DomainName: aws.String("String"), // Required
  182. ItemName: aws.String("String"), // Required
  183. AttributeNames: []*string{
  184. aws.String("String"), // Required
  185. // More values...
  186. },
  187. ConsistentRead: aws.Bool(true),
  188. }
  189. resp, err := svc.GetAttributes(params)
  190. if err != nil {
  191. // Print the error, cast err to awserr.Error to get the Code and
  192. // Message from an error.
  193. fmt.Println(err.Error())
  194. return
  195. }
  196. // Pretty-print the response data.
  197. fmt.Println(resp)
  198. }
  199. func ExampleSimpleDB_ListDomains() {
  200. sess, err := session.NewSession()
  201. if err != nil {
  202. fmt.Println("failed to create session,", err)
  203. return
  204. }
  205. svc := simpledb.New(sess)
  206. params := &simpledb.ListDomainsInput{
  207. MaxNumberOfDomains: aws.Int64(1),
  208. NextToken: aws.String("String"),
  209. }
  210. resp, err := svc.ListDomains(params)
  211. if err != nil {
  212. // Print the error, cast err to awserr.Error to get the Code and
  213. // Message from an error.
  214. fmt.Println(err.Error())
  215. return
  216. }
  217. // Pretty-print the response data.
  218. fmt.Println(resp)
  219. }
  220. func ExampleSimpleDB_PutAttributes() {
  221. sess, err := session.NewSession()
  222. if err != nil {
  223. fmt.Println("failed to create session,", err)
  224. return
  225. }
  226. svc := simpledb.New(sess)
  227. params := &simpledb.PutAttributesInput{
  228. Attributes: []*simpledb.ReplaceableAttribute{ // Required
  229. { // Required
  230. Name: aws.String("String"), // Required
  231. Value: aws.String("String"), // Required
  232. Replace: aws.Bool(true),
  233. },
  234. // More values...
  235. },
  236. DomainName: aws.String("String"), // Required
  237. ItemName: aws.String("String"), // Required
  238. Expected: &simpledb.UpdateCondition{
  239. Exists: aws.Bool(true),
  240. Name: aws.String("String"),
  241. Value: aws.String("String"),
  242. },
  243. }
  244. resp, err := svc.PutAttributes(params)
  245. if err != nil {
  246. // Print the error, cast err to awserr.Error to get the Code and
  247. // Message from an error.
  248. fmt.Println(err.Error())
  249. return
  250. }
  251. // Pretty-print the response data.
  252. fmt.Println(resp)
  253. }
  254. func ExampleSimpleDB_Select() {
  255. sess, err := session.NewSession()
  256. if err != nil {
  257. fmt.Println("failed to create session,", err)
  258. return
  259. }
  260. svc := simpledb.New(sess)
  261. params := &simpledb.SelectInput{
  262. SelectExpression: aws.String("String"), // Required
  263. ConsistentRead: aws.Bool(true),
  264. NextToken: aws.String("String"),
  265. }
  266. resp, err := svc.Select(params)
  267. if err != nil {
  268. // Print the error, cast err to awserr.Error to get the Code and
  269. // Message from an error.
  270. fmt.Println(err.Error())
  271. return
  272. }
  273. // Pretty-print the response data.
  274. fmt.Println(resp)
  275. }