attachStaticIp method

Future<AttachStaticIpResult> attachStaticIp({
  1. required String instanceName,
  2. required String staticIpName,
})

Attaches a static IP address to a specific Amazon Lightsail instance.

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

Parameter instanceName : The instance name to which you want to attach the static IP address.

Parameter staticIpName : The name of the static IP.

Implementation

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

  return AttachStaticIpResult.fromJson(jsonResponse.body);
}