updateServerEngineAttributes method

Future<UpdateServerEngineAttributesResponse> updateServerEngineAttributes({
  1. required String attributeName,
  2. required String serverName,
  3. String? attributeValue,
})

Updates engine-specific attributes on a specified server. The server enters the MODIFYING state when this operation is in progress. Only one update can occur at a time. You can use this command to reset a Chef server's public key (CHEF_PIVOTAL_KEY) or a Puppet server's admin password (PUPPET_ADMIN_PASSWORD).

This operation is asynchronous.

This operation can only be called for servers in HEALTHY or UNHEALTHY states. Otherwise, an InvalidStateException is raised. 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 attributeName : The name of the engine attribute to update.

Parameter serverName : The name of the server to update.

Parameter attributeValue : The value to set for the attribute.

Implementation

Future<UpdateServerEngineAttributesResponse> updateServerEngineAttributes({
  required String attributeName,
  required String serverName,
  String? attributeValue,
}) async {
  ArgumentError.checkNotNull(attributeName, 'attributeName');
  _s.validateStringLength(
    'attributeName',
    attributeName,
    1,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(serverName, 'serverName');
  _s.validateStringLength(
    'serverName',
    serverName,
    1,
    40,
    isRequired: true,
  );
  _s.validateStringLength(
    'attributeValue',
    attributeValue,
    0,
    10000,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'OpsWorksCM_V2016_11_01.UpdateServerEngineAttributes'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AttributeName': attributeName,
      'ServerName': serverName,
      if (attributeValue != null) 'AttributeValue': attributeValue,
    },
  );

  return UpdateServerEngineAttributesResponse.fromJson(jsonResponse.body);
}