« blib/lib/Paws/DynamoDB/ExpectedAttributeMap.pm
↑ Summary
blib/lib/Paws/DynamoDB/ExportDescription.pm »
| 1 | # Generated by default/object.tt | ||
| 2 | package Paws::DynamoDB::ExpectedAttributeValue; | ||
| 3 | use Moose; | ||
| 4 | has AttributeValueList => (is => 'ro', isa => 'ArrayRef[Paws::DynamoDB::AttributeValue]'); | ||
| 5 | has ComparisonOperator => (is => 'ro', isa => 'Str'); | ||
| 6 | has Exists => (is => 'ro', isa => 'Bool'); | ||
| 7 | has Value => (is => 'ro', isa => 'Paws::DynamoDB::AttributeValue'); | ||
| 8 | |||
| 9 | 1; | ||
| 10 | |||
| 11 | ### main pod documentation begin ### | ||
| 12 | |||
| 13 | =head1 NAME | ||
| 14 | |||
| 15 | Paws::DynamoDB::ExpectedAttributeValue | ||
| 16 | |||
| 17 | =head1 USAGE | ||
| 18 | |||
| 19 | This class represents one of two things: | ||
| 20 | |||
| 21 | =head3 Arguments in a call to a service | ||
| 22 | |||
| 23 | Use the attributes of this class as arguments to methods. You shouldn't make instances of this class. | ||
| 24 | Each attribute should be used as a named argument in the calls that expect this type of object. | ||
| 25 | |||
| 26 | As an example, if Att1 is expected to be a Paws::DynamoDB::ExpectedAttributeValue object: | ||
| 27 | |||
| 28 | $service_obj->Method(Att1 => { AttributeValueList => $value, ..., Value => $value }); | ||
| 29 | |||
| 30 | =head3 Results returned from an API call | ||
| 31 | |||
| 32 | Use accessors for each attribute. If Att1 is expected to be an Paws::DynamoDB::ExpectedAttributeValue object: | ||
| 33 | |||
| 34 | $result = $service_obj->Method(...); | ||
| 35 | $result->Att1->AttributeValueList | ||
| 36 | |||
| 37 | =head1 DESCRIPTION | ||
| 38 | |||
| 39 | Represents a condition to be compared with an attribute value. This | ||
| 40 | condition can be used with C<DeleteItem>, C<PutItem>, or C<UpdateItem> | ||
| 41 | operations; if the comparison evaluates to true, the operation | ||
| 42 | succeeds; if not, the operation fails. You can use | ||
| 43 | C<ExpectedAttributeValue> in one of two different ways: | ||
| 44 | |||
| 45 | =over | ||
| 46 | |||
| 47 | =item * | ||
| 48 | |||
| 49 | Use C<AttributeValueList> to specify one or more values to compare | ||
| 50 | against an attribute. Use C<ComparisonOperator> to specify how you want | ||
| 51 | to perform the comparison. If the comparison evaluates to true, then | ||
| 52 | the conditional operation succeeds. | ||
| 53 | |||
| 54 | =item * | ||
| 55 | |||
| 56 | Use C<Value> to specify a value that DynamoDB will compare against an | ||
| 57 | attribute. If the values match, then C<ExpectedAttributeValue> | ||
| 58 | evaluates to true and the conditional operation succeeds. Optionally, | ||
| 59 | you can also set C<Exists> to false, indicating that you I<do not> | ||
| 60 | expect to find the attribute value in the table. In this case, the | ||
| 61 | conditional operation succeeds only if the comparison evaluates to | ||
| 62 | false. | ||
| 63 | |||
| 64 | =back | ||
| 65 | |||
| 66 | C<Value> and C<Exists> are incompatible with C<AttributeValueList> and | ||
| 67 | C<ComparisonOperator>. Note that if you use both sets of parameters at | ||
| 68 | once, DynamoDB will return a C<ValidationException> exception. | ||
| 69 | |||
| 70 | =head1 ATTRIBUTES | ||
| 71 | |||
| 72 | |||
| 73 | =head2 AttributeValueList => ArrayRef[L<Paws::DynamoDB::AttributeValue>] | ||
| 74 | |||
| 75 | One or more values to evaluate against the supplied attribute. The | ||
| 76 | number of values in the list depends on the C<ComparisonOperator> being | ||
| 77 | used. | ||
| 78 | |||
| 79 | For type Number, value comparisons are numeric. | ||
| 80 | |||
| 81 | String value comparisons for greater than, equals, or less than are | ||
| 82 | based on ASCII character code values. For example, C<a> is greater than | ||
| 83 | C<A>, and C<a> is greater than C<B>. For a list of code values, see | ||
| 84 | http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters | ||
| 85 | (http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters). | ||
| 86 | |||
| 87 | For Binary, DynamoDB treats each byte of the binary data as unsigned | ||
| 88 | when it compares binary values. | ||
| 89 | |||
| 90 | For information on specifying data types in JSON, see JSON Data Format | ||
| 91 | (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataFormat.html) | ||
| 92 | in the I<Amazon DynamoDB Developer Guide>. | ||
| 93 | |||
| 94 | |||
| 95 | =head2 ComparisonOperator => Str | ||
| 96 | |||
| 97 | A comparator for evaluating attributes in the C<AttributeValueList>. | ||
| 98 | For example, equals, greater than, less than, etc. | ||
| 99 | |||
| 100 | The following comparison operators are available: | ||
| 101 | |||
| 102 | C<EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | | ||
| 103 | NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN> | ||
| 104 | |||
| 105 | The following are descriptions of each comparison operator. | ||
| 106 | |||
| 107 | =over | ||
| 108 | |||
| 109 | =item * | ||
| 110 | |||
| 111 | C<EQ> : Equal. C<EQ> is supported for all data types, including lists | ||
| 112 | and maps. | ||
| 113 | |||
| 114 | C<AttributeValueList> can contain only one C<AttributeValue> element of | ||
| 115 | type String, Number, Binary, String Set, Number Set, or Binary Set. If | ||
| 116 | an item contains an C<AttributeValue> element of a different type than | ||
| 117 | the one provided in the request, the value does not match. For example, | ||
| 118 | C<{"S":"6"}> does not equal C<{"N":"6"}>. Also, C<{"N":"6"}> does not | ||
| 119 | equal C<{"NS":["6", "2", "1"]}>. | ||
| 120 | |||
| 121 | =item * | ||
| 122 | |||
| 123 | C<NE> : Not equal. C<NE> is supported for all data types, including | ||
| 124 | lists and maps. | ||
| 125 | |||
| 126 | C<AttributeValueList> can contain only one C<AttributeValue> of type | ||
| 127 | String, Number, Binary, String Set, Number Set, or Binary Set. If an | ||
| 128 | item contains an C<AttributeValue> of a different type than the one | ||
| 129 | provided in the request, the value does not match. For example, | ||
| 130 | C<{"S":"6"}> does not equal C<{"N":"6"}>. Also, C<{"N":"6"}> does not | ||
| 131 | equal C<{"NS":["6", "2", "1"]}>. | ||
| 132 | |||
| 133 | =item * | ||
| 134 | |||
| 135 | C<LE> : Less than or equal. | ||
| 136 | |||
| 137 | C<AttributeValueList> can contain only one C<AttributeValue> element of | ||
| 138 | type String, Number, or Binary (not a set type). If an item contains an | ||
| 139 | C<AttributeValue> element of a different type than the one provided in | ||
| 140 | the request, the value does not match. For example, C<{"S":"6"}> does | ||
| 141 | not equal C<{"N":"6"}>. Also, C<{"N":"6"}> does not compare to | ||
| 142 | C<{"NS":["6", "2", "1"]}>. | ||
| 143 | |||
| 144 | =item * | ||
| 145 | |||
| 146 | C<LT> : Less than. | ||
| 147 | |||
| 148 | C<AttributeValueList> can contain only one C<AttributeValue> of type | ||
| 149 | String, Number, or Binary (not a set type). If an item contains an | ||
| 150 | C<AttributeValue> element of a different type than the one provided in | ||
| 151 | the request, the value does not match. For example, C<{"S":"6"}> does | ||
| 152 | not equal C<{"N":"6"}>. Also, C<{"N":"6"}> does not compare to | ||
| 153 | C<{"NS":["6", "2", "1"]}>. | ||
| 154 | |||
| 155 | =item * | ||
| 156 | |||
| 157 | C<GE> : Greater than or equal. | ||
| 158 | |||
| 159 | C<AttributeValueList> can contain only one C<AttributeValue> element of | ||
| 160 | type String, Number, or Binary (not a set type). If an item contains an | ||
| 161 | C<AttributeValue> element of a different type than the one provided in | ||
| 162 | the request, the value does not match. For example, C<{"S":"6"}> does | ||
| 163 | not equal C<{"N":"6"}>. Also, C<{"N":"6"}> does not compare to | ||
| 164 | C<{"NS":["6", "2", "1"]}>. | ||
| 165 | |||
| 166 | =item * | ||
| 167 | |||
| 168 | C<GT> : Greater than. | ||
| 169 | |||
| 170 | C<AttributeValueList> can contain only one C<AttributeValue> element of | ||
| 171 | type String, Number, or Binary (not a set type). If an item contains an | ||
| 172 | C<AttributeValue> element of a different type than the one provided in | ||
| 173 | the request, the value does not match. For example, C<{"S":"6"}> does | ||
| 174 | not equal C<{"N":"6"}>. Also, C<{"N":"6"}> does not compare to | ||
| 175 | C<{"NS":["6", "2", "1"]}>. | ||
| 176 | |||
| 177 | =item * | ||
| 178 | |||
| 179 | C<NOT_NULL> : The attribute exists. C<NOT_NULL> is supported for all | ||
| 180 | data types, including lists and maps. | ||
| 181 | |||
| 182 | This operator tests for the existence of an attribute, not its data | ||
| 183 | type. If the data type of attribute "C<a>" is null, and you evaluate it | ||
| 184 | using C<NOT_NULL>, the result is a Boolean C<true>. This result is | ||
| 185 | because the attribute "C<a>" exists; its data type is not relevant to | ||
| 186 | the C<NOT_NULL> comparison operator. | ||
| 187 | |||
| 188 | =item * | ||
| 189 | |||
| 190 | C<NULL> : The attribute does not exist. C<NULL> is supported for all | ||
| 191 | data types, including lists and maps. | ||
| 192 | |||
| 193 | This operator tests for the nonexistence of an attribute, not its data | ||
| 194 | type. If the data type of attribute "C<a>" is null, and you evaluate it | ||
| 195 | using C<NULL>, the result is a Boolean C<false>. This is because the | ||
| 196 | attribute "C<a>" exists; its data type is not relevant to the C<NULL> | ||
| 197 | comparison operator. | ||
| 198 | |||
| 199 | =item * | ||
| 200 | |||
| 201 | C<CONTAINS> : Checks for a subsequence, or value in a set. | ||
| 202 | |||
| 203 | C<AttributeValueList> can contain only one C<AttributeValue> element of | ||
| 204 | type String, Number, or Binary (not a set type). If the target | ||
| 205 | attribute of the comparison is of type String, then the operator checks | ||
| 206 | for a substring match. If the target attribute of the comparison is of | ||
| 207 | type Binary, then the operator looks for a subsequence of the target | ||
| 208 | that matches the input. If the target attribute of the comparison is a | ||
| 209 | set ("C<SS>", "C<NS>", or "C<BS>"), then the operator evaluates to true | ||
| 210 | if it finds an exact match with any member of the set. | ||
| 211 | |||
| 212 | CONTAINS is supported for lists: When evaluating "C<a CONTAINS b>", | ||
| 213 | "C<a>" can be a list; however, "C<b>" cannot be a set, a map, or a | ||
| 214 | list. | ||
| 215 | |||
| 216 | =item * | ||
| 217 | |||
| 218 | C<NOT_CONTAINS> : Checks for absence of a subsequence, or absence of a | ||
| 219 | value in a set. | ||
| 220 | |||
| 221 | C<AttributeValueList> can contain only one C<AttributeValue> element of | ||
| 222 | type String, Number, or Binary (not a set type). If the target | ||
| 223 | attribute of the comparison is a String, then the operator checks for | ||
| 224 | the absence of a substring match. If the target attribute of the | ||
| 225 | comparison is Binary, then the operator checks for the absence of a | ||
| 226 | subsequence of the target that matches the input. If the target | ||
| 227 | attribute of the comparison is a set ("C<SS>", "C<NS>", or "C<BS>"), | ||
| 228 | then the operator evaluates to true if it I<does not> find an exact | ||
| 229 | match with any member of the set. | ||
| 230 | |||
| 231 | NOT_CONTAINS is supported for lists: When evaluating "C<a NOT CONTAINS | ||
| 232 | b>", "C<a>" can be a list; however, "C<b>" cannot be a set, a map, or a | ||
| 233 | list. | ||
| 234 | |||
| 235 | =item * | ||
| 236 | |||
| 237 | C<BEGINS_WITH> : Checks for a prefix. | ||
| 238 | |||
| 239 | C<AttributeValueList> can contain only one C<AttributeValue> of type | ||
| 240 | String or Binary (not a Number or a set type). The target attribute of | ||
| 241 | the comparison must be of type String or Binary (not a Number or a set | ||
| 242 | type). | ||
| 243 | |||
| 244 | =item * | ||
| 245 | |||
| 246 | C<IN> : Checks for matching elements in a list. | ||
| 247 | |||
| 248 | C<AttributeValueList> can contain one or more C<AttributeValue> | ||
| 249 | elements of type String, Number, or Binary. These attributes are | ||
| 250 | compared against an existing attribute of an item. If any elements of | ||
| 251 | the input are equal to the item attribute, the expression evaluates to | ||
| 252 | true. | ||
| 253 | |||
| 254 | =item * | ||
| 255 | |||
| 256 | C<BETWEEN> : Greater than or equal to the first value, and less than or | ||
| 257 | equal to the second value. | ||
| 258 | |||
| 259 | C<AttributeValueList> must contain two C<AttributeValue> elements of | ||
| 260 | the same type, either String, Number, or Binary (not a set type). A | ||
| 261 | target attribute matches if the target value is greater than, or equal | ||
| 262 | to, the first element and less than, or equal to, the second element. | ||
| 263 | If an item contains an C<AttributeValue> element of a different type | ||
| 264 | than the one provided in the request, the value does not match. For | ||
| 265 | example, C<{"S":"6"}> does not compare to C<{"N":"6"}>. Also, | ||
| 266 | C<{"N":"6"}> does not compare to C<{"NS":["6", "2", "1"]}> | ||
| 267 | |||
| 268 | =back | ||
| 269 | |||
| 270 | |||
| 271 | |||
| 272 | =head2 Exists => Bool | ||
| 273 | |||
| 274 | Causes DynamoDB to evaluate the value before attempting a conditional | ||
| 275 | operation: | ||
| 276 | |||
| 277 | =over | ||
| 278 | |||
| 279 | =item * | ||
| 280 | |||
| 281 | If C<Exists> is C<true>, DynamoDB will check to see if that attribute | ||
| 282 | value already exists in the table. If it is found, then the operation | ||
| 283 | succeeds. If it is not found, the operation fails with a | ||
| 284 | C<ConditionCheckFailedException>. | ||
| 285 | |||
| 286 | =item * | ||
| 287 | |||
| 288 | If C<Exists> is C<false>, DynamoDB assumes that the attribute value | ||
| 289 | does not exist in the table. If in fact the value does not exist, then | ||
| 290 | the assumption is valid and the operation succeeds. If the value is | ||
| 291 | found, despite the assumption that it does not exist, the operation | ||
| 292 | fails with a C<ConditionCheckFailedException>. | ||
| 293 | |||
| 294 | =back | ||
| 295 | |||
| 296 | The default setting for C<Exists> is C<true>. If you supply a C<Value> | ||
| 297 | all by itself, DynamoDB assumes the attribute exists: You don't have to | ||
| 298 | set C<Exists> to C<true>, because it is implied. | ||
| 299 | |||
| 300 | DynamoDB returns a C<ValidationException> if: | ||
| 301 | |||
| 302 | =over | ||
| 303 | |||
| 304 | =item * | ||
| 305 | |||
| 306 | C<Exists> is C<true> but there is no C<Value> to check. (You expect a | ||
| 307 | value to exist, but don't specify what that value is.) | ||
| 308 | |||
| 309 | =item * | ||
| 310 | |||
| 311 | C<Exists> is C<false> but you also provide a C<Value>. (You cannot | ||
| 312 | expect an attribute to have a value, while also expecting it not to | ||
| 313 | exist.) | ||
| 314 | |||
| 315 | =back | ||
| 316 | |||
| 317 | |||
| 318 | |||
| 319 | =head2 Value => L<Paws::DynamoDB::AttributeValue> | ||
| 320 | |||
| 321 | Represents the data for the expected attribute. | ||
| 322 | |||
| 323 | Each attribute value is described as a name-value pair. The name is the | ||
| 324 | data type, and the value is the data itself. | ||
| 325 | |||
| 326 | For more information, see Data Types | ||
| 327 | (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html#HowItWorks.DataTypes) | ||
| 328 | in the I<Amazon DynamoDB Developer Guide>. | ||
| 329 | |||
| 330 | |||
| 331 | |||
| 332 | =head1 SEE ALSO | ||
| 333 | |||
| 334 | This class forms part of L<Paws>, describing an object used in L<Paws::DynamoDB> | ||
| 335 | |||
| 336 | =head1 BUGS and CONTRIBUTIONS | ||
| 337 | |||
| 338 | The source code is located here: L<https://github.com/pplu/aws-sdk-perl> | ||
| 339 | |||
| 340 | Please report bugs to: L<https://github.com/pplu/aws-sdk-perl/issues> | ||
| 341 | |||
| 342 | =cut | ||
| 343 |