disassociateNode method

Future<DisassociateNodeResponse> disassociateNode({
  1. required String nodeName,
  2. required String serverName,
  3. List<EngineAttribute>? engineAttributes,
})

Disassociates a node from an AWS OpsWorks CM server, and removes the node from the server's managed nodes. After a node is disassociated, the node key pair is no longer valid for accessing the configuration manager's API. For more information about how to associate a node, see AssociateNode.

A node can can only be disassociated from a server that is in a HEALTHY state. Otherwise, an InvalidStateException is thrown. A ResourceNotFoundException is thrown when the server does not exist. A ValidationException is raised when parameters of the request are not valid.

May throw InvalidStateException. May throw ResourceNotFoundException. May throw ValidationException.

Parameter nodeName : The name of the client node.

Parameter serverName : The name of the server from which to disassociate the node.

Parameter engineAttributes : Engine attributes that are used for disassociating the node. No attributes are required for Puppet.

Attributes required in a DisassociateNode request for Chef

  • CHEF_ORGANIZATION: The Chef organization with which the node was associated. By default only one organization named default can exist.

Implementation

Future<DisassociateNodeResponse> disassociateNode({
  required String nodeName,
  required String serverName,
  List<EngineAttribute>? engineAttributes,
}) async {
  ArgumentError.checkNotNull(nodeName, 'nodeName');
  _s.validateStringLength(
    'nodeName',
    nodeName,
    0,
    10000,
    isRequired: true,
  );
  ArgumentError.checkNotNull(serverName, 'serverName');
  _s.validateStringLength(
    'serverName',
    serverName,
    1,
    40,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'OpsWorksCM_V2016_11_01.DisassociateNode'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'NodeName': nodeName,
      'ServerName': serverName,
      if (engineAttributes != null) 'EngineAttributes': engineAttributes,
    },
  );

  return DisassociateNodeResponse.fromJson(jsonResponse.body);
}