service.go 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package dynamodb
  3. import (
  4. "github.com/aws/aws-sdk-go/aws"
  5. "github.com/aws/aws-sdk-go/aws/defaults"
  6. "github.com/aws/aws-sdk-go/aws/request"
  7. "github.com/aws/aws-sdk-go/aws/service"
  8. "github.com/aws/aws-sdk-go/aws/service/serviceinfo"
  9. "github.com/aws/aws-sdk-go/internal/protocol/jsonrpc"
  10. "github.com/aws/aws-sdk-go/internal/signer/v4"
  11. )
  12. // Overview
  13. //
  14. // This is the Amazon DynamoDB API Reference. This guide provides descriptions
  15. // and samples of the low-level DynamoDB API. For information about DynamoDB
  16. // application development, see the Amazon DynamoDB Developer Guide (http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/).
  17. //
  18. // Instead of making the requests to the low-level DynamoDB API directly from
  19. // your application, we recommend that you use the AWS Software Development
  20. // Kits (SDKs). The easy-to-use libraries in the AWS SDKs make it unnecessary
  21. // to call the low-level DynamoDB API directly from your application. The libraries
  22. // take care of request authentication, serialization, and connection management.
  23. // For more information, see Using the AWS SDKs with DynamoDB (http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/UsingAWSSDK.html)
  24. // in the Amazon DynamoDB Developer Guide.
  25. //
  26. // If you decide to code against the low-level DynamoDB API directly, you will
  27. // need to write the necessary code to authenticate your requests. For more
  28. // information on signing your requests, see Using the DynamoDB API (http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/API.html)
  29. // in the Amazon DynamoDB Developer Guide.
  30. //
  31. // The following are short descriptions of each low-level API action, organized
  32. // by function.
  33. //
  34. // Managing Tables
  35. //
  36. // CreateTable - Creates a table with user-specified provisioned throughput
  37. // settings. You must designate one attribute as the hash primary key for the
  38. // table; you can optionally designate a second attribute as the range primary
  39. // key. DynamoDB creates indexes on these key attributes for fast data access.
  40. // Optionally, you can create one or more secondary indexes, which provide fast
  41. // data access using non-key attributes.
  42. //
  43. // DescribeTable - Returns metadata for a table, such as table size, status,
  44. // and index information.
  45. //
  46. // UpdateTable - Modifies the provisioned throughput settings for a table.
  47. // Optionally, you can modify the provisioned throughput settings for global
  48. // secondary indexes on the table.
  49. //
  50. // ListTables - Returns a list of all tables associated with the current
  51. // AWS account and endpoint.
  52. //
  53. // DeleteTable - Deletes a table and all of its indexes.
  54. //
  55. // For conceptual information about managing tables, see Working with Tables
  56. // (http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTables.html)
  57. // in the Amazon DynamoDB Developer Guide.
  58. //
  59. // Reading Data
  60. //
  61. // GetItem - Returns a set of attributes for the item that has a given primary
  62. // key. By default, GetItem performs an eventually consistent read; however,
  63. // applications can request a strongly consistent read instead.
  64. //
  65. // BatchGetItem - Performs multiple GetItem requests for data items using
  66. // their primary keys, from one table or multiple tables. The response from
  67. // BatchGetItem has a size limit of 16 MB and returns a maximum of 100 items.
  68. // Both eventually consistent and strongly consistent reads can be used.
  69. //
  70. // Query - Returns one or more items from a table or a secondary index. You
  71. // must provide a specific hash key value. You can narrow the scope of the query
  72. // using comparison operators against a range key value, or on the index key.
  73. // Query supports either eventual or strong consistency. A single response has
  74. // a size limit of 1 MB.
  75. //
  76. // Scan - Reads every item in a table; the result set is eventually consistent.
  77. // You can limit the number of items returned by filtering the data attributes,
  78. // using conditional expressions. Scan can be used to enable ad-hoc querying
  79. // of a table against non-key attributes; however, since this is a full table
  80. // scan without using an index, Scan should not be used for any application
  81. // query use case that requires predictable performance.
  82. //
  83. // For conceptual information about reading data, see Working with Items
  84. // (http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html)
  85. // and Query and Scan Operations (http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html)
  86. // in the Amazon DynamoDB Developer Guide.
  87. //
  88. // Modifying Data
  89. //
  90. // PutItem - Creates a new item, or replaces an existing item with a new
  91. // item (including all the attributes). By default, if an item in the table
  92. // already exists with the same primary key, the new item completely replaces
  93. // the existing item. You can use conditional operators to replace an item only
  94. // if its attribute values match certain conditions, or to insert a new item
  95. // only if that item doesn't already exist.
  96. //
  97. // UpdateItem - Modifies the attributes of an existing item. You can also
  98. // use conditional operators to perform an update only if the item's attribute
  99. // values match certain conditions.
  100. //
  101. // DeleteItem - Deletes an item in a table by primary key. You can use conditional
  102. // operators to perform a delete an item only if the item's attribute values
  103. // match certain conditions.
  104. //
  105. // BatchWriteItem - Performs multiple PutItem and DeleteItem requests across
  106. // multiple tables in a single request. A failure of any request(s) in the batch
  107. // will not cause the entire BatchWriteItem operation to fail. Supports batches
  108. // of up to 25 items to put or delete, with a maximum total request size of
  109. // 16 MB.
  110. //
  111. // For conceptual information about modifying data, see Working with Items
  112. // (http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html)
  113. // and Query and Scan Operations (http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html)
  114. // in the Amazon DynamoDB Developer Guide.
  115. type DynamoDB struct {
  116. *service.Service
  117. }
  118. // Used for custom service initialization logic
  119. var initService func(*service.Service)
  120. // Used for custom request initialization logic
  121. var initRequest func(*request.Request)
  122. // New returns a new DynamoDB client.
  123. func New(config *aws.Config) *DynamoDB {
  124. service := &service.Service{
  125. ServiceInfo: serviceinfo.ServiceInfo{
  126. Config: defaults.DefaultConfig.Merge(config),
  127. ServiceName: "dynamodb",
  128. APIVersion: "2012-08-10",
  129. JSONVersion: "1.0",
  130. TargetPrefix: "DynamoDB_20120810",
  131. },
  132. }
  133. service.Initialize()
  134. // Handlers
  135. service.Handlers.Sign.PushBack(v4.Sign)
  136. service.Handlers.Build.PushBack(jsonrpc.Build)
  137. service.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal)
  138. service.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta)
  139. service.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError)
  140. // Run custom service initialization if present
  141. if initService != nil {
  142. initService(service)
  143. }
  144. return &DynamoDB{service}
  145. }
  146. // newRequest creates a new request for a DynamoDB operation and runs any
  147. // custom request initialization.
  148. func (c *DynamoDB) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  149. req := c.NewRequest(op, params, data)
  150. // Run custom request initialization if present
  151. if initRequest != nil {
  152. initRequest(req)
  153. }
  154. return req
  155. }