registerEcsCluster method

Future<RegisterEcsClusterResult> registerEcsCluster({
  1. required String ecsClusterArn,
  2. required String stackId,
})

Registers a specified Amazon ECS cluster with a stack. You can register only one cluster with a stack. A cluster can be registered with only one stack. 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 ecsClusterArn : The cluster's ARN.

Parameter stackId : The stack ID.

Implementation

Future<RegisterEcsClusterResult> registerEcsCluster({
  required String ecsClusterArn,
  required String stackId,
}) async {
  ArgumentError.checkNotNull(ecsClusterArn, 'ecsClusterArn');
  ArgumentError.checkNotNull(stackId, 'stackId');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'OpsWorks_20130218.RegisterEcsCluster'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'EcsClusterArn': ecsClusterArn,
      'StackId': stackId,
    },
  );

  return RegisterEcsClusterResult.fromJson(jsonResponse.body);
}