putInventory method

Future<PutInventoryResult> putInventory({
  1. required String instanceId,
  2. required List<InventoryItem> items,
})

Bulk update custom inventory items on one more instance. The request adds an inventory item, if it doesn't already exist, or updates an inventory item, if it does exist.

May throw InternalServerError. May throw InvalidInstanceId. May throw InvalidTypeNameException. May throw InvalidItemContentException. May throw TotalSizeLimitExceededException. May throw ItemSizeLimitExceededException. May throw ItemContentMismatchException. May throw CustomSchemaCountLimitExceededException. May throw UnsupportedInventorySchemaVersionException. May throw UnsupportedInventoryItemContextException. May throw InvalidInventoryItemContextException. May throw SubTypeCountLimitExceededException.

Parameter instanceId : An instance ID where you want to add or update inventory items.

Parameter items : The inventory items that you want to add or update on instances.

Implementation

Future<PutInventoryResult> putInventory({
  required String instanceId,
  required List<InventoryItem> items,
}) async {
  ArgumentError.checkNotNull(instanceId, 'instanceId');
  ArgumentError.checkNotNull(items, 'items');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonSSM.PutInventory'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'InstanceId': instanceId,
      'Items': items,
    },
  );

  return PutInventoryResult.fromJson(jsonResponse.body);
}