« blib/lib/Paws/SecretsManager/PutResourcePolicyResponse.pm
↑ Summary
blib/lib/Paws/SecretsManager/PutSecretValueResponse.pm »
| 1 | |||
| 2 | package Paws::SecretsManager::PutSecretValue; | ||
| 3 | use Moose; | ||
| 4 | has ClientRequestToken => (is => 'ro', isa => 'Str'); | ||
| 5 | has SecretBinary => (is => 'ro', isa => 'Str'); | ||
| 6 | has SecretId => (is => 'ro', isa => 'Str', required => 1); | ||
| 7 | has SecretString => (is => 'ro', isa => 'Str'); | ||
| 8 | has VersionStages => (is => 'ro', isa => 'ArrayRef[Str|Undef]'); | ||
| 9 | |||
| 10 | use MooseX::ClassAttribute; | ||
| 11 | |||
| 12 | class_has _api_call => (isa => 'Str', is => 'ro', default => 'PutSecretValue'); | ||
| 13 | class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::SecretsManager::PutSecretValueResponse'); | ||
| 14 | class_has _result_key => (isa => 'Str', is => 'ro'); | ||
| 15 | 1; | ||
| 16 | |||
| 17 | ### main pod documentation begin ### | ||
| 18 | |||
| 19 | =head1 NAME | ||
| 20 | |||
| 21 | Paws::SecretsManager::PutSecretValue - Arguments for method PutSecretValue on L<Paws::SecretsManager> | ||
| 22 | |||
| 23 | =head1 DESCRIPTION | ||
| 24 | |||
| 25 | This class represents the parameters used for calling the method PutSecretValue on the | ||
| 26 | L<AWS Secrets Manager|Paws::SecretsManager> service. Use the attributes of this class | ||
| 27 | as arguments to method PutSecretValue. | ||
| 28 | |||
| 29 | You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to PutSecretValue. | ||
| 30 | |||
| 31 | =head1 SYNOPSIS | ||
| 32 | |||
| 33 | my $secretsmanager = Paws->service('SecretsManager'); | ||
| 34 | # To store a secret value in a new version of a secret | ||
| 35 | # The following example shows how to create a new version of the secret. | ||
| 36 | # Alternatively, you can use the update-secret command. | ||
| 37 | my $PutSecretValueResponse = $secretsmanager->PutSecretValue( | ||
| 38 | 'ClientRequestToken' => 'EXAMPLE2-90ab-cdef-fedc-ba987EXAMPLE', | ||
| 39 | 'SecretId' => 'MyTestDatabaseSecret', | ||
| 40 | 'SecretString' => '{"username":"david","password":"BnQw!XDWgaEeT9XGTT29"}' | ||
| 41 | ); | ||
| 42 | |||
| 43 | # Results: | ||
| 44 | my $ARN = $PutSecretValueResponse->ARN; | ||
| 45 | my $Name = $PutSecretValueResponse->Name; | ||
| 46 | my $VersionId = $PutSecretValueResponse->VersionId; | ||
| 47 | my $VersionStages = $PutSecretValueResponse->VersionStages; | ||
| 48 | |||
| 49 | # Returns a L<Paws::SecretsManager::PutSecretValueResponse> object. | ||
| 50 | |||
| 51 | 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. | ||
| 52 | For the AWS API documentation, see L<https://docs.aws.amazon.com/goto/WebAPI/secretsmanager/PutSecretValue> | ||
| 53 | |||
| 54 | =head1 ATTRIBUTES | ||
| 55 | |||
| 56 | |||
| 57 | =head2 ClientRequestToken => Str | ||
| 58 | |||
| 59 | (Optional) Specifies a unique identifier for the new version of the | ||
| 60 | secret. | ||
| 61 | |||
| 62 | If you use the AWS CLI or one of the AWS SDK to call this operation, | ||
| 63 | then you can leave this parameter empty. The CLI or SDK generates a | ||
| 64 | random UUID for you and includes that in the request. If you don't use | ||
| 65 | the SDK and instead generate a raw HTTP request to the Secrets Manager | ||
| 66 | service endpoint, then you must generate a C<ClientRequestToken> | ||
| 67 | yourself for new versions and include that value in the request. | ||
| 68 | |||
| 69 | This value helps ensure idempotency. Secrets Manager uses this value to | ||
| 70 | prevent the accidental creation of duplicate versions if there are | ||
| 71 | failures and retries during the Lambda rotation function's processing. | ||
| 72 | We recommend that you generate a UUID-type | ||
| 73 | (https://wikipedia.org/wiki/Universally_unique_identifier) value to | ||
| 74 | ensure uniqueness within the specified secret. | ||
| 75 | |||
| 76 | =over | ||
| 77 | |||
| 78 | =item * | ||
| 79 | |||
| 80 | If the C<ClientRequestToken> value isn't already associated with a | ||
| 81 | version of the secret then a new version of the secret is created. | ||
| 82 | |||
| 83 | =item * | ||
| 84 | |||
| 85 | If a version with this value already exists and that version's | ||
| 86 | C<SecretString> or C<SecretBinary> values are the same as those in the | ||
| 87 | request then the request is ignored (the operation is idempotent). | ||
| 88 | |||
| 89 | =item * | ||
| 90 | |||
| 91 | If a version with this value already exists and the version of the | ||
| 92 | C<SecretString> and C<SecretBinary> values are different from those in | ||
| 93 | the request then the request fails because you cannot modify an | ||
| 94 | existing secret version. You can only create new versions to store new | ||
| 95 | secret values. | ||
| 96 | |||
| 97 | =back | ||
| 98 | |||
| 99 | This value becomes the C<VersionId> of the new version. | ||
| 100 | |||
| 101 | |||
| 102 | |||
| 103 | =head2 SecretBinary => Str | ||
| 104 | |||
| 105 | (Optional) Specifies binary data that you want to encrypt and store in | ||
| 106 | the new version of the secret. To use this parameter in the | ||
| 107 | command-line tools, we recommend that you store your binary data in a | ||
| 108 | file and then use the appropriate technique for your tool to pass the | ||
| 109 | contents of the file as a parameter. Either C<SecretBinary> or | ||
| 110 | C<SecretString> must have a value, but not both. They cannot both be | ||
| 111 | empty. | ||
| 112 | |||
| 113 | This parameter is not accessible if the secret using the Secrets | ||
| 114 | Manager console. | ||
| 115 | |||
| 116 | |||
| 117 | |||
| 118 | =head2 B<REQUIRED> SecretId => Str | ||
| 119 | |||
| 120 | Specifies the secret to which you want to add a new version. You can | ||
| 121 | specify either the Amazon Resource Name (ARN) or the friendly name of | ||
| 122 | the secret. The secret must already exist. | ||
| 123 | |||
| 124 | If you specify an ARN, we generally recommend that you specify a | ||
| 125 | complete ARN. You can specify a partial ARN tooE<mdash>for example, if | ||
| 126 | you donE<rsquo>t include the final hyphen and six random characters | ||
| 127 | that Secrets Manager adds at the end of the ARN when you created the | ||
| 128 | secret. A partial ARN match can work as long as it uniquely matches | ||
| 129 | only one secret. However, if your secret has a name that ends in a | ||
| 130 | hyphen followed by six characters (before Secrets Manager adds the | ||
| 131 | hyphen and six characters to the ARN) and you try to use that as a | ||
| 132 | partial ARN, then those characters cause Secrets Manager to assume that | ||
| 133 | youE<rsquo>re specifying a complete ARN. This confusion can cause | ||
| 134 | unexpected results. To avoid this situation, we recommend that you | ||
| 135 | donE<rsquo>t create secret names ending with a hyphen followed by six | ||
| 136 | characters. | ||
| 137 | |||
| 138 | If you specify an incomplete ARN without the random suffix, and instead | ||
| 139 | provide the 'friendly name', you I<must> not include the random suffix. | ||
| 140 | If you do include the random suffix added by Secrets Manager, you | ||
| 141 | receive either a I<ResourceNotFoundException> or an | ||
| 142 | I<AccessDeniedException> error, depending on your permissions. | ||
| 143 | |||
| 144 | |||
| 145 | |||
| 146 | =head2 SecretString => Str | ||
| 147 | |||
| 148 | (Optional) Specifies text data that you want to encrypt and store in | ||
| 149 | this new version of the secret. Either C<SecretString> or | ||
| 150 | C<SecretBinary> must have a value, but not both. They cannot both be | ||
| 151 | empty. | ||
| 152 | |||
| 153 | If you create this secret by using the Secrets Manager console then | ||
| 154 | Secrets Manager puts the protected secret text in only the | ||
| 155 | C<SecretString> parameter. The Secrets Manager console stores the | ||
| 156 | information as a JSON structure of key/value pairs that the default | ||
| 157 | Lambda rotation function knows how to parse. | ||
| 158 | |||
| 159 | For storing multiple values, we recommend that you use a JSON text | ||
| 160 | string argument and specify key/value pairs. For information on how to | ||
| 161 | format a JSON parameter for the various command line tool environments, | ||
| 162 | see Using JSON for Parameters | ||
| 163 | (https://docs.aws.amazon.com/cli/latest/userguide/cli-using-param.html#cli-using-param-json) | ||
| 164 | in the I<AWS CLI User Guide>. | ||
| 165 | |||
| 166 | For example: | ||
| 167 | |||
| 168 | C<[{"username":"bob"},{"password":"abc123xyz456"}]> | ||
| 169 | |||
| 170 | If your command-line tool or SDK requires quotation marks around the | ||
| 171 | parameter, you should use single quotes to avoid confusion with the | ||
| 172 | double quotes required in the JSON text. | ||
| 173 | |||
| 174 | |||
| 175 | |||
| 176 | =head2 VersionStages => ArrayRef[Str|Undef] | ||
| 177 | |||
| 178 | (Optional) Specifies a list of staging labels that are attached to this | ||
| 179 | version of the secret. These staging labels are used to track the | ||
| 180 | versions through the rotation process by the Lambda rotation function. | ||
| 181 | |||
| 182 | A staging label must be unique to a single version of the secret. If | ||
| 183 | you specify a staging label that's already associated with a different | ||
| 184 | version of the same secret then that staging label is automatically | ||
| 185 | removed from the other version and attached to this version. | ||
| 186 | |||
| 187 | If you do not specify a value for C<VersionStages> then Secrets Manager | ||
| 188 | automatically moves the staging label C<AWSCURRENT> to this new | ||
| 189 | version. | ||
| 190 | |||
| 191 | |||
| 192 | |||
| 193 | |||
| 194 | =head1 SEE ALSO | ||
| 195 | |||
| 196 | This class forms part of L<Paws>, documenting arguments for method PutSecretValue in L<Paws::SecretsManager> | ||
| 197 | |||
| 198 | =head1 BUGS and CONTRIBUTIONS | ||
| 199 | |||
| 200 | The source code is located here: L<https://github.com/pplu/aws-sdk-perl> | ||
| 201 | |||
| 202 | Please report bugs to: L<https://github.com/pplu/aws-sdk-perl/issues> | ||
| 203 | |||
| 204 | =cut | ||
| 205 |