File Coverage

blib/lib/Paws/DynamoDB/ExpectedAttributeValue.pm
Criterion Covered Total %
statement 3 3 100.0
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 4 4 100.0


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