associateElasticIp method
Associates one of the stack's registered Elastic IP addresses with a specified instance. The address must first be registered with the stack by calling RegisterElasticIp. For more information, see Resource Management.
Required Permissions: To use this action, an IAM user must have a Manage permissions level for the stack, or an attached policy that explicitly grants permissions. For more information on user permissions, see Managing User Permissions.
May throw ValidationException. May throw ResourceNotFoundException.
Parameter elasticIp
:
The Elastic IP address.
Parameter instanceId
:
The instance ID.
Implementation
Future<void> associateElasticIp({
required String elasticIp,
String? instanceId,
}) async {
ArgumentError.checkNotNull(elasticIp, 'elasticIp');
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'OpsWorks_20130218.AssociateElasticIp'
};
await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ElasticIp': elasticIp,
if (instanceId != null) 'InstanceId': instanceId,
},
);
}