File Coverage

blib/lib/Paws/DynamoDB/AttributeValueUpdate.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::AttributeValueUpdate;
2 1     1   547 use Moose;
  1         3  
  1         8  
3             has Action => (is => 'ro', isa => 'Str');
4             has Value => (is => 'ro', isa => 'Paws::DynamoDB::AttributeValue');
5             1;
6              
7             ### main pod documentation begin ###
8              
9             =head1 NAME
10              
11             Paws::DynamoDB::AttributeValueUpdate
12              
13             =head1 USAGE
14              
15             This class represents one of two things:
16              
17             =head3 Arguments in a call to a service
18              
19             Use the attributes of this class as arguments to methods. You shouldn't make instances of this class.
20             Each attribute should be used as a named argument in the calls that expect this type of object.
21              
22             As an example, if Att1 is expected to be a Paws::DynamoDB::AttributeValueUpdate object:
23              
24             $service_obj->Method(Att1 => { Action => $value, ..., Value => $value });
25              
26             =head3 Results returned from an API call
27              
28             Use accessors for each attribute. If Att1 is expected to be an Paws::DynamoDB::AttributeValueUpdate object:
29              
30             $result = $service_obj->Method(...);
31             $result->Att1->Action
32              
33             =head1 DESCRIPTION
34              
35             For the C<UpdateItem> operation, represents the attributes to be
36             modified, the action to perform on each, and the new value for each.
37              
38             You cannot use C<UpdateItem> to update any primary key attributes.
39             Instead, you will need to delete the item, and then use C<PutItem> to
40             create a new item with new attributes.
41              
42             Attribute values cannot be null; string and binary type attributes must
43             have lengths greater than zero; and set type attributes must not be
44             empty. Requests with empty values will be rejected with a
45             C<ValidationException> exception.
46              
47             =head1 ATTRIBUTES
48              
49              
50             =head2 Action => Str
51              
52             Specifies how to perform the update. Valid values are C<PUT> (default),
53             C<DELETE>, and C<ADD>. The behavior depends on whether the specified
54             primary key already exists in the table.
55              
56             B<If an item with the specified I<Key> is found in the table:>
57              
58             =over
59              
60             =item *
61              
62             C<PUT> - Adds the specified attribute to the item. If the attribute
63             already exists, it is replaced by the new value.
64              
65             =item *
66              
67             C<DELETE> - If no value is specified, the attribute and its value are
68             removed from the item. The data type of the specified value must match
69             the existing value's data type.
70              
71             If a I<set> of values is specified, then those values are subtracted
72             from the old set. For example, if the attribute value was the set
73             C<[a,b,c]> and the C<DELETE> action specified C<[a,c]>, then the final
74             attribute value would be C<[b]>. Specifying an empty set is an error.
75              
76             =item *
77              
78             C<ADD> - If the attribute does not already exist, then the attribute
79             and its values are added to the item. If the attribute does exist, then
80             the behavior of C<ADD> depends on the data type of the attribute:
81              
82             =over
83              
84             =item *
85              
86             If the existing attribute is a number, and if C<Value> is also a
87             number, then the C<Value> is mathematically added to the existing
88             attribute. If C<Value> is a negative number, then it is subtracted from
89             the existing attribute.
90              
91             If you use C<ADD> to increment or decrement a number value for an item
92             that doesn't exist before the update, DynamoDB uses 0 as the initial
93             value.
94              
95             In addition, if you use C<ADD> to update an existing item, and intend
96             to increment or decrement an attribute value which does not yet exist,
97             DynamoDB uses C<0> as the initial value. For example, suppose that the
98             item you want to update does not yet have an attribute named
99             I<itemcount>, but you decide to C<ADD> the number C<3> to this
100             attribute anyway, even though it currently does not exist. DynamoDB
101             will create the I<itemcount> attribute, set its initial value to C<0>,
102             and finally add C<3> to it. The result will be a new I<itemcount>
103             attribute in the item, with a value of C<3>.
104              
105             =item *
106              
107             If the existing data type is a set, and if the C<Value> is also a set,
108             then the C<Value> is added to the existing set. (This is a I<set>
109             operation, not mathematical addition.) For example, if the attribute
110             value was the set C<[1,2]>, and the C<ADD> action specified C<[3]>,
111             then the final attribute value would be C<[1,2,3]>. An error occurs if
112             an Add action is specified for a set attribute and the attribute type
113             specified does not match the existing set type.
114              
115             Both sets must have the same primitive data type. For example, if the
116             existing data type is a set of strings, the C<Value> must also be a set
117             of strings. The same holds true for number sets and binary sets.
118              
119             =back
120              
121             This action is only valid for an existing attribute whose data type is
122             number or is a set. Do not use C<ADD> for any other data types.
123              
124             =back
125              
126             B<If no item with the specified I<Key> is found:>
127              
128             =over
129              
130             =item *
131              
132             C<PUT> - DynamoDB creates a new item with the specified primary key,
133             and then adds the attribute.
134              
135             =item *
136              
137             C<DELETE> - Nothing happens; there is no attribute to delete.
138              
139             =item *
140              
141             C<ADD> - DynamoDB creates an item with the supplied primary key and
142             number (or set of numbers) for the attribute value. The only data types
143             allowed are number and number set; no other data types can be
144             specified.
145              
146             =back
147              
148              
149              
150             =head2 Value => L<Paws::DynamoDB::AttributeValue>
151              
152             Represents the data for an attribute.
153              
154             Each attribute value is described as a name-value pair. The name is the
155             data type, and the value is the data itself.
156              
157             For more information, see Data TYpes in the I<Amazon DynamoDB Developer
158             Guide>.
159              
160              
161              
162             =head1 SEE ALSO
163              
164             This class forms part of L<Paws>, describing an object used in L<Paws::DynamoDB>
165              
166             =head1 BUGS and CONTRIBUTIONS
167              
168             The source code is located here: https://github.com/pplu/aws-sdk-perl
169              
170             Please report bugs to: https://github.com/pplu/aws-sdk-perl/issues
171              
172             =cut
173