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