enableAddOn method

Future<EnableAddOnResult> enableAddOn({
  1. required AddOnRequest addOnRequest,
  2. required String resourceName,
})

Enables or modifies an add-on for an Amazon Lightsail resource. For more information, see the Lightsail Dev Guide.

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

Parameter addOnRequest : An array of strings representing the add-on to enable or modify.

Parameter resourceName : The name of the source resource for which to enable or modify the add-on.

Implementation

Future<EnableAddOnResult> enableAddOn({
  required AddOnRequest addOnRequest,
  required String resourceName,
}) async {
  ArgumentError.checkNotNull(addOnRequest, 'addOnRequest');
  ArgumentError.checkNotNull(resourceName, 'resourceName');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Lightsail_20161128.EnableAddOn'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'addOnRequest': addOnRequest,
      'resourceName': resourceName,
    },
  );

  return EnableAddOnResult.fromJson(jsonResponse.body);
}