« blib/lib/Paws/DynamoDB/ProvisionedThroughputDescription.pm
↑ Summary
blib/lib/Paws/DynamoDB/PutItemInputAttributeMap.pm »
| 1 | |||
| 2 | package Paws::DynamoDB::PutItem; | ||
| 3 | 2 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | has ConditionalOperator => (is => 'ro', isa => 'Str'); | |
| 5 | 2 | has ConditionExpression => (is => 'ro', isa => 'Str'); | |
| 6 | 2 | has Expected => (is => 'ro', isa => 'Paws::DynamoDB::ExpectedAttributeMap'); | |
| 7 | 2 | has ExpressionAttributeNames => (is => 'ro', isa => 'Paws::DynamoDB::ExpressionAttributeNameMap'); | |
| 8 | 2 | has ExpressionAttributeValues => (is => 'ro', isa => 'Paws::DynamoDB::ExpressionAttributeValueMap'); | |
| 9 | 2 | has Item => (is => 'ro', isa => 'Paws::DynamoDB::PutItemInputAttributeMap', required => 1); | |
| 10 | 2 | has ReturnConsumedCapacity => (is => 'ro', isa => 'Str'); | |
| 11 | 2 | has ReturnItemCollectionMetrics => (is => 'ro', isa => 'Str'); | |
| 12 | 2 | has ReturnValues => (is => 'ro', isa => 'Str'); | |
| 13 | 2 | has TableName => (is => 'ro', isa => 'Str', required => 1); | |
| 14 | |||
| 15 | 2 | ▶ | use MooseX::ClassAttribute; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | 2 | class_has _api_call => (isa => 'Str', is => 'ro', default => 'PutItem'); | |
| 18 | 2 | class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::DynamoDB::PutItemOutput'); | |
| 19 | 2 | class_has _result_key => (isa => 'Str', is => 'ro'); | |
| 20 | 2 | 1; | |
| 21 | |||
| 22 | ### main pod documentation begin ### | ||
| 23 | |||
| 24 | =head1 NAME | ||
| 25 | |||
| 26 | Paws::DynamoDB::PutItem - Arguments for method PutItem on L<Paws::DynamoDB> | ||
| 27 | |||
| 28 | =head1 DESCRIPTION | ||
| 29 | |||
| 30 | This class represents the parameters used for calling the method PutItem on the | ||
| 31 | L<Amazon DynamoDB|Paws::DynamoDB> service. Use the attributes of this class | ||
| 32 | as arguments to method PutItem. | ||
| 33 | |||
| 34 | You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to PutItem. | ||
| 35 | |||
| 36 | =head1 SYNOPSIS | ||
| 37 | |||
| 38 | my $dynamodb = Paws->service('DynamoDB'); | ||
| 39 | # To add an item to a table | ||
| 40 | # This example adds a new item to the Music table. | ||
| 41 | my $PutItemOutput = $dynamodb->PutItem( | ||
| 42 | 'Item' => { | ||
| 43 | 'AlbumTitle' => { | ||
| 44 | 'S' => 'Somewhat Famous' | ||
| 45 | }, | ||
| 46 | 'Artist' => { | ||
| 47 | 'S' => 'No One You Know' | ||
| 48 | }, | ||
| 49 | 'SongTitle' => { | ||
| 50 | 'S' => 'Call Me Today' | ||
| 51 | } | ||
| 52 | }, | ||
| 53 | 'ReturnConsumedCapacity' => 'TOTAL', | ||
| 54 | 'TableName' => 'Music' | ||
| 55 | ); | ||
| 56 | |||
| 57 | # Results: | ||
| 58 | my $ConsumedCapacity = $PutItemOutput->ConsumedCapacity; | ||
| 59 | |||
| 60 | # Returns a L<Paws::DynamoDB::PutItemOutput> object. | ||
| 61 | |||
| 62 | Values for attributes that are native types (Int, String, Float, etc) can passed as-is (scalar values). Values for complex Types (objects) can be passed as a HashRef. The keys and values of the hashref will be used to instance the underlying object. | ||
| 63 | For the AWS API documentation, see L<https://docs.aws.amazon.com/goto/WebAPI/dynamodb/PutItem> | ||
| 64 | |||
| 65 | =head1 ATTRIBUTES | ||
| 66 | |||
| 67 | |||
| 68 | =head2 ConditionalOperator => Str | ||
| 69 | |||
| 70 | This is a legacy parameter. Use C<ConditionExpression> instead. For | ||
| 71 | more information, see ConditionalOperator | ||
| 72 | (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.ConditionalOperator.html) | ||
| 73 | in the I<Amazon DynamoDB Developer Guide>. | ||
| 74 | |||
| 75 | Valid values are: C<"AND">, C<"OR"> | ||
| 76 | |||
| 77 | =head2 ConditionExpression => Str | ||
| 78 | |||
| 79 | A condition that must be satisfied in order for a conditional | ||
| 80 | C<PutItem> operation to succeed. | ||
| 81 | |||
| 82 | An expression can contain any of the following: | ||
| 83 | |||
| 84 | =over | ||
| 85 | |||
| 86 | =item * | ||
| 87 | |||
| 88 | Functions: C<attribute_exists | attribute_not_exists | attribute_type | | ||
| 89 | contains | begins_with | size> | ||
| 90 | |||
| 91 | These function names are case-sensitive. | ||
| 92 | |||
| 93 | =item * | ||
| 94 | |||
| 95 | Comparison operators: C<= | E<lt>E<gt> | E<lt> | E<gt> | E<lt>= | | ||
| 96 | E<gt>= | BETWEEN | IN> | ||
| 97 | |||
| 98 | =item * | ||
| 99 | |||
| 100 | Logical operators: C<AND | OR | NOT> | ||
| 101 | |||
| 102 | =back | ||
| 103 | |||
| 104 | For more information on condition expressions, see Condition | ||
| 105 | Expressions | ||
| 106 | (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html) | ||
| 107 | in the I<Amazon DynamoDB Developer Guide>. | ||
| 108 | |||
| 109 | |||
| 110 | |||
| 111 | =head2 Expected => L<Paws::DynamoDB::ExpectedAttributeMap> | ||
| 112 | |||
| 113 | This is a legacy parameter. Use C<ConditionExpression> instead. For | ||
| 114 | more information, see Expected | ||
| 115 | (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.Expected.html) | ||
| 116 | in the I<Amazon DynamoDB Developer Guide>. | ||
| 117 | |||
| 118 | |||
| 119 | |||
| 120 | =head2 ExpressionAttributeNames => L<Paws::DynamoDB::ExpressionAttributeNameMap> | ||
| 121 | |||
| 122 | One or more substitution tokens for attribute names in an expression. | ||
| 123 | The following are some use cases for using C<ExpressionAttributeNames>: | ||
| 124 | |||
| 125 | =over | ||
| 126 | |||
| 127 | =item * | ||
| 128 | |||
| 129 | To access an attribute whose name conflicts with a DynamoDB reserved | ||
| 130 | word. | ||
| 131 | |||
| 132 | =item * | ||
| 133 | |||
| 134 | To create a placeholder for repeating occurrences of an attribute name | ||
| 135 | in an expression. | ||
| 136 | |||
| 137 | =item * | ||
| 138 | |||
| 139 | To prevent special characters in an attribute name from being | ||
| 140 | misinterpreted in an expression. | ||
| 141 | |||
| 142 | =back | ||
| 143 | |||
| 144 | Use the B<#> character in an expression to dereference an attribute | ||
| 145 | name. For example, consider the following attribute name: | ||
| 146 | |||
| 147 | =over | ||
| 148 | |||
| 149 | =item * | ||
| 150 | |||
| 151 | C<Percentile> | ||
| 152 | |||
| 153 | =back | ||
| 154 | |||
| 155 | The name of this attribute conflicts with a reserved word, so it cannot | ||
| 156 | be used directly in an expression. (For the complete list of reserved | ||
| 157 | words, see Reserved Words | ||
| 158 | (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html) | ||
| 159 | in the I<Amazon DynamoDB Developer Guide>). To work around this, you | ||
| 160 | could specify the following for C<ExpressionAttributeNames>: | ||
| 161 | |||
| 162 | =over | ||
| 163 | |||
| 164 | =item * | ||
| 165 | |||
| 166 | C<{"#P":"Percentile"}> | ||
| 167 | |||
| 168 | =back | ||
| 169 | |||
| 170 | You could then use this substitution in an expression, as in this | ||
| 171 | example: | ||
| 172 | |||
| 173 | =over | ||
| 174 | |||
| 175 | =item * | ||
| 176 | |||
| 177 | C<#P = :val> | ||
| 178 | |||
| 179 | =back | ||
| 180 | |||
| 181 | Tokens that begin with the B<:> character are I<expression attribute | ||
| 182 | values>, which are placeholders for the actual value at runtime. | ||
| 183 | |||
| 184 | For more information on expression attribute names, see Specifying Item | ||
| 185 | Attributes | ||
| 186 | (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html) | ||
| 187 | in the I<Amazon DynamoDB Developer Guide>. | ||
| 188 | |||
| 189 | |||
| 190 | |||
| 191 | =head2 ExpressionAttributeValues => L<Paws::DynamoDB::ExpressionAttributeValueMap> | ||
| 192 | |||
| 193 | One or more values that can be substituted in an expression. | ||
| 194 | |||
| 195 | Use the B<:> (colon) character in an expression to dereference an | ||
| 196 | attribute value. For example, suppose that you wanted to check whether | ||
| 197 | the value of the I<ProductStatus> attribute was one of the following: | ||
| 198 | |||
| 199 | C<Available | Backordered | Discontinued> | ||
| 200 | |||
| 201 | You would first need to specify C<ExpressionAttributeValues> as | ||
| 202 | follows: | ||
| 203 | |||
| 204 | C<{ ":avail":{"S":"Available"}, ":back":{"S":"Backordered"}, | ||
| 205 | ":disc":{"S":"Discontinued"} }> | ||
| 206 | |||
| 207 | You could then use these values in an expression, such as this: | ||
| 208 | |||
| 209 | C<ProductStatus IN (:avail, :back, :disc)> | ||
| 210 | |||
| 211 | For more information on expression attribute values, see Condition | ||
| 212 | Expressions | ||
| 213 | (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html) | ||
| 214 | in the I<Amazon DynamoDB Developer Guide>. | ||
| 215 | |||
| 216 | |||
| 217 | |||
| 218 | =head2 B<REQUIRED> Item => L<Paws::DynamoDB::PutItemInputAttributeMap> | ||
| 219 | |||
| 220 | A map of attribute name/value pairs, one for each attribute. Only the | ||
| 221 | primary key attributes are required; you can optionally provide other | ||
| 222 | attribute name-value pairs for the item. | ||
| 223 | |||
| 224 | You must provide all of the attributes for the primary key. For | ||
| 225 | example, with a simple primary key, you only need to provide a value | ||
| 226 | for the partition key. For a composite primary key, you must provide | ||
| 227 | both values for both the partition key and the sort key. | ||
| 228 | |||
| 229 | If you specify any attributes that are part of an index key, then the | ||
| 230 | data types for those attributes must match those of the schema in the | ||
| 231 | table's attribute definition. | ||
| 232 | |||
| 233 | Empty String and Binary attribute values are allowed. Attribute values | ||
| 234 | of type String and Binary must have a length greater than zero if the | ||
| 235 | attribute is used as a key attribute for a table or index. | ||
| 236 | |||
| 237 | For more information about primary keys, see Primary Key | ||
| 238 | (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.CoreComponents.html#HowItWorks.CoreComponents.PrimaryKey) | ||
| 239 | in the I<Amazon DynamoDB Developer Guide>. | ||
| 240 | |||
| 241 | Each element in the C<Item> map is an C<AttributeValue> object. | ||
| 242 | |||
| 243 | |||
| 244 | |||
| 245 | =head2 ReturnConsumedCapacity => Str | ||
| 246 | |||
| 247 | |||
| 248 | |||
| 249 | Valid values are: C<"INDEXES">, C<"TOTAL">, C<"NONE"> | ||
| 250 | |||
| 251 | =head2 ReturnItemCollectionMetrics => Str | ||
| 252 | |||
| 253 | Determines whether item collection metrics are returned. If set to | ||
| 254 | C<SIZE>, the response includes statistics about item collections, if | ||
| 255 | any, that were modified during the operation are returned in the | ||
| 256 | response. If set to C<NONE> (the default), no statistics are returned. | ||
| 257 | |||
| 258 | Valid values are: C<"SIZE">, C<"NONE"> | ||
| 259 | |||
| 260 | =head2 ReturnValues => Str | ||
| 261 | |||
| 262 | Use C<ReturnValues> if you want to get the item attributes as they | ||
| 263 | appeared before they were updated with the C<PutItem> request. For | ||
| 264 | C<PutItem>, the valid values are: | ||
| 265 | |||
| 266 | =over | ||
| 267 | |||
| 268 | =item * | ||
| 269 | |||
| 270 | C<NONE> - If C<ReturnValues> is not specified, or if its value is | ||
| 271 | C<NONE>, then nothing is returned. (This setting is the default for | ||
| 272 | C<ReturnValues>.) | ||
| 273 | |||
| 274 | =item * | ||
| 275 | |||
| 276 | C<ALL_OLD> - If C<PutItem> overwrote an attribute name-value pair, then | ||
| 277 | the content of the old item is returned. | ||
| 278 | |||
| 279 | =back | ||
| 280 | |||
| 281 | The C<ReturnValues> parameter is used by several DynamoDB operations; | ||
| 282 | however, C<PutItem> does not recognize any values other than C<NONE> or | ||
| 283 | C<ALL_OLD>. | ||
| 284 | |||
| 285 | Valid values are: C<"NONE">, C<"ALL_OLD">, C<"UPDATED_OLD">, C<"ALL_NEW">, C<"UPDATED_NEW"> | ||
| 286 | |||
| 287 | =head2 B<REQUIRED> TableName => Str | ||
| 288 | |||
| 289 | The name of the table to contain the item. | ||
| 290 | |||
| 291 | |||
| 292 | |||
| 293 | |||
| 294 | =head1 SEE ALSO | ||
| 295 | |||
| 296 | This class forms part of L<Paws>, documenting arguments for method PutItem in L<Paws::DynamoDB> | ||
| 297 | |||
| 298 | =head1 BUGS and CONTRIBUTIONS | ||
| 299 | |||
| 300 | The source code is located here: L<https://github.com/pplu/aws-sdk-perl> | ||
| 301 | |||
| 302 | Please report bugs to: L<https://github.com/pplu/aws-sdk-perl/issues> | ||
| 303 | |||
| 304 | =cut | ||
| 305 | |||