getRelationalDatabaseMasterUserPassword method

Future<GetRelationalDatabaseMasterUserPasswordResult> getRelationalDatabaseMasterUserPassword({
  1. required String relationalDatabaseName,
  2. RelationalDatabasePasswordVersion? passwordVersion,
})

Returns the current, previous, or pending versions of the master user password for a Lightsail database.

The GetRelationalDatabaseMasterUserPassword operation supports tag-based access control via resource tags applied to the resource identified by relationalDatabaseName.

May throw ServiceException. May throw InvalidInputException. May throw NotFoundException. May throw OperationFailureException. May throw AccessDeniedException. May throw AccountSetupInProgressException. May throw UnauthenticatedException.

Parameter relationalDatabaseName : The name of your database for which to get the master user password.

Parameter passwordVersion : The password version to return.

Specifying CURRENT or PREVIOUS returns the current or previous passwords respectively. Specifying PENDING returns the newest version of the password that will rotate to CURRENT. After the PENDING password rotates to CURRENT, the PENDING password is no longer available.

Default: CURRENT

Implementation

Future<GetRelationalDatabaseMasterUserPasswordResult>
    getRelationalDatabaseMasterUserPassword({
  required String relationalDatabaseName,
  RelationalDatabasePasswordVersion? passwordVersion,
}) async {
  ArgumentError.checkNotNull(
      relationalDatabaseName, 'relationalDatabaseName');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'Lightsail_20161128.GetRelationalDatabaseMasterUserPassword'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'relationalDatabaseName': relationalDatabaseName,
      if (passwordVersion != null)
        'passwordVersion': passwordVersion.toValue(),
    },
  );

  return GetRelationalDatabaseMasterUserPasswordResult.fromJson(
      jsonResponse.body);
}