getContactMethods method

Future<GetContactMethodsResult> getContactMethods({
  1. List<ContactProtocol>? protocols,
})

Returns information about the configured contact methods. Specify a protocol in your request to return information about a specific contact method.

A contact method is used to send you notifications about your Amazon Lightsail resources. You can add one email address and one mobile phone number contact method in each AWS Region. However, SMS text messaging is not supported in some AWS Regions, and SMS text messages cannot be sent to some countries/regions. For more information, see Notifications in Amazon Lightsail.

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

Parameter protocols : The protocols used to send notifications, such as Email, or SMS (text messaging).

Specify a protocol in your request to return information about a specific contact method protocol.

Implementation

Future<GetContactMethodsResult> getContactMethods({
  List<ContactProtocol>? protocols,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Lightsail_20161128.GetContactMethods'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (protocols != null)
        'protocols': protocols.map((e) => e.toValue()).toList(),
    },
  );

  return GetContactMethodsResult.fromJson(jsonResponse.body);
}