attachElasticLoadBalancer method

Future<void> attachElasticLoadBalancer({
  1. required String elasticLoadBalancerName,
  2. required String layerId,
})

Attaches an Elastic Load Balancing load balancer to a specified layer. AWS OpsWorks Stacks does not support Application Load Balancer. You can only use Classic Load Balancer with AWS OpsWorks Stacks. For more information, see Elastic Load Balancing. 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 elasticLoadBalancerName : The Elastic Load Balancing instance's name.

Parameter layerId : The ID of the layer to which the Elastic Load Balancing instance is to be attached.

Implementation

Future<void> attachElasticLoadBalancer({
  required String elasticLoadBalancerName,
  required String layerId,
}) async {
  ArgumentError.checkNotNull(
      elasticLoadBalancerName, 'elasticLoadBalancerName');
  ArgumentError.checkNotNull(layerId, 'layerId');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'OpsWorks_20130218.AttachElasticLoadBalancer'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ElasticLoadBalancerName': elasticLoadBalancerName,
      'LayerId': layerId,
    },
  );
}